@juicesharp/rpiv-pi 2.8.0 → 2.9.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/extensions/rpiv-core/agent-enablement.ts +164 -0
- package/extensions/rpiv-core/agents.ts +98 -12
- package/extensions/rpiv-core/built-in-workflows.ts +148 -26
- package/extensions/rpiv-core/built-ins/reconcile-directives.d.mts +29 -0
- package/extensions/rpiv-core/built-ins/reconcile-directives.mjs +338 -0
- package/extensions/rpiv-core/built-ins/reconcile.ts +88 -130
- package/extensions/rpiv-core/frontmatter.ts +22 -0
- package/extensions/rpiv-core/models-config.ts +86 -6
- package/extensions/rpiv-core/package-checks.ts +13 -0
- package/extensions/rpiv-core/workflow-execution-host.ts +3 -2
- package/package.json +2 -2
- package/skills/_shared/reconcile-lint.mjs +125 -0
- package/skills/elaborate/SKILL.md +3 -3
- package/skills/grade/SKILL.md +5 -5
- package/skills/implement/SKILL.md +17 -2
- package/skills/research/SKILL.md +1 -1
- package/skills/slice/SKILL.md +2 -2
- package/skills/synthesize/SKILL.md +1 -1
|
@@ -58,10 +58,12 @@ const _persistableLevelsMatchPiAi: _PersistableLevelsMatchPiAi = true;
|
|
|
58
58
|
* Background-lane concurrency cap fallback. The fail-soft default applied by
|
|
59
59
|
* `resolveMaxConcurrency` when `~/.config/rpiv-pi/models.json` is absent or
|
|
60
60
|
* carries no valid `maxConcurrency`. Rate limits, not CPU, are the real cap —
|
|
61
|
-
*
|
|
61
|
+
* 6 lanes clears the widest built-in fanout batch (the 5-dimension grade
|
|
62
|
+
* panel, which a cap of 4 split into a 4+1 second batch on every panel) with
|
|
63
|
+
* one lane of headroom; no rate-limit events were observed at 4. Re-exported from
|
|
62
64
|
* packages/rpiv-pi/extensions/rpiv-core/workflow-execution-host.ts to preserve the tested public surface.
|
|
63
65
|
*/
|
|
64
|
-
export const DEFAULT_MAX_CONCURRENCY =
|
|
66
|
+
export const DEFAULT_MAX_CONCURRENCY = 6;
|
|
65
67
|
|
|
66
68
|
// ---------------------------------------------------------------------------
|
|
67
69
|
// TypeBox schemas
|
|
@@ -106,6 +108,18 @@ const ModelEntrySchema = Type.Union(
|
|
|
106
108
|
}),
|
|
107
109
|
),
|
|
108
110
|
thinking: Type.Optional(ThinkingLevelSchema),
|
|
111
|
+
extensions: Type.Optional(
|
|
112
|
+
Type.Array(Type.String(), {
|
|
113
|
+
description:
|
|
114
|
+
"Sibling extension names the agent may load when installed (per-agent axis only — ignored in defaults)",
|
|
115
|
+
}),
|
|
116
|
+
),
|
|
117
|
+
tools: Type.Optional(
|
|
118
|
+
Type.Array(Type.String(), {
|
|
119
|
+
description:
|
|
120
|
+
"Tool selectors appended to the agent's tools frontmatter (per-agent axis only — ignored in defaults)",
|
|
121
|
+
}),
|
|
122
|
+
),
|
|
109
123
|
},
|
|
110
124
|
{ additionalProperties: false },
|
|
111
125
|
),
|
|
@@ -172,6 +186,10 @@ export interface ResolvedModelConfig {
|
|
|
172
186
|
model?: string;
|
|
173
187
|
/** Explicit level incl. "off" (disable). Absent ⇒ inherit session/baseline. */
|
|
174
188
|
thinking?: ModelThinkingLevelValue;
|
|
189
|
+
/** Sibling extensions the agent may load when installed (per-agent axis only). */
|
|
190
|
+
extensions?: string[];
|
|
191
|
+
/** Tool selectors appended to the agent's tools frontmatter (per-agent axis only). */
|
|
192
|
+
tools?: string[];
|
|
175
193
|
}
|
|
176
194
|
|
|
177
195
|
/** The resolved config shape returned by loadModelsConfig. */
|
|
@@ -189,6 +207,24 @@ export interface ModelsConfig {
|
|
|
189
207
|
// Helper — resolve a ModelEntry (string or object) to ResolvedModelConfig.
|
|
190
208
|
// ---------------------------------------------------------------------------
|
|
191
209
|
|
|
210
|
+
/**
|
|
211
|
+
* String-filter salvage for the agent-axis arrays, hardened against
|
|
212
|
+
* frontmatter-line injection: keeps strings, drops non-strings silently (the
|
|
213
|
+
* standing salvage contract), and drops any string carrying `\n`/`\r` with a
|
|
214
|
+
* console.warn naming the field — such an entry would smuggle extra physical
|
|
215
|
+
* lines into a synced agent's frontmatter (see the call-site comment).
|
|
216
|
+
*/
|
|
217
|
+
function filterFrontmatterSafeStrings(values: readonly unknown[], field: "tools" | "extensions"): string[] {
|
|
218
|
+
const strings = values.filter((v): v is string => typeof v === "string");
|
|
219
|
+
const safe = strings.filter((v) => !/[\r\n]/.test(v));
|
|
220
|
+
if (safe.length !== strings.length) {
|
|
221
|
+
console.warn(
|
|
222
|
+
`[rpiv-pi] models.json: dropped ${strings.length - safe.length} \`${field}\` entr${strings.length - safe.length === 1 ? "y" : "ies"} containing newline characters — a multi-line entry would inject frontmatter lines into synced agent definitions`,
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
return safe;
|
|
226
|
+
}
|
|
227
|
+
|
|
192
228
|
/** Resolve a raw ModelEntry value to a ResolvedModelConfig. */
|
|
193
229
|
function resolveModelEntry(entry: unknown): ResolvedModelConfig {
|
|
194
230
|
if (typeof entry === "string") {
|
|
@@ -209,6 +245,21 @@ function resolveModelEntry(entry: unknown): ResolvedModelConfig {
|
|
|
209
245
|
);
|
|
210
246
|
}
|
|
211
247
|
}
|
|
248
|
+
// Agent-axis fields: per-field string-filter salvage — an array value
|
|
249
|
+
// survives with non-string elements dropped (an explicit [] is meaningful:
|
|
250
|
+
// it suppresses the map default downstream); a non-array value drops the
|
|
251
|
+
// field entirely (falls back to map defaults). Entries carrying \n/\r are
|
|
252
|
+
// dropped LOUDLY: these strings land on one logical frontmatter line of
|
|
253
|
+
// ~/.pi/agent/agents/*.md, where an interior newline becomes a physical
|
|
254
|
+
// line the Pi runtime reads as agent capability config — a copy-paste
|
|
255
|
+
// artifact like "x\nisolated: false" would silently un-isolate an agent
|
|
256
|
+
// (review 2026-08-31 S1).
|
|
257
|
+
if (Array.isArray(obj.tools)) {
|
|
258
|
+
result.tools = filterFrontmatterSafeStrings(obj.tools, "tools");
|
|
259
|
+
}
|
|
260
|
+
if (Array.isArray(obj.extensions)) {
|
|
261
|
+
result.extensions = filterFrontmatterSafeStrings(obj.extensions, "extensions");
|
|
262
|
+
}
|
|
212
263
|
return result;
|
|
213
264
|
}
|
|
214
265
|
return {};
|
|
@@ -231,6 +282,29 @@ export function loadModelsConfig(): ModelsConfig {
|
|
|
231
282
|
const validated = validateConfig(ModelsConfigSchema, raw);
|
|
232
283
|
|
|
233
284
|
const defaults = resolvedEntry(validated.defaults);
|
|
285
|
+
// Agent-axis-only fields never cascade: strip them from `defaults` (one
|
|
286
|
+
// warn) so the {...defaults, ...resolved} cascade and the
|
|
287
|
+
// getAgentModelConfig defaults fallback cannot leak enablement to every
|
|
288
|
+
// configured agent.
|
|
289
|
+
if (defaults && (defaults.extensions !== undefined || defaults.tools !== undefined)) {
|
|
290
|
+
console.warn("[rpiv-pi] models.json: `extensions`/`tools` in `defaults` are ignored — they are per-agent fields");
|
|
291
|
+
delete defaults.extensions;
|
|
292
|
+
delete defaults.tools;
|
|
293
|
+
}
|
|
294
|
+
// The SAME strip on every other non-agents axis (review 2026-08-31 I3):
|
|
295
|
+
// the shared ModelEntrySchema admits `tools`/`extensions` everywhere, but
|
|
296
|
+
// only the agents-axis lookup consumes them — a stages/skills/preset entry
|
|
297
|
+
// carrying them passed validation and silently granted nothing. One warn
|
|
298
|
+
// per load, naming the offending axes.
|
|
299
|
+
const strippedAxes = new Set<string>();
|
|
300
|
+
const stripAgentAxisFields = (entry: ResolvedModelConfig, axis: string): ResolvedModelConfig => {
|
|
301
|
+
if (entry.extensions !== undefined || entry.tools !== undefined) {
|
|
302
|
+
strippedAxes.add(axis);
|
|
303
|
+
delete entry.extensions;
|
|
304
|
+
delete entry.tools;
|
|
305
|
+
}
|
|
306
|
+
return entry;
|
|
307
|
+
};
|
|
234
308
|
const agents: Record<string, ResolvedModelConfig> = {};
|
|
235
309
|
const stages: Record<string, ResolvedModelConfig> = {};
|
|
236
310
|
const skills: Record<string, ResolvedModelConfig> = {};
|
|
@@ -244,13 +318,13 @@ export function loadModelsConfig(): ModelsConfig {
|
|
|
244
318
|
|
|
245
319
|
if (validated.stages && typeof validated.stages === "object") {
|
|
246
320
|
for (const [name, entry] of Object.entries(validated.stages)) {
|
|
247
|
-
stages[name] = resolvedEntryWithCascade(entry, defaults);
|
|
321
|
+
stages[name] = stripAgentAxisFields(resolvedEntryWithCascade(entry, defaults), "stages");
|
|
248
322
|
}
|
|
249
323
|
}
|
|
250
324
|
|
|
251
325
|
if (validated.skills && typeof validated.skills === "object") {
|
|
252
326
|
for (const [name, entry] of Object.entries(validated.skills)) {
|
|
253
|
-
skills[name] = resolvedEntryWithCascade(entry, defaults);
|
|
327
|
+
skills[name] = stripAgentAxisFields(resolvedEntryWithCascade(entry, defaults), "skills");
|
|
254
328
|
}
|
|
255
329
|
}
|
|
256
330
|
|
|
@@ -260,7 +334,7 @@ export function loadModelsConfig(): ModelsConfig {
|
|
|
260
334
|
const presetStages: Record<string, ResolvedModelConfig> = {};
|
|
261
335
|
if (presetBlock.stages && typeof presetBlock.stages === "object") {
|
|
262
336
|
for (const [stageName, entry] of Object.entries(presetBlock.stages)) {
|
|
263
|
-
presetStages[stageName] = resolvedEntryWithCascade(entry, defaults);
|
|
337
|
+
presetStages[stageName] = stripAgentAxisFields(resolvedEntryWithCascade(entry, defaults), "presets");
|
|
264
338
|
}
|
|
265
339
|
}
|
|
266
340
|
if (Object.keys(presetStages).length > 0) {
|
|
@@ -269,6 +343,12 @@ export function loadModelsConfig(): ModelsConfig {
|
|
|
269
343
|
}
|
|
270
344
|
}
|
|
271
345
|
|
|
346
|
+
if (strippedAxes.size > 0) {
|
|
347
|
+
console.warn(
|
|
348
|
+
`[rpiv-pi] models.json: \`extensions\`/\`tools\` in ${[...strippedAxes].sort().join("/")} entries are ignored — they are per-agent fields (only \`agents.<name>\` consumes them)`,
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
|
|
272
352
|
const result: ModelsConfig = {
|
|
273
353
|
defaults,
|
|
274
354
|
agents: Object.keys(agents).length > 0 ? agents : undefined,
|
|
@@ -359,7 +439,7 @@ export function resolveStageModel(
|
|
|
359
439
|
|
|
360
440
|
/**
|
|
361
441
|
* Resolve the background-lane concurrency cap from `~/.config/rpiv-pi/models.json`.
|
|
362
|
-
* Returns `DEFAULT_MAX_CONCURRENCY` (
|
|
442
|
+
* Returns `DEFAULT_MAX_CONCURRENCY` (6) when the key is absent OR holds an invalid
|
|
363
443
|
* value (non-integer, < 1).
|
|
364
444
|
*
|
|
365
445
|
* NOTE: `Value.Clean` (typebox@1.3.6) does NOT strip invalid scalars — it only
|
|
@@ -17,3 +17,16 @@ export function findMissingSiblings(): SiblingPlugin[] {
|
|
|
17
17
|
const installed = result.packages.filter((e): e is string => typeof e === "string");
|
|
18
18
|
return SIBLINGS.filter((s) => !installed.some((entry) => s.matches.test(entry)));
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Return the SIBLINGS currently installed — the exact complement of
|
|
23
|
+
* findMissingSiblings over the same readPiAgentSettings() read. No settings
|
|
24
|
+
* file (or a packages array that isn't one) ⇒ [] — mirroring
|
|
25
|
+
* findMissingSiblings' all-missing fallback in the opposite direction.
|
|
26
|
+
*/
|
|
27
|
+
export function findInstalledSiblings(): SiblingPlugin[] {
|
|
28
|
+
const result = readPiAgentSettings();
|
|
29
|
+
if (!result) return [];
|
|
30
|
+
const installed = result.packages.filter((e): e is string => typeof e === "string");
|
|
31
|
+
return SIBLINGS.filter((s) => installed.some((entry) => s.matches.test(entry)));
|
|
32
|
+
}
|
|
@@ -97,7 +97,7 @@ export function createWorkflowExecution(
|
|
|
97
97
|
cwd: observer.cwd,
|
|
98
98
|
runId,
|
|
99
99
|
childSessionsDir, // resolved by the runner; rpiv-pi does not synthesize the path
|
|
100
|
-
maxConcurrency: resolveMaxConcurrency(loadModelsConfig()), // config-driven background-lane cap (default
|
|
100
|
+
maxConcurrency: resolveMaxConcurrency(loadModelsConfig()), // config-driven background-lane cap (default 6)
|
|
101
101
|
});
|
|
102
102
|
|
|
103
103
|
// Record this run as a switchable lane at launch (appears in the ambient
|
|
@@ -177,7 +177,8 @@ export async function registerWorkflowExecutionHostProvider(): Promise<void> {
|
|
|
177
177
|
const { registerWorkflowExecutionHost } = await import("@juicesharp/rpiv-workflow/startup");
|
|
178
178
|
registerWorkflowExecutionHost({
|
|
179
179
|
createHost: createWorkflowExecution,
|
|
180
|
-
resolveModel: ({ stage, skill }) =>
|
|
180
|
+
resolveModel: ({ workflow, stage, skill }) =>
|
|
181
|
+
toModelSelection(resolveStageModel(loadModelsConfig(), { workflow, stage, skill })),
|
|
181
182
|
// Death-scene reader — re-open the just-failed session's persisted JSONL
|
|
182
183
|
// and return its branch, narrowed to the workflow-owned BranchEntry shape
|
|
183
184
|
// (the SDK's SessionEntry union carries private discriminators — the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juicesharp/rpiv-pi",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "A skill-based development workflow for Pi Agent. 30 contract-carrying skills (discover → research → design → plan → implement → validate → code-review → commit, and more), the 15 named subagents they dispatch, and four built-in /wf workflows that chain them end to end in detached parallel runs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
]
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@juicesharp/rpiv-config": "^2.
|
|
53
|
+
"@juicesharp/rpiv-config": "^2.9.0",
|
|
54
54
|
"typebox": "^1.1.24"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Pre-flight lint for `#### Reconciliation` directives — the deterministic
|
|
4
|
+
* `reconcile` gate's own parser (reconcile-directives.mjs, the same module
|
|
5
|
+
* extensions/rpiv-core/built-ins/reconcile.ts imports) run in check-only mode,
|
|
6
|
+
* so a directive that lints clean here parses and applies cleanly at the gate.
|
|
7
|
+
* The implement skill runs this after recording a directive and before printing
|
|
8
|
+
* its closing block: every finding caught here is one `/skill:amend` repair
|
|
9
|
+
* session plus a gate re-entry that never happens.
|
|
10
|
+
*
|
|
11
|
+
* Usage: node reconcile-lint.mjs <plan.md> [--phase <N>] [--root <dir>]
|
|
12
|
+
*
|
|
13
|
+
* <plan.md> the plan artifact carrying the `#### Reconciliation` section(s)
|
|
14
|
+
* --phase <N> lint only the `## Phase N:` section's directives (an implement
|
|
15
|
+
* phase checks its OWN directives without tripping over a
|
|
16
|
+
* sibling's); the declared write-set is still read from the
|
|
17
|
+
* whole plan
|
|
18
|
+
* --root <dir> repo root the targets resolve against (default: cwd)
|
|
19
|
+
*
|
|
20
|
+
* Checks per directive, mirroring the gate's failure classes: grammar
|
|
21
|
+
* (malformed attempts), containment (target must resolve inside the root),
|
|
22
|
+
* eligibility (target must be in the plan's declared write-set — the union of
|
|
23
|
+
* every phase's `files:`, twin-expanded; best-effort frontmatter scan, the
|
|
24
|
+
* gate holds the authoritative YAML parse), and find-presence against the
|
|
25
|
+
* target's CURRENT bytes — with the gate's already-applied /
|
|
26
|
+
* deletion-satisfied tolerances, so a legitimately-applied directive never
|
|
27
|
+
* false-fails. Language-agnostic: eligibility derives from the plan's own
|
|
28
|
+
* declarations, never from a filename convention. Read-only: never writes.
|
|
29
|
+
*
|
|
30
|
+
* Exit codes: 0 = clean; 1 = findings (each printed on its own line);
|
|
31
|
+
* 2 = usage / unreadable plan.
|
|
32
|
+
*/
|
|
33
|
+
import { readFileSync } from "node:fs";
|
|
34
|
+
import { isAbsolute, relative, resolve } from "node:path";
|
|
35
|
+
import {
|
|
36
|
+
classifyApplication,
|
|
37
|
+
declaredWriteSet,
|
|
38
|
+
phaseSection,
|
|
39
|
+
reconciliationRecords,
|
|
40
|
+
} from "../../extensions/rpiv-core/built-ins/reconcile-directives.mjs";
|
|
41
|
+
|
|
42
|
+
const usage = () => {
|
|
43
|
+
console.error("usage: node reconcile-lint.mjs <plan.md> [--phase <N>] [--root <dir>]");
|
|
44
|
+
process.exit(2);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const args = process.argv.slice(2);
|
|
48
|
+
let planPath;
|
|
49
|
+
let phase;
|
|
50
|
+
let root = process.cwd();
|
|
51
|
+
for (let i = 0; i < args.length; i++) {
|
|
52
|
+
if (args[i] === "--phase") {
|
|
53
|
+
phase = args[++i];
|
|
54
|
+
if (phase === undefined) usage();
|
|
55
|
+
} else if (args[i] === "--root") {
|
|
56
|
+
root = args[++i];
|
|
57
|
+
if (root === undefined) usage();
|
|
58
|
+
} else if (planPath === undefined) {
|
|
59
|
+
planPath = args[i];
|
|
60
|
+
} else {
|
|
61
|
+
usage();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (planPath === undefined) usage();
|
|
65
|
+
|
|
66
|
+
let planBody;
|
|
67
|
+
try {
|
|
68
|
+
planBody = readFileSync(resolve(root, planPath), "utf-8");
|
|
69
|
+
} catch (err) {
|
|
70
|
+
console.error(`reconcile-lint: cannot read ${planPath} — ${err instanceof Error ? err.message : String(err)}`);
|
|
71
|
+
process.exit(2);
|
|
72
|
+
}
|
|
73
|
+
const declared = declaredWriteSet(planBody);
|
|
74
|
+
let scanBody = planBody;
|
|
75
|
+
if (phase !== undefined) {
|
|
76
|
+
const section = phaseSection(planBody, phase);
|
|
77
|
+
if (section === undefined) {
|
|
78
|
+
console.error(`reconcile-lint: no "## Phase ${phase}:" section in ${planPath}`);
|
|
79
|
+
process.exit(2);
|
|
80
|
+
}
|
|
81
|
+
scanBody = section;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const { directives, malformed } = reconciliationRecords(scanBody);
|
|
85
|
+
const findings = [];
|
|
86
|
+
for (const m of malformed) {
|
|
87
|
+
findings.push(
|
|
88
|
+
"malformed directive — use one list item: - `<target>`: replace `<find>` → `<replace>` — <rationale> " +
|
|
89
|
+
"(no inner backticks in the spans), or the fenced form (- `<target>`: replace — <rationale>, then a find: " +
|
|
90
|
+
`line + fenced block, then a replace: line + fenced block) for content with backticks — offending item: ${m}`,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
for (const d of directives) {
|
|
94
|
+
const abs = resolve(root, d.target);
|
|
95
|
+
const rel = relative(root, abs);
|
|
96
|
+
if (rel.startsWith("..") || isAbsolute(rel)) {
|
|
97
|
+
findings.push(`target ${d.target} resolves outside the working tree — use a repo-root-relative target`);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (!declared.has(d.target)) {
|
|
101
|
+
findings.push(
|
|
102
|
+
`target ${d.target} is not in the plan's declared write-set (the union of every phase's 'files:', twin-expanded) — the gate rejects undeclared targets; declare the file in the owning phase's 'files:' or route the edit through validate's remediation arm`,
|
|
103
|
+
);
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
let content;
|
|
107
|
+
try {
|
|
108
|
+
content = readFileSync(abs, "utf-8");
|
|
109
|
+
} catch {
|
|
110
|
+
findings.push(`target ${d.target} is unreadable — the gate will fail this directive; check the path`);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (classifyApplication(d, content) === "missing") {
|
|
114
|
+
findings.push(
|
|
115
|
+
`find substring not present in ${d.target} (and the replacement is absent) — Read the file and copy the find bytes verbatim; if the text carries backticks, use the fenced form`,
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (findings.length > 0) {
|
|
121
|
+
for (const f of findings) console.log(`reconcile-lint: ${f}`);
|
|
122
|
+
console.log(`reconcile-lint: FAIL — ${findings.length} finding(s) across ${directives.length} directive(s)`);
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
console.log(`reconcile-lint: OK — ${directives.length} directive(s), 0 findings`);
|
|
@@ -48,7 +48,7 @@ Copy values verbatim. `<iso>` is the first tab-separated field (use as `date`);
|
|
|
48
48
|
## Steps
|
|
49
49
|
|
|
50
50
|
1. **Read the plan fully** (no limit/offset). Note its `## Synthesis Notes` (the reconciled seams — conflict resolutions, shared locals, integration order) and locate the `## Phase N:` section you own: its `### Changes` (the files/symbols to touch) and its `### Success Criteria`. Skim the **other** phases' sections too — to know what they own and what interfaces they expose — but never implement them.
|
|
51
|
-
2. **Ground in the live code.** For every file the phase's `### Changes` names, Read/Grep the cited `path:line` in the **current** tree. The plan may have been written against a slightly older state — anchor the code you write to what is actually there now (signatures, imports, surrounding style).
|
|
51
|
+
2. **Ground in the live code.** For every file the phase's `### Changes` names, Read/Grep the cited `path:line` in the **current** tree. The plan may have been written against a slightly older state — anchor the code you write to what is actually there now (signatures, imports, surrounding style). Files owned by a **sibling phase** are the exception: never Read, Grep, or wait for them on disk — sibling lanes create them concurrently, so they may not exist yet, and an ENOENT on a sibling-owned path is expected, never a retry. Their interfaces come from the plan's Synthesis Notes and the sibling's phase section (Step 3).
|
|
52
52
|
3. **Write the code for this phase only.** For each file in the phase's Changes, emit a concrete, paste-ready code block: the full function/section to add, or the exact edit (enough that `implement` applies it without guessing). Match the surrounding code's conventions. Where the phase depends on a sibling phase's symbol, reference it by the shape the plan/Synthesis Notes already fixed — do not redefine it.
|
|
53
53
|
4. **Carry the success criteria.** Preserve the phase's `### Success Criteria` (Automated + Manual), tightening a check only if your code makes it more concrete. Do not drop or weaken a criterion.
|
|
54
54
|
5. **Resolve ambiguity yourself.** Decide from the plan, the Synthesis Notes, and the real code. This skill is **non-interactive** — if a genuine blocker can't be settled from those inputs, make the most defensible call, record it under `## Notes / Deferred`, and let the grade panel catch a bad call. Do **not** ask the user (N lanes run concurrently).
|
|
@@ -56,7 +56,7 @@ Copy values verbatim. `<iso>` is the first tab-separated field (use as `date`);
|
|
|
56
56
|
- **Snapshot.** Capture `git status --porcelain` BEFORE the probe (the byte-identical revert target).
|
|
57
57
|
- **Probe.** Apply each drafted code block via `Edit` at its REAL anchor position in the current file (not a speculative layout). New files named by the phase are written for the probe.
|
|
58
58
|
- **Verify, in order, attributing only write-scope errors.** Take the command vocabulary from the project's guidance `# Commands` table — never substitute a tool the project does not use:
|
|
59
|
-
1. The project's **read-only
|
|
59
|
+
1. The project's **read-only check, in the NARROWEST recorded form that covers write-scope** — the per-package/per-crate/per-module invocation from the `# Commands` table (e.g. `tsc -p <package>`, `cargo check -p <crate>`, `go build ./<pkg>/...`), falling back to the whole-tree form only when no scoped variant is recorded (N sibling lanes each running the whole-tree check concurrently is the fanout's single biggest compute cost): attribute ONLY errors whose file path is in `write-scope` (sibling units' in-flight edits surface as cross-file noise and are NOT yours to act on; revert past them). An unresolved reference to a sibling-owned symbol or file is **expected-unresolved** — not yours to fix, and never a reason to probe the tree for the sibling's files. Re-derive and fix drafted blocks from the attributed errors until clean. If the project records no such command, skip — the apply-at-anchor probe still validates placement.
|
|
60
60
|
2. The project's **path-scoped auto-fix lint/format command** (the scoped form from the `# Commands` table), passed ONLY the write-scope paths — it may rewrite only those. Never run an unscoped auto-fixer: it rewrites sibling phases' in-flight edits.
|
|
61
61
|
3. Any **project-specific invariant check** the guidance names for files in your write-scope (some projects register extra validators for load-bearing files) — run it as recorded there.
|
|
62
62
|
- **Revert.** `git restore <tracked write-scope files>` (undo in-place `Edit`s) and `rm -f <newly-created files>` (undo new-file `Write`s) so the tree returns to its pre-probe state. The mutation is a TRANSIENT, reverted probe — the emitted elaboration doc is the only lasting output (`implement` applies the code later, after the splice).
|
|
@@ -116,7 +116,7 @@ tags: [elaboration]
|
|
|
116
116
|
|
|
117
117
|
- **One phase only.** Never write code for a file another phase owns; reference its interfaces by the shape `synthesize` already fixed.
|
|
118
118
|
- **Implement-ready code, grounded in the current tree.** Read the cited files first; emit code blocks, not prose hand-waving ("handle appropriately", "etc.").
|
|
119
|
-
- **Repo-root-relative,
|
|
119
|
+
- **Repo-root-relative citations, from what you read.** Every `file:line` your elaboration emits — in prose or in code comments — uses the **repo-root-relative** path (`packages/billing/src/invoice.ts:NN`), never a subdirectory-relative form (`src/invoice.ts:NN`) or a bare basename, and comes from a file you actually read; if you're unsure of the line, cite the path alone and omit the `:line`.
|
|
120
120
|
- **Body is exactly one `## Phase N: <title>` section** with the verbatim heading — the deterministic splice folds it back by phase number. Don't rename the heading or change `N`.
|
|
121
121
|
- **Write the doc, not the code.** You only write your elaboration artifact; reading the codebase to ground the code is required, editing it is out of scope — `implement` applies the code later, after the splice. The Self-check step's tree mutation is the ONE exception: a transient, reverted probe that applies drafted blocks to verify them, then reverts byte-identical — it never leaves the edit for `implement` (the elaboration doc carries the code; the tree returns clean).
|
|
122
122
|
- **Byte-identical self-check revert (the sole parallel-safety contract).** The Self-check `git restore <tracked> + rm -f <new>` MUST return the tree to a `git status --porcelain` byte-identical pre-probe snapshot; any residue is a blocking error and the unit emits nothing. Under the parallel phase fanout a sibling unit's in-flight edit can surface as cross-file check noise — attribute ONLY errors in YOUR write-set and revert past the rest.
|
package/skills/grade/SKILL.md
CHANGED
|
@@ -68,14 +68,14 @@ You grade ONE artifact against ONE quality dimension and emit a verdict JSON. Yo
|
|
|
68
68
|
- `--goal <path>` *(optional)* — the user's original brief, captured verbatim at run start. **Read it only for `completeness` and `correctness`** — every other dimension ignores it. Absent, or the file is empty → grade the artifact on its own content as usual.
|
|
69
69
|
- `--acceptance <path>` *(optional, `completeness` only)* — the goal-derived acceptance inventory (`items:` frontmatter, ids `a1…`), frozen before planning. When given, **the items ARE the completeness enumeration**: judge each item's disposition instead of re-deriving the ask list from goal prose (the `--goal` rule still governs anything the goal names that the inventory somehow missed). Every other dimension ignores this flag. Missing or unreadable path → grade normally without it.
|
|
70
70
|
- `--prior <path>` *(optional)* — a prior round's verdict JSON for this same `(artifact, dimension)`, passed by a CONFIRM panel. Its presence puts you in **confirm mode** (see "Prior-round adjudication" below). If the path is missing or unreadable, grade normally without it — a stale prior is not a wiring error.
|
|
71
|
-
- `--cite-check <path>` *(optional, `correctness` only)* — the deterministic citation floor's verdict JSON for the same artifact.
|
|
71
|
+
- `--cite-check <path>` *(optional, `correctness` only)* — the deterministic citation floor's verdict JSON for the same artifact. Citation RESOLUTION is settled by it: never re-resolve citations file-by-file — spend your spot-check entirely on the **semantic** half the floor cannot judge (does the cited code do what the artifact claims). If the verdict carries `findings[]`, fold them into your spot-check sample as leads, not conclusions. Every other dimension ignores this flag; it never triggers confirm mode and never produces `finding_rulings`. Missing or unreadable path → grade normally without it (full mechanical + semantic spot-check).
|
|
72
72
|
|
|
73
73
|
**Plan-authored risk flags (the `correctness` dimension only).** When your `--dimension` is `correctness` and the `--artifact` carries a `risks:` frontmatter array (each `{ id, claim }`, described in the plan's `## Risk Flags` section), you are REQUIRED to rule on every flag — this is a first-class channel, not an optional prose aside. For each flag, verify its `claim` against the real codebase / the plan (Read/Grep the relevant `file:line`) and decide `pass` (the concern is unfounded or already handled) or `fail` (the risk is real and unaddressed). A `fail` ruling blocks the gate (the workflow folds these across the panel), so an assumption the plan flagged for review cannot ride a green pass into commit. Other dimensions ignore `risks:`.
|
|
74
74
|
|
|
75
75
|
Two duties tighten what a `pass` means, and the gate enforces both (an un-grounded `pass` is demoted as if it were `fail`):
|
|
76
76
|
|
|
77
77
|
- **Echo the flag's duty fields verbatim.** Copy `claim_type`, `disposition`, `procedure`, and `owner` from the plan's `risks:` entry into your ruling UNCHANGED. The duty itself is imposed by the plan's `risks:` frontmatter — the gate cross-references it by flag `id`, so dropping or mistyping `claim_type`/`disposition` in your ruling waives NOTHING: a mechanics `pass` is still demoted unless the ruling carries a `file:line` `evidence`, and a verify-at-implement `pass` is still demoted unless the ruling carries a concrete `procedure` and a numeric `owner`. Echo the fields anyway — the ruling stays self-describing for the audit trail and for `validate`, which runs the deferred `procedure` against the shipped code.
|
|
78
|
-
- **Mechanics evidence duty (`claim_type: mechanics`).** A mechanics risk ruled `pass` MUST cite the `file:line` you actually checked in the ruling's `evidence` (e.g. `"packages/x/y.ts:42 — the helper returns early on undefined"`). A mechanics `pass` with no `evidence`, or whose `evidence` is not `file:line`-shaped, is demoted to `fail` — the gate refuses a confident-but-ungrounded mechanism assertion (the honest-lazy class: a confident pass that never opened a file). **The adjacency rule — what "`file:line`-shaped" means:**
|
|
78
|
+
- **Mechanics evidence duty (`claim_type: mechanics`).** A mechanics risk ruled `pass` MUST cite the `file:line` you actually checked in the ruling's `evidence` (e.g. `"packages/x/y.ts:42 — the helper returns early on undefined"`). A mechanics `pass` with no `evidence`, or whose `evidence` is not `file:line`-shaped, is demoted to `fail` — the gate refuses a confident-but-ungrounded mechanism assertion (the honest-lazy class: a confident pass that never opened a file). **The adjacency rule — what "`file:line`-shaped" means:** at least one site in the `evidence` string must be a dotted file path with its line number IMMEDIATELY adjacent (`path.ext:NN`, colon-number directly after the extension, no space — e.g. `packages/x/y.ts:1168`). Make the FIRST cited site that shape; later refs in the same string may be abbreviated bare `:NN`. `symbol :NN`, a bare `(:NN/:NN)` list, or a path with no adjacent `:NN` anywhere all fail the rule and demote the ruling. Rule `fail` outright if the mechanism does not hold.
|
|
79
79
|
- **Verify-at-implement rule (`disposition: verify-at-implement`).** You may defer a risk to the owner phase instead of ruling it finally here. Rule `pass` ONLY when the flag carries a concrete `procedure` (the named command/test the owner phase runs) AND a numeric `owner` phase AND you judge that phase actually carries that step; otherwise rule `fail` (a bare "verify later" with no procedure does not defer — it fails). When you defer, echo `procedure` and `owner` verbatim so `validate` can run the procedure against the shipped code.
|
|
80
80
|
|
|
81
81
|
Emit these as a `risk_rulings: [{ id, pass, evidence?, claim_type?, disposition?, procedure?, owner? }]` array in your verdict — one ruling per declared flag, none omitted. `evidence` is REQUIRED on a mechanics `pass` (and must be `file:line`-shaped); `claim_type`/`disposition`/`procedure`/`owner` are echoed whenever the plan flag carries them.
|
|
@@ -117,10 +117,10 @@ Grade against the row matching `--dimension`. "Pass bar" is the line; meet it
|
|
|
117
117
|
1. **Parse + validate flags.** Bail per the Input rules above if malformed.
|
|
118
118
|
2. **Read fully** (no limit/offset): `--artifact`, and `--context` / `--goal` / `--acceptance` / `--prior` / `--cite-check` if given (skip `--goal` unless your dimension is `completeness` or `correctness`; skip `--acceptance` unless your dimension is `completeness`; skip `--cite-check` unless your dimension is `correctness`).
|
|
119
119
|
3. **Select the single rubric row** for `--dimension`. Ignore every problem outside it.
|
|
120
|
-
4. **Evaluate.** For `correctness` / `architecture-fit` / `pattern-following` / `design-readiness`, spot-check against the real codebase — resolve references, compare conventions, check boundaries, expand each slice's true touch + dependency fan-out from its cited seeds to gauge whether the footing is bounded AND complete, and check each shared contract has a single owning slice. **Citation-resolution rule:
|
|
121
|
-
5. **Decide** `pass` (against the pass bar), `score` (0–100), `severity` (`none` | `low` | `medium` | `high` = the worst finding), and `feedback`. **`severity` is gate-load-bearing: the workflow treats any verdict whose worst finding is `low`/`none` as passing, even on `pass: false`, and only a `medium`+ finding blocks the gate.** So set `severity` to honestly reflect blocking weight — `low`/`none` for a cosmetic nit (a stylistic phrasing, a naming quibble that doesn't change behavior
|
|
120
|
+
4. **Evaluate.** For `correctness` / `architecture-fit` / `pattern-following` / `design-readiness`, spot-check against the real codebase — resolve references, compare conventions, check boundaries, expand each slice's true touch + dependency fan-out from its cited seeds to gauge whether the footing is bounded AND complete, and check each shared contract has a single owning slice. **Citation-resolution rule: citations are navigation hints — locate by symbol, not exact line. Line drift is NEVER a finding, at any severity; do not report or mention it. The only citation findings that exist: the file does not exist, the named symbol/content does not exist in it, or the code does not do what the artifact claims it does.** For `completeness` / `actionability`, judge the artifact's own content. **On `correctness`, also rule every plan-authored risk flag** (see "Plan-authored risk flags" above) — verify each `risks:` claim against the code and record a `risk_rulings` entry. **On `correctness` with `--cite-check`, resolution is settled by the floor — sample citations only for the semantic claim, folding the floor's findings into your sample.** **With `--prior`, also adjudicate every prior finding** (see "Prior-round adjudication" above) — verify each against artifact + code and record a `finding_rulings` entry. Collect findings — each is `{ detail, where }` (`where` = `path:line` or a section heading; for slice dimensions, cite the offending `## Slice N`). Where a `design-readiness` finding fires, the `feedback` must name the exact re-cut (which slice to split and along which seam, which under-cited grounding to add, or which overlap to separate) so the re-slice can act on it.
|
|
121
|
+
5. **Decide** `pass` (against the pass bar), `score` (0–100), `severity` (`none` | `low` | `medium` | `high` = the worst finding), and `feedback`. **`severity` is gate-load-bearing: the workflow treats any verdict whose worst finding is `low`/`none` as passing, even on `pass: false`, and only a `medium`+ finding blocks the gate.** So set `severity` to honestly reflect blocking weight — `low`/`none` for a cosmetic nit (a stylistic phrasing, a naming quibble that doesn't change behavior), `medium`+ for a finding a downstream stage genuinely cannot proceed past (a cited file or symbol that does not exist, a missing step, an executable edit that would fail as written, a boundary violation), **or for a claim about behavior you verified is false that sits in text the implementer copies verbatim (a code block, JSDoc, or comment) — behavior that happens to be correct anyway does not make it a nit; the shipped false claim is itself the defect**. Do **not** mark a real blocker `low` to be lenient, and do **not** mark a cosmetic nit `medium`+ to force a re-run — the gate reads `severity`, so mis-rating it either ships a defect or stalls the loop. **Every string you emit (`feedback` and each `findings[].detail` / `where`) MUST be JSON-safe: a single line, no literal newlines or tabs, no backticks or code fences, double-quotes escaped as `\"`. Put `path:line` citations in `findings[].where` — never paste code snippets into `feedback`.**
|
|
122
122
|
- `pass: false` → `feedback` is a **surgical, concrete instruction set** telling `amend` exactly what to change to clear this dimension, citing `where`. This field is the only thing `amend` reads — make it sufficient but concise (≤ ~500 chars; lean on `findings[]` for specifics).
|
|
123
|
-
- `pass: false` on `design-readiness` where **every** finding's remedy is pure citation bookkeeping — add a named seed to a slice's `Draws on`, or move a named item to `Out of scope`, with **no** split/merge/renumber/re-fence needed: additionally emit top-level `"remedy": "cite"` and give **each** finding a `"requires": "<path>:<lines>"` naming the exact seed. The slice gate then verifies deterministically that the re-cut map satisfies every finding with the slice structure unchanged, and skips the re-grade panel. Emit `remedy` ONLY when those citation edits alone would flip your verdict to pass — any structural doubt, or any finding without a concrete `requires` seed, → omit it and the normal re-grade runs.
|
|
123
|
+
- `pass: false` on `design-readiness` where **every** finding's remedy is pure citation bookkeeping — add a named seed to a slice's `Draws on`, or move a named item to `Out of scope`, with **no** split/merge/renumber/re-fence needed: additionally emit top-level `"remedy": "cite"` and give **each** finding a `"requires": "<path>:<lines>"` naming the exact seed. The slice gate then verifies deterministically that the re-cut map satisfies every finding with the slice structure unchanged, and skips the re-grade panel. Emit `remedy` ONLY when those citation edits alone would flip your verdict to pass — any structural doubt, or any finding without a concrete `requires` seed, → omit it and the normal re-grade runs.
|
|
124
124
|
- `pass: true` → `feedback` is **one short sentence, or empty** — never a multi-sentence essay. A long free-text value on a pass is pure JSON-malform risk with no consumer.
|
|
125
125
|
6. **Write the verdict** with the Write tool to `.rpiv/artifacts/verdicts/<artifact-basename-without-ext>__<dimension>__<slug>.json` (`<slug>` from the Metadata block). Do **not** overwrite a prior round's verdict for this `(artifact, dimension)` pair — the round-distinct `<slug>` preserves each round's findings, so the round-1 findings that drove a fix stay in the trail instead of being clobbered by round 4. The panel folds by latest-per-dimension, so the newest round still decides the gate. **Always write it, even on pass** — the panel collects this file to score the gate. **Emit machine-valid JSON only**: every string single-line with quotes escaped, no literal newlines, no backticks/code fences, no raw control characters. **After writing, re-read the file and confirm it parses as JSON; if it doesn't (an unescaped quote, a stray comma, a code fence in a value), rewrite it minimally until it parses.**
|
|
126
126
|
7. **Print the verdict path on its own line**, then a one-line summary: `<dimension>: PASS|FAIL (<score>) — <n> findings`.
|
|
@@ -35,12 +35,27 @@ Rules:
|
|
|
35
35
|
- **Never silently defer your phase's own edits.** Apply every change the named phase owns, or fail. A phase that writes a partial slice and checks off nothing is worse than a clean failure.
|
|
36
36
|
- **Repo-located scratch lives under `.rpiv/tmp/`, nowhere else.** Any file you create that is not in your phase's `files:` — a probe script, a fixture, a captured payload — goes under `.rpiv/tmp/` (exempt from the workflow's scope floor) or outside the repo entirely. The floor counts **untracked** files too (`git status -uall`): a scratch file left at the repo root or in an undeclared directory is an undeclared write the downstream `implement-scope-check` flags. Delete repo-located scratch when you're done with it regardless.
|
|
37
37
|
- Do not read, edit, or check off other phases' sections. Stop and print the closing block as soon as the named phase's own success criteria pass.
|
|
38
|
-
- **Record a `#### Reconciliation` directive for cross-phase test updates you can't apply yourself.** Under build/vet's parallel implement lane, a correct change in YOUR phase can invalidate a test expectation that lives in a SIBLING phase's landed section — and single-phase mode forbids editing another phase's files. Do NOT edit the sibling's file and do NOT silently skip it: record a `#### Reconciliation` directive in your OWN phase's section. The directive is a machine-findable, machine-applicable `find → replace` against a single repo-root-relative
|
|
38
|
+
- **Record a `#### Reconciliation` directive for cross-phase test updates you can't apply yourself.** Under build/vet's parallel implement lane, a correct change in YOUR phase can invalidate a test expectation that lives in a SIBLING phase's landed section — and single-phase mode forbids editing another phase's files. Do NOT edit the sibling's file and do NOT silently skip it: record a `#### Reconciliation` directive in your OWN phase's section. The directive is a machine-findable, machine-applicable `find → replace` against a single repo-root-relative target, so the downstream `reconcile` stage can apply it write-restricted to the plan's declared write-set:
|
|
39
39
|
```
|
|
40
40
|
#### Reconciliation
|
|
41
41
|
- `path/to/x.test.ts`: replace `expect(r).toBe(3)` → `expect(r).toBe(4)` — <one-line rationale>
|
|
42
42
|
```
|
|
43
|
-
The
|
|
43
|
+
The `find`/`replace` spans may span multiple lines, but must carry **no inner backticks** — the spans are backtick-delimited, so a snippet containing a backtick (a template literal, markdown-in-a-test) is inexpressible in this form. For such content use the **fenced form**: the same `- `<target>`: replace — <rationale>` header with NO inline spans, followed by a `find:` line + a fenced code block, then a `replace:` line + a fenced code block (indent the blocks under the list item; the fence line's own indentation is stripped from the captured content):
|
|
44
|
+
````
|
|
45
|
+
#### Reconciliation
|
|
46
|
+
- `path/to/x.test.ts`: replace — <one-line rationale>
|
|
47
|
+
find:
|
|
48
|
+
```
|
|
49
|
+
const s = `a ${b} c`;
|
|
50
|
+
```
|
|
51
|
+
replace:
|
|
52
|
+
```
|
|
53
|
+
const s = `a ${b} c d`;
|
|
54
|
+
```
|
|
55
|
+
````
|
|
56
|
+
The target MUST be in the plan's declared write-set — the union of every phase's `files:`, twin-expanded (`x.ts` licenses `x.test.ts`) — the same authority the scope floor enforces; eligibility is plan-derived, never a filename convention, so any language's test or expectation file qualifies once declared. `reconcile` rejects (and reports) a directive against an undeclared path — route such an edit through validate's remediation arm or the owning phase. Record directives only for MECHANICAL expectation/consistency updates you can state concretely; a real logic change in a sibling's files is plan-level work (`/skill:revise`), not a reconciliation directive.
|
|
57
|
+
|
|
58
|
+
When you record one: Read the target file first and copy the `find` bytes verbatim from its live content (never from memory — `reconcile` matches raw bytes and does not guess); any backtick in a span forces the fenced form (the inline grammar cannot express it). Then verify with `node "${SKILL_DIR}/../_shared/reconcile-lint.mjs" <plan-path> --phase <N>` — the gate's own parser in check-only mode — and fix every finding it prints before your closing block. Each defect the lint catches is one amend session and a gate fix round that never happens.
|
|
44
59
|
- If no phase is named → **sequential full-plan mode:** implement every phase in the plan sequentially.
|
|
45
60
|
- If the input is empty or the plan path is missing/literal, ask the user for the plan path before proceeding.
|
|
46
61
|
|
package/skills/research/SKILL.md
CHANGED
|
@@ -163,7 +163,7 @@ Before compiling, emit:
|
|
|
163
163
|
- Prioritize live codebase findings as primary source of truth
|
|
164
164
|
- Use `.rpiv/artifacts/` findings as supplementary historical context
|
|
165
165
|
- Include specific file paths and line numbers
|
|
166
|
-
- **
|
|
166
|
+
- **Cite what you actually read.** Every `file:line` comes from a file you opened in this session — never a remembered or guessed range; if you're unsure of the line, cite the path alone and omit the `:line`. Write paths **relative to the repo root** (`packages/billing/src/invoice.ts:NN` — not the subdirectory-relative `src/invoice.ts:NN`, nor the bare `invoice.ts:NN`) — downstream artifacts inherit your citation form. No separate verification pass: citations are compressed addresses for the next stage, and a consumer that finds one drifted locates the symbol itself.
|
|
167
167
|
- Build Code References as jump-table entries for the planner, not narrative (file:startLine-endLine format)
|
|
168
168
|
- No multi-line code blocks (>3 lines) — use file:line refs + prose. No implementation recipes — facts only.
|
|
169
169
|
- No artifact summaries — link plans/designs in Historical Context, don't summarize their contents. Research describes current codebase state.
|
package/skills/slice/SKILL.md
CHANGED
|
@@ -90,7 +90,7 @@ A vertical slice is a coherent, independently-buildable capability that cuts thr
|
|
|
90
90
|
## Steps
|
|
91
91
|
|
|
92
92
|
1. **Input.** Read the research path FULLY (no limit/offset) and read the key source files it cites — these are your grounding. A missing, empty, or non-research argument is a dispatch error: print an error and stop (the workflow runs `research` before `slice`, so a research artifact is always available).
|
|
93
|
-
2. **Decompose.** Identify the capabilities the work delivers, then group them into independent vertical slices by **mechanism, not by location** — a shared package, file, or subsystem is never itself a reason to group two units; one mechanism may claim many coverage units, or one, and unit count is not the test. First enumerate the brief's **coverage units** — the distinct observable outcomes it asks for, each with a short stable `id` (`c1`, `c2`, …) and a one-line `brief` — then assign every unit to the slice(s) that deliver it via each slice's `covers:`, so every unit is claimed by at least one slice. Every slice's `Draws on:` cites a real `file:line` from the research read in Step 1 — write the **repo-root-relative path** (`packages/billing/src/invoice.ts:NN`), never a subdirectory-relative form (`src/invoice.ts:NN`) or a bare basename (`invoice.ts:NN`)
|
|
93
|
+
2. **Decompose.** Identify the capabilities the work delivers, then group them into independent vertical slices by **mechanism, not by location** — a shared package, file, or subsystem is never itself a reason to group two units; one mechanism may claim many coverage units, or one, and unit count is not the test. First enumerate the brief's **coverage units** — the distinct observable outcomes it asks for, each with a short stable `id` (`c1`, `c2`, …) and a one-line `brief` — then assign every unit to the slice(s) that deliver it via each slice's `covers:`, so every unit is claimed by at least one slice. Every slice's `Draws on:` cites a real `file:line` from the research read in Step 1 — write the **repo-root-relative path** (`packages/billing/src/invoice.ts:NN`), never a subdirectory-relative form (`src/invoice.ts:NN`) or a bare basename (`invoice.ts:NN`).
|
|
94
94
|
3. **Resolve ambiguity.** Settle from the research/code wherever you can. When a genuine decomposition fork remains (e.g. "is this finding in scope for the brief, or deferred?"), use `ask_user_question` with 2–4 concrete options — **one at a time**, wait for the answer. **Granularity is not such a fork** — how finely to cut is settled by the `design-readiness` rubric, not by the developer; never offer "N vs M slices" options.
|
|
95
95
|
4. **Confirm the decomposition.** Once, before writing: `ask_user_question` — "{N} slices for {topic}. Slice 1: {name}. Slices 2–N: {brief}. Approve?". Header "Slices". Options: "Approve (Recommended)" (write the map); "Adjust slices" (reorder/merge/split); "Change scope" (add/remove). Apply the answer, then write.
|
|
96
96
|
- `Header` is capped at ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
@@ -108,7 +108,7 @@ You are re-cutting an existing slice map from its verdicts. Unlike a surgical re
|
|
|
108
108
|
- **dropped coverage unit** (from `--slice-check`) → re-attach its `id` to the `covers:` of whichever slice now delivers it; never resolve this by deleting the unit.
|
|
109
109
|
- **unbacked `file:line` citation** (from `--slice-check`) → correct the `Draws on:` reference to a real **repo-root-relative** `file:line` (not a bare basename), or drop the line numbers; never leave a fabricated citation.
|
|
110
110
|
3. **Rebuild the invariants** — renumber `n` contiguously `1..N`, recompute `slice_count`, fix `deps`, carry `coverage:` forward verbatim and reassign `covers:` so the union still claims every unit, and keep exactly one `## Slice N:` heading per entry.
|
|
111
|
-
4. **Re-emit** the slice map (same Output shape, `status: ready`). **Non-interactive**: the verdict feedback IS the instruction — no confirm step, no `ask_user_question`. If you add a revision note
|
|
111
|
+
4. **Re-emit** the slice map (same Output shape, `status: ready`). **Non-interactive**: the verdict feedback IS the instruction — no confirm step, no `ask_user_question`. If you add a revision note quoting a replaced citation, write it as an `old→new` arrow pair (e.g. `` `:3699→:3721` ``) or inside a fenced code block, never bare in prose.
|
|
112
112
|
5. **Print** the path, then `re-sliced: <N> slices (was <M>) — addressed <failing dimensions>`.
|
|
113
113
|
|
|
114
114
|
## Output document
|
|
@@ -151,7 +151,7 @@ tags: [plan, synthesized]
|
|
|
151
151
|
## Phase 1: <title>
|
|
152
152
|
### Changes
|
|
153
153
|
- `path/to/file.ts` — <what to do>
|
|
154
|
-
<!-- Every `file:line` uses the repo-root-relative path, never a subdirectory-relative form or a bare basename
|
|
154
|
+
<!-- Every `file:line` uses the repo-root-relative path, never a subdirectory-relative form or a bare basename. -->
|
|
155
155
|
|
|
156
156
|
### Success Criteria
|
|
157
157
|
#### Automated Verification:
|