devrites 3.0.7 → 3.1.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 (472) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +67 -47
  3. package/SECURITY.md +31 -29
  4. package/docs/adr/0001-go-engine-as-control-plane.md +1 -1
  5. package/docs/adr/0002-dual-host-harness.md +1 -1
  6. package/docs/adr/0004-state-schema-phases-sections.md +1 -2
  7. package/docs/adr/0006-clock-seam-and-engine-ci-gates.md +3 -4
  8. package/docs/adr/0009-prebuild-decision-coverage-and-readiness.md +67 -0
  9. package/docs/adr/0010-agent-first-fresh-context-orchestration.md +71 -0
  10. package/docs/adr/0011-define-plan-transition-rights.md +28 -0
  11. package/docs/adr/README.md +3 -0
  12. package/docs/agents/triage-labels.md +7 -7
  13. package/docs/architecture.md +157 -140
  14. package/docs/cli.md +41 -12
  15. package/docs/command-map.md +49 -35
  16. package/docs/engine/agent-contract.md +92 -15
  17. package/docs/engine/commands.md +242 -72
  18. package/docs/engine/state-schema.md +52 -23
  19. package/docs/engine/workspace-schema.md +94 -15
  20. package/docs/extensions.md +1 -1
  21. package/docs/flow.md +80 -50
  22. package/docs/harness-compliance.md +29 -5
  23. package/docs/orchestration.md +107 -79
  24. package/docs/quick-reference.md +7 -3
  25. package/docs/release.md +4 -3
  26. package/docs/skills.md +64 -38
  27. package/docs/usage.md +57 -38
  28. package/engine/cmd/releasepack/main.go +219 -0
  29. package/engine/cmd/releasepack/main_test.go +170 -0
  30. package/engine/commands.go +170 -23
  31. package/engine/git_guard.go +187 -0
  32. package/engine/git_guard_test.go +283 -0
  33. package/engine/hookpolicy.go +53 -55
  34. package/engine/hookpolicy_test.go +91 -1
  35. package/engine/hooks.go +296 -75
  36. package/engine/hooks_events_test.go +276 -6
  37. package/engine/hooks_workspace.go +640 -159
  38. package/engine/internal/devritespaths/paths.go +65 -10
  39. package/engine/internal/devritespaths/paths_test.go +110 -0
  40. package/engine/internal/doctor/doctor.go +153 -23
  41. package/engine/internal/doctor/doctor_test.go +74 -0
  42. package/engine/internal/forge/forge.go +940 -0
  43. package/engine/internal/forge/forge_test.go +576 -0
  44. package/engine/internal/forge/git.go +245 -0
  45. package/engine/internal/forge/liveness_unix.go +48 -0
  46. package/engine/internal/forge/liveness_windows.go +67 -0
  47. package/engine/internal/forge/manifest.go +402 -0
  48. package/engine/internal/gate/gate.go +90 -71
  49. package/engine/internal/gate/gate_test.go +71 -2
  50. package/engine/internal/harness/compliance.go +18 -24
  51. package/engine/internal/harness/harness.go +37 -44
  52. package/engine/internal/harness/harness_test.go +21 -5
  53. package/engine/internal/install/install.go +486 -38
  54. package/engine/internal/install/install_test.go +383 -10
  55. package/engine/internal/iohooks/iohooks.go +350 -59
  56. package/engine/internal/iohooks/iohooks_test.go +421 -1
  57. package/engine/internal/lib/buildreadiness.go +35 -18
  58. package/engine/internal/lib/clarifyreturn.go +91 -0
  59. package/engine/internal/lib/clarifyreturn_test.go +123 -0
  60. package/engine/internal/lib/context.go +54 -15
  61. package/engine/internal/lib/cursor_compat_test.go +8 -0
  62. package/engine/internal/lib/extensions.go +2 -3
  63. package/engine/internal/lib/gitauthority.go +601 -0
  64. package/engine/internal/lib/gitauthority_test.go +346 -0
  65. package/engine/internal/lib/jsonout.go +25 -11
  66. package/engine/internal/lib/jsonout_test.go +16 -0
  67. package/engine/internal/lib/lanes.go +14 -8
  68. package/engine/internal/lib/observability_test.go +358 -0
  69. package/engine/internal/lib/packageexistence.go +151 -35
  70. package/engine/internal/lib/packageexistence_test.go +163 -0
  71. package/engine/internal/lib/progress.go +11 -9
  72. package/engine/internal/lib/provenance.go +462 -0
  73. package/engine/internal/lib/provenance_test.go +154 -0
  74. package/engine/internal/lib/readiness_contract.json +111 -0
  75. package/engine/internal/lib/readinessartifact.go +510 -0
  76. package/engine/internal/lib/readinessartifact_test.go +321 -0
  77. package/engine/internal/lib/reconcile.go +712 -88
  78. package/engine/internal/lib/reconcile_test.go +335 -16
  79. package/engine/internal/lib/recoveryattempts.go +298 -0
  80. package/engine/internal/lib/recoveryattempts_test.go +215 -0
  81. package/engine/internal/lib/resolve.go +23 -19
  82. package/engine/internal/lib/runbook_context_test.go +20 -0
  83. package/engine/internal/lib/session.go +701 -9
  84. package/engine/internal/lib/session_test.go +80 -13
  85. package/engine/internal/lib/testintegrity.go +33 -37
  86. package/engine/internal/lib/testintegrity_test.go +63 -1
  87. package/engine/internal/migrate/migrate.go +81 -1
  88. package/engine/internal/migrate/migrate_test.go +22 -1
  89. package/engine/internal/reason/reason.go +180 -0
  90. package/engine/internal/reason/reason_test.go +35 -0
  91. package/engine/internal/rootfacts/facts.go +466 -0
  92. package/engine/internal/rootfacts/facts_test.go +306 -0
  93. package/engine/internal/safepath/safepath.go +55 -0
  94. package/engine/internal/safepath/safepath_test.go +69 -0
  95. package/engine/internal/safepath/safepath_windows_test.go +26 -0
  96. package/engine/internal/state/clarify_transition.go +165 -0
  97. package/engine/internal/state/clarify_transition_test.go +130 -0
  98. package/engine/internal/state/cmd/workflowmanifest/main.go +12 -8
  99. package/engine/internal/state/cursor.go +58 -0
  100. package/engine/internal/state/cursor_test.go +42 -1
  101. package/engine/internal/state/feature.go +35 -48
  102. package/engine/internal/state/schema.go +90 -37
  103. package/engine/internal/state/snapshot.go +18 -2
  104. package/engine/internal/state/state_test.go +187 -7
  105. package/engine/internal/state/status.go +48 -11
  106. package/engine/internal/state/workflow_manifest.json +231 -50
  107. package/engine/internal/toolpolicy/classifier.go +533 -0
  108. package/engine/internal/toolpolicy/classifier_test.go +424 -0
  109. package/engine/internal/toolpolicy/git.go +616 -0
  110. package/engine/internal/toolpolicy/scanner.go +382 -0
  111. package/engine/main.go +160 -77
  112. package/engine/observability_cli_test.go +52 -0
  113. package/engine/root_routing_test.go +277 -0
  114. package/engine/testdata/golden/TestParityBuildReadiness/arg=approved.golden +1 -1
  115. package/engine/testdata/golden/TestParityBuildReadiness/arg=emptystatus.golden +1 -1
  116. package/engine/testdata/golden/TestParityBuildReadiness/arg=noclarify.golden +1 -0
  117. package/engine/testdata/golden/TestParityBuildReadiness/arg=novet.golden +1 -0
  118. package/engine/testdata/golden/TestParityBuildReadiness/arg=stalevet.golden +1 -0
  119. package/engine/testdata/golden/TestParityBuildReadiness/arg=trailhash.golden +1 -1
  120. package/engine/testdata/golden/TestParityBuildReadiness/arg=trailpipe.golden +1 -1
  121. package/engine/testdata/golden/TestParityBuildReadiness/arg=vetnotready.golden +1 -0
  122. package/engine/testdata/golden/TestParityProgress/arg=allbuilt.golden +1 -1
  123. package/engine/testdata/golden/TestParityProgress/arg=done.golden +1 -1
  124. package/engine/testdata/golden/TestParityProgress/arg=mid.golden +1 -1
  125. package/engine/testdata/golden/TestParityProgress/arg=nophase.golden +1 -1
  126. package/engine/testdata/golden/TestParityProgress/arg=noslice.golden +1 -1
  127. package/engine/testdata/golden/TestParityProgress/arg=plan.golden +1 -1
  128. package/engine/testdata/golden/TestParityProgress/arg=seal.golden +1 -1
  129. package/engine/testdata/golden/TestParityReconcile/check-clean.golden +1 -1
  130. package/engine/testdata/golden/TestParityReconcile/inline-fallback.golden +1 -0
  131. package/engine/testdata/golden/TestParityReconcile/snapshot-no-allowlist.golden +1 -0
  132. package/engine/testdata/golden/TestParityWrightScope/devrites-edit-denied.golden +2 -0
  133. package/engine/testdata/golden/TestParityWrightScope/out-of-scope-enforce-denies.golden +1 -1
  134. package/engine/tests/adr_0011_define_plan_test.go +30 -0
  135. package/engine/tests/budget_test.go +19 -8
  136. package/engine/tests/concurrency_cli_test.go +7 -1
  137. package/engine/tests/doctor_cli_test.go +148 -2
  138. package/engine/tests/forge_cli_test.go +463 -0
  139. package/engine/tests/gate_test.go +63 -8
  140. package/engine/tests/hook_test.go +260 -8
  141. package/engine/tests/hooks_io_test.go +94 -3
  142. package/engine/tests/json_contract_test.go +127 -2
  143. package/engine/tests/migrate_cli_test.go +2 -2
  144. package/engine/tests/parity_buildreadiness_test.go +141 -10
  145. package/engine/tests/parity_learnings_test.go +16 -17
  146. package/engine/tests/parity_reconcile_test.go +20 -17
  147. package/engine/tests/parity_resolve_test.go +12 -11
  148. package/engine/tests/parity_test.go +21 -17
  149. package/pack/.claude/agents/devrites-code-reviewer.md +62 -48
  150. package/pack/.claude/agents/devrites-devex-reviewer.md +69 -53
  151. package/pack/.claude/agents/devrites-doubt-reviewer.md +29 -22
  152. package/pack/.claude/agents/devrites-evidence-scout.md +69 -0
  153. package/pack/.claude/agents/devrites-forge-judge.md +74 -61
  154. package/pack/.claude/agents/devrites-frontend-reviewer.md +48 -39
  155. package/pack/.claude/agents/devrites-performance-reviewer.md +49 -40
  156. package/pack/.claude/agents/devrites-plan-drafter.md +71 -0
  157. package/pack/.claude/agents/devrites-plan-reviewer.md +80 -47
  158. package/pack/.claude/agents/devrites-proof-runner.md +74 -0
  159. package/pack/.claude/agents/devrites-retrospector.md +48 -45
  160. package/pack/.claude/agents/devrites-security-auditor.md +46 -36
  161. package/pack/.claude/agents/devrites-simplifier-reviewer.md +50 -46
  162. package/pack/.claude/agents/devrites-slice-wright.md +153 -165
  163. package/pack/.claude/agents/devrites-spec-reviewer.md +34 -32
  164. package/pack/.claude/agents/devrites-strategy-reviewer.md +63 -34
  165. package/pack/.claude/agents/devrites-test-analyst.md +40 -30
  166. package/pack/.claude/settings.json +2 -1
  167. package/pack/.claude/skills/devrites-audit/SKILL.md +40 -61
  168. package/pack/.claude/skills/devrites-debug-recovery/SKILL.md +24 -13
  169. package/pack/.claude/skills/devrites-debug-recovery/reference/build-the-loop.md +24 -21
  170. package/pack/.claude/skills/devrites-debug-recovery/reference/cleanup-and-classify.md +34 -6
  171. package/pack/.claude/skills/devrites-debug-recovery/reference/instrumentation.md +2 -2
  172. package/pack/.claude/skills/devrites-doubt/SKILL.md +25 -17
  173. package/pack/.claude/skills/devrites-interview/SKILL.md +53 -52
  174. package/pack/.claude/skills/devrites-lib/SKILL.md +11 -9
  175. package/pack/.claude/skills/devrites-lib/reference/intent-map.md +3 -2
  176. package/pack/.claude/skills/devrites-lib/reference/parallel-dispatch.md +82 -137
  177. package/pack/.claude/skills/devrites-lib/reference/reply-contract.md +8 -1
  178. package/pack/.claude/skills/devrites-lib/reference/standards/README.md +38 -55
  179. package/pack/.claude/skills/devrites-lib/reference/standards/afk-hitl.md +53 -27
  180. package/pack/.claude/skills/devrites-lib/reference/standards/agents.md +198 -190
  181. package/pack/.claude/skills/devrites-lib/reference/standards/anti-patterns.md +5 -15
  182. package/pack/.claude/skills/devrites-lib/reference/standards/ci-cd.md +27 -58
  183. package/pack/.claude/skills/devrites-lib/reference/standards/code-review.md +16 -52
  184. package/pack/.claude/skills/devrites-lib/reference/standards/coding-style.md +2 -10
  185. package/pack/.claude/skills/devrites-lib/reference/standards/context-hygiene.md +18 -61
  186. package/pack/.claude/skills/devrites-lib/reference/standards/core.md +23 -18
  187. package/pack/.claude/skills/devrites-lib/reference/standards/deprecation.md +17 -57
  188. package/pack/.claude/skills/devrites-lib/reference/standards/development-workflow.md +4 -33
  189. package/pack/.claude/skills/devrites-lib/reference/standards/git-workflow.md +4 -20
  190. package/pack/.claude/skills/devrites-lib/reference/standards/hooks.md +3 -14
  191. package/pack/.claude/skills/devrites-lib/reference/standards/patterns.md +9 -25
  192. package/pack/.claude/skills/devrites-lib/reference/standards/performance.md +0 -9
  193. package/pack/.claude/skills/devrites-lib/reference/standards/principles.md +1 -3
  194. package/pack/.claude/skills/devrites-lib/reference/standards/security.md +17 -7
  195. package/pack/.claude/skills/devrites-lib/reference/standards/testing.md +1 -27
  196. package/pack/.claude/skills/devrites-lib/reference/standards/tooling.md +46 -50
  197. package/pack/.claude/skills/devrites-lib/reference/workspace-artifact-schema.md +23 -10
  198. package/pack/.claude/skills/devrites-source-driven/SKILL.md +23 -22
  199. package/pack/.claude/skills/rite/SKILL.md +8 -6
  200. package/pack/.claude/skills/rite/reference/menu.md +8 -6
  201. package/pack/.claude/skills/rite-adopt/SKILL.md +33 -37
  202. package/pack/.claude/skills/rite-autocomplete/SKILL.md +33 -28
  203. package/pack/.claude/skills/rite-autocomplete/reference/loop.md +21 -21
  204. package/pack/.claude/skills/rite-autocomplete/reference/stop-conditions.md +15 -6
  205. package/pack/.claude/skills/rite-build/SKILL.md +35 -30
  206. package/pack/.claude/skills/rite-build/reference/afk-discipline.md +38 -38
  207. package/pack/.claude/skills/rite-build/reference/evidence-standard.md +10 -0
  208. package/pack/.claude/skills/rite-build/reference/forge.md +186 -156
  209. package/pack/.claude/skills/rite-build/reference/one-slice-cycle.md +4 -3
  210. package/pack/.claude/skills/rite-build/reference/phase-contract.md +96 -175
  211. package/pack/.claude/skills/rite-build/reference/wright-dispatch.md +129 -134
  212. package/pack/.claude/skills/rite-clarify/SKILL.md +89 -0
  213. package/pack/.claude/skills/rite-clarify/reference/decision-coverage.md +59 -0
  214. package/pack/.claude/skills/rite-converge/SKILL.md +35 -25
  215. package/pack/.claude/skills/rite-define/SKILL.md +57 -32
  216. package/pack/.claude/skills/rite-define/reference/gates.md +16 -15
  217. package/pack/.claude/skills/rite-define/reference/plan-template.md +16 -8
  218. package/pack/.claude/skills/rite-frame/reference/failure-modes.md +22 -24
  219. package/pack/.claude/skills/rite-plan/SKILL.md +44 -16
  220. package/pack/.claude/skills/rite-plan/reference/task-breakdown.md +4 -0
  221. package/pack/.claude/skills/rite-polish/SKILL.md +27 -23
  222. package/pack/.claude/skills/rite-prototype/SKILL.md +25 -26
  223. package/pack/.claude/skills/rite-prove/SKILL.md +27 -17
  224. package/pack/.claude/skills/rite-resolve/SKILL.md +12 -11
  225. package/pack/.claude/skills/rite-resolve/reference/answer-protocol.md +3 -0
  226. package/pack/.claude/skills/rite-review/SKILL.md +37 -28
  227. package/pack/.claude/skills/rite-seal/reference/phase-contract.md +27 -92
  228. package/pack/.claude/skills/rite-seal/reference/risk-and-rollback.md +13 -0
  229. package/pack/.claude/skills/rite-ship/reference/design-memory.md +31 -36
  230. package/pack/.claude/skills/rite-spec/SKILL.md +84 -135
  231. package/pack/.claude/skills/rite-spec/reference/investigation.md +37 -33
  232. package/pack/.claude/skills/rite-spec/reference/question-protocol.md +6 -2
  233. package/pack/.claude/skills/rite-spec/reference/spec-checklists.md +25 -24
  234. package/pack/.claude/skills/rite-spec/reference/spec-template.md +9 -2
  235. package/pack/.claude/skills/rite-spec/reference/state-workspace.md +13 -3
  236. package/pack/.claude/skills/rite-temper/SKILL.md +62 -47
  237. package/pack/.claude/skills/rite-temper/reference/review-dimensions.md +24 -22
  238. package/pack/.claude/skills/rite-vet/SKILL.md +110 -113
  239. package/pack/.claude/skills/rite-vet/reference/artifacts.md +42 -9
  240. package/pack/.claude/skills/rite-vet/reference/review-axes.md +39 -37
  241. package/pack/generated/claude/agents/devrites-code-reviewer.md +62 -48
  242. package/pack/generated/claude/agents/devrites-devex-reviewer.md +69 -53
  243. package/pack/generated/claude/agents/devrites-doubt-reviewer.md +29 -22
  244. package/pack/generated/claude/agents/devrites-evidence-scout.md +69 -0
  245. package/pack/generated/claude/agents/devrites-forge-judge.md +74 -61
  246. package/pack/generated/claude/agents/devrites-frontend-reviewer.md +48 -39
  247. package/pack/generated/claude/agents/devrites-performance-reviewer.md +49 -40
  248. package/pack/generated/claude/agents/devrites-plan-drafter.md +71 -0
  249. package/pack/generated/claude/agents/devrites-plan-reviewer.md +80 -47
  250. package/pack/generated/claude/agents/devrites-proof-runner.md +74 -0
  251. package/pack/generated/claude/agents/devrites-retrospector.md +48 -45
  252. package/pack/generated/claude/agents/devrites-security-auditor.md +46 -36
  253. package/pack/generated/claude/agents/devrites-simplifier-reviewer.md +50 -46
  254. package/pack/generated/claude/agents/devrites-slice-wright.md +153 -165
  255. package/pack/generated/claude/agents/devrites-spec-reviewer.md +34 -32
  256. package/pack/generated/claude/agents/devrites-strategy-reviewer.md +63 -34
  257. package/pack/generated/claude/agents/devrites-test-analyst.md +40 -30
  258. package/pack/generated/claude/settings.json +2 -1
  259. package/pack/generated/claude/skills/devrites-audit/SKILL.md +40 -61
  260. package/pack/generated/claude/skills/devrites-debug-recovery/SKILL.md +24 -13
  261. package/pack/generated/claude/skills/devrites-debug-recovery/reference/build-the-loop.md +24 -21
  262. package/pack/generated/claude/skills/devrites-debug-recovery/reference/cleanup-and-classify.md +34 -6
  263. package/pack/generated/claude/skills/devrites-debug-recovery/reference/instrumentation.md +2 -2
  264. package/pack/generated/claude/skills/devrites-doubt/SKILL.md +25 -17
  265. package/pack/generated/claude/skills/devrites-interview/SKILL.md +53 -52
  266. package/pack/generated/claude/skills/devrites-lib/SKILL.md +11 -9
  267. package/pack/generated/claude/skills/devrites-lib/reference/intent-map.md +3 -2
  268. package/pack/generated/claude/skills/devrites-lib/reference/parallel-dispatch.md +82 -137
  269. package/pack/generated/claude/skills/devrites-lib/reference/reply-contract.md +8 -1
  270. package/pack/generated/claude/skills/devrites-lib/reference/standards/README.md +38 -55
  271. package/pack/generated/claude/skills/devrites-lib/reference/standards/afk-hitl.md +53 -27
  272. package/pack/generated/claude/skills/devrites-lib/reference/standards/agents.md +198 -190
  273. package/pack/generated/claude/skills/devrites-lib/reference/standards/anti-patterns.md +5 -15
  274. package/pack/generated/claude/skills/devrites-lib/reference/standards/ci-cd.md +27 -58
  275. package/pack/generated/claude/skills/devrites-lib/reference/standards/code-review.md +16 -52
  276. package/pack/generated/claude/skills/devrites-lib/reference/standards/coding-style.md +2 -10
  277. package/pack/generated/claude/skills/devrites-lib/reference/standards/context-hygiene.md +18 -61
  278. package/pack/generated/claude/skills/devrites-lib/reference/standards/core.md +23 -18
  279. package/pack/generated/claude/skills/devrites-lib/reference/standards/deprecation.md +17 -57
  280. package/pack/generated/claude/skills/devrites-lib/reference/standards/development-workflow.md +4 -33
  281. package/pack/generated/claude/skills/devrites-lib/reference/standards/git-workflow.md +4 -20
  282. package/pack/generated/claude/skills/devrites-lib/reference/standards/hooks.md +3 -14
  283. package/pack/generated/claude/skills/devrites-lib/reference/standards/patterns.md +9 -25
  284. package/pack/generated/claude/skills/devrites-lib/reference/standards/performance.md +0 -9
  285. package/pack/generated/claude/skills/devrites-lib/reference/standards/principles.md +1 -3
  286. package/pack/generated/claude/skills/devrites-lib/reference/standards/security.md +17 -7
  287. package/pack/generated/claude/skills/devrites-lib/reference/standards/testing.md +1 -27
  288. package/pack/generated/claude/skills/devrites-lib/reference/standards/tooling.md +46 -50
  289. package/pack/generated/claude/skills/devrites-lib/reference/workspace-artifact-schema.md +23 -10
  290. package/pack/generated/claude/skills/devrites-source-driven/SKILL.md +23 -22
  291. package/pack/generated/claude/skills/rite/SKILL.md +8 -6
  292. package/pack/generated/claude/skills/rite/reference/menu.md +8 -6
  293. package/pack/generated/claude/skills/rite-adopt/SKILL.md +33 -37
  294. package/pack/generated/claude/skills/rite-autocomplete/SKILL.md +33 -28
  295. package/pack/generated/claude/skills/rite-autocomplete/reference/loop.md +21 -21
  296. package/pack/generated/claude/skills/rite-autocomplete/reference/stop-conditions.md +15 -6
  297. package/pack/generated/claude/skills/rite-build/SKILL.md +35 -30
  298. package/pack/generated/claude/skills/rite-build/reference/afk-discipline.md +38 -38
  299. package/pack/generated/claude/skills/rite-build/reference/evidence-standard.md +10 -0
  300. package/pack/generated/claude/skills/rite-build/reference/forge.md +186 -156
  301. package/pack/generated/claude/skills/rite-build/reference/one-slice-cycle.md +4 -3
  302. package/pack/generated/claude/skills/rite-build/reference/phase-contract.md +96 -175
  303. package/pack/generated/claude/skills/rite-build/reference/wright-dispatch.md +129 -134
  304. package/pack/generated/claude/skills/rite-clarify/SKILL.md +89 -0
  305. package/pack/generated/claude/skills/rite-clarify/reference/decision-coverage.md +59 -0
  306. package/pack/generated/claude/skills/rite-converge/SKILL.md +35 -25
  307. package/pack/generated/claude/skills/rite-define/SKILL.md +57 -32
  308. package/pack/generated/claude/skills/rite-define/reference/gates.md +16 -15
  309. package/pack/generated/claude/skills/rite-define/reference/plan-template.md +16 -8
  310. package/pack/generated/claude/skills/rite-frame/reference/failure-modes.md +22 -24
  311. package/pack/generated/claude/skills/rite-plan/SKILL.md +44 -16
  312. package/pack/generated/claude/skills/rite-plan/reference/task-breakdown.md +4 -0
  313. package/pack/generated/claude/skills/rite-polish/SKILL.md +27 -23
  314. package/pack/generated/claude/skills/rite-prototype/SKILL.md +25 -26
  315. package/pack/generated/claude/skills/rite-prove/SKILL.md +27 -17
  316. package/pack/generated/claude/skills/rite-resolve/SKILL.md +12 -11
  317. package/pack/generated/claude/skills/rite-resolve/reference/answer-protocol.md +3 -0
  318. package/pack/generated/claude/skills/rite-review/SKILL.md +37 -28
  319. package/pack/generated/claude/skills/rite-seal/reference/phase-contract.md +27 -92
  320. package/pack/generated/claude/skills/rite-seal/reference/risk-and-rollback.md +13 -0
  321. package/pack/generated/claude/skills/rite-ship/reference/design-memory.md +31 -36
  322. package/pack/generated/claude/skills/rite-spec/SKILL.md +84 -135
  323. package/pack/generated/claude/skills/rite-spec/reference/investigation.md +37 -33
  324. package/pack/generated/claude/skills/rite-spec/reference/question-protocol.md +6 -2
  325. package/pack/generated/claude/skills/rite-spec/reference/spec-checklists.md +25 -24
  326. package/pack/generated/claude/skills/rite-spec/reference/spec-template.md +9 -2
  327. package/pack/generated/claude/skills/rite-spec/reference/state-workspace.md +13 -3
  328. package/pack/generated/claude/skills/rite-temper/SKILL.md +62 -47
  329. package/pack/generated/claude/skills/rite-temper/reference/review-dimensions.md +24 -22
  330. package/pack/generated/claude/skills/rite-vet/SKILL.md +110 -113
  331. package/pack/generated/claude/skills/rite-vet/reference/artifacts.md +42 -9
  332. package/pack/generated/claude/skills/rite-vet/reference/review-axes.md +39 -37
  333. package/pack/generated/codex/AGENTS.md +5 -2
  334. package/pack/generated/codex/agents/devrites-code-reviewer.toml +69 -47
  335. package/pack/generated/codex/agents/devrites-devex-reviewer.toml +75 -51
  336. package/pack/generated/codex/agents/devrites-doubt-reviewer.toml +35 -20
  337. package/pack/generated/codex/agents/devrites-evidence-scout.toml +75 -0
  338. package/pack/generated/codex/agents/devrites-forge-judge.toml +80 -59
  339. package/pack/generated/codex/agents/devrites-frontend-reviewer.toml +54 -37
  340. package/pack/generated/codex/agents/devrites-performance-reviewer.toml +55 -38
  341. package/pack/generated/codex/agents/devrites-plan-drafter.toml +77 -0
  342. package/pack/generated/codex/agents/devrites-plan-reviewer.toml +82 -47
  343. package/pack/generated/codex/agents/devrites-proof-runner.toml +80 -0
  344. package/pack/generated/codex/agents/devrites-retrospector.toml +54 -43
  345. package/pack/generated/codex/agents/devrites-security-auditor.toml +53 -35
  346. package/pack/generated/codex/agents/devrites-simplifier-reviewer.toml +56 -44
  347. package/pack/generated/codex/agents/devrites-slice-wright.toml +159 -163
  348. package/pack/generated/codex/agents/devrites-spec-reviewer.toml +40 -30
  349. package/pack/generated/codex/agents/devrites-strategy-reviewer.toml +65 -34
  350. package/pack/generated/codex/agents/devrites-test-analyst.toml +46 -28
  351. package/pack/generated/codex/hooks.json +4 -14
  352. package/pack/generated/codex/skills/devrites-api-interface/SKILL.md +7 -3
  353. package/pack/generated/codex/skills/devrites-audit/SKILL.md +47 -64
  354. package/pack/generated/codex/skills/devrites-browser-proof/SKILL.md +7 -3
  355. package/pack/generated/codex/skills/devrites-debug-recovery/SKILL.md +31 -16
  356. package/pack/generated/codex/skills/devrites-debug-recovery/reference/build-the-loop.md +24 -21
  357. package/pack/generated/codex/skills/devrites-debug-recovery/reference/cleanup-and-classify.md +34 -6
  358. package/pack/generated/codex/skills/devrites-debug-recovery/reference/instrumentation.md +2 -2
  359. package/pack/generated/codex/skills/devrites-doubt/SKILL.md +32 -20
  360. package/pack/generated/codex/skills/devrites-frontend-craft/SKILL.md +7 -3
  361. package/pack/generated/codex/skills/devrites-interview/SKILL.md +60 -55
  362. package/pack/generated/codex/skills/devrites-lib/SKILL.md +18 -12
  363. package/pack/generated/codex/skills/devrites-lib/reference/intent-map.md +3 -2
  364. package/pack/generated/codex/skills/devrites-lib/reference/parallel-dispatch.md +82 -137
  365. package/pack/generated/codex/skills/devrites-lib/reference/reply-contract.md +8 -1
  366. package/pack/generated/codex/skills/devrites-lib/reference/standards/README.md +38 -55
  367. package/pack/generated/codex/skills/devrites-lib/reference/standards/afk-hitl.md +53 -27
  368. package/pack/generated/codex/skills/devrites-lib/reference/standards/agents.md +198 -190
  369. package/pack/generated/codex/skills/devrites-lib/reference/standards/anti-patterns.md +5 -15
  370. package/pack/generated/codex/skills/devrites-lib/reference/standards/ci-cd.md +27 -58
  371. package/pack/generated/codex/skills/devrites-lib/reference/standards/code-review.md +16 -52
  372. package/pack/generated/codex/skills/devrites-lib/reference/standards/coding-style.md +2 -10
  373. package/pack/generated/codex/skills/devrites-lib/reference/standards/context-hygiene.md +18 -61
  374. package/pack/generated/codex/skills/devrites-lib/reference/standards/core.md +23 -18
  375. package/pack/generated/codex/skills/devrites-lib/reference/standards/deprecation.md +17 -57
  376. package/pack/generated/codex/skills/devrites-lib/reference/standards/development-workflow.md +4 -33
  377. package/pack/generated/codex/skills/devrites-lib/reference/standards/git-workflow.md +4 -20
  378. package/pack/generated/codex/skills/devrites-lib/reference/standards/hooks.md +3 -14
  379. package/pack/generated/codex/skills/devrites-lib/reference/standards/patterns.md +9 -25
  380. package/pack/generated/codex/skills/devrites-lib/reference/standards/performance.md +0 -9
  381. package/pack/generated/codex/skills/devrites-lib/reference/standards/principles.md +1 -3
  382. package/pack/generated/codex/skills/devrites-lib/reference/standards/security.md +17 -7
  383. package/pack/generated/codex/skills/devrites-lib/reference/standards/testing.md +1 -27
  384. package/pack/generated/codex/skills/devrites-lib/reference/standards/tooling.md +46 -50
  385. package/pack/generated/codex/skills/devrites-lib/reference/workspace-artifact-schema.md +23 -10
  386. package/pack/generated/codex/skills/devrites-prose-craft/SKILL.md +7 -3
  387. package/pack/generated/codex/skills/devrites-refresh-indexes/SKILL.md +7 -3
  388. package/pack/generated/codex/skills/devrites-source-driven/SKILL.md +29 -24
  389. package/pack/generated/codex/skills/devrites-ux-shape/SKILL.md +7 -3
  390. package/pack/generated/codex/skills/rite/SKILL.md +19 -13
  391. package/pack/generated/codex/skills/rite/reference/menu.md +8 -6
  392. package/pack/generated/codex/skills/rite-adopt/SKILL.md +40 -40
  393. package/pack/generated/codex/skills/rite-autocomplete/SKILL.md +40 -31
  394. package/pack/generated/codex/skills/rite-autocomplete/reference/loop.md +21 -21
  395. package/pack/generated/codex/skills/rite-autocomplete/reference/stop-conditions.md +15 -6
  396. package/pack/generated/codex/skills/rite-build/SKILL.md +42 -33
  397. package/pack/generated/codex/skills/rite-build/reference/afk-discipline.md +38 -38
  398. package/pack/generated/codex/skills/rite-build/reference/evidence-standard.md +10 -0
  399. package/pack/generated/codex/skills/rite-build/reference/forge.md +186 -156
  400. package/pack/generated/codex/skills/rite-build/reference/one-slice-cycle.md +4 -3
  401. package/pack/generated/codex/skills/rite-build/reference/phase-contract.md +96 -175
  402. package/pack/generated/codex/skills/rite-build/reference/wright-dispatch.md +129 -134
  403. package/pack/generated/codex/skills/rite-clarify/SKILL.md +105 -0
  404. package/pack/generated/codex/skills/rite-clarify/reference/decision-coverage.md +59 -0
  405. package/pack/generated/codex/skills/rite-converge/SKILL.md +42 -28
  406. package/pack/generated/codex/skills/rite-customize/SKILL.md +7 -3
  407. package/pack/generated/codex/skills/rite-define/SKILL.md +64 -35
  408. package/pack/generated/codex/skills/rite-define/reference/gates.md +16 -15
  409. package/pack/generated/codex/skills/rite-define/reference/plan-template.md +16 -8
  410. package/pack/generated/codex/skills/rite-doctor/SKILL.md +7 -3
  411. package/pack/generated/codex/skills/rite-dogfood/SKILL.md +7 -3
  412. package/pack/generated/codex/skills/rite-explain/SKILL.md +7 -3
  413. package/pack/generated/codex/skills/rite-frame/SKILL.md +7 -3
  414. package/pack/generated/codex/skills/rite-frame/reference/failure-modes.md +22 -24
  415. package/pack/generated/codex/skills/rite-handoff/SKILL.md +7 -3
  416. package/pack/generated/codex/skills/rite-learn/SKILL.md +7 -3
  417. package/pack/generated/codex/skills/rite-plan/SKILL.md +51 -19
  418. package/pack/generated/codex/skills/rite-plan/reference/task-breakdown.md +5 -1
  419. package/pack/generated/codex/skills/rite-polish/SKILL.md +34 -26
  420. package/pack/generated/codex/skills/rite-pov/SKILL.md +7 -3
  421. package/pack/generated/codex/skills/rite-pr-feedback/SKILL.md +7 -3
  422. package/pack/generated/codex/skills/rite-pressure-test/SKILL.md +7 -3
  423. package/pack/generated/codex/skills/rite-prototype/SKILL.md +32 -29
  424. package/pack/generated/codex/skills/rite-prove/SKILL.md +34 -20
  425. package/pack/generated/codex/skills/rite-quick/SKILL.md +7 -3
  426. package/pack/generated/codex/skills/rite-resolve/SKILL.md +19 -14
  427. package/pack/generated/codex/skills/rite-resolve/reference/answer-protocol.md +3 -0
  428. package/pack/generated/codex/skills/rite-review/SKILL.md +44 -31
  429. package/pack/generated/codex/skills/rite-seal/SKILL.md +7 -3
  430. package/pack/generated/codex/skills/rite-seal/reference/phase-contract.md +27 -92
  431. package/pack/generated/codex/skills/rite-seal/reference/risk-and-rollback.md +13 -0
  432. package/pack/generated/codex/skills/rite-ship/SKILL.md +7 -3
  433. package/pack/generated/codex/skills/rite-ship/reference/design-memory.md +31 -36
  434. package/pack/generated/codex/skills/rite-spec/SKILL.md +91 -138
  435. package/pack/generated/codex/skills/rite-spec/reference/investigation.md +37 -33
  436. package/pack/generated/codex/skills/rite-spec/reference/question-protocol.md +6 -2
  437. package/pack/generated/codex/skills/rite-spec/reference/spec-checklists.md +25 -24
  438. package/pack/generated/codex/skills/rite-spec/reference/spec-template.md +9 -2
  439. package/pack/generated/codex/skills/rite-spec/reference/state-workspace.md +13 -3
  440. package/pack/generated/codex/skills/rite-status/SKILL.md +7 -3
  441. package/pack/generated/codex/skills/rite-temper/SKILL.md +69 -50
  442. package/pack/generated/codex/skills/rite-temper/reference/review-dimensions.md +24 -22
  443. package/pack/generated/codex/skills/rite-vet/SKILL.md +117 -116
  444. package/pack/generated/codex/skills/rite-vet/reference/artifacts.md +42 -9
  445. package/pack/generated/codex/skills/rite-vet/reference/review-axes.md +40 -38
  446. package/pack/generated/codex/skills/rite-zoom-out/SKILL.md +7 -3
  447. package/package.json +1 -1
  448. package/scripts/build-release-tarball.sh +32 -15
  449. package/scripts/check-authority-drift.py +125 -0
  450. package/scripts/check-instruction-size-baseline.mjs +19 -11
  451. package/scripts/check-invocation-integrity.py +2 -0
  452. package/scripts/codex-generate.sh +69 -33
  453. package/scripts/grade-feature.sh +121 -40
  454. package/scripts/live-hosts/agent-result.schema.json +230 -0
  455. package/scripts/live-hosts/claude.sh +87 -0
  456. package/scripts/live-hosts/codex.sh +81 -0
  457. package/scripts/live-hosts/common.sh +113 -0
  458. package/scripts/live-hosts/fake-host.py +264 -0
  459. package/scripts/live-hosts/host-transport.py +287 -0
  460. package/scripts/release-check.sh +5 -1
  461. package/scripts/run-agent-contract-evals.py +1380 -0
  462. package/scripts/run-behavioral-evals.sh +24 -30
  463. package/scripts/run-evals.sh +1 -5
  464. package/scripts/run-live-behavioral-evals.py +1274 -144
  465. package/scripts/run-outcome-evals.sh +414 -88
  466. package/scripts/run-tests.mjs +30 -2
  467. package/scripts/skills-inventory.mjs +1 -1
  468. package/scripts/validate-workflow-security.py +39 -20
  469. package/scripts/validate-workspace-schema.py +362 -10
  470. package/scripts/validate.sh +21 -15
  471. package/engine/testdata/golden/TestParityWrightScope/devrites-edit-allowed.golden +0 -1
  472. /package/engine/testdata/golden/{TestParityReconcile/check-no-claimed.golden → TestParityBuildReadiness/arg=clarifyopen.golden} +0 -0
