checkwright 0.20.0 → 0.22.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 (250) hide show
  1. package/README.md +385 -19
  2. package/lib/common/digest.sh +18 -0
  3. package/lib/common/lock.sh +11 -0
  4. package/lib/common/recipe.sh +8 -11
  5. package/lib/doctor.sh +49 -0
  6. package/lib/init.sh +152 -29
  7. package/package.json +2 -2
  8. package/payload/artifact/targets.list +30 -0
  9. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  10. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
  11. package/payload/canon-kit/README.md +1 -0
  12. package/payload/canon-kit/SPEC.md +281 -26
  13. package/payload/canon-kit/checks/check-comment-tier.sh +7 -2
  14. package/payload/canon-kit/checks/check-docs-link-convention.sh +11 -4
  15. package/payload/canon-kit/checks/check-md-refs.sh +22 -9
  16. package/payload/canon-kit/checks/check-payload-claim.sh +133 -0
  17. package/payload/canon-kit/checks/check-prose-enum.sh +1 -1
  18. package/payload/canon-kit/checks/check-spec-pointer.sh +15 -4
  19. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
  20. package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +26 -3
  21. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/OUTSIDE.md +4 -0
  22. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/index.md +3 -0
  23. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/OUTSIDE.md +4 -0
  24. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +8 -0
  25. package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +94 -0
  26. package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +5 -3
  27. package/payload/canon-kit/gate-tests/check-payload-claim/bad/README.md +15 -0
  28. package/payload/canon-kit/gate-tests/check-payload-claim/bad/expect.txt +2 -0
  29. package/payload/canon-kit/gate-tests/check-payload-claim/bad/install.md +19 -0
  30. package/payload/canon-kit/gate-tests/check-payload-claim/bad/posts/note.md +6 -0
  31. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +8 -0
  32. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/payload-claims.sh +7 -0
  33. package/payload/canon-kit/gate-tests/check-payload-claim/good/README.md +15 -0
  34. package/payload/canon-kit/gate-tests/check-payload-claim/good/expect.txt +2 -0
  35. package/payload/canon-kit/gate-tests/check-payload-claim/good/install.md +20 -0
  36. package/payload/canon-kit/gate-tests/check-payload-claim/good/posts/note.md +6 -0
  37. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +8 -0
  38. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/payload-claims.sh +7 -0
  39. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +24 -1
  40. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +1 -0
  41. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +1 -0
  42. package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +1 -0
  43. package/payload/canon-kit/lib/spec.sh +22 -12
  44. package/payload/canon-kit/smoke/install.sh +20 -1
  45. package/payload/canon-kit/templates/SPEC-amendment.md +5 -1
  46. package/payload/context-kit/SPEC.md +38 -7
  47. package/payload/context-kit/lib/toolfloor.sh +1 -1
  48. package/payload/context-kit/smoke/install.sh +3 -1
  49. package/payload/delegation-kit/README.md +2 -1
  50. package/payload/delegation-kit/SPEC.md +590 -48
  51. package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +97 -0
  52. package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +61 -0
  53. package/payload/delegation-kit/checks/check-gate-tamper.sh +1 -1
  54. package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/bad/agents/silent.md +7 -0
  55. package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/bad/args +1 -0
  56. package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/bad/expect.txt +1 -0
  57. package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/agents/explicit-cheap.md +7 -0
  58. package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/agents/explicit-inherit.md +8 -0
  59. package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/args +1 -0
  60. package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/expect.txt +1 -0
  61. package/payload/delegation-kit/lib/delegation.sh +3 -0
  62. package/payload/delegation-kit/smoke/install.sh +3 -1
  63. package/payload/delegation-kit/templates/agent-dispatch-guard.sh +61 -0
  64. package/payload/delegation-kit/templates/agent-execution.md +171 -15
  65. package/payload/delegation-kit/templates/delegation-config.sh +4 -0
  66. package/payload/delegation-kit/templates/dispatch-checklists.md +1 -1
  67. package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +30 -0
  68. package/payload/doctrine-kit/DOCTRINE.md +27 -0
  69. package/payload/doctrine-kit/README.md +5 -0
  70. package/payload/doctrine-kit/SPEC.md +62 -3
  71. package/payload/doctrine-kit/bin/install-doctrine.sh +84 -4
  72. package/payload/doctrine-kit/smoke/install.sh +77 -1
  73. package/payload/drift-kit/README.md +3 -2
  74. package/payload/drift-kit/SPEC.md +253 -20
  75. package/payload/drift-kit/bin/stage-economics.sh +157 -3
  76. package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +42 -0
  77. package/payload/drift-kit/smoke/install.sh +155 -1
  78. package/payload/drift-kit/templates/economics.md +9 -0
  79. package/payload/drift-kit/templates/kpis.list +6 -1
  80. package/payload/evidence-kit/README.md +20 -6
  81. package/payload/evidence-kit/SPEC.md +355 -17
  82. package/payload/evidence-kit/bin/run-validate.sh +51 -9
  83. package/payload/evidence-kit/checks/check-battery-roster.sh +86 -0
  84. package/payload/evidence-kit/checks/check-producer-liveness.sh +34 -0
  85. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/args +1 -0
  86. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/expect.txt +1 -0
  87. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/runner.md +14 -0
  88. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +7 -0
  89. package/payload/evidence-kit/gate-tests/check-battery-roster/good/args +1 -0
  90. package/payload/evidence-kit/gate-tests/check-battery-roster/good/expect.txt +1 -0
  91. package/payload/evidence-kit/gate-tests/check-battery-roster/good/runner.md +14 -0
  92. package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +7 -0
  93. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +68 -0
  94. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/args +1 -0
  95. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/expect.txt +1 -0
  96. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/run-validate.lock +1 -0
  97. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/args +1 -0
  98. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/expect.txt +2 -0
  99. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/run-validate.lock +1 -0
  100. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +109 -0
  101. package/payload/evidence-kit/lib/evidence.sh +18 -0
  102. package/payload/evidence-kit/smoke/install.sh +17 -3
  103. package/payload/gate-sdk/README.md +4 -1
  104. package/payload/gate-sdk/SPEC.md +1955 -79
  105. package/payload/gate-sdk/bin/gen-pre-commit.sh +13 -3
  106. package/payload/gate-sdk/bin/run-consumer-smoke.sh +121 -1
  107. package/payload/gate-sdk/bin/run-gate-tests.sh +40 -9
  108. package/payload/gate-sdk/bin/run-gates.sh +32 -3
  109. package/payload/gate-sdk/bin/upgrade-smoke.sh +3 -3
  110. package/payload/gate-sdk/checks/check-action-gh-repo.gate +2 -0
  111. package/payload/gate-sdk/checks/check-action-pinning.gate +2 -0
  112. package/payload/gate-sdk/checks/check-action-run-shell.sh +3 -1
  113. package/payload/gate-sdk/checks/check-core-files.sh +27 -4
  114. package/payload/gate-sdk/checks/check-exec-bit.sh +20 -1
  115. package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +106 -0
  116. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +6 -7
  117. package/payload/gate-sdk/checks/check-gate-output.sh +9 -1
  118. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +302 -0
  119. package/payload/gate-sdk/checks/check-graph.sh +7 -8
  120. package/payload/gate-sdk/checks/check-readme-roster.sh +5 -0
  121. package/payload/gate-sdk/checks/check-reads-couples.sh +73 -22
  122. package/payload/gate-sdk/checks/check-template-registry-parity.sh +81 -0
  123. package/payload/gate-sdk/checks/check-tree-terms.sh +11 -7
  124. package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +16 -1
  125. package/payload/gate-sdk/gate-tests/check-core-files.test.sh +64 -0
  126. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/args +2 -0
  127. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/expect.txt +5 -0
  128. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/kitroot/checks/check-vendored.gate +2 -0
  129. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/check-ported.gate +2 -0
  130. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +2 -0
  131. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gates.list +4 -0
  132. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stamp.txt +1 -0
  133. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stub-bin +6 -0
  134. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/args +2 -0
  135. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/expect.txt +5 -0
  136. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/kitroot/checks/check-vendored.gate +2 -0
  137. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/check-ported.gate +2 -0
  138. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +2 -0
  139. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gates.list +4 -0
  140. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stamp.txt +1 -0
  141. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stub-bin +5 -0
  142. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +81 -0
  143. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +3 -1
  144. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +3 -1
  145. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +3 -1
  146. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
  147. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +1 -0
  148. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +1 -0
  149. package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
  150. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/args +2 -0
  151. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/conservation.md +7 -0
  152. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +12 -0
  153. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/impl/gate.rs +2 -0
  154. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kitroot/check-orphan.rs +3 -0
  155. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/publish.yml +15 -0
  156. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +3 -0
  157. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.gate +1 -0
  158. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.sh +3 -0
  159. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +1 -0
  160. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +6 -0
  161. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +3 -0
  162. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +3 -0
  163. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/targets.list +3 -0
  164. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/args +2 -0
  165. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/conservation.md +8 -0
  166. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -0
  167. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/impl/gate.rs +2 -0
  168. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kitroot/check-other.rs +3 -0
  169. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/publish.yml +15 -0
  170. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +3 -0
  171. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-ported.gate +2 -0
  172. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +6 -0
  173. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +2 -0
  174. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +3 -0
  175. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/targets.list +2 -0
  176. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +123 -0
  177. package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +139 -0
  178. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/templates/widgets.list +4 -0
  179. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-one.sh +3 -0
  180. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-two.sh +3 -0
  181. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +4 -0
  182. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +1 -0
  183. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/scripts/gate-sdk-config.sh +5 -0
  184. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/templates/widgets.list +4 -0
  185. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-one.sh +3 -0
  186. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-two.sh +3 -0
  187. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +8 -0
  188. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/rules.list +5 -0
  189. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/table.tsv +4 -0
  190. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -0
  191. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +5 -0
  192. package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +4 -4
  193. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +41 -1
  194. package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +144 -0
  195. package/payload/gate-sdk/lib/consumer-smoke.sh +26 -1
  196. package/payload/gate-sdk/lib/gate.sh +104 -13
  197. package/payload/gate-sdk/lib/inject.sh +21 -1
  198. package/payload/gate-sdk/smoke/install.sh +19 -1
  199. package/payload/guard-kit/README.md +4 -3
  200. package/payload/guard-kit/SPEC.md +88 -10
  201. package/payload/guard-kit/bin/compare-settings-allow.sh +40 -7
  202. package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +64 -0
  203. package/payload/guard-kit/lib/guard.sh +1 -0
  204. package/payload/guard-kit/templates/close-triage.md +35 -7
  205. package/payload/guard-kit/templates/guard-config.sh +3 -0
  206. package/payload/lifecycle-kit/README.md +1 -0
  207. package/payload/lifecycle-kit/SPEC.md +589 -33
  208. package/payload/lifecycle-kit/bin/enter-stage.sh +13 -3
  209. package/payload/lifecycle-kit/bin/file-gap.sh +42 -1
  210. package/payload/lifecycle-kit/bin/file-survey.sh +50 -0
  211. package/payload/lifecycle-kit/checks/check-merge-attrs.sh +1 -1
  212. package/payload/lifecycle-kit/checks/check-skill-binding.sh +1 -1
  213. package/payload/lifecycle-kit/checks/check-survey-record.sh +102 -0
  214. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +1 -0
  215. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +1 -0
  216. package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +1 -0
  217. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/args +2 -0
  218. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +4 -0
  219. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +18 -0
  220. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/args +2 -0
  221. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -0
  222. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +13 -0
  223. package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +84 -0
  224. package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +94 -0
  225. package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +102 -0
  226. package/payload/lifecycle-kit/lib/stages.sh +8 -2
  227. package/payload/lifecycle-kit/smoke/install.sh +17 -1
  228. package/payload/lifecycle-kit/templates/consult.md +73 -0
  229. package/payload/lifecycle-kit/templates/lead.md +141 -10
  230. package/payload/lifecycle-kit/templates/stages/align.md +12 -0
  231. package/payload/lifecycle-kit/templates/stages/build.md +8 -0
  232. package/payload/lifecycle-kit/templates/stages/close.md +25 -4
  233. package/payload/lifecycle-kit/templates/stages/scope.md +34 -0
  234. package/payload/lifecycle-kit/templates/stages/spec.md +8 -0
  235. package/payload/lifecycle-kit/templates/stages/validate.md +8 -0
  236. package/payload/queue-kit/README.md +4 -1
  237. package/payload/queue-kit/SPEC.md +230 -6
  238. package/payload/queue-kit/bin/queue-edges.sh +78 -0
  239. package/payload/queue-kit/checks/check-queue-entry-budget.sh +5 -3
  240. package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +5 -0
  241. package/payload/queue-kit/gate-tests/queue-edges.test.sh +130 -0
  242. package/payload/queue-kit/smoke/install.sh +4 -1
  243. package/payload/queue-kit/templates/TASK-QUEUE.md +3 -0
  244. package/payload/site-kit/SPEC.md +135 -29
  245. package/payload/site-kit/checks/check-docs-render-fidelity.sh +100 -27
  246. package/payload/site-kit/gate-tests/check-docs-render-fidelity-batch.test.sh +158 -0
  247. package/payload/site-kit/lib/site.sh +16 -2
  248. package/payload/site-kit/smoke/install.sh +9 -1
  249. package/payload/gate-sdk/checks/check-action-gh-repo.sh +0 -321
  250. package/payload/gate-sdk/checks/check-action-pinning.sh +0 -55
