devrites 5.1.0 → 5.2.1

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/pack/.claude/agents/devrites-plan-drafter.md +7 -0
  4. package/pack/.claude/agents/devrites-slice-wright.md +5 -1
  5. package/pack/.claude/skills/rite-build/SKILL.md +6 -4
  6. package/pack/.claude/skills/rite-build/reference/one-slice-cycle.md +2 -1
  7. package/pack/.claude/skills/rite-build/reference/parallel-batch.md +3 -2
  8. package/pack/.claude/skills/rite-build/reference/spec-drift-guard.md +22 -3
  9. package/pack/.claude/skills/rite-build/reference/wright-dispatch.md +4 -1
  10. package/pack/.claude/skills/rite-plan/SKILL.md +26 -3
  11. package/pack/.claude/skills/rite-plan/reference/replan-and-repair.md +10 -3
  12. package/pack/.claude/skills/rite-vet/SKILL.md +25 -13
  13. package/pack/generated/claude/agents/devrites-plan-drafter.md +7 -0
  14. package/pack/generated/claude/agents/devrites-slice-wright.md +5 -1
  15. package/pack/generated/claude/skills/rite-build/SKILL.md +6 -4
  16. package/pack/generated/claude/skills/rite-build/reference/one-slice-cycle.md +2 -1
  17. package/pack/generated/claude/skills/rite-build/reference/parallel-batch.md +3 -2
  18. package/pack/generated/claude/skills/rite-build/reference/spec-drift-guard.md +22 -3
  19. package/pack/generated/claude/skills/rite-build/reference/wright-dispatch.md +4 -1
  20. package/pack/generated/claude/skills/rite-plan/SKILL.md +26 -3
  21. package/pack/generated/claude/skills/rite-plan/reference/replan-and-repair.md +10 -3
  22. package/pack/generated/claude/skills/rite-vet/SKILL.md +25 -13
  23. package/pack/generated/codex/agents/devrites-plan-drafter.toml +7 -0
  24. package/pack/generated/codex/agents/devrites-slice-wright.toml +5 -1
  25. package/pack/generated/codex/skills/rite-build/SKILL.md +6 -4
  26. package/pack/generated/codex/skills/rite-build/reference/one-slice-cycle.md +2 -1
  27. package/pack/generated/codex/skills/rite-build/reference/parallel-batch.md +3 -2
  28. package/pack/generated/codex/skills/rite-build/reference/spec-drift-guard.md +22 -3
  29. package/pack/generated/codex/skills/rite-build/reference/wright-dispatch.md +4 -1
  30. package/pack/generated/codex/skills/rite-plan/SKILL.md +26 -3
  31. package/pack/generated/codex/skills/rite-plan/reference/replan-and-repair.md +10 -3
  32. package/pack/generated/codex/skills/rite-vet/SKILL.md +25 -13
  33. package/pack/generated/omp/agents/devrites-plan-drafter.md +7 -0
  34. package/pack/generated/omp/agents/devrites-slice-wright.md +5 -1
  35. package/pack/generated/omp/skills/rite-build/SKILL.md +6 -4
  36. package/pack/generated/omp/skills/rite-build/reference/one-slice-cycle.md +2 -1
  37. package/pack/generated/omp/skills/rite-build/reference/parallel-batch.md +3 -2
  38. package/pack/generated/omp/skills/rite-build/reference/spec-drift-guard.md +22 -3
  39. package/pack/generated/omp/skills/rite-build/reference/wright-dispatch.md +4 -1
  40. package/pack/generated/omp/skills/rite-plan/SKILL.md +26 -3
  41. package/pack/generated/omp/skills/rite-plan/reference/replan-and-repair.md +10 -3
  42. package/pack/generated/omp/skills/rite-vet/SKILL.md +25 -13
  43. package/package.json +1 -1
@@ -138,6 +138,10 @@ return an `Escalation`** when:
138
138
  scoped exception or the approach must change. Report the principle and conflict
139
139
  in `Escalation`.
140
140
 
141
+ A plan-gap or underspecification escalation populates `assumptions` with every
142
+ contract assumption already checked (verified|falsified); the orchestrator's
143
+ batch sweep covers only the unchecked remainder. Never a bare "plan is wrong".
144
+
141
145
  If an answer would change scope or acceptance, do **not** fold it into the slice.
142
146
  Return it in `Escalation` so the orchestrator can route it through the Spec Drift
143
147
  Guard (`$rite-plan repair`). Respect any AFK budget in the contract.
@@ -172,7 +176,7 @@ reuse: []
172
176
  conventions: []
173
177
  principles: []
174
178
  sources: []
175
- assumptions: []
179
+ assumptions: [] # plan-gap escalation: every checked contract assumption, verified|falsified
176
180
  decisions_stood: [] # irreversible-risk items go to escalation
177
181
  dead_ends: []
178
182
  escalation: <none | gate + crisp question + proposed answer>
@@ -38,8 +38,10 @@ Wright applies anti-slop; root verifies returns and never patches source.
38
38
  single-slice isolation when `wright-dispatch.md` preflight + reconcile hold.
39
39
  - Exact feature scope only; reject out-of-allowlist diffs; record adjacent issues.
40
40
  - Never rerun an unchanged check; re-prove after edits.
