devrites 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/docs/engine/commands.md +65 -6
  4. package/engine/go.mod +1 -1
  5. package/engine/internal/gate/gate.go +154 -46
  6. package/engine/internal/gate/gate_test.go +290 -2
  7. package/engine/internal/gate/readiness_binding.go +66 -100
  8. package/engine/internal/gate/readiness_binding_test.go +126 -3
  9. package/engine/internal/lib/resolve.go +6 -6
  10. package/engine/internal/state/cmd/workflowmanifest/main.go +32 -3
  11. package/engine/internal/state/feature.go +1 -100
  12. package/engine/internal/state/observation.go +584 -0
  13. package/engine/internal/state/observation_open_other.go +9 -0
  14. package/engine/internal/state/observation_open_unix.go +12 -0
  15. package/engine/internal/state/observation_test.go +960 -0
  16. package/engine/internal/state/observation_unix_test.go +68 -0
  17. package/engine/internal/state/schema.go +60 -160
  18. package/engine/internal/state/state_test.go +489 -101
  19. package/engine/internal/state/status.go +67 -48
  20. package/engine/tests/adr_0004_required_by_phase_test.go +16 -13
  21. package/engine/tests/adr_0011_define_plan_test.go +14 -12
  22. package/engine/tests/gate_test.go +403 -28
  23. package/engine/tests/workspace_observation_migration_test.go +1065 -0
  24. package/pack/.claude/skills/devrites-debug-recovery/SKILL.md +1 -10
  25. package/pack/.claude/skills/devrites-lib/reference/standards/acceptance-preserving-reslice.md +30 -0
  26. package/pack/.claude/skills/devrites-lib/reference/standards/afk-hitl.md +2 -9
  27. package/pack/.claude/skills/devrites-lib/reference/standards/one-shot-actions.md +1 -6
  28. package/pack/.claude/skills/devrites-lib/reference/standards/workflow-artifacts.md +411 -102
  29. package/pack/.claude/skills/rite-autocomplete/SKILL.md +98 -146
  30. package/pack/.claude/skills/rite-autocomplete/reference/decision-policy.md +11 -5
  31. package/pack/.claude/skills/rite-autocomplete/reference/loop.md +96 -134
  32. package/pack/.claude/skills/rite-autocomplete/reference/stop-conditions.md +92 -131
  33. package/pack/.claude/skills/rite-build/SKILL.md +51 -79
  34. package/pack/.claude/skills/rite-build/reference/phase-contract.md +3 -17
  35. package/pack/.claude/skills/rite-plan/SKILL.md +17 -17
  36. package/pack/.claude/skills/rite-plan/reference/anti-patterns.md +11 -1
  37. package/pack/.claude/skills/rite-plan/reference/replan-and-repair.md +10 -3
  38. package/pack/.claude/skills/rite-prove/SKILL.md +95 -153
  39. package/pack/.claude/skills/rite-vet/SKILL.md +121 -174
  40. package/pack/.claude/skills/rite-vet/reference/anti-patterns.md +14 -2
  41. package/pack/.claude/skills/rite-vet/reference/artifacts.md +10 -6
  42. package/pack/.claude/skills/rite-vet/reference/depth.md +10 -3
  43. package/pack/.claude/skills/rite-vet/reference/review-axes.md +12 -4
  44. package/pack/generated/claude/skills/devrites-debug-recovery/SKILL.md +1 -10
  45. package/pack/generated/claude/skills/devrites-lib/reference/standards/acceptance-preserving-reslice.md +30 -0
  46. package/pack/generated/claude/skills/devrites-lib/reference/standards/afk-hitl.md +2 -9
  47. package/pack/generated/claude/skills/devrites-lib/reference/standards/one-shot-actions.md +1 -6
  48. package/pack/generated/claude/skills/devrites-lib/reference/standards/workflow-artifacts.md +411 -102
  49. package/pack/generated/claude/skills/rite-autocomplete/SKILL.md +98 -146
  50. package/pack/generated/claude/skills/rite-autocomplete/reference/decision-policy.md +11 -5
  51. package/pack/generated/claude/skills/rite-autocomplete/reference/loop.md +96 -134
  52. package/pack/generated/claude/skills/rite-autocomplete/reference/stop-conditions.md +92 -131
  53. package/pack/generated/claude/skills/rite-build/SKILL.md +51 -79
  54. package/pack/generated/claude/skills/rite-build/reference/phase-contract.md +3 -17
  55. package/pack/generated/claude/skills/rite-plan/SKILL.md +17 -17
  56. package/pack/generated/claude/skills/rite-plan/reference/anti-patterns.md +11 -1
  57. package/pack/generated/claude/skills/rite-plan/reference/replan-and-repair.md +10 -3
  58. package/pack/generated/claude/skills/rite-prove/SKILL.md +95 -153
  59. package/pack/generated/claude/skills/rite-vet/SKILL.md +121 -174
  60. package/pack/generated/claude/skills/rite-vet/reference/anti-patterns.md +14 -2
  61. package/pack/generated/claude/skills/rite-vet/reference/artifacts.md +10 -6
  62. package/pack/generated/claude/skills/rite-vet/reference/depth.md +10 -3
  63. package/pack/generated/claude/skills/rite-vet/reference/review-axes.md +12 -4
  64. package/pack/generated/codex/skills/devrites-debug-recovery/SKILL.md +1 -10
  65. package/pack/generated/codex/skills/devrites-lib/reference/standards/acceptance-preserving-reslice.md +30 -0
  66. package/pack/generated/codex/skills/devrites-lib/reference/standards/afk-hitl.md +2 -9
  67. package/pack/generated/codex/skills/devrites-lib/reference/standards/one-shot-actions.md +1 -6
  68. package/pack/generated/codex/skills/devrites-lib/reference/standards/workflow-artifacts.md +411 -102
  69. package/pack/generated/codex/skills/rite-autocomplete/SKILL.md +98 -146
  70. package/pack/generated/codex/skills/rite-autocomplete/reference/decision-policy.md +11 -5
  71. package/pack/generated/codex/skills/rite-autocomplete/reference/loop.md +96 -134
  72. package/pack/generated/codex/skills/rite-autocomplete/reference/stop-conditions.md +92 -131
  73. package/pack/generated/codex/skills/rite-build/SKILL.md +51 -79
  74. package/pack/generated/codex/skills/rite-build/reference/phase-contract.md +3 -17
  75. package/pack/generated/codex/skills/rite-plan/SKILL.md +17 -17
  76. package/pack/generated/codex/skills/rite-plan/reference/anti-patterns.md +11 -1
  77. package/pack/generated/codex/skills/rite-plan/reference/replan-and-repair.md +10 -3
  78. package/pack/generated/codex/skills/rite-prove/SKILL.md +95 -153
  79. package/pack/generated/codex/skills/rite-vet/SKILL.md +121 -174
  80. package/pack/generated/codex/skills/rite-vet/reference/anti-patterns.md +14 -2
  81. package/pack/generated/codex/skills/rite-vet/reference/artifacts.md +10 -6
  82. package/pack/generated/codex/skills/rite-vet/reference/depth.md +10 -3
  83. package/pack/generated/codex/skills/rite-vet/reference/review-axes.md +12 -4
  84. package/package.json +1 -1
