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
@@ -1,131 +1,92 @@
1
- # Stop conditions: when autocomplete must pause for a human
2
-
3
- On these conditions, write `state.md` (`awaiting_human` or `blocked`), report
4
- the reason and one resume command when an actual human/safety/access action can
5
- change the state, notify if configured, and stop. Exhausted agent-owned
6
- technical recovery is terminal for its unchanged causal fingerprint: record
7
- `Next step: none` and no runnable recovery command. `--ship` cannot bypass them.
8
- Closure of a prior fingerprint is progress, not exhaustion. A separately evidenced
9
- Critical/Important failed invariant starts its own bounded fingerprint; it never
10
- resets or extends the budget of the one just closed.
11
-
12
- An exhausted consumptive-action authorization is not technical-recovery
13
- exhaustion. It blocks another real action, but retained evidence of a new
14
- Critical/Important fingerprint must enter offline caller-owned recovery while its
15
- own no-progress budget remains. After affected Vet is READY, pause for fresh action
16
- authorization; never execute from the old GO.
17
-
18
- ## Always stop (irreversible-risk list: from `afk-hitl.md`)
19
-
20
- Regardless of `allow_gates` or `--ship`:
21
- - Destructive data migration (drop column/table, irreversible backfill).
22
- - Auth / authz boundary change.
23
- - Public-API break (response shape, removed endpoint, changed status semantics).
24
- - External-service contract change.
25
- - Filesystem destruction outside the workspace.
26
-
27
- Red checks are hard non-advance gates. Run bounded `devrites-debug-recovery`;
28
- on exhaustion, stop as a technical blocker unless human-owned.
29
-
30
- ## Not a stop: agent-owned backtracking
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
-
37
- Agent-owned backtracking is not a stop condition while its causal-fingerprint
38
- budget remains. The active caller invokes the earlier phase inline, follows Vet
39
- and any bounded remediation, then resumes the originating phase. Persist
40
- `Next step` for crash recovery, but do not surface it as a command the human must
41
- submit. Use the repaired finding's narrow Vet recheck to distinguish resolution,
42
- the same decisive failure, and a genuinely new Critical/Important invariant.
43
- Stop only after three no-progress attempts on the exact same fingerprint or when
44
- the remaining choice is a real human/safety/access gate.
45
-
46
- On technical exhaustion, preserve the fingerprint, reproduction, attempts, and
47
- dead ends, then stop without `$rite-plan unblock` or another phase command.
48
- Reinvocation with unchanged evidence remains blocked and does not reset the cap.
49
- Here `unchanged` means the same fingerprint already has three recorded
50
- no-progress corrections. A retained fingerprint with remaining offline budget is
51
- not terminal merely because `state.md` was written by the failed action or a prior
52
- session ended.
53
-
54
- A pre-ownership workflow-artifact writer stop is not unchanged evidence when the
55
- current contract supplies controlling-root materialization. Prior drafter/wright refusals do not count
56
- as root materialization attempts. Reopen only when exact paths and executable
57
- behavior passed Vet and there is **no controlling-root materialization attempt**;
58
- record the routing migration so it cannot reset again. Missing product slices,
59
- unresolved protocol choices, or a recorded root attempt remain under their normal
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.
66
-
67
- Past evidence being irretrievable is not by itself terminal. When an in-scope
68
- trusted diagnostic seam can make the next retained fingerprint uniquely
69
- actionable, Autocomplete must run diagnostic-amplification Plan repair and narrow
70
- Vet inline, then pause for a fresh GO before the single evidence-acquisition
71
- attempt. Use `Next: none` only after proving no safe in-scope amplification seam
72
- exists, a real human/risk/scope gate owns it, or bounded recovery is exhausted.
73
-
74
- ## Stop on gate severity
75
-
76
- - `blocking` gate fires synchronous pause.
77
- - `escalating` gate fires pause, route to the specialist tag.
78
- - Any `questions.md` entry with `gate: validating` and `status: open` → pause (it is a
79
- seal NO-GO by definition; stop before reaching seal).
80
-
81
- ## Stop on strategic-review scope expansion (`$rite-temper`)
82
-
83
- - Any `expand` or added acceptance criterion pauses regardless of
84
- `allow_gates`/`--ship`. Only `hold-rigor` and `reduce-to-MVP` auto-apply;
85
- skipped low-stakes specs and those two modes do not pause.
86
-
87
- ## Stop on incomplete decision coverage (`$rite-clarify`)
88
-
89
- - Stop on any material Partial/Missing/unowned row or low-confidence, high-consequence
90
- assumption. Continue the up-front window with the next genuine decision packet; never arm
91
- AFK or carry it into build. Resolve facts and reversible choices automatically.
92
-
93
- ## Stop on workflow state
94
-
95
- - **NO-GO at seal** → stop; surface every blocker with `file:line` and the fix
96
- direction. Do not round NO-GO up to GO.
97
- - **Spec Drift Guard fires** (`$rite-build` finds the plan is wrong and the change
98
- alters product behaviour) → stop; route through `$rite-plan repair`.
99
- - **Budget exhausted with slices still pending:** any validated root-owned remaining
100
- value of zero stops before the next dispatch. Report which bound won (pre-existing
101
- remaining value, explicit flag, sentinel cap, or post-vet pending count) and the
102
- unbuilt slices. A malformed value also fails closed. Zero with no pending slices is
103
- normal completion → continue to `$rite-prove` without pausing.
104
- - **Resource envelope unavailable or exhausted:** stop before more work when the AFK
105
- envelope is missing/malformed/expired; another run overlaps; native agent, token,
106
- cost, or wall-time headroom is exhausted/unobservable despite a declared cap; or
107
- unresolved review/gate backlog is above its cap. At the review cap, permit only
108
- reconciliation that reduces the queue. Record the exact winning limit and observed
109
- usage/count. A new activation gets fresh activation-local counters; it does not reset
110
- durable slice/recovery budgets, expiry, or the recomputed queue.
111
- - **Still low-confidence after the interview:** the idea can't be pinned to testable
112
- acceptance criteria → stop and ask, rather than guessing the product.
113
- - **Repeated failure:** bounded recovery exhausts → stop with reproduction.
114
-
115
- ## The final type-GO
116
-
117
- - `--ship` / `--yolo` never authorizes Git. Continue through ship preflight,
118
- disclose the exact plan, then stop for literal `GO` and native approval.
119
- - Without either flag, stop at seal GO with `$rite-ship` as the resume command.
120
- Seal GO, AFK, prior approval, and flags never satisfy ship approval.
121
-
122
- ## How to stop well
123
-
124
- State must be enough for a fresh agent to resume cold:
125
- - `state.md`: `Status`, the blocking reason, and either a single actionable
126
- `Next step` command or the terminal `none — technical recovery exhausted`
127
- marker.
128
- - The relevant `questions.md` / `drift.md` / `seal.md` entry that explains the pause.
129
- - A one-line user-facing message: *what* stopped it and, only when one exists,
130
- *what human-owned action* resumes. A terminal technical blocker names no
131
- routine Plan/Vet/retry command.
1
+ # Stop conditions: when autocomplete pauses
2
+
3
+ On a real stop, write `state.md` as `awaiting_human` or `blocked`, persist the
4
+ reason, and include one resume command only when an actual human/safety/access
5
+ action can change it. Exhausted agent-owned recovery records terminal
6
+ `Next step: none` and no runnable recovery command. `--ship` never bypasses a
7
+ stop.
8
+
9
+ Authority: `.agents/skills/devrites-lib/reference/standards/acceptance-preserving-reslice.md`.
10
+
11
+ <!-- BEGIN RESLICE ROUTE-TO-ACTION -->
12
+ - `FOLD` keep Plan repair/affected Vet internal; no stop solely for topology/count.
13
+ - `GUARD_AND_REPAIR` enter Spec Drift Guard/Clarify; pause only at an existing human-owned gate; resume Plan/Vet internally.
14
+ - `BLOCKED_INPUT` no planning writes; stop internal branch; exact diagnostic; recover authority; reclassify.
15
+ <!-- END RESLICE ROUTE-TO-ACTION -->
16
+
17
+ ## Always stop
18
+
19
+ Regardless of flags or AFK ceiling:
20
+
21
+ - destructive data migration;
22
+ - auth/authz boundary change;
23
+ - public API break;
24
+ - external-service contract change; or
25
+ - filesystem destruction outside the workspace.
26
+
27
+ Red proof cannot advance. Run bounded Debug Recovery; stop after proven
28
+ exhaustion unless the remaining owner is human.
29
+
30
+ ## Not stops: internal technical routing
31
+
32
+ `NEEDS_REPLAN` is not a stop condition under active Autocomplete. It blocks
33
+ forward work, persists the return cursor, and invokes Plan repair plus Recovery
34
+ Vet inline. The same applies to nested `STOP`/`Next step` when its decision is
35
+ agent-owned.
36
+
37
+ Agent-owned backtracking is not a stop condition while the exact causal
38
+ fingerprint has budget. Invoke the earlier phase, affected Vet, remediation, and
39
+ proof; then resume the origin. Stop only after three no-progress corrections of
40
+ that exact fingerprint or a real human/safety/access gate. Preserve reproduction,
41
+ attempts, and dead ends; never offer `$rite-plan unblock` or another routine
42
+ phase command. Reinvocation with unchanged evidence does not reset the cap.
43
+ `unchanged` means the same fingerprint already has three recorded no-progress
44
+ corrections. Closure is progress; a separately evidenced Critical/Important
45
+ invariant starts its own cap and cannot extend the closed one.
46
+
47
+ Spent consumptive-action authorization is not technical-recovery exhaustion.
48
+ It blocks another execution; retained new Critical/Important evidence still
49
+ enters offline recovery. After affected Vet is READY, pause for fresh action
50
+ authorization and never reuse old GO.
51
+
52
+ Past evidence being irretrievable is not by itself terminal. If an in-scope
53
+ trusted seam can uniquely discriminate the next failure, run diagnostic-
54
+ amplification Plan repair and narrow Vet inline, then pause for fresh GO before
55
+ one evidence-acquisition attempt. Use terminal none only when no safe in-scope
56
+ seam exists, a real human/risk/scope gate owns it, or bounded recovery is
57
+ exhausted.
58
+
59
+ <!-- workflow-artifact-adapter: {"module":"devrites-lib/reference/standards/workflow-artifacts.md","entry":"classifier returns owner-busy, exhausted, or existing hard gate","action":"stop on exact WAIT_ACTIVE_OWNER, BLOCKED_EXHAUSTED, or BLOCKED_GATE result","return":"unchanged cursor plus fixed route-owned output"} -->
60
+ ## Other stop classes
61
+
62
+ - **Gate severity:** blocking or escalating gate; any open validating question.
63
+ - **Temper:** any `expand` or added acceptance criterion. `hold-rigor`,
64
+ `reduce-to-MVP`, and a justified skip do not pause.
65
+ - **Clarify:** material Partial/Missing/unowned decision coverage or a
66
+ low-confidence high-consequence assumption. Continue the initial interview;
67
+ never arm AFK early.
68
+ - **Seal:** NO-GO, with every blocker and fix direction. Never round up to GO.
69
+ - **Reslice:** execute its marked action before deciding continue/stop.
70
+ - **Slice budget:** any validated root-owned remaining value of zero stops before the next dispatch
71
+ when slices remain; malformed state also stops. Report whether the winning
72
+ bound was the pre-existing remaining value, explicit flag, sentinel cap, or post-vet pending count.
73
+ Zero with no pending slices is normal completion and proceeds to Prove.
74
+ - **Resource envelope:** missing/malformed/expired AFK, overlapping run,
75
+ exhausted/unobservable declared agent/token/cost/time headroom, or review queue
76
+ above cap. At cap, only queue-reducing reconciliation may run. Persist winning
77
+ bound and observed usage; a new activation does not reset durable budgets or
78
+ expiry.
79
+ - **Confidence:** intent still cannot become testable acceptance after interview.
80
+ - **Repeated failure:** the exact fingerprint's bounded recovery is exhausted.
81
+
82
+ ## Final GO and durable stop
83
+
84
+ `--ship`/`--yolo` never authorizes Git. With a flag, complete Ship preflight,
85
+ disclose the exact plan, and stop for literal `GO` plus native approval. Without
86
+ one, stop at Seal GO with `$rite-ship`. Seal GO, AFK, prior approval, and flags
87
+ never satisfy Ship approval.
88
+
89
+ A cold-resumable stop records `state.md` status, exact reason, and either one
90
+ human-owned resume action or `none technical recovery exhausted`; the owning
91
+ question/drift/seal entry explains it. The user-facing line says what stopped
92
+ and, only when applicable, what human action resumes it.
@@ -8,92 +8,64 @@ user-invocable: true
8
8
  # $rite-build: one verified slice