@@ -41,6 +41,60 @@ disjointness — so the cap is a correctness bound, never a preference a consume
41
41
  may configure up for committing agents (the knob's derivation: §Layout and
42
42
  configuration).
43
43
 
44
+ The template's **Background + notification, never poll** rule reads as
45
+ universal but is not, and the sentence that scopes it is a fact rather than a
46
+ role list: backgrounding survives a turn, and a dispatched agent's turn end is
47
+ its session end. Attested failure surface — a stage session read the rule,
48
+ backgrounded its whole validate suite, ended its turn to report progress, and
49
+ its child died with it: an entry stamp, no results, the suite re-run from
50
+ scratch. Nothing reddened, because missing evidence is indistinguishable from
51
+ pending evidence. Two phrasings were drafted and rejected on the way to the
52
+ current one, and both failures are instructive: a role-neutral "never end your
53
+ turn with detached work" forbids the supervisor pattern the same rule
54
+ prescribes, and "await it in the **foreground**" names a lever the agent may
55
+ not have — dispatches made *without* requesting backgrounding have been
56
+ observed detached anyway, so a rule stated on foreground is unfollowable
57
+ exactly where it is needed. That a subagent's return terminates its background
58
+ children was **attested here and inferred from the harness docs, not stated by
59
+ them**, and a counter-observation has since narrowed it: a validate session
60
+ backgrounded a *shell* producer, ended its turn, and the process kept running
61
+ and kept writing its output file for minutes. Reaping holds for an `Agent`
62
+ child and not for a shell one, so the rule's mechanism is the unconditional
63
+ loss of the **observer**, not the conditional loss of the work — and the
64
+ surviving-producer case is the worse of the two, since it is
65
+ `validate-producer-liveness-unobservable`'s hazard (an unread producer mutating
66
+ shared files while the next actor moves) arriving through the backgrounding
67
+ door. The rule is anchored on the invariant either way — an agent's contract
68
+ with its caller is its return value, so work whose result is not in the return
69
+ did not happen as far as the caller is concerned — which is why the
70
+ counter-observation cost the rule a sentence and not its content, exactly as
71
+ this paragraph predicted a reaping change would.
72
+
73
+ **Why that correction needed an affordance, not just a better reason.** The
74
+ session that produced the counter-observation reasoned *correctly* into the
75
+ failure: it read the producer-liveness hazard, concluded it must not let the
76
+ next actor proceed until the producer finished, and ended its turn to wait for
77
+ the completion notification — the one act that destroys that channel for a
78
+ dispatched role. A rule whose correct application requires a channel the reader
79
+ does not have is defeated by careful readers and not only careless ones, so the
80
+ template names the channel a dispatched role *does* have: an in-turn wait on the
81
+ work's own artifact. This is the case where the backgrounding rule and the
82
+ liveness hazard meet and neither, alone, covered it.
83
+
84
+ The template's **Findings you will act on are durable before you act on them**
85
+ rule rests on a near-loss rather than a loss: a close stage dispatched two
86
+ audit sweeps and then hit the session wall. Both had already returned, which
87
+ was luck; had the wall landed mid-sweep the audit work would have been gone
88
+ with no record it ran. The gap is that the journal mechanics are written for a
89
+ dispatched *mutating* agent, so a read-only child journals nothing and its
90
+ findings exist only as a return value in the parent's context. The fix
91
+ deliberately does **not** overturn the read-only-fan-out caveat in §Resume
92
+ journal — that caveat was re-examined against this evidence and kept, with its
93
+ duty relocated to the receiving end, because overturning it would put the write
94
+ back exactly where the observed failures are. Recorded here because the rule
95
+ and the caveat otherwise read as each other's contradiction and the next
96
+ reader re-litigates them.
97
+
44
98
  `templates/agent-budget-guard.sh` closes the gap the template's
