opencodekit 0.17.0 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/template/.opencode/AGENT_ALIGNMENT.md +564 -0
  3. package/dist/template/.opencode/agent/build.md +140 -0
  4. package/dist/template/.opencode/agent/general.md +89 -0
  5. package/dist/template/.opencode/agent/plan.md +175 -0
  6. package/dist/template/.opencode/agent/review.md +96 -0
  7. package/dist/template/.opencode/command/create.md +57 -15
  8. package/dist/template/.opencode/command/init-context.md +259 -0
  9. package/dist/template/.opencode/command/init-user.md +103 -0
  10. package/dist/template/.opencode/command/init.md +53 -39
  11. package/dist/template/.opencode/command/plan.md +200 -16
  12. package/dist/template/.opencode/command/ship.md +251 -17
  13. package/dist/template/.opencode/command/start.md +35 -4
  14. package/dist/template/.opencode/dcp.jsonc +80 -80
  15. package/dist/template/.opencode/memory/_templates/PROJECT.md +58 -0
  16. package/dist/template/.opencode/memory/_templates/ROADMAP.md +93 -0
  17. package/dist/template/.opencode/memory/_templates/STATE.md +89 -0
  18. package/dist/template/.opencode/memory/_templates/tech-stack.md +35 -0
  19. package/dist/template/.opencode/memory/project/project.md +92 -0
  20. package/dist/template/.opencode/memory/project/roadmap.md +142 -0
  21. package/dist/template/.opencode/memory/project/state.md +84 -0
  22. package/dist/template/.opencode/opencode.json +1030 -1104
  23. package/dist/template/.opencode/package.json +1 -1
  24. package/dist/template/.opencode/skill/context-initialization/SKILL.md +60 -0
  25. package/dist/template/.opencode/skill/systematic-debugging/SKILL.md +76 -0
  26. package/dist/template/.opencode/skill/writing-plans/SKILL.md +68 -0
  27. package/package.json +1 -1
@@ -147,6 +147,146 @@ Load contextually when needed:
147
147
  - **Parallel** for 3+ independent, file-disjoint tasks using `task(...)`
148
148
  - Use `swarm({ op: "plan", ... })` when decomposition is unclear
149
149
 