9
9
 
10
10
  Build and prove one slice. HITL stops; a later user invocation starts the next.
11
- Explicit `.devrites/AFK` alone lets the controlling root chain pending slices,
12
- only under existing green-proof, cap, and pause rules. **Read the active workspace
13
- first**; if none, tell the user to run `$rite-spec <feature>`.
11
+ Explicit `.devrites/AFK` alone lets the controlling root chain pending slices
12
+ under green proof, caps, and pause rules. Every wright returns after it. Read the
13
+ active workspace first; without one, route `$rite-spec <feature>`.
14
14
 
15
- The root owns gates/workspace; a
16
- fresh-context [`devrites-slice-wright`](.codex/agents/devrites-slice-wright.toml)
17
- writes product source and tests. Exact Vet-ready executable workflow artifacts use
15
+ Root owns gates/bookkeeping. Fresh
16
+ [`devrites-slice-wright`](.codex/agents/devrites-slice-wright.toml) writes product
17
+ source/tests. Workflow Artifact paths use
18
18
  [`workflow-artifacts.md`](../devrites-lib/reference/standards/workflow-artifacts.md).
19
- Apply the readiness, selection, host, HITL/AFK,
20
- dispatch, doubt, fail-on-red, record, and stop checks. See
19
+ Execute [`reference/phase-contract.md`](reference/phase-contract.md); dispatch uses
21
20
  [`reference/wright-dispatch.md`](reference/wright-dispatch.md).
