devrites 5.7.1 → 5.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +4 -4
  3. package/docs/command-map.md +1 -1
  4. package/docs/engine/commands.md +1 -0
  5. package/docs/orchestration.md +2 -2
  6. package/engine/internal/parallel/cli.go +69 -0
  7. package/engine/internal/parallel/select.go +76 -0
  8. package/engine/internal/parallel/select_test.go +95 -0
  9. package/pack/.claude/settings.json +1 -0
  10. package/pack/.claude/skills/devrites-lib/reference/standards/afk-hitl.md +9 -10
  11. package/pack/.claude/skills/devrites-lib/reference/standards/loop-operations.md +3 -3
  12. package/pack/.claude/skills/rite-autocomplete/SKILL.md +5 -4
  13. package/pack/.claude/skills/rite-autocomplete/reference/loop.md +9 -10
  14. package/pack/.claude/skills/rite-autocomplete/reference/stop-conditions.md +2 -3
  15. package/pack/.claude/skills/rite-build/SKILL.md +2 -1
  16. package/pack/.claude/skills/rite-build/reference/afk-discipline.md +3 -1
  17. package/pack/.claude/skills/rite-build/reference/one-slice-cycle.md +1 -1
  18. package/pack/.claude/skills/rite-build/reference/parallel-batch.md +17 -13
  19. package/pack/generated/claude/settings.json +1 -0
  20. package/pack/generated/claude/skills/devrites-lib/reference/standards/afk-hitl.md +9 -10
  21. package/pack/generated/claude/skills/devrites-lib/reference/standards/loop-operations.md +3 -3
  22. package/pack/generated/claude/skills/rite-autocomplete/SKILL.md +5 -4
  23. package/pack/generated/claude/skills/rite-autocomplete/reference/loop.md +9 -10
  24. package/pack/generated/claude/skills/rite-autocomplete/reference/stop-conditions.md +2 -3
  25. package/pack/generated/claude/skills/rite-build/SKILL.md +2 -1
  26. package/pack/generated/claude/skills/rite-build/reference/afk-discipline.md +3 -1
  27. package/pack/generated/claude/skills/rite-build/reference/one-slice-cycle.md +1 -1
  28. package/pack/generated/claude/skills/rite-build/reference/parallel-batch.md +17 -13
  29. package/pack/generated/codex/skills/devrites-lib/reference/standards/afk-hitl.md +9 -10
  30. package/pack/generated/codex/skills/devrites-lib/reference/standards/loop-operations.md +3 -3
  31. package/pack/generated/codex/skills/rite-autocomplete/SKILL.md +5 -4
  32. package/pack/generated/codex/skills/rite-autocomplete/reference/loop.md +9 -10
  33. package/pack/generated/codex/skills/rite-autocomplete/reference/stop-conditions.md +2 -3
  34. package/pack/generated/codex/skills/rite-build/SKILL.md +2 -1
  35. package/pack/generated/codex/skills/rite-build/reference/afk-discipline.md +3 -1
  36. package/pack/generated/codex/skills/rite-build/reference/one-slice-cycle.md +1 -1
  37. package/pack/generated/codex/skills/rite-build/reference/parallel-batch.md +17 -13
  38. package/pack/generated/omp/skills/devrites-lib/reference/standards/afk-hitl.md +9 -10
  39. package/pack/generated/omp/skills/devrites-lib/reference/standards/loop-operations.md +3 -3
  40. package/pack/generated/omp/skills/rite-autocomplete/SKILL.md +5 -4
  41. package/pack/generated/omp/skills/rite-autocomplete/reference/loop.md +9 -10
  42. package/pack/generated/omp/skills/rite-autocomplete/reference/stop-conditions.md +2 -3
  43. package/pack/generated/omp/skills/rite-build/SKILL.md +2 -1
  44. package/pack/generated/omp/skills/rite-build/reference/afk-discipline.md +3 -1
  45. package/pack/generated/omp/skills/rite-build/reference/one-slice-cycle.md +1 -1
  46. package/pack/generated/omp/skills/rite-build/reference/parallel-batch.md +17 -13
  47. package/pack/generated/pi/agents/devrites-code-reviewer.md +1 -1
  48. package/pack/generated/pi/agents/devrites-devex-reviewer.md +1 -1
  49. package/pack/generated/pi/agents/devrites-doubt-reviewer.md +1 -1
  50. package/pack/generated/pi/agents/devrites-evidence-scout.md +1 -1
  51. package/pack/generated/pi/agents/devrites-frontend-reviewer.md +1 -1
  52. package/pack/generated/pi/agents/devrites-performance-reviewer.md +1 -1
  53. package/pack/generated/pi/agents/devrites-plan-drafter.md +1 -1
  54. package/pack/generated/pi/agents/devrites-plan-reviewer.md +1 -1
  55. package/pack/generated/pi/agents/devrites-proof-runner.md +1 -1
  56. package/pack/generated/pi/agents/devrites-retrospector.md +1 -1
  57. package/pack/generated/pi/agents/devrites-security-auditor.md +1 -1
  58. package/pack/generated/pi/agents/devrites-simplifier-reviewer.md +1 -1
  59. package/pack/generated/pi/agents/devrites-slice-wright.md +1 -1
  60. package/pack/generated/pi/agents/devrites-spec-reviewer.md +1 -1
  61. package/pack/generated/pi/agents/devrites-strategy-reviewer.md +1 -1
  62. package/pack/generated/pi/agents/devrites-test-analyst.md +1 -1
  63. package/pack/generated/pi/agents/devrites-upgrade-planner.md +1 -1
  64. package/pack/generated/pi/skills/devrites-lib/reference/standards/afk-hitl.md +9 -10
  65. package/pack/generated/pi/skills/devrites-lib/reference/standards/loop-operations.md +3 -3
  66. package/pack/generated/pi/skills/rite-autocomplete/SKILL.md +5 -4
  67. package/pack/generated/pi/skills/rite-autocomplete/reference/loop.md +9 -10
  68. package/pack/generated/pi/skills/rite-autocomplete/reference/stop-conditions.md +2 -3
  69. package/pack/generated/pi/skills/rite-build/SKILL.md +2 -1
  70. package/pack/generated/pi/skills/rite-build/reference/afk-discipline.md +3 -1
  71. package/pack/generated/pi/skills/rite-build/reference/one-slice-cycle.md +1 -1
  72. package/pack/generated/pi/skills/rite-build/reference/parallel-batch.md +17 -13
  73. package/package.json +1 -1
  74. package/scripts/pi-generate.sh +52 -1