45
99
  **Budget-check before *each* dispatch in a fan-out** rule leaves when it relies
46
100
  on the agent *choosing* to run the tool: a memory-quoted percentage acts in its
@@ -76,6 +130,24 @@ consumer). Registration is the opt-in valve: a consumer wanting pure advice
76
130
  does not wire the hook. No new persistent state and no new key on the
77
131
  `usage.txt` contract — the verdict line is the only interface.
78
132
 
133
+ **Covered at every depth, aggregated at none.** The hook's registration is
134
+ session-wide, so it fires inside dispatched sessions too: a dispatched
135
+ session's own dispatches re-arm it, carrying that session's identity, and the
136
+ coverage reaches every depth rather than stopping at the root. What it cannot
137
+ do is **aggregate** — each fire is independent and holds no state about the
138
+ tree, so a verdict prices the one call it gates and never the subtree that call
139
+ opens. That pairing is what the subtree clause of the template's
140
+ **Budget-check before *each* dispatch in a fan-out** rule exists to compensate,
141
+ and stating both halves here is what stops the next reader re-filing either.
142
+ Calibration history, because the silence invited the wrong turn: the hook
143
+ script is stateless and carries no depth counter, and a scope survey read that
144
+ as *the guard does not reach below the root* and filed against it. The reading
145
+ of the script was exact; the inference from it was false. A guard whose output
146
+ is only ever seen by the session it fires in looks absent from every other
147
+ vantage point — so a supervisor counting its own hook fires is watching a
148
+ strict undercount of its own tree, which is the observation the residual
149
+ projection gap is stated against rather than a coverage gap to be re-armed.
150
+
79
151
  A knob-raise ruling has one working transport in this harness: the settings
80
152
  env block (`.claude/settings.local.json`), which hooks re-read per fire — the
81
153
  raised `DELEGATION_KIT_PAUSE_PCT` reaches the guard on the next dispatch with
@@ -86,7 +158,167 @@ Propagation is asymmetric within a live session: the hook re-reads the file
86
158
  per fire, but the Bash tool environment retains an injected value after the
87
159
  entry is deleted until the session restarts — an in-session `usage-verdict`
88
160
  run and a hook fire can judge against different thresholds in that window, so
