checkwright 0.0.1 → 0.17.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 (839) hide show
  1. package/README.md +260 -4
  2. package/bin/checkwright.sh +53 -0
  3. package/lib/common/lock.sh +28 -0
  4. package/lib/common/profile.sh +58 -0
  5. package/lib/common/recipe.sh +93 -0
  6. package/lib/doctor.sh +90 -0
  7. package/lib/init.sh +289 -0
  8. package/package.json +15 -3
  9. package/payload/canon-kit/README.md +78 -0
  10. package/payload/canon-kit/SPEC.md +1264 -0
  11. package/payload/canon-kit/checks/check-amendment-queue.sh +115 -0
  12. package/payload/canon-kit/checks/check-comment-tier.sh +211 -0
  13. package/payload/canon-kit/checks/check-deprecation-task.sh +90 -0
  14. package/payload/canon-kit/checks/check-docs-cmd.sh +153 -0
  15. package/payload/canon-kit/checks/check-docs-link-convention.sh +71 -0
  16. package/payload/canon-kit/checks/check-knob-citation.sh +117 -0
  17. package/payload/canon-kit/checks/check-knob-default-coupling.sh +239 -0
  18. package/payload/canon-kit/checks/check-manifest-count.sh +46 -0
  19. package/payload/canon-kit/checks/check-manifest-temporal.sh +83 -0
  20. package/payload/canon-kit/checks/check-md-refs.sh +115 -0
  21. package/payload/canon-kit/checks/check-prose-enum.sh +115 -0
  22. package/payload/canon-kit/checks/check-prose-tells.sh +207 -0
  23. package/payload/canon-kit/checks/check-spec-derivable-section.sh +69 -0
  24. package/payload/canon-kit/checks/check-spec-dod-singleton.sh +45 -0
  25. package/payload/canon-kit/checks/check-spec-embedded-source.sh +133 -0
  26. package/payload/canon-kit/checks/check-spec-fence-balance.sh +42 -0
  27. package/payload/canon-kit/checks/check-spec-pointer.sh +176 -0
  28. package/payload/canon-kit/checks/check-surface-duplication.sh +105 -0
  29. package/payload/canon-kit/checks/check-todo-task-liveness.sh +80 -0
  30. package/payload/canon-kit/checks/check-tracking-claim.sh +136 -0
  31. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/SPEC-tidy.md +5 -0
  32. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/TASK-QUEUE.md +15 -0
  33. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/expect.txt +1 -0
  34. package/payload/canon-kit/gate-tests/check-amendment-queue/good/SPEC-widget.md +6 -0
  35. package/payload/canon-kit/gate-tests/check-amendment-queue/good/TASK-QUEUE.md +15 -0
  36. package/payload/canon-kit/gate-tests/check-amendment-queue/good/expect.txt +1 -0
  37. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.sh +25 -0
  38. package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +1 -0
  39. package/payload/canon-kit/gate-tests/check-comment-tier/good/expect.txt +1 -0
  40. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +32 -0
  41. package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +146 -0
  42. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/TASK-QUEUE.md +19 -0
  43. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.sh +6 -0
  44. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/expect.txt +1 -0
  45. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.sh +5 -0
  46. package/payload/canon-kit/gate-tests/check-deprecation-task/good/TASK-QUEUE.md +21 -0
  47. package/payload/canon-kit/gate-tests/check-deprecation-task/good/expect.txt +1 -0
  48. package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.sh +5 -0
  49. package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.sh +5 -0
  50. package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +98 -0
  51. package/payload/canon-kit/gate-tests/check-docs-cmd/bad/args +1 -0
  52. package/payload/canon-kit/gate-tests/check-docs-cmd/bad/doc.md +9 -0
  53. package/payload/canon-kit/gate-tests/check-docs-cmd/bad/expect.txt +1 -0
  54. package/payload/canon-kit/gate-tests/check-docs-cmd/good/args +1 -0
  55. package/payload/canon-kit/gate-tests/check-docs-cmd/good/bin/tool.sh +3 -0
  56. package/payload/canon-kit/gate-tests/check-docs-cmd/good/doc.md +18 -0
  57. package/payload/canon-kit/gate-tests/check-docs-cmd/good/expect.txt +1 -0
  58. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/args +4 -0
  59. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/demokit/index.md +5 -0
  60. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/index.md +3 -0
  61. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/expect.txt +1 -0
  62. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/args +4 -0
  63. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/demokit/index.md +6 -0
  64. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/index.md +3 -0
  65. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +3 -0
  66. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/expect.txt +1 -0
  67. package/payload/canon-kit/gate-tests/check-knob-citation/bad/SPEC.md +10 -0
  68. package/payload/canon-kit/gate-tests/check-knob-citation/bad/expect.txt +1 -0
  69. package/payload/canon-kit/gate-tests/check-knob-citation/good/SPEC.md +19 -0
  70. package/payload/canon-kit/gate-tests/check-knob-citation/good/expect.txt +1 -0
  71. package/payload/canon-kit/gate-tests/check-knob-citation.test.sh +71 -0
  72. package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/expect.txt +1 -0
  73. package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/scripts/gate-sdk-config.sh +4 -0
  74. package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/widget-kit/SPEC.md +4 -0
  75. package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/widget-kit/lib/widget-cli.sh +3 -0
  76. package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/widget-kit/lib/widget.sh +5 -0
  77. package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/expect.txt +1 -0
  78. package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/scripts/gate-sdk-config.sh +5 -0
  79. package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/widget-kit/SPEC.md +7 -0
  80. package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/widget-kit/lib/widget-cli.sh +3 -0
  81. package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/widget-kit/lib/widget.sh +5 -0
  82. package/payload/canon-kit/gate-tests/check-knob-default-coupling.test.sh +73 -0
  83. package/payload/canon-kit/gate-tests/check-manifest-count/bad/SPEC.md +15 -0
  84. package/payload/canon-kit/gate-tests/check-manifest-count/bad/expect.txt +1 -0
  85. package/payload/canon-kit/gate-tests/check-manifest-count/good/SPEC.md +37 -0
  86. package/payload/canon-kit/gate-tests/check-manifest-count/good/expect.txt +1 -0
  87. package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +104 -0
  88. package/payload/canon-kit/gate-tests/check-manifest-temporal/bad/SPEC.md +6 -0
  89. package/payload/canon-kit/gate-tests/check-manifest-temporal/bad/expect.txt +1 -0
  90. package/payload/canon-kit/gate-tests/check-manifest-temporal/good/SPEC.md +17 -0
  91. package/payload/canon-kit/gate-tests/check-manifest-temporal/good/expect.txt +1 -0
  92. package/payload/canon-kit/gate-tests/check-md-refs/bad/args +1 -0
  93. package/payload/canon-kit/gate-tests/check-md-refs/bad/doc.md +3 -0
  94. package/payload/canon-kit/gate-tests/check-md-refs/bad/expect.txt +1 -0
  95. package/payload/canon-kit/gate-tests/check-md-refs/good/args +1 -0
  96. package/payload/canon-kit/gate-tests/check-md-refs/good/doc.md +3 -0
  97. package/payload/canon-kit/gate-tests/check-md-refs/good/expect.txt +1 -0
  98. package/payload/canon-kit/gate-tests/check-md-refs/good/target.md +1 -0
  99. package/payload/canon-kit/gate-tests/check-md-refs.test.sh +82 -0
  100. package/payload/canon-kit/gate-tests/check-prose-enum/bad/SPEC.md +4 -0
  101. package/payload/canon-kit/gate-tests/check-prose-enum/bad/expect.txt +1 -0
  102. package/payload/canon-kit/gate-tests/check-prose-enum/bad/scripts/canon-config.sh +4 -0
  103. package/payload/canon-kit/gate-tests/check-prose-enum/good/SPEC.md +16 -0
  104. package/payload/canon-kit/gate-tests/check-prose-enum/good/expect.txt +1 -0
  105. package/payload/canon-kit/gate-tests/check-prose-enum/good/scripts/canon-config.sh +4 -0
  106. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +127 -0
  107. package/payload/canon-kit/gate-tests/check-prose-tells/bad/expect.txt +1 -0
  108. package/payload/canon-kit/gate-tests/check-prose-tells/bad/prose.md +15 -0
  109. package/payload/canon-kit/gate-tests/check-prose-tells/bad/scripts/canon-config.sh +8 -0
  110. package/payload/canon-kit/gate-tests/check-prose-tells/good/expect.txt +1 -0
  111. package/payload/canon-kit/gate-tests/check-prose-tells/good/prose.md +21 -0
  112. package/payload/canon-kit/gate-tests/check-prose-tells/good/scripts/canon-config.sh +8 -0
  113. package/payload/canon-kit/gate-tests/check-spec-derivable-section/bad/SPEC.md +20 -0
  114. package/payload/canon-kit/gate-tests/check-spec-derivable-section/bad/expect.txt +1 -0
  115. package/payload/canon-kit/gate-tests/check-spec-derivable-section/good/SPEC.md +13 -0
  116. package/payload/canon-kit/gate-tests/check-spec-derivable-section/good/expect.txt +1 -0
  117. package/payload/canon-kit/gate-tests/check-spec-dod-singleton/bad/SPEC.md +15 -0
  118. package/payload/canon-kit/gate-tests/check-spec-dod-singleton/bad/expect.txt +1 -0
  119. package/payload/canon-kit/gate-tests/check-spec-dod-singleton/good/SPEC.md +13 -0
  120. package/payload/canon-kit/gate-tests/check-spec-dod-singleton/good/expect.txt +1 -0
  121. package/payload/canon-kit/gate-tests/check-spec-dod-singleton.test.sh +63 -0
  122. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/SPEC.md +16 -0
  123. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/expect.txt +1 -0
  124. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/widget.sh +9 -0
  125. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/SPEC.md +19 -0
  126. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/expect.txt +1 -0
  127. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/widget.sh +9 -0
  128. package/payload/canon-kit/gate-tests/check-spec-fence-balance/bad/args +1 -0
  129. package/payload/canon-kit/gate-tests/check-spec-fence-balance/bad/doc.md +8 -0
  130. package/payload/canon-kit/gate-tests/check-spec-fence-balance/bad/expect.txt +1 -0
  131. package/payload/canon-kit/gate-tests/check-spec-fence-balance/good/args +1 -0
  132. package/payload/canon-kit/gate-tests/check-spec-fence-balance/good/doc.md +9 -0
  133. package/payload/canon-kit/gate-tests/check-spec-fence-balance/good/expect.txt +1 -0
  134. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/README.md +4 -0
  135. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/SPEC-target.md +6 -0
  136. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/SPEC-widget.md +5 -0
  137. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/cand-tmpl.md +5 -0
  138. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +1 -0
  139. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/scripts/canon-config.sh +5 -0
  140. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +5 -0
  141. package/payload/canon-kit/gate-tests/check-spec-pointer/good/README.md +4 -0
  142. package/payload/canon-kit/gate-tests/check-spec-pointer/good/SPEC-target.md +6 -0
  143. package/payload/canon-kit/gate-tests/check-spec-pointer/good/SPEC-widget.md +5 -0
  144. package/payload/canon-kit/gate-tests/check-spec-pointer/good/cand-tmpl.md +7 -0
  145. package/payload/canon-kit/gate-tests/check-spec-pointer/good/expect.txt +1 -0
  146. package/payload/canon-kit/gate-tests/check-spec-pointer/good/scripts/canon-config.sh +5 -0
  147. package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +6 -0
  148. package/payload/canon-kit/gate-tests/check-surface-duplication/bad/GLOSSARY.md +11 -0
  149. package/payload/canon-kit/gate-tests/check-surface-duplication/bad/VISION.md +6 -0
  150. package/payload/canon-kit/gate-tests/check-surface-duplication/bad/expect.txt +1 -0
  151. package/payload/canon-kit/gate-tests/check-surface-duplication/good/GLOSSARY.md +11 -0
  152. package/payload/canon-kit/gate-tests/check-surface-duplication/good/VISION.md +6 -0
  153. package/payload/canon-kit/gate-tests/check-surface-duplication/good/expect.txt +1 -0
  154. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/TASK-QUEUE.md +19 -0
  155. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.sh +5 -0
  156. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/expect.txt +1 -0
  157. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/TASK-QUEUE.md +23 -0
  158. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/expect.txt +1 -0
  159. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.sh +5 -0
  160. package/payload/canon-kit/gate-tests/check-tracking-claim/bad/README.md +4 -0
  161. package/payload/canon-kit/gate-tests/check-tracking-claim/bad/args +1 -0
  162. package/payload/canon-kit/gate-tests/check-tracking-claim/bad/expect.txt +1 -0
  163. package/payload/canon-kit/gate-tests/check-tracking-claim/bad/kept.txt +1 -0
  164. package/payload/canon-kit/gate-tests/check-tracking-claim/good/README.md +7 -0
  165. package/payload/canon-kit/gate-tests/check-tracking-claim/good/args +1 -0
  166. package/payload/canon-kit/gate-tests/check-tracking-claim/good/expect.txt +1 -0
  167. package/payload/canon-kit/gate-tests/check-tracking-claim/good/kept.txt +1 -0
  168. package/payload/canon-kit/gate-tests/check-tracking-claim/good/roster.list +1 -0
  169. package/payload/canon-kit/gate-tests/check-tracking-claim.test.sh +86 -0
  170. package/payload/canon-kit/lib/spec.sh +475 -0
  171. package/payload/canon-kit/smoke/install.sh +36 -0
  172. package/payload/canon-kit/smoke/violation.sh +22 -0
  173. package/payload/canon-kit/templates/SPEC-amendment.md +55 -0
  174. package/payload/canon-kit/templates/canon-config.sh +2 -0
  175. package/payload/context-kit/README.md +82 -0
  176. package/payload/context-kit/SPEC.md +785 -0
  177. package/payload/context-kit/bin/always-loaded.sh +86 -0
  178. package/payload/context-kit/bin/env-probe.sh +144 -0
  179. package/payload/context-kit/bin/footprint.sh +144 -0
  180. package/payload/context-kit/bin/md-index.sh +80 -0
  181. package/payload/context-kit/bin/md-section.sh +63 -0
  182. package/payload/context-kit/bin/pub-index.sh +90 -0
  183. package/payload/context-kit/bin/run-index-tests.sh +91 -0
  184. package/payload/context-kit/checks/check-brevity.sh +123 -0
  185. package/payload/context-kit/checks/check-footprint-fresh.sh +38 -0
  186. package/payload/context-kit/checks/check-memory-off.sh +112 -0
  187. package/payload/context-kit/checks/check-settings-pins.sh +110 -0
  188. package/payload/context-kit/gate-tests/check-brevity/bad/CLAUDE.md +14 -0
  189. package/payload/context-kit/gate-tests/check-brevity/bad/args +2 -0
  190. package/payload/context-kit/gate-tests/check-brevity/bad/expect.txt +1 -0
  191. package/payload/context-kit/gate-tests/check-brevity/good/CLAUDE.md +20 -0
  192. package/payload/context-kit/gate-tests/check-brevity/good/args +2 -0
  193. package/payload/context-kit/gate-tests/check-brevity/good/expect.txt +1 -0
  194. package/payload/context-kit/gate-tests/check-brevity.test.sh +89 -0
  195. package/payload/context-kit/gate-tests/check-footprint-fresh/bad/args +4 -0
  196. package/payload/context-kit/gate-tests/check-footprint-fresh/bad/emit.txt +12 -0
  197. package/payload/context-kit/gate-tests/check-footprint-fresh/bad/expect.txt +1 -0
  198. package/payload/context-kit/gate-tests/check-footprint-fresh/bad/projection.txt +11 -0
  199. package/payload/context-kit/gate-tests/check-footprint-fresh/good/args +4 -0
  200. package/payload/context-kit/gate-tests/check-footprint-fresh/good/emit.txt +12 -0
  201. package/payload/context-kit/gate-tests/check-footprint-fresh/good/expect.txt +1 -0
  202. package/payload/context-kit/gate-tests/check-footprint-fresh/good/projection.txt +12 -0
  203. package/payload/context-kit/gate-tests/check-memory-off/bad/args +1 -0
  204. package/payload/context-kit/gate-tests/check-memory-off/bad/expect.txt +1 -0
  205. package/payload/context-kit/gate-tests/check-memory-off/bad/memory/example-fact.md +6 -0
  206. package/payload/context-kit/gate-tests/check-memory-off/good/args +1 -0
  207. package/payload/context-kit/gate-tests/check-memory-off/good/expect.txt +1 -0
  208. package/payload/context-kit/gate-tests/check-memory-off/good/memory/.gitkeep +0 -0
  209. package/payload/context-kit/gate-tests/check-memory-off.test.sh +54 -0
  210. package/payload/context-kit/gate-tests/check-settings-pins/bad/args +1 -0
  211. package/payload/context-kit/gate-tests/check-settings-pins/bad/expect.txt +1 -0
  212. package/payload/context-kit/gate-tests/check-settings-pins/bad/settings-pins.conf +3 -0
  213. package/payload/context-kit/gate-tests/check-settings-pins/bad/settings.json +6 -0
  214. package/payload/context-kit/gate-tests/check-settings-pins/good/args +1 -0
  215. package/payload/context-kit/gate-tests/check-settings-pins/good/expect.txt +1 -0
  216. package/payload/context-kit/gate-tests/check-settings-pins/good/settings-pins.conf +3 -0
  217. package/payload/context-kit/gate-tests/check-settings-pins/good/settings.json +6 -0
  218. package/payload/context-kit/index-tests/corpus/baseline.txt +2 -0
  219. package/payload/context-kit/index-tests/corpus/hook-sample.txt +4 -0
  220. package/payload/context-kit/index-tests/corpus/sample.md +23 -0
  221. package/payload/context-kit/index-tests/corpus/sample.rs +24 -0
  222. package/payload/context-kit/index-tests/corpus/sample.ts +34 -0
  223. package/payload/context-kit/index-tests/corpus/surface.md +6 -0
  224. package/payload/context-kit/index-tests/expected/always-loaded.txt +1 -0
  225. package/payload/context-kit/index-tests/expected/md-index.txt +6 -0
  226. package/payload/context-kit/index-tests/expected/md-section.txt +6 -0
  227. package/payload/context-kit/index-tests/expected/pub-index-shadow.txt +2 -0
  228. package/payload/context-kit/index-tests/expected/pub-index-ts.txt +12 -0
  229. package/payload/context-kit/index-tests/expected/pub-index.txt +10 -0
  230. package/payload/context-kit/index-tests/expected/toolfloor.txt +14 -0
  231. package/payload/context-kit/index-tests/toolfloor-cases.sh +29 -0
  232. package/payload/context-kit/lib/pub-lang/rust.sh +26 -0
  233. package/payload/context-kit/lib/pub-lang/ts.sh +32 -0
  234. package/payload/context-kit/lib/toolfloor.sh +47 -0
  235. package/payload/context-kit/smoke/agents-md.sh +116 -0
  236. package/payload/context-kit/smoke/install.sh +60 -0
  237. package/payload/context-kit/smoke/violation.sh +21 -0
  238. package/payload/context-kit/templates/close-brevity.md +30 -0
  239. package/payload/context-kit/templates/context-config.sh +2 -0
  240. package/payload/context-kit/templates/session-context.sh +133 -0
  241. package/payload/context-kit/templates/settings-sessionstart.json +12 -0
  242. package/payload/delegation-kit/README.md +87 -0
  243. package/payload/delegation-kit/SPEC.md +780 -0
  244. package/payload/delegation-kit/bin/run-budget-guard-tests.sh +88 -0
  245. package/payload/delegation-kit/bin/run-trend-tests.sh +63 -0
  246. package/payload/delegation-kit/bin/run-usage-tests.sh +226 -0
  247. package/payload/delegation-kit/bin/usage-trend.sh +120 -0
  248. package/payload/delegation-kit/bin/usage-verdict.sh +144 -0
  249. package/payload/delegation-kit/checks/check-gate-tamper.sh +139 -0
  250. package/payload/delegation-kit/checks/check-rule-citation.sh +76 -0
  251. package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/args +1 -0
  252. package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/expect.txt +1 -0
  253. package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/staged-files +5 -0
  254. package/payload/delegation-kit/gate-tests/check-gate-tamper/good/added-exemptions +2 -0
  255. package/payload/delegation-kit/gate-tests/check-gate-tamper/good/args +1 -0
  256. package/payload/delegation-kit/gate-tests/check-gate-tamper/good/expect.txt +1 -0
  257. package/payload/delegation-kit/gate-tests/check-gate-tamper/good/staged-files +5 -0
  258. package/payload/delegation-kit/gate-tests/check-rule-citation/bad/args +1 -0
  259. package/payload/delegation-kit/gate-tests/check-rule-citation/bad/expect.txt +1 -0
  260. package/payload/delegation-kit/gate-tests/check-rule-citation/bad/spec.md +9 -0
  261. package/payload/delegation-kit/gate-tests/check-rule-citation/bad/tmpl.md +4 -0
  262. package/payload/delegation-kit/gate-tests/check-rule-citation/good/args +1 -0
  263. package/payload/delegation-kit/gate-tests/check-rule-citation/good/expect.txt +1 -0
  264. package/payload/delegation-kit/gate-tests/check-rule-citation/good/spec.md +20 -0
  265. package/payload/delegation-kit/gate-tests/check-rule-citation/good/tmpl.md +5 -0
  266. package/payload/delegation-kit/lib/delegation.sh +81 -0
  267. package/payload/delegation-kit/smoke/install.sh +61 -0
  268. package/payload/delegation-kit/smoke/violation.sh +16 -0
  269. package/payload/delegation-kit/templates/agent-budget-guard.sh +18 -0
  270. package/payload/delegation-kit/templates/agent-execution.md +136 -0
  271. package/payload/delegation-kit/templates/delegation-config.sh +2 -0
  272. package/payload/delegation-kit/templates/dispatch-checklists.md +60 -0
  273. package/payload/delegation-kit/templates/statusline-usage.sh +79 -0
  274. package/payload/delegation-kit/templates/usage-poller.sh +67 -0
  275. package/payload/delegation-kit/usage-tests/budget-guard-cases.tsv +20 -0
  276. package/payload/delegation-kit/usage-tests/cases.tsv +44 -0
  277. package/payload/delegation-kit/usage-tests/trend-history.log +20 -0
  278. package/payload/doctrine-kit/DOCTRINE.md +386 -0
  279. package/payload/doctrine-kit/README.md +70 -0
  280. package/payload/doctrine-kit/SPEC.md +233 -0
  281. package/payload/doctrine-kit/bin/install-doctrine.sh +44 -0
  282. package/payload/doctrine-kit/bin/stage-rules.sh +51 -0
  283. package/payload/doctrine-kit/checks/check-doctrine-registration.sh +216 -0
  284. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/AGENT.md +14 -0
  285. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/DOCTRINE.md +12 -0
  286. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/args +1 -0
  287. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/expect.txt +1 -0
  288. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/AGENT.md +15 -0
  289. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/DOCTRINE.md +12 -0
  290. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/args +1 -0
  291. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/expect.txt +1 -0
  292. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +208 -0
  293. package/payload/doctrine-kit/lib/doctrine.sh +29 -0
  294. package/payload/doctrine-kit/smoke/install.sh +24 -0
  295. package/payload/doctrine-kit/smoke/violation.sh +13 -0
  296. package/payload/drift-kit/README.md +115 -0
  297. package/payload/drift-kit/SPEC.md +828 -0
  298. package/payload/drift-kit/bin/drift-report.sh +152 -0
  299. package/payload/drift-kit/bin/kfric.sh +42 -0
  300. package/payload/drift-kit/bin/overhead-meter.sh +106 -0
  301. package/payload/drift-kit/bin/stage-economics.sh +311 -0
  302. package/payload/drift-kit/bin/trajectory.sh +242 -0
  303. package/payload/drift-kit/kpis/kpi-always-loaded.sh +39 -0
  304. package/payload/drift-kit/kpis/kpi-amendment-age.sh +33 -0
  305. package/payload/drift-kit/kpis/kpi-deferred-age.sh +44 -0
  306. package/payload/drift-kit/kpis/kpi-gate-backlog.sh +52 -0
  307. package/payload/drift-kit/kpis/kpi-gate-runtime.sh +31 -0
  308. package/payload/drift-kit/kpis/kpi-knowledge-friction.sh +21 -0
  309. package/payload/drift-kit/kpis/kpi-overhead.sh +44 -0
  310. package/payload/drift-kit/kpis/kpi-price-table-age.sh +68 -0
  311. package/payload/drift-kit/kpis/kpi-prompt-friction.sh +38 -0
  312. package/payload/drift-kit/kpis/kpi-settings-local.sh +21 -0
  313. package/payload/drift-kit/kpis/kpi-task-split.sh +43 -0
  314. package/payload/drift-kit/smoke/install.sh +348 -0
  315. package/payload/drift-kit/smoke/overhead-fixture.jsonl +4 -0
  316. package/payload/drift-kit/templates/close-knowledge.md +24 -0
  317. package/payload/drift-kit/templates/drift-config.sh +2 -0
  318. package/payload/drift-kit/templates/economics.md +45 -0
  319. package/payload/drift-kit/templates/kpi-deprecated-surface.sh +32 -0
  320. package/payload/drift-kit/templates/kpis.list +22 -0
  321. package/payload/drift-kit/templates/price-table.tsv +21 -0
  322. package/payload/evidence-kit/README.md +59 -0
  323. package/payload/evidence-kit/SPEC.md +261 -0
  324. package/payload/evidence-kit/bin/diff-baseline.sh +34 -0
  325. package/payload/evidence-kit/bin/run-validate.sh +82 -0
  326. package/payload/evidence-kit/checks/check-evidence-baseline.sh +103 -0
  327. package/payload/evidence-kit/checks/check-evidence-manifest.sh +104 -0
  328. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/TASK-QUEUE.md +3 -0
  329. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/args +2 -0
  330. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/expect.txt +1 -0
  331. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/validate-baseline.txt +3 -0
  332. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/TASK-QUEUE.md +3 -0
  333. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/args +2 -0
  334. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/expect.txt +1 -0
  335. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/validate-baseline.txt +3 -0
  336. package/payload/evidence-kit/gate-tests/check-evidence-baseline.test.sh +84 -0
  337. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/TASK-QUEUE.md +1 -0
  338. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/WORKFLOW-STATE.txt +3 -0
  339. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/args +3 -0
  340. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/expect.txt +1 -0
  341. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/validate-evidence.txt +2 -0
  342. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/TASK-QUEUE.md +1 -0
  343. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/WORKFLOW-STATE.txt +3 -0
  344. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/args +3 -0
  345. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/expect.txt +1 -0
  346. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/validate-evidence.txt +2 -0
  347. package/payload/evidence-kit/gate-tests/check-evidence-manifest.test.sh +107 -0
  348. package/payload/evidence-kit/gate-tests/evidence-lib.test.sh +82 -0
  349. package/payload/evidence-kit/lib/evidence.sh +173 -0
  350. package/payload/evidence-kit/smoke/install.sh +45 -0
  351. package/payload/evidence-kit/smoke/violation.sh +8 -0
  352. package/payload/evidence-kit/templates/evidence-config.sh +2 -0
  353. package/payload/gate-sdk/README.md +124 -0
  354. package/payload/gate-sdk/SPEC.md +1861 -0
  355. package/payload/gate-sdk/bin/enforcement-map.sh +272 -0
  356. package/payload/gate-sdk/bin/gen-pre-commit.sh +267 -0
  357. package/payload/gate-sdk/bin/install-hooks.sh +48 -0
  358. package/payload/gate-sdk/bin/run-consumer-smoke.sh +112 -0
  359. package/payload/gate-sdk/bin/run-gate-tests.sh +128 -0
  360. package/payload/gate-sdk/bin/run-gates.sh +147 -0
  361. package/payload/gate-sdk/bin/upgrade-smoke.sh +163 -0
  362. package/payload/gate-sdk/checks/check-action-pinning.sh +55 -0
  363. package/payload/gate-sdk/checks/check-action-run-shell.sh +219 -0
  364. package/payload/gate-sdk/checks/check-assertion-strength.sh +134 -0
  365. package/payload/gate-sdk/checks/check-commit-msg.sh +50 -0
  366. package/payload/gate-sdk/checks/check-commit-subject.sh +43 -0
  367. package/payload/gate-sdk/checks/check-core-files.sh +52 -0
  368. package/payload/gate-sdk/checks/check-enforcement-fresh.sh +37 -0
  369. package/payload/gate-sdk/checks/check-exec-bit.sh +76 -0
  370. package/payload/gate-sdk/checks/check-gate-assertions.sh +123 -0
  371. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +106 -0
  372. package/payload/gate-sdk/checks/check-gate-fail-closed.sh +84 -0
  373. package/payload/gate-sdk/checks/check-gate-fixture-coverage.sh +92 -0
  374. package/payload/gate-sdk/checks/check-gate-output.sh +65 -0
  375. package/payload/gate-sdk/checks/check-graph.sh +632 -0
  376. package/payload/gate-sdk/checks/check-hook-exec-bit.sh +45 -0
  377. package/payload/gate-sdk/checks/check-identity.sh +134 -0
  378. package/payload/gate-sdk/checks/check-kit-enum.sh +94 -0
  379. package/payload/gate-sdk/checks/check-kit-registration.sh +68 -0
  380. package/payload/gate-sdk/checks/check-readme-roster.sh +102 -0
  381. package/payload/gate-sdk/checks/check-reads-couples.sh +148 -0
  382. package/payload/gate-sdk/checks/check-root-tiering.sh +66 -0
  383. package/payload/gate-sdk/checks/check-shellcheck.sh +55 -0
  384. package/payload/gate-sdk/checks/check-smoke-entry-guard.sh +53 -0
  385. package/payload/gate-sdk/checks/check-template-copy-parity.sh +126 -0
  386. package/payload/gate-sdk/checks/check-test-hermetic.sh +119 -0
  387. package/payload/gate-sdk/checks/check-tree-terms.sh +61 -0
  388. package/payload/gate-sdk/checks/check-workflow-tiering.sh +84 -0
  389. package/payload/gate-sdk/gate-tests/check-action-pinning/bad/args +1 -0
  390. package/payload/gate-sdk/gate-tests/check-action-pinning/bad/expect.txt +1 -0
  391. package/payload/gate-sdk/gate-tests/check-action-pinning/bad/tree/mutable.yml +11 -0
  392. package/payload/gate-sdk/gate-tests/check-action-pinning/bad/tree/nested/pinned.yml +5 -0
  393. package/payload/gate-sdk/gate-tests/check-action-pinning/good/args +1 -0
  394. package/payload/gate-sdk/gate-tests/check-action-pinning/good/expect.txt +1 -0
  395. package/payload/gate-sdk/gate-tests/check-action-pinning/good/tree/nested/deep.yml +5 -0
  396. package/payload/gate-sdk/gate-tests/check-action-pinning/good/tree/no-refs.yaml +8 -0
  397. package/payload/gate-sdk/gate-tests/check-action-pinning/good/tree/pinned.yml +10 -0
  398. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/args +3 -0
  399. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/expect.txt +1 -0
  400. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/tree/workflows/ci.yml +15 -0
  401. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/args +3 -0
  402. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/expect.txt +1 -0
  403. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/action.yml +14 -0
  404. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/not-actions.yml +16 -0
  405. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/workflows/ci.yml +106 -0
  406. package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +88 -0
  407. package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/args +3 -0
  408. package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/bin/verdict.sh +5 -0
  409. package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/expect.txt +1 -0
  410. package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/smoke/install.sh +11 -0
  411. package/payload/gate-sdk/gate-tests/check-assertion-strength/good/args +3 -0
  412. package/payload/gate-sdk/gate-tests/check-assertion-strength/good/bin/verdict.sh +5 -0
  413. package/payload/gate-sdk/gate-tests/check-assertion-strength/good/expect.txt +1 -0
  414. package/payload/gate-sdk/gate-tests/check-assertion-strength/good/smoke/install.sh +16 -0
  415. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/args +2 -0
  416. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/expect.txt +1 -0
  417. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/msg.txt +5 -0
  418. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/patterns.list +5 -0
  419. package/payload/gate-sdk/gate-tests/check-commit-msg/good/args +2 -0
  420. package/payload/gate-sdk/gate-tests/check-commit-msg/good/expect.txt +1 -0
  421. package/payload/gate-sdk/gate-tests/check-commit-msg/good/msg.txt +5 -0
  422. package/payload/gate-sdk/gate-tests/check-commit-msg/good/patterns.list +5 -0
  423. package/payload/gate-sdk/gate-tests/check-commit-subject/bad/args +2 -0
  424. package/payload/gate-sdk/gate-tests/check-commit-subject/bad/expect.txt +1 -0
  425. package/payload/gate-sdk/gate-tests/check-commit-subject/bad/msg.txt +4 -0
  426. package/payload/gate-sdk/gate-tests/check-commit-subject/good/args +2 -0
  427. package/payload/gate-sdk/gate-tests/check-commit-subject/good/expect.txt +1 -0
  428. package/payload/gate-sdk/gate-tests/check-commit-subject/good/msg.txt +5 -0
  429. package/payload/gate-sdk/gate-tests/check-commit-subject.test.sh +73 -0
  430. package/payload/gate-sdk/gate-tests/check-core-files/bad/args +1 -0
  431. package/payload/gate-sdk/gate-tests/check-core-files/bad/core-files.list +3 -0
  432. package/payload/gate-sdk/gate-tests/check-core-files/bad/expect.txt +1 -0
  433. package/payload/gate-sdk/gate-tests/check-core-files/bad/present.txt +1 -0
  434. package/payload/gate-sdk/gate-tests/check-core-files/good/args +1 -0
  435. package/payload/gate-sdk/gate-tests/check-core-files/good/core-files.list +5 -0
  436. package/payload/gate-sdk/gate-tests/check-core-files/good/expect.txt +1 -0
  437. package/payload/gate-sdk/gate-tests/check-core-files/good/nested/also-present.txt +1 -0
  438. package/payload/gate-sdk/gate-tests/check-core-files/good/present.txt +1 -0
  439. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/args +4 -0
  440. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/emit.txt +14 -0
  441. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/expect.txt +1 -0
  442. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/projection.txt +7 -0
  443. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/args +4 -0
  444. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/emit.txt +14 -0
  445. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/expect.txt +1 -0
  446. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/projection.txt +14 -0
  447. package/payload/gate-sdk/gate-tests/check-exec-bit/bad/args +1 -0
  448. package/payload/gate-sdk/gate-tests/check-exec-bit/bad/dump.txt +7 -0
  449. package/payload/gate-sdk/gate-tests/check-exec-bit/bad/expect.txt +1 -0
  450. package/payload/gate-sdk/gate-tests/check-exec-bit/good/args +1 -0
  451. package/payload/gate-sdk/gate-tests/check-exec-bit/good/dump.txt +7 -0
  452. package/payload/gate-sdk/gate-tests/check-exec-bit/good/expect.txt +1 -0
  453. package/payload/gate-sdk/gate-tests/check-exec-bit.test.sh +46 -0
  454. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/args +1 -0
  455. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/expect.txt +1 -0
  456. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/SPEC.md +13 -0
  457. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-baz.sh +13 -0
  458. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-foo.sh +10 -0
  459. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/args +1 -0
  460. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -0
  461. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/SPEC.md +20 -0
  462. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/check-baz.sh +12 -0
  463. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/check-foo.sh +9 -0
  464. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +9 -0
  465. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/args +1 -0
  466. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +1 -0
  467. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +11 -0
  468. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/TASK-QUEUE.md +9 -0
  469. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/args +1 -0
  470. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
  471. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/gates/check-sample.sh +11 -0
  472. package/payload/gate-sdk/gate-tests/check-gate-fail-closed/bad/args +1 -0
  473. package/payload/gate-sdk/gate-tests/check-gate-fail-closed/bad/expect.txt +1 -0
  474. package/payload/gate-sdk/gate-tests/check-gate-fail-closed/bad/gates/check-sample.sh +8 -0
  475. package/payload/gate-sdk/gate-tests/check-gate-fail-closed/good/args +1 -0
  476. package/payload/gate-sdk/gate-tests/check-gate-fail-closed/good/expect.txt +1 -0
  477. package/payload/gate-sdk/gate-tests/check-gate-fail-closed/good/gates/check-sample.sh +8 -0
  478. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/args +1 -0
  479. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/check-gamma.sh +4 -0
  480. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/expect.txt +1 -0
  481. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/gate-tests/check-alpha/bad/.keep +0 -0
  482. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/gate-tests/check-alpha/good/.keep +0 -0
  483. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/gates.list +4 -0
  484. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/args +1 -0
  485. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/check-beta.sh +5 -0
  486. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/expect.txt +1 -0
  487. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/gate-tests/check-alpha/bad/.keep +0 -0
  488. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/gate-tests/check-alpha/good/.keep +0 -0
  489. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/gates.list +5 -0
  490. package/payload/gate-sdk/gate-tests/check-gate-output/bad/args +1 -0
  491. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +4 -0
  492. package/payload/gate-sdk/gate-tests/check-gate-output/bad/expect.txt +1 -0
  493. package/payload/gate-sdk/gate-tests/check-gate-output/bad/gates.list +2 -0
  494. package/payload/gate-sdk/gate-tests/check-gate-output/good/args +1 -0
  495. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +9 -0
  496. package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
  497. package/payload/gate-sdk/gate-tests/check-gate-output/good/gates.list +3 -0
  498. package/payload/gate-sdk/gate-tests/check-graph/bad/SPEC-example-gate.md +12 -0
  499. package/payload/gate-sdk/gate-tests/check-graph/bad/args +1 -0
  500. package/payload/gate-sdk/gate-tests/check-graph/bad/expect.txt +1 -0
  501. package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-example-gate.md +20 -0
  502. package/payload/gate-sdk/gate-tests/check-graph/good/args +3 -0
  503. package/payload/gate-sdk/gate-tests/check-graph/good/expect.txt +1 -0
  504. package/payload/gate-sdk/gate-tests/check-graph-cap.test.sh +51 -0
  505. package/payload/gate-sdk/gate-tests/check-graph-refs.test.sh +55 -0
  506. package/payload/gate-sdk/gate-tests/check-graph-theme.test.sh +63 -0
  507. package/payload/gate-sdk/gate-tests/check-hook-exec-bit/bad/args +1 -0
  508. package/payload/gate-sdk/gate-tests/check-hook-exec-bit/bad/expect.txt +1 -0
  509. package/payload/gate-sdk/gate-tests/check-hook-exec-bit/bad/hooks/pre-commit +2 -0
  510. package/payload/gate-sdk/gate-tests/check-hook-exec-bit/good/args +1 -0
  511. package/payload/gate-sdk/gate-tests/check-hook-exec-bit/good/expect.txt +1 -0
  512. package/payload/gate-sdk/gate-tests/check-hook-exec-bit/good/hooks/pre-commit +2 -0
  513. package/payload/gate-sdk/gate-tests/check-identity/bad/args +1 -0
  514. package/payload/gate-sdk/gate-tests/check-identity/bad/expect.txt +1 -0
  515. package/payload/gate-sdk/gate-tests/check-identity/bad/git-config-email +1 -0
  516. package/payload/gate-sdk/gate-tests/check-identity/bad/git-remotes +2 -0
  517. package/payload/gate-sdk/gate-tests/check-identity/bad/identity.conf +4 -0
  518. package/payload/gate-sdk/gate-tests/check-identity/good/args +1 -0
  519. package/payload/gate-sdk/gate-tests/check-identity/good/expect.txt +1 -0
  520. package/payload/gate-sdk/gate-tests/check-identity/good/git-config-email +1 -0
  521. package/payload/gate-sdk/gate-tests/check-identity/good/git-remotes +3 -0
  522. package/payload/gate-sdk/gate-tests/check-identity/good/identity.conf +5 -0
  523. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/args +1 -0
  524. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/check-sample.sh +5 -0
  525. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/expect.txt +1 -0
  526. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/gates.list +4 -0
  527. package/payload/gate-sdk/gate-tests/check-kit-enum/good/args +1 -0
  528. package/payload/gate-sdk/gate-tests/check-kit-enum/good/check-sample.sh +5 -0
  529. package/payload/gate-sdk/gate-tests/check-kit-enum/good/expect.txt +1 -0
  530. package/payload/gate-sdk/gate-tests/check-kit-enum/good/gates.list +3 -0
  531. package/payload/gate-sdk/gate-tests/check-kit-registration/bad/args +4 -0
  532. package/payload/gate-sdk/gate-tests/check-kit-registration/bad/expect.txt +1 -0
  533. package/payload/gate-sdk/gate-tests/check-kit-registration/bad/registry-doc.md +20 -0
  534. package/payload/gate-sdk/gate-tests/check-kit-registration/good/args +5 -0
  535. package/payload/gate-sdk/gate-tests/check-kit-registration/good/expect.txt +1 -0
  536. package/payload/gate-sdk/gate-tests/check-kit-registration.test.sh +75 -0
  537. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/alpha-kit/README.md +14 -0
  538. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/alpha-kit/checks/check-alpha-one.sh +3 -0
  539. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/alpha-kit/checks/check-alpha-two.sh +3 -0
  540. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/args +4 -0
  541. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/expect.txt +1 -0
  542. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/gamma-kit/README.md +5 -0
  543. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/gamma-kit/checks/check-gamma-one.sh +3 -0
  544. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.sh +5 -0
  545. package/payload/gate-sdk/gate-tests/check-readme-roster/good/alpha-kit/README.md +16 -0
  546. package/payload/gate-sdk/gate-tests/check-readme-roster/good/alpha-kit/checks/check-alpha-one.sh +3 -0
  547. package/payload/gate-sdk/gate-tests/check-readme-roster/good/alpha-kit/checks/check-alpha-two.sh +3 -0
  548. package/payload/gate-sdk/gate-tests/check-readme-roster/good/args +6 -0
  549. package/payload/gate-sdk/gate-tests/check-readme-roster/good/beta-kit/smoke/install.sh +3 -0
  550. package/payload/gate-sdk/gate-tests/check-readme-roster/good/expect.txt +1 -0
  551. package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.sh +5 -0
  552. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/args +2 -0
  553. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/corpus/sub/deep.md +1 -0
  554. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/corpus/top.md +1 -0
  555. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/expect.txt +1 -0
  556. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/sandbox-gate.sh +6 -0
  557. package/payload/gate-sdk/gate-tests/check-reads-couples/good/args +3 -0
  558. package/payload/gate-sdk/gate-tests/check-reads-couples/good/corpus/sub/deep.md +1 -0
  559. package/payload/gate-sdk/gate-tests/check-reads-couples/good/corpus/top.md +1 -0
  560. package/payload/gate-sdk/gate-tests/check-reads-couples/good/expect.txt +1 -0
  561. package/payload/gate-sdk/gate-tests/check-reads-couples/good/sandbox-gate.sh +8 -0
  562. package/payload/gate-sdk/gate-tests/check-root-tiering/bad/allow.list +1 -0
  563. package/payload/gate-sdk/gate-tests/check-root-tiering/bad/args +1 -0
  564. package/payload/gate-sdk/gate-tests/check-root-tiering/bad/expect.txt +1 -0
  565. package/payload/gate-sdk/gate-tests/check-root-tiering/bad/root/README.md +1 -0
  566. package/payload/gate-sdk/gate-tests/check-root-tiering/bad/root/stray.txt +1 -0
  567. package/payload/gate-sdk/gate-tests/check-root-tiering/good/allow.list +3 -0
  568. package/payload/gate-sdk/gate-tests/check-root-tiering/good/args +1 -0
  569. package/payload/gate-sdk/gate-tests/check-root-tiering/good/expect.txt +1 -0
  570. package/payload/gate-sdk/gate-tests/check-root-tiering/good/root/LICENSE +1 -0
  571. package/payload/gate-sdk/gate-tests/check-root-tiering/good/root/README.md +1 -0
  572. package/payload/gate-sdk/gate-tests/check-root-tiering/good/root/somedir/keep.txt +1 -0
  573. package/payload/gate-sdk/gate-tests/check-shellcheck/bad/args +1 -0
  574. package/payload/gate-sdk/gate-tests/check-shellcheck/bad/expect.txt +1 -0
  575. package/payload/gate-sdk/gate-tests/check-shellcheck/bad/warn.sh +5 -0
  576. package/payload/gate-sdk/gate-tests/check-shellcheck/good/args +1 -0
  577. package/payload/gate-sdk/gate-tests/check-shellcheck/good/expect.txt +1 -0
  578. package/payload/gate-sdk/gate-tests/check-shellcheck/good/ok.sh +4 -0
  579. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/alpha-kit/smoke/install.sh +4 -0
  580. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/alpha-kit/smoke/violation.sh +7 -0
  581. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/args +4 -0
  582. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/expect.txt +1 -0
  583. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/scripts/gate-sdk-config.sh +5 -0
  584. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/install.sh +4 -0
  585. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/violation.sh +4 -0
  586. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/args +6 -0
  587. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/beta-kit/smoke/install.sh +4 -0
  588. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/expect.txt +1 -0
  589. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/scripts/gate-sdk-config.sh +5 -0
  590. package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/args +9 -0
  591. package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/delegation-kit/templates/agent-budget-guard.sh +16 -0
  592. package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/expect.txt +1 -0
  593. package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/scripts/agent-budget-guard.sh +17 -0
  594. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/args +8 -0
  595. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/agent-budget-guard.sh +16 -0
  596. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/delegation-config.sh +3 -0
  597. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/usage-poller.sh +6 -0
  598. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/expect.txt +1 -0
  599. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/agent-budget-guard.sh +16 -0
  600. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/delegation-config.sh +4 -0
  601. package/payload/gate-sdk/gate-tests/check-test-hermetic/bad/args +3 -0
  602. package/payload/gate-sdk/gate-tests/check-test-hermetic/bad/expect.txt +1 -0
  603. package/payload/gate-sdk/gate-tests/check-test-hermetic/bad/leaky.test.sh +5 -0
  604. package/payload/gate-sdk/gate-tests/check-test-hermetic/good/args +3 -0
  605. package/payload/gate-sdk/gate-tests/check-test-hermetic/good/exempt.test.sh +4 -0
  606. package/payload/gate-sdk/gate-tests/check-test-hermetic/good/expect.txt +1 -0
  607. package/payload/gate-sdk/gate-tests/check-test-hermetic/good/sourced.test.sh +5 -0
  608. package/payload/gate-sdk/gate-tests/check-test-hermetic-smoke.test.sh +84 -0
  609. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/args +2 -0
  610. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +1 -0
  611. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/patterns.list +3 -0
  612. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/leak.txt +1 -0
  613. package/payload/gate-sdk/gate-tests/check-tree-terms/good/args +2 -0
  614. package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -0
  615. package/payload/gate-sdk/gate-tests/check-tree-terms/good/patterns.list +3 -0
  616. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/clean.txt +1 -0
  617. package/payload/gate-sdk/gate-tests/check-workflow-tiering/bad/.workflow/payload.txt +1 -0
  618. package/payload/gate-sdk/gate-tests/check-workflow-tiering/bad/.workflow/projection.txt +1 -0
  619. package/payload/gate-sdk/gate-tests/check-workflow-tiering/bad/expect.txt +1 -0
  620. package/payload/gate-sdk/gate-tests/check-workflow-tiering/good/.workflow/projection.txt +1 -0
  621. package/payload/gate-sdk/gate-tests/check-workflow-tiering/good/.workflow/wire.txt +1 -0
  622. package/payload/gate-sdk/gate-tests/check-workflow-tiering/good/expect.txt +1 -0
  623. package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +87 -0
  624. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +78 -0
  625. package/payload/gate-sdk/gate-tests/run-for-path.test.sh +77 -0
  626. package/payload/gate-sdk/lib/consumer-smoke.sh +32 -0
  627. package/payload/gate-sdk/lib/gate.sh +216 -0
  628. package/payload/gate-sdk/lib/inject.sh +35 -0
  629. package/payload/gate-sdk/lib/test-hermetic.sh +11 -0
  630. package/payload/gate-sdk/smoke/install.sh +84 -0
  631. package/payload/gate-sdk/smoke/violation.sh +13 -0
  632. package/payload/gate-sdk/templates/check-skeleton.sh +23 -0
  633. package/payload/gate-sdk/templates/gates-workflow.yml +55 -0
  634. package/payload/gate-sdk/templates/msg-patterns.list +21 -0
  635. package/payload/guard-kit/README.md +65 -0
  636. package/payload/guard-kit/SPEC.md +590 -0
  637. package/payload/guard-kit/bin/compare-settings-allow.sh +58 -0
  638. package/payload/guard-kit/bin/run-guard-tests.sh +86 -0
  639. package/payload/guard-kit/bin/scan-prompts.sh +166 -0
  640. package/payload/guard-kit/bin/scratch-run.sh +34 -0
  641. package/payload/guard-kit/gate-tests/scan-prompts.test.sh +70 -0
  642. package/payload/guard-kit/gate-tests/scratch-run.test.sh +62 -0
  643. package/payload/guard-kit/guard-tests/cases.tsv +117 -0
  644. package/payload/guard-kit/guard-tests/escalation-cases.tsv +13 -0
  645. package/payload/guard-kit/lib/guard.sh +448 -0
  646. package/payload/guard-kit/smoke/install.sh +26 -0
  647. package/payload/guard-kit/templates/bash-guard.sh +18 -0
  648. package/payload/guard-kit/templates/close-triage.md +31 -0
  649. package/payload/guard-kit/templates/escalation-guard.sh +27 -0
  650. package/payload/guard-kit/templates/guard-config.sh +2 -0
  651. package/payload/guard-kit/templates/settings-hooks.json +19 -0
  652. package/payload/guard-kit/templates/wakeup-guard.sh +20 -0
  653. package/payload/lifecycle-kit/README.md +106 -0
  654. package/payload/lifecycle-kit/SPEC.md +1469 -0
  655. package/payload/lifecycle-kit/bin/close-surfaces.sh +94 -0
  656. package/payload/lifecycle-kit/bin/enter-stage.sh +215 -0
  657. package/payload/lifecycle-kit/bin/file-gap.sh +43 -0
  658. package/payload/lifecycle-kit/bin/install-lifecycle.sh +36 -0
  659. package/payload/lifecycle-kit/bin/session-id.sh +75 -0
  660. package/payload/lifecycle-kit/checks/check-close-surfaces.sh +63 -0
  661. package/payload/lifecycle-kit/checks/check-lesson-disposition.sh +98 -0
  662. package/payload/lifecycle-kit/checks/check-lifecycle-registration.sh +54 -0
  663. package/payload/lifecycle-kit/checks/check-merge-attrs.sh +69 -0
  664. package/payload/lifecycle-kit/checks/check-shim-restatement.sh +97 -0
  665. package/payload/lifecycle-kit/checks/check-skill-binding.sh +59 -0
  666. package/payload/lifecycle-kit/checks/check-stage-entry.sh +197 -0
  667. package/payload/lifecycle-kit/checks/check-stage-evidence.sh +81 -0
  668. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.sh +47 -0
  669. package/payload/lifecycle-kit/gate-tests/boundary-scratch-wipe.test.sh +96 -0
  670. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/args +1 -0
  671. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/expect.txt +1 -0
  672. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/owners/inbox.md +5 -0
  673. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/scripts/lifecycle-config.sh +4 -0
  674. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/args +1 -0
  675. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/expect.txt +1 -0
  676. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/owners/inbox.md +5 -0
  677. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/scripts/lifecycle-config.sh +4 -0
  678. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +66 -0
  679. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/args +2 -0
  680. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/evidence.txt +2 -0
  681. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/expect.txt +1 -0
  682. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/queue-head.md +8 -0
  683. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/queue-work.md +5 -0
  684. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/args +2 -0
  685. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/evidence.txt +3 -0
  686. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/expect.txt +1 -0
  687. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/queue-head.md +8 -0
  688. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/queue-work.md +5 -0
  689. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +56 -0
  690. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/AGENT.md +11 -0
  691. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/args +1 -0
  692. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/expect.txt +1 -0
  693. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/AGENT.md +11 -0
  694. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/args +1 -0
  695. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/expect.txt +1 -0
  696. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +59 -0
  697. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +6 -0
  698. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/expect.txt +1 -0
  699. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +5 -0
  700. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/expect.txt +1 -0
  701. package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +113 -0
  702. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/args +2 -0
  703. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/commands/build.md +6 -0
  704. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/corpus.md +4 -0
  705. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/expect.txt +1 -0
  706. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/args +2 -0
  707. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/commands/build.md +5 -0
  708. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/corpus.md +4 -0
  709. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/expect.txt +1 -0
  710. package/payload/lifecycle-kit/gate-tests/check-shim-restatement.test.sh +80 -0
  711. package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/args +1 -0
  712. package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/commands/build.md +5 -0
  713. package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/expect.txt +1 -0
  714. package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/templates/build.md +7 -0
  715. package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/args +1 -0
  716. package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/commands/build.md +7 -0
  717. package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/expect.txt +1 -0
  718. package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/templates/build.md +7 -0
  719. package/payload/lifecycle-kit/gate-tests/check-skill-binding.test.sh +84 -0
  720. package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/.workflow/WORKFLOW-STATE.txt +7 -0
  721. package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/TASK-QUEUE.md +13 -0
  722. package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/expect.txt +1 -0
  723. package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/.workflow/WORKFLOW-STATE.txt +7 -0
  724. package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/TASK-QUEUE.md +13 -0
  725. package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/expect.txt +1 -0
  726. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +251 -0
  727. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/.workflow/WORKFLOW-STATE.txt +6 -0
  728. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/TASK-QUEUE.md +13 -0
  729. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/expect.txt +1 -0
  730. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/.workflow/WORKFLOW-STATE.txt +6 -0
  731. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/TASK-QUEUE.md +13 -0
  732. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/expect.txt +1 -0
  733. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +115 -0
  734. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/args +1 -0
  735. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/align.md +2 -0
  736. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/build.md +2 -0
  737. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/scope.md +2 -0
  738. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/validate.md +2 -0
  739. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/expect.txt +1 -0
  740. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/args +1 -0
  741. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/align.md +2 -0
  742. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/build.md +2 -0
  743. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/close.md +2 -0
  744. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/scope.md +2 -0
  745. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/validate.md +2 -0
  746. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/expect.txt +1 -0
  747. package/payload/lifecycle-kit/lib/stages.sh +179 -0
  748. package/payload/lifecycle-kit/smoke/install.sh +341 -0
  749. package/payload/lifecycle-kit/smoke/violation.sh +8 -0
  750. package/payload/lifecycle-kit/templates/lead.md +271 -0
  751. package/payload/lifecycle-kit/templates/lifecycle-config.sh +2 -0
  752. package/payload/lifecycle-kit/templates/skills/align.md +65 -0
  753. package/payload/lifecycle-kit/templates/skills/build.md +78 -0
  754. package/payload/lifecycle-kit/templates/skills/close.md +122 -0
  755. package/payload/lifecycle-kit/templates/skills/release-sweep.md +39 -0
  756. package/payload/lifecycle-kit/templates/skills/scope.md +112 -0
  757. package/payload/lifecycle-kit/templates/skills/spec.md +91 -0
  758. package/payload/lifecycle-kit/templates/skills/upgrade.md +41 -0
  759. package/payload/lifecycle-kit/templates/skills/validate.md +54 -0
  760. package/payload/queue-kit/README.md +62 -0
  761. package/payload/queue-kit/SPEC.md +366 -0
  762. package/payload/queue-kit/bin/lesson-sink.sh +28 -0
  763. package/payload/queue-kit/bin/queue-index.sh +131 -0
  764. package/payload/queue-kit/checks/check-queue-hygiene.sh +81 -0
  765. package/payload/queue-kit/checks/check-queue-prose-precondition.sh +63 -0
  766. package/payload/queue-kit/checks/check-queue-sections.sh +44 -0
  767. package/payload/queue-kit/checks/check-queue-slug-liveness.sh +63 -0
  768. package/payload/queue-kit/checks/check-queue-wrap.sh +56 -0
  769. package/payload/queue-kit/checks/check-tag-lead-line.sh +66 -0
  770. package/payload/queue-kit/checks/check-task-conservation.sh +50 -0
  771. package/payload/queue-kit/checks/check-task-names.sh +128 -0
  772. package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/TASK-QUEUE.md +17 -0
  773. package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/expect.txt +1 -0
  774. package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +25 -0
  775. package/payload/queue-kit/gate-tests/check-queue-hygiene/good/expect.txt +1 -0
  776. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/TASK-QUEUE.md +15 -0
  777. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/expect.txt +1 -0
  778. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/good/TASK-QUEUE.md +25 -0
  779. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/good/expect.txt +1 -0
  780. package/payload/queue-kit/gate-tests/check-queue-sections/bad/TASK-QUEUE.md +13 -0
  781. package/payload/queue-kit/gate-tests/check-queue-sections/bad/expect.txt +1 -0
  782. package/payload/queue-kit/gate-tests/check-queue-sections/good/TASK-QUEUE.md +15 -0
  783. package/payload/queue-kit/gate-tests/check-queue-sections/good/expect.txt +1 -0
  784. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/TASK-QUEUE.md +17 -0
  785. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/docs/page.md +4 -0
  786. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/expect.txt +1 -0
  787. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/scripts/queue-config.sh +3 -0
  788. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/TASK-QUEUE.md +19 -0
  789. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/docs/page.md +5 -0
  790. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/expect.txt +1 -0
  791. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/scripts/queue-config.sh +3 -0
  792. package/payload/queue-kit/gate-tests/check-queue-wrap/bad/TASK-QUEUE.md +15 -0
  793. package/payload/queue-kit/gate-tests/check-queue-wrap/bad/expect.txt +1 -0
  794. package/payload/queue-kit/gate-tests/check-queue-wrap/good/TASK-QUEUE.md +25 -0
  795. package/payload/queue-kit/gate-tests/check-queue-wrap/good/expect.txt +1 -0
  796. package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/TASK-QUEUE.md +22 -0
  797. package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/expect.txt +1 -0
  798. package/payload/queue-kit/gate-tests/check-tag-lead-line/good/TASK-QUEUE.md +29 -0
  799. package/payload/queue-kit/gate-tests/check-tag-lead-line/good/expect.txt +1 -0
  800. package/payload/queue-kit/gate-tests/check-task-names/bad/TASK-QUEUE.md +18 -0
  801. package/payload/queue-kit/gate-tests/check-task-names/bad/expect.txt +1 -0
  802. package/payload/queue-kit/gate-tests/check-task-names/good/TASK-QUEUE.md +25 -0
  803. package/payload/queue-kit/gate-tests/check-task-names/good/expect.txt +1 -0
  804. package/payload/queue-kit/gate-tests/queue-index.test.sh +118 -0
  805. package/payload/queue-kit/lib/queue.sh +107 -0
  806. package/payload/queue-kit/smoke/install.sh +21 -0
  807. package/payload/queue-kit/smoke/violation.sh +8 -0
  808. package/payload/queue-kit/templates/TASK-QUEUE.md +43 -0
  809. package/payload/queue-kit/templates/queue-config.sh +2 -0
  810. package/payload/site-kit/README.md +61 -0
  811. package/payload/site-kit/SPEC.md +263 -0
  812. package/payload/site-kit/checks/check-docs-cname-parity.sh +80 -0
  813. package/payload/site-kit/checks/check-docs-render-fidelity.sh +167 -0
  814. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/args +4 -0
  815. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/expect.txt +1 -0
  816. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/site-config.sh +7 -0
  817. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/tree/CNAME +1 -0
  818. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/tree/README.md +5 -0
  819. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/args +5 -0
  820. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/expect.txt +1 -0
  821. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/site-config.sh +7 -0
  822. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/CNAME +1 -0
  823. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/docs/posts/2026-01-01-legacy.md +4 -0
  824. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/index.md +4 -0
  825. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/pkg/gate-tests/fixture.md +5 -0
  826. package/payload/site-kit/gate-tests/check-docs-render-fidelity/bad/args +8 -0
  827. package/payload/site-kit/gate-tests/check-docs-render-fidelity/bad/expect.txt +1 -0
  828. package/payload/site-kit/gate-tests/check-docs-render-fidelity/bad/tree/docs/install.md +38 -0
  829. package/payload/site-kit/gate-tests/check-docs-render-fidelity/good/args +6 -0
  830. package/payload/site-kit/gate-tests/check-docs-render-fidelity/good/expect.txt +1 -0
  831. package/payload/site-kit/gate-tests/check-docs-render-fidelity/good/tree/docs/install.md +35 -0
  832. package/payload/site-kit/gate-tests/check-docs-render-fidelity-foreign.test.sh +87 -0
  833. package/payload/site-kit/gate-tests/check-docs-render-fidelity-span.test.sh +80 -0
  834. package/payload/site-kit/gate-tests/check-docs-render-fidelity-table.test.sh +90 -0
  835. package/payload/site-kit/lib/site.sh +29 -0
  836. package/payload/site-kit/smoke/install.sh +26 -0
  837. package/payload/site-kit/smoke/violation.sh +20 -0
  838. package/payload/site-kit/templates/site-health.yml +164 -0
  839. package/profiles.list +53 -0