@@ -7,161 +7,113 @@ user-invocable: true
7
7
 
8
8
  # /rite-autocomplete: full lifecycle, unattended
9
9
 
10
- Runs every phase unattended after initial clarification. Irreversible-risk,
10
+ Run every phase after one clarification window. Irreversible-risk,
11
11
  blocking/escalating,<!-- pack-scan-ignore: negated statement: gates are NOT disabled -->
12
- and NO-GO gates still pause. Use the **Standard** native execution profile by
13
- default and **Full** for high-risk scope or explicit `--full`; profiles are defined in
14
- [`devrites-lib/reference/orchestration-profiles.md`](../devrites-lib/reference/orchestration-profiles.md).
12
+ NO-GO, resource, and human-owned gates still pause. Use the Standard native
13
+ profile by default and Full for high-risk scope or explicit `--full`; see
14
+ [`orchestration-profiles.md`](../devrites-lib/reference/orchestration-profiles.md).
15
15
 
16
- ## Rules consulted (read on demand from `.claude/skills/devrites-lib/reference/standards/`)
17
- **Step 0:** Read `.claude/skills/devrites-lib/reference/standards/core.md` and `.claude/skills/devrites-lib/reference/standards/afk-hitl.md` first.
18
- When the cursor or approved plan contains a consumptive action, also read
19
- `.claude/skills/devrites-lib/reference/standards/one-shot-actions.md` before any
20
- stop/continue or execution decision.
21
- When a blocked cursor names missing executable controller/harness/bundle bytes or
22
- a missing writer under the active feature workspace, read
23
- `.claude/skills/devrites-lib/reference/standards/workflow-artifacts.md` before honoring
24
- the terminal cursor or its recovery count.
16
+ ## Required rules
25
17
 
26
- ## Operating rules
27
- - **Use one initial human window.** Run spec and topology-first clarify; arm AFK
28
- only after `Decision coverage: CLEAR`. Record later discretionary calls
29
- ([decision policy](reference/decision-policy.md)).
30
- - **Safety gates are not bypassable.** Irreversible risk, blocking/escalating,
31
- open validating gates, and unexcepted principle violations pause. `--ship` /
32
- `--yolo` never authorizes Git; it reaches only the exact-plan literal-GO and
33
- native-approval boundary. Red checks run bounded recovery, then block unless
34
- the remaining decision is human-owned.
35
- - **Keep routine backtracking internal.** Always follow agent-owned backward edges
36
- through repair, Vet, bounded implementation correction, and re-proof inside
37
- the active run. A nested phase `STOP` or intermediate `Next step` is not a
38
- user handoff; pause only on the shared real stop conditions.
18
+ Read `devrites-lib/reference/standards/core.md` and `afk-hitl.md` first. Read
19
+ `one-shot-actions.md` before any stop/continue or execution decision involving a
20
+ consumptive action. Before honoring a terminal cursor that names missing
21
+ executable controller/harness/bundle bytes or a missing writer, read
22
+ `workflow-artifacts.md`. Before classifying any Reslice, read `.claude/skills/devrites-lib/reference/standards/acceptance-preserving-reslice.md`.
23
+
24
+ <!-- BEGIN RESLICE ROUTE-TO-ACTION -->
25
+ - `FOLD` keep Plan repair/affected Vet internal; no stop solely for topology/count.
26
+ - `GUARD_AND_REPAIR` enter Spec Drift Guard/Clarify; pause only at an existing human-owned gate; resume Plan/Vet internally.
27
+ - `BLOCKED_INPUT` no planning writes; stop internal branch; exact diagnostic; recover authority; reclassify.
28
+ <!-- END RESLICE ROUTE-TO-ACTION -->
29
+
30
+ ## Invariants
31
+
32
+ - Use one initial human window: Spec, topology-first Clarify, and
33
+ `Decision coverage: CLEAR`. Only then arm AFK. Record later reversible choices
34
+ under [decision policy](reference/decision-policy.md).
35
+ - Safety is not bypassable. `--ship`/`--yolo` reaches only the exact-plan
36
+ literal-GO and native-approval boundary; it never authorizes Git.
39
37
  - **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.