41
- - Unplanned dependency/design-system/gap/repair → Vet/Spec Drift Guard. Ask only
42
- for licensing/cost/security/product or explicit architecture-policy decisions.
41
+ - Unplanned dependency/design-system/gap/repair → Vet/Spec Drift Guard batch
42
+ sweep: every contract-assumption violation recorded before one folded
43
+ repair+vet. Ask only for licensing/cost/security/product or explicit
44
+ architecture-policy decisions.
43
45
  - Root never edits product source/tests (`.devrites/` + Workflow Artifact only).
44
46
  Wright is sole product writer; extras in returned paths/`git diff --name-only` hard-stop.
45
47
  - Principles bind; irreversible conflict needs human exception or stop.
@@ -57,8 +59,8 @@ Wright applies anti-slop; root verifies returns and never patches source.
57
59
 
58
60
  Omitted/`1` ≡ serial; `2`–`10` → path-disjoint fan-out when eligible; else hard refuse.
59
61
  All-green serial integrate; one red/gap aborts. Abort with agent-owned plan
60
- gaps continues via Spec Drift Guard (plan repair + vet inline); do not emit a
61
- human `Fix`. AFK charges after integrate only. Running lease blocks another
62
+ gaps continues via Spec Drift Guard (batch sweep, one folded plan repair + one
63
+ vet recheck inline); do not emit a human `Fix`. AFK charges after integrate only. Running lease blocks another
62
64
  `$rite-build`. Details: `parallel-batch.md`.
63
65
 
64
66
  ## Execute and reply
@@ -39,7 +39,8 @@ you check yourself against: anything outside it is scope creep or a drift event.
39
39
  ## When the slice can't be completed cleanly
40
40
 
41
41
  - Discovered the plan is wrong → **Spec Drift Guard** (record, classify;
42
- agent-owned repair+vet inline; ask only for product/policy/irreversible-risk).
42
+ sweep every remaining contract assumption, then one folded repair+vet inline;
43
+ ask only for product/policy/irreversible-risk).
43
44
  - Slice is bigger than one cycle → `$rite-plan reslice` inline when AC is
44
45
  preserved; do not emit a human Fix.
45
46
  - Blocked on a failing dependency → record in `state.md`, `$rite-plan unblock`
@@ -51,8 +51,9 @@ Lease: `batch_id`, `created_at`, `base_sha`, `n`,
51
51
  per integrated sibling; optional `check candidate`.
52
52
  8. Cleanup: success removes worktrees/branches. Abort keeps them as repair
53
53
  inputs until the root consumes them: agent-owned plan gaps (AC unchanged)
54
- follow [`spec-drift-guard.md`](spec-drift-guard.md) — `$rite-plan repair` then
55
- `$rite-vet` inline, then cleanup and resume Build. Do not emit
54
+ follow [`spec-drift-guard.md`](spec-drift-guard.md) — batch-sweep all
55
+ siblings' contract assumptions, one folded `$rite-plan repair` + one
56
+ `$rite-vet` recheck inline, then cleanup and resume Build. Do not emit
56
57
  `Fix: $rite-plan repair`. Product/policy/irreversible-risk still stops.
57
58
 
58
59
  ## Engine verbs
@@ -24,13 +24,31 @@ other phases reference it here.
24
24
  YES, active-slice technical/tool failure → log it and use Build's bounded debug
25
25
  recovery. Do not ask for retry authorization and do not re-plan unless the
26
26
  durable remaining-work instructions are wrong.
27
- YES, durable plan is wrong → log it, save the caller's return cursor, then
28
- invoke `$rite-plan repair` and `$rite-vet` inline without a question and resume.
27
+ YES, durable plan is wrong → run the batch sweep below, log every
28
+ violation, save the caller's return cursor, then invoke `$rite-plan repair` and `$rite-vet` inline
29
+ without a question — ONE folded repair for all open entries, ONE
30
+ recheck for every open fingerprint — and resume.
29
31
  NO, product/policy/irreversible-risk decision → ask the user (format below).
30
32
  5. Never continue on a known-wrong durable plan. A repaired active-slice implementation
31
33
  may continue only after bounded recovery, returned-diff review, and proof gates pass.
32
34
  ```
33
35
 
36
+ ## Batch sweep (before repair)
37
+
38
+ A durable-plan drift abort never repairs the first gap alone:
39
+
40
+ 1. Verify every remaining statically-checkable contract assumption against the
41
+ live repo — named paths, symbols/APIs/signatures, routes, commands, dependency
42
+ versions, contract artifacts. The wright's return names what it falsified;
43
+ check the rest yourself — existence checks are deterministic, no dispatch.
44
+ 2. Record each violation as its own `drift.md` entry/fingerprint; one folded
45
+ repair + one batched recheck resolves the set.
46
+ 3. A recheck-surfaced gap is a new fingerprint with its own budget — loop
47
+ internally, never hand an intermediate command to the human.
48
+ 4. Nothing skips or defers silently: every entry ends resolved, human-escalated,
49
+ or fingerprint-exhausted. Execution-only gaps (tests, UX, evidence) get the
50
+ identical path when they surface.
51
+
34
52
  ## User question format
35
53
  ```
