@juicesharp/rpiv-pi 2.7.0 → 2.8.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 +2 -2
- package/docs/architecture.md +3 -3
- package/docs/skills.md +9 -7
- package/docs/workflows.md +3 -3
- package/extensions/rpiv-core/built-in-workflows.ts +273 -94
- package/extensions/rpiv-core/built-ins/gates.ts +38 -15
- package/extensions/rpiv-core/built-ins/goal-baseline.ts +43 -1
- package/extensions/rpiv-core/built-ins/grade-panel.ts +98 -29
- package/extensions/rpiv-core/built-ins/index.ts +2 -0
- package/extensions/rpiv-core/built-ins/priors.ts +208 -38
- package/extensions/rpiv-core/built-ins/remediation.ts +96 -0
- package/extensions/rpiv-core/built-ins/slices.ts +5 -1
- package/extensions/rpiv-core/lane-relay-ui.ts +25 -1
- package/extensions/rpiv-core/outcome-derivation.ts +1 -0
- package/extensions/rpiv-core/pipeline-pointer.ts +1 -1
- package/package.json +3 -3
- package/skills/acceptance/SKILL.md +123 -0
- package/skills/grade/SKILL.md +5 -4
- package/skills/quick-plan/SKILL.md +19 -2
- package/skills/remediate/SKILL.md +17 -15
- package/skills/research/SKILL.md +27 -0
- package/skills/slice/SKILL.md +2 -2
- package/skills/validate/SKILL.md +11 -4
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
CODE_DIMENSION_FANOUT,
|
|
45
45
|
COMMIT_BASELINE_PROMPT,
|
|
46
46
|
captureGoal,
|
|
47
|
+
captureReviewScope,
|
|
47
48
|
codeDemote,
|
|
48
49
|
codeGatePasses,
|
|
49
50
|
codeSnapshot,
|
|
@@ -69,6 +70,7 @@ import {
|
|
|
69
70
|
planSnapshot,
|
|
70
71
|
REVIEW_PHASE_ITERATE,
|
|
71
72
|
reconcile,
|
|
73
|
+
remediationOutcome,
|
|
72
74
|
rulingEffectivePass,
|
|
73
75
|
SHIP_DIMENSION_FANOUT,
|
|
74
76
|
SHIP_DIMENSIONS,
|
|
@@ -143,7 +145,8 @@ const polishWorkflow = defineWorkflow({
|
|
|
143
145
|
});
|
|
144
146
|
|
|
145
147
|
// ===========================================================================
|
|
146
|
-
// build — goal (verbatim-brief capture) → research →
|
|
148
|
+
// build — goal (verbatim-brief capture) → research → acceptance (the
|
|
149
|
+
// goal-derived executable standard of completion) → slice → slice-check
|
|
147
150
|
// (deterministic floor) → slice-grade (design-readiness, slice-fix loop)
|
|
148
151
|
// → slice-design (fanout) → design-review (one human checkpoint) →
|
|
149
152
|
// subplan (cluster fanout) → plan → plan-grade (plan-fix loop) →
|
|
@@ -182,26 +185,41 @@ const RESEARCH_BRIEF_PROMPT: PromptFn = ({ state }) => `/skill:research ${state.
|
|
|
182
185
|
|
|
183
186
|
/**
|
|
184
187
|
* ship's research front-load — a LEANER grounding than build's `/skill:research`
|
|
185
|
-
* pass
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
188
|
+
* pass, tiered to the brief's pre-chewedness. Bypasses the research skill: a
|
|
189
|
+
* pre-chewed brief (root cause, files to touch, or fix already named) gets
|
|
190
|
+
* VERIFICATION, not re-derivation — at most ONE verify-only `codebase-analyzer`
|
|
191
|
+
* dispatch confirming each named anchor, or none at all when the anchors are
|
|
192
|
+
* plain file paths the stage child reads itself; a symptom-only brief keeps at
|
|
193
|
+
* most TWO targeted `codebase-analyzer` dispatches (sequentially — never
|
|
194
|
+
* parallel, never `run_in_background`) mapping only what a lightweight
|
|
195
|
+
* single-phase plan needs to be correct. The agent then `Write`s a grounding
|
|
196
|
+
* doc under `.rpiv/artifacts/research/` (the prompt names the directory only —
|
|
197
|
+
* a full example path would prime the collector's pre-write path-echo hazard),
|
|
198
|
+
* where the research bucket collector harvests it — the grade panel's
|
|
199
|
+
* architecture-fit dimension threads it as `--context` exactly as build's
|
|
200
|
+
* research artifact does. A prompt stage (no skill), so the stage name
|
|
201
|
+
* `research` drives outcome derivation (research contract → `research`
|
|
194
202
|
* bucket), exactly as build's `RESEARCH_BRIEF_PROMPT` stage does — the prompt
|
|
195
|
-
* text, not dispatch, is what differs.
|
|
203
|
+
* text, not dispatch, is what differs. The prompt also pins a progress-marker
|
|
204
|
+
* protocol — a `[Classified]:` first line naming the chosen tier,
|
|
205
|
+
* `[Dispatch N/M]:` / `[Dispatch N/M returned]:` echo lines around each
|
|
206
|
+
* grounding dispatch (plus the `[Dispatch]: none` zero-dispatch escape) — so
|
|
207
|
+
* the lane console's live tail narrates the otherwise-silent batch window;
|
|
208
|
+
* markers are transcript text only and never carry an artifacts path before
|
|
209
|
+
* the write.
|
|
196
210
|
*/
|
|
197
211
|
const SHIP_RESEARCH_PROMPT: PromptFn = ({ state }) =>
|
|
198
212
|
[
|
|
199
213
|
"Ground this brief for a lightweight ship plan.",
|
|
200
|
-
"Do NOT dispatch /skill:research
|
|
214
|
+
"Do NOT dispatch /skill:research — size the grounding to what the brief already carries.",
|
|
215
|
+
"Classify the brief first, then follow ONLY the matching tier:",
|
|
216
|
+
"- Tier A (pre-chewed — the brief names the root cause, the files to touch, or the fix): VERIFY, don't re-derive. Dispatch at most ONE codebase-analyzer subagent (sequentially — never parallel, never run_in_background) in verify-only mode, confirming or denying each named anchor against the actual code and reporting drift with the corrected file:line. If the anchors are plain file paths, dispatch nothing — Read/Grep them yourself.",
|
|
217
|
+
"- Tier B (symptom only — the brief names none of the three: no root cause, no files, no fix): dispatch at most TWO targeted codebase-analyzer subagents (sequentially — never parallel, never run_in_background) to map only what a single-phase plan needs to be correct: entry points, the relevant module's shape, and the conventions the implement lane must match.",
|
|
218
|
+
"Progress markers — echo your status as you go: the first line of your reply, before anything else, is [Classified]: Tier A — verify-only or [Classified]: Tier B — map ground truth (the tier you classified the brief into). Before each dispatch, emit [Dispatch N/M]: <purpose phrase>; once it lands, emit [Dispatch N/M returned]: <outcome phrase> (M is the tier's dispatch ceiling: 1 for Tier A, 2 for Tier B). For Tier A's zero-dispatch escape, emit [Dispatch]: none — reading the named anchors directly. Markers are transcript text only, never artifact content, and must NEVER contain a .rpiv/artifacts/ path before the file is written.",
|
|
201
219
|
"",
|
|
202
220
|
`Brief: ${state.originalInput}`,
|
|
203
221
|
"",
|
|
204
|
-
"Then Write
|
|
222
|
+
"Then Write the grounding doc under .rpiv/artifacts/research/ (timestamped filename, under 150 lines) carrying the findings with verifiable file:line citations — Code References, Integration Points, the relevant module's shape, and the conventions the implement lane must match — announce the written file's path in your final message, and stop.",
|
|
205
223
|
].join("\n");
|
|
206
224
|
|
|
207
225
|
/**
|
|
@@ -290,8 +308,10 @@ const vetWorkflow = defineWorkflow({
|
|
|
290
308
|
start: "goal",
|
|
291
309
|
stages: {
|
|
292
310
|
// Capture the user's brief verbatim on its own `goal` channel, and snapshot
|
|
293
|
-
// the run-start pre-existing-dirty paths (role "baseline").
|
|
294
|
-
// `
|
|
311
|
+
// the run-start pre-existing-dirty paths (role "baseline"). Uses
|
|
312
|
+
// `captureReviewScope` — build's capture minus the garbage-brief floor,
|
|
313
|
+
// because vet's input is a review-scope token ("staged", a hash) that is
|
|
314
|
+
// legitimately shorter than any brief the floor admits — so the scope-check's
|
|
295
315
|
// `reads: ["plans", "goal"]` resolves a baseline to subtract and the goal md
|
|
296
316
|
// rides the channel face. `goal` as start publishes the goal-md as
|
|
297
317
|
// `artifacts[0]`; `code-review` is a plain `produces()` SKILL stage (skill
|
|
@@ -307,7 +327,7 @@ const vetWorkflow = defineWorkflow({
|
|
|
307
327
|
// attaches its `outputSchema` and the `blockers_count` gate would read
|
|
308
328
|
// UNVALIDATED data (NaN-route risk, not just a warning). Keeping it a skill
|
|
309
329
|
// stage keeps `skill="code-review"` → contract schema attaches → validated.
|
|
310
|
-
goal: produces.script({ run:
|
|
330
|
+
goal: produces.script({ run: captureReviewScope }),
|
|
311
331
|
"code-review": produces(),
|
|
312
332
|
blueprint: produces(),
|
|
313
333
|
// Dep-gated DAG variant: implement phases now
|
|
@@ -373,10 +393,112 @@ const vetWorkflow = defineWorkflow({
|
|
|
373
393
|
},
|
|
374
394
|
});
|
|
375
395
|
|
|
396
|
+
/**
|
|
397
|
+
* The classifying validate gate — classifies a failing verdict BEFORE routing
|
|
398
|
+
* to the repair arm. `remediate`'s work-list is contractually the report's
|
|
399
|
+
* `pass: false` risk rulings plus its structured `blockers:` entries; a
|
|
400
|
+
* `verdict: fail` carrying NEITHER (run 2026-08-22_12-14-12-64eb: two
|
|
401
|
+
* whole-plan gate failures recorded only in report prose) has no handle the
|
|
402
|
+
* arm may act on, so routing it to `validate-fix` buys a provably futile lap
|
|
403
|
+
* — the arm drift-escapes without an edit and the unchanged tree re-validates
|
|
404
|
+
* to the identical verdict until the backward-jump guard halts the run. Such
|
|
405
|
+
* a fail STOPs at the gate with a route note naming why (the ship-gate
|
|
406
|
+
* `setRouteNote` pattern; a noted decision stop records as a halt). The
|
|
407
|
+
* repair-arm authority rule the slice gate learned the same way: a gate may
|
|
408
|
+
* only loop into an arm whose authority covers the failure class.
|
|
409
|
+
*
|
|
410
|
+
* A factory (not one shared EdgeFn) for the scopeFloorGate reason — each
|
|
411
|
+
* workflow's route-note symbol must never alias the other's. `maxFixRounds`
|
|
412
|
+
* caps the remediation hops a remediable fail may buy: each `validate-fix`
|
|
413
|
+
* pass publishes exactly one digest on the `remediation` channel, so the
|
|
414
|
+
* channel length IS the rounds already spent. Build passes no cap (the
|
|
415
|
+
* runner's backward-jump guard is its budget); ship caps at ONE — the single
|
|
416
|
+
* bounded hop its stop-on-fail identity concedes (run 7299: a docs-gap
|
|
417
|
+
* `fail` at the last stage stranded ~50 min of verified implementation).
|
|
418
|
+
*
|
|
419
|
+
* Reads the `validation` channel (validate's contract-derived publish bucket
|
|
420
|
+
* — a prompt stage owns its message and can't inherit its contract's output
|
|
421
|
+
* schema, so the gate folds the channel, never the raw stage output). A
|
|
422
|
+
* missing/unexpected verdict stays terminal STOP, exactly as the `match` it
|
|
423
|
+
* replaces — un-anticipated data can never route INTO commit OR the repair arm.
|
|
424
|
+
*/
|
|
425
|
+
const validateGate = (opts?: { maxFixRounds?: number }): EdgeFn => {
|
|
426
|
+
const maxFixRounds = opts?.maxFixRounds ?? Number.POSITIVE_INFINITY;
|
|
427
|
+
const route: EdgeFn = defineRoute(
|
|
428
|
+
["commit", "validate-fix", "stop"],
|
|
429
|
+
({ state }) => {
|
|
430
|
+
const latest = state.named.validation?.at(-1);
|
|
431
|
+
const data = latest?.data as { verdict?: unknown; blockers?: unknown } | undefined;
|
|
432
|
+
if (data?.verdict === "pass") return "commit";
|
|
433
|
+
if (data?.verdict !== "fail") {
|
|
434
|
+
setRouteNote(
|
|
435
|
+
route,
|
|
436
|
+
`validate verdict ${JSON.stringify(data?.verdict ?? null)} matched no branch — terminated (no fallback)`,
|
|
437
|
+
);
|
|
438
|
+
return "stop";
|
|
439
|
+
}
|
|
440
|
+
// Remediable handles: `pass: false` risk rulings (the arm's original
|
|
441
|
+
// work-list) + structured `blockers:` entries (whole-plan gate failures
|
|
442
|
+
// the validate skill attributes with a runnable command + in-delta file).
|
|
443
|
+
const failedRulings = latest ? verdictRiskRulings(latest).filter((r) => !r.pass).length : 0;
|
|
444
|
+
const blockers = Array.isArray(data.blockers) ? data.blockers.length : 0;
|
|
445
|
+
if (failedRulings + blockers === 0) {
|
|
446
|
+
setRouteNote(
|
|
447
|
+
route,
|
|
448
|
+
"validate failed with no remediable handle (no pass:false risk ruling, no blockers entry) — the remediation arm cannot act; fix manually or revise the plan",
|
|
449
|
+
);
|
|
450
|
+
return "stop";
|
|
451
|
+
}
|
|
452
|
+
if ((state.named.remediation?.length ?? 0) >= maxFixRounds) {
|
|
453
|
+
setRouteNote(
|
|
454
|
+
route,
|
|
455
|
+
`validate still fails after ${maxFixRounds} remediation round${maxFixRounds === 1 ? "" : "s"} — fix manually, then resume to re-validate`,
|
|
456
|
+
);
|
|
457
|
+
return "stop";
|
|
458
|
+
}
|
|
459
|
+
return "validate-fix";
|
|
460
|
+
},
|
|
461
|
+
{ readsData: false },
|
|
462
|
+
);
|
|
463
|
+
return route;
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* The repair-arm progress gate — the deterministic no-op backstop. The
|
|
468
|
+
* `remediation` channel carries `remediationOutcome`'s `{ changed }` (a
|
|
469
|
+
* git-only tree digest snapshotted around the `validate-fix` stage): an
|
|
470
|
+
* unchanged tree makes the re-validate lap provably futile (validate's
|
|
471
|
+
* verdict is a function of the tree), so it STOPs with a note instead of
|
|
472
|
+
* burning a backward-jump on an identical verdict. Only an explicit
|
|
473
|
+
* `changed: false` stops — a missing signal (non-repo, git failure, absent
|
|
474
|
+
* channel) proceeds, the worktree-digest degrade doctrine. A factory for the
|
|
475
|
+
* same note-symbol-aliasing reason as `validateGate`. NOTE the resume
|
|
476
|
+
* asymmetry this stop relies on: the runner never re-dispatches a halted
|
|
477
|
+
* SIDE-EFFECT gate stage — resume re-enters at this gate's onward target
|
|
478
|
+
* (implement-scope-check), so a hand-fix after this stop re-verifies
|
|
479
|
+
* end-to-end instead of replaying a remediation that would no-op again.
|
|
480
|
+
*/
|
|
481
|
+
const validateFixGate = (): EdgeFn => {
|
|
482
|
+
const route: EdgeFn = defineRoute(
|
|
483
|
+
["implement-scope-check", "stop"],
|
|
484
|
+
({ state }) => {
|
|
485
|
+
const data = state.named.remediation?.at(-1)?.data as { changed?: unknown } | undefined;
|
|
486
|
+
if (data?.changed !== false) return "implement-scope-check";
|
|
487
|
+
setRouteNote(
|
|
488
|
+
route,
|
|
489
|
+
"remediation left the working tree unchanged — re-validating cannot change the verdict; fix manually or revise the plan",
|
|
490
|
+
);
|
|
491
|
+
return "stop";
|
|
492
|
+
},
|
|
493
|
+
{ readsData: false },
|
|
494
|
+
);
|
|
495
|
+
return route;
|
|
496
|
+
};
|
|
497
|
+
|
|
376
498
|
const buildWorkflow = defineWorkflow({
|
|
377
499
|
name: "build",
|
|
378
500
|
description:
|
|
379
|
-
"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 → 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
|
|
501
|
+
"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.",
|
|
380
502
|
start: "goal",
|
|
381
503
|
stages: {
|
|
382
504
|
// The user's brief, verbatim, on its own channel — the judgment seams
|
|
@@ -389,7 +511,20 @@ const buildWorkflow = defineWorkflow({
|
|
|
389
511
|
// gate's architecture-fit dimension its --context. Prompt-dispatched so it
|
|
390
512
|
// still receives the raw brief now that `goal` holds the start slot.
|
|
391
513
|
research: produces({ prompt: RESEARCH_BRIEF_PROMPT }),
|
|
392
|
-
|
|
514
|
+
// The goal-derived acceptance inventory (see ship's twin comment): the
|
|
515
|
+
// executable standard of completion, frozen before slicing/planning so
|
|
516
|
+
// it cannot inherit their scope. Threaded to the plan/code gates'
|
|
517
|
+
// completeness units (--acceptance) and to validate, which executes the
|
|
518
|
+
// evidence commands. Deliberately NOT fed to slice/design/synthesize —
|
|
519
|
+
// the bounded-context doctrine that keeps `goal` out of the generative
|
|
520
|
+
// stages applies to its derived standard too.
|
|
521
|
+
acceptance: produces({ reads: ["goal", "research"] }),
|
|
522
|
+
// `reads: ["research"]` (not the rolling primary): `acceptance` now sits
|
|
523
|
+
// between research and slice, so the rolling primary at this stage is
|
|
524
|
+
// the acceptance doc — the explicit read restores the research artifact
|
|
525
|
+
// as slice's grounding input (dispatched as `--research <path>`; the
|
|
526
|
+
// slice skill accepts the flag form of its fresh input).
|
|
527
|
+
slice: produces({ reads: ["research"] }),
|
|
393
528
|
// Deterministic floor (no LLM): dependency-cycle freedom + brief-coverage conservation.
|
|
394
529
|
"slice-check": produces.script({ reads: ["slices"], run: sliceStructureCheck }),
|
|
395
530
|
// One LLM design-readiness judgment; verdicts on their own channel.
|
|
@@ -452,7 +587,7 @@ const buildWorkflow = defineWorkflow({
|
|
|
452
587
|
outcome: planVerdictOutcome,
|
|
453
588
|
// `research` is read so the architecture-fit unit can thread it as
|
|
454
589
|
// --context; `goal` so completeness/correctness anchor on the brief.
|
|
455
|
-
reads: ["plans", "research", "goal"],
|
|
590
|
+
reads: ["plans", "research", "goal", "acceptance"],
|
|
456
591
|
}),
|
|
457
592
|
// Stamp the duty demotion onto the graded verdicts as legible on-disk data
|
|
458
593
|
// (a `risk_duty_demotions` array written in place onto each demoted
|
|
@@ -471,7 +606,7 @@ const buildWorkflow = defineWorkflow({
|
|
|
471
606
|
skill: "grade",
|
|
472
607
|
loop: PLAN_CONFIRM_FANOUT,
|
|
473
608
|
outcome: planVerdictOutcome,
|
|
474
|
-
reads: ["plans", "research", "goal"],
|
|
609
|
+
reads: ["plans", "research", "goal", "acceptance"],
|
|
475
610
|
}),
|
|
476
611
|
"plan-fix": produces({
|
|
477
612
|
skill: "amend",
|
|
@@ -521,7 +656,7 @@ const buildWorkflow = defineWorkflow({
|
|
|
521
656
|
outcome: codeVerdictOutcome,
|
|
522
657
|
// `research` is read so the architecture-fit unit can thread it as
|
|
523
658
|
// --context; `goal` so completeness/correctness anchor on the brief.
|
|
524
|
-
reads: ["plans", "research", "goal"],
|
|
659
|
+
reads: ["plans", "research", "goal", "acceptance"],
|
|
525
660
|
}),
|
|
526
661
|
// The code-gate twin of `plan-demote`: stamp the duty demotion onto the
|
|
527
662
|
// code-graded verdicts (re-grading `plans` on `code-verdicts`) one hop
|
|
@@ -542,7 +677,7 @@ const buildWorkflow = defineWorkflow({
|
|
|
542
677
|
skill: "grade",
|
|
543
678
|
loop: CODE_CONFIRM_FANOUT,
|
|
544
679
|
outcome: codeVerdictOutcome,
|
|
545
|
-
reads: ["plans", "research", "goal"],
|
|
680
|
+
reads: ["plans", "research", "goal", "acceptance"],
|
|
546
681
|
}),
|
|
547
682
|
"code-fix": produces({
|
|
548
683
|
skill: "amend",
|
|
@@ -584,22 +719,27 @@ const buildWorkflow = defineWorkflow({
|
|
|
584
719
|
// `from` form suppresses the READS_DATA outputSchema lint.
|
|
585
720
|
reconcile: produces.script({ reads: ["plans"], run: reconcile }),
|
|
586
721
|
validate: produces({ prompt: VALIDATE_GOAL_PROMPT }),
|
|
587
|
-
// Repair arm the validate gate dispatches on a `verdict: "fail"`.
|
|
588
|
-
// (not `produces()`) because remediate is `side-effect`/`code-mutation`
|
|
589
|
-
// tools twin of `implement`: re-runs verification commands via `Bash(*)`
|
|
590
|
-
// edits the working tree)
|
|
591
|
-
//
|
|
592
|
-
// ⇒ `stageEntryArgs` derives `--plans <plan> --validation <latest-report>`;
|
|
722
|
+
// Repair arm the validate gate dispatches on a remediable `verdict: "fail"`.
|
|
723
|
+
// `acts()` (not `produces()`) because remediate is `side-effect`/`code-mutation`
|
|
724
|
+
// (the tools twin of `implement`: re-runs verification commands via `Bash(*)`
|
|
725
|
+
// and edits the working tree). `reads: ["plans","validation"]` ⇒
|
|
726
|
+
// `stageEntryArgs` derives `--plans <plan> --validation <latest-report>`;
|
|
593
727
|
// `validation` is validate's own publish bucket, so validate-fix always reads
|
|
594
|
-
// the latest failing report.
|
|
595
|
-
|
|
728
|
+
// the latest failing report. `remediationOutcome` publishes the deterministic
|
|
729
|
+
// did-anything-change digest verdict on the `remediation` channel (the
|
|
730
|
+
// `commit`/`gitCommitOutcome` pattern) — the arm's OWN edge folds it, so a
|
|
731
|
+
// no-op remediation stops instead of re-validating an unchanged tree.
|
|
732
|
+
"validate-fix": acts({ skill: "remediate", reads: ["plans", "validation"], outcome: remediationOutcome }),
|
|
596
733
|
commit: acts({ prompt: COMMIT_BASELINE_PROMPT, outcome: gitCommitOutcome }),
|
|
597
734
|
},
|
|
598
735
|
edges: {
|
|
599
736
|
goal: "research",
|
|
600
|
-
//
|
|
601
|
-
//
|
|
602
|
-
research
|
|
737
|
+
// The acceptance inventory derives between research (which grounds its
|
|
738
|
+
// evidence commands) and slice (which must never see it — bounded
|
|
739
|
+
// context). Slice's research input rides its explicit `reads` now that
|
|
740
|
+
// the rolling primary here is the acceptance doc.
|
|
741
|
+
research: "acceptance",
|
|
742
|
+
acceptance: "slice",
|
|
603
743
|
slice: "slice-check",
|
|
604
744
|
// Skip the design-readiness re-grade when the gate is already satisfied — after
|
|
605
745
|
// a `slice-fix` that only cleared the deterministic structure floor (the common
|
|
@@ -659,8 +799,11 @@ const buildWorkflow = defineWorkflow({
|
|
|
659
799
|
// readers. `plan-grade` is now a simple always-hop edge to `plan-demote`;
|
|
660
800
|
// the route body below is the verbatim logic that used to live here.
|
|
661
801
|
"plan-grade": "plan-demote",
|
|
662
|
-
// Pass ⇒ code. A dimension's
|
|
663
|
-
//
|
|
802
|
+
// Pass ⇒ code. A dimension's fresh confirm-worthy blocking verdict — a
|
|
803
|
+
// HIGH-severity or risk-ruling blocker, or a regressed carried pass — ⇒
|
|
804
|
+
// plan-confirm (one independent second judgment — see `confirmDue`; a
|
|
805
|
+
// first-time medium finding skips the confirm and buys the surgical fix
|
|
806
|
+
// directly); a confirmed blocker, or
|
|
664
807
|
// a failure with no dimension blocking (the citation floor alone is red) ⇒
|
|
665
808
|
// plan-fix, looping back THROUGH the citation floor so the amended plan
|
|
666
809
|
// re-verifies. Route logic unchanged — merely shifted one hop later so the
|
|
@@ -702,7 +845,7 @@ const buildWorkflow = defineWorkflow({
|
|
|
702
845
|
// duty-demotion write-back lands before this fold. `code-grade` is now a
|
|
703
846
|
// simple always-hop edge to `code-demote`; the route body below is verbatim.
|
|
704
847
|
"code-grade": "code-demote",
|
|
705
|
-
// Pass ⇒ implement. A
|
|
848
|
+
// Pass ⇒ implement. A fresh confirm-worthy blocking verdict ⇒ code-confirm (the plan
|
|
706
849
|
// gate's confirm contract, on the code-verdicts channel); a confirmed
|
|
707
850
|
// blocker or cite-floor-only failure ⇒ code-fix. Routes to `code-fix`, NOT
|
|
708
851
|
// back to `code`: the gate fails on plan-text defects (edit anchors, line
|
|
@@ -749,29 +892,25 @@ const buildWorkflow = defineWorkflow({
|
|
|
749
892
|
// manually). Safe by construction: the sole path onward is an explicit
|
|
750
893
|
// `verdict: "pass"`. Sourced from the reconcile channel via the `from` form.
|
|
751
894
|
reconcile: match("verdict", { validate: "pass" }, { from: "reconcile" }),
|
|
752
|
-
// Gate commit on validate's own verdict —
|
|
753
|
-
//
|
|
754
|
-
//
|
|
755
|
-
//
|
|
756
|
-
//
|
|
757
|
-
//
|
|
758
|
-
//
|
|
759
|
-
// terminal STOP, so un-anticipated data
|
|
760
|
-
// repair arm. Safe by construction: the
|
|
761
|
-
//
|
|
762
|
-
//
|
|
763
|
-
|
|
764
|
-
//
|
|
765
|
-
//
|
|
766
|
-
//
|
|
767
|
-
|
|
768
|
-
//
|
|
769
|
-
//
|
|
770
|
-
|
|
771
|
-
// deterministic hop into the loop body), so it never trips a backward-jump
|
|
772
|
-
// budget on its own — the budget-consuming decision edge is the validate
|
|
773
|
-
// gate's `validate-fix` branch above.
|
|
774
|
-
"validate-fix": "implement-scope-check",
|
|
895
|
+
// Gate commit on validate's own verdict — see `validateGate`. `pass` ⇒
|
|
896
|
+
// commit; a `fail` WITH remediable handles (a `pass: false` risk ruling or a
|
|
897
|
+
// structured `blockers:` entry) ⇒ validate-fix, which re-enters at
|
|
898
|
+
// implement-scope-check to re-reconcile + re-validate — bounded by the
|
|
899
|
+
// per-destination backward-jump budget; a `fail` with NO handle ⇒ STOP with
|
|
900
|
+
// a route note (the repair arm cannot act on prose-only failures — looping
|
|
901
|
+
// it re-validated an unchanged tree until the guard halted the run).
|
|
902
|
+
// A missing/unexpected verdict stays terminal STOP, so un-anticipated data
|
|
903
|
+
// can never route INTO commit OR the repair arm. Safe by construction: the
|
|
904
|
+
// sole path to commit is an explicit pass. No fix-round cap — the runner's
|
|
905
|
+
// backward-jump guard is build's remediation budget.
|
|
906
|
+
validate: validateGate(),
|
|
907
|
+
// Re-entry after the repair arm: remediate's code-mutation is followed by a
|
|
908
|
+
// fresh scope check → reconcile → validate pass, so a fix is re-verified
|
|
909
|
+
// end-to-end before the gate re-folds. Now a decision edge (`validateFixGate`
|
|
910
|
+
// folds the `remediation` channel's deterministic digest verdict): a
|
|
911
|
+
// remediation that changed nothing STOPs here — progress is verified, not
|
|
912
|
+
// assumed — while a real fix proceeds into the loop body.
|
|
913
|
+
"validate-fix": validateFixGate(),
|
|
775
914
|
commit: "stop",
|
|
776
915
|
},
|
|
777
916
|
});
|
|
@@ -849,44 +988,68 @@ const shipGradeGate: EdgeFn = defineRoute(
|
|
|
849
988
|
|
|
850
989
|
/**
|
|
851
990
|
* ship — the lightweight `/wf` preset: the no-ceremony path for small-to-
|
|
852
|
-
* midsize tasks whose approach is obvious. goal → research →
|
|
853
|
-
* plan-cite-check → grade → implement → implement-scope-check →
|
|
854
|
-
* validate → commit, stop-on-fail at every gate
|
|
855
|
-
* gate
|
|
856
|
-
*
|
|
857
|
-
*
|
|
858
|
-
*
|
|
859
|
-
*
|
|
860
|
-
*
|
|
861
|
-
*
|
|
862
|
-
*
|
|
991
|
+
* midsize tasks whose approach is obvious. goal → research → acceptance →
|
|
992
|
+
* plan → plan-cite-check → grade → implement → implement-scope-check →
|
|
993
|
+
* reconcile → validate → (validate-fix, once) | commit, stop-on-fail at every gate: a red
|
|
994
|
+
* gate halts the run (the agent hand-repairs and RESUMES — `/wf @<runId>`
|
|
995
|
+
* re-runs the halted gate against the repaired tree, reusing every upstream
|
|
996
|
+
* artifact) instead of looping a fix cycle. The ONE concession to that
|
|
997
|
+
* identity is validate's single bounded remediation hop (run 7299: a
|
|
998
|
+
* remediable docs-gap `fail` at the last stage stranded ~50 min of verified
|
|
999
|
+
* implementation behind a terminal stop). Research stays front-loaded — a
|
|
1000
|
+
* brief-sized grounding pass (SHIP_RESEARCH_PROMPT, not a full
|
|
1001
|
+
* `/skill:research` run: at most one verify-only dispatch when the brief names
|
|
1002
|
+
* root cause, files, or fix — none when its anchors are plain file paths; at
|
|
1003
|
+
* most two targeted dispatches otherwise) — because the single PRE-implement
|
|
1004
|
+
* grade's architecture-fit dimension needs its artifact as `--context`. That
|
|
1005
|
+
* grade is tier-independent: the bespoke SHIP_DIMENSION_FANOUT always grades
|
|
1006
|
+
* the full correctness/completeness/architecture-fit roster (no
|
|
1007
|
+
* gateTier/gateRoster light-tier drop), and SHIP's gate folds risk flags
|
|
1008
|
+
* without re-folding the citation floor (that floor folds at its own edge).
|
|
863
1009
|
*/
|
|
864
1010
|
const shipWorkflow = defineWorkflow({
|
|
865
1011
|
name: "ship",
|
|
866
1012
|
description:
|
|
867
|
-
"Ship, unsliced: capture the verbatim brief as a goal artifact → ground it with at most two targeted
|
|
1013
|
+
"Ship, unsliced: capture the verbatim brief as a goal artifact → ground it with a brief-sized research pass (none or one verify-only codebase-analyzer dispatch when the brief names root cause, files, or fix; at most two targeted dispatches otherwise — no /skill:research) → derive a goal-anchored acceptance inventory (the executable standard of completion, frozen before planning; quick-plan records a per-item disposition, the completeness gate anchors on it, validate executes its evidence commands) → one lightweight quick-plan pass → deterministic citation floor (files: coverage gaps stop; citation-resolution findings are advisory and adjudicated by the grade panel) → single tier-independent quality gate (correctness/completeness/architecture-fit, stop-on-fail) → implement → implement-scope-check → reconcile → validate → commit. Every gate halts the run on fail (hand-repair, then resume with /wf @<runId> to re-run the gate) — except a validate fail carrying structured remediable handles, which buys ONE bounded remediation hop before halting.",
|
|
868
1014
|
start: "goal",
|
|
869
1015
|
stages: {
|
|
870
1016
|
// build's verbatim goal capture — the brief on its own channel, plus the
|
|
871
1017
|
// run-start pre-existing-dirty snapshot the scope-check subtracts.
|
|
872
1018
|
goal: produces.script({ run: captureGoal }),
|
|
873
1019
|
// The lean grounding pass — SHIP_RESEARCH_PROMPT (a custom prompt, NOT
|
|
874
|
-
// /skill:research)
|
|
875
|
-
//
|
|
876
|
-
//
|
|
877
|
-
//
|
|
1020
|
+
// /skill:research), sized to the brief's pre-chewedness: at most one
|
|
1021
|
+
// verify-only codebase-analyzer dispatch when the brief names root
|
|
1022
|
+
// cause, files, or fix (none when its anchors are plain file paths);
|
|
1023
|
+
// at most two targeted dispatches when it names only a symptom; then
|
|
1024
|
+
// one grounding doc under .rpiv/artifacts/research/. A prompt stage,
|
|
1025
|
+
// so the stage name `research` drives outcome derivation (research
|
|
1026
|
+
// contract → `research` bucket) exactly as build's
|
|
1027
|
+
// RESEARCH_BRIEF_PROMPT stage does.
|
|
878
1028
|
research: produces({ prompt: SHIP_RESEARCH_PROMPT }),
|
|
1029
|
+
// The goal-derived acceptance inventory — the executable standard of
|
|
1030
|
+
// completion, authored BEFORE any plan exists so it cannot inherit the
|
|
1031
|
+
// plan's scope. Items enumerate the verbatim brief's asks (research
|
|
1032
|
+
// grounds only the evidence commands, never membership — the skill's
|
|
1033
|
+
// hard rule, since research routinely narrows the brief). Downstream:
|
|
1034
|
+
// quick-plan addresses-or-defers each item, the grade panel's
|
|
1035
|
+
// completeness unit anchors on the inventory (--acceptance), and
|
|
1036
|
+
// validate EXECUTES the evidence commands against the finished tree.
|
|
1037
|
+
// Outcome derives from the acceptance contract (artifactKind:
|
|
1038
|
+
// acceptance → `acceptance` bucket).
|
|
1039
|
+
acceptance: produces({ reads: ["goal", "research"] }),
|
|
879
1040
|
// The lightweight planner — quick-plan: ONE targeted
|
|
880
1041
|
// codebase-pattern-finder dispatch, one `status: ready` plan, no risks
|
|
881
1042
|
// frontmatter, no multi-slice decomposition. Derives its `plans` outcome
|
|
882
|
-
// from the quick-plan contract (artifactKind: plan). Reads
|
|
883
|
-
// explicitly (`--research <path> --goal <path
|
|
884
|
-
//
|
|
885
|
-
//
|
|
886
|
-
//
|
|
887
|
-
//
|
|
888
|
-
//
|
|
889
|
-
|
|
1043
|
+
// from the quick-plan contract (artifactKind: plan). Reads all three
|
|
1044
|
+
// channels explicitly (`--research <path> --goal <path>
|
|
1045
|
+
// --acceptance <path>`) — without `goal` the stage falls to the rolling
|
|
1046
|
+
// primary and the planner sees only the research doc, whose grounding
|
|
1047
|
+
// routinely narrows the brief; the grade panel's completeness dimension
|
|
1048
|
+
// anchors on the VERBATIM goal and the acceptance inventory, so the
|
|
1049
|
+
// planner must anchor on the same artifacts and record a per-item
|
|
1050
|
+
// disposition (implemented or deferred) instead of silently inheriting
|
|
1051
|
+
// the drop.
|
|
1052
|
+
plan: produces({ skill: "quick-plan", reads: ["research", "goal", "acceptance"] }),
|
|
890
1053
|
// Deterministic citation floor BEFORE the LLM gate — build's verifier
|
|
891
1054
|
// verbatim. Only a `files:` coverage gap fails structurally and STOPs the
|
|
892
1055
|
// run; every citation-resolution finding (unresolved path, ambiguity,
|
|
@@ -897,12 +1060,14 @@ const shipWorkflow = defineWorkflow({
|
|
|
897
1060
|
// (SHIP_DIMENSION_FANOUT — tier-independent, no confirm/snapshot arms);
|
|
898
1061
|
// verdicts on the `ship-verdicts` channel. `research` is read so the
|
|
899
1062
|
// architecture-fit unit threads it as --context; `goal` so
|
|
900
|
-
// completeness/correctness anchor on the verbatim brief
|
|
1063
|
+
// completeness/correctness anchor on the verbatim brief; `acceptance` so
|
|
1064
|
+
// the completeness unit checks the plan's per-item dispositions against
|
|
1065
|
+
// the frozen inventory (--acceptance).
|
|
901
1066
|
grade: produces({
|
|
902
1067
|
skill: "grade",
|
|
903
1068
|
loop: SHIP_DIMENSION_FANOUT,
|
|
904
1069
|
outcome: shipVerdictOutcome,
|
|
905
|
-
reads: ["plans", "research", "goal"],
|
|
1070
|
+
reads: ["plans", "research", "goal", "acceptance"],
|
|
906
1071
|
}),
|
|
907
1072
|
// Dep-gated DAG implement — build's lane verbatim.
|
|
908
1073
|
implement: acts({ loop: IMPLEMENT_DAG_FANOUT, reads: ["plans"] }),
|
|
@@ -914,11 +1079,18 @@ const shipWorkflow = defineWorkflow({
|
|
|
914
1079
|
// verbatim. Pass ⇒ validate; fail/missing ⇒ STOP (no fallback).
|
|
915
1080
|
reconcile: produces.script({ reads: ["plans"], run: reconcile }),
|
|
916
1081
|
validate: produces({ prompt: VALIDATE_GOAL_PROMPT }),
|
|
1082
|
+
// Repair arm — build's stage verbatim; ship's validate gate dispatches it
|
|
1083
|
+
// at most ONCE (maxFixRounds: 1). Kept because the terminal gate is where
|
|
1084
|
+
// a red verdict strands the most verified work over the least defect: the
|
|
1085
|
+
// arm acts only on the report's structured handles, and its own progress
|
|
1086
|
+
// gate stops a no-op remediation instead of re-validating an unchanged tree.
|
|
1087
|
+
"validate-fix": acts({ skill: "remediate", reads: ["plans", "validation"], outcome: remediationOutcome }),
|
|
917
1088
|
commit: acts({ prompt: COMMIT_BASELINE_PROMPT, outcome: gitCommitOutcome }),
|
|
918
1089
|
},
|
|
919
1090
|
edges: {
|
|
920
1091
|
goal: "research",
|
|
921
|
-
research: "
|
|
1092
|
+
research: "acceptance",
|
|
1093
|
+
acceptance: "plan",
|
|
922
1094
|
plan: "plan-cite-check",
|
|
923
1095
|
// Both gates are the named EdgeFns above — they attach a stop-reason
|
|
924
1096
|
// ROUTE_NOTE the recap surfaces; routing semantics are unchanged.
|
|
@@ -937,14 +1109,21 @@ const shipWorkflow = defineWorkflow({
|
|
|
937
1109
|
// Reconciliation gate — build's route verbatim: pass ⇒ validate;
|
|
938
1110
|
// fail/missing ⇒ STOP (plan-vs-tree drift the agent reconciles manually).
|
|
939
1111
|
reconcile: match("verdict", { validate: "pass" }, { from: "reconcile" }),
|
|
940
|
-
// Validate gate — build's
|
|
941
|
-
//
|
|
942
|
-
//
|
|
943
|
-
//
|
|
944
|
-
//
|
|
945
|
-
//
|
|
946
|
-
//
|
|
947
|
-
|
|
1112
|
+
// Validate gate — build's classifying gate, capped at ONE remediation
|
|
1113
|
+
// round: `pass` ⇒ commit; a `fail` WITH structured remediable handles and
|
|
1114
|
+
// no remediation spent ⇒ validate-fix; every other fail (prose-only, or
|
|
1115
|
+
// the one round already used) ⇒ STOP with a route note. The cap is what
|
|
1116
|
+
// keeps ship's stop-on-fail identity: the arm is a single bounded hop,
|
|
1117
|
+
// not a loop — the runner's `remediation`-channel length enforces it
|
|
1118
|
+
// deterministically. NOT vet's tail: vet's validate routes to
|
|
1119
|
+
// code-review, which gates back to blueprint (a bounded backward loop).
|
|
1120
|
+
validate: validateGate({ maxFixRounds: 1 }),
|
|
1121
|
+
// Re-entry after the repair arm — build's edge: a remediation that
|
|
1122
|
+
// changed nothing STOPs (progress is verified, not assumed); a real fix
|
|
1123
|
+
// re-enters at implement-scope-check so it is re-verified end-to-end
|
|
1124
|
+
// (scope floor → reconcile → validate) before the gate re-folds — where
|
|
1125
|
+
// the spent round now stops any remaining fail.
|
|
1126
|
+
"validate-fix": validateFixGate(),
|
|
948
1127
|
commit: "stop",
|
|
949
1128
|
},
|
|
950
1129
|
});
|