rpi-kit 2.2.2 → 2.5.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/.claude-plugin/marketplace.json +3 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.gemini/commands/opsx/apply.toml +149 -0
- package/.gemini/commands/opsx/archive.toml +154 -0
- package/.gemini/commands/opsx/bulk-archive.toml +239 -0
- package/.gemini/commands/opsx/continue.toml +111 -0
- package/.gemini/commands/opsx/explore.toml +170 -0
- package/.gemini/commands/opsx/ff.toml +94 -0
- package/.gemini/commands/opsx/new.toml +66 -0
- package/.gemini/commands/opsx/onboard.toml +547 -0
- package/.gemini/commands/opsx/propose.toml +103 -0
- package/.gemini/commands/opsx/sync.toml +131 -0
- package/.gemini/commands/opsx/verify.toml +161 -0
- package/.gemini/commands/rpi/archive.toml +140 -0
- package/.gemini/commands/rpi/docs-gen.toml +210 -0
- package/.gemini/commands/rpi/docs.toml +153 -0
- package/.gemini/commands/rpi/evolve.toml +411 -0
- package/.gemini/commands/rpi/fix.toml +290 -0
- package/.gemini/commands/rpi/implement.toml +272 -0
- package/.gemini/commands/rpi/init.toml +180 -0
- package/.gemini/commands/rpi/learn.toml +105 -0
- package/.gemini/commands/rpi/new.toml +158 -0
- package/.gemini/commands/rpi/onboarding.toml +236 -0
- package/.gemini/commands/rpi/party.toml +204 -0
- package/.gemini/commands/rpi/plan.toml +623 -0
- package/.gemini/commands/rpi/research.toml +265 -0
- package/.gemini/commands/rpi/review.toml +443 -0
- package/.gemini/commands/rpi/rpi.toml +114 -0
- package/.gemini/commands/rpi/simplify.toml +214 -0
- package/.gemini/commands/rpi/status.toml +194 -0
- package/.gemini/commands/rpi/update.toml +107 -0
- package/.gemini/skills/openspec-apply-change/SKILL.md +156 -0
- package/.gemini/skills/openspec-archive-change/SKILL.md +114 -0
- package/.gemini/skills/openspec-bulk-archive-change/SKILL.md +246 -0
- package/.gemini/skills/openspec-continue-change/SKILL.md +118 -0
- package/.gemini/skills/openspec-explore/SKILL.md +288 -0
- package/.gemini/skills/openspec-ff-change/SKILL.md +101 -0
- package/.gemini/skills/openspec-new-change/SKILL.md +74 -0
- package/.gemini/skills/openspec-onboard/SKILL.md +554 -0
- package/.gemini/skills/openspec-propose/SKILL.md +110 -0
- package/.gemini/skills/openspec-sync-specs/SKILL.md +138 -0
- package/.gemini/skills/openspec-verify-change/SKILL.md +168 -0
- package/CHANGELOG.md +15 -0
- package/README.md +6 -6
- package/agents/atlas.md +40 -0
- package/agents/clara.md +40 -0
- package/agents/forge.md +40 -0
- package/agents/hawk.md +40 -0
- package/agents/luna.md +40 -0
- package/agents/mestre.md +46 -0
- package/agents/nexus.md +52 -0
- package/agents/pixel.md +40 -0
- package/agents/quill.md +40 -0
- package/agents/razor.md +40 -0
- package/agents/sage.md +46 -0
- package/agents/scout.md +40 -0
- package/agents/shield.md +40 -0
- package/bin/cli.js +60 -18
- package/commands/rpi/docs.md +29 -1
- package/commands/rpi/fix.md +301 -0
- package/commands/rpi/implement.md +37 -0
- package/commands/rpi/plan.md +66 -1
- package/commands/rpi/research.md +48 -1
- package/commands/rpi/review.md +48 -1
- package/commands/rpi/rpi.md +1 -1
- package/commands/rpi/simplify.md +31 -1
- package/commands/rpi/status.md +69 -0
- package/marketplace.json +3 -2
- package/package.json +2 -1
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
description = "Quick bugfix — Luna interviews, Mestre plans (max 3 tasks), Forge implements. One command."
|
|
2
|
+
|
|
3
|
+
prompt = """
|
|
4
|
+
# /rpi:fix — Quick Bugfix
|
|
5
|
+
|
|
6
|
+
Runs Luna → Mestre → Forge in one step for bugfixes. Creates compact artifacts with max 3 tasks. Each task generates a commit.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Step 1: Load config and parse arguments
|
|
11
|
+
|
|
12
|
+
1. Read `.rpi.yaml` for config. Apply defaults if missing:
|
|
13
|
+
- `folder`: `rpi/features`
|
|
14
|
+
- `context_file`: `rpi/context.md`
|
|
15
|
+
- `commit_style`: `conventional`
|
|
16
|
+
2. Parse `$ARGUMENTS` to extract:
|
|
17
|
+
- `{slug}` — the bug name (required)
|
|
18
|
+
- `--resume`: continue from last completed task if IMPLEMENT.md exists
|
|
19
|
+
- `--force`: restart from scratch (overwrites existing artifacts)
|
|
20
|
+
3. If `{slug}` is not provided, ask with AskUserQuestion: "What's the bug? Give it a short slug (e.g. 'login-crash', 'missing-validation')."
|
|
21
|
+
4. Convert slug to kebab-case (lowercase, spaces/underscores become hyphens, strip special chars).
|
|
22
|
+
|
|
23
|
+
## Step 2: Check for existing feature
|
|
24
|
+
|
|
25
|
+
Check if `{folder}/{slug}/` already exists.
|
|
26
|
+
|
|
27
|
+
If it exists and `--force` was NOT passed:
|
|
28
|
+
- Check if `implement/IMPLEMENT.md` exists:
|
|
29
|
+
- If yes and `--resume` was passed (or default): skip to Step 6 (resume implementation).
|
|
30
|
+
- If yes and `--force` was NOT passed: ask the user: "Feature '{slug}' already exists. Resume implementation (--resume) or start over (--force)?"
|
|
31
|
+
- If no IMPLEMENT.md: ask the user: "Feature '{slug}' already exists but implementation hasn't started. Overwrite? (yes/no)"
|
|
32
|
+
|
|
33
|
+
If it exists and `--force` was passed: proceed (will overwrite).
|
|
34
|
+
|
|
35
|
+
## Step 3: Create directory structure
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
mkdir -p {folder}/{slug}/plan
|
|
39
|
+
mkdir -p {folder}/{slug}/implement
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
No `research/` directory. No `delta/` directories.
|
|
43
|
+
|
|
44
|
+
## Step 4: Luna — Bugfix Interview
|
|
45
|
+
|
|
46
|
+
Adopt Luna's persona. This is a bugfix interview — fast and focused.
|
|
47
|
+
|
|
48
|
+
### If slug is descriptive (e.g. `login-crash`, `null-pointer-auth`):
|
|
49
|
+
|
|
50
|
+
Ask one question with AskUserQuestion:
|
|
51
|
+
> "Descreve o bug: o que acontece, o que deveria acontecer, e onde se manifesta (ficheiro, endpoint, componente — se souberes)."
|
|
52
|
+
|
|
53
|
+
### If slug is vague (e.g. `fix1`, `bug`):
|
|
54
|
+
|
|
55
|
+
Ask two questions with AskUserQuestion:
|
|
56
|
+
> 1. "Qual é o bug?"
|
|
57
|
+
> 2. "Onde se manifesta? (ficheiro, endpoint, componente — se souberes)"
|
|
58
|
+
|
|
59
|
+
### Generate REQUEST.md
|
|
60
|
+
|
|
61
|
+
Write `{folder}/{slug}/REQUEST.md`:
|
|
62
|
+
|
|
63
|
+
```markdown
|
|
64
|
+
# Fix: {slug}
|
|
65
|
+
|
|
66
|
+
## Bug Report
|
|
67
|
+
{bug description — what happens vs. what should happen}
|
|
68
|
+
|
|
69
|
+
## Location
|
|
70
|
+
{where it manifests — file, module, endpoint, or "Unknown"}
|
|
71
|
+
|
|
72
|
+
## Constraints
|
|
73
|
+
- {constraint if any, or "None identified"}
|
|
74
|
+
|
|
75
|
+
## Unknowns
|
|
76
|
+
- {at least one — e.g., "Root cause not confirmed"}
|
|
77
|
+
|
|
78
|
+
## Complexity Estimate
|
|
79
|
+
S — bugfix
|
|
80
|
+
|
|
81
|
+
## Quick Flow
|
|
82
|
+
This is a bugfix. Skipping research phase.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Output:
|
|
86
|
+
```
|
|
87
|
+
REQUEST.md created: {folder}/{slug}/REQUEST.md
|
|
88
|
+
Starting plan phase...
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Step 5: Mestre — Compact Plan
|
|
92
|
+
|
|
93
|
+
Launch Mestre agent with this prompt:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
You are Mestre. Generate a compact bugfix plan for: {slug}
|
|
97
|
+
|
|
98
|
+
## Bug Report (REQUEST.md)
|
|
99
|
+
{content of REQUEST.md}
|
|
100
|
+
|
|
101
|
+
## Project Context
|
|
102
|
+
{content of context.md if it exists, otherwise "No project context file found."}
|
|
103
|
+
|
|
104
|
+
## Instructions
|
|
105
|
+
1. Read the files mentioned in the Location section of the bug report
|
|
106
|
+
2. Analyze the probable root cause
|
|
107
|
+
3. Generate a PLAN.md with maximum 3 tasks
|
|
108
|
+
4. Each task must list exact files to change and dependencies
|
|
109
|
+
5. Be surgical — only fix the bug, no refactoring, no improvements
|
|
110
|
+
|
|
111
|
+
IMPORTANT: If you determine this bug needs more than 3 tasks, output ONLY:
|
|
112
|
+
"ESCALATE: This bug is too complex for /rpi:fix. Use /rpi:new {slug} for the full pipeline."
|
|
113
|
+
Do NOT generate a plan in this case.
|
|
114
|
+
|
|
115
|
+
Output using this format:
|
|
116
|
+
|
|
117
|
+
# Plan: Fix {slug}
|
|
118
|
+
|
|
119
|
+
## Analysis
|
|
120
|
+
{2-3 sentences — probable root cause, affected files}
|
|
121
|
+
|
|
122
|
+
## Tasks
|
|
123
|
+
|
|
124
|
+
### Task 1: {description}
|
|
125
|
+
- Files: {files to change}
|
|
126
|
+
- Deps: none
|
|
127
|
+
|
|
128
|
+
### Task 2: {description}
|
|
129
|
+
- Files: {files to change}
|
|
130
|
+
- Deps: [1]
|
|
131
|
+
|
|
132
|
+
## Risks
|
|
133
|
+
- {if any, or "None — straightforward fix"}
|
|
134
|
+
|
|
135
|
+
After generating the plan, append your activity to {folder}/{slug}/ACTIVITY.md:
|
|
136
|
+
|
|
137
|
+
### {current_date} — Mestre (Fix — Compact Plan)
|
|
138
|
+
- **Action:** Compact bugfix plan for {slug}
|
|
139
|
+
- **Tasks:** {count}
|
|
140
|
+
- **Quality:** {your quality gate result}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Handle Mestre's response
|
|
144
|
+
|
|
145
|
+
If Mestre outputs `ESCALATE:`:
|
|
146
|
+
```
|
|
147
|
+
This bug needs more than 3 tasks — too complex for /rpi:fix.
|
|
148
|
+
|
|
149
|
+
Use the full pipeline: /rpi:new {slug}
|
|
150
|
+
```
|
|
151
|
+
Stop.
|
|
152
|
+
|
|
153
|
+
If Mestre outputs a valid plan:
|
|
154
|
+
1. Write `{folder}/{slug}/plan/PLAN.md` with Mestre's output.
|
|
155
|
+
2. Output:
|
|
156
|
+
```
|
|
157
|
+
PLAN.md created: {folder}/{slug}/plan/PLAN.md ({N} tasks)
|
|
158
|
+
Starting implementation...
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Step 6: Forge — Implementation
|
|
162
|
+
|
|
163
|
+
For each task in PLAN.md order, respecting dependency ordering:
|
|
164
|
+
|
|
165
|
+
### Step 6a: Initialize IMPLEMENT.md (if not resuming)
|
|
166
|
+
|
|
167
|
+
Write `{folder}/{slug}/implement/IMPLEMENT.md`:
|
|
168
|
+
|
|
169
|
+
```markdown
|
|
170
|
+
# Implementation: Fix {slug}
|
|
171
|
+
|
|
172
|
+
Started: {YYYY-MM-DD}
|
|
173
|
+
Plan: {folder}/{slug}/plan/PLAN.md
|
|
174
|
+
|
|
175
|
+
## Tasks
|
|
176
|
+
|
|
177
|
+
- [ ] Task {1}: {description}
|
|
178
|
+
- [ ] Task {2}: {description}
|
|
179
|
+
- ...
|
|
180
|
+
|
|
181
|
+
## Execution Log
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Step 6b: Handle resume
|
|
185
|
+
|
|
186
|
+
If resuming (IMPLEMENT.md exists):
|
|
187
|
+
1. Read IMPLEMENT.md, find next unchecked task `- [ ]`.
|
|
188
|
+
2. Output: `Resuming '{slug}' from task {next_task_id}. ({completed}/{total} tasks done)`
|
|
189
|
+
|
|
190
|
+
### Step 6c: Execute each task
|
|
191
|
+
|
|
192
|
+
Launch Forge agent for each task:
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
You are Forge. Implement task {task_id} for bugfix: {slug}
|
|
196
|
+
|
|
197
|
+
## Task
|
|
198
|
+
{task description from PLAN.md}
|
|
199
|
+
|
|
200
|
+
## Target Files
|
|
201
|
+
{files listed for this task}
|
|
202
|
+
|
|
203
|
+
## Dependencies Completed
|
|
204
|
+
{list of completed task IDs and their descriptions}
|
|
205
|
+
|
|
206
|
+
## Bug Report
|
|
207
|
+
{content of REQUEST.md}
|
|
208
|
+
|
|
209
|
+
## Project Context
|
|
210
|
+
{content of context.md if it exists}
|
|
211
|
+
|
|
212
|
+
CRITICAL RULES:
|
|
213
|
+
1. CONTEXT_READ: You MUST read ALL target files before writing ANY code
|
|
214
|
+
2. Match existing patterns — naming, error handling, imports, style
|
|
215
|
+
3. Only touch files listed in the task unless absolutely necessary
|
|
216
|
+
4. Commit your changes with a conventional commit message
|
|
217
|
+
5. Report: DONE | BLOCKED | DEVIATED
|
|
218
|
+
|
|
219
|
+
After completing the task, append your activity to {folder}/{slug}/ACTIVITY.md:
|
|
220
|
+
|
|
221
|
+
### {current_date} — Forge (Fix — Task {task_id})
|
|
222
|
+
- **Action:** Implemented task {task_id} for {slug}
|
|
223
|
+
- **Files changed:** {list}
|
|
224
|
+
- **Status:** {DONE|BLOCKED|DEVIATED}
|
|
225
|
+
- **Quality:** {your quality gate result}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Step 6d: Parse Forge response
|
|
229
|
+
|
|
230
|
+
**DONE:**
|
|
231
|
+
1. Update IMPLEMENT.md: `- [ ] Task {id}` → `- [x] Task {id}`
|
|
232
|
+
2. Append to Execution Log:
|
|
233
|
+
```
|
|
234
|
+
### Task {id}: {description}
|
|
235
|
+
- Status: DONE
|
|
236
|
+
- Commit: {hash}
|
|
237
|
+
- Files: {list of files changed}
|
|
238
|
+
```
|
|
239
|
+
3. Continue to next task.
|
|
240
|
+
|
|
241
|
+
**BLOCKED:**
|
|
242
|
+
1. Update IMPLEMENT.md with blocker.
|
|
243
|
+
2. Output:
|
|
244
|
+
```
|
|
245
|
+
Fix blocked at task {id}: {description}
|
|
246
|
+
|
|
247
|
+
Blocker: {reason}
|
|
248
|
+
|
|
249
|
+
Options:
|
|
250
|
+
- Fix the blocker and run: /rpi:fix {slug} --resume
|
|
251
|
+
- Use the full pipeline: /rpi:new {slug}
|
|
252
|
+
```
|
|
253
|
+
3. Stop.
|
|
254
|
+
|
|
255
|
+
**DEVIATED:**
|
|
256
|
+
1. Cosmetic: log it, continue automatically.
|
|
257
|
+
2. Interface/scope: warn the user, ask to accept or revert.
|
|
258
|
+
3. If accepted: update IMPLEMENT.md as DONE with deviation noted.
|
|
259
|
+
4. If reverted: git revert, task stays unchecked. Stop.
|
|
260
|
+
|
|
261
|
+
## Step 7: Completion summary
|
|
262
|
+
|
|
263
|
+
After all tasks completed, output:
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
Fix complete: {slug}
|
|
267
|
+
|
|
268
|
+
Tasks: {completed}/{total}
|
|
269
|
+
Commits:
|
|
270
|
+
- {hash1}: {task 1 description}
|
|
271
|
+
- {hash2}: {task 2 description}
|
|
272
|
+
|
|
273
|
+
Next:
|
|
274
|
+
- Review: /rpi:review {slug}
|
|
275
|
+
- Archive: /rpi:archive {slug}
|
|
276
|
+
- Full pipeline on this: /rpi {slug} --from=simplify
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Update IMPLEMENT.md with a final section:
|
|
280
|
+
|
|
281
|
+
```markdown
|
|
282
|
+
## Summary
|
|
283
|
+
|
|
284
|
+
- Total tasks: {N}
|
|
285
|
+
- Completed: {N}
|
|
286
|
+
- Blocked: {N}
|
|
287
|
+
- Deviations: {N}
|
|
288
|
+
- Completed: {YYYY-MM-DD}
|
|
289
|
+
```
|
|
290
|
+
"""
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
description = "Execute the plan task by task with Forge. Sage assists with tests if TDD enabled."
|
|
2
|
+
|
|
3
|
+
prompt = """
|
|
4
|
+
# /rpi:implement — Implement Phase
|
|
5
|
+
|
|
6
|
+
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.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Step 1: Load config and validate
|
|
11
|
+
|
|
12
|
+
1. Read `.rpi.yaml` for config. Apply defaults if missing:
|
|
13
|
+
- `folder`: `rpi/features`
|
|
14
|
+
- `context_file`: `rpi/context.md`
|
|
15
|
+
- `tdd`: `false`
|
|
16
|
+
- `commit_style`: `conventional`
|
|
17
|
+
2. Parse `$ARGUMENTS` to extract `{slug}` and optional flags:
|
|
18
|
+
- `--resume`: continue from last completed task (default behavior when IMPLEMENT.md exists)
|
|
19
|
+
- `--force`: restart implementation from scratch even if IMPLEMENT.md exists
|
|
20
|
+
3. Validate `rpi/features/{slug}/plan/PLAN.md` exists. If not:
|
|
21
|
+
```
|
|
22
|
+
PLAN.md not found for '{slug}'. Run /rpi:plan {slug} first.
|
|
23
|
+
```
|
|
24
|
+
Stop.
|
|
25
|
+
|
|
26
|
+
## Step 2: Gather context
|
|
27
|
+
|
|
28
|
+
1. Read `rpi/features/{slug}/plan/PLAN.md` — store as `$PLAN`.
|
|
29
|
+
2. Read `rpi/features/{slug}/plan/eng.md` if it exists — store as `$ENG`.
|
|
30
|
+
3. Read `rpi/context.md` (project context) if it exists — store as `$CONTEXT`.
|
|
31
|
+
4. Parse `$PLAN` to extract the ordered task list. Each task should have:
|
|
32
|
+
- `task_id`: task number/identifier
|
|
33
|
+
- `description`: what to implement
|
|
34
|
+
- `files`: target files to create or modify
|
|
35
|
+
- `deps`: dependencies on other tasks (must be completed first)
|
|
36
|
+
|
|
37
|
+
## Step 3: Handle resume vs fresh start
|
|
38
|
+
|
|
39
|
+
### If IMPLEMENT.md exists and `--force` was NOT passed:
|
|
40
|
+
|
|
41
|
+
1. Read `rpi/features/{slug}/implement/IMPLEMENT.md`.
|
|
42
|
+
2. Parse completed tasks: lines matching `- [x]` are done, `- [ ]` are pending.
|
|
43
|
+
3. Find the next incomplete task — this is where execution resumes.
|
|
44
|
+
4. Inform the user:
|
|
45
|
+
```
|
|
46
|
+
Resuming '{slug}' from task {next_task_id}. ({completed}/{total} tasks done)
|
|
47
|
+
```
|
|
48
|
+
5. Skip to Step 5 starting from the next incomplete task.
|
|
49
|
+
|
|
50
|
+
### If IMPLEMENT.md exists and `--force` was passed:
|
|
51
|
+
|
|
52
|
+
1. Ask the user: "IMPLEMENT.md already exists for '{slug}'. This will restart from scratch. Continue? (yes/no)"
|
|
53
|
+
2. If no: stop.
|
|
54
|
+
3. If yes: proceed to Step 4 (will overwrite).
|
|
55
|
+
|
|
56
|
+
### If IMPLEMENT.md does not exist:
|
|
57
|
+
|
|
58
|
+
Proceed to Step 4.
|
|
59
|
+
|
|
60
|
+
## Step 4: Initialize IMPLEMENT.md
|
|
61
|
+
|
|
62
|
+
1. Ensure directory exists: `rpi/features/{slug}/implement/`
|
|
63
|
+
2. Write `rpi/features/{slug}/implement/IMPLEMENT.md` with all tasks unchecked:
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
# Implementation: {Feature Title}
|
|
67
|
+
|
|
68
|
+
Started: {YYYY-MM-DD}
|
|
69
|
+
Plan: rpi/features/{slug}/plan/PLAN.md
|
|
70
|
+
|
|
71
|
+
## Tasks
|
|
72
|
+
|
|
73
|
+
- [ ] Task {1}: {description}
|
|
74
|
+
- [ ] Task {2}: {description}
|
|
75
|
+
- ...
|
|
76
|
+
|
|
77
|
+
## Execution Log
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Step 5: Execute tasks in order
|
|
81
|
+
|
|
82
|
+
For each task in PLAN.md order, respecting dependency ordering (a task's deps must all be `[x]` before it runs):
|
|
83
|
+
|
|
84
|
+
### Step 5a: TDD — Sage writes tests (if `tdd: true` in config)
|
|
85
|
+
|
|
86
|
+
Launch Sage agent with this prompt:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
You are Sage. Write failing tests for task {task_id} of feature: {slug}
|
|
90
|
+
|
|
91
|
+
## Task
|
|
92
|
+
{task description from PLAN.md}
|
|
93
|
+
|
|
94
|
+
## Target Files
|
|
95
|
+
{files listed for this task}
|
|
96
|
+
|
|
97
|
+
## Engineering Spec
|
|
98
|
+
{$ENG}
|
|
99
|
+
|
|
100
|
+
## Project Context
|
|
101
|
+
{$CONTEXT}
|
|
102
|
+
|
|
103
|
+
Your task:
|
|
104
|
+
1. Read existing test files and test patterns in the project
|
|
105
|
+
2. Write tests that verify the expected behavior for this task
|
|
106
|
+
3. Tests MUST fail right now (the implementation doesn't exist yet)
|
|
107
|
+
4. Cover: happy path, error path, at least one edge case
|
|
108
|
+
5. Run the tests and confirm they fail
|
|
109
|
+
6. Output: test file path, test code, and the failing test output
|
|
110
|
+
|
|
111
|
+
After writing tests, append your activity to rpi/features/{slug}/ACTIVITY.md:
|
|
112
|
+
|
|
113
|
+
### {current_date} — Sage (Implement — TDD for Task {task_id})
|
|
114
|
+
- **Action:** Wrote failing tests for task {task_id}
|
|
115
|
+
- **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
|
|
116
|
+
- **Tests written:** {count}
|
|
117
|
+
- **Edge cases covered:** {count}
|
|
118
|
+
- **Quality:** {your quality gate result}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
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.
|
|
122
|
+
|
|
123
|
+
### Step 5b: Launch Forge to implement
|
|
124
|
+
|
|
125
|
+
Launch Forge agent with this prompt:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
You are Forge. Implement task {task_id} for feature: {slug}
|
|
129
|
+
|
|
130
|
+
## Task
|
|
131
|
+
{task description from PLAN.md}
|
|
132
|
+
|
|
133
|
+
## Target Files
|
|
134
|
+
{files listed for this task}
|
|
135
|
+
|
|
136
|
+
## Dependencies Completed
|
|
137
|
+
{list of completed task IDs and their descriptions}
|
|
138
|
+
|
|
139
|
+
## Engineering Spec
|
|
140
|
+
{$ENG}
|
|
141
|
+
|
|
142
|
+
## Project Context
|
|
143
|
+
{$CONTEXT}
|
|
144
|
+
|
|
145
|
+
## Tests to Pass
|
|
146
|
+
{$SAGE_TESTS if TDD enabled, otherwise "No TDD tests — follow the plan."}
|
|
147
|
+
|
|
148
|
+
CRITICAL RULES:
|
|
149
|
+
1. CONTEXT_READ: You MUST read ALL target files before writing ANY code
|
|
150
|
+
2. Match existing patterns — naming, error handling, imports, style
|
|
151
|
+
3. Only touch files listed in the task unless absolutely necessary
|
|
152
|
+
4. If TDD: make the failing tests pass
|
|
153
|
+
5. Commit your changes with a conventional commit message
|
|
154
|
+
6. Report: DONE | BLOCKED | DEVIATED
|
|
155
|
+
|
|
156
|
+
After completing the task, append your activity to rpi/features/{slug}/ACTIVITY.md:
|
|
157
|
+
|
|
158
|
+
### {current_date} — Forge (Implement — Task {task_id})
|
|
159
|
+
- **Action:** Implemented task {task_id} for {slug}
|
|
160
|
+
- **Key decisions:** {for each <decision> tag you emitted: "summary (rationale)", separated by semicolons. If none: "No decisions in this phase."}
|
|
161
|
+
- **Files changed:** {list}
|
|
162
|
+
- **Status:** {DONE|BLOCKED|DEVIATED}
|
|
163
|
+
- **Quality:** {your quality gate result}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Step 5c: Parse Forge response
|
|
167
|
+
|
|
168
|
+
Forge will respond with one of three statuses:
|
|
169
|
+
|
|
170
|
+
#### DONE
|
|
171
|
+
|
|
172
|
+
1. Task completed successfully.
|
|
173
|
+
2. Extract the commit hash from Forge's commit.
|
|
174
|
+
3. If TDD enabled: verify tests now pass. If tests still fail, inform the user and ask how to proceed.
|
|
175
|
+
4. Update IMPLEMENT.md: change `- [ ] Task {id}` to `- [x] Task {id}` and append to Execution Log:
|
|
176
|
+
```
|
|
177
|
+
### Task {id}: {description}
|
|
178
|
+
- Status: DONE
|
|
179
|
+
- Commit: {hash}
|
|
180
|
+
- Files: {list of files changed}
|
|
181
|
+
```
|
|
182
|
+
5. Continue to next task.
|
|
183
|
+
|
|
184
|
+
#### BLOCKED
|
|
185
|
+
|
|
186
|
+
1. Forge could not complete the task.
|
|
187
|
+
2. Update IMPLEMENT.md with blocker details:
|
|
188
|
+
```
|
|
189
|
+
### Task {id}: {description}
|
|
190
|
+
- Status: BLOCKED
|
|
191
|
+
- Reason: {blocker description from Forge}
|
|
192
|
+
```
|
|
193
|
+
3. Stop execution. Inform the user:
|
|
194
|
+
```
|
|
195
|
+
Implementation blocked at task {id}: {description}
|
|
196
|
+
|
|
197
|
+
Blocker: {reason}
|
|
198
|
+
|
|
199
|
+
Options:
|
|
200
|
+
- Fix the blocker and run: /rpi:implement {slug} --resume
|
|
201
|
+
- Skip this task and continue: /rpi:implement {slug} (after manually marking task as skipped)
|
|
202
|
+
- Re-plan: /rpi:plan {slug} --force
|
|
203
|
+
```
|
|
204
|
+
4. Do NOT continue to the next task.
|
|
205
|
+
|
|
206
|
+
#### DEVIATED
|
|
207
|
+
|
|
208
|
+
1. Forge deviated from the plan.
|
|
209
|
+
2. Check the deviation severity:
|
|
210
|
+
- **cosmetic** (naming, formatting): log it, continue automatically.
|
|
211
|
+
- **interface** (API changes, function signatures): warn the user, ask to accept or revert.
|
|
212
|
+
- **scope** (extra features, different approach): stop execution, ask the user to accept or revert.
|
|
213
|
+
3. If accepted: update IMPLEMENT.md as DONE with deviation noted:
|
|
214
|
+
```
|
|
215
|
+
### Task {id}: {description}
|
|
216
|
+
- Status: DONE (with deviation)
|
|
217
|
+
- Commit: {hash}
|
|
218
|
+
- Deviation: {severity} — {description}
|
|
219
|
+
- Files: {list of files changed}
|
|
220
|
+
```
|
|
221
|
+
4. If reverted: Forge's changes are reverted (git revert), task stays unchecked. Inform the user and stop.
|
|
222
|
+
|
|
223
|
+
## Step 6: Completion summary
|
|
224
|
+
|
|
225
|
+
After all tasks are completed, output:
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
Implementation complete: {slug}
|
|
229
|
+
|
|
230
|
+
Tasks: {completed}/{total}
|
|
231
|
+
Commits:
|
|
232
|
+
- {hash1}: {task 1 description}
|
|
233
|
+
- {hash2}: {task 2 description}
|
|
234
|
+
- ...
|
|
235
|
+
|
|
236
|
+
{If any deviations: list them here}
|
|
237
|
+
|
|
238
|
+
Next: /rpi {slug}
|
|
239
|
+
Or explicitly: /rpi:simplify {slug}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Update IMPLEMENT.md with a final section:
|
|
243
|
+
|
|
244
|
+
```markdown
|
|
245
|
+
## Summary
|
|
246
|
+
|
|
247
|
+
- Total tasks: {N}
|
|
248
|
+
- Completed: {N}
|
|
249
|
+
- Blocked: {N}
|
|
250
|
+
- Deviations: {N} ({list severities})
|
|
251
|
+
- Completed: {YYYY-MM-DD}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Step 7: Consolidate decisions to DECISIONS.md
|
|
255
|
+
|
|
256
|
+
1. Read `rpi/features/{slug}/ACTIVITY.md`.
|
|
257
|
+
2. Extract all `<decision>` tags from entries belonging to the Implement phase (Sage and Forge entries from this run).
|
|
258
|
+
3. If no decisions found, skip this step.
|
|
259
|
+
4. Read `rpi/features/{slug}/DECISIONS.md` if it exists (to get the last decision number for sequential numbering).
|
|
260
|
+
5. Append a new section to `rpi/features/{slug}/DECISIONS.md`:
|
|
261
|
+
|
|
262
|
+
```markdown
|
|
263
|
+
## Implement Phase
|
|
264
|
+
_Generated: {current_date}_
|
|
265
|
+
|
|
266
|
+
| # | Type | Decision | Alternatives | Rationale | Impact |
|
|
267
|
+
|---|------|----------|-------------|-----------|--------|
|
|
268
|
+
| {N} | {type} | {summary} | {alternatives} | {rationale} | {impact} |
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
6. Number decisions sequentially, continuing from the last number in DECISIONS.md.
|
|
272
|
+
"""
|