devrites 5.4.0 → 5.5.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 (213) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/docs/command-map.md +2 -2
  4. package/docs/engine/state-schema.md +12 -0
  5. package/docs/flow.md +4 -0
  6. package/docs/orchestration.md +5 -2
  7. package/engine/commands.go +2 -2
  8. package/engine/internal/devritespaths/paths.go +15 -0
  9. package/engine/internal/gate/gate.go +78 -0
  10. package/engine/internal/gate/gate_test.go +118 -0
  11. package/engine/internal/lib/candidate.go +7 -3
  12. package/engine/internal/lib/manifest_union.go +326 -0
  13. package/engine/internal/lib/manifest_union_test.go +214 -0
  14. package/engine/internal/lib/observe_budgets.go +73 -0
  15. package/engine/internal/lib/observe_budgets_test.go +142 -0
  16. package/engine/internal/lib/observe_summary.go +74 -13
  17. package/engine/internal/lib/workspace_read.go +11 -6
  18. package/engine/internal/state/budgets.go +163 -0
  19. package/engine/internal/state/budgets_test.go +42 -0
  20. package/engine/internal/state/cursor.go +16 -10
  21. package/engine/internal/state/observation.go +50 -4
  22. package/engine/internal/state/status.go +38 -26
  23. package/engine/internal/state/taskgraph.go +23 -0
  24. package/engine/main.go +32 -13
  25. package/engine/root_routing_test.go +3 -1
  26. package/pack/.claude/agents/devrites-code-reviewer.md +9 -6
  27. package/pack/.claude/agents/devrites-doubt-reviewer.md +6 -0
  28. package/pack/.claude/agents/devrites-plan-reviewer.md +7 -1
  29. package/pack/.claude/agents/devrites-slice-wright.md +42 -46
  30. package/pack/.claude/agents/devrites-test-analyst.md +9 -4
  31. package/pack/.claude/agents/devrites-upgrade-planner.md +9 -1
  32. package/pack/.claude/settings.json +17 -0
  33. package/pack/.claude/skills/devrites-api-interface/SKILL.md +2 -2
  34. package/pack/.claude/skills/devrites-doubt/SKILL.md +9 -17
  35. package/pack/.claude/skills/devrites-lib/reference/candidate-integrity.md +34 -35
  36. package/pack/.claude/skills/devrites-lib/reference/parallel-dispatch.md +11 -12
  37. package/pack/.claude/skills/devrites-lib/reference/standards/afk-hitl.md +104 -51
  38. package/pack/.claude/skills/devrites-lib/reference/standards/agents.md +1 -0
  39. package/pack/.claude/skills/devrites-lib/reference/standards/context-hygiene.md +45 -25
  40. package/pack/.claude/skills/devrites-lib/reference/standards/core.md +1 -1
  41. package/pack/.claude/skills/devrites-lib/reference/workspace-artifact-schema.md +80 -41
  42. package/pack/.claude/skills/rite-autocomplete/SKILL.md +19 -8
  43. package/pack/.claude/skills/rite-autocomplete/reference/loop.md +33 -1
  44. package/pack/.claude/skills/rite-build/SKILL.md +26 -19
  45. package/pack/.claude/skills/rite-build/reference/afk-discipline.md +1 -1
  46. package/pack/.claude/skills/rite-build/reference/parallel-batch.md +90 -40
  47. package/pack/.claude/skills/rite-build/reference/phase-contract.md +79 -59
  48. package/pack/.claude/skills/rite-build/reference/spec-drift-guard.md +14 -15
  49. package/pack/.claude/skills/rite-build/reference/wright-dispatch.md +8 -8
  50. package/pack/.claude/skills/rite-define/SKILL.md +4 -1
  51. package/pack/.claude/skills/rite-plan/SKILL.md +4 -1
  52. package/pack/.claude/skills/rite-plan/reference/replan-and-repair.md +21 -0
  53. package/pack/.claude/skills/rite-plan/reference/slicing.md +117 -15
  54. package/pack/.claude/skills/rite-prove/SKILL.md +20 -22
  55. package/pack/.claude/skills/rite-review/SKILL.md +23 -16
  56. package/pack/.claude/skills/rite-seal/SKILL.md +8 -8
  57. package/pack/.claude/skills/rite-seal/reference/final-evidence.md +6 -5
  58. package/pack/.claude/skills/rite-seal/reference/phase-contract.md +13 -13
  59. package/pack/.claude/skills/rite-ship/SKILL.md +3 -0
  60. package/pack/.claude/skills/rite-ship/reference/close-out.md +16 -2
  61. package/pack/.claude/skills/rite-ship/reference/git-ship.md +14 -5
  62. package/pack/.claude/skills/rite-spec/SKILL.md +6 -0
  63. package/pack/.claude/skills/rite-spec/reference/state-workspace.md +6 -0
  64. package/pack/.claude/skills/rite-status/SKILL.md +4 -1
  65. package/pack/.claude/skills/rite-temper/SKILL.md +14 -11
  66. package/pack/.claude/skills/rite-temper/reference/anti-patterns.md +14 -13
  67. package/pack/.claude/skills/rite-temper/reference/review-dimensions.md +3 -4
  68. package/pack/.claude/skills/rite-upgrade/SKILL.md +11 -2
  69. package/pack/.claude/skills/rite-vet/SKILL.md +22 -15
  70. package/pack/.claude/skills/rite-vet/reference/anti-patterns.md +11 -9
  71. package/pack/.claude/skills/rite-vet/reference/depth.md +6 -7
  72. package/pack/.claude/skills/rite-vet/reference/review-axes.md +39 -14
  73. package/pack/generated/claude/agents/devrites-code-reviewer.md +9 -6
  74. package/pack/generated/claude/agents/devrites-doubt-reviewer.md +6 -0
  75. package/pack/generated/claude/agents/devrites-plan-reviewer.md +7 -1
  76. package/pack/generated/claude/agents/devrites-slice-wright.md +42 -46
  77. package/pack/generated/claude/agents/devrites-test-analyst.md +9 -4
  78. package/pack/generated/claude/agents/devrites-upgrade-planner.md +9 -1
  79. package/pack/generated/claude/settings.json +17 -0
  80. package/pack/generated/claude/skills/devrites-api-interface/SKILL.md +2 -2
  81. package/pack/generated/claude/skills/devrites-doubt/SKILL.md +9 -17
  82. package/pack/generated/claude/skills/devrites-lib/reference/candidate-integrity.md +34 -35
  83. package/pack/generated/claude/skills/devrites-lib/reference/parallel-dispatch.md +11 -12
  84. package/pack/generated/claude/skills/devrites-lib/reference/standards/afk-hitl.md +104 -51
  85. package/pack/generated/claude/skills/devrites-lib/reference/standards/agents.md +1 -0
  86. package/pack/generated/claude/skills/devrites-lib/reference/standards/context-hygiene.md +45 -25
  87. package/pack/generated/claude/skills/devrites-lib/reference/standards/core.md +1 -1
  88. package/pack/generated/claude/skills/devrites-lib/reference/workspace-artifact-schema.md +80 -41
  89. package/pack/generated/claude/skills/rite-autocomplete/SKILL.md +19 -8
  90. package/pack/generated/claude/skills/rite-autocomplete/reference/loop.md +33 -1
  91. package/pack/generated/claude/skills/rite-build/SKILL.md +26 -19
  92. package/pack/generated/claude/skills/rite-build/reference/afk-discipline.md +1 -1
  93. package/pack/generated/claude/skills/rite-build/reference/parallel-batch.md +90 -40
  94. package/pack/generated/claude/skills/rite-build/reference/phase-contract.md +79 -59
  95. package/pack/generated/claude/skills/rite-build/reference/spec-drift-guard.md +14 -15
  96. package/pack/generated/claude/skills/rite-build/reference/wright-dispatch.md +8 -8
  97. package/pack/generated/claude/skills/rite-define/SKILL.md +4 -1
  98. package/pack/generated/claude/skills/rite-plan/SKILL.md +4 -1
  99. package/pack/generated/claude/skills/rite-plan/reference/replan-and-repair.md +21 -0
  100. package/pack/generated/claude/skills/rite-plan/reference/slicing.md +117 -15
  101. package/pack/generated/claude/skills/rite-prove/SKILL.md +20 -22
  102. package/pack/generated/claude/skills/rite-review/SKILL.md +23 -16
  103. package/pack/generated/claude/skills/rite-seal/SKILL.md +8 -8
  104. package/pack/generated/claude/skills/rite-seal/reference/final-evidence.md +6 -5
  105. package/pack/generated/claude/skills/rite-seal/reference/phase-contract.md +13 -13
  106. package/pack/generated/claude/skills/rite-ship/SKILL.md +3 -0
  107. package/pack/generated/claude/skills/rite-ship/reference/close-out.md +16 -2
  108. package/pack/generated/claude/skills/rite-ship/reference/git-ship.md +14 -5
  109. package/pack/generated/claude/skills/rite-spec/SKILL.md +6 -0
  110. package/pack/generated/claude/skills/rite-spec/reference/state-workspace.md +6 -0
  111. package/pack/generated/claude/skills/rite-status/SKILL.md +4 -1
  112. package/pack/generated/claude/skills/rite-temper/SKILL.md +14 -11
  113. package/pack/generated/claude/skills/rite-temper/reference/anti-patterns.md +14 -13
  114. package/pack/generated/claude/skills/rite-temper/reference/review-dimensions.md +3 -4
  115. package/pack/generated/claude/skills/rite-upgrade/SKILL.md +11 -2
  116. package/pack/generated/claude/skills/rite-vet/SKILL.md +22 -15
  117. package/pack/generated/claude/skills/rite-vet/reference/anti-patterns.md +11 -9
  118. package/pack/generated/claude/skills/rite-vet/reference/depth.md +6 -7
  119. package/pack/generated/claude/skills/rite-vet/reference/review-axes.md +39 -14
  120. package/pack/generated/codex/agents/devrites-code-reviewer.toml +9 -6
  121. package/pack/generated/codex/agents/devrites-doubt-reviewer.toml +6 -0
  122. package/pack/generated/codex/agents/devrites-plan-reviewer.toml +7 -1
  123. package/pack/generated/codex/agents/devrites-slice-wright.toml +42 -46
  124. package/pack/generated/codex/agents/devrites-test-analyst.toml +9 -4
  125. package/pack/generated/codex/agents/devrites-upgrade-planner.toml +9 -1
  126. package/pack/generated/codex/skills/devrites-api-interface/SKILL.md +2 -2
  127. package/pack/generated/codex/skills/devrites-doubt/SKILL.md +9 -17
  128. package/pack/generated/codex/skills/devrites-lib/reference/candidate-integrity.md +34 -35
  129. package/pack/generated/codex/skills/devrites-lib/reference/parallel-dispatch.md +11 -12
  130. package/pack/generated/codex/skills/devrites-lib/reference/standards/afk-hitl.md +104 -51
  131. package/pack/generated/codex/skills/devrites-lib/reference/standards/agents.md +1 -0
  132. package/pack/generated/codex/skills/devrites-lib/reference/standards/context-hygiene.md +45 -25
  133. package/pack/generated/codex/skills/devrites-lib/reference/standards/core.md +1 -1
  134. package/pack/generated/codex/skills/devrites-lib/reference/workspace-artifact-schema.md +80 -41
  135. package/pack/generated/codex/skills/rite-autocomplete/SKILL.md +19 -8
  136. package/pack/generated/codex/skills/rite-autocomplete/reference/loop.md +33 -1
  137. package/pack/generated/codex/skills/rite-build/SKILL.md +26 -19
  138. package/pack/generated/codex/skills/rite-build/reference/afk-discipline.md +1 -1
  139. package/pack/generated/codex/skills/rite-build/reference/parallel-batch.md +90 -40
  140. package/pack/generated/codex/skills/rite-build/reference/phase-contract.md +79 -59
  141. package/pack/generated/codex/skills/rite-build/reference/spec-drift-guard.md +14 -15
  142. package/pack/generated/codex/skills/rite-build/reference/wright-dispatch.md +8 -8
  143. package/pack/generated/codex/skills/rite-define/SKILL.md +4 -1
  144. package/pack/generated/codex/skills/rite-plan/SKILL.md +4 -1
  145. package/pack/generated/codex/skills/rite-plan/reference/replan-and-repair.md +21 -0
  146. package/pack/generated/codex/skills/rite-plan/reference/slicing.md +117 -15
  147. package/pack/generated/codex/skills/rite-prove/SKILL.md +20 -22
  148. package/pack/generated/codex/skills/rite-review/SKILL.md +23 -16
  149. package/pack/generated/codex/skills/rite-seal/SKILL.md +8 -8
  150. package/pack/generated/codex/skills/rite-seal/reference/final-evidence.md +6 -5
  151. package/pack/generated/codex/skills/rite-seal/reference/phase-contract.md +13 -13
  152. package/pack/generated/codex/skills/rite-ship/SKILL.md +3 -0
  153. package/pack/generated/codex/skills/rite-ship/reference/close-out.md +16 -2
  154. package/pack/generated/codex/skills/rite-ship/reference/git-ship.md +14 -5
  155. package/pack/generated/codex/skills/rite-spec/SKILL.md +6 -0
  156. package/pack/generated/codex/skills/rite-spec/reference/state-workspace.md +6 -0
  157. package/pack/generated/codex/skills/rite-status/SKILL.md +4 -1
  158. package/pack/generated/codex/skills/rite-temper/SKILL.md +14 -11
  159. package/pack/generated/codex/skills/rite-temper/reference/anti-patterns.md +14 -13
  160. package/pack/generated/codex/skills/rite-temper/reference/review-dimensions.md +3 -4
  161. package/pack/generated/codex/skills/rite-upgrade/SKILL.md +11 -2
  162. package/pack/generated/codex/skills/rite-vet/SKILL.md +22 -15
  163. package/pack/generated/codex/skills/rite-vet/reference/anti-patterns.md +11 -9
  164. package/pack/generated/codex/skills/rite-vet/reference/depth.md +6 -7
  165. package/pack/generated/codex/skills/rite-vet/reference/review-axes.md +39 -14
  166. package/pack/generated/omp/agents/devrites-code-reviewer.md +9 -6
  167. package/pack/generated/omp/agents/devrites-doubt-reviewer.md +6 -0
  168. package/pack/generated/omp/agents/devrites-plan-reviewer.md +7 -1
  169. package/pack/generated/omp/agents/devrites-slice-wright.md +42 -46
  170. package/pack/generated/omp/agents/devrites-test-analyst.md +9 -4
  171. package/pack/generated/omp/agents/devrites-upgrade-planner.md +9 -1
  172. package/pack/generated/omp/skills/devrites-api-interface/SKILL.md +2 -2
  173. package/pack/generated/omp/skills/devrites-doubt/SKILL.md +9 -17
  174. package/pack/generated/omp/skills/devrites-lib/reference/candidate-integrity.md +34 -35
  175. package/pack/generated/omp/skills/devrites-lib/reference/parallel-dispatch.md +11 -12
  176. package/pack/generated/omp/skills/devrites-lib/reference/standards/afk-hitl.md +104 -51
  177. package/pack/generated/omp/skills/devrites-lib/reference/standards/agents.md +1 -0
  178. package/pack/generated/omp/skills/devrites-lib/reference/standards/context-hygiene.md +45 -25
  179. package/pack/generated/omp/skills/devrites-lib/reference/standards/core.md +1 -1
  180. package/pack/generated/omp/skills/devrites-lib/reference/workspace-artifact-schema.md +80 -41
  181. package/pack/generated/omp/skills/rite-autocomplete/SKILL.md +19 -8
  182. package/pack/generated/omp/skills/rite-autocomplete/reference/loop.md +33 -1
  183. package/pack/generated/omp/skills/rite-build/SKILL.md +26 -19
  184. package/pack/generated/omp/skills/rite-build/reference/afk-discipline.md +1 -1
  185. package/pack/generated/omp/skills/rite-build/reference/parallel-batch.md +90 -40
  186. package/pack/generated/omp/skills/rite-build/reference/phase-contract.md +79 -59
  187. package/pack/generated/omp/skills/rite-build/reference/spec-drift-guard.md +14 -15
  188. package/pack/generated/omp/skills/rite-build/reference/wright-dispatch.md +8 -8
  189. package/pack/generated/omp/skills/rite-define/SKILL.md +4 -1
  190. package/pack/generated/omp/skills/rite-plan/SKILL.md +4 -1
  191. package/pack/generated/omp/skills/rite-plan/reference/replan-and-repair.md +21 -0
  192. package/pack/generated/omp/skills/rite-plan/reference/slicing.md +117 -15
  193. package/pack/generated/omp/skills/rite-prove/SKILL.md +20 -22
  194. package/pack/generated/omp/skills/rite-review/SKILL.md +23 -16
  195. package/pack/generated/omp/skills/rite-seal/SKILL.md +8 -8
  196. package/pack/generated/omp/skills/rite-seal/reference/final-evidence.md +6 -5
  197. package/pack/generated/omp/skills/rite-seal/reference/phase-contract.md +13 -13
  198. package/pack/generated/omp/skills/rite-ship/SKILL.md +3 -0
  199. package/pack/generated/omp/skills/rite-ship/reference/close-out.md +16 -2
  200. package/pack/generated/omp/skills/rite-ship/reference/git-ship.md +14 -5
  201. package/pack/generated/omp/skills/rite-spec/SKILL.md +6 -0
  202. package/pack/generated/omp/skills/rite-spec/reference/state-workspace.md +6 -0
  203. package/pack/generated/omp/skills/rite-status/SKILL.md +4 -1
  204. package/pack/generated/omp/skills/rite-temper/SKILL.md +14 -11
  205. package/pack/generated/omp/skills/rite-temper/reference/anti-patterns.md +14 -13
  206. package/pack/generated/omp/skills/rite-temper/reference/review-dimensions.md +3 -4
  207. package/pack/generated/omp/skills/rite-upgrade/SKILL.md +11 -2
  208. package/pack/generated/omp/skills/rite-vet/SKILL.md +22 -15
  209. package/pack/generated/omp/skills/rite-vet/reference/anti-patterns.md +11 -9
  210. package/pack/generated/omp/skills/rite-vet/reference/depth.md +6 -7
  211. package/pack/generated/omp/skills/rite-vet/reference/review-axes.md +39 -14
  212. package/package.json +1 -1
  213. package/scripts/codex-generate.sh +6 -0