44
- - **Do not confuse an action budget with recovery exhaustion.** After a failed
45
- consumptive action, zero remaining real attempts blocks only another execution.
46
- New retained Critical/Important evidence starts offline repair and narrow Vet
47
- inside this Autocomplete invocation. Stop for a fresh GO only after that repair
48
- changes the failure condition and Vet is READY.
49
- - **Admit work under the AFK resource envelope.** Vet may split/add slices.
50
- `--max-slices N` replaces the safe new-sentinel default of 10; post-Vet pending
51
- count may lower it. Before every phase or leaf dispatch, also enforce expiry,
52
- review-backlog, and native agent/token/cost/time limits from `afk-hitl.md`.
53
- - **Parse flags only from this invocation.** `--ship`, `--yolo`, `--max-slices`,
54
- `--full`, and `--cross-model` are active only when their exact standalone tokens
55
- occur in `$ARGUMENTS`; their presence in this skill, examples, or earlier messages
56
- can never arm them. `--max-slices` must occur once and be followed by a positive
57
- base-10 integer; missing, repeated, malformed, or conflicting values stop before
58
- any sentinel or workspace write.
59
- - **Record discretionary choices.** Use the specialist/reviewer recommendation
60
- and rationale; never choose arbitrarily.
61
- - **Strategic review runs, but never auto-grows scope.** After `/rite-clarify`, run `/rite-temper`
62
- (significance-gated; it skips low-stakes specs in one line). Unattended it auto-applies only
63
- `hold-rigor` + `reduce-to-MVP` (these never grow acceptance); **any `expand` is a blocking
64
- pause**, and irreversible-risk findings always pause. Autocomplete hardens and may *prune* the
65
- spec on its own; it never *expands* the build's scope without the human.
66
- - **Engineering review runs on every plan, but never auto-grows scope.** After `/rite-define`,
67
- run `/rite-vet` on **every** feature (depth scales: a light pass on simple plans, full rigor on
68
- big/risky; never skipped). Unattended it auto-applies only *hardening* findings: added test
69
- requirements, error-handling / failure-mode coverage, tightened scope, reuse-over-rebuild,
70
- dependency-order fixes (these never grow acceptance); acceptance-preserving
71
- reslicing or remediation remains agent-owned. **Any finding that grows product
72
- scope or changes acceptance is a blocking pause**, and irreversible-risk findings always
73
- pause. Cross-model is off unless `--cross-model` was armed.
38
+ to Plan repair and narrow Vet. `NEEDS_REPLAN` cold resume follows a valid
39
+ technical return cursor before forward work or any reply. Clarification is
40
+ likewise internal when current authority resolves it.
41
+ - Always follow agent-owned backward edges through repair, affected Vet,
42
+ correction, and proof. A nested `STOP`/`Next step` is not a user handoff.
43
+ Pause only for a shared human/safety/access/exhaustion condition.
44
+ - **Do not confuse an action budget with recovery exhaustion.** Spent action
45
+ authority blocks another real execution, not offline correction of retained
46
+ Critical/Important evidence. Stop for fresh GO only after changed conditions
47
+ and READY Vet.
48
+ - Every exact causal fingerprint gets at most three no-progress corrections.
49
+ Closing one is progress; a distinct Critical/Important invariant has its own
50
+ budget. Lower severity cannot prolong recovery.
51
+ - Enforce `--max-slices`, the AFK sentinel, expiry, review queue, and native
52
+ agent/token/cost/time limits before every phase or dispatch. Count failed,
53
+ malformed, and unavailable leaf calls. At the review cap, permit only work
54
+ that reduces the queue.
55
+ - Parse flags only from this invocation. `--ship`, `--yolo`, `--max-slices`,
56
+ `--full`, and `--cross-model` activate only as exact standalone tokens in
57
+ `$ARGUMENTS`; examples or earlier messages can never arm them. `--max-slices`
58
+ must occur once and be followed by a positive base-10 integer; missing, repeated, malformed, or conflicting values stop before any write.
59
+ - Temper always runs after Clarify. Unattended mode auto-applies only
60
+ `hold-rigor` and `reduce-to-MVP`; any `expand` or added acceptance pauses.
61
+ - Vet every plan. Cross-model is off unless the current invocation arms it.
62
+ Never auto-grow accepted scope.
74
63
 
75
64
  ## Workflow
