devrites 3.2.2 → 3.2.3

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 (196) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -1
  3. package/docs/architecture.md +6 -2
  4. package/docs/command-map.md +3 -3
  5. package/docs/engine/agent-contract.md +3 -2
  6. package/docs/harness-compliance.md +2 -2
  7. package/docs/orchestration.md +15 -12
  8. package/docs/porting-to-a-new-harness.md +2 -1
  9. package/docs/skills.md +7 -2
  10. package/engine/hooks.go +39 -4
  11. package/engine/hooks_agent_dispatch.go +1193 -0
  12. package/engine/hooks_workspace.go +78 -10
  13. package/engine/internal/forge/forge.go +0 -2
  14. package/engine/internal/harness/compliance.go +1 -1
  15. package/engine/internal/harness/harness.go +3 -0
  16. package/engine/internal/lib/doubtcoverage.go +2 -12
  17. package/engine/internal/lib/reconcile.go +4 -29
  18. package/engine/internal/lib/reconcile_test.go +14 -10
  19. package/engine/main.go +4 -1
  20. package/engine/tests/hook_test.go +874 -1
  21. package/engine/tests/lib_parity_test.go +5 -17
  22. package/engine/tests/parity_reconcile_test.go +1 -1
  23. package/engine/tests/parity_test.go +2 -6
  24. package/pack/.claude/skills/devrites-api-interface/SKILL.md +1 -0
  25. package/pack/.claude/skills/devrites-audit/SKILL.md +5 -6
  26. package/pack/.claude/skills/devrites-browser-proof/SKILL.md +1 -0
  27. package/pack/.claude/skills/devrites-debug-recovery/SKILL.md +1 -0
  28. package/pack/.claude/skills/devrites-doubt/SKILL.md +2 -1
  29. package/pack/.claude/skills/devrites-frontend-craft/SKILL.md +1 -0
  30. package/pack/.claude/skills/devrites-interview/SKILL.md +1 -0
  31. package/pack/.claude/skills/devrites-lib/SKILL.md +1 -0
  32. package/pack/.claude/skills/devrites-lib/reference/model-tiers.md +4 -3
  33. package/pack/.claude/skills/devrites-lib/reference/parallel-dispatch.md +4 -5
  34. package/pack/.claude/skills/devrites-lib/reference/standards/agents.md +14 -8
  35. package/pack/.claude/skills/devrites-prose-craft/SKILL.md +1 -0
  36. package/pack/.claude/skills/devrites-refresh-indexes/SKILL.md +1 -0
  37. package/pack/.claude/skills/devrites-source-driven/SKILL.md +1 -0
  38. package/pack/.claude/skills/devrites-ux-shape/SKILL.md +1 -0
  39. package/pack/.claude/skills/rite/SKILL.md +1 -0
  40. package/pack/.claude/skills/rite-adopt/SKILL.md +1 -0
  41. package/pack/.claude/skills/rite-autocomplete/SKILL.md +1 -0
  42. package/pack/.claude/skills/rite-build/SKILL.md +2 -1
  43. package/pack/.claude/skills/rite-build/reference/phase-contract.md +3 -4
  44. package/pack/.claude/skills/rite-build/reference/wright-dispatch.md +11 -12
  45. package/pack/.claude/skills/rite-clarify/SKILL.md +1 -0
  46. package/pack/.claude/skills/rite-converge/SKILL.md +1 -0
  47. package/pack/.claude/skills/rite-customize/SKILL.md +1 -0
  48. package/pack/.claude/skills/rite-define/SKILL.md +1 -0
  49. package/pack/.claude/skills/rite-doctor/SKILL.md +1 -0
  50. package/pack/.claude/skills/rite-dogfood/SKILL.md +1 -0
  51. package/pack/.claude/skills/rite-explain/SKILL.md +4 -2
  52. package/pack/.claude/skills/rite-frame/SKILL.md +1 -0
  53. package/pack/.claude/skills/rite-handoff/SKILL.md +1 -0
  54. package/pack/.claude/skills/rite-learn/SKILL.md +1 -0
  55. package/pack/.claude/skills/rite-plan/SKILL.md +1 -0
  56. package/pack/.claude/skills/rite-polish/SKILL.md +1 -0
  57. package/pack/.claude/skills/rite-pov/SKILL.md +1 -0
  58. package/pack/.claude/skills/rite-pr-feedback/SKILL.md +1 -0
  59. package/pack/.claude/skills/rite-pressure-test/SKILL.md +1 -0
  60. package/pack/.claude/skills/rite-prototype/SKILL.md +1 -0
  61. package/pack/.claude/skills/rite-prove/SKILL.md +1 -0
  62. package/pack/.claude/skills/rite-quick/SKILL.md +1 -0
  63. package/pack/.claude/skills/rite-resolve/SKILL.md +1 -0
  64. package/pack/.claude/skills/rite-review/SKILL.md +1 -0
  65. package/pack/.claude/skills/rite-seal/SKILL.md +1 -0
  66. package/pack/.claude/skills/rite-seal/reference/phase-contract.md +2 -3
  67. package/pack/.claude/skills/rite-seal/reference/risk-and-rollback.md +10 -12
  68. package/pack/.claude/skills/rite-ship/SKILL.md +1 -0
  69. package/pack/.claude/skills/rite-spec/SKILL.md +1 -0
  70. package/pack/.claude/skills/rite-status/SKILL.md +1 -0
  71. package/pack/.claude/skills/rite-temper/SKILL.md +3 -2
  72. package/pack/.claude/skills/rite-upgrade/SKILL.md +3 -1
  73. package/pack/.claude/skills/rite-vet/SKILL.md +1 -0
  74. package/pack/.claude/skills/rite-zoom-out/SKILL.md +1 -0
  75. package/pack/generated/claude/skills/devrites-api-interface/SKILL.md +1 -0
  76. package/pack/generated/claude/skills/devrites-audit/SKILL.md +5 -6
  77. package/pack/generated/claude/skills/devrites-browser-proof/SKILL.md +1 -0
  78. package/pack/generated/claude/skills/devrites-debug-recovery/SKILL.md +1 -0
  79. package/pack/generated/claude/skills/devrites-doubt/SKILL.md +2 -1
  80. package/pack/generated/claude/skills/devrites-frontend-craft/SKILL.md +1 -0
  81. package/pack/generated/claude/skills/devrites-interview/SKILL.md +1 -0
  82. package/pack/generated/claude/skills/devrites-lib/SKILL.md +1 -0
  83. package/pack/generated/claude/skills/devrites-lib/reference/model-tiers.md +4 -3
  84. package/pack/generated/claude/skills/devrites-lib/reference/parallel-dispatch.md +4 -5
  85. package/pack/generated/claude/skills/devrites-lib/reference/standards/agents.md +14 -8
  86. package/pack/generated/claude/skills/devrites-prose-craft/SKILL.md +1 -0
  87. package/pack/generated/claude/skills/devrites-refresh-indexes/SKILL.md +1 -0
  88. package/pack/generated/claude/skills/devrites-source-driven/SKILL.md +1 -0
  89. package/pack/generated/claude/skills/devrites-ux-shape/SKILL.md +1 -0
  90. package/pack/generated/claude/skills/rite/SKILL.md +1 -0
  91. package/pack/generated/claude/skills/rite-adopt/SKILL.md +1 -0
  92. package/pack/generated/claude/skills/rite-autocomplete/SKILL.md +1 -0
  93. package/pack/generated/claude/skills/rite-build/SKILL.md +2 -1
  94. package/pack/generated/claude/skills/rite-build/reference/phase-contract.md +3 -4
  95. package/pack/generated/claude/skills/rite-build/reference/wright-dispatch.md +11 -12
  96. package/pack/generated/claude/skills/rite-clarify/SKILL.md +1 -0
  97. package/pack/generated/claude/skills/rite-converge/SKILL.md +1 -0
  98. package/pack/generated/claude/skills/rite-customize/SKILL.md +1 -0
  99. package/pack/generated/claude/skills/rite-define/SKILL.md +1 -0
  100. package/pack/generated/claude/skills/rite-doctor/SKILL.md +1 -0
  101. package/pack/generated/claude/skills/rite-dogfood/SKILL.md +1 -0
  102. package/pack/generated/claude/skills/rite-explain/SKILL.md +4 -2
  103. package/pack/generated/claude/skills/rite-frame/SKILL.md +1 -0
  104. package/pack/generated/claude/skills/rite-handoff/SKILL.md +1 -0
  105. package/pack/generated/claude/skills/rite-learn/SKILL.md +1 -0
  106. package/pack/generated/claude/skills/rite-plan/SKILL.md +1 -0
  107. package/pack/generated/claude/skills/rite-polish/SKILL.md +1 -0
  108. package/pack/generated/claude/skills/rite-pov/SKILL.md +1 -0
  109. package/pack/generated/claude/skills/rite-pr-feedback/SKILL.md +1 -0
  110. package/pack/generated/claude/skills/rite-pressure-test/SKILL.md +1 -0
  111. package/pack/generated/claude/skills/rite-prototype/SKILL.md +1 -0
  112. package/pack/generated/claude/skills/rite-prove/SKILL.md +1 -0
  113. package/pack/generated/claude/skills/rite-quick/SKILL.md +1 -0
  114. package/pack/generated/claude/skills/rite-resolve/SKILL.md +1 -0
  115. package/pack/generated/claude/skills/rite-review/SKILL.md +1 -0
  116. package/pack/generated/claude/skills/rite-seal/SKILL.md +1 -0
  117. package/pack/generated/claude/skills/rite-seal/reference/phase-contract.md +2 -3
  118. package/pack/generated/claude/skills/rite-seal/reference/risk-and-rollback.md +10 -12
  119. package/pack/generated/claude/skills/rite-ship/SKILL.md +1 -0
  120. package/pack/generated/claude/skills/rite-spec/SKILL.md +1 -0
  121. package/pack/generated/claude/skills/rite-status/SKILL.md +1 -0
  122. package/pack/generated/claude/skills/rite-temper/SKILL.md +3 -2
  123. package/pack/generated/claude/skills/rite-upgrade/SKILL.md +3 -1
  124. package/pack/generated/claude/skills/rite-vet/SKILL.md +1 -0
  125. package/pack/generated/claude/skills/rite-zoom-out/SKILL.md +1 -0
  126. package/pack/generated/codex/AGENTS.md +2 -4
  127. package/pack/generated/codex/hooks.json +24 -5
  128. package/pack/generated/codex/skills/devrites-api-interface/SKILL.md +6 -4
  129. package/pack/generated/codex/skills/devrites-audit/SKILL.md +10 -10
  130. package/pack/generated/codex/skills/devrites-browser-proof/SKILL.md +6 -4
  131. package/pack/generated/codex/skills/devrites-debug-recovery/SKILL.md +6 -4
  132. package/pack/generated/codex/skills/devrites-doubt/SKILL.md +7 -5
  133. package/pack/generated/codex/skills/devrites-frontend-craft/SKILL.md +6 -4
  134. package/pack/generated/codex/skills/devrites-interview/SKILL.md +6 -4
  135. package/pack/generated/codex/skills/devrites-lib/SKILL.md +6 -4
  136. package/pack/generated/codex/skills/devrites-lib/reference/model-tiers.md +4 -3
  137. package/pack/generated/codex/skills/devrites-lib/reference/parallel-dispatch.md +4 -5
  138. package/pack/generated/codex/skills/devrites-lib/reference/standards/agents.md +14 -8
  139. package/pack/generated/codex/skills/devrites-prose-craft/SKILL.md +6 -4
  140. package/pack/generated/codex/skills/devrites-refresh-indexes/SKILL.md +6 -4
  141. package/pack/generated/codex/skills/devrites-source-driven/SKILL.md +6 -4
  142. package/pack/generated/codex/skills/devrites-ux-shape/SKILL.md +6 -4
  143. package/pack/generated/codex/skills/rite/SKILL.md +6 -4
  144. package/pack/generated/codex/skills/rite-adopt/SKILL.md +6 -4
  145. package/pack/generated/codex/skills/rite-autocomplete/SKILL.md +6 -4
  146. package/pack/generated/codex/skills/rite-build/SKILL.md +7 -5
  147. package/pack/generated/codex/skills/rite-build/reference/phase-contract.md +3 -4
  148. package/pack/generated/codex/skills/rite-build/reference/wright-dispatch.md +11 -12
  149. package/pack/generated/codex/skills/rite-clarify/SKILL.md +6 -4
  150. package/pack/generated/codex/skills/rite-converge/SKILL.md +6 -4
  151. package/pack/generated/codex/skills/rite-customize/SKILL.md +6 -4
  152. package/pack/generated/codex/skills/rite-define/SKILL.md +6 -4
  153. package/pack/generated/codex/skills/rite-doctor/SKILL.md +6 -4
  154. package/pack/generated/codex/skills/rite-dogfood/SKILL.md +6 -4
  155. package/pack/generated/codex/skills/rite-explain/SKILL.md +9 -6
  156. package/pack/generated/codex/skills/rite-frame/SKILL.md +6 -4
  157. package/pack/generated/codex/skills/rite-handoff/SKILL.md +6 -4
  158. package/pack/generated/codex/skills/rite-learn/SKILL.md +6 -4
  159. package/pack/generated/codex/skills/rite-plan/SKILL.md +6 -4
  160. package/pack/generated/codex/skills/rite-polish/SKILL.md +6 -4
  161. package/pack/generated/codex/skills/rite-pov/SKILL.md +6 -4
  162. package/pack/generated/codex/skills/rite-pr-feedback/SKILL.md +6 -4
  163. package/pack/generated/codex/skills/rite-pressure-test/SKILL.md +6 -4
  164. package/pack/generated/codex/skills/rite-prototype/SKILL.md +6 -4
  165. package/pack/generated/codex/skills/rite-prove/SKILL.md +6 -4
  166. package/pack/generated/codex/skills/rite-quick/SKILL.md +6 -4
  167. package/pack/generated/codex/skills/rite-resolve/SKILL.md +6 -4
  168. package/pack/generated/codex/skills/rite-review/SKILL.md +6 -4
  169. package/pack/generated/codex/skills/rite-seal/SKILL.md +6 -4
  170. package/pack/generated/codex/skills/rite-seal/reference/phase-contract.md +2 -3
  171. package/pack/generated/codex/skills/rite-seal/reference/risk-and-rollback.md +10 -12
  172. package/pack/generated/codex/skills/rite-ship/SKILL.md +6 -4
  173. package/pack/generated/codex/skills/rite-spec/SKILL.md +6 -4
  174. package/pack/generated/codex/skills/rite-status/SKILL.md +6 -4
  175. package/pack/generated/codex/skills/rite-temper/SKILL.md +8 -6
  176. package/pack/generated/codex/skills/rite-upgrade/SKILL.md +8 -5
  177. package/pack/generated/codex/skills/rite-vet/SKILL.md +6 -4
  178. package/pack/generated/codex/skills/rite-zoom-out/SKILL.md +6 -4
  179. package/package.json +1 -1
  180. package/scripts/codex-generate.sh +32 -18
  181. package/scripts/live-hosts/agent-result.schema.json +2 -1
  182. package/scripts/live-hosts/claude.sh +2 -2
  183. package/scripts/live-hosts/codex.sh +4 -0
  184. package/scripts/live-hosts/fake-host.py +1 -8
  185. package/scripts/live-hosts/host-transport.py +1 -2
  186. package/scripts/run-agent-contract-evals.py +3 -3
  187. package/scripts/run-evals.sh +3 -34
  188. package/scripts/validate-frontmatter.py +34 -1
  189. package/engine/testdata/golden/TestParityA1Guard/inline-fallback-silent.golden +0 -1
  190. package/engine/testdata/golden/TestParityDoubtCoverage/arg=inline.golden +0 -3
  191. package/engine/testdata/golden/TestParityDoubtCoverage/arg=missing-inline.golden +0 -3
  192. package/scripts/eval-runner.py +0 -275
  193. package/scripts/eval-scorer.mjs +0 -46
  194. package/scripts/render-eval-summary.py +0 -48
  195. /package/engine/testdata/golden/TestParityReconcile/{inline-fallback → close-window}/snapshot.golden +0 -0
  196. /package/engine/testdata/golden/TestParityReconcile/{inline-fallback.golden → close-window.golden} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to DevRites are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and DevRites adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Releases are generated automatically by [semantic-release](https://semantic-release.gitbook.io/) from Conventional Commits on `main`.
4
4
 
5
+ ## [3.2.3](https://github.com/ViktorsBaikers/DevRites/compare/v3.2.2...v3.2.3) (2026-07-25)
6
+
7
+ ### Fixed
8
+
9
+ * **agents:** enforce native specialist dispatch ([4ac3eb1](https://github.com/ViktorsBaikers/DevRites/commit/4ac3eb1a407ed8df4d3097984fbc0e369a5918b4))
10
+ * **agents:** satisfy staticcheck error style ([cc21c46](https://github.com/ViktorsBaikers/DevRites/commit/cc21c4600171111dc30065327a9cd0ffff2420bc))
11
+ * **skills:** avoid false invocation reference ([45f25bb](https://github.com/ViktorsBaikers/DevRites/commit/45f25bb70516460d753bccaa5ba78cce73e2a1d0))
12
+
5
13
  ## [3.2.2](https://github.com/ViktorsBaikers/DevRites/compare/v3.2.1...v3.2.2) (2026-07-25)
6
14
 
7
15
  ### Fixed
package/README.md CHANGED
@@ -25,7 +25,7 @@ final commit, push, and tag, and it requires a typed `GO` confirmation.
25
25
  Unattended runs may create local WIP checkpoint commits along the way, but only
26
26
  Ship collapses and pushes them.
27
27
 
28
- **Status:** [`v3.2.2`](https://github.com/ViktorsBaikers/DevRites/releases/tag/v3.2.2): see [`CHANGELOG.md`](CHANGELOG.md) for release notes.
28
+ **Status:** [`v3.2.3`](https://github.com/ViktorsBaikers/DevRites/releases/tag/v3.2.3): see [`CHANGELOG.md`](CHANGELOG.md) for release notes.
29
29
 
30
30
  ## Quick start
31
31
 
@@ -318,7 +318,8 @@ contract.
318
318
  - **Drift**: an explicit **Spec Drift Guard** in build/prove/polish/review/seal.
319
319
  - **Design**: `devrites-frontend-craft` + a four-phase `/rite-polish` orchestrator (code + backend always; UI normalize + polish when UI is in scope).
320
320
  - **Agents**: 18 fresh-context roles at flat depth one: 17 read-only leaves and
321
- one wright. Fallback order is named, generic, then labelled inline.
321
+ one wright. Dispatch order is named, then guarded generic; if neither can
322
+ spawn, the workflow stops for HITL.
322
323
  - **Review**: **feature-scoped** multi-axis review with severity labels and
323
324
  fresh-context agents at the seal.
324
325
  - **Scope**: clarify → seal (decide) → ship (commit → push → tag or PR,
@@ -332,7 +333,10 @@ contract.
332
333
  1. **Invocation semantics are explicit in frontmatter.** `user-invocable`
333
334
  controls whether a skill is a public command; `disable-model-invocation`
334
335
  independently marks explicit-only public utilities and the internal
335
- `devrites-lib` library. Model-invocable phases can still hand off and route;
336
+ `devrites-lib` library. `required-agent-roles` is the canonical list of
337
+ unconditional fresh-agent roles for one invocation (`none` is explicit);
338
+ Codex derives its fail-closed dispatch receipt from the installed mirror.
339
+ Model-invocable phases can still hand off and route;
336
340
  per-phase side-effect discipline (for example, "stop after one slice") is
337
341
  enforced in the skill **body**, because invocation flags cannot express it.
338
342
  2. **`context: fork` used selectively.** Verified it is a real field (isolated
@@ -144,9 +144,9 @@ the shared reference library.
144
144
  Only the root dispatches; leaves never dispatch other leaves. The first
145
145
  fallback is a generic `explorer` or `worker` that reads the same role contract,
146
146
  but only when the host preserves the required read-only or exact-write
147
- boundary. If no safe fresh-context option is available, the root runs the work
148
- inline and labels the result `independence: fallback`. Declared leaf identity
149
- and scope guards fail closed. A missing or crashed engine blocks the tool call
147
+ boundary. If no safe fresh-context option is available, the workflow stops for
148
+ HITL. The root never executes a specialist role. Declared leaf identity and
149
+ scope guards fail closed. A missing or crashed engine blocks the tool call
150
150
  instead of granting permission to continue.
151
151
 
152
152
  ## Engineering rules (`pack/.claude/skills/devrites-lib/reference/standards/`)
@@ -132,7 +132,8 @@ timeline rows remain readable beside v1 rows.
132
132
 
133
133
  The v1 validator accepts only:
134
134
 
135
- - `execution_mode`: `named` · `generic` · `inline` · `none`;
135
+ - `execution_mode`: `named` · `generic` · `inline` · `none` (`inline` remains
136
+ readable for historical telemetry; current specialist dispatch never emits it);
136
137
  - `guard_strength`: `enforced` · `observed` · `unavailable` · `bypassed` · `n/a`;
137
138
  - `host`: `engine` · `claude` · `codex`;
138
139
  - registered `DRV-*` reason and rule IDs;
@@ -166,6 +167,6 @@ reasons are:
166
167
  | `DRV-GIT-AMBIGUOUS-*` / `DRV-GIT-INPUT-TOO-LARGE` | direct-literal Git parser boundary |
167
168
  | `DRV-GIT-DESTRUCTIVE-*` | destructive-operation classifier |
168
169
  | `DRV-GIT-AUTHORITY-*` / `DRV-GIT-WORKSPACE-UNAVAILABLE` | exact one-shot authority and replay gate |
169
- | `DRV-AGENT-*` | named/generic/inline execution and result reconciliation |
170
+ | `DRV-AGENT-*` | named/generic execution, historical inline telemetry, and result reconciliation |
170
171
 
171
172
  Add a reason to that registry before an emitting rule or eval depends on it.
@@ -40,7 +40,7 @@ the table and the code can never silently drift apart.
40
40
  | Stop gate | Conditional | Conditional | all rest points | observe-only finding + manual host-specific rite-status | yes | high | Both deliver Stop; stop-gate blocks with DEVRITES_STOP_GATE=enforce or DEVRITES_HOOK_PROFILE=strict. |
41
41
  | SubagentStart discipline injection | Native | Native | review/build fan-out | agent file preamble | yes | high | subagent-orient wired on both. |
42
42
  | Skill invocation | Native | Adapter-backed | all public rites | explicit file read | yes | high | Claude: native /rite. Codex: $rite over the mirrored .agents/skills tree. |
43
- | Reviewer subagent dispatch | Native | Instruction-backed | review/seal confidence | labelled inline pass | partial | medium | Codex under-fires embedded spawns (openai/codex#23496); falls back to .codex/agents + a labelled inline pass. |
43
+ | Reviewer subagent dispatch | Native | Adapter-backed | review/seal confidence | HITL stop; no root inline review | yes | high | Codex V2 requires the exact named role and verifies its durable parent/child rollout because V2 collaboration lifecycle calls bypass hooks; V1 keeps the guarded explorer fallback. |
44
44
  | Standards step-0 load | Native | Instruction-backed | all phases | explicit standards read | partial | medium | Claude: skill Reads core.md. Codex: an AGENTS.md directive to read it. |
45
45
  | Project activation | Native | Conditional | Codex-only startup | inspect hooks/config, decide trust, then rerun doctor | yes | medium | Codex silently skips every .codex/ layer in an untrusted project; trust remains an operator decision after inspection. |
46
46
 
@@ -52,7 +52,7 @@ Tiers: **Native** (the harness exposes and delivers the surface directly; policy
52
52
 
53
53
  The matrix above records what each host can support. The agent-contract eval
54
54
  checks whether the complete dispatch path behaves as claimed. Its 12 scenarios
55
- cover named reviewer and wright runs, generic and inline fallbacks, denial
55
+ cover named reviewer and wright runs, generic fallback and dispatch unavailability, denial
56
56
  paths, stale or malformed results, session orientation, interruption, and
57
57
  post-compaction recovery. Every scenario runs once on Claude and once on
58
58
  Codex, for 24 isolated cells.
@@ -34,18 +34,21 @@ or out-of-scope returns before adding anything to canonical state.
34
34
 
35
35
  Use the first safe option available:
36
36
 
37
- 1. the named project role;
38
- 2. a generic `explorer` or `worker` reading the same generated role contract
39
- only when the host still enforces read-only or exact wright scope (or
40
- isolated staging);
41
- 3. inline execution, labelled `independence: fallback`, when neither safe
42
- fresh-context option is callable.
43
-
44
- Inline self-review never silently satisfies an independence gate. Declared
45
- leaf identity is fail-closed: a missing or crashed `devrites-engine` guard
46
- blocks the tool call. Leaves never ask the human, write `.devrites/**`, change
47
- phase, commit, push, install, deploy, migrate live data, or perform irreversible
48
- actions.
37
+ 1. the named project role; Codex V2 uses its exact `agent_type`, a unique
38
+ `task_name`, and a durable rollout proving native rules, wait, and result;
39
+ 2. a generic V1 `explorer`/`worker` only when the host still enforces read-only
40
+ or exact wright scope (or isolated staging);
41
+ 3. a HITL stop when neither safe fresh-context option is callable.
42
+
43
+ Specialist work never runs in the root context. Declared leaf identity is
44
+ fail-closed: a missing or crashed `devrites-engine` guard blocks the tool call.
45
+ Every installed skill also carries `required-agent-roles` frontmatter. Codex
46
+ arms those unconditional roles when the user invokes the skill and blocks Stop
47
+ until each role has a confirmed start, wait, and non-empty result. `none`
48
+ explicitly declares that the skill has no unconditional fresh-agent requirement;
49
+ conditional fan-out still follows the phase's documented triggers.
50
+ Leaves never ask the human, write `.devrites/**`, change phase, commit, push,
51
+ install, deploy, migrate live data, or perform irreversible actions.
49
52
 
50
53
  ## Single-writer build lifecycle
51
54
 
@@ -21,7 +21,8 @@ The harness must invoke DevRites and route to `/rite-spec` (or the host's explic
21
21
  - Skill discovery path is project-local and installed by `npx devrites`.
22
22
  - Session/project orientation runs automatically at startup/compact/resume, or the missing surface is recorded in `docs/harness-compliance.md`.
23
23
  - `devrites-engine` hooks/gates are wired, or each degraded gate has an honest fallback and confidence label.
24
- - Subagent support is mapped; if unavailable, reviewers/wrights use the documented inline fallback and label it.
24
+ - Subagent support is mapped; if unavailable, required reviewer/wright work
25
+ stops for HITL rather than running in the root context.
25
26
  - Skills, agents, standards, hooks, and harness guidance stay project-local;
26
27
  the optional shared `devrites-engine` executable is the sole sanctioned
27
28
  global artifact and must remain skippable with `--no-binary`.
package/docs/skills.md CHANGED
@@ -18,6 +18,11 @@ only when needed; small utilities keep their narrower contract local. The npm
18
18
  `devrites` shim bootstraps or proxies the engine directly (see
19
19
  [`cli.md`](cli.md)).
20
20
 
21
+ Every canonical skill declares `required-agent-roles`. A comma-separated list
22
+ means those fresh agents are mandatory for a Codex invocation; `none` means no
23
+ agent is unconditionally required. Host generation preserves the field and
24
+ validation rejects missing or unresolved role contracts.
25
+
21
26
  ## Naming convention
22
27
 
23
28
  `rite-*` is the namespace for lifecycle and utility commands. Its utilities are
@@ -248,8 +253,8 @@ context with only the slice contract; all other agents are read-only.
248
253
  | [`devrites-slice-wright`](../pack/.claude/agents/devrites-slice-wright.md) | Turn ONE exact allowlisted slice into the smallest complete, idiomatic, proven implementation. Writes code + tests only; returns a typed artifact for the root to reconcile, gate, and record. Writes no `.devrites/` bookkeeping; single-threaded per tree. |
249
254
 
250
255
  Dispatch contract + return shape + fallback: [`rite-build/reference/wright-dispatch.md`](../pack/.claude/skills/rite-build/reference/wright-dispatch.md).
251
- The shared topology, named → generic → labelled-inline fallback, and fail-closed
252
- identity rules live in [`standards/agents.md`](../pack/.claude/skills/devrites-lib/reference/standards/agents.md).
256
+ The shared topology, named → guarded generic → HITL stop, and fail-closed identity
257
+ rules live in [`standards/agents.md`](../pack/.claude/skills/devrites-lib/reference/standards/agents.md).
253
258
 
254
259
  ---
255
260
 
package/engine/hooks.go CHANGED
@@ -467,7 +467,7 @@ func hookReviewerReadonly(h harness.Harness, stdin io.Reader, stdout, stderr io.
467
467
  return exitOK
468
468
  }
469
469
  in := h.ParseGuardInput(bytes.NewReader(data))
470
- kind := devritesAgent(in.AgentType)
470
+ kind := devritesAgentForGuard(h, in)
471
471
  if kind == devritesAgentNone &&
472
472
  os.Getenv("DEVRITES_CODEX_GENERIC_AGENT_COMPAT") == "1" &&
473
473
  in.AgentType == "" {
@@ -540,11 +540,46 @@ var subagentOrientContext string
540
540
  // Spawned agents have fresh context and do not load the rite-* framework the
541
541
  // same way as the main thread. The output matches devrites-subagent-orient.sh.
542
542
  func hookSubagentOrient(h harness.Harness, stdin io.Reader, stdout, stderr io.Writer) int {
543
- agentType := h.SubagentAgentType(stdin)
544
- if !strings.HasPrefix(agentType, "devrites-") {
543
+ data, err := io.ReadAll(stdin)
544
+ if err != nil {
545
+ return exitOK
546
+ }
547
+ agentType := h.SubagentAgentType(bytes.NewReader(data))
548
+ context := strings.ReplaceAll(subagentOrientContext, "\r\n", "\n")
549
+ if h == harness.Codex {
550
+ in, parseErr := parseAgentDispatchHookInput(bytes.NewReader(data))
551
+ root, ok := agentDispatchRoot()
552
+ if parseErr != nil || !ok || in.SessionID == "" || in.TurnID == "" || in.AgentID == "" {
553
+ if !strings.HasPrefix(agentType, "devrites-") {
554
+ return exitOK
555
+ }
556
+ context += "\n\n- **Dispatch binding unavailable.** Return blocked without doing specialist work; the parent must retry a confirmed spawn."
557
+ } else {
558
+ role, bound, bindErr := bindAgentDispatchStart(root, in)
559
+ if bindErr != nil {
560
+ context += "\n\n- **Dispatch binding failed.** Return blocked without doing specialist work; the parent must repair the agent-start receipt."
561
+ } else if bound {
562
+ if in.AgentType == role {
563
+ context += fmt.Sprintf(
564
+ "\n\n- **Confirmed role.** Your named Codex profile is `%s`; follow its loaded `developer_instructions` and execute only the unchanged packet from the parent.",
565
+ role,
566
+ )
567
+ } else {
568
+ context += fmt.Sprintf(
569
+ "\n\n- **Confirmed role.** Your generic `%s` identity is bound to `%s`; the spawn hook injected `.codex/agents/%s.toml` `developer_instructions` into your message. Follow them and execute only the unchanged packet from the parent.",
570
+ in.AgentType, role, role,
571
+ )
572
+ }
573
+ } else if !strings.HasPrefix(agentType, "devrites-") {
574
+ return exitOK
575
+ } else {
576
+ context += "\n\n- **Unbound named start.** Return blocked without doing specialist work; no matching root spawn receipt exists."
577
+ }
578
+ }
579
+ } else if !strings.HasPrefix(agentType, "devrites-") {
545
580
  return exitOK // Stay silent without a DevRites agent identity.
546
581
  }
547
- out, err := h.SubagentStartContext(strings.ReplaceAll(subagentOrientContext, "\r\n", "\n"))
582
+ out, err := h.SubagentStartContext(context)
548
583
  if err != nil {
549
584
  debugf(stderr, "subagent-orient: %v", err)
550
585
  return exitOK