rpi-kit 1.4.1 → 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 (53) hide show
  1. package/.claude-plugin/marketplace.json +9 -6
  2. package/.claude-plugin/plugin.json +4 -4
  3. package/AGENTS.md +2004 -109
  4. package/CHANGELOG.md +83 -0
  5. package/README.md +116 -169
  6. package/agents/atlas.md +61 -0
  7. package/agents/clara.md +49 -0
  8. package/agents/forge.md +38 -0
  9. package/agents/hawk.md +54 -0
  10. package/agents/luna.md +50 -0
  11. package/agents/mestre.md +61 -0
  12. package/agents/nexus.md +63 -0
  13. package/agents/pixel.md +48 -0
  14. package/agents/quill.md +40 -0
  15. package/agents/razor.md +41 -0
  16. package/agents/sage.md +52 -0
  17. package/agents/scout.md +49 -0
  18. package/agents/shield.md +51 -0
  19. package/bin/cli.js +27 -10
  20. package/bin/onboarding.js +46 -28
  21. package/commands/rpi/archive.md +149 -0
  22. package/commands/rpi/docs.md +106 -168
  23. package/commands/rpi/implement.md +163 -401
  24. package/commands/rpi/init.md +150 -67
  25. package/commands/rpi/learn.md +114 -0
  26. package/commands/rpi/new.md +85 -155
  27. package/commands/rpi/onboarding.md +157 -336
  28. package/commands/rpi/party.md +212 -0
  29. package/commands/rpi/plan.md +241 -205
  30. package/commands/rpi/research.md +162 -104
  31. package/commands/rpi/review.md +350 -104
  32. package/commands/rpi/rpi.md +125 -0
  33. package/commands/rpi/simplify.md +156 -93
  34. package/commands/rpi/status.md +91 -114
  35. package/package.json +3 -3
  36. package/skills/rpi-agents/SKILL.md +63 -39
  37. package/skills/rpi-workflow/SKILL.md +160 -186
  38. package/agents/code-reviewer.md +0 -40
  39. package/agents/code-simplifier.md +0 -35
  40. package/agents/cto-advisor.md +0 -51
  41. package/agents/doc-synthesizer.md +0 -53
  42. package/agents/doc-writer.md +0 -36
  43. package/agents/explore-codebase.md +0 -50
  44. package/agents/plan-executor.md +0 -48
  45. package/agents/product-manager.md +0 -52
  46. package/agents/requirement-parser.md +0 -42
  47. package/agents/senior-engineer.md +0 -52
  48. package/agents/test-engineer.md +0 -28
  49. package/agents/ux-designer.md +0 -47
  50. package/codex.md +0 -72
  51. package/commands/rpi/add-todo.md +0 -83
  52. package/commands/rpi/set-profile.md +0 -124
  53. package/commands/rpi/test.md +0 -198
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: rpi:implement
3
- description: Execute the implementation plan with task-level tracking and smart parallelism.
4
- argument-hint: "<feature-slug> [--sequential|--parallel] [--resume] [--from-task <id>]"
3
+ description: Execute the plan task by task with Forge. Sage assists with tests if TDD enabled.
4
+ argument-hint: "<feature-name> [--resume] [--force]"
5
5
  allowed-tools:
6
6
  - Read
7
7
  - Write
@@ -13,472 +13,234 @@ allowed-tools:
13
13
  - AskUserQuestion
14
14
  ---
15
15
 
16
- <objective>
17
- Execute tasks from PLAN.md with per-task commits. Track everything in IMPLEMENT.md. Simplification and review run in separate sessions for fresh context.
18
- </objective>
16
+ # /rpi:implement — Implement Phase
19
17
 
20
- <process>
18
+ Execute PLAN.md task by task. Forge implements each task with strict CONTEXT_READ discipline. If TDD is enabled, Sage writes failing tests before Forge implements.
21
19
 
22
- ## 1. Load config and parse arguments
20
+ ---
23
21
 