36
54
  I hit spec drift:
@@ -50,7 +68,8 @@ human permission question. Re-plan only when the durable plan changed.
50
68
 
51
69
  ## Inline return contract
52
70
 
53
- The phase that detected agent-owned drift owns the whole backtrack. Preserve it
71
+ The phase that detected agent-owned drift owns the whole backtrack, batch sweep
72
+ included. Preserve it
54
73
  as `return_phase`/`return_next_action`; consume Plan and Vet's nested `STOP`
55
74
  boundaries internally; follow any vetted remediation required by the settled
56
75
  acceptance; then restore the cursor and resume the failed step. Do not hand an
@@ -83,4 +83,7 @@ Opt-in `$rite-build --parallel N` fans out only under [`parallel-batch.md`](para
83
83
  attempts is the limit; persist each and never dispatch a fourth related try.
84
84
  5. Reconcile returned reuse, conventions, principles, sources, assumptions,
85
85
  decisions, dead ends, follow-ups, gates, and touched files. Persist the
86
- relevant facts in canonical artifacts, not the wholesale report.
86
+ relevant facts in canonical artifacts, not the wholesale report. A plan-gap
87
+ escalation without the checked-assumption list (verified|falsified) is
88
+ malformed; root sweeps the unchecked remainder per
89
+ [`spec-drift-guard.md`](spec-drift-guard.md) before repair.
@@ -79,6 +79,11 @@ Before classifying any Reslice, read `.agents/skills/devrites-lib/reference/stan
79
79
  require the drafter to apply `one-shot-actions.md` and return the bounded
80
80
  diagnostic-amplification design, injective boundary map, per-seam fixtures, and
81
81
  collision mutant. Past evidence loss is not terminal. The drafter supplies no bodies.
82
+ A repair candidate carries a delta self-check scoped to what the patch
83
+ touches: which intersected invariants it re-verified, with evidence of no
84
+ correction-created regression. Global re-derivation (ID/edge/HZN counts,
85
+ acyclicity) runs on materialized artifacts at the step-7 gate — the drafter
86
+ never re-derives them by exhaustive search.
82
87
  Bind exact active `.devrites/work/<slug>/` targets and executable contract; after Vet READY, root
83
88
  materializes the exact vetted workflow-artifact paths under
84
89
  [`workflow-artifacts.md`](../devrites-lib/reference/standards/workflow-artifacts.md)
@@ -101,7 +106,16 @@ Before classifying any Reslice, read `.agents/skills/devrites-lib/reference/stan
101
106
  [task-breakdown](reference/task-breakdown.md). Prefer thin, shippable, verifiable.
102
107
  **Completion:** every slice is independently shippable/provable or carries an irreducibility reason.
103
108
  5. Reconcile the candidate against steps 3 and 4, then the root updates `plan.md`, `tasks.md`,
104
- `state.md`, and appends rationale to `decisions.md`.
109
+ `state.md`, and appends rationale to `decisions.md`. A rejected candidate
110
+ (malformed bundle, stale or non-unique anchor) or a drafter `Outcome: gap`
111
+ is one no-progress outcome on every open fingerprint in the fold; the
112
+ re-dispatch packet must name the rejection so the same hunks don't recur.
113
+ A gap naming genuinely human-owned information routes to `$rite-clarify`.
114
+ A drafter `Outcome: partial` is progress: materialize its complete findings,
115
+ then re-dispatch a narrowed packet for `remaining_findings` with anchors
116
+ re-derived from the just-updated files — same repair pass, fresh context.
117
+ A partial covering zero findings counts as no-progress. Findings in
118
+ `blocked_findings` route to `$rite-clarify`, never the re-dispatch.
105
119
  Any change to `architecture.md`, `plan.md`, `tasks.md`, or `traceability.md` invalidates
106
120
  the previous vet verdict: set `Phase: plan`, `Next step: $rite-vet`, and, when
107
121
  `eng-review.md` exists, set `Implementation readiness: NEEDS REPLAN`. Never retain READY
@@ -115,8 +129,9 @@ Before classifying any Reslice, read `.agents/skills/devrites-lib/reference/stan
115
129
  material assumption, or open blocking/escalating question routes `$rite-clarify`/HITL.
116
130
  Restore `CLEAR` only from current evidence.
117
131
  7. **Done when:** every slice is sized (builds + proves in one cycle; no slice scoring >3
118
- left unjustified), the dependency order is acyclic, every `drift.md` entry you stopped for
119
- is marked resolved, revised artifacts agree with each other, no source files changed in
132
+ left unjustified), the dependency order is acyclic, every open `drift.md` entry
133
+ was folded in one pass and marked resolved, the delta self-check is recorded,
134
+ revised artifacts agree with each other, no source files changed in
120
135
  `revise` mode, the marked action is complete, and every changed
121
136
  plan ends at `$rite-vet` rather than returning directly to build; horizon IDs stay stable,
122
137
  reclassifications cite evidence, and no unresolved item vanished. The `Shared contract proof`
@@ -128,5 +143,13 @@ to that caller so it can invoke Vet immediately. The phase boundary is not a
128
143
  user-facing stop unless a genuine HITL, safety/access, or exhausted-recovery
129
144
  condition was recorded.
130
145
 
146
+ When invoked directly with no controlling caller and a planning artifact
147
+ changed, become the caller for the mandated next step: record the return
148
+ cursor, invoke `$rite-vet` inline, and consume its results — `NEEDS REPLAN`
149
+ re-enters repair internally under the fingerprint caps; `NEEDS CLARIFICATION`
150
+ and human-owned gates still reach the user. Stop only at Vet's boundary (READY
151
+ readback; next step `$rite-build`). An unchanged plan keeps its recorded next
152
+ step.
153
+
131
154
  > **Mid-flight discipline.** Do not change product behavior without confirmation or
132
155
  > absorb drift silently. See [`anti-patterns`](reference/anti-patterns.md).
@@ -26,12 +26,19 @@ dependency edges.
26
26
 
27
27
  A drift event stopped the build. Steps:
28
28
 
29
- 1. Read the `drift.md` entry and its classification.
29
+ 1. Read the `drift.md` entries and their classifications. Fold EVERY open entry
30
+ and accepted finding for the affected artifacts in ONE pass, never serially.
30
31
  2. If the user answered a drift question, encode that decision in `decisions.md`.
31
32
  3. Update `spec.md` (only the affected sections) and `plan.md`/`tasks.md` to match
32
33
  reality. Adjust acceptance criteria if they were wrong.
33
- 4. Mark the `drift.md` entry **resolved** with the resolution + date.
34
- 5. Resume at the corrected slice.
34
+ 4. Mark each `drift.md` entry **resolved** with the resolution + date.
35
+ 5. **Self-check the repaired candidate on the delta before handoff** — re-verify
36
+ every invariant the correction touched (acyclic dependency graph,
37
+ bidirectional traceability, Shared contract proof vs boundary set, sizing,
38
+ no correction-created regression) and record the evidence in the Plan
39
+ checkpoint; Vet's recheck verifies it rather than rediscovering the defect a
40
+ loop later.
41
+ 6. Resume at the corrected slice.
35
42
  Never quietly delete a requirement; use the marked action before contract edits.
36
43
 
37
44
  ## reorder
@@ -52,10 +52,14 @@ plan declares a root-authored executable workflow file, read
52
52
  - Use the lowest axis band; never average or round thin to ready. Search before
53
53
  asking and resolve reversible technical choices. Ask only human-owned choices.
54
54
  - Preserve a valid technical return cursor. Agent-owned `NEEDS REPLAN` returns
55
- internally to its caller, not to the human.
56
- - **Recovery recheck is bounded.** A valid cursor plus open fingerprint enters
57
- Recovery recheck; it does not start another Full Vet or repeat unaffected
58
- axes/reviewers.
55
+ internally to its caller, not to the human; on a direct invocation there is
56
+ no caller, so Vet becomes it record the cursor and invoke `$rite-plan`
57
+ repair inline under the same fingerprint caps.
58
+ - **Recovery recheck is bounded and batched.** A valid cursor plus open
59
+ fingerprints enters Recovery recheck; it does not start another Full Vet or
60
+ repeat unaffected axes/reviewers. One dispatch covers every open fingerprint
61
+ of the fold — each checked individually — with a mandatory correction-created
62
+ regression audit.
59
63
  <!-- workflow-artifact-adapter: {"module":"devrites-lib/reference/standards/workflow-artifacts.md","entry":"plan declares root-authored executable workflow file","action":"emit exact admission; stale/missing authority uses PLAN_VET_REPAIR","return":"Vet READY cursor or exact technical replan"} -->
60
64
  ## Workflow
61
65
 
@@ -73,10 +77,15 @@ plan declares a root-authored executable workflow file, read
73
77
  required account blocks.
74
78
  1b. **Recovery recheck.** Require valid return cursor, accepted prior finding,
75
79
  exact fingerprint/reproduction, repaired candidate identity, changed
76
- paths/criteria, and affected drift/evidence. Freeze that packet and dispatch
77
- each exact owning reviewer once, fresh/read-only, limited to it. Do not rerun
78
- broad inventory or unaffected reviewers. Close the prior fingerprint only
79
- with discriminating evidence. Otherwise record one no-progress outcome. A
80
+ paths/criteria, affected drift/evidence, and the recorded delta self-check.
81
+ Freeze that packet and dispatch each exact owning reviewer once,
82
+ fresh/read-only, limited to it all its open fingerprints in that dispatch.
83
+ Do not rerun broad inventory or unaffected reviewers. Close the prior
84
+ fingerprint only with discriminating evidence plus an explicit
85
+ correction-created regression verdict on the touched invariants (acyclic
86
+ deps, traceability, contract proof, sizing) and every region depending on a
87
+ changed clause — enumerate dependents via the dep graph and traceability
88
+ refs, not only patched sites. Otherwise record one no-progress outcome. A
80
89
  different Critical/Important invariant needs exact evidence and a new
81
90
  fingerprint; a Suggestion, Nit, or FYI cannot keep recovery open. Reconcile
82
91
  shared artifact/readiness gates and return to caller or next repair.
@@ -119,11 +128,14 @@ plan declares a root-authored executable workflow file, read
119
128
  criterion needs positive, discriminating proof; every slice must be one-pass
120
129
  implementable; developer plans need a predicted scorecard. Durable commands
121
130
  are portable repository commands, not host wrappers.
122
- 7. **Narrow recheck after edits.** Dispatch exact plan reviewer once per
123
- correction/fingerprint (`per correction/fingerprint`) with accepted findings,
124
- changed paths/criteria, and new
125
- identity. Within one correction, no broad third loop. If it changes plan,
126
- fold again. A closed input plus a distinct Critical/Important invariant returns
131
+ 7. **Narrow recheck after edits.** Dispatch the exact plan reviewer once per
132
+ fold one dispatch covering every open fingerprint, preserving
133
+ per correction/fingerprint accounting (each checked individually with its
134
+ accepted findings, changed paths/criteria, new identity, and recorded delta
135
+ self-check); it must return an explicit correction-created regression
136
+ verdict over touched invariants plus every dependent of each changed clause
137
+ (dep-graph and traceability lookup), not only fingerprint closure. Within one correction, no broad
138
+ third loop. If it changes plan, fold again. A closed input plus a distinct Critical/Important invariant returns
127
139
  that new fingerprint as progress. Then close matrix and rerun ID/meaning audit.
128
140
  8. **Build readback and readiness.** Add a cited five-line readback to
129
141
  `eng-review.md` (artifacts.md §7 rows 1–5): outcome/ACs; IN/OUT/must-NOT; UI direction and architecture/
@@ -52,6 +52,13 @@ principle-exception questions. List them for the root.
52
52
  - Do not invoke another agent.
53
53
  - Return candidate content only for requested paths. If unfinished, name the exact
54
54
  remaining path instead of compressing away a contract.
55
+ - In `repair`, if the full bundle would exceed reliable output, return
56
+ `Outcome: partial` with complete hunks for a whole-finding prefix in packet
57
+ order plus `remaining_findings` — a finding is all its sites or none; never
58
+ split one across returns. The root materializes the partial bundle and
59
+ re-dispatches the rest. A finding blocked on human-owned information goes in
60
+ `blocked_findings` with the needed input named — never `remaining_findings`,
61
+ which is reserved for what another dispatch can complete.
55
62
 
56
63
  ## Output format
57
64
 
@@ -138,6 +138,10 @@ return an `Escalation`** when:
138
138
  scoped exception or the approach must change. Report the principle and conflict
139
139
  in `Escalation`.
140
140
 
141
+ A plan-gap or underspecification escalation populates `assumptions` with every
142
+ contract assumption already checked (verified|falsified); the orchestrator's
143
+ batch sweep covers only the unchecked remainder. Never a bare "plan is wrong".
144
+
141
145
  If an answer would change scope or acceptance, do **not** fold it into the slice.
142
146
  Return it in `Escalation` so the orchestrator can route it through the Spec Drift
143
147
  Guard (`/rite-plan repair`). Respect any AFK budget in the contract.
@@ -172,7 +176,7 @@ reuse: []
172
176
  conventions: []
173
177
  principles: []
174
178
  sources: []
175
- assumptions: []
179
+ assumptions: [] # plan-gap escalation: every checked contract assumption, verified|falsified
176
180
  decisions_stood: [] # irreversible-risk items go to escalation
177
181
  dead_ends: []
178
182
  escalation: <none | gate + crisp question + proposed answer>
@@ -38,8 +38,10 @@ Wright applies anti-slop; root verifies returns and never patches source.
38
38
  single-slice isolation when `wright-dispatch.md` preflight + reconcile hold.
39
39
  - Exact feature scope only; reject out-of-allowlist diffs; record adjacent issues.
40
40
  - Never rerun an unchanged check; re-prove after edits.
41
- - Unplanned dependency/design-system/gap/repair → Vet/Spec Drift Guard. Ask only
42
- for licensing/cost/security/product or explicit architecture-policy decisions.
41
+ - Unplanned dependency/design-system/gap/repair → Vet/Spec Drift Guard batch
42
+ sweep: every contract-assumption violation recorded before one folded
43
+ repair+vet. Ask only for licensing/cost/security/product or explicit
44
+ architecture-policy decisions.
43
45
  - Root never edits product source/tests (`.devrites/` + Workflow Artifact only).
44
46
  Wright is sole product writer; extras in returned paths/`git diff --name-only` hard-stop.
45
47
  - Principles bind; irreversible conflict needs human exception or stop.
@@ -57,8 +59,8 @@ Wright applies anti-slop; root verifies returns and never patches source.
57
59
 
58
60
  Omitted/`1` ≡ serial; `2`–`10` → path-disjoint fan-out when eligible; else hard refuse.
59
61
  All-green serial integrate; one red/gap aborts. Abort with agent-owned plan
60
- gaps continues via Spec Drift Guard (plan repair + vet inline); do not emit a
61
- human `Fix`. AFK charges after integrate only. Running lease blocks another
62
+ gaps continues via Spec Drift Guard (batch sweep, one folded plan repair + one
63
+ vet recheck inline); do not emit a human `Fix`. AFK charges after integrate only. Running lease blocks another
62
64
  `/rite-build`. Details: `parallel-batch.md`.
63
65
 
64
66
  ## Execute and reply
@@ -39,7 +39,8 @@ you check yourself against: anything outside it is scope creep or a drift event.
39
39
  ## When the slice can't be completed cleanly
40
40
 
41
41
  - Discovered the plan is wrong → **Spec Drift Guard** (record, classify;
42
- agent-owned repair+vet inline; ask only for product/policy/irreversible-risk).
42
+ sweep every remaining contract assumption, then one folded repair+vet inline;
43
+ ask only for product/policy/irreversible-risk).
43
44
  - Slice is bigger than one cycle → `/rite-plan reslice` inline when AC is
44
45
  preserved; do not emit a human Fix.
45
46
  - Blocked on a failing dependency → record in `state.md`, `/rite-plan unblock`
@@ -51,8 +51,9 @@ Lease: `batch_id`, `created_at`, `base_sha`, `n`,
51
51
  per integrated sibling; optional `check candidate`.
52
52
  8. Cleanup: success removes worktrees/branches. Abort keeps them as repair
53
53
  inputs until the root consumes them: agent-owned plan gaps (AC unchanged)
54
- follow [`spec-drift-guard.md`](spec-drift-guard.md) — `/rite-plan repair` then
55
- `/rite-vet` inline, then cleanup and resume Build. Do not emit
54
+ follow [`spec-drift-guard.md`](spec-drift-guard.md) — batch-sweep all
55
+ siblings' contract assumptions, one folded `/rite-plan repair` + one
56
+ `/rite-vet` recheck inline, then cleanup and resume Build. Do not emit
56
57
  `Fix: /rite-plan repair`. Product/policy/irreversible-risk still stops.
57
58
 
58
59
  ## Engine verbs
@@ -24,13 +24,31 @@ other phases reference it here.
24
24
  YES, active-slice technical/tool failure → log it and use Build's bounded debug
25
25
  recovery. Do not ask for retry authorization and do not re-plan unless the
26
26
  durable remaining-work instructions are wrong.
27
- YES, durable plan is wrong → log it, save the caller's return cursor, then
28
- invoke `/rite-plan repair` and `/rite-vet` inline without a question and resume.
27
+ YES, durable plan is wrong → run the batch sweep below, log every
28
+ violation, save the caller's return cursor, then invoke `/rite-plan repair` and `/rite-vet` inline
29
+ without a question — ONE folded repair for all open entries, ONE
30
+ recheck for every open fingerprint — and resume.
29
31
  NO, product/policy/irreversible-risk decision → ask the user (format below).
30
32
  5. Never continue on a known-wrong durable plan. A repaired active-slice implementation
31
33
  may continue only after bounded recovery, returned-diff review, and proof gates pass.
32
34
  ```
33
35
 
36
+ ## Batch sweep (before repair)
37
+
38
+ A durable-plan drift abort never repairs the first gap alone:
39
+
40
+ 1. Verify every remaining statically-checkable contract assumption against the
41
+ live repo — named paths, symbols/APIs/signatures, routes, commands, dependency
42
+ versions, contract artifacts. The wright's return names what it falsified;
43
+ check the rest yourself — existence checks are deterministic, no dispatch.
44
+ 2. Record each violation as its own `drift.md` entry/fingerprint; one folded
45
+ repair + one batched recheck resolves the set.
46
+ 3. A recheck-surfaced gap is a new fingerprint with its own budget — loop
47
+ internally, never hand an intermediate command to the human.
48
+ 4. Nothing skips or defers silently: every entry ends resolved, human-escalated,
49
+ or fingerprint-exhausted. Execution-only gaps (tests, UX, evidence) get the
50
+ identical path when they surface.
51
+
34
52
  ## User question format
35
53
  ```
36
54
  I hit spec drift:
@@ -50,7 +68,8 @@ human permission question. Re-plan only when the durable plan changed.
50
68
 
51
69
  ## Inline return contract
52
70
 
53
- The phase that detected agent-owned drift owns the whole backtrack. Preserve it
71
+ The phase that detected agent-owned drift owns the whole backtrack, batch sweep
72
+ included. Preserve it
54
73
  as `return_phase`/`return_next_action`; consume Plan and Vet's nested `STOP`
55
74
  boundaries internally; follow any vetted remediation required by the settled
56
75
  acceptance; then restore the cursor and resume the failed step. Do not hand an
@@ -83,4 +83,7 @@ Opt-in `/rite-build --parallel N` fans out only under [`parallel-batch.md`](para
83
83
  attempts is the limit; persist each and never dispatch a fourth related try.
84
84
  5. Reconcile returned reuse, conventions, principles, sources, assumptions,
85
85
  decisions, dead ends, follow-ups, gates, and touched files. Persist the
86
- relevant facts in canonical artifacts, not the wholesale report.
86
+ relevant facts in canonical artifacts, not the wholesale report. A plan-gap
87
+ escalation without the checked-assumption list (verified|falsified) is
88
+ malformed; root sweeps the unchecked remainder per
89
+ [`spec-drift-guard.md`](spec-drift-guard.md) before repair.
@@ -79,6 +79,11 @@ Before classifying any Reslice, read `.omp/skills/devrites-lib/reference/standar
79
79
  require the drafter to apply `one-shot-actions.md` and return the bounded
80
80
  diagnostic-amplification design, injective boundary map, per-seam fixtures, and
81
81
  collision mutant. Past evidence loss is not terminal. The drafter supplies no bodies.
82
+ A repair candidate carries a delta self-check scoped to what the patch
83
+ touches: which intersected invariants it re-verified, with evidence of no
84
+ correction-created regression. Global re-derivation (ID/edge/HZN counts,
85
+ acyclicity) runs on materialized artifacts at the step-7 gate — the drafter
86
+ never re-derives them by exhaustive search.
82
87
  Bind exact active `.devrites/work/<slug>/` targets and executable contract; after Vet READY, root
83
88
  materializes the exact vetted workflow-artifact paths under
84
89
  [`workflow-artifacts.md`](../devrites-lib/reference/standards/workflow-artifacts.md)
@@ -101,7 +106,16 @@ Before classifying any Reslice, read `.omp/skills/devrites-lib/reference/standar
101
106
  [task-breakdown](reference/task-breakdown.md). Prefer thin, shippable, verifiable.
102
107
  **Completion:** every slice is independently shippable/provable or carries an irreducibility reason.
103
108
  5. Reconcile the candidate against steps 3 and 4, then the root updates `plan.md`, `tasks.md`,
104
- `state.md`, and appends rationale to `decisions.md`.
109
+ `state.md`, and appends rationale to `decisions.md`. A rejected candidate
110
+ (malformed bundle, stale or non-unique anchor) or a drafter `Outcome: gap`
111
+ is one no-progress outcome on every open fingerprint in the fold; the
112
+ re-dispatch packet must name the rejection so the same hunks don't recur.
113
+ A gap naming genuinely human-owned information routes to `/rite-clarify`.
114
+ A drafter `Outcome: partial` is progress: materialize its complete findings,
115
+ then re-dispatch a narrowed packet for `remaining_findings` with anchors
116
+ re-derived from the just-updated files — same repair pass, fresh context.
117
+ A partial covering zero findings counts as no-progress. Findings in
118
+ `blocked_findings` route to `/rite-clarify`, never the re-dispatch.
105
119
  Any change to `architecture.md`, `plan.md`, `tasks.md`, or `traceability.md` invalidates
106
120
  the previous vet verdict: set `Phase: plan`, `Next step: /rite-vet`, and, when
107
121
  `eng-review.md` exists, set `Implementation readiness: NEEDS REPLAN`. Never retain READY
@@ -115,8 +129,9 @@ Before classifying any Reslice, read `.omp/skills/devrites-lib/reference/standar
115
129
  material assumption, or open blocking/escalating question routes `/rite-clarify`/HITL.
116
130
  Restore `CLEAR` only from current evidence.
117
131
  7. **Done when:** every slice is sized (builds + proves in one cycle; no slice scoring >3
118
- left unjustified), the dependency order is acyclic, every `drift.md` entry you stopped for
119
- is marked resolved, revised artifacts agree with each other, no source files changed in
132
+ left unjustified), the dependency order is acyclic, every open `drift.md` entry
133
+ was folded in one pass and marked resolved, the delta self-check is recorded,
134
+ revised artifacts agree with each other, no source files changed in
120
135
  `revise` mode, the marked action is complete, and every changed