22
21
 
23
- ## Rules consulted (read on demand from `.agents/skills/devrites-lib/reference/standards/`)
24
- Read `.agents/skills/devrites-lib/reference/standards/core.md` first. The wright
25
- reads named on-demand rules while writing; root reads them for doubt/record gates:
26
- - `coding-style.md`: naming, function shape, guard clauses, comments, reuse-first.
27
- - `error-handling.md`: fail fast, no silent catches, fail closed.
28
- - `testing.md`: pyramid, behaviour over implementation, see-it-fail-first.
29
- - [`reference/tdd.md`](reference/tdd.md): the slice-level Red → Green → Refactor
30
- and Prove-It contract.
31
- - `patterns.md`: composition over inheritance, avoid premature abstraction.
32
- - `principles.md`: the project invariants (`.devrites/principles.md`) the slice must honor; the wright reads them as **binding**, not priors.
33
- - `security.md`: when the slice touches user input, auth, data, or external integrations.
34
- - `repository-topology.md`: when targets span roots/languages/services or touch generated/vendor surfaces.
35
- - `data-integrity.md`: when the slice writes durable state or changes migration/concurrency/tenant/retention behavior.
36
- - `integration-reliability.md`: when the slice changes an API/webhook/queue/job/cache/cross-service boundary.
37
- - `definition-of-done.md`: standing Done bar: acceptance mapped, fresh proof, no open hard gates, scoped edits, rollback/docs where needed.
22
+ ## Required rules
38
23
 
