devrites 4.2.0 → 4.4.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 (117) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/docs/cli.md +15 -0
  4. package/docs/engine/commands.md +20 -2
  5. package/docs/orchestration.md +6 -3
  6. package/engine/commands.go +1 -1
  7. package/engine/internal/lib/cli_observe.go +66 -0
  8. package/engine/internal/lib/observe_summary.go +79 -0
  9. package/engine/internal/lib/open_visual.go +254 -0
  10. package/engine/internal/lib/open_visual_test.go +280 -0
  11. package/engine/internal/lib/skilltrust.go +196 -0
  12. package/engine/internal/lib/taskgraph.go +162 -0
  13. package/engine/internal/lib/taskgraph_test.go +150 -0
  14. package/engine/internal/lib/visual_outline.go +163 -0
  15. package/engine/internal/lib/visual_outline_test.go +161 -0
  16. package/engine/internal/lib/workspace_read.go +29 -0
  17. package/engine/internal/parallel/cli.go +467 -0
  18. package/engine/internal/parallel/git.go +181 -0
  19. package/engine/internal/parallel/lease.go +244 -0
  20. package/engine/internal/parallel/ops.go +416 -0
  21. package/engine/internal/parallel/parallel_test.go +242 -0
  22. package/engine/internal/parallel/pathdisjoint.go +129 -0
  23. package/engine/internal/parallel/pathdisjoint_test.go +97 -0
  24. package/engine/internal/state/status.go +41 -16
  25. package/engine/main.go +76 -3
  26. package/engine/root_routing_test.go +50 -15
  27. package/engine/testdata/visual/open-visual-smoke.html +675 -0
  28. package/engine/testdata/visual/open-visual-smoke.outline.md +54 -0
  29. package/pack/.claude/skills/devrites-lib/SKILL.md +2 -0
  30. package/pack/.claude/skills/devrites-lib/reference/standards/skill-authoring.md +22 -0
  31. package/pack/.claude/skills/devrites-lib/reference/visual-playbooks/code.md +46 -0
  32. package/pack/.claude/skills/devrites-lib/reference/visual-playbooks/comparison.md +44 -0
  33. package/pack/.claude/skills/devrites-lib/reference/visual-playbooks/diagram.md +53 -0
  34. package/pack/.claude/skills/devrites-lib/reference/visual-playbooks/index.md +57 -0
  35. package/pack/.claude/skills/devrites-lib/reference/visual-playbooks/input.md +47 -0
  36. package/pack/.claude/skills/devrites-lib/reference/visual-playbooks/outline-template.md +106 -0
  37. package/pack/.claude/skills/devrites-lib/reference/visual-playbooks/plan.md +49 -0
  38. package/pack/.claude/skills/devrites-lib/reference/visual-playbooks/slides.md +42 -0
  39. package/pack/.claude/skills/devrites-lib/reference/visual-playbooks/table.md +44 -0
  40. package/pack/.claude/skills/devrites-lib/reference/workspace-artifact-schema.md +24 -9
  41. package/pack/.claude/skills/rite-build/SKILL.md +29 -36
  42. package/pack/.claude/skills/rite-build/reference/afk-discipline.md +19 -25
  43. package/pack/.claude/skills/rite-build/reference/checkpoint-protocol.md +29 -59
  44. package/pack/.claude/skills/rite-build/reference/one-slice-cycle.md +8 -3
  45. package/pack/.claude/skills/rite-build/reference/output.md +2 -0
  46. package/pack/.claude/skills/rite-build/reference/parallel-batch.md +64 -0
  47. package/pack/.claude/skills/rite-build/reference/phase-contract.md +6 -5
  48. package/pack/.claude/skills/rite-build/reference/wright-dispatch.md +7 -3
  49. package/pack/.claude/skills/rite-clarify/reference/anti-patterns.md +24 -0
  50. package/pack/.claude/skills/rite-customize/SKILL.md +3 -2
  51. package/pack/.claude/skills/rite-define/SKILL.md +10 -1
  52. package/pack/.claude/skills/rite-doctor/SKILL.md +5 -1
  53. package/pack/.claude/skills/rite-explain/SKILL.md +23 -7
  54. package/pack/.claude/skills/rite-explain/reference/intake.md +11 -2
  55. package/pack/.claude/skills/rite-plan/reference/dependency-graph.md +3 -0
  56. package/pack/.claude/skills/rite-spec/reference/spec-template.md +5 -2
  57. package/pack/.claude/skills/rite-spec/reference/state-workspace.md +26 -3
  58. package/pack/generated/claude/skills/devrites-lib/SKILL.md +2 -0
  59. package/pack/generated/claude/skills/devrites-lib/reference/standards/skill-authoring.md +22 -0
  60. package/pack/generated/claude/skills/devrites-lib/reference/visual-playbooks/code.md +46 -0
  61. package/pack/generated/claude/skills/devrites-lib/reference/visual-playbooks/comparison.md +44 -0
  62. package/pack/generated/claude/skills/devrites-lib/reference/visual-playbooks/diagram.md +53 -0
  63. package/pack/generated/claude/skills/devrites-lib/reference/visual-playbooks/index.md +57 -0
  64. package/pack/generated/claude/skills/devrites-lib/reference/visual-playbooks/input.md +47 -0
  65. package/pack/generated/claude/skills/devrites-lib/reference/visual-playbooks/outline-template.md +106 -0
  66. package/pack/generated/claude/skills/devrites-lib/reference/visual-playbooks/plan.md +49 -0
  67. package/pack/generated/claude/skills/devrites-lib/reference/visual-playbooks/slides.md +42 -0
  68. package/pack/generated/claude/skills/devrites-lib/reference/visual-playbooks/table.md +44 -0
  69. package/pack/generated/claude/skills/devrites-lib/reference/workspace-artifact-schema.md +24 -9
  70. package/pack/generated/claude/skills/rite-build/SKILL.md +29 -36
  71. package/pack/generated/claude/skills/rite-build/reference/afk-discipline.md +19 -25
  72. package/pack/generated/claude/skills/rite-build/reference/checkpoint-protocol.md +29 -59
  73. package/pack/generated/claude/skills/rite-build/reference/one-slice-cycle.md +8 -3
  74. package/pack/generated/claude/skills/rite-build/reference/output.md +2 -0
  75. package/pack/generated/claude/skills/rite-build/reference/parallel-batch.md +64 -0
  76. package/pack/generated/claude/skills/rite-build/reference/phase-contract.md +6 -5
  77. package/pack/generated/claude/skills/rite-build/reference/wright-dispatch.md +7 -3
  78. package/pack/generated/claude/skills/rite-clarify/reference/anti-patterns.md +24 -0
  79. package/pack/generated/claude/skills/rite-customize/SKILL.md +3 -2
  80. package/pack/generated/claude/skills/rite-define/SKILL.md +10 -1
  81. package/pack/generated/claude/skills/rite-doctor/SKILL.md +5 -1
  82. package/pack/generated/claude/skills/rite-explain/SKILL.md +23 -7
  83. package/pack/generated/claude/skills/rite-explain/reference/intake.md +11 -2
  84. package/pack/generated/claude/skills/rite-plan/reference/dependency-graph.md +3 -0
  85. package/pack/generated/claude/skills/rite-spec/reference/spec-template.md +5 -2
  86. package/pack/generated/claude/skills/rite-spec/reference/state-workspace.md +26 -3
  87. package/pack/generated/codex/skills/devrites-lib/SKILL.md +2 -0
  88. package/pack/generated/codex/skills/devrites-lib/reference/standards/skill-authoring.md +22 -0
  89. package/pack/generated/codex/skills/devrites-lib/reference/visual-playbooks/code.md +46 -0
  90. package/pack/generated/codex/skills/devrites-lib/reference/visual-playbooks/comparison.md +44 -0
  91. package/pack/generated/codex/skills/devrites-lib/reference/visual-playbooks/diagram.md +53 -0
  92. package/pack/generated/codex/skills/devrites-lib/reference/visual-playbooks/index.md +57 -0
  93. package/pack/generated/codex/skills/devrites-lib/reference/visual-playbooks/input.md +47 -0
  94. package/pack/generated/codex/skills/devrites-lib/reference/visual-playbooks/outline-template.md +106 -0
  95. package/pack/generated/codex/skills/devrites-lib/reference/visual-playbooks/plan.md +49 -0
  96. package/pack/generated/codex/skills/devrites-lib/reference/visual-playbooks/slides.md +42 -0
  97. package/pack/generated/codex/skills/devrites-lib/reference/visual-playbooks/table.md +44 -0
  98. package/pack/generated/codex/skills/devrites-lib/reference/workspace-artifact-schema.md +24 -9
  99. package/pack/generated/codex/skills/rite-build/SKILL.md +29 -36
  100. package/pack/generated/codex/skills/rite-build/reference/afk-discipline.md +19 -25
  101. package/pack/generated/codex/skills/rite-build/reference/checkpoint-protocol.md +29 -59
  102. package/pack/generated/codex/skills/rite-build/reference/one-slice-cycle.md +8 -3
  103. package/pack/generated/codex/skills/rite-build/reference/output.md +2 -0
  104. package/pack/generated/codex/skills/rite-build/reference/parallel-batch.md +64 -0
  105. package/pack/generated/codex/skills/rite-build/reference/phase-contract.md +6 -5
  106. package/pack/generated/codex/skills/rite-build/reference/wright-dispatch.md +7 -3
  107. package/pack/generated/codex/skills/rite-clarify/reference/anti-patterns.md +24 -0
  108. package/pack/generated/codex/skills/rite-customize/SKILL.md +3 -2
  109. package/pack/generated/codex/skills/rite-define/SKILL.md +10 -1
  110. package/pack/generated/codex/skills/rite-doctor/SKILL.md +5 -1
  111. package/pack/generated/codex/skills/rite-explain/SKILL.md +23 -7
  112. package/pack/generated/codex/skills/rite-explain/reference/intake.md +11 -2
  113. package/pack/generated/codex/skills/rite-plan/reference/dependency-graph.md +3 -0
  114. package/pack/generated/codex/skills/rite-spec/reference/spec-template.md +5 -2
  115. package/pack/generated/codex/skills/rite-spec/reference/state-workspace.md +26 -3
  116. package/package.json +1 -1
  117. package/scripts/install-lib.sh +1 -1