@@ -0,0 +1,780 @@
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
+ `templates/agent-budget-guard.sh` closes the gap the template's
45
+ **Budget-check before *each* dispatch in a fan-out** rule leaves when it relies
46
+ on the agent *choosing* to run the tool: a memory-quoted percentage acts in its
47
+ place (a session quoted ~5% while the live verdict read 29%). It is a `PreToolUse` hook (matcher `Agent`) the
48
+ harness fires on every dispatch once the consumer registers it in settings —
49
+ per-dispatch freshness, not a start-of-session reading a mid-session window
50
+ outlives. It runs `usage-verdict` at the decision point and routes on the exit
51
+ code:
52
+
53
+ - **PAUSE (1)** → `guard_block`: the verdict line plus its corrective (wait for
54
+ the window reset, or re-run with `DELEGATION_KIT_PAUSE_PCT` deliberately
55
+ raised). This is guard-kit's one sanctioned fail-closed deny — the hook
56
+ matcher proves the tool identity and PAUSE is reachable only through a fresh,
57
+ readable, over-threshold snapshot, so blocking cannot wedge a consumer with
58
+ no producer.
59
+ - **STALE / unreadable (2)** and **OK / RESET-OK (0)** → `guard_advise`,
60
+ feeding the verdict line back as `additionalContext` so the live reading
61
+ rides in context at every dispatch and a memory-quoted percentage can never
62
+ be the acting source. The advise arm relays that line and adds nothing: the
63
+ verdict string carries its own decision consequence (§usage-verdict), so
64
+ restating it on the arm would be one fact in two places. Routing STALE to
65
+ advice rather than out of delegation is what keeps a consumer with no
66
+ snapshot producer working — budget-unknown is decision-relevant, never
67
+ disqualifying.
68
+
69
+ The harness is the producer (it fires the hook once the settings registration
70
+ is set); the consumers are the dispatching agent, which reads the verdict line
71
+ off `additionalContext` at the dispatch-decision transition, and the
72
+ supervising user, who consumes a block by ruling — raise the knob or wait; the
73
+ agent never overrides. delegation-kit owns the verdict, its thresholds, and the
74
+ routing; guard-kit supplies only the framework primitives (its second
75
+ consumer). Registration is the opt-in valve: a consumer wanting pure advice
76
+ does not wire the hook. No new persistent state and no new key on the
77
+ `usage.txt` contract — the verdict line is the only interface.
78
+
79
+ A knob-raise ruling has one working transport in this harness: the settings
80
+ env block (`.claude/settings.local.json`), which hooks re-read per fire — the
81
+ raised `DELEGATION_KIT_PAUSE_PCT` reaches the guard on the next dispatch with
82
+ no restart, and deleting the entry afterwards restores the default just as
83
+ immediately. A Bash-tool inline `export` never reaches the hook (the hook
84
+ process does not inherit the tool's shell), so it is not an override path.
85
+ Propagation is asymmetric within a live session: the hook re-reads the file
86
+ per fire, but the Bash tool environment retains an injected value after the
87
+ entry is deleted until the session restarts — an in-session `usage-verdict`
88
+ run and a hook fire can judge against different thresholds in that window, so
89
+ the hook's verdict line, not an in-session re-run, is the acting reading.
90
+
91
+ ### One template, a resident pointer
92
+
93
+ `templates/agent-execution.md` is the single source for the protocol — a
94
+ binding-shim *template* in lifecycle-kit's grammar (lifecycle-kit/SPEC.md
95
+ §check-skill-binding). The consumer creates `.claude/commands/agent-execution.md`
96
+ as a shim that names the template and binds its two slots — the shared-file
97
+ roster and the validate battery — the consumer-specialization discipline of
98
+ guard-kit's consumer-rules block, now carried by the slot/binding mechanism the
99
+ lifecycle skills already use. `check-skill-binding` enforces the slot pairing on
100
+ the consumer side.
101
+
102
+ A spec reference to one of those rules uses the citation grammar
103
+ `the template's **<name>** rule`, where `<name>` is a bullet's bold lead-in
104
+ verbatim minus its trailing period; `check-rule-citation` resolves every such
105
+ citation in §The delegation model forward into the template, so a lead-in
106
+ rename cannot silently dangle a reference.
107
+
108
+ `templates/dispatch-checklists.md` is a second, load-triggered template the
109
+ protocol template reaches by a single pointer line: `agent-execution.md` names
110
+ it for a deletion, rename, or heavy cross-spec audit dispatch, and it loads only
111
+ then — never resident, and not a binding shim (it binds no slots, so
112
+ `check-skill-binding` does not scan it). It carries the mechanical pre-flight for
113
+ those dispatch shapes — the importer/collision/sweep-verification checks — while
114
+ the protocol proper stays whole in `agent-execution.md`; the pointer-line
115
+ contract is that the protocol template stays complete alone and the checklists
116
+ are a reach-through, so the width, journal, and validate rules live once in the
117
+ protocol template and are cited from the checklists, never restated. This is the
118
+ load-trigger-residency rule applied a rung deeper: even inside a load-triggered
119
+ template, a subset that only a narrower trigger (a deletion or rename dispatch)
120
+ needs sits behind its own pointer.
121
+
122
+ The consumer's CLAUDE.md carries no digest of the bullets, only a resident
123
+ pointer: the pre-authorization sentence (consumer judgment on what delegation
124
+ needs no ask) and `/agent-execution`. Rationale: a rule is resident only when it
125
+ has no load trigger (the load-trigger-residency doctrine), and every protocol
126
+ bullet triggers at `Agent` dispatch — which already has a mechanical seam, the
127
+ per-dispatch budget guard, whose block message names `/agent-execution`. The
128
+ doctrine lives behind the trigger, not in the always-loaded file. Honest limit:
129
+ the guard enforces budget mechanically, not protocol literacy — a session that
130
+ dispatches without invoking the skill carries only the resident pointer.
131
+
132
+ ## Resume journal — agent writes, supervisor deletes
133
+
134
+ A mutating agent `Write`s a running progress journal (findings triaged,
135
+ edits applied, what remains) to a repo-local gitignored scratch directory
136
+ in the main checkout — never a temporary worktree (a worktree-isolated
137
+ agent's own tree is deleted with the worktree, taking the journal) nor a
138
+ system temp dir (a restart wipes tmpfs). The supervisor names that path
139
+ **absolute into the main checkout** in the dispatch prompt, so a
140
+ worktree-isolated agent writes to the surviving checkout, not its doomed
141
+ tree. Repo-dir-local scratch is reboot-survivable, cheap to clean, and
142
+ predictable across coding agents. The agent updates the journal as it
143
+ goes; on success it appends a `DONE` marker. Each finding lands in the journal *inline as it is
144
+ confirmed* — never "see final output": the agent's return message dies with
145
+ the session, so a pointer-only journal makes `DONE` lie about
146
+ recoverability. Agents have no `rm`; the supervisor deletes the journal at
147
+ the post-commit validation checkpoint. Whether a journal *without* `DONE`
148
+ signals interruption turns on whether the supervisor consumed the agent's
149
+ return. On the ordinary completion path the supervisor received the return and
150
+ ran its post-commit verification (§Validate after every agent commit); that
151
+ return plus the verification *is* the recovery contract, attesting completion
152
+ directly, so the `DONE` marker is redundant and a journal without it does
153
+ **not** imply interruption. Only in a **cold read** — the supervisor finds a
154
+ journal but never consumed a return, the agent's session having died before
155
+ returning (a background sandbox died, a crash, a timeout) — is the marker the
156
+ sole signal, and there the original reading holds: no `DONE` = interrupted,
157
+ resume from it. The inline-findings rule above is exactly that cold arm's
158
+ insurance — with no surviving return, a pointer-only journal would make a
159
+ would-be `DONE` lie about recoverability.
160
+
161
+ **Caveat — the sandbox may block the journal write.** Background agents
162
+ have been observed unable to `Write` to the granted path, silently falling
163
+ back to returning findings in the final message — which defeats the journal
164
+ exactly when it matters (a long, interruptible run). So: for a read-only
165
+ fan-out the return value *is* the contract — no journal; for mutating
166
+ agents, grant the journal path explicitly before dispatch rather than
167
+ assuming the write succeeds.
168
+
169
+ ## Validate after every agent commit
170
+
171
+ Re-run the relevant gates plus the consumer's validate battery (for this
172
+ repo and any gate-sdk consumer: `bash gate-sdk/bin/run-gates.sh` and the
173
+ kit fixture runners; a toolchain consumer adds its compile/lint/test set in
174
+ the template's marked section, including a zero-byte-file sweep after
175
+ renames — silent edit corruption is real). **Diff every gate change in an
176
+ agent commit before accepting**: an agent blocked by a gate will weaken it
177
+ (a false exemption) rather than fix the code — "the gate is in my way"
178
+ almost always means the code doesn't fit the convention.
179
+
180
+ `check-gate-tamper` is the mechanical floor under that duty. Two
181
+ assertions, blocking the two attested tamper shapes:
182
+
183
+ - **A — gate-edit isolation.** A commit that touches a gate file (the
184
+ `DELEGATION_KIT_GATE_FILES` globs) may touch only meta-layer paths
185
+ (`DELEGATION_KIT_META_PATHS` prefixes + root `*.md`); co-staging product
186
+ code with a gate edit is blocked. Split the gate change into its own
187
+ commit.
188
+ - **B — no self-serving exemption.** A newly added path/glob entry in any
189
+ gate's `# exception-list:` array must not match a file staged in the same
190
+ commit — an exemption never excuses the very change it lands with.
191
+
192
+ **Honest limit:** the gate blocks by commit *shape*; it does not catch
193
+ semantic weakening inside a legitimate scripts-only commit — the by-eye
194
+ diff review of agent gate edits remains a supervisor duty. `--fixture <dir>`
195
+ injects `staged-files` / `added-exemptions` lists (fixture-pair test
196
+ capability); live mode reads `git diff --cached`.
197
+
198
+ ## usage-verdict
199
+
200
+ Emits a trustworthy budget verdict from a usage snapshot file, closing the
201
+ three failure modes a raw percentage reading leaves open:
202
+
203
+ 1. **Stale reading** — `now - updated_at` beyond `DELEGATION_KIT_STALE_AGE` → STALE
204
+ (exit 2): budget-unknown, never blocking delegation — re-read or refresh
205
+ before trusting the number.
206
+ 2. **Dead window** — `resets_at <= now` → RESET-OK (exit 0): the percentage
207
+ is from the dead window and must not be read as a pause signal. The
208
+ weekly axis carries the same rule per-axis (`seven_day_resets_at <= now`
209
+ disarms the weekly pause without forcing the whole verdict to RESET-OK —
210
+ the axes are judged independently).
211
+ 3. **Post-login lag** — a fresh login starts a new window but the
212
+ server-fed percentage lags it, and the file-write age check cannot see
213
+ that. The gate reads the auth event from the credentials file's mtime
214
+ (`DELEGATION_KIT_LOGIN_WINDOW`) and, within that window, routes a
215
+ would-be OK to STALE (re-read). Letting the lag print OK would emit a
216
+ fresh-looking chimera, since the producer stamps the new account id while
217
+ the percentage and `resets_at` still carry the dead login's window.
218
+ Self-limiting: once the mtime ages out, the reroute stops firing.
219
+
220
+ **The reroute is asymmetric — it may suppress an OK, never a PAUSE.** It
221
+ therefore follows the axis compares rather than preceding them. The two
222
+ directions of a lagging reading have opposite costs: a lagging *low*
223
+ percentage printing OK invites a dispatch the budget may not afford, which
224
+ is what the reroute exists to prevent; a lagging *high* percentage
225
+ suppressed into STALE waves that dispatch through, because STALE is
226
+ advisory and never blocks (§The staleness contract). An unconditional
227
+ reroute closes the first and opens the second, so it must fire on the
228
+ non-blocking outcome only: inside the window an at-or-over reading still
229
+ exits 1 on whichever axis fired, and an under-threshold one still exits 2.
230
+ An account switch swaps both windows, so neither axis escapes the
231
+ suppression when the outcome is a would-be OK.
232
+
233
+ **The mtime is a proxy, and the roll witnesses refute it.** A credentials
234
+ file's mtime cannot distinguish an actual login from a routine OAuth token
235
+ rotation, which rewrites the same file — so every rotation mints a fake
236
+ auth event and blinds the verdict for the window's duration, and rotations
237
+ cluster around long-session resume, exactly when a verdict is being asked
238
+ for. The reroute's *premise* is that a low percentage inside the window is
239
+ a **lagging** reading; when the five-hour window has demonstrably rolled,
240
+ a low percentage is the **expected** reading and the premise is false. Two
241
+ witnesses of a roll are already in hand at that point, and the verdict
242
+ consults both — conjunctively, since either alone is ambiguous:
243
+
244
+ - the snapshot's `five_hour_resets_at` differs from the newest
245
+ `DELEGATION_KIT_USAGE_HISTORY` sample's `resets_at` (the boundary moved);
246
+ - the snapshot's `updated_at` is past that **previous** boundary (time
247
+ actually crossed it, rather than the boundary being restamped by an
248
+ account switch).
249
+
250
+ Both firing disarms the reroute and the reading verdicts on its own merits.
251
+ This makes the verdict path a **reader** of the trend log it already
252
+ appends to; the read is taken before this run's own append, so the witness
253
+ is the previous reading and never this one. It falls open to the
254
+ unrefuted reroute whenever the log cannot answer — knob unset, file absent
255
+ or unreadable, or a tail carrying no numeric `resets_at` — which is the
256
+ pre-existing behavior, so an unconfigured consumer is unchanged. The
257
+ residual limit is honest and named: a rotation with **no** roll still
258
+ blinds the window, because no witness in hand contradicts it; closing that
259
+ needs an account-keyed check against the credential's own identity, not a
260
+ sharper time window.
261
+
262
+ Check order: parse → RESET-OK → age-STALE → pause axes → login-STALE → OK. The
263
+ RESET-OK branch is the same decision one step earlier and is ordering
264
+ precedent for the witnesses: the file already accepts that a demonstrated roll
265
+ outranks the reroute. It covers only a snapshot from an already-dead window;
266
+ the witnesses cover a window that rolled *between* samples, where the
267
+ re-polled snapshot carries a live `resets_at`.
268
+
269
+ Exit codes: **0** OK / RESET-OK, **1** PAUSE, **2** STALE or unreadable. Exit
270
+ 2 is fail-closed on *trusting the number* and deliberately fail-open on
271
+ *refusing work* — budget-unknown never blocks delegation — so it is never the
272
+ code a reading that should refuse an expensive dispatch may land on. The bin's
273
+ `# exit:` header declares that mapping, stating exit 2's consequence rather
274
+ than labelling it a bare "fail-closed" (which named only the trust axis and
275
+ read as a claim about the blocking one). That declaration is **machine-read** by
276
+ `check-assertion-strength` (gate-sdk/SPEC.md), which derives the verdict
277
+ vocabulary from it rather than carrying a literal — so the header is a surface
278
+ with a consumer, not loose documentation, and rewording it reshapes what that
279
+ gate can discriminate.
280
+ Fail-closed throughout: missing keys and a non-numeric percentage route to
281
+ STALE; each threshold compare uses `awk`, not integer-only bash
282
+ arithmetic, so a fractional percentage cannot silently skip PAUSE; and both
283
+ pause compares are **at-or-over** (`>=`), so a reading exactly at
284
+ `DELEGATION_KIT_PAUSE_PCT` / `DELEGATION_KIT_PAUSE_PCT_7D` pauses — the
285
+ boundary reading is judged at the
286
+ limit, not under it.
287
+
288
+ **Demand-driven refresh.** The decision point triggers the poll: when
289
+ `DELEGATION_KIT_REFRESH_CMD` is non-empty, `usage-verdict` runs it before
290
+ reading the snapshot, so the budget guard and any verdict caller read live
291
+ data instead of whatever the last statusline render left behind. This closes
292
+ the push producer's blind spot at the point of use — a lead that delegates
293
+ stops rendering exactly when it goes static, and the first live poll proved
294
+ the gap: the snapshot said 2-5% while the endpoint said 28%. Empty (the
295
+ default) keeps the read-only behavior, so an unconfigured consumer's push and
296
+ timer producers are unchanged.
297
+
298
+ The refresh is **short-circuited** by `DELEGATION_KIT_REFRESH_MIN_AGE`: the
299
+ command runs only when the snapshot is missing, unreadable, or its
300
+ `updated_at` age is at least that value. The statusline calls `usage-verdict`
301
+ on every render for trend sampling; without the floor a configured refresh
302
+ would hammer the source on the render path. At dispatch-decision time a
303
+ stale-enough snapshot still polls.
304
+
305
+ It is **fail-soft**: a non-zero refresh exit leaves the snapshot untouched and
306
+ the verdict proceeds on the cached file — the staleness machinery above judges
307
+ its trust, turning a dead producer into a STALE verdict rather than a silent
308
+ green. Refresh diagnostics are suppressed rather than mixed into the verdict
309
+ output, which callers relay verbatim; the snapshot's age is the signal.
310
+ `usage.txt` survives as last-known-good cache, source-agnostic seam, and test
311
+ seam. A refresh inside the `DELEGATION_KIT_LOGIN_WINDOW` rewrites `updated_at` while the
312
+ server-fed percentage may still lag the login by about a minute — the reroute
313
+ correctly keeps those readings STALE for the window's duration, save the
314
+ at-or-over ones it is forbidden to suppress.
315
+
316
+ **The verdict-string contract.** Every line `usage-verdict` emits carries three
317
+ parts: the **reading** (the measured fields), the **epistemic status** of that
318
+ reading (how far to trust the number), and its **decision consequence** for
319
+ delegation (what the reading gates). A verdict string stating a status without
320
+ its consequence is incomplete by contract — the reader completes it by
321
+ inference, and the inference is unconstrained: a session reading a bare STALE
322
+ infers "do not trust the number" into "do not dispatch". That read is wrong
323
+ (STALE never blocks) and is structurally uncorrectable downstream, because the
324
+ budget guard fires *on* dispatch, the act a hesitating session has not yet
325
+ performed. STALE's status half is site-specific — each emission site names why
326
+ it is stale — while its consequence half is uniform, because the consequence is
327
+ uniform: STALE is budget-unknown at every site and never blocks delegation. The
328
+ consequence clause appends *after* the `` -> <verdict> `` arrow, leaving it
329
+ disjoint from the `width=<n>` invariant below.
330
+
331
+ **The `width=<n>` field.** Every emitted verdict line — OK, PAUSE, STALE (the
332
+ fail-closed diagnostics included), RESET-OK — carries a `width=<n>` field
333
+ immediately before the `` -> <verdict> `` arrow, read from
334
+ `DELEGATION_KIT_FAN_WIDTH` (§Layout and configuration). It is the knob's
335
+ mechanical reader: the budget check already runs before every dispatch, so the
336
+ read-only fan-out bound surfaces at exactly the wave-sizing decision point, and
337
+ `agent-budget-guard.sh` relays the verdict line verbatim (block on PAUSE, advise
338
+ otherwise) so the width rides into context with the budget verdict. *Verbatim*
339
+ governs the verdict line's own text, not the surrounding frame: the guard
340
+ prefixes the relayed line and the PAUSE arm appends its corrective, but no arm
341
+ restates the payload's content — there is exactly one advise arm and it adds
342
+ nothing. The field is
343
+ a config constant, not derived from the snapshot, so it is present even on an
344
+ unreadable-snapshot STALE. No exit-code or other-field change: existing callers
345
+ that key off the exit code or the `-> <verdict>` arrow are unaffected.
346
+
347
+ **Two pause axes.** The five-hour window is the always-on axis; the weekly
348
+ (7-day) window is a second axis, armed only when both `seven_day_used_pct`
349
+ and `seven_day_resets_at` are present (a three-line snapshot keeps today's
350
+ behavior — no retroactive contract break). The weekly limit can deplete
351
+ while the 5h window sits comfortable, and a weekly PAUSE costs days, not
352
+ hours, so it must gate delegation planning, not merely appear in a log —
353
+ delegation is the discretionary spend, the first thing to stop near the
354
+ weekly ceiling so the remaining week stays with the supervisor. The axes
355
+ are judged independently against `DELEGATION_KIT_PAUSE_PCT` and
356
+ `DELEGATION_KIT_PAUSE_PCT_7D`; either
357
+ firing is a PAUSE (exit 1), and the message names the axis that fired
358
+ (`PAUSE (7-day window)` vs `PAUSE (5h window)`, the weekly named when both
359
+ fire) because the operator's remediation differs by days. No caller
360
+ changes: the session-context hook and the per-dispatch Agent budget guard
361
+ already consume the exit code, so the weekly axis flows into every dispatch
362
+ decision the moment a producer supplies the keys.
363
+
364
+ **Usage-history sampling.** When `DELEGATION_KIT_USAGE_HISTORY` is non-empty,
365
+ `usage-verdict` appends one sample line (§The usage.txt contract) to that log
366
+ after every successfully parsed snapshot, whatever the verdict — the raw
367
+ harness-reported values verbatim; write-time smoothing or correction is
368
+ forbidden (a later corrective push is evidence about the earlier sample, and
369
+ only the reader has both). A STALE exit from an unreadable or unparseable
370
+ snapshot appends nothing — a sample the gate would not trust is not history.
371
+ `usage-trend` (§Trend reporter) reads the log, and so does `usage-verdict`
372
+ itself: the newest sample's `resets_at` is one of the two roll witnesses
373
+ (§usage-verdict). That read is the log's only in-verdict consumer and is
374
+ strictly fall-open, so the log stays an advisory trend surface rather than
375
+ becoming a correctness dependency — a consumer with sampling off gets the
376
+ same verdicts it always did.
377
+
378
+ ### The usage.txt contract
379
+
380
+ The snapshot is the wire contract between any producer and the gate — three
381
+ `key=value` lines:
382
+
383
+ ```
384
+ five_hour_used_pct=<float>
385
+ five_hour_resets_at=<epoch-seconds>
386
+ updated_at=<epoch-seconds>
387
+ ```
388
+
389
+ Beyond the three mandatory lines a producer may write optional keys when its
390
+ source exposes them; `usage-verdict` reads the ones it interprets and passes
391
+ the rest through: `seven_day_used_pct` / `seven_day_resets_at` (the weekly
392
+ window — read at the verdict transition to arm the second pause axis),
393
+ `account` (the logged-in account identity — `login_at` detects a switch,
394
+ `account` says to whom, which lets `usage-trend` group a multi-account
395
+ operator's segments per account), `tier` (subscription tier — the
396
+ denominator behind the percentages), and `tokens_in` / `tokens_out`
397
+ (cumulative token counts, the axis that binds API-billed consumers for whom
398
+ no subscription percentage applies). Optional keys are omitted when their
399
+ source has no value, never written empty; keys the verdict does not read
400
+ pass through unchanged.
401
+
402
+ The kit ships two reference producers — one push, one poll — and any producer
403
+ honoring the contract works beside them. `templates/statusline-usage.sh` is
404
+ the push producer: a statusline hook
405
+ that parses the harness's rate-limit JSON and atomically writes the
406
+ snapshot (`tmp` + `mv`) to `${CLAUDE_CONFIG_DIR:-$HOME/.claude}/usage.txt`.
407
+ It also produces the weekly pair from the payload and `account` / `tier`
408
+ from the local account config (`.credentials.json` / `~/.claude.json`,
409
+ overridable via `DELEGATION_KIT_CRED_FILE` / `DELEGATION_KIT_ACCOUNT_CONFIG`).
410
+ It ships no `tokens_in` / `tokens_out` producer: this harness's payload
411
+ carries no cumulative token count, so under the dead-producer rule the keys
412
+ stay defined here for third-party producers but no dead producer is shipped.
413
+ Beyond the snapshot write it renders a status bar — model/effort, a context
414
+ gauge, the 5h and 7d windows with reset countdowns, and an `iteration@stage`
415
+ readout whose two halves come from two surfaces: the iteration from the queue
416
+ header, the stage from the lifecycle evidence file's **last data line**. Both
417
+ are repo-root-relative reads in the template's existing hardcode style — a
418
+ consumer-owned template adds no knob. With no cursor to read (no evidence file,
419
+ or one truncated to its preamble at an iteration boundary) the readout degrades
420
+ to the iteration alone rather than printing a dangling separator or a partial
421
+ parse — self-contained ANSI, no external asset
422
+ (§Out of scope). The snapshot write is the contract; the bar is
423
+ reference UX a consumer may restyle or discard. The source is pluggable
424
+ (`DELEGATION_KIT_USAGE_FILE`), so no
425
+ single-operator `CLAUDE_CONFIG_DIR` assumption is baked in.
426
+
427
+ `templates/usage-poller.sh` is the poll producer, closing the push producer's
428
+ blind spot: the statusline fires on the supervising session's own message
429
+ flow, so a lead that delegates stops producing exactly when it goes static —
430
+ a delegated build can run for hours with every per-dispatch budget verdict
431
+ reading a stale file. The poller is one poll cycle per invocation: read the
432
+ harness OAuth token from the credentials file the kit already knows
433
+ (`DELEGATION_KIT_CRED_FILE`; the token goes into the request header and
434
+ nowhere else — never logged, never echoed, never written to the snapshot),
435
+ query the account usage source, map the payload onto the contract (the three
436
+ mandatory lines plus whichever optional keys the source exposes; **no new
437
+ key**), and atomically rewrite the snapshot (`tmp` + `mv`, the same
438
+ discipline). No daemon, no loop: scheduling belongs to the consumer, and two
439
+ modes are sanctioned. **Demand-driven** (§usage-verdict): point
440
+ `DELEGATION_KIT_REFRESH_CMD` at the poller and the same one-cycle producer runs
441
+ at verdict time, which puts the freshest reading exactly at the decision point.
442
+ **Timer-driven**: a cron line such as `*/5 * * * * bash usage-poller.sh` or a
443
+ systemd timer, for consumers wanting continuous trend density independent of
444
+ verdict calls. Either entry is the enabling config; with neither, the producer
445
+ is dead. The usage endpoint is harness-account plumbing, not a
446
+ published contract, so the poller is **fail-soft**: a missing/unreadable
447
+ credentials file, a fetch failure, or an unparseable payload exits non-zero
448
+ with a `help:` line *without touching the snapshot* — a stale snapshot is
449
+ already the detected condition downstream (`usage-verdict`'s `updated_at`
450
+ staleness check turns it into a STALE verdict, never a silent green), and the
451
+ non-zero exit lands in the invoking timer's logging, deliberately nowhere
452
+ else. The endpoint URL is the `DELEGATION_KIT_USAGE_ENDPOINT` knob — both the
453
+ test seam (the smoke points it at a local `file://` stub) and the valve when
454
+ the source moves.
455
+
456
+ Both producers write the whole snapshot atomically from the same account
457
+ source; last-writer-wins is correct because the freshest write is the truest
458
+ and `updated_at` arbitrates downstream. Nothing serializes them and nothing
459
+ needs to. The trend log is unaffected: `usage-verdict` stays the single
460
+ append author (§usage-verdict); the poller writes the snapshot only.
461
+
462
+ Because the
463
+ statusline fires far more often than the per-session /
464
+ per-dispatch verdict calls, a consumer wanting a denser trend history can drive
465
+ sampling from the render path — `usage-verdict` stays the single append author
466
+ (§usage-verdict), so the statusline calls it (with `DELEGATION_KIT_USAGE_HISTORY`
467
+ set) rather than appending the log itself.
468
+
469
+ **The sample line.** With sampling enabled (§usage-verdict), `usage-verdict`
470
+ appends one line per parsed snapshot — the trend log's wire contract between
471
+ it and `usage-trend`:
472
+
473
+ ```
474
+ 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>]
475
+ ```
476
+
477
+ Space-separated `key=value`, order-insensitive; optional groups are omitted
478
+ (never written empty) when the snapshot lacks them. `login_at` is the
479
+ credentials-file mtime the post-login-lag check already reads, stamped per
480
+ sample so an account switch becomes data; `pct` / `resets_at` are the 5h
481
+ values verbatim and `pct_7d` / `resets_7d` the weekly ones. The log is
482
+ append-only (the tmp-prune / boundary-truncate conventions own cleanup), and
483
+ carries operator-local account identifiers, so it lives under the gitignored
484
+ measurement dir and never reaches a tracked file.
485
+
486
+ ## Trend reporter
487
+
488
+ `bin/usage-trend.sh` reads the history log and reports how the footprint
489
+ evolves — advisory tooling, never a gate: exit **0** report emitted, **2**
490
+ knob unset or history missing/unreadable (fail-closed, mirroring the
491
+ verdict's STALE discipline), never **1** (it renders no verdict; the verdict
492
+ stays the sole pause authority). The source signal is known-noisy — a
493
+ rolling-window reading spikes and reverts-down when a harness over-report is
494
+ corrected by the next push — so the design separates signal from noise by
495
+ the window's one physical constraint: within a segment, true usage never
496
+ decreases.
497
+
498
+ 1. **Segment** samples per axis by that axis's reset epoch, `login_at`,
499
+ `account`, and `tier`: the 5h axis keys on `resets_at`, the weekly axis
500
+ on `resets_7d` (the windows roll independently — a weekly segment spans
501
+ many 5h segments). A timer reset, a `/login`, or an account or tier
502
+ change each starts a segment; only within-segment comparisons are
503
+ meaningful, so an account switch is a boundary, not a flagged anomaly.
504
+ 2. **Flag** any sample whose pct is below an earlier one in the same segment
505
+ as a monotonicity violation: the downward correction indicts the elevated
506
+ sample(s) before it as reader noise, and both sides are excluded from rate
507
+ math, never averaged in. Median-of-3 smoothing resolves single-sample
508
+ spikes; segment endpoints keep their own value (no 2-window averaging).
509
+ 3. **Report** per segment and axis — first/last smoothed pct, pct-per-hour
510
+ rate, token deltas when token keys ride, tier, sample count, and
511
+ suspect-sample count (a high suspect ratio means the producer is
512
+ unreliable and no number from that segment is trusted). The weekly axis
513
+ additionally reports headroom against `DELEGATION_KIT_PAUSE_PCT_7D` at the current rate —
514
+ the planning number for how much delegation the week still affords — and,
515
+ when `account` is present, segments group under an account heading so a
516
+ rotating operator reads one weekly trajectory per account rather than an
517
+ interleaved stream.
518
+
519
+ ## Layout and configuration
520
+
521
+ ```
522
+ delegation-kit/
523
+ bin/usage-verdict.sh
524
+ bin/usage-trend.sh # footprint trend reporter over the history log
525
+ bin/run-usage-tests.sh # verdict decision-table runner
526
+ bin/run-budget-guard-tests.sh # budget-guard decision-table runner
527
+ bin/run-trend-tests.sh # trend-reporter assertion runner
528
+ usage-tests/cases.tsv # expected-verdict <TAB> scenario knobs
529
+ usage-tests/budget-guard-cases.tsv # expected-action <TAB> scenario knobs
530
+ usage-tests/trend-history.log # fixture history for the trend runner
531
+ checks/check-gate-tamper.sh
532
+ checks/check-rule-citation.sh
533
+ gate-tests/check-gate-tamper/{good,bad}/
534
+ gate-tests/check-rule-citation/{good,bad}/
535
+ templates/agent-execution.md # full protocol, bound as a skill shim
536
+ templates/dispatch-checklists.md # deletion/rename/audit pre-flight, reached by a pointer
537
+ templates/agent-budget-guard.sh # PreToolUse(Agent) budget guard
538
+ templates/statusline-usage.sh # push usage.txt producer (statusline hook) + status bar
539
+ templates/usage-poller.sh # poll usage.txt producer (timer-driven, fail-soft)
540
+ templates/delegation-config.sh # knob overrides (arrays live here)
541
+ smoke/install.sh
542
+ smoke/violation.sh
543
+ ```
544
+
545
+ Config follows the established kit pattern: copy
546
+ `templates/delegation-config.sh` into the gates dir (or point
547
+ `DELEGATION_KIT_CONFIG_FILE` elsewhere) and override any knob; defaults
548
+ fill what the consumer left unset. The loader is fail-closed: a
549
+ `DELEGATION_KIT_CONFIG_FILE` named but absent, or a config leaving any knob
550
+ malformed, exits 2 (a broken machine gates nothing). Knobs (this repo's
551
+ layout as defaults):
552
+
553
+ - `DELEGATION_KIT_USAGE_FILE` — default
554
+ `${CLAUDE_CONFIG_DIR:-$HOME/.claude}/usage.txt`; positional `$1`
555
+ overrides (test injection).
556
+ - `DELEGATION_KIT_CRED_FILE` — default the usage file's sibling
557
+ `.credentials.json`; positional `$2` overrides.
558
+ - `DELEGATION_KIT_USAGE_ENDPOINT` — the poll producer's usage source; default
559
+ `https://api.anthropic.com/api/oauth/usage`. The test seam (a `file://` stub)
560
+ and the stability valve when the unpublished source moves (§The usage.txt
561
+ contract).
562
+ - `DELEGATION_KIT_PAUSE_PCT` — default `80`.
563
+ - `DELEGATION_KIT_PAUSE_PCT_7D` — weekly-axis pause threshold; default `95`,
564
+ deliberately looser than the 5h axis: a weekly PAUSE is remediated in days,
565
+ not hours, so pausing at the 5h conservatism would strand a fifth of the
566
+ week's budget — only the true red zone stops delegation on this axis.
567
+ - `DELEGATION_KIT_STALE_AGE` — default `600` (seconds).
568
+ - `DELEGATION_KIT_LOGIN_WINDOW` — default `600` (seconds).
569
+ - `DELEGATION_KIT_REFRESH_CMD` — the command `usage-verdict` runs before
570
+ reading the snapshot (§usage-verdict); default empty, which keeps the
571
+ read-only behavior. This repo points it at the poll producer, run in place
572
+ from its template path.
573
+ - `DELEGATION_KIT_REFRESH_MIN_AGE` — the refresh short-circuit (§usage-verdict);
574
+ default `60` (seconds), validated a non-negative integer by the loader. The
575
+ floor is set by the render path, not the dispatch path: the statusline calls
576
+ the verdict on every render, so the default bounds source traffic to roughly
577
+ one poll a minute while leaving any dispatch-time reading fresh enough to act
578
+ on.
579
+ - `DELEGATION_KIT_USAGE_HISTORY` — sample-log path; default empty (sampling
580
+ off). This repo sets `.metric/usage-history.log`, a gitignored persistent
581
+ measurement trend (drift-kit/SPEC.md §Layout and configuration owns the
582
+ metric-dir retention contract).
583
+ - `DELEGATION_KIT_FAN_WIDTH` — read-only-fan-out width bound; default `2`,
584
+ validated a positive integer by the loader. It bounds read-only fan-outs
585
+ only: a committing fan-out serializes or takes its own worktree regardless
586
+ (the template's **Serialize on shared files; ≤`DELEGATION_KIT_FAN_WIDTH`-wide
587
+ otherwise** rule), so this knob is never a licence to widen concurrent
588
+ committers.
589
+ The default is the loss-bounding invariant — bound the in-flight loss to
590
+ what the window can absorb when the wall fires mid-flight — at a Pro-class
591
+ subscription window; a Max-class window absorbs more, and an API-billed
592
+ operator has no mid-flight window wall at all, so there spend rate and the
593
+ provider's rate limits replace the rationale. A consumer retunes from the
594
+ invariant, not the number. **Supervision ceiling:** operator attention over
595
+ N concurrent reports does not scale with the budget window — a bigger
596
+ window raises the affordable width, not the reviewable one, so budget is
597
+ never the sole input to widening. `usage-verdict` surfaces the live value
598
+ as the `width=` field (§usage-verdict), the knob's mechanical reader.
599
+ - `DELEGATION_KIT_GATE_FILES` — globs naming gate files for tamper
600
+ assertion A; default
601
+ `("${GATE_SDK_GATES_DIR:-scripts}/check-*.sh")` plus the gate-sdk lib and
602
+ runners. A consumer declaration **replaces** this default outright rather
603
+ than extending it — the loader guards it with `declare -p … ||`, so the
604
+ default is the no-declaration fallback, not a base to append to. A consumer
605
+ adding kit-shipped globs must therefore restate any default glob it still
606
+ wants covered (this repo's config names `*/checks/*.sh` **and**
607
+ `scripts/check-*.sh`, because it has gates in both places). Contrast
608
+ `DELEGATION_KIT_META_PATHS` below, whose kit-root union *is* additive — the
609
+ two knobs do not behave alike.
610
+ - `DELEGATION_KIT_META_PATHS` — prefixes counted as meta-layer for
611
+ assertion A; default `("${GATE_SDK_GATES_DIR:-scripts}/"
612
+ "${GATE_SDK_WORKFLOW_DIR:-.workflow}/" ".claude/")`; root-level `*.md` is
613
+ always meta. When `gate.sh` is resolvable (`GATE_SDK_LIB`, else the vendored
614
+ sibling), the loader unions every `gate_kit_roots` member into this array as a
615
+ root-relative `dir/` prefix — a vendored kit's edits are meta-layer by
616
+ definition, so the consumer's config need not name kit dirs at all (this
617
+ repo's keeps only the non-kit prefixes). The union is additive, never a
618
+ filter: a
619
+ prefix the consumer declared cannot be lost, and without `gate.sh` the config
620
+ is used exactly as written.
621
+
622
+ `check-gate-tamper` registers in the consumer's `gates.list`
623
+ (tier: precommit) — in this repo's too; dogfooding is day-one, and agents
624
+ commit here.
625
+
626
+ `agent-budget-guard.sh` is not a gate — it is a hook, so it registers not in
627
+ `gates.list` but under `PreToolUse` matcher `Agent` in the consumer's
628
+ `.claude/settings.json` (beside the guard-kit Bash guard). Copy the template
629
+ into the gates dir and wire `bash scripts/agent-budget-guard.sh`; it resolves
630
+ `guard-kit/lib/guard.sh` and `bin/usage-verdict.sh` at their vendored paths,
631
+ overridable with `GUARD_KIT_LIB` / `DELEGATION_KIT_VERDICT_BIN`. Registration
632
+ is the whole opt-in: unwired, the guard is inert. This repo registers it, and
633
+ its consumer session brief (`scripts/session-context.sh`) additionally prints
634
+ the verdict line at SessionStart for planning-time visibility — a consumer-side
635
+ edit; the context-kit template stays uncoupled from delegation-kit.
636
+
637
+ ## Testing
638
+
639
+ `check-gate-tamper` speaks the full gate contract (`GATE-TAMPER: clean
640
+ (…)` / findings + `help:` lines / exit 0-1-2) and ships the standard
641
+ `good/`+`bad/` fixture pair driven through `--fixture` by gate-sdk's
642
+ `run-gate-tests.sh`.
643
+
644
+ `check-rule-citation` speaks the same gate contract and ships the standard
645
+ `good/`+`bad/` fixture pair (a citation resolving to a template lead-in vs one
646
+ naming an absent lead-in), driven by `run-gate-tests.sh` over fixture-local
647
+ spec + template files passed as its two positional arguments.
648
+
649
+ `usage-verdict` does not fit the gate contract (a three-state verdict, not a
650
+ clean/violation pair), so — like guard-kit's guard-tests — the kit ships
651
+ its own decision-table runner: `usage-tests/cases.tsv` pairs an expected
652
+ verdict token (`OK`/`PAUSE`/`STALE`/`RESET-OK`) and exit code with scenario
653
+ knobs (percentage, snapshot age offset, reset offset, credential age);
654
+ `bin/run-usage-tests.sh` materializes each case as a generated snapshot
655
+ file (timestamps must be computed relative to *now* — static fixtures
656
+ would age into permanent STALE) and asserts verdict and exit code. Each
657
+ case runs in a throwaway sandbox with no consumer config on the lookup
658
+ path **and** with ambient `DELEGATION_KIT_*` exports stripped at each gate
659
+ invocation, so the gate exercises its own defaults hermetic to the host
660
+ repo — the decision table encodes those defaults, and a host override (a
661
+ raised pause threshold, say) must not reshape it. The trend and
662
+ budget-guard runners below share the strip, each runner under a deliberate
663
+ poison export that fails its own table loudly if the strip ever breaks;
664
+ `cases.tsv` columns are `verdict exit pct age_off reset_off cred_age pct_7d
665
+ reset7d_off append axis desc` (the offsets seconds from *now*; `pct_7d` `-`
666
+ omits the weekly keys, `append` is the expected sample-line count, `axis`
667
+ asserts which window a PAUSE names). Every verdict branch and both pause axes
668
+ carry a firing and a non-firing case — the fixture-pair discipline,
669
+ transplanted — covering a weekly PAUSE while 5h is comfortable, the axis
670
+ named in the output, absent keys disarming the weekly axis, a dead weekly
671
+ window not pausing, each axis's at-or-over boundary (a reading exactly at the
672
+ threshold pauses; just under does not), both directions of the login reroute
673
+ (an under-threshold percentage with a fresh login is STALE, not OK; an
674
+ at-or-over one on either axis is still PAUSE, not STALE — the asymmetry is
675
+ what keeps the reroute from waving an unaffordable dispatch through), and the
676
+ sample-append discipline (a parsed snapshot
677
+ appends one line whatever the verdict; a non-numeric snapshot appends none;
678
+ `pct_7d` present-vs-omitted in the passed-through line).
679
+
680
+ The demand-driven refresh needs a command seam the table's columns do not
681
+ carry, so it is asserted beside the table through a stub
682
+ `DELEGATION_KIT_REFRESH_CMD` (a real
683
+ poll would need the network): **armed** — a stale snapshot invokes the command
684
+ and the verdict reads the values the refresh wrote, not the cached ones;
685
+ **fail-soft** — a non-zero stub leaves the snapshot byte-identical, the verdict
686
+ proceeds and the cached reading is judged STALE by the existing staleness
687
+ machinery, and no refresh diagnostic leaks into the relayed verdict line;
688
+ **short-circuit** — a snapshot under `DELEGATION_KIT_REFRESH_MIN_AGE` never invokes the
689
+ command. Armed and short-circuit are the firing/non-firing pair over the same
690
+ stub, so the absence proves the floor rather than a broken stub.
691
+
692
+ The **roll witnesses** need a pre-seeded history tail the table's columns do
693
+ not carry, so they are asserted beside it too, over one fixed shape — a low
694
+ percentage with a credentials mtime inside the login window, which without a
695
+ witness is STALE. Both witnesses present verdicts OK; each of the four ways
696
+ the log can fail to answer holds the STALE — the boundary unmoved, the
697
+ previous boundary uncrossed, a tail with a non-numeric `resets_at`, and no
698
+ history at all. The two single-witness cases are the discriminating pair: they
699
+ prove the conjunction is load-bearing rather than either witness carrying it
700
+ alone. A sixth case asserts the read is not self-witnessing — a run with an
701
+ empty log still STALEs and leaves exactly its own sample behind, so the
702
+ witness can only ever be a previous reading.
703
+
704
+ `usage-trend` is likewise not a gate (it renders no clean/violation
705
+ verdict), so it ships an assertion runner, `bin/run-trend-tests.sh`, over a
706
+ static fixture history `usage-tests/trend-history.log` (static epochs are
707
+ safe — the reporter measures within-segment deltas, never against *now*). It
708
+ asserts per-axis segmentation at a reset boundary, a `login_at` change, and
709
+ an account change; per-account grouping reuniting a weekly trajectory across
710
+ a switch-back; a spike-then-correction flagged and excluded rather than
711
+ averaged; token deltas and weekly headroom on the report; and the
712
+ fail-closed exits (knob unset / history missing → 2). No fixture pair owed —
713
+ neither script is a gate.
714
+
715
+ `agent-budget-guard.sh` is a hook, not a gate, so it speaks exit-2 + hook
716
+ JSON rather than the gate output contract — and like the verdict it ships a
717
+ decision-table runner beside the verdict tests: `usage-tests/budget-guard-cases.tsv`
718
+ pairs an expected action (`block`/`advise`) with the same snapshot knobs
719
+ (`action pct age_off reset_off cred_age desc`, `pct=UNREADABLE` for the
720
+ no-snapshot case), and `bin/run-budget-guard-tests.sh` drives the *template*
721
+ with each injected snapshot — feeding an Agent hook JSON on stdin, pointing
722
+ `DELEGATION_KIT_USAGE_FILE` at the generated fixture — and classifies the
723
+ result: PAUSE → `block` (exit 2, verdict on stderr), OK/RESET-OK/STALE/unreadable
724
+ → `advise` (exit 0, verdict in `additionalContext`). The block branch carries
725
+ its firing (PAUSE) and non-firing (the four advise cases) — the fixture-pair
726
+ discipline again — and every case asserts the live verdict text rides the
727
+ output so a memory-quoted percentage cannot be the acting source.
728
+
729
+ `smoke/install.sh` copies the templates and `bin/` tools into the scratch
730
+ consumer, registers the tamper gate, and drives one crafted snapshot
731
+ through `usage-verdict` asserting a verdict — self-verifying install. It opens
732
+ with **one hermetic env prelude covering the whole file**: it strips the whole
733
+ `DELEGATION_KIT_*` namespace and then sets the knobs with no per-call home —
734
+ sampling off, and both pause thresholds at the defaults the 95% reading is
735
+ judged against. A prelude rather than per-instance pins because
736
+ instance-pinning has already missed
737
+ once by construction: a pass that pinned the two knobs then biting left the
738
+ third, and the survivor was the one whose failure is **silent** — an
739
+ unpinned history path makes every smoke verdict append a synthetic sample
740
+ into whatever trend log the ambient config names, indistinguishable in shape
741
+ from a real operator reading. That this repo's runs happened not to pollute
742
+ was accidental, not designed: the harness runs the file with cwd = the
743
+ scratch consumer root and the configured history path is *relative*, so the
744
+ appends died with the scratch tree — hermeticity that evaporates the moment a
745
+ consumer configures an absolute path or the file is invoked from a real tree.
746
+ Stripping the whole namespace is the shape that cannot miss a third knob.
747
+ The credentials pin stays **at each invocation** rather than moving into the
748
+ prelude, because gate-sdk/SPEC.md §check-test-hermetic reads it there — a
749
+ line-local pin is evidence a reader and a gate can both see without tracing
750
+ file-level state — and the poller's own snapshot, credentials and endpoint
751
+ paths stay inline too, being genuine per-call arguments the prelude has no
752
+ business pre-empting. That
753
+ assertion is **code-specific**: the 95% guard captures the exit status and
754
+ compares it to the PAUSE code, reporting the status it observed rather than
755
+ claiming an outcome it did not establish, so a STALE regression cannot pass
756
+ under a "did not PAUSE" message (gate-sdk/SPEC.md
757
+ §check-assertion-strength, the gate for the class). It also
758
+ drives the poll producer through its `file://` stub seam: the happy path
759
+ writes a contract-valid snapshot (asserted by driving it through
760
+ `usage-verdict`), and a fetch failure exits non-zero leaving a pre-seeded
761
+ snapshot byte-identical — the fail-soft contract, exercised end to end.
762
+ `smoke/violation.sh` stages a gate edit co-staged with a product file in
763
+ the scratch consumer and asserts the battery reds (assertion A) — the
764
+ violation is craftable, so the file is mandatory
765
+ (gate-sdk/SPEC.md §Consumer smoke).
766
+
767
+ ## Out of scope
768
+
769
+ A consumer's validate battery (its compile/lint/test command set and rename
770
+ corruption sweeps), its shared-file roster, and its width/burn anecdotes tied
771
+ to specific sweeps are rule content, referenced only as marked-section
772
+ examples. A task-output tailer is not shipped: such a tool hardcodes local
773
+ harness paths and exists to violate the template's **Background + notification,
774
+ never poll** rule for debugging. The
775
+ `usage.txt` write contract and a reference producer rendering the gauge bars
776
+ and `iteration@stage` readout do ship (the producer's ANSI is self-contained,
777
+ pulling no external asset); a consumer's *particular* statusline styling and
778
+ any asset its own gauges pull are not the rendering mechanism and stay with
779
+ it. The split is protocol and mechanisms here, a consumer's rosters,
780
+ batteries, and bespoke UX in its own copies.