@juicesharp/rpiv-pi 2.3.1 → 2.5.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 +6 -6
- package/docs/architecture.md +3 -3
- package/docs/skills.md +3 -1
- package/docs/workflows.md +10 -4
- package/extensions/rpiv-core/built-in-workflows.ts +321 -258
- package/extensions/rpiv-core/built-ins/index.ts +27 -0
- package/extensions/rpiv-core/built-ins/markdown-fence.ts +108 -0
- package/extensions/rpiv-core/built-ins/shared.ts +153 -0
- package/extensions/rpiv-core/lane-console.ts +9 -1
- package/extensions/rpiv-core/lane-list.ts +43 -6
- package/extensions/rpiv-core/lane-progress.ts +49 -4
- package/extensions/rpiv-core/pipeline-pointer.ts +1 -1
- package/extensions/rpiv-core/run-lane-registry.ts +46 -21
- package/package.json +3 -3
- package/skills/quick-plan/SKILL.md +165 -0
- package/skills/remediate/SKILL.md +73 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: quick-plan
|
|
3
|
+
description: "Produce a single unsliced, consistently-phased implementation plan for a small, well-understood task and write it directly to .rpiv/artifacts/plans/ with status: ready — one non-interactive pass, no slice decomposition, no in-skill review (the workflow's grade and validate stages are the gates). Dispatched by the ship preset's plan stage; also usable standalone for a small task whose research is done or whose shape is obvious. Prefer blueprint for multi-component features needing slice-by-slice micro-checkpoints, and plan when turning an existing design artifact into phases."
|
|
4
|
+
argument-hint: "[research artifact path or feature description]"
|
|
5
|
+
shell-timeout: 10
|
|
6
|
+
disable-model-invocation: true
|
|
7
|
+
contract:
|
|
8
|
+
produces:
|
|
9
|
+
kind: produces
|
|
10
|
+
meta:
|
|
11
|
+
artifactKind: plan
|
|
12
|
+
data:
|
|
13
|
+
type: object
|
|
14
|
+
required: [phases, phase_count]
|
|
15
|
+
properties:
|
|
16
|
+
status:
|
|
17
|
+
enum: [ready]
|
|
18
|
+
phase_count:
|
|
19
|
+
type: integer
|
|
20
|
+
minimum: 1
|
|
21
|
+
maximum: 32
|
|
22
|
+
phases:
|
|
23
|
+
type: array
|
|
24
|
+
minItems: 1
|
|
25
|
+
maxItems: 32
|
|
26
|
+
items:
|
|
27
|
+
type: object
|
|
28
|
+
required: [n, title]
|
|
29
|
+
properties:
|
|
30
|
+
n: { type: integer, minimum: 1 }
|
|
31
|
+
title: { type: string }
|
|
32
|
+
consumes:
|
|
33
|
+
meta:
|
|
34
|
+
artifactKind: [research]
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
# Quick Plan
|
|
38
|
+
|
|
39
|
+
You produce a **single, unsliced, consistently-phased** implementation plan for a small, well-understood task and write it directly to `.rpiv/artifacts/plans/` with `status: ready`. One non-interactive pass — no slice decomposition, no skeleton-then-fill, no in-skill review. The workflow's `grade` and `validate` stages (or your own review, standalone) are the gates; this skill only emits the artifact those gates parse.
|
|
40
|
+
|
|
41
|
+
The expected shape is **one phase** (the small-task default). Add a phase only when the task genuinely splits into independently-verifiable units that share no file. This is the trimmed mimic of `blueprint`'s artifact shape minus every step that exists to produce _confidence in_ the artifact.
|
|
42
|
+
|
|
43
|
+
## Input
|
|
44
|
+
|
|
45
|
+
`$ARGUMENTS` — one of four shapes (the skill is sound however the caller wires it):
|
|
46
|
+
|
|
47
|
+
- **Flags (workflow dispatch)** — `--research <path> --goal <path>`. Read BOTH files FULLY (no limit/offset). The research doc is the grounding; the goal file is the verbatim brief — every ask it names is either implemented by a phase or deferred under `## Out of Scope`.
|
|
48
|
+
- **Research artifact path** — a `.md` path under `.rpiv/artifacts/research/`. Read it FULLY (no limit/offset); it is the grounding for the plan.
|
|
49
|
+
- **Injected research** — when dispatched by a workflow `reads: ["research"]` stage, the research doc is already in context; treat `$ARGUMENTS` as the task description / goal.
|
|
50
|
+
- **Free-text** (standalone small task) — `$ARGUMENTS` is the task description; research is done or the shape is obvious.
|
|
51
|
+
|
|
52
|
+
If `$ARGUMENTS` is empty AND no research doc is in context, print an error and stop — there is nothing to plan from.
|
|
53
|
+
|
|
54
|
+
## Metadata
|
|
55
|
+
|
|
56
|
+
```!
|
|
57
|
+
node "${SKILL_DIR}/../_shared/now.mjs"
|
|
58
|
+
echo
|
|
59
|
+
node "${SKILL_DIR}/../_shared/git-context.mjs"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Copy values verbatim. `<iso>` is the first tab-separated field (use as `date:`); `<slug>` is the second.
|
|
63
|
+
|
|
64
|
+
## Flow
|
|
65
|
+
|
|
66
|
+
1. Input → 2. Optional single targeted research → 3. Write plan (`status: ready`)
|
|
67
|
+
|
|
68
|
+
## Steps
|
|
69
|
+
|
|
70
|
+
### Step 1: Read the input
|
|
71
|
+
|
|
72
|
+
- If a research artifact path was given, read it FULLY. Extract the task, the Code References (`file:line`), the Integration Points, and any Open Questions already resolved.
|
|
73
|
+
- If a `--goal` file was given, read it FULLY and enumerate every ask it names; each is either implemented by a phase or deferred under `## Out of Scope` with a reason (when the research narrowed the brief, its rationale is the deferral reason).
|
|
74
|
+
- Read the key source files the research points at — the anchors the plan will cite — so the phase's code blocks and `file:line` references are real and current.
|
|
75
|
+
- Determine the goal (the `--goal` brief, the task description, or the research's stated goal).
|
|
76
|
+
|
|
77
|
+
### Step 2: Optional single targeted research (at most ONE dispatch)
|
|
78
|
+
|
|
79
|
+
You may dispatch **at most one** `codebase-pattern-finder` agent to find the implementation pattern to model the code after — only if the research did not already surface one. **Never parallel, never `run_in_background`**: a background completion cannot re-drive this session, so the skill would end its turn before writing the plan and the stage would fail with no artifact.
|
|
80
|
+
|
|
81
|
+
Spawn the agent using the Agent tool:
|
|
82
|
+
|
|
83
|
+
- subagent_type: `codebase-pattern-finder`
|
|
84
|
+
- Prompt: "Find the implementation pattern I should model after for {task}. Single pass."
|
|
85
|
+
|
|
86
|
+
If the research already gave you the pattern (Code References + Integration Points), **skip this step entirely** — most small, well-understood tasks need no dispatch.
|
|
87
|
+
|
|
88
|
+
### Step 3: Write the plan (`status: ready`)
|
|
89
|
+
|
|
90
|
+
Write the plan **in one pass** to `.rpiv/artifacts/plans/<slug>_<description>.md` (`<slug>` from the Metadata block; `<description>` is a brief kebab-case summary). Set frontmatter `status: ready` directly — there is no `in-progress`/`in-review` transition. **Do not author a `risks:` frontmatter array** (see Important Notes).
|
|
91
|
+
|
|
92
|
+
The artifact MUST be **consistently phased**: frontmatter `phases:` array length == number of `## Phase N:` headings == scalar `phase_count`. Any drift and `planPhaseRecords` halts the workflow at plan time. Single phase is the default.
|
|
93
|
+
|
|
94
|
+
Use this template (single-phase shown; replicate the `## Phase N:` block per phase only when genuinely multi-phase):
|
|
95
|
+
|
|
96
|
+
```markdown
|
|
97
|
+
---
|
|
98
|
+
date: {<iso> from Metadata block}
|
|
99
|
+
author: {`author:` from Metadata block}
|
|
100
|
+
commit: {Current commit hash}
|
|
101
|
+
branch: {Current branch name}
|
|
102
|
+
repository: {`repo:` from Metadata block}
|
|
103
|
+
topic: "{task name}"
|
|
104
|
+
tags: [plan]
|
|
105
|
+
status: ready
|
|
106
|
+
phase_count: 1
|
|
107
|
+
phases:
|
|
108
|
+
- { n: 1, title: {Phase 1 title}, files: [{every repo-root-relative path Phase 1 creates/edits}], depends_on: [] }
|
|
109
|
+
last_updated: {same <iso> as date:}
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
# {Task Name} Implementation Plan
|
|
113
|
+
|
|
114
|
+
## Overview
|
|
115
|
+
|
|
116
|
+
{1-3 sentences: what this plan implements and why.}
|
|
117
|
+
|
|
118
|
+
## Out of Scope
|
|
119
|
+
|
|
120
|
+
{One line per goal ask this plan does not implement — "- {ask} — deferred: {reason}". Omit the section when every named ask is covered.}
|
|
121
|
+
|
|
122
|
+
## Phase 1: {Descriptive Title}
|
|
123
|
+
|
|
124
|
+
### Overview
|
|
125
|
+
{One sentence: what this phase delivers.}
|
|
126
|
+
|
|
127
|
+
### Changes Required:
|
|
128
|
+
|
|
129
|
+
#### 1. {repo-root-relative/path/to/file.ext}
|
|
130
|
+
**File**: `repo-root-relative/path/to/file.ext`
|
|
131
|
+
**Changes**: {NEW | MODIFY} — {one-line summary}
|
|
132
|
+
|
|
133
|
+
```{language}
|
|
134
|
+
// Copy-pasteable code — the full function/section to add, or the exact edit,
|
|
135
|
+
// grounded in the current tree. implement applies this without guessing.
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Success Criteria:
|
|
139
|
+
|
|
140
|
+
#### Automated Verification:
|
|
141
|
+
- [ ] {One self-contained command that exits 0 when the criterion holds, write-scoped to THIS phase's `files:` set — e.g. `npm run check:files -- <this phase's paths>`}
|
|
142
|
+
- [ ] {Read-only whole-tree check — e.g. `npx tsc --noEmit -p tsconfig.base.json`}
|
|
143
|
+
- [ ] {Phase-scoped test — e.g. `npx vitest run <this phase's test path>`}
|
|
144
|
+
|
|
145
|
+
#### Manual Verification:
|
|
146
|
+
- [ ] {Human check — UI, real-conditions behavior, edge case}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Populate each `phases[].files:` from that phase's `#### N.` / `**File**:` paths — every repo-root-relative path the phase creates or edits — or the plan-time coverage floor (`planCitationCheck`) flags a gap. Make every `#### Automated Verification:` command write-scoped to its own phase's `files:` set; phases may run concurrently under implement, so an unscoped command that rewrites the wider tree corrupts a sibling phase's edit.
|
|
150
|
+
|
|
151
|
+
Populate `## Out of Scope` from the Step 1 goal-ask enumeration: one one-line deferral with a reason per goal ask no phase implements.
|
|
152
|
+
|
|
153
|
+
Then print the path and a one-line summary: `quick-plan written: {N} phase(s), {M} files`.
|
|
154
|
+
|
|
155
|
+
## Important Notes
|
|
156
|
+
|
|
157
|
+
- **Consistently phased, always.** `phases:` length == `## Phase N:` heading count == scalar `phase_count`. A half-phased plan throws at plan time. Single phase is the small-task default — only split when units are independently verifiable and share no file.
|
|
158
|
+
- **No `risks:` frontmatter — this is the correctness lightening.** The `grade` skill's `correctness` risk-flag adjudication (the heaviest correctness sub-check, with its mechanics-evidence and verify-at-implement duties) fires **only** when the artifact carries `risks:`. With none declared, `risk_rulings` is omitted and adjudication auto-skips — the grade runs the cheap spot-check path. Do NOT invent a `"correctness-simplified"` dimension (grade does not recognize it and would deadlock the gate); the lightening is realized by the plan's shape, not by a new dimension.
|
|
159
|
+
- **One Write, `status: ready` directly.** No skeleton-then-fill, no progressive `Edit`, no 3-state status machine. The artifact is gated externally (the workflow's `grade` + `validate`, or your own review standalone).
|
|
160
|
+
- **At most ONE `codebase-pattern-finder` dispatch.** Never parallel, never `run_in_background` — a background completion cannot re-drive this session and the stage fails with no artifact. Skip the dispatch when research already surfaced the pattern.
|
|
161
|
+
- **Non-interactive.** No `ask_user_question` checkpoint. A checkpoint without blueprint's dimension sweep is pure latency on a fast-path preset whose output is immediately grade-gated. Resolve ambiguity from the research and the real code; if a genuine fork can't be settled, make the most defensible call and let the grade panel catch it.
|
|
162
|
+
- **Defer explicitly, never silently.** Every goal ask no phase implements gets a one-line `## Out of Scope` deferral with a reason — the completeness gate blocks on a named ask that is neither addressed nor deferred.
|
|
163
|
+
- **Ground every citation.** Every `file:line` in prose or code comments uses a repo-root-relative path and is verifiable at the current revision — the plan passes the deterministic `plan-cite-check` floor.
|
|
164
|
+
- **NEVER edit source files.** This skill produces a plan document, not implementation. Source editing is `implement`'s job.
|
|
165
|
+
- **Drops blueprint's ceremony by design:** multi-slice decomposition, skeleton-then-fill, the per-slice `slice-verifier` loop, the dual post-finalization review (`artifact-code-reviewer` + `artifact-coverage-reviewer`), the 6-dimension sweep, and parallel research are all absent here — the workflow's own gates own that confidence.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: remediate
|
|
3
|
+
description: Surgically repair a working tree whose validate run returned a failing verdict — re-run each failed verify-at-implement risk ruling's prescribed procedure, apply the minimal localized code fix grounded in the validation report, then confirm the procedure passes. Single-pass, no subagents, no self-review, no questions. Workflow-gated repair arm dispatched after a failing validate; use as a gate's repair stage.
|
|
4
|
+
argument-hint: "--plans <plan-path> --validation <report-path>"
|
|
5
|
+
allowed-tools: Read, Edit, Write, Bash(*), Glob, Grep
|
|
6
|
+
shell-timeout: 10
|
|
7
|
+
disable-model-invocation: true
|
|
8
|
+
contract:
|
|
9
|
+
produces:
|
|
10
|
+
kind: side-effect
|
|
11
|
+
meta:
|
|
12
|
+
effect: code-mutation
|
|
13
|
+
consumes:
|
|
14
|
+
reads:
|
|
15
|
+
plans:
|
|
16
|
+
meta:
|
|
17
|
+
artifactKind: plan
|
|
18
|
+
validation:
|
|
19
|
+
meta:
|
|
20
|
+
artifactKind: validation
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# Remediate
|
|
24
|
+
|
|
25
|
+
You surgically repair a **working tree** that a validate stage judged `verdict: fail`. You do **not** re-validate the whole plan, re-run the project's full build/test suite, or rewrite anything broadly — you clear exactly the localized defects the failing risk rulings prescribe, and re-run each ruling's own `procedure` to confirm it now passes. One pass, non-interactive, side-effect only: you mutate code, never emit an artifact. The workflow loops you straight back to the validate gate, which re-judges; that is the only validation, so you do **not** self-review or ask for approval.
|
|
26
|
+
|
|
27
|
+
You are the tools/contract twin of `implement` (`Bash(*)` + `code-mutation`, side-effect, not an artifact) and the body-discipline twin of `amend` (single-pass, surgical, no subagents, no self-review, no questions).
|
|
28
|
+
|
|
29
|
+
## Input
|
|
30
|
+
|
|
31
|
+
`$ARGUMENTS` — flags the orchestrator wires from the gate's channels. Parse flag-style (order-agnostic), exactly like `amend`:
|
|
32
|
+
|
|
33
|
+
- **`--plans <plan-path>`** — the plan under `.rpiv/artifacts/plans/`. Its frontmatter carries the `risks:` array; a ruling's `id` joins to a flag there.
|
|
34
|
+
- **`--validation <report-path>`** — the failing validation report under `.rpiv/artifacts/validation/`. Its frontmatter carries `verdict` + `risk_rulings: [{ id, pass }]`.
|
|
35
|
+
|
|
36
|
+
If `--plans` or `--validation` is missing, print an error and stop — it is a dispatch error, not a failing phase.
|
|
37
|
+
|
|
38
|
+
## Steps
|
|
39
|
+
|
|
40
|
+
1. **Read the plan and the report fully** (no limit/offset). From the report's frontmatter read `verdict` and the `risk_rulings: [{ id, pass }]` array; from the plan's frontmatter read the `risks:` array (each flag is `{ id, claim, … }`).
|
|
41
|
+
2. **Build the work-list — ONLY the report's failing risk rulings.** Take every `risk_rulings` entry with `pass === false`, and join each to the plan's `risks:` flag by `id`. A `pass: false` ruling whose `id` matches no plan flag has no `claim`/`procedure`/`owner` to ground a fix — treat it as a drift-escape (step 4). Never source work from the report body's Potential Issues / Deviations prose on its own: those tie to a ruling only when a `risk_rulings` entry names it.
|
|
42
|
+
3. **Partition the work-list into fixable vs drift-escape.** A failed ruling is **fixable** ONLY when its joined plan flag carries ALL of:
|
|
43
|
+
- `disposition: verify-at-implement` — the ruling the plan deferred to this exact repair arm;
|
|
44
|
+
- a concrete, non-empty `procedure` — the named command/test the ruling's own verification runs (the `owner` phase promised it);
|
|
45
|
+
- a numeric `owner` phase.
|
|
46
|
+
|
|
47
|
+
Every other failed ruling — a `claim_type: mechanics` flag (cited `file:line`, no `procedure`), a bare `{ id, claim }` flag, or a flag missing `owner` — is a **drift-escape**: it has no executable procedure a localized fix can discharge, so an open-ended repair would be guessing.
|
|
48
|
+
4. **Drift-escape gate (checked BEFORE any edit).** If the work-list is empty (`verdict: fail` with no `pass: false` risk ruling at all), print `remediation not localized: no-prescribed-rulings`, edit nothing, and stop. If ANY failed ruling is non-fixable, print `remediation not localized: <ruling-id>` for each non-fixable ruling, edit nothing, and stop. Either way, do NOT print the success closing block.
|
|
49
|
+
5. **Repair pass — one cycle per fixable ruling, single-pass (no in-skill retry loop).** For each fixable ruling, in turn:
|
|
50
|
+
- **Run `flag.procedure`** via `Bash`, verbatim (the ruling's own verification command). Capture pass/fail.
|
|
51
|
+
- **If it passes already** (the tree may have drifted since validate), the ruling is cleared — record it and move on (no edit).
|
|
52
|
+
- **If it fails**, Read/Grep the report body items tied to that ruling `id` (Risk Flag Rulings, Potential Issues, Automated Verification Results) and the plan flag's `claim` + cited `file:line`, then apply the **minimal localized code fix** — the smallest edit grounded in the current tree that makes `flag.procedure` pass. Then **re-run `flag.procedure`** and record the result. One fix attempt per ruling; never loop, never widen the edit, never `ask_user_question`.
|
|
53
|
+
6. **Emit the result.** If every fixable ruling's `procedure` now passes, print the success closing block (below) — the run is fully cleared. If a ruling's `procedure` still fails after its one localized fix, it is not localized either: print `remediation not localized: <ruling-id>` for each un-cleared ruling and OMIT the success closing block; the fixes already applied to cleared rulings stand (single-pass), and re-validate will catch what remains.
|
|
54
|
+
|
|
55
|
+
## Hard rules
|
|
56
|
+
|
|
57
|
+
- **Drift-escape, never an open-ended repair.** A failed ruling with no executable `procedure` (a `claim_type: mechanics` flag, a bare `{ id, claim }` flag), an empty work-list when `verdict: fail` has no `pass: false` risk ruling, or a fixable ruling whose `procedure` won't clear in one localized fix — each emits `remediation not localized: <ruling-id>` (or `remediation not localized: no-prescribed-rulings` for the empty case), and the success closing block is withheld. The upfront gate (non-fixable / empty) edits nothing and stops. Never `ask_user_question`, never widen into an un-prescribed repair, never re-run the project's whole build/test suite — that is the downstream validate gate's job.
|
|
58
|
+
- **Surgical, single-pass.** Touch only the code a fixable ruling's `procedure` gates; leave passing rulings' code and untouched files byte-for-byte. One fix attempt per ruling — no in-skill retry loop. The validate gate re-judges; that is the validation.
|
|
59
|
+
- **Fix the code, never the plan or any `.rpiv/artifacts/` document.** Remediate mutates the working tree only. Reading the plan/report to locate a ruling is required; editing the plan, the report, or any artifact is out of scope (that is amend's / revise's authority). The embedded code blocks in a spliced plan are the plan's own content too — remediate does not edit them either; it edits the repo files the ruling's `procedure` exercises.
|
|
60
|
+
- **Never touch code a passing ruling owns.** A `pass: true` ruling's cited area is verified-correct; editing it risks regressing a cleared dimension.
|
|
61
|
+
- **No subagents. No self-review. No `ask_user_question`.** Apply the localized fixes and re-run the procedures; the validate gate is the validation.
|
|
62
|
+
|
|
63
|
+
## Closing block
|
|
64
|
+
|
|
65
|
+
On a fully-cleared run (every failed ruling fixable, every `procedure` now passing), print:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
Remediation complete: {N} failed ruling(s) addressed, {M} file(s) changed, {C} command(s) re-run (all pass).
|
|
69
|
+
Rulings: {id1} ✓, {id2} ✓ …
|
|
70
|
+
Outstanding: none.
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Omit this block on any drift-escape — print only the `remediation not localized: …` line(s) and stop.
|