24
+ Read `.agents/skills/devrites-lib/reference/standards/core.md` first. Load only
25
+ rules triggered by the slice:
39
26
 
40
- ## Operating rules
41
- - **One slice per wright dispatch.** Every wright returns after it. The controlling
42
- root applies the mode rule above before another dispatch. Prefer the guarded serial
43
- native-worktree pilot in `wright-dispatch.md` only when its committed-clean
44
- preflight and explicit reconciliation path both hold; otherwise use the existing
45
- serial same-worktree writer. Never run writers in parallel.
46
- - Evidence over confidence. Prefer existing conventions. Feature scope only: no
47
- drive-by refactors.
48
- - **Record adjacent issues; do not edit them.** An issue outside the exact paths
49
- stated in the dispatch task becomes an FYI follow-up in `decisions.md`. The slice summary states
50
- what it deliberately left alone ([`git-workflow.md`](../devrites-lib/reference/standards/git-workflow.md)
51
- "Things I didn't touch"). The root rejects a returned diff outside this boundary.
52
- - **Don't re-run an unchanged check.** The same build or test on unchanged code provides
53
- no new evidence. Re-verify after an edit.
54
- - Surface material assumptions. Do not introduce an unplanned dependency or second design
55
- system: route the objective plan gap to `$rite-vet` (or bounded recovery), not to a human.
56
- Ask only if the newly exposed choice changes licensing/cost/security, product behavior,
57
- or an explicit architecture policy. The
58
- [Spec Drift Guard](reference/spec-drift-guard.md) is active throughout.
59
- - **Avoid AI slop while writing.** `devrites-slice-wright` applies the anti-slop charter
60
- while writing. The canonical list is `rite-polish/reference/anti-ai-slop.md`; do not
61
- duplicate it here. The wright follows project idioms and reuses existing code first.
62
- **Verify the charter on return.** Do not correct source from the orchestrator.
63
- The **prose you write yourself** (`evidence.md`, `decisions.md`, the slice report) follows
64
- the human-voice charter (`.agents/skills/devrites-lib/reference/standards/prose-style.md`; depth in `devrites-prose-craft`): no
65
- filler openers or marketing adjectives; preserve exact commands and identifiers.
66
- - **Honor declared project principles.** The wright reads `.devrites/principles.md` and treats
67
- each invariant as **binding** (not a prior to weigh like a convention): a slice it cannot build
68
- without breaking one is an **Escalation**, not a silent violation. On return **you verify no
69
- principle was broken**; a fresh violation is handled like any irreversible-risk item: a
70
- human-approved, scoped exception in the register or a stop, never folded into the slice. No
71
- `.devrites/principles.md` → none declared → nothing to honor.
72
- - **You never edit product source/tests.** You write `.devrites/` bookkeeping and,
73
- only through `workflow-artifacts.md`, an exact Vet-ready executable workflow-artifact set.
74
- Follow the
75
- host gate in `wright-dispatch.md` before every build or recovery dispatch. On a
76
- supported host, the wright is the only writer of code and tests. Codex gives
77
- the root workspace permission only so that native writer dispatch can execute;
78
- never patch code from the root. Put the exact project-relative source/test path
79
- list directly in the task, dispatch the exact `devrites-slice-wright`, then
80
- compare `git diff --name-only` with those task paths. Any extra source file is
81
- a hard STOP.
82
- - **Executable workflow-artifact branch.** If every implementation target is an
83
- exact admitted path under the active `.devrites/work/<slug>/`, the controlling
84
- root materializes and proves that atomic set itself. It does not dispatch the wright,
85
- decrement/count a product slice, update the candidate manifest, or execute the
86
- consumptive action. After narrow Vet, restore the caller cursor.
27
+ - coding style, error handling, testing, [`reference/tdd.md`](reference/tdd.md),
28
+ patterns, and definition of done;
29
+ - binding `.devrites/principles.md` invariants when present;
30
+ - security for input/auth/data/integrations;
31
+ - repository topology for multiple roots/languages or generated/vendor surfaces;
32
+ - data integrity for durable state, migration, concurrency, tenancy, or retention;
33
+ - integration reliability for API/webhook/queue/job/cache/service boundaries.
87
34
 
