forge-cc 0.1.9 → 0.1.11

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 (59) hide show
  1. package/README.md +253 -178
  2. package/dist/cli.js +109 -8
  3. package/dist/cli.js.map +1 -1
  4. package/dist/gates/codex-gate.d.ts +51 -0
  5. package/dist/gates/codex-gate.js +121 -0
  6. package/dist/gates/codex-gate.js.map +1 -0
  7. package/dist/go/auto-chain.d.ts +13 -23
  8. package/dist/go/auto-chain.js +29 -101
  9. package/dist/go/auto-chain.js.map +1 -1
  10. package/dist/go/executor.d.ts +5 -0
  11. package/dist/go/executor.js +43 -5
  12. package/dist/go/executor.js.map +1 -1
  13. package/dist/go/finalize.d.ts +50 -1
  14. package/dist/go/finalize.js +122 -0
  15. package/dist/go/finalize.js.map +1 -1
  16. package/dist/go/prd-queue.d.ts +43 -0
  17. package/dist/go/prd-queue.js +67 -0
  18. package/dist/go/prd-queue.js.map +1 -0
  19. package/dist/go/prd-selector.d.ts +57 -0
  20. package/dist/go/prd-selector.js +101 -0
  21. package/dist/go/prd-selector.js.map +1 -0
  22. package/dist/go/verify-loop.d.ts +18 -1
  23. package/dist/go/verify-loop.js +119 -2
  24. package/dist/go/verify-loop.js.map +1 -1
  25. package/dist/spec/templates.d.ts +2 -2
  26. package/dist/state/prd-status.d.ts +59 -0
  27. package/dist/state/prd-status.js +121 -0
  28. package/dist/state/prd-status.js.map +1 -0
  29. package/dist/state/reader.d.ts +2 -24
  30. package/dist/state/reader.js +4 -77
  31. package/dist/state/reader.js.map +1 -1
  32. package/dist/state/writer.d.ts +2 -41
  33. package/dist/state/writer.js +14 -130
  34. package/dist/state/writer.js.map +1 -1
  35. package/dist/team/consensus.d.ts +28 -0
  36. package/dist/team/consensus.js +130 -0
  37. package/dist/team/consensus.js.map +1 -0
  38. package/dist/team/index.d.ts +4 -0
  39. package/dist/team/index.js +5 -0
  40. package/dist/team/index.js.map +1 -0
  41. package/dist/team/lifecycle.d.ts +37 -0
  42. package/dist/team/lifecycle.js +92 -0
  43. package/dist/team/lifecycle.js.map +1 -0
  44. package/dist/team/reviewer.d.ts +10 -0
  45. package/dist/team/reviewer.js +345 -0
  46. package/dist/team/reviewer.js.map +1 -0
  47. package/dist/team/types.d.ts +269 -0
  48. package/dist/team/types.js +70 -0
  49. package/dist/team/types.js.map +1 -0
  50. package/dist/types.d.ts +1 -0
  51. package/dist/utils/browser.d.ts +1 -1
  52. package/dist/utils/browser.js +8 -1
  53. package/dist/utils/browser.js.map +1 -1
  54. package/dist/worktree/session.d.ts +3 -0
  55. package/dist/worktree/session.js +1 -0
  56. package/dist/worktree/session.js.map +1 -1
  57. package/package.json +2 -1
  58. package/skills/forge-go.md +176 -62
  59. package/skills/forge-spec.md +30 -5
@@ -1,6 +1,6 @@
1
1
  # /forge:go — Execute Milestones with Wave-Based Agent Teams
2
2
 
3
- Execute milestones from your PRD with wave-based agent teams, self-healing verification, and automatic state management.
3
+ Execute milestones from your PRD with real agent teams (TeamCreate/SendMessage), consensus-based review, self-healing verification, and automatic state management.
4
4
 
5
5
  ## Instructions
6
6
 
@@ -10,27 +10,27 @@ Follow these steps exactly. The execution engine at `src/go/executor.ts` provide
10
10
 
11
11
  **This step has two parts. Complete BOTH before moving to Step 2. Do NOT read any other files, do NOT start pre-flight checks, do NOT read the PRD until both parts are done.**
