forge-cc 1.0.3 → 2.0.0

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 (66) hide show
  1. package/.forge.json +6 -5
  2. package/README.md +7 -7
  3. package/dist/cli.js +193 -131
  4. package/dist/cli.js.map +1 -1
  5. package/dist/codex-poll.d.ts +38 -0
  6. package/dist/codex-poll.js +70 -0
  7. package/dist/codex-poll.js.map +1 -0
  8. package/dist/config/schema.d.ts +0 -28
  9. package/dist/config/schema.js +0 -7
  10. package/dist/config/schema.js.map +1 -1
  11. package/dist/graph/index.d.ts +6 -0
  12. package/dist/graph/index.js +11 -0
  13. package/dist/graph/index.js.map +1 -0
  14. package/dist/graph/query.d.ts +52 -0
  15. package/dist/graph/query.js +319 -0
  16. package/dist/graph/query.js.map +1 -0
  17. package/dist/graph/reader.d.ts +13 -0
  18. package/dist/graph/reader.js +140 -0
  19. package/dist/graph/reader.js.map +1 -0
  20. package/dist/graph/schemas.d.ts +215 -0
  21. package/dist/graph/schemas.js +54 -0
  22. package/dist/graph/schemas.js.map +1 -0
  23. package/dist/graph/types.d.ts +109 -0
  24. package/dist/graph/types.js +2 -0
  25. package/dist/graph/types.js.map +1 -0
  26. package/dist/graph/validator.d.ts +32 -0
  27. package/dist/graph/validator.js +253 -0
  28. package/dist/graph/validator.js.map +1 -0
  29. package/dist/graph/writer.d.ts +18 -0
  30. package/dist/graph/writer.js +159 -0
  31. package/dist/graph/writer.js.map +1 -0
  32. package/dist/linear/client.d.ts +94 -4
  33. package/dist/linear/client.js +203 -20
  34. package/dist/linear/client.js.map +1 -1
  35. package/dist/linear/sync.d.ts +11 -14
  36. package/dist/linear/sync.js +63 -83
  37. package/dist/linear/sync.js.map +1 -1
  38. package/dist/runner/loop.d.ts +1 -1
  39. package/dist/runner/loop.js +93 -100
  40. package/dist/runner/loop.js.map +1 -1
  41. package/dist/runner/prompt.d.ts +7 -9
  42. package/dist/runner/prompt.js +27 -30
  43. package/dist/runner/prompt.js.map +1 -1
  44. package/dist/setup.js +14 -0
  45. package/dist/setup.js.map +1 -1
  46. package/dist/types.d.ts +0 -23
  47. package/package.json +3 -5
  48. package/skills/README.md +35 -33
  49. package/skills/forge-build.md +344 -0
  50. package/skills/forge-capture.md +204 -0
  51. package/skills/forge-fix.md +207 -0
  52. package/skills/forge-plan.md +335 -0
  53. package/skills/forge-quick.md +154 -0
  54. package/skills/forge-setup.md +2 -2
  55. package/skills/ref/adversarial-review.md +117 -0
  56. package/skills/ref/graph-correction.md +88 -0
  57. package/skills/ref/requirement-sizing.md +146 -0
  58. package/dist/server.d.ts +0 -6
  59. package/dist/server.js +0 -51
  60. package/dist/server.js.map +0 -1
  61. package/dist/state/status.d.ts +0 -66
  62. package/dist/state/status.js +0 -96
  63. package/dist/state/status.js.map +0 -1
  64. package/skills/forge-go.md +0 -583
  65. package/skills/forge-spec.md +0 -367
  66. package/skills/forge-triage.md +0 -179
package/dist/setup.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAE1C,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;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C;IAED,2BAA2B;IAC3B,MAAM,aAAa,GAAG,MAAM,cAAc,CAAC,UAAU,CAAC,CAAC;IACvD,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAClD,CAAC;IAED,0BAA0B;IAC1B,MAAM,cAAc,EAAE,CAAC;IAEvB,OAAO,CAAC,GAAG,CAAC,sEAAsE,CAAC,CAAC;AACtF,CAAC"}
package/dist/types.d.ts CHANGED
@@ -19,32 +19,9 @@ export interface ForgeConfig {
19
19
  gateTimeouts: Record<string, number>;
20
20
  maxIterations: number;
21
21
  linearTeam: string;
22
- linearStates: {
23
- planned: string;
24
- inProgress: string;
25
- inReview: string;
26
- done: string;
27
- };
28
22
  verifyFreshness: number;
29
23
  forgeVersion: string;
30
24
  }