24
- Read `.rpi.yaml` for configuration. Also read `profile` and `models` keys.
25
- Parse `$ARGUMENTS`:
26
- - First argument: `{feature-slug}` (required)
27
- - `--sequential`: force single agent mode
28
- - `--parallel`: force parallel wave mode
29
- - `--resume`: resume from last completed task in existing IMPLEMENT.md
30
- - `--from-task {id}`: resume from a specific task ID (used with --resume)
22
+ ## Step 1: Load config and validate
23
+
24
+ 1. Read `.rpi.yaml` for config. Apply defaults if missing:
25
+ - `folder`: `rpi/features`
26
+ - `context_file`: `rpi/context.md`
27
+ - `tdd`: `false`
28
+ - `commit_style`: `conventional`
29
+ 2. Parse `$ARGUMENTS` to extract `{slug}` and optional flags:
30
+ - `--resume`: continue from last completed task (default behavior when IMPLEMENT.md exists)
31
+ - `--force`: restart implementation from scratch even if IMPLEMENT.md exists
32
+ 3. Validate `rpi/features/{slug}/plan/PLAN.md` exists. If not:
33
+ ```
34
+ PLAN.md not found for '{slug}'. Run /rpi:plan {slug} first.
35
+ ```
36
+ Stop.
31
37
 
32
- ## 1b. Resolve model
38
+ ## Step 2: Gather context
33
39
 
34
- Resolve the model for the `implement` phase following the Model Resolution Algorithm in the rpi-workflow skill. Store as `{resolved_model}`. If a model is resolved, output the status message once before task execution begins.
40
+ 1. Read `rpi/features/{slug}/plan/PLAN.md` store as `$PLAN`.
41
+ 2. Read `rpi/features/{slug}/plan/eng.md` if it exists — store as `$ENG`.
42
+ 3. Read `rpi/context.md` (project context) if it exists — store as `$CONTEXT`.
43
+ 4. Parse `$PLAN` to extract the ordered task list. Each task should have:
44
+ - `task_id`: task number/identifier
45
+ - `description`: what to implement
46
+ - `files`: target files to create or modify
47
+ - `deps`: dependencies on other tasks (must be completed first)
35
48
 
36
- ## 2. Resolve feature path and validate prerequisites
49
+ ## Step 3: Handle resume vs fresh start
37
50
 
38
- Parse `{feature-slug}` from arguments.
51
+ ### If IMPLEMENT.md exists and `--force` was NOT passed:
39
52
 
40
- **Resolution order:**
41
- 1. Check if `{folder}/{feature-slug}/` exists type = "feature", path = `{folder}/{feature-slug}`
42
- 2. If not, Glob `{folder}/*/changes/{feature-slug}/` if found, type = "change", path = matched path, parent_path = parent directory
43
- 3. If multiple matches → AskUserQuestion listing all matches with full paths
44
- 4. If no match → error: `Feature not found: {feature-slug}. Run /rpi:new {feature-slug} first.`
53
+ 1. Read `rpi/features/{slug}/implement/IMPLEMENT.md`.
54
+ 2. Parse completed tasks: lines matching `- [x]` are done, `- [ ]` are pending.
55
+ 3. Find the next incomplete task this is where execution resumes.
56
+ 4. Inform the user:
57
+ ```
58
+ Resuming '{slug}' from task {next_task_id}. ({completed}/{total} tasks done)
59
+ ```
60
+ 5. Skip to Step 5 starting from the next incomplete task.
45
61
 
46
- If `type == "change"`:
47
- - Set `parent_path` to the parent feature directory
48
- - Read parent artifacts for agent context:
49
- - `{parent_path}/REQUEST.md`
50
- - `{parent_path}/research/RESEARCH.md` (if exists)
51
- - `{parent_path}/plan/PLAN.md` (if exists)
52
- - `{parent_path}/plan/eng.md` (if exists)
62
+ ### If IMPLEMENT.md exists and `--force` was passed:
53
63
 
