devrites 3.2.16 → 3.2.18

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 (122) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +1 -1
  3. package/engine/Makefile +3 -3
  4. package/engine/hooks.go +20 -4
  5. package/engine/hooks_agent_dispatch.go +297 -48
  6. package/engine/hooks_events_test.go +40 -0
  7. package/engine/hooks_workspace.go +26 -6
  8. package/engine/internal/devritespaths/paths.go +80 -0
  9. package/engine/internal/install/install.go +36 -16
  10. package/engine/internal/install/install_test.go +50 -1
  11. package/engine/internal/iohooks/iohooks.go +5 -3
  12. package/engine/internal/iohooks/iohooks_test.go +11 -0
  13. package/engine/internal/lib/adoption.go +36 -11
  14. package/engine/internal/lib/adoption_test.go +30 -0
  15. package/engine/internal/lib/analyze.go +10 -2
  16. package/engine/internal/lib/archivesearch.go +41 -9
  17. package/engine/internal/lib/archivesearch_test.go +28 -0
  18. package/engine/internal/lib/buildreadiness.go +5 -1
  19. package/engine/internal/lib/closeout.go +34 -11
  20. package/engine/internal/lib/closeout_test.go +99 -0
  21. package/engine/internal/lib/context.go +6 -1
  22. package/engine/internal/lib/dispatchwaive.go +31 -0
  23. package/engine/internal/lib/dispatchwaive_test.go +23 -0
  24. package/engine/internal/lib/extensions.go +5 -1
  25. package/engine/internal/lib/learnings.go +8 -2
  26. package/engine/internal/lib/ledger.go +17 -4
  27. package/engine/internal/lib/ledger_test.go +24 -0
  28. package/engine/internal/lib/mutationgate.go +6 -2
  29. package/engine/internal/lib/reconcile.go +201 -64
  30. package/engine/internal/lib/reconcile_test.go +159 -12
  31. package/engine/internal/lib/resolve.go +8 -3
  32. package/engine/internal/lib/resolve_remediation_test.go +14 -0
  33. package/engine/internal/lib/runbook.go +4 -1
  34. package/engine/internal/lib/runbook_context_test.go +43 -0
  35. package/engine/internal/lib/testintegrity.go +4 -4
  36. package/engine/internal/lib/testintegrity_test.go +15 -0
  37. package/engine/internal/lib/tickafk.go +6 -2
  38. package/engine/internal/lib/util.go +128 -23
  39. package/engine/internal/profile/profile.go +27 -13
  40. package/engine/internal/profile/profile_test.go +13 -0
  41. package/engine/main.go +4 -1
  42. package/engine/testdata/golden/TestParityReconcile/close-window.golden +1 -0
  43. package/engine/testdata/golden/TestParityReconcile/not-git.golden +1 -1
  44. package/engine/testdata/golden/TestParityTestIntegrity/not-git.golden +1 -1
  45. package/engine/tests/hook_test.go +353 -17
  46. package/engine/tests/parity_reconcile_test.go +4 -1
  47. package/engine/tests/parity_testintegrity_test.go +1 -1
  48. package/pack/.claude/agents/devrites-code-reviewer.md +3 -0
  49. package/pack/.claude/agents/devrites-devex-reviewer.md +12 -8
  50. package/pack/.claude/agents/devrites-doubt-reviewer.md +3 -0
  51. package/pack/.claude/agents/devrites-forge-judge.md +4 -1
  52. package/pack/.claude/agents/devrites-frontend-reviewer.md +3 -0
  53. package/pack/.claude/agents/devrites-performance-reviewer.md +10 -9
  54. package/pack/.claude/agents/devrites-plan-reviewer.md +3 -0
  55. package/pack/.claude/agents/devrites-proof-runner.md +14 -14
  56. package/pack/.claude/agents/devrites-retrospector.md +3 -0
  57. package/pack/.claude/agents/devrites-security-auditor.md +3 -0
  58. package/pack/.claude/agents/devrites-simplifier-reviewer.md +3 -0
  59. package/pack/.claude/agents/devrites-slice-wright.md +4 -2
  60. package/pack/.claude/agents/devrites-spec-reviewer.md +3 -0
  61. package/pack/.claude/agents/devrites-strategy-reviewer.md +3 -0
  62. package/pack/.claude/agents/devrites-test-analyst.md +3 -0
  63. package/pack/.claude/skills/devrites-lib/reference/parallel-dispatch.md +8 -0
  64. package/pack/.claude/skills/devrites-lib/reference/standards/agents.md +10 -0
  65. package/pack/.claude/skills/devrites-source-driven/SKILL.md +1 -1
  66. package/pack/.claude/skills/rite-build/reference/phase-contract.md +17 -3
  67. package/pack/.claude/skills/rite-build/reference/wright-dispatch.md +3 -1
  68. package/pack/.claude/skills/rite-prove/SKILL.md +25 -14
  69. package/pack/.claude/skills/rite-temper/SKILL.md +1 -1
  70. package/pack/.claude/skills/rite-upgrade/SKILL.md +1 -1
  71. package/pack/.claude/skills/rite-vet/SKILL.md +18 -15
  72. package/pack/generated/claude/agents/devrites-code-reviewer.md +3 -0
  73. package/pack/generated/claude/agents/devrites-devex-reviewer.md +12 -8
  74. package/pack/generated/claude/agents/devrites-doubt-reviewer.md +3 -0
  75. package/pack/generated/claude/agents/devrites-forge-judge.md +4 -1
  76. package/pack/generated/claude/agents/devrites-frontend-reviewer.md +3 -0
  77. package/pack/generated/claude/agents/devrites-performance-reviewer.md +10 -9
  78. package/pack/generated/claude/agents/devrites-plan-reviewer.md +3 -0
  79. package/pack/generated/claude/agents/devrites-proof-runner.md +14 -14
  80. package/pack/generated/claude/agents/devrites-retrospector.md +3 -0
  81. package/pack/generated/claude/agents/devrites-security-auditor.md +3 -0
  82. package/pack/generated/claude/agents/devrites-simplifier-reviewer.md +3 -0
  83. package/pack/generated/claude/agents/devrites-slice-wright.md +4 -2
  84. package/pack/generated/claude/agents/devrites-spec-reviewer.md +3 -0
  85. package/pack/generated/claude/agents/devrites-strategy-reviewer.md +3 -0
  86. package/pack/generated/claude/agents/devrites-test-analyst.md +3 -0
  87. package/pack/generated/claude/skills/devrites-lib/reference/parallel-dispatch.md +8 -0
  88. package/pack/generated/claude/skills/devrites-lib/reference/standards/agents.md +10 -0
  89. package/pack/generated/claude/skills/devrites-source-driven/SKILL.md +1 -1
  90. package/pack/generated/claude/skills/rite-build/reference/phase-contract.md +17 -3
  91. package/pack/generated/claude/skills/rite-build/reference/wright-dispatch.md +3 -1
  92. package/pack/generated/claude/skills/rite-prove/SKILL.md +25 -14
  93. package/pack/generated/claude/skills/rite-temper/SKILL.md +1 -1
  94. package/pack/generated/claude/skills/rite-upgrade/SKILL.md +1 -1
  95. package/pack/generated/claude/skills/rite-vet/SKILL.md +18 -15
  96. package/pack/generated/codex/agents/devrites-code-reviewer.toml +3 -0
  97. package/pack/generated/codex/agents/devrites-devex-reviewer.toml +11 -7
  98. package/pack/generated/codex/agents/devrites-doubt-reviewer.toml +3 -0
  99. package/pack/generated/codex/agents/devrites-forge-judge.toml +4 -1
  100. package/pack/generated/codex/agents/devrites-frontend-reviewer.toml +3 -0
  101. package/pack/generated/codex/agents/devrites-performance-reviewer.toml +9 -8
  102. package/pack/generated/codex/agents/devrites-plan-reviewer.toml +3 -0
  103. package/pack/generated/codex/agents/devrites-proof-runner.toml +13 -13
  104. package/pack/generated/codex/agents/devrites-retrospector.toml +3 -0
  105. package/pack/generated/codex/agents/devrites-security-auditor.toml +3 -0
  106. package/pack/generated/codex/agents/devrites-simplifier-reviewer.toml +3 -0
  107. package/pack/generated/codex/agents/devrites-slice-wright.toml +4 -2
  108. package/pack/generated/codex/agents/devrites-spec-reviewer.toml +3 -0
  109. package/pack/generated/codex/agents/devrites-strategy-reviewer.toml +3 -0
  110. package/pack/generated/codex/agents/devrites-test-analyst.toml +3 -0
  111. package/pack/generated/codex/hooks.json +1 -1
  112. package/pack/generated/codex/skills/devrites-lib/reference/parallel-dispatch.md +8 -0
  113. package/pack/generated/codex/skills/devrites-lib/reference/standards/agents.md +10 -0
  114. package/pack/generated/codex/skills/devrites-source-driven/SKILL.md +1 -1
  115. package/pack/generated/codex/skills/rite-build/reference/phase-contract.md +17 -3
  116. package/pack/generated/codex/skills/rite-build/reference/wright-dispatch.md +3 -1
  117. package/pack/generated/codex/skills/rite-prove/SKILL.md +25 -14
  118. package/pack/generated/codex/skills/rite-temper/SKILL.md +1 -1
  119. package/pack/generated/codex/skills/rite-upgrade/SKILL.md +1 -1
  120. package/pack/generated/codex/skills/rite-vet/SKILL.md +18 -15
  121. package/package.json +1 -1
  122. package/scripts/codex-generate.sh +1 -1