@@ -0,0 +1,49 @@
1
+ # Visual playbook: plan
2
+
3
+ ## use_when
4
+
5
+ Explain a product or technical plan before implementation — PRD-style approach, technical design, implementation proposal, or pre-build walkthrough that benefits from layout over prose alone.
6
+
7
+ Use a lighter `comparison` or `diagram` playbook alone when the plan is only one small design choice.
8
+
9
+ ## Structure / landmarks / stable ids
10
+
11
+ | Landmark | Suggested `id` | Role |
12
+ | --- | --- | --- |
13
+ | Goal | `plan-goal` | Desired outcome |
14
+ | Current state | `plan-current` | What exists today |
15
+ | Desired behavior | `plan-desired` | Target behavior |
16
+ | Approach | `plan-approach` | High-level proposal |
17
+ | Risks | `plan-risks` | Failure modes / migration / compat |
18
+ | Open questions | `plan-questions` | Unresolved; clear when answered |
19
+ | Options (optional) | `plan-options` | Follow [`comparison.md`](comparison.md) |
20
+
21
+ A plan should be self-contained enough that another developer could implement from it. Verify claims against the codebase before stating them as fact.
22
+
23
+ When frontend UX matters, prefer a visual mock of the experience under a consistent local design (CSS in-page) over text-only description.
24
+
25
+ ## design_rules
26
+
27
+ - Portable single-file HTML; self-contained CSS preferred.
28
+ - Cite real repo paths for architecture claims (outline `## Citations`).
29
+ - Update the plan when questions resolve — do not leave stale open questions that are already decided.
30
+ - Nest other playbooks' surfaces (diagram / comparison / table) with their own stable ids.
31
+ - CDN only when nested Mermaid / diff surfaces need it; note in outline.
32
+ - Explicit background / color-scheme; semantic landmarks.
33
+
34
+ ## Pitfalls / anti-patterns
35
+
36
+ - Focusing only on ambiguous decisions and omitting the actual proposal.
37
+ - Omitting failure modes, migration, or backwards-compatibility concerns.
38
+ - Leaving resolved questions in the artifact as if still open.
39
+ - Treating Lavish annotation as required for plan review.
40
+ - HTML without outline companion.
41
+
42
+ ## DevRites notes
43
+
44
+ - **Home:** `.devrites/work/<slug>/visual/<name>.html` + `<name>.outline.md`.
45
+ - Does **not** replace workspace `plan.md` / `spec.md` — optional richer presentation beside them.
46
+ - Outline: [`outline-template.md`](outline-template.md); **outline wins** on conflict.
47
+ - Open questions may point into workspace `questions.md` ids; durable answers belong there and/or outline `## Answers` if `input` was used.
48
+ - **No new lifecycle phase.**
49
+ - Router: [`index.md`](index.md).
@@ -0,0 +1,42 @@
1
+ # Visual playbook: slides
2
+
3
+ ## use_when
4
+
5
+ **Only** when the user asks for a deck, presentation, talk, or paced walkthrough. Default to a scroll page (`plan`, `diagram`, `comparison`, …) for reference material, detailed review, or dense evidence.
6
+
7
+ ## Structure / landmarks / stable ids
8
+
9
+ | Landmark | Suggested `id` | Role |
10
+ | --- | --- | --- |
11
+ | Deck root | `slides-root` | Container / scroll-snap or section stack |
12
+ | Slide N | `slide-<n>` | One idea per slide |
13
+ | Deck nav (optional) | `slides-nav` | Prev/next or index |
14
+ | Closing slide | `slide-close` | Decision or next action |
15
+
16
+ Plan the story before markup: open with the point → context → evidence → decision/next action. Vary composition so consecutive slides do not feel like identical cards unless repetition is intentional.
17
+
18
+ ## design_rules
19
+
20
+ - Sparse text; let visuals carry explanation.
21
+ - Large type, strong alignment, deliberate whitespace — not dense paragraphs.
22
+ - Make navigation and screen-size assumptions explicit (e.g. "designed for 16:9 presenter view").
23
+ - Prefer self-contained CSS (scroll-snap sections or simple slide panes). CDN only if nested Mermaid/diff needs it; note in outline.
24
+ - Stable `id` on every slide for outline inventory and deep links.
25
+ - Explicit background / color-scheme on the page and each slide.
26
+
27
+ ## Pitfalls / anti-patterns
28
+
29
+ - Turning every explainer into slides by default.
30
+ - Pasting a scroll-page outline into fixed frames without rewriting the narrative.
31
+ - Dense code review inside slides — use [`code.md`](code.md) on a scroll page instead.
32
+ - Requiring Lavish runtime for advancement or feedback.
33
+ - HTML without outline companion.
34
+
35
+ ## DevRites notes
36
+
37
+ - **Home:** `.devrites/work/<slug>/visual/<name>.html` + `<name>.outline.md`.
38
+ - Outline: [`outline-template.md`](outline-template.md); list each `slide-<n>` in ID inventory with its one idea.
39
+ - **Outline wins** on conflict.
40
+ - Feedback/choices on a deck still use [`input.md`](input.md) → outline `## Answers` / `questions.md`, not Lavish queue APIs.
41
+ - **No new phase**; optional; not readiness-required.
42
+ - Router: [`index.md`](index.md).
@@ -0,0 +1,44 @@
1
+ # Visual playbook: table
2
+
3
+ ## use_when
4
+
5
+ Turn dense records that share the same fields into a scan-friendly review surface (status matrices, coverage grids, inventory with comparable columns).
6
+
7
+ ## Structure / landmarks / stable ids
8
+
9
+ | Landmark | Suggested `id` | Role |
10
+ | --- | --- | --- |
11
+ | Summary | `table-summary` | What the rows prove or require |
12
+ | Primary table | `table-main` | Semantic `<table>` for comparable rows |
13
+ | Row groups | `table-group-<slug>` | Optional thematic sections |
14
+ | Footer notes | `table-notes` | Caveats, filters, open questions |
15
+
16
+ Stable ids: put `id` on the table and on important rows (`tr id="row-…"`) when a row is a decision target. Mirror row ids in the outline inventory when they matter.
17
+
18
+ Column groups should follow the decision they support: identity → evidence → status → action.
19
+
20
+ ## design_rules
21
+
22
+ - Use semantic `<table>` / `<thead>` / `<tbody>` / `<th scope>` when data is tabular.
23
+ - Lead with a short summary (counts, risk levels, verdicts) above the grid.
24
+ - Protect long paths, symbols, and URLs from overflow (`overflow-wrap`, narrow-viewport friendly).
25
+ - Restrained color for status/severity; never color as the only signal (pair with text).
26
+ - Prefer self-contained CSS; no CDN required for tables.
27
+ - Explicit page background / color-scheme; landmarks with stable ids.
28
+
29
+ ## Pitfalls / anti-patterns
30
+
31
+ - Pasting a terminal table into HTML unchanged.
32
+ - Hiding the conclusion under a large undifferentiated grid.
33
+ - Using cards when rows share fields (or tables when shapes differ wildly — use cards then).
34
+ - Lavish row-queue / annotation APIs as requirements.
35
+ - HTML without outline companion.
36
+
37
+ ## DevRites notes
38
+
39
+ - **Home:** `.devrites/work/<slug>/visual/<name>.html` + `<name>.outline.md`.
40
+ - Outline: [`outline-template.md`](outline-template.md); cite this id under Playbooks used.
41
+ - **Outline wins** on HTML/outline conflict.
42
+ - Prefer linking dense evidence from existing artifacts (`traceability.md`, `test-plan.md`) rather than duplicating whole files into the visual.
43
+ - **No new phase**; optional; not readiness-required.
44
+ - Router: [`index.md`](index.md).
@@ -31,7 +31,7 @@ Readers continue to accept safe legacy basenames; no ordinary phase renames one.
31
31
  | 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