54
- Read `{path}/plan/PLAN.md`. If missing:
55
- ```
56
- Plan not found. Run /rpi:plan {feature-slug} first.
57
- ```
64
+ 1. Ask the user: "IMPLEMENT.md already exists for '{slug}'. This will restart from scratch. Continue? (yes/no)"
65
+ 2. If no: stop.
66
+ 3. If yes: proceed to Step 4 (will overwrite).
58
67
 
59
- Also read eng.md (and pm.md, ux.md if they exist) for full context.
68
+ ### If IMPLEMENT.md does not exist:
60
69
 
61
- ## 2b. Detect session isolation tier
70
+ Proceed to Step 4.
62
71
 
63
- Read `session_isolation` from `.rpi.yaml` (default: `auto`).
72
+ ## Step 4: Initialize IMPLEMENT.md
64
73
 
65
- If `session_isolation: off`, skip all isolation logic. Use current behavior.
74
+ 1. Ensure directory exists: `rpi/features/{slug}/implement/`
75
+ 2. Write `rpi/features/{slug}/implement/IMPLEMENT.md` with all tasks unchecked:
66
76
 
67
- If `session_isolation: aggressive`, set tier = 3 and max_tasks = 3.
77
+ ```markdown
78
+ # Implementation: {Feature Title}
68
79
 
69
- If `session_isolation: auto`:
70
- 1. Read `## Metadata` section from PLAN.md
71
- 2. Extract `suggested_tier` and `context_weight`
72
- 3. If metadata section missing (old plans), compute from tasks:
73
- - Count tasks, unique files, max dependency depth
74
- - Calculate context_weight
75
- 4. Recalculate plan_hash from current file contents:
76
- ```bash
77
- cat {sorted existing files from PLAN.md tasks} | shasum -a 256 | cut -d' ' -f1
78
- ```
79
- 5. Compare with `plan_hash` from metadata. If different:
80
- ```
81
- Codebase has changed since planning.
82
- Changed files: {list files where content differs}
83
- Options:
84
- - Continue anyway (changes may be compatible)
85
- - Re-plan: /rpi:plan {feature-slug} --force
86
- - Review changes manually
87
- ```
88
- Use AskUserQuestion to let user decide.
89
- 6. Set tier and max_tasks_per_session based on context_weight:
90
- - Tier 1 (weight <= 8): max_tasks = unlimited
91
- - Tier 2 (weight 9-18): max_tasks = config value or 5
92
- - Tier 3 (weight > 18): max_tasks = config value or 4
80
+ Started: {YYYY-MM-DD}
81
+ Plan: rpi/features/{slug}/plan/PLAN.md
93
82
 
94
- Inform user:
95
- ```
96
- Session isolation: Tier {N} (context weight: {weight})
97
- {Tier 1: "Single session — no checkpoints needed"}
98
- {Tier 2: "Session warning after {max_tasks} tasks"}
99
- {Tier 3: "Forced checkpoints after each wave"}
100
- ```
83
+ ## Tasks
101
84
 
102
- ## 3. Handle resume
85
+ - [ ] Task {1}: {description}
86
+ - [ ] Task {2}: {description}
87
+ - ...
103
88
 
