@juicesharp/rpiv-pi 2.1.0 → 2.3.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 +9 -8
- package/docs/lanes.md +3 -2
- package/docs/models-config.md +6 -6
- package/docs/workflows.md +4 -18
- package/extensions/rpiv-core/artifact-collector.ts +2 -2
- package/extensions/rpiv-core/bash-timeout.ts +16 -0
- package/extensions/rpiv-core/built-in-workflows.ts +2289 -318
- package/extensions/rpiv-core/guidance.ts +35 -19
- package/extensions/rpiv-core/index.ts +2 -2
- package/extensions/rpiv-core/lane-console.ts +62 -5
- package/extensions/rpiv-core/lane-list.ts +84 -32
- package/extensions/rpiv-core/lane-progress.ts +13 -77
- package/extensions/rpiv-core/lane-switcher.ts +114 -33
- package/extensions/rpiv-core/lane-usage.ts +25 -0
- package/extensions/rpiv-core/models-config-validate.ts +1 -1
- package/extensions/rpiv-core/models-config.ts +38 -3
- package/extensions/rpiv-core/register-built-in-workflows.ts +2 -2
- package/extensions/rpiv-core/run-lane-registry.ts +80 -69
- package/extensions/rpiv-core/sdk-workflow-host.ts +43 -3
- package/extensions/rpiv-core/subagent-usage.ts +147 -0
- package/extensions/rpiv-core/workflow-execution-host.ts +24 -7
- package/package.json +3 -3
- package/skills/amend/SKILL.md +7 -3
- package/skills/annotate-guidance/SKILL.md +1 -0
- package/skills/architecture-review/SKILL.md +1 -0
- package/skills/blueprint/SKILL.md +10 -4
- package/skills/changelog/SKILL.md +1 -0
- package/skills/commit/SKILL.md +1 -0
- package/skills/design/SKILL.md +4 -3
- package/skills/design-review/SKILL.md +1 -0
- package/skills/design-slice/SKILL.md +2 -1
- package/skills/discover/SKILL.md +1 -1
- package/skills/elaborate/SKILL.md +21 -9
- package/skills/elaborate/_helpers/validate-workflow-invariant.mjs +88 -0
- package/skills/explore/SKILL.md +1 -0
- package/skills/frontend-design/SKILL.md +1 -0
- package/skills/grade/SKILL.md +24 -6
- package/skills/implement/SKILL.md +10 -2
- package/skills/plan/SKILL.md +10 -6
- package/skills/research/SKILL.md +9 -8
- package/skills/resume-handoff/SKILL.md +1 -0
- package/skills/revise/SKILL.md +1 -0
- package/skills/slice/SKILL.md +4 -3
- package/skills/synthesize/SKILL.md +16 -7
- package/skills/validate/SKILL.md +1 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// validate-workflow-invariant.mjs — self-check helper for the elaborate skill.
|
|
3
|
+
//
|
|
4
|
+
// Invoked by the elaborate Self-check step ONLY when a phase's write-set
|
|
5
|
+
// includes packages/rpiv-pi/extensions/rpiv-core/built-in-workflows.ts. It
|
|
6
|
+
// re-derives the effective skill contracts + contract-sourced outcomes onto
|
|
7
|
+
// the LIVE built-in workflows and runs validateWorkflow over each, exiting 1
|
|
8
|
+
// with one `<workflow>: [<code>] <message>` line per error OR warning issue
|
|
9
|
+
// (e.g. the route-reads-unvalidated-data rule from checkPredicateSchemas at
|
|
10
|
+
// packages/rpiv-workflow/validate/contract-compat.ts:50). Clean tree → exit 0.
|
|
11
|
+
//
|
|
12
|
+
// Reads only — writes nothing to the tree. The harness mirrors the
|
|
13
|
+
// withDerivedOutcomes / deriveAndValidate helpers in
|
|
14
|
+
// packages/rpiv-pi/extensions/rpiv-core/built-in-workflows.test.ts, so the
|
|
15
|
+
// contract-derived outcomes are threaded before validateWorkflow runs (the
|
|
16
|
+
// built-ins carry no inline outputSchema/outcomes — they are contract-sourced,
|
|
17
|
+
// via buildSkillContractsFromFrontmatter(BUNDLED_SKILLS_DIR)).
|
|
18
|
+
//
|
|
19
|
+
// All sources are .ts (this monorepo is noEmit); loaded via jiti (a direct dep
|
|
20
|
+
// of both @juicesharp/rpiv-pi and @juicesharp/rpiv-workflow). jiti is created
|
|
21
|
+
// from this file so its resolver walks node_modules upward from
|
|
22
|
+
// _helpers/ → .../packages/rpiv-pi/skills/elaborate/_helpers and finds the
|
|
23
|
+
// root-workspace @juicesharp/rpiv-workflow symlink. Module cache ON (default):
|
|
24
|
+
// the bare-specifier import and the transitive import built-in-workflows.ts
|
|
25
|
+
// makes resolve to one shared module instance.
|
|
26
|
+
|
|
27
|
+
import { createJiti } from "jiti";
|
|
28
|
+
import { fileURLToPath } from "node:url";
|
|
29
|
+
|
|
30
|
+
const jiti = createJiti(import.meta.url);
|
|
31
|
+
|
|
32
|
+
// rpiv-core extension sources, resolved relative to this helper
|
|
33
|
+
// (_helpers/ → elaborate/ → skills/ → rpiv-pi/ → extensions/rpiv-core/).
|
|
34
|
+
const CORE = fileURLToPath(new URL("../../../extensions/rpiv-core/", import.meta.url));
|
|
35
|
+
|
|
36
|
+
// Five jiti.imports — bare specifier (rpiv-workflow → validateWorkflow) plus
|
|
37
|
+
// four absolute .ts paths. The returned namespace exposes the named exports
|
|
38
|
+
// directly (no { default: true }); verified at runtime against jiti 2.7.0.
|
|
39
|
+
let builtInWorkflows;
|
|
40
|
+
let validateWorkflow;
|
|
41
|
+
let buildSkillContractsFromFrontmatter;
|
|
42
|
+
let deriveOutcomes;
|
|
43
|
+
let BUNDLED_SKILLS_DIR;
|
|
44
|
+
try {
|
|
45
|
+
({ builtInWorkflows } = await jiti.import(`${CORE}built-in-workflows.ts`));
|
|
46
|
+
({ validateWorkflow } = await jiti.import("@juicesharp/rpiv-workflow"));
|
|
47
|
+
({ buildSkillContractsFromFrontmatter } = await jiti.import(`${CORE}skill-contracts-source.ts`));
|
|
48
|
+
({ deriveOutcomes } = await jiti.import(`${CORE}outcome-derivation.ts`));
|
|
49
|
+
({ BUNDLED_SKILLS_DIR } = await jiti.import(`${CORE}paths.ts`));
|
|
50
|
+
} catch (err) {
|
|
51
|
+
process.stderr.write(`validate-workflow-invariant: failed to load modules: ${err?.stack ?? err}\n`);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Declared skill contracts threaded from the bundled skills dir — mirrors
|
|
56
|
+
// built-in-workflows.test.ts DECLARED_CONTRACTS. Without these, the
|
|
57
|
+
// contract-backed routing lint (checkPredicateSchemas) fires false warnings on
|
|
58
|
+
// dispatching stages whose produces.data schema is sourced from the contract,
|
|
59
|
+
// not declared inline as outputSchema.
|
|
60
|
+
const DECLARED_CONTRACTS = new Map(buildSkillContractsFromFrontmatter(BUNDLED_SKILLS_DIR));
|
|
61
|
+
|
|
62
|
+
// Derive contract-sourced outcomes onto a mutable copy of a workflow, mirroring
|
|
63
|
+
// built-in-workflows.test.ts withDerivedOutcomes. Deriving on a (shallow) copy
|
|
64
|
+
// keeps the shared builtInWorkflows constant untouched across the loop.
|
|
65
|
+
const withDerivedOutcomes = (wf) => {
|
|
66
|
+
const mutable = { ...wf, stages: { ...wf.stages } };
|
|
67
|
+
for (const [name, stage] of Object.entries(wf.stages)) mutable.stages[name] = { ...stage };
|
|
68
|
+
deriveOutcomes([mutable], DECLARED_CONTRACTS, () => {}, new Map());
|
|
69
|
+
return mutable;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
let failed = 0;
|
|
73
|
+
for (const wf of builtInWorkflows) {
|
|
74
|
+
const issues = validateWorkflow(withDerivedOutcomes(wf), { skillContracts: DECLARED_CONTRACTS });
|
|
75
|
+
for (const issue of issues) {
|
|
76
|
+
// Errors AND warnings. route-reads-unvalidated-data — this helper's
|
|
77
|
+
// flagship defect — is itself a warning (issue.ts:244), and the
|
|
78
|
+
// mirrored deriveAndValidate harness asserts 0 errors AND 0 warnings
|
|
79
|
+
// on clean built-ins (built-in-workflows.test.ts:508). Gating on
|
|
80
|
+
// error-only would let the named defect slip through green.
|
|
81
|
+
if (issue.severity !== "error" && issue.severity !== "warning") continue;
|
|
82
|
+
failed += 1;
|
|
83
|
+
const where = issue.stage ? ` (${issue.stage})` : "";
|
|
84
|
+
process.stdout.write(`${issue.workflow}${where}: [${issue.code}] ${issue.message}\n`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
process.exit(failed === 0 ? 0 : 1);
|
package/skills/explore/SKILL.md
CHANGED
|
@@ -110,6 +110,7 @@ Present the candidate set and default dimensions to the developer before per-can
|
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
2. **Confirm via the `ask_user_question` tool with the following question:** "{N} candidates, {D} dimensions. Begin per-candidate fit dispatch?". Header: "Candidates". Options: "Proceed (Recommended)" (Begin per-candidate fit dispatch with all {N} candidates and all {D} dimensions); "Adjust candidates or dimensions" (Rename, add, or drop candidates; drop dimensions that don't apply); "Re-generate candidates" (Candidates look wrong — re-run Step 2 with adjusted scope).
|
|
113
|
+
- `Header` is capped at ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
113
114
|
|
|
114
115
|
3. **Handle developer input:**
|
|
115
116
|
|
|
@@ -126,6 +126,7 @@ When skipping, record: "Dimension X: [finding from scan] — respecting existing
|
|
|
126
126
|
### Dimension 1: Tone & Mood
|
|
127
127
|
|
|
128
128
|
Ask via `ask_user_question`:
|
|
129
|
+
- `Header` is capped at ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
129
130
|
- Question: "Pick a tone and commit. What should this interface FEEL like on first glance?"
|
|
130
131
|
- Header: "Tone"
|
|
131
132
|
- Options (pick 3-4 that fit the project context, always include the first):
|
package/skills/grade/SKILL.md
CHANGED
|
@@ -33,6 +33,11 @@ contract:
|
|
|
33
33
|
properties:
|
|
34
34
|
id: { type: string }
|
|
35
35
|
pass: { type: boolean }
|
|
36
|
+
evidence: { type: string }
|
|
37
|
+
claim_type: { type: string }
|
|
38
|
+
disposition: { type: string }
|
|
39
|
+
procedure: { type: string }
|
|
40
|
+
owner: { type: integer, minimum: 1 }
|
|
36
41
|
finding_rulings:
|
|
37
42
|
type: array
|
|
38
43
|
items:
|
|
@@ -63,10 +68,20 @@ You grade ONE artifact against ONE quality dimension and emit a verdict JSON. Yo
|
|
|
63
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.
|
|
64
69
|
- `--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.
|
|
65
70
|
|
|
66
|
-
**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).
|
|
71
|
+
**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:`.
|
|
72
|
+
|
|
73
|
+
Two duties tighten what a `pass` means, and the gate enforces both (an un-grounded `pass` is demoted as if it were `fail`):
|
|
74
|
+
|
|
75
|
+
- **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.
|
|
76
|
+
- **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:** the gate validates `evidence` with a regex (`FILE_LINE_CITATION_RE`) that requires at least one site as a dotted file path with its line number IMMEDIATELY adjacent as `path.ext:NN` (colon-number directly after the extension, no space, e.g. `packages/x/y.ts:1168`); the check is `.match() !== null`, so ONE adjacent `path.ext:NN` anywhere in the string satisfies the duty. Make the FIRST cited site that full adjacent `path.ext:NN`; subsequent refs to other sites in the SAME string may then be abbreviated bare `:NN` (you have already grounded the file) — a compliant multi-site evidence string is `"packages/x/y.ts:85 (countHeadingsOutsideFences); further sites :1173, :1568 — all four consumers reproduce the continue-skip semantics"`, where the `:85` is adjacent to `packages/x/y.ts` and the abbreviated `:1173`/`:1568` that follow are fine. A recurring drift shape names a real file but attaches no adjacent `:NN` to ANY site, so the duty's line never lands — give at least the first site its own adjacent `path.ext:NN`. Three shapes each NAME a real line yet fail the adjacency rule and demote the ruling (none carries an adjacent `path.ext:NN`): `symbol :NN` — a bare symbol (no dotted extension) with a space before the colon, e.g. `handleToString :34`; a bare `(:NN/:NN/:NN)` list where every ref is bare and the path (if named at all) sits separately in the sentence, e.g. `(:85/:1173/:1568)`; and a path token with no adjacent `:NN` at all, e.g. `built-in-workflows.ts — verified…`. Rule `fail` outright if the mechanism does not hold.
|
|
77
|
+
- **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.
|
|
78
|
+
|
|
79
|
+
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.
|
|
67
80
|
|
|
68
81
|
**Prior-round adjudication (confirm mode, `--prior` present).** You are the second judgment on a dimension whose prior round BLOCKED the gate. You still grade the artifact fresh against your rubric — but you additionally MUST adjudicate the prior verdict: read the `--prior` JSON fully, and for **each** entry in its `findings[]` array, plus each of its `risk_rulings` entries with `pass: false`, verify the claim against the artifact and the real codebase and rule it:
|
|
69
82
|
|
|
83
|
+
**Demotion-suspect clause — when the prior blocked yet carries no `pass: false` ruling.** If the `--prior` verdict's `risk_rulings` are ALL `pass: true` but this dimension still blocked (you are in confirm mode, so the prior round blocked the gate, yet the prior carries no `pass: false` ruling to adjudicate), suspect a duty DEMOTION of a `pass: true` ruling: either evidence-format (a mechanics claim with no adjacent `path.ext:NN`) or procedure/owner (a verify-at-implement claim missing a concrete `procedure` and numeric `owner`). Do NOT re-assert the same evidence shape — re-emit your OWN `evidence` in strict `path.ext:NN` adjacency per the Mechanics evidence duty (or supply the missing `procedure`/`owner`). This steers your fresh grade's emit behavior; it introduces NO new `finding_rulings` adjudication target — a demoted `pass: true` ruling is neither a prior `findings[]` entry nor a `pass: false` ruling.
|
|
84
|
+
|
|
70
85
|
- **`upheld`** — the finding is real. Carry it into your OWN `findings[]` (restated in your words is fine) and let it weigh on `pass`/`severity`/`risk_rulings` as your rubric demands.
|
|
71
86
|
- **`refuted`** — the finding is wrong. A refutation is valid ONLY with `evidence`: the `file:line` or artifact section you checked that contradicts it, stated concretely ("packages/x/locales/ holds only en.json — verified by listing" beats "seems fine"). "Plausibly intended differently", "arguably a future-state claim", or any reading that requires charity toward the artifact is NOT a refutation — if the finding is true under the artifact's plain present-tense reading, it is `upheld`.
|
|
72
87
|
|
|
@@ -89,7 +104,7 @@ Grade against the row matching `--dimension`. "Pass bar" is the line; meet it
|
|
|
89
104
|
| Dimension | What it checks | Where to look | Pass bar |
|
|
90
105
|
|---|---|---|---|
|
|
91
106
|
| `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, and no explicit `--goal` ask is silently dropped. |
|
|
92
|
-
| `correctness` | Claims match reality —
|
|
107
|
+
| `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. |
|
|
93
108
|
| `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. |
|
|
94
109
|
| `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. |
|
|
95
110
|
| `pattern-following` | Mirrors the codebase's dominant conventions (naming, error handling, file layout, test style) instead of inventing new ones where a precedent exists; any divergence is justified. | **Spot-check** comparable existing code via Grep/Read for the local convention. | Aligns with the dominant local pattern, or names a reason to diverge. |
|
|
@@ -100,9 +115,10 @@ Grade against the row matching `--dimension`. "Pass bar" is the line; meet it
|
|
|
100
115
|
1. **Parse + validate flags.** Bail per the Input rules above if malformed.
|
|
101
116
|
2. **Read fully** (no limit/offset): `--artifact`, and `--context` / `--goal` / `--prior` if given (skip `--goal` unless your dimension is `completeness` or `correctness`).
|
|
102
117
|
3. **Select the single rubric row** for `--dimension`. Ignore every problem outside it.
|
|
103
|
-
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. 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. **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.
|
|
104
|
-
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
|
|
118
|
+
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: resolve every `path:line` citation by opening the file and locating the named symbol/content — the line number is a navigation hint, not a claim. A line number that points near but not exactly at the cited symbol is NEVER a finding, at any severity — do not report it, do not mention it in feedback: downstream stages locate code by symbol, so drift wastes fix rounds without ever blocking anything. 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. **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.
|
|
119
|
+
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; line-number drift is not even a nit — per the citation-resolution rule it is never a finding), `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`.**
|
|
105
120
|
- `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).
|
|
121
|
+
- `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. (There is no "refresh a drifted line number" remedy — per the citation-resolution rule, drifted line numbers are not findings.)
|
|
106
122
|
- `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.
|
|
107
123
|
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.**
|
|
108
124
|
7. **Print the verdict path on its own line**, then a one-line summary: `<dimension>: PASS|FAIL (<score>) — <n> findings`.
|
|
@@ -121,7 +137,9 @@ Grade against the row matching `--dimension`. "Pass bar" is the line; meet it
|
|
|
121
137
|
{ "detail": "what is wrong", "where": "path/to/file.ts:42 or '## Section'" }
|
|
122
138
|
],
|
|
123
139
|
"risk_rulings": [
|
|
124
|
-
{ "id": "r1", "pass": true }
|
|
140
|
+
{ "id": "r1", "pass": true },
|
|
141
|
+
{ "id": "r2", "pass": true, "claim_type": "mechanics", "evidence": "packages/x/y.ts:42 — helper returns early on undefined" },
|
|
142
|
+
{ "id": "r3", "pass": true, "disposition": "verify-at-implement", "procedure": "npm run coverage", "owner": 5 }
|
|
125
143
|
],
|
|
126
144
|
"finding_rulings": [
|
|
127
145
|
{ "where": "r2", "ruling": "refuted", "evidence": "packages/x/locales/ holds 9 files (listed); the claim's premise is false" }
|
|
@@ -130,7 +148,7 @@ Grade against the row matching `--dimension`. "Pass bar" is the line; meet it
|
|
|
130
148
|
}
|
|
131
149
|
```
|
|
132
150
|
|
|
133
|
-
Include `risk_rulings` **only** on a `correctness` verdict when the artifact declares `risks:` — one entry per flag. Omit the key entirely on every other dimension and when the artifact declares no risks. Include `finding_rulings` **only** when `--prior` was given — one entry per prior finding and per prior failed risk ruling, none omitted (see "Prior-round adjudication"); omit the key entirely otherwise. Every `evidence` string follows the same JSON-safety rules as `feedback`.
|
|
151
|
+
Include `risk_rulings` **only** on a `correctness` verdict when the artifact declares `risks:` — one entry per flag. Omit the key entirely on every other dimension and when the artifact declares no risks. Include `finding_rulings` **only** when `--prior` was given — one entry per prior finding and per prior failed risk ruling, none omitted (see "Prior-round adjudication"); omit the key entirely otherwise. Include top-level `"remedy": "cite"` plus a per-finding `"requires"` **only** on a `design-readiness` fail whose every finding is discharged by adding the named citation (see step 5); omit them otherwise. Every `evidence` string follows the same JSON-safety rules as `feedback`.
|
|
134
152
|
|
|
135
153
|
## Hard rules
|
|
136
154
|
|
|
@@ -34,6 +34,12 @@ Rules:
|
|
|
34
34
|
- **A genuinely missing prerequisite is a hard error, not a decision.** If a file your phase must read or edit (one an earlier phase owns) is absent, **STOP and fail** with `prerequisite missing: <path> (expected from an earlier phase)`. Do **not** create it, do **not** `ask_user_question` about it, and do **not** defer your own edits — fail loudly so the run surfaces the ordering defect.
|
|
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
|
- 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.
|
|
37
|
+
- **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 test target, so the downstream `reconcile` stage can apply it write-restricted to test-expectation files:
|
|
38
|
+
```
|
|
39
|
+
#### Reconciliation
|
|
40
|
+
- `path/to/x.test.ts`: replace `expect(r).toBe(3)` → `expect(r).toBe(4)` — <one-line rationale>
|
|
41
|
+
```
|
|
42
|
+
The target MUST be a co-located test file (`*.test.{ts,tsx,js,jsx}`) — exactly the four extensions `reconcile`'s `isTestPath`/`TEST_PATH_RE` accepts; `reconcile` rejects (and reports) a directive against any other path, so golden masters / fixtures / snapshots such as `.test.json`/`.test.snap` are NOT auto-applied (route those updates to the owning phase). The `find` substring must be present in the target — `reconcile` does not guess, so an absent `find` fails the reconciliation gate. Record directives only for edits you can state concretely; anything needing real restructuring is plan-level work (`/skill:revise`), not a reconciliation directive.
|
|
37
43
|
- If no phase is named → **sequential full-plan mode:** implement every phase in the plan sequentially.
|
|
38
44
|
- If the input is empty or the plan path is missing/literal, ask the user for the plan path before proceeding.
|
|
39
45
|
|
|
@@ -68,16 +74,18 @@ If you encounter a mismatch:
|
|
|
68
74
|
|
|
69
75
|
```
|
|
70
76
|
|
|
77
|
+
`Header` is capped at ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
71
78
|
Use the `ask_user_question` tool to resolve the mismatch. Question: "{Brief summary of the mismatch}". Header: "Mismatch". Options: "Follow the plan" (Adapt the plan's approach to the current code state); "Skip this change" (Move on without this change — it may not be needed); "Update the plan" (The plan needs to be revised before continuing).
|
|
72
79
|
|
|
73
80
|
## Verification Approach
|
|
74
81
|
|
|
75
82
|
After implementing a phase:
|
|
76
|
-
- **Sequential full-plan mode:** run the success
|
|
77
|
-
- **Single-phase mode:** run **only the commands under the named phase's own `#### Automated Verification:` block** — and flip exactly those `- [ ]` → `- [x]`. Do **not** gate completion on the whole
|
|
83
|
+
- **Sequential full-plan mode:** run the plan's own whole-plan success-criteria commands (the project's build + test commands, as recorded in its guidance `# Commands` table).
|
|
84
|
+
- **Single-phase mode:** run **only the commands under the named phase's own `#### Automated Verification:` block** — and flip exactly those `- [ ]` → `- [x]`. Do **not** gate completion on the project's whole-repo build/test command: that runs sibling phases' not-yet-present code and is the downstream `validate` stage's job (whole-plan / cross-phase validation), not implement's. Under build's parallel implement lane, sibling phases run concurrently in the same working tree; the tree shows their in-flight changes — verify only your own phase's `files:`, and keep every command you run write-scoped to that set (a command that rewrites the wider tree corrupts a sibling's in-flight edit; narrow any formatter/auto-fixer to the phase's paths).
|
|
78
85
|
- Fix any issues before proceeding
|
|
79
86
|
- Update your progress in both the plan and your todos
|
|
80
87
|
- Check off completed items in the plan file itself using Edit
|
|
88
|
+
- Anchor each checkbox-flip `Edit` on the **full unique line** — the item's phase-specific tail (the verification command, file path, or criterion text), never just the shared `- [ ]`/`- [x]` prefix. That shared prefix repeats identically across phases, so a prefix-only anchor collides and Pi rejects the whole atomic edit batch with a "Found N occurrences" error (an observed run lost an atomic 9-edit batch this way). A full-line anchor is unique per item.
|
|
81
89
|
- If the input scopes you to a single phase, stop immediately after the named phase's own checks pass — do not advance to other phases
|
|
82
90
|
|
|
83
91
|
Don't let verification interrupt your flow - batch it at natural stopping points.
|
package/skills/plan/SKILL.md
CHANGED
|
@@ -126,7 +126,7 @@ Write the plan **incrementally** — skeleton first, then fill each phase. Code
|
|
|
126
126
|
- With ticket: `2025-01-08_14-30-00_ENG-1478-parent-child-tracking.md`
|
|
127
127
|
- Without ticket: `2025-01-08_14-30-00_improve-error-handling.md`
|
|
128
128
|
- The skeleton includes everything EXCEPT large code blocks: frontmatter, Overview, Desired End State, What We're NOT Doing, full phase structure (Overview, Changes Required with file paths and change summaries, **Success Criteria copied verbatim from design's `## Slices`**, parallelism annotations), Testing Strategy, Performance Considerations, References. Phase boundaries are inherited 1:1 from `## Slices` — no recomposition.
|
|
129
|
-
- **Frontmatter `phases:` array** — one `{ n, title }` entry per `## Phase N:` section, in body order; `phase_count` equals its length. `implement` fans out over it.
|
|
129
|
+
- **Frontmatter `phases:` array** — one `{ n, title, files, depends_on }` entry per `## Phase N:` section, in body order; `phase_count` equals its length. `implement` fans out over it. Populate `files:` from each phase's `### Changes Required:` `**File**:` paths (every repo-root-relative path the phase creates or edits) and `depends_on` (lower `n` only) from the design's Ordering Constraints when the ordering is semantic (no shared file).
|
|
130
130
|
|
|
131
131
|
2. **Fill code blocks using Edit** — one phase at a time:
|
|
132
132
|
- For each phase, Edit to insert the code blocks from the design's `## Architecture` section into the Changes Required subsections. Use the slice's `**Files**:` list (from the design's `## Slices`) to know which Architecture entries belong to which phase.
|
|
@@ -147,8 +147,8 @@ status: in-progress
|
|
|
147
147
|
parent: "{path to design artifact}"
|
|
148
148
|
phase_count: {number of `## Phase N:` sections}
|
|
149
149
|
phases:
|
|
150
|
-
- { n: 1, title: {Phase 1 name} }
|
|
151
|
-
- { n: 2, title: {Phase 2 name} }
|
|
150
|
+
- { n: 1, title: {Phase 1 name}, files: [{repo-root-relative paths Phase 1 creates/edits}], depends_on: [] }
|
|
151
|
+
- { n: 2, title: {Phase 2 name}, files: [{paths}], depends_on: [1] }
|
|
152
152
|
last_updated: {Same ISO timestamp as `date:` above}
|
|
153
153
|
last_updated_by: {`author:` from Metadata block}
|
|
154
154
|
---
|
|
@@ -325,7 +325,7 @@ The 8-column header is retained when only one source returns; only rows from the
|
|
|
325
325
|
**Order and batching**: blockers sequentially (resolution may invalidate later rows). Concerns and suggestions: batch up to 4 independent rows per `ask_user_question` call. Independent = different files / different intents AND neither recommendation references the other's location; otherwise sequential.
|
|
326
326
|
|
|
327
327
|
2. **Rebuild `phases:` then flip status to ready**: once every row has a `resolution` (or the table is empty per Step 4's no-findings / failure-fallback path):
|
|
328
|
-
- **Rebuild the `phases:` frontmatter array (and `phase_count`) from the `## Phase N:` headings** — one `{ n, title }` entry per section, in body order. The implement fanout derive-checks length against the headings, so a triage-applied split/merge that left the array stale fails fast.
|
|
328
|
+
- **Rebuild the `phases:` frontmatter array (and `phase_count`) from the `## Phase N:` headings** — one `{ n, title, files, depends_on }` entry per section, in body order. Populate `files:` from each section's `### Changes Required:` `**File**:` paths and `depends_on` (lower `n` only) from the design's Ordering Constraints when the ordering is semantic (no shared file). The implement fanout derive-checks length against the headings, so a triage-applied split/merge that left the array stale fails fast.
|
|
329
329
|
- Edit frontmatter `status: in-review` → `status: ready`. Artifact is now implement-ready.
|
|
330
330
|
|
|
331
331
|
3. **Present the plan location** (after triage is complete):
|
|
@@ -353,7 +353,7 @@ The 8-column header is retained when only one source returns; only rows from the
|
|
|
353
353
|
|
|
354
354
|
- **Edit in-place.** Use the Edit tool to update the plan artifact directly. Phase numbering stays stable when possible — renumber only when a phase is split or merged.
|
|
355
355
|
- **Bump frontmatter.** Update `last_updated` + `last_updated_by`; set `last_updated_note: "<one-line summary>"`.
|
|
356
|
-
- **Phase-level moves.** Split large phases, merge small phases, adjust success criteria, reorder phases — all in-place. Continue refining until the developer is satisfied. On any boundary change (split/merge/reorder), **rebuild `phases:` and `phase_count` from the `## Phase N:` headings** — the implement fanout throws on a stale array.
|
|
356
|
+
- **Phase-level moves.** Split large phases, merge small phases, adjust success criteria, reorder phases — all in-place. Continue refining until the developer is satisfied. On any boundary change (split/merge/reorder), **rebuild `phases:` and `phase_count` from the `## Phase N:` headings** (re-populating each entry's `files:` from its `### Changes Required:` `**File**:` paths) — the implement fanout throws on a stale array.
|
|
357
357
|
- **When to re-invoke instead.** For surgical edits driven by review findings, prefer `/skill:revise <plan-path>`. Re-run `/skill:plan` only when the underlying design changed materially. The previous block's `Next step:` stays valid for the existing plan.
|
|
358
358
|
|
|
359
359
|
## Guidelines
|
|
@@ -399,9 +399,13 @@ Success Criteria are **authored upstream in `/skill:design` Step 6.1** and verif
|
|
|
399
399
|
|
|
400
400
|
**Two categories, same shape design produces:**
|
|
401
401
|
|
|
402
|
-
1. **Automated Verification** (run by execution agents):
|
|
402
|
+
1. **Automated Verification** (run by execution agents): the project's own test and lint commands, as recorded in its guidance `# Commands` table; file-existence checks; type checking; test suites.
|
|
403
403
|
2. **Manual Verification** (requires human): UI/UX, real-conditions performance, hard-to-automate edge cases, UAT.
|
|
404
404
|
|
|
405
|
+
**Write-scope rule (per-phase, mandatory before parallel implement):** every command in a phase's `#### Automated Verification:` block must be **write-scoped to that phase's own `files:` set** — running it must not modify anything outside the phase's `files:`. Phases run concurrently under build's parallel implement lane, so a command that rewrites the wider tree corrupts a sibling phase's in-flight edit; narrow any formatter or auto-fixer to the phase's paths (take the project's command vocabulary from its guidance `# Commands` table — where the table gives only an unscoped form, narrow it to the phase's paths rather than substituting a different tool). Read-only repo-wide commands (a type check, a non-fixing lint, a scoped test selection) are permitted. Whole-repo build/test verification belongs to the plan's final whole-plan block, owned by `validate` — never to a phase.
|
|
406
|
+
|
|
407
|
+
**Who runs AV lines:** `implement` runs each phase's own `#### Automated Verification:` commands in its shell and flips the checkboxes; `validate` re-runs them agent-side over the whole finished plan. Both are agents with a real shell and judgment — no deterministic harness re-executes these lines. Still prefer ONE self-contained command per line that exits 0 when the criterion holds, with the target path inside the backtick span; prose around the span is context for the agent, not executed syntax. Remember AV lines are written before sibling phases land: a check asserting another phase's rename target or source may be true at phase time and false on the final tree — scope each line to what YOUR phase owns.
|
|
408
|
+
|
|
405
409
|
**Format example:**
|
|
406
410
|
```markdown
|
|
407
411
|
### Success Criteria:
|
package/skills/research/SKILL.md
CHANGED
|
@@ -137,7 +137,7 @@ Findings go into Precedents & Lessons. Otherwise skip and note "git history unav
|
|
|
137
137
|
- Prioritize live codebase findings as primary source of truth
|
|
138
138
|
- Use `.rpiv/artifacts/` findings as supplementary historical context
|
|
139
139
|
- Include specific file paths and line numbers
|
|
140
|
-
- **Every `file:line` you emit must be VERIFIABLE against the file at this revision.** Before writing a citation, confirm the file exists and the cited line (or range end) is within it — cite what you actually read, never a remembered or guessed range. If you cannot verify a line number, cite the file path alone and omit the `:line`. Write paths **relative to the repo root** (`packages/billing/src/invoice.ts:
|
|
140
|
+
- **Every `file:line` you emit must be VERIFIABLE against the file at this revision.** Before writing a citation, confirm the file exists and the cited line (or range end) is within it — cite what you actually read, never a remembered or guessed range. If you cannot verify a line number, cite the file 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. A fabricated `file:line` (a range that matches no version of the file) propagates unbacked precision downstream — when the build workflow consumes this research, the slice map that rests on it fails the deterministic citation check at the `slice-check` gate, so an invented citation only bounces the flow.
|
|
141
141
|
- Build Code References as jump-table entries for the planner, not narrative (file:startLine-endLine format)
|
|
142
142
|
- No multi-line code blocks (>3 lines) — use file:line refs + prose. No implementation recipes — facts only.
|
|
143
143
|
- No artifact summaries — link plans/designs in Historical Context, don't summarize their contents. Research describes current codebase state.
|
|
@@ -149,9 +149,9 @@ Findings go into Precedents & Lessons. Otherwise skip and note "git history unav
|
|
|
149
149
|
|
|
150
150
|
Every question MUST embed at least one `file:line` reference in the question text — not just in surrounding context. Examples:
|
|
151
151
|
|
|
152
|
-
- "❓ Question: `src/events/orders.ts:
|
|
153
|
-
- "❓ Question: Pattern-finder found manual mapping at `src/services/OrderService.ts:
|
|
154
|
-
- "❓ Question: Precedent commit `abc123` required a follow-up fix at `src/handlers/key.ts:
|
|
152
|
+
- "❓ Question: `src/events/orders.ts:NN-NN` has 3 event hooks but no error recovery path. Is there a retry mechanism elsewhere I'm not seeing?"
|
|
153
|
+
- "❓ Question: Pattern-finder found manual mapping at `src/services/OrderService.ts:NN` (8 uses) vs AutoMapper at `src/services/UserService.ts:NN` (2 uses). Which should new code follow?"
|
|
154
|
+
- "❓ Question: Precedent commit `abc123` required a follow-up fix at `src/handlers/key.ts:NN` for connection leak. Should we account for that pattern in this design?"
|
|
155
155
|
|
|
156
156
|
Anti-patterns — NEVER ask these:
|
|
157
157
|
- "Is this research to understand X or prepare for Y?" — confirmatory, pulls zero new information
|
|
@@ -169,7 +169,8 @@ Findings go into Precedents & Lessons. Otherwise skip and note "git history unav
|
|
|
169
169
|
|
|
170
170
|
- **`ask_user_question` tool** — when your question has 2-4 concrete options from code analysis (pattern conflicts, integration choices, scope boundaries, priority overrides). The automatically appended `Type something.` row captures custom input. Example:
|
|
171
171
|
|
|
172
|
-
>
|
|
172
|
+
> `Header` is capped at ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
173
|
+
> Use the `ask_user_question` tool with the following question: "Found 2 patterns for retry logic — which is canonical?". Header: "Pattern". Options: "Event-sourced retry (Recommended)" (`src/events/orders.ts:NN-NN` — 3 hooks, matches precedent commit `abc123`); "Direct retry loop" (`src/services/OrderService.ts:NN` — single use, no event traceability).
|
|
173
174
|
|
|
174
175
|
- **Open-ended** (discovery, "what am I missing?", corrections) — still use `ask_user_question`; supply 2-4 concrete hypotheses with behavior, `file:line` evidence, impact, and decision context, then let the automatic `Type something.` row capture unanticipated detail.
|
|
175
176
|
|
|
@@ -177,7 +178,7 @@ Findings go into Precedents & Lessons. Otherwise skip and note "git history unav
|
|
|
177
178
|
|
|
178
179
|
❌ "The premise inversion is load-bearing for prioritization — it means Site A is a no-op, and the real bloat only hits general-purpose dispatches. Given this, where is the bloat actually landing? Do your skills dispatch named bundled agents — in which case append-mode is irrelevant — or general-purpose — in which case it IS the dominant source?"
|
|
179
180
|
|
|
180
|
-
✅ Extract the 2 concrete options and call `ask_user_question`: "Where is the prompt bloat landing?". Header: "Bloat source". Options: "Named bundled agents (Recommended)" (Skills dispatch `codebase-analyzer` etc. — `prompt_mode: "replace"`, no parent inheritance); "General-purpose agent" (`default-agents.ts:
|
|
181
|
+
✅ Extract the 2 concrete options and call `ask_user_question`: "Where is the prompt bloat landing?". Header: "Bloat source". Options: "Named bundled agents (Recommended)" (Skills dispatch `codebase-analyzer` etc. — `prompt_mode: "replace"`, no parent inheritance); "General-purpose agent" (`default-agents.ts:NN-NN` — `promptMode: "append"`, inherits full parent prompt).
|
|
181
182
|
|
|
182
183
|
**Batching**: When you have 2-4 independent questions (answers don't depend on each other), you MAY batch them in a single `ask_user_question` call. Keep dependent questions sequential.
|
|
183
184
|
|
|
@@ -262,8 +263,8 @@ Findings go into Precedents & Lessons. Otherwise skip and note "git history unav
|
|
|
262
263
|
...
|
|
263
264
|
|
|
264
265
|
## Code References
|
|
265
|
-
- `path/to/file.py:
|
|
266
|
-
- `another/file.ts:
|
|
266
|
+
- `path/to/file.py:NN` — Description of what's there
|
|
267
|
+
- `another/file.ts:NN-NN` — Description of the code block
|
|
267
268
|
|
|
268
269
|
## Integration Points
|
|
269
270
|
{All connections to the researched area. Enumerate each consumer, dependency, and wiring point with file:line. Source from the questions artifact's Discovery Summary + new connections found by analysis agents.}
|
|
@@ -122,6 +122,7 @@ When this command is invoked:
|
|
|
122
122
|
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
+
`Header` is capped at ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
125
126
|
Use the `ask_user_question` tool to confirm the approach. Question: "{Summary of recommended next action}. Proceed?". Header: "Resume". Options: "Proceed (Recommended)" (Begin with {recommended action 1}); "Adjust approach" (Change the order or scope of next steps); "Re-analyze" (The codebase has changed — re-verify state first).
|
|
126
127
|
|
|
127
128
|
### Step 4: Create Action Plan
|
package/skills/revise/SKILL.md
CHANGED
|
@@ -155,6 +155,7 @@ I plan to update the plan by:
|
|
|
155
155
|
Does this align with your intent?
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
+
`Header` is capped at ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
158
159
|
Use the `ask_user_question` tool to confirm before editing. Question: "{Summary of planned modifications}. Proceed with these edits?". Header: "Changes". Options: "Proceed (Recommended)" (Apply the planned changes to the existing plan); "Adjust approach" (Modify what will be changed before editing); "Show me first" (Show the exact text changes before applying).
|
|
159
160
|
|
|
160
161
|
### Step 4: Update the Plan
|
package/skills/slice/SKILL.md
CHANGED
|
@@ -90,9 +90,10 @@ 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 —
|
|
94
|
-
3. **Resolve ambiguity.** Settle from the research/code wherever you can. When a genuine decomposition fork remains (e.g. "
|
|
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`): in the build workflow the deterministic `slice-check` floor verifies every citation, and an ambiguous or unresolvable path fails the gate and forces a re-slice loop.
|
|
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
|
+
- `Header` is capped at ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
96
97
|
5. **Write the slice map** (below) with `status: ready`.
|
|
97
98
|
6. **Print the path**, then a one-line summary: `<N> slices: <comma-separated titles>`.
|
|
98
99
|
|
|
@@ -107,7 +108,7 @@ You are re-cutting an existing slice map from its verdicts. Unlike a surgical re
|
|
|
107
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.
|
|
108
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.
|
|
109
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.
|
|
110
|
-
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`.
|
|
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 documenting refreshed citations, quote each replaced citation ONLY as an `old→new` arrow pair (e.g. `` `:3699→:3721` ``) or inside a fenced code block — the deterministic cite-discharge treats arrow-adjacent and fenced occurrences as quotation; an old citation quoted bare in prose reads as still-live and forfeits the discharge, costing a full re-grade panel.
|
|
111
112
|
5. **Print** the path, then `re-sliced: <N> slices (was <M>) — addressed <failing dimensions>`.
|
|
112
113
|
|
|
113
114
|
## Output document
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: synthesize
|
|
3
3
|
description: Merge N independent per-slice designs (plus the research they rest on) into ONE coherent phased plan in .rpiv/artifacts/plans/ — reconciling cross-slice overlaps, wiring inter-slice integration, and ordering phases by slice dependencies. Single-pass, no subagents, no self-review. The fan-in barrier of a fanout-and-synthesize flow — one phase per slice, plan-compatible so implement/validate consume it unchanged. For large slice maps it also runs hierarchically — as a per-cluster partial (`--as-subplan` turns designs into a subplan) and as the root merge (`--subplans` turns subplans into a plan) — so no single pass must hold every design at once. Use after a per-slice design fanout.
|
|
4
|
-
argument-hint: "--designs <path>... [--research <path>] [--as-subplan] | --subplans <path>... [--research <path>]"
|
|
4
|
+
argument-hint: "--designs <path>... [--research <path>] [--as-subplan] [--cluster <k>] | --subplans <path>... [--research <path>]"
|
|
5
5
|
allowed-tools: Read, Grep, Glob, Write
|
|
6
6
|
shell-timeout: 10
|
|
7
7
|
disable-model-invocation: true
|
|
@@ -57,6 +57,7 @@ You merge several independent per-slice designs into **one coherent phased plan*
|
|
|
57
57
|
- `--subplans <path>` **(repeats)** — partial sub-plans from a cluster fanout (root mode).
|
|
58
58
|
- `--research <path>` *(optional)* — the research the slices rest on, for cross-slice constraints.
|
|
59
59
|
- `--as-subplan` *(flag)* — emit a **sub-plan** (partial mode) instead of a full plan.
|
|
60
|
+
- `--cluster <k>` *(optional, partial mode)* — the ordinal written into the sub-plan's `_cluster-<k>.md` filename. The cluster fanout supplies it; for manual partial invocation pick an unused `<k>` (scan `.rpiv/artifacts/subplans/` for existing `*_cluster-<k>.md` and take the next unused positive integer) so a re-dispatched pass writes a distinct file and never clobbers a sibling sub-plan.
|
|
60
61
|
|
|
61
62
|
If neither `--designs` nor `--subplans` is present, print an error and stop.
|
|
62
63
|
|
|
@@ -91,8 +92,11 @@ Copy values verbatim. `<iso>` is the first tab-separated field; `<slug>` is the
|
|
|
91
92
|
- **Overlap** — when two inputs touch the same file/symbol, merge them into a single coherent change (or split into ordered phases) rather than emitting contradictory edits.
|
|
92
93
|
- **Integration** — wire the seams: an input that depends on another's interface must reference the real shape the other defines. In root mode, this is where each sub-plan's `exports` get connected.
|
|
93
94
|
- **Conflict** — when two inputs make incompatible decisions, resolve to one, and record the resolution in Synthesis Notes (the grade panel's correctness/architecture-fit members will check it).
|
|
94
|
-
- **Risk flags** — a decision you're not confident is correct (an unverified assumption, an edge case wanting a second opinion) goes in the frontmatter `risks:` array as a `{ id, claim }` entry (stable `id`; `claim` = the one-line assertion to rule on) plus a `## Risk Flags` line — **never** buried in prose. This is the first-class channel grade and validate are REQUIRED to rule on; flag anything you'd otherwise write "flagging this so the grade panel can weigh in" about.
|
|
95
|
-
|
|
95
|
+
- **Risk flags** — a decision you're not confident is correct (an unverified assumption, an edge case wanting a second opinion) goes in the frontmatter `risks:` array as a `{ id, claim }` entry (stable `id`; `claim` = the one-line assertion to rule on) plus a `## Risk Flags` line — **never** buried in prose. This is the first-class channel grade and validate are REQUIRED to rule on; flag anything you'd otherwise write "flagging this so the grade panel can weigh in" about. Two optional fields tighten what "passing" means, so the gate can refuse a confident-but-ungrounded assertion (the honest-lazy class — a confident pass that never opened a file):
|
|
96
|
+
- **`claim_type: mechanics`** — the `claim` asserts a verified mechanism (a behavior that holds because code was checked). A grade panel ruling it `pass` MUST cite the checked `file:line` in that ruling's `evidence`, else the gate demotes the pass as un-grounded. Use it for risks like "the revert is byte-identical" or "the helper no-ops on absent fields" where the assertion is checkable against code right now.
|
|
97
|
+
- **`disposition: verify-at-implement`** — the panel may defer the risk to a later phase rather than rule it in this panel. A deferred pass is accepted ONLY when the flag ALSO carries a concrete **`procedure`** (the named command/test the owner phase runs to discharge it) and an **`owner`** (the phase `n` that runs that step); a bare "verify later" with no procedure demotes. Use it for risks that genuinely need the shipped tree (a real `build` run, a coverage gate) the plan-grade panel cannot run.
|
|
98
|
+
- Default (no `claim_type`, no `disposition`) stays the ordinary `{ id, claim }` shape — the panel rules it on the artifact as today, with no evidence or procedure duty.
|
|
99
|
+
3. **Sequence phases** — one phase per slice (flat/partial) or carry the sub-plans' phases through (root), ordered so a phase never precedes one it `depends_on`. Tightly-coupled units may merge into one phase; note any merge. Populate each entry's `files:` from that phase's `### Changes` paths (every repo-root-relative path the phase creates or edits) and `depends_on` only for semantic ordering NOT visible in `files:` (a phase that needs an earlier phase to run first despite no shared file) — lower `n` only.
|
|
96
100
|
4. **Write the output** (below), `status: ready`:
|
|
97
101
|
- **Flat / root** → a standard **plan** in `.rpiv/artifacts/plans/` — phases with concrete changes and Success Criteria that pass through unchanged to `implement`/`validate`.
|
|
98
102
|
- **Partial** (`--as-subplan`) → a **sub-plan** in `.rpiv/artifacts/subplans/` — the same phase shape PLUS a `summary` and an `exports` block naming the seams (files/symbols/interfaces this cluster owns) the root will wire other clusters into. Keep it compact: the root reads it instead of your cluster's designs.
|
|
@@ -103,7 +107,7 @@ This skill is **non-interactive**: when a conflict can't be cleanly resolved, ma
|
|
|
103
107
|
## Output document
|
|
104
108
|
|
|
105
109
|
**Flat / root mode** → Path: `.rpiv/artifacts/plans/<slug>_<topic>.md`.
|
|
106
|
-
**Partial mode** (`--as-subplan`) → Path: `.rpiv/artifacts/subplans/<slug>_cluster-<k>.md
|
|
110
|
+
**Partial mode** (`--as-subplan`) → Path: `.rpiv/artifacts/subplans/<slug>_cluster-<k>.md` — `<k>` is the verbatim `--cluster <k>` value (the cluster fanout always supplies it; for manual partial invocation pick an unused `<k>`: scan `.rpiv/artifacts/subplans/` for existing `*_cluster-<k>.md` and take the next unused positive integer, so a re-dispatched pass never clobbers a sibling sub-plan). Same body shape plus a `summary:` scalar and an `exports:` list in frontmatter, e.g.:
|
|
107
111
|
|
|
108
112
|
```yaml
|
|
109
113
|
summary: "<one-paragraph what this cluster delivers>"
|
|
@@ -125,10 +129,12 @@ topic: "<topic>"
|
|
|
125
129
|
status: ready
|
|
126
130
|
phase_count: <N>
|
|
127
131
|
phases:
|
|
128
|
-
- { n: 1, title: "<title>", slice: 1 }
|
|
129
|
-
- { n: 2, title: "<title>", slice: 2 }
|
|
132
|
+
- { n: 1, title: "<title>", slice: 1, files: ["path/to/file.ts"], depends_on: [] }
|
|
133
|
+
- { n: 2, title: "<title>", slice: 2, files: ["path/to/other.ts"], depends_on: [1] }
|
|
130
134
|
risks:
|
|
131
135
|
- { id: r1, claim: "<a decision you want the grade panel + validate to rule on>" }
|
|
136
|
+
- { id: r2, claim: "<a checkable mechanism>", claim_type: mechanics }
|
|
137
|
+
- { id: r3, claim: "<needs the shipped tree to discharge>", disposition: verify-at-implement, procedure: "<named command/test>", owner: <phase n> }
|
|
132
138
|
sources: [<each --designs path>, <--research path>]
|
|
133
139
|
tags: [plan, synthesized]
|
|
134
140
|
---
|
|
@@ -160,6 +166,9 @@ tags: [plan, synthesized]
|
|
|
160
166
|
## Hard rules
|
|
161
167
|
|
|
162
168
|
- Exactly one `## Phase N:` heading per `phases:` entry; `phase_count` == array length == heading count. Number `n` contiguously `1..N`.
|
|
163
|
-
-
|
|
169
|
+
- **`files:` contract.** Every path a phase creates or edits MUST be listed in that phase's `files:` array (repo-root-relative, never a bare basename) — the same floor-backing reason body citations carry: the plan-time coverage floor (`plan-cite-check`/`code-cite-check`) flags a body edit path absent from `files:`, and a later dep-gated implement fanout derives phase edges from `files:` overlap. A `files:`-less entry degrades to "no check" (legacy-safe), but a `synthesize` plan always declares `files:`.
|
|
170
|
+
- **Write-scope rule (per-phase, mandatory before parallel implement).** Every command in a phase's `#### Automated Verification:` block must be **write-scoped to that phase's own `files:` set** — running it must not modify anything outside the phase's `files:`. Phases run concurrently under build's parallel implement lane, so a command that rewrites the wider tree corrupts a sibling phase's in-flight edit; narrow any formatter or auto-fixer to the phase's paths (take the project's command vocabulary from its guidance `# Commands` table — where the table gives only an unscoped form, narrow it to the phase's paths rather than substituting a different tool). Read-only repo-wide commands (a type check, a non-fixing lint, a scoped test selection) are permitted. Whole-repo build/test verification belongs to the plan's final whole-plan block, owned by `validate` — never to a phase.
|
|
171
|
+
- **Who runs AV lines.** `implement` runs each phase's own `#### Automated Verification:` commands in its shell and flips the checkboxes; `validate` re-runs them agent-side over the whole finished plan. Both are agents with a real shell and judgment — no deterministic harness re-executes these lines. Still prefer ONE self-contained command per line that exits 0 when the criterion holds, with the target path inside the backtick span; prose around the span is context for the agent, not executed syntax. Remember AV lines are written before sibling phases land: a check asserting another phase's rename target or source may be true at phase time and false on the final tree — scope each line to what YOUR phase owns.
|
|
164
172
|
- **Plan-compatible output.** Phases + Success Criteria in the standard plan shape so `implement` and `validate` consume it with no changes.
|
|
165
173
|
- **No subagents. No self-review. No questions.** Merge, record open risks in Synthesis Notes, write.
|
|
174
|
+
- **`sources:` lists every `--designs` path.** In partial mode especially (each cluster sub-plan lists its own `--designs` paths), the frontmatter `sources:` array MUST contain every `--designs <path>` the orchestrator threaded in — and the `--research` path when given. Omitting one hides a slice from the `subplan-check` cluster-coverage floor, which reconciles dispatched sub-plans against the slice map by reading `sources:` (a design whose slice appears in no sub-plan's `sources:` routes the whole cluster fanout back to a re-dispatch). Mirror the plan template's `sources: [<each --designs path>, <--research path>]` exactly.
|
package/skills/validate/SKILL.md
CHANGED
|
@@ -131,6 +131,7 @@ For each phase in the plan:
|
|
|
131
131
|
7. **Rule every plan risk flag** (when the plan carries a `risks:` frontmatter array):
|
|
132
132
|
- The plan's `risks:` array (each `{ id, claim }`, described under `## Risk Flags`) is the structured channel of decisions the planner asked to have checked. You are REQUIRED to rule on each one against the actual implementation — not skip it.
|
|
133
133
|
- For each flag, verify its `claim` against the delivered code (Read/Grep the relevant `file:line`) and record a `risk_rulings: [{ id, pass }]` entry — `pass: true` when the risk is unfounded or handled, `pass: false` when it is real and unaddressed in the shipped code.
|
|
134
|
+
- **For a `disposition: verify-at-implement` flag**, do not just Read/Grep — RUN its declared `procedure` (the named command/test the plan's `owner` phase promised) against the shipped code and rule `pass: false` if that procedure fails. This is the phase that discharges the deferral the plan-grade panel accepted on trust; a deferred risk whose procedure now fails is exactly the un-addressed-defect class this gate catches. A mechanics (`claim_type: mechanics`) flag is verified against its shipped `file:line` as above.
|
|
134
135
|
- **Any `pass: false` ruling forces `verdict: fail`** and is reported under **Potential Issues**, quoting the flag's claim. A flagged risk that shipped unaddressed is exactly the class of defect this gate exists to catch.
|
|
135
136
|
|
|
136
137
|
### Step 3: Write the Validation Report
|