@juicesharp/rpiv-pi 0.4.5 → 0.5.1

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.
@@ -0,0 +1,3 @@
1
+ export const FLAG_DEBUG = "rpiv-debug";
2
+ export const MSG_TYPE_GIT_CONTEXT = "rpiv-git-context";
3
+ export const MSG_TYPE_GUIDANCE = "rpiv-guidance";
@@ -22,6 +22,7 @@
22
22
  import { existsSync, readFileSync } from "node:fs";
23
23
  import { dirname, relative, sep, isAbsolute, join } from "node:path";
24
24
  import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
25
+ import { FLAG_DEBUG, MSG_TYPE_GUIDANCE } from "./constants.js";
25
26
 
26
27
  // ---------------------------------------------------------------------------
27
28
  // Guidance Resolution
@@ -145,9 +146,9 @@ export function injectRootGuidance(cwd: string, pi: ExtensionAPI): void {
145
146
  kind: "architecture",
146
147
  });
147
148
  pi.sendMessage({
148
- customType: "rpiv-guidance",
149
+ customType: MSG_TYPE_GUIDANCE,
149
150
  content: `## Project Guidance: ${label}\n\n${content}`,
150
- display: false,
151
+ display: !!pi.getFlag(FLAG_DEBUG),
151
152
  });
152
153
  }
153
154
 
@@ -185,9 +186,9 @@ export function handleToolCallGuidance(
185
186
  );
186
187
 
187
188
  pi.sendMessage({
188
- customType: "rpiv-guidance",
189
+ customType: MSG_TYPE_GUIDANCE,
189
190
  content: contextParts.join("\n\n---\n\n"),
190
- display: false,
191
+ display: !!pi.getFlag(FLAG_DEBUG),
191
192
  });
192
193
  }
193
194
 
@@ -8,11 +8,17 @@
8
8
  */
9
9
 
10
10
  import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
11
+ import { FLAG_DEBUG } from "./constants.js";
11
12
  import { registerSessionHooks } from "./session-hooks.js";
12
13
  import { registerSetupCommand } from "./setup-command.js";
13
14
  import { registerUpdateAgentsCommand } from "./update-agents-command.js";
14
15
 
