devrites 5.2.3 → 5.3.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/engine/internal/install/uninstall.go +3 -0
  4. package/engine/internal/lib/resolve.go +7 -0
  5. package/engine/internal/parallel/cli.go +62 -8
  6. package/engine/internal/parallel/git.go +46 -7
  7. package/engine/internal/parallel/lease.go +7 -0
  8. package/engine/internal/parallel/ops.go +256 -72
  9. package/engine/internal/parallel/ops_test.go +223 -6
  10. package/engine/internal/parallel/parallel_test.go +229 -6
  11. package/engine/internal/parallel/pathdisjoint.go +18 -3
  12. package/engine/internal/parallel/pathdisjoint_test.go +21 -0
  13. package/pack/.claude/agents/devrites-plan-drafter.md +9 -0
  14. package/pack/.claude/agents/devrites-plan-reviewer.md +4 -1
  15. package/pack/.claude/skills/devrites-api-interface/SKILL.md +3 -1
  16. package/pack/.claude/skills/devrites-doubt/SKILL.md +3 -2
  17. package/pack/.claude/skills/rite-autocomplete/SKILL.md +2 -3
  18. package/pack/.claude/skills/rite-build/SKILL.md +7 -3
  19. package/pack/.claude/skills/rite-build/reference/checkpoint.md +13 -15
  20. package/pack/.claude/skills/rite-build/reference/one-slice-cycle.md +4 -2
  21. package/pack/.claude/skills/rite-build/reference/parallel-batch.md +75 -20
  22. package/pack/.claude/skills/rite-build/reference/spec-drift-guard.md +8 -1
  23. package/pack/.claude/skills/rite-plan/SKILL.md +26 -1
  24. package/pack/.claude/skills/rite-plan/reference/replan-and-repair.md +8 -4
  25. package/pack/.claude/skills/rite-review/SKILL.md +10 -6
  26. package/pack/.claude/skills/rite-seal/SKILL.md +3 -1
  27. package/pack/.claude/skills/rite-vet/SKILL.md +19 -5
  28. package/pack/generated/claude/agents/devrites-plan-drafter.md +9 -0
  29. package/pack/generated/claude/agents/devrites-plan-reviewer.md +4 -1
  30. package/pack/generated/claude/skills/devrites-api-interface/SKILL.md +3 -1
  31. package/pack/generated/claude/skills/devrites-doubt/SKILL.md +3 -2
  32. package/pack/generated/claude/skills/rite-autocomplete/SKILL.md +2 -3
  33. package/pack/generated/claude/skills/rite-build/SKILL.md +7 -3
  34. package/pack/generated/claude/skills/rite-build/reference/checkpoint.md +13 -15
  35. package/pack/generated/claude/skills/rite-build/reference/one-slice-cycle.md +4 -2
  36. package/pack/generated/claude/skills/rite-build/reference/parallel-batch.md +75 -20
  37. package/pack/generated/claude/skills/rite-build/reference/spec-drift-guard.md +8 -1
  38. package/pack/generated/claude/skills/rite-plan/SKILL.md +26 -1
  39. package/pack/generated/claude/skills/rite-plan/reference/replan-and-repair.md +8 -4
  40. package/pack/generated/claude/skills/rite-review/SKILL.md +10 -6
  41. package/pack/generated/claude/skills/rite-seal/SKILL.md +3 -1
  42. package/pack/generated/claude/skills/rite-vet/SKILL.md +19 -5
  43. package/pack/generated/codex/agents/devrites-plan-drafter.toml +9 -0
  44. package/pack/generated/codex/agents/devrites-plan-reviewer.toml +4 -1
  45. package/pack/generated/codex/skills/devrites-api-interface/SKILL.md +3 -1
  46. package/pack/generated/codex/skills/devrites-doubt/SKILL.md +3 -2
  47. package/pack/generated/codex/skills/rite-autocomplete/SKILL.md +2 -3
  48. package/pack/generated/codex/skills/rite-build/SKILL.md +7 -3
  49. package/pack/generated/codex/skills/rite-build/reference/checkpoint.md +13 -15
  50. package/pack/generated/codex/skills/rite-build/reference/one-slice-cycle.md +4 -2
  51. package/pack/generated/codex/skills/rite-build/reference/parallel-batch.md +75 -20
  52. package/pack/generated/codex/skills/rite-build/reference/spec-drift-guard.md +8 -1
  53. package/pack/generated/codex/skills/rite-plan/SKILL.md +26 -1
  54. package/pack/generated/codex/skills/rite-plan/reference/replan-and-repair.md +8 -4
  55. package/pack/generated/codex/skills/rite-review/SKILL.md +10 -6
  56. package/pack/generated/codex/skills/rite-seal/SKILL.md +3 -1
  57. package/pack/generated/codex/skills/rite-vet/SKILL.md +19 -5
  58. package/pack/generated/omp/agents/devrites-plan-drafter.md +9 -0
  59. package/pack/generated/omp/agents/devrites-plan-reviewer.md +4 -1
  60. package/pack/generated/omp/skills/devrites-api-interface/SKILL.md +3 -1
  61. package/pack/generated/omp/skills/devrites-doubt/SKILL.md +3 -2
  62. package/pack/generated/omp/skills/rite-autocomplete/SKILL.md +2 -3
  63. package/pack/generated/omp/skills/rite-build/SKILL.md +7 -3
  64. package/pack/generated/omp/skills/rite-build/reference/checkpoint.md +13 -15
  65. package/pack/generated/omp/skills/rite-build/reference/one-slice-cycle.md +4 -2
  66. package/pack/generated/omp/skills/rite-build/reference/parallel-batch.md +75 -20
  67. package/pack/generated/omp/skills/rite-build/reference/spec-drift-guard.md +8 -1
  68. package/pack/generated/omp/skills/rite-plan/SKILL.md +26 -1
  69. package/pack/generated/omp/skills/rite-plan/reference/replan-and-repair.md +8 -4
  70. package/pack/generated/omp/skills/rite-review/SKILL.md +10 -6
  71. package/pack/generated/omp/skills/rite-seal/SKILL.md +3 -1
  72. package/pack/generated/omp/skills/rite-vet/SKILL.md +19 -5
  73. package/package.json +1 -1
