@juicesharp/rpiv-pi 0.4.5 → 0.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.
|
@@ -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:
|
|
149
|
+
customType: MSG_TYPE_GUIDANCE,
|
|
149
150
|
content: `## Project Guidance: ${label}\n\n${content}`,
|
|
150
|
-
display:
|
|
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:
|
|
189
|
+
customType: MSG_TYPE_GUIDANCE,
|
|
189
190
|
content: contextParts.join("\n\n---\n\n"),
|
|
190
|
-
display:
|
|
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:
|
|
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:
|
|
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:
|
|
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.
|
|
3
|
+
"version": "0.5.0",
|
|
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",
|
package/skills/explore/SKILL.md
CHANGED
|
@@ -31,35 +31,91 @@ Then wait for the user's request.
|
|
|
31
31
|
- Extract requirements, constraints, and goals
|
|
32
32
|
- Identify what problem we're solving
|
|
33
33
|
|
|
34
|
-
2. **
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
**
|
|
40
|
-
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
34
|
+
2. **Generate candidates and dimensions:**
|
|
35
|
+
|
|
36
|
+
**Generate 2–4 named candidates** from three sources, then merge into one shortlist:
|
|
37
|
+
|
|
38
|
+
- **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.
|
|
39
|
+
- **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.
|
|
40
|
+
- **User shortlist** — if the user pre-named candidates in the entry prompt ("compare TanStack Query vs SWR"), include those verbatim.
|
|
41
|
+
|
|
42
|
+
Merge to 2–4 candidates total. Name each with a short noun phrase ("TanStack Query", "Direct event bus"). Deduplicate.
|
|
43
|
+
|
|
44
|
+
**Default dimension list** (presented at Step 2.5; developer may drop irrelevant ones):
|
|
45
|
+
|
|
46
|
+
- **approach-shape** (hybrid) — what category of solution the candidate is, what core moving parts it requires.
|
|
47
|
+
- **precedent-fit** (codebase-anchored) — does the existing code already use this pattern; how many call sites would adopt the new option.
|
|
48
|
+
- **integration-risk** (codebase-anchored) — which existing seams the candidate would touch; what breaks if it lands.
|
|
49
|
+
- **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.
|
|
50
|
+
- **verification-cost** (codebase-anchored) — test/CI surface needed to make the candidate safe to adopt.
|
|
51
|
+
- **novelty** (external-anchored) — how recently the candidate emerged, ecosystem momentum, deprecation risk.
|
|
52
|
+
|
|
53
|
+
Hold the candidate set and default dimension list in working state for the Step 2.5 checkpoint. Do not dispatch fit agents yet.
|
|
54
|
+
|
|
55
|
+
## Step 2.5: Candidate Checkpoint
|
|
56
|
+
|
|
57
|
+
Present the candidate set and default dimensions to the developer before per-candidate fit dispatch.
|
|
58
|
+
|
|
59
|
+
1. **Show candidates and dimensions:**
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
## Candidates for: [Topic]
|
|
63
|
+
|
|
64
|
+
1. [Candidate A] — [one-line what it is]
|
|
65
|
+
2. [Candidate B] — [one-line what it is]
|
|
66
|
+
...
|
|
67
|
+
|
|
68
|
+
Dimensions (default 6; drop any that don't apply):
|
|
69
|
+
- approach-shape · precedent-fit · integration-risk
|
|
70
|
+
- migration-cost · verification-cost · novelty
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
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).
|
|
74
|
+
|
|
75
|
+
3. **Handle developer input:**
|
|
76
|
+
|
|
77
|
+
**"Proceed"**: lock the candidate × dimension set; advance to Step 3.
|
|
78
|
+
|
|
79
|
+
**"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`.
|
|
80
|
+
|
|
81
|
+
**"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 2.5.
|
|
82
|
+
|
|
83
|
+
Loop until "Proceed" is selected.
|
|
84
|
+
|
|
85
|
+
3. **Per-candidate fit dispatch (parallel agents):**
|
|
86
|
+
|
|
87
|
+
For each confirmed candidate, dispatch up to two agents in parallel — total ≤ 2 × N agents:
|
|
88
|
+
|
|
89
|
+
- **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.
|
|
90
|
+
- **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.
|
|
91
|
+
|
|
92
|
+
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.
|
|
93
|
+
|
|
94
|
+
**Per-candidate prompt shape** (use the same outer template, fill in candidate name and kept dimensions):
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
Candidate: [name] — [one-line what it is]
|
|
98
|
+
Topic: [topic from Step 1]
|
|
99
|
+
|
|
100
|
+
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.
|
|
101
|
+
|
|
102
|
+
Dimensions for this run:
|
|
103
|
+
- [dimension name] — [one-line of what to look for]
|
|
104
|
+
- ...
|
|
105
|
+
|
|
106
|
+
Do NOT compare against other candidates; another agent handles each one separately. Focus on depth of evidence for THIS candidate.
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Wait for ALL agents to complete before proceeding.
|
|
110
|
+
|
|
111
|
+
**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.
|
|
112
|
+
|
|
113
|
+
4. **Synthesize and recommend:**
|
|
114
|
+
|
|
115
|
+
- Cross-reference per-candidate findings — fill the candidate × dimension grid with evidence per cell.
|
|
116
|
+
- 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).
|
|
117
|
+
- **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.
|
|
118
|
+
- **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 6 frontmatter `confidence: low` and `status: blocked`.
|
|
63
119
|
|
|
64
120
|
5. **Determine metadata and filename:**
|
|
65
121
|
- Filename format: `thoughts/shared/solutions/YYYY-MM-DD_HH-MM-SS_[topic].md`
|
|
@@ -166,6 +222,10 @@ Then wait for the user's request.
|
|
|
166
222
|
|
|
167
223
|
## Recommendation
|
|
168
224
|
|
|
225
|
+
<!-- Render exactly ONE of the two blocks below, based on Step 4's fit-filter outcome. -->
|
|
226
|
+
|
|
227
|
+
**(A) When ≥1 candidate clears the fit filter:**
|
|
228
|
+
|
|
169
229
|
**Selected:** [Option N]
|
|
170
230
|
|
|
171
231
|
**Rationale:**
|
|
@@ -193,6 +253,21 @@ Then wait for the user's request.
|
|
|
193
253
|
**Risks:**
|
|
194
254
|
- [Risk]: [Mitigation]
|
|
195
255
|
|
|
256
|
+
**(B) When every candidate fails the fit filter:**
|
|
257
|
+
|
|
258
|
+
**No-fit:** every candidate surfaced a blocking concern on at least one kept dimension.
|
|
259
|
+
|
|
260
|
+
**Per-candidate blockers:**
|
|
261
|
+
- [Option 1]: [blocking dimension] — [evidence with file:line or doc link]
|
|
262
|
+
- [Option 2]: [blocking dimension] — [evidence]
|
|
263
|
+
- ...
|
|
264
|
+
|
|
265
|
+
**Recommended next step:**
|
|
266
|
+
- [Re-scope the question] — [how the topic should narrow/widen so candidates can clear]
|
|
267
|
+
- OR [Expand the candidate pool] — [what new candidate sources to enumerate; e.g., named ecosystem option not surfaced by Step 2]
|
|
268
|
+
|
|
269
|
+
**Frontmatter overrides:** set `confidence: low` and `status: blocked`.
|
|
270
|
+
|
|
196
271
|
## Scope Boundaries
|
|
197
272
|
- [What we're building]
|
|
198
273
|
- [What we're NOT doing]
|
|
@@ -243,19 +318,21 @@ Then wait for the user's request.
|
|
|
243
318
|
- Always use parallel Agent tool calls to maximize efficiency and minimize context usage
|
|
244
319
|
- Always spawn fresh research to validate current state - never rely on old research docs as source of truth
|
|
245
320
|
- Old research documents can provide historical context but must be validated against current code
|
|
246
|
-
-
|
|
321
|
+
- Generate 2-4 named candidates in Step 2; confirm them with the developer at Step 2.5 before per-candidate fit dispatch
|
|
322
|
+
- 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
|
|
323
|
+
- 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
324
|
- Solutions documents should be self-contained with all necessary context
|
|
248
|
-
- Each agent prompt should be specific and focused on
|
|
249
|
-
- Quantify pattern precedent
|
|
325
|
+
- Each agent prompt should be specific and focused on a single candidate scored on the kept dimensions
|
|
326
|
+
- Quantify pattern precedent — count usage in codebase, don't just say "follows pattern"
|
|
250
327
|
- Ground complexity estimates in actual similar work from git history
|
|
251
|
-
- Think like a software architect -
|
|
328
|
+
- Think like a software architect — option-shopping output is 2–4 comparable candidates plus an honest fit verdict
|
|
252
329
|
- Keep the main agent focused on synthesis and comparison, not deep implementation details
|
|
253
330
|
- Encourage agents to find existing patterns and examples, not just describe possibilities
|
|
254
|
-
- Resolve technical unknowns during research
|
|
331
|
+
- Resolve technical unknowns during research — don't leave critical questions for design
|
|
255
332
|
- **File reading**: Always read mentioned files FULLY (no limit/offset) before invoking skills
|
|
256
333
|
- **Critical ordering**: Follow the numbered steps exactly
|
|
257
334
|
- ALWAYS read mentioned files first before invoking skills (step 1)
|
|
258
|
-
- ALWAYS
|
|
259
|
-
- ALWAYS wait for all agents to complete before synthesizing (step 3)
|
|
335
|
+
- ALWAYS generate candidates and run the Step 2.5 checkpoint before per-candidate dispatch (steps 2 → 2.5 → 3)
|
|
336
|
+
- ALWAYS wait for all per-candidate agents to complete before synthesizing (step 3)
|
|
260
337
|
- ALWAYS gather metadata before writing the document (step 5 before step 6)
|
|
261
338
|
- NEVER write the solutions document with placeholder values
|