@@ -2,216 +2,137 @@
2
2
 
3
3
  See also [`one-slice-cycle.md`](one-slice-cycle.md).
4
4
 
5
- ## Execution spine
6
-
7
- Run the engine gates at these moments:
8
-
9
- ```bash
10
- devrites-engine preamble
11
- devrites-engine snapshot
12
- devrites-engine build-readiness; echo "readiness rc=$?"
13
-
14
- devrites-engine reconcile snapshot
15
- devrites-engine stuck log "$(cat .devrites/ACTIVE 2>/dev/null)" dispatch "<slice id>"
16
-
17
- devrites-engine footprint log <slug> doubt "<decision id>"
18
-
19
- devrites-engine reconcile check; echo "reconcile rc=$?"
20
- devrites-engine test-integrity; echo "test-integrity rc=$?"
21
- devrites-engine package-existence; echo "package-existence rc=$?"
22
-
23
- devrites-engine conventions contradict --key <key> --slug <slug> \
24
- --evidence "<what the live code does>" --drift-file .devrites/work/<slug>/drift.md
25
- devrites-engine footprint log <slug> wright "<slice id>"
26
- devrites-engine tick-afk <state.md path>
27
-
28
- devrites-engine progress
29
- ```
30
-
31
- Conditional calls still obey the detailed rules below: doubt logging runs for
32
- each stood decision; convention contradiction runs only when the wright reports
33
- or exposes a contradiction; `tick-afk` runs only under AFK; forge follows
34
- [`forge.md`](forge.md) and still returns to the same doubt, record, and stop
35
- gates.
36
-
37
- > **Running the gate helpers.** Each gated `bash` block calls the installed engine
38
- > directly: `devrites-engine <command> [args]`. It **propagates its exit code**,
39
- > so the `rc=$?` checks below still hold; host hooks fail open when the binary is absent,
40
- > but phase gates should treat a missing engine as a setup problem.
41
-
42
- 0. **Rules + AFK + readiness check.** Read `.agents/skills/devrites-lib/reference/standards/core.md` first. Then **run the
43
- shared orientation preamble**. It prints `state.md`, the artifacts present, the run
44
- mode (HITL/AFK), and the open-question tally by gate, deterministically:
5
+ 0. **Rules + AFK + readiness check.** Read
6
+ `.agents/skills/devrites-lib/reference/standards/core.md`, then orient and run the
7
+ deterministic readiness gate:
45
8
  ```bash
46
9
  devrites-engine preamble
47
10
  devrites-engine snapshot
48
11
  ```