@@ -1,23 +1,19 @@
1
1
  # Workspace artifact schema
2
2
 
3
- Feature truth lives in `.devrites/work/<slug>/`; discovery requires `state.md`.
4
- `README.md` is an optional discovery map; the spec phase still writes it. Operational remnants and archive entries are not
5
- active workspaces. Current writers use canonical filenames. Both released cursor
6
- forms remain official; `/rite-upgrade` audits them in place and never performs
7
- path, alias, or format migration.
3
+ Feature truth: `.devrites/work/<slug>/`, discovered by `state.md`; remnants/archives
4
+ are inactive. Spec writes optional `README.md`. Use canonical filenames; both released
5
+ cursor forms remain valid. `/rite-upgrade` audits without path/alias/format migration.
8
6
 
9
7
  ## Slug identity
10
8
 
11
- New workspaces use a meaningful objective-derived slug that is lowercase ASCII
12
- kebab-case, matches `[a-z0-9]+(?:-[a-z0-9]+)*`, and is at most 64 characters.
13
- Prefer shortening at a word boundary. After the final shortening or suffix step,
14
- trim boundary hyphens and reject an empty result.
9
+ New slugs derive from the objective: lowercase ASCII kebab-case matching
10
+ `[a-z0-9]+(?:-[a-z0-9]+)*`, at most 64 characters. Shorten at word boundaries.
11
+ After the final shortening or suffix step, trim boundary hyphens; reject empty results.
15
12
 
