devrites 3.0.7 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (484) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +82 -50
  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/0012-semantic-workspace-upgrades.md +77 -0
  12. package/docs/adr/README.md +4 -0
  13. package/docs/agents/triage-labels.md +7 -7
  14. package/docs/architecture.md +179 -141
  15. package/docs/cli.md +47 -12
  16. package/docs/command-map.md +61 -38
  17. package/docs/engine/agent-contract.md +92 -15
  18. package/docs/engine/commands.md +248 -72
  19. package/docs/engine/state-schema.md +52 -23
  20. package/docs/engine/workspace-schema.md +103 -15
  21. package/docs/extensions.md +1 -1
  22. package/docs/flow.md +86 -51
  23. package/docs/harness-compliance.md +29 -5
  24. package/docs/orchestration.md +107 -79
  25. package/docs/quick-reference.md +11 -3
  26. package/docs/release.md +4 -3
  27. package/docs/skills.md +67 -38
  28. package/docs/usage.md +84 -39
  29. package/engine/cmd/releasepack/main.go +219 -0
  30. package/engine/cmd/releasepack/main_test.go +170 -0
  31. package/engine/commands.go +170 -23
  32. package/engine/git_guard.go +187 -0
  33. package/engine/git_guard_test.go +283 -0
  34. package/engine/hookpolicy.go +53 -55
  35. package/engine/hookpolicy_test.go +91 -1
  36. package/engine/hooks.go +296 -75
  37. package/engine/hooks_events_test.go +276 -6
  38. package/engine/hooks_workspace.go +640 -159
  39. package/engine/internal/devritespaths/paths.go +65 -10
  40. package/engine/internal/devritespaths/paths_test.go +110 -0
  41. package/engine/internal/doctor/doctor.go +153 -23
  42. package/engine/internal/doctor/doctor_test.go +74 -0
  43. package/engine/internal/forge/forge.go +940 -0
  44. package/engine/internal/forge/forge_test.go +576 -0
  45. package/engine/internal/forge/git.go +245 -0
  46. package/engine/internal/forge/liveness_unix.go +48 -0
  47. package/engine/internal/forge/liveness_windows.go +67 -0
  48. package/engine/internal/forge/manifest.go +402 -0
  49. package/engine/internal/gate/gate.go +90 -71
  50. package/engine/internal/gate/gate_test.go +71 -2
  51. package/engine/internal/harness/compliance.go +18 -24
  52. package/engine/internal/harness/harness.go +37 -44
  53. package/engine/internal/harness/harness_test.go +21 -5
  54. package/engine/internal/install/install.go +486 -38
  55. package/engine/internal/install/install_test.go +383 -10
  56. package/engine/internal/iohooks/iohooks.go +350 -59
  57. package/engine/internal/iohooks/iohooks_test.go +421 -1
  58. package/engine/internal/lib/buildreadiness.go +43 -18
  59. package/engine/internal/lib/clarifyreturn.go +91 -0
  60. package/engine/internal/lib/clarifyreturn_test.go +123 -0
  61. package/engine/internal/lib/context.go +54 -15
  62. package/engine/internal/lib/cursor_compat_test.go +8 -0
  63. package/engine/internal/lib/extensions.go +2 -3
  64. package/engine/internal/lib/gitauthority.go +601 -0
  65. package/engine/internal/lib/gitauthority_test.go +346 -0
  66. package/engine/internal/lib/jsonout.go +25 -11
  67. package/engine/internal/lib/jsonout_test.go +16 -0
  68. package/engine/internal/lib/lanes.go +14 -8
  69. package/engine/internal/lib/observability_test.go +358 -0
  70. package/engine/internal/lib/packageexistence.go +151 -35
  71. package/engine/internal/lib/packageexistence_test.go +163 -0
  72. package/engine/internal/lib/progress.go +11 -9
  73. package/engine/internal/lib/provenance.go +462 -0
  74. package/engine/internal/lib/provenance_test.go +154 -0
  75. package/engine/internal/lib/readiness_contract.json +118 -0
  76. package/engine/internal/lib/readinessartifact.go +533 -0
  77. package/engine/internal/lib/readinessartifact_test.go +422 -0
  78. package/engine/internal/lib/reconcile.go +712 -88
  79. package/engine/internal/lib/reconcile_test.go +335 -16
  80. package/engine/internal/lib/recoveryattempts.go +298 -0
  81. package/engine/internal/lib/recoveryattempts_test.go +215 -0
  82. package/engine/internal/lib/resolve.go +23 -19
  83. package/engine/internal/lib/runbook_context_test.go +20 -0
  84. package/engine/internal/lib/session.go +701 -9
  85. package/engine/internal/lib/session_test.go +80 -13
  86. package/engine/internal/lib/testintegrity.go +33 -37
  87. package/engine/internal/lib/testintegrity_test.go +63 -1
  88. package/engine/internal/migrate/migrate.go +81 -1
  89. package/engine/internal/migrate/migrate_test.go +22 -1
  90. package/engine/internal/reason/reason.go +180 -0
  91. package/engine/internal/reason/reason_test.go +35 -0
  92. package/engine/internal/rootfacts/facts.go +466 -0
  93. package/engine/internal/rootfacts/facts_test.go +306 -0
  94. package/engine/internal/safepath/safepath.go +55 -0
  95. package/engine/internal/safepath/safepath_test.go +69 -0
  96. package/engine/internal/safepath/safepath_windows_test.go +26 -0
  97. package/engine/internal/state/clarify_transition.go +165 -0
  98. package/engine/internal/state/clarify_transition_test.go +130 -0
  99. package/engine/internal/state/cmd/workflowmanifest/main.go +12 -8
  100. package/engine/internal/state/cursor.go +58 -0
  101. package/engine/internal/state/cursor_test.go +42 -1
  102. package/engine/internal/state/feature.go +35 -48
  103. package/engine/internal/state/schema.go +90 -37
  104. package/engine/internal/state/snapshot.go +18 -2
  105. package/engine/internal/state/state_test.go +187 -7
  106. package/engine/internal/state/status.go +48 -11
  107. package/engine/internal/state/workflow_manifest.json +231 -50
  108. package/engine/internal/toolpolicy/classifier.go +533 -0
  109. package/engine/internal/toolpolicy/classifier_test.go +424 -0
  110. package/engine/internal/toolpolicy/git.go +616 -0
  111. package/engine/internal/toolpolicy/scanner.go +382 -0
  112. package/engine/main.go +160 -77
  113. package/engine/observability_cli_test.go +52 -0
  114. package/engine/root_routing_test.go +277 -0
  115. package/engine/testdata/golden/TestParityBuildReadiness/arg=approved.golden +1 -1
  116. package/engine/testdata/golden/TestParityBuildReadiness/arg=emptystatus.golden +1 -1
  117. package/engine/testdata/golden/TestParityBuildReadiness/arg=legacycontract.golden +1 -0
  118. package/engine/testdata/golden/TestParityBuildReadiness/arg=noclarify.golden +1 -0
  119. package/engine/testdata/golden/TestParityBuildReadiness/arg=novet.golden +1 -0
  120. package/engine/testdata/golden/TestParityBuildReadiness/arg=stalevet.golden +1 -0
  121. package/engine/testdata/golden/TestParityBuildReadiness/arg=trailhash.golden +1 -1
  122. package/engine/testdata/golden/TestParityBuildReadiness/arg=trailpipe.golden +1 -1
  123. package/engine/testdata/golden/TestParityBuildReadiness/arg=vetnotready.golden +1 -0
  124. package/engine/testdata/golden/TestParityProgress/arg=allbuilt.golden +1 -1
  125. package/engine/testdata/golden/TestParityProgress/arg=done.golden +1 -1
  126. package/engine/testdata/golden/TestParityProgress/arg=mid.golden +1 -1
  127. package/engine/testdata/golden/TestParityProgress/arg=nophase.golden +1 -1
  128. package/engine/testdata/golden/TestParityProgress/arg=noslice.golden +1 -1
  129. package/engine/testdata/golden/TestParityProgress/arg=plan.golden +1 -1
  130. package/engine/testdata/golden/TestParityProgress/arg=seal.golden +1 -1
  131. package/engine/testdata/golden/TestParityReconcile/check-clean.golden +1 -1
  132. package/engine/testdata/golden/TestParityReconcile/inline-fallback.golden +1 -0
  133. package/engine/testdata/golden/TestParityReconcile/snapshot-no-allowlist.golden +1 -0
  134. package/engine/testdata/golden/TestParityWrightScope/devrites-edit-denied.golden +2 -0
  135. package/engine/testdata/golden/TestParityWrightScope/out-of-scope-enforce-denies.golden +1 -1
  136. package/engine/tests/adr_0011_define_plan_test.go +30 -0
  137. package/engine/tests/budget_test.go +19 -8
  138. package/engine/tests/concurrency_cli_test.go +7 -1
  139. package/engine/tests/doctor_cli_test.go +148 -2
  140. package/engine/tests/forge_cli_test.go +463 -0
  141. package/engine/tests/gate_test.go +63 -8
  142. package/engine/tests/hook_test.go +260 -8
  143. package/engine/tests/hooks_io_test.go +94 -3
  144. package/engine/tests/json_contract_test.go +127 -2
  145. package/engine/tests/migrate_cli_test.go +2 -2
  146. package/engine/tests/parity_buildreadiness_test.go +167 -10
  147. package/engine/tests/parity_learnings_test.go +16 -17
  148. package/engine/tests/parity_reconcile_test.go +20 -17
  149. package/engine/tests/parity_resolve_test.go +12 -11
  150. package/engine/tests/parity_test.go +21 -17
  151. package/pack/.claude/agents/devrites-code-reviewer.md +62 -48
  152. package/pack/.claude/agents/devrites-devex-reviewer.md +69 -53
  153. package/pack/.claude/agents/devrites-doubt-reviewer.md +29 -22
  154. package/pack/.claude/agents/devrites-evidence-scout.md +69 -0
  155. package/pack/.claude/agents/devrites-forge-judge.md +74 -61
  156. package/pack/.claude/agents/devrites-frontend-reviewer.md +48 -39
  157. package/pack/.claude/agents/devrites-performance-reviewer.md +49 -40
  158. package/pack/.claude/agents/devrites-plan-drafter.md +73 -0
  159. package/pack/.claude/agents/devrites-plan-reviewer.md +80 -47
  160. package/pack/.claude/agents/devrites-proof-runner.md +74 -0
  161. package/pack/.claude/agents/devrites-retrospector.md +48 -45
  162. package/pack/.claude/agents/devrites-security-auditor.md +46 -36
  163. package/pack/.claude/agents/devrites-simplifier-reviewer.md +50 -46
  164. package/pack/.claude/agents/devrites-slice-wright.md +153 -165
  165. package/pack/.claude/agents/devrites-spec-reviewer.md +34 -32
  166. package/pack/.claude/agents/devrites-strategy-reviewer.md +63 -34
  167. package/pack/.claude/agents/devrites-test-analyst.md +40 -30
  168. package/pack/.claude/agents/devrites-upgrade-planner.md +100 -0
  169. package/pack/.claude/settings.json +2 -1
  170. package/pack/.claude/skills/devrites-audit/SKILL.md +40 -61
  171. package/pack/.claude/skills/devrites-debug-recovery/SKILL.md +24 -13
  172. package/pack/.claude/skills/devrites-debug-recovery/reference/build-the-loop.md +24 -21
  173. package/pack/.claude/skills/devrites-debug-recovery/reference/cleanup-and-classify.md +34 -6
  174. package/pack/.claude/skills/devrites-debug-recovery/reference/instrumentation.md +2 -2
  175. package/pack/.claude/skills/devrites-doubt/SKILL.md +25 -17
  176. package/pack/.claude/skills/devrites-interview/SKILL.md +53 -52
  177. package/pack/.claude/skills/devrites-lib/SKILL.md +12 -9
  178. package/pack/.claude/skills/devrites-lib/reference/intent-map.md +4 -2
  179. package/pack/.claude/skills/devrites-lib/reference/parallel-dispatch.md +82 -137
  180. package/pack/.claude/skills/devrites-lib/reference/reply-contract.md +8 -1
  181. package/pack/.claude/skills/devrites-lib/reference/standards/README.md +38 -55
  182. package/pack/.claude/skills/devrites-lib/reference/standards/afk-hitl.md +53 -27
  183. package/pack/.claude/skills/devrites-lib/reference/standards/agents.md +200 -190
  184. package/pack/.claude/skills/devrites-lib/reference/standards/anti-patterns.md +5 -15
  185. package/pack/.claude/skills/devrites-lib/reference/standards/ci-cd.md +27 -58
  186. package/pack/.claude/skills/devrites-lib/reference/standards/code-review.md +16 -52
  187. package/pack/.claude/skills/devrites-lib/reference/standards/coding-style.md +2 -10
  188. package/pack/.claude/skills/devrites-lib/reference/standards/context-hygiene.md +18 -61
  189. package/pack/.claude/skills/devrites-lib/reference/standards/core.md +23 -18
  190. package/pack/.claude/skills/devrites-lib/reference/standards/deprecation.md +17 -57
  191. package/pack/.claude/skills/devrites-lib/reference/standards/development-workflow.md +4 -33
  192. package/pack/.claude/skills/devrites-lib/reference/standards/git-workflow.md +4 -20
  193. package/pack/.claude/skills/devrites-lib/reference/standards/hooks.md +3 -14
  194. package/pack/.claude/skills/devrites-lib/reference/standards/patterns.md +9 -25
  195. package/pack/.claude/skills/devrites-lib/reference/standards/performance.md +0 -9
  196. package/pack/.claude/skills/devrites-lib/reference/standards/principles.md +1 -3
  197. package/pack/.claude/skills/devrites-lib/reference/standards/security.md +17 -7
  198. package/pack/.claude/skills/devrites-lib/reference/standards/testing.md +1 -27
  199. package/pack/.claude/skills/devrites-lib/reference/standards/tooling.md +46 -50
  200. package/pack/.claude/skills/devrites-lib/reference/workspace-artifact-schema.md +40 -10
  201. package/pack/.claude/skills/devrites-source-driven/SKILL.md +23 -22
  202. package/pack/.claude/skills/rite/SKILL.md +10 -6
  203. package/pack/.claude/skills/rite/reference/menu.md +13 -7
  204. package/pack/.claude/skills/rite-adopt/SKILL.md +33 -37
  205. package/pack/.claude/skills/rite-autocomplete/SKILL.md +33 -28
  206. package/pack/.claude/skills/rite-autocomplete/reference/loop.md +21 -21
  207. package/pack/.claude/skills/rite-autocomplete/reference/stop-conditions.md +15 -6
  208. package/pack/.claude/skills/rite-build/SKILL.md +35 -30
  209. package/pack/.claude/skills/rite-build/reference/afk-discipline.md +41 -39
  210. package/pack/.claude/skills/rite-build/reference/evidence-standard.md +10 -0
  211. package/pack/.claude/skills/rite-build/reference/forge.md +186 -156
  212. package/pack/.claude/skills/rite-build/reference/one-slice-cycle.md +4 -3
  213. package/pack/.claude/skills/rite-build/reference/phase-contract.md +96 -175
  214. package/pack/.claude/skills/rite-build/reference/spec-drift-guard.md +10 -4
  215. package/pack/.claude/skills/rite-build/reference/wright-dispatch.md +129 -134
  216. package/pack/.claude/skills/rite-clarify/SKILL.md +90 -0
  217. package/pack/.claude/skills/rite-clarify/reference/decision-coverage.md +61 -0
  218. package/pack/.claude/skills/rite-converge/SKILL.md +35 -25
  219. package/pack/.claude/skills/rite-define/SKILL.md +58 -32
  220. package/pack/.claude/skills/rite-define/reference/gates.md +16 -15
  221. package/pack/.claude/skills/rite-define/reference/plan-template.md +18 -8
  222. package/pack/.claude/skills/rite-frame/reference/failure-modes.md +22 -24
  223. package/pack/.claude/skills/rite-plan/SKILL.md +47 -16
  224. package/pack/.claude/skills/rite-plan/reference/task-breakdown.md +4 -0
  225. package/pack/.claude/skills/rite-polish/SKILL.md +27 -23
  226. package/pack/.claude/skills/rite-prototype/SKILL.md +25 -26
  227. package/pack/.claude/skills/rite-prove/SKILL.md +27 -17
  228. package/pack/.claude/skills/rite-resolve/SKILL.md +12 -11
  229. package/pack/.claude/skills/rite-resolve/reference/answer-protocol.md +3 -0
  230. package/pack/.claude/skills/rite-review/SKILL.md +37 -28
  231. package/pack/.claude/skills/rite-seal/reference/phase-contract.md +27 -92
  232. package/pack/.claude/skills/rite-seal/reference/risk-and-rollback.md +13 -0
  233. package/pack/.claude/skills/rite-ship/reference/design-memory.md +31 -36
  234. package/pack/.claude/skills/rite-spec/SKILL.md +84 -135
  235. package/pack/.claude/skills/rite-spec/reference/investigation.md +37 -33
  236. package/pack/.claude/skills/rite-spec/reference/question-protocol.md +6 -2
  237. package/pack/.claude/skills/rite-spec/reference/spec-checklists.md +25 -24
  238. package/pack/.claude/skills/rite-spec/reference/spec-template.md +9 -2
  239. package/pack/.claude/skills/rite-spec/reference/state-workspace.md +13 -3
  240. package/pack/.claude/skills/rite-temper/SKILL.md +62 -47
  241. package/pack/.claude/skills/rite-temper/reference/review-dimensions.md +24 -22
  242. package/pack/.claude/skills/rite-upgrade/SKILL.md +125 -0
  243. package/pack/.claude/skills/rite-vet/SKILL.md +114 -113
  244. package/pack/.claude/skills/rite-vet/reference/artifacts.md +50 -9
  245. package/pack/.claude/skills/rite-vet/reference/review-axes.md +39 -37
  246. package/pack/generated/claude/agents/devrites-code-reviewer.md +62 -48
  247. package/pack/generated/claude/agents/devrites-devex-reviewer.md +69 -53
  248. package/pack/generated/claude/agents/devrites-doubt-reviewer.md +29 -22
  249. package/pack/generated/claude/agents/devrites-evidence-scout.md +69 -0
  250. package/pack/generated/claude/agents/devrites-forge-judge.md +74 -61
  251. package/pack/generated/claude/agents/devrites-frontend-reviewer.md +48 -39
  252. package/pack/generated/claude/agents/devrites-performance-reviewer.md +49 -40
  253. package/pack/generated/claude/agents/devrites-plan-drafter.md +73 -0
  254. package/pack/generated/claude/agents/devrites-plan-reviewer.md +80 -47
  255. package/pack/generated/claude/agents/devrites-proof-runner.md +74 -0
  256. package/pack/generated/claude/agents/devrites-retrospector.md +48 -45
  257. package/pack/generated/claude/agents/devrites-security-auditor.md +46 -36
  258. package/pack/generated/claude/agents/devrites-simplifier-reviewer.md +50 -46
  259. package/pack/generated/claude/agents/devrites-slice-wright.md +153 -165
  260. package/pack/generated/claude/agents/devrites-spec-reviewer.md +34 -32
  261. package/pack/generated/claude/agents/devrites-strategy-reviewer.md +63 -34
  262. package/pack/generated/claude/agents/devrites-test-analyst.md +40 -30
  263. package/pack/generated/claude/agents/devrites-upgrade-planner.md +100 -0
  264. package/pack/generated/claude/settings.json +2 -1
  265. package/pack/generated/claude/skills/devrites-audit/SKILL.md +40 -61
  266. package/pack/generated/claude/skills/devrites-debug-recovery/SKILL.md +24 -13
  267. package/pack/generated/claude/skills/devrites-debug-recovery/reference/build-the-loop.md +24 -21
  268. package/pack/generated/claude/skills/devrites-debug-recovery/reference/cleanup-and-classify.md +34 -6
  269. package/pack/generated/claude/skills/devrites-debug-recovery/reference/instrumentation.md +2 -2
  270. package/pack/generated/claude/skills/devrites-doubt/SKILL.md +25 -17
  271. package/pack/generated/claude/skills/devrites-interview/SKILL.md +53 -52
  272. package/pack/generated/claude/skills/devrites-lib/SKILL.md +12 -9
  273. package/pack/generated/claude/skills/devrites-lib/reference/intent-map.md +4 -2
  274. package/pack/generated/claude/skills/devrites-lib/reference/parallel-dispatch.md +82 -137
  275. package/pack/generated/claude/skills/devrites-lib/reference/reply-contract.md +8 -1
  276. package/pack/generated/claude/skills/devrites-lib/reference/standards/README.md +38 -55
  277. package/pack/generated/claude/skills/devrites-lib/reference/standards/afk-hitl.md +53 -27
  278. package/pack/generated/claude/skills/devrites-lib/reference/standards/agents.md +200 -190
  279. package/pack/generated/claude/skills/devrites-lib/reference/standards/anti-patterns.md +5 -15
  280. package/pack/generated/claude/skills/devrites-lib/reference/standards/ci-cd.md +27 -58
  281. package/pack/generated/claude/skills/devrites-lib/reference/standards/code-review.md +16 -52
  282. package/pack/generated/claude/skills/devrites-lib/reference/standards/coding-style.md +2 -10
  283. package/pack/generated/claude/skills/devrites-lib/reference/standards/context-hygiene.md +18 -61
  284. package/pack/generated/claude/skills/devrites-lib/reference/standards/core.md +23 -18
  285. package/pack/generated/claude/skills/devrites-lib/reference/standards/deprecation.md +17 -57
  286. package/pack/generated/claude/skills/devrites-lib/reference/standards/development-workflow.md +4 -33
  287. package/pack/generated/claude/skills/devrites-lib/reference/standards/git-workflow.md +4 -20
  288. package/pack/generated/claude/skills/devrites-lib/reference/standards/hooks.md +3 -14
  289. package/pack/generated/claude/skills/devrites-lib/reference/standards/patterns.md +9 -25
  290. package/pack/generated/claude/skills/devrites-lib/reference/standards/performance.md +0 -9
  291. package/pack/generated/claude/skills/devrites-lib/reference/standards/principles.md +1 -3
  292. package/pack/generated/claude/skills/devrites-lib/reference/standards/security.md +17 -7
  293. package/pack/generated/claude/skills/devrites-lib/reference/standards/testing.md +1 -27
  294. package/pack/generated/claude/skills/devrites-lib/reference/standards/tooling.md +46 -50
  295. package/pack/generated/claude/skills/devrites-lib/reference/workspace-artifact-schema.md +40 -10
  296. package/pack/generated/claude/skills/devrites-source-driven/SKILL.md +23 -22
  297. package/pack/generated/claude/skills/rite/SKILL.md +10 -6
  298. package/pack/generated/claude/skills/rite/reference/menu.md +13 -7
  299. package/pack/generated/claude/skills/rite-adopt/SKILL.md +33 -37
  300. package/pack/generated/claude/skills/rite-autocomplete/SKILL.md +33 -28
  301. package/pack/generated/claude/skills/rite-autocomplete/reference/loop.md +21 -21
  302. package/pack/generated/claude/skills/rite-autocomplete/reference/stop-conditions.md +15 -6
  303. package/pack/generated/claude/skills/rite-build/SKILL.md +35 -30
  304. package/pack/generated/claude/skills/rite-build/reference/afk-discipline.md +41 -39
  305. package/pack/generated/claude/skills/rite-build/reference/evidence-standard.md +10 -0
  306. package/pack/generated/claude/skills/rite-build/reference/forge.md +186 -156
  307. package/pack/generated/claude/skills/rite-build/reference/one-slice-cycle.md +4 -3
  308. package/pack/generated/claude/skills/rite-build/reference/phase-contract.md +96 -175
  309. package/pack/generated/claude/skills/rite-build/reference/spec-drift-guard.md +10 -4
  310. package/pack/generated/claude/skills/rite-build/reference/wright-dispatch.md +129 -134
  311. package/pack/generated/claude/skills/rite-clarify/SKILL.md +90 -0
  312. package/pack/generated/claude/skills/rite-clarify/reference/decision-coverage.md +61 -0
  313. package/pack/generated/claude/skills/rite-converge/SKILL.md +35 -25
  314. package/pack/generated/claude/skills/rite-define/SKILL.md +58 -32
  315. package/pack/generated/claude/skills/rite-define/reference/gates.md +16 -15
  316. package/pack/generated/claude/skills/rite-define/reference/plan-template.md +18 -8
  317. package/pack/generated/claude/skills/rite-frame/reference/failure-modes.md +22 -24
  318. package/pack/generated/claude/skills/rite-plan/SKILL.md +47 -16
  319. package/pack/generated/claude/skills/rite-plan/reference/task-breakdown.md +4 -0
  320. package/pack/generated/claude/skills/rite-polish/SKILL.md +27 -23
  321. package/pack/generated/claude/skills/rite-prototype/SKILL.md +25 -26
  322. package/pack/generated/claude/skills/rite-prove/SKILL.md +27 -17
  323. package/pack/generated/claude/skills/rite-resolve/SKILL.md +12 -11
  324. package/pack/generated/claude/skills/rite-resolve/reference/answer-protocol.md +3 -0
  325. package/pack/generated/claude/skills/rite-review/SKILL.md +37 -28
  326. package/pack/generated/claude/skills/rite-seal/reference/phase-contract.md +27 -92
  327. package/pack/generated/claude/skills/rite-seal/reference/risk-and-rollback.md +13 -0
  328. package/pack/generated/claude/skills/rite-ship/reference/design-memory.md +31 -36
  329. package/pack/generated/claude/skills/rite-spec/SKILL.md +84 -135
  330. package/pack/generated/claude/skills/rite-spec/reference/investigation.md +37 -33
  331. package/pack/generated/claude/skills/rite-spec/reference/question-protocol.md +6 -2
  332. package/pack/generated/claude/skills/rite-spec/reference/spec-checklists.md +25 -24
  333. package/pack/generated/claude/skills/rite-spec/reference/spec-template.md +9 -2
  334. package/pack/generated/claude/skills/rite-spec/reference/state-workspace.md +13 -3
  335. package/pack/generated/claude/skills/rite-temper/SKILL.md +62 -47
  336. package/pack/generated/claude/skills/rite-temper/reference/review-dimensions.md +24 -22
  337. package/pack/generated/claude/skills/rite-upgrade/SKILL.md +125 -0
  338. package/pack/generated/claude/skills/rite-vet/SKILL.md +114 -113
  339. package/pack/generated/claude/skills/rite-vet/reference/artifacts.md +50 -9
  340. package/pack/generated/claude/skills/rite-vet/reference/review-axes.md +39 -37
  341. package/pack/generated/codex/AGENTS.md +5 -2
  342. package/pack/generated/codex/agents/devrites-code-reviewer.toml +69 -47
  343. package/pack/generated/codex/agents/devrites-devex-reviewer.toml +75 -51
  344. package/pack/generated/codex/agents/devrites-doubt-reviewer.toml +35 -20
  345. package/pack/generated/codex/agents/devrites-evidence-scout.toml +75 -0
  346. package/pack/generated/codex/agents/devrites-forge-judge.toml +80 -59
  347. package/pack/generated/codex/agents/devrites-frontend-reviewer.toml +54 -37
  348. package/pack/generated/codex/agents/devrites-performance-reviewer.toml +55 -38
  349. package/pack/generated/codex/agents/devrites-plan-drafter.toml +79 -0
  350. package/pack/generated/codex/agents/devrites-plan-reviewer.toml +82 -47
  351. package/pack/generated/codex/agents/devrites-proof-runner.toml +80 -0
  352. package/pack/generated/codex/agents/devrites-retrospector.toml +54 -43
  353. package/pack/generated/codex/agents/devrites-security-auditor.toml +53 -35
  354. package/pack/generated/codex/agents/devrites-simplifier-reviewer.toml +56 -44
  355. package/pack/generated/codex/agents/devrites-slice-wright.toml +159 -163
  356. package/pack/generated/codex/agents/devrites-spec-reviewer.toml +40 -30
  357. package/pack/generated/codex/agents/devrites-strategy-reviewer.toml +65 -34
  358. package/pack/generated/codex/agents/devrites-test-analyst.toml +46 -28
  359. package/pack/generated/codex/agents/devrites-upgrade-planner.toml +106 -0
  360. package/pack/generated/codex/hooks.json +4 -14
  361. package/pack/generated/codex/skills/devrites-api-interface/SKILL.md +7 -3
  362. package/pack/generated/codex/skills/devrites-audit/SKILL.md +47 -64
  363. package/pack/generated/codex/skills/devrites-browser-proof/SKILL.md +7 -3
  364. package/pack/generated/codex/skills/devrites-debug-recovery/SKILL.md +31 -16
  365. package/pack/generated/codex/skills/devrites-debug-recovery/reference/build-the-loop.md +24 -21
  366. package/pack/generated/codex/skills/devrites-debug-recovery/reference/cleanup-and-classify.md +34 -6
  367. package/pack/generated/codex/skills/devrites-debug-recovery/reference/instrumentation.md +2 -2
  368. package/pack/generated/codex/skills/devrites-doubt/SKILL.md +32 -20
  369. package/pack/generated/codex/skills/devrites-frontend-craft/SKILL.md +7 -3
  370. package/pack/generated/codex/skills/devrites-interview/SKILL.md +60 -55
  371. package/pack/generated/codex/skills/devrites-lib/SKILL.md +19 -12
  372. package/pack/generated/codex/skills/devrites-lib/reference/intent-map.md +4 -2
  373. package/pack/generated/codex/skills/devrites-lib/reference/parallel-dispatch.md +82 -137
  374. package/pack/generated/codex/skills/devrites-lib/reference/reply-contract.md +8 -1
  375. package/pack/generated/codex/skills/devrites-lib/reference/standards/README.md +38 -55
  376. package/pack/generated/codex/skills/devrites-lib/reference/standards/afk-hitl.md +53 -27
  377. package/pack/generated/codex/skills/devrites-lib/reference/standards/agents.md +200 -190
  378. package/pack/generated/codex/skills/devrites-lib/reference/standards/anti-patterns.md +5 -15
  379. package/pack/generated/codex/skills/devrites-lib/reference/standards/ci-cd.md +27 -58
  380. package/pack/generated/codex/skills/devrites-lib/reference/standards/code-review.md +16 -52
  381. package/pack/generated/codex/skills/devrites-lib/reference/standards/coding-style.md +2 -10
  382. package/pack/generated/codex/skills/devrites-lib/reference/standards/context-hygiene.md +18 -61
  383. package/pack/generated/codex/skills/devrites-lib/reference/standards/core.md +23 -18
  384. package/pack/generated/codex/skills/devrites-lib/reference/standards/deprecation.md +17 -57
  385. package/pack/generated/codex/skills/devrites-lib/reference/standards/development-workflow.md +4 -33
  386. package/pack/generated/codex/skills/devrites-lib/reference/standards/git-workflow.md +4 -20
  387. package/pack/generated/codex/skills/devrites-lib/reference/standards/hooks.md +3 -14
  388. package/pack/generated/codex/skills/devrites-lib/reference/standards/patterns.md +9 -25
  389. package/pack/generated/codex/skills/devrites-lib/reference/standards/performance.md +0 -9
  390. package/pack/generated/codex/skills/devrites-lib/reference/standards/principles.md +1 -3
  391. package/pack/generated/codex/skills/devrites-lib/reference/standards/security.md +17 -7
  392. package/pack/generated/codex/skills/devrites-lib/reference/standards/testing.md +1 -27
  393. package/pack/generated/codex/skills/devrites-lib/reference/standards/tooling.md +46 -50
  394. package/pack/generated/codex/skills/devrites-lib/reference/workspace-artifact-schema.md +40 -10
  395. package/pack/generated/codex/skills/devrites-prose-craft/SKILL.md +7 -3
  396. package/pack/generated/codex/skills/devrites-refresh-indexes/SKILL.md +7 -3
  397. package/pack/generated/codex/skills/devrites-source-driven/SKILL.md +29 -24
  398. package/pack/generated/codex/skills/devrites-ux-shape/SKILL.md +7 -3
  399. package/pack/generated/codex/skills/rite/SKILL.md +21 -13
  400. package/pack/generated/codex/skills/rite/reference/menu.md +13 -7
  401. package/pack/generated/codex/skills/rite-adopt/SKILL.md +40 -40
  402. package/pack/generated/codex/skills/rite-autocomplete/SKILL.md +40 -31
  403. package/pack/generated/codex/skills/rite-autocomplete/reference/loop.md +21 -21
  404. package/pack/generated/codex/skills/rite-autocomplete/reference/stop-conditions.md +15 -6
  405. package/pack/generated/codex/skills/rite-build/SKILL.md +42 -33
  406. package/pack/generated/codex/skills/rite-build/reference/afk-discipline.md +41 -39
  407. package/pack/generated/codex/skills/rite-build/reference/evidence-standard.md +10 -0
  408. package/pack/generated/codex/skills/rite-build/reference/forge.md +186 -156
  409. package/pack/generated/codex/skills/rite-build/reference/one-slice-cycle.md +4 -3
  410. package/pack/generated/codex/skills/rite-build/reference/phase-contract.md +96 -175
  411. package/pack/generated/codex/skills/rite-build/reference/spec-drift-guard.md +10 -4
  412. package/pack/generated/codex/skills/rite-build/reference/wright-dispatch.md +129 -134
  413. package/pack/generated/codex/skills/rite-clarify/SKILL.md +106 -0
  414. package/pack/generated/codex/skills/rite-clarify/reference/decision-coverage.md +61 -0
  415. package/pack/generated/codex/skills/rite-converge/SKILL.md +42 -28
  416. package/pack/generated/codex/skills/rite-customize/SKILL.md +7 -3
  417. package/pack/generated/codex/skills/rite-define/SKILL.md +65 -35
  418. package/pack/generated/codex/skills/rite-define/reference/gates.md +16 -15
  419. package/pack/generated/codex/skills/rite-define/reference/plan-template.md +18 -8
  420. package/pack/generated/codex/skills/rite-doctor/SKILL.md +7 -3
  421. package/pack/generated/codex/skills/rite-dogfood/SKILL.md +7 -3
  422. package/pack/generated/codex/skills/rite-explain/SKILL.md +7 -3
  423. package/pack/generated/codex/skills/rite-frame/SKILL.md +7 -3
  424. package/pack/generated/codex/skills/rite-frame/reference/failure-modes.md +22 -24
  425. package/pack/generated/codex/skills/rite-handoff/SKILL.md +7 -3
  426. package/pack/generated/codex/skills/rite-learn/SKILL.md +7 -3
  427. package/pack/generated/codex/skills/rite-plan/SKILL.md +54 -19
  428. package/pack/generated/codex/skills/rite-plan/reference/task-breakdown.md +5 -1
  429. package/pack/generated/codex/skills/rite-polish/SKILL.md +34 -26
  430. package/pack/generated/codex/skills/rite-pov/SKILL.md +7 -3
  431. package/pack/generated/codex/skills/rite-pr-feedback/SKILL.md +7 -3
  432. package/pack/generated/codex/skills/rite-pressure-test/SKILL.md +7 -3
  433. package/pack/generated/codex/skills/rite-prototype/SKILL.md +32 -29
  434. package/pack/generated/codex/skills/rite-prove/SKILL.md +34 -20
  435. package/pack/generated/codex/skills/rite-quick/SKILL.md +7 -3
  436. package/pack/generated/codex/skills/rite-resolve/SKILL.md +19 -14
  437. package/pack/generated/codex/skills/rite-resolve/reference/answer-protocol.md +3 -0
  438. package/pack/generated/codex/skills/rite-review/SKILL.md +44 -31
  439. package/pack/generated/codex/skills/rite-seal/SKILL.md +7 -3
  440. package/pack/generated/codex/skills/rite-seal/reference/phase-contract.md +27 -92
  441. package/pack/generated/codex/skills/rite-seal/reference/risk-and-rollback.md +13 -0
  442. package/pack/generated/codex/skills/rite-ship/SKILL.md +7 -3
  443. package/pack/generated/codex/skills/rite-ship/reference/design-memory.md +31 -36
  444. package/pack/generated/codex/skills/rite-spec/SKILL.md +91 -138
  445. package/pack/generated/codex/skills/rite-spec/reference/investigation.md +37 -33
  446. package/pack/generated/codex/skills/rite-spec/reference/question-protocol.md +6 -2
  447. package/pack/generated/codex/skills/rite-spec/reference/spec-checklists.md +25 -24
  448. package/pack/generated/codex/skills/rite-spec/reference/spec-template.md +9 -2
  449. package/pack/generated/codex/skills/rite-spec/reference/state-workspace.md +13 -3
  450. package/pack/generated/codex/skills/rite-status/SKILL.md +7 -3
  451. package/pack/generated/codex/skills/rite-temper/SKILL.md +69 -50
  452. package/pack/generated/codex/skills/rite-temper/reference/review-dimensions.md +24 -22
  453. package/pack/generated/codex/skills/rite-upgrade/SKILL.md +141 -0
  454. package/pack/generated/codex/skills/rite-upgrade/agents/openai.yaml +2 -0
  455. package/pack/generated/codex/skills/rite-vet/SKILL.md +121 -116
  456. package/pack/generated/codex/skills/rite-vet/reference/artifacts.md +50 -9
  457. package/pack/generated/codex/skills/rite-vet/reference/review-axes.md +40 -38
  458. package/pack/generated/codex/skills/rite-zoom-out/SKILL.md +7 -3
  459. package/package.json +1 -1
  460. package/scripts/build-release-tarball.sh +32 -15
  461. package/scripts/check-authority-drift.py +125 -0
  462. package/scripts/check-instruction-size-baseline.mjs +19 -11
  463. package/scripts/check-invocation-integrity.py +2 -0
  464. package/scripts/codex-generate.sh +69 -33
  465. package/scripts/grade-feature.sh +121 -40
  466. package/scripts/live-hosts/agent-result.schema.json +230 -0
  467. package/scripts/live-hosts/claude.sh +87 -0
  468. package/scripts/live-hosts/codex.sh +81 -0
  469. package/scripts/live-hosts/common.sh +113 -0
  470. package/scripts/live-hosts/fake-host.py +264 -0
  471. package/scripts/live-hosts/host-transport.py +287 -0
  472. package/scripts/release-check.sh +5 -1
  473. package/scripts/run-agent-contract-evals.py +1380 -0
  474. package/scripts/run-behavioral-evals.sh +24 -30
  475. package/scripts/run-evals.sh +1 -5
  476. package/scripts/run-live-behavioral-evals.py +1274 -144
  477. package/scripts/run-outcome-evals.sh +445 -88
  478. package/scripts/run-tests.mjs +30 -2
  479. package/scripts/skills-inventory.mjs +1 -1
  480. package/scripts/validate-workflow-security.py +39 -20
  481. package/scripts/validate-workspace-schema.py +362 -10
  482. package/scripts/validate.sh +21 -15
  483. package/engine/testdata/golden/TestParityWrightScope/devrites-edit-allowed.golden +0 -1
  484. /package/engine/testdata/golden/{TestParityReconcile/check-no-claimed.golden → TestParityBuildReadiness/arg=clarifyopen.golden} +0 -0
