rpi-kit 2.2.1 → 2.4.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.
@@ -109,6 +109,15 @@ Rules:
109
109
  - Match existing documentation style and tone
110
110
  - Use concrete examples, not abstract descriptions
111
111
  - If the code says WHAT, the docs should say WHY
112
+
113
+ After documentation updates, append your activity to rpi/features/{slug}/ACTIVITY.md:
114
+
115
+ ### {current_date} — Quill (Docs)
116
+ - **Action:** Documentation updates for {slug}
117
+ - **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
118
+ - **Files updated:** {list}
119
+ - **Changelog entry:** {yes|no}
120
+ - **Quality:** {your quality gate result}
112
121
  ```
113
122
 
114
123
  Store the output as `$QUILL_OUTPUT`.
@@ -124,7 +133,26 @@ Store the output as `$QUILL_OUTPUT`.
124
133
  git commit -m "docs({slug}): update documentation for {slug}"
125
134
  ```
126
135
 
127
- ## Step 6: Output summary
136
+ ## Step 6: Consolidate decisions to DECISIONS.md
137
+
138
+ 1. Read `rpi/features/{slug}/ACTIVITY.md`.
139
+ 2. Extract all `<decision>` tags from entries belonging to the Docs phase (Quill entries from this run).
140
+ 3. If no decisions found, skip this step.
141
+ 4. Read `rpi/features/{slug}/DECISIONS.md` if it exists (to get the last decision number for sequential numbering).
142
+ 5. Append a new section to `rpi/features/{slug}/DECISIONS.md`:
143
+
144
+ ```markdown
145
+ ## Docs Phase
146
+ _Generated: {current_date}_
147
+
148
+ | # | Type | Decision | Alternatives | Rationale | Impact |
149
+ |---|------|----------|-------------|-----------|--------|
150
+ | {N} | {type} | {summary} | {alternatives} | {rationale} | {impact} |
151
+ ```
152
+
153
+ 6. Number decisions sequentially, continuing from the last number in DECISIONS.md.
154
+
155
+ ## Step 7: Output summary
128
156
 