16
- Before creating a directory, compare any matching workspace's `brief.md`
17
- objective. Reuse it only for the same feature. Otherwise append the smallest
18
- unused numeric suffix (`-2`, `-3`, ...), shortening and trimming the base again
19
- to stay within 64 characters. Never overwrite a workspace by slug alone.
20
- Readers continue to accept safe legacy basenames; no ordinary phase renames one.
13
+ Before creation, compare a matching workspace's `brief.md` objective: reuse only the
14
+ same feature. Otherwise append the smallest unused suffix (`-2`, `-3`, ...), keeping
15
+ the trimmed base within 64 characters. Never overwrite a workspace by slug alone;
16
+ accept safe legacy basenames. Ordinary phases never rename them.
21
17
 
22
18
  ## Required by phase
23
19
 
@@ -31,13 +27,13 @@ Readers continue to accept safe legacy basenames; no ordinary phase renames one.
31
27
  | vet/build/converge | plan artifacts plus `eng-review.md`, `test-plan.md`; Build creates and maintains `touched-files.md` after its first green slice |
32
28
  | prove/polish/review | vetted plan artifacts plus `evidence.md`, `touched-files.md` |
33
29
  | seal/ship/done | proof artifacts plus `review.md`, `seal.md`; Ship writes `ship.md` |
34
- | conditional | `flows.md` when diagrams clarify; `visual/` HTML+`.outline.md` companions when a richer reviewable visual earns it (optional; never readiness-required); `design-brief.md` and `browser-evidence.md` for UI; `drift.md` for drift; `polish-report.md` for polish; `handoff.md` only when requested; `references.md` + `references/` when references exist; `investigation-map.md` for pressure-test; `dogfood.md` for dogfood |
30
+ | conditional | `flows.md` when diagrams clarify; `visual/` HTML+`.outline.md` companions when a richer reviewable visual earns it (optional; never readiness-required); `design-brief.md` and `browser-evidence.md` for UI; `drift.md` for drift; `polish-report.md` for polish; `handoff.md` only when requested; `references.md` + `references/` when references exist; `investigation-map.md` for pressure-test; `dogfood.md` for dogfood; `packets/` for by-reference dispatch packets and admitted accounts (≤ 64 KiB each; older closed rounds may be deleted; never transcripts); `history/` for verbatim relocated checkpoint narrative (append-only, never a read-next) |
35
31
 
36
32
  ## What each file owns
37
33
 
38
34
  | File | Job | Budget |
39
35
  | --- | --- | --- |
40
- | `README.md` | compact workspace map: phase, status, next action, artifact map, read-next table, blocking gates, last updated | 120 lines |
36
+ | `README.md` | map: phase/status/next action, artifacts/read-next, blocking gates, last update | 120 lines |
41
37
  | `brief.md` | user request, objective, non-goals, success definition | 80 lines |
42
38
  | `spec.md` | product WHAT/WHY, requirements, acceptance criteria, edge cases, measurable success, scope boundaries | 260 lines |
43
39
  | `decision-coverage.md` | topology-first coverage matrix, assumption audit, residual uncertainty, and typed clarity verdict | 200 lines |
@@ -53,22 +49,23 @@ Readers continue to accept safe legacy basenames; no ordinary phase renames one.
53
49
  | `plan.md` | technical approach, slice strategy, canonical shared-contract proof, validation strategy, rollback | 220 lines |
54
50
  | `tasks.md` | `SLICE-###` vertical slices with AC IDs, likely files, tests/proof, mode/gate, dependencies, done condition | 280 lines |
55
51
  | `traceability.md` | matrix: AC/REQ ID, slice IDs, test/proof, evidence ID, touched files, status | 220 lines |
56
- | `eng-review.md` | vetted scope/architecture/quality/performance, failure modes, preflight, stable-input binding | 240 lines |
52
+ | `eng-review.md` | vetted scope/architecture/quality/performance, failure modes, preflight, stable-input binding, `## Deferred findings` (late rows: severity · site · role · kind · round) for Review | 240 lines |
57
53
  | `test-plan.md` | executable proof commands, preflight/provenance contract, acceptance and interaction coverage | 260 lines |
