rpi-kit 1.1.0 → 1.2.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.
- package/AGENTS.md +4 -0
- package/README.md +5 -2
- package/agents/plan-executor.md +33 -12
- package/bin/onboarding.js +8 -11
- package/codex.md +3 -0
- package/commands/rpi/add-todo.md +1 -1
- package/commands/rpi/implement.md +287 -120
- package/commands/rpi/init.md +3 -0
- package/commands/rpi/onboarding.md +354 -170
- package/commands/rpi/plan.md +82 -0
- package/commands/rpi/status.md +14 -3
- package/package.json +1 -1
- package/skills/rpi-agents/SKILL.md +3 -2
- package/skills/rpi-workflow/SKILL.md +39 -4
package/AGENTS.md
CHANGED
|
@@ -81,6 +81,10 @@ You implement tasks from PLAN.md one at a time with surgical precision.
|
|
|
81
81
|
3. Match existing code style exactly — even if you'd do it differently
|
|
82
82
|
4. If a task is blocked, skip it and note the blocker — don't improvise
|
|
83
83
|
5. Every commit message references the task ID: "feat(1.3): route handlers"
|
|
84
|
+
6. Before writing code, read ALL target files and output CONTEXT_READ and EXISTING_PATTERNS
|
|
85
|
+
7. After completion, write a checkpoint file to `implement/checkpoints/{task_id}.md` with structured status
|
|
86
|
+
8. Return a single status line to the orchestrator — do not return verbose output
|
|
87
|
+
9. Classify deviations as cosmetic (auto-accept), interface (flag downstream), or scope (block for human)
|
|
84
88
|
|
|
85
89
|
## Code Simplifier
|
|
86
90
|
|
package/README.md
CHANGED
|
@@ -71,6 +71,8 @@ Copy `AGENTS.md` and `codex.md` to your project root. The workflow rules and age
|
|
|
71
71
|
| `/rpi:simplify` | Code simplification (reuse, quality, efficiency) |
|
|
72
72
|
| `/rpi:status` | Show all features and their current phase |
|
|
73
73
|
| `/rpi:review` | Code review against plan requirements + test coverage |
|
|
74
|
+
| `/rpi:docs` | Generate documentation from implementation artifacts |
|
|
75
|
+
| `/rpi:add-todo` | Capture quick implementation ideas in `{folder}/todos/` |
|
|
74
76
|
|
|
75
77
|
## Research Tiers
|
|
76
78
|
|
|
@@ -84,7 +86,7 @@ Control depth and cost with tier flags:
|
|
|
84
86
|
|
|
85
87
|
## Agent Team
|
|
86
88
|
|
|
87
|
-
RPIKit simulates a product team with
|
|
89
|
+
RPIKit simulates a product team with 12 specialized agents:
|
|
88
90
|
|
|
89
91
|
| Agent | Perspective |
|
|
90
92
|
|-------|-------------|
|
|
@@ -99,6 +101,7 @@ RPIKit simulates a product team with 11 specialized agents:
|
|
|
99
101
|
| Test Engineer | Writes failing tests before implementation (TDD) |
|
|
100
102
|
| Code Simplifier | Reuse, quality, efficiency checks with direct fixes |
|
|
101
103
|
| Code Reviewer | Reviews against plan requirements + test coverage |
|
|
104
|
+
| Doc Writer | Generates documentation from artifacts for completed features |
|
|
102
105
|
|
|
103
106
|
All agents follow behavioral constraints inspired by [Karpathy's coding guidelines](https://x.com/karpathy/status/2015883857489522876): cite evidence, name unknowns, be concrete, stay in scope.
|
|
104
107
|
|
|
@@ -174,7 +177,7 @@ test_runner: auto # Test command (auto-detect or explicit)
|
|
|
174
177
|
|---|---|---|---|
|
|
175
178
|
| Focus | Spec-driven artifacts | Feature lifecycle with gates | Full project management |
|
|
176
179
|
| Phases | Fluid (propose/apply) | 3 phases (R→P→I) | Roadmap → phases → tasks |
|
|
177
|
-
| Agents | None |
|
|
180
|
+
| Agents | None | 12 specialized roles | 15+ orchestrated agents |
|
|
178
181
|
| TDD | None | Integrated RED→GREEN→REFACTOR | None |
|
|
179
182
|
| Validation | None | GO/NO-GO research gate | Goal-backward verification |
|
|
180
183
|
| Scope | Single change | Single feature | Entire project |
|
package/agents/plan-executor.md
CHANGED
|
@@ -17,6 +17,11 @@ You implement tasks from the RPI plan. You work surgically — one task at a tim
|
|
|
17
17
|
5. Commit messages reference the task ID: `feat(1.3): route handlers` or `test(2.1): auth middleware tests`
|
|
18
18
|
6. Read the eng.md technical spec before implementing — follow the architecture decisions
|
|
19
19
|
7. After each task, report: files changed, lines added/removed, any deviations from plan
|
|
20
|
+
8. Classify deviations by severity:
|
|
21
|
+
- `cosmetic`: naming, formatting changes (auto-accepted, log only)
|
|
22
|
+
- `interface`: changed function signatures, added/removed parameters (flags downstream tasks)
|
|
23
|
+
- `scope`: did more or less than specified (blocks execution, requires human decision)
|
|
24
|
+
9. Write a per-task checkpoint file after completion (see Output Protocol in section 5)
|
|
20
25
|
</rules>
|
|
21
26
|
|
|
22
27
|
<anti_patterns>
|
|
@@ -34,11 +39,17 @@ You implement tasks from the RPI plan. You work surgically — one task at a tim
|
|
|
34
39
|
|
|
35
40
|
## For each assigned task:
|
|
36
41
|
|
|
37
|
-
### 1. Read
|
|
38
|
-
- Read
|
|
42
|
+
### 1. Pre-Implementation Context Read (MANDATORY)
|
|
43
|
+
- Read ALL target files listed in the task's `Files:` field
|
|
39
44
|
- Read eng.md for technical approach
|
|
40
45
|
- Read pm.md for acceptance criteria (if exists)
|
|
41
46
|
- Read ux.md for UX requirements (if exists and task is UI-related)
|
|
47
|
+
- Output before ANY code changes:
|
|
48
|
+
```
|
|
49
|
+
CONTEXT_READ: [list of files examined]
|
|
50
|
+
EXISTING_PATTERNS: [key patterns observed -- naming, error handling, imports]
|
|
51
|
+
```
|
|
52
|
+
- Match these patterns in your implementation — do not invent new patterns
|
|
42
53
|
|
|
43
54
|
### 2. Verify dependencies
|
|
44
55
|
- Check that all dependency tasks are completed
|
|
@@ -55,20 +66,30 @@ You implement tasks from the RPI plan. You work surgically — one task at a tim
|
|
|
55
66
|
- If the task has acceptance criteria (from pm.md), verify each one
|
|
56
67
|
- Check that the implementation matches the task description
|
|
57
68
|
|
|
58
|
-
### 5.
|
|
59
|
-
|
|
69
|
+
### 5. Write checkpoint and report
|
|
70
|
+
|
|
71
|
+
Write checkpoint file to `{folder}/{feature-slug}/implement/checkpoints/{task_id}.md`:
|
|
72
|
+
|
|
73
|
+
```markdown
|
|
74
|
+
## Status: {task_id}
|
|
75
|
+
status: done | blocked | deviated
|
|
76
|
+
files_read: ["list of files read in pre-implementation"]
|
|
77
|
+
files_changed: ["list of files created or modified"]
|
|
78
|
+
commit: {commit_hash}
|
|
79
|
+
deviations: none | {severity}: {description}
|
|
80
|
+
duration: {estimated_seconds}s
|
|
81
|
+
context_read: ["files from CONTEXT_READ step"]
|
|
82
|
+
patterns_followed: ["patterns from EXISTING_PATTERNS step"]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Return to orchestrator (single line only):
|
|
60
86
|
```
|
|
61
|
-
|
|
62
|
-
Files: {list of files changed}
|
|
63
|
-
Lines: +{added} -{removed}
|
|
64
|
-
Deviations: {none | list deviations with rationale}
|
|
87
|
+
DONE: {task_id} | files: {N} changed | deviations: none
|
|
65
88
|
```
|
|
66
89
|
|
|
67
|
-
|
|
90
|
+
Or if blocked:
|
|
68
91
|
```
|
|
69
|
-
|
|
70
|
-
Reason: {why}
|
|
71
|
-
Suggestion: {what to do}
|
|
92
|
+
BLOCKED: {task_id} | reason: {short description}
|
|
72
93
|
```
|
|
73
94
|
|
|
74
95
|
</execution_flow>
|
package/bin/onboarding.js
CHANGED
|
@@ -17,7 +17,7 @@ RPIKit is a structured feature development workflow for Claude Code and Codex.
|
|
|
17
17
|
It guides you through 3 phases with validation gates, so you research before
|
|
18
18
|
you plan, and plan before you code.
|
|
19
19
|
|
|
20
|
-
${DIM}
|
|
20
|
+
${DIM}12 specialized agents simulate a product team:
|
|
21
21
|
engineers, PMs, designers, reviewers — all working in parallel.${RESET}`,
|
|
22
22
|
},
|
|
23
23
|
{
|
|
@@ -89,18 +89,15 @@ ${DIM}Or run standalone:${RESET} /rpi:test your-feature --task 1.2`,
|
|
|
89
89
|
body: `
|
|
90
90
|
${BOLD}Step 1:${RESET} Open Claude Code in your project
|
|
91
91
|
|
|
92
|
-
${BOLD}Step 2:${RESET}
|
|
93
|
-
${CYAN}/rpi:
|
|
92
|
+
${BOLD}Step 2:${RESET} Run the interactive onboarding
|
|
93
|
+
${CYAN}/rpi:onboarding${RESET}
|
|
94
94
|
|
|
95
|
-
${
|
|
96
|
-
|
|
95
|
+
${DIM}This will analyze your codebase, generate a project profile,
|
|
96
|
+
suggest features to build, and guide you through your first feature.${RESET}
|
|
97
97
|
|
|
98
|
-
${
|
|
99
|
-
${CYAN}/rpi:
|
|
100
|
-
${CYAN}/rpi:
|
|
101
|
-
${CYAN}/rpi:implement my-feature${RESET}
|
|
102
|
-
|
|
103
|
-
${DIM}Use /rpi:status anytime to see where you are.${RESET}
|
|
98
|
+
${DIM}Or jump straight in:${RESET}
|
|
99
|
+
${CYAN}/rpi:init${RESET} Configure RPIKit
|
|
100
|
+
${CYAN}/rpi:new my-feature${RESET} Start a feature
|
|
104
101
|
|
|
105
102
|
${GREEN}Happy building!${RESET}`,
|
|
106
103
|
},
|
package/codex.md
CHANGED
|
@@ -38,6 +38,8 @@ You follow the RPI (Research → Plan → Implement) workflow for feature develo
|
|
|
38
38
|
- `/rpi:test <feature>` — Run TDD cycles (RED → GREEN → REFACTOR) per task
|
|
39
39
|
- `/rpi:status` — Show all features and their current phase
|
|
40
40
|
- `/rpi:review <feature>` — Code review against plan
|
|
41
|
+
- `/rpi:docs <feature>` — Generate documentation from artifacts
|
|
42
|
+
- `/rpi:add-todo` — Capture quick implementation ideas
|
|
41
43
|
|
|
42
44
|
## Research Tiers
|
|
43
45
|
|
|
@@ -60,6 +62,7 @@ You follow the RPI (Research → Plan → Implement) workflow for feature develo
|
|
|
60
62
|
| Code Reviewer | Reviews against plan requirements |
|
|
61
63
|
| Codebase Explorer | Scans existing code for patterns and context |
|
|
62
64
|
| Test Engineer | Writes failing tests before implementation (TDD) |
|
|
65
|
+
| Doc Writer | Generates documentation from artifacts |
|
|
63
66
|
|
|
64
67
|
## GO/NO-GO Verdicts
|
|
65
68
|
|
package/commands/rpi/add-todo.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rpi:implement
|
|
3
3
|
description: Execute the implementation plan with task-level tracking, smart parallelism, automatic simplification, and mandatory code review.
|
|
4
|
-
argument-hint: "<feature-slug> [--sequential|--parallel] [--skip-simplify] [--skip-review] [--resume]"
|
|
4
|
+
argument-hint: "<feature-slug> [--sequential|--parallel] [--skip-simplify] [--skip-review] [--resume] [--from-task <id>]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
7
7
|
- Write
|
|
@@ -29,6 +29,7 @@ Parse `$ARGUMENTS`:
|
|
|
29
29
|
- `--skip-simplify`: skip the simplify step (overrides config)
|
|
30
30
|
- `--skip-review`: skip the review step (overrides config)
|
|
31
31
|
- `--resume`: resume from last completed task in existing IMPLEMENT.md
|
|
32
|
+
- `--from-task {id}`: resume from a specific task ID (used with --resume)
|
|
32
33
|
|
|
33
34
|
## 2. Validate prerequisites
|
|
34
35
|
|
|
@@ -39,20 +40,70 @@ Plan not found. Run /rpi:plan {feature-slug} first.
|
|
|
39
40
|
|
|
40
41
|
Also read eng.md (and pm.md, ux.md if they exist) for full context.
|
|
41
42
|
|
|
43
|
+
## 2b. Detect session isolation tier
|
|
44
|
+
|
|
45
|
+
Read `session_isolation` from `.rpi.yaml` (default: `auto`).
|
|
46
|
+
|
|
47
|
+
If `session_isolation: off`, skip all isolation logic. Use current behavior.
|
|
48
|
+
|
|
49
|
+
If `session_isolation: aggressive`, set tier = 3 and max_tasks = 3.
|
|
50
|
+
|
|
51
|
+
If `session_isolation: auto`:
|
|
52
|
+
1. Read `## Metadata` section from PLAN.md
|
|
53
|
+
2. Extract `suggested_tier` and `context_weight`
|
|
54
|
+
3. If metadata section missing (old plans), compute from tasks:
|
|
55
|
+
- Count tasks, unique files, max dependency depth
|
|
56
|
+
- Calculate context_weight
|
|
57
|
+
4. Recalculate plan_hash from current file contents:
|
|
58
|
+
```bash
|
|
59
|
+
cat {sorted existing files from PLAN.md tasks} | shasum -a 256 | cut -d' ' -f1
|
|
60
|
+
```
|
|
61
|
+
5. Compare with `plan_hash` from metadata. If different:
|
|
62
|
+
```
|
|
63
|
+
Codebase has changed since planning.
|
|
64
|
+
Changed files: {list files where content differs}
|
|
65
|
+
Options:
|
|
66
|
+
- Continue anyway (changes may be compatible)
|
|
67
|
+
- Re-plan: /rpi:plan {feature-slug} --force
|
|
68
|
+
- Review changes manually
|
|
69
|
+
```
|
|
70
|
+
Use AskUserQuestion to let user decide.
|
|
71
|
+
6. Set tier and max_tasks_per_session based on context_weight:
|
|
72
|
+
- Tier 1 (weight <= 8): max_tasks = unlimited
|
|
73
|
+
- Tier 2 (weight 9-18): max_tasks = config value or 5
|
|
74
|
+
- Tier 3 (weight > 18): max_tasks = config value or 4
|
|
75
|
+
|
|
76
|
+
Inform user:
|
|
77
|
+
```
|
|
78
|
+
Session isolation: Tier {N} (context weight: {weight})
|
|
79
|
+
{Tier 1: "Single session — no checkpoints needed"}
|
|
80
|
+
{Tier 2: "Session warning after {max_tasks} tasks"}
|
|
81
|
+
{Tier 3: "Forced checkpoints after each wave"}
|
|
82
|
+
```
|
|
83
|
+
|
|
42
84
|
## 3. Handle resume
|
|
43
85
|
|
|
44
86
|
If `--resume` or IMPLEMENT.md already exists:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
87
|
+
1. Read all files in `{folder}/{feature-slug}/implement/checkpoints/`
|
|
88
|
+
2. Parse each checkpoint: extract task_id and status
|
|
89
|
+
3. Build completed set from checkpoints where status == "done"
|
|
90
|
+
4. If `--from-task {id}` specified, resume from that task
|
|
91
|
+
5. Otherwise, find first uncompleted task in PLAN.md order
|
|
92
|
+
6. Count completed tasks to determine session task counter start
|
|
93
|
+
7. Inform user: "Resuming from task {id}: {name} ({completed}/{total} done)"
|
|
49
94
|
|
|
50
95
|
If IMPLEMENT.md exists and no `--resume`:
|
|
51
96
|
- Ask user: "Implementation in progress ({N}/{total} tasks). Resume or restart?"
|
|
52
97
|
|
|
53
|
-
## 4. Initialize
|
|
98
|
+
## 4. Initialize implementation directory
|
|
54
99
|
|
|
55
|
-
If starting fresh
|
|
100
|
+
If starting fresh:
|
|
101
|
+
```bash
|
|
102
|
+
mkdir -p {folder}/{feature-slug}/implement/checkpoints
|
|
103
|
+
mkdir -p {folder}/{feature-slug}/implement/sessions
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Create `{folder}/{feature-slug}/implement/IMPLEMENT.md`:
|
|
56
107
|
|
|
57
108
|
```markdown
|
|
58
109
|
# Implementation: {Feature Title}
|
|
@@ -88,141 +139,240 @@ Otherwise, use smart default:
|
|
|
88
139
|
|
|
89
140
|
## 6. Execute tasks
|
|
90
141
|
|
|
91
|
-
|
|
142
|
+
Initialize session task counter: `tasks_this_session = 0`
|
|
92
143
|
|
|
93
|
-
|
|
144
|
+
### 6a. Agent prompt template (all tiers)
|
|
94
145
|
|
|
95
|
-
|
|
96
|
-
|
|
146
|
+
For each task, construct the agent prompt:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
You are the plan-executor agent for the RPI workflow.
|
|
150
|
+
|
|
151
|
+
## Pre-Implementation (MANDATORY)
|
|
152
|
+
Before writing ANY code, read ALL target files and output:
|
|
153
|
+
CONTEXT_READ: [list of files examined]
|
|
154
|
+
EXISTING_PATTERNS: [key patterns observed -- naming, error handling, imports]
|
|
155
|
+
|
|
156
|
+
## Your Task
|
|
157
|
+
**{task_id}** {task_description}
|
|
158
|
+
Effort: {effort}
|
|
159
|
+
Files: {files}
|
|
160
|
+
Test: {test_spec from PLAN.md, if present}
|
|
161
|
+
|
|
162
|
+
## Technical Context
|
|
163
|
+
{contents of eng.md}
|
|
164
|
+
|
|
165
|
+
## Rules
|
|
166
|
+
- Only touch files listed for this task
|
|
167
|
+
- Match patterns from CONTEXT_READ -- do not invent new patterns
|
|
168
|
+
- If blocked, report the blocker -- don't improvise
|
|
169
|
+
- Classify any deviations: cosmetic | interface | scope
|
|
170
|
+
|
|
171
|
+
## Output Protocol
|
|
172
|
+
Write checkpoint to `{folder}/{feature-slug}/implement/checkpoints/{task_id}.md`:
|
|
173
|
+
|
|
174
|
+
## Status: {task_id}
|
|
175
|
+
status: done | blocked | deviated
|
|
176
|
+
files_read: ["files examined"]
|
|
177
|
+
files_changed: ["files modified"]
|
|
178
|
+
commit: {hash}
|
|
179
|
+
deviations: none | {severity}: {description}
|
|
180
|
+
duration: {seconds}s
|
|
181
|
+
context_read: ["files from CONTEXT_READ"]
|
|
182
|
+
patterns_followed: ["observed patterns"]
|
|
183
|
+
|
|
184
|
+
Return single line: `DONE: {task_id} | files: N | deviations: none`
|
|
185
|
+
```
|
|
97
186
|
|
|
98
187
|
#### If TDD is enabled (`tdd: true` in config):
|
|
99
188
|
|
|
100
|
-
|
|
189
|
+
Before launching plan-executor, run TDD cycle per task:
|
|
101
190
|
|
|
102
191
|
**RED — Write failing test:**
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
**VERIFY RED — Confirm correct failure:**
|
|
125
|
-
3b. Run the test:
|
|
126
|
-
```bash
|
|
127
|
-
{test_runner} {test_file}
|
|
128
|
-
```
|
|
129
|
-
- Test fails for expected reason → proceed
|
|
130
|
-
- Test errors (syntax/import) → fix test, re-run
|
|
131
|
-
- Test passes → behavior exists already, skip or ask user
|
|
132
|
-
|
|
133
|
-
**GREEN — Minimal implementation:**
|
|
134
|
-
3c. Launch plan-executor agent:
|
|
135
|
-
```
|
|
136
|
-
You are implementing a single task using TDD.
|
|
137
|
-
|
|
138
|
-
The following test is currently FAILING:
|
|
139
|
-
{test_file}:{test_name}
|
|
140
|
-
Failure: {failure_reason}
|
|
141
|
-
|
|
142
|
-
Write the MINIMAL code to make this test pass.
|
|
143
|
-
- Only touch files listed for this task
|
|
144
|
-
- Do NOT add features beyond what the test requires
|
|
145
|
-
- Match existing code style
|
|
146
|
-
- If blocked, report the blocker — don't improvise
|
|
147
|
-
```
|
|
192
|
+
Launch test-engineer agent:
|
|
193
|
+
```
|
|
194
|
+
You are the test-engineer agent for the RPI workflow.
|
|
195
|
+
|
|
196
|
+
Read these files for context:
|
|
197
|
+
- {folder}/{feature-slug}/plan/PLAN.md
|
|
198
|
+
- {folder}/{feature-slug}/plan/eng.md
|
|
199
|
+
|
|
200
|
+
Current task:
|
|
201
|
+
**{task_id}** {task_description}
|
|
202
|
+
Files: {files}
|
|
203
|
+
Test: {test_spec from PLAN.md, if present}
|
|
204
|
+
|
|
205
|
+
Write ONE failing test for this task.
|
|
206
|
+
- Exercise real code through public interfaces
|
|
207
|
+
- Clear, behavior-describing test name
|
|
208
|
+
- Minimal assertions — one logical check
|
|
209
|
+
- Follow project test conventions
|
|
210
|
+
- Do NOT write implementation code
|
|
211
|
+
```
|
|
148
212
|
|
|
149
|
-
**VERIFY
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
Run full suite to check regressions:
|
|
155
|
-
```bash
|
|
156
|
-
{test_runner}
|
|
157
|
-
```
|
|
158
|
-
- All pass → proceed to REFACTOR
|
|
159
|
-
- Target fails → fix implementation (not the test), re-run
|
|
160
|
-
- Other tests break → fix regressions first
|
|
213
|
+
**VERIFY RED:** Run test → must fail for expected reason.
|
|
214
|
+
**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."
|
|
215
|
+
**VERIFY GREEN:** Run test + full suite → all pass.
|
|
216
|
+
**REFACTOR:** Clean up, re-run tests.
|
|
217
|
+
**Additional cycles:** Repeat RED → GREEN → REFACTOR for each test scenario.
|
|
161
218
|
|
|
162
|
-
|
|
163
|
-
3e. Review implementation: remove duplication, improve names, extract helpers if 3+ uses.
|
|
164
|
-
Re-run tests to confirm still green.
|
|
219
|
+
### Tier 1 execution (Inline — weight <= 8):
|
|
165
220
|
|
|
166
|
-
|
|
167
|
-
|
|
221
|
+
For each task in order (respecting dependencies):
|
|
222
|
+
1. Launch plan-executor agent (foreground) with the prompt template
|
|
223
|
+
2. Agent returns full result
|
|
224
|
+
3. Extract status line from result. Discard rest.
|
|
225
|
+
4. Increment `tasks_this_session`
|
|
226
|
+
5. If config `commit_style` is `conventional`: verify agent committed, or stage and commit
|
|
227
|
+
6. Proceed to next task
|
|
168
228
|
|
|
169
|
-
|
|
229
|
+
### Tier 2 execution (File-mediated — weight 9-18):
|
|
170
230
|
|
|
171
|
-
|
|
231
|
+
For each task in order (respecting dependencies):
|
|
232
|
+
1. Launch plan-executor agent (foreground) with the prompt template
|
|
233
|
+
2. Agent writes checkpoint file and returns 1-line status
|
|
234
|
+
3. Parse status line only. Do NOT read the full agent response for context.
|
|
235
|
+
4. Increment `tasks_this_session`
|
|
236
|
+
5. If config `commit_style` is `conventional`: verify agent committed
|
|
237
|
+
6. **Session warning check**: if `tasks_this_session >= max_tasks_per_session`:
|
|
172
238
|
```
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
- {folder}/{feature-slug}/plan/PLAN.md
|
|
177
|
-
- {folder}/{feature-slug}/plan/eng.md
|
|
178
|
-
- {additional plan files if they exist}
|
|
179
|
-
|
|
180
|
-
Current task:
|
|
181
|
-
**{task_id}** {task_description}
|
|
182
|
-
Effort: {effort} | Files: {files}
|
|
183
|
-
|
|
184
|
-
Rules:
|
|
185
|
-
- Only touch files listed for this task
|
|
186
|
-
- Match existing code style
|
|
187
|
-
- If blocked, report the blocker — don't improvise
|
|
188
|
-
- When done, report: files changed, any deviations
|
|
239
|
+
Session getting long ({tasks_this_session} tasks completed).
|
|
240
|
+
Consider starting a new session for better accuracy:
|
|
241
|
+
/rpi:implement {feature-slug} --resume
|
|
189
242
|
```
|
|
243
|
+
Continue if user wants to proceed.
|
|
244
|
+
7. Proceed to next task
|
|
190
245
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
4. Update IMPLEMENT.md:
|
|
194
|
-
- Mark task as `[x]` with timestamp
|
|
195
|
-
- Record files changed
|
|
196
|
-
- Record any deviations
|
|
197
|
-
- If TDD: record tests written and pass/fail status
|
|
198
|
-
5. If config `commit_style` is `conventional`:
|
|
199
|
-
- Stage changed files
|
|
200
|
-
- Commit: `{type}({task_id}): {task_description}`
|
|
201
|
-
|
|
202
|
-
### Parallel wave mode:
|
|
246
|
+
### Tier 3 execution (Wave-isolated — weight > 18):
|
|
203
247
|
|
|
204
248
|
1. Group tasks by phase from PLAN.md
|
|
205
249
|
2. Within each phase, identify dependency waves:
|
|
206
250
|
- Wave 1: tasks with no deps (or deps already completed)
|
|
207
251
|
- Wave 2: tasks depending only on wave 1
|
|
208
252
|
- Wave 3: tasks depending on waves 1-2
|
|
209
|
-
3. For each wave
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
253
|
+
3. For each wave:
|
|
254
|
+
a. Launch ALL wave tasks as parallel foreground agents (one message, multiple Agent calls)
|
|
255
|
+
b. Each agent uses the prompt template
|
|
256
|
+
c. Wait for all agents in wave to complete
|
|
257
|
+
d. For each completed agent, parse status line only
|
|
258
|
+
e. Increment `tasks_this_session` by wave size
|
|
259
|
+
f. **Deviation check** (see section 6b)
|
|
260
|
+
g. **Rollback check** (see section 6c)
|
|
261
|
+
4. After each wave, **forced session checkpoint** (see section 6d)
|
|
262
|
+
|
|
263
|
+
## 6b. Handle deviations
|
|
264
|
+
|
|
265
|
+
After each task (all tiers) or after each wave (Tier 3):
|
|
266
|
+
|
|
267
|
+
1. Parse the status line for deviations
|
|
268
|
+
2. If `deviations: none` — continue
|
|
269
|
+
3. If deviation reported, read the checkpoint file to get severity:
|
|
270
|
+
- `cosmetic`: log in IMPLEMENT.md, continue automatically
|
|
271
|
+
- `interface`:
|
|
272
|
+
a. Read PLAN.md to find tasks that depend on the current task
|
|
273
|
+
b. Check if any dependent task's `Files:` field overlaps with the deviated files
|
|
274
|
+
c. If overlap: pause execution, ask user:
|
|
275
|
+
```
|
|
276
|
+
Task {task_id} changed an interface ({description}).
|
|
277
|
+
Downstream tasks that may be affected: {list}
|
|
278
|
+
Options:
|
|
279
|
+
- Continue (downstream agents will read the actual code)
|
|
280
|
+
- Pause and review the change
|
|
281
|
+
- Revert task {task_id} and re-plan
|
|
282
|
+
```
|
|
283
|
+
d. If no overlap: log, continue
|
|
284
|
+
- `scope`:
|
|
285
|
+
a. Pause execution immediately
|
|
286
|
+
b. Read full checkpoint file for details
|
|
287
|
+
c. Ask user:
|
|
288
|
+
```
|
|
289
|
+
Task {task_id} deviated in scope: {description}
|
|
290
|
+
Options:
|
|
291
|
+
- Accept the deviation and continue
|
|
292
|
+
- Revert task {task_id}: git revert {commit_hash}
|
|
293
|
+
- Stop implementation for manual review
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## 6c. Rollback protocol (Tier 3 parallel waves only)
|
|
297
|
+
|
|
298
|
+
If any task in a wave reports `status: blocked`:
|
|
299
|
+
|
|
300
|
+
1. Identify the blocked task and its reason
|
|
301
|
+
2. Read PLAN.md dependency graph
|
|
302
|
+
3. Find completed tasks in the SAME wave that depend on the blocked task:
|
|
303
|
+
```
|
|
304
|
+
invalidated = [t for t in wave_completed if blocked_task_id in t.deps]
|
|
305
|
+
```
|
|
306
|
+
4. For each invalidated task:
|
|
307
|
+
a. Read its checkpoint file to get commit hash
|
|
308
|
+
b. Run: `git revert {commit_hash} --no-commit`
|
|
309
|
+
c. Update checkpoint file: `status: rolled_back`
|
|
310
|
+
5. If any reverts were staged:
|
|
311
|
+
```bash
|
|
312
|
+
git commit -m "revert: rollback tasks {list} due to {blocked_task_id} failure"
|
|
313
|
+
```
|
|
314
|
+
6. Inform user:
|
|
315
|
+
```
|
|
316
|
+
Task {blocked_task_id} blocked: {reason}
|
|
317
|
+
Rolled back dependent tasks: {list}
|
|
318
|
+
Kept independent tasks: {list}
|
|
213
319
|
|
|
214
|
-
|
|
320
|
+
Fix the blocker and resume:
|
|
321
|
+
/rpi:implement {feature-slug} --resume --from-task {blocked_task_id}
|
|
322
|
+
```
|
|
323
|
+
7. Stop execution (do not proceed to next wave)
|
|
324
|
+
|
|
325
|
+
## 6d. Session checkpoint
|
|
326
|
+
|
|
327
|
+
Triggered by:
|
|
328
|
+
- Tier 2: user agrees to take a break after session warning
|
|
329
|
+
- Tier 3: after every wave completes
|
|
330
|
+
|
|
331
|
+
### Checkpoint process:
|
|
332
|
+
|
|
333
|
+
1. **Aggregate IMPLEMENT.md** from checkpoint files:
|
|
334
|
+
- Read all files in `{folder}/{feature-slug}/implement/checkpoints/`
|
|
335
|
+
- Sort by task ID
|
|
336
|
+
- Build IMPLEMENT.md with all task statuses, files changed, deviations
|
|
337
|
+
- Preserve existing sections (Simplify Findings, Review) if present
|
|
338
|
+
|
|
339
|
+
2. **Write session record** to `{folder}/{feature-slug}/implement/sessions/session-{N}.md`:
|
|
340
|
+
```markdown
|
|
341
|
+
# Session {N}
|
|
342
|
+
Started: {timestamp}
|
|
343
|
+
Ended: {timestamp}
|
|
344
|
+
Tier: {tier}
|
|
345
|
+
Tasks completed: {list of task IDs completed this session}
|
|
346
|
+
Total progress: {completed}/{total}
|
|
347
|
+
Next task: {next_task_id}
|
|
348
|
+
Deviations: {summary or "none"}
|
|
349
|
+
```
|
|
215
350
|
|
|
216
|
-
|
|
351
|
+
3. **Print resume command**:
|
|
352
|
+
```
|
|
353
|
+
Session checkpoint saved.
|
|
354
|
+
Completed: {completed}/{total} tasks
|
|
355
|
+
To continue in a new session:
|
|
356
|
+
/rpi:implement {feature-slug} --resume
|
|
357
|
+
```
|
|
217
358
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
Phase {N}: {Phase Name}
|
|
221
|
-
Tasks: {completed}/{total}
|
|
222
|
-
Commits: {list}
|
|
223
|
-
```
|
|
359
|
+
4. **For Tier 3: stop execution**. The user must start a new session.
|
|
360
|
+
For Tier 2: continue if user wants to, or stop.
|
|
224
361
|
|
|
225
|
-
|
|
362
|
+
## 7. Phase checkpoint
|
|
363
|
+
|
|
364
|
+
After all tasks in a PLAN.md phase complete:
|
|
365
|
+
|
|
366
|
+
1. Read checkpoint files for all tasks in the phase
|
|
367
|
+
2. Count completed vs blocked vs deviated
|
|
368
|
+
3. Output:
|
|
369
|
+
```
|
|
370
|
+
Phase {N}: {Phase Name}
|
|
371
|
+
Tasks: {completed}/{total}
|
|
372
|
+
Commits: {list from checkpoint files}
|
|
373
|
+
Deviations: {count by severity}
|
|
374
|
+
```
|
|
375
|
+
4. If any tasks blocked, ask user how to proceed before next phase
|
|
226
376
|
|
|
227
377
|
## 8. Run simplify (unless --skip-simplify)
|
|
228
378
|
|
|
@@ -240,14 +390,19 @@ Record verdict in IMPLEMENT.md under "## Review".
|
|
|
240
390
|
|
|
241
391
|
## 10. Finalize IMPLEMENT.md
|
|
242
392
|
|
|
243
|
-
|
|
393
|
+
Rebuild IMPLEMENT.md from all checkpoint files:
|
|
394
|
+
1. Read all files in `checkpoints/`
|
|
395
|
+
2. Build task list with statuses, commits, deviations
|
|
396
|
+
3. Append summary:
|
|
397
|
+
|
|
244
398
|
```markdown
|
|
245
399
|
## Summary
|
|
246
400
|
|
|
247
401
|
Completed: {timestamp}
|
|
248
402
|
Total tasks: {N}
|
|
249
|
-
|
|
250
|
-
|
|
403
|
+
Sessions: {count from sessions/ directory}
|
|
404
|
+
Commits: {list with hashes from checkpoints}
|
|
405
|
+
Deviations: {count by severity}
|
|
251
406
|
|
|
252
407
|
## Review Verdict: {PASS|FAIL}
|
|
253
408
|
{details}
|
|
@@ -272,6 +427,18 @@ Feature {feature-slug} implementation complete but review found issues:
|
|
|
272
427
|
Fix and re-run: /rpi:review {feature-slug}
|
|
273
428
|
```
|
|
274
429
|
|
|
430
|
+
## 11b. Cross-phase session boundary (Tier 3 only)
|
|
431
|
+
|
|
432
|
+
If tier == 3, after presenting the final result, add:
|
|
433
|
+
|
|
434
|
+
```
|
|
435
|
+
This was a large feature (Tier 3). For future features of this complexity,
|
|
436
|
+
consider running each RPI phase in a separate session:
|
|
437
|
+
1. Session 1: /rpi:new + /rpi:research
|
|
438
|
+
2. Session 2: /rpi:plan
|
|
439
|
+
3. Session 3+: /rpi:implement --resume (one session per wave)
|
|
440
|
+
```
|
|
441
|
+
|
|
275
442
|
## 12. Handle isolation cleanup
|
|
276
443
|
|
|
277
444
|
Read `isolation` from `.rpi.yaml`.
|