32
  | prove/polish/review | vetted plan artifacts plus `evidence.md`, `touched-files.md` |
33
33
  | seal/ship/done | proof artifacts plus `review.md`, `seal.md` |
34
- | conditional | `flows.md` when diagrams clarify; `design-brief.md` and `browser-evidence.md` for UI; `drift.md` for drift; `handoff.md` only when requested; `references.md` + `references/` when references exist |
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; `handoff.md` only when requested; `references.md` + `references/` when references exist |
35
35
 
36
36
  ## What each file owns
37
37
 
@@ -44,6 +44,9 @@ Readers continue to accept safe legacy basenames; no ordinary phase renames one.
44
44
  | `strategy.md` | temper verdict, scope mode/deltas, pre-mortem risks, deferred ambition | 180 lines |
45
45
  | `architecture.md` | owning layer, integration points, data/API/events, dependencies, risks, affected boundaries | 180 lines |
46
46
  | `flows.md` | useful Mermaid sequence/state/data/lifecycle diagrams with why-it-matters text and related IDs | 160 lines |
47
+ | `visual/<name>.html` | optional portable human-viewable visualization; pair with sibling `.outline.md`; self-contained preferred | 400 lines |
48
+ | `visual/<name>.outline.md` | required machine dual-read companion for the sibling HTML; outline wins on conflict; never a candidate path | 200 lines |
49
+ | `visual/README.md` | optional index of visuals in the workspace | 80 lines |
47
50
  | `decisions.md` | ADR-style `DEC-###` log: status, context, options, decision, consequences, related IDs | 200 lines |
