@laitszkin/apollo-toolkit 5.0.2 → 5.0.4

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.
@@ -13,16 +13,22 @@ This prompt defines a coordinator agent:
13
13
 
14
14
  This skill is responsible for "planning the coordination strategy" — extracting information from SPEC/DESIGN/CHECKLIST, decomposing into concrete tasks, pre-writing worker prompts, and scheduling batch execution order.
15
15
 
16
+ Worker prompts are written to individual files under `<spec_dir>/plan/` (single spec) or `<batch_dir>/plan/` (batch spec) instead of inline in PROMPT.md. This keeps PROMPT.md focused on coordination strategy while each worker prompt is independently dispatchable.
17
+
16
18
  ## Acceptance Criteria
17
19
 
18
20
  - `docs/plans/<YYYY-MM-DD>/<spec_name>/PROMPT.md` is produced and placed at the root of the spec or batch spec directory
19
21
  - PROMPT.md is a **self-contained coordinator prompt**, containing:
20
22
  - Coordinator role definition (what to do, what not to do)
21
23
  - Task decomposition with dependency graph
22
- - Pre-written worker prompts for every dispatchable task (self-contained, ready to send)
24
+ - Worker prompt index referencing `plan/*.md` files
23
25
  - Batch schedule with verification gates
24
26
  - Error recovery strategy
25
27
  - Boundary rules (ALWAYS / ASK FIRST / NEVER)
28
+ - Worker prompts are stored in `<spec_dir>/plan/*.md` or `<batch_dir>/plan/*.md`, one prompt per file
29
+ - PROMPT.md References section cites:
30
+ - Worker prompt file paths (`plan/*.md`)
31
+ - All code file paths that need modification across all tasks
26
32
 
27
33
  ## Workflow
28
34
 
@@ -39,6 +45,7 @@ Read all files thoroughly:
39
45
  - `SPEC.md` — Business requirements and scope (BDD GIVEN/WHEN/THEN), In/Out of Scope