104
- If `--resume` or IMPLEMENT.md already exists:
105
- 1. Read all files in `{folder}/{feature-slug}/implement/checkpoints/`
106
- 2. Parse each checkpoint: extract task_id and status
107
- 3. Build completed set from checkpoints where status == "done"
108
- 4. If `--from-task {id}` specified, resume from that task
109
- 5. Otherwise, find first uncompleted task in PLAN.md order
110
- 6. Count completed tasks to determine session task counter start
111
- 7. Inform user: "Resuming from task {id}: {name} ({completed}/{total} done)"
89
+ ## Execution Log
90
+ ```
112
91
 
113
- If IMPLEMENT.md exists and no `--resume`:
114
- - Ask user: "Implementation in progress ({N}/{total} tasks). Resume or restart?"
92
+ ## Step 5: Execute tasks in order
115
93
 
116
- ## 4. Initialize implementation directory
94
+ For each task in PLAN.md order, respecting dependency ordering (a task's deps must all be `[x]` before it runs):
117
95
 
118
- If starting fresh:
119
- ```bash
120
- mkdir -p {folder}/{feature-slug}/implement/checkpoints
121
- mkdir -p {folder}/{feature-slug}/implement/sessions
122
- ```
96
+ ### Step 5a: TDD — Sage writes tests (if `tdd: true` in config)
123
97
 
124
- Create `{folder}/{feature-slug}/implement/IMPLEMENT.md`:
98
+ Launch Sage agent with this prompt:
125
99
 
126
- ```markdown
127
- # Implementation: {Feature Title}
100
+ ```
101
+ You are Sage. Write failing tests for task {task_id} of feature: {slug}
128
102
 
129
- Started: {timestamp}
103
+ ## Task
104
+ {task description from PLAN.md}
130
105
 
131
- ## Tasks
106
+ ## Target Files
107
+ {files listed for this task}
132
108
 
133
- {Copy task checklist from PLAN.md with all boxes unchecked}
109
+ ## Engineering Spec
110
+ {$ENG}
134
111
 
135
- ## Deviations
112
+ ## Project Context
113
+ {$CONTEXT}
136
114
 
137
- _None yet._
115
+ Your task:
116
+ 1. Read existing test files and test patterns in the project
117
+ 2. Write tests that verify the expected behavior for this task
118
+ 3. Tests MUST fail right now (the implementation doesn't exist yet)
119
+ 4. Cover: happy path, error path, at least one edge case
120
+ 5. Run the tests and confirm they fail
121
+ 6. Output: test file path, test code, and the failing test output
122
+ ```
138
123
 
139
- ## Simplify Findings
124
+ 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.
140
125
 
141
- _Pending._
126
+ ### Step 5b: Launch Forge to implement
142
127
 
143
- ## Review
128
+ Launch Forge agent with this prompt:
144
129
 
