@juicesharp/rpiv-pi 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +121 -271
- package/agents/scope-tracer.md +1 -1
- package/docs/agents.md +70 -0
- package/docs/architecture.md +136 -0
- package/docs/lanes.md +82 -0
- package/docs/models-config.md +200 -0
- package/docs/skills.md +86 -0
- package/docs/workflows.md +109 -0
- package/extensions/rpiv-core/bash-timeout.ts +16 -0
- package/extensions/rpiv-core/built-in-workflows.ts +2363 -278
- package/extensions/rpiv-core/guidance.ts +35 -19
- package/extensions/rpiv-core/lane-list.ts +5 -29
- package/extensions/rpiv-core/lane-progress.ts +5 -76
- package/extensions/rpiv-core/models-config.ts +35 -0
- package/extensions/rpiv-core/run-lane-registry.ts +0 -65
- package/extensions/rpiv-core/sdk-workflow-host.ts +4 -0
- package/extensions/rpiv-core/workflow-execution-host.ts +24 -7
- package/package.json +7 -3
- package/skills/amend/SKILL.md +7 -3
- package/skills/annotate-guidance/SKILL.md +2 -3
- package/skills/annotate-inline/SKILL.md +1 -3
- package/skills/architecture-review/SKILL.md +5 -4
- package/skills/blueprint/SKILL.md +14 -6
- package/skills/changelog/SKILL.md +1 -0
- package/skills/commit/SKILL.md +1 -0
- package/skills/design/SKILL.md +8 -5
- package/skills/design-review/SKILL.md +2 -1
- package/skills/design-slice/SKILL.md +2 -1
- package/skills/discover/SKILL.md +3 -4
- package/skills/elaborate/SKILL.md +17 -5
- package/skills/elaborate/_helpers/validate-workflow-invariant.mjs +88 -0
- package/skills/explore/SKILL.md +1 -0
- package/skills/frontend-design/SKILL.md +1 -0
- package/skills/grade/SKILL.md +20 -3
- package/skills/implement/SKILL.md +10 -2
- package/skills/plan/SKILL.md +10 -6
- package/skills/research/SKILL.md +14 -12
- package/skills/resume-handoff/SKILL.md +2 -1
- package/skills/revise/SKILL.md +1 -0
- package/skills/slice/SKILL.md +3 -2
- package/skills/synthesize/SKILL.md +16 -7
- package/skills/validate/SKILL.md +2 -1
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* `resolveGuidance` is pure logic with no ExtensionAPI references
|
|
16
16
|
* (utility-module rule from extensions/rpiv-core/CLAUDE.md). Side
|
|
17
17
|
* effects (sendMessage, in-memory dedup Set) live in
|
|
18
|
-
* `handleToolCallGuidance
|
|
19
|
-
* `clearInjectionState`.
|
|
18
|
+
* `handleToolCallGuidance` (sendMessage only), `resolveAndFormatNewGuidance`
|
|
19
|
+
* and `injectRootGuidance` (dedup-Set owners), and `clearInjectionState`.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -160,8 +160,37 @@ export function injectRootGuidance(cwd: string, pi: ExtensionAPI): void {
|
|
|
160
160
|
// ---------------------------------------------------------------------------
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
163
|
+
* Resolve, dedup, mark, and format guidance for a touched file — the "build"
|
|
164
|
+
* half of tool-call injection (no `ExtensionAPI`, no `sendMessage`). Owns the
|
|
165
|
+
* `injectedGuidance` Set read+mark so the dedup filter and the mark step stay
|
|
166
|
+
* in one function: marking before returning content lets the caller send with
|
|
167
|
+
* idempotence > reliability.
|
|
168
|
+
*
|
|
169
|
+
* Returns the `"\n\n---\n\n"`-joined formatted blocks, or `null` when nothing
|
|
170
|
+
* resolves along the ladder OR every resolved file is already injected (marks
|
|
171
|
+
* nothing in the null cases).
|
|
172
|
+
*/
|
|
173
|
+
export function resolveAndFormatNewGuidance(filePath: string, cwd: string, toolName: string): string | null {
|
|
174
|
+
const resolved = resolveGuidance(filePath, cwd);
|
|
175
|
+
const newFiles = resolved.filter((g) => !injectedGuidance.has(g.relativePath));
|
|
176
|
+
if (newFiles.length === 0) return null;
|
|
177
|
+
|
|
178
|
+
// Mark before send — idempotence > reliability.
|
|
179
|
+
for (const g of newFiles) {
|
|
180
|
+
injectedGuidance.add(g.relativePath);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const trigger = `auto-loaded because ${toolName} touched ${shortenPath(filePath, cwd)}`;
|
|
184
|
+
const contextParts = newFiles.map((g) => wrapGuidance(formatLabel(g), g.content, trigger));
|
|
185
|
+
|
|
186
|
+
return contextParts.join("\n\n---\n\n");
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Handle guidance injection on tool_call events for read/edit/write — a thin
|
|
191
|
+
* wiring pipeline: filter → extract → delegate → send. Resolve/dedup/mark/format
|
|
192
|
+
* live in `resolveAndFormatNewGuidance`; this handler adds no direct
|
|
193
|
+
* `injectedGuidance` reference.
|
|
165
194
|
*/
|
|
166
195
|
export function handleToolCallGuidance(
|
|
167
196
|
event: { toolName: string; input: Record<string, unknown> },
|
|
@@ -173,21 +202,8 @@ export function handleToolCallGuidance(
|
|
|
173
202
|
const filePath = (event.input as any).file_path ?? (event.input as any).path;
|
|
174
203
|
if (!filePath) return;
|
|
175
204
|
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
178
|
-
|
|
179
|
-
const newFiles = resolved.filter((g) => !injectedGuidance.has(g.relativePath));
|
|
180
|
-
if (newFiles.length === 0) return;
|
|
181
|
-
|
|
182
|
-
// Mark before sendMessage — idempotence > reliability.
|
|
183
|
-
for (const g of newFiles) {
|
|
184
|
-
injectedGuidance.add(g.relativePath);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
const trigger = `auto-loaded because ${event.toolName} touched ${shortenPath(filePath, ctx.cwd)}`;
|
|
188
|
-
const contextParts = newFiles.map((g) => wrapGuidance(formatLabel(g), g.content, trigger));
|
|
189
|
-
|
|
190
|
-
sendGuidanceMessage(pi, contextParts.join("\n\n---\n\n"));
|
|
205
|
+
const content = resolveAndFormatNewGuidance(filePath, ctx.cwd, event.toolName);
|
|
206
|
+
if (content !== null) sendGuidanceMessage(pi, content);
|
|
191
207
|
}
|
|
192
208
|
|
|
193
209
|
/**
|
|
@@ -51,25 +51,17 @@ export const SPIN_INTERVAL_MS = 160;
|
|
|
51
51
|
const CURSOR_SELECTED = "❯ ";
|
|
52
52
|
const CURSOR_UNSELECTED = " ";
|
|
53
53
|
|
|
54
|
-
/** Mini stage-progress bar: filled/empty cells, capped + scaled for big workflows. */
|
|
55
|
-
const BAR_FILLED = "▰";
|
|
56
|
-
const BAR_EMPTY = "▱";
|
|
57
|
-
const BAR_MAX_CELLS = 7;
|
|
58
54
|
/** Minimum leftover display columns to bother showing a failure-reason chip. */
|
|
59
55
|
const MIN_REASON_WIDTH = 6;
|
|
60
|
-
/** Lap marker (`↻7`) for the path ordinal — shown ONLY once the walk has re-entered a stage
|
|
61
|
-
* (`stageNumber > visited`) so an acyclic run stays a clean `3/4` with no marker. */
|
|
62
|
-
const LAP_MARK = "↻";
|
|
63
56
|
/** Retry glyph (onStageRetry); running uses the spinner, error the failed glyph. */
|
|
64
57
|
const RETRY_GLYPH = "⟲";
|
|
65
58
|
|
|
66
59
|
// Fixed-width columns (column stability): each leading field is truncated or right-padded to a
|
|
67
|
-
// constant DISPLAY width so the
|
|
60
|
+
// constant DISPLAY width so the status region starts at the same column on every row.
|
|
68
61
|
const TAG_COL = 12;
|
|
69
62
|
const MAX_LABEL_WIDTH = 40;
|
|
70
63
|
const LABEL_LEADING = 4 + TAG_COL + 2;
|
|
71
64
|
const PROGRESS_MIN_WIDTH = 12;
|
|
72
|
-
const NUM_COL = 5;
|
|
73
65
|
|
|
74
66
|
/** Per-status glyph; needs-input overrides it (see renderLaneRow). */
|
|
75
67
|
const STATUS_GLYPH: Record<LaneStatus, string> = {
|
|
@@ -241,8 +233,7 @@ function renderUnitRow(
|
|
|
241
233
|
|
|
242
234
|
/**
|
|
243
235
|
* Render a lane row carrying live stage progress. Width priority under pressure: the
|
|
244
|
-
* `
|
|
245
|
-
* mini-bar (decoration) is dropped FIRST — so a failed row shows its cause before its bar.
|
|
236
|
+
* `stageName` label is always kept; the failure `reason` chip fills what's left.
|
|
246
237
|
*/
|
|
247
238
|
function renderProgressRow(
|
|
248
239
|
theme: Theme,
|
|
@@ -252,40 +243,25 @@ function renderProgressRow(
|
|
|
252
243
|
reason?: string,
|
|
253
244
|
usage?: LaneUsage,
|
|
254
245
|
): string {
|
|
255
|
-
const cells = BAR_MAX_CELLS;
|
|
256
|
-
const visited = progress.visited ?? Math.min(progress.stageNumber, progress.totalStages);
|
|
257
|
-
const ratio = progress.totalStages > 0 ? visited / progress.totalStages : 0;
|
|
258
|
-
const filled = Math.max(0, Math.min(cells, Math.round(ratio * cells)));
|
|
259
|
-
const filledStr = BAR_FILLED.repeat(filled);
|
|
260
|
-
const emptyStr = BAR_EMPTY.repeat(cells - filled);
|
|
261
|
-
|
|
262
|
-
const numRaw = `${visited}/${progress.totalStages}`;
|
|
263
246
|
let nameRaw = progress.stageName;
|
|
264
247
|
if (progress.phase === "retry" && progress.attempt !== undefined) nameRaw += ` · retry ${progress.attempt}`;
|
|
265
|
-
if (progress.stageNumber > visited) nameRaw += ` · ${LAP_MARK}${progress.stageNumber}`;
|
|
266
248
|
if (progress.units) nameRaw += ` · units ${progress.units.done}/${progress.units.total}`;
|
|
267
249
|
const usageTally = formatUsageTally(usage);
|
|
268
250
|
if (usageTally) nameRaw += ` · ${usageTally}`;
|
|
269
251
|
|
|
270
|
-
const numCol = padCol(theme, "muted", numRaw, NUM_COL);
|
|
271
252
|
const coloredName = theme.fg("muted", nameRaw);
|
|
272
|
-
const coreW = visibleWidth(prefix) +
|
|
253
|
+
const coreW = visibleWidth(prefix) + visibleWidth(nameRaw);
|
|
273
254
|
|
|
274
255
|
let reasonStr = "";
|
|
275
256
|
if (reason) {
|
|
276
257
|
const leftover = width - coreW;
|
|
277
258
|
if (leftover >= MIN_REASON_WIDTH) reasonStr = theme.fg("warning", truncateToWidth(` — ${reason}`, leftover, "…"));
|
|
278
259
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
const includeBar = cells > 0 && coreW + reasonW + cells + 2 <= width;
|
|
282
|
-
if (!includeBar) return `${prefix}${numCol} ${coloredName}${reasonStr}`;
|
|
283
|
-
const coloredBar = `${theme.fg("accent", filledStr)}${theme.fg("dim", emptyStr)}`;
|
|
284
|
-
return `${prefix}${coloredBar} ${numCol} ${coloredName}${reasonStr}`;
|
|
260
|
+
return `${prefix}${coloredName}${reasonStr}`;
|
|
285
261
|
}
|
|
286
262
|
|
|
287
263
|
/** Render a lane (parent) row: cursor-gutter · status-glyph · workflow-tag · descriptor ·
|
|
288
|
-
* [progress
|
|
264
|
+
* [stage progress / status word]. needs-input wins the glyph + trailing label. */
|
|
289
265
|
function renderLaneRow(
|
|
290
266
|
theme: Theme,
|
|
291
267
|
lane: LaneEntry,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Each lifecycle event maps to `setLaneProgress(ctx.runId, …)`:
|
|
12
12
|
* - onStageStart → clear the prior stage's fan-out unit sub-rows (every stage kind; it fires
|
|
13
|
-
* before onLoopStart on a loop stage) + {
|
|
13
|
+
* before onLoopStart on a loop stage) + { stageName, phase: "running" }
|
|
14
14
|
* - onStageRetry → phase "retry" + attempt ("⟲ … retry 2/3")
|
|
15
15
|
* - onStageError → phase "error" (brief — the run then evicts)
|
|
16
16
|
* - onLoopStart → seed units.total (fanout precomputes its unit list); on a
|
|
@@ -41,10 +41,8 @@ import {
|
|
|
41
41
|
clearUnitLanes,
|
|
42
42
|
getLane,
|
|
43
43
|
markUnitDone,
|
|
44
|
-
noteVisitedStage,
|
|
45
44
|
retireRun,
|
|
46
45
|
seedPendingUnits,
|
|
47
|
-
seedVisitedStages,
|
|
48
46
|
setLaneProgress,
|
|
49
47
|
setUnitStarted,
|
|
50
48
|
sweepRunningUnits,
|
|
@@ -119,19 +117,6 @@ export async function registerLaneProgress(): Promise<void> {
|
|
|
119
117
|
// loader/DSL/runner graph off startup and avoids the barrel-import race.
|
|
120
118
|
const { registerLifecycle } = await import("@juicesharp/rpiv-workflow/startup");
|
|
121
119
|
g.dispose = registerLifecycle({
|
|
122
|
-
// Fires ONCE per run (new or resumed) BEFORE the chain kicks. On a RESUME the
|
|
123
|
-
// engine reconstructs its distinct-visited set from the trail and re-enters the
|
|
124
|
-
// walk at a deep `stageNumber`, but only re-fires per-stage events from that point
|
|
125
|
-
// forward — so seed the registry's accumulator from `ctx.visited` HERE, otherwise
|
|
126
|
-
// the bridge recounts from zero and a near-done resume renders a misleading "1/17".
|
|
127
|
-
// A fresh run carries an empty `visited`, so this no-ops. The numerator surfaces on
|
|
128
|
-
// the first post-seed `setLaneProgress` (the resumed stage's onStageStart).
|
|
129
|
-
onWorkflowStart: (ctx) => {
|
|
130
|
-
if (ctx.visited?.length) seedVisitedStages(ctx.runId, ctx.visited);
|
|
131
|
-
},
|
|
132
|
-
// `noteVisitedStage` is idempotent per stage name, so calling it from every
|
|
133
|
-
// per-stage event keeps `visited` (the distinct-nodes-visited fraction
|
|
134
|
-
// numerator) correct without inflating on a loop-back — see LaneProgress.
|
|
135
120
|
// onStageStart fires for EVERY stage kind — a plain sequential stage (the single-stage
|
|
136
121
|
// entry announcement, run-stage.ts:221) AND every loop stage, where it fires BEFORE
|
|
137
122
|
// onLoopStart (announceLoopStart, loop.ts:75→78). So retiring the prior stage's fan-out
|
|
@@ -141,23 +126,10 @@ export async function registerLaneProgress(): Promise<void> {
|
|
|
141
126
|
// clearUnitLanes is a no-op on an empty map, so the first stage of a run pays nothing.
|
|
142
127
|
onStageStart: (stage, ctx) => {
|
|
143
128
|
clearUnitLanes(ctx.runId);
|
|
144
|
-
setLaneProgress(ctx.runId, {
|
|
145
|
-
stageNumber: stage.stageNumber,
|
|
146
|
-
totalStages: ctx.totalStages,
|
|
147
|
-
visited: noteVisitedStage(ctx.runId, stage.name),
|
|
148
|
-
stageName: stage.name,
|
|
149
|
-
phase: "running",
|
|
150
|
-
});
|
|
129
|
+
setLaneProgress(ctx.runId, { stageName: stage.name, phase: "running" });
|
|
151
130
|
},
|
|
152
131
|
onStageRetry: (stage, attempt, ctx) =>
|
|
153
|
-
setLaneProgress(ctx.runId, {
|
|
154
|
-
stageNumber: stage.stageNumber,
|
|
155
|
-
totalStages: ctx.totalStages,
|
|
156
|
-
visited: noteVisitedStage(ctx.runId, stage.name),
|
|
157
|
-
stageName: stage.name,
|
|
158
|
-
phase: "retry",
|
|
159
|
-
attempt,
|
|
160
|
-
}),
|
|
132
|
+
setLaneProgress(ctx.runId, { stageName: stage.name, phase: "retry", attempt }),
|
|
161
133
|
// Carry the stage's failure cause so the dock row can surface WHY
|
|
162
134
|
// it failed before the run retires — no longer discarded.
|
|
163
135
|
onStageError: (stage, error, ctx) => {
|
|
@@ -166,28 +138,7 @@ export async function registerLaneProgress(): Promise<void> {
|
|
|
166
138
|
// onUnitEnd — flip every still-running sub-row to ✗ so none spins forever.
|
|
167
139
|
sweepRunningUnits(ctx.runId, "failed");
|
|
168
140
|
fanoutRuns.delete(ctx.runId);
|
|
169
|
-
setLaneProgress(ctx.runId, {
|
|
170
|
-
stageNumber: stage.stageNumber,
|
|
171
|
-
totalStages: ctx.totalStages,
|
|
172
|
-
visited: noteVisitedStage(ctx.runId, stage.name),
|
|
173
|
-
stageName: stage.name,
|
|
174
|
-
phase: "error",
|
|
175
|
-
reason: error,
|
|
176
|
-
});
|
|
177
|
-
},
|
|
178
|
-
// A decision edge took its arm: credit each not-taken RECOVERY arm (a
|
|
179
|
-
// failure loop the chosen arm skipped for good — build's slice-fix/plan-fix/code-fix)
|
|
180
|
-
// as visited. This advances the distinct-nodes-visited numerator at the
|
|
181
|
-
// gate, so the bar reaches `totalStages` WHILE the terminal stage runs
|
|
182
|
-
// (commit shows 16/16) instead of capping below until the onWorkflowEnd
|
|
183
|
-
// snap. `noteVisitedStage` is idempotent + the runner already excludes
|
|
184
|
-
// already-visited / forward arms, so this never inflates past the total.
|
|
185
|
-
onRoute: (_from, _to, ctx, bypassed) => {
|
|
186
|
-
if (!bypassed?.length) return;
|
|
187
|
-
let visited = 0;
|
|
188
|
-
for (const name of bypassed) visited = noteVisitedStage(ctx.runId, name);
|
|
189
|
-
const prog = getLane(ctx.runId)?.progress;
|
|
190
|
-
if (prog) setLaneProgress(ctx.runId, { ...prog, visited });
|
|
141
|
+
setLaneProgress(ctx.runId, { stageName: stage.name, phase: "error", reason: error });
|
|
191
142
|
},
|
|
192
143
|
onLoopStart: (stage, info, ctx) => {
|
|
193
144
|
// A new fan-out generation REPLACES the prior one's sub-rows — the engine
|
|
@@ -211,9 +162,6 @@ export async function registerLaneProgress(): Promise<void> {
|
|
|
211
162
|
fanoutRuns.delete(ctx.runId);
|
|
212
163
|
}
|
|
213
164
|
setLaneProgress(ctx.runId, {
|
|
214
|
-
stageNumber: stage.stageNumber,
|
|
215
|
-
totalStages: ctx.totalStages,
|
|
216
|
-
visited: noteVisitedStage(ctx.runId, stage.name),
|
|
217
165
|
stageName: stage.name,
|
|
218
166
|
phase: "running",
|
|
219
167
|
// Fanout precomputes its unit list; pull loops (iterate/assess) discover
|
|
@@ -257,14 +205,7 @@ export async function registerLaneProgress(): Promise<void> {
|
|
|
257
205
|
const prev = getLane(ctx.runId)?.progress?.units;
|
|
258
206
|
units = { done: (prev?.done ?? 0) + 1, total: prev?.total ?? unit.index + 1 };
|
|
259
207
|
}
|
|
260
|
-
setLaneProgress(ctx.runId, {
|
|
261
|
-
stageNumber: stage.stageNumber,
|
|
262
|
-
totalStages: ctx.totalStages,
|
|
263
|
-
visited: noteVisitedStage(ctx.runId, stage.name),
|
|
264
|
-
stageName: stage.name,
|
|
265
|
-
phase: "running",
|
|
266
|
-
units,
|
|
267
|
-
});
|
|
208
|
+
setLaneProgress(ctx.runId, { stageName: stage.name, phase: "running", units });
|
|
268
209
|
},
|
|
269
210
|
// The run terminated: RETAIN the lane with its terminal status (so
|
|
270
211
|
// it stays visible + its transcript stays viewable) and PUSH a completion
|
|
@@ -278,18 +219,6 @@ export async function registerLaneProgress(): Promise<void> {
|
|
|
278
219
|
// `termination.error` is the readable cause (the same text as the trail's
|
|
279
220
|
// errMsg) — retain it on the lane for the dock chip + viewer header.
|
|
280
221
|
const error = result.termination?.error;
|
|
281
|
-
// A completed run is 100% by definition. The bar's fraction is
|
|
282
|
-
// distinct-stages-visited / reachable-stages. The onRoute handler now credits
|
|
283
|
-
// bypassed recovery arms (build's `slice-fix`/`plan-fix`/`code-fix`) at the gate, so a clean
|
|
284
|
-
// run usually already reads full here and this snap is a no-op. It REMAINS as a
|
|
285
|
-
// safety net for any uncredited skip (e.g. a gate passed before a resume point,
|
|
286
|
-
// whose onRoute never re-fired). Paint the bar full on clean completion only;
|
|
287
|
-
// `failed`/`aborted` keep their last real snapshot so the row stays frozen at
|
|
288
|
-
// the stage that died.
|
|
289
|
-
const prog = lane?.progress;
|
|
290
|
-
if (status === "completed" && prog && prog.visited !== prog.totalStages) {
|
|
291
|
-
setLaneProgress(ctx.runId, { ...prog, visited: prog.totalStages });
|
|
292
|
-
}
|
|
293
222
|
// Sweep any unit that never fired onUnitEnd (abort/throw) to the run's terminal
|
|
294
223
|
// kind BEFORE retiring, so a failed run's stuck sub-rows read ✗ (retireRun's
|
|
295
224
|
// running→done fallback then no-ops on them). Drop the gate — the run is over.
|
|
@@ -35,6 +35,15 @@ export type ThinkingLevelValue = (typeof THINKING_LEVEL_VALUES)[number];
|
|
|
35
35
|
export const MODEL_THINKING_LEVEL_VALUES = ["off", ...THINKING_LEVEL_VALUES] as const;
|
|
36
36
|
export type ModelThinkingLevelValue = (typeof MODEL_THINKING_LEVEL_VALUES)[number];
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Background-lane concurrency cap fallback. The fail-soft default applied by
|
|
40
|
+
* `resolveMaxConcurrency` when `~/.config/rpiv-pi/models.json` is absent or
|
|
41
|
+
* carries no valid `maxConcurrency`. Rate limits, not CPU, are the real cap —
|
|
42
|
+
* 4 background lanes is the safe default. Re-exported from
|
|
43
|
+
* packages/rpiv-pi/extensions/rpiv-core/workflow-execution-host.ts to preserve the tested public surface.
|
|
44
|
+
*/
|
|
45
|
+
export const DEFAULT_MAX_CONCURRENCY = 4;
|
|
46
|
+
|
|
38
47
|
// ---------------------------------------------------------------------------
|
|
39
48
|
// TypeBox schemas
|
|
40
49
|
// ---------------------------------------------------------------------------
|
|
@@ -121,6 +130,13 @@ const ModelsConfigSchema = Type.Object(
|
|
|
121
130
|
stages: Type.Optional(Type.Record(Type.String(), ModelEntrySchema)),
|
|
122
131
|
skills: Type.Optional(Type.Record(Type.String(), ModelEntrySchema)),
|
|
123
132
|
presets: Type.Optional(Type.Record(Type.String(), PresetSchema)),
|
|
133
|
+
maxConcurrency: Type.Optional(
|
|
134
|
+
Type.Integer({
|
|
135
|
+
minimum: 1,
|
|
136
|
+
description:
|
|
137
|
+
"Background-lane concurrency cap (fail-soft default applied by resolveMaxConcurrency when absent/invalid)",
|
|
138
|
+
}),
|
|
139
|
+
),
|
|
124
140
|
},
|
|
125
141
|
{ additionalProperties: false },
|
|
126
142
|
);
|
|
@@ -145,6 +161,8 @@ export interface ModelsConfig {
|
|
|
145
161
|
stages?: Record<string, ResolvedModelConfig>;
|
|
146
162
|
skills?: Record<string, ResolvedModelConfig>;
|
|
147
163
|
presets?: Record<string, { stages?: Record<string, ResolvedModelConfig> }>;
|
|
164
|
+
/** Background-lane concurrency cap. Absent/invalid ⇒ DEFAULT_MAX_CONCURRENCY (via resolveMaxConcurrency). */
|
|
165
|
+
maxConcurrency?: number;
|
|
148
166
|
}
|
|
149
167
|
|
|
150
168
|
// ---------------------------------------------------------------------------
|
|
@@ -237,6 +255,7 @@ export function loadModelsConfig(): ModelsConfig {
|
|
|
237
255
|
stages: Object.keys(stages).length > 0 ? stages : undefined,
|
|
238
256
|
skills: Object.keys(skills).length > 0 ? skills : undefined,
|
|
239
257
|
presets: Object.keys(presets).length > 0 ? presets : undefined,
|
|
258
|
+
maxConcurrency: validated.maxConcurrency,
|
|
240
259
|
};
|
|
241
260
|
modelsConfigCache = result;
|
|
242
261
|
return result;
|
|
@@ -318,6 +337,22 @@ export function resolveStageModel(
|
|
|
318
337
|
return config.defaults;
|
|
319
338
|
}
|
|
320
339
|
|
|
340
|
+
/**
|
|
341
|
+
* Resolve the background-lane concurrency cap from `~/.config/rpiv-pi/models.json`.
|
|
342
|
+
* Returns `DEFAULT_MAX_CONCURRENCY` (4) when the key is absent OR holds an invalid
|
|
343
|
+
* value (non-integer, < 1).
|
|
344
|
+
*
|
|
345
|
+
* NOTE: `Value.Clean` (typebox@1.3.6) does NOT strip invalid scalars — it only
|
|
346
|
+
* strips unknown keys, leaving `null` in place — so a configured
|
|
347
|
+
* `maxConcurrency: 0` / `-1` / `4.5` / `"4"` / `null` survives schema
|
|
348
|
+
* validation. This guard is therefore the fail-soft boundary, not the schema's
|
|
349
|
+
* `minimum: 1`. (`undefined` reaches the guard only from an absent key.)
|
|
350
|
+
*/
|
|
351
|
+
export function resolveMaxConcurrency(config: ModelsConfig): number {
|
|
352
|
+
const v = config.maxConcurrency;
|
|
353
|
+
return v !== undefined && Number.isInteger(v) && v >= 1 ? v : DEFAULT_MAX_CONCURRENCY;
|
|
354
|
+
}
|
|
355
|
+
|
|
321
356
|
// ---------------------------------------------------------------------------
|
|
322
357
|
// Warn-on-miss — surface record-key typos that schema validation can't catch.
|
|
323
358
|
// ---------------------------------------------------------------------------
|
|
@@ -137,26 +137,6 @@ export interface UnitLane {
|
|
|
137
137
|
* `streaming…` label. Absent (undefined) before the first stage starts.
|
|
138
138
|
*/
|
|
139
139
|
export interface LaneProgress {
|
|
140
|
-
/**
|
|
141
|
-
* Path ordinal — the count of stage ACTIVATIONS along the executed walk
|
|
142
|
-
* (`idx + 1`), so it climbs on every loop-back / re-entry and is unbounded by
|
|
143
|
-
* graph size. This is the "lap" number (`↻7`), NOT a fraction numerator: it is
|
|
144
|
-
* incommensurable with `totalStages` (distance travelled vs. map size).
|
|
145
|
-
*/
|
|
146
|
-
stageNumber: number;
|
|
147
|
-
/** Distinct reachable stage NODES in the workflow graph (static, BFS at launch). */
|
|
148
|
-
totalStages: number;
|
|
149
|
-
/**
|
|
150
|
-
* Distinct stage nodes VISITED so far (≤ totalStages) — the one quantity for
|
|
151
|
-
* which `visited/totalStages ≤ 1` holds, so it (not `stageNumber`) is the
|
|
152
|
-
* progress-fraction numerator. Counts nodes actually entered PLUS the recovery
|
|
153
|
-
* arms a gate bypassed for good (build's slice-fix/plan-fix/code-fix, credited via onRoute's
|
|
154
|
-
* `bypassed`), so a clean run reaches `totalStages` while its terminal stage
|
|
155
|
-
* runs instead of capping below until the onWorkflowEnd snap. Undefined for
|
|
156
|
-
* snapshots built outside the lifecycle bridge; the renderer falls back to
|
|
157
|
-
* `min(stageNumber, totalStages)`.
|
|
158
|
-
*/
|
|
159
|
-
visited?: number;
|
|
160
140
|
stageName: string;
|
|
161
141
|
/** Glyph selector: running spinner · ⟲ retry · ✗ error. */
|
|
162
142
|
phase: "running" | "retry" | "error";
|
|
@@ -204,15 +184,6 @@ export interface LaneEntry {
|
|
|
204
184
|
readonly units: Map<number, UnitLane>;
|
|
205
185
|
/** Live stage progress; undefined until the first onStageStart. */
|
|
206
186
|
progress: LaneProgress | undefined;
|
|
207
|
-
/**
|
|
208
|
-
* Distinct stage names entered over this run's life — the accumulator behind
|
|
209
|
-
* `LaneProgress.visited`. Lives on the entry (not the per-event progress
|
|
210
|
-
* snapshot, which the bridge rebuilds wholesale) so a cyclic walk that revisits
|
|
211
|
-
* a stage never inflates the count. Retained across a same-session resume
|
|
212
|
-
* (those stages WERE visited); only a launcher restart resets it, which resets
|
|
213
|
-
* the whole lane anyway. Lazily created by `noteVisitedStage`.
|
|
214
|
-
*/
|
|
215
|
-
visitedStages?: Set<string>;
|
|
216
187
|
/**
|
|
217
188
|
* Terminal failure cause — `result.termination.error` captured at
|
|
218
189
|
* `retireRun`, the readable reason a `failed`/`aborted`/`cancelled` run ended.
|
|
@@ -625,42 +596,6 @@ export function setLaneProgress(runId: string, progress: LaneProgress | undefine
|
|
|
625
596
|
notify();
|
|
626
597
|
}
|
|
627
598
|
|
|
628
|
-
/**
|
|
629
|
-
* Record a stage entry and return the running count of DISTINCT stages visited
|
|
630
|
-
* for this run — the `LaneProgress.visited` numerator. Idempotent per stage name
|
|
631
|
-
* (a `Set`), so the bridge can call it from every per-stage event (start, retry,
|
|
632
|
-
* unit-end) and always read back the correct distinct count without inflating it
|
|
633
|
-
* on a loop-back. Returns 0 for a missing/evicted run (best-effort, like
|
|
634
|
-
* `setLaneProgress`). Does NOT `notify()` — the paired `setLaneProgress` does.
|
|
635
|
-
*/
|
|
636
|
-
export function noteVisitedStage(runId: string, stageName: string): number {
|
|
637
|
-
const entry = state().lanes.get(runId);
|
|
638
|
-
if (!entry) return 0;
|
|
639
|
-
const visited = entry.visitedStages ?? new Set<string>();
|
|
640
|
-
visited.add(stageName);
|
|
641
|
-
entry.visitedStages = visited;
|
|
642
|
-
return visited.size;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* Seed the distinct-visited accumulator with stage names the engine already walked
|
|
647
|
-
* — the reconstructed `RunContext.visited` carried on `onWorkflowStart`'s
|
|
648
|
-
* `LifecycleContext.visited`. UNIONS into the set (never replaces), so it composes
|
|
649
|
-
* with `noteVisitedStage`: a fresh run seeds an empty list (no-op), while a RESUMED
|
|
650
|
-
* run seeds its reconstructed walk so the first post-resume `noteVisitedStage` reads
|
|
651
|
-
* back the true distinct count instead of recounting from zero (the `1/17`-near-done
|
|
652
|
-
* bug). Idempotent + best-effort (a missing/evicted run no-ops). Returns the running
|
|
653
|
-
* size. Does NOT `notify()` — the numerator surfaces on the next `setLaneProgress`.
|
|
654
|
-
*/
|
|
655
|
-
export function seedVisitedStages(runId: string, names: readonly string[]): number {
|
|
656
|
-
const entry = state().lanes.get(runId);
|
|
657
|
-
if (!entry) return 0;
|
|
658
|
-
const visited = entry.visitedStages ?? new Set<string>();
|
|
659
|
-
for (const name of names) visited.add(name);
|
|
660
|
-
entry.visitedStages = visited;
|
|
661
|
-
return visited.size;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
599
|
/** Enqueue a deferred foreground-stage UI request onto a UNIT's queue (relay).
|
|
665
600
|
* Stamps the LANE-level needs-input clock on the FIRST enqueue across the
|
|
666
601
|
* lane that finds it unset (held across a transient drain→refill so the aging
|
|
@@ -433,6 +433,10 @@ export class SdkWorkflowHost implements WorkflowHostContext {
|
|
|
433
433
|
// runner THIS child's `aborted` stop was a tool-timeout (→ soft-halt), not a
|
|
434
434
|
// run/user abort. Undefined until/unless the watchdog fires.
|
|
435
435
|
toolTimeout: () => watchdog.timedOut(),
|
|
436
|
+
// Recovery twin: clear the verdict + pending timers so the resumed turn's next
|
|
437
|
+
// bash call re-arms a fresh per-toolCallId timer via the still-live subscribe
|
|
438
|
+
// listener. Same watchdog handle armed once per child; dispose() still runs in finally.
|
|
439
|
+
resetToolTimeout: () => watchdog.reset(),
|
|
436
440
|
sessionManager: {
|
|
437
441
|
// The transcript reader (`transcript.ts`) expects the ENVELOPED branch
|
|
438
442
|
// shape `{ type: "message", message: {...} }` (SessionEntry[]) — the same
|
|
@@ -18,9 +18,10 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import type { ExtensionAPI, ExtensionUIContext } from "@earendil-works/pi-coding-agent";
|
|
21
|
-
import
|
|
21
|
+
import { SessionManager } from "@earendil-works/pi-coding-agent";
|
|
22
|
+
import type { BranchEntry, ModelSelection, WorkflowHostContext } from "@juicesharp/rpiv-workflow";
|
|
22
23
|
import { isLaneRelayUiContext } from "./lane-relay-ui.js";
|
|
23
|
-
import { loadModelsConfig, resolveStageModel } from "./models-config.js";
|
|
24
|
+
import { loadModelsConfig, resolveMaxConcurrency, resolveStageModel } from "./models-config.js";
|
|
24
25
|
import { getFocusedRun, getLane, recordRun, retireRun, setLaneAbort } from "./run-lane-registry.js";
|
|
25
26
|
import { SdkWorkflowHost } from "./sdk-workflow-host.js";
|
|
26
27
|
import { getCapturedModelRegistry, getCapturedUiContext } from "./session-capture.js";
|
|
@@ -34,11 +35,12 @@ type WorkflowExecution = {
|
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
|
-
* Background-lane concurrency cap
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* Background-lane concurrency cap, re-exported from models-config.ts (the single
|
|
39
|
+
* source of truth alongside `resolveMaxConcurrency`). Re-exported here to
|
|
40
|
+
* preserve the tested public surface; the live cap is driven through
|
|
41
|
+
* `resolveMaxConcurrency(loadModelsConfig())` at the consumer below.
|
|
40
42
|
*/
|
|
41
|
-
export
|
|
43
|
+
export { DEFAULT_MAX_CONCURRENCY } from "./models-config.js";
|
|
42
44
|
|
|
43
45
|
/**
|
|
44
46
|
* Map the config layer's `ResolvedModelConfig` ({ model?, thinking? }) to the
|
|
@@ -95,7 +97,7 @@ export function createWorkflowExecution(
|
|
|
95
97
|
cwd: observer.cwd,
|
|
96
98
|
runId,
|
|
97
99
|
childSessionsDir, // resolved by the runner; rpiv-pi does not synthesize the path
|
|
98
|
-
maxConcurrency:
|
|
100
|
+
maxConcurrency: resolveMaxConcurrency(loadModelsConfig()), // config-driven background-lane cap (default 4)
|
|
99
101
|
});
|
|
100
102
|
|
|
101
103
|
// Record this run as a switchable lane at launch (appears in the ambient
|
|
@@ -176,6 +178,21 @@ export async function registerWorkflowExecutionHostProvider(): Promise<void> {
|
|
|
176
178
|
registerWorkflowExecutionHost({
|
|
177
179
|
createHost: createWorkflowExecution,
|
|
178
180
|
resolveModel: ({ stage, skill }) => toModelSelection(resolveStageModel(loadModelsConfig(), { stage, skill })),
|
|
181
|
+
// Death-scene reader — re-open the just-failed session's persisted JSONL
|
|
182
|
+
// and return its branch, narrowed to the workflow-owned BranchEntry shape
|
|
183
|
+
// (the SDK's SessionEntry union carries private discriminators — the
|
|
184
|
+
// `as unknown as` double-cast is duplicated by necessity, not a mirror:
|
|
185
|
+
// this module sits on the entry graph, so sibling-import-graph.test.ts
|
|
186
|
+
// forbids a value-import of `readBranch` from the peer
|
|
187
|
+
// packages/rpiv-workflow/transcript.ts. That twin cast stays untouched —
|
|
188
|
+
// peer package, out of write scope). Fail-soft: any open/read error ⇒ undefined.
|
|
189
|
+
readSessionBranch: (file: string) => {
|
|
190
|
+
try {
|
|
191
|
+
return SessionManager.open(file).getBranch() as unknown as BranchEntry[] | undefined;
|
|
192
|
+
} catch {
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
},
|
|
179
196
|
});
|
|
180
197
|
} catch (err) {
|
|
181
198
|
if (isModuleNotFound(err)) return; // sibling absent — /rpiv-setup guides the user
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juicesharp/rpiv-pi",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "A skill-based development workflow for Pi Agent.
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"description": "A skill-based development workflow for Pi Agent. 27 contract-carrying skills (discover → research → design → plan → implement → validate → code-review → commit, and more), the 15 named subagents they dispatch, and five built-in /wf workflows that chain them end to end in detached parallel runs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
7
7
|
"pi-extension",
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
"skills/",
|
|
33
33
|
"agents/",
|
|
34
34
|
"scripts/",
|
|
35
|
+
"docs/",
|
|
36
|
+
"!docs/*.png",
|
|
37
|
+
"!docs/*.jpg",
|
|
38
|
+
"!docs/*.svg",
|
|
35
39
|
"README.md",
|
|
36
40
|
"LICENSE",
|
|
37
41
|
"!**/*.test.ts"
|
|
@@ -45,7 +49,7 @@
|
|
|
45
49
|
]
|
|
46
50
|
},
|
|
47
51
|
"dependencies": {
|
|
48
|
-
"@juicesharp/rpiv-config": "^2.
|
|
52
|
+
"@juicesharp/rpiv-config": "^2.2.0",
|
|
49
53
|
"typebox": "^1.1.24"
|
|
50
54
|
},
|
|
51
55
|
"peerDependencies": {
|
package/skills/amend/SKILL.md
CHANGED
|
@@ -19,7 +19,9 @@ You surgically fix **one** artifact so it clears the dimensions a grade panel ma
|
|
|
19
19
|
`$ARGUMENTS` — flags the orchestrator wires from the gate's channels. Parse them **generically**, agnostic to the channel name:
|
|
20
20
|
|
|
21
21
|
- **Verdicts** — every flag whose name ends in `-verdicts` (e.g. `--research-verdicts`, `--plan-verdicts`), repeatable. Each value is a verdict JSON path.
|
|
22
|
-
- **
|
|
22
|
+
- **Citation floors** — every flag whose name ends in `-cite-check` (e.g. `--plan-cite-check`, `--code-cite-check`), repeatable. Each value is a cite-check verdict JSON path.
|
|
23
|
+
- **Lineage sources** — the read-only context flags `--goal`, `--research`, and `--subplans` (repeatable; build's fix arms only). `--goal` is the verbatim brief, `--research` the architecture/precedent findings, `--subplans` the per-cluster sub-plans. They are context, never the artifact to re-emit.
|
|
24
|
+
- **Artifact** — the single remaining `--<channel>` flag that is **not** a verdicts, citation-floor, or lineage-source flag (i.e. not ending in `-verdicts` or `-cite-check`, and not `--goal`/`--research`/`--subplans`). Its value is the artifact to fix and re-emit; for both build fix arms this resolves to `--plans`.
|
|
23
25
|
|
|
24
26
|
If you can't identify exactly one artifact flag and at least one verdicts flag, print an error and stop.
|
|
25
27
|
|
|
@@ -34,14 +36,16 @@ The first tab-separated field is `<iso>` (use as `last_updated`).
|
|
|
34
36
|
## Steps
|
|
35
37
|
|
|
36
38
|
1. **Read the artifact fully** (no limit/offset) and **read every verdict JSON**.
|
|
37
|
-
2. **Select the failing findings.** Group verdicts by `dimension`; for each dimension keep the **latest** (by `graded_at`) — verdicts accumulate across amend loops, so an older failing verdict may already be superseded. From the latest-per-dimension set, take those with `pass: false
|
|
38
|
-
3. **Apply each failing verdict's `feedback`/`findings` surgically.** Use each finding's `where` to locate the exact spot and change only that. Honor `feedback` as the instruction set. Where a finding requires checking the codebase (a `correctness` or `pattern-following` fix), Read/Grep the cited `file:line` to ground the edit — but never edit code, only the artifact.
|
|
39
|
+
2. **Select the failing findings.** Group verdicts by `dimension`; for each dimension keep the **latest** (by `graded_at`) — verdicts accumulate across amend loops, so an older failing verdict may already be superseded. From the latest-per-dimension set, take those with `pass: false`, **and also any carrying a non-empty `risk_duty_demotions` array** (a field the workflow stamps after grading — even when the verdict's own `pass` is `true`, a demoted risk ruling records the demotion there). If none fail and none carry a demotion, the artifact already passes: re-emit it unchanged (only bump `last_updated`) and report — the panel will confirm.
|
|
40
|
+
3. **Apply each failing verdict's `feedback`/`findings` surgically.** Use each finding's `where` to locate the exact spot and change only that. Honor `feedback` as the instruction set. Where a finding requires checking the codebase (a `correctness` or `pattern-following` fix), Read/Grep the cited `file:line` to ground the edit — but never edit code, only the artifact. A **completeness-class** finding (the artifact under-covers the brief) is repaired from the lineage sources — `--goal`, `--research`, `--subplans` — by reading the authoritative source there and folding the missing point in; never reconstruct the missing content from verdict prose or guess it from a directory listing.
|
|
39
41
|
4. **Confirm coverage** — every failing finding maps to an edit you made. Do not introduce changes no finding asked for.
|
|
40
42
|
5. **Re-emit the artifact to the SAME path** (Edit in place; Write only if a structural rewrite of a section is unavoidable). Preserve everything outside the cited findings, keep `status: ready`, and update `last_updated: <iso>` in the frontmatter. Same path ⇒ the artifact's channel updates latest-wins for re-judging.
|
|
41
43
|
6. **Print the artifact path**, then a one-line summary: `amended for <dimensions>: <k> findings addressed`.
|
|
42
44
|
|
|
43
45
|
## Hard rules
|
|
44
46
|
|
|
47
|
+
- **A `risk_duty_demotions` demotion is grader-side — re-emit unchanged.** A verdict carrying a non-empty `risk_duty_demotions` array records a risk ruling the panel marked `pass: true` that a duty demoted: the evidence citation format (a mechanics claim with no adjacent `file:line`) or the ruling's missing `procedure`+`owner` (a verify-at-implement deferral). The plan carries **no defect** for it — the demoted ruling was `pass: true`, and the defect lives in grader-emit fields (the citation shape or the ruling's procedure/owner), not the plan body. So amend re-emits the artifact unchanged (only bump `last_updated`), exactly the "none fail" branch; it does **NOT** manufacture `risks:` edits for the demotion and does **NOT** invoke the two resolve moves of the failed-ruling hard rule below (which govern only `pass: false` rulings). The re-grade — with the evidence-duty prompt — addresses the citation format; the demotion is a signal to select the verdict, not a plan defect to fix.
|
|
48
|
+
- **Resolve a failed risk ruling, don't re-assert it.** When a grade/validate panel ruled a plan risk flag `fail`, amend may close it ONLY one of two ways: (a) **resolve-verified-against-code** — ground the mechanism against the cited `file:line` in the real code and fix the plan's `claim` to match verified reality (then re-grade confirms it); or (b) **attach `verify-at-implement`** — edit the risk flag to add a concrete `procedure` (named command/test) + `owner` phase that will discharge it. Never re-emit the risk as a bare, still-unverified mechanism assertion — the gate demotes an un-evidenced mechanics pass and rejects a procedure-less deferral, so a bare re-assertion just re-fails.
|
|
45
49
|
- **Surgical, not wholesale.** Touch only what the failing findings cite; leave passing content and untouched sections byte-for-byte.
|
|
46
50
|
- **Fix the artifact, never the repo.** Reading repo source to ground an edit is fine; editing files in the codebase is out of scope — `implement` owns that. **Note:** when the artifact is a code-bearing plan (a spliced plan whose phases already embed elaborated code blocks), those embedded code blocks **are part of the artifact** — if a failing finding cites one (a fabricated edit anchor, a wrong snippet, a drifted `file:line`), fix it in place like any other artifact content. The boundary is the repo working tree, not the plan's own fenced code.
|
|
47
51
|
- **Re-emit in place.** Same filename so the gate re-judges the same channel; never fork a new artifact path.
|
|
@@ -140,10 +140,8 @@ You are tasked with generating architecture guidance files for a brownfield proj
|
|
|
140
140
|
|
|
141
141
|
**Choosing question format:**
|
|
142
142
|
|
|
143
|
-
- **`ask_user_question` tool** —
|
|
143
|
+
- **`ask_user_question` tool** — use `ask_user_question` with 2-4 concrete hypotheses. State observed behavior, `file:line` evidence, impact, and the decision; the automatic `Type something.` row accepts unexpected detail.
|
|
144
144
|
|
|
145
|
-
- **Free-text with ❓ Question: prefix** — when the question is open-ended and options can't be predicted (discovery, "what am I missing?", corrections). Example:
|
|
146
|
-
"❓ Question: Integration scanner found no background job registration for this area. Is that expected, or is there async processing I'm not seeing?"
|
|
147
145
|
|
|
148
146
|
**Batching**: When you have 2-4 independent questions (answers don't depend on each other), you MAY batch them in a single `ask_user_question` call. Keep dependent questions sequential.
|
|
149
147
|
|
|
@@ -212,6 +210,7 @@ You are tasked with generating architecture guidance files for a brownfield proj
|
|
|
212
210
|
- Write each file to `.rpiv/guidance/{relative_path}/architecture.md`. For the root file, write to `.rpiv/guidance/architecture.md`. Create any intermediate directories that do not exist.
|
|
213
211
|
- Write ALL files at once using the Write tool
|
|
214
212
|
- Do NOT ask for confirmation before each file — batch mode
|
|
213
|
+
- **Record both forms of a formatter/auto-fixer.** Where the project has a formatter or auto-fixer, record BOTH its repo-wide form AND its path-scoped form (the invocation that rewrites only the paths it is given) in the `# Commands` table — phase-scoped verification depends on the scoped form being known, because a phase's `#### Automated Verification:` command must be write-scoped to that phase's own `files:` set.
|
|
215
214
|
- After writing, present a summary:
|
|
216
215
|
```
|
|
217
216
|
## Architecture Guidance Files Created
|
|
@@ -138,10 +138,8 @@ You are tasked with generating CLAUDE.md files across a brownfield project. You
|
|
|
138
138
|
|
|
139
139
|
**Choosing question format:**
|
|
140
140
|
|
|
141
|
-
- **`ask_user_question` tool** —
|
|
141
|
+
- **`ask_user_question` tool** — use `ask_user_question` with 2-4 concrete hypotheses. State observed behavior, `file:line` evidence, impact, and the decision; the automatic `Type something.` row accepts unexpected detail.
|
|
142
142
|
|
|
143
|
-
- **Free-text with ❓ Question: prefix** — when the question is open-ended and options can't be predicted (discovery, "what am I missing?", corrections). Example:
|
|
144
|
-
"❓ Question: Integration scanner found no background job registration for this area. Is that expected, or is there async processing I'm not seeing?"
|
|
145
143
|
|
|
146
144
|
**Batching**: When you have 2-4 independent questions (answers don't depend on each other), you MAY batch them in a single `ask_user_question` call. Keep dependent questions sequential.
|
|
147
145
|
|