150
+ ### Wave-Based Parallel Execution (GSD-Style)
151
+
152
+ When executing plans with multiple tasks, pre-compute execution waves:
153
+
154
+ ```
155
+ Wave 1: Independent tasks (no dependencies) → Run in parallel
156
+ Wave 2: Tasks depending only on Wave 1 → Run in parallel after Wave 1
157
+ Wave 3: Tasks depending on Wave 2 → And so on
158
+ ```
159
+
160
+ **Dependency analysis before execution:**
161
+
162
+ 1. For each task, identify `needs` (prerequisites) and `creates` (outputs)
163
+ 2. Build dependency graph
164
+ 3. Assign wave numbers: `wave = max(dependency.waves) + 1`
165
+ 4. Execute wave-by-wave, parallel within wave
166
+
167
+ ### Task Commit Protocol (Per-Task Commits)
168
+
169
+ After each task completes (verification passed):
170
+
171
+ 1. **Check modified files:** `git status --short`
172
+ 2. **Stage task-related files individually** (NEVER `git add .`):
173
+ ```bash
174
+ git add src/specific/file.ts
175
+ git add tests/file.test.ts
176
+ ```
177
+ 3. **Commit with descriptive message:**
178
+
179
+ ```bash
180
+ git commit -m "feat(bead-XX): [task description]
181
+
182
+ - [key change 1]
183
+ - [key change 2]"
184
+ ```
185
+
186
+ 4. **Record commit hash** for progress tracking
187
+
188
+ **Commit types:**
189
+ | Type | Use For |
190
+ |------|---------|
191
+ | `feat` | New feature, endpoint, component |
192
+ | `fix` | Bug fix, error correction |
193
+ | `test` | Test-only changes (TDD RED phase) |
194
+ | `refactor` | Code cleanup, no behavior change |
195
+ | `chore` | Config, tooling, dependencies |
196
+
197
+ ## Deviation Rules (Auto-Fix Without Permission)
198
+
199
+ While executing, you WILL discover work not in the plan. Apply these rules automatically:
200
+
201
+ **RULE 1: Auto-fix bugs** (broken behavior, errors, logic issues)
202
+
203
+ - Wrong queries, type errors, null pointer exceptions
204
+ - Fix inline → verify → continue task
205
+
206
+ **RULE 2: Auto-add missing critical functionality** (validation, auth, error handling)
207
+
208
+ - Missing input validation, no auth on protected routes
209
+ - No error handling, missing null checks
210
+ - These are correctness requirements, not features
211
+
212
+ **RULE 3: Auto-fix blocking issues** (missing deps, wrong types, broken imports)
213
+
214
+ - Missing dependency, wrong types, broken imports
215
+ - Missing env var, DB connection error
216
+ - Fix to unblock task completion
217
+
218
+ **RULE 4: ASK about architectural changes** (new tables, library switches, major refactors)
219
+
220
+ - New DB table (not column), major schema changes
221
+ - Switching libraries/frameworks, changing auth approach
222
+ - Breaking API changes, new infrastructure
223
+ - STOP → report to user with: what found, proposed change, impact
224
+
225
+ **Rule Priority:**
226
+
227
+ 1. Rule 4 applies → STOP (user decision required)
228
+ 2. Rules 1-3 apply → Fix automatically, track deviation
229
+ 3. Genuinely unsure → Treat as Rule 4 (ask)
230
+
231
+ ## Checkpoint Protocol
232
+
233
+ When plan has checkpoint tasks, follow this protocol:
234
+
235
+ **Checkpoint types:**
236
+ | Type | Use For | Action |
237
+ |------|---------|--------|
238
+ | `checkpoint:human-verify` | Visual/functional verification | Execute automation first, then pause for user |
239
+ | `checkpoint:decision` | Implementation choice | Present options, wait for selection |
240
+ | `checkpoint:human-action` | Unavoidable manual step | Request specific action, verification command |
241
+
242
+ **Automation-first rule:** If you CAN automate it (CLI/API), you MUST automate it. Checkpoints verify AFTER automation, not replace it.
243
+
244
+ **Checkpoint return format:**
245
+
246
+ ```markdown
247
+ ## CHECKPOINT REACHED
248
+
249
+ **Type:** [human-verify | decision | human-action]
250
+ **Progress:** X/Y tasks complete
251
+
252
+ ### Completed Tasks
253
+
254
+ | Task | Commit | Files |
255
+ | ---- | ------ | ------- |
256
+ | 1 | [hash] | [files] |
257
+
258
+ ### Current Task
259
+
260
+ **Task N:** [name]
261
+ **Blocked by:** [specific blocker]
262
+
263
+ ### Awaiting
264
+
265
+ [What user needs to do/provide]
266
+ ```
267
+
268
+ ## TDD Execution Flow
269
+
270
+ When executing TDD tasks, follow RED→GREEN→REFACTOR:
271
+
272
+ **RED Phase:**
273
+
274
+ 1. Create test file with failing test
275
+ 2. Run test → MUST fail
276
+ 3. Commit: `test(bead-XX): add failing test for [feature]`
277
+
278
+ **GREEN Phase:**
279
+
280
+ 1. Write minimal code to make test pass
281
+ 2. Run test → MUST pass
282
+ 3. Commit: `feat(bead-XX): implement [feature]`
283
+
284
+ **REFACTOR Phase:** (if needed)
285
+
286
+ 1. Clean up code
287
+ 2. Run tests → MUST still pass
288
+ 3. Commit only if changes: `refactor(bead-XX): clean up [feature]`
289
+
150
290
  ## Pressure Handling
151
291
 
152
292
  When constraints tighten:
@@ -55,6 +55,95 @@ Execute clear, low-complexity coding tasks quickly (typically 1-3 files) and rep
55
55
  - Keep changes minimal and in-scope
56
56
  - Ask before irreversible actions (commit, push, destructive ops)
57
57
 
58
+ ## Deviation Rules (Executor Autonomy)
59
+
60
+ As an executor subagent, you WILL discover issues not in your task spec. Apply these automatically:
61
+
62
+ **RULE 1: Auto-fix bugs** (broken behavior, errors, logic issues)
63
+
64
+ - Wrong queries, type errors, null pointer exceptions, logic errors
65
+ - **Action:** Fix inline → add test if applicable → verify → report deviation
66
+ - **No permission needed**
67
+
68
+ **RULE 2: Auto-add missing critical functionality** (validation, auth, error handling)
69
+
70
+ - Missing input validation, no auth on protected routes, no error handling
71
+ - Missing null checks, no CSRF/CORS, no rate limiting
72
+ - **Action:** Add minimal fix → verify → report as "[Rule 2] Added missing validation"
73
+ - **No permission needed**
74
+
75
+ **RULE 3: Auto-fix blocking issues** (missing deps, wrong types, broken imports)
76
+
77
+ - Missing dependency, wrong types, broken imports, missing env var
78
+ - **Action:** Fix to unblock task → verify → report deviation
79
+ - **No permission needed**
80
+
81
+ **RULE 4: STOP and report architectural changes** (new tables, library switches)
82
+
83
+ - New DB table, major schema changes, switching libraries/frameworks
84
+ - Breaking API changes, new infrastructure, new service layer
85
+ - **Action:** STOP → report to parent: "Found [issue] requiring architectural change. Proposed: [solution]. Impact: [scope]"
86
+ - **User decision required**
87
+
88
+ **Rule Priority:**
89
+
90
+ 1. Rule 4 applies → STOP and report
91
+ 2. Rules 1-3 apply → Fix automatically, document in output
92
+ 3. Genuinely unsure → Treat as Rule 4
93
+
94
+ ## TDD Execution (When Task Specifies TDD)
95
+
96
+ Follow strict RED→GREEN→REFACTOR:
97
+
98
+ **RED Phase:**
99
+
100
+ 1. Read task's `<behavior>` or test specification
101
+ 2. Create test file with failing test
102
+ 3. Run test → MUST fail (if passes, test is wrong)
103
+ 4. Commit: `test: add failing test for [feature]`
104
+
105
+ **GREEN Phase:**
106
+
107
+ 1. Write minimal code to pass test
108
+ 2. Run test → MUST pass
109
+ 3. Commit: `feat: implement [feature]`
110
+
111
+ **REFACTOR Phase:** (only if needed)
112
+
113
+ 1. Clean up code while keeping tests green
114
+ 2. Run tests → MUST still pass
115
+ 3. Commit if changes made: `refactor: clean up [feature]`
116
+
117
+ **TDD Verification:**
118
+
119
+ - Can you write `expect(fn(input)).toBe(output)` before writing `fn`?
120
+ - If YES → Use TDD flow above
121
+ - If NO → Standard implementation (UI layout, config, glue code)
122
+
123
+ ## Self-Check Before Reporting Complete
124
+
125
+ Before claiming task done:
126
+
127
+ 1. **Verify files exist:**
128
+
129
+ ```bash
130
+ [ -f "path/to/file" ] && echo "FOUND" || echo "MISSING"
131
+ ```
132
+
133
+ 2. **Verify tests pass:**
134
+
135
+ ```bash
136
+ [run test command]
137
+ ```
138
+
139
+ 3. **Check for obvious stubs:**
140
+ - Search for `TODO`, `FIXME`, `placeholder`, `return null`
141
+ - If found and NOT specified in task → fix or flag
142
+
143
+ 4. **Document deviations:**
144
+ - List any Rule 1-3 fixes applied
145
+ - Explain why each was needed
146
+
58
147
  ## Workflow
59
148
 
60
149
  1. Read relevant files