145
- _Pending._
146
130
  ```
131
+ You are Forge. Implement task {task_id} for feature: {slug}
147
132
 
148
- ## 5. Determine execution mode
149
-
150
- Count total uncompleted tasks.
133
+ ## Task
134
+ {task description from PLAN.md}
151
135
 
152
- If `--sequential` flag: single agent mode.
153
- If `--parallel` flag: wave mode.
154
- Otherwise, use smart default:
155
- - < {parallel_threshold from config, default 8} tasks → single agent
156
- - >= threshold → parallel waves
136
+ ## Target Files
137
+ {files listed for this task}
157
138
 
158
- ## 6. Execute tasks
139
+ ## Dependencies Completed
140
+ {list of completed task IDs and their descriptions}
159
141
 
160
- Initialize session task counter: `tasks_this_session = 0`
142
+ ## Engineering Spec
143
+ {$ENG}
161
144
 
162
- ### 6a. Agent prompt template (all tiers)
145
+ ## Project Context
146
+ {$CONTEXT}
163
147
 
164
- For each task, construct the agent prompt. If a model was resolved in Step 1b, include `model: "{resolved_model}"` in every Agent tool call (plan-executor and test-engineer).
148
+ ## Tests to Pass
149
+ {$SAGE_TESTS if TDD enabled, otherwise "No TDD tests — follow the plan."}
165
150
 
166
- ```
167
- You are the plan-executor agent for the RPI workflow.
168
-
169
- ## Pre-Implementation (MANDATORY)
170
- Before writing ANY code, read ALL target files and output:
171
- CONTEXT_READ: [list of files examined]
172
- EXISTING_PATTERNS: [key patterns observed -- naming, error handling, imports]
173
-
174
- ## Your Task
175
- **{task_id}** {task_description}
176
- Effort: {effort}
177
- Files: {files}
178
- Test: {test_spec from PLAN.md, if present}
179
-
180
- ## Technical Context
181
- {contents of eng.md}
182
-
183
- If `type == "change"`, add:
184
-
185
- ## Parent Feature Context
186
- {contents of parent artifacts read in step 2}
187
-
188
- This is a CHANGE to an existing feature. When implementing:
189
- - Ensure compatibility with existing parent feature code
190
- - Flag breaking changes as scope deviations
191
- - Reference parent architecture decisions from eng.md
192
-
193
- ## Rules
194
- - Only touch files listed for this task
195
- - Match patterns from CONTEXT_READ -- do not invent new patterns
196
- - If blocked, report the blocker -- don't improvise
197
- - Classify any deviations: cosmetic | interface | scope
198
-
199
- ## Output Protocol
200
- Write checkpoint to `{folder}/{feature-slug}/implement/checkpoints/{task_id}.md`:
201
-
202
- ## Status: {task_id}
203
- status: done | blocked | deviated
204
- files_read: ["files examined"]
205
- files_changed: ["files modified"]
206
- commit: {hash}
207
- deviations: none | {severity}: {description}
208
- duration: {seconds}s
209
- context_read: ["files from CONTEXT_READ"]
210
- patterns_followed: ["observed patterns"]
211
-
212
- Return single line: `DONE: {task_id} | files: N | deviations: none`
151
+ CRITICAL RULES:
152
+ 1. CONTEXT_READ: You MUST read ALL target files before writing ANY code
153
+ 2. Match existing patterns — naming, error handling, imports, style
154
+ 3. Only touch files listed in the task unless absolutely necessary
155
+ 4. If TDD: make the failing tests pass
156
+ 5. Commit your changes with a conventional commit message
157
+ 6. Report: DONE | BLOCKED | DEVIATED
213
158
  ```
214
159
 
215
- #### If TDD is enabled (`tdd: true` in config):
160
+ ### Step 5c: Parse Forge response
216
161
 
217
- Before launching plan-executor, run TDD cycle per task:
162
+ Forge will respond with one of three statuses:
218
163
 
219
- **RED — Write failing test:**
220
- Launch test-engineer agent:
221
- ```
222
- You are the test-engineer agent for the RPI workflow.
223
-
224
- Read these files for context:
225
- - {folder}/{feature-slug}/plan/PLAN.md
226
- - {folder}/{feature-slug}/plan/eng.md
227
-
228
- Current task:
229
- **{task_id}** {task_description}
230
- Files: {files}
231
- Test: {test_spec from PLAN.md, if present}
232
-
233
- Write ONE failing test for this task.
234
- - Exercise real code through public interfaces
235
- - Clear, behavior-describing test name
236
- - Minimal assertions — one logical check
237
- - Follow project test conventions
238
- - Do NOT write implementation code
239
- ```
164
+ #### DONE
240
165
 
241
- **VERIFY RED:** Run test → must fail for expected reason.
242
- **GREEN:** Launch plan-executor with the prompt template above, adding: "The following test is FAILING: {test_file}:{test_name}. Write MINIMAL code to pass it."
243
- **VERIFY GREEN:** Run test + full suite all pass.
244
- **REFACTOR:** Clean up, re-run tests.
245
- **Additional cycles:** Repeat RED → GREEN → REFACTOR for each test scenario.
246
-
247
- ### Tier 1 execution (Inline — weight <= 8):
248
-
249
- For each task in order (respecting dependencies):
250
- 1. Launch plan-executor agent (foreground) with the prompt template
251
- 2. Agent returns full result
252
- 3. Extract status line from result. Discard rest.
253
- 4. Increment `tasks_this_session`
254
- 5. If config `commit_style` is `conventional`: verify agent committed, or stage and commit
255
- 6. Proceed to next task
256
-
257
- ### Tier 2 execution (File-mediated — weight 9-18):
258
-
259
- For each task in order (respecting dependencies):
260
- 1. Launch plan-executor agent (foreground) with the prompt template
261
- 2. Agent writes checkpoint file and returns 1-line status
262
- 3. Parse status line only. Do NOT read the full agent response for context.
263
- 4. Increment `tasks_this_session`
264
- 5. If config `commit_style` is `conventional`: verify agent committed
265
- 6. **Session warning check**: if `tasks_this_session >= max_tasks_per_session`:
266
- ```
267
- Session getting long ({tasks_this_session} tasks completed).
268
- Consider starting a new session for better accuracy:
269
- /rpi:implement {feature-slug} --resume
270
- ```
271
- Continue if user wants to proceed.
272
- 7. Proceed to next task
273
-
274
- ### Tier 3 execution (Wave-isolated — weight > 18):
275
-
276
- 1. Group tasks by phase from PLAN.md
277
- 2. Within each phase, identify dependency waves:
278
- - Wave 1: tasks with no deps (or deps already completed)
279
- - Wave 2: tasks depending only on wave 1
280
- - Wave 3: tasks depending on waves 1-2
281
- 3. For each wave:
282
- a. Launch ALL wave tasks as parallel foreground agents (one message, multiple Agent calls)
283
- b. Each agent uses the prompt template
284
- c. Wait for all agents in wave to complete
285
- d. For each completed agent, parse status line only
286
- e. Increment `tasks_this_session` by wave size
287
- f. **Deviation check** (see section 6b)
288
- g. **Rollback check** (see section 6c)
289
- 4. After each wave, **forced session checkpoint** (see section 6d)
290
-
291
- ## 6b. Handle deviations
292
-
293
- After each task (all tiers) or after each wave (Tier 3):
294
-
295
- 1. Parse the status line for deviations
296
- 2. If `deviations: none` — continue
297
- 3. If deviation reported, read the checkpoint file to get severity:
298
- - `cosmetic`: log in IMPLEMENT.md, continue automatically
299
- - `interface`:
300
- a. Read PLAN.md to find tasks that depend on the current task
301
- b. Check if any dependent task's `Files:` field overlaps with the deviated files
302
- c. If overlap: pause execution, ask user:
303
- ```
304
- Task {task_id} changed an interface ({description}).
305
- Downstream tasks that may be affected: {list}
306
- Options:
307
- - Continue (downstream agents will read the actual code)
308
- - Pause and review the change
309
- - Revert task {task_id} and re-plan
310
- ```
311
- d. If no overlap: log, continue
312
- - `scope`:
313
- a. Pause execution immediately
314
- b. Read full checkpoint file for details
315
- c. Ask user:
316
- ```
317
- Task {task_id} deviated in scope: {description}
318
- Options:
319
- - Accept the deviation and continue
320
- - Revert task {task_id}: git revert {commit_hash}
321
- - Stop implementation for manual review
322
- ```
323
-
324
- ## 6c. Rollback protocol (Tier 3 parallel waves only)
325
-
326
- If any task in a wave reports `status: blocked`:
327
-
328
- 1. Identify the blocked task and its reason
329
- 2. Read PLAN.md dependency graph
330
- 3. Find completed tasks in the SAME wave that depend on the blocked task:
166
+ 1. Task completed successfully.
167
+ 2. Extract the commit hash from Forge's commit.
168
+ 3. If TDD enabled: verify tests now pass. If tests still fail, inform the user and ask how to proceed.
169
+ 4. Update IMPLEMENT.md: change `- [ ] Task {id}` to `- [x] Task {id}` and append to Execution Log:
331
170
  ```
