@juicesharp/rpiv-pi 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +121 -271
- package/agents/scope-tracer.md +1 -1
- package/docs/agents.md +70 -0
- package/docs/architecture.md +136 -0
- package/docs/lanes.md +82 -0
- package/docs/models-config.md +200 -0
- package/docs/skills.md +86 -0
- package/docs/workflows.md +109 -0
- package/extensions/rpiv-core/bash-timeout.ts +16 -0
- package/extensions/rpiv-core/built-in-workflows.ts +2363 -278
- package/extensions/rpiv-core/guidance.ts +35 -19
- package/extensions/rpiv-core/lane-list.ts +5 -29
- package/extensions/rpiv-core/lane-progress.ts +5 -76
- package/extensions/rpiv-core/models-config.ts +35 -0
- package/extensions/rpiv-core/run-lane-registry.ts +0 -65
- package/extensions/rpiv-core/sdk-workflow-host.ts +4 -0
- package/extensions/rpiv-core/workflow-execution-host.ts +24 -7
- package/package.json +7 -3
- package/skills/amend/SKILL.md +7 -3
- package/skills/annotate-guidance/SKILL.md +2 -3
- package/skills/annotate-inline/SKILL.md +1 -3
- package/skills/architecture-review/SKILL.md +5 -4
- package/skills/blueprint/SKILL.md +14 -6
- package/skills/changelog/SKILL.md +1 -0
- package/skills/commit/SKILL.md +1 -0
- package/skills/design/SKILL.md +8 -5
- package/skills/design-review/SKILL.md +2 -1
- package/skills/design-slice/SKILL.md +2 -1
- package/skills/discover/SKILL.md +3 -4
- package/skills/elaborate/SKILL.md +17 -5
- package/skills/elaborate/_helpers/validate-workflow-invariant.mjs +88 -0
- package/skills/explore/SKILL.md +1 -0
- package/skills/frontend-design/SKILL.md +1 -0
- package/skills/grade/SKILL.md +20 -3
- package/skills/implement/SKILL.md +10 -2
- package/skills/plan/SKILL.md +10 -6
- package/skills/research/SKILL.md +14 -12
- package/skills/resume-handoff/SKILL.md +2 -1
- package/skills/revise/SKILL.md +1 -0
- package/skills/slice/SKILL.md +3 -2
- package/skills/synthesize/SKILL.md +16 -7
- package/skills/validate/SKILL.md +2 -1
|
@@ -68,7 +68,8 @@ The final artifact is blueprint-consumable per phase.
|
|
|
68
68
|
|
|
69
69
|
### Step 1: Identify the Target
|
|
70
70
|
|
|
71
|
-
1. **Argument is empty:** use the `ask_user_question` tool with the following question: "What are we reviewing?". Header: "Target". Options: "Single module" (one package / project / crate / namespace directory); "Single subdirectory" (a subtree inside a module); "Single file" (deep review of one large file)
|
|
71
|
+
1. **Argument is empty:** use the `ask_user_question` tool with the following question: "What are we reviewing?". Header: "Target". Options: "Single module" (one package / project / crate / namespace directory); "Single subdirectory" (a subtree inside a module); "Single file" (deep review of one large file). The automatic `Type something.` row accepts a custom target.
|
|
72
|
+
- `Header` is capped at ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
72
73
|
|
|
73
74
|
2. **Validate the target exists**. Use `ls` via the Bash tool on the resolved path. If missing, ask for a corrected path.
|
|
74
75
|
|
|
@@ -235,7 +236,7 @@ Layers mirror dependency direction. Higher layers consume lower-layer vocabulary
|
|
|
235
236
|
{One paragraph: what unifies these findings, what the theme thread delivers when implemented, what the closing finding is if any.}
|
|
236
237
|
```
|
|
237
238
|
|
|
238
|
-
3. **Confirm grouping** via the `ask_user_question` tool: "{N} cross-cutting themes: {T1 — name; T2 — name; ...}. Approve grouping or adjust?". Header: "Themes". Options: "Approve grouping (Recommended)"; "Merge themes" (developer names which); "Split a theme" (developer names which)
|
|
239
|
+
3. **Confirm grouping** via the `ask_user_question` tool: "{N} cross-cutting themes: {T1 — name; T2 — name; ...}. Approve grouping or adjust?". Header: "Themes". Options: "Approve grouping (Recommended)"; "Merge themes" (developer names which); "Split a theme" (developer names which). The automatic `Type something.` row captures another grouping request.
|
|
239
240
|
|
|
240
241
|
### Step 8: Consolidated Polish Plan
|
|
241
242
|
|
|
@@ -275,7 +276,7 @@ Phases are agent-driven: each one will be handed to `blueprint` → `implement`.
|
|
|
275
276
|
Phase 6 (Public-API)
|
|
276
277
|
```
|
|
277
278
|
|
|
278
|
-
6. **Confirm the plan + flip status.** Use the `ask_user_question` tool: "{N} phases ({F} findings across {Files} files). Approve or adjust?". Header: "Plan". Options: "Approve (Recommended)" (**rebuild the `phases:` frontmatter array from the `### Phase N — name` headings** — one `{ n, title, depends_on, blast_radius, effort }` entry per heading, in body order: `depends_on` from the dependency graph (Step 5, earlier phases only), `blast_radius` the phase's widest of `internal`/`public-API`/`on-disk`/`cross-module` (Step 3), `effort` `S`/`M`/`L`; e.g. `phases: [{ n: 1, title: Foundation, depends_on: [], blast_radius: internal, effort: S }, { n: 2, title: Vocabulary, depends_on: [1], blast_radius: internal, effort: M }]`; then Edit frontmatter `status: in-progress` → `status: ready`, proceed to Step 9); "Adjust phase boundaries" (describe); "Resequence phases" (describe)
|
|
279
|
+
6. **Confirm the plan + flip status.** Use the `ask_user_question` tool: "{N} phases ({F} findings across {Files} files). Approve or adjust?". Header: "Plan". Options: "Approve (Recommended)" (**rebuild the `phases:` frontmatter array from the `### Phase N — name` headings** — one `{ n, title, depends_on, blast_radius, effort }` entry per heading, in body order: `depends_on` from the dependency graph (Step 5, earlier phases only), `blast_radius` the phase's widest of `internal`/`public-API`/`on-disk`/`cross-module` (Step 3), `effort` `S`/`M`/`L`; e.g. `phases: [{ n: 1, title: Foundation, depends_on: [], blast_radius: internal, effort: S }, { n: 2, title: Vocabulary, depends_on: [1], blast_radius: internal, effort: M }]`; then Edit frontmatter `status: in-progress` → `status: ready`, proceed to Step 9); "Adjust phase boundaries" (describe); "Resequence phases" (describe). The automatic `Type something.` row captures another adjustment.
|
|
279
280
|
|
|
280
281
|
### Step 9: Present and Chain
|
|
281
282
|
|
|
@@ -332,7 +333,7 @@ Spawn multiple agents in parallel when they're searching for different things. E
|
|
|
332
333
|
|
|
333
334
|
## Important Notes
|
|
334
335
|
|
|
335
|
-
- **All checkpoints are `ask_user_question`** — no prose "ask the user". The tool
|
|
336
|
+
- **All checkpoints are `ask_user_question`** — no prose "ask the user". The tool automatically appends the `Type something.` free-text row; do not author `Other` as an option.
|
|
336
337
|
- **Read all in-scope files FULLY** in Step 5.1 — no limit/offset on the Read tool. Selective reads bias findings toward what you happened to load.
|
|
337
338
|
- **Edit the artifact progressively in Step 5.4** — never batch all findings into one final write. The artifact is the durable checkpoint between sessions.
|
|
338
339
|
- **Critical ordering:**
|
|
@@ -150,6 +150,7 @@ Use the grounded-questions-one-at-a-time pattern. Use a **❓ Question:** prefix
|
|
|
150
150
|
- Reference real findings with `file:line` evidence
|
|
151
151
|
- Present concrete options (not abstract choices)
|
|
152
152
|
- Pull a DECISION from the developer, not confirm what you already found
|
|
153
|
+
- Keep `Header` ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
153
154
|
|
|
154
155
|
**Directional confirms first.** Before the one-at-a-time questions, clear every **directional** finding from Step 3 in a single batched `ask_user_question` (up to 4 per call). Do not mark the "follow" option Recommended.
|
|
155
156
|
|
|
@@ -170,13 +171,15 @@ Use the grounded-questions-one-at-a-time pattern. Use a **❓ Question:** prefix
|
|
|
170
171
|
- Lead with the most architecturally significant ambiguity.
|
|
171
172
|
- Every answer becomes a FIXED decision — no revisiting unless the developer explicitly asks.
|
|
172
173
|
|
|
174
|
+
- Every ambiguity checkpoint MUST be self-contained: state observed behavior, at least one `file:line` evidence reference, why the decision matters, and 2-4 concrete decision options in the question or option descriptions.
|
|
175
|
+
|
|
173
176
|
**Choosing question format:**
|
|
174
177
|
|
|
175
|
-
- **`ask_user_question` tool** —
|
|
178
|
+
- **`ask_user_question` tool** — concrete options include evidence and trade-offs in every description. The user can type a custom answer through the automatically appended `Type something.` row; do not author `Other`. Example:
|
|
176
179
|
|
|
177
|
-
> Use the `ask_user_question` tool with the following question: "Found 2 mapping approaches — which should new code follow?". Header: "Pattern". Options: "Manual mapping (Recommended)" (Used in OrderService (src/services/OrderService.ts:
|
|
180
|
+
> Use the `ask_user_question` tool with the following question: "Found 2 mapping approaches — which should new code follow?". Header: "Pattern". Options: "Manual mapping (Recommended)" (Used in OrderService (src/services/OrderService.ts:NN) — 8 occurrences); "AutoMapper" (Used in UserService (src/services/UserService.ts:NN) — 2 occurrences).
|
|
178
181
|
|
|
179
|
-
- **Open-ended**
|
|
182
|
+
- **Open-ended** — 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.
|
|
180
183
|
|
|
181
184
|
**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.
|
|
182
185
|
|
|
@@ -368,6 +371,11 @@ Use the `ask_user_question` tool to confirm. Question: "Slice {N/M}: {slice name
|
|
|
368
371
|
- [ ] New widget renders correctly above the editor
|
|
369
372
|
- [ ] Performance acceptable with 1000+ todo items
|
|
370
373
|
```
|
|
374
|
+
|
|
375
|
+
**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.
|
|
376
|
+
|
|
377
|
+
**Exit-0 contract (the `reconcile` stage re-runs AV lines verbatim):** after implement, `reconcile` re-executes the FIRST backtick span of every `- [ ]` line in `#### Automated Verification:` via `execFileSync` — arg-array (no shell: no `|`/`&&`/redirection), stdin ignored, exit 0 the ONLY pass signal. Prose around the span never executes, and a non-zero exit halts the run with no fix arm. So every AV line must be ONE self-contained command that exits 0 exactly when the criterion holds: name the target file INSIDE the span (never "over `<file>`" in prose — the command then greps an empty stdin and always fails); never assert absence ("returns nothing" — grep exits 1 on no match, so that line can ONLY fail; restate it to exit 0 on success, e.g. a `node -e` probe that inverts the check, or move it to `#### Manual Verification:`); never rely on prose expected counts ("returns `4`" — fold the assertion into the command itself); never point a formatter at paths outside its configured scope (Biome on a doc-only phase's `.md` exits non-zero with "No files were processed"). The `plan-cite-check`/`code-cite-check` floor lints these shapes and routes violations into a plan-fix round; anything it cannot catch statically still kills the run at `reconcile`.
|
|
378
|
+
|
|
371
379
|
5. Update the Plan History section: `- Phase N: {name} — approved as generated`
|
|
372
380
|
6. Decrement frontmatter `unresolved_phase_count` by 1
|
|
373
381
|
- Proceed to next slice
|
|
@@ -391,11 +399,11 @@ The artifact was created as a skeleton in Step 5 and filled progressively in Ste
|
|
|
391
399
|
|
|
392
400
|
If any check fails, return to Step 6. Do NOT flip status. (7.1 and 7.2 guard the same invariant — empty content ↔ unresolved counter.)
|
|
393
401
|
|
|
394
|
-
Then **rebuild the `phases:` frontmatter array from the `## Phase N:` headings** — one `{ n, title }` entry per section, in body order:
|
|
402
|
+
Then **rebuild the `phases:` frontmatter array from the `## Phase N:` headings** — one `{ n, title, files, depends_on }` entry per section, in body order. Populate `files:` from each phase's `#### N. path/to/file.ext` + `**File**:` entries and `depends_on` (lower `n` only) from the decomposition's `Depends on:` lines:
|
|
395
403
|
```yaml
|
|
396
404
|
phases:
|
|
397
|
-
- { n: 1, title: Schema layer }
|
|
398
|
-
- { n: 2, title: Runtime wiring }
|
|
405
|
+
- { n: 1, title: Schema layer, files: [src/schema.ts], depends_on: [] }
|
|
406
|
+
- { n: 2, title: Runtime wiring, files: [src/runtime.ts], depends_on: [1] }
|
|
399
407
|
```
|
|
400
408
|
|
|
401
409
|
3. **Update frontmatter** via Edit: `status: in-progress` → `status: in-review` (Step 9 flips to `ready` after triage — keeps consumers off an artifact still being edited). Leave `last_updated` / `last_updated_by` as-is.
|
|
@@ -155,6 +155,7 @@ What this example demonstrates:
|
|
|
155
155
|
2. Print the proposed `[Unreleased]` body for each affected CHANGELOG, in full.
|
|
156
156
|
3. Call `ask_user_question`:
|
|
157
157
|
- Question: "Apply regenerated `[Unreleased]` to {N} CHANGELOG(s)?"
|
|
158
|
+
- `Header` is capped at ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
158
159
|
- Header: "Changelog"
|
|
159
160
|
- Options:
|
|
160
161
|
- "Apply (Recommended)" — Write the regenerated sections to disk. Refinement, if needed, happens afterward in normal chat (`Edit` tool) or via `git restore` to roll back.
|
package/skills/commit/SKILL.md
CHANGED
|
@@ -67,6 +67,7 @@ node "${SKILL_DIR}/../_shared/git-changes.mjs" --baseline <path>
|
|
|
67
67
|
- List the files you plan to add for each commit
|
|
68
68
|
- Show the commit message(s) you'll use
|
|
69
69
|
- Use the `ask_user_question` tool to confirm the commit plan. Question: "{N} commit(s) with {M} files. Proceed?". Header: "Commit". Options: "Commit (Recommended)" (Create the commit(s) as planned); "Adjust" (Change the grouping or commit messages); "Review files" (Show me the full diff before committing).
|
|
70
|
+
- `Header` is capped at ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
70
71
|
|
|
71
72
|
4. **Execute upon confirmation:**
|
|
72
73
|
- Use `git add` with specific files (never use `-A` or `.`) — and stage **only** files from the `---status---` block. Any path under `---pre-existing (do NOT commit …)---` is out of scope: leave it dirty, never stage it.
|
package/skills/design/SKILL.md
CHANGED
|
@@ -136,6 +136,7 @@ Use the grounded-questions-one-at-a-time pattern. Use a **❓ Question:** prefix
|
|
|
136
136
|
- Reference real findings with `file:line` evidence
|
|
137
137
|
- Present concrete options (not abstract choices)
|
|
138
138
|
- Pull a DECISION from the developer, not confirm what you already found
|
|
139
|
+
- Keep `Header` ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
139
140
|
|
|
140
141
|
**Directional confirms first.** Before the one-at-a-time questions, clear every **directional** finding from Step 3 in a single batched `ask_user_question` (up to 4 per call). Do not mark the "follow" option Recommended.
|
|
141
142
|
|
|
@@ -156,13 +157,15 @@ Use the grounded-questions-one-at-a-time pattern. Use a **❓ Question:** prefix
|
|
|
156
157
|
- Lead with the most architecturally significant ambiguity.
|
|
157
158
|
- Every answer becomes a FIXED decision — no revisiting unless the developer explicitly asks.
|
|
158
159
|
|
|
160
|
+
- Every ambiguity checkpoint MUST be self-contained: state observed behavior, at least one `file:line` evidence reference, why the decision matters, and 2-4 concrete decision options in the question or option descriptions.
|
|
161
|
+
|
|
159
162
|
**Choosing question format:**
|
|
160
163
|
|
|
161
|
-
- **`ask_user_question` tool** —
|
|
164
|
+
- **`ask_user_question` tool** — concrete options include evidence and trade-offs in every description. The user can type a custom answer through the automatically appended `Type something.` row; do not author `Other`. Example:
|
|
162
165
|
|
|
163
166
|
> Use the `ask_user_question` tool with the following question: "Found 2 mapping approaches — which should new code follow?". Header: "Pattern". Options: "Manual mapping (Recommended)" (Used in OrderService (src/services/OrderService.ts:45) — 8 occurrences); "AutoMapper" (Used in UserService (src/services/UserService.ts:12) — 2 occurrences).
|
|
164
167
|
|
|
165
|
-
- **Open-ended**
|
|
168
|
+
- **Open-ended** — 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.
|
|
166
169
|
|
|
167
170
|
**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.
|
|
168
171
|
|
|
@@ -274,7 +277,7 @@ Generate complete, copy-pasteable code AND the slice's `### Success Criteria:` f
|
|
|
274
277
|
- **Modified files**: read current file FULLY, generate only the modified/added code scoped to changed sections (no full "Current" block — the original is on disk)
|
|
275
278
|
- **Test files**: complete test suites following project patterns
|
|
276
279
|
- **Wiring**: show where new code hooks into existing code
|
|
277
|
-
- **Success Criteria**: derive `### Success Criteria:` from this slice's file changes plus `## Verification Notes` entries that map to this slice's scope. Use the same `- [ ]` format as 6.4 (see template below). Project-baseline checks (
|
|
280
|
+
- **Success Criteria**: derive `### Success Criteria:` from this slice's file changes plus `## Verification Notes` entries that map to this slice's scope. Use the same `- [ ]` format as 6.4 (see template below). Project-baseline checks (the project's whole-repo build/test commands, from its guidance `# Commands` table) go on the terminal slice only. Commands in backticks. Criteria authored here flow through to plan as the phase's Success Criteria — slice ≡ phase, 1:1.
|
|
278
281
|
|
|
279
282
|
If additional context is needed, spawn a targeted **codebase-analyzer** agent.
|
|
280
283
|
|
|
@@ -334,8 +337,8 @@ Use the `ask_user_question` tool to confirm. Question: "Slice {N/M}: {slice name
|
|
|
334
337
|
**Files**: `path/to/file1.ext`, `path/to/file2.ext`
|
|
335
338
|
|
|
336
339
|
#### Automated Verification:
|
|
337
|
-
- [ ] Type checking passes: `
|
|
338
|
-
- [ ] Tests pass: `
|
|
340
|
+
- [ ] Type checking passes: `{project typecheck command}`
|
|
341
|
+
- [ ] Tests pass: `{project test command}`
|
|
339
342
|
- [ ] Grep pattern from Verification Note: `grep -r "newApi" packages/ | wc -l` returns >= 3
|
|
340
343
|
|
|
341
344
|
#### Manual Verification:
|
|
@@ -54,7 +54,8 @@ The first tab-separated field is `<iso>` (use as `last_updated` when you edit a
|
|
|
54
54
|
|
|
55
55
|
Lead with the data types and interface surface — that is the contract the developer is signing off on.
|
|
56
56
|
|
|
57
|
-
3. **Ask the developer to accept or adjust** with the `ask_user_question` tool. Question: "Proposed design across {N} slices ({F} files). Accept, or adjust a slice?". Header: "Design". Options: "Accept (Recommended)" (Proceed to synthesis — merge the per-slice designs into the plan); "Adjust a slice" (Change a slice's approach, interfaces, data types, or scope before synthesis — describe which slice and what). The developer
|
|
57
|
+
3. **Ask the developer to accept or adjust** with the `ask_user_question` tool. Question: "Proposed design across {N} slices ({F} files). Accept, or adjust a slice?". Header: "Design". Options: "Accept (Recommended)" (Proceed to synthesis — merge the per-slice designs into the plan); "Adjust a slice" (Change a slice's approach, interfaces, data types, or scope before synthesis — describe which slice and what). The developer may use the automatically appended `Type something.` row to provide an unanticipated adjustment; do not author an `Other` option.
|
|
58
|
+
- `Header` is capped at ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
58
59
|
|
|
59
60
|
4. **On Adjust — apply surgically and cascade, then re-present (loop back to Step 2).** Classify the change:
|
|
60
61
|
|
|
@@ -61,6 +61,7 @@ Copy values verbatim. `<iso>` is the first tab-separated field; `<slug>` is the
|
|
|
61
61
|
- **Integration points** — where this slice wires into existing code (and into sibling slices it depends on, by file/symbol — referencing the real shapes from the upstream `## Key Interfaces`).
|
|
62
62
|
- **Success criteria** — concrete `- [ ]` checks that prove the slice works.
|
|
63
63
|
5. **Resolve ambiguity:** decide from the slice map, the upstream designs, research, and code wherever you can. Use `ask_user_question` (2–4 concrete options, one at a time) ONLY when you can't settle it from those inputs — either a genuine design fork within this slice, **or** a contract this slice depends on is still an undecided fork in an upstream's `## Notes / Deferred`. Do **not** ask the user to approve the finished design — the grade panel owns that.
|
|
64
|
+
- `Header` is capped at ≤16 characters (`MAX_HEADER_LENGTH = 16` — longer values are rejected).
|
|
64
65
|
6. **Write the design doc** (below), `status: ready`.
|
|
65
66
|
7. **Print the path**, then a one-line summary: `Slice N design: <k> files, <m> success criteria`.
|
|
66
67
|
|
|
@@ -97,7 +98,7 @@ tags: [design, slice]
|
|
|
97
98
|
|
|
98
99
|
## Integration Points
|
|
99
100
|
- `path:line` — <how this slice wires in; name sibling slices it couples to>
|
|
100
|
-
<!-- `path` is the repo-root-relative path (`packages/.../foo.ts:
|
|
101
|
+
<!-- `path` is the repo-root-relative path (`packages/.../foo.ts:NN`), never a subdirectory-relative form or a bare basename: the plan's deterministic cite-check floor verifies it, and an ambiguous or unresolvable path fails. -->
|
|
101
102
|
|
|
102
103
|
## Success Criteria
|
|
103
104
|
- [ ] <concrete, checkable>
|
package/skills/discover/SKILL.md
CHANGED
|
@@ -55,7 +55,7 @@ The final artifact is research-compatible — its Decisions block is translated
|
|
|
55
55
|
|
|
56
56
|
2. **Detect input shape** — parse the input:
|
|
57
57
|
- If the argument is an existing file path (resolves to a readable `.md` under `.rpiv/artifacts/`, or any path the user mentions for refinement context), read it FULLY using the Read tool WITHOUT limit/offset. Treat its content as baseline context — the interview surfaces gaps, missing requirements, and unstated assumptions relative to what's already documented.
|
|
58
|
-
-
|
|
58
|
+
- Plain free-text input → fresh-feature mode: the entire argument is the free-text feature description.
|
|
59
59
|
|
|
60
60
|
3. **Read any other files mentioned** in the prompt (tickets, docs, related artifacts, explicit `path:line` references) FULLY before proceeding.
|
|
61
61
|
|
|
@@ -71,8 +71,7 @@ Before any codebase probe, ask the foundational intent question. This is purely
|
|
|
71
71
|
- Frame: "What problem are you solving and who hits it?" / "What does success look like for the person experiencing this today?" — phrase it for the specific feature.
|
|
72
72
|
- **No `(Recommended)` option.** The developer should generate the framing, not pick from a proposal.
|
|
73
73
|
- **No `file:line` citations** — codebase has nothing to say about intent.
|
|
74
|
-
- Options should be open shapes (
|
|
75
|
-
- Always offer "Other" so the developer can free-text the real framing.
|
|
74
|
+
- Options should be open shapes (for example, "End user", "Maintainer", or "Operator") that route the answer, not solution shapes. The automatically appended `Type something.` row lets the developer supply a different framing; do not author an `Other` option.
|
|
76
75
|
|
|
77
76
|
2. **Capture the answer in the developer's own words.** This text feeds into the FRD's Problem & Intent section verbatim — do not paraphrase into agent prose.
|
|
78
77
|
|
|
@@ -132,7 +131,7 @@ Walk the lazy tree depth-first, parent before child. Expand the next layer (buil
|
|
|
132
131
|
|
|
133
132
|
2. **Recommended answer** (`scope` / `shape` / `detail`): derive from intent + Step 3 evidence + project conventions. Every non-intent question carries a recommendation labeled `(Recommended)`.
|
|
134
133
|
|
|
135
|
-
3. **Ask via `ask_user_question`.** Lead with the recommended option. The
|
|
134
|
+
3. **Ask via `ask_user_question`.** Lead with the recommended authored option. The automatic `Type something.` custom-answer row handles open-ended answers; do not author an `Other` option.
|
|
136
135
|
|
|
137
136
|
4. **Critical rules**:
|
|
138
137
|
- Ask ONE question at a time. Wait for the answer before asking the next.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: elaborate
|
|
3
3
|
description: Write implement-ready code into ONE phase of a synthesized plan — read the whole plan plus the real code the phase touches, then emit a code-bearing replacement for that single `## Phase N:` section to .rpiv/artifacts/elaborations/. Single-pass, no subagents, no self-review, no questions. Dispatched once per phase by an elaborate fanout after synthesize; the per-phase elaborations are folded back into the plan by the deterministic `stitch-elaborations` script, and the grade panel judges the stitched plan. Use as a fanout unit, not standalone.
|
|
4
4
|
argument-hint: "<plan-path> Phase N: <title>"
|
|
5
|
-
allowed-tools: Read, Grep, Glob,
|
|
5
|
+
allowed-tools: Read, Edit, Write, Grep, Glob, Bash(git restore *), Bash(git checkout *), Bash(git status*), Bash(rm *), Bash(npx tsc *), Bash(npm run check:files *), Bash(npx biome check *), Bash(node *)
|
|
6
6
|
shell-timeout: 10
|
|
7
7
|
disable-model-invocation: true
|
|
8
8
|
contract:
|
|
@@ -52,8 +52,18 @@ Copy values verbatim. `<iso>` is the first tab-separated field (use as `date`);
|
|
|
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).
|
|
55
|
-
6. **
|
|
56
|
-
|
|
55
|
+
6. **Self-check (probe → revert → guard).** Before emitting, verify the drafted code blocks actually apply and typecheck at their REAL placement — declaration-order / `const`-TDZ (TS2448/2454) and contract-routing defects only surface when a block lands at its true anchor, not an idealized layout. Define **write-scope** = the set of repo-root-relative paths the phase's `### Changes` names (the files below this step's emitted `#### \`...\`` headings); the whole self-check applies and reverts ONLY those paths so the `FRONTMATTER_PHASE_FANOUT` parallelism (`packages/rpiv-pi/extensions/rpiv-core/built-in-workflows.ts:229`) is preserved — never touch a sibling phase's files. The cycle is exactly:
|
|
56
|
+
- **Snapshot.** Capture `git status --porcelain` BEFORE the probe (the byte-identical revert target).
|
|
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 (`validate-workflow-invariant.mjs`/`.test.ts`) are written for the probe.
|
|
58
|
+
- **Verify, in order, attributing only write-scope errors:**
|
|
59
|
+
1. `npx tsc --noEmit -p tsconfig.base.json` — a read-only repo-wide typecheck; attribute ONLY errors whose file path is in `write-scope` (sibling units' in-flight edits surface as cross-file noise — `c2r1` — and are NOT yours to act on; revert past them). Re-derive and fix drafted blocks from the attributed errors until clean.
|
|
60
|
+
2. `npm run check:files -- <write-scope files>` — scoped Biome (`--write --error-on-warnings`); may rewrite ONLY the write-scope paths it is given.
|
|
61
|
+
3. ONLY when `packages/rpiv-pi/extensions/rpiv-core/built-in-workflows.ts` is in `write-scope`: `node "${SKILL_DIR}/_helpers/validate-workflow-invariant.mjs"` — re-derives the live built-in workflows + contracts and surfaces any `route-reads-unvalidated-data` (or other) validation issue before emit.
|
|
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).
|
|
63
|
+
- **Guard.** `git status --porcelain` MUST equal the pre-probe snapshot byte-for-byte when you emit. ANY residue (a missed revert, an untracked file, a mode change) is a BLOCKING error: fail the elaboration, emit nothing, and surface the residue.
|
|
64
|
+
- **Fix → re-emit.** From the attributed errors, fix the drafted code blocks in the elaboration; re-probe is optional, but emit ONLY blocks that passed (every block must have cleared its scoped `tsc` + `check:files`, and the workflow-invariant helper when applicable). A clean phase (no defect, no `built-in-workflows.ts`) still emits unchanged — the self-check is a no-op pass that reverts byte-identical.
|
|
65
|
+
7. **Write the elaboration doc** (below), `status: ready`. Its filename pairs to the plan so the splice can fold it back deterministically — see Output document.
|
|
66
|
+
8. **Print the path**, then a one-line summary: `Phase N elaborated: <k> files, <m> code blocks`.
|
|
57
67
|
|
|
58
68
|
## Output document
|
|
59
69
|
|
|
@@ -106,7 +116,9 @@ tags: [elaboration]
|
|
|
106
116
|
|
|
107
117
|
- **One phase only.** Never write code for a file another phase owns; reference its interfaces by the shape `synthesize` already fixed.
|
|
108
118
|
- **Implement-ready code, grounded in the current tree.** Read the cited files first; emit code blocks, not prose hand-waving ("handle appropriately", "etc.").
|
|
109
|
-
- **Repo-root-relative, verifiable citations.** Every `file:line` your elaboration emits — in prose or in code comments — uses the **repo-root-relative** path (`packages/billing/src/invoice.ts:
|
|
119
|
+
- **Repo-root-relative, verifiable citations.** 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 must be verifiable at the current revision: cite what you actually read; if you can't verify a line number, cite the path alone and omit the `:line`. Your elaboration is spliced into the plan and passes the deterministic `code-cite-check` floor — one unbacked or ambiguous citation fails the gate and buys the whole run a code-fix loop.
|
|
110
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`.
|
|
111
|
-
- **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.
|
|
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
|
+
- **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 `FRONTMATTER_PHASE_FANOUT` (`packages/rpiv-pi/extensions/rpiv-core/built-in-workflows.ts:229`) a sibling unit's in-flight edit can surface as cross-file `tsc` noise — attribute ONLY errors in YOUR write-set and revert past the rest.
|
|
123
|
+
- **Per-phase write-scope.** Each unit applies and reverts ONLY the files its phase's `### Changes` names — the `packages/rpiv-pi/skills/implement/SKILL.md:77` discipline this slice adopts. Never probe, edit, or revert a file another phase owns.
|
|
112
124
|
- **No subagents. No self-review. No `ask_user_question`.** Decide, record any deferral in Notes, write — the grade panel is the validation.
|
|
@@ -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 a777 honest-lazy class). **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. The 553b drift named a real file but attached no adjacent `:NN` to ANY site, so the duty's line never landed — 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
|
|
|
@@ -101,7 +116,7 @@ Grade against the row matching `--dimension`. "Pass bar" is the line; meet it
|
|
|
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
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. 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 line-number off by one or two, a stylistic phrasing, a naming quibble that doesn't change behavior), `medium`+ for a finding a downstream stage genuinely cannot proceed past (a reference that won't resolve, a missing step, an executable edit that would fail as written, a boundary violation)
|
|
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 line-number off by one or two, a stylistic phrasing, a naming quibble that doesn't change behavior), `medium`+ for a finding a downstream stage genuinely cannot proceed past (a reference that won't resolve, 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).
|
|
106
121
|
- `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
122
|
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.**
|
|
@@ -121,7 +136,9 @@ Grade against the row matching `--dimension`. "Pass bar" is the line; meet it
|
|
|
121
136
|
{ "detail": "what is wrong", "where": "path/to/file.ts:42 or '## Section'" }
|
|
122
137
|
],
|
|
123
138
|
"risk_rulings": [
|
|
124
|
-
{ "id": "r1", "pass": true }
|
|
139
|
+
{ "id": "r1", "pass": true },
|
|
140
|
+
{ "id": "r2", "pass": true, "claim_type": "mechanics", "evidence": "packages/x/y.ts:42 — helper returns early on undefined" },
|
|
141
|
+
{ "id": "r3", "pass": true, "disposition": "verify-at-implement", "procedure": "npm run coverage", "owner": 5 }
|
|
125
142
|
],
|
|
126
143
|
"finding_rulings": [
|
|
127
144
|
{ "where": "r2", "ruling": "refuted", "evidence": "packages/x/locales/ holds 9 files (listed); the claim's premise is false" }
|
|
@@ -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 (run a777 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
|
+
**Exit-0 contract (the `reconcile` stage re-runs AV lines verbatim):** after implement, `reconcile` re-executes the FIRST backtick span of every `- [ ]` line in `#### Automated Verification:` via `execFileSync` — arg-array (no shell: no `|`/`&&`/redirection), stdin ignored, exit 0 the ONLY pass signal. Prose around the span never executes, and a non-zero exit halts the run with no fix arm. So every AV line must be ONE self-contained command that exits 0 exactly when the criterion holds: name the target file INSIDE the span (never "over `<file>`" in prose — the command then greps an empty stdin and always fails); never assert absence ("returns nothing" — grep exits 1 on no match, so that line can ONLY fail; restate it to exit 0 on success, e.g. a `node -e` probe that inverts the check, or move it to `#### Manual Verification:`); never rely on prose expected counts ("returns `4`" — fold the assertion into the command itself); never point a formatter at paths outside its configured scope (Biome on a doc-only phase's `.md` exits non-zero with "No files were processed"). The `plan-cite-check`/`code-cite-check` floor lints these shapes and routes violations into a plan-fix round; anything it cannot catch statically still kills the run at `reconcile`.
|
|
408
|
+
|
|
405
409
|
**Format example:**
|
|
406
410
|
```markdown
|
|
407
411
|
### Success Criteria:
|