checkwright 0.24.0 → 0.26.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 (1044) hide show
  1. package/README.md +35 -1361
  2. package/bin/checkwright.ps1 +157 -0
  3. package/bin/checkwright.sh +187 -44
  4. package/package.json +15 -14
  5. package/payload/artifact/aarch64-apple-darwin/checkwright-gates +0 -0
  6. package/payload/artifact/aarch64-apple-darwin/checkwright-gates.sha256 +1 -0
  7. package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe +0 -0
  8. package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -0
  9. package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates +0 -0
  10. package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
  11. package/payload/artifact/targets.list +120 -24
  12. package/payload/artifact/x86_64-apple-darwin/checkwright-gates +0 -0
  13. package/payload/artifact/x86_64-apple-darwin/checkwright-gates.sha256 +1 -0
  14. package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe +0 -0
  15. package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -0
  16. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  17. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
  18. package/payload/canon-kit/README.md +25 -37
  19. package/payload/canon-kit/checks/check-amendment-queue.gate +2 -2
  20. package/payload/canon-kit/checks/check-amendment-retired-spelling.gate +3 -0
  21. package/payload/canon-kit/checks/check-amendment-update-target.gate +3 -0
  22. package/payload/canon-kit/checks/check-comment-tier.gate +1 -1
  23. package/payload/canon-kit/checks/check-deprecation-task.gate +2 -1
  24. package/payload/canon-kit/checks/check-docs-cmd.gate +2 -2
  25. package/payload/canon-kit/checks/check-docs-link-convention.gate +1 -1
  26. package/payload/canon-kit/checks/check-docs-restatement-parity.gate +4 -0
  27. package/payload/canon-kit/checks/check-fence-command-head.gate +3 -0
  28. package/payload/canon-kit/checks/check-fence-run.gate +3 -0
  29. package/payload/canon-kit/checks/check-install-claim.gate +2 -1
  30. package/payload/canon-kit/checks/check-knob-citation.gate +1 -1
  31. package/payload/canon-kit/checks/check-manifest-count.gate +1 -1
  32. package/payload/canon-kit/checks/check-manifest-temporal.gate +1 -1
  33. package/payload/canon-kit/checks/check-md-refs.gate +1 -1
  34. package/payload/canon-kit/checks/check-md-unwrapped.gate +3 -0
  35. package/payload/canon-kit/checks/check-measured-claim.gate +2 -1
  36. package/payload/canon-kit/checks/check-payload-claim.gate +2 -1
  37. package/payload/canon-kit/checks/check-prose-bounds.gate +3 -0
  38. package/payload/canon-kit/checks/check-prose-enum.gate +2 -1
  39. package/payload/canon-kit/checks/check-prose-tells.gate +1 -1
  40. package/payload/canon-kit/checks/check-provenance-seam.gate +3 -0
  41. package/payload/canon-kit/checks/check-spec-derivable-section.gate +1 -1
  42. package/payload/canon-kit/checks/check-spec-dod-singleton.gate +1 -1
  43. package/payload/canon-kit/checks/check-spec-embedded-source.gate +1 -1
  44. package/payload/canon-kit/checks/check-spec-fence-balance.gate +1 -1
  45. package/payload/canon-kit/checks/check-spec-pointer.gate +2 -2
  46. package/payload/canon-kit/checks/check-surface-duplication.gate +3 -0
  47. package/payload/canon-kit/checks/check-todo-task-liveness.gate +1 -1
  48. package/payload/canon-kit/checks/check-tracking-claim.gate +1 -1
  49. package/payload/canon-kit/checks/check-unmarked-claim.gate +4 -0
  50. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/SPEC-tidy.md +3 -0
  51. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/TASK-QUEUE.md +37 -8
  52. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/expect.txt +6 -3
  53. package/payload/canon-kit/gate-tests/check-amendment-queue/good/SPEC-widget.md +7 -0
  54. package/payload/canon-kit/gate-tests/check-amendment-queue/good/TASK-QUEUE.md +11 -3
  55. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/SPEC-nosection.md +16 -0
  56. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/SPEC-thing.md +26 -0
  57. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/expect.txt +8 -0
  58. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/surface/one.md +4 -0
  59. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/surface/two.md +3 -0
  60. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/SPEC-tidy.md +20 -0
  61. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/SPEC-widget.md +37 -0
  62. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/component/README.md +4 -0
  63. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/component/SPEC.md +4 -0
  64. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/expect.txt +1 -0
  65. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/unnamed.md +4 -0
  66. package/payload/canon-kit/gate-tests/check-amendment-update-target/bad/SPEC-thing.md +26 -0
  67. package/payload/canon-kit/gate-tests/check-amendment-update-target/bad/expect.txt +8 -0
  68. package/payload/canon-kit/gate-tests/check-amendment-update-target/good/SPEC-widget.md +47 -0
  69. package/payload/canon-kit/gate-tests/check-amendment-update-target/good/expect.txt +1 -0
  70. package/payload/canon-kit/gate-tests/check-amendment-update-target.test.sh +82 -0
  71. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +1 -1
  72. package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +37 -26
  73. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/TASK-QUEUE.md +3 -1
  74. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.knobs +2 -0
  75. package/payload/canon-kit/gate-tests/check-deprecation-task/good/TASK-QUEUE.md +6 -2
  76. package/payload/canon-kit/gate-tests/check-deprecation-task/good/expect.txt +1 -1
  77. package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.knobs +2 -0
  78. package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +12 -10
  79. package/payload/canon-kit/gate-tests/check-docs-cmd/good/doc.md +4 -1
  80. package/payload/canon-kit/gate-tests/check-docs-cmd.test.sh +61 -0
  81. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/expect.txt +3 -0
  82. package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +21 -2
  83. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/expect.txt +2 -0
  84. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/kit/README.md +10 -0
  85. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/kit/index.md +11 -0
  86. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/scripts/canon-config.knobs +2 -0
  87. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/scripts/gate-sdk-config.knobs +2 -0
  88. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/expect.txt +1 -0
  89. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/kit/README.md +12 -0
  90. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/kit/index.md +13 -0
  91. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/scripts/canon-config.knobs +2 -0
  92. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/scripts/gate-sdk-config.knobs +2 -0
  93. package/payload/canon-kit/gate-tests/check-fence-command-head/bad/args +1 -0
  94. package/payload/canon-kit/gate-tests/check-fence-command-head/bad/doc.md +16 -0
  95. package/payload/canon-kit/gate-tests/check-fence-command-head/bad/expect.txt +5 -0
  96. package/payload/canon-kit/gate-tests/check-fence-command-head/good/args +1 -0
  97. package/payload/canon-kit/gate-tests/check-fence-command-head/good/bin/run.sh +3 -0
  98. package/payload/canon-kit/gate-tests/check-fence-command-head/good/doc.md +41 -0
  99. package/payload/canon-kit/gate-tests/check-fence-command-head/good/expect.txt +1 -0
  100. package/payload/canon-kit/gate-tests/check-fence-command-head/good/lib/tool.sh +5 -0
  101. package/payload/canon-kit/gate-tests/check-fence-command-head/good/scripts/canon-config.knobs +2 -0
  102. package/payload/canon-kit/gate-tests/check-fence-run/bad/args +1 -0
  103. package/payload/canon-kit/gate-tests/check-fence-run/bad/doc.md +32 -0
  104. package/payload/canon-kit/gate-tests/check-fence-run/bad/expect.txt +7 -0
  105. package/payload/canon-kit/gate-tests/check-fence-run/good/args +1 -0
  106. package/payload/canon-kit/gate-tests/check-fence-run/good/doc.md +31 -0
  107. package/payload/canon-kit/gate-tests/check-fence-run/good/expect.txt +1 -0
  108. package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/canon-config.knobs +7 -0
  109. package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/canon-config.knobs +7 -0
  110. package/payload/canon-kit/gate-tests/check-knob-citation.test.sh +42 -7
  111. package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +1 -2
  112. package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +2 -3
  113. package/payload/canon-kit/gate-tests/check-knob-default-coupling.test.sh +37 -8
  114. package/payload/canon-kit/gate-tests/check-manifest-count/bad/SPEC.md +3 -0
  115. package/payload/canon-kit/gate-tests/check-manifest-count/good/SPEC.md +10 -0
  116. package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +6 -6
  117. package/payload/canon-kit/gate-tests/check-md-refs.test.sh +1 -1
  118. package/payload/canon-kit/gate-tests/check-md-unwrapped/bad/doc.md +13 -0
  119. package/payload/canon-kit/gate-tests/check-md-unwrapped/bad/expect.txt +4 -0
  120. package/payload/canon-kit/gate-tests/check-md-unwrapped/bad/scripts/canon-config.knobs +2 -0
  121. package/payload/canon-kit/gate-tests/check-md-unwrapped/good/doc.md +45 -0
  122. package/payload/canon-kit/gate-tests/check-md-unwrapped/good/expect.txt +1 -0
  123. package/payload/canon-kit/gate-tests/check-md-unwrapped/good/scripts/canon-config.knobs +4 -0
  124. package/payload/canon-kit/gate-tests/check-measured-claim/bad/SPEC.md +3 -0
  125. package/payload/canon-kit/gate-tests/check-measured-claim/bad/expect.txt +1 -0
  126. package/payload/canon-kit/gate-tests/check-measured-claim/bad/scripts/canon-config.knobs +4 -0
  127. package/payload/canon-kit/gate-tests/check-measured-claim/good/SPEC.md +8 -0
  128. package/payload/canon-kit/gate-tests/check-measured-claim/good/scripts/canon-config.knobs +4 -0
  129. package/payload/canon-kit/gate-tests/check-measured-claim/good/worktrees/SPEC.md +12 -0
  130. package/payload/canon-kit/gate-tests/check-measured-claim.test.sh +32 -13
  131. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.knobs +6 -0
  132. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.knobs +6 -0
  133. package/payload/canon-kit/gate-tests/check-prose-bounds/bad/CLAUDE.md +9 -0
  134. package/payload/canon-kit/gate-tests/check-prose-bounds/bad/SPEC.md +11 -0
  135. package/payload/canon-kit/gate-tests/check-prose-bounds/bad/expect.txt +3 -0
  136. package/payload/canon-kit/gate-tests/check-prose-bounds/bad/scripts/canon-config.knobs +3 -0
  137. package/payload/canon-kit/gate-tests/check-prose-bounds/good/CLAUDE.md +10 -0
  138. package/payload/canon-kit/gate-tests/check-prose-bounds/good/SPEC.md +27 -0
  139. package/payload/canon-kit/gate-tests/check-prose-bounds/good/expect.txt +1 -0
  140. package/payload/canon-kit/gate-tests/check-prose-bounds/good/scripts/canon-config.knobs +3 -0
  141. package/payload/canon-kit/gate-tests/check-prose-bounds.test.sh +98 -0
  142. package/payload/canon-kit/gate-tests/check-prose-enum/bad/scripts/canon-config.knobs +3 -0
  143. package/payload/canon-kit/gate-tests/check-prose-enum/good/scripts/canon-config.knobs +3 -0
  144. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +55 -25
  145. package/payload/canon-kit/gate-tests/check-prose-tells/bad/prose.md +2 -0
  146. package/payload/canon-kit/gate-tests/check-prose-tells/bad/scripts/canon-config.knobs +5 -0
  147. package/payload/canon-kit/gate-tests/check-prose-tells/good/prose.md +6 -0
  148. package/payload/canon-kit/gate-tests/check-prose-tells/good/scripts/{canon-config.sh → canon-config.knobs} +2 -5
  149. package/payload/canon-kit/gate-tests/check-prose-tells/good/worktrees/prose.md +17 -0
  150. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/TASK-QUEUE.md +15 -0
  151. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/expect.txt +8 -0
  152. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/scripts/canon-config.knobs +3 -0
  153. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/scripts/gate-sdk-config.knobs +2 -0
  154. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/scripts/lifecycle-config.knobs +12 -0
  155. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/widget-toolkit/SPEC.md +27 -0
  156. package/payload/canon-kit/gate-tests/check-provenance-seam/good/TASK-QUEUE.md +15 -0
  157. package/payload/canon-kit/gate-tests/check-provenance-seam/good/expect.txt +1 -0
  158. package/payload/canon-kit/gate-tests/check-provenance-seam/good/scripts/canon-config.knobs +3 -0
  159. package/payload/canon-kit/gate-tests/check-provenance-seam/good/scripts/gate-sdk-config.knobs +2 -0
  160. package/payload/canon-kit/gate-tests/check-provenance-seam/good/scripts/lifecycle-config.knobs +12 -0
  161. package/payload/canon-kit/gate-tests/check-provenance-seam/good/widget-toolkit/SPEC.md +20 -0
  162. package/payload/canon-kit/gate-tests/check-provenance-seam.test.sh +136 -0
  163. package/payload/canon-kit/gate-tests/check-spec-dod-singleton.test.sh +1 -1
  164. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/README.md +6 -0
  165. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/SPEC-widget.md +5 -0
  166. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.rs +2 -0
  167. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +4 -0
  168. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/scripts/canon-config.knobs +6 -0
  169. package/payload/canon-kit/gate-tests/check-spec-pointer/good/README.md +15 -0
  170. package/payload/canon-kit/gate-tests/check-spec-pointer/good/SPEC-widget.md +10 -0
  171. package/payload/canon-kit/gate-tests/check-spec-pointer/good/expect.txt +1 -1
  172. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.rs +2 -0
  173. package/payload/canon-kit/gate-tests/check-spec-pointer/good/scripts/canon-config.knobs +6 -0
  174. package/payload/canon-kit/gate-tests/check-spec-pointer/good/vendored-kit/notes.txt +4 -0
  175. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/TASK-QUEUE.md +3 -1
  176. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/TASK-QUEUE.md +9 -3
  177. package/payload/canon-kit/gate-tests/check-tracking-claim.test.sh +1 -1
  178. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/SPEC.md +14 -0
  179. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/expect.txt +4 -0
  180. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/scripts/canon-config.knobs +4 -0
  181. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/SPEC.md +21 -0
  182. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/expect.txt +1 -0
  183. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/scripts/canon-config.knobs +4 -0
  184. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/worktrees/SPEC.md +11 -0
  185. package/payload/canon-kit/gate-tests/check-unmarked-claim.test.sh +110 -0
  186. package/payload/canon-kit/templates/SPEC-amendment.md +63 -27
  187. package/payload/canon-kit/templates/canon-config.knobs +1 -0
  188. package/payload/context-kit/README.md +33 -61
  189. package/payload/context-kit/checks/check-brevity.gate +2 -2
  190. package/payload/context-kit/checks/check-footprint-fresh.gate +3 -2
  191. package/payload/context-kit/checks/check-memory-off.gate +1 -1
  192. package/payload/context-kit/checks/check-settings-paths.gate +2 -2
  193. package/payload/context-kit/checks/check-settings-pins.gate +1 -1
  194. package/payload/context-kit/checks/check-surface-ratchet.gate +3 -0
  195. package/payload/context-kit/gate-tests/check-brevity/bad/CLAUDE.md +9 -2
  196. package/payload/context-kit/gate-tests/check-brevity/bad/expect.txt +1 -0
  197. package/payload/context-kit/gate-tests/check-brevity/good/CLAUDE.md +9 -4
  198. package/payload/context-kit/gate-tests/check-brevity/good/expect.txt +1 -1
  199. package/payload/context-kit/gate-tests/check-brevity.test.sh +107 -24
  200. package/payload/context-kit/gate-tests/check-footprint-fresh/good/CLAUDE.md +6 -0
  201. package/payload/context-kit/gate-tests/check-footprint-fresh/good/demo-kit/SPEC.md +3 -0
  202. package/payload/context-kit/gate-tests/check-footprint-fresh/good/demo-kit/templates/guide.md +3 -0
  203. package/payload/context-kit/gate-tests/check-footprint-fresh/good/docs/footprint.md +30 -0
  204. package/payload/context-kit/gate-tests/check-memory-off/bad/scripts/{context-config.sh → context-config.knobs} +1 -3
  205. package/payload/context-kit/gate-tests/check-memory-off/good/scripts/{context-config.sh → context-config.knobs} +1 -3
  206. package/payload/context-kit/gate-tests/check-memory-off.test.sh +1 -1
  207. package/payload/context-kit/gate-tests/check-settings-paths/bad/expect.txt +2 -0
  208. package/payload/context-kit/gate-tests/check-settings-paths/bad/settings.json +21 -0
  209. package/payload/context-kit/gate-tests/check-settings-paths/bad/tools/run-gates.sh +4 -0
  210. package/payload/context-kit/gate-tests/check-settings-paths/good/expect.txt +2 -1
  211. package/payload/context-kit/gate-tests/check-settings-paths/good/settings.json +48 -1
  212. package/payload/context-kit/gate-tests/check-settings-paths/good/tools/run-gates.sh +4 -0
  213. package/payload/context-kit/gate-tests/check-settings-pins.test.sh +1 -1
  214. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/CLAUDE.md +5 -0
  215. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/expect.txt +2 -0
  216. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/scripts/context-config.knobs +4 -0
  217. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/surface-ceiling.txt +2 -0
  218. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/templates/ungoverned.md +3 -0
  219. package/payload/context-kit/gate-tests/check-surface-ratchet/good/CLAUDE.md +3 -0
  220. package/payload/context-kit/gate-tests/check-surface-ratchet/good/expect.txt +1 -0
  221. package/payload/context-kit/gate-tests/check-surface-ratchet/good/scripts/context-config.knobs +4 -0
  222. package/payload/context-kit/gate-tests/check-surface-ratchet/good/surface-ceiling.txt +4 -0
  223. package/payload/context-kit/gate-tests/check-surface-ratchet/good/templates/held.md +4 -0
  224. package/payload/context-kit/gate-tests/check-surface-ratchet.test.sh +76 -0
  225. package/payload/context-kit/index-tests/corpus/baseline.txt +1 -1
  226. package/payload/context-kit/index-tests/corpus/surface.md +1 -6
  227. package/payload/context-kit/index-tests/expected/always-loaded.txt +1 -1
  228. package/payload/context-kit/templates/close-brevity.md +9 -28
  229. package/payload/context-kit/templates/context-config.knobs +1 -0
  230. package/payload/context-kit/templates/session-context.sh +43 -28
  231. package/payload/delegation-kit/README.md +35 -59
  232. package/payload/delegation-kit/checks/check-agent-tier-explicit.gate +1 -1
  233. package/payload/delegation-kit/checks/check-gate-tamper.gate +1 -1
  234. package/payload/delegation-kit/gate-tests/check-gate-tamper.test.sh +23 -2
  235. package/payload/delegation-kit/templates/agent-execution.md +23 -372
  236. package/payload/delegation-kit/templates/delegation-config.knobs +4 -0
  237. package/payload/delegation-kit/templates/dispatch-checklists.md +8 -45
  238. package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +33 -17
  239. package/payload/doctrine-kit/DOCTRINE.md +92 -458
  240. package/payload/doctrine-kit/README.md +24 -55
  241. package/payload/doctrine-kit/checks/check-doctrine-registration.gate +1 -1
  242. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +48 -3
  243. package/payload/drift-kit/README.md +43 -89
  244. package/payload/drift-kit/templates/close-knowledge.md +7 -22
  245. package/payload/drift-kit/templates/drift-config.knobs +1 -0
  246. package/payload/drift-kit/templates/economics.md +10 -48
  247. package/payload/drift-kit/templates/kpi-deprecated-surface.sh +31 -9
  248. package/payload/drift-kit/templates/kpis.list +2 -1
  249. package/payload/drift-kit/templates/price-table.tsv +1 -1
  250. package/payload/evidence-kit/README.md +23 -46
  251. package/payload/evidence-kit/checks/check-battery-roster.gate +1 -1
  252. package/payload/evidence-kit/checks/check-evidence-baseline.gate +2 -2
  253. package/payload/evidence-kit/checks/check-evidence-manifest.gate +1 -1
  254. package/payload/evidence-kit/checks/check-producer-liveness.gate +3 -0
  255. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.knobs +7 -0
  256. package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.knobs +7 -0
  257. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +7 -7
  258. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/TASK-QUEUE.md +3 -1
  259. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/args +1 -0
  260. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/expect.txt +2 -0
  261. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/scripts/evidence-config.knobs +4 -0
  262. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/validate-baseline.txt +1 -0
  263. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/TASK-QUEUE.md +3 -1
  264. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/args +1 -0
  265. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/scripts/evidence-config.knobs +3 -0
  266. package/payload/evidence-kit/gate-tests/check-evidence-baseline.test.sh +134 -14
  267. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/scripts/{evidence-config.sh → evidence-config.knobs} +3 -5
  268. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/scripts/{evidence-config.sh → evidence-config.knobs} +3 -5
  269. package/payload/evidence-kit/gate-tests/check-evidence-manifest.test.sh +5 -4
  270. package/payload/evidence-kit/gate-tests/diff-baseline-status.test.sh +128 -0
  271. package/payload/evidence-kit/gate-tests/evidence-lib.test.sh +51 -45
  272. package/payload/evidence-kit/gate-tests/pre-hook.test.sh +66 -0
  273. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +29 -16
  274. package/payload/evidence-kit/templates/evidence-config.knobs +1 -0
  275. package/payload/gate-sdk/README.md +47 -73
  276. package/payload/gate-sdk/bin/build-native.sh +89 -1
  277. package/payload/gate-sdk/bin/run-gates.ps1 +266 -0
  278. package/payload/gate-sdk/bin/run-gates.sh +60 -182
  279. package/payload/gate-sdk/checks/check-action-gh-repo.gate +1 -1
  280. package/payload/gate-sdk/checks/check-action-job-ref.gate +3 -0
  281. package/payload/gate-sdk/checks/check-action-permissions.gate +3 -0
  282. package/payload/gate-sdk/checks/check-action-pinning.gate +1 -1
  283. package/payload/gate-sdk/checks/check-action-run-path.gate +3 -0
  284. package/payload/gate-sdk/checks/check-action-run-shell.gate +3 -0
  285. package/payload/gate-sdk/checks/check-commit-msg.gate +2 -1
  286. package/payload/gate-sdk/checks/check-commit-subject.gate +1 -1
  287. package/payload/gate-sdk/checks/check-core-files.gate +1 -1
  288. package/payload/gate-sdk/checks/check-crate-arms.gate +3 -0
  289. package/payload/gate-sdk/checks/check-enforcement-fresh.gate +3 -2
  290. package/payload/gate-sdk/checks/check-exec-bit.gate +1 -1
  291. package/payload/gate-sdk/checks/check-front-end-fail-open.gate +3 -0
  292. package/payload/gate-sdk/checks/check-gate-assertions.gate +3 -0
  293. package/payload/gate-sdk/checks/check-gate-binary-fresh.gate +1 -1
  294. package/payload/gate-sdk/checks/check-gate-exemption-tasks.gate +1 -1
  295. package/payload/gate-sdk/checks/check-gate-fail-closed.gate +1 -1
  296. package/payload/gate-sdk/checks/check-gate-fixture-coverage.gate +1 -1
  297. package/payload/gate-sdk/checks/check-gate-output.gate +1 -1
  298. package/payload/gate-sdk/checks/check-gate-substrate-parity.gate +3 -0
  299. package/payload/gate-sdk/checks/check-graph.gate +2 -1
  300. package/payload/gate-sdk/checks/check-hook-exec-bit.gate +1 -1
  301. package/payload/gate-sdk/checks/check-identity.gate +1 -1
  302. package/payload/gate-sdk/checks/check-install-disposition.gate +3 -0
  303. package/payload/gate-sdk/checks/check-kit-enum.gate +1 -1
  304. package/payload/gate-sdk/checks/check-kit-registration.gate +1 -1
  305. package/payload/gate-sdk/checks/check-kit-roots-dialect.gate +3 -0
  306. package/payload/gate-sdk/checks/check-packed-links.gate +3 -0
  307. package/payload/gate-sdk/checks/check-path-dialect.gate +3 -0
  308. package/payload/gate-sdk/checks/check-pipe-membership.gate +3 -0
  309. package/payload/gate-sdk/checks/check-portability-floor.gate +4 -0
  310. package/payload/gate-sdk/checks/check-projection-roster.gate +4 -0
  311. package/payload/gate-sdk/checks/check-reads-couples.gate +1 -1
  312. package/payload/gate-sdk/checks/check-root-tiering.gate +1 -1
  313. package/payload/gate-sdk/checks/check-shellcheck.gate +3 -0
  314. package/payload/gate-sdk/checks/check-template-copy-parity.gate +1 -1
  315. package/payload/gate-sdk/checks/check-tree-terms.gate +4 -0
  316. package/payload/gate-sdk/checks/check-workflow-tiering.gate +1 -1
  317. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/args +2 -0
  318. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/expect.txt +1 -0
  319. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/scripts/gate-sdk-config.knobs +1 -0
  320. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/tree/notes.md +3 -0
  321. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/tree/workflows/ci.yml +8 -0
  322. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/args +3 -0
  323. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/expect.txt +1 -0
  324. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/scripts/gate-sdk-config.knobs +1 -0
  325. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/tree/notes.md +3 -0
  326. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/tree/workflows/ci.yml +8 -0
  327. package/payload/gate-sdk/gate-tests/check-action-permissions/bad/args +3 -0
  328. package/payload/gate-sdk/gate-tests/check-action-permissions/bad/expect.txt +5 -0
  329. package/payload/gate-sdk/gate-tests/check-action-permissions/bad/tree/workflows/empty-allowlist.yml +29 -0
  330. package/payload/gate-sdk/gate-tests/check-action-permissions/bad/tree/workflows/gates.yml +25 -0
  331. package/payload/gate-sdk/gate-tests/check-action-permissions/good/args +5 -0
  332. package/payload/gate-sdk/gate-tests/check-action-permissions/good/expect.txt +1 -0
  333. package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/action.yml +9 -0
  334. package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/not-actions.yml +7 -0
  335. package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/workflows/declared.yml +69 -0
  336. package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/workflows/valves.yml +22 -0
  337. package/payload/gate-sdk/gate-tests/check-action-run-path/bad/args +4 -0
  338. package/payload/gate-sdk/gate-tests/check-action-run-path/bad/expect.txt +2 -0
  339. package/payload/gate-sdk/gate-tests/check-action-run-path/bad/tree/scripts/present.sh +3 -0
  340. package/payload/gate-sdk/gate-tests/check-action-run-path/bad/tree/workflows/ci.yml +14 -0
  341. package/payload/gate-sdk/gate-tests/check-action-run-path/good/args +5 -0
  342. package/payload/gate-sdk/gate-tests/check-action-run-path/good/expect.txt +1 -0
  343. package/payload/gate-sdk/gate-tests/check-action-run-path/good/tree/scripts/build.sh +3 -0
  344. package/payload/gate-sdk/gate-tests/check-action-run-path/good/tree/sub/scripts/inner.sh +3 -0
  345. package/payload/gate-sdk/gate-tests/check-action-run-path/good/tree/workflows/ci.yml +36 -0
  346. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/args +4 -2
  347. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/expect.txt +2 -0
  348. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/tree/workflows/runner-dialect.yml +36 -0
  349. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/args +3 -2
  350. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/expect.txt +1 -1
  351. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/workflows/runner-dialect.yml +71 -0
  352. package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +102 -9
  353. package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/smoke/install.sh +1 -1
  354. package/payload/gate-sdk/gate-tests/check-assertion-strength/good/smoke/install.sh +1 -1
  355. package/payload/gate-sdk/gate-tests/check-assertion-strength.test.sh +55 -0
  356. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/expect.txt +1 -0
  357. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/msg.txt +4 -0
  358. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/patterns.list +5 -1
  359. package/payload/gate-sdk/gate-tests/check-commit-msg/good/msg.txt +7 -0
  360. package/payload/gate-sdk/gate-tests/check-commit-msg/good/patterns.list +5 -1
  361. package/payload/gate-sdk/gate-tests/check-commit-subject.test.sh +2 -2
  362. package/payload/gate-sdk/gate-tests/check-core-files.test.sh +1 -1
  363. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/scripts/gate-sdk-config.knobs +3 -0
  364. package/payload/gate-sdk/gate-tests/check-crate-arms/good/scripts/gate-sdk-config.knobs +3 -0
  365. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/SPEC.md +3 -0
  366. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/checks/check-demo.gate +1 -0
  367. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/probe.conf +1 -0
  368. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/templates/guide.md +3 -0
  369. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/docs/enforcement.md +33 -0
  370. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/scripts/gate-sdk-config.knobs +1 -0
  371. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/scripts/gates.list +1 -0
  372. package/payload/gate-sdk/gate-tests/check-exec-bit.test.sh +1 -1
  373. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/args +3 -0
  374. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/expect.txt +2 -0
  375. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/gate-sdk/bin/run-gates.ps1 +5 -0
  376. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/gate-sdk/bin/run-gates.sh +9 -0
  377. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/args +4 -0
  378. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/expect.txt +1 -0
  379. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/gate-sdk/bin/run-gates.ps1 +5 -0
  380. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/gate-sdk/bin/run-gates.sh +9 -0
  381. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/expect.txt +5 -1
  382. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/SPEC.md +22 -0
  383. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-count.sh +11 -0
  384. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-extra.sh +14 -0
  385. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-zero.sh +7 -0
  386. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -1
  387. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/SPEC.md +30 -0
  388. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/check-qux.sh +13 -0
  389. package/payload/gate-sdk/gate-tests/check-gate-assertions.test.sh +117 -0
  390. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.knobs +2 -0
  391. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.knobs +2 -0
  392. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +6 -12
  393. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +5 -3
  394. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/TASK-QUEUE.md +3 -1
  395. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks.test.sh +4 -2
  396. package/payload/gate-sdk/gate-tests/check-gate-output.test.sh +1 -1
  397. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/ci/build-artifact.sh +9 -0
  398. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/ci.yml +9 -0
  399. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +6 -2
  400. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kit-spec.md +6 -0
  401. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-nospec.sh +4 -0
  402. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-ungrounded.sh +5 -0
  403. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.knobs +5 -0
  404. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +8 -0
  405. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/ci/build-artifact.sh +9 -0
  406. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/ci.yml +16 -0
  407. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +6 -2
  408. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kit-spec.md +12 -0
  409. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-held.sh +1 -0
  410. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.knobs +5 -0
  411. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +1 -1
  412. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +222 -197
  413. package/payload/gate-sdk/gate-tests/check-graph/bad/SPEC-example-gate.md +7 -2
  414. package/payload/gate-sdk/gate-tests/check-graph/bad/expect.txt +4 -0
  415. package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-second-gate.md +3 -1
  416. package/payload/gate-sdk/gate-tests/check-graph-cap.test.sh +1 -1
  417. package/payload/gate-sdk/gate-tests/check-graph-refs.test.sh +8 -8
  418. package/payload/gate-sdk/gate-tests/check-graph-theme.test.sh +2 -2
  419. package/payload/gate-sdk/gate-tests/check-graph-tree.test.sh +49 -14
  420. package/payload/gate-sdk/gate-tests/check-identity/bad/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +4 -4
  421. package/payload/gate-sdk/gate-tests/check-identity/good/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +4 -4
  422. package/payload/gate-sdk/gate-tests/check-identity.test.sh +1 -1
  423. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-eta.sh +7 -0
  424. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-iota.sh +7 -0
  425. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-theta.sh +7 -0
  426. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-zeta.gate +3 -0
  427. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/smoke/install.sh +1 -1
  428. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/args +8 -5
  429. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/expect.txt +5 -0
  430. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/native/src/installer/recipe.rs +10 -0
  431. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +2 -3
  432. package/payload/gate-sdk/gate-tests/check-install-disposition/good/args +8 -4
  433. package/payload/gate-sdk/gate-tests/check-install-disposition/good/expect.txt +2 -0
  434. package/payload/gate-sdk/gate-tests/check-install-disposition/good/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +2 -3
  435. package/payload/gate-sdk/gate-tests/check-install-disposition/good/{alpha-kit → site-kit}/checks/check-alpha.sh +1 -1
  436. package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-beta.gate +3 -0
  437. package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-gamma.sh +6 -0
  438. package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-omega.sh +7 -0
  439. package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-psi.sh +7 -0
  440. package/payload/gate-sdk/gate-tests/check-install-disposition/good/{alpha-kit → site-kit}/smoke/install.sh +2 -2
  441. package/payload/gate-sdk/gate-tests/check-kit-registration/bad/registry-doc.md +15 -12
  442. package/payload/gate-sdk/gate-tests/check-kit-registration/good/args +7 -5
  443. package/payload/gate-sdk/gate-tests/check-kit-registration/good/scripts/gate-sdk-config.knobs +2 -0
  444. package/payload/gate-sdk/gate-tests/check-kit-registration.test.sh +2 -2
  445. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/args +5 -0
  446. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/expect.txt +1 -0
  447. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/alpha-kit/checks/placeholder.txt +3 -0
  448. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/alpha-kit/gate-tests/alpha.test.sh +3 -0
  449. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/alpha-kit/lib/alpha.sh +3 -0
  450. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/beta-kit/checks/placeholder.txt +3 -0
  451. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/beta-kit/gate-tests/beta.test.sh +3 -0
  452. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/beta-kit/lib/beta.sh +3 -0
  453. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/gate-sdk/checks/placeholder.txt +3 -0
  454. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/gate-sdk/lib/gate.sh +3 -0
  455. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/scripts/gate-sdk-config.knobs +7 -0
  456. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/scripts/gates.list +3 -0
  457. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/args +7 -0
  458. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/expect.txt +1 -0
  459. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/alpha-kit/checks/placeholder.txt +3 -0
  460. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/alpha-kit/gate-tests/alpha.test.sh +3 -0
  461. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/alpha-kit/lib/alpha.sh +3 -0
  462. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/beta-kit/checks/placeholder.txt +3 -0
  463. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/beta-kit/gate-tests/beta.test.sh +3 -0
  464. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/beta-kit/lib/beta.sh +3 -0
  465. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/gate-sdk/checks/placeholder.txt +3 -0
  466. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/gate-sdk/lib/gate.sh +3 -0
  467. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/scripts/gates.list +3 -0
  468. package/payload/gate-sdk/gate-tests/check-packed-links/bad/alpha-kit/README.md +5 -0
  469. package/payload/gate-sdk/gate-tests/check-packed-links/bad/args +5 -0
  470. package/payload/gate-sdk/gate-tests/check-packed-links/bad/beta-kit/README.md +5 -0
  471. package/payload/gate-sdk/gate-tests/check-packed-links/bad/expect.txt +2 -0
  472. package/payload/gate-sdk/gate-tests/check-packed-links/bad/scripts/gate-sdk-config.knobs +4 -0
  473. package/payload/gate-sdk/gate-tests/check-packed-links/good/alpha-kit/README.md +5 -0
  474. package/payload/gate-sdk/gate-tests/check-packed-links/good/args +8 -0
  475. package/payload/gate-sdk/gate-tests/check-packed-links/good/beta-kit/README.md +9 -0
  476. package/payload/gate-sdk/gate-tests/check-packed-links/good/expect.txt +1 -0
  477. package/payload/gate-sdk/gate-tests/check-packed-links/good/gamma-kit/SPEC.md +4 -0
  478. package/payload/gate-sdk/gate-tests/check-packed-links/good/scripts/gate-sdk-config.knobs +6 -0
  479. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/args +3 -0
  480. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/expect.txt +15 -0
  481. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/native/src/primitive.rs +19 -0
  482. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/native/src/producer.rs +8 -0
  483. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/native/src/walk.rs +13 -0
  484. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/bound-root.sh +5 -0
  485. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/case-arm.sh +6 -0
  486. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/commented.sh +5 -0
  487. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/common-dir.sh +4 -0
  488. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/glob-test.sh +4 -0
  489. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/late-anchor.sh +7 -0
  490. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/logical-readback.sh +5 -0
  491. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/probe.sh +7 -0
  492. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/two-root.sh +5 -0
  493. package/payload/gate-sdk/gate-tests/check-path-dialect/good/args +3 -0
  494. package/payload/gate-sdk/gate-tests/check-path-dialect/good/expect.txt +13 -0
  495. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/commented.rs +5 -0
  496. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/local.rs +12 -0
  497. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/namespace.rs +11 -0
  498. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/typed.rs +10 -0
  499. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/verdict.rs +5 -0
  500. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/walk.rs +24 -0
  501. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/anchored.sh +6 -0
  502. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/cd-only.sh +7 -0
  503. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/commented.sh +6 -0
  504. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/one-root.sh +4 -0
  505. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/probe.sh +8 -0
  506. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/rooted.sh +23 -0
  507. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/subshell.sh +6 -0
  508. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/two-line.sh +8 -0
  509. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/verdict.sh +7 -0
  510. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/args +4 -0
  511. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/expect.txt +6 -0
  512. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/scripts/gate-sdk-config.knobs +1 -0
  513. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/array-grep.sh +6 -0
  514. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/echo-max-count.sh +5 -0
  515. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/gate-tests/membership.test.sh +6 -0
  516. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/loop-head.sh +5 -0
  517. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/tests/relocated.test.sh +6 -0
  518. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/args +5 -0
  519. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/expect.txt +3 -0
  520. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/full-reader.sh +4 -0
  521. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/gate-tests/check-x/bad/violating.test.sh +6 -0
  522. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/gate-tests/clean.test.sh +8 -0
  523. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/loop-membership.sh +8 -0
  524. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/no-pipefail.sh +6 -0
  525. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/one-line-producer.sh +5 -0
  526. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/args +2 -0
  527. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/expect.txt +8 -0
  528. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/patterns.list +4 -0
  529. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/scripts/gate-sdk-config.knobs +4 -0
  530. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/empty-reason-verb +5 -0
  531. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/strings.ps1 +6 -0
  532. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/too-far-verb +5 -0
  533. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/undeclared-verb +3 -0
  534. package/payload/gate-sdk/gate-tests/check-portability-floor/good/args +2 -0
  535. package/payload/gate-sdk/gate-tests/check-portability-floor/good/expect.txt +1 -0
  536. package/payload/gate-sdk/gate-tests/check-portability-floor/good/patterns.list +5 -0
  537. package/payload/gate-sdk/gate-tests/check-portability-floor/good/scripts/gate-sdk-config.knobs +4 -0
  538. package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/front.ps1 +7 -0
  539. package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/plain-verb +5 -0
  540. package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/portability-patterns.list +5 -0
  541. package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/upgrade-verb +7 -0
  542. package/payload/gate-sdk/gate-tests/check-portability-floor.test.sh +154 -0
  543. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/demo-kit/checks/check-beta.gate +2 -0
  544. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/docs/roster.md +11 -0
  545. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/expect.txt +7 -0
  546. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/check-alpha.gate +2 -0
  547. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/check-gamma.gate +2 -0
  548. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/check-plain.gate +1 -0
  549. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/gate-sdk-config.knobs +3 -0
  550. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/gates.list +4 -0
  551. package/payload/gate-sdk/gate-tests/check-projection-roster/good/demo-kit/checks/check-beta.gate +2 -0
  552. package/payload/gate-sdk/gate-tests/check-projection-roster/good/docs/roster.md +16 -0
  553. package/payload/gate-sdk/gate-tests/check-projection-roster/good/expect.txt +1 -0
  554. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-alpha.gate +2 -0
  555. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-delta.gate +2 -0
  556. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-epsilon.gate +2 -0
  557. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-plain.gate +1 -0
  558. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/gate-sdk-config.knobs +4 -0
  559. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/gates.list +5 -0
  560. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.knobs +4 -0
  561. package/payload/gate-sdk/gate-tests/check-readme-roster/good/args +1 -1
  562. package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.knobs +4 -0
  563. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/expect.txt +1 -1
  564. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/sandbox-gate.sh +4 -4
  565. package/payload/gate-sdk/gate-tests/check-reads-couples/good/sandbox-gate.sh +4 -4
  566. package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +25 -20
  567. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/alpha-kit/smoke/install.sh +1 -1
  568. package/payload/gate-sdk/gate-tests/{check-template-registry-parity/bad/scripts/gate-sdk-config.sh → check-smoke-entry-guard/bad/scripts/gate-sdk-config.knobs} +2 -3
  569. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/install.sh +1 -1
  570. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/violation.sh +1 -1
  571. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/args +1 -1
  572. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/beta-kit/smoke/install.sh +1 -1
  573. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/scripts/gate-sdk-config.knobs +4 -0
  574. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/args +3 -1
  575. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/session-note.sh +6 -0
  576. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/expect.txt +1 -1
  577. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/session-note.sh +6 -0
  578. package/payload/gate-sdk/gate-tests/check-template-copy-parity.test.sh +1 -1
  579. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +2 -0
  580. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/drift-kit/templates/kpis.list +18 -0
  581. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +2 -0
  582. package/payload/gate-sdk/gate-tests/{check-smoke-entry-guard/bad/scripts/gate-sdk-config.sh → check-template-registry-parity/bad/scripts/gate-sdk-config.knobs} +2 -3
  583. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +3 -1
  584. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/drift-kit/templates/kpis.list +17 -0
  585. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -1
  586. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.knobs +4 -0
  587. package/payload/gate-sdk/gate-tests/check-test-hermetic-smoke.test.sh +5 -5
  588. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +6 -0
  589. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/patterns.list +4 -0
  590. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/accounts.txt +1 -0
  591. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/multi.txt +4 -0
  592. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/second-leak.txt +2 -0
  593. package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -1
  594. package/payload/gate-sdk/gate-tests/check-tree-terms/good/patterns.list +7 -0
  595. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/anchored.txt +5 -0
  596. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/handles.txt +2 -0
  597. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/msg-patterns.list +2 -0
  598. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/msg-patterns.local.list +3 -0
  599. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/worktrees/vendored-note.txt +3 -0
  600. package/payload/gate-sdk/gate-tests/check-tree-terms.test.sh +133 -0
  601. package/payload/gate-sdk/gate-tests/emit-arm-shape.test.sh +95 -0
  602. package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +10 -10
  603. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +10 -184
  604. package/payload/gate-sdk/gate-tests/reads-census.test.sh +96 -0
  605. package/payload/gate-sdk/gate-tests/run-arm-contract.test.sh +190 -0
  606. package/payload/gate-sdk/gate-tests/run-dispatch-streams.test.sh +64 -41
  607. package/payload/gate-sdk/gate-tests/run-for-path.test.sh +2 -2
  608. package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +121 -16
  609. package/payload/gate-sdk/gate-tests/run-gates-linked-worktree.test.sh +136 -0
  610. package/payload/gate-sdk/lib/gate.sh +231 -484
  611. package/payload/gate-sdk/lib/test-hermetic.sh +39 -9
  612. package/payload/gate-sdk/templates/check-skeleton.sh +3 -2
  613. package/payload/gate-sdk/templates/gates-workflow.yml +23 -10
  614. package/payload/gate-sdk/templates/msg-patterns.list +14 -5
  615. package/payload/gate-sdk/templates/portability-patterns.list +56 -0
  616. package/payload/guard-kit/README.md +43 -46
  617. package/payload/guard-kit/checks/check-door-binding.gate +3 -0
  618. package/payload/guard-kit/gate-tests/check-door-binding/bad/alpha-kit/README.md +6 -0
  619. package/payload/guard-kit/gate-tests/check-door-binding/bad/alpha-kit/templates/alpha-config.knobs +3 -0
  620. package/payload/guard-kit/gate-tests/check-door-binding/bad/args +5 -0
  621. package/payload/guard-kit/gate-tests/check-door-binding/bad/beta-kit/lib/beta.sh +6 -0
  622. package/payload/guard-kit/gate-tests/check-door-binding/bad/expect.txt +5 -0
  623. package/payload/guard-kit/gate-tests/check-door-binding/bad/scripts/gate-sdk-config.knobs +4 -0
  624. package/payload/guard-kit/gate-tests/check-door-binding/bad/scripts/guard-config.knobs +3 -0
  625. package/payload/guard-kit/gate-tests/check-door-binding/bad/site/banner.md +8 -0
  626. package/payload/guard-kit/gate-tests/check-door-binding/bad/site/landing.md +11 -0
  627. package/payload/guard-kit/gate-tests/check-door-binding/good/alpha-kit/README.md +8 -0
  628. package/payload/guard-kit/gate-tests/check-door-binding/good/alpha-kit/templates/settings-hooks.json +20 -0
  629. package/payload/guard-kit/gate-tests/check-door-binding/good/args +7 -0
  630. package/payload/guard-kit/gate-tests/check-door-binding/good/beta-kit/lib/beta.sh +6 -0
  631. package/payload/guard-kit/gate-tests/check-door-binding/good/expect.txt +1 -0
  632. package/payload/guard-kit/gate-tests/check-door-binding/good/scripts/gate-sdk-config.knobs +4 -0
  633. package/payload/guard-kit/gate-tests/check-door-binding/good/scripts/guard-config.knobs +3 -0
  634. package/payload/guard-kit/gate-tests/check-door-binding/good/site/mirror.md +12 -0
  635. package/payload/guard-kit/gate-tests/check-door-binding/good/site/register.md +24 -0
  636. package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +75 -17
  637. package/payload/guard-kit/gate-tests/consumer-rules.test.sh +189 -0
  638. package/payload/guard-kit/gate-tests/door-binding-corpus.test.sh +72 -0
  639. package/payload/guard-kit/gate-tests/git-mutation-under-producer.test.sh +48 -23
  640. package/payload/guard-kit/gate-tests/guard-config-knobs.test.sh +170 -0
  641. package/payload/guard-kit/gate-tests/rewrite.test.sh +73 -0
  642. package/payload/guard-kit/gate-tests/scan-prompts.test.sh +174 -8
  643. package/payload/guard-kit/gate-tests/scratch-run.test.sh +149 -13
  644. package/payload/guard-kit/gate-tests/worktree-confinement.test.sh +169 -0
  645. package/payload/guard-kit/guard-tests/background-cases.tsv +23 -0
  646. package/payload/guard-kit/guard-tests/cases.tsv +374 -38
  647. package/payload/guard-kit/guard-tests/powershell-background-cases.tsv +29 -0
  648. package/payload/guard-kit/guard-tests/powershell-cases.tsv +81 -0
  649. package/payload/guard-kit/templates/close-triage.md +15 -55
  650. package/payload/guard-kit/templates/guard-config.knobs +26 -0
  651. package/payload/guard-kit/templates/settings-allow.json +15 -0
  652. package/payload/guard-kit/templates/settings-hooks.json +5 -5
  653. package/payload/lifecycle-kit/README.md +48 -76
  654. package/payload/lifecycle-kit/checks/check-audit-roster.gate +3 -0
  655. package/payload/lifecycle-kit/checks/check-close-surfaces.gate +1 -1
  656. package/payload/lifecycle-kit/checks/check-dispatch-entry.gate +3 -0
  657. package/payload/lifecycle-kit/checks/check-gap-inbox-neutrality.gate +1 -1
  658. package/payload/lifecycle-kit/checks/check-lesson-disposition.gate +1 -1
  659. package/payload/lifecycle-kit/checks/check-lifecycle-registration.gate +1 -1
  660. package/payload/lifecycle-kit/checks/check-merge-attrs.gate +1 -1
  661. package/payload/lifecycle-kit/checks/check-scratch-citation.gate +1 -1
  662. package/payload/lifecycle-kit/checks/check-shim-restatement.gate +1 -1
  663. package/payload/lifecycle-kit/checks/check-skill-binding.gate +1 -1
  664. package/payload/lifecycle-kit/checks/check-stage-entry.gate +2 -2
  665. package/payload/lifecycle-kit/checks/check-stage-evidence.gate +1 -1
  666. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.gate +2 -2
  667. package/payload/lifecycle-kit/checks/check-stamp-subject.gate +3 -0
  668. package/payload/lifecycle-kit/checks/check-survey-record.gate +2 -2
  669. package/payload/lifecycle-kit/gate-tests/boundary-scratch-wipe.test.sh +93 -18
  670. package/payload/lifecycle-kit/gate-tests/boundary-stage-journal.test.sh +196 -0
  671. package/payload/lifecycle-kit/gate-tests/boundary-worktree-refusal.test.sh +214 -0
  672. package/payload/lifecycle-kit/gate-tests/check-audit-roster/bad/args +2 -0
  673. package/payload/lifecycle-kit/gate-tests/check-audit-roster/bad/expect.txt +6 -0
  674. package/payload/lifecycle-kit/gate-tests/check-audit-roster/bad/roster.txt +34 -0
  675. package/payload/lifecycle-kit/gate-tests/check-audit-roster/good/args +2 -0
  676. package/payload/lifecycle-kit/gate-tests/check-audit-roster/good/expect.txt +1 -0
  677. package/payload/lifecycle-kit/gate-tests/check-audit-roster/good/roster.txt +22 -0
  678. package/payload/lifecycle-kit/gate-tests/check-audit-roster.test.sh +101 -0
  679. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/scripts/lifecycle-config.knobs +2 -0
  680. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/owners/worktrees/inbox.md +5 -0
  681. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/scripts/lifecycle-config.knobs +2 -0
  682. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +21 -4
  683. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/args +6 -0
  684. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/expect.txt +1 -0
  685. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/head.txt +5 -0
  686. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/marker.txt +1 -0
  687. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/msg.txt +4 -0
  688. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/paths.txt +1 -0
  689. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/staged.txt +5 -0
  690. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/args +6 -0
  691. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/expect.txt +1 -0
  692. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/head.txt +5 -0
  693. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/marker.txt +1 -0
  694. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/msg.txt +4 -0
  695. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/paths.txt +2 -0
  696. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/staged.txt +6 -0
  697. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry.test.sh +60 -0
  698. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +1 -1
  699. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/AGENT.md +1 -5
  700. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/AGENT.md +1 -5
  701. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +1 -1
  702. package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +2 -2
  703. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/scripts/lifecycle-config.knobs +2 -0
  704. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/scripts/lifecycle-config.knobs +2 -0
  705. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/surfaces/worktrees/queue.md +13 -0
  706. package/payload/lifecycle-kit/gate-tests/check-shim-restatement.test.sh +1 -1
  707. package/payload/lifecycle-kit/gate-tests/check-skill-binding.test.sh +1 -1
  708. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +158 -11
  709. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +27 -2
  710. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/align.md +4 -1
  711. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/build.md +4 -1
  712. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/close.md +5 -0
  713. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/scope.md +4 -1
  714. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/validate.md +1 -1
  715. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/expect.txt +1 -1
  716. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/align.md +4 -1
  717. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/build.md +4 -1
  718. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/close.md +4 -1
  719. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/scope.md +4 -1
  720. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/validate.md +4 -1
  721. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage.test.sh +73 -0
  722. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/args +4 -0
  723. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/expect.txt +1 -0
  724. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/head.txt +5 -0
  725. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/msg.txt +4 -0
  726. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/staged.txt +6 -0
  727. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/args +4 -0
  728. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/expect.txt +1 -0
  729. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/head.txt +5 -0
  730. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/msg.txt +4 -0
  731. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/staged.txt +7 -0
  732. package/payload/lifecycle-kit/gate-tests/check-stamp-subject.test.sh +59 -0
  733. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +3 -0
  734. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +24 -0
  735. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -1
  736. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +10 -0
  737. package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +56 -5
  738. package/payload/lifecycle-kit/gate-tests/dispatch-marker.test.sh +152 -0
  739. package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +23 -48
  740. package/payload/lifecycle-kit/gate-tests/gap-inbox-route.test.sh +7 -5
  741. package/payload/lifecycle-kit/gate-tests/lead-journal-open.test.sh +119 -0
  742. package/payload/lifecycle-kit/gate-tests/preflight-valve.test.sh +170 -0
  743. package/payload/lifecycle-kit/gate-tests/rename-iteration.test.sh +5 -3
  744. package/payload/lifecycle-kit/gate-tests/ruling-staleness.test.sh +89 -0
  745. package/payload/lifecycle-kit/gate-tests/stamp-before-write.test.sh +66 -0
  746. package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +12 -6
  747. package/payload/lifecycle-kit/templates/consult.md +9 -63
  748. package/payload/lifecycle-kit/templates/lead.md +143 -423
  749. package/payload/lifecycle-kit/templates/lifecycle-config.knobs +1 -0
  750. package/payload/lifecycle-kit/templates/release-sweep.md +6 -35
  751. package/payload/lifecycle-kit/templates/stages/align.md +14 -82
  752. package/payload/lifecycle-kit/templates/stages/build.md +30 -98
  753. package/payload/lifecycle-kit/templates/stages/close.md +21 -170
  754. package/payload/lifecycle-kit/templates/stages/scope.md +42 -167
  755. package/payload/lifecycle-kit/templates/stages/spec.md +31 -97
  756. package/payload/lifecycle-kit/templates/stages/validate.md +22 -59
  757. package/payload/lifecycle-kit/templates/upgrade.md +6 -37
  758. package/payload/queue-kit/README.md +33 -48
  759. package/payload/queue-kit/checks/check-deferred-board-tags.gate +3 -0
  760. package/payload/queue-kit/checks/check-queue-entry-budget.gate +2 -2
  761. package/payload/queue-kit/checks/check-queue-hygiene.gate +2 -2
  762. package/payload/queue-kit/checks/check-queue-prose-precondition.gate +1 -1
  763. package/payload/queue-kit/checks/check-queue-sections.gate +1 -1
  764. package/payload/queue-kit/checks/check-queue-slug-liveness.gate +2 -2
  765. package/payload/queue-kit/checks/check-queue-wrap.gate +2 -2
  766. package/payload/queue-kit/checks/check-roadmap-fresh.gate +3 -2
  767. package/payload/queue-kit/checks/check-tag-lead-line.gate +2 -2
  768. package/payload/queue-kit/checks/check-task-conservation.gate +1 -1
  769. package/payload/queue-kit/checks/check-task-names.gate +2 -2
  770. package/payload/queue-kit/gate-tests/check-deferred-board-tags/bad/TASK-QUEUE.md +41 -0
  771. package/payload/queue-kit/gate-tests/check-deferred-board-tags/bad/expect.txt +6 -0
  772. package/payload/queue-kit/gate-tests/check-deferred-board-tags/bad/widget-kit/README.md +3 -0
  773. package/payload/queue-kit/gate-tests/check-deferred-board-tags/good/TASK-QUEUE.md +39 -0
  774. package/payload/queue-kit/gate-tests/check-deferred-board-tags/good/expect.txt +1 -0
  775. package/payload/queue-kit/gate-tests/check-deferred-board-tags/good/widget-kit/README.md +3 -0
  776. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/TASK-QUEUE.md +76 -31
  777. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/expect.txt +12 -4
  778. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/scripts/queue-config.knobs +4 -0
  779. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/TASK-QUEUE.md +58 -19
  780. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/expect.txt +8 -4
  781. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/scripts/queue-config.knobs +4 -0
  782. package/payload/queue-kit/gate-tests/check-queue-entry-budget.test.sh +124 -0
  783. package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/TASK-QUEUE.md +11 -1
  784. package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/expect.txt +2 -0
  785. package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +30 -11
  786. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/TASK-QUEUE.md +3 -1
  787. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/expect.txt +1 -0
  788. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/good/TASK-QUEUE.md +22 -6
  789. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/TASK-QUEUE.md +3 -1
  790. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/docs/page.md +1 -1
  791. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/expect.txt +3 -1
  792. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/scripts/queue-config.knobs +1 -0
  793. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/TASK-QUEUE.md +6 -2
  794. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/docs/page.md +3 -3
  795. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/docs/worktrees/page.md +4 -0
  796. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/scripts/queue-config.knobs +1 -0
  797. package/payload/queue-kit/gate-tests/check-queue-slug-liveness.test.sh +100 -0
  798. package/payload/queue-kit/gate-tests/check-queue-wrap/bad/TASK-QUEUE.md +3 -1
  799. package/payload/queue-kit/gate-tests/check-queue-wrap/good/TASK-QUEUE.md +20 -6
  800. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/TASK-QUEUE.md +15 -8
  801. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/scripts/queue-config.knobs +5 -0
  802. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/TASK-QUEUE.md +13 -6
  803. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/scripts/queue-config.knobs +5 -0
  804. package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/TASK-QUEUE.md +28 -7
  805. package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/expect.txt +10 -2
  806. package/payload/queue-kit/gate-tests/check-tag-lead-line/good/TASK-QUEUE.md +30 -8
  807. package/payload/queue-kit/gate-tests/check-task-names/bad/TASK-QUEUE.md +18 -3
  808. package/payload/queue-kit/gate-tests/check-task-names/bad/expect.txt +9 -0
  809. package/payload/queue-kit/gate-tests/check-task-names/good/TASK-QUEUE.md +20 -6
  810. package/payload/queue-kit/gate-tests/entry-history.test.sh +197 -0
  811. package/payload/queue-kit/gate-tests/queue-counts.test.sh +77 -73
  812. package/payload/queue-kit/gate-tests/queue-edges.test.sh +168 -87
  813. package/payload/queue-kit/gate-tests/queue-index.test.sh +30 -16
  814. package/payload/queue-kit/gate-tests/roadmap.test.sh +65 -58
  815. package/payload/queue-kit/templates/TASK-QUEUE.md +36 -23
  816. package/payload/queue-kit/templates/queue-config.knobs +1 -0
  817. package/payload/site-kit/README.md +26 -45
  818. package/payload/site-kit/checks/check-docs-cname-parity.gate +1 -1
  819. package/payload/site-kit/checks/check-docs-highlight-coverage.gate +4 -0
  820. package/payload/site-kit/checks/check-docs-liquid-parse.gate +3 -0
  821. package/payload/site-kit/checks/check-docs-render-fidelity.gate +3 -0
  822. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/args +1 -1
  823. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/scripts/site-config.knobs +2 -0
  824. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/args +2 -2
  825. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/scripts/site-config.knobs +2 -0
  826. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/docs/_layouts/default.html +11 -0
  827. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/expect.txt +4 -0
  828. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/scripts/highlight-tokens.list +7 -0
  829. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/scripts/site-config.knobs +3 -0
  830. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/docs/_layouts/default.html +14 -0
  831. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/expect.txt +1 -0
  832. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/scripts/highlight-tokens.list +7 -0
  833. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/scripts/site-config.knobs +1 -0
  834. package/payload/site-kit/gate-tests/check-docs-liquid-parse/bad/docs/_layouts/default.html +4 -0
  835. package/payload/site-kit/gate-tests/check-docs-liquid-parse/bad/docs/span.md +3 -0
  836. package/payload/site-kit/gate-tests/check-docs-liquid-parse/bad/expect.txt +2 -0
  837. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/_layouts/default.html +4 -0
  838. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/front.md +7 -0
  839. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/loop.md +5 -0
  840. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/plain.html +1 -0
  841. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/raw.md +3 -0
  842. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/search.json +4 -0
  843. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/expect.txt +1 -0
  844. package/payload/site-kit/gate-tests/check-docs-liquid-parse-parser.test.sh +62 -0
  845. package/payload/site-kit/gate-tests/check-docs-render-fidelity-batch.test.sh +40 -45
  846. package/payload/site-kit/gate-tests/check-docs-render-fidelity-foreign.test.sh +7 -4
  847. package/payload/site-kit/gate-tests/check-docs-render-fidelity-span.test.sh +7 -4
  848. package/payload/site-kit/gate-tests/check-docs-render-fidelity-table.test.sh +7 -4
  849. package/payload/site-kit/templates/site-health.yml +67 -4
  850. package/profiles.list +4 -5
  851. package/lib/common/digest.sh +0 -18
  852. package/lib/common/lock.sh +0 -75
  853. package/lib/common/profile.sh +0 -91
  854. package/lib/common/recipe.sh +0 -106
  855. package/lib/diff.sh +0 -66
  856. package/lib/doctor.sh +0 -164
  857. package/lib/init.sh +0 -428
  858. package/lib/uninstall.sh +0 -214
  859. package/lib/update.sh +0 -34
  860. package/payload/canon-kit/SPEC.md +0 -2129
  861. package/payload/canon-kit/checks/check-surface-duplication.sh +0 -106
  862. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.sh +0 -6
  863. package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.sh +0 -6
  864. package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/canon-config.sh +0 -10
  865. package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/canon-config.sh +0 -10
  866. package/payload/canon-kit/gate-tests/check-measured-claim/bad/scripts/canon-config.sh +0 -6
  867. package/payload/canon-kit/gate-tests/check-measured-claim/good/scripts/canon-config.sh +0 -6
  868. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +0 -8
  869. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +0 -8
  870. package/payload/canon-kit/gate-tests/check-prose-enum/bad/scripts/canon-config.sh +0 -4
  871. package/payload/canon-kit/gate-tests/check-prose-enum/good/scripts/canon-config.sh +0 -4
  872. package/payload/canon-kit/gate-tests/check-prose-tells/bad/scripts/canon-config.sh +0 -8
  873. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/scripts/canon-config.sh +0 -5
  874. package/payload/canon-kit/gate-tests/check-spec-pointer/good/scripts/canon-config.sh +0 -5
  875. package/payload/canon-kit/lib/spec.sh +0 -544
  876. package/payload/canon-kit/smoke/install.sh +0 -56
  877. package/payload/canon-kit/smoke/violation.sh +0 -22
  878. package/payload/canon-kit/templates/canon-config.sh +0 -2
  879. package/payload/context-kit/SPEC.md +0 -1123
  880. package/payload/context-kit/bin/always-loaded.sh +0 -70
  881. package/payload/context-kit/bin/env-probe.sh +0 -142
  882. package/payload/context-kit/bin/md-index.sh +0 -80
  883. package/payload/context-kit/bin/md-section.sh +0 -63
  884. package/payload/context-kit/bin/pub-index.sh +0 -90
  885. package/payload/context-kit/bin/run-index-tests.sh +0 -91
  886. package/payload/context-kit/gate-tests/check-footprint-fresh/good/args +0 -4
  887. package/payload/context-kit/gate-tests/check-footprint-fresh/good/emit.txt +0 -12
  888. package/payload/context-kit/gate-tests/check-footprint-fresh/good/projection.txt +0 -12
  889. package/payload/context-kit/index-tests/expected/toolfloor.txt +0 -23
  890. package/payload/context-kit/index-tests/toolfloor-cases.sh +0 -49
  891. package/payload/context-kit/lib/context.sh +0 -56
  892. package/payload/context-kit/lib/pub-lang/rust.sh +0 -26
  893. package/payload/context-kit/lib/pub-lang/ts.sh +0 -32
  894. package/payload/context-kit/lib/toolfloor.sh +0 -58
  895. package/payload/context-kit/smoke/agents-md.sh +0 -139
  896. package/payload/context-kit/smoke/install.sh +0 -64
  897. package/payload/context-kit/smoke/violation.sh +0 -21
  898. package/payload/context-kit/templates/context-config.sh +0 -2
  899. package/payload/delegation-kit/SPEC.md +0 -1712
  900. package/payload/delegation-kit/bin/run-budget-guard-tests.sh +0 -88
  901. package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +0 -97
  902. package/payload/delegation-kit/bin/run-trend-tests.sh +0 -63
  903. package/payload/delegation-kit/bin/run-usage-tests.sh +0 -226
  904. package/payload/delegation-kit/bin/usage-trend.sh +0 -120
  905. package/payload/delegation-kit/bin/usage-verdict.sh +0 -144
  906. package/payload/delegation-kit/lib/delegation.sh +0 -84
  907. package/payload/delegation-kit/smoke/install.sh +0 -63
  908. package/payload/delegation-kit/smoke/violation.sh +0 -16
  909. package/payload/delegation-kit/templates/agent-budget-guard.sh +0 -18
  910. package/payload/delegation-kit/templates/agent-dispatch-guard.sh +0 -61
  911. package/payload/delegation-kit/templates/delegation-config.sh +0 -6
  912. package/payload/delegation-kit/templates/statusline-usage.sh +0 -101
  913. package/payload/delegation-kit/templates/usage-poller.sh +0 -67
  914. package/payload/delegation-kit/usage-tests/budget-guard-cases.tsv +0 -20
  915. package/payload/doctrine-kit/SPEC.md +0 -385
  916. package/payload/doctrine-kit/bin/install-doctrine.sh +0 -194
  917. package/payload/doctrine-kit/bin/stage-rules.sh +0 -51
  918. package/payload/doctrine-kit/lib/doctrine.sh +0 -29
  919. package/payload/doctrine-kit/smoke/install.sh +0 -203
  920. package/payload/doctrine-kit/smoke/violation.sh +0 -13
  921. package/payload/drift-kit/SPEC.md +0 -1187
  922. package/payload/drift-kit/bin/drift-report.sh +0 -155
  923. package/payload/drift-kit/bin/kfric.sh +0 -61
  924. package/payload/drift-kit/bin/overhead-meter.sh +0 -106
  925. package/payload/drift-kit/bin/stage-economics.sh +0 -465
  926. package/payload/drift-kit/kpis/kpi-always-loaded.sh +0 -39
  927. package/payload/drift-kit/kpis/kpi-amendment-age.sh +0 -33
  928. package/payload/drift-kit/kpis/kpi-deferred-age.sh +0 -46
  929. package/payload/drift-kit/kpis/kpi-gate-backlog.sh +0 -52
  930. package/payload/drift-kit/kpis/kpi-gate-runtime.sh +0 -31
  931. package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +0 -42
  932. package/payload/drift-kit/kpis/kpi-knowledge-friction.sh +0 -21
  933. package/payload/drift-kit/kpis/kpi-overhead.sh +0 -44
  934. package/payload/drift-kit/kpis/kpi-price-table-age.sh +0 -68
  935. package/payload/drift-kit/kpis/kpi-prompt-friction.sh +0 -38
  936. package/payload/drift-kit/kpis/kpi-queue-net-delta.sh +0 -74
  937. package/payload/drift-kit/kpis/kpi-settings-local.sh +0 -21
  938. package/payload/drift-kit/kpis/kpi-task-split.sh +0 -43
  939. package/payload/drift-kit/lib/drift.sh +0 -43
  940. package/payload/drift-kit/smoke/install.sh +0 -537
  941. package/payload/drift-kit/smoke/overhead-fixture.jsonl +0 -4
  942. package/payload/drift-kit/templates/drift-config.sh +0 -2
  943. package/payload/evidence-kit/SPEC.md +0 -740
  944. package/payload/evidence-kit/bin/diff-baseline.sh +0 -34
  945. package/payload/evidence-kit/bin/run-validate.sh +0 -124
  946. package/payload/evidence-kit/checks/check-producer-liveness.sh +0 -75
  947. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +0 -7
  948. package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +0 -7
  949. package/payload/evidence-kit/lib/evidence.sh +0 -193
  950. package/payload/evidence-kit/smoke/install.sh +0 -59
  951. package/payload/evidence-kit/smoke/violation.sh +0 -8
  952. package/payload/evidence-kit/templates/evidence-config.sh +0 -2
  953. package/payload/gate-sdk/SPEC.md +0 -10138
  954. package/payload/gate-sdk/bin/gen-pre-commit.sh +0 -297
  955. package/payload/gate-sdk/bin/install-hooks.sh +0 -60
  956. package/payload/gate-sdk/bin/port-blockers.sh +0 -473
  957. package/payload/gate-sdk/bin/run-consumer-smoke.sh +0 -239
  958. package/payload/gate-sdk/bin/run-gate-tests.sh +0 -179
  959. package/payload/gate-sdk/bin/upgrade-smoke.sh +0 -236
  960. package/payload/gate-sdk/checks/check-action-run-shell.sh +0 -223
  961. package/payload/gate-sdk/checks/check-crate-arms.sh +0 -62
  962. package/payload/gate-sdk/checks/check-gate-assertions.sh +0 -149
  963. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +0 -397
  964. package/payload/gate-sdk/checks/check-install-disposition.sh +0 -93
  965. package/payload/gate-sdk/checks/check-shellcheck.sh +0 -57
  966. package/payload/gate-sdk/checks/check-tree-terms.sh +0 -67
  967. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/scripts/gate-sdk-config.sh +0 -2
  968. package/payload/gate-sdk/gate-tests/check-crate-arms/good/scripts/gate-sdk-config.sh +0 -2
  969. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/args +0 -4
  970. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/emit.txt +0 -14
  971. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/projection.txt +0 -14
  972. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +0 -2
  973. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +0 -2
  974. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +0 -6
  975. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +0 -3
  976. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +0 -6
  977. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +0 -3
  978. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/installer/lib/common/recipe.sh +0 -9
  979. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-beta.gate +0 -3
  980. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-gamma.sh +0 -6
  981. package/payload/gate-sdk/gate-tests/check-install-disposition/good/installer/lib/common/recipe.sh +0 -10
  982. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.sh +0 -5
  983. package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.sh +0 -5
  984. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/scripts/gate-sdk-config.sh +0 -5
  985. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +0 -5
  986. package/payload/gate-sdk/gate-tests/declaration-lib-parity.test.sh +0 -211
  987. package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +0 -112
  988. package/payload/gate-sdk/lib/consumer-smoke.sh +0 -69
  989. package/payload/gate-sdk/lib/declaration.sh +0 -59
  990. package/payload/gate-sdk/lib/inject.sh +0 -80
  991. package/payload/gate-sdk/smoke/install.sh +0 -148
  992. package/payload/gate-sdk/smoke/violation.sh +0 -13
  993. package/payload/guard-kit/SPEC.md +0 -1063
  994. package/payload/guard-kit/bin/compare-settings-allow.sh +0 -91
  995. package/payload/guard-kit/bin/run-guard-tests.sh +0 -92
  996. package/payload/guard-kit/bin/scan-prompts.sh +0 -166
  997. package/payload/guard-kit/bin/scratch-run.sh +0 -34
  998. package/payload/guard-kit/gate-tests/guard-read-path.test.sh +0 -52
  999. package/payload/guard-kit/lib/guard.sh +0 -835
  1000. package/payload/guard-kit/smoke/install.sh +0 -26
  1001. package/payload/guard-kit/templates/bash-guard.sh +0 -18
  1002. package/payload/guard-kit/templates/escalation-guard.sh +0 -27
  1003. package/payload/guard-kit/templates/guard-config.sh +0 -5
  1004. package/payload/guard-kit/templates/wakeup-guard.sh +0 -20
  1005. package/payload/lifecycle-kit/SPEC.md +0 -2884
  1006. package/payload/lifecycle-kit/bin/cite-survey.sh +0 -81
  1007. package/payload/lifecycle-kit/bin/enter-stage.sh +0 -380
  1008. package/payload/lifecycle-kit/bin/file-gap.sh +0 -101
  1009. package/payload/lifecycle-kit/bin/file-survey.sh +0 -69
  1010. package/payload/lifecycle-kit/bin/install-lifecycle.sh +0 -36
  1011. package/payload/lifecycle-kit/bin/session-id.sh +0 -75
  1012. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/scripts/lifecycle-config.sh +0 -4
  1013. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/scripts/lifecycle-config.sh +0 -4
  1014. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/scripts/lifecycle-config.sh +0 -4
  1015. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/scripts/lifecycle-config.sh +0 -4
  1016. package/payload/lifecycle-kit/gate-tests/workflow-state-guard.test.sh +0 -100
  1017. package/payload/lifecycle-kit/lib/stages.sh +0 -194
  1018. package/payload/lifecycle-kit/smoke/install.sh +0 -434
  1019. package/payload/lifecycle-kit/smoke/violation.sh +0 -8
  1020. package/payload/lifecycle-kit/templates/lifecycle-config.sh +0 -2
  1021. package/payload/lifecycle-kit/templates/workflow-state-guard.sh +0 -29
  1022. package/payload/queue-kit/SPEC.md +0 -1358
  1023. package/payload/queue-kit/bin/lesson-sink.sh +0 -28
  1024. package/payload/queue-kit/bin/queue-counts.sh +0 -35
  1025. package/payload/queue-kit/bin/queue-edges.sh +0 -78
  1026. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/scripts/queue-config.sh +0 -6
  1027. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/scripts/queue-config.sh +0 -6
  1028. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/scripts/queue-config.sh +0 -3
  1029. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/scripts/queue-config.sh +0 -3
  1030. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/scripts/queue-config.sh +0 -6
  1031. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/scripts/queue-config.sh +0 -6
  1032. package/payload/queue-kit/gate-tests/queue-lib-parity.test.sh +0 -215
  1033. package/payload/queue-kit/lib/queue.sh +0 -129
  1034. package/payload/queue-kit/smoke/install.sh +0 -25
  1035. package/payload/queue-kit/smoke/violation.sh +0 -8
  1036. package/payload/queue-kit/templates/queue-config.sh +0 -2
  1037. package/payload/site-kit/SPEC.md +0 -589
  1038. package/payload/site-kit/checks/check-docs-render-fidelity.sh +0 -242
  1039. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/scripts/site-config.sh +0 -7
  1040. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/scripts/site-config.sh +0 -7
  1041. package/payload/site-kit/lib/site.sh +0 -43
  1042. package/payload/site-kit/smoke/install.sh +0 -34
  1043. package/payload/site-kit/smoke/violation.sh +0 -20
  1044. /package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/{check-ported.gate → check-stage-entry.gate} +0 -0