121
136
  plan ends at `/rite-vet` rather than returning directly to build; horizon IDs stay stable,
122
137
  reclassifications cite evidence, and no unresolved item vanished. The `Shared contract proof`
@@ -128,5 +143,13 @@ to that caller so it can invoke Vet immediately. The phase boundary is not a
128
143
  user-facing stop unless a genuine HITL, safety/access, or exhausted-recovery
129
144
  condition was recorded.
130
145
 
146
+ When invoked directly with no controlling caller and a planning artifact
147
+ changed, become the caller for the mandated next step: record the return
148
+ cursor, invoke `/rite-vet` inline, and consume its results — `NEEDS REPLAN`
149
+ re-enters repair internally under the fingerprint caps; `NEEDS CLARIFICATION`
150
+ and human-owned gates still reach the user. Stop only at Vet's boundary (READY
151
+ readback; next step `/rite-build`). An unchanged plan keeps its recorded next
152
+ step.
153
+
131
154
  > **Mid-flight discipline.** Do not change product behavior without confirmation or
132
155
  > absorb drift silently. See [`anti-patterns`](reference/anti-patterns.md).
@@ -26,12 +26,19 @@ dependency edges.
26
26
 
27
27
  A drift event stopped the build. Steps:
28
28
 
29
- 1. Read the `drift.md` entry and its classification.
29
+ 1. Read the `drift.md` entries and their classifications. Fold EVERY open entry
30
+ and accepted finding for the affected artifacts in ONE pass, never serially.
30
31
  2. If the user answered a drift question, encode that decision in `decisions.md`.