15
16
  export default function (pi: ExtensionAPI) {
17
+ pi.registerFlag(FLAG_DEBUG, {
18
+ description: "Show injected guidance and git-context messages",
19
+ type: "boolean",
20
+ default: false,
21
+ });
16
22
  registerSessionHooks(pi);
17
23
  registerUpdateAgentsCommand(pi);
18
24
  registerSetupCommand(pi);
@@ -16,6 +16,7 @@ import {
16
16
  takeGitContextIfChanged,
17
17
  } from "./git-context.js";
18
18
  import { syncBundledAgents, type SyncResult } from "./agents.js";
19
+ import { FLAG_DEBUG, MSG_TYPE_GIT_CONTEXT } from "./constants.js";
19
20
  import { findMissingSiblings } from "./package-checks.js";
20
21
 
21
22
  const THOUGHTS_DIRS = [
@@ -40,7 +41,7 @@ export function registerSessionHooks(pi: ExtensionAPI): void {
40
41
  injectRootGuidance(ctx.cwd, pi);
41
42
  scaffoldThoughtsDirs(ctx.cwd);
42
43
  await injectGitContext(pi, (msg) =>
43
- pi.sendMessage({ customType: "rpiv-git-context", content: msg, display: false }),
44
+ pi.sendMessage({ customType: MSG_TYPE_GIT_CONTEXT, content: msg, display: !!pi.getFlag(FLAG_DEBUG) }),
44
45
  );
45
46
  const agents = syncBundledAgents(ctx.cwd, false);
46
47
  if (ctx.hasUI) {
@@ -55,7 +56,7 @@ export function registerSessionHooks(pi: ExtensionAPI): void {
55
56
  resetInjectedMarker();
56
57
  injectRootGuidance(ctx.cwd, pi);
57
58
  await injectGitContext(pi, (msg) =>
58
- pi.sendMessage({ customType: "rpiv-git-context", content: msg, display: false }),
59
+ pi.sendMessage({ customType: MSG_TYPE_GIT_CONTEXT, content: msg, display: !!pi.getFlag(FLAG_DEBUG) }),
59
60
  );
60
61
  });
61
62
 
@@ -75,7 +76,7 @@ export function registerSessionHooks(pi: ExtensionAPI): void {
75
76
  pi.on("before_agent_start", async () => {
76
77
  const content = await takeGitContextIfChanged(pi);
77
78
  if (!content) return;
78
- return { message: { customType: "rpiv-git-context", content, display: false } };
79
+ return { message: { customType: MSG_TYPE_GIT_CONTEXT, content, display: !!pi.getFlag(FLAG_DEBUG) } };
79
80
  });
80
81
  }
81
82
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juicesharp/rpiv-pi",
3
- "version": "0.4.5",
3
+ "version": "0.5.1",
4
4
  "description": "Skill-based development workflow for Pi Agent — discover, research, design, plan, implement, validate",
5
5
  "keywords": ["pi-package", "pi-extension", "rpiv", "skills", "workflow"],
6
6
  "license": "MIT",
@@ -22,240 +22,324 @@ I'll analyze the current codebase, generate solution options, and provide recomm
22
22
 
23
23
  Then wait for the user's request.
24
24
 
25
- ## Steps to follow after receiving the request:
26
-
27
- 1. **Read context files and understand the problem:**
28
- - If user mentions tickets, research docs, or other files, read them FULLY first
29
- - **IMPORTANT**: Use Read tool WITHOUT limit/offset parameters
30
- - **CRITICAL**: Read these files in main context before invoking skills
31
- - Extract requirements, constraints, and goals
32
- - Identify what problem we're solving
33
-
34
- 2. **Research current state and analyze requirements:**
35
- - **ALWAYS spawn fresh research** - Never rely on old research docs as truth
36
- - Old research can be read as historical context but validate against current code
37
- - Think deeply about requirements, constraints, and integration points
38
-
39
- **Spawn parallel research agents using the Agent tool:**
40
- - Use the **codebase-locator** agent to find relevant components
41
- - Use the **codebase-analyzer** agent to understand current implementation
42
- - Use the **codebase-pattern-finder** agent to find similar patterns
43
- - Use the **thoughts-locator** agent to find historical context in thoughts/
44
- - Optional: Use the **web-search-researcher** agent for web research only if user requests
45
-
46
- 3. **Generate and compare solution options:**
47
- - Wait for ALL agents to complete
48
- - Generate 2-4 viable approaches when possible
49
- - If only 1 clear option exists, explain why alternatives aren't viable
50
- - For each option, document:
51
- - How it works and precedent in codebase
52
- - Pros/cons with evidence
53
- - Complexity and integration points
54
- - Risk factors
55
- - Cross-reference agent findings
56
- - Compare options systematically
57
-
58
- 4. **Make recommendation:**
59
- - Choose best option based on requirements, codebase fit, and complexity
60
- - Provide clear rationale with evidence
61
- - Explain why alternatives were not chosen
62
- - Identify conditions that would change recommendation
63
-
64
- 5. **Determine metadata and filename:**
65
- - Filename format: `thoughts/shared/solutions/YYYY-MM-DD_HH-MM-SS_[topic].md`
66
- - YYYY-MM-DD_HH-MM-SS: Current date and time (e.g., 2025-10-11_14-30-22)
67
- - [topic]: Brief kebab-case description
68
- - Repository name: from git root basename, or current directory basename if not a git repo
69
- - Use the git branch and commit from the git context injected at the start of the session (or run `git branch --show-current` / `git rev-parse --short HEAD` directly)
70
- - Researcher: use the User from the git context injected at the start of the session (fallback: "unknown")
71
- - If metadata unavailable: use "unknown" for commit/branch
72
-
73
- 6. **Generate solutions document:**
74
- - Use the metadata gathered in step 5
75
- - Structure the document with YAML frontmatter followed by content:
76
- ```markdown
77
- ---
78
- date: [Current date and time with timezone in ISO format]
79
- researcher: [Researcher name]
80
- git_commit: [Current commit hash]
81
- branch: [Current branch name]
82
- repository: [Repository name]
83
- topic: "[Feature/Problem]"
84
- confidence: high | medium | low
85
- complexity: low | medium | high
86
- status: ready | awaiting_input | blocked
87
- tags: [solutions, component-names]
88
- last_updated: [Current date in YYYY-MM-DD format]
89
- last_updated_by: [Researcher name]
90
- ---
91
-
92
- # Solution Analysis: [Feature/Problem]
93
-
94
- **Date**: [Current date and time with timezone from step 5]
95
- **Researcher**: [Researcher name from step 5]
96
- **Git Commit**: [Current commit hash from step 5]
97
- **Branch**: [Current branch name from step 5]
98
- **Repository**: [Repository name]
99
-
100
- ## Research Question
101
- [Original user query]
102
-
103
- ## Summary
104
- **Problem**: [What we're solving]
105
- **Recommended**: [Option name] - [One sentence why]
106
- **Effort**: [Low/Med/High] ([N days])
107
- **Confidence**: [High/Med/Low]
108
-
109
- ## Problem Statement
110
-
111
- **Requirements:**
112
- - [Requirement 1]
113
- - [Requirement 2]
114
-
115
- **Constraints:**
116
- - [Hard constraint - must respect]
117
- - [Soft constraint - should consider]
118
-
119
- **Success criteria:**
120
- - [What "done" looks like]
121
-
122
- ## Current State
123
-
124
- **Existing implementation:**
125
- [What exists with file:line references]
126
-
127
- **Relevant patterns:**
128
- - [Pattern 1]: `file.ext:line` - Used in [N] places
129
- - [Pattern 2]: `file.ext:line` - Used in [N] places
130
-
131
- **Integration points:**
132
- - `file.ext:line` - [Where feature hooks in]
133
- - `file.ext:line` - [Another integration point]
134
-
135
- ## Solution Options
136
-
137
- ### Option 1: [Name]
138
- **How it works:**
139
- [2-3 sentence description + implementation approach]
140
-
141
- **Pros:**
142
- - [Advantage with evidence from codebase]
143
- - [Advantage with evidence]
144
-
145
- **Cons:**
146
- - [Disadvantage with impact]
147
-
148
- **Complexity:** [Low/Med/High] (~[N] days)
149
- - Files to create: [N] (~[X] lines)
150
- - Files to modify: [N] (~[X] lines)
151
- - Risk level: [Low/Med/High]
152
-
153
- ### Option 2: [Alternative Name]
154
- [Same structure as Option 1]
155
-
156
- ### Option 3: [Another Alternative]
157
- [Same structure as Option 1]
158
-
159
- ## Comparison
25
+ ## Steps
160
26
 
161
- | Criteria | Option 1 | Option 2 | Option 3 |
162
- |----------|----------|----------|----------|
163
- | Complexity | [L/M/H] | [L/M/H] | [L/M/H] |
164
- | Codebase fit | [H/M/L] | [H/M/L] | [H/M/L] |
165
- | Risk | [L/M/H] | [L/M/H] | [L/M/H] |
27
+ ### Step 1: Read Mentioned Files
166
28
 
167
- ## Recommendation
29
+ - If user mentions tickets, research docs, or other files, read them FULLY first
30
+ - **IMPORTANT**: Use Read tool WITHOUT limit/offset parameters
31
+ - **CRITICAL**: Read these files in main context before invoking skills
32
+ - Extract requirements, constraints, and goals
33
+ - Identify what problem we're solving
168
34
 
169
- **Selected:** [Option N]
35
+ ### Step 2: Generate Candidates and Dimensions
170
36
 
171
- **Rationale:**
172
- - [Key reason with evidence]
173
- - [Key reason with evidence]
174
- - ...
37
+ **Generate 2–4 named candidates** from three sources, then merge into one shortlist:
175
38
 
176
- **Why not alternatives:**
177
- - Option X: [Reason]
39
+ - **Ecosystem scan** — spawn `web-search-researcher` for any topic where the candidate space includes external libraries, frameworks, or services. Prompt it to return 2–4 named options with one-line "what it is" + canonical doc link per option. Skip only when the topic is wholly internal (e.g., "how to organize this service layer") and the orchestrator's design-space enumeration plus the user shortlist already cover the space.
40
+ - **Design-space enumeration** — orchestrator names abstract shapes from first principles when applicable (pub/sub vs direct-call vs event-bus; sync vs async; manual mapping vs auto-mapper). One-line "what it is" per shape.
41
+ - **User shortlist** — if the user pre-named candidates in the entry prompt ("compare TanStack Query vs SWR"), include those verbatim.
178
42
 
179
- **Trade-offs:**
180
- - Accepting [limitation] for [benefit]
43
+ Merge to 2–4 candidates total. Name each with a short noun phrase ("TanStack Query", "Direct event bus"). Deduplicate.
181
44
 
182
- **Implementation approach:**
183
- 1. [Phase 1] - [What to build]
184
- 2. ...
45
+ **Default dimension list** (presented at Step 3; developer may drop irrelevant ones):
185
46
 
186
- **Integration points:**
187
- - `file.ext:line` - [Specific change]
188
- - `file.ext:line` - [Specific change]
47
+ - **approach-shape** (hybrid) — what category of solution the candidate is, what core moving parts it requires.
48
+ - **precedent-fit** (codebase-anchored) does the existing code already use this pattern; how many call sites would adopt the new option.
49
+ - **integration-risk** (codebase-anchored) which existing seams the candidate would touch; what breaks if it lands.
50
+ - **migration-cost** (external-anchored for libraries; codebase-anchored for in-house code) — work to introduce the candidate plus work to remove the incumbent if there is one.
51
+ - **verification-cost** (codebase-anchored) — test/CI surface needed to make the candidate safe to adopt.
52
+ - **novelty** (external-anchored) — how recently the candidate emerged, ecosystem momentum, deprecation risk.
189
53
 
190
- **Patterns to follow:**
191
- - [Pattern]: `file.ext:line`
54
+ Hold the candidate set and default dimension list in working state for the Step 3 checkpoint. Do not dispatch fit agents yet.
192
55
 
193
- **Risks:**
194
- - [Risk]: [Mitigation]
56
+ ### Step 3: Candidate Checkpoint
195
57
 
196
- ## Scope Boundaries
197
- - [What we're building]
198
- - [What we're NOT doing]
58
+ Present the candidate set and default dimensions to the developer before per-candidate fit dispatch.
199
59
 
200
- ## Testing Strategy
60
+ 1. **Show candidates and dimensions:**
201
61
 
202
- **Unit tests:**
203
- - [Key test scenario 1]
204
- - ...
62
+ ```
63
+ ## Candidates for: [Topic]
205
64
 
206
- **Integration tests:**
207
- - [End-to-end scenario 1]
208
- - ...
65
+ 1. [Candidate A] — [one-line what it is]
66
+ 2. [Candidate B] — [one-line what it is]
67
+ ...
209
68
 
210
- **Manual verification:**
211
- - [ ] [Manual test 1]
212
- - [ ] ...
69
+ Dimensions (default 6; drop any that don't apply):
70
+ - approach-shape · precedent-fit · integration-risk
71
+ - migration-cost · verification-cost · novelty
72
+ ```
213
73
 
214
- ## Open Questions
215
- **Resolved during research:**
216
- - [Question that was answered] - [Answer with evidence from file:line]
74
+ 2. **Confirm via the `ask_user_question` tool with the following question:** "[N] candidates, [D] dimensions. Begin per-candidate fit dispatch?". Header: "Candidates". Options: "Proceed (Recommended)" (Begin per-candidate fit dispatch with all [N] candidates and all [D] dimensions); "Adjust candidates or dimensions" (Rename, add, or drop candidates; drop dimensions that don't apply); "Re-generate candidates" (Candidates look wrong — re-run Step 2 with adjusted scope).
217
75
 
218
- **Requires user input:**
219
- - [Business or design question] - [Default assumption for planning]
76
+ 3. **Handle developer input:**
220
77
 
221
- **Blockers:**
222
- - [Critical unknown that prevents implementation] - [How to unblock]
78
+ **"Proceed"**: lock the candidate × dimension set; advance to Step 4.
223
79
 
224
- ## References
80
+ **"Adjust candidates or dimensions"**: ask the follow-up free-text question with prefix `❓ Question:` — "Which candidates and dimensions should be added, dropped, or renamed?" — apply edits to the working set, re-present, and confirm again with the same three-option `ask_user_question`.
225
81
 
226
- - `thoughts/shared/research/[file].md` - [Context]
227
- - `src/file.ext:line` - [Similar implementation]
228
- - `thoughts/shared/[file].md` - [Historical decision]
229
- ```
82
+ **"Re-generate candidates"**: ask the follow-up free-text question with prefix `❓ Question:` — "What should be different in candidate generation? (narrower/wider scope, different ecosystem, exclude approach X, …)" — return to Step 2 with the updated scope, then re-enter Step 3.
230
83
 
231
- 7. **Present findings:**
232
- - Present concise summary with clear recommendation
233
- - Highlight key integration points
234
- - Ask if they want to proceed to /skill:design with the chosen option or need clarification
84
+ Loop until "Proceed" is selected.
235
85
 
236
- 8. **Handle follow-up questions:**
237
- - If user has questions, append to same document
238
- - Update frontmatter: `last_updated` and `last_updated_by`
239
- - Add section: `## Follow-up Analysis [timestamp]`
240
- - Spawn additional agents as needed
86
+ ### Step 4: Per-Candidate Fit Dispatch (parallel agents)
87
+
88
+ For each confirmed candidate, dispatch up to two agents in parallel — total ≤ 2 × N agents:
89
+
90
+ - **One `codebase-analyzer` per candidate** — when ≥1 kept dimension is codebase-anchored (precedent-fit, integration-risk, often migration-cost and verification-cost). The agent scores the candidate on every kept codebase-anchored dimension in a single pass, returning evidence per dimension with `file:line` references.
91
+ - **One `web-search-researcher` per candidate** — when ≥1 kept dimension is external-anchored (novelty, often migration-cost for libraries, approach-shape for ecosystem options). The agent scores the candidate on every kept external-anchored dimension in a single pass, returning evidence per dimension with doc/source links.
92
+
93
+ Skip either agent for a candidate when no dimension of that anchor-type was kept. Hybrid dimension `approach-shape` is scored by the orchestrator after both agents return, by combining their per-candidate findings.
94
+
95
+ **Per-candidate prompt shape** (use the same outer template, fill in candidate name and kept dimensions):
96
+
97
+ ```
98
+ Candidate: [name] — [one-line what it is]
99
+ Topic: [topic from Step 1]
100
+
101
+ Score this single candidate on the following dimensions, each with concrete evidence ([file:line] for codebase, doc/source link for external). Report findings as one section per dimension.
102
+
103
+ Dimensions for this run:
104
+ - [dimension name] — [one-line of what to look for]
105
+ - ...
106
+
107
+ Do NOT compare against other candidates; another agent handles each one separately. Focus on depth of evidence for THIS candidate.
108
+ ```
109
+
110
+ Wait for ALL agents to complete before proceeding.
111
+
112
+ **Coverage check**: every (candidate × kept-dimension) cell is filled — by an agent's evidence or by an explicit `null` ("does not apply to this candidate"). Cells silently dropped indicate a missing dispatch — re-run that candidate's agent.
113
+
114
+ ### Step 5: Synthesize and Recommend
115
+
116
+ - Cross-reference per-candidate findings — fill the candidate × dimension grid with evidence per cell.
117
+ - Apply the fit filter qualitatively per candidate: a candidate "clears" when no kept dimension surfaces a blocking concern (integration-risk that breaks load-bearing seams, migration-cost that exceeds the topic's scope, verification-cost with no path to coverage).
118
+ - **If ≥1 candidate clears the fit filter**: pick the strongest, document rationale with evidence, and explain why alternatives weren't chosen. Identify conditions that would change the recommendation.
119
+ - **If every candidate fails the fit filter**: produce a "no-fit" recommendation — list each candidate's blocking dimension with evidence, recommend re-scoping the question or expanding the candidate pool, and set Step 7 frontmatter `confidence: low` and `status: blocked`.
120
+
121
+ ### Step 6: Determine Metadata and Filename
122
+
123
+ - Filename format: `thoughts/shared/solutions/YYYY-MM-DD_HH-MM-SS_[topic].md`
124
+ - YYYY-MM-DD_HH-MM-SS: Current date and time (e.g., 2025-10-11_14-30-22)
125
+ - [topic]: Brief kebab-case description
126
+ - Repository name: from git root basename, or current directory basename if not a git repo
127
+ - Use the git branch and commit from the git context injected at the start of the session (or run `git branch --show-current` / `git rev-parse --short HEAD` directly)
128
+ - Researcher: use the User from the git context injected at the start of the session (fallback: "unknown")
129
+ - If metadata unavailable: use "unknown" for commit/branch
130
+
131
+ ### Step 7: Generate Solutions Document
132
+
133
+ - Use the metadata gathered in step 6
134
+ - Structure the document with YAML frontmatter followed by content:
135
+
136
+ ```markdown
137
+ ---
138
+ date: [Current date and time with timezone in ISO format]
139
+ researcher: [Researcher name]
140
+ git_commit: [Current commit hash]
141
+ branch: [Current branch name]
142
+ repository: [Repository name]
143
+ topic: "[Feature/Problem]"
144
+ confidence: high | medium | low
145
+ complexity: low | medium | high
146
+ status: ready | awaiting_input | blocked
147
+ tags: [solutions, component-names]
148
+ last_updated: [Current date in YYYY-MM-DD format]
149
+ last_updated_by: [Researcher name]
150
+ ---
151
+
152
+ # Solution Analysis: [Feature/Problem]
153
+
154
+ **Date**: [Current date and time with timezone from step 6]
155
+ **Researcher**: [Researcher name from step 6]
156
+ **Git Commit**: [Current commit hash from step 6]
157
+ **Branch**: [Current branch name from step 6]
158
+ **Repository**: [Repository name]
159
+
160
+ ## Research Question
161
+ [Original user query]
162
+
163
+ ## Summary
164
+ **Problem**: [What we're solving]
165
+ **Recommended**: [Option name] - [One sentence why]
166
+ **Effort**: [Low/Med/High] ([N days])
167
+ **Confidence**: [High/Med/Low]
168
+
169
+ ## Problem Statement
170
+
171
+ **Requirements:**
172
+ - [Requirement 1]
173
+ - [Requirement 2]
174
+
175
+ **Constraints:**
176
+ - [Hard constraint - must respect]
177
+ - [Soft constraint - should consider]
178
+
179
+ **Success criteria:**
180
+ - [What "done" looks like]
181
+
182
+ ## Current State
183
+
184
+ **Existing implementation:**
185
+ [What exists with file:line references]
186
+
187
+ **Relevant patterns:**
188
+ - [Pattern 1]: `file.ext:line` - Used in [N] places
189
+ - [Pattern 2]: `file.ext:line` - Used in [N] places
190
+
191
+ **Integration points:**
192
+ - `file.ext:line` - [Where feature hooks in]
193
+ - `file.ext:line` - [Another integration point]
194
+
195
+ ## Solution Options
196
+
197
+ ### Option 1: [Name]
198
+ **How it works:**
199
+ [2-3 sentence description + implementation approach]
200
+
201
+ **Pros:**
202
+ - [Advantage with evidence from codebase]
203
+ - [Advantage with evidence]
204
+
205
+ **Cons:**
206
+ - [Disadvantage with impact]
207
+
208
+ **Complexity:** [Low/Med/High] (~[N] days)
209
+ - Files to create: [N] (~[X] lines)
210
+ - Files to modify: [N] (~[X] lines)
211
+ - Risk level: [Low/Med/High]
212
+
213
+ ### Option 2: [Alternative Name]
214
+ [Same structure as Option 1]
215
+
216
+ ### Option 3: [Another Alternative]
217
+ [Same structure as Option 1]
218
+
219
+ ## Comparison
220
+
221
+ | Criteria | Option 1 | Option 2 | Option 3 |
222
+ |----------|----------|----------|----------|
223
+ | Complexity | [L/M/H] | [L/M/H] | [L/M/H] |
224
+ | Codebase fit | [H/M/L] | [H/M/L] | [H/M/L] |
225
+ | Risk | [L/M/H] | [L/M/H] | [L/M/H] |
226
+
227
+ ## Recommendation
228
+
229
+ <!-- Render exactly ONE of the two blocks below, based on Step 5's fit-filter outcome. -->
230
+
231
+ **(A) When ≥1 candidate clears the fit filter:**
232
+
233
+ **Selected:** [Option N]
234
+
235
+ **Rationale:**
236
+ - [Key reason with evidence]
237
+ - [Key reason with evidence]
238
+ - ...
239
+
240
+ **Why not alternatives:**
241
+ - Option X: [Reason]
242
+
243
+ **Trade-offs:**
244
+ - Accepting [limitation] for [benefit]
245
+
246
+ **Implementation approach:**
247
+ 1. [Phase 1] - [What to build]
248
+ 2. ...
249
+
250
+ **Integration points:**
251
+ - `file.ext:line` - [Specific change]
252
+ - `file.ext:line` - [Specific change]
253
+
254
+ **Patterns to follow:**
255
+ - [Pattern]: `file.ext:line`
256
+
257
+ **Risks:**
258
+ - [Risk]: [Mitigation]
259
+
260
+ **(B) When every candidate fails the fit filter:**
261
+
262
+ **No-fit:** every candidate surfaced a blocking concern on at least one kept dimension.
263
+
264
+ **Per-candidate blockers:**
265
+ - [Option 1]: [blocking dimension] — [evidence with file:line or doc link]
266
+ - [Option 2]: [blocking dimension] — [evidence]
267
+ - ...
268
+
269
+ **Recommended next step:**
270
+ - [Re-scope the question] — [how the topic should narrow/widen so candidates can clear]
271
+ - OR [Expand the candidate pool] — [what new candidate sources to enumerate; e.g., named ecosystem option not surfaced by Step 2]
272
+
273
+ **Frontmatter overrides:** set `confidence: low` and `status: blocked`.
274
+
275
+ ## Scope Boundaries
276
+ - [What we're building]
277
+ - [What we're NOT doing]
278
+
279
+ ## Testing Strategy
280
+
281
+ **Unit tests:**
282
+ - [Key test scenario 1]
283
+ - ...
284
+
285
+ **Integration tests:**
286
+ - [End-to-end scenario 1]
287
+ - ...
288
+
289
+ **Manual verification:**
290
+ - [ ] [Manual test 1]
291
+ - [ ] ...
292
+
293
+ ## Open Questions
294
+ **Resolved during research:**
295
+ - [Question that was answered] - [Answer with evidence from file:line]
296
+
297
+ **Requires user input:**
298
+ - [Business or design question] - [Default assumption for planning]
299
+
300
+ **Blockers:**
301
+ - [Critical unknown that prevents implementation] - [How to unblock]
302
+
303
+ ## References
304
+
305
+ - `thoughts/shared/research/[file].md` - [Context]
306
+ - `src/file.ext:line` - [Similar implementation]
307
+ - `thoughts/shared/[file].md` - [Historical decision]
308
+ ```
309
+
310
+ ### Step 8: Present Findings
311
+
312
+ - Present concise summary with clear recommendation
313
+ - Highlight key integration points
314
+ - Ask if they want to proceed to /skill:design with the chosen option or need clarification
315
+
316
+ ### Step 9: Handle Follow-up Questions
317
+
318
+ - If user has questions, append to same document
319
+ - Update frontmatter: `last_updated` and `last_updated_by`
320
+ - Add section: `## Follow-up Analysis [timestamp]`
321
+ - Spawn additional agents as needed
322
+
323
+ ## Important Notes
241
324
 
242
- ## Important notes:
243
325
  - Always use parallel Agent tool calls to maximize efficiency and minimize context usage
244
326
  - Always spawn fresh research to validate current state - never rely on old research docs as source of truth
245
327
  - Old research documents can provide historical context but must be validated against current code
246
- - Focus on generating 2-4 viable solution options with specific file:line references
328
+ - Generate 2-4 named candidates in Step 2; confirm them with the developer at Step 3 before per-candidate fit dispatch
329
+ - Web-search-researcher is a first-class Step 2 agent for ecosystem candidate-source — skip only when the topic is wholly internal and design-space enumeration plus user shortlist cover the space
330
+ - Per-candidate fit dispatch caps at two agents per candidate (one codebase-analyzer, one web-search-researcher) — skip either when no dimension of its anchor-type was kept
247
331
  - Solutions documents should be self-contained with all necessary context
248
- - Each agent prompt should be specific and focused on targeted research questions
249
- - Quantify pattern precedent - count usage in codebase, don't just say "follows pattern"
332
+ - Each agent prompt should be specific and focused on a single candidate scored on the kept dimensions
333
+ - Quantify pattern precedent count usage in codebase, don't just say "follows pattern"
250
334
  - Ground complexity estimates in actual similar work from git history
251
- - Think like a software architect - you're setting up design for success by landing on one chosen approach with evidence
335
+ - Think like a software architect — option-shopping output is 2–4 comparable candidates plus an honest fit verdict
252
336
  - Keep the main agent focused on synthesis and comparison, not deep implementation details
253
337
  - Encourage agents to find existing patterns and examples, not just describe possibilities
254
- - Resolve technical unknowns during research - don't leave critical questions for design
338
+ - Resolve technical unknowns during research don't leave critical questions for design
255
339
  - **File reading**: Always read mentioned files FULLY (no limit/offset) before invoking skills
256
340
  - **Critical ordering**: Follow the numbered steps exactly
257
341
  - ALWAYS read mentioned files first before invoking skills (step 1)
258
- - ALWAYS spawn fresh research to validate current state (step 2)
259
- - ALWAYS wait for all agents to complete before synthesizing (step 3)
260
- - ALWAYS gather metadata before writing the document (step 5 before step 6)
342
+ - ALWAYS generate candidates and run the Step 3 checkpoint before per-candidate dispatch (steps 2 → 3 → 4)
343
+ - ALWAYS wait for all per-candidate agents to complete before synthesizing (step 4)
344
+ - ALWAYS gather metadata before writing the document (step 6 before step 7)
261
345
  - NEVER write the solutions document with placeholder values