12
12
 
13
- **Part A — Read state (only these 3 files, nothing else):**
13
+ **Part A — Read state (only these files, nothing else):**
14
14
 
15
15
  ```
16
16
  Read these files in parallel:
17
17
  - CLAUDE.md
18
- - .planning/STATE.md
19
- - .planning/ROADMAP.md
18
+ - .planning/status/*.json (scan for PRD status files)
20
19
  ```
21
20
 
22
- From STATE.md, extract:
23
- - **Current milestone number** (from `**Milestone:**` field)
24
- - **Branch** (from `**Branch:**` field)
25
- - **Active PRD path** (from `**Active PRD:**` field)
21
+ From the status files, determine:
22
+ - **Available PRDs** with pending milestones
23
+ - If only one PRD: auto-select it
24
+ - If multiple PRDs: present a picker using AskUserQuestion with each PRD as an option showing its name, branch, and pending milestone count
25
+ - **Current milestone number** — the lowest-numbered pending milestone for the selected PRD
26
+ - **Branch** — from the status file's `branch` field
27
+ - **Active PRD path** — `.planning/prds/<slug>.md`
26
28
 
27
- From ROADMAP.md, find the next milestone with status "Pending". If STATE.md says the current milestone is complete, advance to the next pending one.
29
+ If no PRD status files exist:
28
30
 
29
- If no active PRD exists:
31
+ > No PRD status files found. Run `/forge:spec` first to create a PRD with milestones.
30
32
 
31
- > No active PRD found. Run `/forge:spec` first to create a PRD with milestones.
32
-
33
- If all milestones are complete:
33
+ If all milestones are complete across all PRDs:
34
34
 
35
35
  > All milestones complete! Create a PR with `gh pr create` or run `/forge:spec` to start a new project.
36
36
 
@@ -55,13 +55,13 @@ Otherwise: **your very next tool call MUST be AskUserQuestion.** No file reads,
55
55
 
56
56
  Verify the execution environment is ready:
57
57
 