129
157
  ```
130
158
  Documentation complete: {slug}
@@ -0,0 +1,301 @@
1
+ ---
2
+ name: rpi:fix
3
+ description: Quick bugfix — Luna interviews, Mestre plans (max 3 tasks), Forge implements. One command.
4
+ argument-hint: "<bug-slug> [--resume] [--force]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Agent
13
+ - AskUserQuestion
14
+ ---
15
+
16
+ # /rpi:fix — Quick Bugfix
17
+
18
+ Runs Luna → Mestre → Forge in one step for bugfixes. Creates compact artifacts with max 3 tasks. Each task generates a commit.
19
+
20
+ ---
21
+
22
+ ## Step 1: Load config and parse arguments
23
+
24
+ 1. Read `.rpi.yaml` for config. Apply defaults if missing:
25
+ - `folder`: `rpi/features`
26
+ - `context_file`: `rpi/context.md`
27
+ - `commit_style`: `conventional`
28
+ 2. Parse `$ARGUMENTS` to extract:
29
+ - `{slug}` — the bug name (required)
30
+ - `--resume`: continue from last completed task if IMPLEMENT.md exists
31
+ - `--force`: restart from scratch (overwrites existing artifacts)
32
+ 3. If `{slug}` is not provided, ask with AskUserQuestion: "What's the bug? Give it a short slug (e.g. 'login-crash', 'missing-validation')."
33
+ 4. Convert slug to kebab-case (lowercase, spaces/underscores become hyphens, strip special chars).
34
+
35
+ ## Step 2: Check for existing feature
36
+
37
+ Check if `{folder}/{slug}/` already exists.
38
+
39
+ If it exists and `--force` was NOT passed:
40
+ - Check if `implement/IMPLEMENT.md` exists:
41
+ - If yes and `--resume` was passed (or default): skip to Step 6 (resume implementation).
42
+ - If yes and `--force` was NOT passed: ask the user: "Feature '{slug}' already exists. Resume implementation (--resume) or start over (--force)?"
43
+ - If no IMPLEMENT.md: ask the user: "Feature '{slug}' already exists but implementation hasn't started. Overwrite? (yes/no)"
44
+
45
+ If it exists and `--force` was passed: proceed (will overwrite).
46
+
47
+ ## Step 3: Create directory structure
48
+
49
+ ```bash
50
+ mkdir -p {folder}/{slug}/plan
51
+ mkdir -p {folder}/{slug}/implement
52
+ ```
53
+
54
+ No `research/` directory. No `delta/` directories.
55
+
56
+ ## Step 4: Luna — Bugfix Interview
57
+
58
+ Adopt Luna's persona. This is a bugfix interview — fast and focused.
59
+
60
+ ### If slug is descriptive (e.g. `login-crash`, `null-pointer-auth`):
61
+
62
+ Ask one question with AskUserQuestion:
63
+ > "Descreve o bug: o que acontece, o que deveria acontecer, e onde se manifesta (ficheiro, endpoint, componente — se souberes)."
64
+
65
+ ### If slug is vague (e.g. `fix1`, `bug`):
66
+
67
+ Ask two questions with AskUserQuestion:
68
+ > 1. "Qual é o bug?"
69
+ > 2. "Onde se manifesta? (ficheiro, endpoint, componente — se souberes)"
70
+
71
+ ### Generate REQUEST.md
72
+
73
+ Write `{folder}/{slug}/REQUEST.md`:
74
+
75
+ ```markdown
76
+ # Fix: {slug}
77
+
78
+ ## Bug Report
79
+ {bug description — what happens vs. what should happen}
80
+
81
+ ## Location
82
+ {where it manifests — file, module, endpoint, or "Unknown"}
83
+
84
+ ## Constraints
85
+ - {constraint if any, or "None identified"}
86
+
87
+ ## Unknowns
88
+ - {at least one — e.g., "Root cause not confirmed"}
89
+
90
+ ## Complexity Estimate
91
+ S — bugfix
92
+
93
+ ## Quick Flow
94
+ This is a bugfix. Skipping research phase.
95
+ ```
96
+
97
+ Output:
98
+ ```
99
+ REQUEST.md created: {folder}/{slug}/REQUEST.md
100
+ Starting plan phase...
101
+ ```
102
+
103
+ ## Step 5: Mestre — Compact Plan
104
+
105
+ Launch Mestre agent with this prompt:
106
+
107
+ ```
108
+ You are Mestre. Generate a compact bugfix plan for: {slug}
109
+
110
+ ## Bug Report (REQUEST.md)
111
+ {content of REQUEST.md}
112
+
113
+ ## Project Context
114
+ {content of context.md if it exists, otherwise "No project context file found."}
115
+
116
+ ## Instructions
117
+ 1. Read the files mentioned in the Location section of the bug report
118
+ 2. Analyze the probable root cause
119
+ 3. Generate a PLAN.md with maximum 3 tasks
120
+ 4. Each task must list exact files to change and dependencies
121
+ 5. Be surgical — only fix the bug, no refactoring, no improvements
122
+
123
+ IMPORTANT: If you determine this bug needs more than 3 tasks, output ONLY:
124
+ "ESCALATE: This bug is too complex for /rpi:fix. Use /rpi:new {slug} for the full pipeline."
125
+ Do NOT generate a plan in this case.
126
+
127
+ Output using this format:
128
+
129
+ # Plan: Fix {slug}
130
+
131
+ ## Analysis
132
+ {2-3 sentences — probable root cause, affected files}
133
+
134
+ ## Tasks
135
+
136
+ ### Task 1: {description}
137
+ - Files: {files to change}
138
+ - Deps: none
139
+
140
+ ### Task 2: {description}
141
+ - Files: {files to change}
142
+ - Deps: [1]
143
+
144
+ ## Risks
145
+ - {if any, or "None — straightforward fix"}
146
+
147
+ After generating the plan, append your activity to {folder}/{slug}/ACTIVITY.md:
148
+
149
+ ### {current_date} — Mestre (Fix — Compact Plan)
150
+ - **Action:** Compact bugfix plan for {slug}
151
+ - **Tasks:** {count}
152
+ - **Quality:** {your quality gate result}
153
+ ```
154
+
155
+ ### Handle Mestre's response
156
+
157
+ If Mestre outputs `ESCALATE:`:
158
+ ```
159
+ This bug needs more than 3 tasks — too complex for /rpi:fix.
160
+
161
+ Use the full pipeline: /rpi:new {slug}
162
+ ```
163
+ Stop.
164
+
165
+ If Mestre outputs a valid plan:
166
+ 1. Write `{folder}/{slug}/plan/PLAN.md` with Mestre's output.
167
+ 2. Output:
168
+ ```
169
+ PLAN.md created: {folder}/{slug}/plan/PLAN.md ({N} tasks)
170
+ Starting implementation...
171
+ ```
172
+
173
+ ## Step 6: Forge — Implementation
174
+
175
+ For each task in PLAN.md order, respecting dependency ordering:
176
+
177
+ ### Step 6a: Initialize IMPLEMENT.md (if not resuming)
178
+
179
+ Write `{folder}/{slug}/implement/IMPLEMENT.md`:
180
+
181
+ ```markdown
182
+ # Implementation: Fix {slug}
183
+
184
+ Started: {YYYY-MM-DD}
185
+ Plan: {folder}/{slug}/plan/PLAN.md
186
+
187
+ ## Tasks
188
+
189
+ - [ ] Task {1}: {description}
190
+ - [ ] Task {2}: {description}
191
+ - ...
192
+
193
+ ## Execution Log
194
+ ```
195
+
196
+ ### Step 6b: Handle resume
197
+
198
+ If resuming (IMPLEMENT.md exists):
199
+ 1. Read IMPLEMENT.md, find next unchecked task `- [ ]`.
200
+ 2. Output: `Resuming '{slug}' from task {next_task_id}. ({completed}/{total} tasks done)`
201
+
202
+ ### Step 6c: Execute each task
203
+
204
+ Launch Forge agent for each task:
205
+
206
+ ```
207
+ You are Forge. Implement task {task_id} for bugfix: {slug}
208
+
209
+ ## Task
210
+ {task description from PLAN.md}
211
+
212
+ ## Target Files
213
+ {files listed for this task}
214
+
215
+ ## Dependencies Completed
216
+ {list of completed task IDs and their descriptions}
217
+
218
+ ## Bug Report
219
+ {content of REQUEST.md}
220
+
221
+ ## Project Context
222
+ {content of context.md if it exists}
223
+
224
+ CRITICAL RULES:
225
+ 1. CONTEXT_READ: You MUST read ALL target files before writing ANY code
226
+ 2. Match existing patterns — naming, error handling, imports, style
227
+ 3. Only touch files listed in the task unless absolutely necessary
228
+ 4. Commit your changes with a conventional commit message
229
+ 5. Report: DONE | BLOCKED | DEVIATED
230
+
231
+ After completing the task, append your activity to {folder}/{slug}/ACTIVITY.md:
232
+
233
+ ### {current_date} — Forge (Fix — Task {task_id})
234
+ - **Action:** Implemented task {task_id} for {slug}
235
+ - **Files changed:** {list}
236
+ - **Status:** {DONE|BLOCKED|DEVIATED}
237
+ - **Quality:** {your quality gate result}
238
+ ```
239
+
240
+ ### Step 6d: Parse Forge response
241
+
242
+ **DONE:**
243
+ 1. Update IMPLEMENT.md: `- [ ] Task {id}` → `- [x] Task {id}`
244
+ 2. Append to Execution Log:
245
+ ```
246
+ ### Task {id}: {description}
247
+ - Status: DONE
248
+ - Commit: {hash}
249
+ - Files: {list of files changed}
250
+ ```
251
+ 3. Continue to next task.
252
+
253
+ **BLOCKED:**
254
+ 1. Update IMPLEMENT.md with blocker.
255
+ 2. Output:
256
+ ```
257
+ Fix blocked at task {id}: {description}
258
+
259
+ Blocker: {reason}
260
+
261
+ Options:
262
+ - Fix the blocker and run: /rpi:fix {slug} --resume
263
+ - Use the full pipeline: /rpi:new {slug}
264
+ ```
265
+ 3. Stop.
266
+
267
+ **DEVIATED:**
268
+ 1. Cosmetic: log it, continue automatically.
269
+ 2. Interface/scope: warn the user, ask to accept or revert.
270
+ 3. If accepted: update IMPLEMENT.md as DONE with deviation noted.
271
+ 4. If reverted: git revert, task stays unchecked. Stop.
272
+
273
+ ## Step 7: Completion summary
274
+
275
+ After all tasks completed, output:
276
+
277
+ ```
278
+ Fix complete: {slug}
279
+
280
+ Tasks: {completed}/{total}
281
+ Commits:
282
+ - {hash1}: {task 1 description}
283
+ - {hash2}: {task 2 description}
284
+
285
+ Next:
286
+ - Review: /rpi:review {slug}
287
+ - Archive: /rpi:archive {slug}
288
+ - Full pipeline on this: /rpi {slug} --from=simplify
289
+ ```
290
+
291
+ Update IMPLEMENT.md with a final section:
292
+
293
+ ```markdown
294
+ ## Summary
295
+
296
+ - Total tasks: {N}
297
+ - Completed: {N}
298
+ - Blocked: {N}
299
+ - Deviations: {N}
300
+ - Completed: {YYYY-MM-DD}
301
+ ```
@@ -119,6 +119,15 @@ Your task:
119
119
  4. Cover: happy path, error path, at least one edge case
120
120
  5. Run the tests and confirm they fail
121
121
  6. Output: test file path, test code, and the failing test output
122
+
123
+ After writing tests, append your activity to rpi/features/{slug}/ACTIVITY.md:
124
+
125
+ ### {current_date} — Sage (Implement — TDD for Task {task_id})
126
+ - **Action:** Wrote failing tests for task {task_id}
127
+ - **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
128
+ - **Tests written:** {count}
129
+ - **Edge cases covered:** {count}
130
+ - **Quality:** {your quality gate result}
122
131
  ```
