rpi-kit 1.2.0 → 1.3.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
3
3
  "name": "rpi-kit",
4
- "version": "1.1.0",
4
+ "version": "1.3.0",
5
5
  "description": "Research → Plan → Implement. A systematic feature development workflow with validation gates, multi-role agent teams, and adaptive depth.",
6
6
  "owner": {
7
7
  "name": "Daniel Mendes"
@@ -11,7 +11,7 @@
11
11
  "name": "rpi-kit",
12
12
  "source": "./",
13
13
  "description": "Research → Plan → Implement. A systematic feature development workflow for Claude Code and Codex.",
14
- "version": "1.1.0",
14
+ "version": "1.3.0",
15
15
  "author": {
16
16
  "name": "Daniel Mendes"
17
17
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rpi-kit",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Research → Plan → Implement. A systematic feature development workflow with validation gates, multi-role agent teams, and adaptive depth.",
5
5
  "author": {
6
6
  "name": "Daniel Mendes",
package/README.md CHANGED
@@ -73,6 +73,7 @@ Copy `AGENTS.md` and `codex.md` to your project root. The workflow rules and age
73
73
  | `/rpi:review` | Code review against plan requirements + test coverage |
74
74
  | `/rpi:docs` | Generate documentation from implementation artifacts |
75
75
  | `/rpi:add-todo` | Capture quick implementation ideas in `{folder}/todos/` |
76
+ | `/rpi:set-profile` | Switch the active model profile for agent execution |
76
77
 
77
78
  ## Research Tiers
78
79
 
@@ -136,6 +137,33 @@ test_runner: auto # or "npm test", "npx vitest", "pytest", etc.
136
137
  - **Implementation** writes a failing test first, verifies failure, then implements minimal code
137
138
  - **Review** checks test coverage and verifies tests exercise real code through public interfaces
138
139
 
140
+ ## Model Profiles
141
+
142
+ Control which AI model runs each workflow phase. Profiles optimize the cost/quality tradeoff by using stronger models where reasoning matters most and faster models for mechanical tasks.
143
+
144
+ | Profile | research | plan | implement | review |
145
+ |---------|----------|------|-----------|--------|
146
+ | `quality-first` | opus | opus | opus | opus |
147
+ | `balanced` | opus | opus | sonnet | opus |
148
+ | `speed-first` | sonnet | sonnet | sonnet | sonnet |
149
+ | `budget` | haiku | sonnet | haiku | sonnet |
150
+
151
+ ### Configure via command
152
+
153
+ ```bash
154
+ /rpi:set-profile balanced
155
+ ```
156
+
157
+ ### Configure via `.rpi.yaml`
158
+
159
+ ```yaml
160
+ profile: balanced # quality-first | balanced | speed-first | budget
161
+ models: # Per-phase overrides (optional)
162
+ implement: opus # Override a single phase
163
+ ```
164
+
165
+ Per-phase overrides in `models:` take precedence over the profile. No profile configured = all agents inherit the parent session's model (current default behavior).
166
+
139
167
  ## Feature Folder Structure
140
168
 
141
169
  Each feature lives in its own folder (configurable via `.rpi.yaml`):
@@ -21,13 +21,17 @@ Generate documentation for a completed feature using all RPI artifacts as source
21
21
 
22
22
  ## 1. Load config and parse arguments
23
23
 
24
- Read `.rpi.yaml` for folder path.
24
+ Read `.rpi.yaml` for folder path. Also read `profile` and `models` keys.
25
25
  Parse `$ARGUMENTS`:
26
26
  - First argument: `{feature-slug}` (required)
27
27
  - `--skip-inline`: skip adding inline code documentation
28
28
  - `--skip-readme`: skip README updates
29
29
  - `--skip-changelog`: skip changelog entry
30
30
 
31
+ ## 1b. Resolve model
32
+
33
+ Resolve the model for the `review` phase following the Model Resolution Algorithm in the rpi-workflow skill. Store as `{resolved_model}`. If a model is resolved, output the status message before agent spawns.
34
+
31
35
  ## 2. Validate prerequisites
32
36
 
33
37
  Verify the feature has passed review. Read `{folder}/{feature-slug}/implement/IMPLEMENT.md`.
@@ -66,7 +70,7 @@ Use Glob and Grep to read the actual implemented files and identify what needs d
66
70
 
67
71
  ## 5. Launch parallel documentation agents
68
72
 
69
- Use the Agent tool to launch applicable agents concurrently.
73
+ Use the Agent tool to launch applicable agents concurrently. If a model was resolved in Step 1b, include `model: "{resolved_model}"` in each Agent tool call.
70
74
 
71
75
  ### Agent 1: Inline Documentation (unless --skip-inline)
72
76
 
@@ -21,7 +21,7 @@ Execute tasks from PLAN.md with per-task commits, automatic code simplification,
21
21
 
22
22
  ## 1. Load config and parse arguments
23
23
 
24
- Read `.rpi.yaml` for configuration.
24
+ Read `.rpi.yaml` for configuration. Also read `profile` and `models` keys.
25
25
  Parse `$ARGUMENTS`:
26
26
  - First argument: `{feature-slug}` (required)
27
27
  - `--sequential`: force single agent mode
@@ -31,9 +31,29 @@ Parse `$ARGUMENTS`:
31
31
  - `--resume`: resume from last completed task in existing IMPLEMENT.md
32
32
  - `--from-task {id}`: resume from a specific task ID (used with --resume)
33
33
 
34
- ## 2. Validate prerequisites
34
+ ## 1b. Resolve model
35
35
 
36
- Read `{folder}/{feature-slug}/plan/PLAN.md`. If missing:
36
+ 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.
37
+
38
+ ## 2. Resolve feature path and validate prerequisites
39
+
40
+ Parse `{feature-slug}` from arguments.
41
+
42
+ **Resolution order:**
43
+ 1. Check if `{folder}/{feature-slug}/` exists → type = "feature", path = `{folder}/{feature-slug}`
44
+ 2. If not, Glob `{folder}/*/changes/{feature-slug}/` → if found, type = "change", path = matched path, parent_path = parent directory
45
+ 3. If multiple matches → AskUserQuestion listing all matches with full paths
46
+ 4. If no match → error: `Feature not found: {feature-slug}. Run /rpi:new {feature-slug} first.`
47
+
48
+ If `type == "change"`:
49
+ - Set `parent_path` to the parent feature directory
50
+ - Read parent artifacts for agent context:
51
+ - `{parent_path}/REQUEST.md`
52
+ - `{parent_path}/research/RESEARCH.md` (if exists)
53
+ - `{parent_path}/plan/PLAN.md` (if exists)
54
+ - `{parent_path}/plan/eng.md` (if exists)
55
+
56
+ Read `{path}/plan/PLAN.md`. If missing:
37
57
  ```
38
58
  Plan not found. Run /rpi:plan {feature-slug} first.
39
59
  ```
@@ -143,7 +163,7 @@ Initialize session task counter: `tasks_this_session = 0`
143
163
 
144
164
  ### 6a. Agent prompt template (all tiers)
145
165
 
146
- For each task, construct the agent prompt:
166
+ 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).
147
167
 
148
168
  ```
149
169
  You are the plan-executor agent for the RPI workflow.
@@ -162,6 +182,16 @@ Test: {test_spec from PLAN.md, if present}
162
182
  ## Technical Context
163
183
  {contents of eng.md}
164
184
 
185
+ If `type == "change"`, add:
186
+
187
+ ## Parent Feature Context
188
+ {contents of parent artifacts read in step 2}
189
+
190
+ This is a CHANGE to an existing feature. When implementing:
191
+ - Ensure compatibility with existing parent feature code
192
+ - Flag breaking changes as scope deviations
193
+ - Reference parent architecture decisions from eng.md
194
+
165
195
  ## Rules
166
196
  - Only touch files listed for this task
167
197
  - Match patterns from CONTEXT_READ -- do not invent new patterns
@@ -41,6 +41,16 @@ Use AskUserQuestion to gather preferences. Ask up to 4 questions at a time:
41
41
  - "Enable Test-Driven Development during implementation?" — Options: No (default), Yes
42
42
  - If yes: "What command runs your tests?" — Options: auto-detect (Recommended), `npm test`, `npx vitest`, `pytest`, custom
43
43
 
44
+ **Batch 5 (Model Profiles):**
45
+ - "Which model profile do you want for agent execution?" — Options:
46
+ - `balanced` (Recommended — opus for research/plan/review, sonnet for implement)
47
+ - `quality-first` (opus everywhere — maximum quality)
48
+ - `speed-first` (sonnet everywhere — maximum speed)
49
+ - `budget` (haiku + sonnet mix — cost optimized, may reduce research quality)
50
+ - "No profile" (default — all agents inherit parent model)
51
+
52
+ If reconfiguring and a profile already exists, show: "Current profile: {profile}. Change model profile?" with the same options plus "Keep current ({profile})".
53
+
44
54
  ## 3. Create .rpi.yaml
45
55
 
46
56
  Write the config file at the project root:
@@ -61,6 +71,7 @@ tdd: {true|false}
61
71
  test_runner: {auto|command}
62
72
  session_isolation: {auto|aggressive|off}
63
73
  max_tasks_per_session: 5 # tasks before session warning (Tier 2) or forced checkpoint (Tier 3)
74
+ profile: {balanced|quality-first|speed-first|budget} # omit if "No profile" selected
64
75
  ```
65
76
 
66
77
  ## 4. Create feature folder
@@ -73,11 +84,25 @@ mkdir -p {folder}
73
84
  ## 5. Confirm
74
85
 
75
86
  Output a brief confirmation:
87
+
88
+ With profile:
89
+ ```
90
+ RPI initialized.
91
+ Config: .rpi.yaml
92
+ Features: {folder}/
93
+ Tier: {tier}
94
+ Profile: {profile} (research: {model}, plan: {model}, implement: {model}, review: {model})
95
+
96
+ Next: /rpi:new to start your first feature.
97
+ ```
98
+
99
+ Without profile:
76
100
  ```
77
101
  RPI initialized.
78
102
  Config: .rpi.yaml
79
103
  Features: {folder}/
80
104
  Tier: {tier}
105
+ Profile: none (agents inherit parent model)
81
106
 
82
107
  Next: /rpi:new to start your first feature.
83
108
  ```
@@ -29,7 +29,34 @@ If no argument, ask: "What feature do you want to build?" and derive the slug fr
29
29
 
30
30
  ## 3. Check for existing feature
31
31
 
32
- Check if `{folder}/{feature-slug}/` already exists. If yes, warn the user and ask if they want to continue (overwrite REQUEST.md) or pick a different name.
32
+ Check if `{folder}/{feature-slug}/` already exists.
33
+
34
+ If it does NOT exist, continue to step 4 (new feature interview).
35
+
36
+ If it DOES exist, ask the user with AskUserQuestion:
37
+
38
+ "Feature '{feature-slug}' already exists ({folder}/{feature-slug}/). What do you want to do?"
39
+
40
+ Options:
41
+ - "Create a change for this feature" — go to step 3b
42
+ - "Overwrite existing REQUEST.md" — continue to step 4 (current behavior)
43
+ - "Pick a different name" — go back to step 2
44
+
45
+ ## 3b. Set up change
46
+
47
+ Ask: "What change do you want to make to {feature-slug}?" and derive change-slug (kebab-case) from the answer.
48
+
49
+ Check if `{folder}/{feature-slug}/changes/{change-slug}/` already exists. If yes, warn and ask to overwrite or pick a different name.
50
+
51
+ Read parent feature context for the interview:
52
+ - `{folder}/{feature-slug}/REQUEST.md`
53
+ - `{folder}/{feature-slug}/research/RESEARCH.md` (if exists)
54
+ - `{folder}/{feature-slug}/plan/PLAN.md` (if exists)
55
+ - `{folder}/{feature-slug}/implement/IMPLEMENT.md` (if exists)
56
+
57
+ Store the parent artifacts content as `parent_context` for use in steps 4 and 6.
58
+
59
+ Set `is_change = true` and `parent_slug = {feature-slug}`.
33
60
 
34
61
  ## 4. Adaptive interview
35
62
 
@@ -48,6 +75,22 @@ Start with core questions, then ask follow-ups based on answers.
48
75
 
49
76
  Use AskUserQuestion for structured questions. Keep it conversational — 2-3 questions per batch, max 3 batches. Stop when you have enough to write a clear REQUEST.md.
50
77
 
78
+ ### Change mode interview (if `is_change == true`)
79
+
80
+ Replace the core questions with context-aware ones:
81
+
82
+ **Core (always ask):**
83
+ - "What do you want to change in {parent_slug}?" (skip if already answered in step 3b)
84
+ - "Why is this change needed?"
85
+
86
+ **Adaptive follow-ups (based on parent artifacts):**
87
+ - If parent has IMPLEMENT.md: "Which parts of the existing implementation are affected?"
88
+ - If parent has PLAN.md with architecture decisions: "Does this change any architecture decisions from the original plan?"
89
+ - If change sounds like it could break things: "Will this break any existing behavior?"
90
+ - Always offer: "Any constraints or references?"
91
+
92
+ Use AskUserQuestion. Keep it lighter than new features — max 2 batches.
93
+
51
94
  ## 5. Set up isolation
52
95
 
53
96
  Read `isolation` from `.rpi.yaml` (default: `none`).
@@ -128,6 +171,45 @@ Write `{folder}/{feature-slug}/REQUEST.md` with this structure:
128
171
  {S | M | L | XL} — {brief justification}
129
172
  ```
130
173
 
174
+ ### Change mode directory creation (if `is_change == true`)
175
+
176
+ Skip isolation setup (changes use the parent feature's branch/worktree context).
177
+
178
+ Create the change directory structure:
179
+ ```bash
180
+ mkdir -p {folder}/{parent_slug}/changes/{change-slug}/research
181
+ mkdir -p {folder}/{parent_slug}/changes/{change-slug}/plan
182
+ mkdir -p {folder}/{parent_slug}/changes/{change-slug}/implement
183
+ ```
184
+
185
+ Write `{folder}/{parent_slug}/changes/{change-slug}/REQUEST.md` with this structure:
186
+
187
+ ```markdown
188
+ # {Change Title}
189
+
190
+ ## Parent Feature
191
+ [{Parent Feature Title}]({relative-path-to-parent-REQUEST.md})
192
+ {1-2 sentence summary of parent feature from parent_context}
193
+
194
+ ## Summary of Change
195
+ {What changes in the existing feature}
196
+
197
+ ## Motivation
198
+ {Why this change is needed}
199
+
200
+ ## Affected Areas
201
+ - {Components/files of parent feature that are affected}
202
+
203
+ ## Breaking Changes
204
+ - {List or "None"}
205
+
206
+ ## Constraints
207
+ - {Technical/business constraints}
208
+
209
+ ## Complexity Estimate
210
+ {S | M | L | XL} — {brief justification}
211
+ ```
212
+
131
213
  ## 7. Next step
132
214
 
133
215
  Output:
@@ -141,4 +223,14 @@ Options:
141
223
  --deep Full analysis with strategic review
142
224
  ```
143
225
 
226
+ ### Change mode output (if `is_change == true`)
227
+
228
+ Output:
229
+ ```
230
+ Change created: {folder}/{parent_slug}/changes/{change-slug}/REQUEST.md
231
+ Parent: {folder}/{parent_slug}/
232
+
233
+ Next: /rpi:research {change-slug}
234
+ ```
235
+
144
236
  </process>
@@ -20,21 +20,41 @@ Generate implementation plan artifacts from the research output. Adapts which ar
20
20
 
21
21
  ## 1. Load config and parse arguments
22
22
 
23
- Read `.rpi.yaml` for configuration.
23
+ Read `.rpi.yaml` for configuration. Also read `profile` and `models` keys.
24
24
  Parse `$ARGUMENTS`:
25
25
  - First argument: `{feature-slug}` (required)
26
26
  - `--force`: proceed even if research verdict was NO-GO
27
27
  - `--skip-pm`: don't generate pm.md
28
28
  - `--skip-ux`: don't generate ux.md
29
29
 
30
- ## 2. Validate prerequisites
30
+ ## 1b. Resolve model
31
31
 
32
- Read `{folder}/{feature-slug}/research/RESEARCH.md`. If missing:
32
+ Resolve the model for the `plan` phase following the Model Resolution Algorithm in the rpi-workflow skill. Store as `{resolved_model}`. If a model is resolved, output the status message before agent spawns.
33
+
34
+ ## 2. Resolve feature path and validate prerequisites
35
+
36
+ Parse `{feature-slug}` from arguments.
37
+
38
+ **Resolution order:**
39
+ 1. Check if `{folder}/{feature-slug}/` exists → type = "feature", path = `{folder}/{feature-slug}`
40
+ 2. If not, Glob `{folder}/*/changes/{feature-slug}/` → if found, type = "change", path = matched path, parent_path = parent directory
41
+ 3. If multiple matches → AskUserQuestion listing all matches with full paths
42
+ 4. If no match → error: `Feature not found: {feature-slug}. Run /rpi:new {feature-slug} first.`
43
+
44
+ If `type == "change"`:
45
+ - Set `parent_path` to the parent feature directory
46
+ - Read parent artifacts for agent context:
47
+ - `{parent_path}/REQUEST.md`
48
+ - `{parent_path}/research/RESEARCH.md` (if exists)
49
+ - `{parent_path}/plan/PLAN.md` (if exists)
50
+ - `{parent_path}/plan/eng.md` (if exists)
51
+
52
+ Read `{path}/research/RESEARCH.md`. If missing:
33
53
  ```
34
54
  Research not found. Run /rpi:research {feature-slug} first.
35
55
  ```
36
56
 
37
- Check the verdict in RESEARCH.md. If NO-GO and no `--force` flag:
57
+ Check verdict. If NO-GO and no `--force`:
38
58
  ```
39
59
  Research verdict is NO-GO. Review alternatives in RESEARCH.md.
40
60
  To proceed anyway: /rpi:plan {feature-slug} --force
@@ -85,7 +105,7 @@ After the interview, create a brief alignment summary that will be included in a
85
105
 
86
106
  ## 4. Generate eng.md (always)
87
107
 
88
- Launch senior-engineer agent:
108
+ Launch senior-engineer agent. If a model was resolved in Step 1b, include `model: "{resolved_model}"` in the Agent tool call.
89
109
  ```
90
110
  You are planning the technical implementation for a feature.
91
111
 
@@ -108,9 +128,23 @@ Be concrete. Cite existing codebase files and patterns from the research.
108
128
  Follow senior-engineer rules from RPI agent guidelines.
109
129
  ```
110
130
 
131
+ If `type == "change"`, append to the agent prompt:
132
+
133
+ ```
134
+ ## Parent Feature Context
135
+ {contents of parent artifacts read in step 2}
136
+
137
+ This is a CHANGE to an existing feature. Focus on:
138
+ - What's different from the parent implementation
139
+ - Compatibility with existing code
140
+ - Breaking changes to watch for
141
+ ```
142
+
143
+ > **Note:** Also append this same parent context block to the pm.md (step 5), ux.md (step 6), and PLAN.md (step 7) agent prompts when `type == "change"`.
144
+
111
145
  ## 5. Generate pm.md (if not skipped)
112
146
 
113
- Launch product-manager agent:
147
+ Launch product-manager agent. If a model was resolved, include `model: "{resolved_model}"` in the Agent tool call.
114
148
  ```
115
149
  You are creating product requirements for a feature.
116
150
 
@@ -133,7 +167,7 @@ Follow product-manager rules from RPI agent guidelines.
133
167
 
134
168
  ## 6. Generate ux.md (if not skipped)
135
169
 
136
- Launch ux-designer agent:
170
+ Launch ux-designer agent. If a model was resolved, include `model: "{resolved_model}"` in the Agent tool call.
137
171
  ```
138
172
  You are designing the user experience for a feature.
139
173
 
@@ -156,7 +190,7 @@ Follow ux-designer rules from RPI agent guidelines.
156
190
 
157
191
  ## 7. Generate PLAN.md
158
192
 
159
- After all agents complete (eng.md is required, pm.md and ux.md may be parallel), launch senior-engineer agent again to create the task breakdown:
193
+ After all agents complete (eng.md is required, pm.md and ux.md may be parallel), launch senior-engineer agent again to create the task breakdown. If a model was resolved, include `model: "{resolved_model}"` in the Agent tool call.
160
194
 
161
195
  ```
162
196
  You are creating an implementation plan from the technical spec.
@@ -20,21 +20,37 @@ Run parallel research agents on a feature's REQUEST.md, synthesize findings into
20
20
 
21
21
  ## 1. Load config and parse arguments
22
22
 
23
- Read `.rpi.yaml` for folder path and default tier.
23
+ Read `.rpi.yaml` for folder path and default tier. Also read `profile` and `models` keys.
24
24
  Parse `$ARGUMENTS`:
25
25
  - First argument: `{feature-slug}` (required)
26
26
  - Flags: `--quick`, `--standard`, `--deep` (override config tier)
27
27
  - Flag: `--force` (proceed even if previous research exists)
28
28
 
29
- ## 2. Validate feature
29
+ ## 1b. Resolve model
30
30
 
31
- Read `{folder}/{feature-slug}/REQUEST.md`. If it doesn't exist, error:
32
- ```
33
- Feature not found: {folder}/{feature-slug}/REQUEST.md
34
- Run /rpi:new {feature-slug} first.
35
- ```
31
+ Resolve the model for the `research` phase following the Model Resolution Algorithm in the rpi-workflow skill. Store as `{resolved_model}`. If a model is resolved, output the status message before agent spawns.
32
+
33
+ ## 2. Resolve feature path
34
+
35
+ Parse `{feature-slug}` from arguments.
36
+
37
+ **Resolution order:**
38
+ 1. Check if `{folder}/{feature-slug}/` exists → type = "feature", path = `{folder}/{feature-slug}`
39
+ 2. If not, Glob `{folder}/*/changes/{feature-slug}/` → if found, type = "change", path = matched path, parent_path = parent directory
40
+ 3. If multiple matches in step 2 → AskUserQuestion listing all matches with full paths
41
+ 4. If no match → error: `Feature not found: {feature-slug}. Run /rpi:new {feature-slug} first.`
42
+
43
+ If `type == "change"`:
44
+ - Set `parent_path` to the parent feature directory
45
+ - Read parent artifacts for agent context:
46
+ - `{parent_path}/REQUEST.md`
47
+ - `{parent_path}/research/RESEARCH.md` (if exists)
48
+ - `{parent_path}/plan/PLAN.md` (if exists)
49
+ - `{parent_path}/plan/eng.md` (if exists)
36
50
 
37
- If `{folder}/{feature-slug}/research/RESEARCH.md` already exists and `--force` not set, ask user:
51
+ Validate that `{path}/REQUEST.md` exists. If not, error.
52
+
53
+ If `{path}/research/RESEARCH.md` already exists and `--force` not set, ask user:
38
54
  "Research already exists for this feature. Overwrite?"
39
55
 
40
56
  ## 3. Determine agent composition by tier
@@ -59,7 +75,7 @@ If `{folder}/{feature-slug}/research/RESEARCH.md` already exists and `--force` n
59
75
 
60
76
  ## 4. Launch research agents in parallel
61
77
 
62
- Use the Agent tool to launch ALL selected agents concurrently in a single message.
78
+ Use the Agent tool to launch ALL selected agents concurrently in a single message. If a model was resolved in Step 1b, include `model: "{resolved_model}"` in each Agent tool call.
63
79
 
64
80
  Each agent receives this prompt:
65
81
  ```
@@ -87,9 +103,21 @@ Follow your role-specific rules as defined in the rpi-agents skill.
87
103
 
88
104
  For explore-codebase agent, also instruct it to scan the project codebase for relevant files, patterns, and conventions.
89
105
 
106
+ If `type == "change"`, append to each agent prompt:
107
+
108
+ ```
109
+ ## Parent Feature Context
110
+ {contents of parent artifacts read in step 2}
111
+
112
+ This is a CHANGE to an existing feature. Focus on:
113
+ - What's different from the parent implementation
114
+ - Compatibility with existing code
115
+ - Breaking changes to watch for
116
+ ```
117
+
90
118
  ## 5. Synthesize into RESEARCH.md
91
119
 
92
- After all agents complete, use the Agent tool to launch the doc-synthesizer agent.
120
+ After all agents complete, use the Agent tool to launch the doc-synthesizer agent. If a model was resolved, include `model: "{resolved_model}"` in the Agent tool call.
93
121
 
94
122
  Prompt:
95
123
  ```
@@ -17,13 +17,26 @@ Review the implementation against the plan. Check completeness, correctness, and
17
17
 
18
18
  <process>
19
19
 
20
- ## 1. Load config and validate
20
+ ## 1. Load config and resolve feature path
21
21
 
22
- Read `.rpi.yaml` for folder path.
23
- Validate that all required files exist:
24
- - `{folder}/{feature-slug}/plan/PLAN.md`
25
- - `{folder}/{feature-slug}/plan/eng.md`
26
- - `{folder}/{feature-slug}/implement/IMPLEMENT.md`
22
+ Read `.rpi.yaml` for folder path. Also read `profile` and `models` keys.
23
+
24
+ Parse `{feature-slug}` from arguments.
25
+
26
+ **Resolution order:**
27
+ 1. Check if `{folder}/{feature-slug}/` exists → type = "feature", path = `{folder}/{feature-slug}`
28
+ 2. If not, Glob `{folder}/*/changes/{feature-slug}/` → if found, type = "change", path = matched path, parent_path = parent directory
29
+ 3. If multiple matches → AskUserQuestion listing all matches with full paths
30
+ 4. If no match → error: `Feature not found: {feature-slug}`
31
+
32
+ If `type == "change"`:
33
+ - Set `parent_path` to the parent feature directory
34
+ - Read parent artifacts for agent context
35
+
36
+ Validate that required files exist:
37
+ - `{path}/plan/PLAN.md`
38
+ - `{path}/plan/eng.md`
39
+ - `{path}/implement/IMPLEMENT.md`
27
40
 
28
41
  If any missing, error with guidance on which command to run.
29
42
 
@@ -38,8 +51,14 @@ Read all plan and implementation files:
38
51
  - ux.md (if exists — UX requirements)
39
52
  - IMPLEMENT.md (implementation record)
40
53
 
54
+ ## 2b. Resolve model
55
+
56
+ Resolve the model for the `review` phase following the Model Resolution Algorithm in the rpi-workflow skill. Store as `{resolved_model}`. If a model is resolved, output the status message before agent spawns.
57
+
41
58
  ## 3. Launch code-reviewer agent
42
59
 
60
+ If a model was resolved in Step 2b, include `model: "{resolved_model}"` in the Agent tool call.
61
+
43
62
  ```
44
63
  You are the code-reviewer agent for the RPI workflow.
45
64
 
@@ -54,6 +73,15 @@ Read these files for the complete feature context:
54
73
 
55
74
  Then review the actual code changes. Use Grep and Glob to find the files listed in the plan and verify the implementation.
56
75
 
76
+ If `type == "change"`, also read parent feature files for context:
77
+ - {parent_path}/REQUEST.md
78
+ - {parent_path}/research/RESEARCH.md (if exists)
79
+ - {parent_path}/plan/eng.md (if exists)
80
+
81
+ This is a CHANGE to an existing feature. Additionally check:
82
+ - Compatibility with parent feature's existing implementation
83
+ - Whether breaking changes listed in the change REQUEST.md are properly handled
84
+
57
85
  Your review must check:
58
86
 
59
87
  ### 1. Completeness
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: rpi:set-profile
3
+ description: Switch the active model profile. Controls which AI model runs each workflow phase (research, plan, implement, review).
4
+ argument-hint: "[quality-first|balanced|speed-first|budget]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - AskUserQuestion
9
+ ---
10
+
11
+ <objective>
12
+ Display the current model profile and phase-model mapping, or switch to a new profile. Persists the selection in `.rpi.yaml`.
13
+ </objective>
14
+
15
+ <process>
16
+
17
+ ## 1. Load current config
18
+
19
+ Read `.rpi.yaml` from the project root. If it doesn't exist:
20
+ ```
21
+ No RPI config found. Run /rpi:init first.
22
+ ```
23
+
24
+ Extract `profile` and `models` keys (both may be absent).
25
+
26
+ ## 2. Parse arguments
27
+
28
+ Parse `$ARGUMENTS`:
29
+ - If empty: display current profile (step 3), then ask if user wants to switch (step 4)
30
+ - If argument provided: validate and switch to that profile (step 5)
31
+
32
+ ## 3. Display current profile
33
+
34
+ Resolve the effective model for each phase using the Model Resolution Algorithm defined in the rpi-workflow skill.
35
+
36
+ Output:
37
+ ```
38
+ Current profile: {profile_name or "none (inheriting parent model)"}
39
+
40
+ Phase mappings:
41
+ research: {resolved_model or "inherit"}
42
+ plan: {resolved_model or "inherit"}
43
+ implement: {resolved_model or "inherit"}
44
+ review: {resolved_model or "inherit"}
45
+ ```
46
+
47
+ If any per-phase overrides exist in `models:` block:
48
+ ```
49
+ Per-phase overrides active: {list overridden phases}
50
+ (Overrides take precedence over the profile. Edit .rpi.yaml to change.)
51
+ ```
52
+
53
+ ## 4. Ask to switch (only if no argument)
54
+
55
+ Use AskUserQuestion:
56
+ "Switch to a different profile?"
57
+
58
+ Options:
59
+ - `quality-first` -- opus for all phases (maximum quality)
60
+ - `balanced` -- opus for research/plan/review, sonnet for implement (recommended)
61
+ - `speed-first` -- sonnet for all phases (fastest)
62
+ - `budget` -- haiku for research/implement, sonnet for plan/review (cheapest, may reduce research quality)
63
+ - `none` -- inherit parent model (current behavior)
64
+ - "Keep current" -- no change
65
+
66
+ If "Keep current", output "No changes made." and stop.
67
+
68
+ If switching to `budget`, display warning:
69
+ ```
70
+ Note: The budget profile uses haiku for research and implement phases.
71
+ Haiku may produce lower-quality research outputs for complex features.
72
+ RPI research agents have strict requirements (evidence-backed verdicts,
73
+ structured analysis). Consider using --deep tier sparingly with this profile.
74
+ ```
75
+
76
+ ## 5. Validate profile name
77
+
78
+ Check that the provided profile name is one of: `quality-first`, `balanced`, `speed-first`, `budget`, `none`.
79
+
80
+ If invalid:
81
+ ```
82
+ Unknown profile: "{input}"
83
+
84
+ Valid profiles: quality-first, balanced, speed-first, budget, none
85
+
86
+ Usage: /rpi:set-profile [profile-name]
87
+ Run /rpi:set-profile with no arguments to see current profile and select interactively.
88
+ ```
89
+
90
+ Stop. Do not modify config.
91
+
92
+ ## 6. Persist to .rpi.yaml
93
+
94
+ Read the current `.rpi.yaml` content. Update the `profile` key:
95
+ - If `profile:` line exists: replace the value
96
+ - If `profile:` line does not exist: add it after the last existing config key, before any comments at the end
97
+ - If selected profile is `none`: remove the `profile:` line (or set to empty)
98
+
99
+ Do NOT modify the `models:` block. Per-phase overrides are preserved as-is.
100
+
101
+ Write the updated `.rpi.yaml`.
102
+
103
+ ## 7. Confirm
104
+
105
+ Display the new effective mapping:
106
+ ```
107
+ Profile switched to: {profile_name}
108
+
109
+ Phase mappings:
110
+ research: {model}
111
+ plan: {model}
112
+ implement: {model}
113
+ review: {model}
114
+ ```
115
+
116
+ If `models:` overrides exist:
117
+ ```
118
+ Note: Per-phase overrides in .rpi.yaml take precedence over the profile.
119
+ Overridden phases: {list}
120
+ ```
121
+
122
+ Tip: Edit .rpi.yaml to customize individual phases.
123
+
124
+ </process>
@@ -18,10 +18,19 @@ Run 3 parallel code review sub-agents (reuse, quality, efficiency) on the implem
18
18
 
19
19
  <process>
20
20
 
21
- ## 1. Load config and identify changes
21
+ ## 1. Load config, resolve path, and identify changes
22
22
 
23
- Read `.rpi.yaml` for folder path.
24
- Read `{folder}/{feature-slug}/implement/IMPLEMENT.md` to identify what was implemented.
23
+ Read `.rpi.yaml` for folder path. Also read `profile` and `models` keys.
24
+
25
+ Parse `{feature-slug}` from arguments.
26
+
27
+ **Resolution order:**
28
+ 1. Check if `{folder}/{feature-slug}/` exists → type = "feature", path = `{folder}/{feature-slug}`
29
+ 2. If not, Glob `{folder}/*/changes/{feature-slug}/` → if found, type = "change", path = matched path, parent_path = parent directory
30
+ 3. If multiple matches → AskUserQuestion listing all matches with full paths
31
+ 4. If no match → error: `Feature not found: {feature-slug}`
32
+
33
+ Read `{path}/implement/IMPLEMENT.md` to identify what was implemented.
25
34
 
26
35
  Get the diff of all implementation changes:
27
36
  ```bash
@@ -30,9 +39,13 @@ git diff HEAD~{number_of_commits}
30
39
 
31
40
  If no git history, use the files listed in IMPLEMENT.md tasks and read them directly.
32
41
 
42
+ ## 1b. Resolve model
43
+
44
+ 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 before agent spawns.
45
+
33
46
  ## 2. Launch 3 parallel sub-agents
34
47
 
35
- Use the Agent tool to launch all 3 concurrently in a single message.
48
+ Use the Agent tool to launch all 3 concurrently in a single message. If a model was resolved in Step 1b, include `model: "{resolved_model}"` in each Agent tool call.
36
49
 
37
50
  ### Agent 1: Reuse Checker
38
51
 
@@ -16,18 +16,31 @@ Display detailed status cards for all features (or a specific feature) in the RP
16
16
 
17
17
  ## 1. Load config
18
18
 
19
- Read `.rpi.yaml` for folder path. Default to `rpi/` if not found.
19
+ Read `.rpi.yaml` for folder path. Default to `rpi/` if not found. Also read `profile` and `models` keys.
20
20
 
21
- ## 2. Discover features
21
+ ## 2. Discover features and changes
22
22
 
23
- Use Glob to find all `REQUEST.md` files:
23
+ Use Glob to find all top-level `REQUEST.md` files:
24
24
  ```
25
25
  {folder}/*/REQUEST.md
26
26
  ```
27
27
 
28
28
  Each parent directory is a feature slug.
29
29
 
30
- If `$ARGUMENTS` specifies a feature slug, filter to that feature only.
30
+ Also find all change `REQUEST.md` files:
31
+ ```
32
+ {folder}/*/changes/*/REQUEST.md
33
+ ```
34
+
35
+ Parse each match to extract parent_slug and change_slug.
36
+
37
+ If `$ARGUMENTS` specifies a slug:
38
+ 1. Check if it matches a top-level feature → show that feature and its changes
39
+ 2. If not, check if it matches a change slug → show just that change (with parent context)
40
+ 3. Resolution follows the shared Resolve Feature Path logic:
41
+ - Check `{folder}/{slug}/` exists → type = "feature"
42
+ - Glob `{folder}/*/changes/{slug}/` → type = "change"
43
+ - Multiple matches → AskUserQuestion
31
44
 
32
45
  If no features found:
33
46
  ```
@@ -44,6 +57,9 @@ For each feature slug, check which files exist:
44
57
  - `plan/PLAN.md` exists, no `implement/IMPLEMENT.md` → Phase: **planned**
45
58
  - `implement/IMPLEMENT.md` exists → Phase: **implementing** or **complete**
46
59
 
60
+ For each change, determine phase using the same logic as features,
61
+ but looking in `{folder}/{parent_slug}/changes/{change_slug}/` instead.
62
+
47
63
  ## 4. Gather details per feature
48
64
 
49
65
  For each feature, read the relevant files to extract:
@@ -70,7 +86,12 @@ For each feature, read the relevant files to extract:
70
86
 
71
87
  ## 5. Display detailed cards
72
88
 
73
- Output a card per feature:
89
+ First, display the active profile at the top of the output. Resolve the effective model for each phase using the Model Resolution Algorithm in the rpi-workflow skill:
90
+ - With profile: `Profile: {profile} (research: {model}, plan: {model}, implement: {model}, review: {model})`
91
+ - With overrides, mark overridden phases with `*`: `Profile: balanced (research: opus, plan: opus, implement: opus*, review: opus)`
92
+ - No profile: `Profile: none (inheriting parent model)`
93
+
94
+ Then output a card per feature:
74
95
 
75
96
  ```markdown
76
97
  ## {feature-slug}
@@ -89,6 +110,8 @@ Verdict: {GO|GO with concerns|NO-GO|—}
89
110
  ```markdown
90
111
  # RPI Status
91
112
 
113
+ Profile: balanced (research: opus, plan: opus, implement: sonnet, review: opus)
114
+
92
115
  ## oauth2-auth
93
116
  Phase: implement (6/9 tasks)
94
117
  Verdict: GO
@@ -96,6 +119,8 @@ Complexity: M
96
119
  Tier: 2 (context weight: 14.5)
97
120
  Sessions: 2
98
121
  Current: Task 2.1 — Login component
122
+ └─ add-social-login [research: GO]
123
+ └─ fix-token-refresh [new]
99
124
 
100
125
  ## payment-system
101
126
  Phase: research
@@ -112,6 +137,9 @@ Phase: new
112
137
  Verdict: —
113
138
  ```
114
139
 
140
+ Changes are displayed indented under their parent feature with `└─` prefix.
141
+ Each change shows its own phase status using the same rules as features.
142
+
115
143
  ## 6. Suggest next action
116
144
 
117
145
  For each feature, suggest the logical next command:
@@ -21,7 +21,7 @@ Execute strict TDD cycles (RED → GREEN → REFACTOR) for tasks in a feature's
21
21
 
22
22
  ## 1. Load config and parse arguments
23
23
 
24
- Read `.rpi.yaml` for configuration (folder, test_runner).
24
+ Read `.rpi.yaml` for configuration (folder, test_runner). Also read `profile` and `models` keys.
25
25
  Parse `$ARGUMENTS`:
26
26
  - First argument: `{feature-slug}` (required)
27
27
  - `--task <id>`: run TDD for a specific task (e.g., `1.2`)
@@ -29,6 +29,10 @@ Parse `$ARGUMENTS`:
29
29
 
30
30
  If no `--task` or `--all`, ask the user which task to work on.
31
31
 
32
+ ## 1b. Resolve model
33
+
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 before agent spawns.
35
+
32
36
  ## 2. Validate prerequisites
33
37
 
34
38
  Read `{folder}/{feature-slug}/plan/PLAN.md`. If missing:
@@ -53,7 +57,7 @@ If no test infrastructure found, ask the user:
53
57
 
54
58
  ### Phase RED: Write failing test
55
59
 
56
- Launch test-engineer agent:
60
+ Launch test-engineer agent. If a model was resolved in Step 1b, include `model: "{resolved_model}"` in the Agent tool call.
57
61
  ```
58
62
  You are the test-engineer agent for the RPI workflow.
59
63
 
@@ -103,7 +107,7 @@ RED: Test fails correctly.
103
107
 
104
108
  ### Phase GREEN: Minimal implementation
105
109
 
106
- Launch plan-executor agent:
110
+ Launch plan-executor agent. If a model was resolved, include `model: "{resolved_model}"` in the Agent tool call.
107
111
  ```
108
112
  You are implementing a single task using TDD.
109
113
 
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "rpi-kit",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Research → Plan → Implement. A systematic feature development workflow for Claude Code.",
5
5
  "license": "MIT",
6
6
  "author": "Daniel Mendes",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/dmend3z/rpi-kit.git"
9
+ "url": "git+https://github.com/dmend3z/rpi-kit.git"
10
10
  },
11
11
  "keywords": [
12
12
  "claude-code",
@@ -19,7 +19,7 @@
19
19
  "agents"
20
20
  ],
21
21
  "bin": {
22
- "rpi-kit": "./bin/cli.js"
22
+ "rpi-kit": "bin/cli.js"
23
23
  },
24
24
  "files": [
25
25
  ".claude-plugin/",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: rpi-workflow
3
- description: This skill should be used when the user wants to develop a feature systematically, asks "how do I start a new feature", "walk me through the workflow", "help me build this step by step", says "research plan implement", mentions TDD or test-driven development, or mentions any RPI command (/rpi:init, /rpi:new, /rpi:research, /rpi:plan, /rpi:implement, /rpi:test, /rpi:simplify, /rpi:status, /rpi:review, /rpi:docs, /rpi:add-todo).
3
+ description: This skill should be used when the user wants to develop a feature systematically, asks "how do I start a new feature", "walk me through the workflow", "help me build this step by step", says "research plan implement", mentions TDD or test-driven development, mentions model profiles or model selection, or mentions any RPI command (/rpi:init, /rpi:new, /rpi:research, /rpi:plan, /rpi:implement, /rpi:test, /rpi:simplify, /rpi:status, /rpi:review, /rpi:docs, /rpi:add-todo, /rpi:set-profile).
4
4
  version: 0.2.0
5
5
  license: MIT
6
6
  ---
@@ -122,8 +122,70 @@ tdd: false # Enable Test-Driven Development
122
122
  test_runner: auto # Test command (auto-detect or explicit)
123
123
  session_isolation: auto # auto | aggressive | off
124
124
  max_tasks_per_session: 5 # tasks before warning/checkpoint
125
+ profile: balanced # quality-first | balanced | speed-first | budget (optional)
126
+ models: # Per-phase overrides (optional, takes precedence over profile)
127
+ # research: opus
128
+ # plan: opus
129
+ # implement: sonnet
130
+ # review: opus
125
131
  ```
126
132
 
133
+ ## Model Resolution Algorithm
134
+
135
+ When a command spawns an agent, it resolves which model to use for the Agent tool's `model` parameter. The algorithm is:
136
+
137
+ ### Resolution Order
138
+
139
+ 1. **Per-phase override**: If `.rpi.yaml` has a `models.{phase}` value, use it.
140
+ 2. **Profile default**: If `.rpi.yaml` has a `profile` value, look up the model for this phase in the profile table below.
141
+ 3. **Inherit parent**: If neither is set, omit the `model` parameter entirely. The agent inherits the parent session's model (current default behavior).
142
+
143
+ ### Profile Lookup Table
144
+
145
+ | Profile | research | plan | implement | review |
146
+ |---------|----------|------|-----------|--------|
147
+ | `quality-first` | opus | opus | opus | opus |
148
+ | `balanced` | opus | opus | sonnet | opus |
149
+ | `speed-first` | sonnet | sonnet | sonnet | sonnet |
150
+ | `budget` | haiku | sonnet | haiku | sonnet |
151
+
152
+ Note: The budget profile uses haiku for research and implement phases.
153
+ Research quality may degrade with haiku -- research agents require structured
154
+ analysis with citations and evidence. Recommended for small or simple features only.
155
+
156
+ ### Phase-to-Command Mapping
157
+
158
+ | Phase | Commands |
159
+ |-------|----------|
160
+ | `research` | `/rpi:research` |
161
+ | `plan` | `/rpi:plan` |
162
+ | `implement` | `/rpi:implement`, `/rpi:test`, `/rpi:simplify` |
163
+ | `review` | `/rpi:review`, `/rpi:docs` |
164
+
165
+ Commands without a phase (`/rpi:init`, `/rpi:new`, `/rpi:status`, `/rpi:add-todo`, `/rpi:onboarding`, `/rpi:set-profile`) do not use model resolution. `/rpi:onboarding` spawns agents but always inherits the parent model -- it is not a workflow phase.
166
+
167
+ ### Validation
168
+
169
+ Valid model names: `opus`, `sonnet`, `haiku`.
170
+
171
+ If a `models.{phase}` value or a `profile` value in `.rpi.yaml` is invalid:
172
+ - Log a warning: `Warning: Invalid model "{value}" for {phase} phase. Falling back to parent model.`
173
+ - Omit the `model` parameter (inherit parent model).
174
+ - Do NOT stop execution.
175
+
176
+ If `profile` is set to an unrecognized name:
177
+ - Log a warning: `Warning: Unknown profile "{value}". Valid profiles: quality-first, balanced, speed-first, budget. Falling back to parent model.`
178
+ - Treat all phases as "inherit parent".
179
+
180
+ ### Status Messages
181
+
182
+ When a model is resolved (not inherited), the command outputs once before spawning agents:
183
+ ```
184
+ Profile: {profile} | {phase} phase -> {model}
185
+ ```
186
+
187
+ When inheriting the parent model (no profile, no override), output nothing extra -- this preserves current behavior silently.
188
+
127
189
  ## Feature Folder Structure
128
190
 
129
191
  ```