58
- 1. **Branch check:** Confirm you are on the correct feature branch (from STATE.md). If on `main`/`master`, warn and abort:
58
+ 1. **Branch check:** Confirm you are on the correct feature branch (from the status file's `branch` field). If on `main`/`master`, warn and abort:
59
59
 
60
60
  > You're on the main branch. Switch to your feature branch first: `git checkout {branch}`
61
61
 
62
62
  2. **Milestone exists:** Read ONLY the current milestone section from the PRD (progressive disclosure — NOT the full PRD). Use the executor's `readCurrentMilestone()` approach — match `### Milestone N:` header and extract until the next milestone header.
63
63
 
64
- 3. **Not already complete:** Check ROADMAP.md to confirm this milestone is not already marked complete. If it is, advance to the next pending milestone.
64
+ 3. **Not already complete:** Check the status file to confirm this milestone is not already marked complete. If it is, advance to the next pending milestone.
65
65
 
66
66
  4. **Clean state:** Run `git status` to check for uncommitted changes. If dirty, warn:
67
67
 
@@ -101,7 +101,34 @@ The execution engine automatically creates a git worktree for isolated execution
101
101
 
102
102
  **If worktree creation fails:** The engine falls back to running in the main working directory (original behavior). A warning is printed but execution continues.
103
103
 
104
- ### Step 3 — Execute Waves
104
+ ### Step 3 — Create Agent Team + Execute Waves
105
+
106
+ #### 3a. Create the Agent Team
107
+
108
+ Use TeamCreate to establish the milestone's agent team:
109
+
110
+ ```
111
+ TeamCreate:
112
+ team_name: "{slug}-m{N}"
113
+ description: "Milestone {N}: {milestone name}"
114
+ ```
115
+
116
+ The team follows a **3-tier hierarchy:**
117
+
118
+ ```
119
+ Executive (you — the /forge:go orchestrator)
120
+ ├── Builder Agent 1 (Opus, full-capability)
121
+ │ ├── Research Subagent (Explore — read-only, for codebase research)
122
+ │ └── Implementation Subagent (general-purpose — for grunt work)
123
+ ├── Builder Agent 2 (Opus, full-capability)
124
+ ├── ...Builder Agent N
125
+ ├── Reviewer Agent (Opus, persistent team member — reviews after each wave)
126
+ └── Notetaker Agent (Opus, optional — spawned when 3+ waves or 4+ agents per wave)
127
+ ```
128
+
129
+ **Notetaker decision:** Spawn a notetaker agent when the milestone has 3+ waves OR any single wave has 4+ agents. The notetaker tracks decisions, file ownership, and cross-agent dependencies via SendMessage updates.
130
+
131
+ #### 3b. Parse Waves from PRD
105
132
 
106
133
  Parse the milestone section from the PRD. Each milestone contains waves with agent definitions:
107
134
 
@@ -112,37 +139,45 @@ Parse the milestone section from the PRD. Each milestone contains waves with age
112
139
  - Modifies: file3
113
140
  ```
114
141
 
142
+ #### 3c. Execute Each Wave
143
+
115
144
  For each wave, in order:
116
145
 
117
- #### 3a. Build Agent Prompts
146
+ **Build Agent Prompts:**
118
147
 
119
148
  For each agent in the wave, construct a prompt that includes:
120
149
 
121
150
  1. **Agent identity:** "You are **{agent-name}** working on Milestone {N}: {name}."
122
- 2. **Milestone goal:** The `**Goal:**` line from the milestone section.
123
- 3. **Agent task:** The specific task description from the wave definition.
124
- 4. **Files to create/modify:** The explicit file list from the agent's definition.
125
- 5. **Existing code context:** Read the actual contents of files the agent depends on (imports, types, utilities). **Inline the actual code** — never reference files by path alone. This is critical for agents that run in isolated contexts.
126
- 6. **Lessons:** Read `tasks/lessons.md` and include all active lessons.
127
- 7. **Rules:**
128
- - Use ES module imports with `.js` extension in import paths
129
- - Stage only your files (never `git add .` or `git add -A`)
130
- - Run `npx tsc --noEmit` after creating files to verify compilation
131
- - Do NOT commit the orchestrator handles commits
132
-
133
- #### 3b. Spawn Agents in Parallel
134
-
135
- Use the Task tool to spawn all agents in the current wave simultaneously:
151
+ 2. **Team context:** "You are part of team `{slug}-m{N}`. Use SendMessage to communicate with the executive and other builders."
152
+ 3. **Milestone goal:** The `**Goal:**` line from the milestone section.
153
+ 4. **Agent task:** The specific task description from the wave definition.
154
+ 5. **Files to create/modify:** The explicit file list from the agent's definition.
155
+ 6. **Existing code context:** Read the actual contents of files the agent depends on (imports, types, utilities). **Inline the actual code** — never reference files by path alone. This is critical for agents that run in isolated contexts.
156
+ 7. **Subagent guidance:** "You may spawn subagents for research (Explore type — read-only) or implementation grunt work (general-purpose type). Use subagents for tasks that don't require team coordination."
157
+ 8. **Conflict avoidance:** "Do NOT modify files outside your assignment. If you discover a need to change a file owned by another agent, send a message to the executive describing the conflict instead of making the change."
158
+ 9. **Lessons:** Read `tasks/lessons.md` and include all active lessons.
159
+ 10. **Rules:**
160
+ - Use ES module imports with `.js` extension in import paths
161
+ - Stage only your files (never `git add .` or `git add -A`)
162
+ - Run `npx tsc --noEmit` after creating files to verify compilation
163
+ - Do NOT commit — the orchestrator handles commits
164
+ - Send a message to the executive when your work is complete
165
+
166
+ **Spawn Builder Agents in Parallel:**
167
+
168
+ Spawn all builder agents for the current wave as team members:
136
169
 
137
170
  ```
138
171
  For each agent in the wave, use the Task tool with:
172
+ - team_name: "{slug}-m{N}"
173
+ - name: "{agent-name}"
139
174
  - The constructed prompt as the task description
140
- - subagent_type appropriate for the work (typically a full-capability agent)
175
+ - subagent_type: full-capability agent (Opus builders need SendMessage + subagent spawning)
141
176
  ```
142
177
 
143
- Wait for ALL agents in the wave to complete before moving to the next step.
178
+ Wait for ALL builder agents in the wave to report completion via SendMessage before moving to the next step.
144
179
 
145
- #### 3c. Restage Files at Wave Boundary
180
+ #### 3d. Restage Files at Wave Boundary
146
181
 
147
182
  **IMPORTANT:** Parallel agents can disrupt each other's git index. After all agents in a wave complete, restage all files:
148
183
 
@@ -152,9 +187,9 @@ git add {all files from this wave's agents}
152
187
 
153
188
  This is a learned lesson — always restage at wave boundaries.
154
189
 
155
- #### 3d. Run Verification
190
+ #### 3e. Run Mechanical Verification
156
191
 
157
- After each wave completes, run forge verification:
192
+ After each wave completes, run mechanical verification gates:
158
193
 
159
194
  ```bash
160
195
  npx tsc --noEmit
@@ -166,30 +201,74 @@ If the project has additional verification configured (tests, lint), also run:
166
201
  npx forge verify
167
202
  ```
168
203
 
169
- If verification **passes**: print a wave completion summary and proceed to the next wave.
204
+ If verification **fails**: proceed to Step 4 (self-healing loop).
205
+
206
+ If verification **passes**: proceed to reviewer.
207
+
208
+ #### 3f. Reviewer Consensus Protocol
209
+
210
+ After mechanical gates pass, engage the reviewer agent:
211
+
212
+ 1. **Send diff to reviewer:** Use SendMessage to send the wave's git diff to the reviewer agent, along with:
213
+ - The PRD milestone section (goals and acceptance criteria)
214
+ - CLAUDE.md rules and architecture decisions
215
+ - The list of files changed and their ownership
216
+
217
+ 2. **Reviewer analyzes diff:** The reviewer examines the changes for:
218
+ - PRD alignment — does the code achieve what the milestone specifies?
219
+ - Architecture adherence — does the code follow CLAUDE.md patterns?
220
+ - Logic errors — not mechanical (tsc catches those), but semantic issues
221
+ - Cross-agent integration — do the pieces from different builders fit together?
222
+
223
+ 3. **Reviewer sends findings:** The reviewer sends structured findings via SendMessage to the relevant builder(s):
224
+ ```
225
+ Finding: {description}
226
+ Severity: error | warning
227
+ File: {path}
228
+ Line: {number}
229
+ ```
230
+
231
+ 4. **Builder responds:** The builder can:
232
+ - **Agree** — finding is queued for fix agent
233
+ - **Disagree: {reason}** — builder explains why the finding is incorrect
234
+ - **Alternative: {proposal}** — builder proposes a different approach
235
+
236
+ 5. **Round 2 (if disagreement):** The reviewer re-evaluates the builder's reasoning. Either:
237
+ - Accepts the builder's position (finding dropped)
238
+ - Maintains the finding (escalates to executive)
239
+
240
+ 6. **Escalation (deadlock after 2 rounds):** The executive (you) reviews both positions and makes the final call.
241
+
242
+ 7. **Fix agreed findings:** Spawn a fix agent to address all agreed-upon findings. The fix agent receives:
243
+ - The specific findings to fix
244
+ - The files to modify
245
+ - "Fix ONLY the agreed findings. Do not refactor or add features."
246
+
247
+ 8. **Re-verify:** Restage files and re-run mechanical gates after fixes.
248
+
249
+ If no findings (or all findings resolved): print wave completion summary and proceed to the next wave.
170
250
 
171
251
  ```
172
252
  ## Wave {N} Complete
173
253
 
174
254
  - agent-1: OK (created file1.ts, file2.ts)
175
255
  - agent-2: OK (modified file3.ts)
176
- - Verification: PASSED
256
+ - Mechanical verification: PASSED
257
+ - Reviewer: {N} findings, {M} resolved, 0 outstanding
177
258
 
178
259
  Proceeding to Wave {N+1}...
179
260
  ```
180
261
 
181
- If verification **fails**: proceed to Step 4 (self-healing loop).
182
-
183
262
  ### Step 4 — Self-Healing Verify Loop
184
263
 
185
- When verification fails after a wave:
264
+ When mechanical verification fails after a wave (or after reviewer fixes):
186
265
 
187
266
  1. Parse the verification errors into structured feedback. Include:
188
267
  - Gate name (types, lint, tests)
189
268
  - Error messages with file paths and line numbers
190
269
  - Remediation hints if available
191
270
 
192
- 2. Spawn a **fix agent** with a prompt that includes:
271
+ 2. Spawn a **fix agent** (as a team member) with a prompt that includes:
193
272
  - The specific errors to fix
194
273
  - The files that need modification
195
274
  - The original task context
@@ -212,11 +291,11 @@ When verification fails after a wave:
212
291
  Please fix the remaining issues manually, then run `/forge:go` again.
213
292
  ```
214
293
 
215
- **Stop execution.** Do not proceed to the next wave or milestone.
294
+ **Stop execution.** Do not proceed to the next wave or milestone. Shut down the agent team (TeamDelete).
216
295
 
217
296
  ### Step 5 — Commit
218
297
 
219
- After ALL waves pass verification:
298
+ After ALL waves pass verification (mechanical + reviewer):
220
299
 
221
300
  1. Stage all files created/modified across all waves:
222
301
 
@@ -238,19 +317,15 @@ After ALL waves pass verification:
238
317
 
239
318
  ### Step 6 — Update State
240
319
 
241
- Update project state files:
320
+ Update the PRD status file:
242
321
 
243
- 1. **STATE.md:** Update the milestone progress table — mark the completed milestone's status as `Complete ({date})`. If there is a next milestone, update the `**Milestone:**` line to point to it. Update `**Last Session:**` to today's date.
322
+ 1. **Status JSON:** Update `.planning/status/<slug>.json` — mark the completed milestone's status as `complete` with today's date.
244
323
 
245
- 2. **ROADMAP.md:** Update the milestone table row to `Complete ({date})`.
246
-
247
- 3. **Session memory:** Write session state for the current branch using the writer module's pattern.
248
-
249
- 4. Commit the state updates:
324
+ 2. Commit the status update:
250
325
 
251
326
  ```bash
252
- git add .planning/STATE.md .planning/ROADMAP.md
253
- git commit -m "docs: mark Milestone {N} complete, update session state"
327
+ git add .planning/status/<slug>.json
328
+ git commit -m "docs: mark Milestone {N} complete"
254
329
  git push origin {branch}
255
330
  ```
256
331
 
@@ -281,12 +356,20 @@ After milestone completion, determine the next action:
281
356
 
282
357
  - Files created: {count}
283
358
  - Files modified: {count}
284
- - Verification: PASSED
359
+ - Verification: PASSED (mechanical + reviewer)
285
360
  - Branch: {branch} (pushed)
286
361
 
287
362
  **Next:** Run `/clear` then `/forge:go` for Milestone {N+1}, or exit and run `npx forge run` to auto-chain all remaining milestones.
288
363
  ```
289
364
 
365
+ Shut down the agent team:
366
+
367
+ ```
368
+ Send shutdown_request to all team members via SendMessage.
369
+ Wait for shutdown confirmations.
370
+ TeamDelete to clean up team resources.
371
+ ```
372
+
290
373
  #### If this IS the last milestone:
291
374
 
292
375
  Create a pull request:
@@ -302,7 +385,7 @@ gh pr create --title "feat: {Project Name}" --body "$(cat <<'EOF'
302
385
  ...
303
386
 
304
387
  ## Verification
305
- All milestones passed forge verification (types, lint, tests).
388
+ All milestones passed forge verification (types, lint, tests) and agent team review.
306
389
 
307
390
  ---
308
391
  Generated by forge-cc
@@ -310,7 +393,27 @@ EOF
310
393
  )"
311
394
  ```
312
395
 
313
- Then print:
396
+ **Codex Review Gate:**
397
+
398
+ After `gh pr create` succeeds, poll for Codex review comments:
399
+
400
+ 1. **Poll loop:** Every 60 seconds, check for new PR review comments:
401
+ ```bash
402
+ gh api repos/{owner}/{repo}/pulls/{pr_number}/comments
403
+ ```
404
+
405
+ 2. **Duration:** Poll for up to 8 minutes (8 checks at 60-second intervals).
406
+
407
+ 3. **If comments found:** For each unresolved comment:
408
+ - Spawn a fix agent (team member) with the comment text, file path, and line number
409
+ - The fix agent either makes the code fix or posts a justified reply explaining why the current code is correct
410
+ - After fixes are pushed, poll one more cycle for new comments from re-review
411
+
412
+ 4. **Completion criteria:** The milestone completes when the PR has 0 unresolved review comments.
413
+
414
+ 5. **Timeout:** If no Codex comments appear after 8 minutes, proceed — Codex may not be configured for this repository.
415
+
416
+ Then shut down the agent team and print:
314
417
 
315
418
  ```
316
419
  ## All Milestones Complete!
@@ -320,10 +423,17 @@ Then print:
320
423
  - {N} milestones completed
321
424
  - {total files} files created/modified
322
425
  - All verification gates passed
426
+ - Codex review: {resolved/no comments/not configured}
323
427
 
324
428
  The PR is ready for review.
325
429
  ```
326
430
 
431
+ ```
432
+ Send shutdown_request to all team members via SendMessage.
433
+ Wait for shutdown confirmations.
434
+ TeamDelete to clean up team resources.
435
+ ```
436
+
327
437
  ### Auto Mode
328
438
 
329
439
  When the user selects "Auto (all milestones)" in Step 1 Part B or invokes with `--auto` (e.g., `/forge:go --auto`):
@@ -337,18 +447,18 @@ Auto mode runs each milestone in a fresh Claude session for maximum quality.
337
447
 
338
448
  **To start:** Exit this Claude session (Ctrl+C), then run in your terminal:
339
449
 
340
- npx forge run
450
+ npx forge run --prd {slug}
341
451
 
342
452
  **What happens:**
343
453
  - Each milestone gets a fresh Claude session (no context rot)
344
454
  - Output streams inline to your terminal
345
455
  - Stops on completion, failure, or stall
346
- - Resume after failure: fix the issue, run `npx forge run` again
456
+ - Resume after failure: fix the issue, run `npx forge run --prd {slug}` again
347
457
 
348
458
  **Requires:** claude CLI on PATH, --dangerously-skip-permissions (automatic)
349
459
  ```
350
460
 
351
- **IMPORTANT:** Auto mode does NOT execute milestones in the current session. It redirects the user to `npx forge run`, which handles spawning fresh Claude sessions per milestone via the Ralph Loop pattern.
461
+ **IMPORTANT:** Auto mode does NOT execute milestones in the current session. It redirects the user to `npx forge run --prd {slug}`, which handles spawning fresh Claude sessions per milestone via the Ralph Loop pattern.
352
462
 
353
463
  ### Parallel Milestones (dependsOn)
354
464
 
@@ -381,12 +491,16 @@ If Linear is not configured, skip silently.
381
491
  ## Edge Cases
382
492
 
383
493
  - **No PRD:** Abort with message to run `/forge:spec` first.
494
+ - **No status files:** Same as no PRD — abort with message to run `/forge:spec` first.
384
495
  - **No waves in milestone:** The milestone section may not have structured wave definitions (e.g., it was written by hand without the spec engine). In this case, treat the entire milestone as a single wave with one agent whose task is the milestone's goal.
385
496
  - **Agent failure:** If an agent in a wave fails (exits with error, times out), record the failure, include the error in the wave result, and proceed to verification. The self-healing loop may fix the issue.
386
497
  - **Branch diverged:** If `git push` fails due to divergence, attempt `git pull --rebase` first. If that fails, stop and ask the user.
387
- - **Interrupted execution:** If execution is interrupted mid-wave, the state files are NOT updated. Running `/forge:go` again will retry the same milestone from the beginning. Completed agents' work will be in the working tree — the new run's verification will detect what's already working.
498
+ - **Interrupted execution:** If execution is interrupted mid-wave, the status files are NOT updated. Running `/forge:go` again will retry the same milestone from the beginning. Completed agents' work will be in the working tree — the new run's verification will detect what's already working. Shut down any remaining team members before retrying.
388
499
  - **Empty milestone section:** If the PRD has a milestone header but no content, abort with:
389
500
  > Milestone {N} has no wave definitions. Update the PRD with agent assignments before running /forge:go.
390
- - **Already on correct milestone:** If STATE.md's current milestone matches the target, proceed normally (this is the expected case).
391
- - **Linear auth fails:** Warn but continue execution. Linear sync is not blocking.
501
+ - **Already on correct milestone:** If the status file's current milestone matches the target, proceed normally (this is the expected case).
392
502
  - **Worktree conflict:** If the worktree directory already exists (e.g., from a crashed session), the engine attempts `npx forge cleanup` first. If that fails, it falls back to main directory execution.
503
+ - **Linear auth fails:** Warn but continue execution. Linear sync is not blocking — the milestone should still execute and complete without Linear.
504
+ - **Team creation fails:** If TeamCreate fails, fall back to the legacy Task-based agent spawning (fire-and-forget without SendMessage). Log a warning that review and consensus will be skipped.
505
+ - **Reviewer timeout:** If the reviewer does not respond within 5 minutes, log a warning and proceed without review findings. Do not block wave progression on a stalled reviewer.
506
+ - **Codex gate timeout:** If Codex does not post comments within 8 minutes, proceed — Codex may not be configured. This is not a failure.
@@ -193,9 +193,32 @@ The PRD should follow this structure:
193
193
 
194
194
  **Milestone sizing check:** Before finalizing, review each milestone against the sizing constraint. Every milestone MUST fit in one agent context window (~4 agents across 2-3 waves max). If any milestone exceeds this, split it into smaller milestones before writing the final PRD. Set `maxContextWindowFit: true` on all milestones — if you cannot make a milestone fit, flag it as `maxContextWindowFit: false` and warn the user.
195
195
 
196
- Write the final PRD to `.planning/prds/{project-slug}.md`. Tell the user:
196
+ Write the final PRD to `.planning/prds/{project-slug}.md`.
197
+
198
+ After writing the PRD file, also:
199
+
200
+ 1. **Create status file:** Write `.planning/status/<slug>.json` with all milestones set to "pending":
201
+ ```json
202
+ {
203
+ "project": "{project name}",
204
+ "slug": "{slug}",
205
+ "branch": "feat/{slug}",
206
+ "createdAt": "{today}",
207
+ "milestones": {
208
+ "1": { "status": "pending" },
209
+ "2": { "status": "pending" },
210
+ ...
211
+ }
212
+ }
213
+ ```
214
+
215
+ 2. **Create feature branch:** `git checkout -b feat/{slug}`
216
+
217
+ Tell the user:
197
218
 
198
219
  > Final PRD written to `.planning/prds/{slug}.md`.
220
+ > Status file created at `.planning/status/{slug}.json`.
221
+ > Feature branch `feat/{slug}` created.
199
222
 
200
223
  Present the full PRD in chat for review and ask:
201
224
 
@@ -268,13 +291,15 @@ After sync, print the handoff prompt:
268
291
  ## Ready for Development
269
292
 
270
293
  PRD: `.planning/prds/{slug}.md`
294
+ Status: `.planning/status/{slug}.json`
295
+ Branch: `feat/{slug}`
271
296
  Linear: {project URL}
272
297
 
273
298
  **Next step:** Run `/forge:go` for one milestone at a time, or exit and run `npx forge run` to execute all milestones autonomously. The execution engine will:
274
- - Read the PRD and milestone plan
275
- - Spawn agent teams for each issue
276
- - Verify each change with forge-mcp gates
277
- - Open PRs and transition issues automatically
299
+ - Read the PRD and per-PRD status file
300
+ - Spawn agent teams for each milestone
301
+ - Verify each change with forge verification gates
302
+ - Update status JSON and transition Linear issues automatically
278
303
  ```
279
304
 
280
305
  **Note:** `/forge:go` now uses git worktrees for session isolation. Multiple users can run `/forge:go` on different milestones simultaneously without conflicts.