@@ -78,14 +78,28 @@ See also [`one-slice-cycle.md`](one-slice-cycle.md).
78
78
  ```bash
79
79
  devrites-engine test-integrity; echo "test-integrity rc=$?"
80
80
  ```
81
- Run every exact command reported as `not-run`: `root-owned artifact-producing gate`
82
- in the wright result. These are root proof commands, not source-edit authority.
83
- Do not omit, rewrite, or substitute them; a missing command is unverifiable proof.
81
+ Run only root-owned gates already authorized byte-for-byte by the vetted
82
+ `test-plan.md` and unchanged `agent-packet/v1`, including exact command, cwd,
83
+ prerequisites, and expected artifact boundary. A wright result may report one
84
+ of those commands as `not-run`; it cannot invent, rewrite, widen, or authorize a
85
+ command. Reject any reported command that does not exactly match the frozen
86
+ plan/packet. Opaque wrapper, build, Playwright, and browser commands are root-owned
87
+ only when pre-authorized there; this transfers no source/test write authority.
88
+ A missing approved command is unverifiable proof.
84
89
  After they pass, run `devrites-engine reconcile check` again after the root-owned gates
85
90
  and before close, proving their child processes did not change tracked source:
86
91
  ```bash
87
92
  devrites-engine reconcile check; echo "reconcile rc=$?"
88
93
  ```