31
32
  3. Update `spec.md` (only the affected sections) and `plan.md`/`tasks.md` to match
32
33
  reality. Adjust acceptance criteria if they were wrong.
33
- 4. Mark the `drift.md` entry **resolved** with the resolution + date.
34
- 5. Resume at the corrected slice.
34
+ 4. Mark each `drift.md` entry **resolved** with the resolution + date.
35
+ 5. **Self-check the repaired candidate on the delta before handoff** — re-verify
36
+ every invariant the correction touched (acyclic dependency graph,
37
+ bidirectional traceability, Shared contract proof vs boundary set, sizing,
38
+ no correction-created regression) and record the evidence in the Plan
39
+ checkpoint; Vet's recheck verifies it rather than rediscovering the defect a
40
+ loop later.
41
+ 6. Resume at the corrected slice.
35
42
  Never quietly delete a requirement; use the marked action before contract edits.
36
43
 
37
44
  ## reorder
@@ -52,10 +52,14 @@ plan declares a root-authored executable workflow file, read
52
52
  - Use the lowest axis band; never average or round thin to ready. Search before
53
53
  asking and resolve reversible technical choices. Ask only human-owned choices.
54
54
  - Preserve a valid technical return cursor. Agent-owned `NEEDS REPLAN` returns
55
- internally to its caller, not to the human.
56
- - **Recovery recheck is bounded.** A valid cursor plus open fingerprint enters
57
- Recovery recheck; it does not start another Full Vet or repeat unaffected
58
- axes/reviewers.
55
+ internally to its caller, not to the human; on a direct invocation there is
56
+ no caller, so Vet becomes it record the cursor and invoke `/rite-plan`
57
+ repair inline under the same fingerprint caps.
58
+ - **Recovery recheck is bounded and batched.** A valid cursor plus open
59
+ fingerprints enters Recovery recheck; it does not start another Full Vet or
60
+ repeat unaffected axes/reviewers. One dispatch covers every open fingerprint
61
+ of the fold — each checked individually — with a mandatory correction-created
62
+ regression audit.
59
63
  <!-- workflow-artifact-adapter: {"module":"devrites-lib/reference/standards/workflow-artifacts.md","entry":"plan declares root-authored executable workflow file","action":"emit exact admission; stale/missing authority uses PLAN_VET_REPAIR","return":"Vet READY cursor or exact technical replan"} -->
