devrites 7.3.4 → 7.3.6

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 (75) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +1 -1
  3. package/docs/adr/0039-autocomplete-structural-admission.md +87 -0
  4. package/docs/adr/0040-early-preparation-admission.md +76 -0
  5. package/docs/adr/README.md +2 -0
  6. package/docs/cli.md +103 -5
  7. package/docs/engine/commands.md +88 -1
  8. package/engine/internal/lib/claims.go +65 -8
  9. package/engine/internal/lib/context.go +50 -2
  10. package/engine/internal/lib/continuation.go +8 -1
  11. package/engine/internal/lib/dispatch.go +147 -46
  12. package/engine/internal/lib/frontier.go +139 -59
  13. package/engine/internal/lib/frontier_controller.go +667 -0
  14. package/engine/internal/lib/frontier_preparation.go +210 -0
  15. package/engine/internal/lib/frontier_roadmap.go +168 -0
  16. package/engine/internal/lib/next.go +14 -2
  17. package/engine/internal/lib/triggers.go +9 -0
  18. package/engine/internal/parallel/repository.go +10 -0
  19. package/pack/.claude/skills/devrites-lib/SKILL.md +2 -0
  20. package/pack/.claude/skills/devrites-lib/reference/parallel-workspaces.md +108 -115
  21. package/pack/.claude/skills/devrites-lib/reference/standards/afk-hitl.md +18 -17
  22. package/pack/.claude/skills/devrites-lib/reference/workspace-artifact-schema.md +41 -38
  23. package/pack/.claude/skills/rite-autocomplete/SKILL.md +35 -38
  24. package/pack/.claude/skills/rite-autocomplete/reference/loop.md +66 -59
  25. package/pack/.claude/skills/rite-autocomplete/reference/stop-conditions.md +28 -28
  26. package/pack/.claude/skills/rite-build/reference/parallel-batch.md +17 -15
  27. package/pack/generated/claude/skills/devrites-lib/SKILL.md +2 -0
  28. package/pack/generated/claude/skills/devrites-lib/reference/parallel-workspaces.md +108 -115
  29. package/pack/generated/claude/skills/devrites-lib/reference/standards/afk-hitl.md +18 -17
  30. package/pack/generated/claude/skills/devrites-lib/reference/workspace-artifact-schema.md +41 -38
  31. package/pack/generated/claude/skills/rite-autocomplete/SKILL.md +35 -38
  32. package/pack/generated/claude/skills/rite-autocomplete/reference/loop.md +66 -59
  33. package/pack/generated/claude/skills/rite-autocomplete/reference/stop-conditions.md +28 -28
  34. package/pack/generated/claude/skills/rite-build/reference/parallel-batch.md +17 -15
  35. package/pack/generated/codex/skills/devrites-lib/SKILL.md +2 -0
  36. package/pack/generated/codex/skills/devrites-lib/reference/parallel-workspaces.md +108 -115
  37. package/pack/generated/codex/skills/devrites-lib/reference/standards/afk-hitl.md +18 -17
  38. package/pack/generated/codex/skills/devrites-lib/reference/workspace-artifact-schema.md +41 -38
  39. package/pack/generated/codex/skills/rite-autocomplete/SKILL.md +35 -38
  40. package/pack/generated/codex/skills/rite-autocomplete/reference/loop.md +66 -59
  41. package/pack/generated/codex/skills/rite-autocomplete/reference/stop-conditions.md +28 -28
  42. package/pack/generated/codex/skills/rite-build/reference/parallel-batch.md +17 -15
  43. package/pack/generated/devin/skills/devrites-lib/SKILL.md +2 -0
  44. package/pack/generated/devin/skills/devrites-lib/reference/parallel-workspaces.md +108 -115
  45. package/pack/generated/devin/skills/devrites-lib/reference/standards/afk-hitl.md +18 -17
  46. package/pack/generated/devin/skills/devrites-lib/reference/workspace-artifact-schema.md +41 -38
  47. package/pack/generated/devin/skills/rite-autocomplete/SKILL.md +35 -38
  48. package/pack/generated/devin/skills/rite-autocomplete/reference/loop.md +66 -59
  49. package/pack/generated/devin/skills/rite-autocomplete/reference/stop-conditions.md +28 -28
  50. package/pack/generated/devin/skills/rite-build/reference/parallel-batch.md +17 -15
  51. package/pack/generated/dsh/skills/devrites-lib/SKILL.md +2 -0
  52. package/pack/generated/dsh/skills/devrites-lib/reference/parallel-workspaces.md +108 -115
  53. package/pack/generated/dsh/skills/devrites-lib/reference/standards/afk-hitl.md +18 -17
  54. package/pack/generated/dsh/skills/devrites-lib/reference/workspace-artifact-schema.md +41 -38
  55. package/pack/generated/dsh/skills/rite-autocomplete/SKILL.md +35 -38
  56. package/pack/generated/dsh/skills/rite-autocomplete/reference/loop.md +66 -59
  57. package/pack/generated/dsh/skills/rite-autocomplete/reference/stop-conditions.md +28 -28
  58. package/pack/generated/dsh/skills/rite-build/reference/parallel-batch.md +17 -15
  59. package/pack/generated/omp/skills/devrites-lib/SKILL.md +2 -0
  60. package/pack/generated/omp/skills/devrites-lib/reference/parallel-workspaces.md +108 -115
  61. package/pack/generated/omp/skills/devrites-lib/reference/standards/afk-hitl.md +18 -17
  62. package/pack/generated/omp/skills/devrites-lib/reference/workspace-artifact-schema.md +41 -38
  63. package/pack/generated/omp/skills/rite-autocomplete/SKILL.md +35 -38
  64. package/pack/generated/omp/skills/rite-autocomplete/reference/loop.md +66 -59
  65. package/pack/generated/omp/skills/rite-autocomplete/reference/stop-conditions.md +28 -28
  66. package/pack/generated/omp/skills/rite-build/reference/parallel-batch.md +17 -15
  67. package/pack/generated/pi/skills/devrites-lib/SKILL.md +2 -0
  68. package/pack/generated/pi/skills/devrites-lib/reference/parallel-workspaces.md +108 -115
  69. package/pack/generated/pi/skills/devrites-lib/reference/standards/afk-hitl.md +18 -17
  70. package/pack/generated/pi/skills/devrites-lib/reference/workspace-artifact-schema.md +41 -38
  71. package/pack/generated/pi/skills/rite-autocomplete/SKILL.md +35 -38
  72. package/pack/generated/pi/skills/rite-autocomplete/reference/loop.md +66 -59
  73. package/pack/generated/pi/skills/rite-autocomplete/reference/stop-conditions.md +28 -28
  74. package/pack/generated/pi/skills/rite-build/reference/parallel-batch.md +17 -15
  75. package/package.json +1 -1