89
- the hook's verdict line, not an in-session re-run, is the acting reading.
161
+ the hook's verdict line, not an in-session re-run, is the acting reading. That
162
+ this transport *works* is not a permission to use it for everything a harness
163
+ env var reaches: the subagent-model override below rides the same block and is
164
+ refused there, so the two must not read as one sanction.
165
+
166
+ **The subagent-model environment override is refused, and the reason is
167
+ precedence.** Model resolution runs in a fixed order — the subagent-model
168
+ environment override, then a dispatch's own `model` parameter, then the agent
169
+ definition's `model:` frontmatter, then the dispatching conversation's model —
170
+ and the environment rung sits *above* the per-dispatch parameter. Setting it
171
+ would pin every subagent to a cheap tier in one line, and would thereby
172
+ silently defeat a supervisor's deliberate per-batch tier pin, the mechanism
173
+ `lifecycle-kit/templates/lead.md` §Economics — batch, and compact where it pays
174
+ depends on to tier a batch by its work classes. A lever that overrides the
175
+ deliberate choice is not a default; it is a ceiling, so it is recorded as
176
+ rejected rather than left to be rediscovered as an improvement. The correct
177
+ rung is the **frontmatter**, third in the chain: it supplies the standing
178
+ default the template's **Match the dispatched model and effort to the unit's
179
+ shape** rule asks for while the per-dispatch parameter still overrides it. The
180
+ same rule's affirmative-selection clause is why the field is *stated* rather
181
+ than left out — an omitted `model:` resolves to the literal `inherit`, so
182
+ omission spells the dispatcher's tier rather than a neutral absence, and
183
+ `check-agent-tier-explicit` is that clause's oracle over the tracked surface.
184
+
185
+ **The dispatch-shape rules are one mechanism, seen from several sides.** The template's **Never dispatch
186
+ a fork to narrow a child**, **A read-only claim is made by isolation, not by
187
+ sentence**, and **A child's only upward route is a durable artifact** rules are
188
+ one defect seen from three sides: each governs the *shape of a dispatch call*,
189
+ and each failed the same way — the prose did not reach the reader it binds.
190
+ One attested surface per rule: a fork dispatched as a read-only audit completed
191
+ a whole stage, commits included; four forks dispatched with prose-only
192
+ "read-only, no edits" briefs, one of which committed unreviewed on the shared
193
+ branch; and repeated fan-outs, across stages and across iterations, messaged the top-level
194
+ session instead of their dispatcher, which no prompt wording could have fixed.
195
+
196
+ **Why an oracle is owed here and not for the turn-ending rule.** §Operative
197
+ residency closes on the finding that a restated rule is reachable, not obeyed,
198
+ and owes no gate because no check can read a session's choice to end a turn —
199
+ the act leaves no tracked artifact. A dispatch leaves no tracked artifact
200
+ either, so the distinguishing axis is not durability but interception:
201
+
202
+ > Where a rule binds an act that leaves no tracked artifact, the enforcement
203
+ > question is whether the act passes a **chokepoint** — not whether it reaches
204
+ > the tree. A dispatch does. A turn-end does not.
205
+
206
+ **The chokepoint — what a `PreToolUse` hook can actually read.** The payload
207
+ carries `session_id`, `prompt_id`, `transcript_path`, `cwd`, `permission_mode`,
208
+ `hook_event_name`, `tool_name`, `tool_input`, and `tool_use_id`; and, **only
209
+ when the hook fires inside a subagent**, `agent_id` and `agent_type`. For the
210
+ dispatch tool, `tool_input` carries the dispatch's own parameters —
211
+ `subagent_type`, `isolation`, `model`, `description`, `prompt`. Three
212
+ consequences carry the guard below: the fork ban has an exact trigger
213
+ (`tool_input.subagent_type`), the read-only claim has an exact trigger
214
+ (`tool_input.isolation`), and depth has an exact, *documented* discriminator —
215
+ `agent_id` is present iff the dispatching session is itself a subagent, so its
216
+ presence means the call about to be made creates a grandchild.
217
+
218
+ **Honest limit on that roster.** It is sourced from the harness's own published
219
+ hook contract, fetched rather than recalled, and from nothing in this tree —
220
+ the same footing as `CLAUDE_CODE_CHILD_SESSION`'s "verified, not trusted"
221
+ treatment (lifecycle-kit/SPEC.md §bin/session-id.sh). A future harness revision
222
+ reshaping the payload is drift this SPEC cannot self-detect; only re-reading the
223
+ hook contract catches it.
224
+
225
+ **Two depth routes ruled out**, both being the obvious move.
226
+ `CLAUDE_CODE_CHILD_SESSION` is set in top-level sessions too, and
227
+ `CLAUDE_CODE_SESSION_ID` carries the *root* id for a child, so a depth-1 and a
228
+ depth-2 dispatcher are indistinguishable by environment alone — that route
229
+ ships a rule silently mis-firing at the top level. The meta record beside a
230
+ transcript does carry an exact spawn depth, and that route works and is
231
+ deliberately not taken: it couples a hook to an *uncontracted* harness artifact
232
+ to answer a question one *contracted* boolean already answers. The
233
+ stage-economics meter accepts that same coupling (drift-kit/SPEC.md §The
234
+ stage-economics meter, the fan-out row) because it needs the whole spawn forest
235
+ and no contracted field supplies it; a hook needs one bit and gets it under
236
+ contract. The axis is what the contract supplies, not appetite for risk.
237
+
238
+ `templates/agent-dispatch-guard.sh` is that oracle — a second `PreToolUse` hook
239
+ on matcher `Agent`, beside the budget guard, composed from
240
+ `guard-kit/lib/guard.sh` primitives. It reads the payload once and runs the
241
+ rules below, in order:
242
+
243
+ | # | rule | trigger | decision |
244
+ | --- | --- | --- | --- |
245
+ | D1 | fork ban | `tool_input.subagent_type` is `fork` | block |
246
+ | D2 | isolation claim | `tool_input.subagent_type` ∈ `DELEGATION_KIT_READONLY_TYPES` and `tool_input.isolation` is not `worktree` | block |
247
+ | D3 | depth advisory | payload carries `agent_id` | advise |
248
+
249
+ Order is load-bearing only between D1/D2 and D3 — a blocked dispatch needs no
250
+ advisory, so D3 runs last. D1 precedes D2 because the fork ban is unconditional
251
+ and its message is the more specific one for a dispatch violating both.
252
+
253
+ **Why a second guard rather than more rules in the budget guard.** Four
254
+ reasons, each independently sufficient: the budget guard blocks on a
255
+ **transient** condition and is deliberately knob-overridable, while these block
256
+ on a **permanent** doctrine violation that must not be per-dispatch
257
+ overridable; the budget guard reads no stdin at all; a consumer may want either
258
+ enforcement without the other, and hook registration is the only opt-in valve
259
+ there is; and their test lanes take different payload grammars. The harness
260
+ fires every hook registered on a matcher and any exit 2 blocks, so the two
261
+ compose with no dispatcher between them.
262
+
263
+ **D1 blocks unconditionally**, which the template's own boundary does not — a
264
+ fork stays correct where the child does the same job at the same authority, and
265
+ a hook cannot read intent. The block is ruled unconditional on the ground that
266
+ no sanctioned fork use exists in this doctrine, and the valve is **unwiring the
267
+ hook**, never a knob: a per-dispatch override is exactly the honour system
268
+ these rules exist to end, and a knob would restore it under a better
269
+ name. The block message names the two lawful alternatives, as guard-kit
270
+ requires of every block message.
271
+
272
+ **D2 is inert until configured**, by construction — the default roster is empty
273
+ and the kit ships no agent-type names. An inert D2 reports nothing; it is a
274
+ hook, not a gate, so there is no clean line to print. Stated here so a consumer
275
+ does not infer coverage it has not configured.
276
+
277
+ **D3 advises rather than blocks**, and both halves are deliberate. It cannot
278
+ block: a nested dispatch is legitimate and common — a stage session's own
279
+ read-only fan-out *is* a grandchild dispatch — so blocking would remove a
280
+ capability rather than confine one. It must not be silent: this is the one rule
281
+ whose bound reader provably never loads the protocol template (§One template, a
282
+ resident pointer), so the advisory is the *only* delivery of it, which is
283
+ §Operative residency's (a)–(c) shape applied at a hook instead of a doc. Ruled
284
+ out for D3: keying on whether the prompt text "names a path" — that fires on
285
+ the word and teaches dispatchers to game the wording, buying a green hook and
286
+ no channel. The `agent_id` trigger is exact and unforgeable; the message
287
+ carries the judgment the trigger cannot.
288
+
289
+ **Degradation — fail-open, but loud**, the posture guard-kit/SPEC.md §The guard
290
+ framework names for a deny-guard whose matcher proves the tool but whose rule
291
+ turns on a payload field:
292
+
293
+ | what is missing | behavior |
294
+ | --- | --- |
295
+ | `jq` absent | allow; one advisory naming the unenforced rules |
296
+ | payload unparseable, or `tool_input` absent | allow; same advisory |
297
+ | `subagent_type` absent from a parseable payload | D1 and D2 do not fire (nothing to match); D3 unaffected |
298
+ | `DELEGATION_KIT_READONLY_TYPES` unset or empty | D2 inert, and silently so; D1 and D3 unaffected |
299
+ | `DELEGATION_KIT_CONFIG_FILE` set but naming no file | allow; advisory naming D2 unenforced |
300
+ | `guard-kit/lib/guard.sh` not vendored | the guard exits 0 before sourcing, as both shipped guards already do |
301
+
302
+ Two implementation facts those rows force, recorded because the obvious build
303
+ gets each of them wrong:
304
+
305
+ - **The `jq`-absent arm cannot deliver through `guard_advise`.** That primitive
306
+ is itself jq-backed, and measuring it rather than assuming settles what
307
+ happens: with `jq` off `PATH` it writes an empty stdout and leaves a shell
308
+ "command not found" on stderr, which names none of the unenforced rules — the
309
+ silent success these rules exist to end, arriving inside the mechanism meant
310
+ to prevent it. The guard therefore emits the advisory envelope itself on that
311
+ arm, and every advisory literal it carries is kept free of the characters
312
+ JSON must escape, since that fallback carries no escaper.
313
+ - **The guard does not source delegation-kit's validating config loader**, only
314
+ the consumer config file, for the one array it reads. The loader exits 2 on
315
+ any malformed knob and a hook that exits 2 blocks, so routing the fork ban
316
+ through a validator for `DELEGATION_KIT_FAN_WIDTH` would let an unrelated
317
+ typo wedge every dispatch in the consumer whose primary token lever is
318
+ delegation — the fail-closed posture this guard is specified against,
319
+ arriving through the config door. The distinction the last two table rows
320
+ draw is this kit's standing one: a roster **configured to nothing** is
321
+ silent, a roster that **could not be read** is loud.
90
322
 
91
323
  ### One template, a resident pointer
92
324
 
@@ -123,50 +355,202 @@ The consumer's CLAUDE.md carries no digest of the bullets, only a resident
123
355
  pointer: the pre-authorization sentence (consumer judgment on what delegation
124
356
  needs no ask) and `/agent-execution`. Rationale: a rule is resident only when it
125
357
  has no load trigger (the load-trigger-residency doctrine), and every protocol
126
- bullet triggers at `Agent` dispatch — which already has a mechanical seam, the
358
+ bullet triggers at `Agent` dispatch **for the role that dispatches** — which
359
+ already has a mechanical seam, the
127
360
  per-dispatch budget guard, whose block message names `/agent-execution`. The