332
- invalidated = [t for t in wave_completed if blocked_task_id in t.deps]
171
+ ### Task {id}: {description}
172
+ - Status: DONE
173
+ - Commit: {hash}
174
+ - Files: {list of files changed}
333
175
  ```
334
- 4. For each invalidated task:
335
- a. Read its checkpoint file to get commit hash
336
- b. Run: `git revert {commit_hash} --no-commit`
337
- c. Update checkpoint file: `status: rolled_back`
338
- 5. If any reverts were staged:
339
- ```bash
340
- git commit -m "revert: rollback tasks {list} due to {blocked_task_id} failure"
341
- ```
342
- 6. Inform user:
343
- ```
344
- Task {blocked_task_id} blocked: {reason}
345
- Rolled back dependent tasks: {list}
346
- Kept independent tasks: {list}
176
+ 5. Continue to next task.
347
177
 
348
- Fix the blocker and resume:
349
- /rpi:implement {feature-slug} --resume --from-task {blocked_task_id}
350
- ```
351
- 7. Stop execution (do not proceed to next wave)
352
-
353
- ## 6d. Session checkpoint
354
-
355
- Triggered by:
356
- - Tier 2: user agrees to take a break after session warning
357
- - Tier 3: after every wave completes
358
-
359
- ### Checkpoint process:
360
-
361
- 1. **Aggregate IMPLEMENT.md** from checkpoint files:
362
- - Read all files in `{folder}/{feature-slug}/implement/checkpoints/`
363
- - Sort by task ID
364
- - Build IMPLEMENT.md with all task statuses, files changed, deviations
365
- - Preserve existing sections (Simplify Findings, Review) if present
366
-
367
- 2. **Write session record** to `{folder}/{feature-slug}/implement/sessions/session-{N}.md`:
368
- ```markdown
369
- # Session {N}
370
- Started: {timestamp}
371
- Ended: {timestamp}
372
- Tier: {tier}
373
- Tasks completed: {list of task IDs completed this session}
374
- Total progress: {completed}/{total}
375
- Next task: {next_task_id}
376
- Deviations: {summary or "none"}
377
- ```
178
+ #### BLOCKED
378
179
 
379
- 3. **Print resume command**:
180
+ 1. Forge could not complete the task.
181
+ 2. Update IMPLEMENT.md with blocker details:
380
182
  ```
