@juicesharp/rpiv-pi 2.7.1 → 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/README.md +2 -2
- package/docs/architecture.md +3 -3
- package/docs/skills.md +8 -6
- package/docs/workflows.md +3 -3
- 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 +373 -142
- package/extensions/rpiv-core/built-ins/gates.ts +38 -15
- package/extensions/rpiv-core/built-ins/goal-baseline.ts +43 -1
- package/extensions/rpiv-core/built-ins/grade-panel.ts +98 -29
- package/extensions/rpiv-core/built-ins/index.ts +1 -0
- package/extensions/rpiv-core/built-ins/priors.ts +208 -38
- 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/built-ins/slices.ts +5 -1
- package/extensions/rpiv-core/frontmatter.ts +22 -0
- package/extensions/rpiv-core/lane-relay-ui.ts +25 -1
- package/extensions/rpiv-core/models-config.ts +86 -6
- package/extensions/rpiv-core/outcome-derivation.ts +1 -0
- package/extensions/rpiv-core/package-checks.ts +13 -0
- package/extensions/rpiv-core/pipeline-pointer.ts +1 -1
- package/extensions/rpiv-core/workflow-execution-host.ts +3 -2
- package/package.json +3 -3
- package/skills/_shared/reconcile-lint.mjs +125 -0
- package/skills/acceptance/SKILL.md +123 -0
- package/skills/elaborate/SKILL.md +3 -3
- package/skills/grade/SKILL.md +8 -7
- package/skills/implement/SKILL.md +17 -2
- package/skills/quick-plan/SKILL.md +19 -2
- package/skills/research/SKILL.md +28 -1
- package/skills/slice/SKILL.md +4 -4
- package/skills/synthesize/SKILL.md +1 -1
- package/skills/validate/SKILL.md +11 -5
|
@@ -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`);
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: acceptance
|
|
3
|
+
description: "Derive an executable acceptance inventory from the verbatim goal — the ID'd observable outcomes the finished work must exhibit, each with a runnable evidence command where one can be derived — and write it to .rpiv/artifacts/acceptance/ in one non-interactive pass. Authored BEFORE any plan exists so the standard of completion cannot inherit the plan's scope: the plan later addresses or explicitly defers each item, the grade panel's completeness dimension anchors on the inventory, and validate executes the evidence commands against the finished tree. Dispatched by the ship and build presets between research and planning."
|
|
4
|
+
argument-hint: "--goal <path> [--research <path>]"
|
|
5
|
+
shell-timeout: 10
|
|
6
|
+
disable-model-invocation: true
|
|
7
|
+
contract:
|
|
8
|
+
produces:
|
|
9
|
+
kind: produces
|
|
10
|
+
meta:
|
|
11
|
+
artifactKind: acceptance
|
|
12
|
+
data:
|
|
13
|
+
type: object
|
|
14
|
+
required: [items, item_count]
|
|
15
|
+
properties:
|
|
16
|
+
status:
|
|
17
|
+
enum: [ready]
|
|
18
|
+
item_count:
|
|
19
|
+
type: integer
|
|
20
|
+
minimum: 1
|
|
21
|
+
maximum: 24
|
|
22
|
+
items:
|
|
23
|
+
type: array
|
|
24
|
+
minItems: 1
|
|
25
|
+
maxItems: 24
|
|
26
|
+
items:
|
|
27
|
+
type: object
|
|
28
|
+
required: [id, statement]
|
|
29
|
+
properties:
|
|
30
|
+
id: { type: string }
|
|
31
|
+
statement: { type: string }
|
|
32
|
+
command: { type: string }
|
|
33
|
+
expect: { type: string }
|
|
34
|
+
manual: { type: string }
|
|
35
|
+
consumes:
|
|
36
|
+
meta:
|
|
37
|
+
artifactKind: [research]
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
# Acceptance
|
|
41
|
+
|
|
42
|
+
You derive an **acceptance inventory** from the verbatim goal: the distinct observable outcomes the finished work must exhibit, each with a short stable id (`a1`, `a2`, …) and — wherever one can be derived — a **runnable evidence command** that will exit 0 once the outcome holds. One non-interactive pass, one Write. You do **not** plan, design, or judge feasibility — the inventory is the measure the later stages answer to, not a plan of how to get there.
|
|
43
|
+
|
|
44
|
+
The inventory exists to keep the standard of completion independent of the work: it is authored before any plan, from the goal alone, so a plan that silently narrows the brief is caught against enumerated items instead of prose re-reading. Downstream: the planner addresses or explicitly defers each item, the grade panel's completeness dimension receives the inventory as `--acceptance`, and validate runs the evidence commands against the finished tree — a failed item with a runnable command becomes a structured, remediable blocker.
|
|
45
|
+
|
|
46
|
+
## Input
|
|
47
|
+
|
|
48
|
+
`$ARGUMENTS` — flags (order-independent):
|
|
49
|
+
|
|
50
|
+
- `--goal <path>` (**required**) — the verbatim brief. Read it FULLY (no limit/offset). Missing/empty ⇒ print an error and stop — a dispatch error (the workflow runs `goal` before `acceptance`).
|
|
51
|
+
- `--research <path>` (optional) — the grounding doc. Read it FULLY. Research grounds only the **evidence procedures** (which command, which test path, which grep target); it NEVER adds, drops, or narrows items — the item set derives from the goal alone.
|
|
52
|
+
|
|
53
|
+
## Metadata
|
|
54
|
+
|
|
55
|
+
```!
|
|
56
|
+
node "${SKILL_DIR}/../_shared/now.mjs"
|
|
57
|
+
echo
|
|
58
|
+
node "${SKILL_DIR}/../_shared/git-context.mjs"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Copy values verbatim. `<iso>` is the first tab-separated field (use as `date:`); `<slug>` is the second.
|
|
62
|
+
|
|
63
|
+
## What an item is
|
|
64
|
+
|
|
65
|
+
An acceptance item is one **observable outcome** the goal asks for — behavior a reader could check on the finished tree, not an implementation step. Good items are:
|
|
66
|
+
|
|
67
|
+
- **Goal-traceable** — the `statement` restates one explicit ask (or explicit constraint) from the goal in one line; quote or closely paraphrase the goal's own words. Never invent scope the goal doesn't name (the graders' anti-scope-inflation rule applies here first).
|
|
68
|
+
- **Observable** — phrased as a checkable end state ("`/wf ship` halts at the grade gate with a route note"), never as activity ("implement the gate").
|
|
69
|
+
- **Singular** — one outcome per item; a goal sentence naming two outcomes yields two items.
|
|
70
|
+
- **Right-sized set** — typically 3–12 items; every explicit ask is covered, and nothing is padded. A one-line goal may legitimately yield a single item. The schema's hard ceiling is 24 — deliberately tighter than the plan/slice family's 32, because an inventory that large is re-litigating scope, not enumerating a brief; a goal genuinely that broad belongs in `build`'s slice decomposition, with each slice's asks staying items here only at the observable-outcome grain.
|
|
71
|
+
|
|
72
|
+
Evidence, per item — exactly one of:
|
|
73
|
+
|
|
74
|
+
- `command` + `expect` — a **read-only, self-contained, repo-root-relative** command expected to exit 0 once the outcome holds (a test invocation, a grep invariant, a `tsc --noEmit`, a file-existence check), with `expect` naming the observable in one line. Ground it in the research/tree so paths and script names are real. It is **future-tense**: it may (and usually will) fail on today's tree — validate runs it after implement.
|
|
75
|
+
- `manual` — a one-line human procedure, ONLY when no read-only command can measure the outcome (visual appearance, real-terminal behavior). Prefer a command whenever one exists; a `manual` item is homework validate can record but not discharge.
|
|
76
|
+
|
|
77
|
+
## Flow
|
|
78
|
+
|
|
79
|
+
1. Read goal (+research) → 2. Enumerate items → 3. Attach evidence → 4. Write (`status: ready`)
|
|
80
|
+
|
|
81
|
+
## Steps
|
|
82
|
+
|
|
83
|
+
1. **Read.** The goal FULLY — it is the sole source of items. The research doc FULLY when given — it is the sole *grounding* for evidence commands (test layouts, script names, conventions). Spot-check any path a command will cite against the real tree.
|
|
84
|
+
2. **Enumerate.** Walk the goal sentence by sentence and extract every explicit ask and explicit constraint as an item (`a1`, `a2`, … in goal order). Ambiguity is resolved toward the goal's own words — restate, don't interpret. Do NOT consult the research for what belongs in the set: a research doc that narrowed the brief must not narrow the inventory.
|
|
85
|
+
3. **Attach evidence.** For each item, derive the strongest read-only command the tree supports and one `expect` line; fall back to `manual` only when nothing runnable can measure it. Never write a command that mutates the tree, reaches the network, or depends on state outside the repo.
|
|
86
|
+
4. **Write** the inventory in one pass to `.rpiv/artifacts/acceptance/<slug>_<description>.md` (`<description>` a brief kebab-case task summary), `status: ready` directly. Then print the path and `acceptance written: {N} item(s), {M} executable`.
|
|
87
|
+
|
|
88
|
+
Use this template:
|
|
89
|
+
|
|
90
|
+
```markdown
|
|
91
|
+
---
|
|
92
|
+
date: {<iso> from Metadata block}
|
|
93
|
+
topic: "{task name}"
|
|
94
|
+
tags: [acceptance]
|
|
95
|
+
status: ready
|
|
96
|
+
item_count: {N}
|
|
97
|
+
items:
|
|
98
|
+
- { id: a1, statement: "{one-line observable outcome}", command: "{read-only command}", expect: "{what exit 0 shows}" }
|
|
99
|
+
- { id: a2, statement: "{one-line observable outcome}", manual: "{one-line human procedure}" }
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
# Acceptance Inventory: {Task Name}
|
|
103
|
+
|
|
104
|
+
Derived from the verbatim goal ({goal path}). Items enumerate the goal's explicit asks; evidence commands are future-tense — run by validate against the finished tree.
|
|
105
|
+
|
|
106
|
+
## Items
|
|
107
|
+
|
|
108
|
+
### a1: {statement}
|
|
109
|
+
**Evidence**: `{command}` — {expect}
|
|
110
|
+
|
|
111
|
+
### a2: {statement}
|
|
112
|
+
**Evidence (manual)**: {procedure}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Important Notes
|
|
116
|
+
|
|
117
|
+
- **Consistently counted, always.** `item_count` == `items:` array length == the number of `### aN:` sections — the `phase_count`/`slice_count` discipline, applied here. Ids run `a1…aN` with no gaps or duplicates.
|
|
118
|
+
- **Items from the goal ALONE.** Research grounds evidence, never membership — the whole point of this stage is a standard the later narrowing cannot rewrite. If the goal names an ask the research argues against, the item still exists; the PLAN defers it legibly.
|
|
119
|
+
- **The inventory is frozen.** No downstream stage re-emits on the acceptance channel; deferral happens in the plan (visibly, per item id), never by editing this artifact.
|
|
120
|
+
- **Read-only, self-contained commands.** Validate runs them as written after implement — a command that mutates the tree or depends on external state corrupts the very measurement it exists to make.
|
|
121
|
+
- **Future-tense evidence.** Do not run the commands here and do not weaken one because it fails today — failing today is the expected state of a check on unbuilt work.
|
|
122
|
+
- **Non-interactive.** No `ask_user_question`, no subagents. Resolve ambiguity toward the goal's own words; the grade panel adjudicates a genuinely contestable reading.
|
|
123
|
+
- **NEVER edit source files.** This skill produces an inventory document only.
|
|
@@ -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
|
@@ -66,15 +66,16 @@ You grade ONE artifact against ONE quality dimension and emit a verdict JSON. Yo
|
|
|
66
66
|
- `--artifact <path>` **(required)** — the artifact under review.
|
|
67
67
|
- `--context <path>` *(optional)* — a supporting artifact (e.g. the research doc). **Required for `architecture-fit`.**
|
|
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
|
+
- `--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.
|
|
69
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.
|
|
70
|
-
- `--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).
|
|
71
72
|
|
|
72
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:`.
|
|
73
74
|
|
|
74
75
|
Two duties tighten what a `pass` means, and the gate enforces both (an un-grounded `pass` is demoted as if it were `fail`):
|
|
75
76
|
|
|
76
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.
|
|
77
|
-
- **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.
|
|
78
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.
|
|
79
80
|
|
|
80
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.
|
|
@@ -104,7 +105,7 @@ Grade against the row matching `--dimension`. "Pass bar" is the line; meet it
|
|
|
104
105
|
|
|
105
106
|
| Dimension | What it checks | Where to look | Pass bar |
|
|
106
107
|
|---|---|---|---|
|
|
107
|
-
| `completeness` | The artifact covers the whole brief — no unresolved `TODO`/`TBD`/`?`/"unknown"/"figure out later" markers; every area it names is addressed; open questions are resolved or explicitly deferred with a reason. **When `--goal` is given, the brief IS the goal file**: every explicit ask and constraint in it is addressed or explicitly deferred with a reason — a requirement present in the goal but absent from the artifact is a blocking gap. | The artifact's own content, cross-checked against `--goal` when given. | No blocking gap — nothing a downstream stage would need is left undefined,
|
|
108
|
+
| `completeness` | The artifact covers the whole brief — no unresolved `TODO`/`TBD`/`?`/"unknown"/"figure out later" markers; every area it names is addressed; open questions are resolved or explicitly deferred with a reason. **When `--goal` is given, the brief IS the goal file**: every explicit ask and constraint in it is addressed or explicitly deferred with a reason — a requirement present in the goal but absent from the artifact is a blocking gap. **When `--acceptance` is also given, walk its `items:` id by id**: each is genuinely covered by the artifact (an `acceptance:` disposition naming a phase must be honest — the phase's work would actually make the item's evidence hold) or explicitly deferred with a reason; an item neither covered nor deferred, a dishonest `implemented` claim, or a silently dropped/reworded item is a blocking gap. | The artifact's own content, cross-checked against `--goal` and the `--acceptance` items when given. | No blocking gap — nothing a downstream stage would need is left undefined, no explicit `--goal` ask is silently dropped, and every `--acceptance` item is honestly disposed. |
|
|
108
109
|
| `correctness` | Claims match reality — cited files and symbols exist and the code does what the artifact claims; described current behavior matches the actual code; no internal contradictions. When `--goal` is given, no claim or decision contradicts an explicit constraint stated in it. | **Spot-check the live codebase**: resolve a sample of the artifact's references with Read/Grep — by file + named symbol, NOT by exact line number (line numbers are navigation hints); check decisions against `--goal` when given. | No false claim found in the sample; cited files/symbols exist; no explicit `--goal` constraint contradicted. |
|
|
109
110
|
| `actionability` | A competent implementer could execute it without guessing — concrete steps, named files/symbols, explicit success criteria; no hand-waving ("somehow", "handle appropriately", "etc."). | The artifact's own content. | Every section/slice is executable as written. |
|
|
110
111
|
| `architecture-fit` | The approach fits the existing architecture and the constraints surfaced in `--context` — respects module boundaries, dependency direction, established layering; introduces no boundary violation. | The artifact **and** `--context`, cross-checked against real module boundaries via Grep/Read. | No architectural conflict with the codebase or the research's constraints. |
|
|
@@ -114,12 +115,12 @@ Grade against the row matching `--dimension`. "Pass bar" is the line; meet it
|
|
|
114
115
|
## Steps
|
|
115
116
|
|
|
116
117
|
1. **Parse + validate flags.** Bail per the Input rules above if malformed.
|
|
117
|
-
2. **Read fully** (no limit/offset): `--artifact`, and `--context` / `--goal` / `--prior` / `--cite-check` if given (skip `--goal` unless your dimension is `completeness` or `correctness`; skip `--cite-check` unless your dimension is `correctness`).
|
|
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`).
|
|
118
119
|
3. **Select the single rubric row** for `--dimension`. Ignore every problem outside it.
|
|
119
|
-
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:
|
|
120
|
-
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`.**
|
|
121
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).
|
|
122
|
-
- `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.
|
|
123
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.
|
|
124
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.**
|
|
125
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
|
|
|
@@ -29,9 +29,19 @@ contract:
|
|
|
29
29
|
properties:
|
|
30
30
|
n: { type: integer, minimum: 1 }
|
|
31
31
|
title: { type: string }
|
|
32
|
+
acceptance:
|
|
33
|
+
type: array
|
|
34
|
+
items:
|
|
35
|
+
type: object
|
|
36
|
+
required: [id, disposition]
|
|
37
|
+
properties:
|
|
38
|
+
id: { type: string }
|
|
39
|
+
disposition: { enum: [implemented, deferred] }
|
|
40
|
+
phase: { type: integer, minimum: 1 }
|
|
41
|
+
reason: { type: string }
|
|
32
42
|
consumes:
|
|
33
43
|
meta:
|
|
34
|
-
artifactKind: [research]
|
|
44
|
+
artifactKind: [research, acceptance]
|
|
35
45
|
---
|
|
36
46
|
|
|
37
47
|
# Quick Plan
|
|
@@ -44,7 +54,7 @@ The expected shape is **one phase** (the small-task default). Add a phase only w
|
|
|
44
54
|
|
|
45
55
|
`$ARGUMENTS` — one of four shapes (the skill is sound however the caller wires it):
|
|
46
56
|
|
|
47
|
-
- **Flags (workflow dispatch)** — `--research <path> --goal <path
|
|
57
|
+
- **Flags (workflow dispatch)** — `--research <path> --goal <path> [--acceptance <path>]`. Read ALL files FULLY (no limit/offset). The research doc is the grounding; the goal file is the verbatim brief — every ask it names is either implemented by a phase or deferred under `## Out of Scope`. The acceptance file, when given, is the goal-derived inventory (`items:` frontmatter, ids `a1…`): the plan MUST record a per-item `acceptance:` disposition — `implemented` naming the phase, or `deferred` with a reason — every item, no omissions (the completeness gate anchors on the inventory, and validate executes each item's evidence command against the finished tree).
|
|
48
58
|
- **Research artifact path** — a `.md` path under `.rpiv/artifacts/research/`. Read it FULLY (no limit/offset); it is the grounding for the plan.
|
|
49
59
|
- **Injected research** — when dispatched by a workflow `reads: ["research"]` stage, the research doc is already in context; treat `$ARGUMENTS` as the task description / goal.
|
|
50
60
|
- **Free-text** (standalone small task) — `$ARGUMENTS` is the task description; research is done or the shape is obvious.
|
|
@@ -71,6 +81,7 @@ Copy values verbatim. `<iso>` is the first tab-separated field (use as `date:`);
|
|
|
71
81
|
|
|
72
82
|
- If a research artifact path was given, read it FULLY. Extract the task, the Code References (`file:line`), the Integration Points, and any Open Questions already resolved.
|
|
73
83
|
- If a `--goal` file was given, read it FULLY and enumerate every ask it names; each is either implemented by a phase or deferred under `## Out of Scope` with a reason (when the research narrowed the brief, its rationale is the deferral reason).
|
|
84
|
+
- If an `--acceptance` file was given, read it FULLY and treat its `items:` as the enumeration of record — dispose of every item id (Step 3's `acceptance:` mapping). An item whose evidence command the plan's work would not make pass is either genuinely covered by a phase or deferred with a reason; never quietly reinterpret an item's statement.
|
|
74
85
|
- Read the key source files the research points at — the anchors the plan will cite — so the phase's code blocks and `file:line` references are real and current.
|
|
75
86
|
- Determine the goal (the `--goal` brief, the task description, or the research's stated goal).
|
|
76
87
|
|
|
@@ -106,6 +117,9 @@ status: ready
|
|
|
106
117
|
phase_count: 1
|
|
107
118
|
phases:
|
|
108
119
|
- { n: 1, title: {Phase 1 title}, files: [{every repo-root-relative path Phase 1 creates/edits}], depends_on: [] }
|
|
120
|
+
acceptance:
|
|
121
|
+
- { id: a1, disposition: implemented, phase: 1 }
|
|
122
|
+
- { id: a2, disposition: deferred, reason: "{one-line reason}" }
|
|
109
123
|
last_updated: {same <iso> as date:}
|
|
110
124
|
---
|
|
111
125
|
|
|
@@ -150,6 +164,8 @@ Populate each `phases[].files:` from that phase's `#### N.` / `**File**:` paths
|
|
|
150
164
|
|
|
151
165
|
Populate `## Out of Scope` from the Step 1 goal-ask enumeration: one one-line deferral with a reason per goal ask no phase implements.
|
|
152
166
|
|
|
167
|
+
Populate `acceptance:` ONLY when an `--acceptance` file was given (omit the array entirely otherwise): one entry per inventory item, in item order — `disposition: implemented` with the covering `phase:` number, or `disposition: deferred` with a one-line `reason:` (and a matching `## Out of Scope` line). Every item id from the inventory appears exactly once; never invent an id the inventory doesn't carry.
|
|
168
|
+
|
|
153
169
|
Then print the path and a one-line summary: `quick-plan written: {N} phase(s), {M} files`.
|
|
154
170
|
|
|
155
171
|
## Important Notes
|
|
@@ -160,6 +176,7 @@ Then print the path and a one-line summary: `quick-plan written: {N} phase(s), {
|
|
|
160
176
|
- **At most ONE `codebase-pattern-finder` dispatch.** Never parallel, never `run_in_background` — a background completion cannot re-drive this session and the stage fails with no artifact. Skip the dispatch when research already surfaced the pattern.
|
|
161
177
|
- **Non-interactive.** No `ask_user_question` checkpoint. A checkpoint without blueprint's dimension sweep is pure latency on a fast-path preset whose output is immediately grade-gated. Resolve ambiguity from the research and the real code; if a genuine fork can't be settled, make the most defensible call and let the grade panel catch it.
|
|
162
178
|
- **Defer explicitly, never silently.** Every goal ask no phase implements gets a one-line `## Out of Scope` deferral with a reason — the completeness gate blocks on a named ask that is neither addressed nor deferred.
|
|
179
|
+
- **Dispose of every acceptance item.** With `--acceptance` given, the `acceptance:` mapping is the machine-readable form of that same rule: every inventory id, exactly once, `implemented` (with phase) or `deferred` (with reason). The completeness gate reads the inventory directly, so a missing or mislabeled disposition is a blocking gap — and validate will run each item's evidence command regardless of what the plan claims.
|
|
163
180
|
- **Ground every citation.** Every `file:line` in prose or code comments uses a repo-root-relative path and is verifiable at the current revision — the plan passes the deterministic `plan-cite-check` floor.
|
|
164
181
|
- **NEVER edit source files.** This skill produces a plan document, not implementation. Source editing is `implement`'s job.
|
|
165
182
|
- **Drops blueprint's ceremony by design:** multi-slice decomposition, skeleton-then-fill, the per-slice `slice-verifier` loop, the dual post-finalization review (`artifact-code-reviewer` + `artifact-coverage-reviewer`), the 6-dimension sweep, and parallel research are all absent here — the workflow's own gates own that confidence.
|
package/skills/research/SKILL.md
CHANGED
|
@@ -71,6 +71,12 @@ The final artifact feeds design or blueprint.
|
|
|
71
71
|
|
|
72
72
|
4. **Parse the agent's final message** as the questions artifact body. Extract: Discovery Summary (3-5 sentence file-landscape overview), Questions (numbered dense 3-6 sentence paragraphs).
|
|
73
73
|
|
|
74
|
+
Questions formulated — emit:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
[Questions]: {N} research questions formulated. Reading shared files and grouping before dispatch.
|
|
78
|
+
```
|
|
79
|
+
|
|
74
80
|
5. **Read key shared files** referenced across multiple questions into main context — especially shared utilities, type definitions, and integration points that multiple questions mention.
|
|
75
81
|
|
|
76
82
|
6. **Analyze question overlap for grouping:**
|
|
@@ -89,6 +95,14 @@ The final artifact feeds design or blueprint.
|
|
|
89
95
|
|
|
90
96
|
Spawn analysis agents using the Agent tool — all in a **single assistant message with multiple Agent calls** (concurrent, synchronous). **Never `run_in_background`**: its completion can't re-drive a workflow session, so the skill ends its turn before writing the document and the stage fails with no artifact.
|
|
91
97
|
|
|
98
|
+
**Launch marker** — in that SAME assistant message, as its text block (it adds no turn, so the one-message parallel dispatch shape stays intact), emit:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
[Dispatched]: {N} analysis agents in one batch{ + precedent sweep}. Waiting for returns.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
N counts every dispatched agent, including the git-gated precedent-locator when it joins; the ` + precedent sweep` suffix appears only when it does.
|
|
105
|
+
|
|
92
106
|
**Default agent**: `codebase-analyzer` for all codebase questions. This agent has Read, Grep, Glob, LS — it can trace code paths, find patterns, and analyze integration points.
|
|
93
107
|
|
|
94
108
|
**Exception**: External surfaces — third-party APIs, SDKs, libraries, services, protocols, or wire formats — that the codebase doesn't already use → `web-search-researcher`. Trigger on the surface itself, not on whether the question text literally names "docs" or "API".
|
|
@@ -129,15 +143,27 @@ Findings go into Precedents & Lessons. Otherwise skip and note "git history unav
|
|
|
129
143
|
|
|
130
144
|
**Wait for ALL agents to complete** before proceeding.
|
|
131
145
|
|
|
146
|
+
Once every agent has returned, emit:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
[Returned]: {N}/{N} agents returned. Proceeding to synthesis.
|
|
150
|
+
```
|
|
151
|
+
|
|
132
152
|
### Step 3: Synthesize and Checkpoint
|
|
133
153
|
|
|
154
|
+
Before compiling, emit:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
[Synthesizing]: compiling {N} agent reports.
|
|
158
|
+
```
|
|
159
|
+
|
|
134
160
|
1. **Compile findings:**
|
|
135
161
|
- Match each agent's response to the question(s) it answered
|
|
136
162
|
- Cross-reference findings across questions — look for patterns, conflicts, and connections
|
|
137
163
|
- Prioritize live codebase findings as primary source of truth
|
|
138
164
|
- Use `.rpiv/artifacts/` findings as supplementary historical context
|
|
139
165
|
- Include specific file paths and line numbers
|
|
140
|
-
- **
|
|
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.
|
|
141
167
|
- Build Code References as jump-table entries for the planner, not narrative (file:startLine-endLine format)
|
|
142
168
|
- No multi-line code blocks (>3 lines) — use file:line refs + prose. No implementation recipes — facts only.
|
|
143
169
|
- No artifact summaries — link plans/designs in Historical Context, don't summarize their contents. Research describes current codebase state.
|
|
@@ -359,3 +385,4 @@ Please review and let me know if you have follow-up questions.
|
|
|
359
385
|
- ALWAYS gather metadata before writing (Step 4)
|
|
360
386
|
- NEVER write the document with placeholder values
|
|
361
387
|
- **Frontmatter consistency**: Always include frontmatter, use snake_case fields
|
|
388
|
+
- **Progress markers are transcript text only**: the `[Questions]:` / `[Dispatched]:` / `[Returned]:` / `[Synthesizing]:` lines are one-line status for the lane console's live tail — never artifact content — and NEVER quote the research document's path in a marker, or anywhere else, before the file is written.
|
package/skills/slice/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: slice
|
|
3
3
|
description: Decompose a research artifact into independent vertical slices — each a self-contained, separately-designable unit — and write a slice map to .rpiv/artifacts/slices/ with a machine-readable `slices:` frontmatter array. A research artifact is required (it is the cut's grounding); confirms the decomposition with you before writing. Also runs in RE-SLICE mode (`--slices <map> --slice-verdicts <v>…`) to STRUCTURALLY re-cut a slice map that failed the design-readiness gate — splitting epics, completing under-cited footings, redistributing frozen coverage units, breaking dependency cycles, renumbering — which a surgical reviser cannot do. Feeds a per-slice design fanout.
|
|
4
|
-
argument-hint: "<research-path> | --slices <map> --slice-verdicts <verdict>..."
|
|
4
|
+
argument-hint: "<research-path> | --research <path> | --slices <map> --slice-verdicts <verdict>..."
|
|
5
5
|
shell-timeout: 10
|
|
6
6
|
disable-model-invocation: true
|
|
7
7
|
contract:
|
|
@@ -60,7 +60,7 @@ You decompose a feature into **independent vertical slices** and write a slice m
|
|
|
60
60
|
|
|
61
61
|
`$ARGUMENTS` takes two forms:
|
|
62
62
|
|
|
63
|
-
1. **Fresh** — a path to a `.rpiv/artifacts/research/*.md` artifact (
|
|
63
|
+
1. **Fresh** — a path to a `.rpiv/artifacts/research/*.md` artifact, positional or as `--research <path>` (the flag form is how the build workflow dispatches it — equivalent, same input). Decompose from scratch via Steps 1–6, grounded in that research. The research artifact is **required**: if the argument is missing, empty, or not a research path, print an error and stop — it's a dispatch error (the workflow runs `research` before `slice`).
|
|
64
64
|
2. **Re-slice** (the re-slice loop) — `--slices <map-path> --slice-verdicts <verdict-path> … [--slice-check <structural-verdict-path> …]` (the `--slice-verdicts` and `--slice-check` flags repeat). **Re-cut the existing slice map** to clear the failures its verdicts name. Recognize this form by the `--slices` flag and follow **Re-slice mode** below — NOT the fresh Steps (no confirm). `--slice-check` carries the **deterministic** structural findings (dependency cycles, dropped coverage units, unbacked `file:line` citations) — treat them exactly like a verdict's findings; they are the un-gameable floor and MUST all be cleared.
|
|
65
65
|
|
|
66
66
|
## Metadata
|
|
@@ -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:
|