128
- doctrine lives behind the trigger, not in the always-loaded file. Honest limit:
129
- the guard enforces budget mechanically, not protocol literacy — a session that
130
- dispatches without invoking the skill carries only the resident pointer.
131
-
132
- ## Resume journal — agent writes, supervisor deletes
133
-
134
- A mutating agent `Write`s a running progress journal (findings triaged,
135
- edits applied, what remains) to a repo-local gitignored scratch directory
136
- in the main checkout — never a temporary worktree (a worktree-isolated
137
- agent's own tree is deleted with the worktree, taking the journal) nor a
138
- system temp dir (a restart wipes tmpfs). The supervisor names that path
139
- **absolute into the main checkout** in the dispatch prompt, so a
140
- worktree-isolated agent writes to the surviving checkout, not its doomed
141
- tree. Repo-dir-local scratch is reboot-survivable, cheap to clean, and
142
- predictable across coding agents. The agent updates the journal as it
143
- goes; on success it appends a `DONE` marker. Each finding lands in the journal *inline as it is
144
- confirmed* — never "see final output": the agent's return message dies with
145
- the session, so a pointer-only journal makes `DONE` lie about
146
- recoverability. Agents have no `rm`; the supervisor deletes the journal at
147
- the post-commit validation checkpoint. Whether a journal *without* `DONE`
148
- signals interruption turns on whether the supervisor consumed the agent's
149
- return. On the ordinary completion path the supervisor received the return and
150
- ran its post-commit verification (§Validate after every agent commit); that
151
- return plus the verification *is* the recovery contract, attesting completion
152
- directly, so the `DONE` marker is redundant and a journal without it does
153
- **not** imply interruption. Only in a **cold read** — the supervisor finds a
154
- journal but never consumed a return, the agent's session having died before
155
- returning (a background sandbox died, a crash, a timeout) — is the marker the
156
- sole signal, and there the original reading holds: no `DONE` = interrupted,
157
- resume from it. The inline-findings rule above is exactly that cold arm's
158
- insurance — with no surviving return, a pointer-only journal would make a
159
- would-be `DONE` lie about recoverability.
361
+ doctrine lives behind the trigger, not in the always-loaded file. Honest limit,
362
+ tightened now that a second hook rides the same matcher: the guards enforce
363
+ mechanically exactly the rules that pass a chokepoint — the budget check, and
364
+ the dispatch-shape rules (§The delegation model) — and protocol literacy
365
+ beyond those stays unenforced. A session that dispatches without invoking the
366
+ skill still carries only the resident pointer for everything else.
367
+
368
+ **That role qualifier is load-bearing rather than hedging.** Stated without it,
369
+ the rationale is role-blind: a *dispatched* role fires no such trigger — it is
370
+ not dispatching at all, it is executing a stage, and no stage skill or stage
371
+ template loads this protocol — so for that reader the pointer posture leaves the
372
+ rule unreached, which is how a posture nobody disputes produced three incidents.
373
+ §Operative residency governs that case, and the bounded imperative it sanctions
374
+ in a consumer's always-loaded agent definition is this same doctrine applied at a
375
+ different reader, not an exception carved out of this paragraph.
376
+
377
+ ### Operative residency
378
+
379
+ A rule may be **restated as an imperative in a surface that does not own it**
380
+ when all three of these hold:
381
+
382
+ - **(a) Unreachable trigger.** The actor the rule binds never fires a trigger
383
+ that loads the rule's owning doc. This is a property of the *reader*, settled
384
+ by asking which triggers that reader actually fires.
385
+ - **(b) Imperative only.** What is restated is the instruction. The reasoning,
386
+ the failure analysis, and the mechanism stay with the owner.
387
+ - **(c) Adjacent citation.** The restatement names the owning surface beside
388
+ itself, so the owner stays the single place the rule is explained and changed.
389
+
390
+ Each condition has a reader at a transition rather than being self-evident: (a)
391
+ and (b) are read by whoever authors a restatement, at authoring, and again by a
392
+ reviewer or an authoring stage assessing an existing one; (c) is the pointer any
393
+ later reader — and any content-tiering check — follows back to the owner. The
394
+ reader the sanction exists for is the third and never inspects a condition at
395
+ all: the bound actor, which receives the imperative at the tier it always loads,
396
+ which is the whole point.
397
+
398
+ **The anti-licence clause is part of the rule, not commentary.** The sanction is
399
+ keyed on (a): a rule that the bound actor's own skill or template already loads
400
+ fails (a) and stays a pointer. Without that clause this reads as "duplicate when
401
+ it feels important", which is the failure content-tiering exists to prevent and
402
+ would cost more than the gap it closes.
403
+
404
+ **This is load-trigger residency's own logic, not an exception to it.** That
405
+ doctrine earns a rule a place in an always-loaded file only when no stage, skill,
406
+ or tool-call trigger exists to load it, and the decisive question is *exists for
407
+ whom*. A trigger that exists but that the bound actor never fires is, for that
408
+ actor, no trigger. The doctrine's stated justification — a rule a stage or a tool
409
+ call would load anyway costs nothing to defer and everything to keep resident —
410
+ does not merely fail for such an actor, it inverts: nothing loads it anyway, so
411
+ deferring costs everything.
412
+
413
+ **Content-tiering is satisfied by bounding what is copied, which is what (b) is
414
+ for.** The restatement is still a restatement, which is why it needs this
415
+ sanction rather than an argument; but its drift surface is one instruction rather
416
+ than a slab, and the place the rule is explained and changed stays single.
417
+
418
+ The attested subjects are the template's **Background + notification, never
419
+ poll** rule and its **Findings you will act on are durable before you act on
420
+ them** rule, both of which bind a dispatched session. Three such sessions read a
421
+ *descriptive* pointer to them at the always-loaded tier and derived no constraint
422
+ from it. The derivations were easy, which is what makes the failure instructive:
423
+ under load a descriptive sentence reads as background about one's situation
424
+ rather than as a constraint on the next action. The defect this rule names is
425
+ therefore pointer-versus-operative-statement, never absence.
426
+
427
+ **Operative is not obeyed, and a fourth firing is the attestation.** A dispatched
428
+ session ended its turn on work still running while the waiting rule sat in that
429
+ session's own agent definition as a bare imperative, restated under (a)–(c) —
430
+ the compliant form this sanction licenses. So the diagnosis above names a cause
431
+ *removed*, not the defect *closed*: residency makes a rule reachable at the point
432
+ of use, and reachable is not obeyed. Every restatement this sanction licenses is
433
+ a request delivered where it is read. Weigh it as one — worth its small drift
434
+ surface for the failure mode it does remove, and never a substitute for an
435
+ oracle where one is buildable. In the attested instance what caught the
436
+ consequence was the artifact-side oracle below, with the prose already in its
437
+ strengthened form.
438
+
439
+ **No gate is owed, and not for budget.** No check can read a session's choice to
440
+ end a turn — the act leaves no tracked artifact. The anti-restatement gates were
441
+ checked against a sanctioned restatement rather than assumed inert, since a
442
+ sanction that required weakening a gate would be the wrong sanction:
443
+ `check-shim-restatement` scans binding shims under the skills directory against a
444
+ corpus of the consumer's always-loaded file plus kit templates, so a consumer's
445
+ agent definition is neither its scanned surface nor its corpus, and
446
+ `check-surface-duplication`'s predicate is a glossary term's definition on a
447
+ canonical SPEC surface, which reaches no agent definition either. The sanction
448
+ therefore ships with **no gate exemption** — and the honest converse ships with
449
+ it: nothing in the battery would catch a *non*-compliant restatement, so (a)–(c)
450
+ are review-enforced. The nearest buildable oracle detects a *consequence* rather
451
+ than the act — `check-producer-liveness` reads a producer still running at the
452
+ next stage's entry (evidence-kit/SPEC.md §check-producer-liveness).
453
+
454
+ **A case where an oracle *was* buildable now sits beside this one, and the two
455
+ are not each other's contradiction.** The dispatch-shape rules bind acts
456
+ that leave no tracked artifact either, yet they are gated. The axis that
457
+ separates them is **interception, not durability**: a dispatch passes a
458
+ chokepoint the harness fires a hook on, and a turn-end passes none (§The
459
+ delegation model, which owns the generalization). So "no tracked artifact" is
460
+ why neither rule gets a *gate* over the tree, and it is not by itself a reason
461
+ to stop looking for an oracle. Recorded here for the same reason §The
462
+ delegation model records the durability rule beside the read-only-fan-out
463
+ caveat: otherwise the next reader re-litigates one of the two paragraphs.
464
+
465
+ ## Resume journal — agent writes, scratch reset sweeps
466
+
467
+ **The contract, in four clauses.** A mutating agent journals to a repo-local
468
+ gitignored scratch directory in the main checkout; the supervisor grants that
469
+ path **absolute** in the dispatch prompt; each finding lands inline as it is
470
+ confirmed; a `DONE` marker is appended on success. The operative text — what
471
+ each clause requires of an agent, and why a temporary worktree and a system
472
+ temp dir both fail the survivability test — is
473
+ `templates/agent-execution.md`'s **Resume journal — agent writes, scratch reset
474
+ sweeps** bullet, which is the surface an agent loads. This section owns what
475
+ that bullet cannot carry: the lifetime rule's reasoning, the attestation it was
476
+ priced against, and the two readings the marker carries.
477
+
478
+ **Lifetime — why retention rather than an eager deletion chore.** Cleanup is
479
+ the consumer's own scratch reset at its next work-unit boundary, a mechanism
480
+ the consumer already owns (here, `enter-stage.sh`'s boundary wipe of `.tmp/` at
481
+ the next scope entry — lifecycle-kit/SPEC.md §bin/enter-stage.sh). Two things
482
+ break when the supervisor deletes on its own schedule instead, and both appear
483
+ only once a dispatched agent is **resumable** rather than one-shot: a resumed
484
+ agent is still writing to the file, and a supervisor treating the journal as
485
+ its **pull channel** (lifecycle-kit/templates/lead.md §Channel design)
486
+ destroys at the first verified commit the channel it is supposed to keep
487
+ reading. A one-shot sweep hides both, which is why an eager deletion chore
488
+ read as correct for as long as it did.
489
+
490
+ **Attested.** A supervisor deleted a resumable session's journal after
491
+ validating that session's first commits; the session resumed minutes later,
492
+ found the file gone mid-write, rebuilt it from context, and reported the
493
+ disappearance as a suspected scratch-directory reliability defect. The lost
494
+ working state was the cheaper half — the false defect signal, raised against
495
+ the scratch dir and against an unrelated sibling unit, is what retention is
496
+ priced against. The same supervisor then retained two later sessions'
497
+ journals against the then-governed text; that deviation is what this section
498
+ now states.
499
+
500
+ **Reading `DONE` under retention.** Retention costs the *presence* of a
501
+ journal its meaning: every journal now survives its session, so finding one
502
+ signals nothing by itself. The marker still carries the completion claim, with
503
+ one sharpening a resumable session forces — `DONE` is meaningful **only as the
504
+ file's last line**, since a session resumed past its own marker appends after
505
+ it, and a mid-file `DONE` claims a completion the later content contradicts.
506
+ Whether a *missing* marker signals interruption still turns on whether the
507
+ supervisor consumed the agent's return. On the ordinary completion path it
508
+ did, and that return plus its post-commit verification (§Verify after every
509
+ agent commit) *is* the recovery contract, so the marker is redundant there.
510
+ Only in a **cold read** — a journal found with no return ever consumed, the
511
+ agent's session having died before returning (a background sandbox died, a
512
+ crash, a timeout) — is the marker the sole signal, and there the original
513
+ reading holds: no `DONE` = interrupted, resume from it. A live journal is told
514
+ from a spent one by per-session journal naming, the consumer's own work
515
+ cursor, and `git log`, which together say more than presence ever did, and the
516
+ boundary sweep bounds the ambiguity to the current work unit. The
517
+ inline-findings rule above is that cold arm's insurance — with no surviving
518
+ return, a pointer-only journal would make a would-be `DONE` lie about
519
+ recoverability.
160
520
 