94
+ If a root-owned gate changes source after the clean pre-gate check, run the exact
95
+ engine-owned rollback and verify the retained tree before recovery:
96
+ ```bash
97
+ devrites-engine reconcile restore-check
98
+ devrites-engine reconcile check; echo "reconcile rc=$?"
99
+ ```
100
+ Never manually restore, truncate, resnapshot, or widen an allowlist to hide
101
+ post-check drift.
102
+
89
103
  If the wright's `Gates` were red (targeted tests / types / lint), `test-integrity`
90
104
  failed, a root-owned gate failed, the final reconcile failed, or proof could not be
91
105
  verified: do **not** mark the slice `built`, and **do not fix the code yourself**.
@@ -2,7 +2,9 @@
2
2
 
3
3
  `$rite-build` delegates one slice or correction to `devrites-slice-wright`.
4
4
  The root owns scope, questions, `.devrites/**`, reconciliation, and routing.
5
- Production builds and browser/E2E runs are root-owned gates.
5
+ Production builds and browser/E2E runs are root-owned gates only when their exact
6
+ command, cwd, prerequisites, and artifact boundary are already frozen in
7
+ `test-plan.md` and the unchanged packet.
6
8
  The wright only writes source/tests, runs writer-safe proof, and never invokes agents.
7
9
 
8
10
  The universal packet, result, budget, await, retry, and host fallback contract is
@@ -70,10 +70,13 @@ Pull these via `Read` when relevant:
70
70
  blocker; don't refactor unrelated code.
71
71
  - Spec Drift Guard applies: if tests/evidence reveal the spec is wrong, stop and handle
72
72
  drift (`rite-build/reference/spec-drift-guard.md`).
73
- - **Runner observes; root records; wright fixes.** Use the file-backed fresh-context
74
- contract in [`agents.md`](../devrites-lib/reference/standards/agents.md). The root owns
75
- the evidence verdict and canonical writes. Every accepted source/test correction is one
76
- bounded `devrites-slice-wright` packet, never an inline edit.
73
+ - **Root executes; runner validates; root records; wright fixes.** Use the file-backed
74
+ fresh-context contract in
75
+ [`agents.md`](../devrites-lib/reference/standards/agents.md). The root owns exact
76
+ vetted gate execution, browser capability, the evidence verdict, and canonical
77
+ writes. The proof runner is read-only and validates immutable logs/artifacts.
78
+ Every accepted source/test correction is one bounded `devrites-slice-wright`
79
+ packet, never an inline edit.
77
80
 
78
81
  ## Workflow
