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