123
132
 
124
133
  Wait for Sage to complete. Store the test output as `$SAGE_TESTS`. Verify the tests actually fail — if they pass, something is wrong (the behavior may already exist). Inform the user and ask how to proceed.
@@ -155,6 +164,15 @@ CRITICAL RULES:
155
164
  4. If TDD: make the failing tests pass
156
165
  5. Commit your changes with a conventional commit message
157
166
  6. Report: DONE | BLOCKED | DEVIATED
167
+
168
+ After completing the task, append your activity to rpi/features/{slug}/ACTIVITY.md:
169
+
170
+ ### {current_date} — Forge (Implement — Task {task_id})
171
+ - **Action:** Implemented task {task_id} for {slug}
172
+ - **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
173
+ - **Files changed:** {list}
174
+ - **Status:** {DONE|BLOCKED|DEVIATED}
175
+ - **Quality:** {your quality gate result}
158
176
  ```
159
177
 
160
178
  ### Step 5c: Parse Forge response
@@ -244,3 +262,22 @@ Update IMPLEMENT.md with a final section:
244
262
  - Deviations: {N} ({list severities})
245
263
  - Completed: {YYYY-MM-DD}
246
264
  ```
265
+
266
+ ## Step 7: Consolidate decisions to DECISIONS.md
267
+
268
+ 1. Read `rpi/features/{slug}/ACTIVITY.md`.
269
+ 2. Extract all `<decision>` tags from entries belonging to the Implement phase (Sage and Forge entries from this run).
270
+ 3. If no decisions found, skip this step.
271
+ 4. Read `rpi/features/{slug}/DECISIONS.md` if it exists (to get the last decision number for sequential numbering).
272
+ 5. Append a new section to `rpi/features/{slug}/DECISIONS.md`:
273
+
274
+ ```markdown
275
+ ## Implement Phase
276
+ _Generated: {current_date}_
277
+
278
+ | # | Type | Decision | Alternatives | Rationale | Impact |
279
+ |---|------|----------|-------------|-----------|--------|
280
+ | {N} | {type} | {summary} | {alternatives} | {rationale} | {impact} |
281
+ ```
282
+
283
+ 6. Number decisions sequentially, continuing from the last number in DECISIONS.md.
@@ -178,6 +178,14 @@ After all questions answered, compile the interview results using your
178
178
  [Nexus — Developer Interview] output format.
