| name | remediate |
| 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 and each structured blocker's failing command, apply the minimal localized code fix grounded in the validation report, then confirm it 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. |
| argument-hint | --plans <plan-path> --validation <report-path> |
| allowed-tools | Read, Edit, Write, Bash(*), Glob, Grep |
| shell-timeout | 10 |
| disable-model-invocation | true |
| contract | {"produces":{"kind":"side-effect","meta":{"effect":"code-mutation"}},"consumes":{"reads":{"plans":"[Truncated]","validation":"[Truncated]"}}} |
Remediate
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 and structured blockers prescribe, and re-run each item's own procedure/command 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.
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).
Input
$ARGUMENTS — flags the orchestrator wires from the gate's channels. Parse flag-style (order-agnostic), exactly like amend:
--plans <plan-path> — the plan under .rpiv/artifacts/plans/. Its frontmatter carries the risks: array; a ruling's id joins to a flag there.
--validation <report-path> — the failing validation report under .rpiv/artifacts/validation/. Its frontmatter carries verdict + risk_rulings: [{ id, pass }] and, when whole-plan gates failed, blockers: [{ id, command, file, line }].
If --plans or --validation is missing, print an error and stop — it is a dispatch error, not a failing phase.
Steps
-
Read the plan and the report fully (no limit/offset). From the report's frontmatter read verdict, the risk_rulings: [{ id, pass }] array, and the blockers: [{ id, command, file, line }] array (absent ⇒ empty); from the plan's frontmatter read the risks: array (each flag is { id, claim, … }).
-
Build the work-list — ONLY the report's failing risk rulings + structured blockers. Take every risk_rulings entry with , and join each to the plan's flag by . A ruling whose matches no plan flag has no // to ground a fix — treat it as a drift-escape (step 4). Then append every entry — each is a whole-plan/automated-command failure validate attributed with a runnable and an in-delta ; its plays the role of a ruling's and it joins no plan flag. Never source work from the report body's Potential Issues / Deviations prose on its own: those tie to a work item only when a or entry names it.