@@ -54,7 +54,6 @@ max_slices: 10 # whole-workspace writer budget; seeds stat
54
54
  max_agents: 32 # native agent dispatches in one host activation
55
55
  max_minutes: 120 # wall-clock minutes in one host activation
56
56
  max_review_queue: 8 # unresolved review/gate items admitted before fan-out stops
57
- expires_at: "<ISO-8601 UTC timestamp>" # absolute unattended-authority expiry
58
57
  # max_tokens: 200000 # optional stricter host-observed token cap
59
58
  # max_cost_usd: 10 # optional stricter host-observed cost cap
60
59
  notify: "ntfy.sh/my-topic" # shell command; examples: rite-build/reference/afk-discipline.md
@@ -108,7 +107,7 @@ candidate manifest to cover the whole recorded chain — run
108
107
 
109
108
  - Only continuations recorded in the parent's `decisions.md` sequence
110
109
  ([slicing.md § Continuation workspaces](../../../rite-plan/reference/slicing.md#continuation-workspaces))
111
- qualify; no recorded next entry, or the cap/expiry/review-queue bound reached, stops
110
+ qualify; no recorded next entry, or the cap/review-queue bound reached, stops
112
111
  with the winning reason.
113
112
  - Milestones are **not** shipped: they stay sealed and unarchived in `.devrites/work/`
114
113
  with `Next step: /rite-ship` preserved. Per-slice `WIP(<slug>)` checkpoints still
@@ -121,34 +120,34 @@ candidate manifest to cover the whole recorded chain — run
121
120
  run exactly as without this field.
122
121
 
123
122
  `max_parallel` caps a Build batch for unattended runs; `1` forces the serial cycle.
124
- Unattended runs take the largest eligible set ≤ cap and recompute after every integrate
123
+ Unattended runs take the largest eligible set ≤ cap and recompute after every completed
124
+ round (serial slice or parallel integrate)
125
125
  ([parallel-batch.md § Dynamic selection and re-batching](../../../rite-build/reference/parallel-batch.md#dynamic-selection-and-re-batching));
126
126
  an explicit `/rite-build --parallel N` cap wins for that invocation.
127
127
 
128
128
  ## Unattended resource envelope
129
129
 
130
130
  AFK writer admission needs a bounded input queue, effective slice cap, and valid
131
- `max_agents`, `max_minutes`, `max_review_queue`, and `expires_at`. Existing sentinels
131
+ `max_agents`, `max_minutes`, and `max_review_queue`. Existing sentinels
132
132
  that declare writer admission but miss/malform these fail closed; cold resume keeps the
133
- state-owned slice counter.
133
+ state-owned slice counter. A leftover `expires_at` is ignored and never rewritten.
134
134
  Read-only watchers use equivalent native caps from [`loop-operations.md`](loop-operations.md).
135
135
 
136
136
  `max_agents` counts every leaf in the native activation, including failures and
137
137
  parallel branches; do not add dispatch telemetry to `.devrites/`. `max_review_queue`
138
138
  counts open validating questions plus unresolved admitted Critical/Important findings.
139
- Above it stop; at it run only reconciliation that reduces the queue. `expires_at` is
140
- absolute ISO-8601 authority. Optional `max_tokens`/`max_cost_usd` lower enforceable
141
- native caps; if declared but unobservable, stop.
139
+ Above it stop; at it run only reconciliation that reduces the queue. Optional
140
+ `max_tokens`/`max_cost_usd` lower enforceable native caps; if declared but unobservable, stop.
142
141
 
143
142
  Numeric limits are nonnegative decimals. Before costly checks, fan-out, or writing,
144
143
  run cheap readiness, reject overlap, count queue, and confirm agent/time/token/cost
145
144
  headroom; re-check after every result. Never start one call that can exceed remaining
146
145
  headroom. Agent/time/token/cost counters are per native activation and start fresh only
147
- for a genuinely new activation. Slices, recovery attempts, absolute expiry, and current
146
+ for a genuinely new activation. Slices, recovery attempts, and current
148
147
  review queue remain durable/recomputed across wakes. Persist each activation stop and
149
148
  checkpoint before notification.
150
149
 
151
- New sentinels default `expires_at` to arming + 4h with no notification/token/cost cap.
150
+ New sentinels write no `expires_at` and no notification/token/cost cap.
152
151
  Post-Vet pending count may lower slices. Existing files
153
152
  never receive missing defaults implicitly.
154
153
 
@@ -38,13 +38,13 @@ Every unattended loop must name:
38
38
  4. **Evaluator:** the skill's existing readiness, proof, review, or watcher verdict.
39
39
  5. **Budget:** every applicable `.devrites/AFK` resource cap.
40
40
  6. **Checkpoint:** durable workspace/evidence update before the turn ends.
41
- 7. **Stop:** success, human/safety/access gate, expiry, budget exhaustion, unchanged
41
+ 7. **Stop:** success, human/safety/access gate, budget exhaustion, unchanged
42
42
  no-progress fingerprint, host failure, or terminal external state.
43
43
  8. **Notification:** optional native-host notification after state is durable; never a
44
44
  substitute for recording the stop.
45
45
 
46
46
  A read-only scheduled/event loop that has no active AFK workspace must still configure
47
- native maximum activations/iterations, wall time, and absolute expiry. Add token/cost
47
+ native maximum activations/iterations and wall time. Add token/cost
48
48
  caps when the host exposes them. One observation cycle per wake is the work unit; the
49
49
  skill never starts its own timer or background poller.
50
50
 
@@ -76,7 +76,7 @@ armed AFK workspace whose exact scope, gates, and budgets permit it.
76
76
  is `gap`/`cannot_verify`, never success.
77
77
  - Do not retry unchanged work merely because a timer fired. Apply the exact
78
78
  causal-fingerprint recovery cap ([`afk-hitl.md`](afk-hitl.md)).
79
- - A cold resume continues durable slice/recovery state and absolute expiry. Fresh
79
+ - A cold resume continues durable slice/recovery state. Fresh
80
80
  native activation counters follow `afk-hitl.md`; no durable bound is reinitialized.
81
81
  - Native notifications fire only after evidence and stop state are written.
82
82
 
@@ -48,7 +48,7 @@ executable controller/harness/bundle bytes or a missing writer, read
48
48
  - Every exact causal fingerprint gets at most three no-progress corrections.
49
49
  Closing one is progress; a distinct Critical/Important invariant has its own
50
50
  budget. Lower severity cannot prolong recovery.
51
- - Enforce `--max-slices`, the AFK sentinel, expiry, review queue, and native
51
+ - Enforce `--max-slices`, the AFK sentinel, review queue, and native
52
52
  agent/token/cost/time limits before every phase or dispatch. Count failed,
53
53
  malformed, and unavailable leaf calls. At the review cap, permit only work
54
54
  that reduces the queue.
@@ -94,9 +94,10 @@ executable controller/harness/bundle bytes or a missing writer, read
94
94
  `/rite-review` → `/rite-seal`. Read and execute each skill; durable files, not
95
95
  chat, carry state. Apply the mutable post-vet budget before first Build.
96
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.
97
+ sentinel `max_parallel`, else 10) and recomputes after every completed round until no
98
+ pending slice remains; a one-slice round is serial for that round only, then
99
+ selection runs again (host isolation still forces serial when concurrent writers
100
+ cannot be separated).
100
101
  **Completion:** loop reaches Seal GO or persists a valid stop before any later phase.
101
102
  5. **Apply stops.** At every gate use
102
103
  [stop-conditions.md](reference/stop-conditions.md). A `blocked` label alone is not a stop condition:
@@ -18,7 +18,6 @@ max_slices: 10
18
18
  max_agents: 32
19
19
  max_minutes: 120
20
20
  max_review_queue: 8
21
- expires_at: "<now + 4 hours>"
22
21
  # continue_sequence: true # opt-in: chain recorded continuations after Seal GO
23
22
  # max_workspaces: 5 # sequence budget when chaining
24
23
  # max_parallel: 10 # Build batch cap; 1 = serial (default: eligible, cap 10)
@@ -28,11 +27,11 @@ expires_at: "<now + 4 hours>"
28
27
  ```
29
28
 
30
29
  Read an existing sentinel first. Preserve it byte-for-byte when valid; stop if
31
- its gate ceiling exceeds advisory, required envelope is malformed/expired, or
30
+ its gate ceiling exceeds advisory, required envelope is malformed, or
32
31
  `max_slices` conflicts with the invocation. If absent, write it once after
33
- clarity, replacing the safe slice default only for explicit `--max-slices N`
34
- and resolving one absolute UTC expiry. It is read-only: never rewrite it after
35
- Vet or reset it on resume.
32
+ clarity, replacing the safe slice default only for explicit `--max-slices N`.
33
+ It is read-only: never rewrite it after Vet or reset it on resume. Leftover
34
+ `expires_at` is ignored and never rewritten.
36
35
 
37
36
  ### Derive the mutable post-vet budget
38
37
 
@@ -45,12 +44,12 @@ or reinitialize it. AFK configuration itself stays unchanged.
45
44
 
46
45
  Before every phase, review fan-out, recovery, or writer dispatch, apply
47
46
  [`afk-hitl.md`](../../devrites-lib/reference/standards/afk-hitl.md#unattended-resource-envelope): cheapest current-state/readiness
48
- check first; reject overlap; count unresolved review; check expiry and native
47
+ check first; reject overlap; count unresolved review; check native
49
48
  agent/token/cost/time headroom. Count every leaf result. At the review cap, only
50
49
  reconciliation that reduces the queue may run. Any reached or unobservable
51
50
  bound stops before more work and persists the winning reason. A new activation
52
- gets fresh activation-local counters but retains durable slice/recovery state,
53
- expiry, and recomputed queue.
51
+ gets fresh activation-local counters but retains durable slice/recovery state
52
+ and recomputed queue.
54
53
 
55
54
  `allow_gates: [advisory]` means validating gates pause now rather than becoming
56
55
  Seal NO-GO. Only explicit human configuration outside Autocomplete may widen it.
@@ -66,7 +65,7 @@ Workspace files carry state; chat does not. Read and execute each phase skill:
66
65
  | 3 | `/rite-temper` | harden or reduce; expansion and irreversible risk pause |
67
66
  | 4 | `/rite-define` | approved plan/tasks/traceability |
68
67
  | 5 | `/rite-vet` | every plan; derive mutable budget after READY |
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 |
68
+ | 6 | `/rite-build` batch loop | largest eligible path-disjoint set (cap 10; one-slice round when <2 eligible); recompute after each round; charge once per green built slice |
70
69
  | 7 | `/rite-prove` | all slices built; approved proof; recovery on red |
71
70
  | 8 | `/rite-polish` | re-prove after code edits |
72
71
  | 9 | `/rite-review` | in-scope correction then fresh proof |
@@ -100,7 +99,7 @@ fields are missing is re-seeded from its `brief.md` parent/position and the
100
99
  parent's counter (same values, never a second charge); a child with no recorded
101
100
  parent/position is not a sequence member and the chain stops.
102
101
 
103
- Stop instead when: no recorded next entry; the cap, expiry, or review-queue bound is
102
+ Stop instead when: no recorded next entry; the cap or review-queue bound is
104
103
  reached; a human-owned, safety, access, or exhaustion condition fires; or Seal returns
105
104
  `NO-GO`. On stop, report the sequence position, the sealed-but-unshipped workspaces, and
106
105
  the single release command (`/rite-autocomplete <release milestone> --ship`, or
@@ -71,11 +71,10 @@ exhausted.
71
71
  when slices remain; malformed state also stops. Report whether the winning
72
72
  bound was the pre-existing remaining value, explicit flag, sentinel cap, or post-vet pending count.
73
73
  Zero with no pending slices is normal completion and proceeds to Prove.
74
- - **Resource envelope:** missing/malformed/expired AFK, overlapping run,
74
+ - **Resource envelope:** missing/malformed AFK, overlapping run,
75
75
  exhausted/unobservable declared agent/token/cost/time headroom, or review queue
76
76
  above cap. At cap, only queue-reducing reconciliation may run. Persist winning
77
- bound and observed usage; a new activation does not reset durable budgets or
78
- expiry.
77
+ bound and observed usage; a new activation does not reset durable budgets.
79
78
  - **Confidence:** intent still cannot become testable acceptance after interview.
80
79
  - **Repeated failure:** the exact fingerprint's bounded recovery is exhausted.
81
80
 
@@ -60,7 +60,8 @@ Wright applies anti-slop; root verifies returns and never patches source.
60
60
 
61
61
  Omitted/`1` ≡ serial; `2`–`10` is a **cap** — the root runs the largest eligible
62
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
63
+ filled, and recomputes after every completed round (serial slice or parallel
64
+ integrate) until no pending slice remains
64
65
  ([`parallel-batch.md` § Dynamic selection](reference/parallel-batch.md#dynamic-selection-and-re-batching)).
65
66
  Unattended runs (`/rite-autocomplete`, `.devrites/AFK` `max_parallel`) repeat batches
66
67
  inside the same run; HITL stops after each batch. Non-integer/`N≤0`/`N>10` hard refuse.
@@ -16,7 +16,9 @@ control; irreversible work (destructive/auth/public API) always pauses.
16
16
  The controlling root owns the cap:
17
17
 
18
18
  1. **Before every dispatch**, re-read `.devrites/AFK`, `state.md`, and the
19
- selected slice. A configured `max_slices` and any existing
19
+ selected slice. When `--parallel N` or sentinel `max_parallel` is greater than
20
+ 1, recompute `N_eff` via `parallel select` before the next dispatch — a prior
21
+ one-slice round does not keep the run serial. A configured `max_slices` and any existing
20
22
  `afk_slices_remaining` value, including its released bullet form, must each
21
23
  be a decimal nonnegative integer. A missing
22
24
  `state.md` or malformed configured value fails closed; an omitted cap is the
@@ -26,7 +26,7 @@ RECORD → orchestrator: after green verification, update state.md/evidence.m
26
26
  upsert the authoritative candidate manifest from the actual scoped diff
27
27
  (CHECKPOINT) → orchestrator: commit the proven slice local-only as WIP(<slug>)
28
28
  with a [devrites-context] body → clean tree, survives a crash (checkpoint.md)
29
- NEXT → HITL root reports and stops; AFK root may repeat only under afk-discipline.md
29
+ NEXT → HITL root reports and stops. AFK with parallel cap>1: return to parallel-batch selection and run the new N_eff; otherwise repeat under afk-discipline.md
30
30
  ```
31
31
 
32
32
  ## Why the boundary matters
@@ -28,18 +28,20 @@ N_eff = min(
28
28
  )
29
29
  ```
30
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.
31
+ Select **greedily in plan order**: pass every currently dependency-ready pending slice
32
+ (plan order, `Files likely touched`) to
33
+ `devrites-engine parallel select --cap N [--root <dir>]`. `N_eff 2` → parallel batch;
34
+ `N_eff = 1` → one serial round; nothing pending → Prove. A cap that cannot be filled
35
+ is normal: take fewer. Serial is this round's size, not the rest of the run.
36
+
37
+ **Re-batch automatically after every completed round** (parallel integrate+cleanup or
38
+ a serial slice). Re-read `state.md`, pending slices, and the tree, then run
39
+ `parallel select` again: finished work leaves the pending set, and satisfied
40
+ dependencies unlock new slices. Under `.devrites/AFK` and `/rite-autocomplete` the
41
+ repeat is the same run HITL stops after each batch. `--parallel 5` with one eligible
42
+ slice runs that one; when two to five then become eligible, the next round takes that
43
+ many. **Failing case:** the run stays one-by-one after a serial round even though more
44
+ slices are now eligible under the same cap.
43
45
 
44
46
  ## Path-disjoint
45
47
 
@@ -71,7 +73,8 @@ Lease: `batch_id`, `created_at`, `base_sha`, `n`,
71
73
  1. Orient/gate; parse the cap; compute `N_eff` and select the eligible set
72
74
  ([Dynamic selection and re-batching](#dynamic-selection-and-re-batching)) —
73
75
  candidates from `orient` `task_graph.slices` + built list, each candidate's
74
- `Files likely touched` via `observe slice`, disjointness via `check path-disjoint`.
76
+ `Files likely touched` via `observe slice`, then
77
+ `parallel select --cap N` (pairwise disjointness is inside that verb).
75
78
  2. Write lease; freeze `B=HEAD`; `parallel create` worktrees.
76
79
  3. Dispatch ≤10 wrights in parallel (cwd=worktree; allowlist; prove `HEAD==B`).
77
80
  4. Inspect each returned path list, cumulative diff from `B`, transfer identity,
@@ -163,6 +166,7 @@ Repair rejected work in place; never discard/rebuild while budget remains.
163
166
  ## Engine verbs
164
167
 
165
168
  ```text
169
+ devrites-engine parallel select --cap <1-10> [--root <dir>] [<json-file>|-]
166
170
  devrites-engine parallel create --root <repo> --slug <slug> --batch <id> --base <B> --json <file>|-
167
171
  devrites-engine parallel record-green --root <repo> --slug <slug> --slice <id> --commit <sha>
168
172
  devrites-engine parallel integrate --root <repo> --slug <slug> --apply-to-control
@@ -54,7 +54,6 @@ max_slices: 10 # whole-workspace writer budget; seeds stat
54
54
  max_agents: 32 # native agent dispatches in one host activation
55
55
  max_minutes: 120 # wall-clock minutes in one host activation
56
56
  max_review_queue: 8 # unresolved review/gate items admitted before fan-out stops
57
- expires_at: "<ISO-8601 UTC timestamp>" # absolute unattended-authority expiry
58
57
  # max_tokens: 200000 # optional stricter host-observed token cap
59
58
  # max_cost_usd: 10 # optional stricter host-observed cost cap
60
59
  notify: "ntfy.sh/my-topic" # shell command; examples: rite-build/reference/afk-discipline.md
@@ -108,7 +107,7 @@ candidate manifest to cover the whole recorded chain — run
108
107
 
109
108
  - Only continuations recorded in the parent's `decisions.md` sequence
110
109
  ([slicing.md § Continuation workspaces](../../../rite-plan/reference/slicing.md#continuation-workspaces))
111
- qualify; no recorded next entry, or the cap/expiry/review-queue bound reached, stops
110
+ qualify; no recorded next entry, or the cap/review-queue bound reached, stops
112
111
  with the winning reason.
113
112
  - Milestones are **not** shipped: they stay sealed and unarchived in `.devrites/work/`
114
113
  with `Next step: $rite-ship` preserved. Per-slice `WIP(<slug>)` checkpoints still
@@ -121,34 +120,34 @@ candidate manifest to cover the whole recorded chain — run
121
120
  run exactly as without this field.
122
121
 
123
122
  `max_parallel` caps a Build batch for unattended runs; `1` forces the serial cycle.
124
- Unattended runs take the largest eligible set ≤ cap and recompute after every integrate
123
+ Unattended runs take the largest eligible set ≤ cap and recompute after every completed
124
+ round (serial slice or parallel integrate)
125
125
  ([parallel-batch.md § Dynamic selection and re-batching](../../../rite-build/reference/parallel-batch.md#dynamic-selection-and-re-batching));
126
126
  an explicit `$rite-build --parallel N` cap wins for that invocation.
127
127
 
128
128
  ## Unattended resource envelope
129
129
 
130
130
  AFK writer admission needs a bounded input queue, effective slice cap, and valid
131
- `max_agents`, `max_minutes`, `max_review_queue`, and `expires_at`. Existing sentinels
131
+ `max_agents`, `max_minutes`, and `max_review_queue`. Existing sentinels
132
132
  that declare writer admission but miss/malform these fail closed; cold resume keeps the
133
- state-owned slice counter.
133
+ state-owned slice counter. A leftover `expires_at` is ignored and never rewritten.
134
134
  Read-only watchers use equivalent native caps from [`loop-operations.md`](loop-operations.md).
135
135
 
136
136
  `max_agents` counts every leaf in the native activation, including failures and
137
137
  parallel branches; do not add dispatch telemetry to `.devrites/`. `max_review_queue`
138
138
  counts open validating questions plus unresolved admitted Critical/Important findings.
139
- Above it stop; at it run only reconciliation that reduces the queue. `expires_at` is
140
- absolute ISO-8601 authority. Optional `max_tokens`/`max_cost_usd` lower enforceable
141
- native caps; if declared but unobservable, stop.
139
+ Above it stop; at it run only reconciliation that reduces the queue. Optional
140
+ `max_tokens`/`max_cost_usd` lower enforceable native caps; if declared but unobservable, stop.
142
141
 
143
142
  Numeric limits are nonnegative decimals. Before costly checks, fan-out, or writing,
144
143
  run cheap readiness, reject overlap, count queue, and confirm agent/time/token/cost
145
144
  headroom; re-check after every result. Never start one call that can exceed remaining
146
145
  headroom. Agent/time/token/cost counters are per native activation and start fresh only
147
- for a genuinely new activation. Slices, recovery attempts, absolute expiry, and current
146
+ for a genuinely new activation. Slices, recovery attempts, and current
148
147
  review queue remain durable/recomputed across wakes. Persist each activation stop and
149
148
  checkpoint before notification.
150
149
 
151
- New sentinels default `expires_at` to arming + 4h with no notification/token/cost cap.
150
+ New sentinels write no `expires_at` and no notification/token/cost cap.
152
151
  Post-Vet pending count may lower slices. Existing files
153
152
  never receive missing defaults implicitly.
154
153
 
@@ -38,13 +38,13 @@ Every unattended loop must name:
38
38
  4. **Evaluator:** the skill's existing readiness, proof, review, or watcher verdict.
39
39
  5. **Budget:** every applicable `.devrites/AFK` resource cap.
40
40
  6. **Checkpoint:** durable workspace/evidence update before the turn ends.
41
- 7. **Stop:** success, human/safety/access gate, expiry, budget exhaustion, unchanged
41
+ 7. **Stop:** success, human/safety/access gate, budget exhaustion, unchanged
42
42
  no-progress fingerprint, host failure, or terminal external state.
43
43
  8. **Notification:** optional native-host notification after state is durable; never a
44
44
  substitute for recording the stop.
45
45
 
46
46
  A read-only scheduled/event loop that has no active AFK workspace must still configure
47
- native maximum activations/iterations, wall time, and absolute expiry. Add token/cost
47
+ native maximum activations/iterations and wall time. Add token/cost
48
48
  caps when the host exposes them. One observation cycle per wake is the work unit; the
49
49
  skill never starts its own timer or background poller.
50
50
 
@@ -76,7 +76,7 @@ armed AFK workspace whose exact scope, gates, and budgets permit it.
76
76
  is `gap`/`cannot_verify`, never success.
77
77
  - Do not retry unchanged work merely because a timer fired. Apply the exact
78
78
  causal-fingerprint recovery cap ([`afk-hitl.md`](afk-hitl.md)).
79
- - A cold resume continues durable slice/recovery state and absolute expiry. Fresh
79
+ - A cold resume continues durable slice/recovery state. Fresh
80
80
  native activation counters follow `afk-hitl.md`; no durable bound is reinitialized.
81
81
  - Native notifications fire only after evidence and stop state are written.
82
82
 
@@ -48,7 +48,7 @@ executable controller/harness/bundle bytes or a missing writer, read
48
48
  - Every exact causal fingerprint gets at most three no-progress corrections.
49
49
  Closing one is progress; a distinct Critical/Important invariant has its own
50
50
  budget. Lower severity cannot prolong recovery.
51
- - Enforce `--max-slices`, the AFK sentinel, expiry, review queue, and native
51
+ - Enforce `--max-slices`, the AFK sentinel, review queue, and native
52
52
  agent/token/cost/time limits before every phase or dispatch. Count failed,
53
53
  malformed, and unavailable leaf calls. At the review cap, permit only work
54
54
  that reduces the queue.
@@ -94,9 +94,10 @@ executable controller/harness/bundle bytes or a missing writer, read
94
94
  `$rite-review` → `$rite-seal`. Read and execute each skill; durable files, not
95
95
  chat, carry state. Apply the mutable post-vet budget before first Build.
96
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.
97
+ sentinel `max_parallel`, else 10) and recomputes after every completed round until no
98
+ pending slice remains; a one-slice round is serial for that round only, then
99
+ selection runs again (host isolation still forces serial when concurrent writers
100
+ cannot be separated).
100
101
  **Completion:** loop reaches Seal GO or persists a valid stop before any later phase.
101
102
  5. **Apply stops.** At every gate use
102
103
  [stop-conditions.md](reference/stop-conditions.md). A `blocked` label alone is not a stop condition:
@@ -18,7 +18,6 @@ max_slices: 10
18
18
  max_agents: 32
19
19
  max_minutes: 120
20
20
  max_review_queue: 8
21
- expires_at: "<now + 4 hours>"
22
21
  # continue_sequence: true # opt-in: chain recorded continuations after Seal GO
23
22
  # max_workspaces: 5 # sequence budget when chaining
24
23
  # max_parallel: 10 # Build batch cap; 1 = serial (default: eligible, cap 10)
@@ -28,11 +27,11 @@ expires_at: "<now + 4 hours>"
28
27
  ```
29
28
 
30
29
  Read an existing sentinel first. Preserve it byte-for-byte when valid; stop if
31
- its gate ceiling exceeds advisory, required envelope is malformed/expired, or
30
+ its gate ceiling exceeds advisory, required envelope is malformed, or
32
31
  `max_slices` conflicts with the invocation. If absent, write it once after
33
- clarity, replacing the safe slice default only for explicit `--max-slices N`
34
- and resolving one absolute UTC expiry. It is read-only: never rewrite it after
35
- Vet or reset it on resume.
32
+ clarity, replacing the safe slice default only for explicit `--max-slices N`.
33
+ It is read-only: never rewrite it after Vet or reset it on resume. Leftover
34
+ `expires_at` is ignored and never rewritten.
36
35
 
37
36
  ### Derive the mutable post-vet budget
38
37
 
@@ -45,12 +44,12 @@ or reinitialize it. AFK configuration itself stays unchanged.
45
44
 
46
45
  Before every phase, review fan-out, recovery, or writer dispatch, apply
47
46
  [`afk-hitl.md`](../../devrites-lib/reference/standards/afk-hitl.md#unattended-resource-envelope): cheapest current-state/readiness
48
- check first; reject overlap; count unresolved review; check expiry and native
47
+ check first; reject overlap; count unresolved review; check native
49
48
  agent/token/cost/time headroom. Count every leaf result. At the review cap, only
50
49
  reconciliation that reduces the queue may run. Any reached or unobservable
51
50
  bound stops before more work and persists the winning reason. A new activation
52
- gets fresh activation-local counters but retains durable slice/recovery state,
53
- expiry, and recomputed queue.
51
+ gets fresh activation-local counters but retains durable slice/recovery state
52
+ and recomputed queue.
54
53
 
55
54
  `allow_gates: [advisory]` means validating gates pause now rather than becoming
56
55
  Seal NO-GO. Only explicit human configuration outside Autocomplete may widen it.
@@ -66,7 +65,7 @@ Workspace files carry state; chat does not. Read and execute each phase skill:
66
65
  | 3 | `$rite-temper` | harden or reduce; expansion and irreversible risk pause |
67
66
  | 4 | `$rite-define` | approved plan/tasks/traceability |
68
67
  | 5 | `$rite-vet` | every plan; derive mutable budget after READY |
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 |
68
+ | 6 | `$rite-build` batch loop | largest eligible path-disjoint set (cap 10; one-slice round when <2 eligible); recompute after each round; charge once per green built slice |
70
69
  | 7 | `$rite-prove` | all slices built; approved proof; recovery on red |
71
70
  | 8 | `$rite-polish` | re-prove after code edits |
72
71
  | 9 | `$rite-review` | in-scope correction then fresh proof |
@@ -100,7 +99,7 @@ fields are missing is re-seeded from its `brief.md` parent/position and the
100
99
  parent's counter (same values, never a second charge); a child with no recorded
101
100
  parent/position is not a sequence member and the chain stops.
102
101
 
103
- Stop instead when: no recorded next entry; the cap, expiry, or review-queue bound is
102
+ Stop instead when: no recorded next entry; the cap or review-queue bound is
104
103
  reached; a human-owned, safety, access, or exhaustion condition fires; or Seal returns
105
104
  `NO-GO`. On stop, report the sequence position, the sealed-but-unshipped workspaces, and
106
105
  the single release command (`$rite-autocomplete <release milestone> --ship`, or
@@ -71,11 +71,10 @@ exhausted.
71
71
  when slices remain; malformed state also stops. Report whether the winning
72
72
  bound was the pre-existing remaining value, explicit flag, sentinel cap, or post-vet pending count.
73
73
  Zero with no pending slices is normal completion and proceeds to Prove.
74
- - **Resource envelope:** missing/malformed/expired AFK, overlapping run,
74
+ - **Resource envelope:** missing/malformed AFK, overlapping run,
75
75
  exhausted/unobservable declared agent/token/cost/time headroom, or review queue
76
76
  above cap. At cap, only queue-reducing reconciliation may run. Persist winning
77
- bound and observed usage; a new activation does not reset durable budgets or
78
- expiry.
77
+ bound and observed usage; a new activation does not reset durable budgets.
79
78
  - **Confidence:** intent still cannot become testable acceptance after interview.
80
79
  - **Repeated failure:** the exact fingerprint's bounded recovery is exhausted.
81
80
 
@@ -60,7 +60,8 @@ Wright applies anti-slop; root verifies returns and never patches source.
60
60
 
61
61
  Omitted/`1` ≡ serial; `2`–`10` is a **cap** — the root runs the largest eligible
62
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
63
+ filled, and recomputes after every completed round (serial slice or parallel
64
+ integrate) until no pending slice remains
64
65
  ([`parallel-batch.md` § Dynamic selection](reference/parallel-batch.md#dynamic-selection-and-re-batching)).
65
66
  Unattended runs (`$rite-autocomplete`, `.devrites/AFK` `max_parallel`) repeat batches
66
67
  inside the same run; HITL stops after each batch. Non-integer/`N≤0`/`N>10` hard refuse.
@@ -16,7 +16,9 @@ control; irreversible work (destructive/auth/public API) always pauses.
16
16
  The controlling root owns the cap:
17
17
 
18
18
  1. **Before every dispatch**, re-read `.devrites/AFK`, `state.md`, and the
19
- selected slice. A configured `max_slices` and any existing
19
+ selected slice. When `--parallel N` or sentinel `max_parallel` is greater than
20
+ 1, recompute `N_eff` via `parallel select` before the next dispatch — a prior
21
+ one-slice round does not keep the run serial. A configured `max_slices` and any existing
20
22
  `afk_slices_remaining` value, including its released bullet form, must each
21
23
  be a decimal nonnegative integer. A missing
22
24
  `state.md` or malformed configured value fails closed; an omitted cap is the
@@ -26,7 +26,7 @@ RECORD → orchestrator: after green verification, update state.md/evidence.m
26
26
  upsert the authoritative candidate manifest from the actual scoped diff
27
27
  (CHECKPOINT) → orchestrator: commit the proven slice local-only as WIP(<slug>)
28
28
  with a [devrites-context] body → clean tree, survives a crash (checkpoint.md)
29
- NEXT → HITL root reports and stops; AFK root may repeat only under afk-discipline.md
29
+ NEXT → HITL root reports and stops. AFK with parallel cap>1: return to parallel-batch selection and run the new N_eff; otherwise repeat under afk-discipline.md
30
30
  ```
31
31
 
32
32
  ## Why the boundary matters
@@ -28,18 +28,20 @@ N_eff = min(
28
28
  )
29
29
  ```
30
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.
31
+ Select **greedily in plan order**: pass every currently dependency-ready pending slice
32
+ (plan order, `Files likely touched`) to
33
+ `devrites-engine parallel select --cap N [--root <dir>]`. `N_eff 2` → parallel batch;
34
+ `N_eff = 1` → one serial round; nothing pending → Prove. A cap that cannot be filled
35
+ is normal: take fewer. Serial is this round's size, not the rest of the run.
36
+
37
+ **Re-batch automatically after every completed round** (parallel integrate+cleanup or
38
+ a serial slice). Re-read `state.md`, pending slices, and the tree, then run
39
+ `parallel select` again: finished work leaves the pending set, and satisfied
40
+ dependencies unlock new slices. Under `.devrites/AFK` and `$rite-autocomplete` the
41
+ repeat is the same run HITL stops after each batch. `--parallel 5` with one eligible
42
+ slice runs that one; when two to five then become eligible, the next round takes that
43
+ many. **Failing case:** the run stays one-by-one after a serial round even though more
44
+ slices are now eligible under the same cap.
43
45
 
44
46
  ## Path-disjoint
45
47
 
@@ -71,7 +73,8 @@ Lease: `batch_id`, `created_at`, `base_sha`, `n`,
71
73
  1. Orient/gate; parse the cap; compute `N_eff` and select the eligible set
72
74
  ([Dynamic selection and re-batching](#dynamic-selection-and-re-batching)) —
73
75
  candidates from `orient` `task_graph.slices` + built list, each candidate's
74
- `Files likely touched` via `observe slice`, disjointness via `check path-disjoint`.
76
+ `Files likely touched` via `observe slice`, then
77
+ `parallel select --cap N` (pairwise disjointness is inside that verb).
75
78
  2. Write lease; freeze `B=HEAD`; `parallel create` worktrees.
76
79
  3. Dispatch ≤10 wrights in parallel (cwd=worktree; allowlist; prove `HEAD==B`).
77
80
  4. Inspect each returned path list, cumulative diff from `B`, transfer identity,
@@ -163,6 +166,7 @@ Repair rejected work in place; never discard/rebuild while budget remains.
163
166
  ## Engine verbs
164
167
 
165
168
  ```text
169
+ devrites-engine parallel select --cap <1-10> [--root <dir>] [<json-file>|-]
166
170
  devrites-engine parallel create --root <repo> --slug <slug> --batch <id> --base <B> --json <file>|-
167
171
  devrites-engine parallel record-green --root <repo> --slug <slug> --slice <id> --commit <sha>
168
172
  devrites-engine parallel integrate --root <repo> --slug <slug> --apply-to-control
@@ -54,7 +54,6 @@ max_slices: 10 # whole-workspace writer budget; seeds stat
54
54
  max_agents: 32 # native agent dispatches in one host activation
55
55
  max_minutes: 120 # wall-clock minutes in one host activation
56
56
  max_review_queue: 8 # unresolved review/gate items admitted before fan-out stops
57
- expires_at: "<ISO-8601 UTC timestamp>" # absolute unattended-authority expiry
58
57
  # max_tokens: 200000 # optional stricter host-observed token cap
59
58
  # max_cost_usd: 10 # optional stricter host-observed cost cap
60
59
  notify: "ntfy.sh/my-topic" # shell command; examples: rite-build/reference/afk-discipline.md
@@ -108,7 +107,7 @@ candidate manifest to cover the whole recorded chain — run
108
107
 
109
108
  - Only continuations recorded in the parent's `decisions.md` sequence
110
109
  ([slicing.md § Continuation workspaces](../../../rite-plan/reference/slicing.md#continuation-workspaces))
111
- qualify; no recorded next entry, or the cap/expiry/review-queue bound reached, stops
110
+ qualify; no recorded next entry, or the cap/review-queue bound reached, stops
112
111
  with the winning reason.
113
112
  - Milestones are **not** shipped: they stay sealed and unarchived in `.devrites/work/`
114
113
  with `Next step: /rite-ship` preserved. Per-slice `WIP(<slug>)` checkpoints still
@@ -121,34 +120,34 @@ candidate manifest to cover the whole recorded chain — run
121
120
  run exactly as without this field.
122
121
 
123
122
  `max_parallel` caps a Build batch for unattended runs; `1` forces the serial cycle.
124
- Unattended runs take the largest eligible set ≤ cap and recompute after every integrate
123
+ Unattended runs take the largest eligible set ≤ cap and recompute after every completed
124
+ round (serial slice or parallel integrate)
125
125
  ([parallel-batch.md § Dynamic selection and re-batching](../../../rite-build/reference/parallel-batch.md#dynamic-selection-and-re-batching));
126
126
  an explicit `/rite-build --parallel N` cap wins for that invocation.
127
127
 
128
128
  ## Unattended resource envelope
129
129
 
130
130
  AFK writer admission needs a bounded input queue, effective slice cap, and valid
131
- `max_agents`, `max_minutes`, `max_review_queue`, and `expires_at`. Existing sentinels
131
+ `max_agents`, `max_minutes`, and `max_review_queue`. Existing sentinels
132
132
  that declare writer admission but miss/malform these fail closed; cold resume keeps the
133
- state-owned slice counter.
133
+ state-owned slice counter. A leftover `expires_at` is ignored and never rewritten.
134
134
  Read-only watchers use equivalent native caps from [`loop-operations.md`](loop-operations.md).
135
135
 
136
136
  `max_agents` counts every leaf in the native activation, including failures and
137
137
  parallel branches; do not add dispatch telemetry to `.devrites/`. `max_review_queue`
138
138
  counts open validating questions plus unresolved admitted Critical/Important findings.
139
- Above it stop; at it run only reconciliation that reduces the queue. `expires_at` is
140
- absolute ISO-8601 authority. Optional `max_tokens`/`max_cost_usd` lower enforceable
141
- native caps; if declared but unobservable, stop.
139
+ Above it stop; at it run only reconciliation that reduces the queue. Optional
140
+ `max_tokens`/`max_cost_usd` lower enforceable native caps; if declared but unobservable, stop.
142
141
 
143
142
  Numeric limits are nonnegative decimals. Before costly checks, fan-out, or writing,
144
143
  run cheap readiness, reject overlap, count queue, and confirm agent/time/token/cost
145
144
  headroom; re-check after every result. Never start one call that can exceed remaining
146
145
  headroom. Agent/time/token/cost counters are per native activation and start fresh only
147
- for a genuinely new activation. Slices, recovery attempts, absolute expiry, and current
146
+ for a genuinely new activation. Slices, recovery attempts, and current
148
147
  review queue remain durable/recomputed across wakes. Persist each activation stop and
149
148
  checkpoint before notification.
150
149
 
151
- New sentinels default `expires_at` to arming + 4h with no notification/token/cost cap.
150
+ New sentinels write no `expires_at` and no notification/token/cost cap.
152
151
  Post-Vet pending count may lower slices. Existing files
153
152
  never receive missing defaults implicitly.
154
153