179
179
 
180
180
  Return the compiled interview content.
181
+
182
+ After the interview, append your activity to rpi/features/{slug}/ACTIVITY.md:
183
+
184
+ ### {current_date} — Nexus (Plan Interview)
185
+ - **Action:** Developer interview for {slug}
186
+ - **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
187
+ - **Questions asked:** {count}
188
+ - **Quality:** {your quality gate result}
181
189
  ```
182
190
 
183
191
  Store the output as `$INTERVIEW`.
@@ -244,6 +252,15 @@ Your task:
244
252
  5. Output using your eng.md format: [Mestre -- Engineering Specification]
245
253
 
246
254
  Be pragmatic. Follow existing codebase patterns from context.md and research findings. No over-engineering.
255
+
256
+ After generating eng.md, append your activity to rpi/features/{slug}/ACTIVITY.md:
257
+
258
+ ### {current_date} — Mestre (Plan — eng.md)
259
+ - **Action:** Engineering specification for {slug}
260
+ - **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
261
+ - **Architecture decisions:** {count}
262
+ - **Files planned:** {count create + modify}
263
+ - **Quality:** {your quality gate result}
247
264
  ```
248
265
 
249
266
  Store the output as `$ENG_OUTPUT`.
@@ -280,6 +297,16 @@ Your task:
280
297
  5. Output using your pm.md format: [Clara -- Product Specification]