88
- ## Workflow
35
+ The wright also applies the canonical anti-slop list. Root verifies its return;
36
+ it never patches source itself.
89
37
 
90
- Run the full execution contract in
91
- [`reference/phase-contract.md`](reference/phase-contract.md). It is not optional:
92
- it contains the gated one-slice workflow, including readiness, HITL/AFK handling,
93
- wright dispatch, doubt, fail-on-red, record gates, and stop behavior.
38
+ ## Invariants
94
39
 
95
- ## Output
40
+ - One slice per wright dispatch; writers are serial. Use the native-worktree pilot
41
+ only when `wright-dispatch.md`'s clean preflight and reconciliation both hold,
42
+ otherwise serial same-worktree writing.
43
+ - Exact feature scope only. Record adjacent issues and Things I didn't touch;
44
+ reject any returned diff outside the task's explicit source/test paths.
45
+ - Never rerun an unchanged check. Re-prove after edits.
46
+ - Unplanned dependency, design system, objective technical gap, or repair stays
47
+ inside Vet/Spec Drift Guard. Ask only for licensing/cost/security/product or
48
+ explicit architecture-policy decisions.
49
+ - Root never edits product source/tests. It writes canonical `.devrites/`
50
+ bookkeeping and applies the Workflow Artifact route only. The supported host's
51
+ wright is sole product writer. Put exact project-relative paths directly in the
52
+ task; compare returned file list and `git diff --name-only`; extras hard-stop.
53
+ - Project principles are binding. An unavoidable conflict or irreversible risk
54
+ needs a human-approved scoped exception or stop, never silent balancing.
55
+ - Evidence beats confidence. Never weaken a failing test, skip TDD, widen a
56
+ writer, or self-approve a wright return. Route drift through
57
+ [`reference/spec-drift-guard.md`](reference/spec-drift-guard.md); checkpoint
58
+ mode follows [`reference/checkpoint.md`](reference/checkpoint.md).
96
59
 