79
82
  0. Read `.agents/skills/devrites-lib/reference/standards/core.md` first (the always-on operating rules); pull the
@@ -86,28 +89,36 @@ Pull these via `Read` when relevant:
86
89
  [test-command-discovery](reference/test-command-discovery.md): README, package
87
90
  scripts, Makefile, CI configs, Gemfile/Rakefile, pyproject, go.mod, Cargo.toml.
88
91
  **Completion:** exact runnable test/build/typecheck/lint commands are recorded or explicitly unavailable.
89
- 3. **Run proof in fresh context.** Freeze the candidate and dispatch
90
- `devrites-proof-runner` with the exact commands, cwd, prerequisites, acceptance map,
91
- and scratch boundary. Await and validate its observed full relevant test suite plus
92
- **build / typecheck / lint** report. The runner writes no canonical evidence.
93
- 4. **UI feature?** Include `design-brief.md`, `references.md`, routes, browser harness, and
94
- allowed scratch path in the proof packet, then have the runner apply the browser proof ladder:
92
+ 3. **Execute proof against a frozen candidate.** Freeze and hash the candidate.
93
+ The root runs only commands authorized byte-for-byte by `test-plan.md` and the
94
+ immutable proof packet, with exact cwd and prerequisites, capturing exit code,
95
+ decisive output, artifact hashes, and before/after candidate identity in secure
96
+ external scratch. Run the full relevant test suite plus **build / typecheck /
97
+ lint**. Reject synthesized or substituted commands and any source drift.
98
+ 4. **UI feature?** The root applies the browser proof ladder with
99
+ `design-brief.md`, `references.md`, packet-listed routes, browser harness, and
100
+ allowed scratch path:
95
101
  [proof-ladder](reference/proof-ladder.md) + [browser-proof](reference/browser-proof.md)
96
102
  (`devrites-browser-proof`): routes, viewports, screenshots (opened + described),
97
103
  console, network, interaction paths, and the brief's proof targets. Compare screenshots
98
104
  with target references and record deltas. An unresolved material mismatch is a failed
99
- result; the root handles any accepted correction at step 6 before re-rendering.
100
- 5. **Map proof completely.** Follow
105
+ result; the root handles any accepted correction at step 7 before re-rendering.
106
+ 5. **Validate proof in fresh context.** Dispatch `devrites-proof-runner` with the
107
+ frozen candidate identity, exact approved command list, immutable root-produced
108
+ logs/screenshots/traces, acceptance map, and hashes. Await its non-empty
109
+ `agent-result/v1`; reject mismatched, missing, stale, or self-attested evidence.
110
+ The runner executes no command and writes no canonical evidence.
111
+ 6. **Map proof completely.** Follow
101
112
  [`reference/acceptance-proof.md`](reference/acceptance-proof.md) for acceptance/scenario
102
113
  coverage and the conditional critical-path, observability, developer-surface, and wiring
103
114
  branches. Completion: every criterion, planned interaction, and declared key link has a
104
115
  proof class plus passing evidence, or is recorded as a blocker.
105
- 6. **On failure** → [failure-triage](reference/failure-triage.md) +
116
+ 7. **On failure** → [failure-triage](reference/failure-triage.md) +
106
117
  `devrites-debug-recovery`. The root reconciles the reproduction. Send an accepted,
107
118
  in-scope correction to the sole writer, `devrites-slice-wright`; then freeze the new
108
119
  candidate and dispatch a fresh proof runner for affected checks. If a fix would exceed
109
120
  scope, record a blocker.
110
- 7. The root updates `evidence.md`, `browser-evidence.md` (if UI), `traceability.md`, and
121
+ 8. The root updates `evidence.md`, `browser-evidence.md` (if UI), `traceability.md`, and
111
122
  `state.md`. New proof goes to `evidence.md` (`proof.md` is a read-only alias:
112
123
  see `devrites-lib/reference/workspace-artifact-schema.md`).
113
124
 
@@ -3,7 +3,7 @@ name: rite-temper
3
3
  description: Temper a readied spec before planning. Use when the user says "temper this", "strategy review", "pre-mortem the spec", or asks if we are over/under-building. Not for code review or final seal.
4
4
  argument-hint: "[feature-slug] [--mode expand|selective|hold|reduce]"
5
5
  user-invocable: true
6
- required-agent-roles: devrites-strategy-reviewer
6
+ required-agent-roles: none
7
7
  ---
8
8
 
9
9
  ## Codex compatibility
@@ -4,7 +4,7 @@ description: User-invoked semantic upgrade for an active legacy DevRites workspa
4
4
  argument-hint: "[feature-slug]"