58
54
  | `state.md` | compact cursor table/key-values; no narrative log | 120 lines |
59
55
  | `evidence.md` | `EVID-###` command/action, result, timestamp if available, related AC/slice IDs, limitation | 280 lines |
60
56
  | `browser-evidence.md` | UI route/viewports/screenshots/console/network/interactions and Visual Verdict | 220 lines |
61
57
  | `drift.md` | `DRIFT-###` spec/plan drift and resolution | 160 lines |
62
- | `touched-files.md` | sole candidate manifest plus a concern-ordered `## Review trail` of `path:line` stops for human review | 160 lines |
58
+ | `touched-files.md` | sole candidate manifest plus a concern-ordered `## Review trail` of `path:line` stops for human review and Build's deferred late findings (severity · site · role · round) that `/rite-review` must close | 160 lines |
63
59
  | `design-brief.md` | UI design direction, states, interaction model | 160 lines |
64
- | `handoff.md` | cold-resume guide: objective, last slice, next action, blockers, read-next. Sections carry content or `Nothing yet`; unevidenced recollections go under `Not tried yet`, never as results | 120 lines |
60
+ | `handoff.md` | resume objective/last slice/next action/blockers/read-next; sections hold content or `Nothing yet`; unevidenced recollections: `Not tried yet`, never results | 120 lines |
65
61
  | `polish-report.md` | polish axis deltas, re-verification lines, residual subjective preferences | 200 lines |
66
62
  | `ship.md` | ship preflight, disclosed Git plan, commit/push/tag/PR record | 120 lines |
63
+ | `review.md` | reconciled Review verdict: `## Spec` and `## Code review` accounts, deferred-finding labels/actions, drift | 240 lines |
64
+ | `seal.md` | seal preflight, exact reviewer roster accounts, GO/NO-GO verdict and disclosures | 200 lines |
65
+ | `ai-spec.md` | model/RAG/agent/eval/LLM-output scope for AI surfaces | 160 lines |
67
66
 
68
- When emitting `visual/` HTML+outline pairs, open matching playbooks via
69
- [`visual-playbooks/index.md`](visual-playbooks/index.md) (progressive load; do not
70
- preload all seven). Required outline headings:
71
- [`visual-playbooks/outline-template.md`](visual-playbooks/outline-template.md).
67
+ For visual pairs load only matching [playbooks](visual-playbooks/index.md); use
68
+ the [required outline headings](visual-playbooks/outline-template.md).
72
69
 
73
70
  ## Candidate manifest and bindings
74
71
 
@@ -98,14 +95,19 @@ candidate scope; only manifest rows do.
98
95
  The public candidate limits are a 1 MiB manifest, 4,096 rows, a 4,096-byte
99
96
  path, 64 MiB per present file, and 256 MiB across all present files.
100
97
 