@@ -1,1712 +0,0 @@
1
- # delegation-kit — safe delegated-agent execution for budget-bounded sessions
2
-
3
- Delegated agents are cheap to dispatch and expensive to trust. Three failure
4
- surfaces dominate: **shared mutable state** (two committing agents race the
5
- git index and one sweeps the other's staged files under the wrong message),
6
- **interrupted long units** (a usage-window wall fires mid-flight and the
7
- uncommitted investigation dies with the session), and **untrustworthy
8
- self-reports** (a sub-agent's "passed" claim, or a gate quietly weakened to
9
- make its commit pass). The kit packages the supervisor-side protocol that
10
- closes all three, plus the two pieces that are mechanizable: a trustworthy
11
- budget verdict (`usage-verdict`) and a commit-shape gate over gate tampering
12
- (`check-gate-tamper`).
13
-
14
- The kit carries the protocol templates, the budget-verdict tool, and the
15
- tamper gate; the consumer supplies its own validate battery, shared-file
16
- roster, and toolchain checks — those are project rule content and never
17
- ship.
18
-
19
- ## The delegation model
20
-
21
- One **supervisor** session dispatches `Agent` tasks and owns every ruling;
22
- agents execute briefs and surface anything the brief does not cover.
23
- `templates/agent-execution.md` owns the load-bearing rules — it is the
24
- procedure a session loads, and each bullet's bold lead-in is the rule's stable
25
- name (§One template, a resident pointer). This section keeps the mechanism
26
- contracts and only the rationale that earns spec residency (a failure surface,
27
- a calibration history, a bound that is correctness rather than preference),
28
- each paragraph citing its rule by name rather than restating it.
29
-
30
- **Boundary — this protocol stays fire-and-forget.** An agent here executes a
31
- bounded brief and its result returns to the supervisor; a paused session that
32
- holds its working state and *resumes in place* when a question is answered is a
33
- different interaction model — *resume-in-place orchestration*, lifecycle-kit's
34
- lead template (lifecycle-kit/SPEC.md §templates/lead.md), which reuses this
35
- protocol's dispatch safety unchanged rather than replacing it.
36
-
37
- The template's **Serialize on shared files; ≤`DELEGATION_KIT_FAN_WIDTH`-wide
38
- otherwise** rule caps an *unlocked* fan-out at read-only work because the git
39
- index and HEAD are shared for every committing agent regardless of source-file
40
- disjointness — so the cap is a correctness bound, never a preference a consumer
41
- may configure up for committing agents (the knob's derivation: §Layout and
42
- configuration).
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 **Background + notification, never poll** rule now carries a
85
- *which primitive* clause, and that clause's residency here is a calibration
86
- history. The template first named the harness's waiting primitive in the
87
- singular while the harness offers two forms with opposite reactivity, so a
88
- session picking one unaided picked by shape. Naming a form teaches a spelling;
89
- naming the property a wait must have and sorting the forms under it teaches the
90
- discriminator — a bound that is correctness rather than preference, because it
91
- is what survives a harness adding a third form.
92
-
93
- **Two waitable things, and only one of them has a path.** The template splits
94
- what a session waits *on* and carries that mechanism itself. What is added here
95
- is that the split is *complete* rather than merely convenient, because the
96
- attested failure had no third case — and that the artifact's home is the resume
97
- journal's own scoping widened rather than a second rule, so the survivability
98
- grounds are stated once and cited twice.
99
-
100
- **The shell branch names its artifact, and the naming is the substance.** The
101
- split above left that branch pointing at *an artifact the session placed* without
102
- saying which, so a session that wanted to comply had nothing to write, and of the
103
- long-running shell producers a session might background, most publish no record of
104
- any kind. The artifact is a **launch-time liveness record**: the child's PID,
105
- captured by the launcher at the moment it backgrounds the child. The obvious
106
- repair — have the child touch a file when it finishes and wait on that — is
107
- refused, and the attested failure is exactly why: a completion marker answers *is
108
- it done* **to a live observer**, and the failure case is the one where the
109
- observer is gone. A liveness record answers *is it still running* **to whoever
110
- arrives next**, which is a question a dead session's successor can still ask.
111
-
112
- **The record's producer is the launcher, and the alternative is recorded as
113
- refused rather than merely not chosen.** The alternative is per-producer
114
- self-claiming — the producer-liveness lock's shape generalized so every
115
- long-running producer claims its own record — and it fails on three counts. It
116
- reaches only producers the consumer's own tree owns, where most backgrounded work
117
- is an ad-hoc command composed at the call site. It puts the record's production in
118
- the one process whose death is the event being detected, so a producer that dies
119
- before claiming is invisible in exactly the window that matters. And it bills a
120
- program for a property that belongs to the *launch* rather than to the program:
121
- the same script backgrounded is in this class and run in the foreground is not.
122
- The launcher, by contrast, knows the PID of anything it started, is the party that
123
- needs to read it back, and is the only one present at the moment the class is
124
- entered.
125
-
126
- **The liveness clause widened rather than acquiring an exception, and its own
127
- premise is what falsified it.** The clause sanctioned a recorded-PID match *where
128
- liveness genuinely is the condition — a producer this session did not start*, and
129
- that exclusion rested on an assumption: a session that started the producer was
130
- taken to have a better instrument, namely its own artifact. The better instrument
131
- requires a live reader, and the failure being fixed is the loss of the reader. So
132
- the subject widens to cover a producer the session started **and backgrounded**,
133
- and the widening is on the subject alone, never on the predicate — pattern-matched
134
- liveness stays refused, and the bracket trick stays refused as the sanctioned
135
- form on the grounds below.
136
-
137
- **The record's grammar is evidence-kit's, and that is what makes the second reader
138
- free.** There are two readers, and they are different parties at different
139
- transitions: the **launching session**, in-turn, as its wait condition; and
140
- **whoever arrives next**, which is the case the attested failure is actually
141
- about, where the launcher is gone and something else must be able to tell that a
142
- producer is still mutating shared files. Written in the one-line `pid=<n>
143
- run=<key>` grammar the producer-liveness lock already carries, the record is a
144
- legal subject for `check-producer-liveness` **unchanged** — that gate already
145
- takes a record path and already reports exactly *is the producer named here still
146
- running*, on a ruled exit contract. No new gate, no new tool, no new grammar, and
147
- a reader already specified, already fixture-covered and already wired. An inverted
148
- grammar would have bought a second implementation of a decided thing, which is the
149
- only argument this needs; it is recorded because *a launch record is not a lock,
150
- so it should have its own shape* is the reading a later session will reach for,
151
- and the answer is that the two records carry the same field, answer the same
152
- question, and differ only in who wrote them. How a PID's liveness is *decided*
153
- stays evidence-kit's — the predicate, the PID-reuse residual and the refused TTL
154
- are ruled in evidence-kit/SPEC.md §The producer-liveness lock and are not
155
- seconded here. delegation-kit owns *when a session waits and on what*.
156
-
157
- **The record's name is a convention, and what the convention buys is a derivable
158
- set.** It is written as `<scratch-dir>/<key>.run`, carrying the same `pid=<n>
159
- run=<key>` line — the filename's `<key>` is that record's own `run=` value, not
160
- a third field. The grammar is untouched; what was missing is not the record's
161
- shape but its **discoverability**. Without a convention the record's path is
162
- known only to the session that wrote it and to whoever it happens to tell, so
163
- the second reader named above — *whoever arrives next*, where the launcher is
164
- gone — can read a record only by guessing its name. A suffix makes the set a
165
- glob, and every reader that must ask *is anything still running here* reads the
166
- set rather than a path: `check-producer-liveness`'s set mode
167
- (evidence-kit/SPEC.md §check-producer-liveness), the stage-entry preflight
168
- behind it, and guard-kit rule 14.
169
-
170
- **`.run` rather than `.lock`, and the distinction is load-bearing.** A lock is
171
- claimed and released by one owner and its absence means *free*;
172
- `EVIDENCE_KIT_LOCK_FILE` is one and keeps its name. A launch record is a
173
- **statement of fact left behind** — it answers *is it still running* to whoever
174
- arrives next, a question a dead session's successor can still ask — and its
175
- absence means *nothing was recorded*, never *nothing is running*. Two meanings,
176
- two suffixes; and a consumer's scratch reset carries no `*.run` on its keep-list,
177
- because a record surviving a work-unit boundary names a producer from the
178
- previous one, which is precisely the stale statement the sweep exists to remove.
179
-
180
- **Both affordances are refused, and the refusal's cost is bounded rather than
181
- denied.** A tool to write the record and a second one to read it are declined: the
182
- write is a PID captured at launch and the read is a single liveness match, each a
183
- shell builtin away and both already spelled in the template, and a script whose
184
- body is one builtin is the clearest case of the script-interpreter surface this
185
- methodology shrinks. The generic reading affordance that would genuinely earn its
186
- place already exists and is `check-producer-liveness`, which the grammar reuse
187
- reaches without adding anything. What the refusal costs is stated rather than
188
- hidden: an affordance would make the record's grammar impossible to get wrong, and
189
- a hand-written one can be malformed. That failure is bounded by the consumer,
190
- which exits **2** on a record it cannot parse, so a malformed record reads as
191
- *could not be established* and never as *nothing running*.
192
-
193
- **What the naming does not claim.** No gate enforces it, and the reason is
194
- structural rather than budgetary: the subject is *did a session record a PID
195
- before backgrounding*, and a session that skips the rule writes nothing, so there
196
- is no absence a check could have been told to expect. The artifact-side backstop
197
- stays the one §Operative residency already names — `check-producer-liveness` at a
198
- stage entry, covering the **concurrent** case, a producer still live when the next
199
- entry is stamped. Widening what that backstop may be pointed at does not make the
200
- rule itself checkable. What the naming removes is a different failure: a session
201
- that **wanted** to comply had no named artifact and was carved out of the only
202
- clause that fit.
203
-
204
- **The enforcement-design question is now answered, and the answer is a
205
- relocation rather than a reversal.** *Given that prose alone does not hold, what
206
- does* stood open here while the ruling above — the write is structurally
207
- uncheckable — stayed true. It still is. What changed is the subject: the
208
- **harm** a missed wait causes is not the turn-end but a tracked-tree mutation
209
- under a live producer, and that arrives as an ordinary tool call at a
210
- `PreToolUse` chokepoint, which is precisely the class §Operative residency says
211
- the interception axis admits. It is enforced there, as guard-kit rule 14
212
- (guard-kit/SPEC.md §The generic ruleset). The chokepoint ruling is confirmed by
213
- this, not weakened.
214
-
215
- **The claim ships with its bound, because a claim without one is the failure
216
- this rule keeps re-earning.** The enforcement holds only for **a session that
217
- recorded**. The paragraph above rules that the record's write is structurally
218
- uncheckable — a session that skips the rule writes nothing, so there is no
219
- absence a check could have been told to expect — so a session that backgrounds
220
- without recording is invisible to rule 14 and to the entry preflight alike,
221
- exactly as it is today. This narrows the failure to that residue rather than
222
- closing it.
223
-
224
- **Enforcing the record's *write* at the launch chokepoint is designed, refused,
225
- and filed** — recorded here so a later session finds a ruling rather than a
226
- blank. The candidate is a rule firing on the backgrounding call itself and
227
- refusing one that writes no record, and the two backgrounding forms differ in a
228
- guard's reach. A shell `&` is in the command text, which every rule in that
229
- ruleset already reads, so that arm is buildable today. A harness's
230
- background-this parameter is **tool input, not command text**, and whether it
231
- reaches the `PreToolUse` payload is an empirical question about one field rather
232
- than about the mechanism — a guard that reads non-headline `tool_input` fields
233
- by `jq` path is already an attested shape. **Building only the `&` arm is
234
- refused as worse than not building it**: every attested firing used the harness
235
- form, so a rule covering only the shell spelling would block the form nobody
236
- uses and pass the one that fires — coverage in appearance, an assertion about
237
- nothing in fact. The probe it waits on is one backgrounded call through a guard
238
- that records its payload, and that probe needs **no** permission- or hook-surface
239
- change, because the `PreToolUse` command matcher is already wired.
240
-
241
- **The guard interaction that produced it resolves without touching the guard.**
242
- The attested sequence: a session reached for the correct artifact wait, spelled
243
- it against the harness's own scratchpad path, and the consumer's bash guard
244
- refused it and steered to repo-local scratch. The guard was **right** and needed
245
- no change. What was missing is that the doctrine never said where an awaited
246
- artifact belongs, so the refusal read as a refusal of artifact-waiting itself and
247
- pushed the session onto the process-liveness form that then broke. With the split
248
- above, a session waiting on an `Agent` never reaches for a path at all, and a
249
- session waiting on a shell child has a path the guard already sanctions.
250
-
251
- **The bracket trick is refused as the sanctioned form, and the grounds are here
252
- because the template defers them here.** The template carries the mechanism —
253
- why a process-liveness predicate can never go false, and the two sanctioned
254
- repairs — and sends here the one question it does not answer: why the third,
255
- `pgrep -f '[r]un-smoke.sh'`, is refused rather than passed over. It is the first
256
- thing a reader reaches for and it *works*, so what disqualifies it is not correctness
257
- but its failure mode: a spelling that must be remembered, whose omission is
258
- invisible at the call site and whose cost when omitted is silent and expensive.
259
- A rule whose correct form differs from its incorrect form by one character is a
260
- rule that will be got wrong, which is why the enforcement half is a guard rule
261
- over the shape (guard-kit/SPEC.md §The generic ruleset) rather than more prose.
262
-
263
- The template's **Findings you will act on are durable before you act on them**
264
- rule rests on a near-loss rather than a loss: a close stage dispatched two
265
- audit sweeps and then hit the session wall. Both had already returned, which
266
- was luck; had the wall landed mid-sweep the audit work would have been gone
267
- with no record it ran. The gap is that the journal mechanics are written for a
268
- dispatched *mutating* agent, so a read-only child journals nothing and its
269
- findings exist only as a return value in the parent's context. The fix
270
- deliberately does **not** overturn the read-only-fan-out caveat in §Resume
271
- journal — that caveat was re-examined against this evidence and kept, with its
272
- duty relocated to the receiving end, because overturning it would put the write
273
- back exactly where the observed failures are. Recorded here because the rule
274
- and the caveat otherwise read as each other's contradiction and the next
275
- reader re-litigates them.
276
-
277
- `templates/agent-budget-guard.sh` closes the gap the template's
278
- **Budget-check before *each* dispatch in a fan-out** rule leaves when it relies
279
- on the agent *choosing* to run the tool: a memory-quoted percentage acts in its
280
- place (a session quoted ~5% while the live verdict read 29%). It is a `PreToolUse` hook (matcher `Agent`) the
281
- harness fires on every dispatch once the consumer registers it in settings —
282
- per-dispatch freshness, not a start-of-session reading a mid-session window
283
- outlives. It runs `usage-verdict` at the decision point and routes on the exit
284
- code:
285
-
286
- - **PAUSE (1)** → `guard_block`: the verdict line plus its corrective (wait for
287
- the window reset, or re-run with `DELEGATION_KIT_PAUSE_PCT` deliberately
288
- raised). This is guard-kit's one sanctioned fail-closed deny — the hook
289
- matcher proves the tool identity and PAUSE is reachable only through a fresh,
290
- readable, over-threshold snapshot, so blocking cannot wedge a consumer with
291
- no producer.
292
- - **STALE / unreadable (2)** and **OK / RESET-OK (0)** → `guard_advise`,
293
- feeding the verdict line back as `additionalContext` so the live reading
294
- rides in context at every dispatch and a memory-quoted percentage can never
295
- be the acting source. The advise arm relays that line and adds nothing: the
296
- verdict string carries its own decision consequence (§usage-verdict), so
297
- restating it on the arm would be one fact in two places. Routing STALE to
298
- advice rather than out of delegation is what keeps a consumer with no
299
- snapshot producer working — budget-unknown is decision-relevant, never
300
- disqualifying.
301
-
302
- The harness is the producer (it fires the hook once the settings registration
303
- is set); the consumers are the dispatching agent, which reads the verdict line
304
- off `additionalContext` at the dispatch-decision transition, and the
305
- supervising user, who consumes a block by ruling — raise the knob or wait; the
306
- agent never overrides. delegation-kit owns the verdict, its thresholds, and the
307
- routing; guard-kit supplies only the framework primitives (its second
308
- consumer). Registration is the opt-in valve: a consumer wanting pure advice
309
- does not wire the hook. No new persistent state and no new key on the
310
- `usage.txt` contract — the verdict line is the only interface.
311
-
312
- **Covered at every depth, aggregated at none.** The hook's registration is
313
- session-wide, so it fires inside dispatched sessions too: a dispatched
314
- session's own dispatches re-arm it, carrying that session's identity, and the
315
- coverage reaches every depth rather than stopping at the root. What it cannot
316
- do is **aggregate** — each fire is independent and holds no state about the
317
- tree, so a verdict prices the one call it gates and never the subtree that call
318
- opens. That pairing is what the subtree clause of the template's
319
- **Budget-check before *each* dispatch in a fan-out** rule exists to compensate,
320
- and stating both halves here is what stops the next reader re-filing either.
321
- Calibration history, because the silence invited the wrong turn: the hook
322
- script is stateless and carries no depth counter, and a scope survey read that
323
- as *the guard does not reach below the root* and filed against it. The reading
324
- of the script was exact; the inference from it was false. A guard whose output
325
- is only ever seen by the session it fires in looks absent from every other
326
- vantage point — so a supervisor counting its own hook fires is watching a
327
- strict undercount of its own tree, which is the observation the residual
328
- projection gap is stated against rather than a coverage gap to be re-armed.
329
-
330
- A knob-raise ruling has one working transport in this harness: the settings
331
- env block (`.claude/settings.local.json`), which hooks re-read per fire — the
332
- raised `DELEGATION_KIT_PAUSE_PCT` reaches the guard on the next dispatch with
333
- no restart, and deleting the entry afterwards restores the default just as
334
- immediately. A Bash-tool inline `export` never reaches the hook (the hook
335
- process does not inherit the tool's shell), so it is not an override path.
336
- Propagation is asymmetric within a live session: the hook re-reads the file
337
- per fire, but the Bash tool environment retains an injected value after the
338
- entry is deleted until the session restarts — an in-session `usage-verdict`
339
- run and a hook fire can judge against different thresholds in that window, so
340
- the hook's verdict line, not an in-session re-run, is the acting reading. That
341
- this transport *works* is not a permission to use it for everything a harness
342
- env var reaches: the subagent-model override below rides the same block and is
343
- refused there, so the two must not read as one sanction.
344
-
345
- **The subagent-model environment override is refused, and the reason is
346
- precedence.** Model resolution runs in a fixed order — the subagent-model
347
- environment override, then a dispatch's own `model` parameter, then the agent
348
- definition's `model:` frontmatter, then the dispatching conversation's model —
349
- and the environment rung sits *above* the per-dispatch parameter. Setting it
350
- would pin every subagent to a cheap tier in one line, and would thereby
351
- silently defeat a supervisor's deliberate per-batch tier pin, the mechanism
352
- `lifecycle-kit/templates/lead.md` §Economics — batch, and compact where it pays
353
- depends on to tier a batch by its work classes. A lever that overrides the
354
- deliberate choice is not a default; it is a ceiling, so it is recorded as
355
- rejected rather than left to be rediscovered as an improvement. The correct
356
- rung is the **frontmatter**, third in the chain: it supplies the standing
357
- default the template's **Match the dispatched model and effort to the unit's
358
- shape** rule asks for while the per-dispatch parameter still overrides it. The
359
- same rule's affirmative-selection clause is why the field is *stated* rather
360
- than left out — an omitted `model:` resolves to the literal `inherit`, so
361
- omission spells the dispatcher's tier rather than a neutral absence, and
362
- `check-agent-tier-explicit` is that clause's oracle over the tracked surface.
363
-
364
- **Isolation's second purpose, and why the cost objection does not land.** The
365
- template's **A read-only claim is made by isolation, not by sentence** rule
366
- states the disposition and carries none of its grounds, which are these. "It has
367
- no Edit tool" is not the safety property it reads as: every agent type available
368
- for audit-shaped work carries write tools, or at least a shell that reaches
369
- `git`, so a toolset is never narrowed by the brief describing it. And the
370
- isolation is not purely a cost — the harness auto-cleans a worktree left
371
- unchanged, so the worktree survives **iff** the agent was not in fact read-only,
372
- which makes one mechanism both the confinement and its own detector. Gitignoring
373
- the worktree path trades that free `git status` signal away, which is why the
374
- rule's second cost sends the parent to an explicit `git worktree list` at the
375
- reaping boundary instead.
376
-
377
- **`worktree.baseRef` is vendor configuration, and choosing it is the consumer's
378
- job.** The template's **Isolation charges three harness costs, and paying them
379
- is the parent's job** rule names the knob and both of its values rather than a
380
- choice, because a vendoring consumer inherits the template and never a settings
381
- file. A consumer that dispatches isolated agents therefore sets the knob
382
- deliberately instead of inheriting the default, and — where its harness config is
383
- gated — pins it, through the general settings-pin mechanism (context-kit/SPEC.md
384
- §check-settings-pins) rather than anything this kit ships. What is ruled is that
385
- the value be *chosen*, never which value: a consumer wanting a clean tree per
386
- dispatch is right to stay on the default. No knob joins delegation-kit's own
387
- roster for it (§Layout and configuration) — this is harness configuration, not
388
- kit configuration, and a kit knob shadowing a vendor setting would be a second
389
- source for one value. Recorded so a later reader does not read the omission as an
390
- oversight and close it.
391
-
392
- **Why that cost names a knob and not a measurement.** "The worktree is cut at
393
- the remote tracking ref, so staleness equals the unpushed backlog" describes the
394
- `fresh` value alone; stated as universal it is false, and it reached shipped,
395
- consumer-facing doctrine on seven attestations — every one taken under that
396
- default, not one of them bearing on whether the behavior was configurable.
397
- Repeated confirmation of a behavior is not evidence about its mutability, and
398
- each re-confirmation made the mechanism feel more settled and so suppressed the
399
- configuration probe that would have settled it. Hence the rule's shape: name the
400
- knob and both values, and leave any measurement attributed to the configuration
401
- it was taken under. It follows that no parent "owes the doubt back" for a
402
- structural defect here — there is none, and the discipline below costs one line
403
- in a prompt.
404
-
405
- **The child-side rev discipline is kept as defence in depth, and the first
406
- ground alone is sufficient.** The parent cannot read the child's *effective*
407
- setting — `baseRef` resolves on the dispatching machine's merged settings,
408
- nothing in the dispatch payload carries it and nothing returns it — so a parent
409
- assuming either value is asserting an unverified premise about a third-party
410
- tool, which is the move that produced the false doctrine above. Second, a
411
- vendoring consumer inherits the template and not a settings file, so for every
412
- consumer that has not set the knob the discipline is the whole protection. Third,
413
- even a repo that pins the knob is not covered end to end: a managed tier and a
414
- command-line override outrank a project settings file and lie outside any repo's
415
- reach. It is also nearly free and self-verifying — one command whose output *is*
416
- the evidence — so under a holding pin it degrades from load-bearing to a cheap
417
- assertion rather than becoming dead weight.
418
-
419
- **The untracked half reaches no configuration at all, and its disposition is
420
- refusal.** An isolated child sees only committed state, so the third cost is a
421
- ruling rather than a mitigation: no value of the knob helps and naming a rev does
422
- not either. Attested twice — a sweep sent to triage an untracked capture log read
423
- an empty file and reported its corpus absent, and a settings-overlay comparison
424
- saw no overlay because the local settings file is uncommitted. Both returned a
425
- confident "nothing there", indistinguishable in shape from a clean result, which
426
- makes it the worse of the two failure modes. It binds *against* the read-only
427
- rule rather than beside it: a read-only claim is made by isolation, and isolation
428
- is what blinds the read, so a claimed-read-only sweep over an untracked corpus
429
- has no correct form at all.
430
-
431
- **The dispatch-shape rules are one mechanism, seen from several sides.** The template's **Never dispatch
432
- a fork to narrow a child**, **A read-only claim is made by isolation, not by
433
- sentence**, and **A child's only upward route is a durable artifact** rules are
434
- one defect seen from three sides: each governs the *shape of a dispatch call*,
435
- and each failed the same way — the prose did not reach the reader it binds.
436
- One attested surface per rule: a fork dispatched as a read-only audit completed
437
- a whole stage, commits included; four forks dispatched with prose-only
438
- "read-only, no edits" briefs, one of which committed unreviewed on the shared
439
- branch; and repeated fan-outs, across stages and across iterations, messaged the top-level
440
- session instead of their dispatcher, which no prompt wording could have fixed.
441
-
442
- **Why an oracle is owed here and not for the turn-ending rule.** §Operative
443
- residency closes on the finding that a restated rule is reachable, not obeyed,
444
- and owes no gate because no check can read a session's choice to end a turn —
445
- the act leaves no tracked artifact. A dispatch leaves no tracked artifact
446
- either, so the distinguishing axis is not durability but interception:
447
-
448
- > Where a rule binds an act that leaves no tracked artifact, the enforcement
449
- > question is whether the act passes a **chokepoint** — not whether it reaches
450
- > the tree. A dispatch does. A turn-end does not.
451
-
452
- **The chokepoint — what a `PreToolUse` hook can actually read.** The payload
453
- carries `session_id`, `prompt_id`, `transcript_path`, `cwd`, `permission_mode`,
454
- `hook_event_name`, `tool_name`, `tool_input`, and `tool_use_id`; and, **only
455
- when the hook fires inside a subagent**, `agent_id` and `agent_type`. For the
456
- dispatch tool, `tool_input` carries the dispatch's own parameters —
457
- `subagent_type`, `isolation`, `model`, `description`, `prompt`. Three
458
- consequences carry the guard below: the fork ban has an exact trigger
459
- (`tool_input.subagent_type`), the read-only claim has an exact trigger
460
- (`tool_input.isolation`), and depth has an exact, *documented* discriminator —
461
- `agent_id` is present iff the dispatching session is itself a subagent, so its
462
- presence means the call about to be made creates a grandchild.
463
-
464
- **Honest limit on that roster.** It is sourced from the harness's own published
465
- hook contract, fetched rather than recalled, and from nothing in this tree —
466
- the same footing as `CLAUDE_CODE_CHILD_SESSION`'s "verified, not trusted"
467
- treatment (lifecycle-kit/SPEC.md §bin/session-id.sh). A future harness revision
468
- reshaping the payload is drift this SPEC cannot self-detect; only re-reading the
469
- hook contract catches it.
470
-
471
- **Two depth routes ruled out**, both being the obvious move.
472
- `CLAUDE_CODE_CHILD_SESSION` is set in top-level sessions too, and
473
- `CLAUDE_CODE_SESSION_ID` carries the *root* id for a child, so a depth-1 and a
474
- depth-2 dispatcher are indistinguishable by environment alone — that route
475
- ships a rule silently mis-firing at the top level. The meta record beside a
476
- transcript does carry an exact spawn depth, and that route works and is
477
- deliberately not taken: it couples a hook to an *uncontracted* harness artifact
478
- to answer a question one *contracted* boolean already answers. The
479
- stage-economics meter accepts that same coupling (drift-kit/SPEC.md §The
480
- stage-economics meter, the fan-out row) because it needs the whole spawn forest
481
- and no contracted field supplies it; a hook needs one bit and gets it under
482
- contract. The axis is what the contract supplies, not appetite for risk.
483
-
484
- `templates/agent-dispatch-guard.sh` is that oracle — a second `PreToolUse` hook
485
- on matcher `Agent`, beside the budget guard, composed from
486
- `guard-kit/lib/guard.sh` primitives. It reads the payload once and runs the
487
- rules below, in order:
488
-
489
- | # | rule | trigger | decision |
490
- | --- | --- | --- | --- |
491
- | D1 | fork ban | `tool_input.subagent_type` is `fork` | block |
492
- | D2 | isolation claim | `tool_input.subagent_type` ∈ `DELEGATION_KIT_READONLY_TYPES` and `tool_input.isolation` is not `worktree` | block |
493
- | D3 | depth advisory | payload carries `agent_id` | advise |
494
-
495
- Order is load-bearing only between D1/D2 and D3 — a blocked dispatch needs no
496
- advisory, so D3 runs last. D1 precedes D2 because the fork ban is unconditional
497
- and its message is the more specific one for a dispatch violating both.
498
-
499
- **Why a second guard rather than more rules in the budget guard.** Four
500
- reasons, each independently sufficient: the budget guard blocks on a
501
- **transient** condition and is deliberately knob-overridable, while these block
502
- on a **permanent** doctrine violation that must not be per-dispatch
503
- overridable; the budget guard reads no stdin at all; a consumer may want either
504
- enforcement without the other, and hook registration is the only opt-in valve
505
- there is; and their test lanes take different payload grammars. The harness
506
- fires every hook registered on a matcher and any exit 2 blocks, so the two
507
- compose with no dispatcher between them.
508
-
509
- **D1 blocks unconditionally**, which the template's own boundary does not — a
510
- fork stays correct where the child does the same job at the same authority, and
511
- a hook cannot read intent. The block is ruled unconditional on the ground that
512
- no sanctioned fork use exists in this doctrine, and the valve is **unwiring the
513
- hook**, never a knob: a per-dispatch override is exactly the honour system
514
- these rules exist to end, and a knob would restore it under a better
515
- name. The block message names the two lawful alternatives, as guard-kit
516
- requires of every block message.
517
-
518
- **D2 is inert until configured**, by construction — the default roster is empty
519
- and the kit ships no agent-type names. An inert D2 reports nothing; it is a
520
- hook, not a gate, so there is no clean line to print. Stated here so a consumer
521
- does not infer coverage it has not configured.
522
-
523
- **D3 advises rather than blocks**, and both halves are deliberate. It cannot
524
- block: a nested dispatch is legitimate and common — a stage session's own
525
- read-only fan-out *is* a grandchild dispatch — so blocking would remove a
526
- capability rather than confine one. It must not be silent: this is the one rule
527
- whose bound reader provably never loads the protocol template (§One template, a
528
- resident pointer), so the advisory is the *only* delivery of it, which is
529
- §Operative residency's (a)–(c) shape applied at a hook instead of a doc. Ruled
530
- out for D3: keying on whether the prompt text "names a path" — that fires on
531
- the word and teaches dispatchers to game the wording, buying a green hook and
532
- no channel. The `agent_id` trigger is exact and unforgeable; the message
533
- carries the judgment the trigger cannot.
534
-
535
- **Degradation — fail-open, but loud**, the posture guard-kit/SPEC.md §The guard
536
- framework names for a deny-guard whose matcher proves the tool but whose rule
537
- turns on a payload field:
538
-
539
- | what is missing | behavior |
540
- | --- | --- |
541
- | `jq` absent | allow; one advisory naming the unenforced rules |
542
- | payload unparseable, or `tool_input` absent | allow; same advisory |
543
- | `subagent_type` absent from a parseable payload | D1 and D2 do not fire (nothing to match); D3 unaffected |
544
- | `DELEGATION_KIT_READONLY_TYPES` unset or empty | D2 inert, and silently so; D1 and D3 unaffected |
545
- | `DELEGATION_KIT_CONFIG_FILE` set but naming no file | allow; advisory naming D2 unenforced |
546
- | `guard-kit/lib/guard.sh` not vendored | the guard exits 0 before sourcing, as both shipped guards already do |
547
-
548
- Two implementation facts those rows force, recorded because the obvious build
549
- gets each of them wrong:
550
-
551
- - **The `jq`-absent arm cannot deliver through `guard_advise`.** That primitive
552
- is itself jq-backed, and measuring it rather than assuming settles what
553
- happens: with `jq` off `PATH` it writes an empty stdout and leaves a shell
554
- "command not found" on stderr, which names none of the unenforced rules — the
555
- silent success these rules exist to end, arriving inside the mechanism meant
556
- to prevent it. The guard therefore emits the advisory envelope itself on that
557
- arm, and every advisory literal it carries is kept free of the characters
558
- JSON must escape, since that fallback carries no escaper.
559
- - **The guard does not source delegation-kit's validating config loader**, only
560
- the consumer config file, for the one array it reads. The loader exits 2 on
561
- any malformed knob and a hook that exits 2 blocks, so routing the fork ban
562
- through a validator for `DELEGATION_KIT_FAN_WIDTH` would let an unrelated
563
- typo wedge every dispatch in the consumer whose primary token lever is
564
- delegation — the fail-closed posture this guard is specified against,
565
- arriving through the config door. The distinction the last two table rows
566
- draw is this kit's standing one: a roster **configured to nothing** is
567
- silent, a roster that **could not be read** is loud.
568
-
569
- ### One template, a resident pointer
570
-
571
- `templates/agent-execution.md` is the single source for the protocol — a
572
- binding-shim *template* in lifecycle-kit's grammar (lifecycle-kit/SPEC.md
573
- §check-skill-binding). The consumer creates `.claude/commands/agent-execution.md`
574
- as a shim that names the template and binds its two slots — the shared-file
575
- roster and the validate battery — the consumer-specialization discipline of
576
- guard-kit's consumer-rules block, now carried by the slot/binding mechanism the
577
- lifecycle skills already use. `check-skill-binding` enforces the slot pairing on
578
- the consumer side.
579
-
580
- A spec reference to one of those rules uses the citation grammar
581
- `the template's **<name>** rule`, where `<name>` is a bullet's bold lead-in
582
- verbatim minus its trailing period; `check-rule-citation` resolves every such
583
- citation in §The delegation model forward into the template, so a lead-in
584
- rename cannot silently dangle a reference.
585
-
586
- `templates/dispatch-checklists.md` is a second, load-triggered template the
587
- protocol template reaches by a single pointer line: `agent-execution.md` names
588
- it for a deletion, rename, or heavy cross-spec audit dispatch, and it loads only
589
- then — never resident, and not a binding shim (it binds no slots, so
590
- `check-skill-binding` does not scan it). It carries the mechanical pre-flight for
591
- those dispatch shapes — the importer/collision/sweep-verification checks — while
592
- the protocol proper stays whole in `agent-execution.md`; the pointer-line
593
- contract is that the protocol template stays complete alone and the checklists
594
- are a reach-through, so the width, journal, and validate rules live once in the
595
- protocol template and are cited from the checklists, never restated. This is the
596
- load-trigger-residency rule applied a rung deeper: even inside a load-triggered
597
- template, a subset that only a narrower trigger (a deletion or rename dispatch)
598
- needs sits behind its own pointer.
599
-
600
- The consumer's CLAUDE.md carries no digest of the bullets, only a resident
601
- pointer: the pre-authorization sentence (consumer judgment on what delegation
602
- needs no ask) and `/agent-execution`. Rationale: a rule is resident only when it
603
- has no load trigger (the load-trigger-residency doctrine), and every protocol
604
- bullet triggers at `Agent` dispatch **for the role that dispatches** — which
605
- already has a mechanical seam, the
606
- per-dispatch budget guard, whose block message names `/agent-execution`. The
607
- doctrine lives behind the trigger, not in the always-loaded file. Honest limit,
608
- tightened now that a second hook rides the same matcher: the guards enforce
609
- mechanically exactly the rules that pass a chokepoint — the budget check, and
610
- the dispatch-shape rules (§The delegation model) — and protocol literacy
611
- beyond those stays unenforced. A session that dispatches without invoking the
612
- skill still carries only the resident pointer for everything else.
613
-
614
- **That role qualifier is load-bearing rather than hedging.** Stated without it,
615
- the rationale is role-blind: a *dispatched* role fires no such trigger — it is
616
- not dispatching at all, it is executing a stage, and no stage skill or stage
617
- template loads this protocol — so for that reader the pointer posture leaves the
618
- rule unreached, which is how a posture nobody disputes produced three incidents.
619
- §Operative residency governs that case, and the bounded imperative it sanctions
620
- in a consumer's always-loaded agent definition is this same doctrine applied at a
621
- different reader, not an exception carved out of this paragraph.
622
-
623
- ### Operative residency
624
-
625
- A rule may be **restated as an imperative in a surface that does not own it**
626
- when all three of these hold:
627
-
628
- - **(a) Unreachable trigger.** The actor the rule binds never fires a trigger
629
- that loads the rule's owning doc. This is a property of the *reader*, settled
630
- by asking which triggers that reader actually fires.
631
- - **(b) Imperative only.** What is restated is the instruction. The reasoning,
632
- the failure analysis, and the mechanism stay with the owner.
633
- - **(c) Adjacent citation.** The restatement names the owning surface beside
634
- itself, so the owner stays the single place the rule is explained and changed.
635
-
636
- Each condition has a reader at a transition rather than being self-evident: (a)
637
- and (b) are read by whoever authors a restatement, at authoring, and again by a
638
- reviewer or an authoring stage assessing an existing one; (c) is the pointer any
639
- later reader — and any content-tiering check — follows back to the owner. The
640
- reader the sanction exists for is the third and never inspects a condition at
641
- all: the bound actor, which receives the imperative at the tier it always loads,
642
- which is the whole point.
643
-
644
- **The anti-licence clause is part of the rule, not commentary.** The sanction is
645
- keyed on (a): a rule that the bound actor's own skill or template already loads
646
- fails (a) and stays a pointer. Without that clause this reads as "duplicate when
647
- it feels important", which is the failure content-tiering exists to prevent and
648
- would cost more than the gap it closes.
649
-
650
- **This is load-trigger residency's own logic, not an exception to it.** That
651
- doctrine earns a rule a place in an always-loaded file only when no stage, skill,
652
- or tool-call trigger exists to load it, and the decisive question is *exists for
653
- whom*. A trigger that exists but that the bound actor never fires is, for that
654
- actor, no trigger. The doctrine's stated justification — a rule a stage or a tool
655
- call would load anyway costs nothing to defer and everything to keep resident —
656
- does not merely fail for such an actor, it inverts: nothing loads it anyway, so
657
- deferring costs everything.
658
-
659
- **Content-tiering is satisfied by bounding what is copied, which is what (b) is
660
- for.** The restatement is still a restatement, which is why it needs this
661
- sanction rather than an argument; but its drift surface is one instruction rather
662
- than a slab, and the place the rule is explained and changed stays single.
663
-
664
- The attested subjects are the template's **Background + notification, never
665
- poll** rule and its **Findings you will act on are durable before you act on
666
- them** rule, both of which bind a dispatched session. Three such sessions read a
667
- *descriptive* pointer to them at the always-loaded tier and derived no constraint
668
- from it. The derivations were easy, which is what makes the failure instructive:
669
- under load a descriptive sentence reads as background about one's situation
670
- rather than as a constraint on the next action. The defect this rule names is
671
- therefore pointer-versus-operative-statement, never absence.
672
-
673
- **Operative is not obeyed, and a fourth firing is the attestation.** A dispatched
674
- session ended its turn on work still running while the waiting rule sat in that
675
- session's own agent definition as a bare imperative, restated under (a)–(c) —
676
- the compliant form this sanction licenses. So the diagnosis above names a cause
677
- *removed*, not the defect *closed*: residency makes a rule reachable at the point
678
- of use, and reachable is not obeyed. Every restatement this sanction licenses is
679
- a request delivered where it is read. Weigh it as one — worth its small drift
680
- surface for the failure mode it does remove, and never a substitute for an
681
- oracle where one is buildable. In the attested instance what caught the
682
- consequence was the artifact-side oracle below, with the prose already in its
683
- strengthened form.
684
-
685
- **The propagate obligation has fired, and the record names what it cost.** The
686
- waiting rule changed — the primitive named by its reactivity property, the
687
- awaited artifact given a home — and the template's *when either rule changes
688
- here, propagate* header sent that change to both of its restatements in this
689
- consumer's `.claude/agents/` definitions: one a stage-session type, one a
690
- read-only sweep type. They did not carry the rule alike. One cited the bullet by
691
- name and restated its wait mechanics at length; the other carried a single
692
- turn-end line with no citation, no primitive and no home. **The target is
693
- symmetric even where the starting text is not**, so propagation into the second
694
- was a genuine addition sized to that file's own voice rather than a paste of the
695
- first's paragraph — and neither absorbed the rejected-alternative reasoning,
696
- which is (b)'s line and stays with this section's owner. Recorded because the
697
- sanction's cost is exactly this: every rule it licenses acquires N carriers that
698
- a later change must find, and a restatement that drifted *unevenly* is harder to
699
- spot than one that drifted at all.
700
-
701
- **The obligation fired again, and the second firing found a carrier the roster
702
- did not hold.** The waiting rule changed once more — the shell-child branch named
703
- its artifact, and the liveness clause widened past *a producer this session did
704
- not start* — and propagation reached both `.claude/agents/` definitions as before.
705
- It also reached a **third** carrier sitting outside this section's roster
706
- entirely: guard-kit's self-matching-`pgrep` rule states the same clause verbatim
707
- in the corrective help text it prints when it blocks, mirrored in prose in that
708
- kit's own SPEC. Left alone, a guard-blocked session would read advice that
709
- undersells what it may now do with its own backgrounded child — a restatement
710
- whose reader arrives at the worst possible moment, already stopped and looking for
711
- the sanctioned form. Recorded because of what found it: the clause's own wording,
712
- grepped across the tree, and not this section's list of known carriers. The
713
- sanction's cost is N carriers a later change must find, and N is discovered by
714
- grepping the rule's phrasing rather than by consulting the roster — a roster is a
715
- record of the carriers someone noticed, never a proof of the set.
716
-
717
- **No gate is owed *over the act*, and not for budget — but one is now owed over
718
- its harm, and it exists.** No check can read a session's choice to end a turn:
719
- the act leaves no tracked artifact and passes no chokepoint, and that ruling
720
- stands unamended. What the ruling never licensed was stopping there. The harm
721
- the turn-end causes does pass a chokepoint — a tracked-tree mutation while a
722
- recorded producer is still writing arrives as an ordinary tool call — and it is
723
- blocked there by guard-kit rule 14 (guard-kit/SPEC.md §The generic ruleset,
724
- whose design §The delegation model owns). So the enforcement question this
725
- section left open is answered **by relocating the subject from the act to its
726
- consequence**, and the honest bound travels with the answer: it reaches only a
727
- session that recorded, since the record's write is itself structurally
728
- uncheckable.
729
-
730
- **The anti-restatement gates were**
731
- checked against a sanctioned restatement rather than assumed inert, since a
732
- sanction that required weakening a gate would be the wrong sanction:
733
- `check-shim-restatement` scans binding shims under the skills directory against a
734
- corpus of the consumer's always-loaded file plus kit templates, so a consumer's
735
- agent definition is neither its scanned surface nor its corpus, and
736
- `check-surface-duplication`'s predicate is a glossary term's definition on a
737
- canonical SPEC surface, which reaches no agent definition either. The sanction
738
- therefore ships with **no gate exemption** — and the honest converse ships with
739
- it: nothing in the battery would catch a *non*-compliant restatement, so (a)–(c)
740
- are review-enforced. Both buildable oracles detect a *consequence* rather than
741
- the act, and they sit at different distances from it: guard-kit rule 14
742
- **prevents** the consequence at the tool call that would cause it, and
743
- `check-producer-liveness` **detects** a producer still running at the next
744
- stage's entry (evidence-kit/SPEC.md §check-producer-liveness). The second
745
- detects late by construction — the turns between the firing and that entry are
746
- already spent, and a firing at the last stage of an iteration has no entry after
747
- it — which is what makes it the backstop behind the first rather than a
748
- substitute for it.
749
-
750
- **A case where an oracle *was* buildable now sits beside this one, and the two
751
- are not each other's contradiction.** The dispatch-shape rules bind acts
752
- that leave no tracked artifact either, yet they are gated. The axis that
753
- separates them is **interception, not durability**: a dispatch passes a
754
- chokepoint the harness fires a hook on, and a turn-end passes none (§The
755
- delegation model, which owns the generalization). So "no tracked artifact" is
756
- why neither rule gets a *gate* over the tree, and it is not by itself a reason
757
- to stop looking for an oracle. Recorded here for the same reason §The
758
- delegation model records the durability rule beside the read-only-fan-out
759
- caveat: otherwise the next reader re-litigates one of the two paragraphs.
760
-
761
- **That last sentence was cashed rather than left standing.** The search it
762
- licensed found one: the turn-end is still unreachable, but the mutation it
763
- enables is a `PreToolUse` call, and rule 14 fires there. Recorded because a
764
- sentence saying *keep looking* is cheap to write and easy to leave un-acted, and
765
- the next reader should find the outcome beside the licence rather than have to
766
- reconstruct whether anyone ever looked.
767
-
768
- ## Resume journal — agent writes, scratch reset sweeps
769
-
770
- **The contract, in four clauses.** A mutating agent journals to a repo-local
771
- gitignored scratch directory in the main checkout; the supervisor grants that
772
- path **absolute** in the dispatch prompt; each finding lands inline as it is
773
- confirmed; a `DONE` marker is appended on success. The operative text — what
774
- each clause requires of an agent, and why a temporary worktree and a system
775
- temp dir both fail the survivability test — is
776
- `templates/agent-execution.md`'s **Resume journal — agent writes, scratch reset
777
- sweeps** bullet, which is the surface an agent loads. This section owns what
778
- that bullet cannot carry: the lifetime rule's reasoning, the attestation it was
779
- priced against, and the two readings the marker carries.
780
-
781
- **Lifetime — why retention rather than an eager deletion chore.** Cleanup is
782
- the consumer's own scratch reset at its next work-unit boundary, a mechanism
783
- the consumer already owns (here, `enter-stage.sh`'s boundary wipe of `.tmp/` at
784
- the next scope entry — lifecycle-kit/SPEC.md §bin/enter-stage.sh). Two things
785
- break when the supervisor deletes on its own schedule instead, and both appear
786
- only once a dispatched agent is **resumable** rather than one-shot: a resumed
787
- agent is still writing to the file, and a supervisor treating the journal as
788
- its **pull channel** (lifecycle-kit/templates/lead.md §Channel design)
789
- destroys at the first verified commit the channel it is supposed to keep
790
- reading. A one-shot sweep hides both, which is why an eager deletion chore
791
- read as correct for as long as it did.
792
-
793
- **Attested.** A supervisor deleted a resumable session's journal after
794
- validating that session's first commits; the session resumed minutes later,
795
- found the file gone mid-write, rebuilt it from context, and reported the
796
- disappearance as a suspected scratch-directory reliability defect. The lost
797
- working state was the cheaper half — the false defect signal, raised against
798
- the scratch dir and against an unrelated sibling unit, is what retention is
799
- priced against. The same supervisor then retained two later sessions'
800
- journals against the then-governed text; that deviation is what this section
801
- now states.
802
-
803
- **Reading `DONE` under retention.** Retention costs the *presence* of a
804
- journal its meaning: every journal now survives its session, so finding one
805
- signals nothing by itself. The marker still carries the completion claim, with
806
- one sharpening a resumable session forces — `DONE` is meaningful **only as the
807
- file's last line**, since a session resumed past its own marker appends after
808
- it, and a mid-file `DONE` claims a completion the later content contradicts.
809
- Whether a *missing* marker signals interruption still turns on whether the
810
- supervisor consumed the agent's return. On the ordinary completion path it
811
- did, and that return plus its post-commit verification (§Verify after every
812
- agent commit) *is* the recovery contract, so the marker is redundant there.
813
- Only in a **cold read** — a journal found with no return ever consumed, the
814
- agent's session having died before returning (a background sandbox died, a
815
- crash, a timeout) — is the marker the sole signal, and there the original
816
- reading holds: no `DONE` = interrupted, resume from it. A live journal is told
817
- from a spent one by per-session journal naming, the consumer's own work
818
- cursor, and `git log`, which together say more than presence ever did, and the
819
- boundary sweep bounds the ambiguity to the current work unit. The
820
- inline-findings rule above is that cold arm's insurance — with no surviving
821
- return, a pointer-only journal would make a would-be `DONE` lie about
822
- recoverability.
823
-
824
- **Caveat — the sandbox may block the journal write.** Background agents
825
- have been observed unable to `Write` to the granted path, silently falling
826
- back to returning findings in the final message — which defeats the journal
827
- exactly when it matters (a long, interruptible run). The template's
828
- read-only-fan-out carve-out and its grant-the-path-explicitly clause both
829
- follow from this observation. That contract has two ends. The caveat's
830
- evidence is about **the child's** write failing silently, and its true
831
- content is *do not make recoverability depend on a backgrounded child's
832
- write* — which is why it is kept rather than overturned by the template's
833
- **Findings you will act on are durable before you act on them** rule. That
834
- rule's duty falls on **the parent**, which has already demonstrated it can
835
- write, being the session that granted the path. The two are disjoint
836
- readings of one contract, not each other's contradiction.
837
-
838
- **Journalling is a discharge path, not a dispatched session's privilege.** The
839
- template's durability rule turns on **capability, never role** — a session
840
- journals when it cannot commit and commits when it can — and this section owns
841
- why the earlier role-keyed reading failed. That reading granted the journal to a
842
- dispatched session and denied it to a top-level one, on the premise that a
843
- top-level session is by construction able to commit. The premise is false
844
- whenever another session holds the shared index, which is the *normal* condition
845
- while a work unit is in flight rather than an edge case: the supervising role
846
- improvised scratch notes on three separate occasions in one iteration, each time
847
- because a live dispatched session held the index. Improvised scratch is the
848
- journal mechanism with none of its contract — no granted path inside the sweep's
849
- reach, no inline landing, no marker — so the failure was silent and the
850
- reconstruction cost was paid per occurrence. Widening by capability rather than
851
- carving out a second surface per role is what keeps the reclaim story unchanged:
852
- every discharge path still lands in the same scratch directory the consumer's
853
- own work-unit boundary already sweeps, so no new lifetime, keep-list entry, or
854
- inbound-triage surface is created by the widening.
855
-
856
- ## Verify after every agent commit
857
-
858
- Re-run the relevant gates plus the consumer's validate battery (for this
859
- repo and any gate-sdk consumer: `bash gate-sdk/bin/run-gates.sh` and the
860
- kit fixture runners; a toolchain consumer adds its compile/lint/test set in
861
- the template's marked section, including a zero-byte-file sweep after
862
- renames — silent edit corruption is real). **Diff every gate change in an
863
- agent commit before accepting**: an agent blocked by a gate will weaken it
864
- (a false exemption) rather than fix the code — "the gate is in my way"
865
- almost always means the code doesn't fit the convention.
866
-
867
- **The act is `verify`; the artifact stays the `validate battery`.** The
868
- discipline is an act a supervisor performs; the battery is the command set
869
- that act runs. One word for both made *completing the act* read as completing
870
- whatever else the consumer names with that word — attested where a consumer's
871
- stage roster carries it, and the near-miss was a skipped stage. Renaming the
872
- act rather than the artifact is the cheap side: the battery is a binding-slot
873
- name every consumer's shim carries (§One template, a resident pointer, read by
874
- `check-skill-binding`), while the act is named only in prose. The result reads
875
- coherently — *you verify an agent's commit by re-running the relevant gates and
876
- the consumer's validate battery* — and the act and the artifact having
877
- different names is the distinction that was missing.
878
-
879
- **A verify step never runs the producer of what it is verifying.** Re-running
880
- is safe and idempotent exactly when the dispatched unit's output is *work* and
881
- the check's output is *a verdict about that work*; it stops being safe the
882
- moment those coincide. Where a unit's deliverable **is** an evidence artifact,
883
- the verify is a **read of the committed artifact**, never a re-execution of
884
- what wrote it: re-running the producer mutates or duplicates the very record
885
- the check exists to confirm.
886
-
887
- **The two wrong re-runs are not equally harmful, and a supervisor needs the
888
- split.** A check that writes nothing the artifact depends on is *inert* on it —
889
- misrouted and wasted work, with nothing lost. Re-running the artifact's **sole
890
- writer** is *destructive*. The routing defect is the same in both; only the
891
- second leaves evidence to restore, and the supervisor that has already run the
892
- wrong one reads this split to learn which one it is holding. Collapsing them
893
- would either overstate the harm of a wasteful re-run or understate the harm of
894
- the destructive one.
895
-
896
- **Honest limit — this rule installs no oracle**, and recurrence is what
897
- establishes it matters rather than a projection: the misrouting fired in two
898
- consecutive iterations and an operator caught it both times. The check class
899
- that would catch it is a gate over a *supervisor's choice of command*, and no
900
- scanner is buildable — the choice leaves no tracked artifact to read, the same
901
- structural reason §Operative residency owes no gate. A consumer whose evidence
902
- producer claims a liveness lock has a partial artifact-side proxy; its coverage
903
- boundary is that consumer's own mechanism to state, not this section's. So
904
- detection stays human, and it is stated here rather than left implicit because
905
- an unstated limit reads as an oversight for a later session to close with a
906
- gate that cannot exist.
907
-
908
- `check-gate-tamper` is the mechanical floor under the diff-every-gate-change
909
- duty. Two assertions, blocking the two attested tamper shapes:
910
-
911
- - **A — gate-edit isolation.** A commit that touches a gate file (the
912
- `DELEGATION_KIT_GATE_FILES` globs) may touch only meta-layer paths
913
- (`DELEGATION_KIT_META_PATHS` prefixes + root `*.md`); co-staging product
914
- code with a gate edit is blocked. Split the gate change into its own
915
- commit.
916
- - **B — no self-serving exemption.** A newly added path/glob entry in any
917
- gate's `# exception-list:` array must not match a file staged in the same
918
- commit — an exemption never excuses the very change it lands with.
919
-
920
- **Honest limit:** the gate blocks by commit *shape*; it does not catch
921
- semantic weakening inside a legitimate scripts-only commit — the by-eye
922
- diff review of agent gate edits remains a supervisor duty. `--fixture <dir>`
923
- injects `staged-files` / `added-exemptions` lists (fixture-pair test
924
- capability); live mode reads `git diff --cached`.
925
-
926
- `checks/check-gate-tamper.gate` (`precommit`, binary-dispatched). `--fixture`
927
- **survives the port**: it selects the rule's own input corpus, which no knob
928
- resolves, so it is not the arrives-too-late shape gate-sdk/SPEC.md §The non-gate
929
- arm deletes — the invocation delegation-kit/README.md documents stays true.
930
-
931
- **Criterion 4 binds on this gate as a property of the *consumer's* configured
932
- globs, not of the gate.** Under the kit-shipped `DELEGATION_KIT_GATE_FILES`
933
- default the corpus is the consumer's own gates directory, which holds no kit
934
- declaration, and the criterion clears. Under a config widening the globs to
935
- every kit's check dir — this repo's — the gate's own declaration falls inside
936
- them, and staging it makes the gate read its own bytes. Reading the kit default,
937
- which is the natural first stop, therefore gives the wrong answer for the tree
938
- the port actually runs against; gate-sdk/SPEC.md §The port-candidate criteria
939
- carries the instance class.
940
-
941
- **Two behaviours changed with the port, and both are rulings rather than
942
- drift.** Assertion B's report lines came out of the shell form in no
943
- reproducible order once a commit added two matching exemptions; the
944
- compiled form emits the same **set** byte-sorted, on the kit-roots cohort's
945
- ruling that a compiled form implements set semantics rather than a shell's
946
- incidental ordering. And a trailing `--fixture` with no directory after it
947
- **hung** the shell form in its argument-parsing loop; the compiled form reads the
948
- missing value as the empty directory name and refuses. A hang is not a verdict, so ending it costs no assertion.
949
-
950
- ## check-agent-tier-explicit
951
-
952
- Every agent definition under `DELEGATION_KIT_AGENT_DIR` declares a `model:`
953
- field in its frontmatter. This is the oracle over the tracked half of the
954
- template's **Match the dispatched model and effort to the unit's shape** rule:
955
- the per-dispatch habit leaves no artifact, but a standing choice does, and the
956
- gate reads it.
957
-
958
- **It polices silence, not the choice.** An explicit `inherit`-valued `model:`
959
- **passes** — a dispatched session that should ride its dispatcher's tier is a
960
- legitimate answer and the gate has no business overruling it. What reds is
961
- *omission*, the one state indistinguishable from not having thought about it,
962
- and the one state that is not the neutral absence it looks like — the refused
963
- environment override and the precedence chain behind that reading are in
964
- §The delegation model. A reader arriving at this gate expecting it to enforce
965
- cheapness has the wrong model of it.
966
-
967
- **Counted inertness.** A consumer with no such directory — or one holding no
968
- definitions — scans zero and reports a clean counted line, the derived-scan-set
969
- shape the kit's other gates use. There is no roster and no registration list to
970
- maintain: the scan set is the directory's contents.
971
-
972
- **Honest limit.** It holds the tracked surface only. A dispatch naming no agent
973
- type and no `model` parameter inherits and leaves no artifact for any gate to
974
- read, so the gate converts the standing-choice class from unenforceable to
975
- enforced and leaves the per-dispatch class to the rule's prose. That is
976
- strictly better than nothing and not a claim to have closed the tier question
977
- mechanically.
978
-
979
- ## usage-verdict
980
-
981
- Emits a trustworthy budget verdict from a usage snapshot file, closing the
982
- three failure modes a raw percentage reading leaves open:
983
-
984
- 1. **Stale reading** — `now - updated_at` beyond `DELEGATION_KIT_STALE_AGE` → STALE
985
- (exit 2): budget-unknown, never blocking delegation — re-read or refresh
986
- before trusting the number.
987
- 2. **Dead window** — `resets_at <= now` → RESET-OK (exit 0): the percentage
988
- is from the dead window and must not be read as a pause signal. The
989
- weekly axis carries the same rule per-axis (`seven_day_resets_at <= now`
990
- disarms the weekly pause without forcing the whole verdict to RESET-OK —
991
- the axes are judged independently).
992
- 3. **Post-login lag** — a fresh login starts a new window but the
993
- server-fed percentage lags it, and the file-write age check cannot see
994
- that. The gate reads the auth event from the credentials file's mtime
995
- (`DELEGATION_KIT_LOGIN_WINDOW`) and, within that window, routes a
996
- would-be OK to STALE (re-read). Letting the lag print OK would emit a
997
- fresh-looking chimera, since the producer stamps the new account id while
998
- the percentage and `resets_at` still carry the dead login's window.
999
- Self-limiting: once the mtime ages out, the reroute stops firing.
1000
-
1001
- **The reroute is asymmetric — it may suppress an OK, never a PAUSE.** It
1002
- therefore follows the axis compares rather than preceding them. The two
1003
- directions of a lagging reading have opposite costs: a lagging *low*
1004
- percentage printing OK invites a dispatch the budget may not afford, which
1005
- is what the reroute exists to prevent; a lagging *high* percentage
1006
- suppressed into STALE waves that dispatch through, because STALE is
1007
- advisory and never blocks (§usage-verdict). An unconditional
1008
- reroute closes the first and opens the second, so it must fire on the
1009
- non-blocking outcome only: inside the window an at-or-over reading still
1010
- exits 1 on whichever axis fired, and an under-threshold one still exits 2.
1011
- An account switch swaps both windows, so neither axis escapes the
1012
- suppression when the outcome is a would-be OK.
1013
-
1014
- **The mtime is a proxy, and the roll witnesses refute it.** A credentials
1015
- file's mtime cannot distinguish an actual login from a routine OAuth token
1016
- rotation, which rewrites the same file — so every rotation mints a fake
1017
- auth event and blinds the verdict for the window's duration, and rotations
1018
- cluster around long-session resume, exactly when a verdict is being asked
1019
- for. The reroute's *premise* is that a low percentage inside the window is
1020
- a **lagging** reading; when the five-hour window has demonstrably rolled,
1021
- a low percentage is the **expected** reading and the premise is false. Two
1022
- witnesses of a roll are already in hand at that point, and the verdict
1023
- consults both — conjunctively, since either alone is ambiguous:
1024
-
1025
- - the snapshot's `five_hour_resets_at` differs from the newest
1026
- `DELEGATION_KIT_USAGE_HISTORY` sample's `resets_at` (the boundary moved);
1027
- - the snapshot's `updated_at` is past that **previous** boundary (time
1028
- actually crossed it, rather than the boundary being restamped by an
1029
- account switch).
1030
-
1031
- Both firing disarms the reroute and the reading verdicts on its own merits.
1032
- This makes the verdict path a **reader** of the trend log it already
1033
- appends to; the read is taken before this run's own append, so the witness
1034
- is the previous reading and never this one. It falls open to the
1035
- unrefuted reroute whenever the log cannot answer — knob unset, file absent
1036
- or unreadable, or a tail carrying no numeric `resets_at` — which is the
1037
- pre-existing behavior, so an unconfigured consumer is unchanged. The
1038
- residual limit is honest and named: a rotation with **no** roll still
1039
- blinds the window, because no witness in hand contradicts it; closing that
1040
- needs an account-keyed check against the credential's own identity, not a
1041
- sharper time window.
1042
-
1043
- Check order: parse → RESET-OK → age-STALE → pause axes → login-STALE → OK. The
1044
- RESET-OK branch is the same decision one step earlier and is ordering
1045
- precedent for the witnesses: the file already accepts that a demonstrated roll
1046
- outranks the reroute. It covers only a snapshot from an already-dead window;
1047
- the witnesses cover a window that rolled *between* samples, where the
1048
- re-polled snapshot carries a live `resets_at`.
1049
-
1050
- Exit codes: **0** OK / RESET-OK, **1** PAUSE, **2** STALE or unreadable. Exit
1051
- 2 is fail-closed on *trusting the number* and deliberately fail-open on
1052
- *refusing work* — budget-unknown never blocks delegation — so it is never the
1053
- code a reading that should refuse an expensive dispatch may land on. The bin's
1054
- `# exit:` header declares that mapping, stating exit 2's consequence rather
1055
- than labelling it a bare "fail-closed" (which named only the trust axis and
1056
- read as a claim about the blocking one). That declaration is **machine-read** by
1057
- `check-assertion-strength` (gate-sdk/SPEC.md), which derives the verdict
1058
- vocabulary from it rather than carrying a literal — so the header is a surface
1059
- with a consumer, not loose documentation, and rewording it reshapes what that
1060
- gate can discriminate.
1061
- Fail-closed throughout: missing keys and a non-numeric percentage route to
1062
- STALE; each threshold compare uses `awk`, not integer-only bash
1063
- arithmetic, so a fractional percentage cannot silently skip PAUSE; and both
1064
- pause compares are **at-or-over** (`>=`), so a reading exactly at
1065
- `DELEGATION_KIT_PAUSE_PCT` / `DELEGATION_KIT_PAUSE_PCT_7D` pauses — the
1066
- boundary reading is judged at the
1067
- limit, not under it.
1068
-
1069
- **Demand-driven refresh.** The decision point triggers the poll: when
1070
- `DELEGATION_KIT_REFRESH_CMD` is non-empty, `usage-verdict` runs it before
1071
- reading the snapshot, so the budget guard and any verdict caller read live
1072
- data instead of whatever the last statusline render left behind. This closes
1073
- the push producer's blind spot at the point of use — a lead that delegates
1074
- stops rendering exactly when it goes static, and the first live poll proved
1075
- the gap: the snapshot said 2-5% while the endpoint said 28%. Empty (the
1076
- default) keeps the read-only behavior, so an unconfigured consumer's push and
1077
- timer producers are unchanged.
1078
-
1079
- The refresh is **short-circuited** by `DELEGATION_KIT_REFRESH_MIN_AGE`: the
1080
- command runs only when the snapshot is missing, unreadable, or its
1081
- `updated_at` age is at least that value. The statusline calls `usage-verdict`
1082
- on every render for trend sampling; without the floor a configured refresh
1083
- would hammer the source on the render path. At dispatch-decision time a
1084
- stale-enough snapshot still polls.
1085
-
1086
- It is **fail-soft**: a non-zero refresh exit leaves the snapshot untouched and
1087
- the verdict proceeds on the cached file — the staleness machinery above judges
1088
- its trust, turning a dead producer into a STALE verdict rather than a silent
1089
- green. Refresh diagnostics are suppressed rather than mixed into the verdict
1090
- output, which callers relay verbatim; the snapshot's age is the signal.
1091
- `usage.txt` survives as last-known-good cache, source-agnostic seam, and test
1092
- seam. A refresh inside the `DELEGATION_KIT_LOGIN_WINDOW` rewrites `updated_at` while the
1093
- server-fed percentage may still lag the login by about a minute — the reroute
1094
- correctly keeps those readings STALE for the window's duration, save the
1095
- at-or-over ones it is forbidden to suppress.
1096
-
1097
- **The verdict-string contract.** Every line `usage-verdict` emits carries three
1098
- parts: the **reading** (the measured fields), the **epistemic status** of that
1099
- reading (how far to trust the number), and its **decision consequence** for
1100
- delegation (what the reading gates). A verdict string stating a status without
1101
- its consequence is incomplete by contract — the reader completes it by
1102
- inference, and the inference is unconstrained: a session reading a bare STALE
1103
- infers "do not trust the number" into "do not dispatch". That read is wrong
1104
- (STALE never blocks) and is structurally uncorrectable downstream, because the
1105
- budget guard fires *on* dispatch, the act a hesitating session has not yet
1106
- performed. STALE's status half is site-specific — each emission site names why
1107
- it is stale — while its consequence half is uniform, because the consequence is
1108
- uniform: STALE is budget-unknown at every site and never blocks delegation. The
1109
- consequence clause appends *after* the `` -> <verdict> `` arrow, leaving it
1110
- disjoint from the `width=<n>` invariant below.
1111
-
1112
- **The `width=<n>` field.** Every emitted verdict line — OK, PAUSE, STALE (the
1113
- fail-closed diagnostics included), RESET-OK — carries a `width=<n>` field
1114
- immediately before the `` -> <verdict> `` arrow, read from
1115
- `DELEGATION_KIT_FAN_WIDTH` (§Layout and configuration). It is the knob's
1116
- mechanical reader: the budget check already runs before every dispatch, so the
1117
- read-only fan-out bound surfaces at exactly the wave-sizing decision point, and
1118
- `agent-budget-guard.sh` relays the verdict line verbatim (block on PAUSE, advise
1119
- otherwise) so the width rides into context with the budget verdict. *Verbatim*
1120
- governs the verdict line's own text, not the surrounding frame: the guard
1121
- prefixes the relayed line and the PAUSE arm appends its corrective, but no arm
1122
- restates the payload's content — there is exactly one advise arm and it adds
1123
- nothing. The field is
1124
- a config constant, not derived from the snapshot, so it is present even on an
1125
- unreadable-snapshot STALE. No exit-code or other-field change: existing callers
1126
- that key off the exit code or the `-> <verdict>` arrow are unaffected.
1127
-
1128
- **Two pause axes.** The five-hour window is the always-on axis; the weekly
1129
- (7-day) window is a second axis, armed only when both `seven_day_used_pct`
1130
- and `seven_day_resets_at` are present (a three-line snapshot keeps today's
1131
- behavior — no retroactive contract break). The weekly limit can deplete
1132
- while the 5h window sits comfortable, and a weekly PAUSE costs days, not
1133
- hours, so it must gate delegation planning, not merely appear in a log —
1134
- delegation is the discretionary spend, the first thing to stop near the
1135
- weekly ceiling so the remaining week stays with the supervisor. The axes
1136
- are judged independently against `DELEGATION_KIT_PAUSE_PCT` and
1137
- `DELEGATION_KIT_PAUSE_PCT_7D`; either
1138
- firing is a PAUSE (exit 1), and the message names the axis that fired
1139
- (`PAUSE (7-day window)` vs `PAUSE (5h window)`, the weekly named when both
1140
- fire) because the operator's remediation differs by days. No caller
1141
- changes: the session-context hook and the per-dispatch Agent budget guard
1142
- already consume the exit code, so the weekly axis flows into every dispatch
1143
- decision the moment a producer supplies the keys.
1144
-
1145
- **Usage-history sampling.** When `DELEGATION_KIT_USAGE_HISTORY` is non-empty,
1146
- `usage-verdict` appends one sample line (§The usage.txt contract) to that log
1147
- after every successfully parsed snapshot, whatever the verdict — the raw
1148
- harness-reported values verbatim; write-time smoothing or correction is
1149
- forbidden (a later corrective push is evidence about the earlier sample, and
1150
- only the reader has both). A STALE exit from an unreadable or unparseable
1151
- snapshot appends nothing — a sample the gate would not trust is not history.
1152
- `usage-trend` (§Trend reporter) reads the log, and so does `usage-verdict`
1153
- itself: the newest sample's `resets_at` is one of the two roll witnesses
1154
- (§usage-verdict). That read is the log's only in-verdict consumer and is
1155
- strictly fall-open, so the log stays an advisory trend surface rather than
1156
- becoming a correctness dependency — a consumer with sampling off gets the
1157
- same verdicts it always did.
1158
-
1159
- ### The usage.txt contract
1160
-
1161
- The snapshot is the wire contract between any producer and the gate — three
1162
- `key=value` lines:
1163
-
1164
- ```
1165
- five_hour_used_pct=<float>
1166
- five_hour_resets_at=<epoch-seconds>
1167
- updated_at=<epoch-seconds>
1168
- ```
1169
-
1170
- Beyond the three mandatory lines a producer may write optional keys when its
1171
- source exposes them; `usage-verdict` reads the ones it interprets and passes
1172
- the rest through: `seven_day_used_pct` / `seven_day_resets_at` (the weekly
1173
- window — read at the verdict transition to arm the second pause axis),
1174
- `account` (the logged-in account identity — `login_at` detects a switch,
1175
- `account` says to whom, which lets `usage-trend` group a multi-account
1176
- operator's segments per account), `tier` (subscription tier — the
1177
- denominator behind the percentages), and `tokens_in` / `tokens_out`
1178
- (cumulative token counts, the axis that binds API-billed consumers for whom
1179
- no subscription percentage applies). Optional keys are omitted when their
1180
- source has no value, never written empty; keys the verdict does not read
1181
- pass through unchanged.
1182
-
1183
- The kit ships two reference producers — one push, one poll — and any producer
1184
- honoring the contract works beside them. `templates/statusline-usage.sh` is
1185
- the push producer: a statusline hook
1186
- that parses the harness's rate-limit JSON and atomically writes the
1187
- snapshot (`tmp` + `mv`) to `${CLAUDE_CONFIG_DIR:-$HOME/.claude}/usage.txt`.
1188
- It also produces the weekly pair from the payload and `account` / `tier`
1189
- from the local account config (`.credentials.json` / `~/.claude.json`,
1190
- overridable via `DELEGATION_KIT_CRED_FILE` / `DELEGATION_KIT_ACCOUNT_CONFIG`).
1191
- It ships no `tokens_in` / `tokens_out` producer: this harness's payload
1192
- carries no cumulative token count, so under the dead-producer rule the keys
1193
- stay defined here for third-party producers but no dead producer is shipped.
1194
- Beyond the snapshot write it renders a status bar (§The statusline template).
1195
- The snapshot write is the contract; the bar is reference UX a consumer may
1196
- restyle or discard. The source is pluggable
1197
- (`DELEGATION_KIT_USAGE_FILE`), so no
1198
- single-operator `CLAUDE_CONFIG_DIR` assumption is baked in.
1199
-
1200
- `templates/usage-poller.sh` is the poll producer, closing the push producer's
1201
- blind spot: the statusline fires on the supervising session's own message
1202
- flow, so a lead that delegates stops producing exactly when it goes static —
1203
- a delegated build can run for hours with every per-dispatch budget verdict
1204
- reading a stale file. The poller is one poll cycle per invocation: read the
1205
- harness OAuth token from the credentials file the kit already knows
1206
- (`DELEGATION_KIT_CRED_FILE`; the token goes into the request header and
1207
- nowhere else — never logged, never echoed, never written to the snapshot),
1208
- query the account usage source, map the payload onto the contract (the three
1209
- mandatory lines plus whichever optional keys the source exposes; **no new
1210
- key**), and atomically rewrite the snapshot (`tmp` + `mv`, the same
1211
- discipline). No daemon, no loop: scheduling belongs to the consumer, and two
1212
- modes are sanctioned. **Demand-driven** (§usage-verdict): point
1213
- `DELEGATION_KIT_REFRESH_CMD` at the poller and the same one-cycle producer runs
1214
- at verdict time, which puts the freshest reading exactly at the decision point.
1215
- **Timer-driven**: a cron line such as `*/5 * * * * bash usage-poller.sh` or a
1216
- systemd timer, for consumers wanting continuous trend density independent of
1217
- verdict calls. Either entry is the enabling config; with neither, the producer
1218
- is dead. The usage endpoint is harness-account plumbing, not a
1219
- published contract, so the poller is **fail-soft**: a missing/unreadable
1220
- credentials file, a fetch failure, or an unparseable payload exits non-zero
1221
- with a `help:` line *without touching the snapshot* — a stale snapshot is
1222
- already the detected condition downstream (`usage-verdict`'s `updated_at`
1223
- staleness check turns it into a STALE verdict, never a silent green), and the
1224
- non-zero exit lands in the invoking timer's logging, deliberately nowhere
1225
- else. The endpoint URL is the `DELEGATION_KIT_USAGE_ENDPOINT` knob — both the
1226
- test seam (the smoke points it at a local `file://` stub) and the valve when
1227
- the source moves.
1228
-
1229
- Both producers write the whole snapshot atomically from the same account
1230
- source; last-writer-wins is correct because the freshest write is the truest
1231
- and `updated_at` arbitrates downstream. Nothing serializes them and nothing
1232
- needs to. The trend log is unaffected: `usage-verdict` stays the single
1233
- append author (§usage-verdict); the poller writes the snapshot only.
1234
-
1235
- Because the
1236
- statusline fires far more often than the per-session /
1237
- per-dispatch verdict calls, a consumer wanting a denser trend history can drive
1238
- sampling from the render path — `usage-verdict` stays the single append author
1239
- (§usage-verdict), so the statusline calls it (with `DELEGATION_KIT_USAGE_HISTORY`
1240
- set) rather than appending the log itself.
1241
-
1242
- **The sample line.** With sampling enabled (§usage-verdict), `usage-verdict`
1243
- appends one line per parsed snapshot — the trend log's wire contract between
1244
- it and `usage-trend`:
1245
-
1246
- ```
1247
- updated_at=<epoch> pct=<float> resets_at=<epoch> verdict=<word> login_at=<epoch>[ account=<word>][ tier=<word>][ pct_7d=<float> resets_7d=<epoch>][ tokens_in=<n> tokens_out=<n>]
1248
- ```
1249
-
1250
- Space-separated `key=value`, order-insensitive; optional groups are omitted
1251
- (never written empty) when the snapshot lacks them. `login_at` is the
1252
- credentials-file mtime the post-login-lag check already reads, stamped per
1253
- sample so an account switch becomes data; `pct` / `resets_at` are the 5h
1254
- values verbatim and `pct_7d` / `resets_7d` the weekly ones. The log is
1255
- append-only (the tmp-prune / boundary-truncate conventions own cleanup), and
1256
- carries operator-local account identifiers, so it lives under the gitignored
1257
- measurement dir and never reaches a tracked file.
1258
-
1259
- ### The statusline template
1260
-
1261
- `templates/statusline-usage.sh` renders model/effort, a context gauge, the 5h
1262
- and 7d windows with reset countdowns, an `iteration@stage` readout, and a queue
1263
- counter group. Self-contained ANSI, no external asset (§Out of scope).
1264
-
1265
- The `iteration@stage` readout's two halves come from two surfaces: the iteration
1266
- from the queue header, the stage from the lifecycle evidence file's **last data
1267
- line**. Both are repo-root-relative reads in the template's existing hardcode
1268
- style — a consumer-owned template adds no knob. With no cursor to read (no
1269
- evidence file, or one truncated to its preamble at an iteration boundary) the
1270
- readout degrades to the iteration alone rather than printing a dangling
1271
- separator or a partial parse.
1272
-
1273
- **The counter group** is a compact `N12 T3 D48 I7` tally of the queue's task
1274
- sections, appended last. The template does not know how many sections exist,
1275
- what they are called, or which tiers the set contains: it runs
1276
- queue-kit's `bin/queue-counts.sh` and renders whatever
1277
- `<section-name><TAB><count>` lines come back, labelling each with the initial of
1278
- the name it was handed (queue-kit/SPEC.md §bin/queue-counts.sh). The section
1279
- vocabulary therefore stays entirely inside the kit that owns it — there is
1280
- nothing here for a later editor to hardcode. As soon as two returned names share
1281
- an initial, **every** label widens to two characters, so a colliding pair stays
1282
- distinguishable and the group stays aligned rather than only the collision
1283
- changing width.
1284
-
1285
- **It is a subprocess call, and that is the contract, not an implementation
1286
- detail.** The counter's library exits 2 at *source* time on a malformed queue
1287
- config; sourced into this shell it would take the whole status bar down — model,
1288
- context gauge, both rate-limit gauges — over a component worth four characters.
1289
- As a subprocess the same fault is a non-zero exit the render absorbs. An absent
1290
- or non-executable counter, a non-zero exit, and empty output all drop the group
1291
- and change nothing else about the bar, matching the two degradations the
1292
- template already performs (an absent queue file drops the iteration; an absent
1293
- evidence file drops the `@stage` suffix). The existence guard is kept even
1294
- though every installer profile carrying this template also carries queue-kit,
1295
- because a future profile pairing differently would otherwise turn a roster fact
1296
- into a broken status bar.
1297
-
1298
- The render cost is one subprocess per statusline fire, which is the kit's most
1299
- frequent trigger by a wide margin (§The usage.txt contract). A full scan of a
1300
- ~3,600-line queue measures in single-digit milliseconds, so the group needs no
1301
- cache — recorded so a later session does not add one on suspicion.
1302
-
1303
- ## Trend reporter
1304
-
1305
- `bin/usage-trend.sh` reads the history log and reports how the footprint
1306
- evolves — advisory tooling, never a gate: exit **0** report emitted, **2**
1307
- knob unset or history missing/unreadable (fail-closed, mirroring the
1308
- verdict's STALE discipline), never **1** (it renders no verdict; the verdict
1309
- stays the sole pause authority). The source signal is known-noisy — a
1310
- rolling-window reading spikes and reverts-down when a harness over-report is
1311
- corrected by the next push — so the design separates signal from noise by
1312
- the window's one physical constraint: within a segment, true usage never
1313
- decreases.
1314
-
1315
- 1. **Segment** samples per axis by that axis's reset epoch, `login_at`,
1316
- `account`, and `tier`: the 5h axis keys on `resets_at`, the weekly axis
1317
- on `resets_7d` (the windows roll independently — a weekly segment spans
1318
- many 5h segments). A timer reset, a `/login`, or an account or tier
1319
- change each starts a segment; only within-segment comparisons are
1320
- meaningful, so an account switch is a boundary, not a flagged anomaly.
1321
- 2. **Flag** any sample whose pct is below an earlier one in the same segment
1322
- as a monotonicity violation: the downward correction indicts the elevated
1323
- sample(s) before it as reader noise, and both sides are excluded from rate
1324
- math, never averaged in. Median-of-3 smoothing resolves single-sample
1325
- spikes; segment endpoints keep their own value (no 2-window averaging).
1326
- 3. **Report** per segment and axis — first/last smoothed pct, pct-per-hour
1327
- rate, token deltas when token keys ride, tier, sample count, and
1328
- suspect-sample count (a high suspect ratio means the producer is
1329
- unreliable and no number from that segment is trusted). The weekly axis
1330
- additionally reports headroom against `DELEGATION_KIT_PAUSE_PCT_7D` at the current rate —
1331
- the planning number for how much delegation the week still affords — and,
1332
- when `account` is present, segments group under an account heading so a
1333
- rotating operator reads one weekly trajectory per account rather than an
1334
- interleaved stream.
1335
-
1336
- ## Layout and configuration
1337
-
1338
- ```
1339
- delegation-kit/
1340
- bin/usage-verdict.sh
1341
- bin/usage-trend.sh # footprint trend reporter over the history log
1342
- bin/run-usage-tests.sh # verdict decision-table runner
1343
- bin/run-budget-guard-tests.sh # budget-guard decision-table runner
1344
- bin/run-dispatch-guard-tests.sh # dispatch-guard decision-table runner (D1/D2/D3)
1345
- bin/run-trend-tests.sh # trend-reporter assertion runner
1346
- lib/delegation.sh # shared helpers for the usage tools and the kit's gates
1347
- usage-tests/cases.tsv # expected-verdict <TAB> scenario knobs
1348
- usage-tests/budget-guard-cases.tsv # expected-action <TAB> scenario knobs
1349
- usage-tests/dispatch-guard-cases.tsv # expected-outcome <TAB> scenario knobs
1350
- usage-tests/trend-history.log # fixture history for the trend runner
1351
- checks/check-gate-tamper.gate # binary-dispatched; live arm reads the index through git
1352
- checks/check-rule-citation.gate # hermetic, binary-dispatched: every SPEC rule citation resolves to a template lead-in
1353
- checks/check-agent-tier-explicit.gate # hermetic, binary-dispatched: every agent definition declares an explicit model:
1354
- gate-tests/check-gate-tamper/{good,bad}/
1355
- gate-tests/check-gate-tamper.test.sh # the live arm, over throwaway git repos
1356
- gate-tests/check-rule-citation/{good,bad}/
1357
- gate-tests/check-agent-tier-explicit/{good,bad}/
1358
- templates/agent-execution.md # full protocol, bound as a skill shim
1359
- templates/dispatch-checklists.md # deletion/rename/audit pre-flight, reached by a pointer
1360
- templates/agent-budget-guard.sh # PreToolUse(Agent) budget guard
1361
- templates/agent-dispatch-guard.sh # PreToolUse(Agent) dispatch-shape guard (D1/D2/D3)
1362
- templates/statusline-usage.sh # push usage.txt producer (statusline hook) + status bar incl. the queue counter group
1363
- templates/usage-poller.sh # poll usage.txt producer (timer-driven, fail-soft)
1364
- templates/delegation-config.sh # knob overrides (arrays live here)
1365
- smoke/install.sh
1366
- smoke/violation.sh
1367
- ```
1368
-
1369
- Config follows the established kit pattern: copy
1370
- `templates/delegation-config.sh` into the gates dir (or point
1371
- `DELEGATION_KIT_CONFIG_FILE` elsewhere) and override any knob; defaults
1372
- fill what the consumer left unset. The loader is fail-closed: a
1373
- `DELEGATION_KIT_CONFIG_FILE` named but absent, or a config leaving any knob
1374
- malformed, exits 2 (a broken machine gates nothing). Knobs (this repo's
1375
- layout as defaults):
1376
-
1377
- - `DELEGATION_KIT_USAGE_FILE` — default
1378
- `${CLAUDE_CONFIG_DIR:-$HOME/.claude}/usage.txt`; positional `$1`
1379
- overrides (test injection).
1380
- - `DELEGATION_KIT_CRED_FILE` — default the usage file's sibling
1381
- `.credentials.json`; positional `$2` overrides.
1382
- - `DELEGATION_KIT_USAGE_ENDPOINT` — the poll producer's usage source; default
1383
- `https://api.anthropic.com/api/oauth/usage`. The test seam (a `file://` stub)
1384
- and the stability valve when the unpublished source moves (§The usage.txt
1385
- contract).
1386
- - `DELEGATION_KIT_PAUSE_PCT` — default `80`.
1387
- - `DELEGATION_KIT_PAUSE_PCT_7D` — weekly-axis pause threshold; default `95`,
1388
- deliberately looser than the 5h axis: a weekly PAUSE is remediated in days,
1389
- not hours, so pausing at the 5h conservatism would strand a fifth of the
1390
- week's budget — only the true red zone stops delegation on this axis.
1391
- - `DELEGATION_KIT_STALE_AGE` — default `600` (seconds).
1392
- - `DELEGATION_KIT_LOGIN_WINDOW` — default `600` (seconds).
1393
- - `DELEGATION_KIT_REFRESH_CMD` — the command `usage-verdict` runs before
1394
- reading the snapshot (§usage-verdict); default empty, which keeps the
1395
- read-only behavior. This repo points it at the poll producer, run in place
1396
- from its template path.
1397
- - `DELEGATION_KIT_REFRESH_MIN_AGE` — the refresh short-circuit (§usage-verdict);
1398
- default `60` (seconds), validated a non-negative integer by the loader. The
1399
- floor is set by the render path, not the dispatch path: the statusline calls
1400
- the verdict on every render, so the default bounds source traffic to roughly
1401
- one poll a minute while leaving any dispatch-time reading fresh enough to act
1402
- on.
1403
- - `DELEGATION_KIT_USAGE_HISTORY` — sample-log path; default empty (sampling
1404
- off). This repo sets `.metric/usage-history.log`, a gitignored persistent
1405
- measurement trend (drift-kit/SPEC.md §Layout and configuration owns the
1406
- metric-dir retention contract).
1407
- - `DELEGATION_KIT_FAN_WIDTH` — read-only-fan-out width bound; default `2`,
1408
- validated a positive integer by the loader. It bounds read-only fan-outs
1409
- only: a committing fan-out serializes or takes its own worktree regardless
1410
- (the template's **Serialize on shared files; ≤`DELEGATION_KIT_FAN_WIDTH`-wide
1411
- otherwise** rule), so this knob is never a licence to widen concurrent
1412
- committers.
1413
- The default is the loss-bounding invariant — bound the in-flight loss to
1414
- what the window can absorb when the wall fires mid-flight — at a Pro-class
1415
- subscription window; a Max-class window absorbs more, and an API-billed
1416
- operator has no mid-flight window wall at all, so there spend rate and the
1417
- provider's rate limits replace the rationale. A consumer retunes from the
1418
- invariant, not the number. **Supervision ceiling:** operator attention over
1419
- N concurrent reports does not scale with the budget window — a bigger
1420
- window raises the affordable width, not the reviewable one, so budget is
1421
- never the sole input to widening. `usage-verdict` surfaces the live value
1422
- as the `width=` field (§usage-verdict), the knob's mechanical reader.
1423
- - `DELEGATION_KIT_AGENT_DIR` — the directory `check-agent-tier-explicit` walks
1424
- for agent definitions; default `.claude/agents`, this harness's conventional
1425
- agent-definition location, validated non-empty by the loader. Positional `$1`
1426
- overrides (fixture injection). A consumer whose harness keeps definitions
1427
- elsewhere repoints it; one with no such directory leaves it and the gate
1428
- reports its counted-inert clean line (§check-agent-tier-explicit).
1429
- - `DELEGATION_KIT_GATE_FILES` — globs naming gate files for tamper
1430
- assertion A; default
1431
- `("${GATE_SDK_GATES_DIR:-scripts}/check-*.sh" "${GATE_SDK_GATES_DIR:-scripts}/check-*.gate")`
1432
- plus the gate-sdk lib and
1433
- runners. **Both declaration spellings are on the default**, because a gate's
1434
- declaration path is `<name>.sh` *or* `<name>.gate`
1435
- (gate-sdk/SPEC.md §The `# graph:` manifest)
1436
- and a consumer on the default would otherwise receive a
1437
- ported gate whose edits escape the isolation rule entirely — the widening the
1438
- `check-gate-tamper` row of
1439
- gate-sdk/SPEC.md §Meta-gate conservation for the binary substrate
1440
- mandates, come due at the first live descriptor.
1441
- A consumer declaration **replaces** this default outright rather
1442
- than extending it — the loader guards it with `declare -p … ||`, so the
1443
- default is the no-declaration fallback, not a base to append to. A consumer
1444
- adding kit-shipped globs must therefore restate any default glob it still
1445
- wants covered (this repo's config names `*/checks/*.sh` and `*/checks/*.gate`
1446
- **and** their `scripts/check-*` counterparts, because it has gates in both
1447
- places). Contrast
1448
- `DELEGATION_KIT_META_PATHS` below, whose kit-root union *is* additive — the
1449
- two knobs do not behave alike.
1450
- - `DELEGATION_KIT_META_PATHS` — prefixes counted as meta-layer for
1451
- assertion A; default `("${GATE_SDK_GATES_DIR:-scripts}/"
1452
- "${GATE_SDK_WORKFLOW_DIR:-.workflow}/" ".claude/")`; root-level `*.md` is
1453
- always meta. When `gate.sh` is resolvable (`GATE_SDK_LIB`, else the vendored
1454
- sibling), the loader unions every `gate_kit_roots` member into this array as a
1455
- root-relative `dir/` prefix — a vendored kit's edits are meta-layer by
1456
- definition, so the consumer's config need not name kit dirs at all (this
1457
- repo's keeps only the non-kit prefixes). The union is additive, never a
1458
- filter: a
1459
- prefix the consumer declared cannot be lost, and without `gate.sh` the config
1460
- is used exactly as written.
1461
- - `DELEGATION_KIT_READONLY_TYPES` — agent-type names the consumer dispatches for
1462
- read-only work; D2's only trigger (§The delegation model). Default empty, in
1463
- which case D2 is inert by construction. Every entry is the consumer's own
1464
- agent roster, never the kit's (CLAUDE.md §The provenance seam) — the same
1465
- reasoning that ships `GUARD_KIT_BREADTH_PROBES` with no default probes.
1466
- Deliberately not knobbed alongside it, each ruled out for a stated reason: a
1467
- fork-type-name knob and an accepted-isolation-values knob — `fork` and
1468
- `worktree` are the **harness's** dispatch vocabulary, and a guard template
1469
- carries its harness's tool vocabulary as literals the same way
1470
- `wakeup-guard.sh` matches `ScheduleWakeup`/`CronCreate` literally, so
1471
- knobbing them would imply a portability the mechanism does not have; a
1472
- warn-only or per-rule opt-out — a doctrine downgradable per session is the
1473
- honour system these rules exist to end, so the valve stays the whole guard's
1474
- registration, never a finer one; and accepting `isolation: remote` as
1475
- satisfying D2 — plausibly correct (a remote agent cannot touch the local
1476
- index) but unverified from here, and remote availability is gated, so it is
1477
- excluded with its reason recorded rather than admitted on plausibility.
1478
-
1479
- `check-gate-tamper` registers in the consumer's `gates.list`
1480
- (tier: precommit) — in this repo's too; dogfooding is day-one, and agents
1481
- commit here.
1482
-
1483
- `agent-budget-guard.sh` is not a gate — it is a hook, so it registers not in
1484
- `gates.list` but under `PreToolUse` matcher `Agent` in the consumer's
1485
- `.claude/settings.json` (beside the guard-kit Bash guard). Copy the template
1486
- into the gates dir and wire `bash scripts/agent-budget-guard.sh`; it resolves
1487
- `guard-kit/lib/guard.sh` and `bin/usage-verdict.sh` at their vendored paths,
1488
- overridable with `GUARD_KIT_LIB` / `DELEGATION_KIT_VERDICT_BIN`. Registration
1489
- is the whole opt-in: unwired, the guard is inert. This repo registers it, and
1490
- its consumer session brief (`scripts/session-context.sh`) additionally prints
1491
- the verdict line at SessionStart for planning-time visibility — a consumer-side
1492
- edit; the context-kit template stays uncoupled from delegation-kit.
1493
-
1494
- `agent-dispatch-guard.sh` is a second hook on that same matcher, registered the
1495
- same way and **independently**: the harness fires every hook a matcher carries
1496
- and any exit 2 blocks, so neither guard knows about the other and a consumer
1497
- may wire either one alone (§The delegation model owns why they are two scripts
1498
- rather than one). It resolves `guard-kit/lib/guard.sh` at its vendored path,
1499
- overridable with `GUARD_KIT_LIB`, and reads the consumer's delegation config for
1500
- D2's roster and nothing else. Registration is again the whole opt-in: unwired,
1501
- it is inert — and an unwired dispatch guard is the exact failure shape it
1502
- exists to catch, so wiring it is not optional dogfooding for a consumer that
1503
- delegates.
1504
-
1505
- **An `OK` verdict is a floor, not a recommendation.** The guard answers one
1506
- question — is there headroom in the window *right now* — and blocks only on
1507
- `PAUSE`. Everything else a dispatch decision turns on sits outside its reach:
1508
- how long the dispatched work runs, what a fan-out beneath the checkpoint will
1509
- cost in total (the guard re-arms on those children but prices each of them
1510
- alone: covered at every depth, aggregated at none — §The delegation model),
1511
- and whether anything forces the dispatch now rather than after the window
1512
- resets. `OK` is therefore one input to that decision and never the decision
1513
- itself; a dispatcher reading `OK` as "go" has substituted the guard's question
1514
- for its own. The asymmetry is deliberate: a wrong `PAUSE` costs a delayed
1515
- dispatch, while an `OK` that is right about headroom and silent about duration
1516
- costs the work in flight.
1517
-
1518
- ## Testing
1519
-
1520
- `check-gate-tamper` speaks the full gate contract (`GATE-TAMPER: clean
1521
- (…)` / findings + `help:` lines / exit 0-1-2) and ships the standard
1522
- `good/`+`bad/` fixture pair driven through `--fixture` by gate-sdk's
1523
- `run-gate-tests.sh`. The pair reaches both assertions — the bad case carries a
1524
- co-staged non-meta path *and* a newly added path exemption matching one of its
1525
- own staged files, beside a bare token assertion B must pass over.
1526
-
1527
- **The pair cannot reach the live arm, and that is a property of the injection
1528
- rather than of the cases.** `--fixture` supplies both lists directly, so the
1529
- function that derives them — reading each staged gate file's bytes out of the
1530
- object store and diffing its exemption set against `HEAD`'s — runs in no fixture
1531
- case. `gate-tests/check-gate-tamper.test.sh` is where it is exercised: each case
1532
- builds a throwaway git repo, stages a commit shape into a real index, and runs
1533
- the gate inside it. It holds the four verdicts the pair cannot — a HEAD-resident
1534
- exemption is not "added" even when a co-staged file matches it, a newly appended
1535
- one is, an added one matching nothing staged stays silent, and a staged
1536
- *deletion* of a gate file reads as an empty exemption set rather than a failure
1537
- to read.
1538
-
1539
- `check-rule-citation` speaks the same gate contract and ships the standard
1540
- `good/`+`bad/` fixture pair (a citation resolving to a template lead-in vs one
1541
- naming an absent lead-in), driven by `run-gate-tests.sh` over fixture-local
1542
- spec + template files passed as its two positional arguments.
1543
-
1544
- `check-agent-tier-explicit` speaks the same gate contract and ships the standard
1545
- `good/`+`bad/` fixture pair over a fixture-local agent directory passed as its
1546
- one positional argument. The `good/` side carries both passing shapes — a
1547
- definition naming a cheaper class outright and one declaring `inherit` — so the
1548
- pair proves the gate discriminates omission from choice rather than merely
1549
- finding a `model:` string; the `bad/` side omits the field.
1550
-
1551
- `usage-verdict` does not fit the gate contract (a three-state verdict, not a
1552
- clean/violation pair), so — like guard-kit's guard-tests — the kit ships
1553
- its own decision-table runner: `usage-tests/cases.tsv` pairs an expected
1554
- verdict token (`OK`/`PAUSE`/`STALE`/`RESET-OK`) and exit code with scenario
1555
- knobs (percentage, snapshot age offset, reset offset, credential age);
1556
- `bin/run-usage-tests.sh` materializes each case as a generated snapshot
1557
- file (timestamps must be computed relative to *now* — static fixtures
1558
- would age into permanent STALE) and asserts verdict and exit code. Each
1559
- case runs in a throwaway sandbox with no consumer config on the lookup
1560
- path **and** with ambient `DELEGATION_KIT_*` exports stripped at each gate
1561
- invocation, so the gate exercises its own defaults hermetic to the host
1562
- repo — the decision table encodes those defaults, and a host override (a
1563
- raised pause threshold, say) must not reshape it. The trend and
1564
- budget-guard runners below share the strip, each runner under a deliberate
1565
- poison export that fails its own table loudly if the strip ever breaks;
1566
- `cases.tsv` columns are `verdict exit pct age_off reset_off cred_age pct_7d
1567
- reset7d_off append axis desc` (the offsets seconds from *now*; `pct_7d` `-`
1568
- omits the weekly keys, `append` is the expected sample-line count, `axis`
1569
- asserts which window a PAUSE names). Every verdict branch and both pause axes
1570
- carry a firing and a non-firing case — the fixture-pair discipline,
1571
- transplanted — covering a weekly PAUSE while 5h is comfortable, the axis
1572
- named in the output, absent keys disarming the weekly axis, a dead weekly
1573
- window not pausing, each axis's at-or-over boundary (a reading exactly at the
1574
- threshold pauses; just under does not), both directions of the login reroute
1575
- (an under-threshold percentage with a fresh login is STALE, not OK; an
1576
- at-or-over one on either axis is still PAUSE, not STALE — the asymmetry is
1577
- what keeps the reroute from waving an unaffordable dispatch through), and the
1578
- sample-append discipline (a parsed snapshot
1579
- appends one line whatever the verdict; a non-numeric snapshot appends none;
1580
- `pct_7d` present-vs-omitted in the passed-through line).
1581
-
1582
- The demand-driven refresh needs a command seam the table's columns do not
1583
- carry, so it is asserted beside the table through a stub
1584
- `DELEGATION_KIT_REFRESH_CMD` (a real
1585
- poll would need the network): **armed** — a stale snapshot invokes the command
1586
- and the verdict reads the values the refresh wrote, not the cached ones;
1587
- **fail-soft** — a non-zero stub leaves the snapshot byte-identical, the verdict
1588
- proceeds and the cached reading is judged STALE by the existing staleness
1589
- machinery, and no refresh diagnostic leaks into the relayed verdict line;
1590
- **short-circuit** — a snapshot under `DELEGATION_KIT_REFRESH_MIN_AGE` never invokes the
1591
- command. Armed and short-circuit are the firing/non-firing pair over the same
1592
- stub, so the absence proves the floor rather than a broken stub.
1593
-
1594
- The **roll witnesses** need a pre-seeded history tail the table's columns do
1595
- not carry, so they are asserted beside it too, over one fixed shape — a low
1596
- percentage with a credentials mtime inside the login window, which without a
1597
- witness is STALE. Both witnesses present verdicts OK; each of the four ways
1598
- the log can fail to answer holds the STALE — the boundary unmoved, the
1599
- previous boundary uncrossed, a tail with a non-numeric `resets_at`, and no
1600
- history at all. The two single-witness cases are the discriminating pair: they
1601
- prove the conjunction is load-bearing rather than either witness carrying it
1602
- alone. A sixth case asserts the read is not self-witnessing — a run with an
1603
- empty log still STALEs and leaves exactly its own sample behind, so the
1604
- witness can only ever be a previous reading.
1605
-
1606
- `usage-trend` is likewise not a gate (it renders no clean/violation
1607
- verdict), so it ships an assertion runner, `bin/run-trend-tests.sh`, over a
1608
- static fixture history `usage-tests/trend-history.log` (static epochs are
1609
- safe — the reporter measures within-segment deltas, never against *now*). It
1610
- asserts per-axis segmentation at a reset boundary, a `login_at` change, and
1611
- an account change; per-account grouping reuniting a weekly trajectory across
1612
- a switch-back; a spike-then-correction flagged and excluded rather than
1613
- averaged; token deltas and weekly headroom on the report; and the
1614
- fail-closed exits (knob unset / history missing → 2). No fixture pair owed —
1615
- neither script is a gate.
1616
-
1617
- `agent-budget-guard.sh` is a hook, not a gate, so it speaks exit-2 + hook
1618
- JSON rather than the gate output contract — and like the verdict it ships a
1619
- decision-table runner beside the verdict tests: `usage-tests/budget-guard-cases.tsv`
1620
- pairs an expected action (`block`/`advise`) with the same snapshot knobs
1621
- (`action pct age_off reset_off cred_age desc`, `pct=UNREADABLE` for the
1622
- no-snapshot case), and `bin/run-budget-guard-tests.sh` drives the *template*
1623
- with each injected snapshot — feeding an Agent hook JSON on stdin, pointing
1624
- `DELEGATION_KIT_USAGE_FILE` at the generated fixture — and classifies the
1625
- result: PAUSE → `block` (exit 2, verdict on stderr), OK/RESET-OK/STALE/unreadable
1626
- → `advise` (exit 0, verdict in `additionalContext`). The block branch carries
1627
- its firing (PAUSE) and non-firing (the four advise cases) — the fixture-pair
1628
- discipline again — and every case asserts the live verdict text rides the
1629
- output so a memory-quoted percentage cannot be the acting source.
1630
-
1631
- `agent-dispatch-guard.sh` takes its own decision-table lane rather than
1632
- guard-kit's `guard-tests/` (keyed on a command, or a to+message — neither can
1633
- express a dispatch's parameters, the same reason the budget guard has its own
1634
- runner) or the budget guard's table (a different payload grammar again):
1635
- `usage-tests/dispatch-guard-cases.tsv` pairs an expected outcome
1636
- (`block`/`advise`/`fallthrough`) with `subagent_type isolation nested desc`,
1637
- and `bin/run-dispatch-guard-tests.sh` drives the *template* with a built Agent
1638
- hook payload — `tool_input.subagent_type`/`.isolation`, and, for a nested case,
1639
- the top-level `agent_id`/`agent_type` the harness only sets inside a subagent —
1640
- classifying block (exit 2) / advise (exit 0, `additionalContext` present) /
1641
- fallthrough (exit 0, empty stdout). The table fixes one roster for its whole
1642
- run, `DELEGATION_KIT_READONLY_TYPES=(ro-type)`, supplied through a generated
1643
- config file and `DELEGATION_KIT_CONFIG_FILE`; a `subagent_type` prefixed
1644
- `noroster:` runs instead with no config file at all (an empty declare),
1645
- stripped before it reaches the guard — the row that proves D2 is inert on the
1646
- roster's *absence*, not merely on this dispatch's type missing from a
1647
- populated one. Every rule carries a firing and a non-firing case (the
1648
- fixture-pair discipline, transplanted): D1 — a fork blocks, a typed dispatch
1649
- under an empty roster does not; D2 — a rostered type without isolation blocks,
1650
- the same type with `isolation: worktree` does not, an unrostered type under a
1651
- populated roster does not, and the empty-roster case does not; D3 — a payload
1652
- carrying `agent_id` advises, one without it falls through. The degradation
1653
- posture gets its own case rather than being asserted only in prose: an
1654
- unparseable payload (`subagent_type` `UNPARSEABLE`, sent as invalid JSON on
1655
- stdin) advises rather than blocks — the assertion that makes delta 6's
1656
- fail-open-but-loud posture testable, not merely stated, and the one case this
1657
- lane must not drop for brevity. The runner strips ambient `DELEGATION_KIT_*` at
1658
- every invocation, the discipline `run-budget-guard-tests.sh` already uses, so a
1659
- consumer's live roster or config-file pointer cannot leak into the fixture.
1660
-
1661
- `smoke/install.sh` copies the templates and `bin/` tools into the scratch
1662
- consumer, registers the tamper gate, and drives one crafted snapshot
1663
- through `usage-verdict` asserting a verdict — self-verifying install. It opens
1664
- with **one hermetic env prelude covering the whole file**: it strips the whole
1665
- `DELEGATION_KIT_*` namespace and then sets the knobs with no per-call home —
1666
- sampling off, and both pause thresholds at the defaults the 95% reading is
1667
- judged against. A prelude rather than per-instance pins because
1668
- instance-pinning has already missed
1669
- once by construction: a pass that pinned the two knobs then biting left the
1670
- third, and the survivor was the one whose failure is **silent** — an
1671
- unpinned history path makes every smoke verdict append a synthetic sample
1672
- into whatever trend log the ambient config names, indistinguishable in shape
1673
- from a real operator reading. That this repo's runs happened not to pollute
1674
- was accidental, not designed: the harness runs the file with cwd = the
1675
- scratch consumer root and the configured history path is *relative*, so the
1676
- appends died with the scratch tree — hermeticity that evaporates the moment a
1677
- consumer configures an absolute path or the file is invoked from a real tree.
1678
- Stripping the whole namespace is the shape that cannot miss a third knob.
1679
- The credentials pin stays **at each invocation** rather than moving into the
1680
- prelude, because gate-sdk/SPEC.md §check-test-hermetic reads it there — a
1681
- line-local pin is evidence a reader and a gate can both see without tracing
1682
- file-level state — and the poller's own snapshot, credentials and endpoint
1683
- paths stay inline too, being genuine per-call arguments the prelude has no
1684
- business pre-empting. That
1685
- assertion is **code-specific**: the 95% guard captures the exit status and
1686
- compares it to the PAUSE code, reporting the status it observed rather than
1687
- claiming an outcome it did not establish, so a STALE regression cannot pass
1688
- under a "did not PAUSE" message (gate-sdk/SPEC.md
1689
- §check-assertion-strength, the gate for the class). It also
1690
- drives the poll producer through its `file://` stub seam: the happy path
1691
- writes a contract-valid snapshot (asserted by driving it through
1692
- `usage-verdict`), and a fetch failure exits non-zero leaving a pre-seeded
1693
- snapshot byte-identical — the fail-soft contract, exercised end to end.
1694
- `smoke/violation.sh` stages a gate edit co-staged with a product file in
1695
- the scratch consumer and asserts the battery reds (assertion A) — the
1696
- violation is craftable, so the file is mandatory
1697
- (gate-sdk/SPEC.md §Consumer smoke).
1698
-
1699
- ## Out of scope
1700
-
1701
- A consumer's validate battery (its compile/lint/test command set and rename
1702
- corruption sweeps), its shared-file roster, and its width/burn anecdotes tied
1703
- to specific sweeps are rule content, referenced only as marked-section
1704
- examples. A task-output tailer is not shipped: such a tool hardcodes local
1705
- harness paths and exists to violate the template's **Background + notification,
1706
- never poll** rule for debugging. The
1707
- `usage.txt` write contract and a reference producer rendering the gauge bars
1708
- and `iteration@stage` readout do ship (the producer's ANSI is self-contained,
1709
- pulling no external asset); a consumer's *particular* statusline styling and
1710
- any asset its own gauges pull are not the rendering mechanism and stay with
1711
- it. The split is protocol and mechanisms here, a consumer's rosters,
1712
- batteries, and bespoke UX in its own copies.