161
521
  **Caveat — the sandbox may block the journal write.** Background agents
162
522
  have been observed unable to `Write` to the granted path, silently falling
163
523
  back to returning findings in the final message — which defeats the journal
164
- exactly when it matters (a long, interruptible run). So: for a read-only
165
- fan-out the return value *is* the contract — no journal; for mutating
166
- agents, grant the journal path explicitly before dispatch rather than
167
- assuming the write succeeds.
168
-
169
- ## Validate after every agent commit
524
+ exactly when it matters (a long, interruptible run). The template's
525
+ read-only-fan-out carve-out and its grant-the-path-explicitly clause both
526
+ follow from this observation. That contract has two ends. The caveat's
527
+ evidence is about **the child's** write failing silently, and its true
528
+ content is *do not make recoverability depend on a backgrounded child's
529
+ write* — which is why it is kept rather than overturned by the template's
530
+ **Findings you will act on are durable before you act on them** rule. That
531
+ rule's duty falls on **the parent**, which has already demonstrated it can
532
+ write, being the session that granted the path. The two are disjoint
533
+ readings of one contract, not each other's contradiction.
534
+
535
+ **Journalling is a discharge path, not a dispatched session's privilege.** The
536
+ template's durability rule turns on **capability, never role** — a session
537
+ journals when it cannot commit and commits when it can — and this section owns
538
+ why the earlier role-keyed reading failed. That reading granted the journal to a
539
+ dispatched session and denied it to a top-level one, on the premise that a
540
+ top-level session is by construction able to commit. The premise is false
541
+ whenever another session holds the shared index, which is the *normal* condition
542
+ while a work unit is in flight rather than an edge case: the supervising role
543
+ improvised scratch notes on three separate occasions in one iteration, each time
544
+ because a live dispatched session held the index. Improvised scratch is the
545
+ journal mechanism with none of its contract — no granted path inside the sweep's
546
+ reach, no inline landing, no marker — so the failure was silent and the
547
+ reconstruction cost was paid per occurrence. Widening by capability rather than
548
+ carving out a second surface per role is what keeps the reclaim story unchanged:
549
+ every discharge path still lands in the same scratch directory the consumer's
550
+ own work-unit boundary already sweeps, so no new lifetime, keep-list entry, or
551
+ inbound-triage surface is created by the widening.
552
+
553
+ ## Verify after every agent commit
170
554
 
171
555
  Re-run the relevant gates plus the consumer's validate battery (for this
172
556
  repo and any gate-sdk consumer: `bash gate-sdk/bin/run-gates.sh` and the
@@ -177,8 +561,49 @@ agent commit before accepting**: an agent blocked by a gate will weaken it
177
561
  (a false exemption) rather than fix the code — "the gate is in my way"
178
562
  almost always means the code doesn't fit the convention.
179
563
 
180
- `check-gate-tamper` is the mechanical floor under that duty. Two
181
- assertions, blocking the two attested tamper shapes:
564
+ **The act is `verify`; the artifact stays the `validate battery`.** The
565
+ discipline is an act a supervisor performs; the battery is the command set
566
+ that act runs. One word for both made *completing the act* read as completing
567
+ whatever else the consumer names with that word — attested where a consumer's
568
+ stage roster carries it, and the near-miss was a skipped stage. Renaming the
569
+ act rather than the artifact is the cheap side: the battery is a binding-slot
570
+ name every consumer's shim carries (§One template, a resident pointer, read by
571
+ `check-skill-binding`), while the act is named only in prose. The result reads
572
+ coherently — *you verify an agent's commit by re-running the relevant gates and
573
+ the consumer's validate battery* — and the act and the artifact having
574
+ different names is the distinction that was missing.
575
+
576
+ **A verify step never runs the producer of what it is verifying.** Re-running
577
+ is safe and idempotent exactly when the dispatched unit's output is *work* and
578
+ the check's output is *a verdict about that work*; it stops being safe the
579
+ moment those coincide. Where a unit's deliverable **is** an evidence artifact,
580
+ the verify is a **read of the committed artifact**, never a re-execution of
581
+ what wrote it: re-running the producer mutates or duplicates the very record
582
+ the check exists to confirm.
583
+
584
+ **The two wrong re-runs are not equally harmful, and a supervisor needs the
585
+ split.** A check that writes nothing the artifact depends on is *inert* on it —
586
+ misrouted and wasted work, with nothing lost. Re-running the artifact's **sole
587
+ writer** is *destructive*. The routing defect is the same in both; only the
588
+ second leaves evidence to restore, and the supervisor that has already run the
589
+ wrong one reads this split to learn which one it is holding. Collapsing them
590
+ would either overstate the harm of a wasteful re-run or understate the harm of
591
+ the destructive one.
592
+
593
+ **Honest limit — this rule installs no oracle**, and recurrence is what
594
+ establishes it matters rather than a projection: the misrouting fired in two
595
+ consecutive iterations and an operator caught it both times. The check class
596
+ that would catch it is a gate over a *supervisor's choice of command*, and no
597
+ scanner is buildable — the choice leaves no tracked artifact to read, the same
598
+ structural reason §Operative residency owes no gate. A consumer whose evidence
599
+ producer claims a liveness lock has a partial artifact-side proxy; its coverage
600
+ boundary is that consumer's own mechanism to state, not this section's. So
601
+ detection stays human, and it is stated here rather than left implicit because
602
+ an unstated limit reads as an oversight for a later session to close with a
603
+ gate that cannot exist.
604
+
605
+ `check-gate-tamper` is the mechanical floor under the diff-every-gate-change
606
+ duty. Two assertions, blocking the two attested tamper shapes:
182
607
 