31
- /** Per-milestone status tracking. */
32
- export interface MilestoneStatus {
33
- status: 'pending' | 'in_progress' | 'complete';
34
- linearMilestoneId?: string;
35
- linearIssueIds?: string[];
36
- completedAt?: string;
37
- }
38
- /** PRD status file shape stored in .planning/status/. */
39
- export interface PRDStatus {
40
- project: string;
41
- slug: string;
42
- branch: string;
43
- createdAt: string;
44
- linearProjectId?: string;
45
- linearTeamId?: string;
46
- milestones: Record<string, MilestoneStatus>;
47
- }
48
25
  /** Cached verification result. */
49
26
  export interface VerifyCache {
50
27
  timestamp: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forge-cc",
3
- "version": "1.0.3",
3
+ "version": "2.0.0",
4
4
  "description": "Forge — verification harness for Claude Code agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -13,7 +13,6 @@
13
13
  "forge",
14
14
  "verification",
15
15
  "claude-code",
16
- "mcp",
17
16
  "pre-commit",
18
17
  "lint",
19
18
  "typescript"
@@ -24,8 +23,7 @@
24
23
  "main": "dist/gates/index.js",
25
24
  "exports": {
26
25
  ".": "./dist/gates/index.js",
27
- "./cli": "./dist/cli.js",
28
- "./server": "./dist/server.js"
26
+ "./cli": "./dist/cli.js"
29
27
  },
30
28
  "bin": {
31
29
  "forge": "dist/cli.js"
@@ -52,8 +50,8 @@
52
50
  },
53
51
  "dependencies": {
54
52
  "@linear/sdk": "^75.0.0",
55
- "@modelcontextprotocol/sdk": "^1.12.0",
56
53
  "commander": "^13.0.0",
54
+ "yaml": "^2.8.2",
57
55
  "zod": "^3.24.0"
58
56
  },
59
57
  "peerDependencies": {
package/skills/README.md CHANGED
@@ -1,33 +1,35 @@
1
- # forge-cc Skills
2
-
3
- Skills are markdown instruction files that Claude Code discovers and executes. When a user types a skill command (e.g., `/forge:triage`), Claude Code reads the corresponding markdown file and follows its instructions using available tools (MCP tools, Bash, file operations, etc.).
4
-
5
- Skills are prompts, not code. The LLM interprets the instructions and orchestrates tool calls to execute the workflow.
6
-
7
- ## Installation
8
-
9
- Copy or symlink the skill files into your Claude Code skills directory:
10
-
11
- ```bash
12
- # Copy all skills
13
- cp skills/forge-*.md ~/.claude/skills/
14
-
15
- # Or symlink (updates automatically with forge-cc)
16
- ln -s "$(pwd)/skills/forge-triage.md" ~/.claude/skills/forge-triage.md
17
- ```
18
-
19
- Skills are also distributed via `npm install forge-cc` and can be found in `node_modules/forge-cc/skills/`.
20
-
21
- ## Available Skills
22
-
23
- | Skill | Command | Description |
24
- |-------|---------|-------------|
25
- | Triage | `/forge:triage` | Brain dump to Linear projects. Paste unstructured ideas, get organized projects. |
26
- | Spec | `/forge:spec` | Interview to PRD. Select a project, answer questions, get milestones + issues. *(coming soon)* |
27
- | Go | `/forge:go` | Execute milestones. Wave-based agents, self-healing verification, auto mode. *(coming soon)* |
28
-
29
- ## Prerequisites
30
-
31
- - Claude Code with MCP tools enabled
32
- - Linear MCP tools configured (`mcp__linear__*`) for triage and spec skills
33
- - `forge-cc` installed in the project for verification gates (used by go skill)
1
+ # forge-cc Skills
2
+
3
+ Skills are markdown instruction files that Claude Code discovers and executes. When a user types a skill command (e.g., `/forge:capture`), Claude Code reads the corresponding markdown file and follows its instructions using available tools (Bash, file operations, etc.).
4
+
5
+ Skills are prompts, not code. The LLM interprets the instructions and orchestrates tool calls to execute the workflow.
6
+
7
+ ## Installation
8
+
9
+ Copy or symlink the skill files into your Claude Code skills directory:
10
+
11
+ ```bash
12
+ # Copy all skills
13
+ cp skills/forge-*.md ~/.claude/skills/
14
+
15
+ # Or symlink (updates automatically with forge-cc)
16
+ ln -s "$(pwd)/skills/forge-capture.md" ~/.claude/skills/forge-capture.md
17
+ ```
18
+
19
+ Skills are also distributed via `npm install forge-cc` and can be found in `node_modules/forge-cc/skills/`.
20
+
21
+ ## Available Skills
22
+
23
+ | Skill | Command | Description |
24
+ |-------|---------|-------------|
25
+ | Capture | `/forge:capture` | Brain dump to Linear projects. Paste unstructured ideas, get organized projects. |
26
+ | Plan | `/forge:plan` | Interview to requirement graph. Adaptive interview, vertical slice enforcement, graph generation. |
27
+ | Build | `/forge:build` | Graph execution with adversarial review. Worktree isolation, Linear state transitions. |
28
+ | Fix | `/forge:fix` | Surgical recovery for failed requirements. Targeted fixes with adversarial review. |
29
+ | Quick | `/forge:quick` | Ad-hoc tasks without planning ceremony. Direct build → verify with optional Linear tracking. |
30
+
31
+ ## Prerequisites
32
+
33
+ - Claude Code installed
34
+ - `LINEAR_API_KEY` set in your environment for Linear integration (used by capture, plan, and build skills)
35
+ - `forge-cc` installed in the project for verification gates and Linear CLI commands
@@ -0,0 +1,344 @@
1
+ # /forge:build — Graph Execution with Adversarial Review
2
+
3
+ Orchestrates requirement graph execution with worktree isolation, adversarial review, and Linear state transitions. Replaces `/forge:go`.
4
+
5
+ **Trigger:** `/forge:build` or `/forge:build --prd <slug>`
6
+
7
+ ## Prerequisites
8
+
9
+ - Requirement graph exists in `.planning/graph/{slug}/` (created by `/forge:plan`)
10
+ - `LINEAR_API_KEY` set in environment
11
+ - `.forge.json` with `linearTeam` configured
12
+ - `ForgeLinearClient` available from `forge-cc`
13
+
14
+ ## Instructions
15
+
16
+ Follow these steps exactly. Each requirement is executed in isolation, reviewed adversarially, and merged only on success.
17
+
18
+ ---
19
+
20
+ ### Step 0 — Load Graph
21
+
22
+ Load the requirement graph and determine what's ready to execute.
23
+
24
+ ```
25
+ index = loadIndex(projectDir, slug)
26
+ ready = findReady(index)
27
+ ```
28
+
29
+ **If `--prd <slug>` is provided:** Use that slug directly.
30
+
31
+ **If no slug provided:** Scan `.planning/graph/` for available graphs.
32
+ - If exactly one graph exists, use it.
33
+ - If multiple exist:
34
+
35
+ <AskUserQuestion>
36
+ question: "Multiple graphs found. Which project should I build?"
37
+ options:
38
+ - "{slug-1}: {title-1}"
39
+ - "{slug-2}: {title-2}"
40
+ - ...
41
+ </AskUserQuestion>
42
+
43
+ **After loading:**
44
+
45
+ - If `isProjectComplete(index)` is true:
46
+ Print: "All requirements in {slug} are complete. Nothing to build."
47
+ Exit.
48
+
49
+ - If `ready.length === 0` and there are pending requirements:
50
+ Print: "All pending requirements are blocked. Here are the blockers:"
51
+ List each blocked requirement and what it's waiting on.
52
+ Exit.
53
+
54
+ - If `ready.length > 0`:
55
+ Print: "Found {N} ready requirements out of {total} total. Starting execution."
56
+ Proceed to Step 1.
57
+
58
+ ---
59
+
60
+ ### Step 1 — Execution Loop
61
+
62
+ Execute requirements one at a time in priority order until the graph is complete.
63
+
64
+ ```
65
+ while (!isProjectComplete(index)) {
66
+ ready = findReady(index)
67
+ if (ready.length === 0) break // all blocked or discovered
68
+
69
+ reqId = ready[0] // priority desc → group order → insertion order
70
+ result = executeRequirement(index, reqId)
71
+
72
+ if (result === "complete") {
73
+ updateRequirementStatus(projectDir, slug, reqId, "complete")
74
+ syncRequirementDone(client, index, reqId) // Issue → Done
75
+ } else if (result === "failed") {
76
+ handleFailure(index, reqId, result.errors)
77
+ }
78
+
79
+ // Reload index — status may have changed, corrections may have been applied
80
+ index = loadIndex(projectDir, slug)
81
+ }
82
+
83
+ syncGraphProjectDone(client, index) // Project → Done if all complete
84
+ ```
85
+
86
+ **Execution order when multiple requirements are ready:**
87
+
88
+ `findReady()` may return multiple requirement IDs. Order them by:
89
+ 1. Priority descending (P0 before P1 before P2)
90
+ 2. Group order (earlier groups first)
91
+ 3. Insertion order (lower req number first)
92
+
93
+ Execute `ready[0]` sequentially. Future parallel execution will use `computeWaves()`.
94
+
95
+ **Between requirements — checkpoint:**
96
+ - Re-run `loadIndex()` to pick up any status changes
97
+ - Check for discovered requirements or graph corrections (see Step 5)
98
+ - Restage all files at wave boundaries — parallel agents can disrupt each other's git index
99
+
100
+ ---
101
+
102
+ ### Step 2 — Per-Requirement Execution
103
+
104
+ Each requirement goes through a full lifecycle: worktree creation, building, verification, adversarial review, and merge.
105
+
106
+ #### 2a. Worktree Lifecycle
107
+
108
+ Each requirement gets its own isolated worktree:
109
+
110
+ | Phase | Action | Details |
111
+ |-------|--------|---------|
112
+ | Create | `createWorktree(projectDir, branch)` | Branch: `feat/{slug}/{reqId}` |
113
+ | Build | Agent works in worktree | Claude session with requirement prompt |
114
+ | Verify | Run forge verification gates | `types`, `lint`, `tests` in the worktree |
115
+ | Review | Adversarial review | Separate agent checks reality against spec |
116
+ | Merge | `mergeWorktree()` | Merges branch into `feat/{slug}` |
117
+ | Cleanup | `removeWorktree()` | After successful merge only |
118
+
119
+ **On verification or review failure:** The agent retries in the SAME worktree (up to max iterations). The worktree is NOT cleaned up until the requirement completes or is marked failed.
120
+
121
+ #### 2b. Prompt Construction
122
+
123
+ Build the agent prompt for each requirement. Loading order matters — most important content goes LAST (attention-sharp zone):
124
+
125
+ 1. **Overview** — project context, tech approach, scope (from `overview.md`)
126
+ 2. **Transitive deps** — requirement files in topological order, deps-first (from `buildRequirementContext(index, reqId)`)
127
+ 3. **Completed dep artifacts** — actual file contents created/modified by completed dependencies. The code IS the summary — inline actual code from created files into downstream agent prompts. Never use predicted/spec types.
128
+ 4. **Target requirement** — the actual requirement file content (LAST = highest attention)
129
+
130
+ **Context budget priority** (if window is tight):
131
+
132
+ | Priority | Content | Action if tight |
133
+ |----------|---------|-----------------|
134
+ | 1 (highest) | Target requirement | Always include in full |
135
+ | 2 | Completed dep artifacts | Include actual file contents |
136
+ | 3 | Overview | Summarize if needed |
137
+ | 4 | Transitive dep requirements | Summarize or truncate |
138
+ | 5 (lowest) | Codebase files | Omit — agent can read them |
139
+
140
+ #### 2c. Build Iterations
141
+
142
+ Max **3 iterations** per requirement:
143
+
144
+ | Iteration | Agent Action |
145
+ |-----------|-------------|
146
+ | 1 | Build from prompt — implement the requirement |
147
+ | 2 | Fix verification failures from iteration 1 (if any) |
148
+ | 3 | Fix remaining issues from iteration 2 (if any) |
149
+
150
+ Each iteration follows this cycle:
151
+ ```
152
+ build/fix → verify gates (types, lint, tests) → adversarial review
153
+ ```
154
+
155
+ Run `npx tsc --noEmit` between every iteration — catches integration issues before the next attempt.
156
+
157
+ If iteration passes both verification AND review: requirement is complete.
158
+ If iteration 3 fails: proceed to failure handling (Step 4).
159
+
160
+ ---
161
+
162
+ ### Step 3 — Adversarial Review
163
+
164
+ See `ref/adversarial-review.md` for the full protocol.
165
+
166
+ The reviewer is a **separate agent** — NOT the builder. It receives:
167
+ - The requirement file (acceptance criteria, technical approach)
168
+ - The actual files on disk in the worktree post-change
169
+ - NOT the diff. NOT the builder's summary. It checks reality against spec.
170
+
171
+ **Review checklist:**
172
+
173
+ 1. **Acceptance criteria met** — Every criterion in the requirement is behaviorally satisfied
174
+ 2. **No stub implementations** — No empty functions, TODO comments, hardcoded returns, or placeholder logic
175
+ 3. **File scope respected** — Files listed in the requirement's `creates`/`modifies` were actually created/modified
176
+ 4. **No unintended side effects** — Files outside the requirement's scope were not modified unexpectedly
177
+
178
+ **Review output:** `PASS` or `FAIL` with specific findings.
179
+
180
+ **If FAIL:** Findings feed back into the next build iteration as error context. The builder agent receives the exact findings and must address each one.
181
+
182
+ **Always delegate to builder agents** for implementation work, even for sequential tasks. The point is preserving the orchestrator's context window, not parallelism.
183
+
184
+ ---
185
+
186
+ ### Step 4 — Failure Handling
187
+
188
+ When a requirement fails verification after max iterations (3):
189
+
190
+ <AskUserQuestion>
191
+ question: "Requirement {reqId} ('{title}') failed after 3 iterations. The remaining issues are:
192
+ {list of failures}
193
+
194
+ How would you like to proceed?"
195
+ options:
196
+ - "Skip and continue — keep as in_progress, move to next ready requirement"
197
+ - "Retry with more iterations — reset iteration count and try again"
198
+ - "Stop execution — halt the build loop entirely"
199
+ - "Open forge:fix — switch to surgical fix mode for this requirement"
200
+ </AskUserQuestion>
201
+
202
+ **Behavior for each option:**
203
+
204
+ | Option | Action |
205
+ |--------|--------|
206
+ | Skip and continue | Requirement stays `in_progress` (NOT complete). Requirements depending on it become blocked. Build loop continues with other ready requirements. Worktree is preserved for later `forge:fix`. |
207
+ | Retry with more iterations | Reset iteration count to 0. Re-enter the build cycle for this requirement. |
208
+ | Stop execution | Halt the build loop. Print current progress summary. Worktree is preserved. |
209
+ | Open forge:fix | Switch to `/forge:fix` mode targeting this specific requirement and worktree. |
210
+
211
+ ---
212
+
213
+ ### Step 5 — Discovered Requirements and Graph Corrections
214
+
215
+ During execution, agents may discover issues with the graph. See `ref/graph-correction.md` for the full correction protocol.
216
+
217
+ **Types of discoveries:**
218
+
219
+ | Discovery | Description | Handling |
220
+ |-----------|-------------|----------|
221
+ | New requirements | Functionality not in the original graph | Added as `disc-NNN` with `discovered` status in index. Surfaced to user. |
222
+ | Missing dependency edges | req-005 actually needs req-002 done first | Proposed as `addEdge(from, to)`. Applied if user approves (or auto-applied in `--auto` mode if no cycle). |
223
+ | Wrong file scoping | Requirement touches files not listed in scope | Applied silently to `_index.yaml` |
224
+ | Group ordering corrections | Group B should depend on Group A | Surfaced to user for approval |
225
+
226
+ **At each checkpoint (between requirements):**
227
+
228
+ If the builder agent reports any discoveries:
229
+
230
+ 1. **New requirements:**
231
+ Print: "Builder discovered a new requirement: {description}"
232
+
233
+ <AskUserQuestion>
234
+ question: "Add this as a new requirement to the graph?"
235
+ options:
236
+ - "Yes — add it as discovered"
237
+ - "No — skip it"
238
+ - "Yes, and it depends on {reqId}"
239
+ </AskUserQuestion>
240
+
241
+ 2. **Missing edges:**
242
+ Print: "Builder found that {reqId-A} actually depends on {reqId-B}."
243
+ Run `detectCycles()` before applying. If adding the edge would create a cycle, reject it and report.
244
+
245
+ 3. **File scope corrections:**
246
+ Apply silently — update `_index.yaml` via `writeIndex()`.
247
+
248
+ 4. **Group ordering corrections:**
249
+ Surface to user for approval before applying.
250
+
251
+ ---
252
+
253
+ ### Step 6 — Completion
254
+
255
+ When the execution loop ends, determine the final state:
256
+
257
+ **If `isProjectComplete(index)` is true:**
258
+
259
+ ```
260
+ syncGraphProjectDone(client, index) // Project → Done in Linear
261
+ ```
262
+
263
+ Print the completion summary:
264
+
265
+ ```
266
+ ## Build Complete: {project title}
267
+
268
+ **Slug:** {slug}
269
+ **Requirements completed:** {completed} / {total}
270
+ **Waves executed:** {count}
271
+ **Linear Project:** {project URL} — Done
272
+
273
+ All requirements verified and merged.
274
+ ```
275
+
276
+ **If the loop ended with blocked/discovered requirements:**
277
+
278
+ ```
279
+ ## Build Paused: {project title}
280
+
281
+ **Slug:** {slug}
282
+ **Completed:** {completed} / {total}
283
+ **Blocked:** {blocked count} (waiting on dependencies)
284
+ **Discovered:** {discovered count} (new requirements found during execution)
285
+
286
+ ### Blocked Requirements
287
+ {for each blocked: reqId, title, what it's waiting on}
288
+
289
+ ### Next Steps
290
+ 1. Run `/forge:fix` to address blocked requirements
291
+ 2. Run `/forge:build {slug}` to resume execution
292
+ ```
293
+
294
+ ---
295
+
296
+ ## Linear State Reference
297
+
298
+ State transitions are driven by execution progress:
299
+
300
+ | Item | Transition | When |
301
+ |------|-----------|------|
302
+ | Issue | Planned → In Progress | Agent starts working on requirement |
303
+ | Issue | In Progress → Done | Requirement verified + merged |
304
+ | Project | Planned → In Progress | First requirement starts |
305
+ | Project | In Progress → Done | ALL requirements complete |
306
+
307
+ **If any Linear transition fails:** Log a warning and continue. Never block execution on Linear API failures.
308
+
309
+ ---
310
+
311
+ ## Context Budget
312
+
313
+ Keep these limits during execution to preserve the orchestrator's context window:
314
+
315
+ | Item | Budget |
316
+ |------|--------|
317
+ | Orchestrator context | Track progress only — delegate all implementation to builder agents |
318
+ | Builder prompt | Target requirement + completed dep artifacts + overview + transitive deps |
319
+ | Review prompt | Requirement file + actual files on disk — no diffs, no builder summaries |
320
+ | Between-requirement checkpoint | Reload index, check discoveries, restage files |
321
+
322
+ ---
323
+
324
+ ## Key References
325
+
326
+ - `ref/adversarial-review.md` — Full review protocol (reviewer receives requirement file + actual files on disk, NOT diff/builder summary; stub detection; PASS/FAIL output)
327
+ - `ref/graph-correction.md` — Mid-execution correction protocol (discovered reqs, missing edges, file scope, group ordering; checkpoint timing; auto-apply rules)
328
+ - `ref/requirement-sizing.md` — Sizing rules (hard/soft limits, splitting guide)
329
+
330
+ ## Graph Module API
331
+
332
+ These TypeScript functions are available for graph operations:
333
+
334
+ - `loadIndex(projectDir, slug)` — Load `_index.yaml` from `.planning/graph/{slug}/`
335
+ - `writeIndex(projectDir, slug, index)` — Write `_index.yaml`
336
+ - `findReady(index)` — Return requirement IDs with all deps complete
337
+ - `computeWaves(index)` — Group requirements into parallel execution waves
338
+ - `detectCycles(index)` — Check for circular dependencies
339
+ - `isProjectComplete(index)` — Check if all requirements are complete
340
+ - `buildRequirementContext(index, reqId)` — Return transitive deps in topological order
341
+ - `updateRequirementStatus(projectDir, slug, reqId, status)` — Update a requirement's status
342
+ - `createWorktree(projectDir, branch)` — Create a git worktree for isolated execution
343
+ - `mergeWorktree()` — Merge worktree branch back into the feature branch
344
+ - `removeWorktree()` — Clean up worktree after merge