49
- Treat the snapshot as the canonical machine-readable status; if you need to tell the
50
- user the next command, use `nextCommands.claude` in Claude Code or `nextCommands.codex`
51
- in Codex. Then **run the readiness gate**. It enforces the step-0 stop conditions by exit code,
52
- not by memory:
12
+ Treat the snapshot as canonical machine-readable status and use its host-specific
13
+ `nextCommands` value:
53
14
  ```bash
54
15
  devrites-engine build-readiness; echo "readiness rc=$?"
55
16
  ```
56
- A non-zero `rc` is a hard STOP: `2` → `$rite-define` (plan not approved), `3` →
57
- `$rite-resolve` (awaiting human), `4` → `$rite-plan` (blocked). The prose below is the
58
- same gate for installs without the script.
59
- Orient from its digest. If `Status == awaiting_human` **STOP**, tell the user to run
60
- `$rite-resolve <qid> "<answer>"`. If `state.md` has no `Plan approved: <iso>` field
61
- **STOP**, tell the user the plan isn't approved yet (`$rite-define` writes it when
62
- the human confirms). If `.devrites/AFK` is present, re-derive the remaining AFK budget
63
- from `state.md`'s `AFK slices remaining: <n>` field (initialized from `.devrites/AFK`
64
- `max_slices` on the first AFK build); if it is `0` → **STOP** (forced HITL stop; raise
65
- the count in `state.md` or remove the sentinel to continue). See
66
- [`afk-discipline.md`](afk-discipline.md).
67
- 1. Read `spec.md`, `plan.md`, `tasks.md`, `assumptions.md`, `drift.md`, and `test-plan.md`
17
+ Any non-zero result is a hard STOP at the gate's reported route; `6` → `$rite-clarify`
18
+ and `7` → `$rite-vet`. Under AFK, also
19
+ enforce the mutable `state.md` budget from
20
+ [`afk-discipline.md`](afk-discipline.md); zero remaining slices forces a HITL stop.
21
+ 1. Read `spec.md`, `decision-coverage.md`, `plan.md`, `tasks.md`, `assumptions.md`,
22
+ `drift.md`, `eng-review.md`, and `test-plan.md`
68
23
  if present (the vetted coverage target from `$rite-vet`: the slice's tests come from
69
24
  here when it exists). `state.md` and the open-`questions.md` tally are already in the
