Loading...
Loading...
MANDATORY before starting any task. Enforces the GPA execution loop that prevents tool call sprawl. G: GATHER phase combines discover queries + memory reads + file reads into one phase. P: Plan in text with zero tool calls. A: APPLY all writes/edits/verification in one phase. One call per tool type per phase — batch all same-type operations together. Covers dependency analysis, batch opportunities, scope estimation, and loop-back triggers.
npx skill4agent add mgd34msu/goodvibes-plugin gather-plan-applyscripts/
validate-gpa-compliance.sh
references/
examples-and-checklists.md0. LOAD SKILLS (once, before any GPA cycle)
- Call get_skill_content for role-relevant skills
- This is NOT part of the GPA cycle itself
1. G — GATHER (1-2 tool calls)
- Check .goodvibes/memory/ files FIRST (failures, patterns, decisions)
- Single `discover` call with ALL queries batched inside
- Multiple query types (glob, grep, symbols, structural) in one call
- Can search file content via grep/symbols queries
- Batch any file reads that need full content alongside discover
- Output: files_only or locations (minimal verbosity)
2. P — PLAN (0 tool calls, cognitive only)
- Agent thinks about what it learned from GATHER
- Plans which files to create/write/edit
- Plans which commands to run for validation
- Identifies ALL batch opportunities — same-type ops go in one call
- Plans the EXACT apply call structure
3. A — APPLY (1-2 tool calls)
- Writes and edits batched into one precision_write or precision_edit call
- Validation commands batched into one precision_exec call
- Key: one call per tool type, everything batched inside it
4. LOOP — Back to G if:
- Results didn't match expectations
- Scope changed
- Validation failed| Phase | Tool Calls | Type | Purpose |
|---|---|---|---|
| G (Gather) | 1-2 | | All discovery + memory reads |
| P (Plan) | 0 | Cognitive | Plan apply operations |
| A (Apply) | 1-2 | | All writes/edits + validation |
| TOTAL | 2-4 |
precision_readdiscoverprecision_globprecision_grepprecision_read# GOOD: Memory reads batched with file content reads
precision_read:
files:
- path: ".goodvibes/memory/failures.json"
- path: ".goodvibes/memory/patterns.json"
- path: ".goodvibes/memory/decisions.json"
verbosity: minimaldiscoverdiscover# GOOD: 1 discover call with everything
discover:
queries:
- id: existing_files
type: glob
patterns: ["src/features/auth/**/*.ts"]
- id: existing_patterns
type: grep
pattern: "export (function|const|class)"
glob: "src/features/**/*.ts"
- id: exported_hooks
type: symbols
query: "use"
kinds: ["function"]
- id: console_logs
type: structural
structural_pattern: "console.log($$$ARGS)"
verbosity: files_onlycount_onlyfiles_onlylocationsprecision_read# BAD: 4 separate tool calls for discovery
precision_glob:
patterns: ["src/**/*.ts"]
precision_grep:
queries:
- id: exports
pattern: "export function"
precision_read:
files:
- path: ".goodvibes/memory/failures.json"
precision_grep:
queries:
- id: imports
pattern: "import.*from"# GOOD: 1 discover call with all queries
discover:
queries:
- id: files
type: glob
patterns: ["src/**/*.ts"]
- id: exports
type: grep
pattern: "export function"
glob: "src/**/*.ts"
- id: imports
type: grep
pattern: "import.*from"
glob: "src/**/*.ts"
verbosity: files_only
# GOOD: Memory reads in one batched call
precision_read:
files:
- path: ".goodvibes/memory/failures.json"
- path: ".goodvibes/memory/patterns.json"
- path: ".goodvibes/memory/decisions.json"
verbosity: minimalPlan:
1. Create the following files:
- src/features/auth/types.ts — User interface
- src/features/auth/hooks.ts — useAuth hook
- src/features/auth/index.ts — barrel export
2. Edit the following files:
- src/app/layout.tsx — wrap App with AuthProvider
3. Validate:
- npm run typecheck (expect exit 0)
- npm run lint (expect exit 0)
4. Batch plan:
- Call 1 (Apply): precision_write with 3 files + precision_edit with 1 edit
- Call 2 (Apply): precision_exec with 2 commandsPlan:
- Create some files
- Maybe edit layout
- Run typecheckprecision_write: ... # 1st call
precision_write: ... # 2nd call! (should be batched)
precision_edit: ... # 3rd call! (could combine with above pattern)Plan:
1. Write 3 files in 1 precision_write call:
- src/features/auth/types.ts (symbols)
- src/features/auth/hooks.ts (content)
- src/features/auth/index.ts (content)
2. Edit 1 file in 1 precision_edit call:
- src/app/layout.tsx — wrap with AuthProvider
3. Validate in 1 precision_exec call:
- npm run typecheck
- npm run lintprecision_write:
files:
- path: "src/features/auth/types.ts"
content: |
export interface User {
id: string;
email: string;
}
- path: "src/features/auth/hooks.ts"
content: |
import type { User } from './types';
export function useAuth(): User | null { /*...*/ }
- path: "src/features/auth/index.ts"
content: |
export * from './types';
export * from './hooks';
verbosity: count_onlyprecision_edit:
edits:
- path: "src/app/layout.tsx"
find: "<App />"
replace: "<AuthProvider><App /></AuthProvider>"
- path: "src/middleware.ts"
find: "export const config = {}"
replace: "export const config = { matcher: ['/dashboard/:path*'] }"
- path: "src/lib/api.ts"
find: "headers: {}"
replace: "headers: { Authorization: `Bearer ${token}` }"
verbosity: minimalprecision_exec:
commands:
- cmd: "npm run typecheck"
expect:
exit_code: 0
- cmd: "npm run lint"
expect:
exit_code: 0
verbosity: minimalprecision_write:
files:
- path: "file1.ts"
content: "..."
precision_write: # Second call!
files:
- path: "file2.ts"
content: "..."
precision_write: # Third call!
files:
- path: "file3.ts"
content: "..."precision_write:
files:
- path: "file1.ts"
content: "..."
- path: "file2.ts"
content: "..."
- path: "file3.ts"
content: "..."
verbosity: count_only# Initial GPA cycle
discover: ... # Gather call 1
precision_read: ... # Gather call 2 (memory + key files)
precision_write: ... # Apply call 1
precision_exec: ... # Apply call 2 — FAILS typecheck
# LOOP: Start new GPA cycle with refined discovery
discover: # Gather call 1 (new cycle)
queries:
- id: find_missing_import
type: grep
pattern: "export.*User"
glob: "src/**/*.ts"
verbosity: locations # Need exact location
precision_edit: ... # Apply call 1 (new cycle) - fix the issue
precision_exec: ... # Apply call 2 (new cycle) - re-validate# Call 1: Check memory
precision_read:
files:
- path: ".goodvibes/memory/failures.json"
- path: ".goodvibes/memory/decisions.json"
verbosity: minimal
# Call 2: Discover landscape
discover:
queries:
- id: existing_auth
type: glob
patterns: ["src/features/auth/**/*.ts", "src/**/auth*.ts"]
- id: auth_patterns
type: grep
pattern: "(useAuth|getSession|AuthProvider)"
glob: "src/**/*.{ts,tsx}"
- id: user_types
type: symbols
query: "User"
kinds: ["interface", "type"]
verbosity: files_onlyGather results:
- No memory failures for auth
- No existing auth files
- No auth patterns in use
- User type exists in src/types/user.ts
Plan:
Apply Call 1 (precision_write): Create 3 auth files
Apply Call 2 (precision_exec): typecheck + lint# Call 1: Create files
precision_write:
files:
- path: "src/features/auth/provider.tsx"
content: |
import { ClerkProvider } from '@clerk/nextjs';
export function AuthProvider({ children }: { children: React.ReactNode }) {
return <ClerkProvider>{children}</ClerkProvider>;
}
- path: "src/features/auth/hooks.ts"
content: |
import { useUser } from '@clerk/nextjs';
import type { User } from '@/types/user';
export function useAuth(): User | null {
const { user } = useUser();
if (!user) return null;
return { id: user.id, email: user.emailAddresses[0].emailAddress, name: user.fullName };
}
- path: "src/features/auth/index.ts"
content: |
export { AuthProvider } from './provider';
export { useAuth } from './hooks';
verbosity: count_only
# Call 2: Validate
precision_exec:
commands:
- cmd: "npm run typecheck"
expect:
exit_code: 0
- cmd: "npm run lint"
expect:
exit_code: 0
verbosity: minimal
# Result: typecheck FAILS — missing @clerk/nextjsdiscover:
queries:
- id: package_json
type: glob
patterns: ["package.json"]
- id: clerk_usage
type: grep
pattern: "@clerk/nextjs"
glob: "src/**/*.{ts,tsx}"
verbosity: files_onlyDiscovery: @clerk/nextjs not in package.json
Plan:
Apply Call 1 (precision_exec): npm install @clerk/nextjs, then typecheckprecision_exec:
commands:
- cmd: "npm install @clerk/nextjs"
- cmd: "npm run typecheck"
expect:
exit_code: 0
verbosity: minimal
# Result: PASSES| Violation | Tool Calls | Fix |
|---|---|---|
| Sequential precision_read calls | 5+ | Batch all files into 1 precision_read call |
| Sequential precision_write calls | 5+ | Batch all files into 1 precision_write call |
| Using precision_glob + precision_grep separately | 2+ | Use 1 discover call with both query types |
| Reading outline, then content | 2 | Read content once if you'll need it |
| Planning via tool calls | 1+ | Plan in text (cognitive work = 0 calls) |
| Memory reads skipped | - | Always check .goodvibes/memory/ in Gather phase |
discoverprecision_readdiscoverprecision_readprecision_writeprecision_editprecision_exec