60
64
  ## Workflow
61
65
 
@@ -73,10 +77,15 @@ plan declares a root-authored executable workflow file, read
73
77
  required account blocks.
74
78
  1b. **Recovery recheck.** Require valid return cursor, accepted prior finding,
75
79
  exact fingerprint/reproduction, repaired candidate identity, changed
76
- paths/criteria, and affected drift/evidence. Freeze that packet and dispatch
77
- each exact owning reviewer once, fresh/read-only, limited to it. Do not rerun
78
- broad inventory or unaffected reviewers. Close the prior fingerprint only
79
- with discriminating evidence. Otherwise record one no-progress outcome. A
80
+ paths/criteria, affected drift/evidence, and the recorded delta self-check.
81
+ Freeze that packet and dispatch each exact owning reviewer once,
82
+ fresh/read-only, limited to it all its open fingerprints in that dispatch.
83
+ Do not rerun broad inventory or unaffected reviewers. Close the prior
84
+ fingerprint only with discriminating evidence plus an explicit
85
+ correction-created regression verdict on the touched invariants (acyclic
86
+ deps, traceability, contract proof, sizing) and every region depending on a
87
+ changed clause — enumerate dependents via the dep graph and traceability
88
+ refs, not only patched sites. Otherwise record one no-progress outcome. A
80
89
  different Critical/Important invariant needs exact evidence and a new