76
- 1. **Orient + parse args.** Resolve the explicit or active slug, require its
77
- `state.md`, and read the cursor directly. Before honoring `blocked` with a
78
- terminal `next_action`, reconcile retained consumptive-action artifacts and
79
- per-fingerprint attempts from `drift.md` / `evidence.md`. A distinct retained
80
- fingerprint below its no-progress cap reopens caller-owned offline recovery;
81
- a stale pre-ownership workflow-artifact writer stop reopens under
82
- `workflow-artifacts.md` when no controlling-root materialization attempt exists.
83
- A `NEEDS_REPLAN` cold resume with a valid technical return cursor immediately
84
- invokes Plan repair and Recovery Vet before selecting a forward phase or
85
- emitting any reply.
86
- That materialization runs directly as non-consumptive prerequisite recovery,
87
- even with no pending product slice or AFK budget; it does not re-ask an answered
88
- human gate.
89
- reconstruct any missing return cursor only from the current phase plus the
90
- exact approved action in `test-plan.md` / evidence, never from chat or guesswork.
91
- The idea + flags: `--ship` / `--yolo` (continue through ship preflight, then stop
92
- for literal-GO and native approval), `--max-slices N` (optional explicit cap;
93
- a newly created sentinel defaults to 10 and post-Vet pending count may lower it).
94
- Parse only the current `$ARGUMENTS`; normalize the result to the idea,
95
- `ship_preflight: yes|no`, `max_slices: N|default`, `profile: standard|full`, and
96
- `cross_model: yes|no`.
97
- **Completion:** that normalized state is unambiguous and no sentinel or workspace
98
- file has been written.
99
- 2. **Specify and clarify up front.** Use `devrites-interview`, `/rite-spec`, and
100
- `/rite-clarify` as one interactive window. Clear specs ask zero questions; Partial/Missing
101
- coverage never arms AFK. **Completion:** `decision-coverage.md` records `CLEAR`.
102
- 3. **Arm AFK after clarity.** Require `Decision coverage: CLEAR`, then apply the
103
- loop's [one-write AFK contract](reference/loop.md#arm-afk-once): preserve a valid
104
- existing sentinel byte-for-byte or create an advisory-only sentinel once with
105
- bounded slices, agents, wall time, review queue, and four-hour absolute expiry;
106
- never rewrite it after Vet or reset it on resume. Also `touch .devrites/CHECKPOINT`:
107
- unattended runs use
108
- checkpoint mode so each proven slice is committed locally as a crash-survivable
109
- `WIP` ([rite-build/reference/checkpoint.md](../rite-build/reference/checkpoint.md));
110
- `/rite-ship` collapses them into the one feature commit. **Completion:** AFK config is
111
- valid and advisory-only, any pre-existing bytes are unchanged, and the checkpoint
112
- sentinel exists.
113
- 4. **Drive the phases** ([reference/loop.md](reference/loop.md)). The canonical arc is
114
- `/rite-spec` → **`/rite-clarify`** → **`/rite-temper`** → `/rite-define` →
115
- **`/rite-vet`** → `/rite-build` (repeat until all slices
116
- built; root charges the AFK budget once per green built slice) → `/rite-prove`
117
- → `/rite-polish` → `/rite-review` → `/rite-seal`.
118
- Read each `SKILL.md` and execute it; workspace files carry state, not chat.
119
- Follow the loop's backward-edge contract whenever a later phase discovers an
120
- agent-owned earlier-phase gap; keep the original return cursor until that
121
- phase resumes.
122
- Immediately after `/rite-vet` and before the first Build dispatch, apply the loop's
123
- [mutable post-vet budget](reference/loop.md#derive-the-mutable-post-vet-budget)
124
- contract, then apply resource admission before every phase and native dispatch.
125
- **Completion:** the loop reaches Seal GO, or a stop condition is persisted
126
- before any later phase runs; the cursor names the last completed phase and the
127
- effective remaining budget.
128
- 5. **Apply stop conditions at every gate** ([reference/stop-conditions.md](reference/stop-conditions.md)):
129
- first route an agent-owned red technical result through the loop's bounded
130
- recovery; its `blocked` label alone is not a stop condition. After that, on
131
- hard-risk / human-owned blocking / escalating / NO-GO / slice, agent, token,
132
- cost, time, review-queue, or expiry exhaustion / still-low-confidence → write
133
- `state.md` (`Status`, `Next step`), surface *why*, and **STOP**.
134
- Exhausted agent-owned technical recovery uses the terminal `Next step: none`
135
- marker and never hands the user `/rite-plan unblock` or another routine
136
- phase command.
137
- **Completion:** either no stop condition is active, or the stopped cursor and reason
138
- are durable and no later phase has been invoked.
139
- 6. **Seal GO → ship boundary.** With `--ship` / `--yolo`, proceed through
140
- `/rite-ship` preflight, disclose the exact Git plan, then stop for the human's
141
- literal `GO` and any native host approval. Without the flag, stop at seal GO with
142
- `/rite-ship` as the resume command. **Completion:** the no-flag path has performed no
143
- Ship work; the flagged path has disclosed the exact plan and performed no Git action
144
- before fresh literal `GO` plus native approval.
145
65
 
146
- > **Mid-flight discipline.** Stop rather than auto-passing a blocking gate, answering a
147
- > human-owned material question, or continuing past red tests.
66
+ 1. **Orient and parse.** Resolve the explicit or active slug, require `state.md`,
67
+ and read its cursor. Before honoring `blocked` with terminal `next_action`,
68
+ reconcile retained consumptive evidence and fingerprint attempts from
69
+ `drift.md`/`evidence.md`; a retained fingerprint below its cap resumes offline
70
+ recovery.
71
+ <!-- workflow-artifact-adapter: {"module":"devrites-lib/reference/standards/workflow-artifacts.md","entry":"lifecycle cursor encounters admitted set or resumable journal","action":"invoke classifier; execute returned route internally","return":"saved phase/action; zero intermediate reply"} -->
72
+ Reconstruct a missing return cursor only from
73
+ the current phase and exact approved action in `test-plan.md`/evidence, never
74
+ from chat. Normalize current arguments to idea, `ship_preflight: yes|no`,
75
+ `max_slices: N|default`, `profile: standard|full`, and `cross_model: yes|no`.
76
+ **Completion:** normalized state is unambiguous and no sentinel or workspace file has been written.
77
+ 2. **Specify and clarify.** Run `devrites-interview`, `/rite-spec`, and
78
+ `/rite-clarify` as one window. Partial/Missing material coverage never arms
79
+ AFK. **Completion:** `Decision coverage: CLEAR` is durable.
80
+ 3. **Arm AFK once.** Apply the loop's
81
+ [one-write AFK contract](reference/loop.md#arm-afk-once): preserve valid
82
+ existing bytes or create the bounded advisory-only sentinel once; never
83
+ rewrite it after Vet. Preserve an existing sentinel byte-for-byte. Touch
84
+ `.devrites/CHECKPOINT` so proven slices get local crash-survivable WIP
85
+ checkpoints for Ship to collapse. **Completion:** valid read-only AFK and checkpoint sentinels exist.
86
+ 4. **Drive phases.** Follow [the loop](reference/loop.md): `/rite-spec` →
87
+ `/rite-clarify` → `/rite-temper` → `/rite-define` → `/rite-vet` →
88
+ `/rite-build` × pending slices → `/rite-prove` → `/rite-polish` →
89
+ `/rite-review` → `/rite-seal`. Read and execute each skill; durable files, not
90
+ chat, carry state. Apply the mutable post-vet budget before first Build.
91
+ **Completion:** loop reaches Seal GO or persists a valid stop before any later phase.
92
+ 5. **Apply stops.** At every gate use
93
+ [stop-conditions.md](reference/stop-conditions.md). A `blocked` label alone is not a stop condition:
94
+ route agent-owned red results through bounded recovery.
95
+ Red gates block forward advancement and enter caller-owned recovery. Stop on
96
+ hard risk, human-owned blocking/escalating/NO-GO, resource exhaustion, or the
97
+ exact fingerprint's proven exhaustion. Technical exhaustion records terminal
98
+ `Next step: none`, never a routine phase command. **Completion:** no stop is active, or its cursor and reason are durable.
99
+ 6. **Seal boundary.** Without a ship flag, stop at Seal GO with `/rite-ship`.
100
+ With one, perform Ship preflight, disclose the exact Git plan, and stop for
101
+ fresh literal `GO` plus native approval. **Completion:** performed no Git action before fresh literal `GO` plus native approval.
148
102
 
149
- Keep the log terse:
150
- ```
103
+ ## Reply and resume
104
+
105
+ HITL Build returns after one slice; explicit valid AFK may chain only green
106
+ slices within every cap. One Autocomplete invocation owns all internal
107
+ backtracking. Context pressure, compaction, or a nested completion footer does
108
+ not create a stop; persist and resume the cursor.
109
+
110
+ Use one terse line:
111
+
112
+ ```text
151
113
  Autocomplete: <slug>
152
114
  spec <done|stopped> · clarify <clear|stopped> · temper <done|skipped|stopped> · define <done|stopped> · vet <ready|stopped> · build <n/N|stopped> · prove <done|stopped> · polish <done|stopped> · review <done|stopped> · seal <GO|NO-GO|stopped>
153
115
  ```
154
116
 
155
- Final state examples: `Shipped: <feature>`, `Stopped: <reason>`, `Awaiting human:
156
- <qid> · <gate> · <slice/phase>`, `NO-GO: <verdict>`, or `GO: feature cleared to ship`.
157
- Do not write a narrative recap.
158
-
159
- ## Clean baseline and checkpoint mode
160
- - Before autonomy, require a clean or accepted baseline; refuse unrelated dirty work and record plan artifacts.
161
- - Arm `.devrites/CHECKPOINT`; `/rite-ship` collapses its local-only proven-slice checkpoints.
162
- - Red gates block forward advancement and enter caller-owned bounded recovery.
163
- Stop only when the shared stop contract classifies risk/HITL or the exact
164
- fingerprint's recovery budget is exhausted.
165
- - One autocomplete pass spans the lifecycle. Each wright returns after one slice;
166
- explicit `.devrites/AFK` lets the Build root chain green slices under cap/pause rules;
167
- otherwise HITL stops.
117
+ Final state is `Shipped`, `Stopped`, `Awaiting human`, `NO-GO`, or `GO`; do not
118
+ write a narrative recap. Require a clean or accepted baseline, arm checkpoint
119
+ mode, and never auto-pass a red gate.
@@ -4,6 +4,14 @@ Unattended ≠ careless. Every discretionary choice is made the way a senior eng
4
4
  would, then **recorded** so the seal can audit it. The difference from interactive mode
5
5
  is only *who answers* a discretionary question, not whether it's reasoned.
6
6
 
7
+ Authority: `.claude/skills/devrites-lib/reference/standards/acceptance-preserving-reslice.md`.
8
+
9
+ <!-- BEGIN RESLICE ROUTE-TO-ACTION -->
10
+ - `FOLD` → keep Plan repair/affected Vet internal; no stop solely for topology/count.
11
+ - `GUARD_AND_REPAIR` → enter Spec Drift Guard/Clarify; pause only at an existing human-owned gate; resume Plan/Vet internally.
12
+ - `BLOCKED_INPUT` → no planning writes; stop internal branch; exact diagnostic; recover authority; reclassify.
13
+ <!-- END RESLICE ROUTE-TO-ACTION -->
14
+
7
15
  ## The rule
8
16
 
9
17
  For each non-trivial choice, pick the option the **relevant specialist favours**, and
@@ -28,8 +36,6 @@ not pick the option that's merely easiest to implement.
28
36
 
29
37
  ## When a choice is NOT autocomplete's to make
30
38
 
31
- If a discretionary choice would change **product behaviour, scope, data model, security
32
- posture, or acceptance criteria**, it is no longer discretionary. It is a material
33
- question. Route it through the Spec Drift Guard / a `blocking` question and **stop**
34
- (see [stop-conditions.md](stop-conditions.md)). Autocomplete answers *how*, never
35
- *what to build* beyond what the up-front interview settled.
39
+ Human-owned contract, data-model, security, and product choices are not discretionary.
40
+ Use owning elicitation/safety gates and the topology marked action. Autocomplete
41
+ answers *how*, never *what to build* beyond the settled interview.
@@ -1,154 +1,116 @@
1
1
  # The autocomplete loop: arm AFK, drive every phase
2
2
 
3
- Autocomplete sequences existing `/rite-*` workflows and enforces stop
4
- conditions without pausing between routine phases.
3
+ Autocomplete sequences existing `/rite-*` workflows without pausing between
4
+ routine phases. Acceptance-preserving Reslice authority is
5
+ `.claude/skills/devrites-lib/reference/standards/acceptance-preserving-reslice.md`.
5
6
 
6
- ## Arm AFK once
7
+ <!-- BEGIN RESLICE ROUTE-TO-ACTION -->
8
+ - `FOLD` → keep Plan repair/affected Vet internal; no stop solely for topology/count.
9
+ - `GUARD_AND_REPAIR` → enter Spec Drift Guard/Clarify; pause only at an existing human-owned gate; resume Plan/Vet internally.
10
+ - `BLOCKED_INPUT` → no planning writes; stop internal branch; exact diagnostic; recover authority; reclassify.
11
+ <!-- END RESLICE ROUTE-TO-ACTION -->
7
12
 
8
- Arm the gate policy up front without mutating it later:
13
+ ## Arm AFK once
9
14
 
10
15
  ```yaml
11
- allow_gates: [advisory] # only advisory auto-handles; validating+ pause
12
- max_slices: 10 # explicit --max-slices N replaces this default
13
- max_agents: 32 # native leaf dispatches in this host activation
14
- max_minutes: 120 # activation wall-clock cap
15
- max_review_queue: 8 # unresolved review/gate backlog cap
16
- expires_at: "<now + 4 hours>" # write one absolute ISO-8601 UTC timestamp
17
- # max_tokens: <N> # optional stricter native-host cap
18
- # max_cost_usd: <amount> # optional stricter native-host cap
19
- # notify: "<cmd>" # optional — fired after a durable stop
16
+ allow_gates: [advisory]
17
+ max_slices: 10
18
+ max_agents: 32
19
+ max_minutes: 120
20
+ max_review_queue: 8
21
+ expires_at: "<now + 4 hours>"
22
+ # max_tokens: <N>
23
+ # max_cost_usd: <amount>
24
+ # notify: "<cmd>"
20
25
  ```
21
26
 
22
- Read an existing sentinel first. Preserve it byte-for-byte when valid; stop if its gate
23
- ceiling exceeds `advisory`, its required resource envelope is missing/malformed/expired,
24
- or its `max_slices` conflicts with the invocation. If absent, write it once after clarity
25
- with the safe defaults above, replacing `max_slices` only for an explicit
26
- `--max-slices N` and resolving `expires_at` to one absolute timestamp. The sentinel is
27
- read-only: never rewrite it after `/rite-vet` to inject a discovered plan count or to
28
- reset resource authority.
27
+ Read an existing sentinel first. Preserve it byte-for-byte when valid; stop if
28
+ its gate ceiling exceeds advisory, required envelope is malformed/expired, or
29
+ `max_slices` conflicts with the invocation. If absent, write it once after
30
+ clarity, replacing the safe slice default only for explicit `--max-slices N`
31
+ and resolving one absolute UTC expiry. It is read-only: never rewrite it after
32
+ Vet or reset it on resume.
29
33
 
30
34
  ### Derive the mutable post-vet budget
31
35
 
32
- After `/rite-vet`, count remaining pending slices and derive the run budget as the
33
- minimum of that count, an explicit `--max-slices`, and a configured sentinel cap. Before
34
- the first build dispatch, pre-seed `state.md` `afk_slices_remaining` when absent. If a
35
- valid remaining counter already exists, retain the lower of it and the derived budget;
36
- never increase or reinitialize it. This keeps the crash-survivable budget in its mutable owner
37
- without changing AFK configuration mid-run.
36
+ After Vet, count pending slices and take the minimum of that count, explicit
37
+ flag, and sentinel cap. Before first Build, seed absent state-owned
38
+ `afk_slices_remaining`; retain the lower valid existing value and never increase
39
+ or reinitialize it. AFK configuration itself stays unchanged.
38
40
 
39
41
  ### Admit each unattended cycle
40
42
 
41
- Before every phase, parallel review fan-out, recovery dispatch, or writer dispatch,
42
- apply [`afk-hitl.md`](../../devrites-lib/reference/standards/afk-hitl.md#unattended-resource-envelope):
43
- run the cheapest readiness/current-state check, reject overlapping work, count the
44
- current unresolved review queue, and check expiry plus native agent/token/cost/time
45
- headroom. Count every leaf, including failed/malformed/unavailable results. At the
46
- review cap, only reconciliation that reduces the queue may run. Any limit reached or
47
- unobservable declared cap ends the current activation before more work and persists
48
- its checkpoint/reason. A genuinely new native activation starts fresh agent/time/token/
49
- cost counters, but reuses durable slice/recovery state, absolute expiry, and recomputed
50
- review queue. It never resets those durable bounds.
51
-
52
- `allow_gates: [advisory]` prevents an open `gate: validating` from being queued until
53
- seal, where it would force NO-GO under `afk-hitl.md`. Autocomplete pauses on it instead. Widen
54
- `allow_gates` only outside autocomplete through an explicit human configuration change;
55
- autocomplete itself never widens the ceiling.
56
-
57
- ## Drive the phases
58
-
59
- Read each phase's `SKILL.md` and execute that workflow. Workspace files such as
60
- `state.md`, `tasks.md`, and `evidence.md` carry state between phases; chat does not.
61
-
62
- | Step | Phase | Loop / gate |
63
- |---|---|---|
64
- | 1 | `/rite-spec` | interactive window: investigate, feed intent answers, write `spec.md` |
65
- | 2 | `/rite-clarify` | same interactive window: topology-first scan; write `decision-coverage.md`; proceed only on `CLEAR`, then arm AFK |
66
- | 3 | `/rite-temper` | significance-gated strategic review; harden spec + write `strategy.md`. Skip low-stakes specs in one line. AFK: `hold-rigor` / `reduce-to-MVP` auto-apply; **any `expand` pauses (blocking)**; irreversible-risk pauses |
67
- | 4 | `/rite-define` | reads `decision-coverage.md` + `strategy.md`; writes `plan.md` + `tasks.md`; records `Plan approved` |
68
- | 5 | `/rite-vet` | engineering/readiness review on **every** plan (light pass on simple plans, full on big/risky; never skipped); harden `plan.md` / `tasks.md` + write `eng-review.md` (`Implementation readiness: READY`) + `test-plan.md`. AFK: hardening / coverage findings auto-apply; **any scope-growing / acceptance-changing finding pauses (blocking)**; irreversible-risk pauses. Derive and pre-seed the state-owned slice budget after this (vet may split a slice); never rewrite the AFK sentinel |
69
- | 6 | `/rite-build` ×N | **loop** while any slice is `pending`; build one, then let the root charge exactly one budget unit with the built-state record. Zero ⇒ STOP before another dispatch. |
70
- | 7 | `/rite-prove` | once all slices `built`; walks `test-plan.md`; on failure → `devrites-debug-recovery` within scope |
71
- | 8 | `/rite-polish` | re-verify after code edits (evidence must stay fresh) |
72
- | 9 | `/rite-review` | apply in-scope fixes; re-prove if code changed |
73
- | 10 | `/rite-seal` | GO/NO-GO decision (no git here) |
74
- | 11 | `/rite-ship` | only if seal GO; `--ship` / `--yolo` never authorizes Git and only continues to the exact-plan literal-GO/native-approval boundary |
43
+ Before every phase, review fan-out, recovery, or writer dispatch, apply
44
+ `afk-hitl.md#unattended-resource-envelope`: cheapest current-state/readiness
45
+ check first; reject overlap; count unresolved review; check expiry and native
46
+ agent/token/cost/time headroom. Count every leaf result. At the review cap, only
47
+ reconciliation that reduces the queue may run. Any reached or unobservable
48
+ bound stops before more work and persists the winning reason. A new activation
49
+ gets fresh activation-local counters but retains durable slice/recovery state,
50
+ expiry, and recomputed queue.
51
+
52
+ `allow_gates: [advisory]` means validating gates pause now rather than becoming
53
+ Seal NO-GO. Only explicit human configuration outside Autocomplete may widen it.
54
+
55
+ ## Phase arc
56
+
57
+ Workspace files carry state; chat does not. Read and execute each phase skill:
58
+
59
+ | Step | Phase | Completion / edge |
60
+ | --- | --- | --- |
61
+ | 1 | `/rite-spec` | investigate and write testable intent |
62
+ | 2 | `/rite-clarify` | topology-first scan; require `Decision coverage: CLEAR`, then arm AFK |
63
+ | 3 | `/rite-temper` | harden or reduce; expansion and irreversible risk pause |
64
+ | 4 | `/rite-define` | approved plan/tasks/traceability |
65
+ | 5 | `/rite-vet` | every plan; derive mutable budget after READY |
66
+ | 6 | `/rite-build` ×N | one pending slice per wright; charge once only after green built state |
67
+ | 7 | `/rite-prove` | all slices built; approved proof; recovery on red |
68
+ | 8 | `/rite-polish` | re-prove after code edits |
69
+ | 9 | `/rite-review` | in-scope correction then fresh proof |
70
+ | 10 | `/rite-seal` | GO/NO-GO; no Git |
71
+ | 11 | `/rite-ship` | only after GO; `--ship` never authorizes Git; stop at literal-GO/native approval |
72
+
73
+ Before advancing, check resource admission and
74
+ [stop-conditions.md](stop-conditions.md). After source edits, discard stale pass
75
+ evidence. Re-read the active workspace before each phase.
75
76
 
76
77
  ## Backtrack without handing off
77
78
 
78
- When a later phase finds an agent-owned technical gap in an earlier phase, the
79
- Autocomplete root remains the caller:
80
-
81
- On cold resume, reconcile the terminal cursor against durable fingerprint
82
- accounting first. A retained distinct fingerprint with fewer than three
83
- no-progress corrections is unfinished recovery, not an unchanged terminal stop.
84
- Restore `return_phase` from the current phase and `return_next_action` only from
85
- the exact approved action recorded in `test-plan.md` / evidence; ambiguity returns
86
- to the applicable Vet contract and never licenses execution.
87
-
88
- Also reconcile a **stale writer-exhaustion cursor** against
89
- `workflow-artifacts.md`. When exact Vet-ready workflow-artifact paths and behavior
90
- exist, the old attempts only targeted the read-only drafter/reviewer or product
91
- wright, and there is **no controlling-root materialization attempt**, supported
92
- root ownership is a changed routing condition. Preserve the old fingerprint,
93
- record the new materialization fingerprint, and run that offline branch directly;
94
- do not charge or require product-slice/AFK budget, re-ask a resolved question, or
95
- request GO. Once a root materialization attempt exists, never apply this migration
96
- again—route its observed failure normally. That one-time migration
97
- does not make the first root attempt terminal: record it as attempt one under the new
98
- materializer fingerprint and continue bounded offline correction while fewer than
99
- three no-progress corrections exist. This reconciliation runs even when all
100
- product slices are already built, before selecting the next forward phase.
101
-
102
- 1. Save the originating phase/action in the native return cursor unless a valid
103
- one already exists.
104
- 2. Invoke the required repair, Vet, remediation, and proof skills inline. After
105
- Plan repair, run Vet in its recovery mode as a narrow Vet recheck of the prior
106
- findings, changed paths/criteria, and affected evidence; do not restart a Full
107
- Vet over unchanged axes. Their
108
- `STOP` instructions end only those nested phases.
109
- 3. Re-read `state.md` after each nested phase and follow its intermediate
110
- `next_action`; do not hand the intermediate command to the user.
111
- 4. Reconcile each exact causal fingerprint from `drift.md` and `evidence.md`.
112
- Continue automatically when the recheck closes a prior fingerprint or admits
113
- a genuinely new Critical/Important fingerprint. Charge only a no-progress
114
- outcome against the same fingerprint; lower-severity novelty cannot prolong
115
- the chain.
116
- For a failed consumptive action, its spent authorization blocks only another
117
- real execution. A retained artifact that identifies a new fingerprint is the
118
- offline reproduction input: diagnose, repair, and narrow-Vet it now, then pause
119
- for fresh authorization before any next consumptive execution.
120
- 5. When the prerequisite chain is green, restore and consume the return cursor,
121
- resume the originating phase, and continue the forward table.
122
-
123
- Count failed corrections by causal fingerprint under `afk-hitl.md`. Ask only
124
- for a human-owned decision or mandatory safety/access action. Exhausted
125
- agent-owned recovery stops once with its reproduction and dead ends, never with
126
- another routine Plan/Vet command.
79
+ The active Autocomplete root remains caller whenever a later phase exposes an
80
+ agent-owned earlier-phase gap:
81
+
82
+ 1. Save the originating phase/action unless a valid native return cursor exists.
83
+ 2. On cold resume, reconcile the terminal cursor against durable fingerprint
84
+ accounting. Restore `return_next_action` only from the approved
85
+ `test-plan.md`/evidence action; ambiguity returns to Vet and never licenses
86
+ execution.
87
+ 3. Invoke required Plan repair, affected Vet, remediation, and proof inline.
88
+ Recovery Vet is a narrow Vet recheck of prior findings, changed paths/criteria,
89
+ and affected evidence; it never restarts unaffected axes. A nested `STOP`
90
+ ends that phase only; do not hand the intermediate command to the user.
91
+ 4. Re-read state after each nested phase. Reconcile exact causal fingerprints
92
+ from `drift.md`/`evidence.md`. A closed reproduction is progress. A different
93
+ Critical/Important invariant gets a separate budget; Suggestion/Nit/FYI does
94
+ not prolong the chain. Only a no-progress result charges the same fingerprint.
95
+ 5. For failed consumptive action, spent authorization blocks only another real
96
+ execution. Use retained evidence for offline diagnosis, repair, and narrow
97
+ Vet; after READY, pause for fresh authorization.
98
+ 6. Restore and consume the original cursor when prerequisites are green.
99
+
100
+ <!-- workflow-artifact-adapter: {"module":"devrites-lib/reference/standards/workflow-artifacts.md","entry":"loop tick sees Workflow Artifact trigger/state","action":"invoke classifier once under owner lock; no actor-history migration","return":"same loop cursor; no budget charge for verify/rerun"} -->
101
+ Ask only for a human-owned decision or mandatory safety/access action. Three
102
+ no-progress corrections of one exact fingerprint exhaust; preserve its
103
+ reproduction and dead ends without another Plan/Vet command.
127
104
 
128
105
  ## Continuous caller obligation
129
106
 
130
- No user-facing reply is permitted while the durable state contains an
131
- agent-owned `NEEDS_REPLAN`, an intermediate Plan/Vet `next_action`, or a distinct
132
- Critical/Important fingerprint with remaining recovery budget. Invoke the exact
133
- next Plan repair and Recovery Vet immediately. A narrow reviewer closing its input
134
- finding and exposing another Critical/Important invariant is progress: close the
135
- old fingerprint, open the new one, and continue without handing a command to the
136
- user.
137
-
138
- The number of completed repair/Vet cycles is not a stop condition and cannot be
139
- used as a surrogate recovery budget. Only three no-progress corrections of the
140
- same exact fingerprint exhaust. Context pressure, compaction, session duration,
141
- or a nested skill's completion footer also cannot convert an internal checkpoint
142
- into a stop; persist the checkpoint and resume from it inside the same controlling
143
- invocation. Autocomplete may emit its final reply only after reaching its requested
144
- rest point or one of the shared human/safety/access/exhaustion stop conditions.
145
-
146
- ## Between phases
147
-
148
- - Re-read the active workspace before each phase (don't trust chat memory).
149
- - Re-run resource admission before each phase or native dispatch; stop before work
150
- when expiry, review backlog, or agent/token/cost/time headroom is exhausted.
151
- - After a phase that edits code (build, polish, review), evidence may be stale: let
152
- the next gate re-prove rather than carrying a stale pass (see
153
- `.claude/skills/devrites-lib/reference/standards/development-workflow.md`).
154
- - Check [stop-conditions.md](stop-conditions.md) at every gate **before** advancing.
107
+ No user-facing reply is permitted while durable state contains agent-owned
108
+ `NEEDS_REPLAN`, an intermediate Plan/Vet action, or a distinct retained
109
+ Critical/Important fingerprint below its cap. Invoke the next internal repair
110
+ immediately. A narrow reviewer closing one finding and exposing another
111
+ Critical/Important invariant is progress, not exhaustion.
112
+
113
+ The number of completed repair/Vet cycles is not a stop condition. Context
114
+ pressure, compaction, session duration, and nested completion do not convert an
115
+ internal checkpoint into a handoff. Persist it and resume until the requested
116
+ rest point or a shared human/safety/access/exhaustion condition.