@@ -10,6 +10,7 @@ Autocomplete chains existing `/rite-*` workflows without routine-phase pauses. A
10
10
  ## Arm AFK once
11
11
 
12
12
  ```yaml
13
+ mode: autocomplete
13
14
  allow_gates: [advisory, validating]
14
15
  # max_slices / max_agents / max_minutes / max_review_queue omitted: unlimited
15
16
  # continue_sequence: false # opt out; default chains after Seal GO
@@ -20,18 +21,15 @@ allow_gates: [advisory, validating]
20
21
  # notify: "<cmd>"
21
22
  ```
22
23
 
23
- Read existing sentinel first. Preserve valid bytes, except
24
- when this invocation contains `--parallel N`: then write or replace only
25
- `max_parallel: N` and leave every other key unchanged. Stop if the sentinel is
26
- malformed. Do not stop because it names `max_slices` / `max_agents` /
27
- `max_minutes` / `max_review_queue` or only `[advisory]`. If absent, write it
28
- once after clarity, and include `max_parallel: N` when that flag is present.
29
- Without the flag, seed a newly created sentinel from retained global lease capacity
30
- when present; otherwise use fresh-run default 10. Never replace a valid existing
31
- sentinel's capacity from lease/default. Never write `max_slices` from `--max-slices`.
32
- It is otherwise read-only: never rewrite it after Vet or reset it on resume. Leftover `expires_at` is ignored
33
- and never rewritten. **Failing case:** leftover `max_parallel: 1` keeps the run
34
- serial after `--parallel 5`.
24
+ Read existing AFK first. On each explicit Autocomplete invocation, upsert only
25
+ `mode: autocomplete` and, if supplied, `max_parallel: N`; preserve other fields.
26
+ Missing mode retains standalone AFK behavior until that explicit entry. Invalid
27
+ or duplicate mode fails closed; mode grants neither phase nor action authority.
28
+ If absent, create AFK after clarity with the mode above; capacity is explicit N,
29
+ else retained global lease capacity, else 10. Preserve existing capacity without
30
+ the flag. Nested phases/wakes leave AFK unchanged: no `max_slices` flag seeding,
31
+ expiry rewrite or reset. Legacy slice/agent/time/review limits do not stop this
32
+ controller. **Failing case:** `--parallel 5` retains `max_parallel: 1`.
35
33
 
36
34
  ### Derive the mutable post-vet budget
37
35
 
@@ -41,18 +39,41 @@ remaining. AFK configuration itself stays unchanged.
41
39
 
42
40
  ### Admit each unattended cycle
43
41
 