48
51
  | `assumptions.md` | assumptions with confidence, owner, validation status | 160 lines |
49
52
  | `questions.md` | current `q-YYYY-MM-DD-NNN` (or released `Q-###`) open/resolved questions, gate, answer, impact | 180 lines |
@@ -60,6 +63,11 @@ Readers continue to accept safe legacy basenames; no ordinary phase renames one.
60
63
  | `design-brief.md` | UI design direction, states, interaction model | 160 lines |
61
64
  | `handoff.md` | cold-resume guide: current objective, last completed slice, next action, blockers, read-next links | 120 lines |
62
65
 
66
+ When emitting `visual/` HTML+outline pairs, open matching playbooks via
67
+ [`visual-playbooks/index.md`](visual-playbooks/index.md) (progressive load; do not
68
+ preload all seven). Required outline headings:
69
+ [`visual-playbooks/outline-template.md`](visual-playbooks/outline-template.md).
70
+
63
71
  ## Candidate manifest and bindings
64
72
 
65
73
  `touched-files.md` contains exactly one `## Touched files` heading and exactly
@@ -88,12 +96,14 @@ candidate scope; only manifest rows do.
88
96
  The public candidate limits are a 1 MiB manifest, 4,096 rows, a 4,096-byte
89
97
  path, 64 MiB per present file, and 256 MiB across all present files.
90
98
 
91
- Workspace and audit artifacts are not candidate paths. Durable project files
92
- include `.devrites/specs/**`, `DESIGN.md`, and `docs/adr/**`, plus the exact
93
- `.devrites/principles.md` owner. Under `.devrites`, only those principles and
94
- spec owners may be candidates; `ACTIVE`, `AFK`, `CHECKPOINT`, `archive/**`,
95
- `work/**`, and every other sibling fail closed. Engine owns malformed path,
96
- type, and size rejection; phases do not reinterpret a rejected manifest.
99
+ Workspace and audit artifacts are not candidate paths. That includes every path
100
+ under `.devrites/work/<slug>/visual/` (HTML, `.outline.md`, and optional
101
+ `visual/README.md`). Durable project files include `.devrites/specs/**`,
102
+ `DESIGN.md`, and `docs/adr/**`, plus the exact `.devrites/principles.md` owner.
103
+ Under `.devrites`, only those principles and spec owners may be candidates;
104
+ `ACTIVE`, `AFK`, `CHECKPOINT`, `archive/**`, `work/**`, and every other sibling
105
+ fail closed. Engine owns malformed path, type, and size rejection; phases do
106
+ not reinterpret a rejected manifest.
97
107
 
98
108
  `evidence.md`, `review.md`, and `seal.md` each contain exactly one unindented standalone
99
109
  binding line; `browser-evidence.md` does too when that file exists:
@@ -122,7 +132,9 @@ The digest binds reviewed bytes; it never substitutes for semantic review. Norma
122
132
  checks structure plus that binding, and Seal rechecks it.