381
- Session checkpoint saved.
382
- Completed: {completed}/{total} tasks
383
- To continue in a new session:
384
- /rpi:implement {feature-slug} --resume
183
+ ### Task {id}: {description}
184
+ - Status: BLOCKED
185
+ - Reason: {blocker description from Forge}
385
186
  ```
187
+ 3. Stop execution. Inform the user:
188
+ ```
189
+ Implementation blocked at task {id}: {description}
386
190
 
387
- 4. **For Tier 3: stop execution**. The user must start a new session.
388
- For Tier 2: continue if user wants to, or stop.
191
+ Blocker: {reason}
389
192
 
390
- ## 7. Phase checkpoint
193
+ Options:
194
+ - Fix the blocker and run: /rpi:implement {slug} --resume
195
+ - Skip this task and continue: /rpi:implement {slug} (after manually marking task as skipped)
196
+ - Re-plan: /rpi:plan {slug} --force
197
+ ```
198
+ 4. Do NOT continue to the next task.
391
199
 
392
- After all tasks in a PLAN.md phase complete:
200
+ #### DEVIATED
393
201
 
394
- 1. Read checkpoint files for all tasks in the phase
395
- 2. Count completed vs blocked vs deviated
396
- 3. Output:
202
+ 1. Forge deviated from the plan.
203
+ 2. Check the deviation severity:
204
+ - **cosmetic** (naming, formatting): log it, continue automatically.
205
+ - **interface** (API changes, function signatures): warn the user, ask to accept or revert.
206
+ - **scope** (extra features, different approach): stop execution, ask the user to accept or revert.
207
+ 3. If accepted: update IMPLEMENT.md as DONE with deviation noted:
397
208
  ```
