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,1861 @@
1
+ # gate-sdk — a self-testing lint framework for prose/spec/config surfaces
2
+
3
+ Machine-gated consistency for the surfaces conventional linters ignore:
4
+ markdown specs, glossaries, task queues, config projections, diagrams — any
5
+ text whose drift is mechanically decidable. A **gate** is a small shell script
6
+ that checks one invariant across one or more governed surfaces and blocks the
7
+ commit (or the merge) when they disagree.
8
+
9
+ The kit carries the generic mechanism only; a consumer's rule content (term
10
+ lists, coupling vocabularies, glossary bodies) stays in the consumer repo.
11
+
12
+ ## Layout and configuration
13
+
14
+ The kit is vendored (or submoduled) into a consumer repo, conventionally at
15
+ `gate-sdk/`. The consumer owns a **gates directory** (default `scripts/`,
16
+ override with `GATE_SDK_GATES_DIR`) holding:
17
+
18
+ - `gates.list` — the registry: one gate name per line (`#` comments and blank
19
+ lines ignored). A listed name resolves to `<gates-dir>/<name>.sh` first, then
20
+ each vendored kit's `checks/<name>.sh` — so any kit's shipped gates are
21
+ registered by name alone, and a consumer can shadow one by dropping a
22
+ same-named file in its own gates dir. The kit set defaults to gate-sdk plus
23
+ every sibling directory holding a `checks/` **or** a `smoke/` (a vendored
24
+ Checkwright kit — a gateless kit is discovered by its `smoke/` alone);
25
+ override with `GATE_SDK_KIT_DIRS` (space-separated kit roots).
26
+ - the consumer's own `check-*.sh` gates (copy-edits of
27
+ `templates/check-skeleton.sh`).
28
+ - `gate-tests/` — the consumer's fixture tree (see §run-gate-tests).
29
+ - `git-hooks/` — the generated `pre-commit` (see §gen-pre-commit) and any
30
+ hand-written hooks.
31
+ - `gate-sdk-config.sh` — optional persistent config: a sourced shell file that
32
+ sets any `GATE_SDK_*` layout knob so the override outlives the shell that set
33
+ it (see the loader paragraph below).
34
+ - `graph-vocab.sh` — optional rule content for `check-graph` (see there).
35
+ - `graph-theme.sh` — optional consumer theme for `check-graph`'s emitted
36
+ artifact (see there).
37
+ - `core-files.list` — optional manifest for `check-core-files`: the
38
+ repo-relative paths that must stay present and tracked (see there).
39
+ - `identity.conf` — optional manifest for `check-identity`: the git identity
40
+ (committer email, remote host) this clone must resolve to (see there).
41
+ - `root-allowlist.list` — optional manifest for `check-root-tiering`: the
42
+ tracked top-level entries permitted at the repo root (see there).
43
+ - `msg-patterns.list` — tracked banned-pattern list for `check-commit-msg` /
44
+ `check-tree-terms` (generic patterns; copy `templates/msg-patterns.list`);
45
+ `msg-patterns.local.list` — its gitignored companion for private terms, which
46
+ must never be tracked (tracking the banned terms would itself be the leak).
47
+
48
+ Environment overrides, all optional: `GATE_SDK_GATES_DIR` (default `scripts`),
49
+ `GATE_SDK_TESTS_DIR` (default `<gates-dir>/gate-tests`), `GATE_SDK_HOOKS_DIR`
50
+ (default `<gates-dir>/git-hooks`), `GATE_SDK_WORKFLOW_DIR` (default
51
+ `.workflow`; the directory's two-tier membership rule, header form, and
52
+ extension rule are §The workflow directory), `GATE_SDK_GRAPH_ARTIFACT` (default
53
+ `<workflow-dir>/CHECK-GRAPH.html`; the emitted coupling-graph artifact's path,
54
+ read by `check-graph` assertion E — set it to republish the artifact elsewhere,
55
+ e.g. a served docs page), `GATE_SDK_TMP_DIR` (default `.tmp`), `GATE_SDK_VERBOSE`
56
+ (default unset = quiet green; any non-empty value restores the full per-gate
57
+ banner roll on `run-gates.sh` and the generated hooks — see §run-gates),
58
+ `GATE_SDK_QUEUE_FILE` (default `TASK-QUEUE.md`), `GATE_SDK_AGENT_FILE` (default
59
+ `CLAUDE.md`; the always-loaded agent file a consumer's harness reads — set it to
60
+ `AGENTS.md` under an agent-file harness, and `check-root-tiering`'s built-in
61
+ allowlist accepts that file at root), `GATE_SDK_GRAPH_THEME` (default
62
+ `<gates-dir>/graph-theme.sh`; the optional consumer theme file `check-graph`
63
+ sources to inline host-site tokens/chrome into the emitted artifact — see
64
+ there), `GATE_SDK_GRAPH_EXTERNAL_REFS` (default empty; space-separated URL
65
+ prefixes the `check-graph` external-ref assertion sanctions beyond the
66
+ kit-seeded mermaid import — a consumer whose theme chrome links absolute URLs
67
+ lists their prefixes here — see §check-graph), `GATE_SDK_CORE_FILES_FILE` (default
68
+ `<gates-dir>/core-files.list`), `GATE_SDK_IDENTITY_FILE` (default
69
+ `<gates-dir>/identity.conf`), `GATE_SDK_PRUNE_DIRS` (default
70
+ `target .git node_modules .tmp gate-tests`), `GATE_SDK_GRAPH_VOCAB` (default
71
+ `<gates-dir>/graph-vocab.sh`), `GATE_SDK_KIT_DIRS` (default: gate-sdk + its
72
+ siblings holding a `checks/` or a `smoke/`), `GATE_SDK_ROOT` (default: the
73
+ vendored `gate-sdk/` resolved beside the sourcing script — the root a
74
+ consumer-copied gate sources `lib/gate.sh` from and the anchor kit roots
75
+ relativize against), `GATE_SDK_ROOT_ALLOWLIST` (default
76
+ `<gates-dir>/root-allowlist.list`), `GATE_SDK_REGISTRY_DOC` (default `README.md`)
77
+ and `GATE_SDK_RUNNER_DOC` (default `README.md`) for `check-kit-registration`,
78
+ `GATE_SDK_MSG_PATTERN_FILES` (default
79
+ `<gates-dir>/msg-patterns.list`; space-separated, each tracked and required —
80
+ fail-closed when missing), `GATE_SDK_MSG_PATTERN_FILES_LOCAL` (default
81
+ `<gates-dir>/msg-patterns.local.list`; gitignored, skipped when absent so a
82
+ fresh clone without the operator's private list still commits),
83
+ `GATE_SDK_COMMIT_TYPES` (default
84
+ `feat fix refactor perf docs test build ci chore style`; the shared
85
+ commit-type roster — see §check-commit-subject), `GATE_SDK_EXEC_GLOBS`
86
+ (default `*/checks/*.sh */kpis/*.sh */bin/*.sh` plus the computed
87
+ `<gates-dir>/check-*.sh` and `<gates-dir>/kpi-*.sh`; the path globs whose
88
+ tracked `*.sh` members `check-exec-bit` holds to index mode `100755` — see
89
+ there), `GATE_SDK_EXEC_PRUNE` (default `gate-tests fixtures templates smoke`;
90
+ the path segments whose subtrees `check-exec-bit` exempts — see there), `GATE_SDK_ENFORCE_SCAN_DIR` (default `.`; the enforcement map's
91
+ monitor-marker scan root — see §enforcement-map), and
92
+ `GATE_SDK_LINT_EXTRA_DIRS` (default empty; space-separated directories whose
93
+ direct `*.sh` members join `check-shellcheck`'s derived scan set — the seam for
94
+ a shipped script that sits under no kit root — see §check-shellcheck). Paths are
95
+ repo-root-relative; every entry point `cd`s to `git rev-parse --show-toplevel`
96
+ before resolving them.
97
+
98
+ `lib/gate.sh` auto-sources the consumer config seam on load, so every gate (all
99
+ source the library) sees the same knob resolution: `GATE_SDK_CONFIG_FILE` when
100
+ set — and a set-but-missing path exits 2 rather than silently running on
101
+ defaults (an operator typo must not pass as clean) — else
102
+ `<gates-dir>/gate-sdk-config.sh`, sourced only when the file exists — a
103
+ zero-config consumer is unaffected. Env vars still win (the config file sets a
104
+ default the invoking shell may override), but the file is how an override
105
+ *persists*: an env-only knob dies with the shell that exported it, so a
106
+ consumer that must relocate a layout knob for every session sets it here. The
107
+ one knob the file cannot set is `GATE_SDK_GATES_DIR`, which locates the file
108
+ itself — it stays env-or-default (a config file cannot name its own directory).
109
+
110
+ ## The workflow directory
111
+
112
+ `GATE_SDK_WORKFLOW_DIR` (default `.workflow`) is where every kit writes its
113
+ committed projections and its local capture. gate-sdk owns the knob, so it owns
114
+ the directory's contract; the kits that write into it own their individual
115
+ files.
116
+
117
+ **Two tiers, partitioned by tracking.** Every member is either a **checked
118
+ projection** (tracked, committed, gate-read) or **local capture** (gitignored,
119
+ advisory, drained by a named reclaim path). A member that is neither tracked nor
120
+ ignored is the drift state `check-workflow-tiering` refuses: an uncommitted file
121
+ no reviewer sees and no `.gitignore` line accounts for.
122
+
123
+ **The header requirement follows tracking, and it must.** Local capture's
124
+ reclaim path is whole-file truncation (`: > <file>`, the shape every capture
125
+ log's close-stage step uses), which erases a header on every drain. A header
126
+ requirement on that tier would fight the tier's own reclaim mechanism — either
127
+ the header is re-seeded on every clear, adding a writer to a surface whose whole
128
+ point is that any appender may write it, or it decays to a rule violated by
129
+ correct operation. So: **checked projections carry the header; local capture
130
+ carries none.** That asymmetry is the substantive content of the
131
+ tracked-vs-gitignored axis, not a convenience.
132
+
133
+ **The header form.** A checked projection's first line is `# contract: `
134
+ followed by one of two ruled payloads:
135
+
136
+ - **Pointer form** — `<owner-path> §<section>`, optionally followed by an
137
+ em-dash tail (` — ` then a line grammar or a gloss). The path is a tracked
138
+ file and the section resolves;
139
+ `check-spec-pointer` already owns that resolution, and the em-dash tail is
140
+ already stripped before heading matching, so a grammar line may ride the same
141
+ header as its pointer. This is the default form.
142
+ - **Version-marker form** — `<format-name> v<N>` (`^[a-z0-9-]+ v[0-9]+$`), used
143
+ only where a gate parses the header itself as a wire-format version. The
144
+ owning SPEC states that it does — evidence-kit/SPEC.md §Evidence manifest is
145
+ the one such statement in this tree.
146
+
147
+ Requiring *some* header would gate nothing — the tracked side already satisfies
148
+ it — so the requirement is the **prefix with a ruled payload**. Both payload
149
+ forms are machine-recognizable, which is what keeps the rule a rule rather than
150
+ a description.
151
+
152
+ **The extension rule keys on writer and reader, not on tier.** These are two
153
+ independent axes, and conflating them is why the convention resisted statement:
154
+ the directory holds tracked `.md` beside gitignored `.md`, so no extension
155
+ tracks tracking.
156
+
157
+ - `.txt` — a **record file with a stated line grammar** that a gate or `bin/`
158
+ affordance parses field-wise.
159
+ - `.md` — a **prose surface a human reads and dispositions**, machine-read only
160
+ for emptiness or for a bullet count.
161
+ - `.log` — an **append-only capture stream** written by tooling at the moment of
162
+ an event, triaged in bulk and cleared wholesale; no per-line grammar contract,
163
+ which is exactly why nothing parses it field-wise.
164
+
165
+ A new file's extension is therefore determined, not chosen: ask which of the
166
+ three describes its writer and its reader. The extension rule is deliberately
167
+ **not** gated — deciding whether a file is a record, a prose surface, or a
168
+ capture stream is the judgment the rule exists to guide, and mechanizing it
169
+ would mean inferring a writer's intent from a file's bytes. Under the
170
+ enforcement-first carve-out it takes the other disposition available to an
171
+ un-gateable class: a cadenced review entry on the consumer's audit roster, due
172
+ at each workflow-directory addition.
173
+
174
+ The tracked tier is also the surface canon-kit's comment gates read — the
175
+ governed comment/pointer surface admits a workflow member iff it is tracked,
176
+ whatever its extension, and blesses only `contract:`/`see` there
177
+ (canon-kit/SPEC.md §check-comment-tier).
178
+
179
+ ## The gate model
180
+
181
+ A gate family imposes test-grade rigor on prose and config surfaces, but a gate
182
+ whose own correctness is unverified silently stops enforcing — production use
183
+ attested two *self-broken* gates (a false-green on a crashed `awk`; two scanner
184
+ crashes) before the four contracts below were adopted.
185
+ The family tests, lints, and constrains itself by the same standard it holds
186
+ the governed tree to.
187
+
188
+ ### Output contract
189
+
190
+ A gate signals success with exactly one line `^<NAME>: clean (<parenthetical>)$`,
191
+ where `<NAME>` is the gate's stable upper-token id and the parenthetical states
192
+ what was checked. One canonical success token across the whole family — a gate
193
+ that "passes silently" is indistinguishable from one that did nothing. Failure
194
+ is one line per finding (location + what is wrong) then a `help:` remedy line
195
+ naming the concrete action — the model is the Rust compiler's `help:`, not a
196
+ restatement of the violation. A gate with multiple distinct failure classes
197
+ gives each its own `help:` line. Exit codes: **0** clean, **1** violation,
198
+ **2** harness/usage error.
199
+
200
+ Enforced by `check-gate-output` (the static half — it asserts each member's
201
+ source carries both a `: clean` emission and a `help:` emission); the `good/`
202
+ fixture is the behavioral half that catches a clean line that never executes.
203
+
204
+ ### Fail-closed contract
205
+
206
+ A gate that captures a subprocess's stdout and branches on the captured value's
207
+ **emptiness** false-greens when that subprocess crashes: the output is empty,
208
+ so the gate prints `clean` — but the check never ran. The fix is to key on the
209
+ subprocess **exit status**. The wrapper is centralized in `lib/gate.sh`; source
210
+ it and call `fail_closed` right after a capture:
211
+
212
+ ```bash
213
+ out="$(awk '…' "$FILE")"; st=$?
214
+ fail_closed "$st" check-foo awk # non-zero status -> exit 2, never a false clean
215
+ ```
216
+
217
+ Wrap an `awk`/`jq` capture that reads a **file** and feeds the verdict. Leave
218
+ alone — and a sweep must NOT blanket-wrap — `grep`'s exit-1-on-no-match
219
+ (expected, not an error), an already-status-checked capture, and in-memory
220
+ transforms (`<<<` here-strings, trivial field selectors that cannot fail on
221
+ present input). Enforced by `check-gate-fail-closed`; a genuinely-safe capture
222
+ opts out with `# fail-closed-exempt: <reason>` on the comment block immediately
223
+ above it. The helper itself is tested directly by
224
+ `gate-tests/lib-gate.test.sh` (a per-gate input fixture cannot prove it — a
225
+ well-formed `awk` cannot be crashed on present input).
226
+
227
+ ### Fixture-pair discipline
228
+
229
+ When a gate is written or edited, it ships with — or updates — its
230
+ `good/`+`bad/` fixture pair under `<tests-dir>/<gate>/`, run by
231
+ `run-gate-tests.sh`. A gate that prints `clean` on broken input is invisible to
232
+ every static check; the only proof it fails closed and that its error text is
233
+ right is a known-bad input (the `bad/` case asserting exit 1 + an `expect.txt`
234
+ substring), paired with a `good/` case asserting acceptance. Coverage is
235
+ enforced by `check-gate-fixture-coverage`: every registry member carries either
236
+ a pair or a `# no-fixture: <reason>` header annotation — the honest, reviewable
237
+ escape for whole-tree scanners whose state has no static-fixture representation
238
+ (e.g. a HEAD-vs-worktree diff). A fixture-*capable* gate carrying the valve as
239
+ a stopgap is filed as debt and fixtured, never given a dishonest "infeasible"
240
+ reason.
241
+
242
+ ### Self-lint
243
+
244
+ Every script in the family — the consumer's gates and the kit's own `lib/`,
245
+ `bin/`, `checks/`, `templates/` — passes ShellCheck at `-S warning`, enforced
246
+ by `check-shellcheck`. Template stubs are lint-governed (they are runnable
247
+ shell a consumer copies out) — and `check-comment-tier` governs their comments
248
+ too: a copied-out template's `spec:` line resolves against the vendored kit
249
+ path, so its comments are directives like any source, thinned to the
250
+ `# graph:`/`# spec:` lines and the placeholder scaffolding the consumer fills
251
+ in (canon-kit/SPEC.md §check-comment-tier). Only `check-spec-pointer` skips a
252
+ template, its `spec:` line being a placeholder unresolvable by design
253
+ (§check-spec-pointer) — so the template↔copy relationship itself is governed
254
+ separately, by §check-template-copy-parity, whose assertion A is the only
255
+ mechanism that resolves a template's target at all. A template's post-copy
256
+ `source` paths are legitimate. A
257
+ false positive is silenced inline with `# shellcheck disable=SCxxxx` plus a
258
+ justifying comment, never a blanket `.shellcheckrc`.
259
+
260
+ ### Shared cross-gate values
261
+
262
+ A value or small lookup needed by ≥2 gates lives in `lib/gate.sh` as the single
263
+ source — reference it, never re-literal it per gate. This is deliberately *not*
264
+ a base library: it shares **values and walk adapters**, never gate structure
265
+ (structure is copied from the skeleton, so it stays per-gate and legible), and
266
+ its failure mode is loud — a missing or malformed `lib/gate.sh` aborts every
267
+ sourcing gate at the `source` line, the fail-closed direction.
268
+
269
+ ### Calibration lessons (paid for, now design rules)
270
+
271
+ - **Wrap-aware matching.** When a gate's signal token can hard-wrap on a
272
+ ~80-col prose surface, match over the joined logical unit, not the physical
273
+ line, and prove it with a wrapped-case `bad/` fixture.
274
+ - **Scope a sentinel allowance to its phase.** A gate that admits a bootstrap
275
+ value (`—`, `TODO`, `0`) with a blanket allowance leaks it past the one phase
276
+ it was meant for; bind the allowance to the phase.
277
+ - **Exclude the fixture tree from whole-tree discovery.** A gate that discovers
278
+ inputs by a shape its own fixtures also carry descends into the fixture tree
279
+ and false-reds — and a *different* gate's fixtures can break yours. Use
280
+ `lib/gate.sh`'s prune adapters: a `find` walk → `gate_find <root> <expr…>`
281
+ (parenthesize a multi-term expression — `gate_find` appends `-print`, and an
282
+ unparenthesized `-o` chain binds it to the last term only); a `grep -r` walk
283
+ → splice `"${GATE_GREP_EXCLUDES[@]}"`; a paths-then-filter walk →
284
+ `gate_path_pruned "$f"`.
285
+ - **Couple per surface, not per file.** When one artifact holds N
286
+ representations of the same model, each needs its own coupling edge or an
287
+ explicit ungated marker; "this file is heavily gated" silently reads as "all
288
+ of it is gated."
289
+ - **Fixtures probe the boundary, not the live tree.** A gate passing on the
290
+ real corpus is not evidence it is correct — write the pair to drive the
291
+ inputs production doesn't (last element, empty set). Last-line idiom:
292
+ `while IFS= read -r e || [[ -n "$e" ]]`.
293
+
294
+ ### When a gate earns its place
295
+
296
+ A gate is a standing cost (maintenance, false-positive friction, reading load),
297
+ so the family is sized deliberately. When a consistency property on a driftable
298
+ governed surface has a **cheap, low-false-positive, mechanically-decidable**
299
+ check, build the gate **proactively — before any attested miss**; discipline is
300
+ not an acceptable substitute for a check this class can make. A gate that is
301
+ expensive or higher-FP waits for a real miss to attest it — and the miss *is*
302
+ the `bad/` fixture. Cheap + low-FP is necessary, not sufficient: the gate must
303
+ check a real drift axis, never a trivially-true proxy (heading *presence* while
304
+ the content drifts) that manufactures false confidence. The dual rule minimizes
305
+ the standing set *subject to the guarantee being preserved*: a gate is
306
+ removable only when its guarantee is delivered another way or was never
307
+ attested. What stays human is the irreducibly semantic judgment alone — *is
308
+ this prose still true?*
309
+
310
+ ## Enforcement tiers
311
+
312
+ Three concentric tiers, each an outer backstop for the one inside it:
313
+
314
+ - **pre-commit** (opt-in, per-clone, fast) — the generated triggered subset,
315
+ catching drift in the single commit that perturbs it. Bypassable by design
316
+ (`git commit --no-verify` is a valve, not a hole, once an outer tier exists).
317
+ - **pre-push / full battery** (opt-in, per-clone, fuller) — `run-gates.sh`
318
+ whole-tree before the work leaves the machine.
319
+ - **CI** (server-side, authoritative) — `run-gates.sh` + `run-gate-tests.sh`
320
+ on every push, with branch protection making a merge conditional on them.
321
+ The copy-out is `templates/gates-workflow.yml` (see there); only this tier is
322
+ a guarantee, and it stops bypass but not workflow self-edit — the tamper-proof
323
+ verifier is the deferred hosted-attestation rung. The inner tiers are latency
324
+ optimizations.
325
+ `run-gate-tests.sh` runs as its own step, not folded into the battery —
326
+ `check-gate-fixture-coverage` asserts fixtures *exist* but never *executes*
327
+ them; the execution is the gate-authority backstop, kept separate so a
328
+ fixture-logic failure is attributed to the gate.
329
+
330
+ ## The `# graph:` manifest
331
+
332
+ Every registered gate's header carries a one-line coupling manifest:
333
+
334
+ ```
335
+ # graph: couples=<globs> dir=bi|one valve=none|PROPOSED tier=precommit|align-only|commit-msg [mode=staged|whole-tree] [trigger=<globs>] [gen=manual]
336
+ ```
337
+
338
+ - `couples=` — the surfaces the gate binds (comma-separated globs). One token
339
+ is special: `kit:<glob>`, which the shared manifest reader in `lib/gate.sh`
340
+ (`gate_expand_couples`) expands to `<kit-root>/<glob>` — repo-root-relative —
341
+ for every `gate_kit_roots` member at read time; the same reader feeds
342
+ `gen-pre-commit` (hook emission), `check-graph` (freshness + the HTML
343
+ projection), and `run-gates --for` (path-scoped selection §run-gates), so
344
+ emitter, checker, and selector cannot desync on the kit set. A
345
+ whole-tree gate writes `kit:*.sh` in place of a per-kit hand list; non-kit
346
+ couples (`scripts/*.sh`, `.workflow/*.txt`, `scripts/gates.list`) stay
347
+ literal. Expansion over-approximates by design — a kit is coupled even where
348
+ the gate's subject is narrower, so an extra trigger runs a green gate while a
349
+ missing one would skip a red — and `check-kit-enum` gates the residual
350
+ hand-lists derivation cannot reach. The corollary is a hard authoring rule:
351
+ `couples=` must *cover* every path the gate reads at runtime, never a subset.
352
+ Globs never cross `/` (and `kit:<glob>` expands one level only), so a gate
353
+ that walks a directory recursively (`find` / `gate_find`) must couple that
354
+ recursion — a `<dir>/<sub>/*.ext` sibling glob or a wider one — and never
355
+ lean on the tree holding only the shape the couple enumerates; an
356
+ under-covering couple silently skips the gate on the very edit it should
357
+ catch. `check-graph` verifies couples→hook parity, not reads⊆couples;
358
+ `check-reads-couples` (§check-reads-couples) mechanizes the reads⊆couples half
359
+ for the statically resolvable walks — so the author's duty narrows to the
360
+ undecidable remainder that gate skips-and-counts (check-shim-restatement's
361
+ stage-template subdirectory was exactly this bug).
362
+ - `dir=` — `bi` for a coupling bijection (both sides must agree), `one` for a
363
+ one-way audit.
364
+ - `valve=` — `PROPOSED` marks a cycle valve: a coupling where a leading
365
+ (design) surface may run ahead of a lagging (code) surface via a
366
+ queue-tracked marker; `none` means the sides must agree now.
367
+ - `tier=` — `precommit` gates emit a trigger block in the generated
368
+ `pre-commit` hook; `align-only` gates run only in the full battery;
369
+ `commit-msg` gates emit an unconditional invocation into the generated
370
+ `commit-msg` hook (the message-file surface, not a tracked path — see
371
+ §gen-pre-commit). Default to `precommit`; the discriminator between the first
372
+ two is not cost but whether the invariant is **restorable within the single
373
+ commit that perturbs it** — a settled-corpus audit would false-red on
374
+ work-in-progress and belongs to the full battery. A `commit-msg` gate's
375
+ `couples=` names its config files (the regeneration triggers), never a tree
376
+ path, and it no-ops cleanly under a no-argument full-battery run — the
377
+ prospective message exists only at commit time.
378
+ - `mode=staged` — the hook passes the staged subset of the trigger globs as
379
+ positional args; default (`whole-tree`) emits a bare invocation.
380
+ - `trigger=` — hook guard globs when they diverge from `couples=`; `trigger=*`
381
+ emits an unconditional invocation.
382
+ - `gen=manual` — the gate's hook block is bespoke and round-trips verbatim
383
+ between `# >>> manual: <gate>` / `# <<< manual: <gate>` sentinels.
384
+
385
+ ## Consumer smoke
386
+
387
+ The fixture suites prove each gate in isolation on contrived case dirs, and a
388
+ consumer repo's battery runs under that consumer's own config overrides. Two
389
+ things go untested there: that a *fresh* consumer reaches green by following
390
+ the kit READMEs, and that the **kit defaults** hold on a vendored-kit tree
391
+ under zero config. The DoD-mode defect (`canon-kit-vendored-spec-dod-scope`)
392
+ shipped through exactly that gap. `bin/run-consumer-smoke.sh` closes it,
393
+ mechanizing what was a hand-repeated validate-stage prose ritual with no
394
+ committed evidence.
395
+
396
+ The harness (`run-consumer-smoke.sh [--keep] [kit-root...]`, a `bin/` tool,
397
+ never a registered gate — it builds a repo and runs the battery repeatedly, so
398
+ it is pre-commit-unfit by runtime budget): builds a scratch consumer in a fresh
399
+ temp dir (`git init`, seed commit), vendors each kit root by copy (default:
400
+ `gate_kit_roots`), and runs each kit's `smoke/install.sh` — gate-sdk first,
401
+ then argument order. It then commits the installed baseline and asserts the
402
+ full battery is green under **zero consumer config** (the positive green token
403
+ `All N gates passed` — the defaults-on-a-vendored-tree assertion no fixture
404
+ suite makes). Per kit shipping `smoke/violation.sh` it fires one crafted
405
+ violation, re-runs the battery, asserts a non-zero exit **and** a `FAIL:`
406
+ line naming the expected gate, then restores the tree (`git reset --hard &&
407
+ git clean -fd` — a hard reset, not `git checkout`, so a violation that staged
408
+ its shape is unstaged too: an index-reading gate like `check-gate-tamper` sees
409
+ only the index) before the next kit; it asserts green once more after the last
410
+ restore. Exit codes follow the gate convention (0 all hold, 1 an assertion
411
+ failed, 2 usage/environment); the success token is `CONSUMER-SMOKE: clean
412
+ (<n> kits installed, <m> violations fired)`. `--keep` retains the temp dir and
413
+ prints its path (the temp-dir write's named reclaim path).
414
+
415
+ The scratch-consumer build itself — temp dir, seed commit, vendor-by-copy, the
416
+ `smoke/install.sh` loop, the installed-baseline commit — is factored into
417
+ `lib/consumer-smoke.sh` (`csmoke_vendor_and_install`, which sets `SCRATCH` and
418
+ `CSMOKE_INSTALLED`), so a second harness that needs the same green baseline
419
+ before it diverges shares the mechanics rather than copying them. The caller
420
+ owns its cleanup trap and every assertion after the baseline commit.
421
+ context-kit's `smoke/agents-md.sh` is that second caller: it builds the same
422
+ baseline, then converts the consumer to a nondefault agent file (`AGENTS.md`)
423
+ and asserts the agent-file knobs carry it — an assertion `run-consumer-smoke.sh`
424
+ cannot make, since it fixes the kit defaults under zero config
425
+ (context-kit/SPEC.md §Testing). `bin/upgrade-smoke.sh` is the third caller: it
426
+ builds the same FROM baseline, then diverges into the two-phase upgrade proof
427
+ (§upgrade-smoke).
428
+
429
+ **The `smoke/` per-kit contract.** Every vendored kit ships a `smoke/`
430
+ directory — shipping it joins fixtures + README + SPEC in the kit-landing
431
+ checklist; a kit root lacking `smoke/` is an environment error (exit 2). Every
432
+ `smoke/` script that mutates the invoking tree — `install.sh` and
433
+ `violation.sh` both do — opens with the entry-point guard
434
+ `: "${SMOKE_KIT_ROOT:?run via run-consumer-smoke.sh}"` before its first mutating
435
+ command, so a bare invocation (outside the harness that exports
436
+ `SMOKE_KIT_ROOT`) refuses instead of writing into the caller's repo;
437
+ `check-smoke-entry-guard` (§check-smoke-entry-guard) holds the guard's presence
438
+ across the roster. The
439
+ README item of that checklist carries the register-the-gates block in
440
+ `<!-- gate-roster:begin -->` / `<!-- gate-roster:end -->` markers, held in
441
+ name-set parity with the kit's shipped `checks/` by `check-readme-roster`
442
+ (§check-readme-roster) — a kit that ships checks registers them. A new gate MAY
443
+ also gain a `pass` row in the held-constant validate baseline —
444
+ evidence-kit/SPEC.md §Baseline manifest tolerates its absence (a classification
445
+ cost only, zero enforcement loss). A new kit's
446
+ bespoke `gate-tests/*.test.sh` sources `lib/test-hermetic.sh`
447
+ (§lib/test-hermetic.sh) — one clause of the same checklist, `check-test-hermetic`
448
+ enforcing it.
449
+
450
+ - `smoke/install.sh` (required) — run with cwd = scratch-consumer root and env
451
+ `SMOKE_KIT_ROOT` = the vendored copy of the installing kit. The executable
452
+ form of that kit's README install steps: register its gates in
453
+ `scripts/gates.list`, establish the minimal governed surface its gates need
454
+ to be green, and regenerate the hook + graph artifacts. It may assume gate-sdk
455
+ is already installed (it runs first), nothing else. A non-zero exit aborts the
456
+ harness with exit 2 (a broken installer is an environment failure, not a gate
457
+ finding).
458
+ - `smoke/violation.sh` (optional) — same cwd/env contract and entry-point guard
459
+ (above); mutates the scratch
460
+ tree to introduce exactly one violation the harness restore (`git reset --hard`
461
+ + `git clean`) reverses (edit a tracked file, add an untracked one, or stage a
462
+ shape), and prints the expected gate name as its first stdout line (the
463
+ harness's red-phase assertion reads it). A kit without one contributes install
464
+ coverage only; the harness prints a notice per such kit so the gap is visible
465
+ in the evidence. The file
466
+ is rightly absent only where no battery-reddening violation is craftable —
467
+ a kit that registers no gates has nothing to redden.
468
+
469
+ **CI tool provisioning.** A gate whose oracle shells out beyond the
470
+ checkout+bash baseline (a renderer, a language runtime) is provisioned in the CI
471
+ backstop (`gates.yml`), not just locally — a green pre-commit on a dev box that
472
+ carries the tool is not a green CI, and the divergence surfaces only after push.
473
+ The provisioning step rides the consumer's filled workflow instance, never the
474
+ generic template (§templates/gates-workflow.yml), since the dependency joins the
475
+ toolchain only for a consumer that registers the gate.
476
+
477
+ **Starter-template conformance.** A kit that ships a starter template (in
478
+ `templates/`) ships it battery-clean: the template must pass the **full
479
+ battery** — every vendored kit's gates — when copied verbatim into a
480
+ combined-kit consumer, not merely the shipping kit's own gates. Kits compose,
481
+ and the first combined tree is where a per-kit-clean template still reddens a
482
+ foreign kit's gate. The obligation is mechanical, not ritual: where a kit ships
483
+ such a template, its `smoke/install.sh` installs it **verbatim** (no fill-in)
484
+ as the governed surface, so a template regression against any kit reddens the
485
+ harness instead of waiting for a hand-run validate proof. A template that
486
+ composes with a downstream kit's contract carries that kit's inert scaffold —
487
+ queue-kit's starter queue ships lifecycle-kit's iteration header so the
488
+ verbatim copy clears the stage gates too, and a single-kit adopter deletes it.
489
+
490
+ Producers and consumers: `smoke/` content is produced by the kit author at
491
+ kit-landing time and consumed by the harness's install and violation phases;
492
+ the expected-gate name (violation.sh line 1) is read by the red-phase
493
+ assertion; `SMOKE_KIT_ROOT` is produced by the harness per invocation and read
494
+ by the scripts to copy from their own kit; the harness verdict is consumed by
495
+ the validate-stage ritual (which gates on the success token) and is the natural
496
+ CI entry point (wiring CI is out of scope here).
497
+
498
+ ## Per-component contracts
499
+
500
+ ### lib/gate.sh
501
+
502
+ The family's single sourced library — values + adapters, never gate structure.
503
+ It gives a gate author the fail-closed guard `fail_closed`, the walk adapters
504
+ (`gate_find` / `GATE_GREP_EXCLUDES` / `gate_path_pruned` over `GATE_PRUNE_DIRS`),
505
+ the registry helpers that resolve a check consumer-first across kit dirs
506
+ (`gate_resolve`, `gate_kit_roots` / `gate_kit_roots_rel`, `gate_check_dirs` —
507
+ the multi-kit resolution path other kits' gates ride), and the `# graph:`
508
+ manifest readers (`gate_expand_couples` and its siblings §The `# graph:`
509
+ manifest). How each derives its result lives in the source; the invariants a
510
+ reader needs outlive the refactor that renames a helper:
511
+
512
+ - The commit-surface value adapters (`gate_msg_pattern_files`,
513
+ `gate_commit_types`) are the single home of the banned-pattern set and the
514
+ commit-type roster, each documented at its gate (§check-commit-msg,
515
+ §check-commit-subject).
516
+ - `gate_self_repo_prefix` is the single identity derivation `check-md-refs`'
517
+ resolver (canon-kit/SPEC.md §check-md-refs) and the reference-link producers
518
+ share, so an emitted link and the pass that validates it cannot derive
519
+ divergent identities; it ships no repo name — the provenance seam holds.
520
+ - `gate_fixture_suites` is the single source both the CI workflow
521
+ (`.github/workflows/gates.yml`) and evidence-kit's validate config loop over,
522
+ so adding a kit enrols its fixtures with no hand-list to drift.
523
+ - `gate_kit_roots_rel` emits the roots repo-root-relative — the anchor the
524
+ couples globs share.
525
+
526
+ `fail_closed` must be passed *only* a status that genuinely means the check
527
+ could not execute (an awk/jq/parser crash) — never `grep`'s exit 1, which is
528
+ the expected "no match"; the caller draws that line at the capture site.
529
+
530
+ ### lib/inject.sh
531
+
532
+ The marker-bounded insert/replace every kit's agent-file injector shares —
533
+ one function, `inject_marker_block <file> <begin> <end>`, taking the inner
534
+ block content on stdin. It writes `<begin>` + the piped content + `<end>` into
535
+ the target: replacing the span between an existing marker pair (inclusive) in
536
+ place, or appending a fresh block when the markers are absent, so a re-run
537
+ never duplicates. A begin marker without its end is a malformed target — it
538
+ refuses (exit 2) rather than guess the bounds; a missing target file is exit
539
+ 2. On success it echoes the action taken (`appended`|`replaced`) for the
540
+ caller to report. Block-content *generation* stays with the caller (the
541
+ lifecycle roster, the doctrine digest) — this helper owns only the placement
542
+ mechanism, so a second injector adds no second copy of the awk replace logic:
543
+ `doctrine-kit/bin/install-doctrine.sh` and
544
+ `lifecycle-kit/bin/install-lifecycle.sh` both ride it. A sourced library, not
545
+ a gate: exercised end-to-end wherever an installer that rides it runs
546
+ (doctrine-kit and lifecycle-kit `smoke/install.sh`).
547
+
548
+ ### lib/test-hermetic.sh
549
+
550
+ The bespoke-test hermeticity bootstrap, sourced as the first act of every
551
+ `gate-tests/*.test.sh` (§run-gate-tests, enforced by §check-test-hermetic). It
552
+ derives the kit roster from its own location — the `gate-sdk` and `*-kit`
553
+ subdirectories of gate-sdk's parent, a name-glob that needs no config to
554
+ bootstrap and reaches the kits whose loader lives in `bin/` (context-kit,
555
+ drift-kit) as well as the `lib/` loaders — and for each exports
556
+ `<KIT>_CONFIG_FILE` (name uppercased, `-`→`_`) pointing at one shared empty file
557
+ at `${TMPDIR:-/tmp}/gate-sdk-hermetic-empty.sh`, created idempotently with `: >`:
558
+ fixed path, always empty, so no trap (a test's own `trap … EXIT` stays
559
+ unclobbered) and no growth. Every kit loader shares one strict shape — fail
560
+ closed (exit 2) on a set-but-missing `<KIT>_CONFIG_FILE` — and the shared
561
+ *existing* empty file is a no-op source for it. Knob-free by
562
+ design: a config-pinning tool cannot itself be configured by the surface it
563
+ pins. A test that must exercise real config overrides after the source (a later
564
+ assignment, or an `env -u <KIT>_CONFIG_FILE` prefix so the loader falls back to
565
+ its cwd-relative default) — ordering wins, no opt-in flag needed.
566
+
567
+ ### run-gates
568
+
569
+ Aggregate runner: executes every `gates.list` member in one shot, timing each
570
+ (`<tmp-dir>/gate-timings.txt`, `<gate> <elapsed-ms>` per line + `TOTAL` —
571
+ uncommitted by design: a measurement, not state). A member that resolves
572
+ nowhere is a failure, not a skip. Exit 0 only when every member passed.
573
+
574
+ The output contract is **quiet green, loud red**. A passing gate prints
575
+ nothing: its captured output is discarded and the run ends with the summary
576
+ line alone, whose executed-gate count (`All N gates passed.`) is the
577
+ roster-collapse tripwire — a battery that silently shrank shows a smaller N. A
578
+ failing or erroring member prints its `===== <name> =====` banner and its
579
+ captured output verbatim, always — the red path is the feedback channel and
580
+ never quiets. `GATE_SDK_VERBOSE` (any non-empty value) restores the full banner
581
+ roll, the on-demand reading for the vacuous-pass tripwire (a "0 files scanned"
582
+ clean line is visible only in the gate's own banner). Env over flag by the kit
583
+ convention: one mechanism serves the interactive run, the generated hooks, and
584
+ any CI wrapper without an argv contract change. Gates themselves are untouched —
585
+ each still prints its single clean line per the output contract (§Output
586
+ contract); the runner captures it.
587
+
588
+ `run-gates.sh --for <path> [<path>...]` is the path-scoped selector, the
589
+ agent-callable half of the oracle-first rule: it resolves the registry exactly
590
+ as a bare run, then runs only the members whose *effective trigger* (`trigger=`
591
+ else `couples=`, expanded through `gate_expand_couples`) glob-matches at least
592
+ one given repo-relative path. Registry order and per-gate output are unchanged;
593
+ a bare `run-gates.sh` keeps its behavior. The loop this buys — edit → run
594
+ coupled gates → read the verdict+help — is strictly cheaper than reading gate
595
+ source to predict a verdict; the producer is a mid-edit session or a delegated
596
+ agent's gate-driven worklist, needing no new config (every gate already carries
597
+ the `# graph:` manifest the selection reads).
598
+
599
+ The match is **one matcher, defined as identical to the generated hook's
600
+ staged-path matching**: the glob step is `gate_staged_matches` in `lib/gate.sh`,
601
+ whose body `gen-pre-commit` emits verbatim as the hook's `staged_matches` (the
602
+ self-contained hook and the selector share one source, held in sync by
603
+ check-graph's freshness assertion §check-graph), and both draw the `# graph:`
604
+ fields through `gate_manifest_field` + `gate_expand_couples` — the single reader
605
+ §The `# graph:` manifest names. Two hook behaviors the selector reproduces
606
+ beyond that matcher: a `trigger=*` gate is selected for every path, and a
607
+ `mode=staged` gate — whose hook branch matches by git pathspec (exact path or
608
+ subtree prefix), a second mechanism — is selected exactly when that branch would
609
+ run it and receives its matching paths as positional args, as the staged branch
610
+ does. A divergence between what the hook would run for a staged path and what
611
+ `--for` runs for the same path is a bug against this contract. When no gate
612
+ couples to a given path the selector prints an explicit `no registered gate
613
+ couples to <path>` note and exits 0 — an ungoverned path is a fact, not a
614
+ failure; the selector is a `bin/` tool, never a registered gate, but its own
615
+ plumbing stays fail-closed (an unreadable registry or unresolvable member exits
616
+ non-zero).
617
+
618
+ ### run-gate-tests
619
+
620
+ Golden-fixture runner. Each `<tests-dir>/<gate>/` holds `good/` + `bad/` case
621
+ dirs; the runner `cd`s into the case dir and invokes the gate (resolved against
622
+ the consumer gates dir, then each vendored kit's `checks/`) with the args in the case's
623
+ `args` file (`#` lines stripped). `good/` must exit 0 (and, when
624
+ `good/expect.txt` exists, print its substring); `bad/` must exit 1 and print
625
+ `bad/expect.txt`'s substring — a rejection substring is required, so the *right*
626
+ finding fired. Exit 2 from a gate marks the fixture malformed (harness error,
627
+ distinct from logic failure). Fixture-pair hermeticity is the `cd` into the case
628
+ dir: a gate resolving its `<KIT>_CONFIG_FILE` under the cwd finds only the case's
629
+ own files (and a fixture may ship its own cwd-relative config deliberately).
630
+ `<tests-dir>/*.test.sh` unit tests run after the pairs; each must exit 0 — and
631
+ each runs with the **invoker's** cwd (repo root in this repo's battery), so
632
+ absent a pin a gate it drives silently inherits this repo's consumer config. The
633
+ hermeticity contract is therefore explicit: every bespoke test sources
634
+ `lib/test-hermetic.sh` (§lib/test-hermetic.sh) as its first act — pinning every
635
+ kit's `<KIT>_CONFIG_FILE` to one shared empty file so the gate runs on kit
636
+ defaults, not the consumer's posture — with `check-test-hermetic`
637
+ (§check-test-hermetic) enforcing the pairing. A case that deliberately exercises
638
+ config overrides *after* the source (a later assignment, or an
639
+ `env -u <KIT>_CONFIG_FILE` / per-invocation prefix) by ordering. A tests dir may
640
+ hold fixture pairs, bespoke unit tests, or **both**, and the runner exits 2 only
641
+ when it holds **neither** — the emptiness case, where the invocation named
642
+ nothing to test at all. So a **gateless** kit ships bespoke tests with no fixture
643
+ pair to give: it registers no gate to build a pair *around*, yet its `lib/` and
644
+ `bin/` still need testing, and the discovery rule already recognizes that kind of
645
+ kit (`gate_kit_roots` keys on `checks/` **or** `smoke/` — §lib/gate.sh). A
646
+ unit-test-only dir prints `0 pairs` beside its unit count, so the shape reads as
647
+ deliberate rather than silent. This widens what a *tests dir* may contain, never
648
+ what a *gate* may omit: a registered gate still owes its `good/`+`bad/` pair
649
+ (§check-fixture-pair). Rehoming such a test in the owning kit's own runner is
650
+ ruled out — `check-test-hermetic`'s assertion A enumerates
651
+ `<kit-root>/gate-tests/*.test.sh` only, so a test outside that directory silently
652
+ escapes the bootstrap-or-marker obligation that is the whole reason this lane
653
+ lives here. The runner is a
654
+ test layer parallel to the gates, never a `gates.list` member.
655
+
656
+ ### run-consumer-smoke
657
+
658
+ The scratch-consumer install+violation harness (§Consumer smoke): vendors the
659
+ kit roots into a fresh temp repo, drives each `smoke/install.sh`, asserts the
660
+ full battery is green under zero config, then fires each `smoke/violation.sh`
661
+ and asserts the battery reddens at the named gate before restoring. A `bin/`
662
+ tool, never a `gates.list` member — it is pre-commit-unfit by runtime budget
663
+ and is the proof that the kit defaults hold on a vendored-kit tree.
664
+
665
+ ### upgrade-smoke
666
+
667
+ The two-phase upgrade proof, `bin/upgrade-smoke.sh` — the third caller of
668
+ `csmoke_vendor_and_install` (§Consumer smoke), reusing the same green baseline
669
+ before it diverges. Where run-consumer-smoke proves a *single* release's
670
+ defaults hold, this proves the *transition* between two: it vendors every kit at
671
+ a **FROM** ref into a scratch consumer, installs and asserts the baseline is
672
+ green (a red FROM baseline is a broken tag — exit 2, not an upgrade finding),
673
+ then replaces the vendored kit directories wholesale at a **TO** ref and
674
+ regenerates the generated artifacts — the contract's consumer phase-A steps
675
+ (docs/install.md §The upgrade contract). It asserts **determinism** (the scratch
676
+ consumer's `git status` shows changes only under the kit roots and the two
677
+ regenerated artifacts — the pre-commit hook and the graph) and then, over the
678
+ phase-B battery, that the **red set is a subset of TO's tightened-gates
679
+ declaration** — the `docs/posts/` note whose front-matter `release:` names TO's
680
+ version, parsed for the bullet lead tokens docs/install.md owns. A new N+1 gate
681
+ is *not* in this consumer's `gates.list` (the phase-A sync never re-runs the
682
+ installer, so it does not run in phase B); the smoke asserts the declaration's
683
+ sufficiency for the gates that *do* run, and the upgrade skill
684
+ (lifecycle-kit/SPEC.md §templates/skills/) is the executor that registers the
685
+ new ones. When TO is unreleased — the `HEAD` default resolving no version — no
686
+ note names it and the red set must be empty: every run is then the standing
687
+ pre-release assertion that the working tree upgrades cleanly from the last tag. A
688
+ red gate absent from the declaration, or a missing/unparseable note while reds
689
+ exist, is a fail (exit 1); usage/environment failure is exit 2 (the gate exit
690
+ convention). A `bin/` tool, not a gate — no `good/`+`bad/` fixture pair is owed;
691
+ the `upgrade` validate suite running it (scripts/evidence-config.sh) is its
692
+ evidence, at ~2× run-consumer-smoke's cost since it runs the battery twice in
693
+ scratch (accepted as validate-stage cost, never pre-commit).
694
+
695
+ Knobs — config-via-env in the `<KIT>_<KNOB>` shape, defaults this repo's layout,
696
+ each read exactly once at the resolve step:
697
+
698
+ - `GATE_SDK_UPGRADE_REPO` — the kit-source git repository (default: the
699
+ enclosing repo's toplevel). A consumer points it at their checkwright clone;
700
+ the smoke never touches the network.
701
+ - `GATE_SDK_UPGRADE_FROM` — the FROM ref (default: the source repo's newest
702
+ `v*` tag; none resolvable is exit 2, not a skip).
703
+ - `GATE_SDK_UPGRADE_TO` — the TO ref (default: `HEAD`).
704
+ - Scratch base is the existing `GATE_SDK_TMP_DIR` knob; the extracted trees and
705
+ the consumer are `mktemp`-created under it and trap-removed.
706
+
707
+ Producers and consumers: the smoke's verdict (exit code + assertion output) is
708
+ produced by the `upgrade` suite each validate stage, or by a consumer invoking
709
+ the script pre-upgrade; it is consumed by the validate session's evidence file
710
+ (this repo) or the operator's go/no-go on a consumer tree. The
711
+ `GATE_SDK_UPGRADE_*` knobs are produced by the invoking environment (defaults
712
+ emitted by the script itself, so the zero-config run works here) and read only
713
+ at the resolve step. The tightened-gates declaration is produced by the release
714
+ session (RELEASING.md) and consumed here (the allowed-red-set parse) and by the
715
+ upgrade skill (the consumer checklist); its grammar owner is docs/install.md
716
+ §The upgrade contract.
717
+
718
+ ### gen-pre-commit
719
+
720
+ Emits the generated git hooks from the per-gate `# graph:` manifests. A
721
+ `tier=precommit` gate becomes one trigger block in `<hooks-dir>/pre-commit`,
722
+ shaped by `trigger=`/`mode=`; a `gen=manual` region round-trips from the
723
+ current hook. A `tier=commit-msg` gate becomes one unconditional invocation in
724
+ a second hook, `<hooks-dir>/commit-msg`, passing that hook's `$1` (the
725
+ prospective-message file git supplies) through to the gate — the message is
726
+ rejected before the commit exists, whereas a history scan would find a leak
727
+ only after push, when the remedy is a destructive rewrite (that CI/history
728
+ backstop stays with the deferred hosted-attestation rung). `--emit` prints the
729
+ pre-commit hook to stdout and `--emit-commit-msg` the commit-msg hook
730
+ (`check-graph` compares against each); `--write` rewrites `pre-commit` always
731
+ and `commit-msg` only when a `tier=commit-msg` gate is registered. Adding a
732
+ gate to either hook is manifest-only — there is no second hand-wiring step to
733
+ drift. The emission is deterministic (no timestamps) so the committed hooks are
734
+ byte-stable. Both emitted hooks carry the quiet-green wrapper in their
735
+ generated header (§run-gates owns the contract): each gate invocation's output
736
+ is captured and reprinted only when that invocation fails (then the uniform
737
+ failure report as before) or when `GATE_SDK_VERBOSE` is set, and a fully green
738
+ hook run prints one summary line carrying its executed-invocation count. The
739
+ wrapper lives in the emitter's heredoc, so the freshness assertion carries any
740
+ change into the committed hooks. A `trigger=`/`couples=` `kit:<glob>` token is emitted *expanded*
741
+ (via `gate_expand_couples`), so adding a kit later reddens `check-graph`
742
+ (committed hook ≠ `--emit`) until regeneration — the freshness gate keeps the
743
+ static hooks honest across a kit-set change.
744
+
745
+ ### install-hooks
746
+
747
+ One-time per-clone opt-in: sets `core.hooksPath → <hooks-dir>` (and
748
+ `blame.ignoreRevsFile` when `.git-blame-ignore-revs` exists). The wiring is
749
+ hooks-dir granular, so it enables every generated hook (`pre-commit` and, when
750
+ present, `commit-msg`) with no per-hook step. Refuses to point at a nonexistent
751
+ hooks dir — generate the hook first. Then, as the
752
+ apply-and-verify rung, runs `check-identity` once immediately after enabling
753
+ `core.hooksPath` (resolved through the registry, so a consumer shadow wins):
754
+ the fresh clone learns of a wrong-identity or wrong-remote mapping before its
755
+ first commit — the moment the push-identity half is cheapest to fix — and the
756
+ gate's exit status surfaces through this script's.
757
+
758
+ ### check-shellcheck
759
+
760
+ Invariant: every `*.sh` directly under the consumer gates dir, each
761
+ vendored kit's `lib/`, `bin/`, `checks/`, and `templates/`, and each directory
762
+ named in `GATE_SDK_LINT_EXTRA_DIRS` passes ShellCheck at `-S warning` (the
763
+ self-lint contract). A missing `shellcheck` binary is exit 2 — a gate that
764
+ cannot run is not clean.
765
+
766
+ That derivation is also the answer to "does anything lint my workflows?", and on
767
+ its own the answer is no: `.github/workflows/*.yml` sits under no kit root and
768
+ under no gates dir, so it is unreached here by construction. §check-action-run-shell
769
+ is the sibling that reaches it, extracting the shell out of `run:` block scalars
770
+ and linting each at this gate's severity.
771
+
772
+ The knob **appends to** that derived set and never replaces it, so a consumer
773
+ that sets nothing keeps the shipped coverage exactly and a consumer that sets it
774
+ can only widen. It exists because the kit-root predicate (§lib/gate.sh) is what
775
+ puts a directory in scope, so a shipped script under no kit root — a consumer's
776
+ own tooling, a runnable walkthrough, an installer — is lintable but not linted
777
+ until its directory is named. Positional arguments remain a full scope override
778
+ (the hermetic fixture affordance), not an addition.
779
+
780
+ **The knob widens what the gate scans, not when the hook fires it.** The
781
+ generated hook's trigger comes from this gate's `# graph:` couples
782
+ (`scripts/*.sh,kit:*.sh`), and `kit:` expands to kit roots — a set a consumer
783
+ knob has no way to join. The kit family itself is fully covered and never was
784
+ the gap: the hook matches with `[[ "$f" == $pat ]]`, where `*` spans `/`, so
785
+ `<kit>/*.sh` already matches every script in every subdirectory of that kit.
786
+ What is genuinely uncovered is a directory the knob adds and nothing else
787
+ names: an edit there is linted by the full battery and by CI, but not by the
788
+ hook at commit time, so the finding arrives one tier later than for every other
789
+ script in the tree. Closing it is not a matter of widening the glob — the
790
+ trigger derives from a manifest a *kit* ships, and a kit manifest that named
791
+ consumer paths would carry consumer content across the provenance seam, which
792
+ is the thing kit literals are forbidden to do. The honest fix is a
793
+ consumer-expandable token in §The `# graph:` manifest, and that is a contract
794
+ change tracked on the queue rather than an adjustment available here.
795
+
796
+ ### check-gate-output
797
+
798
+ Invariant: every `gates.list` member's source contains both a `: clean`
799
+ success emission and a `help:` remedy line (the static half of the output
800
+ contract). Presence is checked, not correctness — whether the clean line
801
+ actually fires is the `good/`-fixture job; whether the remedy text is accurate
802
+ is human review.
803
+
804
+ ### check-gate-fail-closed
805
+
806
+ Invariant: every `awk`/`jq` command-substitution capture in a `check-*.sh`
807
+ gate handles its subprocess exit status — `fail_closed`, an inline
808
+ `|| { … }` guard, a captured `=$?`, or an explicit `# fail-closed-exempt:`
809
+ opt-out. Only `awk`/`jq` captures are checked: `grep`'s exit 1 on no-match is
810
+ expected, here-string captures read data already in memory, and arithmetic
811
+ `$((…))` is never matched. A parser wrapped inside a shell function is not
812
+ visible to this static scan; the opt-out covers residual false positives.
813
+
814
+ ### check-gate-fixture-coverage
815
+
816
+ Invariant: every `gates.list` member either ships a `{good,bad}/` fixture pair
817
+ (searched across the consumer tests dir, then each vendored kit's
818
+ `gate-tests/`) or carries a `# no-fixture: <reason>` header annotation. The authority set is the
819
+ registry — the gates that gate the tree — not every `check-*.sh` file. A
820
+ half-built pair is a defect regardless of any opt-out. The gate cannot
821
+ mechanically distinguish "infeasible" from "stopgap"; honesty is upheld by the
822
+ reason text.
823
+
824
+ ### check-gate-assertions
825
+
826
+ Invariant: every `### <gate>` subsection in the family SPEC whose contract
827
+ enumerates its assertions (a count-word followed by an enumeration noun and a
828
+ labeled span) is coupled to a matching `# assertion <label>:` marker set in
829
+ the gate's code — the marker label set equals the contract's label span, and
830
+ its size equals the count-word. This catches the prose-vs-code drift an
831
+ internal count⟺span check cannot: a contract can be internally consistent
832
+ while the code grew a sixth assertion.
833
+
834
+ Discovery is first-paragraph-scoped, requires the enumeration noun
835
+ (`assertion(s)`|`axes`|`axis`|`checks`) adjacent to the count-word
836
+ (`two`…`nine`), and requires the first following parenthetical to be a
837
+ single-char `(X)` label — four filters that exclude sibling-gate mentions,
838
+ follow-on sentences, hierarchical axis/sub-rule contracts, and count-words
839
+ with non-enumeration nouns. With no spec argument the gate scans
840
+ `<gates-dir>/SPEC.md` when present plus each vendored kit's own `SPEC.md`;
841
+ each matched heading resolves to its gate source through the registry path. Honest residual: the marker catches editing one
842
+ side without the other, but not adding an assertion while forgetting *both*
843
+ its marker and the contract. A first paragraph that embeds the literal pattern
844
+ in example prose self-matches — the failure is loud (a false positive forcing
845
+ a reword), never a silent miss, so it is accepted. Requires GNU awk.
846
+
847
+ ### check-test-hermetic
848
+
849
+ Two assertions guard a run against ambient state: (A) every bespoke
850
+ `gate-tests/*.test.sh` under the configured kit dirs either sources
851
+ `lib/test-hermetic.sh` or carries a `# hermetic-exempt: <reason>` marker line;
852
+ and (B) a credential-managing smoke script — one that assigns a `*_CRED_FILE` —
853
+ pins every own-kit bin call to a `*_CRED_FILE` path on the invocation line, or
854
+ carries the same `# hermetic-exempt:` valve.
855
+
856
+ Assertion A's exposure: `run-gate-tests` runs fixture pairs `cd`'d into a case
857
+ dir (hermetic by construction) but runs the bespoke unit tests with the
858
+ invoker's cwd, so a gate a unit test drives silently inherits the consumer's
859
+ `<KIT>_CONFIG_FILE` resolution — a test can green under the consumer's posture
860
+ rather than kit defaults (attested: 689cd9c). The bootstrap is the fix (one
861
+ shared pin, not one per test §lib/test-hermetic.sh); the marker is the valve for
862
+ a test that establishes hermeticity otherwise (constructing its own cwd).
863
+
864
+ Assertion B's exposure: a smoke script drives its kit's bins under the real
865
+ `$HOME`, so a bin that resolves its credential file from the ambient `~/.claude`
866
+ (the `<KIT>_CRED_FILE` default) reads live login state — a call whose verdict
867
+ then turns on the wall-clock age of the operator's credential, non-deterministic
868
+ by construction (the delegation-kit `usage-verdict` login-window reroute is the
869
+ attested case). The fix pins the cred at an absent path, so no ambient auth
870
+ event leaks in; the trigger is the script's own `*_CRED_FILE` assignment (a
871
+ smoke script that manages no credentials is never held to the rule), and the
872
+ scan keys on the `$SMOKE_KIT_ROOT/bin/` own-kit-bin convention, so no kit's
873
+ credential-consuming bin roster is spelled out in gate code.
874
+
875
+ With no argument the gate runs both — each `gate_kit_roots` kit's `gate-tests/`
876
+ (A) and `smoke/` (B); a positional arg scans the named gate-tests dir(s) (A, the
877
+ mode the fixture pair drives); `--smoke [dir...]` scans the named smoke dir(s)
878
+ (B). Tier `precommit`; the `# graph:` couples `kit:gate-tests/*.test.sh`,
879
+ `kit:smoke/install.sh`, and `kit:smoke/violation.sh` (`dir=one`, a one-way audit
880
+ over the test and smoke trees).
881
+
882
+ ### check-assertion-strength
883
+
884
+ Invariant: **an assertion is at least as strong as its own failure message.** In
885
+ a smoke or gate-test script, a guard that discriminates only zero from non-zero
886
+ must not carry a failure message naming a verdict token that the invoked
887
+ script's declared exit contract binds to one specific non-zero exit code.
888
+
889
+ The exposure is not a false green today but a **masked regression**: the
890
+ attested case is delegation-kit's smoke guarding a `usage-verdict` call with a
891
+ bare `if`, which accepts PAUSE (1) and STALE (2) alike under a message asserting
892
+ specifically that the call "did not PAUSE". A STALE regression then reports
893
+ itself under the wrong name — worse than an honest silence, because it sends the
894
+ reader to the wrong place.
895
+
896
+ **The declared exit contract.** A script may declare its exit codes in its
897
+ header comment block. Both live declarations sit inside a wider `# usage:` block
898
+ and are written `# exit: …` with leading whitespace, so the parser keys on
899
+ `^#[[:space:]]*exit:`, not a bare `# exit:` prefix. The grammar: each uppercase
900
+ token binds to the nearest preceding integer on the line, yielding a token→code
901
+ map. Tokens admit internal hyphens, so `RESET-OK` reads as one token rather than
902
+ two. A token bound to more than one code, or to code 0, is **not discriminable
903
+ and is skipped** — that rule is load-bearing, not housekeeping: a truthiness
904
+ guard discriminates code 0 exactly, so a message naming a code-0 token claims no
905
+ more than the guard established, and the rule is what keeps the gate off the
906
+ honest `did not verdict OK` neighbour sitting a few lines from its own fixture.
907
+
908
+ This is the same seam move `check-test-hermetic` makes with the own-kit-bin
909
+ convention: the verdict vocabulary (`PAUSE`, `STALE`, and any other kit's
910
+ tokens) is derived from the callee's own declaration and **never appears as a
911
+ literal in gate code**. A gate shipping a vocabulary would publish it; a gate
912
+ deriving one cannot.
913
+
914
+ **Reach is opt-in and the gate never widens it.** A callee declaring no `# exit:`
915
+ header is simply out of reach — the gate demands the header of no one, so the
916
+ unit imposes no new obligation on every script in the tree. Stated honestly, the
917
+ day-one reach is thin: of the two live declarations, `usage-trend.sh` names its
918
+ codes in prose with no uppercase token and so yields an empty map, leaving
919
+ `usage-verdict.sh`'s `PAUSE`→1 and `STALE`→2 as the whole live vocabulary
920
+ (`OK` and `RESET-OK` bind to 0 and are skipped). One declaring script, two usable
921
+ tokens; the success line reports the call count so the reach stays visible rather
922
+ than implied.
923
+
924
+ **Detection.** For each guard invoking a declaring script through the own-kit-bin
925
+ convention (`bin/<name>.sh` resolved against the scanned dir's kit root) whose
926
+ discrimination is truthiness only — the call sits in an `if` or chains into
927
+ `||`/`&&` — the gate reads the guard body's failure text within a bounded window,
928
+ truncated at the next such call so guards cannot excuse each other, and reds when
929
+ that text names a discriminable token while the guard compares no status to that
930
+ token's code.
931
+
932
+ **Valve.** A `# assertion-strength-exempt: <reason>` marker, for a guard that
933
+ establishes the outcome by other means. It is an **inline per-site directive**,
934
+ sited on the guard it excuses — its own line, its immediately preceding comment
935
+ block, or its body — and its discipline is the adjacent `<reason>`, exactly as
936
+ `# fail-closed-exempt:` and the `# hermetic-exempt:` valve it is modelled on.
937
+ It is deliberately **not** queue-linked: §check-gate-exemption-tasks scopes
938
+ itself to `# exception-list:`-tagged arrays and rules this class out as local and
939
+ self-evident via its adjacent comment.
940
+
941
+ **Honest limit.** The gate reads guard shape, not semantics. An assertion
942
+ weakened without a token-naming message is out of reach, as is any callee
943
+ declaring no exit contract; a message naming a token bound to several codes is
944
+ skipped rather than guessed. What it catches is precisely the attested shape — a
945
+ message more specific than the guard behind it. Like its siblings, a false
946
+ positive is loud (a forced reword or an explicit exemption), never a silent miss.
947
+
948
+ With no argument the gate scans each `gate_kit_roots` kit's `smoke/` and
949
+ `gate-tests/`; positional args scan the named dir(s), the mode the fixture pair
950
+ drives. Tier `precommit`, matching its sibling; the `# graph:` couples
951
+ `kit:smoke/*.sh`, `kit:gate-tests/*.test.sh`, and `kit:bin/*.sh` (`dir=one`, a
952
+ one-way audit — an edit to a scanned script *or* to a declaring header re-fires
953
+ it). Configuration adds **no new knob**: the scan roots come from the existing
954
+ kit-roots derivation, as `check-test-hermetic`'s do.
955
+
956
+ ### check-gate-exemption-tasks
957
+
958
+ Invariant: every element of an `# exception-list:`-tagged array in a
959
+ `check-*.sh` gate carries exactly one of two disposition annotations —
960
+ `# until: <slug>` (temporary; must resolve to a live task in the queue file's
961
+ New Features / Technical Debt / Deferred sections) or `# permanent: <reason>`
962
+ (structural out-of-scope). An element with neither, a `# until:` slug that is
963
+ Done-only or missing, or elements sharing the array's opening `=(` line are
964
+ violations. Scope is in-script exemption arrays only; inline per-site
965
+ directives (`# fail-closed-exempt:`, `# no-fixture:`) stay out — they are
966
+ local and self-evident via their adjacent comment.
967
+
968
+ ### check-graph
969
+
970
+ Invariant: the `# graph:` manifest on every `gates.list` member is well-formed
971
+ and consistent, and the pre-commit hook is the faithful generated projection of
972
+ the manifests. The manifest grammar a gate author writes against: four required
973
+ keys (`couples`/`dir`/`valve`/`tier`) plus the optional `mode`/`trigger`/`gen`,
974
+ each `couples=`/`trigger=` token a syntactically valid glob (or a `kit:<glob>`
975
+ couples/trigger form that expands before the vocabulary and parity checks), and
976
+ surfaces drawn from the declared vocabulary when one exists. The `valve=` value
977
+ follows the cycle rule: a `dir=bi` gate spanning a declared-leading and a
978
+ declared-lagging surface carries `valve=PROPOSED`; a leading-only gate may carry
979
+ either; a gate with no leading surface carries `valve=none`. From that grammar
980
+ the check derives its guarantees — each `couples=` surface is covered by the
981
+ gate's `trigger=` globs (trigger defaulting to couples), so editing a coupled
982
+ surface always fires the gate; and the committed pre-commit hook, the commit-msg
983
+ hook (when any gate is `tier=commit-msg`), and the coupling-graph projection at
984
+ `GATE_SDK_GRAPH_ARTIFACT` (default `<workflow-dir>/CHECK-GRAPH.html`) each equal
985
+ their generator's `--emit` output, down to every emitted asset href resolving
986
+ under the artifact's own directory. The remedy lines print the resolved artifact
987
+ path, so a consumer that republishes it (this repo serves `docs/check-graph.html`)
988
+ is always offered its own regenerate command; how each guarantee is asserted
989
+ lives in the check. A `# graph:` manifest embedded in a `SPEC-*.md` amendment
990
+ body is held to the glob grammar but not to the vocabulary or hook-parity — the
991
+ gate it describes is unbuilt, so its coupled surface may itself be design-ahead;
992
+ parity re-fires through the normal registry path once the gate lands.
993
+
994
+ Dual-couple manifest: the artifact path is a knob, but check-graph's own
995
+ `# graph:` manifest is kit-shipped static text a consumer never edits, so it
996
+ cannot read the knob. It lists **both** artifact homes as couples — the
997
+ workflow-dir default and `docs/check-graph.html` — so the generated hook
998
+ re-fires on whichever a consumer publishes to. For a default consumer the docs
999
+ path is simply an inert trigger pattern that never stages; couples↔trigger
1000
+ parity holds because the hook derives from the same manifest.
1001
+
1002
+ Rule content is config, not code: `<gates-dir>/graph-vocab.sh` may declare
1003
+ `GRAPH_VOCAB` (the legal surface tokens; empty/absent disables the vocabulary
1004
+ check), `GRAPH_LEADING`/`GRAPH_LAGGING` (the assertion-C sets; absent
1005
+ disables cycle-valve classification, leaving the no-leading `valve=none` rule),
1006
+ and `GRAPH_LAYERS` + `graph_surface_layer()` (the projection's subgraph
1007
+ grouping; absent renders one layer). The `--amend-only [dir]` mode runs only
1008
+ (G) over a given directory, letting the fixture pair exercise it hermetically.
1009
+ Coverage ruling: a full `couples ⊇ find-globs` parity check over arbitrary
1010
+ shell is undecidable — neither cheap nor low-FP — so check-graph does not carry
1011
+ it, and the couples⊆trigger guarantee already ensures editing a *coupled*
1012
+ surface fires the gate. The
1013
+ statically resolvable slice of that parity is carried by its sibling
1014
+ `check-reads-couples` (§check-reads-couples); the undecidable remainder stays
1015
+ the author's duty under §The `# graph:` manifest.
1016
+
1017
+ Theme seam (`emit_graph`): the emitted HTML artifact bypasses the consumer's
1018
+ site generator, so it renders foreign beside the rest of a docs host unless the
1019
+ host theme is inlined — and the theme is consumer-specific, so the emitter must
1020
+ not hardcode it. `GATE_SDK_GRAPH_THEME` (default `<gates-dir>/graph-theme.sh`,
1021
+ mirroring `GATE_SDK_GRAPH_VOCAB`) names a consumer file sourced when present at
1022
+ every emission. It may define override functions, the `graph_surface_layer`
1023
+ pattern: `graph_theme_css` emits the `<style>` element's body (replacing the
1024
+ kit's default stylesheet), `graph_theme_header` emits a fragment directly after
1025
+ `<body>` (site chrome above the kit header), and `graph_theme_footer` emits a
1026
+ fragment directly before `</body>`. An absent file or an undefined function
1027
+ falls back to the kit default, so a themeless consumer's output stays
1028
+ byte-identical. Determinism: the freshness assertion's in-memory emission and the `--emit` a
1029
+ consumer redirects into the artifact resolve the same theme path, so the
1030
+ byte-compare holds; the artifact stays generated-only, a styling change landing
1031
+ in the theme file (or the emitter), never a hand-edit.
1032
+ Self-containment is unchanged: injected content is inline, and a theme emitting
1033
+ a relative asset href must resolve under the artifact dir or the asset-href
1034
+ assertion is red — the existing gate already polices the link-the-site-stylesheet
1035
+ shortcut into inlining. Its complement is the **external-ref assertion**, over
1036
+ the same in-memory emission: every absolute (`://`-carrying) `href`/`src`
1037
+ attribute value and every ESM `import` specifier must prefix-match the allowed
1038
+ set, or the gate reds naming the URL. The set is seeded with `emit_graph`'s own
1039
+ pinned-major mermaid ESM import from the jsdelivr CDN — the one sanctioned
1040
+ external reference the kit itself emits (the diagram renderer is client-side, and
1041
+ inlining a megabyte-scale library into a byte-compared artifact is the worse
1042
+ trade), always allowed so a consumer cannot lock the kit's emission out. A
1043
+ consumer's chrome may need more — this repo's theme links its docs host and its
1044
+ source repo — so `GATE_SDK_GRAPH_EXTERNAL_REFS` (space-separated URL prefixes,
1045
+ default empty) adds consumer-sanctioned prefixes: rule content the kit must not
1046
+ hardcode, the `graph-vocab` seam. The assertion runs whole-tree and hermetically
1047
+ via `--refs-only` (the fixture's `check-graph-refs.test.sh` drives it, as
1048
+ `--amend-only` drives assertion G). Honest limit, now narrowed: the scan covers
1049
+ `href`/`src` values and import specifiers only — CSS `url()` and an inline-script
1050
+ `fetch()` still pass unseen (review-caught), and `xmlns=` namespace values are
1051
+ neither `href` nor `src` and are out of scope. Dark mode is the theme owner's disposition: the kit default keeps its
1052
+ light+dark scheme, and because the emitted mermaid init keys on
1053
+ `prefers-color-scheme`, a theme's chrome must honor that query too or it clashes
1054
+ with a dark-rendered graph on the same page. This repo's `scripts/graph-theme.sh`
1055
+ supplies the docs-host tokens, header, and footer (both schemes), so
1056
+ `docs/check-graph.html` reads as the same site.
1057
+
1058
+ Render cap (`GATE_SDK_GRAPH_MAX_EDGES`, default `100000`): Mermaid refuses to
1059
+ render a flowchart whose edge count *exceeds* `maxEdges` (its own default is
1060
+ `500`), painting an error graphic in place of the diagram — so a graph that
1061
+ outgrows the cap is a published page that never draws, invisible to the
1062
+ byte-compare freshness assertion because the HTML is still well-formed. The
1063
+ emitter writes the knob's value into the page's `mermaid.initialize` call, and
1064
+ the **render-cap assertion** re-derives the cap and the edge count from the same
1065
+ in-memory emission and reds when `edges > cap`. Modelling Mermaid's boundary
1066
+ exactly (`edges == cap` renders; `edges > cap` throws) keeps the gate honest
1067
+ against the renderer rather than a guessed margin. The default is effectively
1068
+ unlimited for a trusted, manifest-bounded graph; the knob exists so a consumer
1069
+ whose graph legitimately dwarfs it, or who wants the guard to bite sooner, sets
1070
+ its own ceiling — the emitted page and the assertion always read the one value,
1071
+ so they cannot disagree. A missing `maxEdges` in the emission falls back to
1072
+ Mermaid's own `500` default, catching a regression that drops the init key
1073
+ entirely. The assertion runs whole-tree and hermetically via `--cap-only` (the
1074
+ fixture's `check-graph-cap.test.sh` drives it, as `--refs-only` drives assertion
1075
+ H).
1076
+
1077
+ ### check-reads-couples
1078
+
1079
+ Invariant: for every registered gate, every **statically resolvable recursive
1080
+ walk** in its source has its tracked read-set covered by the gate's expanded
1081
+ `couples=` — the reads⊆couples half `check-graph` leaves to the author
1082
+ (§The `# graph:` manifest). This is check-graph's coverage sibling: check-graph
1083
+ proves editing a *coupled* surface fires the gate; check-reads-couples proves
1084
+ the couples name every surface a resolvable walk *reads*, so no recursion hides
1085
+ a surface the couple never listed.
1086
+
1087
+ The tractable class is stated as the invariant, because deciding what arbitrary
1088
+ bash reads is undecidable and a gate must not over-claim. A **walk** is a
1089
+ `gate_find` or `find` at command position; a walk is *resolvable* when its first
1090
+ directory argument is one of three shapes — a quoted literal repo-relative path,
1091
+ `"$KIT"[/sub]` (the analyzed gate's own kit dir, from the source's
1092
+ `checks/`-parent), or `"$REPO_ROOT"[/sub]`. For each resolvable root the gate
1093
+ enumerates the **tracked** files under it (`git ls-files`, filtered by a literal
1094
+ `-name '<pat>'` primary when one is extractable from the same invocation, else
1095
+ unfiltered; `gate_find` walks additionally drop the pruned dirs) and asserts
1096
+ every one matches at least one expanded couple under the manifest's own glob
1097
+ semantics — segments never cross `/`, so path and glob must share a segment
1098
+ count (a shallow one-level couple misses a file one level down, the
1099
+ check-shim-restatement bug). A walk whose root does not resolve is **skipped and
1100
+ counted** in the clean line: the gate claims only the resolvable class and says
1101
+ how much it left undecided. Only tracked files need coverage (couples exist to
1102
+ fire the hook on a tracked-path commit; a walk over `.tmp/` or generated state
1103
+ has no commit to couple to) and only walks are analyzed — single-file reads and
1104
+ `git ls-files` enumeration are out of scope.
1105
+
1106
+ Over-demand is absorbed one of two ways, never by weakening the glob semantics
1107
+ to pass a near-miss: add the covering sibling glob (the correct fix), or mark
1108
+ the deliberate uncoupled walk `# reads-couples-exempt: <reason>` on the walk's
1109
+ own line or the line directly above (the `comment-tier-exempt` precedent — local
1110
+ to the walk it excuses, auditable in place; a trailing marker excuses only its
1111
+ own line). The marker's sole reader is this gate; the skip counter's sole reader
1112
+ is the clean-line parenthetical, its honesty label for the undecidable
1113
+ remainder. Manifest `tier=precommit trigger=*`: the unconditional trigger is
1114
+ load-bearing, not laziness — the invariant breaks two ways, a gate edit that
1115
+ changes a walk *or* a new subdirectory grown under a walked root, and no couple
1116
+ glob can name a directory that does not exist yet. Its own `couples=` names what
1117
+ it reads as content (every `checks/` dir plus `gates.list`); the tracked-file
1118
+ enumeration is `git ls-files` metadata, not a content read, so it needs no
1119
+ couple. The hermetic fixture affordance: positional gate-source arguments make
1120
+ the gate analyze the given source(s) with `git ls-files` anchored to the case
1121
+ dir, instead of walking the real `gates.list`.
1122
+
1123
+ ### enforcement-map
1124
+
1125
+ `bin/enforcement-map.sh --emit` writes `docs/enforcement.md`: a kit-first map of
1126
+ every check surface — kit, governed surface, enforcement class — derived from
1127
+ the class registries so it cannot drift from what actually runs. It is
1128
+ check-graph's sibling in shape (an emitter whose output a freshness gate
1129
+ byte-compares), advisory by construction: it never joins `gates.list`, and a
1130
+ *healthy* run exits 0 whatever registries are absent — while a misconfigured run
1131
+ (a set-but-missing registry knob) exits 2, fail-closed. Every knob check runs
1132
+ before the first stdout byte in both modes, so a misconfigured
1133
+ `--emit > docs/enforcement.md` regen leaves an empty projection and a nonzero
1134
+ exit, never a plausible partial page that byte-matches itself on the next
1135
+ freshness check. Bare it prints a human header before the page; `--emit` prints
1136
+ the page alone, for the committed projection.
1137
+
1138
+ Each enforcement class reads one registry, every registry defaulting to this
1139
+ repo's layout through the owning kit's knob: **blocking gates** from
1140
+ `gates.list` plus each gate's `# graph:` `tier=` field, the owning kit taken
1141
+ from the same name-resolution walk the runner uses (a consumer-dir gate groups
1142
+ as the consumer's); **advisory KPIs** from the drift-kit `kpis.list` registry
1143
+ (`DRIFT_KIT_KPIS_FILE`); **guards** and **session warnings** from the
1144
+ `PreToolUse` / `SessionStart` command hooks in the tracked harness settings file
1145
+ (`CONTEXT_KIT_SETTINGS_FILE`, parsed with `jq`); **validate suites** from
1146
+ evidence-kit's suite config (`EVIDENCE_KIT_CONFIG_FILE`); and **monitors** — the
1147
+ one class with no parseable registry — from a line-start
1148
+ `# enforce: class=monitor <free-text>` marker a non-gate surface declares itself
1149
+ with, greped under `GATE_SDK_ENFORCE_SCAN_DIR` (this repo's first carrier is the
1150
+ site-health workflow — deployment truth, not tree truth). A marker is **dormant
1151
+ in a template or fixture** — an inert copy-source — and **activates only where a
1152
+ consumer copies the file into a live path**: the walk therefore prunes
1153
+ `templates/` (a `grep -v`, the sibling-finder idiom) atop the `gate-tests`
1154
+ exclusion `GATE_GREP_EXCLUDES` already carries, so site-kit's shipped
1155
+ `templates/site-health.yml` marker projects no row while this repo's own copy of
1156
+ it under `.github/workflows/` does. The `# enforce:`
1157
+ grammar is the reusable name a future uncovered class adopts rather than growing
1158
+ a bespoke registry.
1159
+
1160
+ Cross-registry reads are a reporting surface (the drift-report precedent), and
1161
+ the emitter distinguishes two absences per class, converging on the strict
1162
+ set-but-missing rule the kit config loaders share (§lib/test-hermetic.sh): a
1163
+ registry *not adopted* — its knob unset with the default path absent — degrades,
1164
+ leaving its section absent, so a gates-only consumer still gets its gate map; a
1165
+ registry *adopted but broken* — its knob explicitly set to a missing path —
1166
+ refuses (exit 2, a stderr line naming the knob). The settings knob additionally
1167
+ checks parseability when set: set and `jq`-unparseable refuses likewise (a typo
1168
+ inside an explicitly adopted file is the same laundering vector as a typo in its
1169
+ path), while the default-path file unparseable keeps degrading — a stray
1170
+ `.claude/` must not break a zero-config consumer — and `jq` *absence* keeps
1171
+ degrading in both modes, a toolchain gap owned by the install requirements /
1172
+ env-probe parity, not a config typo. The emitted
1173
+ page — not this SPEC — owns the enforcement-class **taxonomy** prose (what each
1174
+ class means and how hard it binds); the emitter's preamble heredoc is its single
1175
+ source, and this section documents the emitter contract and cites the page for
1176
+ the taxonomy.
1177
+
1178
+ The page is a docs-site artifact, so it carries the site's link topology. The
1179
+ **taxonomy is a bulleted roster**, each class citing its *mechanism owner* — the
1180
+ kit SPEC section that defines the class — through the reference-link grammar
1181
+ (canon-kit/SPEC.md §The reference-link grammar): a self-repo blob link built from
1182
+ `gate_self_repo_prefix` on the `CANON_KIT_DOCS_BLOB_REF` ref (§lib/gate.sh), so
1183
+ the citation pins to the same ref `check-md-refs`' self-repo pass validates. The
1184
+ citation degrades to the bare `<path> §<section>` text when the identity is
1185
+ unknown (no origin) or the owning kit is unvendored (its SPEC untracked), so a
1186
+ gates-only consumer keeps a resolvable page. The **kit column links each kit's
1187
+ docs page** (`<kit>/index.md`, relative to the page under the docs root); the
1188
+ `(consumer)` group owns no kit page and stays plain text.
1189
+
1190
+ ### check-enforcement-fresh
1191
+
1192
+ Invariant: `docs/enforcement.md` byte-matches `enforcement-map.sh --emit` — the
1193
+ check-graph / trajectory-freshness byte-compare pattern. Bare, it runs the
1194
+ emitter and compares the committed page; given two arguments
1195
+ (`projection-file emit-file`) it compares pre-baked files, letting the fixture
1196
+ pair exercise it hermetically off the live registries. Fail-closed: a missing
1197
+ projection, a missing emitter, or a non-zero emit is a red (exit 2), never a
1198
+ false clean. Its `# graph:` manifest couples every class registry — the gate
1199
+ sources (so a `tier=` edit re-fires), `kpis.list`, the settings file, and the
1200
+ monitor-carrier workflows — beside the artifact itself, so any registry change
1201
+ re-runs the freshness compare. The corrective its help text names is the
1202
+ regeneration command, reachable because the gate rides the generated pre-commit
1203
+ hook (the check-graph contract exactly).
1204
+
1205
+ ### check-kit-enum
1206
+
1207
+ Invariant: for every `gates.list` member, a `couples=` set that literally names
1208
+ two or more `gate_kit_roots` members under a common glob suffix must name
1209
+ *every* kit root having tracked files matching that suffix. `kit:<glob>` deletes
1210
+ the drift axis by derivation (the reader expands it to all roots); this gate is
1211
+ the residual meta-check for the hand-list a future gate author writes anyway —
1212
+ the fix its help text names is the token, not a longer list. Completeness is
1213
+ measured against tracked files (`git ls-files` at the repo root), so a suffix no
1214
+ kit carries forces nothing and the over-approximating token stays a superset of
1215
+ what the gate requires. A lone named root is not a hand list (no completeness
1216
+ obligation); the check engages at two. Fail-closed: an unreadable manifest, an
1217
+ unresolvable registered gate, or a non-repo cwd is a red, not a skip. A member
1218
+ with no `# graph:` line is `check-graph`'s finding, not this gate's.
1219
+
1220
+ ### check-kit-registration
1221
+
1222
+ Invariant: every kit root `gate_kit_roots` enumerates is registered in the
1223
+ consumer's human-facing docs — closing the prose-registry gap `check-kit-enum`
1224
+ leaves open (that gate guards gate-coupling hand-lists, so a landed kit can
1225
+ silently fall out of the registry docs). Two assertions: (A) **registry row** —
1226
+ the registry doc carries, for each root, a markdown link *into* the kit root:
1227
+ any target under the repo-root-relative prefix `<kit>/`, whether the bare
1228
+ directory itself or a page beneath it such as `<kit>/index.md`. The prefix is
1229
+ the assertion because the two registries address a kit differently — a source
1230
+ tree browses to the directory, a rendered docs site must name the page — and
1231
+ both are the same registration. A landed kit missing from the public kit table
1232
+ is red; (B) **fixture-runner
1233
+ line** — every kit root with
1234
+ tracked `gate-tests/` files (`git ls-files <kit>/gate-tests/`) has a line in the
1235
+ runner doc naming `<kit>/gate-tests` (the documented fixture-runner
1236
+ invocation), so a kit whose fixtures never entered the battery is red. A kit
1237
+ without `gate-tests/` (guard-kit, drift-kit) owes nothing under B.
1238
+
1239
+ Config, the standard kit shape: `GATE_SDK_REGISTRY_DOC` (default `README.md`)
1240
+ is A's doc, `GATE_SDK_RUNNER_DOC` (default `README.md`) is B's; both resolve
1241
+ relative to the git toplevel, and an explicit positional argument
1242
+ (`[registry-doc [runner-doc]]`) overrides. Fail-closed: a configured doc that
1243
+ does not exist is a misconfiguration (exit 2, like `check-kit-enum`'s missing
1244
+ registry), as is a non-repo cwd or empty roster — never a false clean. A
1245
+ consumer keeping no prose registry opts out by not registering the gate in its
1246
+ `gates.list`; there is no empty-knob valve. This gate retires close's manual
1247
+ "does the kit table still reflect the kit set?" staleness check, narrowing that
1248
+ step to the un-gated remainder (row descriptions, per-kit READMEs).
1249
+
1250
+ ### check-readme-roster
1251
+
1252
+ Invariant: every kit README's register-the-gates block holds name-set parity
1253
+ with the kit's shipped `checks/` basenames, both directions. This is the
1254
+ `check-install-toolchain` fork applied a second time: the roster names are
1255
+ derivable (the `checks/` script basenames, extension stripped), the per-gate
1256
+ annotation clauses beside them are hand prose, so a gate asserts parity over a
1257
+ hand-maintained list rather than an emitter generating it — the list stays a
1258
+ human-read register, the gate holds it honest.
1259
+
1260
+ Marker vocabulary: each kit README wraps its register block in
1261
+ `<!-- gate-roster:begin -->` / `<!-- gate-roster:end -->` markers (the
1262
+ `docs/install.md` `toolchain:begin` shape). Inside the markers, a line's first
1263
+ `check-`-prefixed token is a roster name; everything after it — annotation
1264
+ prose, `#` clauses — the gate never reads. Calibration: marker lines may carry
1265
+ leading indentation, because a README nests the fenced block inside an install
1266
+ list item; the roster scan trims surrounding whitespace before matching the
1267
+ marker and the names.
1268
+
1269
+ Two assertions, per kit, over the roster set versus the `checks/` basename set:
1270
+ (A) every shipped check appears in the README roster — a gate shipped but never
1271
+ registered is red; (B) every roster name resolves to a shipped check — a roster
1272
+ name naming no `checks/` script is red. Each finding names the kit and the
1273
+ name.
1274
+
1275
+ Sweep: kit roots come from `gate_kit_roots` (the `GATE_SDK_KIT_DIRS` knob —
1276
+ §Layout and configuration), the `check-kit-enum` / `check-kit-registration`
1277
+ sweep shape. A kit root without a `checks/` dir is skipped-and-counted; a kit
1278
+ root with `checks/` but no marker block in its README is red — the kit-landing
1279
+ checklist (§Consumer smoke) has a kit that ships checks registering them.
1280
+ Config reuses `GATE_SDK_KIT_DIRS`; no new knob. Positional form
1281
+ `check-readme-roster.sh [root]` resolves relative kit roots against a fixture
1282
+ tree (the case dir's `gate-sdk-config.sh` names the fixture kits), the sibling
1283
+ meta-gates' hermetic-fixture shape; bare, it sweeps against the git toplevel.
1284
+ Fail-closed: a non-repo cwd with no root argument, an empty roster, or an
1285
+ unreadable README marker scan is exit 2, never a false clean.
1286
+
1287
+ ### check-smoke-entry-guard
1288
+
1289
+ Invariant: for every kit root in the roster, every `smoke/install.sh` and
1290
+ `smoke/violation.sh` present contains the entry-point guard expansion
1291
+ `${SMOKE_KIT_ROOT:?` (§Consumer smoke's contract clause) — a mutating smoke
1292
+ script run bare, outside the harness that exports `SMOKE_KIT_ROOT`, must abort
1293
+ rather than write into the caller's repo. A missing guard is a finding naming
1294
+ the file (the fix worklist). `install.sh`'s shipped guard is the precedent this
1295
+ gate promotes from convention to contract; `violation.sh` joins it.
1296
+
1297
+ Honest limit: the gate asserts the guard's **presence**, not its **position** —
1298
+ a guard placed below a mutating line still passes, so ordering (the guard
1299
+ before the first mutation) is review's, not the gate's. Presence is the
1300
+ mechanically decidable half; position would need a mutation model the gate does
1301
+ not carry.
1302
+
1303
+ Sweep: kit roots come from `gate_kit_roots` (the `GATE_SDK_KIT_DIRS` knob —
1304
+ §Layout and configuration), the sibling roster meta-gates' shape; a kit root
1305
+ without a `smoke/` dir is skipped, and `violation.sh` is checked only where it
1306
+ exists (it is optional — §Consumer smoke). Config reuses `GATE_SDK_KIT_DIRS`;
1307
+ no new knob. Positional form `check-smoke-entry-guard.sh [root]` resolves
1308
+ relative kit roots against a fixture tree (the case dir's `gate-sdk-config.sh`
1309
+ names the fixture kits); bare, it sweeps against the git toplevel. Fail-closed:
1310
+ a non-repo cwd with no root argument, an empty roster, or an unreadable smoke
1311
+ script is exit 2, never a false clean. The `# graph:` couples the mutating
1312
+ smoke scripts (`kit:smoke/install.sh,kit:smoke/violation.sh`, `dir=one`,
1313
+ `tier=precommit`), so editing one re-fires the gate.
1314
+
1315
+ ### check-core-files
1316
+
1317
+ Invariant: every path in the consumer's `core-files.list` manifest exists in
1318
+ the worktree **and** is tracked (`git ls-files --error-unmatch`). Red on a
1319
+ missing or untracked listed path — one existence-plus-tracked test catches a
1320
+ plain `rm`, a `git rm`, and a listed-but-never-added path alike, with no
1321
+ `--diff-filter` timing window that only sees the loss at some later stage.
1322
+
1323
+ The manifest is optional consumer config (the `graph-vocab.sh` pattern): the
1324
+ path knob is `GATE_SDK_CORE_FILES_FILE` (default
1325
+ `<gates-dir>/core-files.list`), registry-style — one repo-relative path per
1326
+ line, `#` comments and blanks ignored. An absent manifest is clean with a note;
1327
+ an empty or comment-only manifest is clean; a present-but-unreadable manifest
1328
+ is fail-closed (exit 2). Calibration: the intentional-removal valve is the
1329
+ manifest itself — retiring a surface means deleting its line in the same commit
1330
+ that removes the file, a diff-visible edit that needs no exemption tag, so the
1331
+ gate is re-scoped in the open, never weakened to pass. The gate's `# graph:`
1332
+ couples the manifest (`tier=precommit`), so an edit to `core-files.list`
1333
+ re-fires it; the whole-tree `run-gates.sh` battery is the backstop for a
1334
+ pure-deletion commit the `ACMR` pre-commit filter would skip.
1335
+
1336
+ ### check-identity
1337
+
1338
+ Invariant: every expectation in the `identity.conf` manifest matches this
1339
+ clone's local git identity — a verification backstop for the fresh-clone gap
1340
+ where an agent commits or pushes under the wrong identity and fails silently
1341
+ (misattribution is unpurgeable without a SHA-breaking history rewrite; the
1342
+ wrong-SSH-key symptom is a misleading "Repository not found"). Multi-identity
1343
+ setups — a work and a personal account on one machine — make this the common
1344
+ case for the integrator audience. **Scope fence:** the identity *mapping* stays
1345
+ git's job (`includeIf`, `core.sshCommand`); this gate only asserts the mapping
1346
+ actually applied here.
1347
+
1348
+ Two expectation kinds, both local reads (cheap, no network, no false positives
1349
+ from a settled corpus):
1350
+
1351
+ - `email <expected>` — matches `git config user.email` exactly.
1352
+ - `remote-host <remote> <host>` — matches `<host>` against the host part of
1353
+ `git remote get-url <remote>` by exact string. An SSH host alias is matched
1354
+ as the alias — that *is* the identity selector in multi-identity setups, so a
1355
+ scp-like `git@alias:path` compares as `alias`, and a `scheme://[user@]host/…`
1356
+ URL as `host`. A configured remote that does not exist in this clone is red.
1357
+
1358
+ The manifest is optional consumer config (the `graph-vocab.sh` pattern): the
1359
+ path knob is `GATE_SDK_IDENTITY_FILE` (default `<gates-dir>/identity.conf`),
1360
+ line-based `key value…` with `#` comments and blanks ignored. An absent, empty,
1361
+ or comment-only manifest is clean with a note; a mismatch (or a manifest-named
1362
+ remote that is absent) is a violation (exit 1); a malformed line — an unknown
1363
+ key or wrong field count — is fail-closed (exit 2), never a false clean on an
1364
+ uninterpretable manifest. A live run under CI (the vendor-neutral `CI` env var)
1365
+ is clean-skipped ahead of the manifest reads: the server-side battery is not a
1366
+ committing clone, so there is no local identity to misattribute a commit or
1367
+ push with, and the CI runner's unset `user.email` is expected, not a violation
1368
+ (fixture mode is unaffected — it exercises the comparison deterministically).
1369
+ Enforcement is dual: the `# graph:` couples the
1370
+ manifest at `tier=precommit` (a `git config` change to the mapping is not
1371
+ diff-visible, so the whole-tree `run-gates.sh` battery is the real backstop for
1372
+ the commit-identity half), and `install-hooks.sh` runs the gate once at opt-in
1373
+ to cover the push-identity half (no pre-push hook is added — gate-sdk generates
1374
+ only the pre-commit hook, and the setup rung plus the precommit tier already
1375
+ cover the surface). A `--fixture <dir>` mode injects the clone's actual identity
1376
+ (`git-config-email`, `git-remotes`) so the fixture pair is deterministic without
1377
+ touching real git config.
1378
+
1379
+ ### check-hook-exec-bit
1380
+
1381
+ Invariant: every tracked file in the hooks dir (`GATE_SDK_HOOKS_DIR`, default
1382
+ `<gates-dir>/git-hooks`; override with the gate's first argument) carries git
1383
+ *index* mode `100755`. The index is the checked surface because it is what a
1384
+ fresh clone receives: git silently skips a non-executable hook, so a
1385
+ `pre-commit` committed at mode `100644` disables the entire gate battery for
1386
+ every clone — a catastrophe-class, invisible failure — and `install-hooks.sh`'s
1387
+ per-clone `chmod` cannot repair a wrong committed mode. One `git ls-files -s`
1388
+ reads the mode a clone would get, sidestepping the worktree bit entirely. A
1389
+ non-repo cwd is fail-closed (exit 2); a hooks dir with no tracked files, or an
1390
+ absent hooks dir, is clean (nothing committed to skip). The `# graph:` couples
1391
+ the hooks dir at `tier=precommit`, and the whole-tree `run-gates.sh` battery is
1392
+ the backstop for a mode-only change no `ACMR` content filter would surface.
1393
+
1394
+ ### check-exec-bit
1395
+
1396
+ Invariant: every tracked `*.sh` path matching an exec-glob carries git *index*
1397
+ mode `100755`. The class is by-path-invoked kit scripts — gate-sdk's runner
1398
+ (`run-gates.sh`), drift-kit's collator (`drift-report.sh`), and lifecycle-kit's
1399
+ entry preflight all invoke kit scripts **by path**, and a shebang'd `bin/` tool
1400
+ is by-convention path-invocable — so a script committed `100644` degrades
1401
+ silently in a fresh clone: a KPI plugin to `n/a (plugin failed)`, a
1402
+ runner-invoked preflight to a skipped check. The index is the checked surface
1403
+ because it is the mode a clone receives, and a `Write`-tool-authored script
1404
+ acquires `100644` there regardless of worktree state; one `git ls-files -s`
1405
+ reads it, sidestepping the worktree bit.
1406
+
1407
+ The subject class is two knobs (both join §Layout and configuration's roster).
1408
+ `GATE_SDK_EXEC_GLOBS` is the space-separated glob set (globs match with `*`
1409
+ spanning `/`); its default `*/checks/*.sh */kpis/*.sh */bin/*.sh` plus the
1410
+ computed `<gates-dir>/check-*.sh` and `<gates-dir>/kpi-*.sh` covers the per-kit
1411
+ exec dirs and the consumer gates dir (consumer gates and KPI plugins resolve
1412
+ from the gates dir first, so they are by-path targets too).
1413
+ `GATE_SDK_EXEC_PRUNE` (default `gate-tests fixtures templates smoke`) exempts
1414
+ subtrees by path segment: fixture trees deliberately carry glob-matching paths,
1415
+ and `templates/` members are copied content sourced at their destination, never
1416
+ invoked in place. `lib/` needs no prune — sourced libraries match no default
1417
+ glob.
1418
+
1419
+ Sibling, not overlap, with `check-hook-exec-bit`: that gate asserts the same
1420
+ index-mode invariant over the hooks dir, a disjoint target class (hook files
1421
+ are not `*.sh`, and no default glob reaches the hooks dir), so both gates
1422
+ stand. The honest limit is shared: the gate reads the index, so a mode broken
1423
+ only in an uncommitted worktree file is invisible until staged, and the
1424
+ whole-tree `run-gates.sh` battery is the backstop for a mode-only change no
1425
+ `ACMR` content filter would surface. A non-repo cwd is fail-closed (exit 2).
1426
+
1427
+ Argument mode (fixture capability): `check-exec-bit.sh [ls-files-dump]` lints a
1428
+ canned `git ls-files -s` dump instead of running `git ls-files -s` from the
1429
+ repo root, so a fixture is hermetic against the host repo's index (the
1430
+ check-merge-attrs precedent). The `good/`+`bad/` pair runs on the argument
1431
+ path; the bespoke `gate-tests/check-exec-bit.test.sh` builds a temp git repo
1432
+ and re-stages a KPI at `100644` then `100755`, exercising the live
1433
+ `git ls-files` path. Tier `precommit`.
1434
+
1435
+ ### check-root-tiering
1436
+
1437
+ Invariant: every tracked top-level entry of the scanned tree (`git ls-files`
1438
+ first-segment set; scan root is the optional second argument, default `.`) is
1439
+ covered by an allowlist entry — an exact name or a glob (`SPEC-*.md`). The repo
1440
+ root is the orientation surface a reader lands on; agent-authored repos
1441
+ accumulate root scratch by reflex, so the allowlist makes a genuinely new root
1442
+ surface a deliberate config edit rather than a silent drop, and keeps workflow
1443
+ machinery under the configured workflow/gates dirs. A non-repo cwd, or an
1444
+ unreadable allowlist, is fail-closed (exit 2).
1445
+
1446
+ The allowlist is optional consumer config (the `graph-vocab.sh` pattern): the
1447
+ path knob is `GATE_SDK_ROOT_ALLOWLIST` (default `<gates-dir>/root-allowlist.list`),
1448
+ registry-style — one entry per line, `#` comments and blanks ignored. An absent
1449
+ file falls back to the built-in minimal orientation set (`README.md`, `LICENSE`,
1450
+ the configured queue file, the configured agent file (`GATE_SDK_AGENT_FILE`,
1451
+ default `CLAUDE.md` — the always-loaded agent file a consumer's harness reads,
1452
+ `AGENTS.md` under an agent-file harness), `.gitignore`, plus the `SPEC-*.md`
1453
+ amendment glob — a root-component amendment is a legitimate transient root
1454
+ surface for any canon-kit consumer, so a gate that reddened every authoring stage
1455
+ would only train bypassing). The intentional-new-surface valve is the manifest
1456
+ itself: adding a root entry means adding its allowlist line in the same commit,
1457
+ a diff-visible edit needing no exemption tag. The `# graph:` couples the
1458
+ manifest at `tier=precommit`; the whole-tree `run-gates.sh` battery is the
1459
+ backstop for a pure-addition commit outside the trigger's staged view.
1460
+
1461
+ ### check-workflow-tiering
1462
+
1463
+ Two assertions, over `GATE_SDK_WORKFLOW_DIR`: (A) **partition totality** — every
1464
+ member is tracked or ignored, never neither; (B) **header presence and form** —
1465
+ every tracked member's first line is `# contract: ` with a payload matching the
1466
+ pointer form or the version-marker form. Both are §The workflow directory's
1467
+ rules; this section is the mechanism, that one the argument.
1468
+
1469
+ It deliberately does **not** re-resolve the pointer's path and heading:
1470
+ `check-spec-pointer` already does, and a second resolver is the parallel copy
1471
+ canon-kit's own tiering rule bans. The division is presence-and-shape here,
1472
+ resolution there — the same split `check-comment-tier` and `check-spec-pointer`
1473
+ already hold between them.
1474
+
1475
+ No new knob: `GATE_SDK_WORKFLOW_DIR` is the whole configuration surface.
1476
+ Fail-closed (exit 2) on a non-repo scan root, on a workflow directory the knob
1477
+ names but the tree lacks, and on an unreadable member. A directory member is
1478
+ partition-checked and header-exempt — a header belongs to a file. Tier
1479
+ `precommit`; the `# graph:` manifest couples the workflow dir and `.gitignore`.
1480
+
1481
+ ### check-action-pinning
1482
+
1483
+ Invariant: every `uses:` ref in a scanned YAML file is immutable — a full 40-hex
1484
+ commit SHA, or a repo-local `./` path to an in-repo composite action, which the
1485
+ checkout already pins. A tag or branch ref (`@v5`, `@main`) reds: whoever owns
1486
+ the tag can repoint it, so the code a run executes stops being the code that was
1487
+ reviewed. The ref is the first whitespace-delimited token after a key-position
1488
+ `uses:`, so a trailing `# v1.2.3` comment falls away and a commented-out step —
1489
+ the copy-paste seed a template ships — is read like a live one.
1490
+
1491
+ Not `check-workflow-*`. This tree already spends "workflow" on §The workflow
1492
+ directory (and `GATE_SDK_WORKFLOW_DIR`), so a second `check-workflow-*` gate,
1493
+ over `.github/workflows/` instead, would collide on the reader's only
1494
+ disambiguator.
1495
+
1496
+ The scan set is **derived, not rostered**: a `gate_find` walk for `*.yml` /
1497
+ `*.yaml` from the scan root (the optional positional argument, default `.`, the
1498
+ `check-root-tiering` form). Not a `git ls-files` enumeration — a tracked-files
1499
+ filter would put the fixture pair's synthetic tree out of reach, since it is
1500
+ untracked by construction. The walk covers `.github/workflows/` and the shipped
1501
+ copy-outs (`templates/gates-workflow.yml`, site-kit's `templates/site-health.yml`)
1502
+ with no roster to drift, and the shared prune set keeps it out of `gate-tests/`,
1503
+ so the `bad/` fixture cannot red the whole-tree run. **No new knob** — the scan
1504
+ set is derived and the prune set is the shared one (§Shared cross-gate values). A
1505
+ tree holding no YAML exits clean on a zero count, the counted inertness that makes
1506
+ this kit mechanism rather than a consumer gate: a consumer running no GitHub
1507
+ Actions pays nothing for it.
1508
+
1509
+ What it deliberately does not assert is the trailing version comment. The comment
1510
+ is not required, and where one is present the gate does not check that it names
1511
+ the tag the SHA resolves to — that needs a network call, which breaks the
1512
+ hermetic-gate contract, and demanding an unverifiable comment would be exactly
1513
+ the trivially-true proxy §When a gate earns its place bars. The comment stays a
1514
+ convention for review. The currency limit the pin does *not* buy is
1515
+ §templates/gates-workflow.yml's.
1516
+
1517
+ Tier `precommit`; the `# graph:` couples the scanned YAML surfaces, `dir=one` —
1518
+ a one-way audit.
1519
+
1520
+ ### check-action-run-shell
1521
+
1522
+ Invariant: every GitHub Actions `run:` **literal block scalar** in a scanned YAML
1523
+ file is ShellCheck-clean at `-S warning` under the dialect the step actually
1524
+ runs. It closes the class §check-shellcheck's target derivation leaves open — a
1525
+ workflow's `run:` body is shell that nothing lints, shellchecks, or executes
1526
+ outside a push or a tag.
1527
+
1528
+ Kit mechanism rather than a consumer gate, and the deciding fact is that kits
1529
+ ship workflow templates carrying `run:` shell — §templates/gates-workflow.yml and
1530
+ site-kit's `templates/site-health.yml`, the copy-outs consumers vendor. A
1531
+ consumer gate could reach both in one tree while leaving them unlinted for every
1532
+ downstream vendor, the same fix-the-instance shape §check-action-pinning
1533
+ rejected; that the second template belongs to a *different kit* is what makes the
1534
+ argument decisive, since no consumer gate and no site-kit-local gate covers both.
1535
+ Named `action-`, not `check-workflow-*`, for §check-action-pinning's reason: this
1536
+ tree already spends "workflow" on §The workflow directory.
1537
+
1538
+ **Scan set — derived, then narrowed to the subject.** Stage one is a `gate_find`
1539
+ walk for `*.yml` / `*.yaml` from the scan root (the optional positional argument,
1540
+ default `.`), pruned by the shared set, so `gate-tests/` is out and the `bad/`
1541
+ fixture cannot red the whole-tree run. Stage two is the **Actions-shape
1542
+ predicate**: a walked file enters the subject only if it carries a top-level
1543
+ `jobs:` key (a workflow) or a top-level `runs:` key (a composite action).
1544
+ Everything else is **skipped and counted**. The predicate governs *extraction as
1545
+ well as refusal* — a file it skips is neither linted nor refused.
1546
+
1547
+ Whole-tree reach is the wrong boundary here even though §check-action-pinning
1548
+ takes it. `uses:` with a 40-hex ref is self-limiting grammar; `run:` is an
1549
+ ordinary word serving as a YAML key in more than one CI schema, so whole-tree
1550
+ reach would lint foreign-schema text as shell — a stream of silent false
1551
+ positives, strictly worse than a loud refusal and squarely what §When a gate
1552
+ earns its place forbids. Two further reasons the narrowing is right rather than
1553
+ merely safe: a gate whose name and reach disagree teaches every later reader the
1554
+ wrong boundary; and gate-sdk has no standing to impose the literal-form
1555
+ conformance rule below on a consumer's non-Actions YAML, where it ships no
1556
+ template and owns no contract.
1557
+
1558
+ The `# graph:` manifest couples the **walked** surface rather than the matching
1559
+ one — a file that *gains* a top-level `jobs:` key must retrigger the gate, and a
1560
+ manifest naming only today's workflows would miss exactly that. The block tally
1561
+ is a measurement, never a contract: this section carries the derivation so a
1562
+ later commit adding a step cannot falsify it.
1563
+
1564
+ **The extractor** is one awk pass per file, keyed on block-scalar indentation,
1565
+ and stays inline in the check script rather than moving to `lib/` — a helper
1566
+ earns its place at a second consumer and there is none. Its rules, each of which
1567
+ a prototype proved necessary by failing without it:
1568
+
1569
+ - **The key column is the column of the key token, never the list dash.** A
1570
+ `- run: |` item's dash sits left of the key; taking the dash's column as the
1571
+ body's indentation floor makes every sibling key of that step (`env:`, `name:`)
1572
+ satisfy "more indented than the block header" and be swallowed into the shell
1573
+ body, dedented by the body's indent, so `env:` arrives as `v:`. That is not a
1574
+ missed block but a false-positive engine, and it is the single most important
1575
+ line in the extractor.
1576
+ - **The body is every following line more indented than the key column**, blank
1577
+ lines included, dedented by the first body line's indentation, ending at the
1578
+ first non-blank line at or left of the key column.
1579
+ - **No block header is recognised while inside a block**, so a body containing a
1580
+ heredoc whose text is literally `run: |` stays shell instead of being
1581
+ double-extracted.
1582
+ - **A comment line is never a header** — the commented example a shipped template
1583
+ carries is not a step.
1584
+
1585
+ **GitHub expressions.** `${{ … }}` is not shell syntax; left raw it is a parse
1586
+ error. It is replaced per line by `${GHEXPR}`, a braced parameter expansion,
1587
+ which presents to ShellCheck as the opaque runtime value a GitHub expression
1588
+ actually is. A bare word does not work and the difference is measured, not
1589
+ stylistic: a literal constant drags ShellCheck's constant-expression analysis
1590
+ into firing on correct code, manufacturing SC2050 inside `[ … ]` and SC2194
1591
+ inside `case`. The braced form causes no finding in any tested position.
1592
+
1593
+ **Dialect — resolved, never assumed.** Linting a block under the wrong dialect
1594
+ manufactures false positives, so the step's effective shell comes from its
1595
+ `shell:` sibling key, which may sit either side of the `run:` block:
1596
+
1597
+ | `shell:` | resolution |
1598
+ | --- | --- |
1599
+ | absent | `-s bash` — GitHub's documented default for a `run:` step on every hosted runner |
1600
+ | `bash` (with or without arguments) | `-s bash` |
1601
+ | `sh` / `dash` / `ksh` | the matching ShellCheck dialect — linting a POSIX body as bash hides the portability findings that dialect exists to surface |
1602
+ | anything else (`pwsh`, `python`, a custom `{0}` template) | the block is **skipped and counted** — the body is not shell, so there is no shell to lint |
1603
+
1604
+ **Severity is `-S warning`**, the gate family's level, so one threshold governs
1605
+ all ShellCheck lint in the tree. A future author lowering it inherits false
1606
+ positives this gate creates rather than finds: **SC1091** ("not following: … was
1607
+ not specified as input") fires on any block that sources a library, because an
1608
+ extracted fragment has no resolvable source root. It sits at `info`, below the
1609
+ threshold, so it does not bite today — recorded so that decision is made
1610
+ knowingly.
1611
+
1612
+ **The fidelity limit.** What the extractor **refuses loudly** can never become a
1613
+ false negative; what is **out of reach** is a stated cost; what is **out of
1614
+ subject** is a boundary the kit declines to cross. The distinctions carry the
1615
+ remedies, so they are kept apart.
1616
+
1617
+ *Refused — exit 2, naming the construct.* Each is detectable, so the gate stops
1618
+ rather than guessing, and every refusal fires **only inside the Actions-shape
1619
+ subject**: a folded block scalar (`run: >`, `run: >-`), because reassembling
1620
+ folded lines needs YAML's folding rules and mis-folding manufactures findings;
1621
+ an explicit block-scalar indentation indicator (`run: |2`), which can contradict
1622
+ the indent derived from the first body line; a YAML anchor or alias as the `run:`
1623
+ value, since no anchor resolution is attempted; and an unbalanced `${{` on a body
1624
+ line. Refusing the folded form makes the literal form a conformance requirement
1625
+ for a multi-line `run:` body *in an Actions-shaped file* — governance where
1626
+ gate-sdk ships the template and owns the contract. The chomping indicators `|-`
1627
+ and `|+` are ordinary spellings, handled and extracted with the body bytes
1628
+ intact; silently skipping those would be the worst hole of the set, since an
1629
+ author reaches for `|-` by habit.
1630
+
1631
+ *Out of subject.* **Other CI dialects that also spell a shell step `run:`.**
1632
+ CircleCI's `.circleci/config.yml` is the concrete case — `- run: |` there is
1633
+ genuinely shell and the extractor would handle it correctly. It is skipped
1634
+ anyway, because gate-sdk ships no CircleCI template and owns no contract over
1635
+ that file. This is a **decision, not an inability**, and the distinction matters
1636
+ to whoever revisits it: widening the predicate is a governance question about
1637
+ what the kit claims, never an engineering question about what the extractor can
1638
+ parse.
1639
+
1640
+ *Out of ability.* **Single-line plain-scalar `run:` values** are not linted: a
1641
+ plain scalar's text is governed by YAML's plain-scalar rules — a space-preceded
1642
+ `#` opens a *YAML* comment, not a shell one — so recovering the shell honestly
1643
+ means parsing the scalar, which is the dependency this gate declines. They are
1644
+ counted in the output so the cost is visible on every run, and the class that
1645
+ produces incidents is multi-line blocks. **Following a `uses:` call into another
1646
+ repository** is beyond any tree-local gate; a called workflow's own blocks are
1647
+ linted in the file that defines them, which carries its own top-level `jobs:`
1648
+ key. **GitHub-expression injection** is a non-goal rather than an oversight: the
1649
+ substitution above turns an interpolation into an opaque expansion, so the gate
1650
+ cannot see the injection hazard of an unquoted `${{ }}` — a textual substitution
1651
+ happening before the shell ever runs, and a different and worse class belonging
1652
+ to a dedicated workflow-security linter.
1653
+
1654
+ Tier `precommit`; **no new knob** — the scan set is derived, the prune set is the
1655
+ shared one, and the severity is the family's literal. A missing `shellcheck`
1656
+ binary is exit 2, as §check-shellcheck models. A tree holding no YAML exits clean
1657
+ on a zero count, the counted inertness that makes this kit mechanism: a consumer
1658
+ running no GitHub Actions pays nothing for it.
1659
+
1660
+ ### check-commit-msg
1661
+
1662
+ Invariant: the prospective commit message (the `commit-msg` hook's `$1`) matches
1663
+ no banned pattern. This is the message half of the CLAUDE.md ban on leaked
1664
+ local paths / private repo/project/account terms — the surface the `pre-commit`
1665
+ hook never sees, since the message does not exist until commit time. Enforcement
1666
+ is a generated `commit-msg` hook (`tier=commit-msg`), which rejects the message
1667
+ before the commit exists rather than a history scan finding the leak after push,
1668
+ when the only remedy is a destructive rewrite. Patterns come from
1669
+ `gate_msg_pattern_files` (lib/gate.sh): explicit positional pattern-file args
1670
+ win; otherwise `GATE_SDK_MSG_PATTERN_FILES` (tracked, must exist — fail-closed)
1671
+ plus `GATE_SDK_MSG_PATTERN_FILES_LOCAL` (gitignored, skipped when absent, so a
1672
+ fresh clone without the operator's private list still commits). Each file is
1673
+ `grep -E` one-pattern-per-line, `#` comments and blanks ignored; the kit ships
1674
+ `templates/msg-patterns.list` with the generic defaults (absolute home paths,
1675
+ the Claude Code promo URL — the marketing link that ends a generated PR body,
1676
+ never the `Co-Authored-By` trailer — and the session-reference class: the
1677
+ session-share URL host and a trailer-shaped `Key: ` line carrying a full UUID,
1678
+ the shape of a harness-injected session-id trailer. Both are generic mechanism —
1679
+ a public host and a shape, no private term — so they ship tracked, not local. The
1680
+ UUID half is anchored to a trailer-shaped line so the shared pattern set (also
1681
+ read by check-tree-terms §check-tree-terms) matches an injected footer, never the
1682
+ synthetic session UUIDs the tracked `smoke/` trees legitimately carry). A
1683
+ no-argument run (the whole-tree battery)
1684
+ is a clean skip: the message is not a tracked surface and the history-scan
1685
+ backstop is deferred to the hosted-attestation rung. A missing message-file
1686
+ argument-with-value, or a missing required tracked pattern file, is fail-closed
1687
+ (exit 2). The `# graph:` couples the pattern file (the regeneration trigger),
1688
+ not a tree path — the gate is emitted into the commit-msg hook, not the
1689
+ pre-commit hook. Subject *shape* is the sibling check-commit-subject's job:
1690
+ this gate stays the leak guard, that one the parse guarantee.
1691
+
1692
+ ### check-commit-subject
1693
+
1694
+ Invariant: the prospective commit message's subject line (the `commit-msg`
1695
+ hook's `$1`, first line) parses as `<type>(<scope>)?!?: <summary>` with
1696
+ `<type>` drawn from the shared roster and `<scope>` a `[a-z0-9./-]+` token, or
1697
+ matches a git-generated carve-out — `Merge `, `Revert ` and the `fixup! ` /
1698
+ `squash! ` autosquash forms. A subject that does not parse is an unread write
1699
+ to a governed projection, not a style nit: trajectory.sh's feat/debt column
1700
+ classifies commit subjects, and the closed-row freeze leans on docs/chore
1701
+ filings sitting outside that harvest — both properties held by convention
1702
+ until this gate made every subject carry a roster token, turning a mistyped
1703
+ prefix into a blocked commit rather than a silently drifted evidence row. It
1704
+ rides the generated `commit-msg` hook (`tier=commit-msg`) beside
1705
+ check-commit-msg, each an independent assertion with its own fixtures: the leak
1706
+ guard checks banned patterns, this one subject shape.
1707
+
1708
+ The roster is `gate_commit_types` (lib/gate.sh), reading `GATE_SDK_COMMIT_TYPES`
1709
+ (default `feat fix refactor perf docs test build ci chore style`). The
1710
+ one-vocabulary/two-readers tension — this gate and the evidence classifiers
1711
+ both key off commit types — is ruled *share the roster, keep the mappings*: the
1712
+ roster's single home is lib/gate.sh; drift-kit's kpi-task-split and
1713
+ trajectory.sh keep their own class mapping (feat vs fix+refactor), a
1714
+ classification over roster tokens rather than a second roster. Edge behavior
1715
+ matches check-commit-msg: a no-argument run (the whole-tree battery) is a clean
1716
+ skip — the message is not a tracked surface; a missing message-file
1717
+ argument-with-value is fail-closed (exit 2). The `# graph:` couples the
1718
+ roster's config home (lib/gate.sh, the regeneration trigger), not a tree path —
1719
+ the gate is emitted into the commit-msg hook.
1720
+
1721
+ ### check-tree-terms
1722
+
1723
+ Invariant: no tracked file matches the same banned-pattern set — the
1724
+ tracked-files half of the leak ban, sharing one pattern source with
1725
+ check-commit-msg (`gate_msg_pattern_files`) so the two halves cannot drift
1726
+ apart. It runs over `git ls-files` (scan root the optional first argument,
1727
+ default `.`; pattern-file overrides follow), at `tier=precommit` with
1728
+ `trigger=*` so it fires on every commit — any tracked file can carry a leak,
1729
+ not only an edited pattern list. Two skips keep it from flagging its own
1730
+ scaffolding: the shared prune dirs (so a fixture tree under `gate-tests/` is out
1731
+ of scope), and any file whose basename begins `msg-patterns` — a pattern list or
1732
+ its template contains, by construction, what it bans, and tracking a private
1733
+ list is caught by keeping it gitignored, not by this gate. A non-repo cwd, or a
1734
+ missing required tracked pattern file, is fail-closed (exit 2). When the pattern
1735
+ set is empty the tree is unchecked (clean) — the fail-closed obligation is on a
1736
+ missing file, not an empty one.
1737
+
1738
+ ### check-template-copy-parity
1739
+
1740
+ Invariant: a kit template and its vendored consumer copy agree on their
1741
+ **declared contract surface**. No mechanism kept the two in step before this
1742
+ gate — `scripts/agent-budget-guard.sh` and its template were both hand-edited
1743
+ with nothing verifying the edits matched.
1744
+
1745
+ **Scope derives from layout, never a roster.** The pairing is
1746
+ `<kit>/templates/<name>.sh` ↔ `<gates-dir>/<name>.sh` (scan root the optional
1747
+ first argument, default the git toplevel). Two exclusions, both derivable:
1748
+ `*-config.sh` is out of scope by name suffix — a config template is a starting
1749
+ point the consumer customizes, so equality would be the defect — and a template
1750
+ with **no** same-named file under the gates dir is silently skipped, not failed.
1751
+ An unpaired template was never vendored out and has no copy to be in parity
1752
+ with; running a template in place (this repo wires two from the template path
1753
+ itself) is a legitimate adoption mode, so failing closed there would red a tree
1754
+ for six files that are working as designed.
1755
+
1756
+ **Byte parity is ruled out, on measurement**, and so is containment in either
1757
+ direction. Every executable pair diverges deliberately: the consumer copies add
1758
+ this repo's own steering content. *copy ⊆ template* is therefore false on
1759
+ purpose; *template ⊆ copy* catches only the reverse of the direction that rots.
1760
+ Both alternatives are recorded here so no later pass re-derives them.
1761
+
1762
+ **The declared surface** is four classes of *declaration*, namespaced so a
1763
+ collision across classes cannot mask one:
1764
+
1765
+ - `func:` — function declarations, both `name()` and `function name` spellings.
1766
+ - `case:` — each `case`-arm's **exit token**: the first command word of the arm
1767
+ body.
1768
+ - `lib:` — command-position calls to `_`-bearing identifiers the file does not
1769
+ itself declare (the sourced-lib API).
1770
+ - `knob:` — uppercase `_`-bearing names read via the defaulted-env idiom
1771
+ `${NAME:-…}` / `${NAME:=…}`.
1772
+
1773
+ The `case:` class reads the arm's **action, never its pattern**, and that is a
1774
+ seam requirement rather than a convenience: a consumer's arm patterns are its own
1775
+ rule vocabulary, which a kit gate must never read (CLAUDE.md §The provenance
1776
+ seam). The gate asserts that a consumer's divergent rule lines are *declared*,
1777
+ never what they say. `func:` is inert on every pair in this tree (thin hook
1778
+ scripts source a kit lib and delegate, declaring no functions); the surface's
1779
+ whole bite comes from the other three classes, which are non-empty on every file.
1780
+
1781
+ **The three assertions.**
1782
+
1783
+ - **A — same resolved `spec:` target.** Both copies' first `spec:` line resolves
1784
+ to the same `<file> §<section>`, compared on the target with trailing prose
1785
+ stripped: a pair may gloss one target two ways deliberately, and comparing
1786
+ whole lines would red a sanctioned divergence. A inherits a second property —
1787
+ `check-spec-pointer` skips templates by design (§Self-lint), so a template's
1788
+ target has never been resolved by anything, and A is the only mechanism that
1789
+ surfaces a dangling template pointer.
1790
+ - **B — the template's declared surface is present in the copy.** Catches a
1791
+ template-side change never propagated *and* a copy-side **removal**. B is the
1792
+ only arm that sees a removal, which is why it is not droppable: the
1793
+ `session-context` pair is a mutual rewrite, not a pure addition.
1794
+ - **C — the copy declares what it adds.** A surface token in the copy but not the
1795
+ template is drift unless a `# copy-divergence: <reason>` line in that copy
1796
+ **names** the token. Naming, not blanket per-file coverage: a blanket marker
1797
+ would let C fire once and never again.
1798
+
1799
+ **The `# copy-divergence: <reason>` marker** is source, like the `# graph:` and
1800
+ `# spec:` headers it sits beside — hand-authored by whoever adds something the
1801
+ template does not declare, read by assertion C, and a directive rather than a
1802
+ restatement under `check-comment-tier` (it changes gate behavior). The reason is
1803
+ required and non-empty, the `[drain-exempt:]` precedent where the reason *is* the
1804
+ audit trail.
1805
+
1806
+ **Why this is the low-false-positive shape:** the gate reads declarations, not
1807
+ prose or logic, so a consumer rewording a message, reordering rules, or adding
1808
+ steering text triggers nothing. It fires only when a declared contract element
1809
+ appears on one side unexplained.
1810
+
1811
+ `dir=bi` — parity is symmetric, either side going stale is the defect, which is
1812
+ precisely what B and C split between them. The fixture pair **synthesizes** the
1813
+ one-sided edit rather than capturing one: the tree's own attesting divergence is
1814
+ already repaired, so `good/` proves green-on-a-sanctioned-`spec:`-prose-difference
1815
+ (alongside an unpaired template and a divergent `*-config.sh` pair, proving both
1816
+ scope exclusions) and `bad/` proves all three assertions red on a hand-edited
1817
+ copy. Tier `precommit`.
1818
+
1819
+ ### templates/check-skeleton.sh
1820
+
1821
+ The copy-paste reference skeleton — the canonical "how to write a gate"
1822
+ template (structure + fail-closed + output contract). A new gate is a
1823
+ copy-edit of it, shipping with its fixture pair. It is a template, never a
1824
+ registry member; structure is copied, not imported, so it stays per-gate and
1825
+ legible.
1826
+
1827
+ ### templates/gates-workflow.yml
1828
+
1829
+ The CI backstop template — the server-side outer tier of §Enforcement tiers,
1830
+ copied out to a consumer's `.github/workflows/gates.yml`. It closes the two
1831
+ gaps the local hook cannot by construction: a `--no-verify` commit, and a clone
1832
+ that never ran `install-hooks.sh`. Trigger is push + pull_request on the
1833
+ consumer's default branch (a fill-in — the template ships `main` and says so);
1834
+ step one is `run-gates.sh` (the full battery); step two is a fail-closed
1835
+ placeholder the consumer replaces with its own fixture/guard-test runners (an
1836
+ unfilled copy reddens CI, the fill-me signal). Checkout + bash only — no
1837
+ caching, no matrix, no third-party actions — so the workflow surface an agent
1838
+ could tamper with stays minimal and reviewable. The one action that survives that
1839
+ rule is pinned to a full commit SHA with the tag kept as a trailing comment, and
1840
+ §check-action-pinning holds it there: ruling *which* actions may appear leaves
1841
+ open *which code* a named tag resolves to, and a tag its owner can repoint is the
1842
+ same tamper axis one hop further out.
1843
+
1844
+ The pin buys immutability, not currency — and the two are easy to confuse. No
1845
+ update bot refreshes a pinned SHA (this repo deliberately runs none), so a pin
1846
+ stays exactly as old as the day it was written; refreshing one is a manual act at
1847
+ release time. A pinned ref is therefore not a maintained ref, and a consumer who
1848
+ reads it as one has the wrong picture of what the pin is worth. This repo's own
1849
+ `.github/workflows/gates.yml` is the filled example; both files register in
1850
+ `core-files.list` so their silent deletion is red, and the instance needs no
1851
+ freshness gate — a workflow invoking a retired script reddens in CI on its next
1852
+ run, the drift signal working as designed.
1853
+
1854
+ Scope boundary, stated in the template header rather than overclaimed:
1855
+ consumer-owned CI stops *bypass*, but cannot stop an agent editing the workflow
1856
+ itself in the same change. A tamper-proof verifier (verifier neutrality) is the
1857
+ deferred hosted-attestation-service rung. CI is not a smoke surface — it runs
1858
+ the real battery, so it is not installed by any kit's `smoke/` (§Consumer
1859
+ smoke); the branch-protection recipe that makes the check a required merge gate
1860
+ is a GitHub setting, so it lands as install-page docs, not committable
1861
+ mechanism.