70
25
  preamble digest from step 0: re-read `questions.md` only for the full text of a flagged
71
26
  blocking question.
72
- If a **blocking `[NEEDS CLARIFICATION]`** remains or the spec/plan readiness gates
73
- don't pass, stop → `$rite-spec` (to resolve) or `$rite-plan` (to repair). Don't build
74
- on an unresolved spec.
27
+ Require `Decision coverage: CLEAR` and `Implementation readiness: READY`. If a
28
+ **blocking `[NEEDS CLARIFICATION]`** or uncovered decision remains, stop
29
+ `$rite-clarify`; if plan readiness does not pass, stop → `$rite-plan` or `$rite-vet`
30
+ as classified by the gate. Don't build on an unresolved spec or unvetted plan.
75
31
  2. Select the next pending slice (or the one in `$ARGUMENTS`). **Restate its goal,
76
32
  acceptance criteria, and scope boundary** in one short block. Confirm it's still the
77
33
  right next slice. Write the slice's `Mode` to `state.md` as `Slice mode: <HITL|AFK>` on
78
- **every** selection (not only on the HITL pause path); `$rite-resolve` clears or updates
34
+ **every** selection, including the non-HITL path; `$rite-resolve` clears or updates
79
35
  it on resume.
80
- 2a. **HITL gate (pre-action pause).** Read the slice's `Mode`. If `HITL`, surface the
81
- checkpoint as a ranked **option set** and resolve it **before** any code lands, per
82
- [`checkpoint-protocol.md`](checkpoint-protocol.md). Branch on whether
83
- a human is here:
84
- - **Human present (interactive: no `.devrites/AFK`) ask inline via `AskUserQuestion`.**
85
- This is the default for an interactive build. Render 2-4 options, the recommended one
86
- **first and labelled `(Recommended)`**, each with its dimension-tagged rationale + the
87
- trade-off it accepts, plus the `Something else — I'll describe it` escape hatch. The
88
- human picks; record the pick to `questions.md` (`answered`) + `decisions.md` (through the
89
- `devrites-engine resolve` writer), clear the gate, and **continue to step 3 in place**: do **not**
90
- STOP, do **not** route through `$rite-resolve`.
91
- - **Human absent / AFK (`.devrites/AFK` present) auto-pick or persist + STOP.** For a gate
92
- in `allow_gates`, auto-pick the recommended option (option 1) and proceed; otherwise
93
- append the `questions.md` entry, write the `Awaiting human` block to `state.md`, set
94
- `Status: awaiting_human`, fire the `notify:` hook, then **STOP**: resume when the user
95
- runs `$rite-resolve <qid> "<answer>"`. `blocking` / `escalating` / irreversible-risk gates
96
- always take this stop path, never the AFK auto-pick.
97
- 3. **Snapshot the tree, then dispatch the build core to `devrites-slice-wright`:** one `Task`
98
- call, fresh context. **First**, capture the pre-dispatch tree so the reconcile gate (step 6)
99
- can prove you never touched source: run this immediately before the `Task` call:
100
- ```bash
101
- devrites-engine reconcile snapshot
102
- ```
103
- Then log the dispatch so the stuck-loop detector can catch a slice that keeps being
104
- re-dispatched without progress (it pauses the build even under AFK):
105
- ```bash
106
- devrites-engine stuck log "$(cat .devrites/ACTIVE 2>/dev/null)" dispatch "<slice id>"
107
- ```
108
- **Forge branch: only if the selected slice is `Forge: yes`.** Instead of the single dispatch
109
- below, run the competitive build per [`forge.md`](forge.md): K=2-3 candidate
110
- wrights, each in an **isolated git worktree** on the distinct strategy `$rite-vet` named, then a
111
- fresh-context [`devrites-forge-judge`](.codex/agents/devrites-forge-judge.toml) scores them against
112
- acceptance + `test-plan.md` + `.devrites/principles.md` + the anti-slop charter, and you land
113
- exactly **one** winner's diff in the working tree, graft any cheap runner-up improvement by
114
- continuing the winning wright once, and write `forge-report.md`. Forge returns the **same shape**
115
- a single wright does (one structured artifact, for the winner), so steps 4-7 (doubt, fail-on-red,
116
- reconcile against the winner's claimed set, record, stop) run **unchanged**. If you cannot give
117
- the judge an objective scorecard (the slice lacks acceptance / `test-plan.md` coverage) or cannot
118
- name two genuinely different strategies, the flag is stale: clear it and build single-path. The
119
- single-writer invariant is intact: each candidate owns its own tree, exactly one author's diff
120
- lands. Then **stop** here for this slice; the steps below are the default single-path dispatch.
121
-
122
- Then assemble the slice contract and send it per
123
- [`wright-dispatch.md`](wright-dispatch.md): the slice goal, acceptance
124
- criteria, and **scope boundary**; the paths it may touch (`touched-files.md`); the context
125
- paths to read (`spec.md`, `plan.md`, `decisions.md`, `assumptions.md`, `.devrites/principles.md`
126
- when present (the binding invariants the slice must honor) plus `test-plan.md`
127
- when present (its per-gap test requirements + regression-criticals for this slice are the
128
- coverage the wright must write) and `design-brief.md`
129
- when the slice touches UI per [`frontend-trigger.md`](frontend-trigger.md)); and the
130
- `.agents/skills/devrites-lib/reference/standards/` files in scope. The wright **orients** on the project's idiom (using a
131
- code-intelligence index **if available** (`codebase-memory-mcp` first, cross-checked with
132
- `codegraph` (`.codegraph/` / `codegraph_*`) + `graphify` (`graphify-out/`), else standard
133
- methods (LSP / `Read`/`Grep`/`Glob`); see `.agents/skills/devrites-lib/reference/standards/tooling.md`) for
134
- placement/callers/impact), writes the **failing test first** when
135
- behaviour changes ([`tdd.md`](tdd.md)), implements the **smallest complete** version in
136
- the project's style (applying `devrites-frontend-craft` to `design-brief.md` for UI, and
137
- `devrites-source-driven` (with context7 if available) for uncertain framework facts), runs the slice's **targeted tests**
138
- (plus typecheck / lint / build where the project has them), and returns a structured artifact
139
- : **code + tests only; it does not write the workspace files.** If the slice is UI but no `design-brief.md` exists (e.g. a spec written before
140
- shaping), shape it via `devrites-ux-shape` before the wright codes. If the `Task` tool is
141
- unavailable, run the wright's discipline **inline** as a flagged fallback (see the reference).
142
- Same one-slice cycle, no isolation; in that case write
143
- `.devrites/work/<slug>/.reconcile-inline` so the reconcile gate skips (you are legitimately
144
- the writer in this fallback).
145
- 4. **Doubt the decisions it stood up.** For each entry in the wright's `Decisions stood`
146
- (branching, boundary crossing, data model, auth, public API, migration, user-flow change,
147
- "this is safe/scales") apply `devrites-doubt` **before accepting the slice**: the writer
148
- doesn't grade its own decisions. Each `devrites-doubt` invocation **dispatches the
149
- `devrites-doubt-reviewer` subagent** (doing the adversarial pass inline is the writer grading
150
- itself: the thing this step exists to forbid). **Completion criterion (checkable):** step 4
151
- is done only when **every** `Decisions stood` entry carries a recorded `devrites-doubt`
152
- verdict (`accept`, or `reject` + the required changes) in `decisions.md` (accepted
153
- trade-offs) / `questions.md` (open gates). A `Decisions stood` entry with **no verdict on
154
- record** means doubt did not run for it: **do not enter step 5 and do not mark the slice
155
- `built`.** Log each dispatch so the seal can prove doubt ran (the footprint already counts a
156
- `doubt` kind):
36
+ 2a. **HITL gate (pre-action pause).** Resolve any `HITL` slice checkpoint before code,
37
+ exactly as [`checkpoint-protocol.md`](checkpoint-protocol.md) defines. An interactive
38
+ human answers inline and the build continues in place. AFK may auto-pick only allowed
39
+ gates; otherwise persist the question and awaiting-human cursor, notify, and STOP for
40
+ `$rite-resolve`. Blocking, escalating, and irreversible-risk gates always take that stop path.
41
+ 3. **Authorize exact paths, snapshot, then fresh-context dispatch the build core to
42
+ `devrites-slice-wright`.** First write the root-owned exact project-relative file list to
43
+ `.devrites/work/<slug>/.wright-allowlist`; mirror it in the packet's
44
+ `scope.allowed_repo_writes`. The wright's later `Files changed` report cannot widen it.
45
+ **Forge branch: only for a fully typed `Forge: yes` slice.** Follow
46
+ [`forge.md`](forge.md) sections 1 through 3: require the scorecard, strategies, and
47
+ real `manifest-env-v1` host binding; run `forge plan` before reconciliation; snapshot after a
48
+ planned result; bind, dispatch, record, and extract every candidate; judge the
49
+ immutable deltas; record one winner; and merge it. A typed serial degradation has
50
+ no Forge side effects and uses the default branch below. A later error preserves
51
+ the manifest-owned run for technical recovery; never degrade silently. After merge,
52
+ validate the winner envelope and enter the common return check at the end of this
53
+ step. Do not also dispatch a serial wright.
54
+
55
+ **Default serial branch.** Follow
56
+ [`wright-dispatch.md`](wright-dispatch.md) end to end; it owns snapshot timing, stuck
57
+ logging, the exact packet, conditional skill loading, and return checks. Dispatch through
58
+ named wright → safely enforced generic fresh worker → labelled inline fallback. Inline is
59
+ allowed only when no fresh worker preserves recognized wright identity plus exact allowlist
60
+ enforcement or isolated staging; it never skips reconciliation. Before any canonical
61
+ `.devrites/` mutation, validate the typed result and require a clean immediate
62
+ `devrites-engine reconcile check`; exit `5` rejects the writer result.
63
+ 4. **Doubt every stood decision before accepting the slice.** The writer never grades its
64
+ own decisions: invoke `devrites-doubt` and its fresh reviewer for each entry. Do not enter
65
+ step 5 until every entry has a recorded `accept` or resolved `reject` verdict. Log each dispatch:
157
66
  ```bash
158
67
  devrites-engine footprint log <slug> doubt "<decision id>"
159
68
  ```