97
- Use [`reference/output.md`](reference/output.md) and the shared
98
- [`reply contract`](../devrites-lib/reference/reply-contract.md). They keep the
99
- HITL stop, bounded AFK chaining, and no-automatic-`$rite-prove` boundary explicit.
60
+ ## Workflow Artifact branch
61
+
62
+ <!-- workflow-artifact-adapter: {"module":"devrites-lib/reference/standards/workflow-artifacts.md","entry":"Vet-ready admitted bytes require root authorship outside product wright","action":"ROOT_TRANSACTION; root writes only admitted .devrites/** targets","return":"saved Build slice cursor; wright product allowlist unchanged"} -->
63
+ ## Execute and reply
64
+
65
+ Run every step in `reference/phase-contract.md`: readiness, one target, dispatch
66
+ or canonical transaction, return inspection, independent doubt/test analysis,
67
+ approved fail-on-red proof, record, AFK accounting, and stop. Use
68
+ [`reference/output.md`](reference/output.md) plus the shared
69
+ [`reply contract`](../devrites-lib/reference/reply-contract.md). HITL never starts
70
+ the next slice automatically; AFK chains only within its durable remaining
71
+ budget; Prove starts only after all slices are built.
@@ -16,28 +16,14 @@ See [`one-slice-cycle.md`](one-slice-cycle.md); candidate lifecycle is
16
16
  scope, or proof, use the Spec Drift Guard/plan recovery; a human-owned unknown
17
17
  stops. Resolve HITL before source work. AFK answers only permitted gates;
18
18
  human-owned or irreversible risk persists a question and stops for `$rite-resolve`.
19
- If the target is only an exact Vet-ready executable workflow-artifact set under
20
- the active feature workspace, apply
19
+ If the target is an exact Vet-ready Workflow Artifact set, apply
21
20
  [`workflow-artifacts.md`](../../devrites-lib/reference/standards/workflow-artifacts.md)
22
21
  instead of treating it as a product slice.
23
- 3. **Dispatch or materialize.** Product source/tests apply [`wright-dispatch.md`](wright-dispatch.md).
22
+ 3. **Dispatch or transact.** Product source/tests apply [`wright-dispatch.md`](wright-dispatch.md).
24
23
  Put the smallest exact project-relative source/test path list directly in the task;
25
24
  dispatch the exact `devrites-slice-wright` fresh. Root never writes those product
26
25
  paths, wright never widens, and a missing profile stops.
27
- For the workflow-artifact branch, the controlling root writes only the admitted
28
- `.devrites/work/<slug>/` paths. Before an active journal or target write, it
29
- compiles the materializer and runs the exact transaction implementation in a
30
- disposable same-layout fixture covering success, replacement failure, rollback,
31
- retained-temporary cleanup, and rerun. It then proves the complete atomic set,
32
- rechecks an
33
- identical product candidate, records hashes/evidence, and runs narrow Vet. Do not
34
- dispatch any agent as a substitute writer and do not charge a product slice.
35
-
36
- ### Executable workflow-artifact branch
37
-
38
- The controlling root materializes the exact admitted workflow-artifact set and
39
- **does not dispatch the wright**. This branch never changes product slice state or
40
- the candidate manifest; it returns through narrow Vet before any consumptive action.
26
+ <!-- workflow-artifact-adapter: {"module":"devrites-lib/reference/standards/workflow-artifacts.md","entry":"Build gate enters or resumes transaction","action":"invoke canonical operation table; reconcile exact result","return":"same slice/checkpoint cursor or Plan/Vet route"} -->
41
27
  4. **Inspect the return.** Wait; compare its file list and `git diff --name-only`
42
28
  with the contract. Reject stale, partial, malformed, or out-of-scope work.
43
29
  Preserve user work; source restoration uses the same bounded wright.
@@ -14,15 +14,20 @@ artifact-only**: reconcile
14
14
  editing source code.
15
15
 
16
16
  ## Rules consulted (read on demand from `.agents/skills/devrites-lib/reference/standards/`)
17
- Pull `development-workflow.md` via `Read` when reshaping slice cadence or DoD criteria.
17
+ Pull `development-workflow.md` via `Read` when reshaping slice cadence or DoD
18
+ criteria.
18
19
  Load `repository-topology.md`, `data-integrity.md`, or `integration-reliability.md`
19
20
  when the spec applicability map or observed drift triggers them.