398
- Phase {N}: {Phase Name}
399
- Tasks: {completed}/{total}
400
- Commits: {list from checkpoint files}
401
- Deviations: {count by severity}
209
+ ### Task {id}: {description}
210
+ - Status: DONE (with deviation)
211
+ - Commit: {hash}
212
+ - Deviation: {severity} {description}
213
+ - Files: {list of files changed}
402
214
  ```
403
- 4. If any tasks blocked, ask user how to proceed before next phase
404
-
405
- ## 8. Finalize IMPLEMENT.md
406
-
407
- Rebuild IMPLEMENT.md from all checkpoint files:
408
- 1. Read all files in `checkpoints/`
409
- 2. Build task list with statuses, commits, deviations
410
- 3. Append summary:
411
-
412
- ```markdown
413
- ## Summary
414
-
415
- Completed: {timestamp}
416
- Total tasks: {N}
417
- Sessions: {count from sessions/ directory}
418
- Commits: {list with hashes from checkpoints}
419
- Deviations: {count by severity}
420
-
421
- ## Simplify Findings
215
+ 4. If reverted: Forge's changes are reverted (git revert), task stays unchecked. Inform the user and stop.
422
216
 
423
- _Run in a separate session: /rpi:simplify {feature-slug}_
217
+ ## Step 6: Completion summary
424
218
 
425
- ## Review
219
+ After all tasks are completed, output:
426
220
 
427
- _Run in a separate session: /rpi:review {feature-slug}_
428
221
  ```
222
+ Implementation complete: {slug}
429
223
 
430
- ## 9. Present result
224
+ Tasks: {completed}/{total}
225
+ Commits:
226
+ - {hash1}: {task 1 description}
227
+ - {hash2}: {task 2 description}
228
+ - ...
431
229
 
432
- ```
433
- Implementation complete: {feature-slug}
434
- {N} tasks completed across {M} phases.
435
-
436
- All artifacts: {folder}/{feature-slug}/
230
+ {If any deviations: list them here}
437
231
 
438
- Next steps (run each in a new session for fresh context):
439
- 1. /rpi:simplify {feature-slug}
440
- 2. /rpi:review {feature-slug}
232
+ Next: /rpi {slug}
233
+ Or explicitly: /rpi:simplify {slug}
441
234
  ```
442
235
 
443
- ## 10. Handle isolation cleanup
444
-
445
- Read `isolation` from `.rpi.yaml`.
446
-
447
- **If `isolation: none`** — do nothing.
236
+ Update IMPLEMENT.md with a final section:
448
237
 
449
- **If `isolation: branch`:**
450
- Ask the user:
451
- ```
452
- Feature branch: feature/{feature-slug}
453
- Want to merge into {main-branch} now? (yes/no)
454
- ```
455
- If yes:
456
- ```bash
457
- git checkout {main-branch}
458
- git merge feature/{feature-slug}
459
- ```
238
+ ```markdown
239
+ ## Summary
460
240
 
461
- **If `isolation: worktree`:**
462
- Ask the user:
463
- ```
464
- Worktree: .worktrees/{feature-slug}
465
- Branch: feature/{feature-slug}
466
- Want to merge into {main-branch} and remove the worktree? (yes/no)
467
- ```
468
- If yes:
469
- ```bash
470
- cd {project-root}
471
- git checkout {main-branch}
472
- git merge feature/{feature-slug}
473
- git worktree remove .worktrees/{feature-slug}
241
+ - Total tasks: {N}
242
+ - Completed: {N}
243
+ - Blocked: {N}
244
+ - Deviations: {N} ({list severities})
245
+ - Completed: {YYYY-MM-DD}
474
246
  ```
475
- If no:
476
- ```
477
- Worktree preserved at .worktrees/{feature-slug}
478
- To merge later:
479
- git checkout {main-branch} && git merge feature/{feature-slug}
480
- To remove:
481
- git worktree remove .worktrees/{feature-slug}
482
- ```
483
-
484
- </process>