5
5
  user-invocable: true
6
6
  disable-model-invocation: true
7
- required-agent-roles: devrites-upgrade-planner
7
+ required-agent-roles: none
8
8
  ---
9
9
 
10
10
  ## Codex compatibility
@@ -144,29 +144,32 @@ Pull the standard named by the active axis: `principles.md`, `patterns.md`,
144
144
  `brief.md`, `spec.md`, `decisions.md`, `assumptions.md`, or `questions.md`, re-scan the
145
145
  affected coverage rows, assumption audit, residual uncertainty, and closed gates.
146
146
  Partial/Missing, an unowned material assumption, or an open blocking/escalating question is
147
- `NEEDS CLARIFICATION` → `$rite-clarify`/HITL; never refresh past it. Only after the matrix is
148
- re-closed, run `devrites-engine readiness-digest coverage <slug>` and replace the complete
149
- `Coverage inputs SHA-256` line in `decision-coverage.md`. This coverage refresh must precede
150
- `devrites-engine readiness-digest engineering <slug>`.
147
+ `NEEDS CLARIFICATION` → `$rite-clarify`/HITL; never refresh past it.
151
148
  Re-run the gate after every fold-back so a task edit cannot invalidate the earlier pass:
152
149
  ```bash
153
150
  devrites-engine analyze; echo "final analyze rc=$?"
154
151
  ```
155
- Any non-zero result blocks the handoff. Then update `state.md`:
156
- write exactly one `DevRites contract: devrites.readiness-artifacts.v2` field to both
157
- `test-plan.md` and `eng-review.md`, plus one typed field to `eng-review.md`:
158
- `Implementation readiness: READY`,
159
- `NEEDS CLARIFICATION`, or `NEEDS REPLAN`. Only READY sets `Phase: vet` and
160
- `Next step: $rite-build`, after a final sweep leaves no foreseeable human choice except a
161
- justified action-time checkpoint. Technical failure records its reproduction and
162
- `$rite-plan repair` without a qid; a human-owned contract gap routes `$rite-clarify` and
163
- uses the normal awaiting-human block.
152
+ Any non-zero result blocks the handoff. Keep `state.md` non-READY and do not
153
+ generate the engineering digest yet; this is the frozen candidate for step 6,
154
+ not the final handoff.
164
155
  6. **One narrow recheck after accepted edits.** If steps 2 through 5 changed the frozen candidate,
165
156
  dispatch `devrites-plan-reviewer` once more with only the accepted initial findings,
166
157
  changed planning paths, affected criteria, and the new immutable identity. Do not repeat
167
158
  the full review or start a third loop. If nothing changed, the initial report is final.
168
- If the recheck causes an accepted edit, repeat step 5, including coverage refresh and analyze,
169
- before generating the engineering digest.
159
+ If the recheck causes an accepted edit, repeat step 5. After the recheck is
160
+ complete and all accepted edits are folded back, re-close the matrix, rerun
161
+ `analyze`, run `devrites-engine readiness-digest coverage <slug>`, replace the
162
+ complete `Coverage inputs SHA-256` line, and only then run
163
+ `devrites-engine readiness-digest engineering <slug>`.
164
+
165
+ Now write exactly one `DevRites contract: devrites.readiness-artifacts.v2`
166
+ field to both `test-plan.md` and `eng-review.md`, plus one typed field to
167
+ `eng-review.md`: `Implementation readiness: READY`, `NEEDS CLARIFICATION`, or
168
+ `NEEDS REPLAN`. Only READY sets `Phase: vet` and `Next step: $rite-build`,
169
+ after a final sweep leaves no foreseeable human choice except a justified
170
+ action-time checkpoint. Technical failure records its reproduction and
171
+ `$rite-plan repair` without a qid; a human-owned contract gap routes
172
+ `$rite-clarify` and uses the normal awaiting-human block.
170
173
  [`reference/cross-model.md`](reference/cross-model.md) owns the optional outside voice.
171
174
  Completion: the final axis floor clears, an objective technical blocker is recorded, or a
172
175
  genuine human-owned gate is recorded.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devrites",
3
- "version": "3.2.16",
3
+ "version": "3.2.18",
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",
@@ -238,7 +238,7 @@ gen_codex_hooks_json() {
238
238
  ],
239
239
  "PostToolUse": [
240
240
  {
241
- "matcher": "Bash",
241
+ "matcher": "Bash|Shell|sh|exec_command|run_command",
242
242
  "hooks": [
243
243
  {
244
244
  "type": "command",