101
- Workspace and audit artifacts are not candidate paths. That includes every path
102
- under `.devrites/work/<slug>/visual/` (HTML, `.outline.md`, and optional
103
- `visual/README.md`). Durable project files include `.devrites/specs/**`,
104
- `DESIGN.md`, and `docs/adr/**`, plus the exact `.devrites/principles.md` owner.
105
- Under `.devrites`, only those principles and spec owners may be candidates;
106
- `ACTIVE`, `AFK`, `CHECKPOINT`, `archive/**`, `work/**`, and every other sibling
107
- fail closed. Engine owns malformed path, type, and size rejection; phases do
108
- not reinterpret a rejected manifest.
98
+ A release milestone's union manifest is produced by `devrites-engine state
99
+ merge-manifest <release-slug>` it walks the recorded `sequence_parent` chain,
100
+ folds every predecessor manifest, and resolves a path collision in favor of the
101
+ later sequence position; a hand-assembled union is not authoritative. When the
102
+ workspace cursor declares `sequence_role: release`, `check candidate` and
103
+ `check seal` require the manifest to cover the whole recorded chain.
104
+
105
+ Workspace and audit artifacts are not candidate paths, including all
106
+ `.devrites/work/<slug>/visual/`. Durable owners include `.devrites/specs/**`,
107
+ `DESIGN.md`, and `docs/adr/**`, plus `.devrites/principles.md`. Under `.devrites`,
108
+ only those spec/principles owners qualify; all other siblings (`ACTIVE`, `AFK`,
109
+ `CHECKPOINT`, `archive/**`, `work/**`) fail closed. Engine owns malformed path, type,
110
+ and size rejection; phases never reinterpret a rejected manifest.
109
111
 
110
112
  `evidence.md`, `review.md`, and `seal.md` each contain exactly one unindented standalone
111
113
  binding line; `browser-evidence.md` does too when that file exists:
@@ -122,16 +124,46 @@ against a malicious concurrent same-size rewrite. Ship's exact Git-index scope,
122
124
  byte, binding, and secret checks own the final freeze immediately before commit.
123
125
 
124
126
  Only a structural `Budget override: <reason>` line (not a fenced example)
125
- permits excess. Phase writers check these limits before returning; there is no
127
+ permits excess. Each line budget also bounds bytes at 400 bytes per budgeted line
128
+ (`state.md` 120 lines → 48 KiB); long lines do not evade it.
129
+ `devrites-engine orient <slug>` reports `artifact_budgets` (lines/bytes/over/override)
130
+ and `bulk_files` (non-canonical files over 64 KiB) so a phase can decide what to read
131
+ before loading. Phase writers check these limits before returning; there is no
126
132
  repository-local script assumption in the installed workflow.
127
133
 
134
+ `check readiness` and `check seal` enforce the material band deterministically: a
135
+ required artifact at or above 1.5× its line or byte budget with no structural override
136
+ line blocks with the exact measurement and the three legal remedies (relocate history
137
+ via `/rite-plan revise`, split via `/rite-plan course-correct`, or record the override).
138
+ Overshoot below that band stays advisory and is reported by `orient`. Proof ledgers
139
+ (`evidence.md`, `browser-evidence.md`, `touched-files.md`) are always advisory: they
140
+ scale with proof volume, and `touched-files.md` keeps its own manifest limits.
141
+ Because they are never gate-blocked they are also the only artifacts that can grow
142
+ unboundedly — so phases read them by index, not whole-file: the standalone binding
143
+ line, a `EVID-###`/section-header index (`grep -n`), then bodies only for entries
144
+ naming this candidate's AC/slice IDs. An entry naming no in-scope ID is anomaly
145
+ evidence to inspect, not skip. A whole-file read is allowed only when `orient`
146
+ reports the artifact within budget; completeness for seal is engine-checked
147
+ (literal `AC-###` presence), the reader judges quality.
148
+
149
+ Two reasons are not durable fixes: slice or acceptance-criteria count (an over-budget
150
+ `tasks.md`/`plan.md`/`traceability.md` from decomposition size is a
151
+ [feature-sequence split](../../rite-plan/reference/slicing.md#feature-ceiling-split-an-epic-never-override-the-budget)),
152
+ and history in `state.md` (checkpoint narrative moves verbatim to
153
+ `history/<file>-<YYYYMMDD>.md`, append-only, never a phase read-next, with a one-line
154
+ pointer left behind). A legacy workspace may carry a temporary `Budget override:` line
155
+ as a bridge; `/rite-upgrade` routes it to relocation or the split, and new writers never
156
+ create one for those two reasons.
157
+ Apply [`context-hygiene.md` dispatch packets](standards/context-hygiene.md#dispatch-packets)
158
+ for byte-size checks and lossless retrieval; budget overrides neither rewrite protected
159
+ history nor require loading it all.
160
+
128
161
  ## Native readiness ownership
129
162
 
130
- `decision-coverage.md` records the topology scan; `test-plan.md` records executable proof;
131
- `eng-review.md` records exact reviewer verdicts, `Implementation readiness`, and the emitted
132
- `Readiness inputs SHA-256`. Root re-reads them and applies the ID-and-meaning checklist.
133
- The digest binds reviewed bytes; it never substitutes for semantic review. Normal readiness
134
- checks structure plus that binding, and Seal rechecks it.
163
+ `decision-coverage.md` owns topology; `test-plan.md`, executable proof; `eng-review.md`,
164
+ reviewer verdicts, `Implementation readiness`, and `Readiness inputs SHA-256`. Root
165
+ re-reads their IDs/meaning. The digest binds bytes, never semantic correctness.
166
+ Readiness checks structure/binding; Seal rechecks both.
135
167
 
136
168
  Proof commands must be repository-portable: no host wrappers, user-specific absolute paths,
137
169
  or temporary proof trees. Evidence records the executed command. Optional `visual/`
@@ -189,9 +221,9 @@ unless the stated reason makes the boundary irreducible.
189
221
  | temper | `spec.md`, `decision-coverage.md`, `decisions.md`, `assumptions.md`, `design-brief.md` |
190
222
  | define | `README.md`, `state.md`, `spec.md`, `decision-coverage.md`, `architecture.md`, `decisions.md`, `assumptions.md` |
191
223
  | vet | `state.md`, `spec.md`, `decision-coverage.md`, `README.md`, `traceability.md`, `plan.md`, `tasks.md`, `architecture.md`, `decisions.md` |
192
- | build | `state.md`, `decision-coverage.md`, `eng-review.md`, `test-plan.md`, `tasks.md`, `plan.md`, `architecture.md`, `traceability.md`, `questions.md`, and `touched-files.md` when present |
193
- | prove | `traceability.md`, `tasks.md`, `evidence.md`, `browser-evidence.md`, `touched-files.md` |
194
- | review/seal | `README.md`, `traceability.md`, `spec.md`, `evidence.md`, `decisions.md`, `drift.md`, `touched-files.md` |
224
+ | build | `devrites-engine orient <slug>` first; then `state.md`, `eng-review.md` (Build readback + `## Deferred findings`), the selected slice and its `depends_on` via `devrites-engine observe slice <slug> <SLICE-ID>`, the `test-plan.md` and `traceability.md` rows that slice's AC IDs name, open `questions.md` gates, and `touched-files.md` when present. Load whole `tasks.md`/`plan.md`/`architecture.md`/`decision-coverage.md` only when `orient` shows them within budget or the slice cites a section by ID |
225
+ | prove | `traceability.md`, `touched-files.md`; each built slice's `Tests/proof` and `Evidence required` via `observe slice`; `evidence.md`/`browser-evidence.md` via the bounded advisory read above |
226
+ | review/seal | `README.md`, `traceability.md`, `spec.md`, `decisions.md`, `drift.md`, `touched-files.md`; `evidence.md`/`browser-evidence.md` via the bounded advisory read above |
195
227
  | handoff | `README.md`, `state.md`, `handoff.md`, then the linked source artifacts |
196
228
 
197
229
  ## Do not duplicate
@@ -199,7 +231,14 @@ unless the stated reason makes the boundary irreducible.
199
231
  - Do not make `spec.md` carry deep architecture; link to `architecture.md`/`flows.md`.
200
232
  - Do not copy acceptance criteria into `plan.md`; reference `AC-###`.
201
233
  - Do not copy full proof into `handoff.md`; link to `evidence.md`.
202
- - Do not make `state.md` an append-only log; keep only the current cursor.
234
+ - Do not make `state.md` an append-only log; keep only the current cursor. A
235
+ checkpoint entry is at most three lines: what changed, the canonical record path or
236
+ DEC/EVID ID, and the next action. Digests, packet hashes, and finding narratives
237
+ belong to the record they identify, not the cursor.
238
+ - Give each normative fact one owner and stable ID; reference rather than copy it.
239
+ Required schema mirrors remain required. Derive counts/mirrors or mechanically
240
+ check equality using available tools, never invented commands. Repair stale
241
+ derived values and assess consumer impact; they are not new policy decisions.
203
242
  - Do not create optional files before their phase; absence is meaningful. Do not
204
243
  treat `visual/` as required for readiness; emit HTML+outline only when a writer
205
244
  earns a richer visual, and keep Mermaid in `flows.md` when that is enough.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: rite-autocomplete
3
3
  description: Run the full DevRites lifecycle unattended; --ship continues to the final Git approval boundary. Use for one-shot autonomous work; not for a single phase.
4
- argument-hint: "[idea] [--ship|--yolo] [--max-slices N] [--full] [--cross-model]"
4
+ argument-hint: "[idea] [--ship|--yolo] [--max-slices N] [--parallel N] [--full] [--cross-model]"
5
5
  user-invocable: true
6
6
  ---
7
7
 
@@ -53,9 +53,11 @@ executable controller/harness/bundle bytes or a missing writer, read
53
53
  malformed, and unavailable leaf calls. At the review cap, permit only work
54
54
  that reduces the queue.
55
55
  - Parse flags only from this invocation. `--ship`, `--yolo`, `--max-slices`,
56
- `--full`, and `--cross-model` activate only as exact standalone tokens in
57
- `$ARGUMENTS`; examples or earlier messages can never arm them. `--max-slices`
58
- must occur once and be followed by a positive base-10 integer; missing, repeated, malformed, or conflicting values stop before any write.
56
+ `--parallel`, `--full`, and `--cross-model` activate only as exact standalone
57
+ tokens in `$ARGUMENTS`; examples or earlier messages can never arm them.
58
+ `--max-slices` must occur once and be followed by a positive base-10 integer;
59
+ `--parallel` must occur once and be followed by a base-10 integer in `1`–`10`.
60
+ Missing, repeated, malformed, or conflicting values stop before any write.
59
61
  - Temper always runs after Clarify. Unattended mode auto-applies only
60
62
  `hold-rigor` and `reduce-to-MVP`; any `expand` or added acceptance pauses.
61
63
  - Vet every plan. Cross-model is off unless the current invocation arms it.
@@ -75,7 +77,8 @@ executable controller/harness/bundle bytes or a missing writer, read
75
77
  from chat. After compaction or a resumed session, read `.devrites/ACTIVE`, then
76
78
  the `state.md` cursor, `questions.md`, `decisions.md`, and `test-plan.md`/`evidence.md`.
77
79
  Normalize current arguments to idea, `ship_preflight: yes|no`,
78
- `max_slices: N|default`, `profile: standard|full`, and `cross_model: yes|no`.
80
+ `max_slices: N|default`, `parallel: N|default`, `profile: standard|full`,
81
+ and `cross_model: yes|no`.
79
82
  **Completion:** normalized state is unambiguous and no sentinel or workspace file has been written.
80
83
  2. **Specify and clarify.** Run `devrites-interview`, `/rite-spec`, and
81
84
  `/rite-clarify` as one window. Partial/Missing material coverage never arms
@@ -87,9 +90,13 @@ executable controller/harness/bundle bytes or a missing writer, read
87
90
  **Completion:** a valid read-only AFK sentinel exists.
88
91
  4. **Drive phases.** Follow [the loop](reference/loop.md): `/rite-spec` →
89
92
  `/rite-clarify` → `/rite-temper` → `/rite-define` → `/rite-vet` →
90
- `/rite-build` × pending slices → `/rite-prove` → `/rite-polish` →
93
+ `/rite-build` batch loop → `/rite-prove` → `/rite-polish` →
91
94
  `/rite-review` → `/rite-seal`. Read and execute each skill; durable files, not
92
95
  chat, carry state. Apply the mutable post-vet budget before first Build.
96
+ Build runs the largest eligible path-disjoint batch (cap: `--parallel N`, else
97
+ sentinel `max_parallel`, else 10) and recomputes after every integrate until no
98
+ pending slice remains; serial only when fewer than two slices are eligible or the
99
+ host cannot isolate concurrent worktree writers.
93
100
  **Completion:** loop reaches Seal GO or persists a valid stop before any later phase.
94
101
  5. **Apply stops.** At every gate use
95
102
  [stop-conditions.md](reference/stop-conditions.md). A `blocked` label alone is not a stop condition:
@@ -98,8 +105,12 @@ executable controller/harness/bundle bytes or a missing writer, read
98
105
  hard risk, human-owned blocking/escalating/NO-GO, resource exhaustion, or the
99
106
  exact fingerprint's proven exhaustion. Technical exhaustion records terminal
100
107
  `Next step: none`, never a routine phase command. **Completion:** no stop is active, or its cursor and reason are durable.
101
- 6. **Seal boundary.** Without a ship flag, stop at Seal GO with `/rite-ship`.
102
- With one, perform Ship preflight, disclose the exact Git plan, and stop for
108
+ 6. **Seal boundary.** Without a ship flag, stop at Seal GO with `/rite-ship` —
109
+ unless `continue_sequence` is armed and sequence budget remains, in which case
110
+ leave the sealed workspace unshipped and open the next recorded continuation
111
+ ([loop.md § Sequence continuation](reference/loop.md#sequence-continuation));
112
+ report the sequence position on every stop.
113
+ With a ship flag, perform Ship preflight, disclose the exact Git plan, and stop for
103
114
  fresh literal `GO` plus native approval. **Completion:** performed no Git action before fresh literal `GO` plus native approval.
104
115
 
105
116
  ## Reply and resume
@@ -19,6 +19,9 @@ max_agents: 32
19
19
  max_minutes: 120
20
20
  max_review_queue: 8
21
21
  expires_at: "<now + 4 hours>"
22
+ # continue_sequence: true # opt-in: chain recorded continuations after Seal GO
23
+ # max_workspaces: 5 # sequence budget when chaining
24
+ # max_parallel: 10 # Build batch cap; 1 = serial (default: eligible, cap 10)
22
25
  # max_tokens: <N>
23
26
  # max_cost_usd: <amount>
24
27
  # notify: "<cmd>"
@@ -63,7 +66,7 @@ Workspace files carry state; chat does not. Read and execute each phase skill:
63
66
  | 3 | `/rite-temper` | harden or reduce; expansion and irreversible risk pause |
64
67
  | 4 | `/rite-define` | approved plan/tasks/traceability |
65
68
  | 5 | `/rite-vet` | every plan; derive mutable budget after READY |
66
- | 6 | `/rite-build` ×N | one pending slice per wright; charge once only after green built state |
69
+ | 6 | `/rite-build` batch loop | largest eligible path-disjoint set (cap 10; serial when <2 eligible); recompute after each integrate; charge once per green built slice |
67
70
  | 7 | `/rite-prove` | all slices built; approved proof; recovery on red |
68
71
  | 8 | `/rite-polish` | re-prove after code edits |
69
72
  | 9 | `/rite-review` | in-scope correction then fresh proof |
@@ -74,6 +77,35 @@ Before advancing, check resource admission and
74
77
  [stop-conditions.md](stop-conditions.md). After source edits, discard stale pass
75
78
  evidence. Re-read the active workspace before each phase.
76
79
 
80
+ ## Sequence continuation
81
+
82
+ With `continue_sequence: true` and sequence budget remaining
83
+ ([sentinel](../../devrites-lib/reference/standards/afk-hitl.md#sequence-continuation-continue_sequence-max_workspaces)),
84
+ step 10 does not end the run: leave the sealed workspace unshipped with its
85
+ `Next step: /rite-ship`, then invoke the next recorded continuation
86
+ (`/rite-spec <parent>-<n> "<objective>"` from the parent's `decisions.md` sequence)
87
+ and re-enter step 1. Spend one workspace per opened continuation.
88
+
89
+ Spend accounting is durable in `state.md` cursors, not chat. Before invoking the
90
+ continuation, ensure the current workspace's `sequence_workspaces_remaining` is
91
+ set — absent, write `max_workspaces - 1` and `sequence_position: 1` first — and
92
+ `> 0`. `/rite-spec` seeds the child's sequence cursor at creation per the
93
+ [continuation contract](../../rite-plan/reference/slicing.md#continuation-workspaces);
94
+ after the child's `state.md` exists, verify it — `sequence_parent` = the current
95
+ slug, `sequence_position` = parent position + 1,
96
+ `sequence_workspaces_remaining` = parent remaining − 1, and — when the recorded
97
+ entry is the sequence's release milestone — `sequence_role: release` (gates then
98
+ require the union manifest). On resume, a child whose
99
+ fields are missing is re-seeded from its `brief.md` parent/position and the
100
+ parent's counter (same values, never a second charge); a child with no recorded
101
+ parent/position is not a sequence member and the chain stops.
102
+
103
+ Stop instead when: no recorded next entry; the cap, expiry, or review-queue bound is
104
+ reached; a human-owned, safety, access, or exhaustion condition fires; or Seal returns
105
+ `NO-GO`. On stop, report the sequence position, the sealed-but-unshipped workspaces, and
106
+ the single release command (`/rite-autocomplete <release milestone> --ship`, or
107
+ `/rite-ship` for the current sealed workspace when the sequence is complete).
108
+
77
109
  ## Backtrack without handing off
78
110
 
79
111
  The active Autocomplete root remains caller whenever a later phase exposes an
@@ -1,22 +1,22 @@
1
1
  ---
2
2
  name: rite-build
3
- description: Build the next approved vertical slice with evidence. HITL one-slice default; AFK may chain serially; opt-in `--parallel N` (2≤N≤10) for path-disjoint worktrees.
3
+ description: Build the next approved vertical slice with evidence. HITL one-slice default; AFK/autocomplete chain serially or in eligible path-disjoint batches (dynamic size, cap 10); `--parallel N` caps a batch.
4
4
  argument-hint: "[--parallel N] [slice number or name]"
5
5
  user-invocable: true
6
6
  ---
7
7
 
8
8
  # /rite-build: one verified slice
9
9
 
10
- Build and prove one slice. HITL stops; a later user invocation starts the next.
11
- Explicit `.devrites/AFK` alone lets the controlling root chain pending slices
12
- serially under green proof, caps, and pause rules. Every wright returns after one slice.
10
+ HITL stops; a later user invocation starts the next slice.
11
+ Explicit `.devrites/AFK` alone lets the controlling root chain under green proof,
12
+ caps and pause rules. Every wright returns after one slice.
13
13
  **Opt-in:** `/rite-build --parallel N` (2≤N≤10; N=1≡serial) follows
14
14
  [`reference/parallel-batch.md`](reference/parallel-batch.md)
15
15
  ([`one-slice-cycle.md`](reference/one-slice-cycle.md)).
16
16
 
17
- Root owns gates/bookkeeping. Fresh
18
- [`devrites-slice-wright`](.omp/agents/devrites-slice-wright.md) writes product
19
- source/tests. Workflow Artifact paths use
17
+ Root owns gates/bookkeeping; fresh
18
+ [`devrites-slice-wright`](.omp/agents/devrites-slice-wright.md) writes source/tests.
19
+ Workflow Artifacts use
20
20
  [`workflow-artifacts.md`](../devrites-lib/reference/standards/workflow-artifacts.md).
21
21
  Execute [`reference/phase-contract.md`](reference/phase-contract.md)
22
22
  ([`one-slice-cycle.md`](reference/one-slice-cycle.md),
@@ -37,7 +37,8 @@ Wright applies anti-slop; root verifies returns and never patches source.
37
37
  multi-writer / root-emulated concurrency forbidden. Native-worktree pilot =
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
- - Never rerun an unchanged check; re-prove after edits.
40
+ - Re-prove affected behavior after edits; reuse observations only under
41
+ [evidence validity](../devrites-lib/reference/candidate-integrity.md#evidence-validity).
41
42
  - Unplanned dependency/design-system/gap/repair → Vet/Spec Drift Guard batch
42
43
  sweep: every contract-assumption violation recorded before one folded
43
44
  repair+vet. Ask only for licensing/cost/security/product or explicit
@@ -57,29 +58,35 @@ Wright applies anti-slop; root verifies returns and never patches source.
57
58
  <!-- workflow-artifact-adapter: {"module":"devrites-lib/reference/standards/workflow-artifacts.md","entry":"Vet-ready admitted bytes require root authorship outside product wright","action":"ROOT_TRANSACTION; root writes only admitted .devrites/** targets","return":"saved Build slice cursor; wright product allowlist unchanged"} -->
58
59
  ## `--parallel N` (opt-in)
59
60
 
60
- Omitted/`1` ≡ serial; `2`–`10` path-disjoint fan-out when eligible; else hard refuse.
61
+ Omitted/`1` ≡ serial; `2`–`10` is a **cap** the root runs the largest eligible
62
+ path-disjoint set it can start now (`N_eff`), takes fewer when the cap cannot be
63
+ filled, and recomputes after every integrate until no pending slice remains
64
+ ([`parallel-batch.md` § Dynamic selection](reference/parallel-batch.md#dynamic-selection-and-re-batching)).
65
+ Unattended runs (`/rite-autocomplete`, `.devrites/AFK` `max_parallel`) repeat batches
66
+ inside the same run; HITL stops after each batch. Non-integer/`N≤0`/`N>10` hard refuse.
61
67
  All-green serial integrate; a red/gap sibling gets a bounded repair round in
62
68
  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` salvages slice
66
- branches before removing worktrees human-gated to abandon a batch,
67
- orchestrator-emitted only as the salvage step of an automatic frozen-lease
68
- re-batch.
69
+ Post-writer inventory and affected rechecks follow `phase-contract.md` § Independent
70
+ Build review; fold accounts before one repair-all wright.
71
+ Plan-owned gaps still route through Spec Drift Guard
72
+ (batch sweep, one folded plan repair + one vet recheck inline); do not emit
73
+ a human `Fix`. Exhausted repair blocks and preserves everything;
74
+ `cleanup --force` salvages slice branches before removing worktrees —
75
+ human-gated to abandon a batch, orchestrator-emitted only as the salvage
76
+ step of an automatic frozen-lease re-batch.
69
77
  AFK charges after integrate only. Running lease blocks another
70
78
  `/rite-build`. Details: `parallel-batch.md`.
71
79
 
72
80
  ## Execute and reply
73
81
 
74
82
  Run every step in `reference/phase-contract.md`: readiness, one target, dispatch
75
- or canonical transaction, return inspection, independent doubt/test analysis,
83
+ or canonical transaction, return inspection, independent code/doubt/test analysis,
76
84
  approved fail-on-red proof, record, AFK accounting, and stop. Use
77
85
  [`reference/output.md`](reference/output.md) plus the shared
78
86
  [`reply contract`](../devrites-lib/reference/reply-contract.md). HITL never starts
79
- the next slice automatically; AFK chains only within its durable remaining
80
- budget; Prove starts only after all slices are built.
87
+ the next slice automatically; AFK obeys remaining budget; Prove requires all slices built.
81
88
 
82
- ## Phase exit (observable)
89
+ ## Phase exit
83
90
 
84
91
  **Complete when:** the dispatched wright returns green proof for the slice,
85
92
  `git diff --name-only` ⊆ allowlist, independent test analysis admits no Critical
@@ -87,7 +87,7 @@ any of:
87
87
  - External-service contract change (webhook payload, partner-facing schema).
88
88
  - Filesystem destructive operation outside the workspace (`rm -rf` of project paths,
89
89
  rewriting `.gitignore`-listed paths, deleting fixtures).
90
- - Anything the slice's `Gate: blocking` plus `tasks.md` `Why HITL:` flags as irreversible.
90
+ - Anything the slice's `Gate: blocking` plus its `Checkpoint:` line in `tasks.md` flags as irreversible.
91
91
 
92
92
  This is the Claude Code auto-mode transcript classifier list adapted to the DevRites
93
93
  workspace.
@@ -7,13 +7,39 @@ Opt-in only. Default `/rite-build` stays [`one-slice-cycle.md`](one-slice-cycle.
7
7
  | Input | Behavior |
8
8
  | --- | --- |
9
9
  | omitted / `--parallel 1` | Serial one-slice |
10
- | `--parallel N` (**2≤N≤10**) | Parallel when eligible + host pass |
10
+ | `--parallel N` (**2≤N≤10**) | N is a **cap**, not a quota: run the largest eligible set N |
11
11
  | non-integer / `N≤0` / `N>10` | Hard refuse (no silent clamp) |
12
+ | Autocomplete, no flag | Same path, cap from sentinel `max_parallel` else 10; serial only when ineligible |
12
13
 
13
- AFK caps `N` by remaining budget. Charge **only after successful integrate**
14
- (once per integrated green sibling). Abort / integrate-failed → **0**. A
15
- present lease is resumable: `/rite-build` continues it (repair rounds or the
16
- blocked verdict); `parallel create` refuses until cleanup.
14
+ AFK caps `N`. Charge green siblings once after integrate; abort /
15
+ integrate-failed → **0**. `parallel create` refuses while a lease exists.
16
+ Reconcile retained repair-round artifacts by exact causal fingerprint before honoring a stored blocked status/verdict. Blocked status, round count, or distinct finding alone cannot stop cold resume: establish missing or stale review coverage under step 4; repair unless a stop condition remains evidenced.
17
+
18
+ ## Dynamic selection and re-batching
19
+
20
+ Size each batch by what is runnable **now**, never by the requested number:
21
+
22
+ ```text
23
+ N_eff = min(
24
+ cap -- --parallel N | sentinel max_parallel | 10 (autocomplete default)
25
+ eligible set -- dependency-satisfied pending slices, pairwise path-disjoint
26
+ AFK headroom -- remaining max_slices, max_agents, max_minutes, review queue
27
+ host capacity -- concurrent worktree writers + the runtime isolation table
28
+ )
29
+ ```
30
+
31
+ Select **greedily in plan order**: walk pending slices whose `depends_on` are built and
32
+ add each one while it stays pairwise disjoint with the selected set and the cap is not
33
+ reached. Then `N_eff ≥ 2` → parallel batch; `N_eff = 1` → the serial one-slice cycle;
34
+ nothing pending → Prove. A cap that cannot be filled is normal: take fewer.
35
+
36
+ **Re-batch automatically.** After integrate + cleanup are green, re-read `state.md`,
37
+ the pending slices (`observe slice`), and the updated tree, then recompute: integrated
38
+ siblings leave the pending set and free their paths, and satisfied dependencies unlock
39
+ new slices. Repeat until no pending slice remains. Under `.devrites/AFK` and
40
+ `/rite-autocomplete` the repeat is part of the same run — a new batch is another
41
+ `/rite-build --parallel` round inside it, not a new user invocation; HITL stops after
42
+ each batch. A batch of three followed by one of four and then two is the expected shape.
17
43
 
18
44
  ## Path-disjoint
19
45
 
@@ -21,7 +47,9 @@ Exact project-relative source/test paths only. Normalize `\`→`/`. Reject `..`,
21
47
  duplicates, absolutes, `.devrites/**`. Empty pairwise intersection required.
22
48
 
23
49
  **SSOT:** `devrites-engine check path-disjoint [--root <dir>] [<json-file>|-]`
24
- (N≥2 only; pass `--root`). Exit `0` → fan-out; else force serial. Inspect-time
50
+ (N≥2 only; pass `--root`). Input is `{"slices":[{"id":"SLICE-002","paths":["src/policy.rs","src/policy/mod.rs"]}]}`
51
+ (or a top-level array) built from each candidate's `Files likely touched`.
52
+ Exit `0` → fan-out; else force serial. Inspect-time
25
53
  overlap → sibling **gap** (a shared path is a contract defect). **Failing
26
54
  case:** two parallel wrights share a path and fan-out proceeds without that
27
55
  check.
@@ -40,14 +68,29 @@ Lease: `batch_id`, `created_at`, `base_sha`, `n`,
40
68
 
41
69
  ## Lifecycle
42
70
 
43
- 1. Orient/gate; parse N; select ≤N path-disjoint pending slices.
71
+ 1. Orient/gate; parse the cap; compute `N_eff` and select the eligible set
72
+ ([Dynamic selection and re-batching](#dynamic-selection-and-re-batching)) —
73
+ candidates from `orient` `task_graph.slices` + built list, each candidate's
74
+ `Files likely touched` via `observe slice`, disjointness via `check path-disjoint`.
44
75
  2. Write lease; freeze `B=HEAD`; `parallel create` worktrees.
45
76
  3. Dispatch ≤10 wrights in parallel (cwd=worktree; allowlist; prove `HEAD==B`).
46
- 4. Inspect + fail-on-red `green|red|gap`. Independent-review Critical is `gap`
47
- even when targeted tests are green.
77
+ 4. Inspect each returned path list, cumulative diff from `B`, transfer identity,
78
+ and required result fields against the immutable contract. Reject malformed,
79
+ stale, or out-of-scope work. Apply
80
+ [independent Build review](phase-contract.md#independent-build-review): first
81
+ full inventory, then bounded owning-role rechecks after repairs. Gap or
82
+ Critical/Important → `gap`; else approved proof → `green|red|gap`.
83
+ Reviewer fan-out for a batch is itself batched under
84
+ [`parallel-dispatch.md`](../../devrites-lib/reference/parallel-dispatch.md#scale-limits)
85
+ (≈4 concurrent read-only reviewers, 8 only with disjoint paths), and `max_agents`
86
+ headroom bounds the batch size — one batch never assumes unbounded reviewers.
48
87
  5. Non-green siblings → **repair round** (below) in the same worktrees; lease
49
88
  stays `running` — no abort while repair budget remains. A green sibling →
50
89
  `parallel record-green`. No partial integrate. All green → integrate.
90
+ A recoverable RED blocks integration but does not cancel independent safe running siblings.
91
+ Expected test-first RED is not a terminal gate failure. Cancel only for a shared
92
+ invalid foundation, safety/access failure, resource boundary, or explicit stop;
93
+ preserve completed and in-progress recoverable work and classify each result.
51
94
  6. Integrate: each `transfer_commit` descends from `B` and diffs path-exact vs
52
95
  `B`; squash-apply all in plan order into one `WIP(<slug>):` commit on the
53
96
  staging branch (Ship collapses it). Conflict → reset to `B`,
@@ -69,46 +112,53 @@ Lease: `batch_id`, `created_at`, `base_sha`, `n`,
69
112
 
70
113
  ## Repair rounds
71
114
 
72
- Rejected work is repaired in place never discarded and rebuilt from scratch
73
- while budget remains.
115
+ Repair rejected work in place; never discard/rebuild while budget remains.
74
116
 
75
- - Record each round as `build-parallel-<batch>-repair-<round>.json`: per
76
- non-green sibling status, verbatim findings, transfer_commit or null.
77
- - Classify first: **implementation defect** (review Critical on the diff, red
78
- wright/proof) repair wright in the same worktree. **Durable-plan defect**
117
+ - Record each round as `build-parallel-<batch>-repair-<round>.json`: each
118
+ non-green sibling's status, verbatim findings, transfer_commit/null.
119
+ - Use step 4's initial inventory or affected recheck as appropriate; never start
120
+ a correction from an early reviewer result while required accounts are pending.
121
+ - Classify the complete inventory: **implementation defect** (review
122
+ Critical/Important on the diff, red wright/proof) → one repair-all wright in
123
+ the same worktree with the full inventory. **Durable-plan defect**
79
124
  (falsified contract assumption, AC unchanged) →
80
125
  [`spec-drift-guard.md`](spec-drift-guard.md): batch-sweep contract
81
126
  assumptions, one folded `/rite-plan repair` + one `/rite-vet` recheck
82
127
  inline, resume repair in the same worktrees under the amended contract;
83
- never emit `Fix:`. **Frozen-lease scope defect** the amended contract or
84
- a review requirement needs paths outside a slice's allowlist, or re-slices
85
- the plan (a lease is immutable once written: its allowlists are the
86
- disjointness guarantee) **automatic re-batch, no human gate**:
87
- `parallel cleanup --force` as the salvage step, record the retained refs in
88
- the repair-round artifact, `parallel create` a fresh batch from control
89
- `HEAD` under the corrected decomposition. Prior attempts stay reachable —
90
- hand each new wright the salvaged branch ref
91
- (`devrites/parallel/<slug>/<old-batch>/<slice>`) so it builds on what worked
92
- instead of starting blind. If no corrected decomposition exists, that is
93
- exhaustion → blocked, preserve, STOP. **Reviewer stall/cancel or missing
128
+ never emit `Fix:`. **Frozen-lease scope defect** (correction needs
129
+ out-of-allowlist paths or re-slicing; lease allowlists are immutable)
130
+ **automatic re-batch, no human gate**: `parallel cleanup --force` salvages
131
+ and records refs; `parallel create` starts from control `HEAD` under the
132
+ corrected decomposition. Give each new wright its salvaged
133
+ `devrites/parallel/<slug>/<old-batch>/<slice>` ref. If the inventory proves the accepted
134
+ approach unsound and no corrected decomposition exists, that is exhaustion
135
+ blocked, preserve, STOP. **Reviewer stall/cancel or missing
94
136
  verdict** → re-dispatch the reviewer, not the wright. **Product/policy/
95
137
  irreversible** → stops for the human.
96
- - Dispatch a fresh `devrites-slice-wright` (cwd = the sibling's worktree, same
97
- allowlist and host rules as step 3 siblings may repair in parallel) with
98
- the original contract + verbatim findings + "preserve what works; fix the
99
- named findings; return a new `transfer_commit`". Never reset the worktree
138
+ - Dispatch one fresh repair-all `devrites-slice-wright` (cwd=worktree; step 3
139
+ rules) with the original contract + complete inventory +
140
+ "preserve what works; fix every finding; **then attack your own correction**
141
+ probe the changed hunks for defects the fix itself introduced (adjacent cases of
142
+ the same rule, new observation/ordering windows, alias or boundary escapes) and
143
+ fold them in before returning; return a new `transfer_commit`". A correction whose
144
+ own diff is unexamined is not ready: a green writer gate plus an unexamined fix is
145
+ how the same defect family reappears one case deeper each round. Never reset
100
146
  to `B` — that destroys the work under repair. The commit must still descend
101
147
  from `B` and diff path-exact vs `B`.
102
- - Each repair return re-runs the full gate chain: inspect, fresh doubt +
103
- test-analysis, approved proof.
104
- - Budget: the shared causal-fingerprint cap three total failed attempts per
105
- sibling per fingerprint (build + repairs count together); a distinct
106
- Critical is a new fingerprint. Exhaustion is not abort: record one
107
- technical blocker (`Status: blocked`; `Next step: none technical recovery
108
- exhausted for <fingerprint>; requires new evidence or changed failure
109
- conditions`), preserve lease/worktrees/branches, STOP same fingerprint
110
- stays blocked on reinvoke; new evidence resumes repair in place. Human-
111
- owned decisions use the drift-guard question and wait.
148
+ - Budget and exhaustion follow only
149
+ [the canonical retry contract](../../devrites-lib/reference/standards/afk-hitl.md#retry-cap-no-progress-loops-and-self-resolve).
150
+ Record one failed invariant, mechanism, reproduction, correction, and decisive
151
+ recheck per fingerprint; never use an umbrella like "covering" or "review is red again".
152
+ - A distinct post-repair Critical/Important gets a new fingerprint: refresh the
153
+ inventory and affected owning-role rechecks. It proves neither plan defect nor
154
+ exhaustion. Use plan path only if inventory proves the approach unsound.
155
+ - Stop under the canonical retry/authority/resource conditions, or when evidence
156
+ proves the approach unsound and no in-scope corrected decomposition exists.
157
+ - Exhaustion is not abort: record one technical blocker (`Status: blocked`;
158
+ `Next step: none — technical recovery exhausted; requires new evidence or changed failure conditions`), preserve
159
+ lease/worktrees/branches, STOP — same fingerprint stays blocked on
160
+ reinvoke; new evidence resumes repair in place. Human-owned decisions use
161
+ the drift-guard question and wait.
112
162
 
113
163
  ## Engine verbs
114
164