21
+ Before classifying any Reslice, read `.agents/skills/devrites-lib/reference/standards/acceptance-preserving-reslice.md`.
22
+
23
+ <!-- BEGIN RESLICE ROUTE-TO-ACTION -->
24
+ - `FOLD` → reconcile `architecture.md`, `plan.md`, `tasks.md`, and `traceability.md` atomically; invalidate Vet/readiness; Vet.
25
+ - `GUARD_AND_REPAIR` → no planning writes; Spec Drift Guard → Clarify → Plan repair → Vet.
26
+ - `BLOCKED_INPUT` → no planning writes; exact diagnostic; recover input; reclassify.
27
+ <!-- END RESLICE ROUTE-TO-ACTION -->
20
28
 
21
29
  ## Operating rules
22
30
  - Update the spec when needed, but never plan around a known-wrong assumption.
23
- - For product behavior, scope, architecture, data, UX, security, or migration changes,
24
- search facts then route human-owned contract decisions through `$rite-clarify`/Drift
25
- Guard. Reversible technical repair is agent-owned, not a question.
26
31
  - Keep each slice small enough for one focused build → prove cycle.
27
32
  - **Derive slice count:** reslice when work cannot build+prove in one cycle, not to hit a
28
33
  requested tally. Treat counts as hints and explain honest differences; see
@@ -57,9 +62,8 @@ when the spec applicability map or observed drift triggers them.
57
62
  - **reorder:** fix the dependency order.
58
63
  - **split:** separate backend/frontend contracts (see `devrites-api-interface`).
59
64
  - **unblock:** a verification failed; re-route around the blocker.
60
- - **course-correct:** deliberate mid-build user pivot. Classify impact on remaining slices,
61
- choose rollback/forward-fix, and update spec/plan/tasks/decisions atomically. Acceptance or
62
- behavior still needs the user first; an `MVP cut` is the pre-agreed retreat.
65
+ - **course-correct:** mid-build user pivot; apply the marked action, choose
66
+ rollback/forward-fix, and update permitted artifacts atomically (`MVP cut` is the named retreat).
63
67
  - **revise:** reconcile a requested artifact revision; propose/confirm its file set and
64
68
  **never edit source**. Only explicit `$rite-upgrade` with a `repairable` assessment naming
65
69
  rule, evidence, gate, paths, and delta can authorize its neutral workspace edit—not source/history.
@@ -105,19 +109,15 @@ when the spec applicability map or observed drift triggers them.
105
109
  reconfirm only after Clarify and Vet close it. If you stopped for drift,
106
110
  mark the `drift.md` entry resolved. Never remove or overwrite a valid caller
107
111
  return cursor while writing the Plan checkpoint.
108
- 6. If product behavior/acceptance criteria change, confirm through `$rite-clarify` before
109
- writing, re-close `decision-coverage.md`, then reconcile the plan. After any edit to
110
- `brief.md`, `spec.md`, `decisions.md`, `assumptions.md`, or `questions.md`, including a
111
- behavior-neutral technical rationale appended to `decisions.md`, re-scan the affected coverage
112
- rows, assumption audit, residual uncertainty, and closed gates. Partial/Missing, an unowned
113
- material assumption, or an open blocking/escalating question routes `$rite-clarify`/HITL.
114
- Re-read every affected row and require current evidence before restoring `CLEAR`.
115
- **Completion:** the change is classified, and every behavior/acceptance change has explicit
116
- confirmation recorded before the artifacts are updated.
112
+ 6. Apply the marked action before writes and retain its decision/coverage evidence.
113
+ After editing `brief.md`, `spec.md`, `decisions.md`, `assumptions.md`, or `questions.md`,
114
+ re-scan affected coverage, assumptions, uncertainty, and gates. Partial/Missing, unowned
115
+ material assumption, or open blocking/escalating question routes `$rite-clarify`/HITL.
116
+ Restore `CLEAR` only from current evidence.
117
117
  7. **Done when:** every slice is sized (builds + proves in one cycle; no slice scoring >3
118
118
  left unjustified), the dependency order is acyclic, every `drift.md` entry you stopped for
119
119
  is marked resolved, revised artifacts agree with each other, no source files changed in
120
- `revise` mode, behavior-change-vs-not is confirmed (`no`, or clarified), and every changed
120
+ `revise` mode, the marked action is complete, and every changed
121
121
  plan ends at `$rite-vet` rather than returning directly to build; horizon IDs stay stable,
122
122
  reclassifications cite evidence, and no unresolved item vanished. The `Shared contract proof`
123
123
  table or justified no-impact statement must still match the revised boundary set.