@@ -83,9 +83,8 @@ executable controller/harness/bundle bytes or a missing writer, read
83
83
  3. **Arm AFK once.** Apply the loop's
84
84
  [one-write AFK contract](reference/loop.md#arm-afk-once): preserve valid
85
85
  existing bytes or create the bounded advisory-only sentinel once; never
86
- rewrite it after Vet. Preserve an existing sentinel byte-for-byte. Touch
87
- `.devrites/CHECKPOINT` so proven slices get local crash-survivable WIP
88
- checkpoints for Ship to collapse. **Completion:** valid read-only AFK and checkpoint sentinels exist.
86
+ rewrite it after Vet. Preserve an existing sentinel byte-for-byte.
87
+ **Completion:** a valid read-only AFK sentinel exists.
89
88
  4. **Drive phases.** Follow [the loop](reference/loop.md): `/rite-spec` →
90
89
  `/rite-clarify` → `/rite-temper` → `/rite-define` → `/rite-vet` →
91
90
  `/rite-build` × pending slices → `/rite-prove` → `/rite-polish` →
@@ -58,9 +58,13 @@ Wright applies anti-slop; root verifies returns and never patches source.
58
58
  ## `--parallel N` (opt-in)
59
59
 
60
60
  Omitted/`1` ≡ serial; `2`–`10` → path-disjoint fan-out when eligible; else hard refuse.
61
- All-green serial integrate; one red/gap aborts. Abort with agent-owned plan
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
61
+ All-green serial integrate; a red/gap sibling gets a bounded repair round in
62
+ its own worktree never rebuilt from scratch while budget remains.
63
+ Plan-owned gaps still route through Spec Drift Guard (batch sweep, one folded
64
+ plan repair + one vet recheck inline); do not emit a human `Fix`. Exhausted
65
+ repair blocks and preserves everything; `cleanup --force` (human discard
66
+ path only) salvages slice branches before removing worktrees.
67
+ AFK charges after integrate only. Running lease blocks another
64
68
  `/rite-build`. Details: `parallel-batch.md`.
65
69
 
66
70
  ## Execute and reply
@@ -1,13 +1,8 @@
1
- # Checkpoint: crash-survivable WIP commits (opt-in)
1
+ # Checkpoint: proven slices land as local WIP commits
2
2
 
3
- `.devrites/` markdown survives compaction, but a slice's source normally stays
4
- uncommitted until `/rite-ship`. A crash during unattended Build can lose that source.
5
- Checkpoint mode commits each proven slice as a local `WIP`, so it survives the session.
6
-
7
- ## When it's on
8
- Opt in with `.devrites/CHECKPOINT`, the mirror of `.devrites/AFK`. When absent,
9
- `/rite-build` makes no checkpoint. Autocomplete sets it for long unattended runs.
10
- **Local-only:** never push a checkpoint or let scratch work trigger CI.
3
+ A slice's source never stays uncommitted after its gates are green: at RECORD
4
+ the orchestrator commits the proven slice as a local `WIP`, so the working
5
+ tree stays clean and the work survives a crash or compaction.
11
6
 
12
7
  ## The checkpoint commit: orchestrator, at RECORD, after gates are green
13
8
  A checkpoint records a **proven** slice only after its gates are green. Stage the exact
@@ -16,7 +11,6 @@ Never stage `touched-files.md`, a directory, glob, unrelated path, or user chang
16
11
  Verify the staged set, then commit locally with a `[devrites-context]` body:
17
12
 
18
13
  ```bash
19
- [ -f .devrites/CHECKPOINT ] || exit 0 # sentinel absent → no-op, silent
20
14
  git commit -m "WIP(<slug>): <slice>" -m "$(cat <<'BODY'
21
15
  [devrites-context]
22
16
  decisions: <one-line delta this slice added to decisions.md>
@@ -26,6 +20,10 @@ BODY
26
20
  )"
27
21
  ```
28
22
 
23
+ When host reconciliation already landed the isolated transfer commit, nothing
24
+ is staged and the step no-ops. **Local-only:** never push a checkpoint or let
25
+ scratch work trigger CI.
26
+
29
27
  ## Restore
30
28
  After a crash, a fresh session may read the last `WIP(<slug>)` body as crash context.
31
29
  Authoritative state remains in `.devrites/`: validate the body against that workspace;
@@ -39,8 +37,8 @@ one atomic feature commit before the Conventional-Commit ladder: see the collaps
39
37
  [git-ship.md](../../rite-ship/reference/git-ship.md). Result: one clean commit, bisect
40
38
  stays green.
41
39
 
42
- ## Autocomplete clean-baseline use
43
- `/rite-autocomplete` may arm checkpoints after verifying a clean or accepted baseline.
44
- They authorize neither red-gate continuation nor Ship. Each wright returns after one
45
- slice; HITL stops, while explicit `.devrites/AFK` lets the controlling Build root chain
46
- another green slice only under its cap and pause rules.
40
+ ## Autocomplete
41
+ Checkpoints are unconditional; `/rite-autocomplete` needs no sentinel arming.
42
+ Each wright returns after one slice; HITL stops, while explicit `.devrites/AFK`
43
+ lets the controlling Build root chain another green slice only under its cap
44
+ and pause rules.
@@ -19,11 +19,13 @@ DISPATCH → hand the slice contract to devrites-slice-wright (fresh context).
19
19
  IMPLEMENT → smallest complete version; match conventions; devrites-frontend-craft for UI
20
20
  VERIFY → writer-safe tests/types/lint; return code + tests
21
21
  (DOUBT) → orchestrator, on return: devrites-doubt each non-trivial decision the wright stood up
22
+ — dispatch the initial read-only reviews of distinct decisions in parallel
23
+ (independent claims, fresh contexts); wright fixes stay serial — writers share files
22
24
  PROVE → root: required build/browser/E2E, then returned-diff/path review; fail-on-red
23
25
  RECORD → orchestrator: after green verification, update state.md/evidence.md and
24
26
  upsert the authoritative candidate manifest from the actual scoped diff
25
- (CHECKPOINT) → orchestrator: if .devrites/CHECKPOINT is set, commit the proven slice
26
- local-only as WIP(<slug>) with a [devrites-context] body → survives a crash (checkpoint.md)
27
+ (CHECKPOINT) → orchestrator: commit the proven slice local-only as WIP(<slug>)
28
+ with a [devrites-context] body → clean tree, survives a crash (checkpoint.md)
27
29
  NEXT → HITL root reports and stops; AFK root may repeat only under afk-discipline.md
28
30
  ```
29
31
 
@@ -12,8 +12,8 @@ Opt-in only. Default `/rite-build` stays [`one-slice-cycle.md`](one-slice-cycle.
12
12
 
13
13
  AFK caps `N` by remaining budget. Charge **only after successful integrate**
14
14
  (once per integrated green sibling). Abort / integrate-failed → **0**. A
15
- `running` lease blocks another `/rite-build`. Any present lease blocks
16
- `parallel create` until cleanup.
15
+ present lease is resumable: `/rite-build` continues it (repair rounds or the
16
+ blocked verdict); `parallel create` refuses until cleanup.
17
17
 
18
18
  ## Path-disjoint
19
19
 
@@ -22,8 +22,9 @@ duplicates, absolutes, `.devrites/**`. Empty pairwise intersection required.
22
22
 
23
23
  **SSOT:** `devrites-engine check path-disjoint [--root <dir>] [<json-file>|-]`
24
24
  (N≥2 only; pass `--root`). Exit `0` → fan-out; else force serial. Inspect-time
25
- overlap → sibling **gap** abort. **Failing case:** two parallel wrights share a
26
- path and fan-out proceeds without that check.
25
+ overlap → sibling **gap** (a shared path is a contract defect). **Failing
26
+ case:** two parallel wrights share a path and fan-out proceeds without that
27
+ check.
27
28
 
28
29
  ## Control vs workers
29
30
 
@@ -44,26 +45,80 @@ Lease: `batch_id`, `created_at`, `base_sha`, `n`,
44
45
  3. Dispatch ≤10 wrights in parallel (cwd=worktree; allowlist; prove `HEAD==B`).
45
46
  4. Inspect + fail-on-red → `green|red|gap`. Independent-review Critical is `gap`
46
47
  even when targeted tests are green.
47
- 5. Any red/gap → **abort** (no partial integrate). All green serial integrate.
48
- 6. Integrate: `transfer_commit` descends from `B`; `` `<base>..<transfer>` ``
49
- path-exact; apply in plan order. Conflictreset to `B`, `integrate-failed`.
50
- 7. Success: FF control; union `touched-files.md`; update state/evidence; AFK +1
51
- per integrated sibling; optional `check candidate`.
52
- 8. Cleanup: success removes worktrees/branches. Abort keeps them as repair
53
- inputs until the root consumes them: agent-owned plan gaps (AC unchanged)
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
57
- `Fix: /rite-plan repair`. Product/policy/irreversible-risk still stops.
48
+ 5. Non-green siblings → **repair round** (below) in the same worktrees; lease
49
+ stays `running` no abort while repair budget remains. A green sibling →
50
+ `parallel record-green`. No partial integrate. All green → integrate.
51
+ 6. Integrate: each `transfer_commit` descends from `B` and diffs path-exact vs
52
+ `B`; squash-apply all in plan order into one `WIP(<slug>):` commit on the
53
+ staging branch (Ship collapses it). Conflict reset to `B`,
54
+ `integrate-failed`; classify under repair rounds (siblings stay in place).
55
+ 7. Success: FF control to the squash commit the batch lands as one local
56
+ commit, never pushed; union `touched-files.md`; update state/evidence;
57
+ AFK +1 per integrated sibling; optional `check candidate`.
58
+ 8. Cleanup runs only after `integrate` marks the lease `complete` — work
59
+ landed in control, so `parallel cleanup` removes worktrees/branches.
60
+ Blocked/human-stopped batches keep lease, worktrees, branches — nothing is
61
+ removed while the batch may resume. `parallel abort` + `cleanup --force`
62
+ is the explicit human discard path, never orchestrator-emitted; it
63
+ salvages each sibling first (uncommitted allowlisted changes → slice-branch
64
+ commit; branches past `B` kept; a failed salvage keeps the worktree) and
65
+ prints retained refs for the abort record. `abort` marks the lease only —
66
+ never rewinds control: a moved HEAD is external work, reported not reset.
67
+ Never integrate a rejected transfer commit.
68
+
69
+ ## Repair rounds
70
+
71
+ Rejected work is repaired in place — never discarded and rebuilt from scratch
72
+ while budget remains.
73
+
74
+ - Record each round as `build-parallel-<batch>-repair-<round>.json`: per
75
+ non-green sibling — status, verbatim findings, transfer_commit or null.
76
+ - Classify first: **implementation defect** (review Critical on the diff, red
77
+ wright/proof) → repair wright in the same worktree. **Durable-plan defect**
78
+ (falsified contract assumption, AC unchanged) →
79
+ [`spec-drift-guard.md`](spec-drift-guard.md): batch-sweep contract
80
+ assumptions, one folded `/rite-plan repair` + one `/rite-vet` recheck
81
+ inline, resume repair in the same worktrees under the amended contract;
82
+ never emit `Fix:`. **Reviewer stall/cancel or missing verdict** →
83
+ re-dispatch the reviewer, not the wright. **Product/policy/irreversible**
84
+ → stops for the human.
85
+ - Dispatch a fresh `devrites-slice-wright` (cwd = the sibling's worktree, same
86
+ allowlist and host rules as step 3 — siblings may repair in parallel) with
87
+ the original contract + verbatim findings + "preserve what works; fix the
88
+ named findings; return a new `transfer_commit`". Never reset the worktree
89
+ to `B` — that destroys the work under repair. The commit must still descend
90
+ from `B` and diff path-exact vs `B`.
91
+ - Each repair return re-runs the full gate chain: inspect, fresh doubt +
92
+ test-analysis, approved proof.
93
+ - Budget: the shared causal-fingerprint cap — three total failed attempts per
94
+ sibling per fingerprint (build + repairs count together); a distinct
95
+ Critical is a new fingerprint. Exhaustion is not abort: record one
96
+ technical blocker (`Status: blocked`; `Next step: none — technical recovery
97
+ exhausted for <fingerprint>; requires new evidence or changed failure
98
+ conditions`), preserve lease/worktrees/branches, STOP — same fingerprint
99
+ stays blocked on reinvoke; new evidence resumes repair in place. Human-
100
+ owned decisions use the drift-guard question and wait.
58
101
 
59
102
  ## Engine verbs
60
103
 
61
104
  ```text
62
- devrites-engine parallel create|record-green|abort|integrate|cleanup|status
63
- devrites-engine parallel lease-write|lease-read|lease-clear
105
+ devrites-engine parallel create --root <repo> --slug <slug> --batch <id> --base <B> --json <file>|-
106
+ devrites-engine parallel record-green --root <repo> --slug <slug> --slice <id> --commit <sha>
107
+ devrites-engine parallel integrate --root <repo> --slug <slug> --apply-to-control
108
+ devrites-engine parallel status --root <repo> --slug <slug>
109
+ devrites-engine parallel lease-write|lease-read|lease-clear --root <repo> --slug <slug>
110
+ # human discard only, never orchestrator-emitted:
111
+ # parallel abort --root <repo> --slug <slug>
112
+ # parallel cleanup --root <repo> --slug <slug> --force (salvages, prints retained refs)
64
113
  ```
65
114
 
66
- Go is SSOT. Skill calls the engine never ad-hoc git/bash orchestration.
115
+ `integrate` without `--apply-to-control` stages the squash commit, leaves the
116
+ lease `running` and control at `B`; cleanup still refuses — the commit cannot
117
+ be lost. `record-green` and `integrate` also accept an `integrate-failed`
118
+ lease, so a failed integrate retries after repair. `--apply-to-control`
119
+ refuses when control moved past `B` or holds uncommitted changes on slice
120
+ paths — commit/stash and retry; the batch is untouched. Go is SSOT; never
121
+ ad-hoc git/bash orchestration.
67
122
 
68
123
  ## Runtime isolation
69
124
 
@@ -78,8 +133,8 @@ assign per-slice env (document in the lease or worktree README):
78
133
  | Dev server | one process per worktree; never share a listener |
79
134
 
80
135
  Reusing the control worktree's running server, DB, or compose stack across
81
- siblings causes cross-slice pollution and flaky proof. Abort if isolation cannot
82
- be established.
136
+ siblings causes cross-slice pollution and flaky proof. Force serial if
137
+ isolation cannot be established.
83
138
 
84
139
  ## Host
85
140
 
@@ -44,7 +44,14 @@ A durable-plan drift abort never repairs the first gap alone:
44
44
  2. Record each violation as its own `drift.md` entry/fingerprint; one folded
45
45
  repair + one batched recheck resolves the set.
46
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.
47
+ internally, never hand an intermediate command to the human. When
48
+ consecutive folded repairs keep landing on the same clause set, the
49
+ repair packet's `convergence_pressure` marking applies (see `/rite-plan`
50
+ repair): bounded declared residuals may close refinements of
51
+ already-pinned clauses; a newly surfaced failure mode is never
52
+ residual-eligible. A suspect seam's declare-limitation-or-continue choice
53
+ routes to `/rite-clarify` like any human-owned gate — it is not an
54
+ intermediate command.
48
55
  4. Nothing skips or defers silently: every entry ends resolved, human-escalated,
49
56
  or fingerprint-exhausted. Execution-only gaps (tests, UX, evidence) get the
50
57
  identical path when they surface.
@@ -83,7 +83,32 @@ Before classifying any Reslice, read `.claude/skills/devrites-lib/reference/stan
83
83
  touches: which intersected invariants it re-verified, with evidence of no
84
84
  correction-created regression. Global re-derivation (ID/edge/HZN counts,
85
85
  acyclicity) runs on materialized artifacts at the step-7 gate — the drafter
86
- never re-derives them by exhaustive search.
86
+ never re-derives them by exhaustive search. It also carries a bounded
87
+ self-attack over the delta (`self_attack_exposures`), catching the shallow
88
+ next-round findings before Vet's dispatch rather than after a full loop.
89
+ Root dispositions every exposure — fold as a finding, accept as a declared
90
+ residual, or reject with reason; none silently drops.
91
+ Packet mechanics: dedupe at assembly — findings with an identical
92
+ required-fix and site set merge into one entry that closes all their
93
+ fingerprints. The packet may carry digest-pinned site excerpts so the
94
+ drafter spot-verifies anchors instead of re-scanning whole files, and root
95
+ may partition findings into anchor-disjoint clusters with one drafter per
96
+ cluster in parallel — findings sharing any anchor or mirrored clause stay
97
+ in one cluster, and each bundle applies independently. A `partial`-
98
+ continuation re-dispatch continues the same packet; it does not advance the
99
+ same-seam counter. Count consecutive repair packets whose findings' cited clause sets overlap
100
+ the immediately previous packet's — the overlap is the seam. At the third
101
+ same-seam packet, mark it `convergence_pressure: true` with the seam named.
102
+ Under pressure the drafter may close a finding marked as a refinement of an
103
+ already-pinned clause by folding an explicit, bounded declared
104
+ residual/limitation into the contract text instead of another precision
105
+ pin — never for a `new_failure_mode` finding. Every finding still gets one
106
+ disposition; none is skipped. A fourth same-seam packet that still carries
107
+ `new_failure_mode` findings means the seam is under-specified, not
108
+ under-repaired: route a declare-limitation-or-continue choice to
109
+ `/rite-clarify`. AFK records the suspect seam in `state.md` and continues
110
+ within budgets — a coverage limitation is a product decision and is never
111
+ auto-declared.
87
112
  Bind exact active `.devrites/work/<slug>/` targets and executable contract; after Vet READY, root
88
113
  materializes the exact vetted workflow-artifact paths under
89
114
  [`workflow-artifacts.md`](../devrites-lib/reference/standards/workflow-artifacts.md)
@@ -32,10 +32,14 @@ A drift event stopped the build. Steps:
32
32
  3. Update `spec.md` (only the affected sections) and `plan.md`/`tasks.md` to match
33
33
  reality. Adjust acceptance criteria if they were wrong.
34
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
35
+ 5. **Self-check and self-attack the repaired candidate on the delta before
36
+ handoff** — re-verify every invariant the correction touched (acyclic
37
+ dependency graph, bidirectional traceability, Shared contract proof vs
38
+ boundary set, sizing, no correction-created regression), then probe the
39
+ delta against the reviewers' attack classes (race/observation windows,
40
+ alias escapes, ordering gaps, capability gaps, unbounded blocking,
41
+ happy-path-only coverage); fold a fix or a named bounded residual into
42
+ the same pass. Record both in the Plan
39
43
  checkpoint; Vet's recheck verifies it rather than rediscovering the defect a
40
44
  loop later.
41
45
  6. Resume at the corrected slice.
@@ -77,7 +77,9 @@ Pull these via `Read` when the diff demands them:
77
77
  Separate contexts prevent one axis from masking the other:
78
78
  - Freeze that closed digest and give the same digest to **two** read-only reviewers in
79
79
  parallel, each with its own narrow brief and no
80
- cross-pollination:
80
+ cross-pollination — and evaluate the frontend (step 4), security (step 5),
81
+ and performance (step 6) dispatch conditions from this same diff now,
82
+ joining the cohort when applicable rather than dispatching later waves:
81
83
  - **Spec axis** → `devrites-spec-reviewer`: "Apply your documented discipline on
82
84
  the active feature workspace + diff. Report (a) criteria the spec asked for that
83
85
  are missing or partial, (b) behaviour in the diff the spec did not ask for
@@ -112,17 +114,19 @@ Pull these via `Read` when the diff demands them:
112
114
  Add only what the dispatched agents could not, then resolve overlaps and
113
115
  contradictions before labeling. ([five-axis-review.md](reference/five-axis-review.md)
114
116
  documents the axes the code-review agent applies.)
115
- - **UI feature?** Dispatch `devrites-frontend-reviewer` and apply the **UX rubric**
117
+ - **UI feature?** `devrites-frontend-reviewer` joins the step-3 cohort; apply the **UX rubric**
116
118
  ([nielsen-heuristics](reference/nielsen-heuristics.md)) and the
117
119
  **cognitive-load lens** ([cognitive-load](reference/cognitive-load.md),
118
120
  [performance-checklist](reference/performance-checklist.md)). No UI/route/style
119
121
  paths: record `Not-applicable: no relevant paths in diff`.
120
- 5. **Security:** dispatch `devrites-security-auditor`
121
- ([security-review](reference/security-review.md)) when input, auth, data,
122
+ 5. **Security:** `devrites-security-auditor`
123
+ ([security-review](reference/security-review.md)) joins the step-3 cohort when
124
+ input, auth, data,
122
125
  secrets, or permissions are in the diff; else `Not-applicable: no relevant paths in diff`.
123
- 6. **Performance:** dispatch `devrites-performance-reviewer`
126
+ 6. **Performance:** `devrites-performance-reviewer`
124
127
  ([performance-review](reference/performance-review.md),
125
- [performance-checklist](reference/performance-checklist.md)) only on a budget or
128
+ [performance-checklist](reference/performance-checklist.md)) joins the step-3 cohort
129
+ only on a budget or
126
130
  hot path; else `Not-applicable: no relevant paths in diff`.
127
131
  7. Reconcile and accept only in-scope fixes. Consolidate them into one bounded
128
132
  wright correction; never edit source in the reviewing context. Any correction
@@ -52,7 +52,9 @@ Follow [`reference/phase-contract.md`](reference/phase-contract.md)
52
52
 
53
53
  1. read workspace and final diff;
54
54
  2. recheck the canonical candidate/bindings and approved repository/CI proof;
55
- 3. dispatch exact proof, spec, test, doubt, and applicable review agents;
55
+ 3. dispatch exact proof, spec, test, doubt, and applicable review agents in
56
+ parallel under `../devrites-lib/reference/parallel-dispatch.md` — independent
57
+ read-only verdicts on one frozen candidate;
56
58
  4. reconcile their read-only verdicts against source and immutable evidence;
57
59
  5. draft GO/NO-GO `seal.md` with acceptance, tests, decisions, and seven accounts;
58
60
  6. write exactly one candidate binding, then run
@@ -73,9 +73,11 @@ plan declares a root-authored executable workflow file, read
73
73
  1. **Select depth.** Apply `reference/depth.md` exactly; never skip. Every initial
74
74
  pass records an engineering verdict and test-plan coverage. A valid Recovery
75
75
  recheck retains prior depth and enters 1b.
76
- 1a. **Independent initial pass.** Freeze candidate and dispatch exact fresh
77
- read-only plan reviewer. Add developer-experience reviewer for developer
78
- surfaces and current strategy reviewer after significant Temper. Missing
76
+ 1a. **Independent initial pass.** Freeze candidate and dispatch the exact fresh
77
+ read-only plan reviewer plus developer-experience reviewer for developer
78
+ surfaces and the current strategy reviewer after significant Temper — in
79
+ parallel under `../devrites-lib/reference/parallel-dispatch.md`; they are
80
+ independent read-only passes on one frozen candidate. Missing
79
81
  required account blocks.
80
82
  1b. **Recovery recheck.** Require valid return cursor, accepted prior finding,
81
83
  exact fingerprint/reproduction, repaired candidate identity, changed
@@ -89,7 +91,16 @@ plan declares a root-authored executable workflow file, read
89
91
  changed clause — enumerate dependents via the dep graph and traceability
90
92
  refs, not only patched sites. Otherwise record one no-progress outcome. A
91
93
  different Critical/Important invariant needs exact evidence and a new
92
- fingerprint; a Suggestion, Nit, or FYI cannot keep recovery open. Reconcile
94
+ fingerprint; a Suggestion, Nit, or FYI cannot keep recovery open. A packet
95
+ marked `convergence_pressure` accepts an explicit, bounded declared
96
+ residual/limitation folded into the contract text as closure for a finding
97
+ marked as a refinement of an already-pinned clause; the recheck may re-raise
98
+ it only by naming a concrete failure path the declaration omits. A
99
+ `new_failure_mode` finding is never residual-eligible. A fold whose
100
+ findings are all Suggestion-or-lower rechecks mechanically at the
101
+ materialization gate — anchors applied, mirrors consistent, invariants
102
+ pass — without a dispatched reviewer; sub-Important findings already
103
+ cannot keep recovery open. Reconcile
93
104
  shared artifact/readiness gates and return to caller or next repair.
94
105
  2. **Challenge scope.** Apply review-axes §0 and search accepted decisions.
95
106
  Harden to the smallest contract-complete plan, using marked topology action.
@@ -119,7 +130,10 @@ plan declares a root-authored executable workflow file, read
119
130
  consumer seam, or an explicit no-impact statement. Missing, one-sided,
120
131
  duplicated-contract, vague, or non-consuming proof fails closed.
121
132
 
122
- Technical gaps are `NEEDS REPLAN` and Plan repair. Product/risk gaps are
133
+ Technical gaps are `NEEDS REPLAN` and Plan repair each finding marks
134
+ itself `new_failure_mode` or names the already-pinned clause/fingerprint
135
+ it refines, making alias-detection and `convergence_pressure` eligibility
136
+ mechanical. Product/risk gaps are
123
137
  `NEEDS CLARIFICATION` and Clarify. Neither becomes a Build qid.
124
138
  5. **Review axes.** Apply `review-axes.md` through `eng-lenses.md`. Fold verified
125
139
  behavior-preserving technical findings; walk only human-owned decisions.
@@ -60,6 +60,14 @@ principle-exception questions. List them for the root.
60
60
  re-dispatches the rest. A finding blocked on human-owned information goes in
61
61
  `blocked_findings` with the needed input named — never `remaining_findings`,
62
62
  which is reserved for what another dispatch can complete.
63
+ - In `repair`, before returning, self-attack the delta: probe every clause the
64
+ hunks touch for the attack classes Vet's reviewers hunt — race/observation
65
+ windows, identity/alias escapes, durability/ordering gaps,
66
+ platform-capability gaps, unbounded blocking, happy-path-only coverage.
67
+ Close each real exposure inside the same delta or return it in
68
+ `self_attack_exposures` with its bound; never silently drop one. This
69
+ narrows the next Vet round; it never replaces independent review and never
70
+ self-approves the repair.
63
71
 
64
72
  ## Output format
65
73
 
@@ -77,6 +85,7 @@ technical_decisions: []
77
85
  human_owned_choices: []
78
86
  validation_commands: []
79
87
  applicability_disposition: []
88
+ self_attack_exposures: []
80
89
  ```
81
90
 
82
91
  The root validates the cross-file bundle and persists accepted content.
@@ -104,7 +104,10 @@ criterion, slice, or proof.
104
104
  - `/rite-vet` may request one initial pass and one narrow recheck per correction/fingerprint.
105
105
  - Label each finding **Critical / Important / Suggestion / Nit / FYI** and include
106
106
  the relevant plan or task section, confidence score, and a concrete fix. Do not
107
- pad the report with praise.
107
+ pad the report with praise. In a recheck, also mark each finding
108
+ `new_failure_mode` or name the already-pinned clause/fingerprint it refines —
109
+ the packet lists prior repairs; the mark makes alias-detection and
110
+ `convergence_pressure` eligibility mechanical.
108
111
  - When a dimension has no issue, say "strong: <why>" instead of inventing a
109
112
  finding.
110
113
  - If a claim cannot be verified, such as blast radius without an index, say so and
@@ -51,7 +51,9 @@ Before standing the interface, run `devrites-doubt`.
51
51
  ## Done when
52
52
  The contract is complete only when **every** field carries a type + optionality + unit,
53
53
  **every** success and error status code is enumerated with its error-body shape, the
54
- `devrites-doubt` verdict is accept (on reject: revise the contract and re-doubt), and the
54
+ `devrites-doubt` verdict is accept (on reject: revise the contract and re-doubt under
55
+ `devrites-doubt`'s per-fingerprint bounds and distinct-findings ceiling — a contract
56
+ that resists repair becomes a blocker or human gate, not an endless revise loop), and the
55
57
  contract + rationale are recorded in `decisions.md`. A contract that pins only the
56
58
  happy-path shape is not done.
57
59
 
@@ -27,7 +27,7 @@ code · claiming "this is safe", "this scales", or "this matches the spec".
27
27
  issues but classify **zero** as actionable, the review is too agreeable. Sharpen the
28
28
  prompt or use a fresh reviewer. Accept a clean pass only after a genuine attempt to
29
29
  disprove the claim.
30
- - [ ] **5. STOP**: met a stop condition (only trivial findings, 3 cycles done, or user override). Emit a **binary gate verdict** the orchestrator must clear: **accept** (no valid-&-actionable findings remain) or **reject + the specific required changes**. On reject, the orchestrator loops the wright on those changes before the slice is accepted. Still reject after the 3-cycle cap classify by decision ownership: human-owned product/risk uncertainty escalates; objective required changes become a technical blocker, never a retry-authorization question.
30
+ - [ ] **5. STOP**: met a stop condition (only trivial findings, no open fingerprint has budget left, the distinct-findings ceiling, or user override). Emit a **binary gate verdict** the orchestrator must clear: **accept** (no valid-&-actionable findings remain) or **reject + the specific required changes**. On reject, the orchestrator loops the wright on those changes before the slice is accepted. Account per finding, not per round: a reject citing a genuinely new defect is progress and the loop continues; a reject re-citing a fingerprint the wright already failed on is no-progress and burns that fingerprint's budget. A finding that only refines a clause a prior cycle already pinned may close as an explicit bounded declared residual. Ceiling: three distinct actionable findings on one decision mean the decision resists repair — classify by decision ownership: human-owned product/risk uncertainty escalates; objective required changes become a technical blocker, never a retry-authorization question.
31
31
 
32
32
  ## Deletion-test lens (for "is this abstraction load-bearing?" doubts)
33
33
 
@@ -72,7 +72,8 @@ real time. Map the verdict to a `questions.md` entry instead of a synchronous pr
72
72
  `questions.md` entry with `gate: blocking`, set `state.md` `Status: awaiting_human`,
73
73
  fire the `notify:` hook, and STOP. AFK never silently accepts irreversible risk.
74
74
 
75
- The 3-loop limit still applies. After 3 cycles, human-owned uncertainty becomes a blocking
75
+ The same bounds apply in AFK. Once no open fingerprint has budget left or the
76
+ distinct-findings ceiling trips, human-owned uncertainty becomes a blocking
76
77
  question; an unresolved objective technical finding becomes `Status: blocked` with its exact
77
78
  required changes and `/rite-plan unblock`, regardless of AFK config.
78
79
 
@@ -83,9 +83,8 @@ executable controller/harness/bundle bytes or a missing writer, read
83
83
  3. **Arm AFK once.** Apply the loop's
84
84
  [one-write AFK contract](reference/loop.md#arm-afk-once): preserve valid
85
85
  existing bytes or create the bounded advisory-only sentinel once; never
86
- rewrite it after Vet. Preserve an existing sentinel byte-for-byte. Touch
87
- `.devrites/CHECKPOINT` so proven slices get local crash-survivable WIP
88
- checkpoints for Ship to collapse. **Completion:** valid read-only AFK and checkpoint sentinels exist.
86
+ rewrite it after Vet. Preserve an existing sentinel byte-for-byte.
87
+ **Completion:** a valid read-only AFK sentinel exists.
89
88
  4. **Drive phases.** Follow [the loop](reference/loop.md): `/rite-spec` →
90
89
  `/rite-clarify` → `/rite-temper` → `/rite-define` → `/rite-vet` →
91
90
  `/rite-build` × pending slices → `/rite-prove` → `/rite-polish` →
@@ -58,9 +58,13 @@ Wright applies anti-slop; root verifies returns and never patches source.
58
58
  ## `--parallel N` (opt-in)
59
59
 
60
60
  Omitted/`1` ≡ serial; `2`–`10` → path-disjoint fan-out when eligible; else hard refuse.
61
- All-green serial integrate; one red/gap aborts. Abort with agent-owned plan
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
61
+ All-green serial integrate; a red/gap sibling gets a bounded repair round in
62
+ its own worktree never rebuilt from scratch while budget remains.
63
+ Plan-owned gaps still route through Spec Drift Guard (batch sweep, one folded
64
+ plan repair + one vet recheck inline); do not emit a human `Fix`. Exhausted
65
+ repair blocks and preserves everything; `cleanup --force` (human discard
66
+ path only) salvages slice branches before removing worktrees.
67
+ AFK charges after integrate only. Running lease blocks another
64
68
  `/rite-build`. Details: `parallel-batch.md`.
65
69
 
66
70
  ## Execute and reply
@@ -1,13 +1,8 @@
1
- # Checkpoint: crash-survivable WIP commits (opt-in)
1
+ # Checkpoint: proven slices land as local WIP commits
2
2
 
3
- `.devrites/` markdown survives compaction, but a slice's source normally stays
4
- uncommitted until `/rite-ship`. A crash during unattended Build can lose that source.
5
- Checkpoint mode commits each proven slice as a local `WIP`, so it survives the session.
6
-
7
- ## When it's on
8
- Opt in with `.devrites/CHECKPOINT`, the mirror of `.devrites/AFK`. When absent,
9
- `/rite-build` makes no checkpoint. Autocomplete sets it for long unattended runs.
10
- **Local-only:** never push a checkpoint or let scratch work trigger CI.
3
+ A slice's source never stays uncommitted after its gates are green: at RECORD
4
+ the orchestrator commits the proven slice as a local `WIP`, so the working
5
+ tree stays clean and the work survives a crash or compaction.
11
6
 
12
7
  ## The checkpoint commit: orchestrator, at RECORD, after gates are green
13
8
  A checkpoint records a **proven** slice only after its gates are green. Stage the exact
@@ -16,7 +11,6 @@ Never stage `touched-files.md`, a directory, glob, unrelated path, or user chang
16
11
  Verify the staged set, then commit locally with a `[devrites-context]` body:
17
12
 
18
13
  ```bash
19
- [ -f .devrites/CHECKPOINT ] || exit 0 # sentinel absent → no-op, silent
20
14
  git commit -m "WIP(<slug>): <slice>" -m "$(cat <<'BODY'
21
15
  [devrites-context]
22
16
  decisions: <one-line delta this slice added to decisions.md>
@@ -26,6 +20,10 @@ BODY
26
20
  )"
27
21
  ```
28
22
 
23
+ When host reconciliation already landed the isolated transfer commit, nothing
24
+ is staged and the step no-ops. **Local-only:** never push a checkpoint or let
25
+ scratch work trigger CI.
26
+
29
27
  ## Restore
30
28
  After a crash, a fresh session may read the last `WIP(<slug>)` body as crash context.
31
29
  Authoritative state remains in `.devrites/`: validate the body against that workspace;
@@ -39,8 +37,8 @@ one atomic feature commit before the Conventional-Commit ladder: see the collaps
39
37
  [git-ship.md](../../rite-ship/reference/git-ship.md). Result: one clean commit, bisect
40
38
  stays green.
41
39
 
42
- ## Autocomplete clean-baseline use
43
- `/rite-autocomplete` may arm checkpoints after verifying a clean or accepted baseline.
44
- They authorize neither red-gate continuation nor Ship. Each wright returns after one
45
- slice; HITL stops, while explicit `.devrites/AFK` lets the controlling Build root chain
46
- another green slice only under its cap and pause rules.
40
+ ## Autocomplete
41
+ Checkpoints are unconditional; `/rite-autocomplete` needs no sentinel arming.
42
+ Each wright returns after one slice; HITL stops, while explicit `.devrites/AFK`
43
+ lets the controlling Build root chain another green slice only under its cap
44
+ and pause rules.
@@ -19,11 +19,13 @@ DISPATCH → hand the slice contract to devrites-slice-wright (fresh context).
19
19
  IMPLEMENT → smallest complete version; match conventions; devrites-frontend-craft for UI
20
20
  VERIFY → writer-safe tests/types/lint; return code + tests
21
21
  (DOUBT) → orchestrator, on return: devrites-doubt each non-trivial decision the wright stood up
22
+ — dispatch the initial read-only reviews of distinct decisions in parallel
23
+ (independent claims, fresh contexts); wright fixes stay serial — writers share files
22
24
  PROVE → root: required build/browser/E2E, then returned-diff/path review; fail-on-red
23
25
  RECORD → orchestrator: after green verification, update state.md/evidence.md and
24
26
  upsert the authoritative candidate manifest from the actual scoped diff
25
- (CHECKPOINT) → orchestrator: if .devrites/CHECKPOINT is set, commit the proven slice
26
- local-only as WIP(<slug>) with a [devrites-context] body → survives a crash (checkpoint.md)
27
+ (CHECKPOINT) → orchestrator: commit the proven slice local-only as WIP(<slug>)
28
+ with a [devrites-context] body → clean tree, survives a crash (checkpoint.md)
27
29
  NEXT → HITL root reports and stops; AFK root may repeat only under afk-discipline.md
28
30
  ```
29
31