123
133
 
124
134
  Proof commands must be repository-portable: no host wrappers, user-specific absolute paths,
125
- or temporary proof trees. Evidence records the executed command.
135
+ or temporary proof trees. Evidence records the executed command. Optional `visual/`
136
+ artifacts never inflate readiness: they are not readiness inputs and do not substitute
137
+ for `decision-coverage.md`, `eng-review.md`, or `test-plan.md`.
126
138
 
127
139
  ## Canonical slice grammar
128
140
 
@@ -186,7 +198,9 @@ unless the stated reason makes the boundary irreducible.
186
198
  - Do not copy acceptance criteria into `plan.md`; reference `AC-###`.
187
199
  - Do not copy full proof into `handoff.md`; link to `evidence.md`.
188
200
  - Do not make `state.md` an append-only log; keep only the current cursor.
189
- - Do not create optional files before their phase; absence is meaningful.
201
+ - Do not create optional files before their phase; absence is meaningful. Do not
202
+ treat `visual/` as required for readiness; emit HTML+outline only when a writer
203
+ earns a richer visual, and keep Mermaid in `flows.md` when that is enough.
190
204
 
191
205
  ## ID contract
192
206
 
@@ -209,3 +223,4 @@ append-only identities, not display positions:
209
223
  Old `AC1` and `Slice 1` forms are legacy and should not be generated for new
210
224
  workspaces. Preserve released legacy forms unless an explicit upgrade owns the
211
225
  migration; never renumber them incidentally.
226
+
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: rite-build
3
- description: Build the next approved vertical slice with evidence. HITL stops after one; explicit AFK may chain bounded green slices.
4
- argument-hint: "[slice number or name]"
3
+ description: Build the next approved vertical slice with evidence. HITL one-slice default; AFK may chain serially; opt-in `--parallel N` (2≤N≤3) for path-disjoint worktrees.
4
+ argument-hint: "[--parallel N] [slice number or name]"
5
5
  user-invocable: true
6
6
  ---
7
7
 
@@ -9,8 +9,9 @@ user-invocable: true
9
9
 
10
10
  Build and prove one slice. HITL stops; a later user invocation starts the next.
11
11
  Explicit `.devrites/AFK` alone lets the controlling root chain pending slices
12
- under green proof, caps, and pause rules. Every wright returns after it. Read the
13
- active workspace first; without one, route `/rite-spec <feature>`.
12
+ serially under green proof, caps, and pause rules. Every wright returns after it.
13
+ **Opt-in:** `/rite-build --parallel N` (2≤N≤3; N=1≡serial) follows
14
+ [`reference/parallel-batch.md`](reference/parallel-batch.md).
14
15
 
15
16
  Root owns gates/bookkeeping. Fresh
16
17
  [`devrites-slice-wright`](../../agents/devrites-slice-wright.md) writes product
@@ -21,45 +22,37 @@ Execute [`reference/phase-contract.md`](reference/phase-contract.md); dispatch u
21
22
 
22
23
  ## Required rules
23
24
 
24
- Read `.claude/skills/devrites-lib/reference/standards/core.md` first. Load only
25
- rules triggered by the slice:
26
-
27
- - coding style, error handling, testing, [`reference/tdd.md`](reference/tdd.md),
28
- patterns, and definition of done;
29
- - binding `.devrites/principles.md` invariants when present;
30
- - security for input/auth/data/integrations;
31
- - repository topology for multiple roots/languages or generated/vendor surfaces;
32
- - data integrity for durable state, migration, concurrency, tenancy, or retention;
33
- - integration reliability for API/webhook/queue/job/cache/service boundaries.
34
-
35
- The wright also applies the canonical anti-slop list. Root verifies its return;
36
- it never patches source itself.
25
+ Read `.claude/skills/devrites-lib/reference/standards/core.md` first. Load only triggered rules:
26
+ coding/error/testing/[`tdd.md`](reference/tdd.md)/patterns/DoD; binding
27
+ `.devrites/principles.md`; security; topology; data integrity; integration reliability.
28
+ Wright applies anti-slop; root verifies returns and never patches source.
37
29
 
38
30
  ## Invariants
39
31
 
40
- - One slice per wright dispatch; writers are serial. Use the native-worktree pilot
41
- only when `wright-dispatch.md`'s clean preflight and reconciliation both hold,
42
- otherwise serial same-worktree writing.
43
- - Exact feature scope only. Record adjacent issues and Things I didn't touch;
44
- reject any returned diff outside the task's explicit source/test paths.
45
- - Never rerun an unchanged check. Re-prove after edits.
46
- - Unplanned dependency, design system, objective technical gap, or repair stays
47
- inside Vet/Spec Drift Guard. Ask only for licensing/cost/security/product or
48
- explicit architecture-policy decisions.
49
- - Root never edits product source/tests. It writes canonical `.devrites/`
50
- bookkeeping and applies the Workflow Artifact route only. The supported host's
51
- wright is sole product writer. Put exact project-relative paths directly in the
52
- task; compare returned file list and `git diff --name-only`; extras hard-stop.
53
- - Project principles are binding. An unavoidable conflict or irreversible risk
54
- needs a human-approved scoped exception or stop, never silent balancing.
55
- - Evidence beats confidence. Never weaken a failing test, skip TDD, widen a
56
- writer, or self-approve a wright return. Route drift through
57
- [`reference/spec-drift-guard.md`](reference/spec-drift-guard.md); checkpoint
58
- mode follows [`reference/checkpoint.md`](reference/checkpoint.md).
32
+ - Default: one slice; writers serial on control. Parallel only via `--parallel N`
33
+ under [`reference/parallel-batch.md`](reference/parallel-batch.md). Same-worktree
34
+ multi-writer / root-emulated concurrency forbidden. Native-worktree pilot =
35
+ single-slice isolation when `wright-dispatch.md` preflight + reconcile hold.
36
+ - Exact feature scope only; reject out-of-allowlist diffs; record adjacent issues.
37
+ - Never rerun an unchanged check; re-prove after edits.
38
+ - Unplanned dependency/design-system/gap/repair Vet/Spec Drift Guard. Ask only
39
+ for licensing/cost/security/product or explicit architecture-policy decisions.
40
+ - Root never edits product source/tests (`.devrites/` + Workflow Artifact only).
41
+ Wright is sole product writer; extras in returned paths/`git diff --name-only` hard-stop.
42
+ - Principles bind; irreversible conflict needs human exception or stop.
43
+ - Evidence beats confidence. Never weaken tests, skip TDD, widen writers, or
44
+ self-approve. Drift [`spec-drift-guard.md`](reference/spec-drift-guard.md);
45
+ checkpoint [`checkpoint.md`](reference/checkpoint.md).
59
46
 