@@ -11,9 +11,13 @@ This is the Codex mirror of a DevRites skill. In Codex:
11
11
 
12
12
  - Load DevRites engineering standards from `.agents/skills/devrites-lib/reference/standards/`. Read `.agents/skills/devrites-lib/reference/standards/core.md` before workflow work, then load the other `.agents/skills/devrites-lib/reference/standards/*.md` files exactly when this skill asks for them.
13
13
  - Use the installed `devrites-engine` binary as the canonical runtime helper surface for orientation, gates, and state mutation.
14
- - When this skill asks for a DevRites specialist or writer agent, **explicitly** spawn the matching Codex custom agent from `.codex/agents/devrites-*.toml` through Codex subagents (`spawn_agent`), then wait for its result and reconcile it as the skill instructs. Do not do the review inline just because the instruction to spawn is embedded here: Codex under-fires embedded spawn/skill instructions (openai/codex #23496), so treat the spawn as required, not optional.
15
- - The independence of a fresh-context subagent is the point. If Codex genuinely cannot spawn subagents in the current surface, run the documented inline fallback and **label the result an inline fallback, not an independent review**: an inline pass shares the calling context and is weaker evidence.
16
- - Codex project hooks are installed in `.codex/hooks.json`. Review and trust them with `/hooks` before relying on hook enforcement.
14
+ - **Invocation and dispatch are different:** invoke means run a skill in this context; dispatch means start a fresh agent with `spawn_agent`, await it, and reconcile its result. Never describe inline skill work as a dispatch.
15
+ - For every DevRites specialist or writer dispatch, first call `spawn_agent` with the named `devrites-<role>` custom role. The matching project contract is `.codex/agents/devrites-<role>.toml`.
16
+ - If `spawn_agent` is callable but a named read-only role is unavailable, use generic `explorer` only when the host proves that run has a runtime-enforced read-only sandbox. Tell it to read `.codex/agents/devrites-<role>.toml`, follow its `developer_instructions`, and execute the unchanged packet. A missing read-only custom role is not evidence that spawning is unavailable.
17
+ - Never dispatch generic `worker` for `devrites-slice-wright` unless the host proves that worker run carries exact DevRites identity and the same `.wright-allowlist` enforcement as the named role. Codex reports a generic run as `agent_type=worker`, so the generated global hooks cannot prove that binding. Reject that unsafe rung and use the documented labelled inline wright path with `.reconcile-inline` plus the full reconcile gate.
18
+ - If the host cannot prove the generic explorer is runtime read-only, reject that rung too. Only when no spawn primitive exists or a higher-priority policy rejects a safe spawn may the root run the documented discipline inline. Label it `independence: fallback`, never call it independent, and apply every fallback risk gate. An unbound generic wright or unconfined generic explorer is such a safety rejection, not evidence that no agents exist.
19
+ - Wait for every required fresh-context dispatch before reconciling or advancing. A backgrounded or lost result is incomplete.
20
+ - Codex project hooks are installed in `.codex/hooks.json`; declared-leaf hooks are scoped inside `.codex/agents/devrites-*.toml`. Review and trust them with `/hooks` before relying on hook enforcement.
17
21
  - When this skill asks a HITL question via `AskUserQuestion`: Codex's equivalent (`request_user_input`) exists only in Plan mode. Outside Plan mode, render the option set as a plain numbered list in chat and **end the turn** so the human answers: NEVER silently pick an option yourself; auto-picking is AFK's contract, gated by the `.devrites/AFK` sentinel.
18
22
 
19
23
 
@@ -1,69 +1,64 @@
1
- # Design memory: roll proven design language into project `DESIGN.md`
1
+ # Design memory: record proven design rules in `DESIGN.md`
2
2
 
3
- Optional, UI-only step at `$rite-ship`. A feature's design decisions live in its
4
- feature-scoped `design-brief.md` and are thrown away when the workspace archives. **Design
5
- memory** is the deliberate exception: when a UI feature ships, roll the design language it
6
- *proved* up into a project-level `DESIGN.md`, so the next feature's `devrites-ux-shape`
7
- inherits the system instead of re-discovering it.
3
+ This optional `$rite-ship` step applies only to UI features. Feature design decisions
4
+ live in `design-brief.md` and archive with the workspace. With the user's approval,
5
+ copy proven, reusable design rules into the project-level `DESIGN.md` for later
6
+ features.
8
7
 
9
- The consumers already exist: `devrites-ux-shape` §1 and
10
- `devrites-frontend-craft/reference/design-references.md` both read `DESIGN.md` when present.
11
- This step is the missing **producer**. It closes the loop: feature N seals its design
12
- language → feature N+1 builds to it.
8
+ `devrites-ux-shape` §1 and
9
+ `devrites-frontend-craft/reference/design-references.md` read `DESIGN.md` when present.
10
+ This step writes that file from sealed feature evidence.
13
11
 
14
12
  ## When it runs
15
13
  - **UI features only.** No UI in the diff → skip silently.
16
14
  - **At ship, GO sealed, after the git plan, before type-GO** (step 2a), so the user sees
17
15
  the full staged change set (code + `DESIGN.md`) under the single type-GO that ships it.
18
- - **Opt-in and confirmed.** Persisting to a project-wide artifact is outside feature scope
19
- (`standards/core.md` rule 7), so it is *never silent*. Present a ranked option set
16
+ - **Opt in and confirm.** A project-wide artifact is outside feature scope
17
+ (`standards/core.md` rule 7), so never write it silently. Present a ranked option set
20
18
  (see [`afk-hitl.md`](../../devrites-lib/reference/standards/afk-hitl.md), "Option set");
21
19
  **default is skip**. The user opts to persist.
22
- - **AFK**: first-time `DESIGN.md` *creation* is treated as a `validating` gate (a new
23
- persistent project artifact): propose + queue, don't auto-create. An *append* to an
20
+ - **AFK:** first-time `DESIGN.md` creation is a `validating` gate because it adds a
21
+ persistent project artifact. Propose and queue it; do not create it automatically. An append to an
24
22
  existing `DESIGN.md` is `advisory` and may auto-proceed when `allow_gates` permits, since
25
23
  it only adds evidence-proven entries.
26
24
 
27
25
  ## Inputs (proven only)
28
26
  - `design-brief.md`: direction, color strategy, **calibration** (density / motion), key
29
27
  states, named anchors, and the per-slice **Build-time refinements**.
30
- - The **final diff** + `touched-files.md`: what tokens / components / states *shipped* (the evidence). Roll up only what the diff proves, not what the brief intended.
28
+ - The **final diff** and `touched-files.md`: the tokens, components, and states that
29
+ shipped. Record only what the diff proves, not everything the brief intended.
31
30
  - Existing `DESIGN.md` if present: the merge target.
32
31
 
33
- ## What to roll up: the project's *converged* system, evidence-gated
34
- Only entries the shipped, proven feature establishes. Each is durable, cross-feature design
35
- language, not this feature's one-off choices.
32
+ ## What to record
33
+ Record only reusable rules established by the shipped, proven feature. Exclude choices
34
+ that apply only to this feature.
36
35
  - **Tokens introduced + used:** new color roles / spacing steps / type steps / elevation
37
36
  / radius that shipped and are reusable. Names and values, mirrored from the code.
38
- - **Color strategy + calibration baseline:** the strategy (Restrained / Committed / …) and
39
- density / motion the project keeps landing on; note a deviation as a deviation, not a new
37
+ - **Color strategy and calibration baseline:** the strategy (Restrained / Committed / …) and
38
+ established density / motion; record a deviation as a deviation, not a new
40
39
  default.
41
40
  - **Type & spacing scales** in actual use; **motion** classes + easing; **materiality**
42
41
  (elevation set, hairline usage, glass / texture policy).
43
- - **Component behaviors:** for each shared component this feature established or extended:
44
- the states it ships and its interaction model. Grows one feature at a time.
45
- - **Named-anchor lineage:** the anchors features steered toward, so later work stays
46
- coherent with what's already built.
42
+ - **Component behaviors:** for each shared component established or extended by the
43
+ feature, record its shipped states and interaction model.
44
+ - **Named-anchor lineage:** the anchors used by shipped features.
47
45
  - **Anti-slop exceptions:** any banned default the project *intentionally* uses (with the
48
46
  why), so build / polish don't "correct" a deliberate choice.
49
47
 
50
48
  ## Merge discipline
51
49
  - **Append, don't overwrite.** Add proven entries; never silently rewrite an existing one.
52
- - **Conflict is a question, not an edit.** A new token / font / strategy that contradicts an
53
- existing `DESIGN.md` entry surface it to the user (the option set), don't resolve it
54
- yourself. One design system per project.
55
- - **Never invent.** If the feature didn't prove it, it doesn't go in. `DESIGN.md` is design
56
- *memory*, not design *aspiration*.
57
- - **Attribute + keep lean.** Tag each new entry with the feature slug so the lineage is
58
- legible; one good line beats a paragraph. The file is read every future spec: keep it
59
- scannable.
50
+ - **Ask about conflicts.** If a new token, font, or strategy contradicts an existing
51
+ `DESIGN.md` entry, present the option set to the user. Do not resolve it yourself.
52
+ Keep one design system per project.
53
+ - **Never invent.** Include only rules proven by the feature.
54
+ - **Attribute and keep it short.** Tag each new entry with the feature slug. Future
55
+ specs read this file, so use concise entries.
60
56
 
61
57
  ## How it commits
62
- `DESIGN.md` is a tracked project artifact, so it ships **in the feature commit**:
58
+ `DESIGN.md` is a tracked project artifact and ships **in the feature commit**:
63
59
  1. Write / update `<project-root>/DESIGN.md` from the template below.
64
- 2. **Append `DESIGN.md` to `touched-files.md`** so the existing ship commit-scoping (SKILL
65
- steps 2 + 4) stages it: the design-memory write rides the same commit and the same
66
- type-GO, no second commit.
60
+ 2. **Append `DESIGN.md` to `touched-files.md`** so the existing commit scope (SKILL
61
+ steps 2 and 4) stages it under the same type-GO. Do not create a second commit.
67
62
  3. Note the rollup in `ship.md` (what was added, or "design-memory: skipped by user").
68
63
 
69
64
  ## `DESIGN.md` template (project-level, stack-agnostic)
@@ -11,24 +11,27 @@ This is the Codex mirror of a DevRites skill. In Codex:
11
11
 
12
12
  - Load DevRites engineering standards from `.agents/skills/devrites-lib/reference/standards/`. Read `.agents/skills/devrites-lib/reference/standards/core.md` before workflow work, then load the other `.agents/skills/devrites-lib/reference/standards/*.md` files exactly when this skill asks for them.
13
13
  - Use the installed `devrites-engine` binary as the canonical runtime helper surface for orientation, gates, and state mutation.
14
- - When this skill asks for a DevRites specialist or writer agent, **explicitly** spawn the matching Codex custom agent from `.codex/agents/devrites-*.toml` through Codex subagents (`spawn_agent`), then wait for its result and reconcile it as the skill instructs. Do not do the review inline just because the instruction to spawn is embedded here: Codex under-fires embedded spawn/skill instructions (openai/codex #23496), so treat the spawn as required, not optional.
15
- - The independence of a fresh-context subagent is the point. If Codex genuinely cannot spawn subagents in the current surface, run the documented inline fallback and **label the result an inline fallback, not an independent review**: an inline pass shares the calling context and is weaker evidence.
16
- - Codex project hooks are installed in `.codex/hooks.json`. Review and trust them with `/hooks` before relying on hook enforcement.
14
+ - **Invocation and dispatch are different:** invoke means run a skill in this context; dispatch means start a fresh agent with `spawn_agent`, await it, and reconcile its result. Never describe inline skill work as a dispatch.
15
+ - For every DevRites specialist or writer dispatch, first call `spawn_agent` with the named `devrites-<role>` custom role. The matching project contract is `.codex/agents/devrites-<role>.toml`.
16
+ - If `spawn_agent` is callable but a named read-only role is unavailable, use generic `explorer` only when the host proves that run has a runtime-enforced read-only sandbox. Tell it to read `.codex/agents/devrites-<role>.toml`, follow its `developer_instructions`, and execute the unchanged packet. A missing read-only custom role is not evidence that spawning is unavailable.
17
+ - Never dispatch generic `worker` for `devrites-slice-wright` unless the host proves that worker run carries exact DevRites identity and the same `.wright-allowlist` enforcement as the named role. Codex reports a generic run as `agent_type=worker`, so the generated global hooks cannot prove that binding. Reject that unsafe rung and use the documented labelled inline wright path with `.reconcile-inline` plus the full reconcile gate.
18
+ - If the host cannot prove the generic explorer is runtime read-only, reject that rung too. Only when no spawn primitive exists or a higher-priority policy rejects a safe spawn may the root run the documented discipline inline. Label it `independence: fallback`, never call it independent, and apply every fallback risk gate. An unbound generic wright or unconfined generic explorer is such a safety rejection, not evidence that no agents exist.
19
+ - Wait for every required fresh-context dispatch before reconciling or advancing. A backgrounded or lost result is incomplete.
20
+ - Codex project hooks are installed in `.codex/hooks.json`; declared-leaf hooks are scoped inside `.codex/agents/devrites-*.toml`. Review and trust them with `/hooks` before relying on hook enforcement.
17
21
  - When this skill asks a HITL question via `AskUserQuestion`: Codex's equivalent (`request_user_input`) exists only in Plan mode. Outside Plan mode, render the option set as a plain numbered list in chat and **end the turn** so the human answers: NEVER silently pick an option yourself; auto-picking is AFK's contract, gated by the `.devrites/AFK` sentinel.
18
22
 
19
23
 
20
- # $rite-spec: investigate deeply, write the spec
24
+ # $rite-spec: investigate and write the spec
21
25
 
22
- The spec phase. Turn a request (even a vague one) into a **fully-covered, correctly-placed
23
- `spec.md`** by investigating deeply and closing every material gap with the human, so
24
- `$rite-define` can plan it and nothing is missed. **No plan, tasks, or code here**. Those
25
- are `$rite-define` and `$rite-build`.
26
+ Turn a request into a **fully covered, correctly placed `spec.md`** by investigating
27
+ the existing system and resolving every material gap found during authoring.
28
+ `$rite-clarify` audits the full topology before `$rite-define` plans it. **Do not write
29
+ a plan, tasks, or code here.** Those belong to `$rite-define` and `$rite-build`.
26
30
 
27
- > **Too small to spec? Use `$rite-quick`.** A typo, copy tweak, config bump, or one-function
28
- > fix does **not** need a full workspace + lifecycle. Stop and run `$rite-quick <change>`: its
29
- > express lane (one contract TDD build scoped prove ship) escalates back here the moment
30
- > the change turns out to touch auth / data / a migration / a public API / more than one slice.
31
- > Spec is for real features; don't pay its ceremony for a one-off.
31
+ > **Use `$rite-quick` for a small change.** A typo, copy edit, config bump, or
32
+ > one-function fix does not need a full workspace and lifecycle. Run
33
+ > `$rite-quick <change>`. It returns here if the work touches auth, data, a migration, a
34
+ > public API, or more than one slice.
32
35
 
33
36
  ## Rules consulted (read on demand from `.agents/skills/devrites-lib/reference/standards/`)
34
37
  Pull `documentation.md` via `Read`
@@ -39,35 +42,34 @@ Pull `spec-grammar.md` and `devrites-lib/reference/workspace-artifact-schema.md`
39
42
  acceptance for a behavioral / high-risk requirement (auth,
40
43
  data model, state machine, public API, money, migration): the structured `### Requirement:` /
41
44
  `#### Scenario:` (SHALL · WHEN/THEN) form, lint-checked by `devrites-engine spec-validate`. Simple criteria
42
- stay flat `AC-###` bullets; the grammar is opt-in by rigor, never forced.
45
+ stay flat `AC-###` bullets; the grammar is opt-in by rigor, never forced. Use
46
+ [`reference/acceptance-criteria.md`](reference/acceptance-criteria.md) to keep each
47
+ criterion independently observable and binary.
43
48
 
44
49
  ## Operating rules (DevRites core)
45
50
  - No silent assumptions · no guessing through confusion · prefer existing conventions ·
46
51
  ask the human when an answer changes scope, placement, data model, UX, security,
47
52
  migration risk, or acceptance.
48
- - **Author section by section, not in one dump.** Draft the spec one section at a time
49
- (problem goal requirements acceptance edge cases), and pause after each: a section
50
- that carries real risk (a contested requirement, a boundary, an unstated assumption) can be
51
- deepened right there with a fitting technique from
52
- [`elicitation.md`](../devrites-lib/reference/standards/elicitation.md) before moving on. A spec
53
- written a section at a time is where sharper thinking lands cheaply; a wall-of-text spec hides
54
- the weak section.
53
+ - **Root authority:** the controlling chat asks every human question, makes decisions, and
54
+ writes the workspace. Read-only evidence work follows the fresh-context contract in
55
+ [`agents.md`](../devrites-lib/reference/standards/agents.md).
56
+ - **Author one section at a time.** Draft problem → goal → requirements → acceptance →
57
+ edge cases, pausing after each section. If a section contains a contested requirement,
58
+ boundary, or unstated assumption, apply a relevant technique from
59
+ [`elicitation.md`](../devrites-lib/reference/standards/elicitation.md) before continuing.
55
60
 
56
61
  ## Workflow
57
62
  0. **Read `.agents/skills/devrites-lib/reference/standards/core.md`:** the always-on operating rules and anti-rationalizations.
58
63
  Then run `devrites-engine preamble` for deterministic workspace orientation.
59
- 0a. **Brownfield check: onboard before speccing onto un-adopted existing code.** If this is an
60
- **existing codebase** (real source predating DevRites) that has **never been adopted** (no
64
+ 0a. **Check whether existing code needs adoption.** If this is an
65
+ **existing codebase** that has **never been adopted** (no
61
66
  `.devrites/conventions.md`, no prior `.devrites/work`, `.devrites/features`, or `.devrites/archive`) the build has no
62
- conventions ledger to follow and the first slice would guess the project's idioms. Route
63
- through `$rite-adopt` **first**, carrying `$ARGUMENTS` as its *next objective*: adopt
64
- reverse-derives the baseline `spec.md`, **seeds the conventions ledger**, and proposes
65
- principles, so this feature is specced on top of an onboarded project (adopt owns the
66
- onboarding; `$rite-spec` only detects and routes: no duplicated logic). In **HITL** present a
67
- ranked option (recommended: *adopt first, then spec this on top*; escape hatch: *spec-only, skip
68
- onboarding*); in **AFK** (adoption allowed) run `$rite-adopt` first automatically. **Greenfield
69
- (no pre-existing source) or an already-onboarded project → skip silently**: never block a spec
70
- for the absence of adoption (the same no-op discipline as the principles gate). Cheap probe:
67
+ conventions ledger, route through `$rite-adopt` **first** and pass `$ARGUMENTS` as its
68
+ next objective. Adopt derives the baseline `spec.md`, seeds conventions, and proposes
69
+ principles; `$rite-spec` only detects and routes. In **HITL**, present a ranked option:
70
+ recommend adoption first and include a spec-only escape hatch. In **AFK**, when adoption
71
+ is allowed, run `$rite-adopt` automatically. **Skip this check silently for greenfield or
72
+ already-onboarded projects.** Never block a spec only because adoption is absent. Probe:
71
73
  ```bash
72
74
  if [ ! -f .devrites/conventions.md ] && [ ! -d .devrites/archive ] \
73
75
  && [ -z "$(ls .devrites/work .devrites/features 2>/dev/null)" ] \
@@ -75,137 +77,88 @@ stay flat `AC-###` bullets; the grammar is opt-in by rigor, never forced.
75
77
  echo "brownfield, not yet adopted → recommend $rite-adopt first (carry this idea as its next objective)"
76
78
  else echo "greenfield or already onboarded → continue spec"; fi
77
79
  ```
78
- 1. **Understand the request** (`$ARGUMENTS`). Restate the goal and the *real problem
79
- behind it* in a sentence or two.
80
- **Completion:** one sentence states both requested outcome and underlying problem.
80
+ 1. **Understand the request** (`$ARGUMENTS`). State the requested outcome and the
81
+ underlying problem in one or two sentences.
82
+ **Completion:** one sentence includes both.
81
83
  1a. **Local dedupe.** Search local issues/PRDs and archived specs before creating a new workspace:
82
84
  ```bash
83
85
  devrites-engine spec-dedupe "$ARGUMENTS"
84
86
  ```
85
87
  If it finds a close match, ask the user: extend existing / adopt / new spec. Record the choice in
86
88
  `decisions.md` once the workspace exists. No match → continue silently.
87
- 2. **Investigate deeply:** [investigation](reference/investigation.md). Produce, and
88
- later write into the spec: **current behavior**; **placement** (which module/layer/
89
- file/component should own it, the seam, patterns to reuse, and integration points:
90
- callers, dependents, data, APIs/events); **what it resolves**; **issues**
91
- (conflicts/constraints); **gaps** (unknowns); **blast radius**. Use a code-intelligence
92
- index **if available**: `codebase-memory-mcp` first, cross-checked with `codegraph`
93
- (`.codegraph/` / `codegraph_*`) + `graphify` (`graphify-out/`), else standard methods
94
- (LSP / `Read`/`Grep`/`Glob`); see `.agents/skills/devrites-lib/reference/standards/tooling.md`:
95
- for placement/callers/impact instead of broad file reads; fall back to reading files. For
96
- uncertain external library/framework facts that bear on placement or feasibility, consult
97
- context7 if available. When a material decision turns on a fact outside the codebase: a
98
- common UX pattern, a standard, a prevailing best practice, how comparable products solve it:
99
- **search the web if available** (brave MCP preferred; see `.agents/skills/devrites-lib/reference/standards/tooling.md`), and
100
- carry the cited finding into the option you put to the human at step 4.
101
- Also discover the project's **test / build/typecheck/lint** commands and the
102
- frontend/backend systems; read `PRODUCT.md` / `DESIGN.md` / `CLAUDE.md` / `AGENTS.md` if
103
- present (`AGENTS.md` is the cross-tool agent-conventions standard (treat it as project
104
- conventions the build must follow, same standing as `CLAUDE.md`), and read
105
- `.devrites/principles.md` if present) the declared invariants the feature must respect.
106
- **Consult the capability ledger**: the living record of what the system already does
89
+ 2. **Investigate:** follow [investigation](reference/investigation.md) through its
90
+ complete findings and done-when gate. Also discover the project's **test /
91
+ build/typecheck/lint** commands, frontend/backend systems, and declared project guidance
92
+ (`PRODUCT.md`, `DESIGN.md`, `CLAUDE.md`, `AGENTS.md`, and `.devrites/principles.md` when
93
+ present).
94
+ **Consult the capability ledger**, which records current system behavior
107
95
  ([`ledger.md`](../rite-ship/reference/ledger.md)): `devrites-engine ledger list` for the
108
96
  capabilities on record, then `devrites-engine ledger show <capability>` for any this feature
109
97
  touches. Also search prior decisions with `devrites-engine decisions search "<2-4 feature nouns>"`
110
- before asking the human to re-decide a settled architecture/API/auth choice. Starting from the proven contract (not a cold re-derive) is what makes the spec store
111
- compound across features; it also tells you which requirements are new vs a change to existing
112
- behavior, which decides the delta kind in step 5.
113
- 3. **Gather design references (optional):** [references-intake](reference/references-intake.md).
114
- The human **may** attach screenshots, mockups, a Figma link, a video, or links, or
115
- **none at all** (perfectly normal; skip this step then). If any are given: **view/fetch**
98
+ before asking the human to revisit a settled architecture, API, or auth choice. The
99
+ ledger shows whether each requirement is new or changes existing behavior, which
100
+ determines the delta kind in step 5.
101
+ Identify proof constraints now: human-only credentials, unavailable environments, approval
102
+ windows, or acceptance not observable through existing test/runtime/browser surfaces.
103
+ Split independent placement, blast-radius, and external-fact questions into at most three
104
+ bounded `devrites-evidence-scout` packets on one frozen baseline. Await and reconcile every
105
+ cited dossier before step 4. The scout supplies facts only; it never asks the human or writes
106
+ the spec.
107
+ 3. **Gather design references when provided:** [references-intake](reference/references-intake.md).
108
+ The human may attach screenshots, mockups, a Figma link, a video, links, or nothing.
109
+ Skip this step when none are provided. Otherwise, **view or fetch**
116
110
  them, **save local files** into `.devrites/work/<slug>/references/`, and index them in
117
111
  `references.md` as target, constraint, or inspiration. Later phases honor that role
118
112
  rather than treating every reference as a fidelity target.
119
113
  **Completion:** every supplied reference is saved and classified, or absence is explicit.
120
- 3a. **Shape the UX/UI before code (if the feature touches UI)**, when this feature is
121
- frontend ([frontend-trigger](../rite-build/reference/frontend-trigger.md)), apply
122
- `devrites-ux-shape` **now**, woven into the spec, not as a separate phase. It turns the
123
- references + the spec into a feature-level **`design-brief.md`** (design direction, key
114
+ 3a. **Shape UX/UI before code when the feature is frontend**
115
+ ([frontend-trigger](../rite-build/reference/frontend-trigger.md)). Apply
116
+ `devrites-ux-shape` within the spec phase. It turns the
117
+ references and spec into a feature-level **`design-brief.md`** (design direction, key
124
118
  states, interaction model, optional Figma/image visual-direction probe) that `$rite-build`
125
- targets so the UI is built to plan, not guessed. In HITL it pauses for the human to
119
+ targets for the build. In HITL it pauses for the human to
126
120
  confirm the direction; in AFK it asserts the best guess and logs it. Pure
127
121
  backend/data/CLI features skip this.
128
- 4. **Close the gaps with the human. You recommend, the human decides.** Every material gap
129
- (one that moves **objective · scope · placement · data model · UX · integration ·
130
- non-functional · security · migration risk · acceptance**) is **put to the human as a ranked
131
- option set**, one gap at a time, via the harness `AskUserQuestion` in HITL: **2-4 concrete
132
- options, your recommended one first and marked `(Recommended)`**, each with a one-line
133
- rationale + trade-off tagged by the dimensions that matter, plus an escape hatch (*Something
134
- else. I'll describe it*). Render contract + AFK behaviour: the **Option set** section of
135
- [`afk-hitl.md`](../devrites-lib/reference/standards/afk-hitl.md); spec-phase question discipline:
136
- [question-protocol](reference/question-protocol.md). Your job is to **investigate, rank, and
137
- recommend**, not to settle a material decision yourself. **Confidence changes the *cost* of
138
- the question, not its *owner*:** when you're near-certain, you still present the set (the
139
- human just confirms your `(Recommended)` option in one pick) you do **not** silently decide
140
- it because you predicted the answer. Only a **genuinely reversible, low-impact** detail is
141
- auto-decided and logged to `assumptions.md`; when unsure whether a gap is material, ask.
142
- (Vague ask `devrites-interview`; rough idea → `$rite-pressure-test`.) For a vague ask,
143
- load [`reference/interview-patterns.md`](reference/interview-patterns.md), **map the decision
144
- tree**, and resolve each branch depth-first; **cover every dimension**:
145
- each resolved by a human pick or explicitly deferred (logged, non-blocking), never silently
146
- skipped. Aim for **zero blocking gaps**. *If a gap is genuinely undecidable on paper (state
147
- machine that may deadlock, data shape ambiguity, "which UX wins") → suggest a
148
- scoped detour to `$rite-prototype` to answer that ONE question before
149
- continuing.* **Invariant conflict is a blocking gap:** if a requirement or acceptance
150
- criterion can only be satisfied by breaking a declared principle (`.devrites/principles.md`),
151
- surface it: the principle wins by default; breaking it needs a recorded, scoped exception a
152
- human approves, never a spec that silently contradicts an invariant.
153
- 5. **Create the workspace** + set `.devrites/ACTIVE`
154
- ([state-workspace](reference/state-workspace.md)). Write compact `README.md`,
155
- `brief.md`, and `spec.md` ([spec-template](reference/spec-template.md)). WHAT/WHY,
156
- technology-agnostic, with requirements, acceptance, edge cases, scope boundaries, links
157
- to future `architecture.md` / `traceability.md`, and measurable acceptance
158
- ([acceptance-criteria](reference/acceptance-criteria.md)). For a
159
- behavioral / high-risk requirement, write the acceptance as a structured
160
- `### Requirement:` (SHALL) + `#### Scenario:` (WHEN/THEN) block per
161
- [`spec-grammar.md`](../devrites-lib/reference/standards/spec-grammar.md), nesting the `AC-###` id inside each scenario
162
- so `$rite-seal` still grades it; routine criteria stay flat `AC-###` bullets. **When a
163
- capability the ledger already holds is changing, write those requirements as deltas**:
164
- `## ADDED / MODIFIED / REMOVED Requirements — capability: <c>` (spec-grammar.md § Delta form):
165
- so the change, not just the end state, is explicit and `$rite-ship` folds it cleanly; a
166
- capability with no ledger entry stays flat (the first sync seeds it). Also
167
- write `brief.md`, `references.md`, `questions.md`, `decisions.md`, `assumptions.md`,
168
- and an initial compact `state.md` (phase: spec) from
169
- [state-workspace](reference/state-workspace.md). When the feature touches
170
- UI, `design-brief.md` is written here too (by `devrites-ux-shape`, step 3a).
171
- Populate `## Edge Coverage` with the deterministic boundary classes implied by each requirement
172
- (empty/huge input, rounding, timezone, ordering, permissions, races, migration) and `## Prohibitions (must-NOT)`
173
- only for bespoke constraints. If the feature touches model calls, RAG, agents, evals, or LLM output,
174
- also create `ai-spec.md` from [ai-spec-template](reference/ai-spec-template.md). Then refresh any
175
- managed project context block so `AGENTS.md` / `CLAUDE.md` point at the new active workspace:
122
+ 4. **Resolve human-owned gaps.** Recommend an option and let the human decide. Apply
123
+ [question-protocol](reference/question-protocol.md), the shared
124
+ [`afk-hitl.md` option-set and decision-ownership rules](../devrites-lib/reference/standards/afk-hitl.md#decision-ownership-search-before-asking),
125
+ and [`interview-patterns.md`](reference/interview-patterns.md) for a vague ask. Every
126
+ material dimension is resolved by a human pick or explicitly deferred as non-blocking;
127
+ only genuinely reversible, low-impact details go to `assumptions.md`. A paper-only
128
+ uncertainty may take one scoped `$rite-prototype` detour. A declared-principle conflict
129
+ remains blocking until the human approves a recorded, scoped exception.
130
+ 4a. **Build-interruption forecast.** Search first, then list and close foreseeable human needs:
131
+ product/acceptance ambiguity, irreversible/external approval, or human-only access. Record
132
+ owned prerequisites. Keep a build checkpoint only for unavailable pre-code evidence or a
133
+ mandatory action-time approval. **Completion:** no foreseeable human choice is deferred.
134
+ 5. **Create the workspace** + set `.devrites/ACTIVE` from
135
+ [state-workspace](reference/state-workspace.md). Write every required artifact and
136
+ conditional annex exactly from [spec-template](reference/spec-template.md), including its
137
+ grammar/delta, coverage-seed, edge/prohibition, UI, and AI rules. Then refresh any managed
138
+ project context block so `AGENTS.md` / `CLAUDE.md` point at the new active workspace:
176
139
  ```bash
177
140
  devrites-engine context sync || true
178
141
  ```
179
- 5a. **Score the spec prose: "unit tests for English"** ([spec-checklists](reference/spec-checklists.md)).
180
- Emit `.devrites/work/<slug>/checklists/<domain>.md` (one per requirement domain the spec covers:
181
- functional · data-model · interaction · non-functional · edge-cases). Each tests the *requirement
182
- prose* for completeness / clarity / measurability: "is 'prominent' quantified?", "is every
183
- enumeration closed?", **not** the implementation. Fix each CRITICAL fail by editing the spec
184
- (not by softening the question); minor fails are logged. The checklists feed the readiness gate.
185
- 6. **Run the spec readiness gate** (bottom of spec-template): no blocking
186
- `[NEEDS CLARIFICATION]`, placement decided, all material gaps resolved, any design
187
- references provided are saved, **UX/UI shaped into `design-brief.md` if the feature is
188
- UI**, requirements testable, success criteria measurable, **one-sentence intent** (the whole
189
- change states its intent in a single sentence (if it can't, it is two features: split it or
190
- narrow the scope), **every `checklists/<domain>.md` at
191
- `Verdict: pass`**, and **any structured requirement blocks are grammar-valid**) run
192
- `devrites-engine spec-skeleton` first, then `devrites-engine spec-validate` with
193
- `--against .devrites/specs` so any delta sections are also
194
- reconciled against the ledger (an ADDED that already exists, or a MODIFIED/REMOVED that doesn't,
195
- is a blocking failure to fix, not soften):
142
+ 5a. **Check the spec prose** with [spec-checklists](reference/spec-checklists.md).
143
+ Emit every applicable domain checklist and fix each CRITICAL by correcting the spec,
144
+ never by softening the question.
145
+ 6. **Run the complete readiness gate** at the bottom of
146
+ [spec-template](reference/spec-template.md), then validate structure and ledger deltas:
196
147
  ```bash
197
148
  devrites-engine spec-skeleton ".devrites/work/<slug>"
198
149
  devrites-engine spec-validate ".devrites/work/<slug>" --against .devrites/specs
199
150
  ```
200
151
  **Do not run `devrites-engine analyze` in this phase:** `tasks.md` deliberately does not
201
152
  exist yet. `$rite-define` owns the first analyze pass after it writes the slices.
202
- Treat edge/prohibition findings as blocking just like grammar findings. When it passes, write `Spec gate: passed <iso>` to `state.md`.
203
- 6a. **Review-before-code digest.** Before handing off to planning, render the cheap human review:
153
+ Any failure blocks. The interruption forecast must be resolved, owned, or a justified
154
+ action-time gate. Then write `Spec gate: passed <iso>`.
155
+ 6a. **Review-before-code digest.** Before planning, render the compact human review:
204
156
  `Intent` (one sentence), `Done means` (top acceptance/scenario IDs), `Scope/risk` (what is in/out
205
157
  plus the hard gates), and `Build exactly this?` (yes → next phase; no → revise now). The digest
206
158
  is a view over `spec.md`, not a new artifact. **Stop** after the digest.
207
159
 
208
- > **Mid-flight discipline.** When tempted to skip investigation depth, gap-closing, or placement decisions: see [`anti-patterns`](reference/anti-patterns.md) (Common Rationalizations + Red Flags). Load it the moment you reach for the excuse.
160
+ > **Mid-flight discipline.** Do not skip investigation, gap resolution, or placement
161
+ > decisions. See [`anti-patterns`](reference/anti-patterns.md).
209
162
 
210
163
  ## Output
211
164
 
@@ -216,12 +169,12 @@ Default success shape:
216
169
  Done: spec ready for <slug>; placement decided and gaps closed.
217
170
  Changed: spec.md, decisions.md, assumptions.md, questions.md, references/ <updated|n/a>
218
171
  Evidence: checklists passed; grammar <valid | n/a flat acceptance>; design brief <path | n/a>
219
- Open: <none | n non-blocking questions | Alternative: $rite-define for small reversible work>; review digest: intent + done-means + scope/risk rendered
220
- Next: $rite-temper
172
+ Open: <none | n non-blocking questions | Alternative: $rite-quick if express-lane eligible>; review digest: intent + done-means + scope/risk rendered
173
+ Next: $rite-clarify
221
174
  Record: .devrites/work/<slug>/spec.md
222
- ↻ Hygiene: /clear before the next phase; $rite-handoff if away > a few hours
175
+ ↻ Hygiene: /clear before $rite-clarify; $rite-handoff if away > a few hours
223
176
  ```
224
- If a workspace with the slug already exists, update its spec rather than overwriting blindly:
177
+ If a workspace with the slug already exists, update its spec rather than overwriting it,
225
178
  and **show the human a short diff of what changed** in `spec.md` (acceptance criteria added /
226
179
  removed / reworded) before proceeding. A spec edit reviewed as a diff catches silent scope
227
180
  drift that a full re-read buries; this is the spec-review view (`$rite-spec --review` renders
@@ -1,23 +1,21 @@
1
- # Investigation: understand deeply before specifying
1
+ # Investigation before specification
2
2
 
3
- The spec is only as good as the investigation behind it. Goal: understand the
4
- requirement **completely**, decide **where it correctly belongs**, name what it
5
- **resolves**, and surface every **issue and gap**, then drive the gaps to closure with
6
- the user so the spec ships fully-covered and correctly-placed. A gap found here is cheap;
7
- a gap found in `$rite-build` is a drift event.
3
+ Understand the requirement, decide where it belongs, define the outcome, and identify
4
+ every issue and gap. Resolve material gaps with the user before the spec is ready. A
5
+ gap first found during `$rite-build` is a drift event.
8
6
 
9
7
  Use a code-intelligence index if available (see
10
- `../../devrites-lib/reference/standards/tooling.md`) for the structural parts below; it answers "where does this
11
- live / what calls it / what would it break" far more cheaply and accurately than reading files.
12
- With none present, fall back to Read/Grep/Glob. When a gap turns on a fact the codebase can't
13
- answer: a standard, a prevailing UX pattern, how comparable products solve it: **search the
14
- web if available** (brave MCP preferred; `../../devrites-lib/reference/standards/tooling.md`) and cite the finding in
15
- the option you present, so the human's pick is informed rather than guessed.
8
+ `../../devrites-lib/reference/standards/tooling.md`) for structural questions such as
9
+ where code lives, what calls it, and what it could break. With none present, use
10
+ Read/Grep/Glob. When a gap depends on an external fact, such as a standard, UX pattern,
11
+ or comparable product, **search the web if available** (brave MCP preferred;
12
+ `../../devrites-lib/reference/standards/tooling.md`). Cite the finding in the option
13
+ presented to the human.
16
14
 
17
- ## Prior art: check our own archive first (cheap, silent when empty)
18
- Before investigating outward, check whether we already shipped this. Grep the shipped
19
- archive for the feature's key nouns: a hit means an extension, a conflict, or a re-spec of
20
- solved work, and you inherit its decisions instead of re-deriving them:
15
+ ## Check the archive first
16
+ Before external research, check whether the project already shipped related work. Search
17
+ the archive for the feature's key nouns. A hit may indicate an extension, conflict, or
18
+ replacement and provides prior decisions:
21
19
  ```bash
22
20
  devrites-engine archive-search "<key nouns>" 2>/dev/null \
23
21
  || grep -rliE '<noun1>|<noun2>' .devrites/archive/*/spec.md 2>/dev/null
@@ -29,18 +27,18 @@ devrites-engine archive-search "<key nouns>" 2>/dev/null \
29
27
  brownfield / principles no-op discipline).
30
28
 
31
29
  ## Produce these findings (write into spec.md)
32
- 1. **The real ask:** restate the goal and the *problem behind the request* (people ask
30
+ 1. **The request and problem:** restate the goal and the problem behind it (people ask
33
31
  for "a dashboard" when they want an answer to a question). Who hits it, how often,
34
32
  what they do today instead.
35
33
  2. **Current behavior:** how it works today, or what's absent. Read the actual code and
36
34
  flows; don't assume.
37
- 3. **Placement, where it should live** *(so it's correctly placed to be used)*
35
+ 3. **Placement**
38
36
  - Which module / layer / file / component should own this; the right seam.
39
37
  - Existing patterns/components/utilities to **extend or reuse** instead of duplicating.
40
38
  - **Integration points**: callers and dependents, the data it reads/writes, the
41
39
  APIs/events/contracts it touches (interface analysis: how it interacts with the
42
40
  rest of the system).
43
- 4. **What it resolves:** the outcome/value and how we'll *observe* it's resolved (feeds
41
+ 4. **Outcome:** the result and how to observe it (feeds
44
42
  success + acceptance criteria).
45
43
  5. **Issues:** conflicts with existing code/UX/data/permissions, constraints, and
46
44
  anything that makes the obvious approach wrong. Each issue gets a disposition.
@@ -48,19 +46,22 @@ devrites-engine archive-search "<key nouns>" 2>/dev/null \
48
46
  becomes a question** (next section).
49
47
  7. **Blast radius:** what this change could break (use the code graph's impact/callers).
50
48
  Informs risks, test strategy, and rollback.
49
+ 8. **Human prerequisites:** credentials, accounts, approval windows, or irreversible
50
+ action-time decisions the acceptance path requires. Separate these from agent-owned
51
+ implementation and diagnostic work.
51
52
 
52
- Also gather any **design/reference materials** the human supplies (screenshots, Figma,
53
- links, video): see [references-intake](references-intake.md). They're part of
54
- understanding the requirement and become the target later phases verify against.
53
+ Gather any design or reference materials the human supplies, including screenshots,
54
+ Figma, links, or video. See [references-intake](references-intake.md). Record whether
55
+ each is a target, constraint, or inspiration for later phases.
55
56
 
56
57
  ## Gap analysis (present → desired)
57
- State the **present state** and the **desired state**; the delta is the work, and the
58
- **unknowns in the delta are the gaps**. Drive the count of open gaps toward zero before
59
- handing off to `$rite-define`. Mark each gap inline with `[NEEDS CLARIFICATION: question]`.
58
+ State the present and desired states. Their delta defines the work; unknowns in that
59
+ delta are gaps. Resolve them before `$rite-define`. Mark each gap inline with
60
+ `[NEEDS CLARIFICATION: question]`.
60
61
 
61
- ## Turn gaps & issues into questions WITH options: you recommend, the human decides
62
- For each material gap/issue (one that changes scope, placement, data model, UX, security,
63
- migration risk, or acceptance), **put it to the human**: one gap at a time, as a ranked
62
+ ## Present gaps and issues as options
63
+ For each material gap or issue that changes scope, placement, data model, UX, security,
64
+ migration risk, or acceptance, **ask the human** one gap at a time with a ranked
64
65
  option set with the recommended option **first and marked `(Recommended)`** plus an escape
65
66
  hatch (via `AskUserQuestion` in HITL):
66
67
  ```
@@ -70,15 +71,18 @@ hatch (via `AskUserQuestion` in HITL):
70
71
  3. <alternative> — <implication>
71
72
  4. Something else — I'll describe it
72
73
  ```
73
- Investigate and recommend; don't settle a material decision yourself. Confidence in the answer
74
- lowers the *cost* of the question (a one-pick confirm), not its owner: present the set anyway.
74
+ Investigate and recommend, but do not settle a material decision. High confidence may
75
+ make the answer a one-pick confirmation; it does not change the decision owner.
75
76
  Only a **genuinely reversible, low-impact** gap is decided and recorded in `assumptions.md`
76
77
  without asking. Full render contract + AFK behaviour: [`afk-hitl.md`](../../devrites-lib/reference/standards/afk-hitl.md).
77
78
 
78
79
  ## Done when
79
80
  - The shipped archive was checked for prior art; any overlap was surfaced to the human.
80
- - The real problem, current behavior, placement, and what-it-resolves are written down.
81
+ - The problem, current behavior, placement, and outcome are written down.
81
82
  - Every issue has a disposition; every material gap is resolved **by a human pick** from its
82
83
  option set (or explicitly deferred as non-blocking), not settled silently on your confidence.
83
- - No blocking `[NEEDS CLARIFICATION]` remains: the spec is **fully covered and correctly
84
- placed**. This is the `$rite-spec` readiness gate before `$rite-define` plans it.
84
+ - Every foreseeable build-time human prerequisite is resolved, assigned, or justified as an
85
+ action-time gate; objective repair/retry work is not disguised as a question.
86
+ - No blocking `[NEEDS CLARIFICATION]` remains. The spec covers the gaps found during
87
+ authoring and records correct placement. This is the `$rite-spec` readiness gate
88
+ before `$rite-clarify` performs the systematic topology scan.
@@ -17,13 +17,17 @@ deferred** (logged and non-blocking), never silently skipped:
17
17
  - [ ] **Integration**: external systems / APIs / contracts (or "none").
18
18
  - [ ] **Non-functional**: auth, sensitive data, latency / scale (or "n/a").
19
19
  - [ ] **Acceptance**: how each requirement is *proven* (test / observation).
20
+ - [ ] **Human prerequisites**: credentials, approval windows, irreversible action-time gates
21
+ (or "none").
20
22
 
21
23
  A blocking gap in any dimension keeps the interview open; a deferred one goes to
22
24
  `questions.md` and doesn't block. This feeds the `$rite-spec` readiness gate.
23
25
 
24
26
  ## Spec question boundary
25
- - Things the codebase answers (read it first).
26
- - Reversible implementation details (decide and note as an assumption).
27
+ - Things the codebase, prior decisions, or authoritative docs answer (search them first).
28
+ - Reversible implementation and test details (decide and note as an assumption).
29
+ - Objective tooling/environment failures (record the prerequisite or technical blocker; never
30
+ ask the human to authorize the agent's repair work).
27
31
  - Everything at once "to be thorough." Thoroughness is depth on the few that matter.
28
32
 
29
33
  ## Record