183
608
  - **A — gate-edit isolation.** A commit that touches a gate file (the
184
609
  `DELEGATION_KIT_GATE_FILES` globs) may touch only meta-layer paths
@@ -195,6 +620,35 @@ diff review of agent gate edits remains a supervisor duty. `--fixture <dir>`
195
620
  injects `staged-files` / `added-exemptions` lists (fixture-pair test
196
621
  capability); live mode reads `git diff --cached`.
197
622
 
623
+ ## check-agent-tier-explicit
624
+
625
+ Every agent definition under `DELEGATION_KIT_AGENT_DIR` declares a `model:`
626
+ field in its frontmatter. This is the oracle over the tracked half of the
627
+ template's **Match the dispatched model and effort to the unit's shape** rule:
628
+ the per-dispatch habit leaves no artifact, but a standing choice does, and the
629
+ gate reads it.
630
+
631
+ **It polices silence, not the choice.** An explicit `inherit`-valued `model:`
632
+ **passes** — a dispatched session that should ride its dispatcher's tier is a
633
+ legitimate answer and the gate has no business overruling it. What reds is
634
+ *omission*, the one state indistinguishable from not having thought about it,
635
+ and the one state that is not the neutral absence it looks like — the refused
636
+ environment override and the precedence chain behind that reading are in
637
+ §The delegation model. A reader arriving at this gate expecting it to enforce
638
+ cheapness has the wrong model of it.
639
+
640
+ **Counted inertness.** A consumer with no such directory — or one holding no
641
+ definitions — scans zero and reports a clean counted line, the derived-scan-set
642
+ shape the kit's other gates use. There is no roster and no registration list to
643
+ maintain: the scan set is the directory's contents.
644
+
645
+ **Honest limit.** It holds the tracked surface only. A dispatch naming no agent
646
+ type and no `model` parameter inherits and leaves no artifact for any gate to
647
+ read, so the gate converts the standing-choice class from unenforceable to
648
+ enforced and leaves the per-dispatch class to the rule's prose. That is
649
+ strictly better than nothing and not a claim to have closed the tier question
650
+ mechanically.
651
+
198
652
  ## usage-verdict
199
653
 
200
654
  Emits a trustworthy budget verdict from a usage snapshot file, closing the
@@ -524,17 +978,23 @@ delegation-kit/
524
978
  bin/usage-trend.sh # footprint trend reporter over the history log
525
979
  bin/run-usage-tests.sh # verdict decision-table runner
526
980
  bin/run-budget-guard-tests.sh # budget-guard decision-table runner
981
+ bin/run-dispatch-guard-tests.sh # dispatch-guard decision-table runner (D1/D2/D3)
527
982
  bin/run-trend-tests.sh # trend-reporter assertion runner
983
+ lib/delegation.sh # shared helpers for the usage tools and the kit's gates
528
984
  usage-tests/cases.tsv # expected-verdict <TAB> scenario knobs
529
985
  usage-tests/budget-guard-cases.tsv # expected-action <TAB> scenario knobs
986
+ usage-tests/dispatch-guard-cases.tsv # expected-outcome <TAB> scenario knobs
530
987
  usage-tests/trend-history.log # fixture history for the trend runner
531
988
  checks/check-gate-tamper.sh
532
989
  checks/check-rule-citation.sh
990
+ checks/check-agent-tier-explicit.sh
533
991
  gate-tests/check-gate-tamper/{good,bad}/
534
992
  gate-tests/check-rule-citation/{good,bad}/
993
+ gate-tests/check-agent-tier-explicit/{good,bad}/
535
994
  templates/agent-execution.md # full protocol, bound as a skill shim
536
995
  templates/dispatch-checklists.md # deletion/rename/audit pre-flight, reached by a pointer
537
996
  templates/agent-budget-guard.sh # PreToolUse(Agent) budget guard
997
+ templates/agent-dispatch-guard.sh # PreToolUse(Agent) dispatch-shape guard (D1/D2/D3)
538
998
  templates/statusline-usage.sh # push usage.txt producer (statusline hook) + status bar
539
999
  templates/usage-poller.sh # poll usage.txt producer (timer-driven, fail-soft)
540
1000
  templates/delegation-config.sh # knob overrides (arrays live here)
@@ -596,15 +1056,31 @@ layout as defaults):
596
1056
  window raises the affordable width, not the reviewable one, so budget is
597
1057
  never the sole input to widening. `usage-verdict` surfaces the live value
598
1058
  as the `width=` field (§usage-verdict), the knob's mechanical reader.
1059
+ - `DELEGATION_KIT_AGENT_DIR` — the directory `check-agent-tier-explicit` walks
1060
+ for agent definitions; default `.claude/agents`, this harness's conventional
1061
+ agent-definition location, validated non-empty by the loader. Positional `$1`
1062
+ overrides (fixture injection). A consumer whose harness keeps definitions
1063
+ elsewhere repoints it; one with no such directory leaves it and the gate
1064
+ reports its counted-inert clean line (§check-agent-tier-explicit).
599
1065
  - `DELEGATION_KIT_GATE_FILES` — globs naming gate files for tamper
600
1066
  assertion A; default
601
- `("${GATE_SDK_GATES_DIR:-scripts}/check-*.sh")` plus the gate-sdk lib and
602
- runners. A consumer declaration **replaces** this default outright rather
1067
+ `("${GATE_SDK_GATES_DIR:-scripts}/check-*.sh" "${GATE_SDK_GATES_DIR:-scripts}/check-*.gate")`
1068
+ plus the gate-sdk lib and
1069
+ runners. **Both declaration spellings are on the default**, because a gate's
1070
+ declaration path is `<name>.sh` *or* `<name>.gate`
1071
+ (gate-sdk/SPEC.md §The `# graph:` manifest)
1072
+ and a consumer on the default would otherwise receive a
1073
+ ported gate whose edits escape the isolation rule entirely — the widening the
1074
+ `check-gate-tamper` row of
1075
+ gate-sdk/SPEC.md §Meta-gate conservation for the binary substrate
1076
+ mandates, come due at the first live descriptor.
1077
+ A consumer declaration **replaces** this default outright rather
603
1078
  than extending it — the loader guards it with `declare -p … ||`, so the
604
1079
  default is the no-declaration fallback, not a base to append to. A consumer
605
1080
  adding kit-shipped globs must therefore restate any default glob it still
606
- wants covered (this repo's config names `*/checks/*.sh` **and**
607
- `scripts/check-*.sh`, because it has gates in both places). Contrast
1081
+ wants covered (this repo's config names `*/checks/*.sh` and `*/checks/*.gate`
1082
+ **and** their `scripts/check-*` counterparts, because it has gates in both
1083
+ places). Contrast
608
1084
  `DELEGATION_KIT_META_PATHS` below, whose kit-root union *is* additive — the