160
- The doubt loop honours `.devrites/AFK` (see its AFK exception): findings below the slice's gate ceiling become advisory entries in `questions.md`;
161
- destructive / auth / public-API concerns always pause regardless. A non-empty `Escalation` in
162
- the artifact is handled here too: irreversible-risk / blockers blocking question + set
163
- `Status: awaiting_human`; a scope-changing answer → `$rite-plan repair` (Spec Drift Guard),
164
- never silently into the slice. **If an irreversible-risk item shows up under the wright's
165
- `Decisions stood` rather than `Escalation`**, treat that misclassification as itself a
166
- blocking protocol violation: pause and re-dispatch with the item flagged out-of-bounds, do
167
- **not** doubt-and-accept it. (The wright's return is the not-yet-load-bearing moment (the
168
- slice isn't `built` or merged yet) so this post-return doubt is still pre-commit.)
69
+ Apply Doubt's AFK exception. Irreversible-risk or blocking escalations pause; scope-changing
70
+ answers route through the Spec Drift Guard. An irreversible-risk item misfiled under
71
+ `Decisions stood` is a blocking protocol violation: re-dispatch it as out of bounds,
72
+ never doubt-and-accept it.
169
73
  **Principle check (same standing):** a wright return that breaks a declared principle
170
74
  (reported in its `Principles` field, or that you detect against `.devrites/principles.md`) is
171
75
  handled here like an irreversible-risk item: block, route to a human-approved scoped
172
76
  exception in the register or stop; never doubt-and-accept a principle violation into the slice.
173
- 5. **Fail-on-red.** If the wright's `Gates` were red (targeted tests / types / lint) or it
174
- couldn't verify: do **not** mark the slice `built`, and **do not fix the code yourself**.
175
- First remedy: **continue the same wright once** (`SendMessage` to it, carrying the failing
176
- gate + its real output) so it fixes in its own context. This retry is for **objective
177
- failures only**: red gate / type / lint / missing test coverage / UI browser-proof fail:
178
- never a contested decision (that routes to `$rite-plan repair`). **Still red after the one
179
- retry** → escalate: AFK → append a blocking question to `questions.md` (gate=blocking,
180
- slice's SLA) + set `Status: awaiting_human`; HITL → pause as a blocking gate. Either way,
181
- `Next step: $rite-plan unblock` until resolved.
182
- 6. **Record. You are the canonical writer.** **First, run the reconcile gate (A1):** write the
183
- wright's reported `Files changed` paths (one per line) to
184
- `.devrites/work/<slug>/.reconcile-claimed` (or the active legacy
185
- `.devrites/features/<slug>/` workspace during migration), then:
186
- ```bash
187
- devrites-engine reconcile check; echo "reconcile rc=$?"
188
- ```
189
- **Exit 5 → hard STOP:** a source file changed outside the wright's claimed set: code was
190
- edited by something other than the wright (A1 breach). Revert it and re-dispatch the wright;
191
- do **not** mark the slice `built`.
192
-
193
- **Then run the test-integrity gate (anti-reward-hacking)**: prove the slice didn't reach
194
- green by weakening its tests:
77
+ 5. **Run retained-baseline integrity gates, then recover any objective red.**
195
78
  ```bash
196
79
  devrites-engine test-integrity; echo "test-integrity rc=$?"
80
+ devrites-engine package-existence; echo "package-existence rc=$?"
197
81
  ```
82
+ If the wright's `Gates` were red (targeted tests / types / lint), either integrity gate
83
+ failed, or it
84
+ couldn't verify: do **not** mark the slice `built`, and **do not fix the code yourself**.
85
+ Classify each causal fingerprint through
86
+ [`cleanup-and-classify.md`](../../devrites-debug-recovery/reference/cleanup-and-classify.md),
87
+ run `devrites-engine recovery route <class>`, and follow the `recovery-route/v1`
88
+ owner/action. Only `humanPause: true` or an exact human-only predicate opens a question;
89
+ technical repair, environment stabilization, and proof reruns remain agent-owned.
90
+ For an agent-owned defect route, continue the same wright under
91
+ `devrites-debug-recovery`, carrying command/output, attempt count, and dead ends. Wright
92
+ plus recovery share **three total attempts per root cause** and never
93
+ rerun an unchanged check. Persist the initial and retry failures with
94
+ `devrites-engine recovery record --class <class> "<root cause>" "<exact failure>" <slug>`,
95
+ run `recovery check` before each retry, and
96
+ `recovery clear --class <class> "<root cause>" <slug>` only after green. Before every
97
+ re-dispatch, update the root-owned allowlist only for an accepted in-slice path and run
98
+ `reconcile snapshot`: after a clean check this refreshes canonical-state scope while
99
+ retaining the original source baseline. Repeat reconcile and both integrity gates on every
100
+ return. This owns red
101
+ gates, missing coverage, browser/runtime failures, and workflow-tool defects.
102
+ After recovery:
103
+ - green → continue to record;
104
+ - product-contract/acceptance ambiguity or irreversible risk → open the genuine human gate
105
+ (and use `$rite-plan repair` only when behavior/scope/acceptance changes);
106
+ - human-only access/action → gate with the exact needed input;
107
+ - exhausted objective failure → preserve reproduction/dead ends, set `Status: blocked` and
108
+ `Next step: $rite-plan unblock`, then STOP without a question or `$rite-resolve`.
109
+ 6. **Close the retained baseline, then record. You are the canonical writer.**
110
+ Reconciliation ran immediately on return and the two integrity gates ran in step 5.
198
111
  **Exit 3 → hard STOP:** a test was deleted, skipped, or de-asserted since the slice base: the
199
112
  slice went green by weakening its tests, a Critical protocol violation. Revert the weakening and
200
113
  re-dispatch the wright; do **not** mark the slice `built`.
201
114
 
202
- **Then run the package-existence gate (anti-hallucination)**: every new third-party import must
203
- be declared in a project manifest, not just imported:
204
- ```bash
205
- devrites-engine package-existence; echo "package-existence rc=$?"
206
- ```
115
+ The package-existence gate (anti-hallucination) requires every new third-party import
116
+ to appear in a project manifest:
207
117
  **Exit 3 → STOP:** an imported package is not declared in any manifest (`package.json`, `go.mod`,
208
118
  `requirements.txt`, `pyproject.toml`, `Pipfile`, `Cargo.toml`): the classic shape of a
209
119
  hallucinated or typo-squatted dependency. Confirm the name on the registry and declare it via the
210
120
  package manager, or remove the import; do **not** mark the slice `built`. The gate is deterministic
211
- and fail-open (not a git repo / no manifest / stdlib-only import → rc 0).
121
+ and fail-open (not a git repo / no manifest / stdlib-only import → rc 0). If the nearest
122
+ manifest declares the package, treat the mismatch as a workflow-tool defect under bounded
123
+ recovery, not a plan repair or retry-authorization question. Once every gate and doubt
124
+ verdict is accepted, a forged slice records successful verification and runs
125
+ manifest-only cleanup per [`forge.md`](forge.md). Then close the private window:
126
+ ```bash
127
+ devrites-engine reconcile close
128
+ ```
129
+ Keep it open across a genuine human wait that resumes the same slice; close it before a
130
+ scope/plan transition.
212
131
 
213
132
  Then, from the wright's artifact, update `state.md`,
214
- `evidence.md`, `touched-files.md` (and `browser-evidence.md` for UI). Add a `## Review trail`
133
+ `evidence.md`, `touched-files.md` (and `browser-evidence.md` for UI). For a forged
134
+ slice, write `forge-report.md` after reconciliation, verification, and cleanup;
135
+ it records the run but owns nothing. Add a `## Review trail`
215
136
  to `touched-files.md`: group the slice's important `path:line` stops by concern (design intent,
216
137
  not file order), 1-5 concerns, each stop under 15 words. This is for a later human walkthrough;
217
138
  keep it factual and skip invented rationale. **Persist every
@@ -1,140 +1,135 @@
1
1
  # Slice-wright dispatch
2
2
 
3
- How `$rite-build` hands the **build core** of one slice to `devrites-slice-wright`: the
4
- fresh-context, **write-capable** executor under `.codex/agents/`. Loaded on demand by
5
- `$rite-build`; not a skill itself. Sibling of
6
- [`../../devrites-lib/reference/parallel-dispatch.md`](../../devrites-lib/reference/parallel-dispatch.md)
7
- (the read-only reviewer fan-out): same isolation principle, opposite direction: this one
8
- **writes**.
9
-
10
- Pattern: the orchestrator owns the **gates and the workspace**; the wright owns the **writing**.
11
- Brief it precisely, in a clean context, with only the slice contract, then doubt, record, and
12
- gate its return.
13
-
14
- ## Why a fresh context writes the slice
15
- The orchestrator's window is full of spec investigation, planning, prior slices, and tool
16
- output: the exact "lost-in-the-middle" load that degrades instruction-following and pulls the
17
- model toward generic code. The wright starts clean and sees only the contract, so it holds the
18
- slice boundary strictly and writes to the *project's* idiom instead of drifting. Single-threaded
19
- by design: **one** wright per slice, never a parallel fan-out of writers *sharing a tree*:
20
- concurrent writers on one working tree make conflicting implicit decisions and produce incoherent
21
- code. The one sanctioned exception is a **forge** slice, which competes K candidates in *isolated*
22
- worktrees and lands exactly one: no tree ever has two authors, so the invariant holds (see
23
- [Forge](#forge--competing-candidates-the-deliberate-exception)).
24
-
25
- ## The contract `$rite-build` sends
26
- One `Task` call to `devrites-slice-wright` carrying everything the writer needs and nothing it
27
- doesn't:
3
+ `$rite-build` delegates one settled slice or correction set to
4
+ `devrites-slice-wright`. The root orchestrator owns scope, human questions,
5
+ `.devrites/**`, gates, reconciliation, and routing. The wright is the only source/test
6
+ writer and never invokes another agent.
7
+
8
+ The universal packet, result, budget, await, retry, and host fallback contract is
9
+ [`standards/agents.md`](../../devrites-lib/reference/standards/agents.md). This file adds
10
+ only the source-write lifecycle.
11
+
12
+ ## Prepare and dispatch
13
+
14
+ 1. Derive the smallest exact file allowlist from the selected slice, current code
15
+ placement, and accepted correction set. Entries are normalized project-relative file
16
+ paths: no directories, globs, traversal, symlink escapes, duplicates, or
17
+ `.devrites/**`.
18
+ 2. Write that list, one path per line, to
19
+ `.devrites/work/<slug>/.wright-allowlist` (or the active compatibility workspace).
20
+ The root owns this file; the wright's returned `Files changed` is evidence, never
21
+ authorization. If a necessary unlisted path appears, the wright stops and returns it.
22
+ 3. Create `agent-packet/v1` for `devrites-slice-wright`. Put the identical paths in
23
+ `scope.allowed_repo_writes`; include the slice goal, verbatim acceptance, boundary,
24
+ exact context paths, test-plan targets, and applicable standards. Do not include the
25
+ root's implementation reasoning.
26
+ 4. Immediately before a serial dispatch:
27
+
28
+ ```bash
29
+ devrites-engine reconcile snapshot
30
+ devrites-engine stuck log "$(cat .devrites/ACTIVE 2>/dev/null)" dispatch "<slice id>"
31
+ ```
32
+
33
+ A Forge slice runs `forge plan` first, then takes this same snapshot; see
34
+ [`forge.md`](forge.md). The first snapshot captures the original dirty-tree baseline, private Git objects,
35
+ allowlist, and canonical-state fingerprint. A later snapshot after a clean check
36
+ refreshes only the dispatch boundary; it retains the original slice baseline.
37
+ 5. Fresh-context dispatch the wright through the capability ladder and await its typed
38
+ result. Never run two possible writers in one tree.
39
+
40
+ ## Forge candidate binding
41
+
42
+ [`forge.md`](forge.md) owns the state machine. This file owns the candidate packet:
43
+ use the same project-relative allowlist and slice contract, add only the manifest-recorded
44
+ candidate strategy, and set all five bindings before the first tool call:
45
+
46
+ ```text
47
+ DEVRITES_FORGE_RUN_ID
48
+ DEVRITES_FORGE_CANDIDATE
49
+ DEVRITES_FORGE_WORKER_ID
50
+ DEVRITES_FORGE_WORKER_PID
51
+ DEVRITES_FORGE_PROCESS_START
52
+ ```
53
+
54
+ The candidate cwd must equal its manifest worktree, and the environment is all-or-none.
55
+ Only a real adapter declared as `manifest-env-v1` may supply it. The live PID,
56
+ engine `forge process-token` value, and worker ID must match the prior `forge record ... started`
57
+ transition. A partial or mismatched binding denies the writer; return to the orchestrator
58
+ instead of widening scope. The candidate writes only source/tests in its own tree and
59
+ returns the normal typed artifact.
60
+
61
+ ## Validate the return before accepting it
62
+
63
+ Validate the `agent-result/v1` identity, baseline, budget, payload type, side effects,
64
+ and exact changed-file set. Before the root writes any canonical record, run:
28
65
 
66
+ ```bash
67
+ devrites-engine reconcile check; echo "reconcile rc=$?"
68
+ devrites-engine test-integrity; echo "test-integrity rc=$?"
69
+ devrites-engine package-existence; echo "package-existence rc=$?"
29
70
  ```
30
- Build one slice of the active DevRites feature. You have a clean context — this contract is
31
- the whole job.
32
-
33
- Workspace: .devrites/work/<slug>/
34
- Slice: <id name>
35
- Goal: <one or two sentences>
36
- Acceptance criteria: <the slice's criteria, verbatim>
37
- UI visual acceptance: <if UI state × viewport × input + target R-id/brief rule, verbatim from tasks.md>
38
- Scope boundary: <what it WILL and will NOT touch>
39
- Mode: <HITL | AFK> (+ AFK budget note if a cap is set)
40
-
41
- Targets (stay inside these — from touched-files.md): <paths>
42
- Interfaces / signatures to match: <if any>
43
- Read yourself: spec.md, plan.md, decisions.md, assumptions.md, rite-polish/reference/anti-ai-slop.md<, design-brief.md if UI>
44
- Rules in scope (.agents/skills/devrites-lib/reference/standards/): coding-style, error-handling, testing, patterns<, security if input/auth/data><, performance if hot path / query / large payload>
45
- Test completeness: write ≥1 asserting test for EVERY interactive element + user flow in this
46
- slice's test-plan.md interaction inventory, each at the right level (fields/elements →
47
- unit/component; critical journeys one E2E; never one-per-field). No element ships
48
- unverified — testing.md "Completeness". If the slice has no test-plan inventory, derive the
49
- element/flow list from the slice's own UI surface and cover it the same way.
50
-
51
- Apply your documented discipline (orient RED implement smallest complete → verify →
52
- return). Frontend slice build to design-brief.md with devrites-frontend-craft and close
53
- the slice's visual-acceptance deltas before returning. Uncertain
54
- framework fact → verify at the source. Code + tests only — do NOT write the workspace
55
- bookkeeping files; return that data. Return your structured artifact, not your transcript.
71
+
72
+ - Reconcile `5`: reject the result. Preserve pre-snapshot user work; restore only the
73
+ unauthorized slice delta; never widen scope from the writer's self-report.
74
+ - Test integrity `3`: a test was deleted, muted, focused, or de-asserted. Treat it as a
75
+ Critical protocol failure and correct it through the wright.
76
+ - Package existence `3`: verify the exact package/version and fix the bounded workflow
77
+ or dependency defect through recovery. It is not a reason to ask for retry approval.
78
+ - A setup/corrupt-baseline error blocks acceptance; never fall back silently to `HEAD`.
79
+
80
+ The clean reconcile check records that source has not changed since inspection. The
81
+ baseline and private object database stay open until every later gate succeeds.
82
+
83
+ ## Decisions, failures, and bounded recovery
84
+
85
+ After the immediate check, independently doubt every `Decisions stood` item. Human-owned
86
+ product, policy, public-contract, irreversible-risk, or human-only access decisions use
87
+ their real gate. Objective red tests, browser/runtime failures, missing technical
88
+ coverage, package-scanner defects, and review corrections stay agent-owned.
89
+
90
+ Classify each causal fingerprint through
91
+ [`cleanup-and-classify.md`](../../devrites-debug-recovery/reference/cleanup-and-classify.md).
92
+ The engine route is canonical; technical defects stay agent-owned.
93
+ Each objective root cause then shares one durable three-attempt budget:
94
+
95
+ ```bash
96
+ devrites-engine recovery route <class>
97
+ devrites-engine recovery record --class <class> "<root cause>" "<exact failure>" <slug>
98
+ devrites-engine recovery check "<root cause>" <slug>
56
99
  ```
57
100
 
58
- Rules:
59
- - **One `Task` call, one wright.** Never dispatch two writers on the same slice.
60
- - **No author reasoning beyond the contract.** Give the slice spec, not your analysis of *how*
61
- to code it: a clean, undirected read is the point.
62
- - **Name the boundary explicitly.** The scope boundary is the single most load-bearing field; an
63
- underspecified one is the main cause of drift.
64
-
65
- ## On return: the orchestrator's job (don't delegate these)
66
- **You never edit source here.** The wright is the only writer of code + tests; you write only
67
- `.devrites/` bookkeeping. Every remedy below is **continue the same wright once** or **stop +
68
- escalate**: never an inline patch. You snapshotted the tree before dispatch (`devrites-engine reconcile snapshot`); the reconcile check in step 4 proves no source changed outside the wright's claimed
69
- set.
70
-
71
- 1. **Doubt the surfaced decisions.** For each entry in the wright's `Decisions stood`, apply
72
- `devrites-doubt` (→ `devrites-doubt-reviewer`) before accepting: the writer must not grade
73
- its own decisions. The wright's return is the not-yet-load-bearing moment (slice not `built`,
74
- not merged), so this post-return doubt is still pre-commit. Irreversible-risk items always
75
- pause, and an irreversible item that the wright filed under `Decisions stood` instead of
76
- `Escalation` is a protocol violation: pause and re-dispatch with it flagged out-of-bounds,
77
- don't doubt-and-accept.
78
- 2. **Honor escalations.** A non-empty `Escalation` do **not** mark the slice built. Write the
79
- `questions.md` entry + `state.md` `Awaiting human` (blocking gate), or route a scope change
80
- through `$rite-plan repair` (Spec Drift Guard). You are the canonical writer of these files.
81
- 3. **Fail-on-red.** If `Gates` show red (or the wright couldn't verify), the slice is **not
82
- built**, and you do **not** fix the code. First remedy: **continue the same wright once**
83
- (`SendMessage`, carrying the failing gate + real output) so it fixes in its own context:
84
- objective failures only (red gate / type / lint / missing coverage / UI browser-proof fail),
85
- never a contested decision. Still red after that one retry blocking question (AFK) or
86
- blocking gate (HITL); `Next: $rite-plan unblock`.
87
- An interactive element or user flow in the slice's test-plan interaction inventory left with
88
- **no asserting test** has the same standing as red: an unverified-element gap blocks the
89
- slice (don't mark it built). Continue the same wright to cover it, or record a blocker.
90
- 4. **Reconcile, then record.** First prove A1 held: write the wright's `Files changed` paths
91
- (one per line) to `.devrites/work/<slug>/.reconcile-claimed` and run `devrites-engine reconcile check`.
92
- **Exit 5 STOP**: a source file changed outside the wright's claimed set (A1 breach); revert
93
- it and re-dispatch, don't mark the slice built. Then persist the wright's artifact to
94
- `state.md`, `evidence.md`, `touched-files.md` (and `browser-evidence.md` for UI) per
95
- [`evidence-standard.md`](evidence-standard.md). Evidence is the wright's real command output,
96
- not its say-so. Add a concern-ordered `## Review trail` to `touched-files.md` from the wright's changed paths and summary so a human can review by design intent instead of file order. **Persist every `Decisions stood` entry to a `## Decisions stood` section in
97
- `decisions.md`, one line each ending `— doubt: <accept | reject-resolved | MISSING>`**:
98
- independent of the doubt step (step 1 above), so a skipped decision still lands on record for
99
- the seal's doubt-coverage cross-check (`- none` when the wright stood nothing). Then tick AFK if
100
- `.devrites/AFK` is present (`devrites-engine tick-afk`; exit 3 → STOP).
101
-
102
- ## Forge: competing candidates (the deliberate exception)
103
-
104
- The single-writer rule forbids parallel writers **sharing one tree**. A `Forge: yes` slice
105
- (flagged by `$rite-vet` as a genuine architecture fork at Complexity ≥4) is the one sanctioned
106
- fan-out, and it keeps the rule intact by **isolation**: each candidate wright works in its own
107
- `git worktree`, sees the identical slice contract plus one **distinct strategy**, and never
108
- touches another candidate's tree. A read-only [`devrites-forge-judge`](.codex/agents/devrites-forge-judge.toml)
109
- then scores the finished candidates against acceptance + `test-plan.md` + `.devrites/principles.md`
110
- + the anti-slop charter, and the orchestrator lands **exactly one** winner's diff in the working
111
- tree. No tree ever has two authors; exactly one author's work ships. Everything downstream (doubt,
112
- fail-on-red, reconcile against the winner's claimed set, record) runs on the winner as if a single
113
- wright had built it.
114
-
115
- Full mechanics (strategy derivation, worktree setup, the judge contract, landing + grafting the
116
- winner, `forge-report.md`, AFK budgeting, and the worktree-unavailable fallback) live in
117
- [`forge.md`](forge.md).
118
-
119
- ## Fallback
120
- If the `Task` tool / sub-agent dispatch is unavailable, `$rite-build` runs the wright's
121
- discipline **inline** in its own context and flags it as a fallback (no clean-context benefit).
122
- The slice still gets the full one-slice cycle (orient → RED → implement → verify) under the
123
- same anti-slop charter; it just doesn't get the isolation. In this path the orchestrator is
124
- legitimately the writer, so write `.devrites/work/<slug>/.reconcile-inline` before editing: the
125
- reconcile gate (step 4) skips when that sentinel is present. Mirrors the reviewer-dispatch
126
- fallback in
127
- [`../../devrites-lib/reference/parallel-dispatch.md`](../../devrites-lib/reference/parallel-dispatch.md).
128
-
129
- ## Optional pre-block hook (defense in depth)
130
- `devrites-engine reconcile` is the **post-hoc** gate. It always runs and catches an A1 breach at record time.
131
- A companion **pre-block** hook, `devrites-engine hook a1-guard` (a `PreToolUse` matcher on
132
- `Edit|Write|MultiEdit`), stops the breach *before* the write lands. It is armed only inside the
133
- mid-build window (between `devrites-engine reconcile snapshot` and a clean `check`, keyed on `.reconcile-base`),
134
- allows the wright (subagent calls carry `agent_id`), the inline fallback (`.reconcile-inline`),
135
- and any `.devrites/` write, so it never touches `$rite-polish`, `$rite-quick`, or ordinary
136
- manual edits. It ships **observe-only** (logs would-be blocks to `.a1-guard.log`, never blocks);
137
- flip to enforce with `DEVRITES_A1_HOOK=enforce` or a `.devrites/work/<slug>/.a1-enforce` file once
138
- the log confirms it never flags the wright's own edits (older Claude Code builds may not populate
139
- `agent_id`: the log is the proof before you enforce). The post-hoc gate stands on its own; the
140
- hook is belt-and-suspenders.
101
+ Before every retry:
102
+
103
+ 1. update `.wright-allowlist` only for an accepted path still inside the settled slice;
104
+ 2. run `devrites-engine reconcile snapshot`.
105
+
106
+ That refresh requires the prior clean check, re-fingerprints root-owned state, and keeps
107
+ the original source baseline. Re-dispatch with the exact output, attempt count, and dead
108
+ ends. Then repeat reconcile and both integrity gates from zero. Clear recovery only after
109
+ green with `recovery clear --class <class> "<root cause>" <slug>`. An exhausted objective
110
+ failure becomes a technical blocker with its reproduction, not a `rite-resolve` question.
111
+
112
+ ## Close and record
113
+
114
+ When reconciliation, integrity, package, proof, and doubt gates all pass:
115
+
116
+ ```bash
117
+ devrites-engine reconcile close
118
+ ```
119
+
120
+ Only then persist `state.md`, `evidence.md`, `touched-files.md`, decision/doubt records,
121
+ and browser evidence. Keep the retained window across a genuine human wait that will
122
+ resume the same slice. Close it before abandoning the slice for a scope/plan transition.
123
+
124
+ ## Host fallback
125
+
126
+ Use named wright safely enforced generic fresh worker labelled inline fallback from
127
+ `standards/agents.md`. A generic worker is eligible only when the host preserves
128
+ recognized wright identity plus exact allowlist enforcement, or contains it in an
129
+ isolated/staged checkout. Post-hoc reconciliation alone cannot authorize an
130
+ instruction-only shared-tree writer.
131
+
132
+ When no safe fresh-context writer rung is callable, the root may execute the same bounded
133
+ wright discipline inline. Write `.reconcile-inline` after the initial snapshot so the legacy
134
+ A1 pre-hook recognizes the authorized fallback; reconciliation does **not** skip. The
135
+ same allowlist, baseline, integrity gates, and close command remain mandatory.