281
298
 
282
299
  Be ruthless with scope. Every requirement must have acceptance criteria.
300
+
301
+ After generating pm.md, append your activity to rpi/features/{slug}/ACTIVITY.md:
302
+
303
+ ### {current_date} — Clara (Plan — pm.md)
304
+ - **Action:** Product specification for {slug}
305
+ - **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
306
+ - **User stories:** {count}
307
+ - **Acceptance criteria:** {count}
308
+ - **Scope cuts:** {count of out-of-scope items}
309
+ - **Quality:** {your quality gate result}
283
310
  ```
284
311
 
285
312
  Store the output as `$PM_OUTPUT`.
@@ -375,6 +402,15 @@ Rules:
375
402
  - If Clara marked something as out-of-scope, don't create tasks for it
376
403
  - If the developer interview decided on approach X, all tasks must use approach X
377
404
  - If the developer marked something as out-of-scope, don't create tasks for it
405
+
406
+ After generating PLAN.md, append your activity to rpi/features/{slug}/ACTIVITY.md:
407
+
408
+ ### {current_date} — Mestre (Plan — PLAN.md)
409
+ - **Action:** Implementation plan for {slug}
410
+ - **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
411
+ - **Tasks:** {count}
412
+ - **Complexity:** {S|M|L|XL}
413
+ - **Quality:** {your quality gate result}
378
414
  ```
379
415
 
380
416
  Store the output as `$PLAN_OUTPUT`.
@@ -497,6 +533,16 @@ After completing all passes:
497
533
  4. MEDIUM/LOW issues: present summary, developer can dismiss or address
498
534
  5. For each resolved issue: note the chosen resolution and which artifacts need patching
499
535
  6. Return the full adversarial review with all resolutions noted
536
+
537
+ After adversarial review, append your activity to rpi/features/{slug}/ACTIVITY.md:
538
+
539
+ ### {current_date} — Nexus (Plan Adversarial Review)
540
+ - **Action:** Adversarial review for {slug}
541
+ - **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
542
+ - **Issues found:** {count by severity}
543
+ - **Contradictions resolved:** {count}
544
+ - **Coherence status:** {PASS|PASS with notes|NEEDS re-plan}
545
+ - **Quality:** {your quality gate result}
500
546
  ```
501
547
 
502
548
  Store the output as `$ADVERSARIAL_REVIEW`.
@@ -544,7 +590,26 @@ If `$ADVERSARIAL_REVIEW` contains resolved issues:
544
590
  ```
545
591
  8. Write delta spec files from Step 13 into the appropriate delta subdirectories.
546
592
 