@@ -5,6 +5,14 @@ feels reluctance toward asking the user before a behavior change.
5
5
 
6
6
  Pack-wide rationalizations + red flags: see [standards/anti-patterns.md](../../devrites-lib/reference/standards/anti-patterns.md).
7
7
 
8
+ Authority: `.agents/skills/devrites-lib/reference/standards/acceptance-preserving-reslice.md`.
9
+
10
+ <!-- BEGIN RESLICE ROUTE-TO-ACTION -->
11
+ - `FOLD` → reconcile `architecture.md`, `plan.md`, `tasks.md`, and `traceability.md` atomically; invalidate Vet/readiness; Vet.
12
+ - `GUARD_AND_REPAIR` → no planning writes; Spec Drift Guard → Clarify → Plan repair → Vet.
13
+ - `BLOCKED_INPUT` → no planning writes; exact diagnostic; recover input; reclassify.
14
+ <!-- END RESLICE ROUTE-TO-ACTION -->
15
+
8
16
  ## Phase-specific rationalizations
9
17
 
10
18
  | Excuse | Rebuttal |
@@ -13,7 +21,9 @@ Pack-wide rationalizations + red flags: see [standards/anti-patterns.md](../../d
13
21
  | "I can fix the slice mid-build, no need to update tasks." | `tasks.md` is the contract `$rite-build` reads. A fix that isn't there isn't visible to the next phase. |
14
22
  | "Reordering slices is cosmetic." | Dependency order controls risk discovery; risk-first wins because it surfaces blockers early. |
15
23
  | "This drift is small enough to absorb silently." | Silent drift = unrecorded decision = future "why does this work?" debugging session. |
16
- | "I can change product behavior to make the plan fit." | Behavior change always asks the user first, no exceptions. |
24
+ | "I can change product behavior to make the plan fit." | **RSLICE-PLAN-001** Implementation convenience cannot rewrite product behavior. |
25
+ | "Topology or a small criterion delta decides the route." | **RSLICE-PLAN-002** — Topology/count and “small” never override the canonical classifier; sufficient authoritative contract delta follows its mapped action. |
26
+ | "Chat, stale material, or the convenient map is enough." | **RSLICE-PLAN-003** — Exact current byte-bound directives are authority; cached, remembered, summarized, paraphrased, or inferred chat and stale material are not. |
17
27
 
18
28
  ## Red Flags
19
29
 
@@ -2,6 +2,14 @@
2
2
 
3
3
  `$rite-plan` runs in one of these modes. Pick from `$ARGUMENTS` or infer from state.
4
4
 
5
+ Authority: `.agents/skills/devrites-lib/reference/standards/acceptance-preserving-reslice.md`.
6
+
7
+ <!-- BEGIN RESLICE ROUTE-TO-ACTION -->
8
+ - `FOLD` → reconcile `architecture.md`, `plan.md`, `tasks.md`, and `traceability.md` atomically; invalidate Vet/readiness; Vet.
9
+ - `GUARD_AND_REPAIR` → no planning writes; Spec Drift Guard → Clarify → Plan repair → Vet.
10
+ - `BLOCKED_INPUT` → no planning writes; exact diagnostic; recover input; reclassify.
11
+ <!-- END RESLICE ROUTE-TO-ACTION -->
12
+
5
13
  ## decompose
6
14
  First (or fresh) breakdown into vertical slices. Use `task-breakdown.md` +
7
15
  `slicing.md`. Output: a populated `tasks.md` and an ordered `plan.md` graph.
@@ -20,8 +28,7 @@ A drift event stopped the build. Steps:
20
28
  reality. Adjust acceptance criteria if they were wrong.
21
29
  4. Mark the `drift.md` entry **resolved** with the resolution + date.
22
30
  5. Resume at the corrected slice.
23
- Never repair by quietly deleting the inconvenient requirement, if behavior changes,
24
- that was a user question.
31
+ Never quietly delete a requirement; use the marked action before contract edits.
25
32
 
26
33
  ## reorder
27
34
  Dependency order is wrong or suboptimal. Recompute the graph (`dependency-graph.md`),
@@ -39,4 +46,4 @@ end and plan a new diagnosis/proof fingerprint. Never clear/reuse old one.
39
46
 
40
47
  ## Always
41
48
  Update `state.md` (phase, next step) and append a dated line to `decisions.md`
42
- explaining *why* the plan changed. Ask the user before any product-behavior change.
49
+ explaining *why* the plan changed. Preserve mapped-action decisions.