60
47
  ## Workflow Artifact branch
61
48
 
62
49
  <!-- 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"} -->
50
+ ## `--parallel N` (opt-in)
51
+
52
+ Omitted/`1` ≡ serial; `2`/`3` → path-disjoint fan-out when eligible; else hard refuse.
53
+ All-green serial integrate; one red/gap aborts. AFK charges after integrate only.
54
+ Running lease blocks another `/rite-build`. Details: `parallel-batch.md`.
55
+
63
56
  ## Execute and reply
64
57
 
65
58
  Run every step in `reference/phase-contract.md`: readiness, one target, dispatch
@@ -8,16 +8,8 @@ Load the shared
8
8
  contract for the sentinel schema, defaults, gate ceiling, and mutable-counter
9
9
  ownership. This file owns only Build's dispatch, charging, and red-path behavior.
10
10
 
11
- These rules follow established autonomous-coding loops, including Ralph Wiggum and
12
- Claude Code auto mode:
13
-
14
- 1. **Require green feedback.** Tests, types, and lint must pass before a slice is
15
- marked `built`.
16
- 2. **Cap iterations.** `max_slices` is the hard limit.
17
- 3. **Run gates before the action they control.** A post-action gate is only a review
18
- queue.
19
- 4. **Keep irreversible work manual.** Destructive work, auth boundaries, and public
20
- API breaks always pause regardless of the sentinel.
11
+ Rules: green before `built`; hard `max_slices` cap; gates before the action they
12
+ control; irreversible work (destructive/auth/public API) always pauses.
21
13
 
22
14
  ## Iteration cap
23
15
 
@@ -41,32 +33,33 @@ The controlling root owns the cap:
41
33
  A controlling orchestrator may pre-seed the remaining field from a validated
42
34
  post-plan budget before the first dispatch; never increase or reinitialize an
43
35
  existing value.
44
- 3. **Charge exactly once after each green built slice.** A slice already marked
45
- built is not charged again after retry, resume, or compaction. Re-read the
46
- saved cursor; if it is zero, report the cap and stop before the next
47
- dispatch.
36
+ 3. **Charge exactly once after each green built slice.** On the control tree, a slice
37
+ already marked built is not charged again after retry, resume, or
38
+ compaction. Re-read the saved cursor; if it is zero, report the cap and stop
39
+ before the next dispatch.
40
+ - **Serial:** charge when fail-on-red is green and the built record is written
41
+ (same rewrite as step 2).
42
+ - **Parallel `--parallel`:** charge only after **successful serial integrate**
43
+ — once per integrated green sibling. Abort / integrate-failed → charge **0**.
44
+ Do not charge on worktree-green before integrate. See
45
+ [`parallel-batch.md`](parallel-batch.md).
48
46
 
49
47
  Use this stop message:
50
48
 
51
- ```
49
+ ```text
52
50
  AFK cap reached. Raise `state.md` `AFK slices remaining` or remove the sentinel to continue.