547
- ## Step 17: Output summary
593
+ ## Step 17: Consolidate decisions to DECISIONS.md
594
+
595
+ 1. Read `rpi/features/{slug}/ACTIVITY.md`.
596
+ 2. Extract all `<decision>` tags from entries belonging to the Plan phase (Nexus interview, Mestre eng.md, Clara, Mestre PLAN.md, Nexus adversarial entries).
597
+ 3. If no decisions found, skip this step.
598
+ 4. Read `rpi/features/{slug}/DECISIONS.md` if it exists (to get the last decision number for sequential numbering).
599
+ 5. Append a new section to `rpi/features/{slug}/DECISIONS.md`:
600
+
601
+ ```markdown
602
+ ## Plan Phase
603
+ _Generated: {current_date}_
604
+
605
+ | # | Type | Decision | Alternatives | Rationale | Impact |
606
+ |---|------|----------|-------------|-----------|--------|
607
+ | {N} | {type} | {summary} | {alternatives} | {rationale} | {impact} |
608
+ ```
609
+
610
+ 6. Number decisions sequentially, continuing from the last number in DECISIONS.md.
611
+
612
+ ## Step 18: Output summary
548
613
 
549
614
  ```
550
615
  Plan complete: rpi/features/{slug}/plan/
@@ -75,6 +75,15 @@ Your task:
75
75
  3. Check rpi/solutions/ for past solutions that could be reused
76
76
  4. Identify files likely affected, patterns to follow, and risks
77
77
  5. Output using your standard format: [Atlas -- Codebase Analysis]
78
+
79
+ 6. After your analysis, append your activity to rpi/features/{slug}/ACTIVITY.md:
80
+
81
+ ### {current_date} — Atlas (Research)
82
+ - **Action:** Codebase analysis for {slug}
83
+ - **Scope:** {list files you actually read}
84
+ - **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
85
+ - **Patterns found:** {count and summary}
86
+ - **Quality:** {your quality gate result}
78
87
  ```
79
88
 
80
89
  ### Scout (external research)
@@ -100,6 +109,15 @@ Your task:
100
109
  4. Identify risks: breaking changes, security issues, maintenance status
101
110
  5. Find relevant benchmarks, examples, or case studies
102
111
  6. Output using your standard format: [Scout -- Technical Investigation]
112
+
113
+ 7. After your investigation, append your activity to rpi/features/{slug}/ACTIVITY.md:
114
+
115
+ ### {current_date} — Scout (Research)
116
+ - **Action:** External research for {slug}
117
+ - **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
118
+ - **Sources consulted:** {count and list}
119
+ - **Recommendations:** {count and summary}
120
+ - **Quality:** {your quality gate result}
103
121
  ```
104
122
 
105
123
  ## Step 5: Wait for completion
@@ -195,6 +213,15 @@ Rules for verdict:
195
213
  - No BLOCK + 2 or more CONCERN findings = GO with concerns
196
214
  - Otherwise = GO
197
215
  - NO-GO requires an Alternatives section
216
+
217
+ After synthesis, append your activity to rpi/features/{slug}/ACTIVITY.md:
218
+
219
+ ### {current_date} — Nexus (Research Synthesis)
220
+ - **Action:** Synthesized Atlas + Scout findings for {slug}
221
+ - **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
222
+ - **Consensus points:** {count}
223
+ - **Disagreements resolved:** {count}
224
+ - **Quality:** {your quality gate result}
198
225
  ```
199
226
 
200
227
  ## Step 8: Write RESEARCH.md and populate delta baselines
@@ -206,7 +233,27 @@ Rules for verdict:
206
233
  - Copy relevant spec baselines into `delta/MODIFIED/` so the plan phase has reference copies
207
234
  - This gives Mestre (plan phase) the current state of specs that will be changed
208
235
 
209
- ## Step 9: Output summary
236
+ ## Step 9: Consolidate decisions to DECISIONS.md
237
+
238
+ 1. Read `rpi/features/{slug}/ACTIVITY.md`.
239
+ 2. Extract all `<decision>` tags from entries belonging to the Research phase (Atlas, Scout, Nexus entries from this run).
240
+ 3. If no decisions found, skip this step.
241
+ 4. Write `rpi/features/{slug}/DECISIONS.md`:
242
+
243
+ ```markdown
244
+ # Decision Log — {slug}
245
+
246
+ ## Research Phase
247
+ _Generated: {current_date}_
248
+
249
+ | # | Type | Decision | Alternatives | Rationale | Impact |
250
+ |---|------|----------|-------------|-----------|--------|
251
+ | {N} | {type} | {summary} | {alternatives} | {rationale} | {impact} |
252
+ ```
253
+
254
+ 5. Number decisions sequentially starting from 1.
255
+
256
+ ## Step 10: Output summary
210
257
 