81
90
  fingerprint; a Suggestion, Nit, or FYI cannot keep recovery open. Reconcile
82
91
  shared artifact/readiness gates and return to caller or next repair.
@@ -119,11 +128,14 @@ plan declares a root-authored executable workflow file, read
119
128
  criterion needs positive, discriminating proof; every slice must be one-pass
120
129
  implementable; developer plans need a predicted scorecard. Durable commands
121
130
  are portable repository commands, not host wrappers.
122
- 7. **Narrow recheck after edits.** Dispatch exact plan reviewer once per
123
- correction/fingerprint (`per correction/fingerprint`) with accepted findings,
124
- changed paths/criteria, and new
125
- identity. Within one correction, no broad third loop. If it changes plan,
126
- fold again. A closed input plus a distinct Critical/Important invariant returns
131
+ 7. **Narrow recheck after edits.** Dispatch the exact plan reviewer once per
132
+ fold one dispatch covering every open fingerprint, preserving
133
+ per correction/fingerprint accounting (each checked individually with its
134
+ accepted findings, changed paths/criteria, new identity, and recorded delta
135
+ self-check); it must return an explicit correction-created regression
136
+ verdict over touched invariants plus every dependent of each changed clause
137
+ (dep-graph and traceability lookup), not only fingerprint closure. Within one correction, no broad
138
+ third loop. If it changes plan, fold again. A closed input plus a distinct Critical/Important invariant returns
127
139
  that new fingerprint as progress. Then close matrix and rerun ID/meaning audit.
128
140
  8. **Build readback and readiness.** Add a cited five-line readback to
129
141
  `eng-review.md` (artifacts.md §7 rows 1–5): outcome/ACs; IN/OUT/must-NOT; UI direction and architecture/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devrites",
3
- "version": "5.1.0",
3
+ "version": "5.2.1",
4
4
  "description": "DevRites: a disciplined senior-engineer workflow pack for Claude Code and Codex",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://github.com/ViktorsBaikers/DevRites#readme",