53
51
  ```
54
52
 
55
53
  `max_slices` itself is read-only and never rewritten. No exit-code command
56
54
  enforces this policy.
57
55
 
58
- Choose a missing or large cap deliberately. Ralph's rule is 5-10 iterations for small
59
- tasks and 30-50 for larger ones. Do not use `unlimited` for work that has not completed
60
- successfully in HITL.
56
+ Choose caps deliberately (≈5–10 small, ≈30–50 larger). Avoid `unlimited` until HITL
57
+ has succeeded for the work.
61
58
 
62
59
  ## Fail-on-red
63
60
 
64
- The **fail-on-red step** (workflow step 5) refuses to mark a slice `built` if targeted
65
- tests, types, or lint are red:
66
-
67
- - A red signal means either the slice's contract is wrong or the implementation/proof path is.
68
- The slice cannot advance, but an objective root cause is agent-owned recovery work.
69
- - Marking it `built` would let the next slice build on broken state.
61
+ The **fail-on-red step** refuses `built` when targeted tests/types/lint are red. Red means
62
+ wrong contract or proof path — agent-owned recovery; never advance on broken state.
70
63
 
71
64
  The fail-on-red path:
72
65
 
@@ -105,7 +98,7 @@ The hook is a single shell command run on the `awaiting_human` transition. Envir
105
98
  the hook receives:
106
99
 
107
100
  | Var | Value |
108
- |---|---|
101
+ | --- | --- |
109
102
  | `DEVRITES_QID` | the new qid (e.g. `q-2026-05-28-001`) |
110
103
  | `DEVRITES_GATE` | `advisory` / `validating` / `blocking` / `escalating` |
111
104
  | `DEVRITES_SLICE` | `<N — name>` |
@@ -117,6 +110,7 @@ The hook is best effort: a non-zero exit does **not** roll back the pause. Failu
117
110
  logged to `evidence.md` so the user sees them on return.
118
111
 
119
112
  Example targets:
113
+
120
114
  - `curl -d "$DEVRITES_QID: $DEVRITES_QUESTION" ntfy.sh/my-topic`
121
115
  - `osascript -e "display notification \"$DEVRITES_QUESTION\" with title \"DevRites: $DEVRITES_GATE\""`
122
116
  - `pb push "$DEVRITES_SLUG: $DEVRITES_QUESTION"` (via pushbullet CLI)
@@ -1,29 +1,22 @@
1
1
  # Checkpoint protocol: what `/rite-build` does when a slice is HITL
2
2
 
3
- When `/rite-build` reaches a slice with `Mode: HITL`, it does **not** start writing code. It
4
- surfaces the checkpoint as a ranked **option set** and resolves it **before** any code lands:
3
+ HITL slices pause **pre-action** as a ranked **option set** before any code:
5
4
 
6
- - **Human present (interactive):** ask inline via `AskUserQuestion` (the option set below).
7
- The human picks; record the pick to `questions.md` (`answered`) + `decisions.md`, clear the
8
- gate, and **continue building in place**: no STOP, no `/rite-resolve` round-trip.
9
- - **Human absent / AFK-pausing / notify-only:** persist the checkpoint (`questions.md` open +
10
- `state.md` `Awaiting human`), fire the `notify:` hook, and **stop**. Resume later via
11
- `/rite-resolve` (or `--batch`).
12
-
13
- Either way the pause is **pre-action**, not post-action: code never lands before the gate.
5
+ - **Interactive:** `AskUserQuestion`; record to `questions.md`/`decisions.md`; clear gate;
6
+ continue in place (no `/rite-resolve` round-trip).
7
+ - **Absent / AFK / notify-only:** persist open question + `Awaiting human`, notify, **stop**.
8
+ Resume via `/rite-resolve` (or `--batch`).
14
9
 
15
10
  ## Render contract
16
11
 
17
- The checkpoint must be rendered in user-facing output **and** persisted to the workspace.
18
- Both are required: the output is for the human in the room (or the notification target),
19
- the persisted form is for the next session or the AFK observer.
12
+ Render the checkpoint in user-facing output **and** persist it for the next session / AFK
13
+ observer.
20
14
 
21
15
  ### User-facing render: the option set
22
16
 
23
- Present the checkpoint as an `AskUserQuestion` with a ranked **option set**
24
- (`afk-hitl.md` "Option set"): 2-4 options, **recommended first** + labelled `(Recommended)`,
25
- each option's description carrying the dimension-tagged rationale + the trade-off it accepts,
26
- plus the escape hatch. The header names the slice + gate:
17
+ Present as `AskUserQuestion` ranked **option set** (`afk-hitl.md`): 2–4 options,
18
+ recommended first + `(Recommended)`, dimension-tagged trade-offs, plus escape hatch.
19
+ Header names slice + gate:
27
20
 
28
21
  ```
29
22
  Slice <N — name> — HITL (<gate>, SLA <SLA>). <Checkpoint text from tasks.md>
@@ -35,12 +28,9 @@ Slice <N — name> — HITL (<gate>, SLA <SLA>). <Checkpoint text from tasks.md>
35
28
  4. Something else — I'll describe it
36
29
  ```
37
30
 
38
- The recommended option (#1) is **required**: a checkpoint without a recommendation is a worse
39
- interrupt than one with shape; the human reacts to a ranked draft faster than to a blank prompt
40
- (the "give the human something to approve" rule). The recommendation reflects *this* project
41
- (its conventions, stack, scale), not a generic default. On an interactive pick, resolve in
42
- place; when persisting a pause instead, the same set is written to `questions.md` `options:`
43
- and the resume line is `/rite-resolve <qid> "<answer>"` (or `--drop <qid> "<reason>"`).
31
+ Option #1 (recommended) is **required** and must reflect *this* project. Interactive pick
32
+ resolve in place; pause persist the same set to `questions.md` `options:` with resume
33
+ `/rite-resolve <qid> "<answer>"` (or `--drop <qid> "<reason>"`).
44
34
 
45
35
  ### Workspace mutations
46
36
 
@@ -93,9 +83,7 @@ rewrite; do not claim cross-file atomicity):
93
83
  sh -c "$notify_cmd"
94
84
  ```
95
85
 
96
- The hook fires after the workspace write so the notification target sees a workspace
97
- that already records the pause. Failures in the hook **do not** roll back the pause:
98
- the gate is authoritative; the notification is best-effort.
86
+ Fire after workspace write. Hook failure does **not** roll back the pause (best-effort).
99
87
 
100
88
  ## qid generation
101
89
 
@@ -109,42 +97,24 @@ reservation or engine command for qids.
109
97
 
110
98
  ## When AFK is active
111
99
 