211
258
  ```
212
259
  Research complete: rpi/features/{slug}/research/RESEARCH.md
@@ -108,6 +108,15 @@ Output format:
108
108
  ## Summary
109
109
  - P1: {N} | P2: {N} | P3: {N}
110
110
  - Overall: {assessment}
111
+
112
+ After your review, append your activity to rpi/features/{slug}/ACTIVITY.md:
113
+
114
+ ### {current_date} — Hawk (Review)
115
+ - **Action:** Adversarial code review for {slug}
116
+ - **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
117
+ - **Findings:** P1={count} P2={count} P3={count}
118
+ - **Perspectives covered:** {list of 5 perspectives}
119
+ - **Quality:** {your quality gate result}
111
120
  ```
112
121
 
113
122
  Store the output as `$HAWK_OUTPUT`.
@@ -178,6 +187,15 @@ Output format:
178
187
 
179
188
  ## Summary
180
189
  - P1: {N} | P2: {N} | P3: {N}
190
+
191
+ After your audit, append your activity to rpi/features/{slug}/ACTIVITY.md:
192
+
193
+ ### {current_date} — Shield (Review)
194
+ - **Action:** Security audit for {slug}
195
+ - **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
196
+ - **Findings:** P1={count} P2={count} P3={count}
197
+ - **OWASP categories checked:** {count}
198
+ - **Quality:** {your quality gate result}
181
199
  ```
182
200
 
183
201
  Store the output as `$SHIELD_OUTPUT`.
@@ -242,6 +260,16 @@ Output format:
242
260
  - Modules without tests: {N}
243
261
  - Missing critical paths: {N}
244
262
  - Missing edge cases: {N}
263
+
264
+ After your analysis, append your activity to rpi/features/{slug}/ACTIVITY.md:
265
+
266
+ ### {current_date} — Sage (Review)
267
+ - **Action:** Test coverage analysis for {slug}
268
+ - **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
269
+ - **Untested modules:** {count}
270
+ - **Missing critical paths:** {count}
271
+ - **Missing edge cases:** {count}
272
+ - **Quality:** {your quality gate result}
245
273
  ```
246
274
 
247
275
  Store the output as `$SAGE_OUTPUT`.
@@ -387,7 +415,26 @@ Verdict: {PASS | PASS with concerns | FAIL}
387
415
  (or "No solutions saved.")
388
416
  ```
389
417
 
390
- ## Step 10: Output summary
418
+ ## Step 10: Consolidate decisions to DECISIONS.md
419
+
420
+ 1. Read `rpi/features/{slug}/ACTIVITY.md`.
421
+ 2. Extract all `<decision>` tags from entries belonging to the Review phase (Hawk, Shield, Sage entries from this run).
422
+ 3. If no decisions found, skip this step.
423
+ 4. Read `rpi/features/{slug}/DECISIONS.md` if it exists (to get the last decision number for sequential numbering).
424
+ 5. Append a new section to `rpi/features/{slug}/DECISIONS.md`:
425
+
426
+ ```markdown
427
+ ## Review Phase
428
+ _Generated: {current_date}_
429
+
430
+ | # | Type | Decision | Alternatives | Rationale | Impact |
431
+ |---|------|----------|-------------|-----------|--------|
432
+ | {N} | {type} | {summary} | {alternatives} | {rationale} | {impact} |
433
+ ```
434
+
435
+ 6. Number decisions sequentially, continuing from the last number in DECISIONS.md.
436
+
437
+ ## Step 11: Output summary
391
438
 
392
439
  ```
393
440
  Review complete: {slug}
@@ -51,7 +51,7 @@ Stop.
51
51
 
52
52
  Check which artifacts exist to determine the next phase:
53
53
 
54
- 1. Has `REQUEST.md`, no `research/RESEARCH.md` → next = **research**
54
+ 1. Has `REQUEST.md`, no `research/RESEARCH.md` AND no `plan/PLAN.md` → next = **research**
55
55
  2. Has `research/RESEARCH.md`, no `plan/PLAN.md` → next = **plan**
56
56
  3. Has `plan/PLAN.md`, no `implement/IMPLEMENT.md` → next = **implement**
57
57
  4. Has `implement/IMPLEMENT.md` but NOT all tasks checked (`- [x]`) → next = **implement** (with `--resume`)