@@ -62,6 +62,181 @@ Planning follows a five-phase arc. Each phase has purpose; silence pockets allow
62
62
  | **Release** | Write the actionable plan | Exact file paths, specific commands, verification steps | Review: "Can a stranger execute this?" |
63
63
  | **Reset** | Handoff and checkpoint | Save to `.opencode/plans/`, update memory, recommend next command | Silent: "What was learned for next time?" |
64
64
 
65
+ ## Goal-Backward Methodology
66
+
67
+ **Forward planning:** "What should we build?" → produces tasks
68
+ **Goal-backward:** "What must be TRUE for the goal to be achieved?" → produces requirements tasks must satisfy
69
+
70
+ ### The Process
71
+
72
+ **Step 1: State the Goal**
73
+ Take goal from PRD. Must be outcome-shaped, not task-shaped.
74
+
75
+ - Good: "Working chat interface" (outcome)
76
+ - Bad: "Build chat components" (task)
77
+
78
+ **Step 2: Derive Observable Truths**
79
+ "What must be TRUE for this goal to be achieved?" List 3-7 truths from USER's perspective.
80
+
81
+ Example for "working chat interface":
82
+
83
+ - User can see existing messages
84
+ - User can type a new message
85
+ - User can send the message
86
+ - Sent message appears in the list
87
+ - Messages persist across page refresh
88
+
89
+ **Test:** Each truth verifiable by a human using the application.
90
+
91
+ **Step 3: Derive Required Artifacts**
92
+ For each truth: "What must EXIST for this to be true?"
93
+
94
+ "User can see existing messages" requires:
95
+
96
+ - Message list component (renders Message[])
97
+ - Messages state (loaded from somewhere)
98
+ - API route or data source (provides messages)
99
+ - Message type definition (shapes the data)
100
+
101
+ **Test:** Each artifact = a specific file or database object.
102
+
103
+ **Step 4: Derive Required Wiring**
104
+ For each artifact: "What must be CONNECTED for this to function?"
105
+
106
+ Message list component wiring:
107
+
108
+ - Imports Message type (not using `any`)
109
+ - Receives messages prop or fetches from API
110
+ - Maps over messages to render (not hardcoded)
111
+ - Handles empty state (not just crashes)
112
+
113
+ **Step 5: Identify Key Links**
114
+ "Where is this most likely to break?" Key links = critical connections where breakage causes cascading failures.
115
+
116
+ For chat interface:
117
+
118
+ - Input onSubmit -> API call (if broken: typing works but sending doesn't)
119
+ - API save -> database (if broken: appears to send but doesn't persist)
120
+ - Component -> real data (if broken: shows placeholder, not messages)
121
+
122
+ ### Must-Haves Documentation
123
+
124
+ Document in plan frontmatter:
125
+
126
+ ```yaml
127
+ must_haves:
128
+ truths:
129
+ - "User can see existing messages"
130
+ - "User can send a message"
131
+ artifacts:
132
+ - path: "src/components/Chat.tsx"
133
+ provides: "Message list rendering"
134
+ min_lines: 30
135
+ key_links:
136
+ - from: "src/components/Chat.tsx"
137
+ to: "/api/chat"
138
+ via: "fetch in useEffect"
139
+ ```
140
+
141
+ ## Discovery Levels
142
+
143
+ **Level 0 - Skip** (pure internal work, existing patterns only)
144
+
145
+ - ALL work follows established codebase patterns (grep confirms)
146
+ - No new external dependencies
147
+ - Examples: Add delete button, add field to model, create CRUD endpoint
148
+
149
+ **Level 1 - Quick Verification** (2-5 min)
150
+
151
+ - Single known library, confirming syntax/version
152
+ - Action: `context7 resolve-library-id + query-docs`
153
+
154
+ **Level 2 - Standard Research** (15-30 min)
155
+
156
+ - Choosing between 2-3 options, new external integration
157
+ - Action: Spawn `@scout` for research, document findings
158
+
159
+ **Level 3 - Deep Dive** (1+ hour)
160
+
161
+ - Architectural decision with long-term impact, novel problem
162
+ - Action: Full research with parallel `@scout` agents, document decisions
163
+
164
+ **Depth indicators:**
165
+
166
+ - Level 2+: New library not in package.json, external API, "choose/select/evaluate" in description
167
+ - Level 3: "architecture/design/system", multiple external services, data modeling, auth design
168
+
169
+ ## Context Budget Rules
170
+
171
+ **Quality Degradation Curve:**
172
+ | Context Usage | Quality | Claude's State |
173
+ |---------------|---------|----------------|
174
+ | 0-30% | PEAK | Thorough, comprehensive |
175
+ | 30-50% | GOOD | Confident, solid work |
176
+ | 50-70% | DEGRADING | Efficiency mode begins |
177
+ | 70%+ | POOR | Rushed, minimal |
178
+
179
+ **Rule:** Plans should target ~50% context per execution. More plans, smaller scope = consistent quality.
180
+
181
+ **Each plan: 2-3 tasks maximum.**
182
+
183
+ | Task Complexity | Tasks/Plan | Context/Task | Total |
184
+ | --------------- | ---------- | ------------ | ------- |
185
+ | Simple (CRUD) | 3 | ~10-15% | ~30-45% |
186
+ | Complex (auth) | 2 | ~20-30% | ~40-50% |
187
+ | Very complex | 1-2 | ~30-40% | ~30-50% |
188
+
189
+ **Split signals:**
190
+
191
+ - More than 3 tasks → Split
192
+ - Multiple subsystems (DB + API + UI) → Separate plans
193
+ - Any task with >5 file modifications → Split
194
+ - Checkpoint + implementation in same plan → Split
195
+ - Discovery + implementation in same plan → Split
196
+
197
+ ## Dependency Graph Construction
198
+
199
+ **For each task, record:**
200
+
201
+ - `needs`: What must exist before this runs
202
+ - `creates`: What this produces
203
+ - `has_checkpoint`: Requires user interaction?
204
+
205
+ **Example:**
206
+
207
+ ```
208
+ Task A (User model): needs nothing, creates src/models/user.ts
209
+ Task B (Product model): needs nothing, creates src/models/product.ts
210
+ Task C (User API): needs Task A, creates src/api/users.ts
211
+ Task D (Product API): needs Task B, creates src/api/products.ts
212
+ Task E (Dashboard): needs Task C + D, creates src/components/Dashboard.tsx
213
+
214
+ Graph:
215
+ A --> C --\
216
+ --> E
217
+ B --> D --/
218
+
219
+ Wave analysis:
220
+ Wave 1: A, B (independent)
221
+ Wave 2: C, D (depend on Wave 1)
222
+ Wave 3: E (depends on Wave 2)
223
+ ```
224
+
225
+ **Vertical slices preferred:**
226
+
227
+ ```
228
+ Plan 01: User feature (model + API + UI) ← Can run parallel
229
+ Plan 02: Product feature (model + API + UI) ← Can run parallel
230
+ ```
231
+
232
+ **Avoid horizontal layers:**
233
+
234
+ ```
235
+ Plan 01: All models (User + Product + Order) ← Sequential
236
+ Plan 02: All APIs (User + Product + Order) ← Depends on Plan 01
237
+ Plan 03: All UI (User + Product + Order) ← Depends on Plan 02
238
+ ```
239
+
65
240
  ## Memory Ritual
66
241
 
67
242
  Planning requires understanding what came before. Follow this ritual every session:
@@ -53,6 +53,102 @@ Only report issues that meet **all** of these:
53
53
  3. Is fixable without requiring unrealistic rigor for this codebase
54
54
  4. Is likely something the author would actually want to fix
55
55
 
56
+ ## Goal-Backward Verification Mode
57
+
58
+ When reviewing implementation against PRD/plan (not just code changes), verify goal achievement:
59
+
60
+ **Task completion ≠ Goal achievement**
61
+
62
+ A task "create chat component" can be marked complete when the component is a placeholder. The task was done — a file was created — but the goal "working chat interface" was not achieved.
63
+
64
+ ### Three-Level Verification
65
+
66
+ **Level 1: Exists**
67
+
68
+ - File is present at expected path
69
+ - Check: `ls path/to/file.ts`
70
+
71
+ **Level 2: Substantive (not a stub)**
72
+
73
+ - Contains actual implementation, not placeholders
74
+ - Red flags: `TODO`, `FIXME`, `return null`, `return <div>Component</div>`, empty handlers
75
+ - Check: `grep -n "TODO\|FIXME\|return null" path/to/file.ts`
76
+
77
+ **Level 3: Wired (connected/used)**
78
+
79
+ - Component is imported and used
80
+ - API is called and response is handled
81
+ - State is rendered, not just defined
82
+ - Check: `grep -r "import.*ComponentName" src/`
83
+
84
+ ### Artifact Status Matrix
85
+
86
+ | Exists | Substantive | Wired | Status | Action |
87
+ | ------ | ----------- | ----- | ----------- | ------------------- |
88
+ | ✓ | ✓ | ✓ | ✓ VERIFIED | None |
89
+ | ✓ | ✓ | ✗ | ⚠️ ORPHANED | Flag as unused code |
90
+ | ✓ | ✗ | - | ✗ STUB | Flag as incomplete |
91
+ | ✗ | - | - | ✗ MISSING | Flag as missing |
92
+
93
+ ### Key Link Verification
94
+
95
+ Verify critical connections (where stubs hide):
96
+
97
+ **Pattern: Component → API**
98
+
99
+ - Component calls API: `grep -E "fetch.*api/|axios" Component.tsx`
100
+ - Response is handled: Check for `.then`, `await`, or state update
101
+
102
+ **Pattern: API → Database**
103
+
104
+ - API queries DB: `grep -E "prisma\.|db\." route.ts`
105
+ - Query result is returned: Check for `return Response.json(result)`
106
+
107
+ **Pattern: Form → Handler**
108
+
109
+ - Form has onSubmit: `grep "onSubmit" Component.tsx`
110
+ - Handler calls API: Check handler implementation
111
+
112
+ **Pattern: State → Render**
113
+
114
+ - State defined: `grep "useState" Component.tsx`
115
+ - State rendered: `grep "{stateVar}" Component.tsx`
116
+
117
+ ### Stub Detection Patterns
118
+
119
+ **React Component Stubs:**
120
+
121
+ ```javascript
122
+ return <div>Component</div> // Placeholder
123
+ return <div>Placeholder</div> // Placeholder
124
+ return <div>{/* TODO */}</div> // Empty
125
+ return null // Empty
126
+ onClick={() => {}} // No-op handler
127
+ onChange={() => console.log('')} // Log-only handler
128
+ ```
129
+
130
+ **API Route Stubs:**
131
+
132
+ ```typescript
133
+ export async function POST() {
134
+ return Response.json({ message: "Not implemented" }); // Stub
135
+ }
136
+ export async function GET() {
137
+ return Response.json([]); // Empty array, no DB query
138
+ }
139
+ ```
140
+
141
+ **Wiring Red Flags:**
142
+
143
+ ```typescript
144
+ fetch('/api/messages') // No await, no .then, no assignment (ignored)
145
+ await prisma.message.findMany()
146
+ return Response.json({ ok: true }) // Returns static, not query result
147
+ onSubmit={(e) => e.preventDefault()} // Only prevents default
148
+ const [messages] = useState([])
149
+ return <div>No messages</div> // State exists but not used
150
+ ```
151
+
56
152
  ## Workflow
57
153
 
58
154
  1. Read changed files and nearby context
@@ -45,30 +45,72 @@ If `--type` was provided, use it directly. Otherwise, suggest a type based on th
45
45
  - **bug**: Something broken (fix, error, crash, not working)
46
46
  - **task**: Tactical change, clear scope (everything else)
47
47
 
48
- ## Phase 3: Gather Context
48
+ ## Phase 3: Choose Research Depth
49
49
 
50
- Spawn parallel subagents to understand the codebase before writing any spec:
50
+ Ask user before spawning agents:
51
51
 
52
- | Agent | Purpose | Returns |
53
- | --------------------------- | ----------------------------------- | ------------------------------------- |
54
- | `explore` | Affected files and patterns | File paths, conventions, architecture |
55
- | `explore` | Test patterns and coverage gaps | Test files, patterns, gaps |
56
- | `explore` | Dependencies and integration points | Dependency graph, risk areas |
57
- | `scout` (feature/epic only) | Best practices and approaches | Recommendations, warnings |
58
- | `review` (epic only) | Architecture impact | Breaking changes, decomposition |
52
+ ```typescript
53
+ question({
54
+ questions: [
55
+ {
56
+ header: "Research Depth",
57
+ question: "How much codebase research do you need?",
58
+ options: [
59
+ {
60
+ label: "Deep (Recommended for complex work)",
61
+ description: "3-5 agents: patterns, tests, deps, best practices (~2 min)",
62
+ },
63
+ {
64
+ label: "Standard",
65
+ description: "2 agents: patterns + tests (~1 min)",
66
+ },
67
+ {
68
+ label: "Minimal",
69
+ description: "1 agent: quick file scan (~30 sec)",
70
+ },
71
+ {
72
+ label: "Skip",
73
+ description: "I know the codebase, use existing knowledge",
74
+ },
75
+ ],
76
+ },
77
+ ],
78
+ });
79
+ ```
80
+
81
+ ## Phase 4: Gather Context
82
+
83
+ Based on research depth choice, spawn agents:
84
+
85
+ **If Deep:**
86
+
87
+ - 3x `explore` (patterns, tests, deps)
88
+ - 1x `scout` (feature/epic)
89
+ - 1x `review` (epic)
90
+
91
+ **If Standard:**
92
+
93
+ - 2x `explore` (patterns, tests)
94
+ - 1x `scout` (feature/epic only)
95
+
96
+ **If Minimal:**
97
+
98
+ - 1x `explore` (patterns)
99
+
100
+ **If Skip:**
59
101
 
60
- All agents launch in ONE message — they run concurrently.
102
+ - No agents, use existing AGENTS.md context
61
103
 
62
- **While agents run**, ask clarifying questions if the description lacks scope or expected outcome. For bugs, also ask for reproduction steps and expected vs actual behavior. Skip questions if the description is already specific.
104
+ **While agents run**, ask clarifying questions if the description lacks scope or expected outcome. For bugs, also ask for reproduction steps and expected vs actual behavior.
63
105
 
64
- ## Phase 4: Create Bead
106
+ ## Phase 5: Create Bead
65
107
 
66
108
  ```bash
67
109
  BEAD_ID=$(br create "$DESCRIPTION" --type $BEAD_TYPE --json | jq -r '.id')
68
110
  mkdir -p ".beads/artifacts/$BEAD_ID"
69
111
  ```
70
112
 
71
- ## Phase 5: Write PRD
113
+ ## Phase 6: Write PRD
72
114
 
73
115
  Copy and fill the PRD template using context from Phase 3:
74
116
 
@@ -99,7 +141,7 @@ Tasks must follow the `prd-task` skill format:
99
141
  - Metadata block: `depends_on`, `parallel`, `conflicts_with`, `files`
100
142
  - At least one verification command per task
101
143
 
102
- ## Phase 6: Validate PRD
144
+ ## Phase 7: Validate PRD
103
145
 
104
146
  Before saving, verify:
105
147
 
@@ -113,7 +155,7 @@ Before saving, verify:
113
155
 
114
156
  If any check fails, fix it — don't ask the user.
115
157
 
116
- ## Phase 7: Report
158
+ ## Phase 8: Report
117
159
 
118
160
  Output:
119
161