112
- If `.devrites/AFK` exists and the slice's `Gate` is in `allow_gates`, `/rite-build` does
113
- **not** invoke the checkpoint protocol. Instead:
114
-
115
- - For `advisory`: log a `gate: advisory` entry to `questions.md`, record the trade-off in
116
- `decisions.md`, and **dispatch the wright** to build the slice (workflow step 3).
117
- - For `validating` (only when `allow_gates` includes it): **dispatch the wright** (step 3); on
118
- return, write a `gate: validating` entry to `questions.md`, mark the slice
119
- `built (pending review)` in `state.md`, and continue. A slice's only states are `pending` and `built`:
120
- acceptance is proven at the **feature** level by `/rite-prove` (recorded in
121
- `evidence.md`), not per slice. The `built (pending review)` slice is not done until the
122
- open `validating` gate resolves via `/rite-resolve`; an open `validating` gate is a
123
- NO-GO at seal.
124
-
125
- For gates in `allow_gates`, AFK **auto-picks the recommended option** (option 1 of the set)
126
- instead of pausing, recording it as above. For `blocking` and `escalating` (and every
127
- irreversible-risk item), AFK **always** invokes the checkpoint protocol: the sentinel does
128
- not unlock these gates and no AFK key can override them. See `afk-discipline.md`
129
- for the irreversible-risk list.
100
+ If `.devrites/AFK` exists and the slice `Gate` is in `allow_gates`, skip this protocol and
101
+ auto-pick recommended option 1:
102
+
103
+ - `advisory`: log `gate: advisory` + `decisions.md`, then dispatch wright.
104
+ - `validating` (only if allowed): dispatch wright; on return log `gate: validating`, mark
105
+ `built (pending review)`, continue. Slice states remain `pending|built`; feature
106
+ acceptance is `/rite-prove`. Open `validating` is NO-GO at seal until `/rite-resolve`.
107
+
108
+ `blocking` / `escalating` / irreversible-risk always use this protocol (`afk-discipline.md`).
130
109
 
131
110
  ## Multi-question pauses
132
111
 
133
- The current protocol is **one question per pause**. If a slice has multiple HITL
134
- checkpoints, split it into sub-slices via `/rite-plan reslice` so each pause is
135
- single-question. Multi-question pauses are reserved future shape; `Awaiting human` is
136
- written as a single block.
112
+ **One question per pause.** Multiple HITL checkpoints `/rite-plan reslice`.
137
113
 
138
114
  ## What NOT to do
139
115
 
140
- - **Don't write code first and pause after.** The pre-action rule is the whole point.
141
- - **Don't render the checkpoint without persisting.** Output without `state.md` + `questions.md`
142
- updates means the workspace lies on `/clear`.
143
- - **Don't self-answer a question that *paused* for a human.** When a gate stopped the session
144
- (an AFK queue, or a HITL pause the human walked away from), `/rite-resolve` requires an
145
- explicit answer: the agent doesn't confirm its own `proposed:` on resume. This is distinct
146
- from the two legitimate auto-resolutions: an interactive `AskUserQuestion` pick the human
147
- just made, and an AFK auto-pick of the recommended option on a gate `allow_gates` permits.
148
- - **Don't bundle the `notify:` hook output into chat.** Fire-and-forget; the chat already
149
- has the user-facing render.
150
- - **Don't fire `notify:` on `advisory`-downgraded entries.** It's reserved for true pauses.
116
+ - Don't write code then pause pre-action only.
117
+ - Don't render without persisting `state.md` + `questions.md`.
118
+ - Don't self-answer a human pause via `proposed:` — `/rite-resolve` needs an explicit
119
+ answer (distinct from interactive pick / AFK auto-pick on `allow_gates`).
120
+ - Don't put `notify:` output in chat; don't fire `notify:` on advisory-only entries.
@@ -3,11 +3,14 @@
3
3
  One wright dispatch builds one thin, proven slice. HITL stops; only explicit
4
4
  `.devrites/AFK` lets the controlling root chain another pending slice under the
5
5
  green-proof, cap, and pause rules. Each wright returns after exactly one slice.
6
+ Opt-in fan-out: [`parallel-batch.md`](parallel-batch.md) (`--parallel N`); this is default.
6
7
 
7
8
  ## The cycle
9
+
8
10
  The orchestrator (`/rite-build`) gates and records; the **wright** writes. See
9
11
  [`wright-dispatch.md`](wright-dispatch.md).
10
- ```
12
+
13
+ ```text
11
14
  SELECT → orchestrator: restate slice goal + acceptance + scope boundary; HITL gate (pause pre-code)
12
15
  (SHAPE) → orchestrator: missing UI design-brief.md → shape it, then /rite-vet before dispatch
13
16
  DISPATCH → hand the slice contract to devrites-slice-wright (fresh context). Inside the wright:
@@ -25,14 +28,16 @@ NEXT → HITL root reports and stops; AFK root may repeat only under afk-di
25
28
  ```
26
29
 
27
30
  ## Why the boundary matters
28
- - Keeps diffs reviewable and reveals integration or drift early.
29
- - Preserves a HITL decision point and prevents unproven pile-ups.
31
+
32
+ Reviewable diffs, early drift signal, HITL decision point, no unproven pile-ups.
30
33
 
31
34
  ## Restate the scope boundary
35
+
32
36
  Before coding, write what this slice will and will **not** touch. This is the contract
33
37
  you check yourself against: anything outside it is scope creep or a drift event.
34
38
 
35
39
  ## When the slice can't be completed cleanly
40
+
36
41
  - Discovered the plan is wrong → **Spec Drift Guard** (stop, record, classify, maybe
37
42
  ask, `/rite-plan` repair).
38
43
  - Slice is bigger than one cycle → stop and `/rite-plan reslice`.
@@ -1,6 +1,7 @@
1
1
  # rite-build output
2
2
 
3
3
  **Slices remain:**
4
+
4
5
  ```text
5
6
  Done: built slice <n> — <name>.
6
7
  Changed: <files>; state.md, touched-files.md, evidence.md
@@ -12,6 +13,7 @@ Record: .devrites/work/<slug>/evidence.md
12
13
  ```
13
14
 
14
15
  **All built:**
16
+
15
17
  ```text
16
18
  Done: built slice <n> — <name>; all slices built.
17
19
  Changed: <files>; state.md, touched-files.md, evidence.md