44
- Before each phase, review fan-out, recovery, or writer dispatch: cheapest
45
- readiness check first; reject overlap. Do not stop on `max_agents`,
46
- `max_minutes`, or `max_review_queue`. Count every leaf result. New activations reset activation-local counters, retaining durable slice/recovery state.
47
-
48
- [Build return](../../rite-build/reference/output.md#caller-owned-continuation).
49
- Pass `--parallel N`; ignore leftover cap/headroom, remaining-0,
50
- and `--max-slices` stops. Agent-invented dispatch, wait, tool-call, or turn budgets are not stop conditions.
51
- An explicit human request to pause or run only a bounded subset still wins.
52
- Path collisions serialize work; they do not end the run.
53
- Resolve ranked validating/blocking picks via `devrites-engine state resolve`;
54
- never hand `/rite-resolve` to the user. Escalating, irreversible-risk, access, blocking
55
- without recommendations, and Seal judgment (`slice: seal`) still pause.
42
+ Before each phase/fan-out/recovery/writer, check readiness/overlap and apply early
43
+ admission and the global pass below; local readiness is insufficient. Count every leaf.
44
+ Explicit activation resets only activation-local counters, not durable recovery.
45
+ Pass resolved `--parallel N` to [Build](../../rite-build/reference/output.md#caller-owned-continuation).
46
+ Legacy or invented execution ceilings never stop this controller; human limits bind.
47
+ Resolve ranked validating/blocking picks via `devrites-engine state resolve`, not
48
+ a user handoff. Escalating, irreversible-risk, access, unrecommended blocking picks
49
+ and Seal judgment (`slice: seal`) still pause.
50
+
51
+ ## Early preparation admission
52
+
53
+ Internal exclusive `context`/`dispatch open` flags:
54
+ - `--prepare-for <parent-source>`: permitted native non-Build preparation roles
55
+ (only controlling-root context may be roleless), exact existing immediate
56
+ successor/parent agreeing on canonical identity, binding, adjacency and chain.
57
+ Exempts the child's successor gate, never product writes.
58
+ - `--sequence-research`: only canonical `evidence-scout`, Spec/Clarify/Temper/Define/
59
+ Plan/Vet, exact existing source and normal path/role/ledger constraints. Exempts
60
+ authority/successor admission solely to investigate broken authority read-only:
61
+ no acceptance, scope/approval/phase advance, successor creation, writers,
62
+ readiness or preparation credit.
63
+
64
+ Context (`--skill rite-<phase>` too) checks before writes; no account required.
65
+ Use context → packet → open → native launch → `dispatch start` actual handles
66
+ before parent admission; openings alone do not count.
67
+
68
+ Derive preparatory-only B before any marked wave from nonterminal parent A:
69
+ until ordinary unmarked B Temper/Define/Plan/Vet or Build-wright admission
70
+ (checking C first), A becoming terminal or ordered handoff to B, C waits—even
71
+ explicit C `next`/`check continuation`. No C creation/rerouting before A's eligible
72
+ phase. Completed B history retains this bound; Spec/Clarify/research/read-only
73
+ Build do not release it. Independent work stays visible; all global-pass gates bind.
74
+
75
+ Shared registry edits alone do not serialize disjoint modules. Isolate their
76
+ writer; refusal-only tests never replace positive requirements or defer their band.
56
77
 
57
78
  ## Phase arc
58
79
 
@@ -72,12 +93,10 @@ Workspace files, not chat, carry state. Read/execute each phase skill:
72
93
  | 10 | `/rite-seal` | GO/NO-GO; no Git |
73
94
  | 11 | `/rite-ship` | only after GO; `--ship` never authorizes Git; stop at literal-GO/native approval |
74
95
 
75
- At phase entry, before cold/local recovery, on landing/reviewer/planning returns
76
- and before native waits, run `devrites-engine frontier <source>` and execute the
77
- shared [global frontier pass](../../devrites-lib/reference/parallel-workspaces.md#continuous-global-frontier).
78
- Its report requires authorized preparation/Vet and mixed selection, not a pause.
79
- Preserve local cursors, pending handles and protected validation windows;
80
- scheduling precedes owner Seal without changing ordered handoff below.
96
+ At phase entry, before recovery/waits, execute the
97
+ [global pass](../../devrites-lib/reference/parallel-workspaces.md#continuous-global-frontier).
98
+ Consume persisted return frontiers; rerun after landing/artifact/capacity changes.
99
+ Execute authorized routes, retaining handles, cursors and protected proof windows.
81
100
 
82
101
  Check [stop-conditions.md](stop-conditions.md) before advancing. Discard stale
83
102
  pass evidence after source edits. Re-read the selected source before each phase per [phase target binding](../../devrites-lib/reference/parallel-workspaces.md#phase-target-binding). On a cold resume or
@@ -90,19 +109,12 @@ floor; `--update` never excuses an unreconciled regression.
90
109
 
91
110
  ## Sequence continuation
92
111
 
93
- Unless `continue_sequence: false`, while sequence budget remains
94
- ([sentinel](../../devrites-lib/reference/standards/afk-hitl.md#sequence-continuation-continue_sequence-max_workspaces)),
95
- step 10 does not end the run: leave the sealed workspace unshipped with its
96
- `Next step: /rite-ship`, then invoke the next recorded continuation
97
- (`/rite-spec <parent>-<n> "<objective>"` from the parent's `decisions.md` sequence)
98
- and re-enter step 1. Spend one workspace per opened continuation.
99
-
100
- For an already prepared child, do not re-specify. Follow
101
- [`parallel-workspaces.md`](../../devrites-lib/reference/parallel-workspaces.md)
102
- while the owner is still running: honor claims, repair/re-Vet stale readiness,
103
- and admit only explicitly independent/dependency-satisfied isolated work.
104
- ACTIVE changes to the child only at normal ordered handoff after the owner Seal;
105
- resume its durable cursor without a second controller or another opening charge.
112
+ With a recorded successor, budget and no opt-out, Seal GO stays internal:
113
+ leave the owner sealed/unshipped with `/rite-ship`; resume the child's cursor/
114
+ controller or authorized native Spec. Use the
115
+ [shared grammar](../../devrites-lib/reference/workspace-artifact-schema.md#what-each-file-owns).
116
+ Charge once; pipeline only immediate successors. ACTIVE changes at ordered handoff,
117
+ not early planning or isolated independent Build.
106
118
 
107
119
  Before invoking a continuation, require durable `state.md`
108
120
  `sequence_workspaces_remaining > 0`; if absent, first write
@@ -156,19 +168,14 @@ and park it after three escalations while independent work continues.
156
168
 
157
169
  ## Continuous caller obligation
158
170
 
159
- Green slice/phase checkpoints consume their recorded `next_action` internally;
160
- only the caller replies finally at completion or a genuine stop.
161
- Before a reply, `devrites-engine check continuation` must print `continuation: clear`; `required` means invoke `invoke:` now.
162
- No user-facing reply is permitted while durable state contains agent-owned
163
- `NEEDS_REPLAN`, an intermediate Plan/Vet action, a distinct retained
164
- Critical/Important fingerprint below its cap or with an escalation left, runnable
165
- work independent of a parked fingerprint, or an open blocking question that
166
- already names a ranked recommended option. Invoke the next internal repair or
167
- `devrites-engine state resolve` immediately, unless that writer already hit the
168
- [resolver-failure stop](stop-conditions.md#other-stop-classes). **Failing case:**
169
- `state resolve` exits 1 on every call and the loop re-invokes it without end. A narrow reviewer closing one finding and exposing another
170
- Critical/Important invariant is progress, not exhaustion.
171
-
172
- The number of completed repair/Vet cycles, context pressure, compaction, session
173
- duration, and nested completion never turn checkpoints into handoffs. Persist and
174
- resume to the requested rest point or shared human/safety/access/parked-recovery stop.
171
+ Execute each green slice/phase's `next_action` internally. Before replying, run
172
+ `devrites-engine check continuation`: consume `required`'s `invoke:`; only `clear`
173
+ permits reply. Controller normalization/preparation/foreign work precedes local
174
+ Build; local repair/picks/reconciliation/discharged deferrals keep their phase,
175
+ not recursive Autocomplete. Route agent-owned NEEDS_REPLAN, budgeted Critical/Important recovery,
176
+ independent work and recommended blocking answers internally; invoke repair or
177
+ `state resolve` unless the [resolver-failure stop](stop-conditions.md#other-stop-classes)
178
+ applies. Distinct invariants are progress; unchanged resolver retries are not.
179
+ Cycles, context pressure, compaction, duration and nested completion never create
180
+ handoffs. Persist/resume until requested completion or a shared human/safety/
181
+ access/parked-recovery stop.
@@ -26,24 +26,27 @@ Fully escalated fingerprints park unless remaining owner is human.
26
26
 
27
27
  ## Not stops: internal technical routing
28
28
 
29
- AFK + `status=running` + an internal phase `next_action` is not a stop. `devrites-engine check continuation` prints `required` for that cursor and `clear` for `/rite-ship`, `awaiting_human`, a question cursor, or an open blocking or escalating question.
30
-
31
- `NEEDS_REPLAN` is not a stop condition under active Autocomplete. It blocks
32
- forward work, persists the return cursor, and invokes Plan repair plus Recovery
33
- Vet inline. The same applies to nested `STOP`/`Next step` when its decision is
34
- agent-owned.
35
-
36
- Agent-owned backtracking is not a stop condition while its exact causal
37
- fingerprint has budget: invoke earlier phase, affected Vet, remediation, proof;
38
- resume origin. Three no-progress corrections spend only that fingerprint's current
39
- strategy: escalate inline to the next class (shared root cause, diagnostic
40
- amplification, boundary redesign) with fresh budget, without permission. After
41
- three escalations per activation it parks; finish independent work, then stop once.
42
- Preserve reproduction, attempts, and dead ends; never offer `/rite-plan unblock`
43
- or another routine phase command. A new user-issued `/rite-autocomplete`
44
- reopens parked fingerprints with fresh escalation; wakes and compaction do not.
45
- Closure is progress; a separately evidenced Critical/Important invariant starts
46
- its own cap and cannot extend the closed one.
29
+ For AFK `status=running`, consume an internal phase edge. In
30
+ `mode: autocomplete`, actionable global normalization, preparation or foreign
31
+ work takes priority over local Build; local-only picks do not recurse through
32
+ Autocomplete. Source human/Ship holds remain binding, while independent
33
+ authorized planning can continue. `clear` is reply permission, not Ship approval.
34
+
35
+ A preparation refusal routes native work or a narrow disclosed scheduling
36
+ deferral under the [global pass](../../devrites-lib/reference/parallel-workspaces.md#continuous-global-frontier).
37
+ Deferral removes only its named scheduling obligation from repeated continuation:
38
+ it neither makes a placeholder prepared nor waives readiness, malformed authority,
39
+ claims, isolation, proof or human gates. Qualified foreign serial handoff is a
40
+ separate rule. Revisit deferrals when their constraint changes.
41
+
42
+ Agent-owned NEEDS_REPLAN or nested STOP persists the return cursor and invokes
43
+ Plan repair, affected Recovery Vet, remediation and proof inline. Three
44
+ no-progress corrections spend that fingerprint's strategy; escalate through
45
+ shared root cause, diagnostic amplification and boundary redesign without asking.
46
+ After three escalations, park it and finish independent work. Preserve attempts;
47
+ resume through `/rite-autocomplete`, not a routine phase command. A new explicit
48
+ invocation reopens parked fingerprints; wakes/compaction do not. Closure is
49
+ progress; a distinct Critical/Important invariant gets its own cap.
47
50
 
48
51
  Spent consumptive-action authorization is not technical-recovery exhaustion.
49
52
  It blocks another execution; retained new Critical/Important evidence still
@@ -72,14 +75,10 @@ Without a safe seam, escalate or park; only a real human/risk/scope gate stops f
72
75
  - **Clarify:** material `open`/unowned decision coverage or a
73
76
  low-confidence high-consequence assumption. Continue the initial interview;
74
77
  never arm AFK early.
75
- - **Seal:** report remaining NO-GO with every blocker/fix direction; never round
76
- up to GO. Resolve recommended-option blocking questions internally; recover
77
- agent-owned findings and re-enter Seal. A first NO-GO is not a stop:
78
- recover every agent-owned blocker (missing or unbound proof, a reviewer gap root
79
- can close, a finding with a fix direction, a missing `review.md` verdict), then
80
- re-enter Seal. The unattended `N` to accepting Important risks means repair, not
81
- stop. Stop only for blockers that need a human: accepting a risk, changing scope
82
- or an acceptance criterion, or access. Record each one as a question.
78
+ - **Seal:** NO-GO never rounds up to GO. Recover agent-owned missing/unbound proof,
79
+ reviewer gaps and findings, then re-enter Seal; declining Important-risk
80
+ acceptance means repair. A human-owned risk, scope/acceptance change or access
81
+ blocker remains a question. A first repairable NO-GO is not a handoff.
83
82
  - **Reslice:** execute its marked action before deciding continue/stop.
84
83
  - **Slice budget:** do not stop on `--max-slices`. Leftover
85
84
  pre-existing remaining value, explicit flag, sentinel cap, or post-vet pending count
@@ -89,8 +88,9 @@ Without a safe seam, escalate or park; only a real human/risk/scope gate stops f
89
88
  another session blocks only work on those paths; run independent work, re-check,
90
89
  and stop only when nothing independent remains. `released`/`dead` claims are
91
90
  reconciled per [§ Cancellation](../../devrites-lib/reference/parallel-dispatch.md#cancellation-and-terminal-reconciliation).
92
- - **Resource envelope:** overlapping run or missing AFK after arm still stops.
93
- Do not stop on `--max-slices`, `max_agents`, `max_minutes`, or `max_review_queue`.
91
+ - **Resource envelope:** overlapping controllers, missing AFK after arm or invalid/
92
+ duplicate mode fail closed. Ignored slice/agent/time/review ceilings do not stop
93
+ Autocomplete; mode itself grants no authority.
94
94
  - **Confidence:** intent still cannot become testable acceptance after interview.
95
95
  - **Repeated failure:** not a stop. Escalate; fully escalated fingerprints park.
96
96
  Stop only when no independent work remains.
@@ -4,11 +4,11 @@
4
4
 
5
5
  Opt-in only. Default `/rite-build` stays [`one-slice-cycle.md`](one-slice-cycle.md).
6
6
 
7
- Autocomplete runs `devrites-engine frontier <source>` and executes shared
8
- [`parallel-workspaces.md`](../../devrites-lib/reference/parallel-workspaces.md#continuous-global-frontier):
9
- it owns preparation, global admission and controller routing. Standalone Build
10
- stays source-local; frontier notices from `parallel select --from-plan` do not
11
- expand its picks. Autocomplete consumes `frontier-select-command`, then this lifecycle.
7
+ Autocomplete executes the shared [global pass](../../devrites-lib/reference/parallel-workspaces.md#continuous-global-frontier)
8
+ before local writers: actual immediate-successor preparation or narrow disclosed
9
+ deferral, then global cohort admission. Consume fresh dispatch-return scheduling.
10
+ Standalone Build stays local; select notices never broaden its picks. A placeholder
11
+ is not preparation; one successor pipelines safely without preparing the whole roadmap.
12
12
 
13
13
  ## Entry
14
14
 
@@ -17,13 +17,15 @@ expand its picks. Autocomplete consumes `frontier-select-command`, then this lif
17
17
  | omitted / `--parallel 1` | Serial one-slice |
18
18
  | `--parallel N` (**2≤N≤10**) | N is a **cap**, not a quota: run the largest eligible set ≤ N |
19
19
  | non-integer / `N≤0` / `N>10` | Hard refuse (no silent clamp) |
20
- | Autocomplete `--parallel N` | N is the cap for this run; leftover sentinel `max_parallel` is ignored, then `/rite-autocomplete` writes or replaces only `max_parallel: N` |
20
+ | Autocomplete `--parallel N` | Global cap for this run; controller entry upserts mode and explicit capacity, preserving other AFK fields |
21
21
  | Autocomplete, no flag | Same path, cap from sentinel `max_parallel` else 10; serial only when ineligible |
22
22
 
23
23
  AFK caps `N`. Charge each green sibling once after its successful landing;
24
24
  rejected/unlanded work charges zero, without undoing prior landed accounting.
25
25
  `parallel create` refuses another retained repository controller.
26
- 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.
26
+ Cold resume reconciles retained repair artifacts by exact fingerprint. A blocked
27
+ label, round count or distinct finding alone does not stop: establish current
28
+ review coverage under step 4 and repair unless a genuine stop remains.
27
29
 
28
30
  ## Dynamic selection and re-batching
29
31
 
@@ -89,14 +91,14 @@ Before `parallel select`, add each slice's hidden write surfaces (list owner:
89
91
  snapshot directory, formatter sweep — and compare paths case-folded
90
92
  (`src/Api.ts` = `src/api.ts`); `--from-plan` adds the manifest/lockfile for a package.
91
93
  Slices colliding on either run serially; the rest
92
- stay eligible. Record `serial: <ids> — <surface>` in `evidence.md`. Under AFK
93
- with `max_parallel ≥ 2`, `dispatch open` refuses a build wright wave narrower
94
- than the from-plan batch until that wave holds the other picks or `serial:`
95
- names each skipped one. Repairing a slice, or a slice already in the lease,
96
- does not waive them. A `serial:` reason that only says the skipped slice is
97
- repairing, already started, or in a wave does not count. HITL is never refused. **Failing
98
- case:** two slices each add a dependency, run in parallel, and integrate fails or
99
- lands a broken lockfile.
94
+ stay eligible. Record `serial: <ids> — <surface>` in `evidence.md`. AFK cap≥2
95
+ refuses narrower Build-wright waves until other picks are started/reserved or
96
+ each skipped pick has a substantive serial reason. Repairing/already-started/in-wave
97
+ alone is not a reason. Controller admission also includes ready foreign picks:
98
+ only exact `serial: child/SLICE-001 — <reason>` can defer that foreign lane; bare
99
+ `SLICE-001` is local. Preparation `frontier-blocked:` cannot waive ready Build
100
+ picks or safety gates. Qualified unsupported-isolation deferral preserves truthful
101
+ owner dispatch/ordered handoff, never early same-tree foreign Build. HITL stays unchanged.
100
102
 
101
103
  ## Control vs workers
102
104
 
@@ -39,6 +39,8 @@ lifecycle state from chat or optional `README.md`.
39
39
  completion states. The host renders the response normally.
40
40
  - [`reference/parallel-workspaces.md`](reference/parallel-workspaces.md): explicit
41
41
  phase targets, one isolated global controller, and source-owned proof.
42
+ - [Autocomplete loop](../rite-autocomplete/reference/loop.md#early-preparation-admission):
43
+ controller-only early preparation, bounded successor routing and normalization research.
42
44
  - [`reference/visual-playbooks/index.md`](reference/visual-playbooks/index.md): progressive
43
45
  visual HTML playbook router (load matching ids only; dual-read outline).
44
46
 
@@ -12,65 +12,45 @@ candidate bindings and proof belong to that source. A missing source artifact
12
12
  routes its prerequisite; it never falls back to another workspace's artifacts.
13
13
  An explicit valid workspace does not require ACTIVE to name it or to exist.
14
14
 
15
- Carry that source through Spec → Clarify → Temper → Define/Plan → Vet and later
16
- Build/Converge/Prove/Polish/Review/Seal/Ship entrypoints. Use existing slug arguments
17
- where supported, including `context <source>` and `handoff <source> --resume`.
18
- For qid-only `state resolve` (including `--drop`/`--batch`), keep its existing argv
19
- and bind the call with `DEVRITES_ROOT=<absolute-control>/.devrites` and
20
- `DEVRITES_WORKSPACE=<absolute-control>/.devrites/work/<source>`. The override is a
21
- workspace path, not a slug. Apply this environment only to that invocation;
22
- neither a fabricated resolver slug argument nor process-global environment
23
- mutation is routing. Use the same source binding for nested recommended answers.
24
-
25
- Preparing or running an admitted future source preserves the ordered owner's
26
- ACTIVE and retained writer/controller. Ordinary standalone Spec still sets ACTIVE;
27
- explicit `--lookahead` still stops at planning/Vet and never becomes a Build root.
15
+ Carry SOURCE through every phase, nested resolution and cold handoff. Use existing
16
+ slug arguments (`context <source>`, `handoff <source> --resume`). Qid-only
17
+ `state resolve` retains its argv: bind only that invocation's `DEVRITES_ROOT` and
18
+ `DEVRITES_WORKSPACE` as above, never a fabricated resolver slug or process-global
19
+ change. Early future work preserves ACTIVE and the retained controller.
20
+ Standalone Spec still sets ACTIVE; `--lookahead` remains planning/Vet-only.
28
21
  Target binding changes neither phase approval nor Ship authority.
29
22
 
30
23
  ## Authority and admission
31
24
 
32
- Resolve one controlling root and ordered lifecycle owner. `.devrites/ACTIVE` stays
33
- on that owner until normal sequence handoff; scheduling a future slice does not
34
- advance ACTIVE or create a second Build root. One repository-global lease owns
35
- control-tip mutations. Resume its controller, source identities and retained
36
- handles before admitting more work; status queried via ACTIVE/source reports the
37
- actual retained controller even after ordered handoff. Another retained
38
- controller is not bypassable; no extra cursor pointer is needed.
39
-
40
- The existing `--parallel N` is one global active-writer cap, not a target guarantee:
41
- explicit invocation value, else AFK `max_parallel`, else retained lease capacity
42
- on resume, else 10. Explicit 1 means one writer, not one writer per workspace.
43
- Review queues obey host capacity and existing reviewer caps separately; neither
44
- capacity nor a Reslice cap waiver waives required named-role fanout or proof gates.
45
-
46
- Use the engine frontier below for recorded source-related sequence membership.
47
- Honor `continue_sequence: false`, opening budget and human bounded requests.
48
- Charge each opening once; reuse prepared children and their cursor.
49
- Unrelated directories or user-mentioned slugs are not automatic enrollment.
50
- Respect workspace claims: a live lookahead owner retains its artifacts until
51
- release/terminal reconciliation. Root alone writes workspace artifacts; leaves
52
- never write `.devrites/**`.
53
-
54
- For each future slice, native Plan/Vet must have CURRENT approved readiness,
55
- a complete bound contract and explicit `Workspace dependencies` under
56
- [canonical slice grammar](workspace-artifact-schema.md#canonical-slice-grammar).
57
- Plan/Vet checks assumptions, consumed interfaces, shared runtime resources and
58
- independent slice proof. `none` is a native declaration, never an inference from
59
- path disjointness, local `Dependencies: none`, planning digests or a green branch.
60
- Only durably BUILT/integrated producer checkpoints satisfy qualified dependencies;
61
- validate each producer reference and graph, including safely archived predecessors.
62
- Cycles, unknown/malformed references and shared unisolated runtime withhold unsafe
63
- candidates. A waiting producer withholds only its consumers, not unrelated work.
64
-
65
- Missing declarations in legacy future plans need narrow Plan repair + affected
66
- Vet before early admission; existing local/standalone plans remain valid. Absent,
67
- incomplete, stale or human-blocked future work is a planning/repair/blocked
68
- opportunity, not a fatal pool failure. Retain every readiness reason: fixing stale
69
- bindings does not waive a coexisting human/access/safety gate. Re-Vet affected
70
- predecessor assumptions, then record current bindings; never auto-refresh a digest.
71
- Read archived predecessors in place through the engine's referenced read-only
72
- readiness lookup. Never copy an archive into live `work/` merely to read/hash it:
73
- that can resurrect stale controller leases and claims.
25
+ Keep ACTIVE on the ordered owner until normal handoff. One repository-global
26
+ lease owns control-tip mutations; recover its controller, source identities and
27
+ handles before more admission, including after handoff. No second Build root.
28
+ `--parallel N` caps active writers globally: explicit N, else AFK `max_parallel`,
29
+ else retained capacity on resume, else 10. One means one writer total. Review
30
+ queues retain host/reviewer caps; capacity or Reslice never waives fanout or proof.
31
+
32
+ Only checked source-related sequence membership qualifies; user-mentioned or
33
+ unrelated directories are not enrollment. Current canonical `roadmap.md` follows
34
+ [the grammar](workspace-artifact-schema.md#what-each-file-owns): one related live/
35
+ archived owner, actual chain root, same-owner unique decision and contiguous
36
+ position table. It supersedes historical tables for scheduling without rewriting
37
+ them. Invalid canonical authority fails closed; absence retains conservative
38
+ legacy resolution. Honor opt-out, opening budgets and human bounds; charge each
39
+ opening once. Lookahead claims retain artifacts through terminal reconciliation.
40
+ Root alone writes workspace artifacts; leaves never write `.devrites/**`.
41
+
42
+ Native Plan/Vet must bind CURRENT readiness, contract, producer assumptions and
43
+ explicit future `Workspace dependencies` per [slice grammar](workspace-artifact-schema.md#canonical-slice-grammar).
44
+ `none` is a native declaration, not an inference from paths, local dependencies,
45
+ digests or green branches. Only durable BUILT/integrated checkpoints satisfy
46
+ validated producer references/graphs, including safely archived predecessors.
47
+ Unknown references, cycles and shared unisolated runtime withhold unsafe slices;
48
+ waiting producers withhold consumers, not independent work. Legacy future plans
49
+ need narrow Plan repair/affected Vet; standalone/local plans retain their rules.
50
+ Per-slice withheld diagnostics do not block other returned eligible IDs;
51
+ workspace-wide readiness failures still withhold the source.
52
+ Preserve coexisting stale-readiness and human/access/safety reasons. Re-Vet changed
53
+ assumptions; never auto-refresh digests or copy archives into live `work/`.
74
54
 
75
55
  ## Recover avoidable serialization
76
56
 
@@ -108,66 +88,79 @@ reslicing unchanged work.
108
88
 
109
89
  ## Continuous global frontier
110
90
 
111
- Autocomplete executes this bounded pass at every phase entry (including cold
112
- Prove/Vet/Review), before phase-local recovery, on each landing/planning/review
113
- return, and immediately before a native wait or final reply. A nested phase
114
- returns scheduling to Autocomplete; its source-local phase/recovery return cursor
115
- and pending native reviewer handles remain intact. This is not a second phase
116
- controller or a persistent frontier artifact.
117
-
118
- 1. Run `devrites-engine frontier <source>` before local recovery or selection.
119
- This read-only report names the related pool, preparation/repair actions and
120
- blockers; it neither authorizes work nor changes the source's local cursor.
121
- For `frontier-prepare` and `frontier-workspace` prepare/repair actions, execute
122
- authorized native Spec → Clarify → Temper → Define/Plan → affected Vet now,
123
- not after owner Seal. Check source gates, claims and planning/Build restrictions.
124
- For `frontier-review-sequence`, read the named approved roadmap/artifacts:
125
- native authority normalization must record the exact continuation through its
126
- owning decision/phase before rerunning frontier. Ambiguous legacy prose,
127
- positive remaining budget and path disjointness never imply permission.
128
- Retain unresolved authority blockers; continue independent authorized work.
129
- Owner-local red/human/access gates withhold that owner and actual consumers;
130
- whole-run safety/access/claim constraints still bind. Record actions/blockers
131
- in existing source artifacts under normal write authority.
132
- Yield children at pending reviewer/phase boundaries; reconcile available
133
- parent returns before another pass. Reporting actions or reading phase skills
134
- is not executing preparation/Vet. Wait only after authorized actions across
135
- the pool have run or reached concrete pending handles/blockers.
136
- 2. Reconcile explicit/AFK capacity changes with
137
- `parallel add --root <repo> --slug <controller> --cap N --json -`, stdin `[]`.
138
- This changes capacity only. Below active count, pause admissions, drain and
139
- retry; never cancel workers to meet a lower cap. Recover a pending recorded
140
- landing before admission; unrelated HEAD/ref movement remains blocked.
141
- Rerun frontier after preparation/repair or capacity changes. Execute returned
142
- `frontier-select-command` with only authorized live `--workspaces`: this exact
143
- candidate list includes the `--slug` controller only when eligible. This is
144
- internal, not a new user flag. `frontier: none` retains source-local routing.
145
- Source-local `parallel select --from-plan` notices neither select globally nor
146
- expand picks. Route notices to their source; running slots/paths seed mixed
147
- selection globally. Zero picks with live writers means continue planning/review
148
- or wait, not Prove for unfinished sources.
149
- 3. Preflight selected slices against their SOURCE workspace with Build's normal
150
- slice/readiness/precondition, exact-path and runtime-isolation gates. Early
151
- foreign Build always uses isolated workers. For cap>1 on a capable host,
152
- isolate even the first lone local writer, so later sources can refill. Persist
153
- `--cap N` on create/add. With a retained lease, add even one pick; a complete
154
- retained lease can reopen only at unchanged control tip. After cleanup,
155
- create a new batch from current control. Never start another controller.
156
- Unsupported isolation uses truthful serial owner dispatch and ordinary ordered
157
- handoff, never early same-tree foreign Build or concurrent same-worktree writers.
158
- 4. Launch every selected native writer before waiting on any; keep scheduling
159
- planning and independent review while they run, including while the owner
160
- awaits Prove/Vet/Review accounts. Apply the protected window below before any
161
- landing: defer control mutations while frozen validation is pending. Outside
162
- that window, land each individually green sibling through Build review/proof
163
- and `parallel integrate --slice <key>`; refill immediately from the whole pool.
164
- A red or `integrate-failed` sibling retains its slot/paths for repair; it does
165
- not halt independent safe landings/refill. A pending landing intent still
166
- requires exact recovery above. Only durable integration satisfies producer edges.
167
- After worker-bound review/proof and source bookkeeping finish, prune only
168
- verified clean integrated checkouts with `parallel prune --root <repo>
169
- --slug <controller>`. Retain transfer refs/lease identities; dirty or ignored
170
- data stays with its reported recovery path and does not justify forced deletion.
91
+ Run this pass at phase entry, before local recovery/waits/reply, and after landing
92
+ or planning changes. A persisted `dispatch return` emits fresh scheduling after
93
+ locks release, even when later claim release fails: retain the nonzero failure
94
+ and claim exclusion. Exact successful claim reconciliation also refreshes;
95
+ rejected/unpersisted returns do not. Ordinary status stays read-only. Keep local
96
+ return cursors and native handles: one controller, not another phase or queue.
97
+
98
+ 1. Read `devrites-engine frontier <source>`, then its selected `frontier-authority`
99
+ paths before preparation. Follow the actual owner/decision, including archives;
100
+ local phase context is not a reason to create a second owner. Execute native actions.
101
+ Normalize unresolved legacy sequence authority through its owning decision/
102
+ phase. Positive budget, ambiguous prose or path disjointness grants nothing.
103
+ A current invalid canonical map is an error, never a fallback to history.
104
+ At controller cap>1, resolve sequence authority and start actual immediate-
105
+ successor preparation before ordinary local Temper/Define/Plan/Vet context or
106
+ dispatch open, and retain the full Build gate before claims/rounds/history.
107
+ Follow [early preparation](../../rite-autocomplete/reference/loop.md#early-preparation-admission)
108
+ for native launch/start, internal markers and bounded preparatory-only routing.
109
+ Missing targets need native Spec → Clarify → Temper → Define/Plan → affected
110
+ Vet; existing targets need current completed/readiness state, registered pending
111
+ native preparation, or an existing human/dependency hold. Completed live/
112
+ archived successors need no reopening; valid finite tails discharge the
113
+ obligation. Placeholders, reports and unopened waves prove nothing.
114
+ Opt-out, zero opening budget or source human/question holds prevent new
115
+ openings, not existing child preparation or independent work.
116
+ If preparation cannot start, retain `frontier-blocked: <successor> — <constraint>`
117
+ in source `evidence.md`. `frontier-blocked: sequence — <constraint>` may defer
118
+ unresolved historical normalization for valid independent local work. Each row
119
+ names one concrete native-reviewed constraint; keep it visible and revisit on
120
+ change. It discharges only that scheduling obligation, not readiness, malformed
121
+ canonical/AFK data, paths, claims, isolation, proof or human gates. It cannot
122
+ waive already-ready foreign picks or certify preparation/normalization.
123
+ 2. Reconcile explicit/AFK capacity via `parallel add --root <repo> --slug
124
+ <controller> --cap N --json -`, stdin `[]`. Below occupied count, freeze every
125
+ new launch, even reserved waves; reconcile/drain and retry without cancelling.
126
+ Recover recorded landing intent; unrelated HEAD/ref movement
127
+ stays blocked. Rerun frontier after changes and execute its exact authorized
128
+ `frontier-select-command`. Local select notices do not broaden picks. Existing
129
+ global slots and paths seed selection; reserve the mixed cohort in create/add
130
+ before separate source-local wave opens. Reservations assemble width, never
131
+ prove actor checkout/start. Ready foreign picks cannot disappear behind local
132
+ `serial:` records. A foreign deferral is exactly
133
+ `serial: child/SLICE-001 — <reason>` in source evidence; bare `SLICE-001` is local.
134
+ Substantive-reason rules apply; native workflow judges the constraint.
135
+ Re-evaluate owning serial rows when constraints change; engine checks exact
136
+ scope, not the truth of a host/resource claim.
137
+ Discharged deferrals are not repeatedly actionable. Foreign work/preparation
138
+ and authority normalization precede local Build; local-only reconciliation,
139
+ repair and picks retain their owning phase, not recursive Autocomplete.
140
+ Zero picks with live writers means planning/wait, not premature Prove.
141
+ 3. Apply SOURCE Build readiness/preconditions, exact paths and runtime isolation.
142
+ Early foreign Build always uses isolated workers. On a capable host at cap>1,
143
+ isolate even the first local writer for later refill; persist `--cap N`.
144
+ Add one pick to a retained lease; reopen a complete lease only at unchanged
145
+ control tip, or create from current control after cleanup. Unsupported
146
+ isolation uses qualified serial deferral, truthful local-owner dispatch and
147
+ ordinary ordered handoff, never early same-tree foreign/concurrent writers.
148
+ New dispatch accounts retain opaque `controller_batch` and immutable per-slice
149
+ normalized `admitted_paths`. Retain only each pending writer's lane; returned/
150
+ integrated siblings may release slots for rolling refill. Missing snapshots or
151
+ changed lease paths require actor reconciliation, never backfill from new tasks.
152
+ Exact claim identity/session still matters; release/expiry does not stop an actor.
153
+ Same-session claims allocate space, not extra write authority. None of these
154
+ records proves actual cwd/profile: verify through the native host.
155
+ 4. Start every selected native writer before waiting; continue independent native
156
+ planning/review while they run. Protected validation defers unsafe landings,
157
+ not independent preparation. Outside that window, land individually green
158
+ siblings through Build review/proof and `parallel integrate --slice <key>`;
159
+ refill globally. Red/integrate-failed siblings keep slots/paths for repair.
160
+ Durable integration alone satisfies producer edges. After worker-bound
161
+ accounts and source bookkeeping settle, `parallel prune --root <repo> --slug
162
+ <controller>` removes only verified clean integrated checkouts, retaining
163
+ transfer refs/lease identities. Dirty/ignored data keeps its recovery path.
171
164
 
172
165
  ## Identity, dispatch and proof
173
166