40
46
  - `DESIGN.md` — Module architecture, interaction anchors (INT-###), external dependencies (EXT-###), system invariants, technical trade-offs
41
47
  - `CHECKLIST.md` — Behavior-to-test mapping, hardening requirements, test level choices
48
+ - `<spec_dir>/references/` or `<batch_dir>/references/` — External method/API reference documents (name, purpose, parameters)
42
49
 
43
50
  ### 3. Task Decomposition
44
51
 
@@ -88,25 +95,27 @@ File overlap detection is the **gate that determines parallelism**. Perform this
88
95
 
89
96
  ### 6. Write Worker Prompts (One Per Dispatchable Task)
90
97
 
91
- For each task that needs an independent worker, write a self-contained worker prompt. PROMPT.md Section 6 (Worker Prompt Library).
98
+ For each task that needs an independent worker, write a self-contained worker prompt. Save each prompt to a separate file under `<spec_dir>/plan/` or `<batch_dir>/plan/`.
99
+
100
+ **Worker prompt file naming**: `plan/T{batch}.{sequence}-{kebab-case-name}.md`
92
101
 
93
102
  Each worker prompt must include:
94
103
 
95
104
  ```
96
105
  ## Mission — What to do and why
97
106
  ## Input — Which files to read
98
- ## What to do — Concrete steps (describe "what" to do, not "which tool" to use)
107
+ ## What to do — Concrete steps, each specifying the exact file path, the function or line range, and what specific change to make (add/delete/modify). Never leave the change description vague.
99
108
  ## Scope — Allowed and forbidden files
100
109
  ## Output — What to report on completion (file list, change summary, test results, risks)
101
110
  ## Verify — Verification commands and expected results
102
111
  ## Boundaries — Constraints (don't touch other workers' files, don't add dependencies, report blockers)
103
112
  ```
104
113
 
105
- **Writing principles:**
106
- - **Self-contained**: Workers do not see the coordinator's context. The prompt must include everything necessary
107
- - **Concrete**: Embed file paths, function names, line numbers. Do not write "fix it" or "based on your findings"
108
- - **Declarative**: Describe "what to do", not "which tool to use"
109
- - **Clear boundaries**: Explicitly list allowed and forbidden files
114
+ **Writing principles (move these to your process, not the template):**
115
+ - **Self-contained**: Workers do not see the coordinator's context. The prompt must include everything necessary. Do not rely on shared context or assume the worker has read other documents.
116
+ - **Concrete**: For every file the worker must modify, specify: (1) the exact file path, (2) the function or line range, (3) what to add, delete, or change. Do not write "fix it", "update as needed", or "based on your findings".
117
+ - **Declarative**: Describe "what to do", not "which tool to use".
118
+ - **Clear boundaries**: Explicitly list allowed and forbidden files. A worker should never need to guess which files it can modify.
110
119
 
111
120
  Tasks that do not need a worker (purely procedural operations) do not get a worker prompt. The coordinator handles these directly in the corresponding batch.
112
121
 
@@ -132,7 +141,7 @@ Based on dependency analysis and file overlap detection, build the batch schedul
132
141
 
133
142
  → PROMPT.md Section 10 (Boundaries).
134
143
 
135
- - **ALWAYS**: Run gate verification after every batch, extract worker prompts verbatim from Section 6, digest results before deciding next step
144
+ - **ALWAYS**: Run gate verification after every batch, extract worker prompts verbatim from Section 7, digest results before deciding next step
136
145
  - **ASK FIRST**: Modify files not defined in SPEC/DESIGN, add new dependencies, two worker failures, regression with unclear cause
137
146
  - **NEVER**: Coordinator edits source code directly, workers spawn sub-workers, skip verification, issue vague instructions
138
147
 
@@ -147,11 +156,12 @@ Use `assets/templates/PROMPT.md`. Fill each section according to the table below
147
156
  | 3. Scope & Boundaries | SPEC.md In/Out of Scope |
148
157
  | 4. Technical Context | DESIGN.md: module list with responsibilities, interaction anchors (INT-###) and dependency order, external dependency setup order (EXT-###), system invariants, technical decisions and trade-offs |
149
158
  | 5. Task Units | Step 3 (task decomposition) + Step 4 (dependency analysis) |
150
- | 6. Worker Prompt Library | Step 6 — one entry per dispatchable task |
159
+ | 6. Worker Prompt Index | Step 6 — list of `plan/*.md` files with task ID mapping |
151
160
  | 7. Batch Schedule | Step 7 (batch schedule) |
152
161
  | 8. Verification Checkpoints | CHECKLIST.md: behavior-to-test mapping (CL-###), hardening requirements, test execution commands |
153
162
  | 9. Error Recovery | Fixed template — populate spec-specific test commands from CHECKLIST.md |
154
- | 10. Boundaries | Fixed template + spec-specific rules |
163
+ | 10. Boundaries | Fixed template + spec-specific rules (including worktree cleanup after each batch) |
164
+ | 11. References | Worker prompt file paths (`plan/*.md`), all code file paths that need modification across all tasks, project context files (CLAUDE.md, AGENTS.md, architecture atlas, codegraph index) |
155
165
 
156
166
  ### 11. Pre-delivery Self-Review
157
167
 
@@ -159,9 +169,10 @@ Before delivering PROMPT.md, verify all of the following.
159
169
 
160
170
  **Worker prompt quality:**
161
171
 
162
- - Every worker prompt in Section 6 is self-contained. Scan for phrases like "based on your findings", "fix it appropriately", "as discussed above" — these leak shared context assumptions. If found, rewrite the prompt to include the necessary information inline.
172
+ - Every worker prompt in `plan/*.md` is self-contained. Scan for phrases like "based on your findings", "fix it appropriately", "as discussed above" — these leak shared context assumptions. If found, rewrite the prompt to include the necessary information inline.
163
173
  - Every worker prompt has a concrete file-level Scope (allowed + forbidden files listed explicitly).
164
174
  - Every worker prompt has a concrete Verify command with an expected output (not just "run tests").
175
+ - Worker prompt filenames match their task IDs (`plan/T{batch}.{sequence}-*.md`).
165
176
 
166
177
  **Coverage completeness:**
167
178
 
@@ -172,18 +183,20 @@ Before delivering PROMPT.md, verify all of the following.
172
183
  **Structural consistency:**
173
184
 
174
185
  - Each task's Depends on field in Section 5 matches the batch ordering in Section 7. No task scheduled in a batch before its dependencies are met.
175
- - Every task listed in Section 7 (Batch Schedule) has a worker prompt in Section 6 — unless it is explicitly marked as coordinator-handled.
186
+ - Every task listed in Section 7 (Batch Schedule) has a worker prompt in `plan/*.md` — unless it is explicitly marked as coordinator-handled.
176
187
  - No orphaned tasks (a task listed in Section 5 that never appears in any batch), no missing dependencies (a Depends on field referencing a task ID that does not exist).
188
+ - PROMPT.md References section lists all worker prompt paths and all code file paths.
177
189
 
178
- ### 12. Produce PROMPT.md
190
+ ### 12. Produce PROMPT.md and Worker Prompts
179
191
 
180
192
  Place the PROMPT.md at the root of the spec or batch spec directory.
193
+ Place worker prompts in `<spec_dir>/plan/` or `<batch_dir>/plan/`.
181
194
 
182
195
  ## Examples
183
196
 
184
- - "Generate a coordinator prompt for a single spec" → Read SPEC.md + DESIGN.md → Decompose into 3 tasks → T1.1 and T1.2 have no file overlap → parallel → Write worker prompts for each → Schedule: Batch 1 parallel T1.1+T1.2 → Batch 2 T1.3 → Output PROMPT.md
185
- - "Generate a coordinator prompt for a batch spec with 4 specs" → Read all SPEC.md + DESIGN.md → Build spec DAG → Detect cross-spec file overlap → Schedule batches → Write worker prompts for each spec's task units → Output PROMPT.md
186
- - "Two tasks modify the same file" → Assign to different batches, each with an independent worker prompt, sequential execution
197
+ - "Generate a coordinator prompt for a single spec" → Read SPEC.md + DESIGN.md + references/ → Decompose into 3 tasks → T1.1 and T1.2 have no file overlap → parallel → Write worker prompts to `plan/` → Schedule: Batch 1 parallel T1.1+T1.2 → Batch 2 T1.3 → Output PROMPT.md + plan/*.md
198
+ - "Generate a coordinator prompt for a batch spec with 4 specs" → Read all SPEC.md + DESIGN.md + references/ → Build spec DAG → Detect cross-spec file overlap → Schedule batches → Write worker prompts to `plan/` → Output PROMPT.md + plan/*.md
199
+ - "Two tasks modify the same file" → Assign to different batches, each with an independent worker prompt in `plan/`, sequential execution → Reference both prompt paths in PROMPT.md
187
200
 
188
201
  ## References
189
202
 
@@ -19,7 +19,7 @@
19
19
  - Wait for all workers in a batch to complete, then digest their results
20
20
  - Run verification commands at each checkpoint
21
21
  - Decide whether to proceed to the next batch, retry a failed worker, or halt
22
- - Handle lightweight coordination tasks: resolving merge conflicts, updating lockfiles
22
+ - Handle lightweight coordination tasks: resolving merge conflicts, updating lockfiles, cleaning up worktrees
23
23
  - Commit all changes in a single commit after the final verification gate passes
24
24
 
25
25
  ### What you NEVER do
@@ -84,15 +84,7 @@
84
84
 
85
85
  - **Goal**: [One sentence]
86
86
  - **Files**: `[file list]`
87
- - **Depends on**: [Task ID, or — (no dependency)]
88
- - **Verify**:
89
- - Command: `[command]`
90
- - Expected: [what you should see]
91
-
92
- #### T{batch}.{sequence}: [Task name]
93
-
94
- - **Goal**: [One sentence]
95
- - **Files**: `[file list]`
87
+ - **Worker prompt**: `plan/T{batch}.{sequence}-[name].md`
96
88
  - **Depends on**: [Task ID, or — (no dependency)]
97
89
  - **Verify**:
98
90
  - Command: `[command]`
@@ -100,49 +92,16 @@
100
92
 
101
93
  ---
102
94
 
103
- ## 6. Worker Prompt Library
104
-
105
- [Each dispatchable task has a pre-written self-contained worker prompt. The coordinator extracts the corresponding block and dispatches it without modification.]
106
-
107
- ### T{batch}.{sequence}: [Task name]
108
-
109
- ```
110
- ## Mission
111
- [Brief description of what to do and why. Enough context for the worker to understand the task's purpose.]
95
+ ## 6. Worker Prompt Index
112
96
 
113
- ## Input
114
- - Read the following files: [list]
97
+ [Each dispatchable task has a pre-written self-contained worker prompt in a separate file under `plan/`. The coordinator reads the corresponding file and dispatches it without modification.]
115
98
 
116
- ## What to do
117
- 1. [Concrete step — describe "what" to do, not "which tool" to use]
118
- 2. [Include specific file paths, function names, line numbers]
119
-
120
- ## Scope
121
- - Allowed files:
122
- - `[path]` — [explanation]
123
- - Forbidden files:
124
- - `[path]` — (belongs to another worker)
125
-
126
- ## Output
127
- On completion, report:
128
- - Which files were modified (absolute paths)
129
- - Change summary for each file
130
- - Test results (pass/fail)
131
- - Any blockers or risks encountered
132
-
133
- ## Verify
134
- - Run: `[command]`
135
- - Expected: [what you should see]
136
-
137
- ## Boundaries
138
- - Do not modify any file in the forbidden list
139
- - Do not introduce new external dependencies
140
- - If you encounter an unexpected blocker, stop and report — do not invent alternative approaches
141
- ```
142
-
143
- ---
99
+ | Task ID | Worker Prompt File | Description |
100
+ |---|---|---|
101
+ | T1.1 | `plan/T1.1-implement-login.md` | [Brief description] |
102
+ | T1.2 | `plan/T1.2-implement-logout.md` | [Brief description] |
144
103
 
145
- [Repeat the above block for each dispatchable task. Tasks handled directly by the coordinator (purely procedural operations) do not need a worker prompt.]
104
+ [Tasks handled directly by the coordinator (purely procedural operations) do not have an entry here.]
146
105
 
147
106
  ---
148
107
 
@@ -223,10 +182,11 @@ On completion, report:
223
182
  ### ALWAYS
224
183
 
225
184
  - Run gate verification immediately after every batch
226
- - Extract worker prompts verbatim from Section 6 — do not rewrite them
185
+ - Extract worker prompts verbatim from `plan/*.md` files — do not rewrite them
227
186
  - After a worker reports, digest the results before deciding next steps
228
187
  - Follow the File Ownership implied by task assignments — do not let two workers modify the same file
229
188
  - **Resolve merge conflicts yourself** — when combining worker results, the coordinator handles conflict resolution. This is coordination, not implementation.
189
+ - **After each batch completes, clean up any temporary branches or worktrees created by workers** — no ephemeral worktree should be left orphaned.
230
190
  - After two failures, pause and ask — do not keep retrying
231
191
 
232
192
  ### ASK FIRST — pause and confirm with the user
@@ -244,3 +204,14 @@ On completion, report:
244
204
  - Give workers vague instructions (e.g., "fix it" or "based on what you found")
245
205
  - Expand implementation scope beyond Section 3
246
206
  - Proceed to the next batch when the current batch's gate has not passed
207
+
208
+ ---
209
+
210
+ ## 11. References
211
+
212
+ - **Worker prompt files**: [List all `plan/*.md` files — e.g., `plan/T1.1-implement-login.md`, `plan/T1.2-implement-logout.md`]
213
+ - **Code files to modify** (across all tasks):
214
+ - [File path — e.g., `src/auth/login.ts`]
215
+ - [File path — e.g., `src/auth/logout.ts`]
216
+ - **Project context files**: [List important project files — e.g., `CLAUDE.md`, `AGENTS.md`, `resources/project-architecture/**`, codegraph index files]
217
+ - **Related documents**: [Links to related specs, design docs, or external documentation]
@@ -13,18 +13,25 @@ This prompt defines a fix coordinator agent:
13
13
 
14
14
  This skill is responsible for "planning the fix strategy" — extracting information from REPORT.md + SPEC/DESIGN/CHECKLIST, writing worker prompts for each fix and regression test, and scheduling batch execution order.
15
15
 
16
+ Worker prompts are written to individual files under `<spec_dir>/fix/` (single spec) or `<batch_dir>/fix/` (batch spec) instead of inline in FIX.md. This keeps FIX.md focused on coordination strategy while each fix/regression worker prompt is independently dispatchable.
17
+
16
18
  ## Acceptance Criteria
17
19
 
18
20
  - `docs/plans/<YYYY-MM-DD>/<spec_name>/FIX.md` is produced and placed in the spec directory (same level as REPORT.md)
19
21
  - FIX.md is a **self-contained fix coordinator prompt**, containing:
20
22
  - Coordinator role definition
21
23
  - Issue inventory with dependency analysis
22
- - Pre-written worker prompt for every fix issue
23
- - Regression test design and worker prompt for every fix
24
+ - Worker prompt index referencing `fix/*.md` files
25
+ - Pre-written worker prompts for every fix and regression test (stored in `fix/*.md`)
26
+ - Regression test design for every fix
24
27
  - Batch schedule (fix batches + regression test batches + final verification)
25
28
  - Error recovery strategy
26
29
  - Boundary rules
27
- - **Every issue in REPORT.md (including P2/P3) has a complete fix plan with a corresponding worker prompt in FIX.md.** No issue may be deferred to a future round or marked as "handle later."
30
+ - Worker prompts are stored in `<spec_dir>/fix/*.md` or `<batch_dir>/fix/*.md`, one prompt per file
31
+ - FIX.md References section cites:
32
+ - Worker prompt file paths (`fix/*.md`)
33
+ - All code file paths that need modification across all fixes and regression tests
34
+ - **Every issue in REPORT.md (including P2/P3) has a complete fix plan with a corresponding worker prompt.** No issue may be deferred to a future round or marked as "handle later."
28
35
 
29
36
  ## Workflow
30
37
 
@@ -36,6 +43,7 @@ Read all of the following:
36
43
 
37
44
  - **SPEC.md + DESIGN.md + CHECKLIST.md**: Full spec and design documentation
38
45
  - **REPORT.md**: Review findings (verdict + P0-P3 issue list + dimension summary)
46
+ - `<spec_dir>/references/` or `<batch_dir>/references/` — External method/API reference documents
39
47
 
40
48
  Understand the original design intent of the spec and the nature of each issue in REPORT.md.
41
49
 
@@ -59,7 +67,7 @@ For each issue in REPORT.md (in P0 → P1 → P2 → P3 order) → FIX.md Sectio
59
67
 
60
68
  ### 4. Design Regression Tests for Each Fix
61
69
 
62
- For every fix issue, design a concrete regression test → FIX.md Section 5 (Fix Details, regression test field) → FIX.md Section 6 (Worker Prompt Library, REGTEST entries).
70
+ For every fix issue, design a concrete regression test → FIX.md Section 5 (Fix Details, regression test field) → worker prompt in `fix/*REGtest*.md`.
63
71
 
64
72
  Design principles:
65
73
  - **Every P0/P1 issue needs at least one regression test.** For P2/P3 issues, if automated testing is impractical, define manual verification steps.
@@ -99,9 +107,11 @@ File overlap detection is the **gate that determines parallel vs sequential exec
99
107
 
100
108
  ### 7. Write Worker Prompts
101
109
 
102
- #### 7a. Fix Worker Prompts → FIX.md Section 6
110
+ #### 7a. Fix Worker Prompts
111
+
112
+ Write a self-contained worker prompt for each fix issue. Save each prompt to a separate file under `<spec_dir>/fix/` or `<batch_dir>/fix/`.
103
113
 
104
- Write a self-contained worker prompt for each fix issue.
114
+ **Worker prompt file naming**: `fix/FIX-{sequence}-{kebab-case-name}.md`
105
115
 
106
116
  Each fix worker prompt must include:
107
117
 
@@ -109,7 +119,7 @@ Each fix worker prompt must include:
109
119
  ## Mission — What to fix and why
110
120
  ## Context — Which review dimension, which spec requirement
111
121
  ## Input — Which files to read
112
- ## What to do — Concrete fix steps (describe "what" to do, not "which tool" to use)
122
+ ## What to do — Concrete fix steps, each specifying the exact file path, the function or line range, and what specific change to make (add/delete/modify). Never leave the change description vague.
113
123
  ## Scope — Allowed and forbidden files
114
124
  ## Output — What to report on completion
115
125
  ## Verify — Verification commands and expected results
@@ -119,10 +129,12 @@ Each fix worker prompt must include:
119
129
  **Simple fixes can be merged**: Multiple simple, non-conflicting fixes can be combined into one worker prompt.
120
130
  **Complex fixes stand alone**: Complex fixes (requiring systematic debug) must have independent worker prompts.
121
131
 
122
- #### 7b. Regression Test Worker Prompts → FIX.md Section 6
132
+ #### 7b. Regression Test Worker Prompts
123
133
 
124
134
  Write a self-contained worker prompt for each regression test. The regression test worker is responsible for **writing test code**.
125
135
 
136
+ **Worker prompt file naming**: `fix/REGTEST-{sequence}-{kebab-case-name}.md`
137
+
126
138
  Each regression test worker prompt must include:
127
139
 
128
140
  ```
@@ -137,6 +149,11 @@ Each regression test worker prompt must include:
137
149
  ## Verify — Run the test, confirm it passes (proving the fix works)
138
150
  ```
139
151
 
152
+ **Writing principles (move these to your process, not the template):**
153
+ - Writing clear worker prompts means being concrete, not declarative. For every file the worker must modify, specify: (1) the exact file path, (2) the function or line range, (3) what to add, delete, or change.
154
+ - Workers do not see the coordinator's context. The prompt must include everything necessary.
155
+ - A regression test that passes before the fix is not a valid test. Always design the oracle so it fails on unfixed code.
156
+
140
157
  #### 7c. Cases That Do Not Need a Worker
141
158
 
142
159
  - Single-line typo fixes (multiple typos can be batched into one worker)
@@ -180,23 +197,46 @@ Use `assets/templates/FIX.md`. Fill according to the table below.
180
197
  | 3. Issue Inventory | REPORT.md issue list (condensed to NL one-liners) |
181
198
  | 4. Fix Dependency Analysis | Steps 5-6 (dependency analysis + file overlap) |
182
199
  | 5. Fix Details (with regression test design) | Step 3 (fix plan) + Step 4 (regression test design) |
183
- | 6. Worker Prompt Library | Step 7a (fix prompts) + Step 7b (regression test prompts) |
200
+ | 6. Worker Prompt Index | Step 7 list of `fix/*.md` files with FIX/REGTEST ID mapping |
184
201
  | 7. Fix Batch Schedule | Step 8 (batch schedule) |
185
202
  | 8. Regression Test Inventory | Step 4 full list. If regtests ≤ 3, omit (Section 5 is sufficient). If ≥ 4, include a condensed NL list. |
186
203
  | 9. Verification Checkpoints | Fixed scaffold, customized with spec-specific commands |
187
204
  | 10. Error Recovery | Fixed scaffold (natural language) |
188
205
  | 11. Fix History | Fixed scaffold (history entries only, no instructions) |
189
- | 12. Boundaries | Fixed scaffold + spec-specific rules |
206
+ | 12. References | Worker prompt file paths (`fix/*.md`), all code file paths that need modification across all fixes/regtests, project context files |
207
+ | 13. Boundaries | Fixed scaffold + spec-specific rules (including worktree cleanup after each batch) |
208
+
209
+ ### 11. Pre-delivery Self-Review
210
+
211
+ Before delivering FIX.md, verify all of the following.
212
+
213
+ **Worker prompt quality:**
214
+
215
+ - Every worker prompt in `fix/*.md` is self-contained. Scan for phrases like "based on your findings", "fix it appropriately", "as discussed above" — these leak shared context assumptions.
216
+ - Every fix worker prompt has concrete file-level Scope and a specific Verify command.
217
+ - Worker prompt filenames match their fix IDs (`fix/FIX-{sequence}-*.md`, `fix/REGTEST-{sequence}-*.md`).
218
+
219
+ **Coverage completeness:**
220
+
221
+ - Every issue in REPORT.md (P0–P3) has a corresponding worker prompt. No deferred issues.
222
+ - Every fix has a corresponding regression test (or documented manual verification steps for P2/P3 where automated testing is impractical).
223
+
224
+ **Structural consistency:**
225
+
226
+ - Each fix's dependency analysis matches the batch ordering. No fix scheduled before its dependencies are met.
227
+ - Regression tests are scheduled after all fix batches complete.
228
+ - FIX.md References section lists all worker prompt paths and all code file paths.
190
229
 
191
- ### 11. Produce FIX.md
230
+ ### 12. Produce FIX.md and Worker Prompts
192
231
 
193
- Place FIX.md in the spec directory (same level as REPORT.md).
232
+ Place the FIX.md in the spec directory (same level as REPORT.md).
233
+ Place worker prompts in `<spec_dir>/fix/` or `<batch_dir>/fix/`.
194
234
 
195
235
  ## Examples
196
236
 
197
- - REPORT.md has 3 P0 issues (hallucinated code, deviation, omission) and 2 P1 issues → Each P0/P1 gets 1+ regression test → FIX.md has 3 fix workers + 5 regression test workers → Schedule: Batch 1 parallel fix 3 P0 → Batch 2 fix 2 P1 → Batch 3 parallel 5 regtests → Batch 4 final
198
- - Two P0 issues both modify `src/auth.ts` → File overlap → Separate into sequential batches → Regression tests run after all fix batches complete
199
- - A P0 logic error: `getDiscount()` does not handle negative input → Regression test: unit test with GIVEN negative input WHEN calling getDiscount THEN return 0 (before fix, returns incorrect negative discount)
237
+ - REPORT.md has 3 P0 issues (hallucinated code, deviation, omission) and 2 P1 issues → Each P0/P1 gets 1+ regression test → FIX.md + fix/ with 3 fix workers + 5 regression test workers → Schedule: Batch 1 parallel fix 3 P0 → Batch 2 fix 2 P1 → Batch 3 parallel 5 regtests → Batch 4 final
238
+ - Two P0 issues both modify `src/auth.ts` → File overlap → Separate into sequential batches → Regression tests run after all fix batches complete → Worker prompts in `fix/FIX-01-*.md` and `fix/FIX-02-*.md`
239
+ - A P0 logic error: `getDiscount()` does not handle negative input → Regression test: unit test with GIVEN negative input WHEN calling getDiscount THEN return 0 (before fix, returns incorrect negative discount) → Worker prompt in `fix/REGTEST-01-discount.md`
200
240
 
201
241
  ## References
202
242
 
@@ -100,112 +100,23 @@
100
100
 
101
101
  ---
102
102
 
103
- ## 6. Worker Prompt Library
103
+ ## 6. Worker Prompt Index
104
104
 
105
- ### Fix Worker Prompts
106
-
107
- [Each dispatchable fix task has a pre-written self-contained worker prompt.]
108
-
109
- #### FIX-01: [Issue title]
110
-
111
- ```
112
- ## Mission
113
- [Brief description: what to fix and why.]
114
-
115
- ## Context
116
- - Review dimension: [Hallucinated code / Omission / Deviation / Architecture / Performance / Redundancy]
117
- - Spec requirement: [Related SPEC requirement]
118
-
119
- ## Input
120
- - Read the following files: [list]
121
-
122
- ## What to do
123
- 1. [Concrete fix steps — describe "what" to do, not "which tool" to use]
124
- 2. [Include specific file paths, function names, line numbers, modification approach]
125
-
126
- ## Scope
127
- - Allowed files:
128
- - `[path]` — [explanation]
129
- - Forbidden files:
130
- - `[path]` — (belongs to another worker)
105
+ [Each dispatchable fix and regression test has a pre-written self-contained worker prompt in a separate file under `fix/`. The coordinator reads the corresponding file and dispatches it without modification.]
131
106
 
132
- ## Output
133
- On completion, report:
134
- - Which files were modified (absolute paths)
135
- - Change summary for each file
136
- - Test results (pass/fail)
137
- - Any blockers or risks encountered
138
-
139
- ## Verify
140
- - Run: `[command]`
141
- - Expected: [what you should see]
142
-
143
- ## Boundaries
144
- - Do not modify any file in the forbidden list
145
- - Fix must not conflict with the original spec requirements
146
- - Preserve existing test behavior semantics (unless the spec explicitly requires a change)
147
- - Do not write regression tests — that is handled by another worker
148
- - If you encounter an unexpected blocker, stop and report — do not invent alternative approaches
149
- ```
150
-
151
- ---
107
+ ### Fix Worker Prompts
152
108
 
153
- [Repeat the above block for each fix worker. Multiple simple fixes with no overlap can be merged into one worker prompt by combining their What to do sections.]
109
+ | Fix ID | Worker Prompt File | Description |
110
+ |---|---|---|
111
+ | FIX-01 | `fix/FIX-01-[name].md` | [Brief description] |
112
+ | FIX-02 | `fix/FIX-02-[name].md` | [Brief description] |
154
113
 
155
114
  ### Regression Test Worker Prompts
156
115
 
157
- [Each regression test has a pre-written self-contained worker prompt. The regression test worker's task is to **write test code**.]
158
-
159
- #### REGTEST-01: [Test name] (related to FIX-01)
160
-
161
- ```
162
- ## Mission
163
- Create a regression test for FIX-01 ([brief description]). This test ensures the issue never reappears.
164
-
165
- ## Context
166
- - Fix summary: [What FIX-01 fixed]
167
- - Root cause: [Root cause explanation]
168
- - Fix files involved: [list]
169
-
170
- ## Input
171
- - Read fix-related files: [list]
172
- - Read existing test files as format reference: `[existing test path]`
173
-
174
- ## What to do
175
- Create a regression test at `[test location]`:
176
-
177
- Test scenario:
178
- - GIVEN [specific precondition and input]
179
- - WHEN [specific trigger]
180
- - THEN [expected output or behavior]
181
-
182
- Oracle: This test must fail on the unfixed code and pass after the fix is applied.
183
-
184
- ## Scope
185
- - Allowed files:
186
- - `[test file path]` — create/modify regression test
187
- - Forbidden files:
188
- - All non-test source files (fixes are handled by another worker)
189
-
190
- ## Output
191
- On completion, report:
192
- - The test file and test function name
193
- - Test execution result (must pass)
194
- - If the test cannot pass, explain why (may indicate an incomplete fix)
195
-
196
- ## Verify
197
- - Run: `[test command]`
198
- - Expected: REGTEST-01 passes
199
-
200
- ## Boundaries
201
- - Do not modify any source code files
202
- - The test must be independently executable, not dependent on external state
203
- - Follow the existing test file's formatting and naming conventions
204
- ```
205
-
206
- ---
207
-
208
- [Repeat the above block for each regression test worker. Multiple regressions in the same file can be merged into one worker prompt.]
116
+ | Test ID | Worker Prompt File | Related Fix | Description |
117
+ |---|---|---|---|
118
+ | REGTEST-01 | `fix/REGTEST-01-[name].md` | FIX-01 | [Brief description] |
119
+ | REGTEST-02 | `fix/REGTEST-02-[name].md` | FIX-02 | [Brief description] |
209
120
 
210
121
  ---
211
122
 
@@ -311,17 +222,29 @@ If there are no entries here, see Section 5 for each fix's regression test desig
311
222
 
312
223
  ---
313
224
 
314
- ## 12. Boundaries
225
+ ## 12. References
226
+
227
+ - **Worker prompt files**: [List all `fix/*.md` files — e.g., `fix/FIX-01-*.md`, `fix/REGTEST-01-*.md`]
228
+ - **Code files to modify** (across all fixes and regression tests):
229
+ - [File path — e.g., `src/auth/login.ts`]
230
+ - [File path — e.g., `src/auth/logout.ts`]
231
+ - **Project context files**: [List important project files the fix coordinator and workers may need — e.g., `CLAUDE.md`, `AGENTS.md`, `resources/project-architecture/**`, codegraph index files]
232
+ - **Related documents**: [Links to REPORT.md, SPEC.md, DESIGN.md, or external documentation]
233
+
234
+ ---
235
+
236
+ ## 13. Boundaries
315
237
 
316
238
  ### ALWAYS
317
239
 
318
240
  - Run gate verification immediately after every batch
319
- - Extract worker prompts verbatim from Section 6 — do not rewrite them
241
+ - Extract worker prompts verbatim from `fix/*.md` files — do not rewrite them
320
242
  - After a worker reports, digest the results before deciding next steps
321
243
  - Fixes must not conflict with the original spec requirements
322
244
  - Regression tests must not start before all fix batches pass
323
245
  - Resolve merge conflicts yourself — the coordinator handles them. This is coordination, not implementation.
324
246
  - **For fixes marked as Complex**: ensure the worker performs systematic debugging (reading related code, tracing execution paths) before applying the fix. Do not let the worker guess the fix.
247
+ - **After each batch completes, clean up any temporary branches or worktrees created by workers** — no ephemeral worktree should be left orphaned.
325
248
 
326
249
  ### ASK FIRST — pause and confirm with the user
327
250
 
@@ -111,6 +111,7 @@ Include the following sections:
111
111
  - **Requirement Status Summary**: Per-requirement: completion status, evidence location, open findings
112
112
  - **Findings**: Issue list sorted by P0 → P3 (only levels with findings)
113
113
  - **Review History**: Previous rounds (if any)
114
+ - **References**: List important project context files the next skill (qa) will need (e.g., `CLAUDE.md`, `AGENTS.md`, `resources/project-architecture/**`). This reduces the LLM's need to search for relevant files when processing the report.
114
115
 
115
116
  **Verdict criteria** (P-level directly determines verdict — no separate requirement check needed):
116
117
 
@@ -56,3 +56,10 @@
56
56
  - **Verdict**: [Ready to Merge / Needs Attention / Needs Work]
57
57
  - **Issues**: P0:X, P1:X, P2:X, P3:X
58
58
  - **Key findings**: [1-2 sentence summary of the most important findings in this round]
59
+
60
+ ---
61
+
62
+ ## References
63
+
64
+ - **Project context files**: [List important project files the reviewer used — e.g., `CLAUDE.md`, `AGENTS.md`, `resources/project-architecture/**`]
65
+ - **Related documents**: [Links to related SPEC.md, DESIGN.md, or external documentation]