devrites 4.0.10 → 4.0.12

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 (40) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +6 -3
  3. package/docs/skills.md +2 -2
  4. package/pack/.claude/skills/devrites-debug-recovery/SKILL.md +5 -1
  5. package/pack/.claude/skills/devrites-lib/reference/reply-contract.md +6 -0
  6. package/pack/.claude/skills/devrites-lib/reference/standards/afk-hitl.md +3 -1
  7. package/pack/.claude/skills/devrites-lib/reference/standards/context-hygiene.md +9 -0
  8. package/pack/.claude/skills/devrites-lib/reference/standards/core.md +4 -1
  9. package/pack/.claude/skills/devrites-lib/reference/standards/one-shot-actions.md +7 -0
  10. package/pack/.claude/skills/devrites-lib/reference/standards/workflow-artifacts.md +27 -1
  11. package/pack/.claude/skills/rite-autocomplete/SKILL.md +8 -0
  12. package/pack/.claude/skills/rite-autocomplete/reference/loop.md +22 -1
  13. package/pack/.claude/skills/rite-autocomplete/reference/stop-conditions.md +11 -1
  14. package/pack/.claude/skills/rite-build/reference/phase-contract.md +5 -1
  15. package/pack/.claude/skills/rite-vet/SKILL.md +6 -2
  16. package/pack/generated/claude/skills/devrites-debug-recovery/SKILL.md +5 -1
  17. package/pack/generated/claude/skills/devrites-lib/reference/reply-contract.md +6 -0
  18. package/pack/generated/claude/skills/devrites-lib/reference/standards/afk-hitl.md +3 -1
  19. package/pack/generated/claude/skills/devrites-lib/reference/standards/context-hygiene.md +9 -0
  20. package/pack/generated/claude/skills/devrites-lib/reference/standards/core.md +4 -1
  21. package/pack/generated/claude/skills/devrites-lib/reference/standards/one-shot-actions.md +7 -0
  22. package/pack/generated/claude/skills/devrites-lib/reference/standards/workflow-artifacts.md +27 -1
  23. package/pack/generated/claude/skills/rite-autocomplete/SKILL.md +8 -0
  24. package/pack/generated/claude/skills/rite-autocomplete/reference/loop.md +22 -1
  25. package/pack/generated/claude/skills/rite-autocomplete/reference/stop-conditions.md +11 -1
  26. package/pack/generated/claude/skills/rite-build/reference/phase-contract.md +5 -1
  27. package/pack/generated/claude/skills/rite-vet/SKILL.md +6 -2
  28. package/pack/generated/codex/skills/devrites-debug-recovery/SKILL.md +5 -1
  29. package/pack/generated/codex/skills/devrites-lib/reference/reply-contract.md +6 -0
  30. package/pack/generated/codex/skills/devrites-lib/reference/standards/afk-hitl.md +3 -1
  31. package/pack/generated/codex/skills/devrites-lib/reference/standards/context-hygiene.md +9 -0
  32. package/pack/generated/codex/skills/devrites-lib/reference/standards/core.md +4 -1
  33. package/pack/generated/codex/skills/devrites-lib/reference/standards/one-shot-actions.md +7 -0
  34. package/pack/generated/codex/skills/devrites-lib/reference/standards/workflow-artifacts.md +27 -1
  35. package/pack/generated/codex/skills/rite-autocomplete/SKILL.md +8 -0
  36. package/pack/generated/codex/skills/rite-autocomplete/reference/loop.md +22 -1
  37. package/pack/generated/codex/skills/rite-autocomplete/reference/stop-conditions.md +11 -1
  38. package/pack/generated/codex/skills/rite-build/reference/phase-contract.md +5 -1
  39. package/pack/generated/codex/skills/rite-vet/SKILL.md +6 -2
  40. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to DevRites are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and DevRites adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Releases are generated automatically by [semantic-release](https://semantic-release.gitbook.io/) from Conventional Commits on `main`.
4
4
 
5
+ ## [4.0.12](https://github.com/ViktorsBaikers/DevRites/compare/v4.0.11...v4.0.12) (2026-08-09)
6
+
7
+ ### Fixed
8
+
9
+ * **rite:** keep internal replans in autocomplete ([9dbbd30](https://github.com/ViktorsBaikers/DevRites/commit/9dbbd30d6fbb088f2b175b6c4af06a9d7e5e9114))
10
+
11
+ ## [4.0.11](https://github.com/ViktorsBaikers/DevRites/compare/v4.0.10...v4.0.11) (2026-08-08)
12
+
13
+ ### Fixed
14
+
15
+ * **rite:** recover workflow materializer failures ([4ab042b](https://github.com/ViktorsBaikers/DevRites/commit/4ab042b269c90ce7133bb425d3db15469035255e))
16
+
5
17
  ## [4.0.10](https://github.com/ViktorsBaikers/DevRites/compare/v4.0.9...v4.0.10) (2026-08-08)
6
18
 
7
19
  ### Fixed
package/README.md CHANGED
@@ -28,7 +28,7 @@ project-conventional push, tag, or PR action, and archive the workspace.
28
28
  Unattended runs may create local WIP checkpoint commits along the way, but they
29
29
  remain local unless Ship's disclosed plan includes an approved remote action.
30
30
 
31
- **Status:** [`v4.0.10`](https://github.com/ViktorsBaikers/DevRites/releases/tag/v4.0.10): see [`CHANGELOG.md`](CHANGELOG.md) for release notes.
31
+ **Status:** [`v4.0.12`](https://github.com/ViktorsBaikers/DevRites/releases/tag/v4.0.12): see [`CHANGELOG.md`](CHANGELOG.md) for release notes.
32
32
 
33
33
  This is the latest published release; `main` may contain unreleased work.
34
34
 
@@ -83,7 +83,7 @@ the same skill.
83
83
  | 3 | Temper | [`/rite-temper`](pack/.claude/skills/rite-temper/SKILL.md) | Challenges scope and failure modes before Define. It is optional for small work and always runs in `/rite-autocomplete`. |
84
84
  | 4 | Define | [`/rite-define`](pack/.claude/skills/rite-define/SKILL.md) | Turns the approved spec into architecture, a plan, traceability, and vertical task slices; changed provider/consumer boundaries name one shared contract and consuming tests on both sides. |
85
85
  | 5 | Vet | [`/rite-vet`](pack/.claude/skills/rite-vet/SKILL.md) | Reviews every plan before implementation. The review depth scales with the risk. |
86
- | 6 | Build | [`/rite-build`](pack/.claude/skills/rite-build/SKILL.md) | In HITL, implements and verifies one product slice, then stops. Run it again for each remaining slice. An explicit `.devrites/AFK` sentinel permits bounded low-risk slice chaining under its cap and pause rules. Exact Vet-ready executable workflow artifacts under the active feature workspace are root-materialized and excluded from product slice accounting. |
86
+ | 6 | Build | [`/rite-build`](pack/.claude/skills/rite-build/SKILL.md) | In HITL, implements and verifies one product slice, then stops. Run it again for each remaining slice. An explicit `.devrites/AFK` sentinel permits bounded low-risk slice chaining under its cap and pause rules. Exact Vet-ready executable workflow artifacts under the active feature workspace are root-materialized and excluded from product slice accounting; their transaction code is proved in a disposable same-layout fixture before active writes and uses normal bounded recovery rather than a one-shot budget. |
87
87
  | 7 | Converge | [`/rite-converge`](pack/.claude/skills/rite-converge/SKILL.md) | Runs only when recovery is needed. It compares the code with the recorded intent, adds missing slices, and sends the changed plan back to Vet. |
88
88
  | 8 | Prove | [`/rite-prove`](pack/.claude/skills/rite-prove/SKILL.md) | Runs positive, discriminating tests, build/runtime checks, and UI proof, then binds the evidence to the exact candidate digest. |
89
89
  | 9 | Polish | [`/rite-polish`](pack/.claude/skills/rite-polish/SKILL.md) | Cleans up the candidate, normalizes UI when needed, performs durable capability/design/ADR rollups, and refreshes affected proof before closing it. |
@@ -105,7 +105,10 @@ Some work needs a different route:
105
105
  boundary-discriminating diagnostic design; only its next real acquisition attempt
106
106
  needs a new GO. After an upgrade introduces a supported workflow-artifact writer,
107
107
  Autocomplete reopens a stale missing-writer stop once instead of preserving the
108
- obsolete recovery count.
108
+ obsolete recovery count. The first real root-materializer failure then counts as
109
+ attempt one under normal fingerprint recovery; it is not terminal by itself.
110
+ Likewise, an internal `NEEDS_REPLAN` result stays inside Autocomplete: it runs
111
+ the next Plan repair and narrow Vet without returning a command to the user.
109
112
  - [`/rite-upgrade [slug]`](pack/.claude/skills/rite-upgrade/SKILL.md) is a
110
113
  compatibility route for an older active workspace that cannot resume. Age or
111
114
  cursor form alone never triggers repair; it is not a lifecycle phase.
package/docs/skills.md CHANGED
@@ -178,7 +178,7 @@ and `Shipped`. Utility commands keep the same compact labels and one-next-action
178
178
 
179
179
  | Skill | What It Does | Use When |
180
180
  |---|---|---|
181
- | [`rite-build`](../pack/.claude/skills/rite-build/SKILL.md) | In HITL, orchestrates one vertical product slice through the sole wright; an explicit `.devrites/AFK` sentinel may chain bounded low-risk slices. Exact Vet-ready executable proof artifacts under the active `.devrites/work/<slug>/` are instead materialized atomically by the controlling root and remain outside product candidate/slice accounting. | A plan exists, native semantic `CLEAR` and `READY` review passes, `test-plan.md` is complete, and the content-bound engine check passes. |
181
+ | [`rite-build`](../pack/.claude/skills/rite-build/SKILL.md) | In HITL, orchestrates one vertical product slice through the sole wright; an explicit `.devrites/AFK` sentinel may chain bounded low-risk slices. Exact Vet-ready executable proof artifacts under the active `.devrites/work/<slug>/` are instead materialized atomically by the controlling root and remain outside product candidate/slice accounting. The materializer transaction is proved first in a disposable same-layout fixture; its failures use normal three-attempt fingerprint recovery, not consumptive one-shot authority. | A plan exists, native semantic `CLEAR` and `READY` review passes, `test-plan.md` is complete, and the content-bound engine check passes. |
182
182
  | [`devrites-source-driven`](../pack/.claude/skills/devrites-source-driven/SKILL.md) | Consult official docs / source before relying on framework behavior; record the source. | API, config, or framework behavior is assumed rather than known. |
183
183
  | [`devrites-api-interface`](../pack/.claude/skills/devrites-api-interface/SKILL.md) | Design stable API / interface contracts: REST/GraphQL, module boundaries, type contracts, FE/BE split. | A slice crosses a boundary or defines a public interface. |
184
184
  | [`devrites-debug-recovery`](../pack/.claude/skills/devrites-debug-recovery/SKILL.md) | Reproduce → ranked hypotheses → instrument → fix in scope → regression-test. Caller and recovery count at most three failures per causal fingerprint from context and Dead ends/evidence. | Tests, builds, or runtime checks fail. |
@@ -222,7 +222,7 @@ and `Shipped`. Utility commands keep the same compact labels and one-next-action
222
222
 
223
223
  | Skill | What It Does | Use When |
224
224
  |---|---|---|
225
- | [`rite-autocomplete`](../pack/.claude/skills/rite-autocomplete/SKILL.md) | Runs the whole lifecycle unattended (spec → clarify → … → seal → ship), choosing the recommended option at each soft gate and recording the rationale in `decisions.md`. A vague prompt triggers one up-front spec/clarify window; after decision coverage is CLEAR it runs without per-phase iteration, pausing only for genuine product/scope/policy decisions, irreversible risk, human-only access/actions, NO-GO, or budget exhaustion. Objective red checks use bounded technical recovery, including cold-resume recovery from retained one-shot evidence and one-time migration of stale missing-writer stops when an upgraded contract supplies the first supported workflow-artifact writer. Spending an action authorization blocks only another real execution, not offline repair. Default stops at Seal GO; `--ship` (alias `--yolo`) reaches Ship preflight but still requires a fresh literal `GO` and native approval. | "Autocomplete", "do the whole thing", "run the full cycle", "one-shot this feature". |
225
+ | [`rite-autocomplete`](../pack/.claude/skills/rite-autocomplete/SKILL.md) | Runs the whole lifecycle unattended (spec → clarify → … → seal → ship), choosing the recommended option at each soft gate and recording the rationale in `decisions.md`. A vague prompt triggers one up-front spec/clarify window; after decision coverage is CLEAR it runs without per-phase iteration, pausing only for genuine product/scope/policy decisions, irreversible risk, human-only access/actions, NO-GO, or budget exhaustion. Objective red checks use bounded technical recovery, including cold-resume recovery from retained one-shot evidence and one-time migration of stale missing-writer stops when an upgraded contract supplies the first supported workflow-artifact writer. That migration applies once, but the first real materializer failure is only attempt one under normal bounded recovery. Internal `NEEDS_REPLAN` and newly discovered agent-owned review findings remain caller-owned backward edges rather than user-facing stops. Spending an action authorization blocks only another real execution, not offline repair. Default stops at Seal GO; `--ship` (alias `--yolo`) reaches Ship preflight but still requires a fresh literal `GO` and native approval. | "Autocomplete", "do the whole thing", "run the full cycle", "one-shot this feature". |
226
226
  | [`rite-zoom-out`](../pack/.claude/skills/rite-zoom-out/SKILL.md) | Map the modules, callers, callees, and decisions in an unfamiliar area using the project's domain glossary. | Explicit-only: `/rite-zoom-out` / `/rite zoom-out`. |
227
227
  | [`rite-prototype`](../pack/.claude/skills/rite-prototype/SKILL.md) | Throwaway code answering ONE design question: logic harness OR 2 to 4 UI variations on one route. | Explicit-only: `/rite-prototype` / `/rite prototype`. |
228
228
  | [`rite-handoff`](../pack/.claude/skills/rite-handoff/SKILL.md) | Compact chat session → handoff doc. References existing `.devrites/work/<slug>/` artifacts by path. | Explicit-only: `/rite-handoff` / `/rite handoff`. |
@@ -73,7 +73,11 @@ has no clear next move.
73
73
  workspace follow
74
74
  [`workflow-artifacts.md`](../devrites-lib/reference/standards/workflow-artifacts.md)
75
75
  and are materialized by the controlling root. Never ask a read-only planner or
76
- reviewer to return implementation bodies.
76
+ reviewer to return implementation bodies. Materializer failures are reversible
77
+ offline recovery, not consumptive one-shot execution: preserve the transaction
78
+ journal, preimage hashes, and bound temporaries, preflight the corrected
79
+ transaction in a disposable same-layout fixture, then retry only within the
80
+ existing materializer fingerprint budget.
77
81
  - **Classify before routing** with
78
82
  [cleanup-and-classify.md](reference/cleanup-and-classify.md).
79
83
  - **Durably record class and rationale** in `decisions.md` and the applicable
@@ -6,6 +6,12 @@ artifact.
6
6
 
7
7
  Keep the reply compact and evidence-backed:
8
8
 
9
+ When an active rite is the controlling caller, Intermediate `NEEDS_REPLAN`, a
10
+ nested phase `STOP`, and a routine Plan/Vet `Next step` are not eligible completion
11
+ states. Return them to the caller without a user-facing reply. Autocomplete may
12
+ use the shapes below only after its requested rest point or a shared genuine
13
+ human/safety/access/exhausted-recovery stop is reached.
14
+
9
15
  ```text
10
16
  Done: <result in one sentence>
11
17
  Changed: <artifact or source paths>
@@ -264,7 +264,9 @@ changes, not a request for permission to retry.
264
264
  a read-only role or product wright for implementation and evidence records
265
265
  **no controlling-root materialization attempt**. Preserve the old attempts, but
266
266
  do not count them against the new root-materialization fingerprint. Record the
267
- migration; after a root attempt exists, normal fingerprint accounting applies.
267
+ migration; after a root attempt exists, normal fingerprint accounting applies:
268
+ the first root failure is attempt one, not a new one-shot terminal, and the
269
+ shared cap remains three no-progress corrections.
268
270
  - **Classify exhaustion:** human-owned contract/risk/access gaps open their gate. Otherwise
269
271
  preserve reproduction/dead ends, set `Status: blocked` and `Next step: none — technical recovery exhausted for <causal fingerprint>; requires new evidence or changed failure conditions`.
270
272
  Do not emit `/rite-plan unblock`, another phase command, a question, or
@@ -54,6 +54,15 @@ Resume next session with: <single command, e.g. /rite-build slice 2>
54
54
  This is advice, not a gate. The user can ignore it. It reports a trade-off the model
55
55
  cannot inspect directly because no API reports context fullness.
56
56
 
57
+ ### Autocomplete exception
58
+
59
+ Do not emit the footer or a resume command for a nested phase controlled by
60
+ Autocomplete. An intermediate `NEEDS_REPLAN`, Plan/Vet checkpoint, or new
61
+ agent-owned fingerprint must continue in the same invocation under the caller
62
+ contract. If the host compacts, persist the current checkpoint and resume from it;
63
+ context pressure is never permission to turn routine backtracking into a user
64
+ handoff.
65
+
57
66
  ## When NOT to recommend `/clear` or `/compact`
58
67
 
59
68
  - The current phase is read-only and cheap (`/rite-status`, `/rite` menu): no
@@ -40,7 +40,10 @@ Repository conventions follow [Precedence](#precedence).
40
40
  ## Lifecycle rest points
41
41
 
42
42
  Before advancing a phase, run `devrites-engine check readiness <slug>` for
43
- structure; exact agents/checklists own semantics. Persist and stop on block.
43
+ structure; exact agents/checklists own semantics. Standalone rites persist and stop
44
+ on block. Under an active controlling caller, an agent-owned technical block is a
45
+ persisted backward edge: return it to that caller instead of producing a
46
+ user-facing stop.
44
47
  After native proof/review, `/rite-seal` runs `devrites-engine check seal <slug>`
45
48
  for structure/freshness, not prose. HITL/blocked stops follow
46
49
  [Persistence before stopping](#persistence-before-stopping-handoff-discipline).
@@ -7,6 +7,13 @@ privileged/external state so a rerun is not equivalent, and actions whose cleanu
7
7
  can destroy the failure state needed for diagnosis. Successful cleanup does not
8
8
  make a consumptive action repeatable.
9
9
 
10
+ Workflow-artifact materialization is reversible offline work when every admitted
11
+ target has a bound preimage or absence marker, rollback is local to the active
12
+ feature workspace, and no privileged/external real action executes. It is not a
13
+ consumptive action and must not receive a one-shot authorization budget. Failures
14
+ of its materializer, atomic replacement, rollback, or offline proof use the normal
15
+ causal-fingerprint recovery cap in `afk-hitl.md`.
16
+
10
17
  ## Pre-attempt gate
11
18
 
12
19
  Before Vet can emit READY, and again immediately before Prove executes the action,
@@ -37,7 +37,9 @@ directly even when all product slices are built or the AFK slice budget is zero.
37
37
  Do not consume product-slice budget, reopen an answered human gate, or require GO
38
38
  for this offline work. After any controlling-root attempt is recorded, this
39
39
  migration cannot apply again; route its observed atomic/proof failure under the
40
- new fingerprint instead.
40
+ new fingerprint instead. Applying the migration once does not make the first root
41
+ attempt terminal: normal fingerprint accounting starts with that attempt and
42
+ allows up to three no-progress corrections under `afk-hitl.md`.
41
43
 
42
44
  ## Admission
43
45
 
@@ -52,15 +54,39 @@ Before writing:
52
54
  or a request that a drafter supply code is a Plan gap, not implementation input.
53
55
  3. Record preimages or absence for every target plus protected product manifests
54
56
  and the current candidate digest. Resolve every parent no-follow before mutation.
57
+ 4. Before creating an active transaction, **preflight the materializer itself**.
58
+ Do this before any journal or admitted-target mutation. Compile/static-check
59
+ it, then run its
60
+ complete transaction machinery in a disposable same-layout fixture. Cover an
61
+ existing target, an absent target, full success, injected replacement failure,
62
+ rollback cleanup, retained-temporary cleanup, and idempotent rerun. Require the
63
+ fixture to prove that failures leave every simulated target at its bound
64
+ preimage and that no same-parent temporary escapes its admitted directory. Run
65
+ with the working directory outside the admitted parent, and execute negative
66
+ mutants where relative replacement omits either directory handle; both mutants
67
+ must fail before the active transaction is eligible.
55
68
 
56
69
  ## Materialize
57
70
 
58
71
  The root authors the smallest complete bytes for all admitted targets. Write each
59
72
  through a same-parent private temporary file, set the planned mode, flush it, and
60
73
  atomically replace the target; settle the whole set or roll back partial output.
74
+ Anchor every relative rename/replace operand to its source and destination directory handles.
75
+ For Python `os.replace`, pass both `src_dir_fd`
76
+ and `dst_dir_fd`; a basename plus only the destination handle is not admitted.
61
77
  Do not install dependencies, touch Git, use the network, mutate product paths, or
62
78
  execute the consumptive action.
63
79
 
80
+ Workflow-artifact materialization is not a consumptive action. Its active
81
+ transaction may begin only after the disposable preflight is green. If an active
82
+ attempt fails, preserve its journal, exact hashes, and decisive boundary before
83
+ cleanup. When all targets remain at their recorded preimages and only bound
84
+ same-parent temporaries remain, perform exact fail-closed cleanup, repair and
85
+ preflight the materializer offline, then retry under the same causal fingerprint.
86
+ The first controlling-root failure is attempt one of the shared cap, not terminal
87
+ exhaustion; stop only after three no-progress corrections or a genuine
88
+ human/safety/access gate.
89
+
64
90
  ## Verify and return
65
91
 
66
92
  Read back the exact path set, modes, and SHA-256 identities. Run only the vetted
@@ -36,6 +36,11 @@ the terminal cursor or its recovery count.
36
36
  through repair, Vet, bounded implementation correction, and re-proof inside
37
37
  the active run. A nested phase `STOP` or intermediate `Next step` is not a
38
38
  user handoff; pause only on the shared real stop conditions.
39
+ - **Treat technical readiness as routing, not completion.** `NEEDS_REPLAN` is a backward edge
40
+ to Plan repair and narrow Vet; `NEEDS_CLARIFICATION` is likewise internal when
41
+ decision coverage can be resolved from existing authority. Neither state may
42
+ end Autocomplete unless its underlying fingerprint is actually exhausted or a
43
+ human/safety/access decision is required.
39
44
  - **Do not confuse an action budget with recovery exhaustion.** After a failed
40
45
  consumptive action, zero remaining real attempts blocks only another execution.
41
46
  New retained Critical/Important evidence starts offline repair and narrow Vet
@@ -73,6 +78,9 @@ the terminal cursor or its recovery count.
73
78
  fingerprint below its no-progress cap reopens caller-owned offline recovery;
74
79
  a stale pre-ownership workflow-artifact writer stop reopens under
75
80
  `workflow-artifacts.md` when no controlling-root materialization attempt exists.
81
+ A `NEEDS_REPLAN` cold resume with a valid technical return cursor immediately
82
+ invokes Plan repair and Recovery Vet before selecting a forward phase or
83
+ emitting any reply.
76
84
  That materialization runs directly as non-consumptive prerequisite recovery,
77
85
  even with no pending product slice or AFK budget; it does not re-ask an answered
78
86
  human gate.
@@ -72,7 +72,10 @@ root ownership is a changed routing condition. Preserve the old fingerprint,
72
72
  record the new materialization fingerprint, and run that offline branch directly;
73
73
  do not charge or require product-slice/AFK budget, re-ask a resolved question, or
74
74
  request GO. Once a root materialization attempt exists, never apply this migration
75
- again—route its observed failure normally. This reconciliation runs even when all
75
+ again—route its observed failure normally. That one-time migration
76
+ does not make the first root attempt terminal: record it as attempt one under the new
77
+ materializer fingerprint and continue bounded offline correction while fewer than
78
+ three no-progress corrections exist. This reconciliation runs even when all
76
79
  product slices are already built, before selecting the next forward phase.
77
80
 
78
81
  1. Save the originating phase/action in the native return cursor unless a valid
@@ -101,6 +104,24 @@ for a human-owned decision or mandatory safety/access action. Exhausted
101
104
  agent-owned recovery stops once with its reproduction and dead ends, never with
102
105
  another routine Plan/Vet command.
103
106
 
107
+ ## Continuous caller obligation
108
+
109
+ No user-facing reply is permitted while the durable state contains an
110
+ agent-owned `NEEDS_REPLAN`, an intermediate Plan/Vet `next_action`, or a distinct
111
+ Critical/Important fingerprint with remaining recovery budget. Invoke the exact
112
+ next Plan repair and Recovery Vet immediately. A narrow reviewer closing its input
113
+ finding and exposing another Critical/Important invariant is progress: close the
114
+ old fingerprint, open the new one, and continue without handing a command to the
115
+ user.
116
+
117
+ The number of completed repair/Vet cycles is not a stop condition and cannot be
118
+ used as a surrogate recovery budget. Only three no-progress corrections of the
119
+ same exact fingerprint exhaust. Context pressure, compaction, session duration,
120
+ or a nested skill's completion footer also cannot convert an internal checkpoint
121
+ into a stop; persist the checkpoint and resume from it inside the same controlling
122
+ invocation. Autocomplete may emit its final reply only after reaching its requested
123
+ rest point or one of the shared human/safety/access/exhaustion stop conditions.
124
+
104
125
  ## Between phases
105
126
 
106
127
  - Re-read the active workspace before each phase (don't trust chat memory).
@@ -29,6 +29,11 @@ on exhaustion, stop as a technical blocker unless human-owned.
29
29
 
30
30
  ## Not a stop: agent-owned backtracking
31
31
 
32
+ `NEEDS_REPLAN` is not a stop condition under an active Autocomplete caller. It
33
+ blocks forward advancement, persists the return cursor, and immediately routes
34
+ Plan repair plus Recovery Vet. The same applies to any intermediate nested
35
+ `STOP`/`Next step` whose underlying decision is agent-owned.
36
+
32
37
  Agent-owned backtracking is not a stop condition while its causal-fingerprint
33
38
  budget remains. The active caller invokes the earlier phase inline, follows Vet
34
39
  and any bounded remediation, then resumes the originating phase. Persist
@@ -52,7 +57,12 @@ as root materialization attempts. Reopen only when exact paths and executable
52
57
  behavior passed Vet and there is **no controlling-root materialization attempt**;
53
58
  record the routing migration so it cannot reset again. Missing product slices,
54
59
  unresolved protocol choices, or a recorded root attempt remain under their normal
55
- gate/fingerprint rules.
60
+ gate/fingerprint rules. The first controlling-root failure is not exhaustion: it
61
+ is the first no-progress result for the materializer fingerprint. If all targets
62
+ still equal their recorded preimages, no real action ran, and only admitted bound
63
+ temporaries remain, reopen an incorrectly persisted one-shot `1/1` terminal,
64
+ preserve its evidence as attempt one, clean/repair/preflight offline, and continue
65
+ within the shared three-attempt cap.
56
66
 
57
67
  Past evidence being irretrievable is not by itself terminal. When an in-scope
58
68
  trusted diagnostic seam can make the next retained fingerprint uniquely
@@ -23,7 +23,11 @@ See [`one-slice-cycle.md`](one-slice-cycle.md); candidate lifecycle is
23
23
  dispatch the exact `devrites-slice-wright` fresh. Root never writes those product
24
24
  paths, wright never widens, and a missing profile stops.
25
25
  For the workflow-artifact branch, the controlling root writes only the admitted
26
- `.devrites/work/<slug>/` paths, proves the complete atomic set, rechecks an
26
+ `.devrites/work/<slug>/` paths. Before an active journal or target write, it
27
+ compiles the materializer and runs the exact transaction implementation in a
28
+ disposable same-layout fixture covering success, replacement failure, rollback,
29
+ retained-temporary cleanup, and rerun. It then proves the complete atomic set,
30
+ rechecks an
27
31
  identical product candidate, records hashes/evidence, and runs narrow Vet. Do not
28
32
  dispatch any agent as a substitute writer and do not charge a product slice.
29
33
 
@@ -144,8 +144,12 @@ Pull the standard named by the active axis: `principles.md`, `patterns.md`,
144
144
  After each fold-back rerun step 2a; missing/meaning-changing mappings block.
145
145
  Keep `state.md` non-READY for step 6.
146
146
  6. **One narrow recheck after edits.** If the candidate changed, dispatch exact
147
- `devrites-plan-reviewer` once with accepted findings, changed paths/criteria,
148
- and new identity. No full or third loop; if it changes the plan, repeat step 5.
147
+ `devrites-plan-reviewer` once per correction/fingerprint with accepted findings,
148
+ changed paths/criteria, and new identity. Within that same correction, no full
149
+ or third loop; if it changes the plan, repeat step 5. If the recheck closes its
150
+ input fingerprint but discovers a distinct Critical/Important invariant, return
151
+ that new fingerprint to the controlling caller as progress. It may start the
152
+ next bounded Plan/Recovery-Vet cycle; the prior reviewer count is not exhaustion.
149
153
  Then close the matrix and rerun step 2a's ID-and-meaning audit.
150
154
 
151
155
  6a. **Build readback.** From the final owning artifacts, add a cited five-line
@@ -73,7 +73,11 @@ has no clear next move.
73
73
  workspace follow
74
74
  [`workflow-artifacts.md`](../devrites-lib/reference/standards/workflow-artifacts.md)
75
75
  and are materialized by the controlling root. Never ask a read-only planner or
76
- reviewer to return implementation bodies.
76
+ reviewer to return implementation bodies. Materializer failures are reversible
77
+ offline recovery, not consumptive one-shot execution: preserve the transaction
78
+ journal, preimage hashes, and bound temporaries, preflight the corrected
79
+ transaction in a disposable same-layout fixture, then retry only within the
80
+ existing materializer fingerprint budget.
77
81
  - **Classify before routing** with
78
82
  [cleanup-and-classify.md](reference/cleanup-and-classify.md).
79
83
  - **Durably record class and rationale** in `decisions.md` and the applicable
@@ -6,6 +6,12 @@ artifact.
6
6
 
7
7
  Keep the reply compact and evidence-backed:
8
8
 
9
+ When an active rite is the controlling caller, Intermediate `NEEDS_REPLAN`, a
10
+ nested phase `STOP`, and a routine Plan/Vet `Next step` are not eligible completion
11
+ states. Return them to the caller without a user-facing reply. Autocomplete may
12
+ use the shapes below only after its requested rest point or a shared genuine
13
+ human/safety/access/exhausted-recovery stop is reached.
14
+
9
15
  ```text
10
16
  Done: <result in one sentence>
11
17
  Changed: <artifact or source paths>
@@ -264,7 +264,9 @@ changes, not a request for permission to retry.
264
264
  a read-only role or product wright for implementation and evidence records
265
265
  **no controlling-root materialization attempt**. Preserve the old attempts, but
266
266
  do not count them against the new root-materialization fingerprint. Record the
267
- migration; after a root attempt exists, normal fingerprint accounting applies.
267
+ migration; after a root attempt exists, normal fingerprint accounting applies:
268
+ the first root failure is attempt one, not a new one-shot terminal, and the
269
+ shared cap remains three no-progress corrections.
268
270
  - **Classify exhaustion:** human-owned contract/risk/access gaps open their gate. Otherwise
269
271
  preserve reproduction/dead ends, set `Status: blocked` and `Next step: none — technical recovery exhausted for <causal fingerprint>; requires new evidence or changed failure conditions`.
270
272
  Do not emit `/rite-plan unblock`, another phase command, a question, or
@@ -54,6 +54,15 @@ Resume next session with: <single command, e.g. /rite-build slice 2>
54
54
  This is advice, not a gate. The user can ignore it. It reports a trade-off the model
55
55
  cannot inspect directly because no API reports context fullness.
56
56
 
57
+ ### Autocomplete exception
58
+
59
+ Do not emit the footer or a resume command for a nested phase controlled by
60
+ Autocomplete. An intermediate `NEEDS_REPLAN`, Plan/Vet checkpoint, or new
61
+ agent-owned fingerprint must continue in the same invocation under the caller
62
+ contract. If the host compacts, persist the current checkpoint and resume from it;
63
+ context pressure is never permission to turn routine backtracking into a user
64
+ handoff.
65
+
57
66
  ## When NOT to recommend `/clear` or `/compact`
58
67
 
59
68
  - The current phase is read-only and cheap (`/rite-status`, `/rite` menu): no
@@ -40,7 +40,10 @@ Repository conventions follow [Precedence](#precedence).
40
40
  ## Lifecycle rest points
41
41
 
42
42
  Before advancing a phase, run `devrites-engine check readiness <slug>` for
43
- structure; exact agents/checklists own semantics. Persist and stop on block.
43
+ structure; exact agents/checklists own semantics. Standalone rites persist and stop
44
+ on block. Under an active controlling caller, an agent-owned technical block is a
45
+ persisted backward edge: return it to that caller instead of producing a
46
+ user-facing stop.
44
47
  After native proof/review, `/rite-seal` runs `devrites-engine check seal <slug>`
45
48
  for structure/freshness, not prose. HITL/blocked stops follow
46
49
  [Persistence before stopping](#persistence-before-stopping-handoff-discipline).
@@ -7,6 +7,13 @@ privileged/external state so a rerun is not equivalent, and actions whose cleanu
7
7
  can destroy the failure state needed for diagnosis. Successful cleanup does not
8
8
  make a consumptive action repeatable.
9
9
 
10
+ Workflow-artifact materialization is reversible offline work when every admitted
11
+ target has a bound preimage or absence marker, rollback is local to the active
12
+ feature workspace, and no privileged/external real action executes. It is not a
13
+ consumptive action and must not receive a one-shot authorization budget. Failures
14
+ of its materializer, atomic replacement, rollback, or offline proof use the normal
15
+ causal-fingerprint recovery cap in `afk-hitl.md`.
16
+
10
17
  ## Pre-attempt gate
11
18
 
12
19
  Before Vet can emit READY, and again immediately before Prove executes the action,
@@ -37,7 +37,9 @@ directly even when all product slices are built or the AFK slice budget is zero.
37
37
  Do not consume product-slice budget, reopen an answered human gate, or require GO
38
38
  for this offline work. After any controlling-root attempt is recorded, this
39
39
  migration cannot apply again; route its observed atomic/proof failure under the
40
- new fingerprint instead.
40
+ new fingerprint instead. Applying the migration once does not make the first root
41
+ attempt terminal: normal fingerprint accounting starts with that attempt and
42
+ allows up to three no-progress corrections under `afk-hitl.md`.
41
43
 
42
44
  ## Admission
43
45
 
@@ -52,15 +54,39 @@ Before writing:
52
54
  or a request that a drafter supply code is a Plan gap, not implementation input.
53
55
  3. Record preimages or absence for every target plus protected product manifests
54
56
  and the current candidate digest. Resolve every parent no-follow before mutation.
57
+ 4. Before creating an active transaction, **preflight the materializer itself**.
58
+ Do this before any journal or admitted-target mutation. Compile/static-check
59
+ it, then run its
60
+ complete transaction machinery in a disposable same-layout fixture. Cover an
61
+ existing target, an absent target, full success, injected replacement failure,
62
+ rollback cleanup, retained-temporary cleanup, and idempotent rerun. Require the
63
+ fixture to prove that failures leave every simulated target at its bound
64
+ preimage and that no same-parent temporary escapes its admitted directory. Run
65
+ with the working directory outside the admitted parent, and execute negative
66
+ mutants where relative replacement omits either directory handle; both mutants
67
+ must fail before the active transaction is eligible.
55
68
 
56
69
  ## Materialize
57
70
 
58
71
  The root authors the smallest complete bytes for all admitted targets. Write each
59
72
  through a same-parent private temporary file, set the planned mode, flush it, and
60
73
  atomically replace the target; settle the whole set or roll back partial output.
74
+ Anchor every relative rename/replace operand to its source and destination directory handles.
75
+ For Python `os.replace`, pass both `src_dir_fd`
76
+ and `dst_dir_fd`; a basename plus only the destination handle is not admitted.
61
77
  Do not install dependencies, touch Git, use the network, mutate product paths, or
62
78
  execute the consumptive action.
63
79
 
80
+ Workflow-artifact materialization is not a consumptive action. Its active
81
+ transaction may begin only after the disposable preflight is green. If an active
82
+ attempt fails, preserve its journal, exact hashes, and decisive boundary before
83
+ cleanup. When all targets remain at their recorded preimages and only bound
84
+ same-parent temporaries remain, perform exact fail-closed cleanup, repair and
85
+ preflight the materializer offline, then retry under the same causal fingerprint.
86
+ The first controlling-root failure is attempt one of the shared cap, not terminal
87
+ exhaustion; stop only after three no-progress corrections or a genuine
88
+ human/safety/access gate.
89
+
64
90
  ## Verify and return
65
91
 
66
92
  Read back the exact path set, modes, and SHA-256 identities. Run only the vetted
@@ -36,6 +36,11 @@ the terminal cursor or its recovery count.
36
36
  through repair, Vet, bounded implementation correction, and re-proof inside
37
37
  the active run. A nested phase `STOP` or intermediate `Next step` is not a
38
38
  user handoff; pause only on the shared real stop conditions.
39
+ - **Treat technical readiness as routing, not completion.** `NEEDS_REPLAN` is a backward edge
40
+ to Plan repair and narrow Vet; `NEEDS_CLARIFICATION` is likewise internal when
41
+ decision coverage can be resolved from existing authority. Neither state may
42
+ end Autocomplete unless its underlying fingerprint is actually exhausted or a
43
+ human/safety/access decision is required.
39
44
  - **Do not confuse an action budget with recovery exhaustion.** After a failed
40
45
  consumptive action, zero remaining real attempts blocks only another execution.
41
46
  New retained Critical/Important evidence starts offline repair and narrow Vet
@@ -73,6 +78,9 @@ the terminal cursor or its recovery count.
73
78
  fingerprint below its no-progress cap reopens caller-owned offline recovery;
74
79
  a stale pre-ownership workflow-artifact writer stop reopens under
75
80
  `workflow-artifacts.md` when no controlling-root materialization attempt exists.
81
+ A `NEEDS_REPLAN` cold resume with a valid technical return cursor immediately
82
+ invokes Plan repair and Recovery Vet before selecting a forward phase or
83
+ emitting any reply.
76
84
  That materialization runs directly as non-consumptive prerequisite recovery,
77
85
  even with no pending product slice or AFK budget; it does not re-ask an answered
78
86
  human gate.
@@ -72,7 +72,10 @@ root ownership is a changed routing condition. Preserve the old fingerprint,
72
72
  record the new materialization fingerprint, and run that offline branch directly;
73
73
  do not charge or require product-slice/AFK budget, re-ask a resolved question, or
74
74
  request GO. Once a root materialization attempt exists, never apply this migration
75
- again—route its observed failure normally. This reconciliation runs even when all
75
+ again—route its observed failure normally. That one-time migration
76
+ does not make the first root attempt terminal: record it as attempt one under the new
77
+ materializer fingerprint and continue bounded offline correction while fewer than
78
+ three no-progress corrections exist. This reconciliation runs even when all
76
79
  product slices are already built, before selecting the next forward phase.
77
80
 
78
81
  1. Save the originating phase/action in the native return cursor unless a valid
@@ -101,6 +104,24 @@ for a human-owned decision or mandatory safety/access action. Exhausted
101
104
  agent-owned recovery stops once with its reproduction and dead ends, never with
102
105
  another routine Plan/Vet command.
103
106
 
107
+ ## Continuous caller obligation
108
+
109
+ No user-facing reply is permitted while the durable state contains an
110
+ agent-owned `NEEDS_REPLAN`, an intermediate Plan/Vet `next_action`, or a distinct
111
+ Critical/Important fingerprint with remaining recovery budget. Invoke the exact
112
+ next Plan repair and Recovery Vet immediately. A narrow reviewer closing its input
113
+ finding and exposing another Critical/Important invariant is progress: close the
114
+ old fingerprint, open the new one, and continue without handing a command to the
115
+ user.
116
+
117
+ The number of completed repair/Vet cycles is not a stop condition and cannot be
118
+ used as a surrogate recovery budget. Only three no-progress corrections of the
119
+ same exact fingerprint exhaust. Context pressure, compaction, session duration,
120
+ or a nested skill's completion footer also cannot convert an internal checkpoint
121
+ into a stop; persist the checkpoint and resume from it inside the same controlling
122
+ invocation. Autocomplete may emit its final reply only after reaching its requested
123
+ rest point or one of the shared human/safety/access/exhaustion stop conditions.
124
+
104
125
  ## Between phases
105
126
 
106
127
  - Re-read the active workspace before each phase (don't trust chat memory).
@@ -29,6 +29,11 @@ on exhaustion, stop as a technical blocker unless human-owned.
29
29
 
30
30
  ## Not a stop: agent-owned backtracking
31
31
 
32
+ `NEEDS_REPLAN` is not a stop condition under an active Autocomplete caller. It
33
+ blocks forward advancement, persists the return cursor, and immediately routes
34
+ Plan repair plus Recovery Vet. The same applies to any intermediate nested
35
+ `STOP`/`Next step` whose underlying decision is agent-owned.
36
+
32
37
  Agent-owned backtracking is not a stop condition while its causal-fingerprint
33
38
  budget remains. The active caller invokes the earlier phase inline, follows Vet
34
39
  and any bounded remediation, then resumes the originating phase. Persist
@@ -52,7 +57,12 @@ as root materialization attempts. Reopen only when exact paths and executable
52
57
  behavior passed Vet and there is **no controlling-root materialization attempt**;
53
58
  record the routing migration so it cannot reset again. Missing product slices,
54
59
  unresolved protocol choices, or a recorded root attempt remain under their normal
55
- gate/fingerprint rules.
60
+ gate/fingerprint rules. The first controlling-root failure is not exhaustion: it
61
+ is the first no-progress result for the materializer fingerprint. If all targets
62
+ still equal their recorded preimages, no real action ran, and only admitted bound
63
+ temporaries remain, reopen an incorrectly persisted one-shot `1/1` terminal,
64
+ preserve its evidence as attempt one, clean/repair/preflight offline, and continue
65
+ within the shared three-attempt cap.
56
66
 
57
67
  Past evidence being irretrievable is not by itself terminal. When an in-scope
58
68
  trusted diagnostic seam can make the next retained fingerprint uniquely
@@ -23,7 +23,11 @@ See [`one-slice-cycle.md`](one-slice-cycle.md); candidate lifecycle is
23
23
  dispatch the exact `devrites-slice-wright` fresh. Root never writes those product
24
24
  paths, wright never widens, and a missing profile stops.
25
25
  For the workflow-artifact branch, the controlling root writes only the admitted
26
- `.devrites/work/<slug>/` paths, proves the complete atomic set, rechecks an
26
+ `.devrites/work/<slug>/` paths. Before an active journal or target write, it
27
+ compiles the materializer and runs the exact transaction implementation in a
28
+ disposable same-layout fixture covering success, replacement failure, rollback,
29
+ retained-temporary cleanup, and rerun. It then proves the complete atomic set,
30
+ rechecks an
27
31
  identical product candidate, records hashes/evidence, and runs narrow Vet. Do not
28
32
  dispatch any agent as a substitute writer and do not charge a product slice.
29
33
 
@@ -144,8 +144,12 @@ Pull the standard named by the active axis: `principles.md`, `patterns.md`,
144
144
  After each fold-back rerun step 2a; missing/meaning-changing mappings block.
145
145
  Keep `state.md` non-READY for step 6.
146
146
  6. **One narrow recheck after edits.** If the candidate changed, dispatch exact
147
- `devrites-plan-reviewer` once with accepted findings, changed paths/criteria,
148
- and new identity. No full or third loop; if it changes the plan, repeat step 5.
147
+ `devrites-plan-reviewer` once per correction/fingerprint with accepted findings,
148
+ changed paths/criteria, and new identity. Within that same correction, no full
149
+ or third loop; if it changes the plan, repeat step 5. If the recheck closes its
150
+ input fingerprint but discovers a distinct Critical/Important invariant, return
151
+ that new fingerprint to the controlling caller as progress. It may start the
152
+ next bounded Plan/Recovery-Vet cycle; the prior reviewer count is not exhaustion.
149
153
  Then close the matrix and rerun step 2a's ID-and-meaning audit.
150
154
 
151
155
  6a. **Build readback.** From the final owning artifacts, add a cited five-line
@@ -73,7 +73,11 @@ has no clear next move.
73
73
  workspace follow
74
74
  [`workflow-artifacts.md`](../devrites-lib/reference/standards/workflow-artifacts.md)
75
75
  and are materialized by the controlling root. Never ask a read-only planner or
76
- reviewer to return implementation bodies.
76
+ reviewer to return implementation bodies. Materializer failures are reversible
77
+ offline recovery, not consumptive one-shot execution: preserve the transaction
78
+ journal, preimage hashes, and bound temporaries, preflight the corrected
79
+ transaction in a disposable same-layout fixture, then retry only within the
80
+ existing materializer fingerprint budget.
77
81
  - **Classify before routing** with
78
82
  [cleanup-and-classify.md](reference/cleanup-and-classify.md).
79
83
  - **Durably record class and rationale** in `decisions.md` and the applicable
@@ -6,6 +6,12 @@ artifact.
6
6
 
7
7
  Keep the reply compact and evidence-backed:
8
8
 
9
+ When an active rite is the controlling caller, Intermediate `NEEDS_REPLAN`, a
10
+ nested phase `STOP`, and a routine Plan/Vet `Next step` are not eligible completion
11
+ states. Return them to the caller without a user-facing reply. Autocomplete may
12
+ use the shapes below only after its requested rest point or a shared genuine
13
+ human/safety/access/exhausted-recovery stop is reached.
14
+
9
15
  ```text
10
16
  Done: <result in one sentence>
11
17
  Changed: <artifact or source paths>
@@ -264,7 +264,9 @@ changes, not a request for permission to retry.
264
264
  a read-only role or product wright for implementation and evidence records
265
265
  **no controlling-root materialization attempt**. Preserve the old attempts, but
266
266
  do not count them against the new root-materialization fingerprint. Record the
267
- migration; after a root attempt exists, normal fingerprint accounting applies.
267
+ migration; after a root attempt exists, normal fingerprint accounting applies:
268
+ the first root failure is attempt one, not a new one-shot terminal, and the
269
+ shared cap remains three no-progress corrections.
268
270
  - **Classify exhaustion:** human-owned contract/risk/access gaps open their gate. Otherwise
269
271
  preserve reproduction/dead ends, set `Status: blocked` and `Next step: none — technical recovery exhausted for <causal fingerprint>; requires new evidence or changed failure conditions`.
270
272
  Do not emit `$rite-plan unblock`, another phase command, a question, or
@@ -54,6 +54,15 @@ Resume next session with: <single command, e.g. $rite-build slice 2>
54
54
  This is advice, not a gate. The user can ignore it. It reports a trade-off the model
55
55
  cannot inspect directly because no API reports context fullness.
56
56
 
57
+ ### Autocomplete exception
58
+
59
+ Do not emit the footer or a resume command for a nested phase controlled by
60
+ Autocomplete. An intermediate `NEEDS_REPLAN`, Plan/Vet checkpoint, or new
61
+ agent-owned fingerprint must continue in the same invocation under the caller
62
+ contract. If the host compacts, persist the current checkpoint and resume from it;
63
+ context pressure is never permission to turn routine backtracking into a user
64
+ handoff.
65
+
57
66
  ## When NOT to recommend `/clear` or `/compact`
58
67
 
59
68
  - The current phase is read-only and cheap (`$rite-status`, `$rite` menu): no
@@ -40,7 +40,10 @@ Repository conventions follow [Precedence](#precedence).
40
40
  ## Lifecycle rest points
41
41
 
42
42
  Before advancing a phase, run `devrites-engine check readiness <slug>` for
43
- structure; exact agents/checklists own semantics. Persist and stop on block.
43
+ structure; exact agents/checklists own semantics. Standalone rites persist and stop
44
+ on block. Under an active controlling caller, an agent-owned technical block is a
45
+ persisted backward edge: return it to that caller instead of producing a
46
+ user-facing stop.
44
47
  After native proof/review, `$rite-seal` runs `devrites-engine check seal <slug>`
45
48
  for structure/freshness, not prose. HITL/blocked stops follow
46
49
  [Persistence before stopping](#persistence-before-stopping-handoff-discipline).
@@ -7,6 +7,13 @@ privileged/external state so a rerun is not equivalent, and actions whose cleanu
7
7
  can destroy the failure state needed for diagnosis. Successful cleanup does not
8
8
  make a consumptive action repeatable.
9
9
 
10
+ Workflow-artifact materialization is reversible offline work when every admitted
11
+ target has a bound preimage or absence marker, rollback is local to the active
12
+ feature workspace, and no privileged/external real action executes. It is not a
13
+ consumptive action and must not receive a one-shot authorization budget. Failures
14
+ of its materializer, atomic replacement, rollback, or offline proof use the normal
15
+ causal-fingerprint recovery cap in `afk-hitl.md`.
16
+
10
17
  ## Pre-attempt gate
11
18
 
12
19
  Before Vet can emit READY, and again immediately before Prove executes the action,
@@ -37,7 +37,9 @@ directly even when all product slices are built or the AFK slice budget is zero.
37
37
  Do not consume product-slice budget, reopen an answered human gate, or require GO
38
38
  for this offline work. After any controlling-root attempt is recorded, this
39
39
  migration cannot apply again; route its observed atomic/proof failure under the
40
- new fingerprint instead.
40
+ new fingerprint instead. Applying the migration once does not make the first root
41
+ attempt terminal: normal fingerprint accounting starts with that attempt and
42
+ allows up to three no-progress corrections under `afk-hitl.md`.
41
43
 
42
44
  ## Admission
43
45
 
@@ -52,15 +54,39 @@ Before writing:
52
54
  or a request that a drafter supply code is a Plan gap, not implementation input.
53
55
  3. Record preimages or absence for every target plus protected product manifests
54
56
  and the current candidate digest. Resolve every parent no-follow before mutation.
57
+ 4. Before creating an active transaction, **preflight the materializer itself**.
58
+ Do this before any journal or admitted-target mutation. Compile/static-check
59
+ it, then run its
60
+ complete transaction machinery in a disposable same-layout fixture. Cover an
61
+ existing target, an absent target, full success, injected replacement failure,
62
+ rollback cleanup, retained-temporary cleanup, and idempotent rerun. Require the
63
+ fixture to prove that failures leave every simulated target at its bound
64
+ preimage and that no same-parent temporary escapes its admitted directory. Run
65
+ with the working directory outside the admitted parent, and execute negative
66
+ mutants where relative replacement omits either directory handle; both mutants
67
+ must fail before the active transaction is eligible.
55
68
 
56
69
  ## Materialize
57
70
 
58
71
  The root authors the smallest complete bytes for all admitted targets. Write each
59
72
  through a same-parent private temporary file, set the planned mode, flush it, and
60
73
  atomically replace the target; settle the whole set or roll back partial output.
74
+ Anchor every relative rename/replace operand to its source and destination directory handles.
75
+ For Python `os.replace`, pass both `src_dir_fd`
76
+ and `dst_dir_fd`; a basename plus only the destination handle is not admitted.
61
77
  Do not install dependencies, touch Git, use the network, mutate product paths, or
62
78
  execute the consumptive action.
63
79
 
80
+ Workflow-artifact materialization is not a consumptive action. Its active
81
+ transaction may begin only after the disposable preflight is green. If an active
82
+ attempt fails, preserve its journal, exact hashes, and decisive boundary before
83
+ cleanup. When all targets remain at their recorded preimages and only bound
84
+ same-parent temporaries remain, perform exact fail-closed cleanup, repair and
85
+ preflight the materializer offline, then retry under the same causal fingerprint.
86
+ The first controlling-root failure is attempt one of the shared cap, not terminal
87
+ exhaustion; stop only after three no-progress corrections or a genuine
88
+ human/safety/access gate.
89
+
64
90
  ## Verify and return
65
91
 
66
92
  Read back the exact path set, modes, and SHA-256 identities. Run only the vetted
@@ -36,6 +36,11 @@ the terminal cursor or its recovery count.
36
36
  through repair, Vet, bounded implementation correction, and re-proof inside
37
37
  the active run. A nested phase `STOP` or intermediate `Next step` is not a
38
38
  user handoff; pause only on the shared real stop conditions.
39
+ - **Treat technical readiness as routing, not completion.** `NEEDS_REPLAN` is a backward edge
40
+ to Plan repair and narrow Vet; `NEEDS_CLARIFICATION` is likewise internal when
41
+ decision coverage can be resolved from existing authority. Neither state may
42
+ end Autocomplete unless its underlying fingerprint is actually exhausted or a
43
+ human/safety/access decision is required.
39
44
  - **Do not confuse an action budget with recovery exhaustion.** After a failed
40
45
  consumptive action, zero remaining real attempts blocks only another execution.
41
46
  New retained Critical/Important evidence starts offline repair and narrow Vet
@@ -73,6 +78,9 @@ the terminal cursor or its recovery count.
73
78
  fingerprint below its no-progress cap reopens caller-owned offline recovery;
74
79
  a stale pre-ownership workflow-artifact writer stop reopens under
75
80
  `workflow-artifacts.md` when no controlling-root materialization attempt exists.
81
+ A `NEEDS_REPLAN` cold resume with a valid technical return cursor immediately
82
+ invokes Plan repair and Recovery Vet before selecting a forward phase or
83
+ emitting any reply.
76
84
  That materialization runs directly as non-consumptive prerequisite recovery,
77
85
  even with no pending product slice or AFK budget; it does not re-ask an answered
78
86
  human gate.
@@ -72,7 +72,10 @@ root ownership is a changed routing condition. Preserve the old fingerprint,
72
72
  record the new materialization fingerprint, and run that offline branch directly;
73
73
  do not charge or require product-slice/AFK budget, re-ask a resolved question, or
74
74
  request GO. Once a root materialization attempt exists, never apply this migration
75
- again—route its observed failure normally. This reconciliation runs even when all
75
+ again—route its observed failure normally. That one-time migration
76
+ does not make the first root attempt terminal: record it as attempt one under the new
77
+ materializer fingerprint and continue bounded offline correction while fewer than
78
+ three no-progress corrections exist. This reconciliation runs even when all
76
79
  product slices are already built, before selecting the next forward phase.
77
80
 
78
81
  1. Save the originating phase/action in the native return cursor unless a valid
@@ -101,6 +104,24 @@ for a human-owned decision or mandatory safety/access action. Exhausted
101
104
  agent-owned recovery stops once with its reproduction and dead ends, never with
102
105
  another routine Plan/Vet command.
103
106
 
107
+ ## Continuous caller obligation
108
+
109
+ No user-facing reply is permitted while the durable state contains an
110
+ agent-owned `NEEDS_REPLAN`, an intermediate Plan/Vet `next_action`, or a distinct
111
+ Critical/Important fingerprint with remaining recovery budget. Invoke the exact
112
+ next Plan repair and Recovery Vet immediately. A narrow reviewer closing its input
113
+ finding and exposing another Critical/Important invariant is progress: close the
114
+ old fingerprint, open the new one, and continue without handing a command to the
115
+ user.
116
+
117
+ The number of completed repair/Vet cycles is not a stop condition and cannot be
118
+ used as a surrogate recovery budget. Only three no-progress corrections of the
119
+ same exact fingerprint exhaust. Context pressure, compaction, session duration,
120
+ or a nested skill's completion footer also cannot convert an internal checkpoint
121
+ into a stop; persist the checkpoint and resume from it inside the same controlling
122
+ invocation. Autocomplete may emit its final reply only after reaching its requested
123
+ rest point or one of the shared human/safety/access/exhaustion stop conditions.
124
+
104
125
  ## Between phases
105
126
 
106
127
  - Re-read the active workspace before each phase (don't trust chat memory).
@@ -29,6 +29,11 @@ on exhaustion, stop as a technical blocker unless human-owned.
29
29
 
30
30
  ## Not a stop: agent-owned backtracking
31
31
 
32
+ `NEEDS_REPLAN` is not a stop condition under an active Autocomplete caller. It
33
+ blocks forward advancement, persists the return cursor, and immediately routes
34
+ Plan repair plus Recovery Vet. The same applies to any intermediate nested
35
+ `STOP`/`Next step` whose underlying decision is agent-owned.
36
+
32
37
  Agent-owned backtracking is not a stop condition while its causal-fingerprint
33
38
  budget remains. The active caller invokes the earlier phase inline, follows Vet
34
39
  and any bounded remediation, then resumes the originating phase. Persist
@@ -52,7 +57,12 @@ as root materialization attempts. Reopen only when exact paths and executable
52
57
  behavior passed Vet and there is **no controlling-root materialization attempt**;
53
58
  record the routing migration so it cannot reset again. Missing product slices,
54
59
  unresolved protocol choices, or a recorded root attempt remain under their normal
55
- gate/fingerprint rules.
60
+ gate/fingerprint rules. The first controlling-root failure is not exhaustion: it
61
+ is the first no-progress result for the materializer fingerprint. If all targets
62
+ still equal their recorded preimages, no real action ran, and only admitted bound
63
+ temporaries remain, reopen an incorrectly persisted one-shot `1/1` terminal,
64
+ preserve its evidence as attempt one, clean/repair/preflight offline, and continue
65
+ within the shared three-attempt cap.
56
66
 
57
67
  Past evidence being irretrievable is not by itself terminal. When an in-scope
58
68
  trusted diagnostic seam can make the next retained fingerprint uniquely
@@ -23,7 +23,11 @@ See [`one-slice-cycle.md`](one-slice-cycle.md); candidate lifecycle is
23
23
  dispatch the exact `devrites-slice-wright` fresh. Root never writes those product
24
24
  paths, wright never widens, and a missing profile stops.
25
25
  For the workflow-artifact branch, the controlling root writes only the admitted
26
- `.devrites/work/<slug>/` paths, proves the complete atomic set, rechecks an
26
+ `.devrites/work/<slug>/` paths. Before an active journal or target write, it
27
+ compiles the materializer and runs the exact transaction implementation in a
28
+ disposable same-layout fixture covering success, replacement failure, rollback,
29
+ retained-temporary cleanup, and rerun. It then proves the complete atomic set,
30
+ rechecks an
27
31
  identical product candidate, records hashes/evidence, and runs narrow Vet. Do not
28
32
  dispatch any agent as a substitute writer and do not charge a product slice.
29
33
 
@@ -144,8 +144,12 @@ Pull the standard named by the active axis: `principles.md`, `patterns.md`,
144
144
  After each fold-back rerun step 2a; missing/meaning-changing mappings block.
145
145
  Keep `state.md` non-READY for step 6.
146
146
  6. **One narrow recheck after edits.** If the candidate changed, dispatch exact
147
- `devrites-plan-reviewer` once with accepted findings, changed paths/criteria,
148
- and new identity. No full or third loop; if it changes the plan, repeat step 5.
147
+ `devrites-plan-reviewer` once per correction/fingerprint with accepted findings,
148
+ changed paths/criteria, and new identity. Within that same correction, no full
149
+ or third loop; if it changes the plan, repeat step 5. If the recheck closes its
150
+ input fingerprint but discovers a distinct Critical/Important invariant, return
151
+ that new fingerprint to the controlling caller as progress. It may start the
152
+ next bounded Plan/Recovery-Vet cycle; the prior reviewer count is not exhaustion.
149
153
  Then close the matrix and rerun step 2a's ID-and-meaning audit.
150
154
 
151
155
  6a. **Build readback.** From the final owning artifacts, add a cited five-line
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devrites",
3
- "version": "4.0.10",
3
+ "version": "4.0.12",
4
4
  "description": "DevRites: a disciplined senior-engineer workflow pack for Claude Code and Codex",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://github.com/ViktorsBaikers/DevRites#readme",