609
1085
  two knobs do not behave alike.
610
1086
  - `DELEGATION_KIT_META_PATHS` — prefixes counted as meta-layer for
@@ -618,6 +1094,23 @@ layout as defaults):
618
1094
  filter: a
619
1095
  prefix the consumer declared cannot be lost, and without `gate.sh` the config
620
1096
  is used exactly as written.
1097
+ - `DELEGATION_KIT_READONLY_TYPES` — agent-type names the consumer dispatches for
1098
+ read-only work; D2's only trigger (§The delegation model). Default empty, in
1099
+ which case D2 is inert by construction. Every entry is the consumer's own
1100
+ agent roster, never the kit's (CLAUDE.md §The provenance seam) — the same
1101
+ reasoning that ships `GUARD_KIT_BREADTH_PROBES` with no default probes.
1102
+ Deliberately not knobbed alongside it, each ruled out for a stated reason: a
1103
+ fork-type-name knob and an accepted-isolation-values knob — `fork` and
1104
+ `worktree` are the **harness's** dispatch vocabulary, and a guard template
1105
+ carries its harness's tool vocabulary as literals the same way
1106
+ `wakeup-guard.sh` matches `ScheduleWakeup`/`CronCreate` literally, so
1107
+ knobbing them would imply a portability the mechanism does not have; a
1108
+ warn-only or per-rule opt-out — a doctrine downgradable per session is the
1109
+ honour system these rules exist to end, so the valve stays the whole guard's
1110
+ registration, never a finer one; and accepting `isolation: remote` as
1111
+ satisfying D2 — plausibly correct (a remote agent cannot touch the local
1112
+ index) but unverified from here, and remote availability is gated, so it is
1113
+ excluded with its reason recorded rather than admitted on plausibility.
621
1114
 
622
1115
  `check-gate-tamper` registers in the consumer's `gates.list`
623
1116
  (tier: precommit) — in this repo's too; dogfooding is day-one, and agents
@@ -634,11 +1127,23 @@ its consumer session brief (`scripts/session-context.sh`) additionally prints
634
1127
  the verdict line at SessionStart for planning-time visibility — a consumer-side
635
1128
  edit; the context-kit template stays uncoupled from delegation-kit.
636
1129
 
1130
+ `agent-dispatch-guard.sh` is a second hook on that same matcher, registered the
1131
+ same way and **independently**: the harness fires every hook a matcher carries
1132
+ and any exit 2 blocks, so neither guard knows about the other and a consumer
1133
+ may wire either one alone (§The delegation model owns why they are two scripts
1134
+ rather than one). It resolves `guard-kit/lib/guard.sh` at its vendored path,
1135
+ overridable with `GUARD_KIT_LIB`, and reads the consumer's delegation config for
1136
+ D2's roster and nothing else. Registration is again the whole opt-in: unwired,
1137
+ it is inert — and an unwired dispatch guard is the exact failure shape it
1138
+ exists to catch, so wiring it is not optional dogfooding for a consumer that
1139
+ delegates.
1140
+
637
1141
  **An `OK` verdict is a floor, not a recommendation.** The guard answers one
638
1142
  question — is there headroom in the window *right now* — and blocks only on
639
1143
  `PAUSE`. Everything else a dispatch decision turns on sits outside its reach:
640
- how long the dispatched work runs, whether it fans out beneath the checkpoint
641
- (the guard fires on the dispatch it gates, not on that dispatch's children),
1144
+ how long the dispatched work runs, what a fan-out beneath the checkpoint will
1145
+ cost in total (the guard re-arms on those children but prices each of them
1146
+ alone: covered at every depth, aggregated at none — §The delegation model),
642
1147
  and whether anything forces the dispatch now rather than after the window
643
1148
  resets. `OK` is therefore one input to that decision and never the decision
644
1149
  itself; a dispatcher reading `OK` as "go" has substituted the guard's question
@@ -658,6 +1163,13 @@ costs the work in flight.
658
1163
  naming an absent lead-in), driven by `run-gate-tests.sh` over fixture-local
659
1164
  spec + template files passed as its two positional arguments.
660
1165
 
1166
+ `check-agent-tier-explicit` speaks the same gate contract and ships the standard
1167
+ `good/`+`bad/` fixture pair over a fixture-local agent directory passed as its
1168
+ one positional argument. The `good/` side carries both passing shapes — a
1169
+ definition naming a cheaper class outright and one declaring `inherit` — so the
1170
+ pair proves the gate discriminates omission from choice rather than merely
1171
+ finding a `model:` string; the `bad/` side omits the field.
1172
+
661
1173
  `usage-verdict` does not fit the gate contract (a three-state verdict, not a
662
1174
  clean/violation pair), so — like guard-kit's guard-tests — the kit ships
663
1175
  its own decision-table runner: `usage-tests/cases.tsv` pairs an expected
@@ -738,6 +1250,36 @@ its firing (PAUSE) and non-firing (the four advise cases) — the fixture-pair
738
1250
  discipline again — and every case asserts the live verdict text rides the
739
1251
  output so a memory-quoted percentage cannot be the acting source.
740
1252
 
1253
+ `agent-dispatch-guard.sh` takes its own decision-table lane rather than
1254
+ guard-kit's `guard-tests/` (keyed on a command, or a to+message — neither can
1255
+ express a dispatch's parameters, the same reason the budget guard has its own
1256
+ runner) or the budget guard's table (a different payload grammar again):
1257
+ `usage-tests/dispatch-guard-cases.tsv` pairs an expected outcome
1258
+ (`block`/`advise`/`fallthrough`) with `subagent_type isolation nested desc`,
1259
+ and `bin/run-dispatch-guard-tests.sh` drives the *template* with a built Agent
1260
+ hook payload — `tool_input.subagent_type`/`.isolation`, and, for a nested case,
1261
+ the top-level `agent_id`/`agent_type` the harness only sets inside a subagent —
1262
+ classifying block (exit 2) / advise (exit 0, `additionalContext` present) /
1263
+ fallthrough (exit 0, empty stdout). The table fixes one roster for its whole
1264
+ run, `DELEGATION_KIT_READONLY_TYPES=(ro-type)`, supplied through a generated
1265
+ config file and `DELEGATION_KIT_CONFIG_FILE`; a `subagent_type` prefixed
1266
+ `noroster:` runs instead with no config file at all (an empty declare),
1267
+ stripped before it reaches the guard — the row that proves D2 is inert on the
1268
+ roster's *absence*, not merely on this dispatch's type missing from a
1269
+ populated one. Every rule carries a firing and a non-firing case (the
1270
+ fixture-pair discipline, transplanted): D1 — a fork blocks, a typed dispatch
1271
+ under an empty roster does not; D2 — a rostered type without isolation blocks,
1272
+ the same type with `isolation: worktree` does not, an unrostered type under a
1273
+ populated roster does not, and the empty-roster case does not; D3 — a payload
1274
+ carrying `agent_id` advises, one without it falls through. The degradation
1275
+ posture gets its own case rather than being asserted only in prose: an
1276
+ unparseable payload (`subagent_type` `UNPARSEABLE`, sent as invalid JSON on
1277
+ stdin) advises rather than blocks — the assertion that makes delta 6's
1278
+ fail-open-but-loud posture testable, not merely stated, and the one case this
1279
+ lane must not drop for brevity. The runner strips ambient `DELEGATION_KIT_*` at
1280
+ every invocation, the discipline `run-budget-guard-tests.sh` already uses, so a
1281
+ consumer's live roster or config-file pointer cannot leak into the fixture.
1282
+
741
1283
  `smoke/install.sh` copies the templates and `bin/` tools into the scratch
742
1284
  consumer, registers the tamper gate, and drives one crafted snapshot
743
1285
  through `usage-verdict` asserting a verdict — self-verifying install. It opens