@juicesharp/rpiv-pi 2.10.0 → 2.11.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.
@@ -70,11 +70,11 @@ import {
70
70
  planGatePasses,
71
71
  planSnapshot,
72
72
  REVIEW_PHASE_ITERATE,
73
+ RISK_DIMENSION,
73
74
  reconcile,
74
75
  remediationOutcome,
75
76
  rulingEffectivePass,
76
77
  SHIP_DIMENSION_FANOUT,
77
- SHIP_DIMENSIONS,
78
78
  SHIP_PANEL_PROGRESS,
79
79
  SLICE_DESIGN_FANOUT,
80
80
  SLICE_DIMENSION_FANOUT,
@@ -85,6 +85,7 @@ import {
85
85
  seedLiftStuck,
86
86
  seedOnlyCiteFail,
87
87
  shipGatePasses,
88
+ shipRoster,
88
89
  shipVerdictOutcome,
89
90
  sliceGatePasses,
90
91
  sliceSeedLift,
@@ -652,6 +653,16 @@ const sliceGradeRoute: EdgeFn = defineRoute(
652
653
  { readsData: false },
653
654
  );
654
655
 
656
+ /**
657
+ * Every unit a plan/code panel can dispatch — the tier roster's dimensions
658
+ * plus the risk unit `panelRoster` adds when the plan declares `risks:`. The
659
+ * dead-unit preemption filters on a failed sentinel per dimension, so naming
660
+ * the risk unit here is safe when it was never dispatched (no sentinel ⇒ not
661
+ * listed) and load-bearing when it was (a dead risk unit is a dead panel
662
+ * member, not a vacuous risk pass).
663
+ */
664
+ const PLAN_PANEL_UNITS: readonly string[] = [...PLAN_DIMENSIONS, RISK_DIMENSION];
665
+
655
666
  /** The plan gate's demote edge — the unit-failed preemption fires BEFORE the
656
667
  * confirm divert (a previously-passing dimension whose re-grade died is not
657
668
  * a flap to adjudicate; there is no verdict to adjudicate). */
@@ -659,7 +670,7 @@ const planDemoteRoute: EdgeFn = defineRoute(
659
670
  ["code", "plan-confirm", "plan-snapshot"],
660
671
  ({ state }) => {
661
672
  if (planGatePasses(state)) return "code";
662
- const unitFailed = unitFailedDimensions(state, "plans", "plan-verdicts", PLAN_DIMENSIONS);
673
+ const unitFailed = unitFailedDimensions(state, "plans", "plan-verdicts", PLAN_PANEL_UNITS);
663
674
  if (unitFailed.length > 0) {
664
675
  setRouteNote(planDemoteRoute, unitFailedNote(unitFailed));
665
676
  return "plan-snapshot";
@@ -674,7 +685,7 @@ const codeDemoteRoute: EdgeFn = defineRoute(
674
685
  ["implement", "code-confirm", "code-snapshot"],
675
686
  ({ state }) => {
676
687
  if (codeGatePasses(state)) return "implement";
677
- const unitFailed = unitFailedDimensions(state, "plans", "code-verdicts", PLAN_DIMENSIONS);
688
+ const unitFailed = unitFailedDimensions(state, "plans", "code-verdicts", PLAN_PANEL_UNITS);
678
689
  if (unitFailed.length > 0) {
679
690
  setRouteNote(codeDemoteRoute, unitFailedNote(unitFailed));
680
691
  return "code-snapshot";
@@ -687,7 +698,7 @@ const codeDemoteRoute: EdgeFn = defineRoute(
687
698
  const buildWorkflow = defineWorkflow({
688
699
  name: "build",
689
700
  description:
690
- "Ship, sliced: capture the verbatim brief as a goal artifact (the north star the quality gates' completeness/correctness dimensions and validate anchor against) → research the brief → derive a goal-anchored acceptance inventory (the executable standard of completion, frozen before any plan so it cannot inherit the plan's scope; the completeness gates anchor on it and validate executes its evidence commands) → decompose it into vertical slices → two-phase slice gate (a deterministic floor — dependency-cycle freedom + brief-coverage conservation so a slice-fix can't pass by dropping scope — then one LLM design-readiness judgment that each slice is chewable by a single design pass) with a slice-fix loop → design each slice in parallel → one consolidated developer checkpoint (accept or adjust the proposed interfaces/data types, adjustments applied surgically and cascaded to dependents) → synthesize hierarchically (per-cluster sub-plans → one merged plan) → tier-scaled quality-panel gate (a one-slice, <=2-phase run grades correctness+completeness only; larger or previously-failing runs grade the full completeness/correctness/actionability/pattern-following/architecture-fit roster) where a dimension's fresh HIGH-severity, risk-ruling, or regressed-pass blocking verdict gets one confirming second judgment before it buys a plan-fix round (a first-time medium finding routes straight to the surgical fix) → elaborate code per phase in parallel → splice it into the plan → re-grade the code-bearing plan (same tier + confirm contract) → implement → implement-scope-check → reconcile → validate → commit. Research-led; three automated gates plus one human design checkpoint, before design, before code, and after the splice.",
701
+ "Ship, sliced: capture the verbatim brief as a goal artifact (the north star the quality gates' completeness/correctness dimensions and validate anchor against) → research the brief → derive a goal-anchored acceptance inventory (the executable standard of completion, frozen before any plan so it cannot inherit the plan's scope; the completeness gates anchor on it and validate executes its evidence commands) → decompose it into vertical slices → two-phase slice gate (a deterministic floor — dependency-cycle freedom + brief-coverage conservation so a slice-fix can't pass by dropping scope — then one LLM design-readiness judgment that each slice is chewable by a single design pass) with a slice-fix loop → design each slice in parallel → one consolidated developer checkpoint (accept or adjust the proposed interfaces/data types, adjustments applied surgically and cascaded to dependents) → synthesize hierarchically (per-cluster sub-plans → one merged plan) → tier-scaled quality-panel gate (a one-slice, <=2-phase run grades correctness+completeness only; larger or previously-failing runs grade the full completeness/correctness/actionability/pattern-following/architecture-fit roster; a plan declaring risk flags adds a concurrent risk-rulings unit at every tier) where a dimension's fresh HIGH-severity, risk-ruling, or regressed-pass blocking verdict gets one confirming second judgment before it buys a plan-fix round (a first-time medium finding routes straight to the surgical fix) → elaborate code per phase in parallel → splice it into the plan → re-grade the code-bearing plan (same tier + confirm contract) → implement → implement-scope-check → reconcile → validate → commit. Research-led; three automated gates plus one human design checkpoint, before design, before code, and after the splice.",
691
702
  start: "goal",
692
703
  stages: {
693
704
  // The user's brief, verbatim, on its own channel — the judgment seams
@@ -785,8 +796,11 @@ const buildWorkflow = defineWorkflow({
785
796
  "subplan-check": produces.script({ reads: [fanin("subplans"), "slices"], run: subplanCoverageCheck }),
786
797
  // The root merge reads `research` (threaded as `--research` so cross-slice
787
798
  // constraints reach the merge directly, not only via each subplan's
788
- // refraction) alongside the cluster sub-plans it fans in.
789
- plan: produces({ skill: "synthesize", reads: ["research", fanin("subplans")] }),
799
+ // refraction) alongside the cluster sub-plans it fans in. `goal` +
800
+ // `acceptance` reach it too: synthesize disposes every inventory id in the
801
+ // plan's `acceptance:` block, the same anchors the completeness judge and
802
+ // validate read.
803
+ plan: produces({ skill: "synthesize", reads: ["research", "goal", "acceptance", fanin("subplans")] }),
790
804
  // Deterministic citation floor BEFORE the LLM plan gate (twin of `slice-check`):
791
805
  // a fabricated `file:line` in the plan fails structurally and routes to `plan-fix`.
792
806
  "plan-cite-check": produces.script({ reads: ["plans"], run: planCitationCheck("plan-cite-check") }),
@@ -831,7 +845,15 @@ const buildWorkflow = defineWorkflow({
831
845
  // mirrors `plan`'s own `reads: ["research", fanin("subplans")]`. `subplans`
832
846
  // is plan-fix-ONLY — by the code gate the plan's completeness is settled, so
833
847
  // code-fix repairs code-shape defects and threads no subplans.
834
- reads: ["plans", fanin("plan-verdicts"), fanin("plan-cite-check"), "goal", "research", fanin("subplans")],
848
+ reads: [
849
+ "plans",
850
+ fanin("plan-verdicts"),
851
+ fanin("plan-cite-check"),
852
+ "goal",
853
+ "acceptance",
854
+ "research",
855
+ fanin("subplans"),
856
+ ],
835
857
  }),
836
858
  // Snapshot the graded plan BEFORE plan-fix amends it — one deterministic
837
859
  // hop inside the existing fix loop (plan-grade/plan-confirm → plan-snapshot
@@ -1186,14 +1208,14 @@ const shipGradeStopNote = (state: RunView): string => {
1186
1208
  // A dead grade unit (post-re-dispatch) is the loudest blocker — name it
1187
1209
  // ahead of the severity blockers (ship's arm is stop + hand-repair +
1188
1210
  // resume, so the note IS the repair instruction).
1189
- const unitFailed = unitFailedDimensions(state, "plans", "ship-verdicts", SHIP_DIMENSIONS);
1211
+ const unitFailed = unitFailedDimensions(state, "plans", "ship-verdicts", shipRoster(state));
1190
1212
  if (unitFailed.length > 0) return unitFailedNote(unitFailed);
1191
1213
  const fresh = freshVerdicts(state.named["ship-verdicts"], latestArtifactPath(state, "plans"));
1192
1214
  if (fresh.length === 0) return "no fresh verdicts for the current plan";
1193
1215
  const risks = planAuthoredRisks(state, "plans");
1194
1216
  const latest = latestVerdictPerDimension(fresh);
1195
1217
  const blockers: string[] = [];
1196
- for (const d of SHIP_DIMENSIONS) {
1218
+ for (const d of shipRoster(state)) {
1197
1219
  const o = latest.get(d);
1198
1220
  if (!o) continue;
1199
1221
  const v = o.data as VerdictRecord | undefined;
@@ -50,6 +50,27 @@ const PLAN_DIMENSIONS = [
50
50
  */
51
51
  export const SHIP_DIMENSIONS = ["completeness", "correctness", "architecture-fit"] as const;
52
52
 
53
+ /**
54
+ * The plan-authored risk-flag ruling unit, split OUT of `correctness` so the
55
+ * two judgments run as concurrent panel members instead of one serial judge.
56
+ * Across 175 build panels the correctness unit finished last in 140 (80%), at
57
+ * 2.2× the median sibling with no flags and no prior, and the risk-ruling +
58
+ * prior-adjudication duties added ~1.7 min on top (4.9 → 6.6 min p50) — the
59
+ * panel's wall time IS the correctness unit's. This dimension rules every
60
+ * `risks:` flag (the mechanics-evidence and verify-at-implement duties move
61
+ * with it, see the `grade` skill), adjudicates its OWN prior rulings on a
62
+ * re-grade, and emits `risk_rulings` — the field every risk fold reads
63
+ * (`allRiskFlagsPass`, `dimensionsToRegrade` clause 3, `confirmDue`,
64
+ * `demoteDuties`, amend's cite derivation). Correctness keeps only its
65
+ * semantic three-class findings. Dispatched ONLY when the graded channel's
66
+ * latest record declares `risks:` (`panelRoster`) — a plan with no flags
67
+ * pays for no unit — and at EVERY tier when it does (the light roster used to
68
+ * rule risks through its correctness member; the duty follows the split). A
69
+ * legacy trail whose correctness verdicts still carry `risk_rulings` folds
70
+ * unchanged: every risk fold is dimension-agnostic.
71
+ */
72
+ export const RISK_DIMENSION = "risk-rulings" as const;
73
+
53
74
  /**
54
75
  * The two dimensions the grade panels anchor against the verbatim brief.
55
76
  * "Complete" and "correct" MEAN "against what the user asked" — without the
@@ -156,6 +177,37 @@ const gateRoster = (tier: GateTier, dimensions: readonly string[]): readonly str
156
177
  return light.length > 0 ? light : dimensions;
157
178
  };
158
179
 
180
+ /**
181
+ * The roster a panel over `channel` actually dispatches and its gate actually
182
+ * folds: the tier roster (`gateRoster(gateTier(...))`) plus the
183
+ * `RISK_DIMENSION` unit whenever the channel's latest record declares
184
+ * `risks:` — at every tier, never otherwise. ONE construction site shared by
185
+ * the panel's `units()`, the gate predicates, `confirmDue`, and the progress
186
+ * hook, so "dispatch", "fold", "confirm", and "lap complete" can never
187
+ * disagree on whether the risk unit is a roster member. A roster that never
188
+ * declares risks (the slice gate over `slices`) is unchanged. Idempotent over
189
+ * a `dimensions` list that already names the risk dimension.
190
+ */
191
+ const panelRoster = (
192
+ state: RunView,
193
+ channel: string,
194
+ verdictChannel: string,
195
+ dimensions: readonly string[],
196
+ ): readonly string[] => {
197
+ const roster = gateRoster(gateTier(state, verdictChannel), dimensions);
198
+ if (roster.includes(RISK_DIMENSION) || planAuthoredRisks(state, channel).size === 0) return roster;
199
+ return [...roster, RISK_DIMENSION];
200
+ };
201
+
202
+ /**
203
+ * Ship's tier-independent twin of `panelRoster`: `SHIP_DIMENSIONS` verbatim
204
+ * (never `gateRoster(gateTier(...))`) plus the risk unit when the plan
205
+ * declares `risks:`. Bound by the ship panel, `shipGatePasses`, and ship's
206
+ * stop note alike.
207
+ */
208
+ const shipRoster = (state: RunView): readonly string[] =>
209
+ planAuthoredRisks(state, "plans").size === 0 ? SHIP_DIMENSIONS : [...SHIP_DIMENSIONS, RISK_DIMENSION];
210
+
159
211
  /**
160
212
  * Drop verdicts judged against an artifact the channel has since REPLACED. A
161
213
  * grade verdict embeds the `artifact` path it judged; when a fix REGENERATES
@@ -405,7 +457,14 @@ const panelProgress =
405
457
  { snapshotChannel, artifactChannel }: { snapshotChannel?: string; artifactChannel?: string } = {},
406
458
  ) =>
407
459
  (state: RunView): ProgressValue => {
408
- const roster = gateRoster(gateTier(state, verdictChannel), dimensions);
460
+ // The artifact channel is where `risks:` lives, so a lane that names it
461
+ // folds the risk unit into its roster exactly as its panel and gate do;
462
+ // a lane without one (no plan channel to declare risks on) keeps the
463
+ // tier roster.
464
+ const roster =
465
+ artifactChannel !== undefined
466
+ ? panelRoster(state, artifactChannel, verdictChannel, dimensions)
467
+ : gateRoster(gateTier(state, verdictChannel), dimensions);
409
468
  const entries = state.named[verdictChannel] ?? [];
410
469
  const currentArtifact = artifactChannel !== undefined ? latestArtifactPath(state, artifactChannel) : undefined;
411
470
  const foldRound = (rows: readonly Output[]): ReadonlyMap<string, Output> =>
@@ -752,7 +811,7 @@ const seedLiftStuck = (state: RunView): boolean => {
752
811
  const subplanGatePasses = (state: RunView): boolean => allDimensionsPass(state.named["subplan-check"]);
753
812
  const planGatePasses = (state: RunView): boolean => {
754
813
  const fresh = freshVerdicts(state.named["plan-verdicts"], latestArtifactPath(state, "plans"));
755
- const roster = gateRoster(gateTier(state, "plan-verdicts"), PLAN_DIMENSIONS);
814
+ const roster = panelRoster(state, "plans", "plan-verdicts", PLAN_DIMENSIONS);
756
815
  const risks = planAuthoredRisks(state, "plans");
757
816
  return (
758
817
  allDimensionsPass(state.named["plan-cite-check"]) &&
@@ -762,7 +821,7 @@ const planGatePasses = (state: RunView): boolean => {
762
821
  };
763
822
  const codeGatePasses = (state: RunView): boolean => {
764
823
  const fresh = freshVerdicts(state.named["code-verdicts"], latestArtifactPath(state, "plans"));
765
- const roster = gateRoster(gateTier(state, "code-verdicts"), PLAN_DIMENSIONS);
824
+ const roster = panelRoster(state, "plans", "code-verdicts", PLAN_DIMENSIONS);
766
825
  const risks = planAuthoredRisks(state, "plans");
767
826
  return (
768
827
  allDimensionsPass(state.named["code-cite-check"]) &&
@@ -777,13 +836,16 @@ const codeGatePasses = (state: RunView): boolean => {
777
836
  * (severity-floored) AND every plan-authored risk flag is ruled pass. Unlike
778
837
  * `planGatePasses`/`codeGatePasses` it folds NO deterministic cite channel —
779
838
  * ship's `plan-cite-check` gate is routed at its own edge — and binds the
780
- * roster to `SHIP_DIMENSIONS` verbatim (never `gateRoster(gateTier(...))`), so
781
- * the gate consults the same fixed set the panel graded.
839
+ * roster to `shipRoster` (`SHIP_DIMENSIONS` verbatim plus the risk unit when
840
+ * the plan declares `risks:` — never `gateRoster(gateTier(...))`), so the gate
841
+ * consults the same fixed set the panel graded, and a dead risk unit's
842
+ * dimension-bearing sentinel blocks instead of vanishing behind a vacuous
843
+ * `allRiskFlagsPass`.
782
844
  */
783
845
  export const shipGatePasses = (state: RunView): boolean => {
784
846
  const fresh = freshVerdicts(state.named["ship-verdicts"], latestArtifactPath(state, "plans"));
785
847
  const risks = planAuthoredRisks(state, "plans");
786
- return allDimensionsPass(fresh, SHIP_DIMENSIONS) && allRiskFlagsPass(fresh, risks);
848
+ return allDimensionsPass(fresh, shipRoster(state)) && allRiskFlagsPass(fresh, risks);
787
849
  };
788
850
 
789
851
  /**
@@ -826,7 +888,7 @@ const confirmDue = (
826
888
  verdictChannel: string,
827
889
  dimensions: readonly string[],
828
890
  ): boolean => {
829
- const roster = new Set(gateRoster(gateTier(state, verdictChannel), dimensions));
891
+ const roster = new Set(panelRoster(state, channel, verdictChannel, dimensions));
830
892
  const fresh = freshVerdicts(state.named[verdictChannel], latestArtifactPath(state, channel));
831
893
  const risks = planAuthoredRisks(state, channel);
832
894
  const byDim = new Map<string, { blocking: boolean; confirmWorthy: boolean; prevBlocking?: boolean }>();
@@ -887,6 +949,7 @@ export {
887
949
  latestVerdictPerDimension,
888
950
  PLAN_DIMENSIONS,
889
951
  panelProgress,
952
+ panelRoster,
890
953
  planAuthoredRisks,
891
954
  planGatePasses,
892
955
  procedureSatisfiesDuty,
@@ -898,6 +961,7 @@ export {
898
961
  seedLiftStuck,
899
962
  seedOnlyCiteFail,
900
963
  seedOnlyFindings,
964
+ shipRoster,
901
965
  sliceGatePasses,
902
966
  subplanGatePasses,
903
967
  type VerdictRecord,
@@ -7,14 +7,15 @@ import {
7
7
  dimensionsToRegrade,
8
8
  freshVerdicts,
9
9
  GOAL_DIMENSIONS,
10
- gateRoster,
11
- gateTier,
12
10
  latestVerdictPerDimension,
13
11
  PLAN_DIMENSIONS,
14
12
  panelProgress,
13
+ panelRoster,
15
14
  planAuthoredRisks,
15
+ RISK_DIMENSION,
16
16
  SHIP_DIMENSIONS,
17
17
  SLICE_DIMENSIONS,
18
+ shipRoster,
18
19
  } from "./gates.js";
19
20
  import { isSurgicalFix, priorArtifact } from "./priors.js";
20
21
  import { haltPreflight, latestFsArtifact } from "./shared.js";
@@ -100,8 +101,14 @@ const citeCheckFlag = (state: RunView, citeChannel: string | undefined): string
100
101
  * `--prior` threads a dimension's latest fresh verdict when that dimension is
101
102
  * still pending (a confirm or re-grade of a blocking prior — the grader must
102
103
  * adjudicate the prior findings, not out-vote them) and always on correctness
103
- * (its re-grades scope to the prior). A carried passing prior on any other
104
- * dimension is not re-adjudicated. Round 1 emits no flag.
104
+ * and on the risk unit (their re-grades scope to the prior). A carried
105
+ * passing prior on any other dimension is not re-adjudicated. Round 1 emits
106
+ * no flag.
107
+ *
108
+ * The `RISK_DIMENSION` unit joins the roster through `panelRoster` whenever
109
+ * the graded channel declares `risks:` — bare flags plus `--prior`: no
110
+ * `--goal` (the goal-contradiction class stays with correctness), no
111
+ * `--cite-check` (resolution is correctness's lead source), no `--context`.
105
112
  *
106
113
  * Every panel wires `haltWhenAllFailed: true`: a generation in which EVERY
107
114
  * dispatched dimension unit failed is a dead panel — nothing was collected, so
@@ -121,7 +128,8 @@ const gradePanelFanout = (
121
128
  fanout({
122
129
  source: channel,
123
130
  unit: { by: "dimension-list", pattern: "dimensions" },
124
- max: dimensions.length,
131
+ // +1: the risk unit `panelRoster` may add on top of the dimension list.
132
+ max: dimensions.length + 1,
125
133
  haltWhenAllFailed: true,
126
134
  retryHaltedUnits: 1,
127
135
  units: ({ state, cwd }) => {
@@ -135,7 +143,7 @@ const gradePanelFanout = (
135
143
  // simply emit no flag.
136
144
  const { contextFlag, goalFlag, acceptanceFlag } = dimensionArtifactFlags(state);
137
145
  const citeFlag = citeCheckFlag(state, citeChannel);
138
- const roster = gateRoster(gateTier(state, verdictChannel), dimensions);
146
+ const roster = panelRoster(state, channel, verdictChannel, dimensions);
139
147
  const latest = latestVerdictPerDimension(freshVerdicts(state.named[verdictChannel], target));
140
148
  const risks = planAuthoredRisks(state, channel);
141
149
  const pending = dimensionsToRegrade(roster, latest, risks);
@@ -155,7 +163,7 @@ const gradePanelFanout = (
155
163
  isSurgicalFix(state, priorChannel, cwd, target, latest, pending, risks);
156
164
  const priorPresent = priorChannel !== undefined && priorArtifact(state, priorChannel) !== undefined;
157
165
  const priorFlag = (d: string): string => {
158
- if (d !== "correctness" && !pending.includes(d)) return "";
166
+ if (d !== "correctness" && d !== RISK_DIMENSION && !pending.includes(d)) return "";
159
167
  const handle = latest.get(d)?.artifacts.find((a) => a.handle.kind === "fs")?.handle;
160
168
  return handle ? ` --prior ${handleToString(handle)}` : "";
161
169
  };
@@ -244,7 +252,8 @@ const CODE_PANEL_PROGRESS = panelProgress("code-verdicts", PLAN_DIMENSIONS, {
244
252
  export const SHIP_DIMENSION_FANOUT = fanout({
245
253
  source: "plans",
246
254
  unit: { by: "dimension-list", pattern: "dimensions" },
247
- max: SHIP_DIMENSIONS.length,
255
+ // +1: the risk unit `shipRoster` adds when the plan declares `risks:`.
256
+ max: SHIP_DIMENSIONS.length + 1,
248
257
  haltWhenAllFailed: true,
249
258
  retryHaltedUnits: 1,
250
259
  units: ({ state }) => {
@@ -258,8 +267,9 @@ export const SHIP_DIMENSION_FANOUT = fanout({
258
267
  // the configured channel carries no fs verdict; a clean verdict settles
259
268
  // resolution, findings carry the advisory leads (see citeCheckFlag).
260
269
  const citeFlag = citeCheckFlag(state, "plan-cite-check");
261
- // Tier-independent roster: SHIP_DIMENSIONS verbatim — never gateRoster(gateTier(...)).
262
- const roster = SHIP_DIMENSIONS;
270
+ // Tier-independent roster: SHIP_DIMENSIONS verbatim (plus the risk unit
271
+ // when the plan declares risks) — never gateRoster(gateTier(...)).
272
+ const roster = shipRoster(state);
263
273
  const latest = latestVerdictPerDimension(freshVerdicts(state.named["ship-verdicts"], target));
264
274
  const risks = planAuthoredRisks(state, "plans");
265
275
  const pending = dimensionsToRegrade(roster, latest, risks);
@@ -16,9 +16,11 @@ export {
16
16
  latestVerdictPerDimension,
17
17
  PLAN_DIMENSIONS,
18
18
  panelProgress,
19
+ panelRoster,
19
20
  planAuthoredRisks,
20
21
  planGatePasses,
21
22
  progressFromRoundCounts,
23
+ RISK_DIMENSION,
22
24
  rulingEffectivePass,
23
25
  type SeedOnlyVerdict,
24
26
  SHIP_DIMENSIONS,
@@ -27,6 +29,7 @@ export {
27
29
  seedOnlyCiteFail,
28
30
  seedOnlyFindings,
29
31
  shipGatePasses,
32
+ shipRoster,
30
33
  sliceGatePasses,
31
34
  subplanGatePasses,
32
35
  unitFailedDimensions,
@@ -139,15 +139,8 @@ const FRONTMATTER_PHASE_FANOUT = fanout({
139
139
  });
140
140
 
141
141
  /**
142
- * The elaborate fanout: `FRONTMATTER_PHASE_FANOUT` with one re-dispatch for a
143
- * unit whose output failed its contract after the in-session retries — a
144
- * malformed section is re-produced with the failure memo, not stitched.
145
- */
146
- const ELABORATE_PHASE_FANOUT = { ...FRONTMATTER_PHASE_FANOUT, retryHaltedUnits: 1 };
147
-
148
- /**
149
- * Derive the directed `deps` edges for ONE implement phase under the dep-gated
150
- * DAG fanout (`IMPLEMENT_DAG_FANOUT`). Edges point strictly downward (toward
142
+ * Derive the directed `deps` edges for ONE phase under the dep-gated DAG
143
+ * fanouts (`IMPLEMENT_DAG_FANOUT`, `ELABORATE_PHASE_FANOUT`). Edges point strictly downward (toward
151
144
  * LOWER phase numbers), so the graph is acyclic by construction. Two clauses:
152
145
  *
153
146
  * - clause A (self declares a `files:` write-set): `self` depends on every
@@ -163,7 +156,7 @@ const ELABORATE_PHASE_FANOUT = { ...FRONTMATTER_PHASE_FANOUT, retryHaltedUnits:
163
156
  * and `phaseDeps` — both defined later textually, but only inside this
164
157
  * runtime closure, so no TDZ (same pattern as `sliceDeps`).
165
158
  */
166
- const implementPhaseDeps = (records: readonly PhaseRecord[], self: PhaseRecord): string[] => {
159
+ const phaseWriteSetDeps = (records: readonly PhaseRecord[], self: PhaseRecord): string[] => {
167
160
  // Twin-expanded (`withTestTwins`) so a phase declaring `x.ts` conflicts with
168
161
  // one declaring `x.test.ts` — the production phase's implicit twin write would
169
162
  // otherwise race a concurrent sibling that owns the test explicitly.
@@ -186,30 +179,59 @@ const implementPhaseDeps = (records: readonly PhaseRecord[], self: PhaseRecord):
186
179
  };
187
180
 
188
181
  /**
189
- * Dep-gated DAG variant of `FRONTMATTER_PHASE_FANOUT` — `implement`'s twin that
190
- * emits per-phase `id`/`deps` edges so the wave scheduler orders phases by their
191
- * declared write-set overlap + explicit `depends_on`. The spread idiom inherits
192
- * `source`/`unit`/`max`/`onCap`/`result`/`kind` verbatim from the base; the new
193
- * `units` closure emits the SAME `prompt`/`label` strings AND adds
194
- * `id: \`phase-${r.n}\`` + `deps: implementPhaseDeps(records, r)`. NO
195
- * `depArtifactFlag` — implement phases feed each other through the working tree
196
- * (not published artifacts), so `deps` drive ONLY wave ordering. NO
197
- * `concurrency` property is set (the spread overrides only `units`), so the loop
198
- * inherits the host cap and phases fan out concurrently, bounded by `deps`.
182
+ * The dep-gated `units` closure shared by the DAG fanouts: emits the SAME
183
+ * `prompt`/`label` strings as `FRONTMATTER_PHASE_FANOUT` AND adds
184
+ * `id: \`phase-${r.n}\`` + `deps: phaseWriteSetDeps(records, r)`, so the wave
185
+ * scheduler orders phases by their declared write-set overlap + explicit
186
+ * `depends_on`. `who` names the fanout in preflight halts.
199
187
  */
200
- const IMPLEMENT_DAG_FANOUT = {
201
- ...FRONTMATTER_PHASE_FANOUT,
202
- units: ({ state, cwd }: FanoutContext) => {
203
- const read = readPlanPhaseRecords(state, cwd, "IMPLEMENT_DAG_FANOUT");
188
+ const dagPhaseUnits =
189
+ (who: string) =>
190
+ ({ state, cwd }: FanoutContext) => {
191
+ const read = readPlanPhaseRecords(state, cwd, who);
204
192
  if (!read) return [];
205
193
  const { records, promptPath } = read;
206
194
  return records.map((r) => ({
207
195
  prompt: `${promptPath} Phase ${r.n}: ${r.title}`.trimEnd(),
208
196
  label: `phase ${r.index + 1}/${r.total}`,
209
197
  id: `phase-${r.n}`,
210
- deps: implementPhaseDeps(records, r),
198
+ deps: phaseWriteSetDeps(records, r),
211
199
  }));
212
- },
200
+ };
201
+
202
+ /**
203
+ * Dep-gated DAG variant of `FRONTMATTER_PHASE_FANOUT` — `implement`'s twin. The
204
+ * spread idiom inherits `source`/`unit`/`max`/`onCap`/`result`/`kind` verbatim
205
+ * from the base; `units` is `dagPhaseUnits`. NO `depArtifactFlag` — implement
206
+ * phases feed each other through the working tree (not published artifacts), so
207
+ * `deps` drive ONLY wave ordering. NO `concurrency` property is set (the spread
208
+ * overrides only `units`), so the loop inherits the host cap and phases fan out
209
+ * concurrently, bounded by `deps`.
210
+ */
211
+ const IMPLEMENT_DAG_FANOUT = {
212
+ ...FRONTMATTER_PHASE_FANOUT,
213
+ units: dagPhaseUnits("IMPLEMENT_DAG_FANOUT"),
214
+ };
215
+
216
+ /**
217
+ * The elaborate fanout: the same dep-gated `units` as `IMPLEMENT_DAG_FANOUT`,
218
+ * plus one re-dispatch for a unit whose output failed its contract after the
219
+ * in-session retries — a malformed section is re-produced with the failure
220
+ * memo, not stitched.
221
+ *
222
+ * Dep-gated for the same reason implement is: every lane's self-check probes
223
+ * the ONE shared working tree (apply → check → revert its own write-scope), and
224
+ * two lanes whose `files:` overlap cannot both revert byte-identically — a lane
225
+ * that snapshots a co-owned file while a sibling's probe is live restores the
226
+ * sibling's transient blocks after the sibling reverted them (run
227
+ * 2026-09-12_14-29-13-5eb9: phase 5's test blocks came back through phase 3's
228
+ * copy-back and phase 2's rebuild, and broke the test target for implement).
229
+ * File-disjoint phases still fan out concurrently.
230
+ */
231
+ const ELABORATE_PHASE_FANOUT = {
232
+ ...FRONTMATTER_PHASE_FANOUT,
233
+ units: dagPhaseUnits("ELABORATE_PHASE_FANOUT"),
234
+ retryHaltedUnits: 1,
213
235
  };
214
236
 
215
237
  /**
@@ -258,7 +280,7 @@ const phaseDeps = (entry: unknown): number[] => {
258
280
  * read straight off `PhaseRecord.entry` so `planPhaseRecords` preserves the new
259
281
  * key unchanged. Consumed by the plan-time coverage floor
260
282
  * (`verifyPhaseFilesCoverage`) and, in a later phase, the dep-gated implement
261
- * fanout (`implementPhaseDeps`). */
283
+ * fanout (`phaseWriteSetDeps`). */
262
284
  const phaseFiles = (entry: unknown): string[] => {
263
285
  const raw = (entry as { files?: unknown } | undefined)?.files;
264
286
  return Array.isArray(raw) ? raw.filter((f): f is string => typeof f === "string") : [];
@@ -271,7 +293,7 @@ const phaseFiles = (entry: unknown): string[] => {
271
293
  * mechanical follow-up edit in its twin — so requiring every plan author,
272
294
  * elaborator, and grader to re-declare the twin is paperwork the convention
273
295
  * already guarantees. Applied at BOTH consumers of the declared set — the
274
- * DAG conflict fold (`implementPhaseDeps`) and the scope floors — so the
296
+ * DAG conflict fold (`phaseWriteSetDeps`) and the scope floors — so the
275
297
  * planner and the floor can never disagree; on the DAG side it also closes the
276
298
  * latent race where phases declaring `x.ts` and `x.test.ts` counted as
277
299
  * disjoint yet predictably collide. Asymmetric by design: declaring a TEST
@@ -58,9 +58,10 @@ const _persistableLevelsMatchPiAi: _PersistableLevelsMatchPiAi = true;
58
58
  * Background-lane concurrency cap fallback. The fail-soft default applied by
59
59
  * `resolveMaxConcurrency` when `~/.config/rpiv-pi/models.json` is absent or
60
60
  * carries no valid `maxConcurrency`. Rate limits, not CPU, are the real cap —
61
- * 6 lanes clears the widest built-in fanout batch (the 5-dimension grade
62
- * panel, which a cap of 4 split into a 4+1 second batch on every panel) with
63
- * one lane of headroom; no rate-limit events were observed at 4. Re-exported from
61
+ * 6 lanes clears the widest built-in fanout batch (the grade panel: five
62
+ * dimensions plus the risk-rulings unit when the plan declares `risks:`; a
63
+ * cap of 4 split the five-dimension panel into a 4+1 second batch on every
64
+ * panel); no rate-limit events were observed at 4. Re-exported from
64
65
  * packages/rpiv-pi/extensions/rpiv-core/workflow-execution-host.ts to preserve the tested public surface.
65
66
  */
66
67
  export const DEFAULT_MAX_CONCURRENCY = 6;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juicesharp/rpiv-pi",
3
- "version": "2.10.0",
3
+ "version": "2.11.0",
4
4
  "description": "A skill-based development workflow for Pi Agent. 30 contract-carrying skills (discover → research → design → plan → implement → validate → code-review → commit, and more), the 15 named subagents they dispatch, and four built-in /wf workflows that chain them end to end in detached parallel runs.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -51,7 +51,7 @@
51
51
  ]
52
52
  },
53
53
  "dependencies": {
54
- "@juicesharp/rpiv-config": "^2.10.0",
54
+ "@juicesharp/rpiv-config": "^2.11.0",
55
55
  "typebox": "^1.1.24"
56
56
  },
57
57
  "peerDependencies": {
@@ -20,7 +20,7 @@ You surgically fix **one** artifact so it clears the dimensions a grade panel ma
20
20
 
21
21
  - **Verdicts** — every flag whose name ends in `-verdicts` (e.g. `--research-verdicts`, `--plan-verdicts`), repeatable. Each value is a verdict JSON path.
22
22
  - **Citation floors** — every flag whose name ends in `-cite-check` (e.g. `--plan-cite-check`, `--code-cite-check`), repeatable. Each value is a cite-check verdict JSON path.
23
- - **Lineage sources** — the read-only context flags `--goal`, `--research`, and `--subplans` (repeatable; build's fix arms only). `--goal` is the verbatim brief, `--research` the architecture/precedent findings, `--subplans` the per-cluster sub-plans. They are context, never the artifact to re-emit.
23
+ - **Lineage sources** — the read-only context flags `--goal`, `--research`, `--acceptance`, and `--subplans` (repeatable; build's fix arms only). `--goal` is the verbatim brief, `--research` the architecture/precedent findings, `--acceptance` the frozen inventory, `--subplans` the per-cluster sub-plans. They are context, never the artifact to re-emit.
24
24
  - **Artifact** — the single remaining `--<channel>` flag that is **not** a verdicts, citation-floor, or lineage-source flag (i.e. not ending in `-verdicts` or `-cite-check`, and not `--goal`/`--research`/`--subplans`). Its value is the artifact to fix and re-emit; for both build fix arms this resolves to `--plans`.
25
25
 
26
26
  If you can't identify exactly one artifact flag and at least one verdicts flag, print an error and stop.
@@ -57,7 +57,7 @@ Copy values verbatim. `<iso>` is the first tab-separated field (use as `date`);
57
57
  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.
58
58
  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.
59
59
  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).
60
- 6. **Self-check (probe → revert → guard).** Before emitting, verify the drafted code blocks actually apply and pass the project's checks at their REAL placement — declaration-order / initialization-order and integration 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 — sibling phase lanes run concurrently in the same working tree, so touching a file another phase owns corrupts its in-flight edit. The cycle is exactly:
60
+ 6. **Self-check (probe → revert → guard).** Before emitting, verify the drafted code blocks actually apply and pass the project's checks at their REAL placement — declaration-order / initialization-order and integration 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 — sibling phase lanes run concurrently in the same working tree (the fanout serializes phases whose `files:` overlap, so a concurrent sibling never owns a path in your write-scope), so touching a file another phase owns corrupts its in-flight edit. Never snapshot, copy back, or rebuild a file from a copy taken earlier: revert is `git restore` only. The cycle is exactly:
61
61
  - **Snapshot.** Capture `git status --porcelain` BEFORE the probe (the byte-identical revert target).
62
62
  - **Probe.** Apply each drafted code block via `Edit` at its REAL anchor position in the current file (not a speculative layout). New files named by the phase are written for the probe.
63
63
  - **Verify, in order, attributing only write-scope errors.** Take the command vocabulary from the project's guidance `# Commands` table — never substitute a tool the project does not use:
@@ -62,6 +62,7 @@ You grade ONE artifact against ONE quality dimension and emit a verdict JSON. Yo
62
62
 
63
63
  - `--dimension <name>` **(required)** — one of:
64
64
  - **artifact dimensions** (any artifact): `completeness`, `correctness`, `actionability`, `architecture-fit`, `pattern-following`.
65
+ - **risk-ruling dimension** (a plan declaring `risks:`): `risk-rulings` — the plan/code gates dispatch it, concurrently with the artifact dimensions, ONLY when the artifact's frontmatter carries a `risks:` array. It rules every flag and nothing else (see "Plan-authored risk flags").
65
66
  - **slice-breakdown dimension** (a slice map): `design-readiness`. (Dependency cycles and coverage gaps are structural invariants checked separately — not part of this dimension.)
66
67
  - `--artifact <path>` **(required)** — the artifact under review.
67
68
  - `--context <path>` *(optional)* — a supporting artifact (e.g. the research doc). **Required for `architecture-fit`.**
@@ -70,7 +71,9 @@ You grade ONE artifact against ONE quality dimension and emit a verdict JSON. Yo
70
71
  - `--prior <path>` *(optional)* — a prior round's verdict JSON for this same `(artifact, dimension)`, threaded by the confirm panels AND by round-≥2 re-grade dispatches. Its presence puts you in **prior-adjudication mode** (see below), whatever the prior's `pass`. A `finding_rulings` `where` is copied verbatim from the IMMEDIATE prior. If the path is missing or unreadable, grade normally without it — a stale prior is not a wiring error.
71
72
  - `--cite-check <path>` *(optional, `correctness` only)* — the deterministic citation floor's verdict JSON for the same artifact. Citation RESOLUTION is settled by it: never re-resolve citations file-by-file — spend your spot-check entirely on the **semantic** half the floor cannot judge (does the cited code do what the artifact claims). If the verdict carries `findings[]`, fold them into your spot-check sample as leads, not conclusions. Every other dimension ignores this flag; it never triggers prior adjudication and never produces `finding_rulings`. Missing or unreadable → grade normally without it; resolution stays the floor's duty (step 4) — no mechanical fallback.
72
73
 
73
- **Plan-authored risk flags (the `correctness` dimension only).** When your `--dimension` is `correctness` and the `--artifact` carries a `risks:` frontmatter array (each `{ id, claim }`, described in the plan's `## Risk Flags` section), you are REQUIRED to rule on every flag — this is a first-class channel, not an optional prose aside. For each flag, verify its `claim` against the real codebase / the plan (Read/Grep the relevant `file:line`) and decide `pass` (the concern is unfounded or already handled) or `fail` (the risk is real and unaddressed). A `fail` ruling blocks the gate (the workflow folds these across the panel), so an assumption the plan flagged for review cannot ride a green pass into commit. Other dimensions ignore `risks:`.
74
+ **Plan-authored risk flags (the `risk-rulings` dimension only).** When your `--dimension` is `risk-rulings`, the `--artifact` carries a `risks:` frontmatter array (each `{ id, claim }`, described in the plan's `## Risk Flags` section) — the panel dispatches this unit only then — and 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. Every other dimension ignores `risks:` — `correctness` included: it never rules a flag and never emits `risk_rulings` (the two judgments run as separate, concurrent panel members so neither waits on the other).
75
+
76
+ The verdict shape for this dimension: `pass` is `true` only when every ruling is `pass` (with its duty below discharged); `severity` is `medium` when any ruling is `fail` (a failed flag blocks the gate), else `none`; `score` is the share of flags passing (0–100); `findings[]` carries exactly one `{ detail, where }` per `fail` ruling — `where` is `## Risk Flags`, `detail` names the flag `id` and states, from the span you read, why the risk holds — and nothing for a `pass`; `feedback` on a fail tells `amend` how to close each failed flag (resolve the claim against the cited code, or attach a `verify-at-implement` deferral with a concrete `procedure` + `owner`). The same turn discipline as `correctness` applies: inventory every flag (plus every prior failed ruling with `--prior`) from the artifact alone, fetch the evidence in ONE batch, describe each span from the code alone BEFORE setting it against the flag's `claim`, verdict by the sixth tool turn — a flag still unread by then is ruled `fail` with `unverified` in its `detail`, never guessed `pass`.
74
77
 
75
78
  Two duties tighten what a `pass` means, and the gate enforces both (an un-grounded `pass` is demoted as if it were `fail`):
76
79
 
@@ -82,7 +85,7 @@ Emit these as a `risk_rulings: [{ id, pass, evidence?, claim_type?, disposition?
82
85
 
83
86
  **Prior-round adjudication (`--prior` present).** You are the next judgment on a dimension that already carries a prior — blocking (a re-grade or confirm dispatch) or passing (a carried full-roster prior). 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:
84
87
 
85
- **Demotion-suspect clause — when the prior blocked yet carries no `pass: false` ruling.** If the `--prior` verdict itself blocked (`pass: false` at `medium`/`high`, or a `pass: false` risk ruling) yet its `risk_rulings` are ALL `pass: true`, 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.
88
+ **Demotion-suspect clause (`risk-rulings` only) — when the prior blocked yet carries no `pass: false` ruling.** If the `--prior` verdict itself blocked (`pass: false` at `medium`/`high`, or a `pass: false` risk ruling) yet its `risk_rulings` are ALL `pass: true`, 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.
86
89
 
87
90
  - **`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.
88
91
  - **`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`.
@@ -107,8 +110,9 @@ Grade against the row matching `--dimension`. "Pass bar" is the line; meet it
107
110
 
108
111
  | Dimension | What it checks | Where to look | Pass bar |
109
112
  |---|---|---|---|
110
- | `completeness` | The artifact covers the whole brief — no unresolved `TODO`/`TBD`/`?`/"unknown"/"figure out later" markers; every area it names is addressed; open questions are resolved or explicitly deferred with a reason. **When `--goal` is given, the brief IS the goal file**: every explicit ask and constraint in it is addressed or explicitly deferred with a reason — a requirement present in the goal but absent from the artifact is a blocking gap. **When `--acceptance` is also given, walk its `items:` id by id**: each is genuinely covered by the artifact (an `acceptance:` disposition naming a phase must be honest — the phase's work would actually make the item's evidence hold) or explicitly deferred with a reason; an item neither covered nor deferred, a dishonest `implemented` claim, or a silently dropped/reworded item is a blocking gap. | The artifact's own content, cross-checked against `--goal` and the `--acceptance` items when given. | No blocking gap — nothing a downstream stage would need is left undefined, no explicit `--goal` ask is silently dropped, and every `--acceptance` item is honestly disposed. |
111
- | `correctness` | Semantic claims only — EXACTLY four finding classes exist (step 4). Citation RESOLUTION is the deterministic floor's duty, never this dimension's. **Never execute.** No code, tests, linters, type checks, or scripts — a claim settleable only by running something is never a finding or blocker: record `unverified: <where>` in `feedback`. **Observed evidence for blocking.** `medium`+ requires observed evidence — the span you read or the probe output you saw; configuration-, documentation-, or must-be-true reasoning caps at `low`. | **Spot-check the live codebase**: by file + named symbol, NOT by exact line number (line numbers are navigation hints). | No false claim in the sample; no two sections contradict; no explicit `--goal` constraint contradicted; no risk flag ruled `fail`. |
113
+ | `completeness` | The artifact covers the whole brief — no unresolved `TODO`/`TBD`/`?`/"unknown"/"figure out later" markers; every area it names is addressed; open questions are resolved or explicitly deferred with a reason. **When `--goal` is given, the brief IS the goal file**: every explicit ask and constraint in it is addressed or explicitly deferred with a reason — a requirement present in the goal but absent from the artifact is a blocking gap. **When `--acceptance` is also given, walk its `items:` id by id against the artifact's frontmatter `acceptance:` block**: each id is `implemented` with an honest `phase:` (its command exits 0 as written on that phase's tree) or `deferred` with a reason and an `## Out of Scope` line, or `rebound` with `phase:`, `command:`, and a reason where the command measures the SAME observable as the item's `statement`/`expect` (a dropped conjunct with no stated reason, or a weaker check, is a blocking gap). No block entry ⇒ undisposed, whatever the prose says. An undisposed id, a dishonest `implemented`, or a dropped/reworded item is a blocking gap at `medium`+. | The artifact's own content, cross-checked against `--goal` and the `--acceptance` items when given. | No blocking gap — nothing a downstream stage would need is left undefined, no explicit `--goal` ask is silently dropped, and every `--acceptance` item is honestly disposed. |
114
+ | `correctness` | Semantic claims only — EXACTLY three finding classes exist (step 4); plan risk flags are the `risk-rulings` member's, never yours. Citation RESOLUTION is the deterministic floor's duty, never this dimension's. **Never execute.** No code, tests, linters, type checks, or scripts — a claim settleable only by running something is never a finding or blocker: record `unverified: <where>` in `feedback`. **Observed evidence for blocking.** `medium`+ requires observed evidence — the span you read or the probe output you saw; configuration-, documentation-, or must-be-true reasoning caps at `low`. | **Spot-check the live codebase**: by file + named symbol, NOT by exact line number (line numbers are navigation hints). | No false claim in the sample; no two sections contradict; no explicit `--goal` constraint contradicted. |
115
+ | `risk-rulings` | Every plan-authored `risks:` flag ruled against the real codebase / the plan (see "Plan-authored risk flags"), each `pass` grounded per its duty (a `file:line`-cited mechanics pass; a `procedure` + `owner` deferral), each `fail` a risk that is real and unaddressed. **Never execute** (the `correctness` rule): a `verify-at-implement` flag is deferred through its `procedure`, not run here. **Observed evidence for blocking**: a `fail` needs the span you read. | The plan's `risks:` frontmatter + `## Risk Flags` section; **spot-check the live codebase** by file + named symbol for every claim. | Every flag ruled `pass` with its duty discharged. |
112
116
  | `actionability` | A competent implementer could execute it without guessing — concrete steps, named files/symbols, explicit success criteria; no hand-waving ("somehow", "handle appropriately", "etc."). | The artifact's own content. | Every section/slice is executable as written. |
113
117
  | `architecture-fit` | The approach fits the existing architecture and the constraints surfaced in `--context` — respects module boundaries, dependency direction, established layering; introduces no boundary violation. | The artifact **and** `--context`, cross-checked against real module boundaries via Grep/Read. | No architectural conflict with the codebase or the research's constraints. |
114
118
  | `pattern-following` | Mirrors the codebase's dominant conventions (naming, error handling, file layout, test style) instead of inventing new ones where a precedent exists; any divergence is justified. | **Spot-check** comparable existing code via Grep/Read for the local convention. | Aligns with the dominant local pattern, or names a reason to diverge. |
@@ -117,10 +121,15 @@ Grade against the row matching `--dimension`. "Pass bar" is the line; meet it
117
121
  ## Steps
118
122
 
119
123
  1. **Parse + validate flags.** Bail per the Input rules above if malformed.
120
- 2. **Read fully** (no limit/offset): `--artifact`, and `--context` / `--goal` / `--acceptance` / `--prior` / `--cite-check` if given (skip `--goal` unless your dimension is `completeness` or `correctness`; skip `--acceptance` unless your dimension is `completeness`; skip `--cite-check` unless your dimension is `correctness`).
124
+ 2. **Read fully, in one batch.** Issue every input read in ONE message: `--artifact`, and `--context` / `--goal` / `--acceptance` / `--prior` / `--cite-check` if given (skip `--goal` unless your dimension is `completeness` or `correctness`; skip `--acceptance` unless your dimension is `completeness`; skip `--cite-check` unless your dimension is `correctness`). A read that comes back truncated reports the file's line count: request EVERY remaining range of that file in a single follow-up message, never one continuation per turn. The input set is known before you start, so reading it costs one turn, at most two — each extra serial turn re-reasons over the whole context for nothing.
121
125
  3. **Select the single rubric row** for `--dimension`. Ignore every problem outside it.
122
- 4. **Evaluate.** For `correctness` / `architecture-fit` / `pattern-following` / `design-readiness`, spot-check against the real codebase — resolve references (correctness excepted: the deterministic floor owns resolution), compare conventions, check boundaries, expand each slice's true touch + dependency fan-out from its cited seeds to gauge whether the footing is bounded AND complete, and check each shared contract has a single owning slice. **Citation-resolution rule: citations are navigation hints — locate by symbol, not exact line. Line drift is NEVER a finding, at any severity; do not report or mention it. OUTSIDE `correctness`, the only citation findings that exist: the file does not exist, the named symbol/content does not exist in it, or the code does not do what the artifact claims it does.** For `completeness` / `actionability`, judge the artifact's own content. **On `correctness`, the closed four-class finding list: (1) a cited span does not do what the artifact claims; (2) two sections contradict each other; (3) a claim contradicts an explicit `--goal` constraint; (4) a risk flag ruled `fail` — nothing else is a `correctness` finding; resolution — flag or no flag — is the floor's duty: never re-resolve citations; sample the SEMANTIC claim, folding floor findings in as leads. Resolution-suppression rule: the resolution classes — file/symbol/content absent, cited line stale or wrong, missing anchor — are suppressed AT EMIT. Never write one into `findings[]`, at any severity — flag or no flag (a rubric violation). When one or more would have fired, emit instead the count-only marker `regradeReason: resolution-suppressed` in `feedback` — recording suppression and NOTHING else (no detail, `where`, or path).** Rule every plan-authored risk flag (see "Plan-authored risk flags") — verify each `risks:` claim 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.
123
- 5. **Decide** `pass` (against the pass bar), `score` (0–100), `severity` (`none` | `low` | `medium` | `high` = the worst finding), and `feedback`. **`severity` is gate-load-bearing: the workflow treats any verdict whose worst finding is `low`/`none` as passing, even on `pass: false`, and only a `medium`+ finding blocks the gate.** So set `severity` to honestly reflect blocking weight — `low`/`none` for a cosmetic nit (a stylistic phrasing, a naming quibble that doesn't change behavior), `medium`+ for a finding a downstream stage genuinely cannot proceed past (a missing step, an executable edit that would fail as written, a boundary violation, or — outside `correctness` — a nonexistent cited file or symbol), **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. **Mechanical self-check: if any finding's own `detail` asserts a deterministic failure-as-written (fails typecheck/compile, an edit anchor does not match, or — outside `correctness` — a nonexistent cited file or symbol), `severity` MUST be `medium`+ — regardless of dimension and even when `pass` would otherwise be `true`.** **Marker-emit clause (`correctness` only): when step 4's suppression rule fired, append the marker `regradeReason: resolution-suppressed` to `feedback` exactly once — count-only. It is the ONE permitted addition to a pass's one-short-sentence feedback; on `pass: false` it rides the instruction set's end.** **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`.**
126
+ 4. **Evaluate.** For `correctness` / `risk-rulings` / `architecture-fit` / `pattern-following` / `design-readiness`, spot-check against the real codebase — resolve references (correctness excepted: the deterministic floor owns resolution), compare conventions, check boundaries, expand each slice's true touch + dependency fan-out from its cited seeds to gauge whether the footing is bounded AND complete, and check each shared contract has a single owning slice. **Citation-resolution rule: citations are navigation hints — locate by symbol, not exact line. Line drift is NEVER a finding, at any severity; do not report or mention it. OUTSIDE `correctness`, the only citation findings that exist: the file does not exist, the named symbol/content does not exist in it, or the code does not do what the artifact claims it does.** For `completeness` / `actionability`, judge the artifact's own content. **On `correctness`, the closed three-class finding list: (1) a cited span does not do what the artifact claims; (2) two sections contradict each other; (3) a claim contradicts an explicit `--goal` constraint — nothing else is a `correctness` finding (a risk flag is the `risk-rulings` member's, never a `correctness` finding); resolution — flag or no flag — is the floor's duty: never re-resolve citations; sample the SEMANTIC claim, folding floor findings in as leads. Resolution-suppression rule: the resolution classes — file/symbol/content absent, cited line stale or wrong, missing anchor — are suppressed AT EMIT. Never write one into `findings[]`, at any severity — flag or no flag (a rubric violation). When one or more would have fired, emit instead the count-only marker `regradeReason: resolution-suppressed` in `feedback` — recording suppression and NOTHING else (no detail, `where`, or path).** **On `risk-rulings`**, rule every plan-authored flag (see "Plan-authored risk flags") — verify each `risks:` claim and record a `risk_rulings` entry; no other dimension does. **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.
127
+ - **`correctness` runs as inventory → one evidence batch → commit-first compare. Never one claim per turn.**
128
+ 1. **Inventory first, from the artifact alone.** Before any codebase read, list what you will check: every `--cite-check` lead (mandatory), every `--prior` finding (mandatory with `--prior`), then a SAMPLE of at most 8 further cited claims, chosen in this priority: claims inside text an implementer copies verbatim (a code block, JSDoc, a comment), claims a phase's edits depend on (a guard, a return shape, a call order, an exported name), then any other. Mandatory items are never cut; only the sample is capped.
129
+ 2. **One evidence batch.** Issue the reads for the WHOLE inventory in ONE message — symbol-anchored `grep -n` and bounded ranges around the symbol (about 40 lines either side), never a whole file. At most two further batches, only for the consumer or caller sites the first batch shows you need. Budget: the verdict is written by the sixth tool turn. A claim still unread at that point is recorded as `unverified: <where>` in `feedback`, exactly like a claim that needs execution — never guessed either way.
130
+ 3. **Commit before comparing.** For each claim, first write from the span alone, in one line, what the code does. Only then set that line against the artifact's sentence. A finding exists only where your line and the artifact's sentence contradict each other on observable behavior; the `detail` states both sides. A span you have not described from the code alone cannot ground a finding.
131
+ 4. **False, not different.** A `correctness` finding says the artifact's claim is false as written. "I would design this differently", a requirement the artifact never states, or an edge case the artifact makes no claim about is not a `correctness` finding — drop it; if another dimension owns it, that member reports it.
132
+ 5. **Decide, then remedy.** Fix `findings[]`, `pass` (against the pass bar), `score` (0–100), and `severity` (`none` | `low` | `medium` | `high` = the worst finding) FIRST, from the evidence alone; only then compose `feedback`. A remedy you can picture is not evidence that a claim is false — the instruction set tells `amend` how to clear findings that already exist, it never recruits new ones. **`severity` is gate-load-bearing: the workflow treats any verdict whose worst finding is `low`/`none` as passing, even on `pass: false`, and only a `medium`+ finding blocks the gate.** So set `severity` to honestly reflect blocking weight — `low`/`none` for a cosmetic nit (a stylistic phrasing, a naming quibble that doesn't change behavior), `medium`+ for a finding a downstream stage genuinely cannot proceed past (a missing step, an executable edit that would fail as written, a boundary violation, or — outside `correctness` — a nonexistent cited file or symbol), **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. **Mechanical self-check: if any finding's own `detail` asserts a deterministic failure-as-written (fails typecheck/compile, an edit anchor does not match, or — outside `correctness` — a nonexistent cited file or symbol), `severity` MUST be `medium`+ — regardless of dimension and even when `pass` would otherwise be `true`.** **Marker-emit clause (`correctness` only): when step 4's suppression rule fired, append the marker `regradeReason: resolution-suppressed` to `feedback` exactly once — count-only. It is the ONE permitted addition to a pass's one-short-sentence feedback; on `pass: false` it rides the instruction set's end.** **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`.**
124
133
  - `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).
125
134
  - `pass: false` on `design-readiness` where **every** finding's remedy is pure citation bookkeeping — add a named seed to a slice's `Draws on`, or move a named item to `Out of scope`, with **no** split/merge/renumber/re-fence needed: additionally emit top-level `"remedy": "cite"` and give **each** finding a `"requires": "<path>:<lines>"` naming the exact seed. The slice gate then verifies deterministically that the re-cut map satisfies every finding with the slice structure unchanged, and skips the re-grade panel. Emit `remedy` ONLY when those citation edits alone would flip your verdict to pass — any structural doubt, or any finding without a concrete `requires` seed, → omit it and the normal re-grade runs.
126
135
  - `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.
@@ -152,7 +161,7 @@ Grade against the row matching `--dimension`. "Pass bar" is the line; meet it
152
161
  }
153
162
  ```
154
163
 
155
- Include `risk_rulings` **only** on a `correctness` verdict when the artifact declares `risks:` — one entry per flag. Omit the key entirely on every other dimension and when the artifact declares no risks. Include `finding_rulings` **only** when `--prior` was given — one entry per prior finding and per prior failed risk ruling, none omitted (see "Prior-round adjudication"); omit the key entirely otherwise. Include top-level `"remedy": "cite"` plus a per-finding `"requires"` **only** on a `design-readiness` fail whose every finding is discharged by adding the named citation (see step 5); omit them otherwise. Every `evidence` string follows the same JSON-safety rules as `feedback`.
164
+ Include `risk_rulings` **only** on a `risk-rulings` verdict — one entry per declared flag, none omitted. Omit the key entirely on every other dimension (`correctness` included). Include `finding_rulings` **only** when `--prior` was given — one entry per prior finding and per prior failed risk ruling, none omitted (see "Prior-round adjudication"); omit the key entirely otherwise. Include top-level `"remedy": "cite"` plus a per-finding `"requires"` **only** on a `design-readiness` fail whose every finding is discharged by adding the named citation (see step 5); omit them otherwise. Every `evidence` string follows the same JSON-safety rules as `feedback`.
156
165
 
157
166
  ## Hard rules
158
167
 
@@ -160,6 +169,7 @@ Include `risk_rulings` **only** on a `correctness` verdict when the artifact dec
160
169
  - **Goal findings quote the goal.** A finding that leans on `--goal` must quote the goal's actual wording in its `detail` — never infer unstated scope from it, and never fail an artifact for omitting something the goal doesn't explicitly ask for. Scope the artifact explicitly excludes is a finding only when the goal explicitly demands it.
161
170
  - **Read-only**, except writing your one verdict JSON. Never edit the artifact or any code.
162
171
  - **No subagents. No `ask_user_question`, anywhere.** A grader is non-interactive — render a verdict from what you can read.
172
+ - **Batch, then reason.** Tool calls that do not depend on each other go in ONE message; the harness runs them concurrently. One read per turn is the slowest possible judge, and it is a rule violation, not caution — plan the reads, issue them together, reason once over the results.
163
173
  - **Always emit the verdict file** on the normal path (pass or fail); only a flag-wiring error stops without one.
164
174
  - **Machine-valid JSON.** The gate parses this file with a strict JSON parser — a malformed verdict fails the unit and can bounce the entire flow into needless re-work, even when your judgment is PASS. Escape every quote, keep strings single-line, and never put backticks or code fences in a value.
165
175
 
@@ -36,9 +36,10 @@ contract:
36
36
  required: [id, disposition]
37
37
  properties:
38
38
  id: { type: string }
39
- disposition: { enum: [implemented, deferred] }
39
+ disposition: { enum: [implemented, deferred, rebound] }
40
40
  phase: { type: integer, minimum: 1 }
41
41
  reason: { type: string }
42
+ command: { type: string }
42
43
  consumes:
43
44
  meta:
44
45
  artifactKind: [research, acceptance]
@@ -164,14 +165,14 @@ Populate each `phases[].files:` from that phase's `#### N.` / `**File**:` paths
164
165
 
165
166
  Populate `## Out of Scope` from the Step 1 goal-ask enumeration: one one-line deferral with a reason per goal ask no phase implements.
166
167
 
167
- Populate `acceptance:` ONLY when an `--acceptance` file was given (omit the array entirely otherwise): one entry per inventory item, in item order — `disposition: implemented` with the covering `phase:` number, or `disposition: deferred` with a one-line `reason:` (and a matching `## Out of Scope` line). Every item id from the inventory appears exactly once; never invent an id the inventory doesn't carry.
168
+ Populate `acceptance:` ONLY when an `--acceptance` file was given (omit the array entirely otherwise): one entry per inventory item, in item order — `disposition: implemented` with the covering `phase:` number, `disposition: deferred` with a one-line `reason:` (and a matching `## Out of Scope` line), or `disposition: rebound` with `phase:`, `command:`, and `reason:`. Every item id from the inventory appears exactly once; never invent an id the inventory doesn't carry. `rebound` + `phase` + `command` + `reason` when the substance is delivered but the frozen command pins a mechanism the design changed (a file or helper name, a count): the replacement command measures the SAME observable as the item's `statement`/`expect`, reuses a check the phase's own AV runs, and drops no conjunct without saying why; substance not delivered ⇒ `deferred`, never `rebound`.
168
169
 
169
170
  Then print the path and a one-line summary: `quick-plan written: {N} phase(s), {M} files`.
170
171
 
171
172
  ## Important Notes
172
173
 
173
174
  - **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.
174
- - **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.
175
+ - **No `risks:` frontmatter — this is the panel lightening.** The grade panel dispatches its `risk-rulings` unit (the risk-flag adjudication, with its mechanics-evidence and verify-at-implement duties) **only** when the artifact carries `risks:`. With none declared, no risk unit runs, `risk_rulings` is omitted everywhere, and `correctness` runs its cheap semantic spot-check alone. 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.
175
176
  - **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).
176
177
  - **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.
177
178
  - **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.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: synthesize
3
3
  description: Merge N independent per-slice designs (plus the research they rest on) into ONE coherent phased plan in .rpiv/artifacts/plans/ — reconciling cross-slice overlaps, wiring inter-slice integration, and ordering phases by slice dependencies. Single-pass, no subagents, no self-review. The fan-in barrier of a fanout-and-synthesize flow — one phase per slice, plan-compatible so implement/validate consume it unchanged. For large slice maps it also runs hierarchically — as a per-cluster partial (`--as-subplan` turns designs into a subplan) and as the root merge (`--subplans` turns subplans into a plan) — so no single pass must hold every design at once. Use after a per-slice design fanout.
4
- argument-hint: "--designs <path>... [--research <path>] [--as-subplan] [--cluster <k>] | --subplans <path>... [--research <path>]"
4
+ argument-hint: "--designs <path>... [--research <path>] [--as-subplan] [--cluster <k>] | --subplans <path>... [--research <path>] [--goal <path>] [--acceptance <path>]"
5
5
  allowed-tools: Read, Grep, Glob, Write
6
6
  shell-timeout: 10
7
7
  disable-model-invocation: true
@@ -38,11 +38,24 @@ contract:
38
38
  properties:
39
39
  id: { type: string }
40
40
  claim: { type: string }
41
+ acceptance:
42
+ type: array
43
+ items:
44
+ type: object
45
+ required: [id, disposition]
46
+ properties:
47
+ id: { type: string }
48
+ disposition: { enum: [implemented, deferred, rebound] }
49
+ phase: { type: integer, minimum: 1 }
50
+ reason: { type: string }
51
+ command: { type: string }
41
52
  consumes:
42
53
  reads:
43
54
  designs: {}
44
55
  subplans: {}
45
56
  research: {}
57
+ goal: {}
58
+ acceptance: {}
46
59
  ---
47
60
 
48
61
  # Synthesize
@@ -58,6 +71,8 @@ You merge several independent per-slice designs into **one coherent phased plan*
58
71
  - `--research <path>` *(optional)* — the research the slices rest on, for cross-slice constraints.
59
72
  - `--as-subplan` *(flag)* — emit a **sub-plan** (partial mode) instead of a full plan.
60
73
  - `--cluster <k>` *(optional, partial mode)* — the ordinal written into the sub-plan's `_cluster-<k>.md` filename. The cluster fanout supplies it; for manual partial invocation pick an unused `<k>` (scan `.rpiv/artifacts/subplans/` for existing `*_cluster-<k>.md` and take the next unused positive integer) so a re-dispatched pass writes a distinct file and never clobbers a sibling sub-plan.
74
+ - `--goal <path>` *(optional, root/flat)* — the verbatim brief. Every ask it names is implemented by a phase or deferred under `## Out of Scope` with a reason. Partial mode ignores it.
75
+ - `--acceptance <path>` *(optional, root/flat)* — the frozen acceptance inventory (`items:`, ids `a1…`). Every id is disposed in the frontmatter `acceptance:` block (step 3b). Partial mode ignores it; missing or unreadable → omit the block.
61
76
 
62
77
  If neither `--designs` nor `--subplans` is present, print an error and stop.
63
78
 
@@ -97,6 +112,7 @@ Copy values verbatim. `<iso>` is the first tab-separated field; `<slug>` is the
97
112
  - **`disposition: verify-at-implement`** — the panel may defer the risk to a later phase rather than rule it in this panel. A deferred pass is accepted ONLY when the flag ALSO carries a concrete **`procedure`** (the named command/test the owner phase runs to discharge it) and an **`owner`** (the phase `n` that runs that step); a bare "verify later" with no procedure demotes. Use it for risks that genuinely need the shipped tree (a real `build` run, a coverage gate) the plan-grade panel cannot run.
98
113
  - Default (no `claim_type`, no `disposition`) stays the ordinary `{ id, claim }` shape — the panel rules it on the artifact as today, with no evidence or procedure duty.
99
114
  3. **Sequence phases** — one phase per slice (flat/partial) or carry the sub-plans' phases through (root), ordered so a phase never precedes one it `depends_on`. Tightly-coupled units may merge into one phase; note any merge. Populate each entry's `files:` from that phase's `### Changes` paths (every repo-root-relative path the phase creates or edits) and `depends_on` only for semantic ordering NOT visible in `files:` (a phase that needs an earlier phase to run first despite no shared file) — lower `n` only.
115
+ 3b. **Dispose every acceptance id** (root/flat, `--acceptance` given): one `acceptance:` entry per inventory id, in order — `implemented` + `phase` (its command exits 0 as written on that phase's tree) or `deferred` + `reason` + an `## Out of Scope` line. Every id once; no invented ids; prose is not a disposition. `rebound` + `phase` + `command` + `reason` when the substance is delivered but the frozen command pins a mechanism the design changed (a file or helper name, a count): the replacement command measures the SAME observable as the item's `statement`/`expect`, reuses a check the phase's own AV runs, and drops no conjunct without saying why; substance not delivered ⇒ `deferred`, never `rebound`.
100
116
  4. **Write the output** (below), `status: ready`:
101
117
  - **Flat / root** → a standard **plan** in `.rpiv/artifacts/plans/` — phases with concrete changes and Success Criteria that pass through unchanged to `implement`/`validate`.
102
118
  - **Partial** (`--as-subplan`) → a **sub-plan** in `.rpiv/artifacts/subplans/` — the same phase shape PLUS a `summary` and an `exports` block naming the seams (files/symbols/interfaces this cluster owns) the root will wire other clusters into. Keep it compact: the root reads it instead of your cluster's designs.
@@ -116,7 +132,7 @@ exports:
116
132
  depends_on_clusters: []
117
133
  ```
118
134
 
119
- The frontmatter **must** carry a `phases:` array and `phase_count` equal to **both** the array length **and** the number of `## Phase N:` headings in the body (a downstream derive-check rejects a mismatch) — for sub-plans too.
135
+ The frontmatter **must** carry a `phases:` array and `phase_count` equal to **both** the array length **and** the number of `## Phase N:` headings in the body (a downstream derive-check rejects a mismatch) — for sub-plans too. `acceptance:` appears ONLY with `--acceptance` in root/flat mode; sub-plans never carry it.
120
136
 
121
137
  ```markdown
122
138
  ---
@@ -135,6 +151,9 @@ risks:
135
151
  - { id: r1, claim: "<a decision you want the grade panel + validate to rule on>" }
136
152
  - { id: r2, claim: "<a checkable mechanism>", claim_type: mechanics }
137
153
  - { id: r3, claim: "<needs the shipped tree to discharge>", disposition: verify-at-implement, procedure: "<named command/test>", owner: <phase n> }
154
+ acceptance:
155
+ - { id: a1, disposition: implemented, phase: 1 }
156
+ - { id: a2, disposition: deferred, reason: "<one line, mirrored by an ## Out of Scope line>" }
138
157
  sources: [<each --designs path>, <--research path>]
139
158
  tags: [plan, synthesized]
140
159
  ---
@@ -154,6 +154,7 @@ For each phase in the plan:
154
154
  10. **Execute the acceptance inventory** (only when `--acceptance` was provided):
155
155
  - Read the inventory fully. Its `items:` are the goal-derived standard of completion, frozen BEFORE planning — the one executable measure the plan did not author, so it catches what the plan's own criteria structurally cannot: an ask the planning narrowed away. Cross-reference the plan's `acceptance:` disposition mapping when it carries one.
156
156
  - **An item the plan marked `deferred`** (with a reason, matching an `## Out of Scope` line): do not run its command; record the deferral under `#### Deviations from Plan:` as a non-blocking note quoting the reason — the deferral was legible and gate-approved. An item the plan never disposed of at all is judged exactly like an `implemented` one — silence does not defer.
157
+ - **An item the plan marked `rebound`** (`command` + `reason` present; else undisposed): run the rebound command instead of the inventory's. Exit 0 ⇒ met, noted under `#### Deviations from Plan:` with the reason and both commands. Non-zero ⇒ fails like `implemented`, rebound command in the `blockers:` entry. Never run both and keep the passing one.
157
158
  - **An item with a `command`** (not deferred): RUN it as written from the repo root. Exit 0 ⇒ the item holds — record it met. Non-zero ⇒ the item fails: force **`verdict: fail`**, report it under **Deviations from Plan** quoting the item's `statement`, and add a `blockers:` entry for it (Step 3.2's shape — the item's `command` verbatim; attribute `file`/`line` to the in-delta file the command or the item's statement most directly names). A failing acceptance command with a sound premise is never "pre-existing debt" — the inventory is future-tense by construction. Only when the command itself is unrunnable as written (a path that never existed at any revision, a malformed invocation) rule the ITEM unmeasurable, non-blocking, under `#### Potential Issues:` — never silently rewrite the command into something weaker.
158
159
  - **An item with only a `manual` procedure** (not deferred): record it under the report's manual-verification section with its procedure — homework for the human, never a blocker.
159
160