checkwright 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1025) hide show
  1. package/README.md +35 -1361
  2. package/bin/checkwright.ps1 +157 -0
  3. package/bin/checkwright.sh +187 -44
  4. package/package.json +15 -14
  5. package/payload/artifact/aarch64-apple-darwin/checkwright-gates +0 -0
  6. package/payload/artifact/aarch64-apple-darwin/checkwright-gates.sha256 +1 -0
  7. package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe +0 -0
  8. package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -0
  9. package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates +0 -0
  10. package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
  11. package/payload/artifact/targets.list +120 -24
  12. package/payload/artifact/x86_64-apple-darwin/checkwright-gates +0 -0
  13. package/payload/artifact/x86_64-apple-darwin/checkwright-gates.sha256 +1 -0
  14. package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe +0 -0
  15. package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -0
  16. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  17. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
  18. package/payload/canon-kit/README.md +23 -37
  19. package/payload/canon-kit/checks/check-amendment-queue.gate +2 -2
  20. package/payload/canon-kit/checks/check-amendment-retired-spelling.gate +3 -0
  21. package/payload/canon-kit/checks/check-amendment-update-target.gate +1 -1
  22. package/payload/canon-kit/checks/check-comment-tier.gate +1 -1
  23. package/payload/canon-kit/checks/check-deprecation-task.gate +2 -1
  24. package/payload/canon-kit/checks/check-docs-cmd.gate +2 -2
  25. package/payload/canon-kit/checks/check-docs-link-convention.gate +1 -1
  26. package/payload/canon-kit/checks/check-docs-restatement-parity.gate +4 -0
  27. package/payload/canon-kit/checks/check-fence-command-head.gate +3 -0
  28. package/payload/canon-kit/checks/check-fence-run.gate +3 -0
  29. package/payload/canon-kit/checks/check-install-claim.gate +2 -1
  30. package/payload/canon-kit/checks/check-knob-citation.gate +1 -1
  31. package/payload/canon-kit/checks/check-manifest-count.gate +1 -1
  32. package/payload/canon-kit/checks/check-manifest-temporal.gate +1 -1
  33. package/payload/canon-kit/checks/check-md-refs.gate +1 -1
  34. package/payload/canon-kit/checks/check-md-unwrapped.gate +3 -0
  35. package/payload/canon-kit/checks/check-measured-claim.gate +2 -1
  36. package/payload/canon-kit/checks/check-payload-claim.gate +2 -1
  37. package/payload/canon-kit/checks/check-prose-bounds.gate +3 -0
  38. package/payload/canon-kit/checks/check-prose-enum.gate +2 -1
  39. package/payload/canon-kit/checks/check-prose-tells.gate +1 -1
  40. package/payload/canon-kit/checks/check-provenance-seam.gate +3 -0
  41. package/payload/canon-kit/checks/check-spec-derivable-section.gate +1 -1
  42. package/payload/canon-kit/checks/check-spec-dod-singleton.gate +1 -1
  43. package/payload/canon-kit/checks/check-spec-embedded-source.gate +1 -1
  44. package/payload/canon-kit/checks/check-spec-fence-balance.gate +1 -1
  45. package/payload/canon-kit/checks/check-spec-pointer.gate +2 -2
  46. package/payload/canon-kit/checks/check-surface-duplication.gate +3 -0
  47. package/payload/canon-kit/checks/check-todo-task-liveness.gate +1 -1
  48. package/payload/canon-kit/checks/check-tracking-claim.gate +1 -1
  49. package/payload/canon-kit/checks/check-unmarked-claim.gate +2 -1
  50. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/SPEC-tidy.md +3 -0
  51. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/TASK-QUEUE.md +37 -8
  52. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/expect.txt +6 -3
  53. package/payload/canon-kit/gate-tests/check-amendment-queue/good/SPEC-widget.md +7 -0
  54. package/payload/canon-kit/gate-tests/check-amendment-queue/good/TASK-QUEUE.md +11 -3
  55. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/SPEC-nosection.md +16 -0
  56. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/SPEC-thing.md +26 -0
  57. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/expect.txt +8 -0
  58. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/surface/one.md +4 -0
  59. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/surface/two.md +3 -0
  60. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/SPEC-tidy.md +20 -0
  61. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/SPEC-widget.md +37 -0
  62. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/component/README.md +4 -0
  63. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/component/SPEC.md +4 -0
  64. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/expect.txt +1 -0
  65. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/unnamed.md +4 -0
  66. package/payload/canon-kit/gate-tests/check-amendment-update-target.test.sh +1 -1
  67. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +1 -1
  68. package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +37 -26
  69. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/TASK-QUEUE.md +3 -1
  70. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.knobs +2 -0
  71. package/payload/canon-kit/gate-tests/check-deprecation-task/good/TASK-QUEUE.md +6 -2
  72. package/payload/canon-kit/gate-tests/check-deprecation-task/good/expect.txt +1 -1
  73. package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.knobs +2 -0
  74. package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +12 -10
  75. package/payload/canon-kit/gate-tests/check-docs-cmd/good/doc.md +4 -1
  76. package/payload/canon-kit/gate-tests/check-docs-cmd.test.sh +61 -0
  77. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/expect.txt +3 -0
  78. package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +21 -2
  79. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/expect.txt +2 -0
  80. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/kit/README.md +10 -0
  81. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/kit/index.md +11 -0
  82. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/scripts/canon-config.knobs +2 -0
  83. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/scripts/gate-sdk-config.knobs +2 -0
  84. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/expect.txt +1 -0
  85. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/kit/README.md +12 -0
  86. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/kit/index.md +13 -0
  87. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/scripts/canon-config.knobs +2 -0
  88. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/scripts/gate-sdk-config.knobs +2 -0
  89. package/payload/canon-kit/gate-tests/check-fence-command-head/bad/args +1 -0
  90. package/payload/canon-kit/gate-tests/check-fence-command-head/bad/doc.md +16 -0
  91. package/payload/canon-kit/gate-tests/check-fence-command-head/bad/expect.txt +5 -0
  92. package/payload/canon-kit/gate-tests/check-fence-command-head/good/args +1 -0
  93. package/payload/canon-kit/gate-tests/check-fence-command-head/good/bin/run.sh +3 -0
  94. package/payload/canon-kit/gate-tests/check-fence-command-head/good/doc.md +41 -0
  95. package/payload/canon-kit/gate-tests/check-fence-command-head/good/expect.txt +1 -0
  96. package/payload/canon-kit/gate-tests/check-fence-command-head/good/lib/tool.sh +5 -0
  97. package/payload/canon-kit/gate-tests/check-fence-command-head/good/scripts/canon-config.knobs +2 -0
  98. package/payload/canon-kit/gate-tests/check-fence-run/bad/args +1 -0
  99. package/payload/canon-kit/gate-tests/check-fence-run/bad/doc.md +32 -0
  100. package/payload/canon-kit/gate-tests/check-fence-run/bad/expect.txt +7 -0
  101. package/payload/canon-kit/gate-tests/check-fence-run/good/args +1 -0
  102. package/payload/canon-kit/gate-tests/check-fence-run/good/doc.md +31 -0
  103. package/payload/canon-kit/gate-tests/check-fence-run/good/expect.txt +1 -0
  104. package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/canon-config.knobs +7 -0
  105. package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/canon-config.knobs +7 -0
  106. package/payload/canon-kit/gate-tests/check-knob-citation.test.sh +42 -7
  107. package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +1 -2
  108. package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +2 -3
  109. package/payload/canon-kit/gate-tests/check-knob-default-coupling.test.sh +37 -8
  110. package/payload/canon-kit/gate-tests/check-manifest-count/bad/SPEC.md +3 -0
  111. package/payload/canon-kit/gate-tests/check-manifest-count/good/SPEC.md +10 -0
  112. package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +6 -6
  113. package/payload/canon-kit/gate-tests/check-md-refs.test.sh +1 -1
  114. package/payload/canon-kit/gate-tests/check-md-unwrapped/bad/doc.md +13 -0
  115. package/payload/canon-kit/gate-tests/check-md-unwrapped/bad/expect.txt +4 -0
  116. package/payload/canon-kit/gate-tests/check-md-unwrapped/bad/scripts/canon-config.knobs +2 -0
  117. package/payload/canon-kit/gate-tests/check-md-unwrapped/good/doc.md +45 -0
  118. package/payload/canon-kit/gate-tests/check-md-unwrapped/good/expect.txt +1 -0
  119. package/payload/canon-kit/gate-tests/check-md-unwrapped/good/scripts/canon-config.knobs +4 -0
  120. package/payload/canon-kit/gate-tests/check-measured-claim/bad/SPEC.md +3 -0
  121. package/payload/canon-kit/gate-tests/check-measured-claim/bad/expect.txt +1 -0
  122. package/payload/canon-kit/gate-tests/check-measured-claim/bad/scripts/canon-config.knobs +4 -0
  123. package/payload/canon-kit/gate-tests/check-measured-claim/good/SPEC.md +8 -0
  124. package/payload/canon-kit/gate-tests/check-measured-claim/good/scripts/canon-config.knobs +4 -0
  125. package/payload/canon-kit/gate-tests/check-measured-claim/good/worktrees/SPEC.md +12 -0
  126. package/payload/canon-kit/gate-tests/check-measured-claim.test.sh +32 -13
  127. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.knobs +6 -0
  128. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.knobs +6 -0
  129. package/payload/canon-kit/gate-tests/check-prose-bounds/bad/CLAUDE.md +9 -0
  130. package/payload/canon-kit/gate-tests/check-prose-bounds/bad/SPEC.md +11 -0
  131. package/payload/canon-kit/gate-tests/check-prose-bounds/bad/expect.txt +3 -0
  132. package/payload/canon-kit/gate-tests/check-prose-bounds/bad/scripts/canon-config.knobs +3 -0
  133. package/payload/canon-kit/gate-tests/check-prose-bounds/good/CLAUDE.md +10 -0
  134. package/payload/canon-kit/gate-tests/check-prose-bounds/good/SPEC.md +27 -0
  135. package/payload/canon-kit/gate-tests/check-prose-bounds/good/expect.txt +1 -0
  136. package/payload/canon-kit/gate-tests/check-prose-bounds/good/scripts/canon-config.knobs +3 -0
  137. package/payload/canon-kit/gate-tests/check-prose-bounds.test.sh +98 -0
  138. package/payload/canon-kit/gate-tests/check-prose-enum/bad/scripts/canon-config.knobs +3 -0
  139. package/payload/canon-kit/gate-tests/check-prose-enum/good/scripts/canon-config.knobs +3 -0
  140. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +55 -25
  141. package/payload/canon-kit/gate-tests/check-prose-tells/bad/prose.md +2 -0
  142. package/payload/canon-kit/gate-tests/check-prose-tells/bad/scripts/canon-config.knobs +5 -0
  143. package/payload/canon-kit/gate-tests/check-prose-tells/good/prose.md +6 -0
  144. package/payload/canon-kit/gate-tests/check-prose-tells/good/scripts/{canon-config.sh → canon-config.knobs} +2 -5
  145. package/payload/canon-kit/gate-tests/check-prose-tells/good/worktrees/prose.md +17 -0
  146. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/TASK-QUEUE.md +15 -0
  147. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/expect.txt +8 -0
  148. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/scripts/canon-config.knobs +3 -0
  149. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/scripts/gate-sdk-config.knobs +2 -0
  150. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/scripts/lifecycle-config.knobs +12 -0
  151. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/widget-toolkit/SPEC.md +27 -0
  152. package/payload/canon-kit/gate-tests/check-provenance-seam/good/TASK-QUEUE.md +15 -0
  153. package/payload/canon-kit/gate-tests/check-provenance-seam/good/expect.txt +1 -0
  154. package/payload/canon-kit/gate-tests/check-provenance-seam/good/scripts/canon-config.knobs +3 -0
  155. package/payload/canon-kit/gate-tests/check-provenance-seam/good/scripts/gate-sdk-config.knobs +2 -0
  156. package/payload/canon-kit/gate-tests/check-provenance-seam/good/scripts/lifecycle-config.knobs +12 -0
  157. package/payload/canon-kit/gate-tests/check-provenance-seam/good/widget-toolkit/SPEC.md +20 -0
  158. package/payload/canon-kit/gate-tests/check-provenance-seam.test.sh +136 -0
  159. package/payload/canon-kit/gate-tests/check-spec-dod-singleton.test.sh +1 -1
  160. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/README.md +6 -0
  161. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/SPEC-widget.md +5 -0
  162. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.rs +2 -0
  163. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +4 -0
  164. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/scripts/canon-config.knobs +6 -0
  165. package/payload/canon-kit/gate-tests/check-spec-pointer/good/README.md +15 -0
  166. package/payload/canon-kit/gate-tests/check-spec-pointer/good/SPEC-widget.md +10 -0
  167. package/payload/canon-kit/gate-tests/check-spec-pointer/good/expect.txt +1 -1
  168. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.rs +2 -0
  169. package/payload/canon-kit/gate-tests/check-spec-pointer/good/scripts/canon-config.knobs +6 -0
  170. package/payload/canon-kit/gate-tests/check-spec-pointer/good/vendored-kit/notes.txt +4 -0
  171. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/TASK-QUEUE.md +3 -1
  172. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/TASK-QUEUE.md +9 -3
  173. package/payload/canon-kit/gate-tests/check-tracking-claim.test.sh +1 -1
  174. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/SPEC.md +3 -0
  175. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/expect.txt +1 -0
  176. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/scripts/canon-config.knobs +4 -0
  177. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/SPEC.md +3 -0
  178. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/scripts/canon-config.knobs +4 -0
  179. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/worktrees/SPEC.md +11 -0
  180. package/payload/canon-kit/gate-tests/check-unmarked-claim.test.sh +53 -28
  181. package/payload/canon-kit/templates/SPEC-amendment.md +46 -25
  182. package/payload/canon-kit/templates/canon-config.knobs +1 -0
  183. package/payload/context-kit/README.md +33 -61
  184. package/payload/context-kit/checks/check-brevity.gate +2 -2
  185. package/payload/context-kit/checks/check-footprint-fresh.gate +3 -2
  186. package/payload/context-kit/checks/check-memory-off.gate +1 -1
  187. package/payload/context-kit/checks/check-settings-paths.gate +2 -2
  188. package/payload/context-kit/checks/check-settings-pins.gate +1 -1
  189. package/payload/context-kit/checks/check-surface-ratchet.gate +3 -0
  190. package/payload/context-kit/gate-tests/check-brevity/bad/CLAUDE.md +9 -2
  191. package/payload/context-kit/gate-tests/check-brevity/bad/expect.txt +1 -0
  192. package/payload/context-kit/gate-tests/check-brevity/good/CLAUDE.md +9 -4
  193. package/payload/context-kit/gate-tests/check-brevity/good/expect.txt +1 -1
  194. package/payload/context-kit/gate-tests/check-brevity.test.sh +107 -24
  195. package/payload/context-kit/gate-tests/check-footprint-fresh/good/CLAUDE.md +6 -0
  196. package/payload/context-kit/gate-tests/check-footprint-fresh/good/demo-kit/SPEC.md +3 -0
  197. package/payload/context-kit/gate-tests/check-footprint-fresh/good/demo-kit/templates/guide.md +3 -0
  198. package/payload/context-kit/gate-tests/check-footprint-fresh/good/docs/footprint.md +30 -0
  199. package/payload/context-kit/gate-tests/check-memory-off/bad/scripts/{context-config.sh → context-config.knobs} +1 -3
  200. package/payload/context-kit/gate-tests/check-memory-off/good/scripts/{context-config.sh → context-config.knobs} +1 -3
  201. package/payload/context-kit/gate-tests/check-memory-off.test.sh +1 -1
  202. package/payload/context-kit/gate-tests/check-settings-paths/bad/expect.txt +2 -0
  203. package/payload/context-kit/gate-tests/check-settings-paths/bad/settings.json +21 -0
  204. package/payload/context-kit/gate-tests/check-settings-paths/bad/tools/run-gates.sh +4 -0
  205. package/payload/context-kit/gate-tests/check-settings-paths/good/expect.txt +2 -1
  206. package/payload/context-kit/gate-tests/check-settings-paths/good/settings.json +48 -1
  207. package/payload/context-kit/gate-tests/check-settings-paths/good/tools/run-gates.sh +4 -0
  208. package/payload/context-kit/gate-tests/check-settings-pins.test.sh +1 -1
  209. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/CLAUDE.md +5 -0
  210. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/expect.txt +2 -0
  211. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/scripts/context-config.knobs +4 -0
  212. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/surface-ceiling.txt +2 -0
  213. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/templates/ungoverned.md +3 -0
  214. package/payload/context-kit/gate-tests/check-surface-ratchet/good/CLAUDE.md +3 -0
  215. package/payload/context-kit/gate-tests/check-surface-ratchet/good/expect.txt +1 -0
  216. package/payload/context-kit/gate-tests/check-surface-ratchet/good/scripts/context-config.knobs +4 -0
  217. package/payload/context-kit/gate-tests/check-surface-ratchet/good/surface-ceiling.txt +4 -0
  218. package/payload/context-kit/gate-tests/check-surface-ratchet/good/templates/held.md +4 -0
  219. package/payload/context-kit/gate-tests/check-surface-ratchet.test.sh +76 -0
  220. package/payload/context-kit/index-tests/corpus/baseline.txt +1 -1
  221. package/payload/context-kit/index-tests/corpus/surface.md +1 -6
  222. package/payload/context-kit/index-tests/expected/always-loaded.txt +1 -1
  223. package/payload/context-kit/templates/close-brevity.md +9 -28
  224. package/payload/context-kit/templates/context-config.knobs +1 -0
  225. package/payload/context-kit/templates/session-context.sh +43 -28
  226. package/payload/delegation-kit/README.md +35 -69
  227. package/payload/delegation-kit/checks/check-agent-tier-explicit.gate +1 -1
  228. package/payload/delegation-kit/checks/check-gate-tamper.gate +1 -1
  229. package/payload/delegation-kit/gate-tests/check-gate-tamper.test.sh +23 -2
  230. package/payload/delegation-kit/templates/agent-execution.md +23 -389
  231. package/payload/delegation-kit/templates/delegation-config.knobs +4 -0
  232. package/payload/delegation-kit/templates/dispatch-checklists.md +8 -45
  233. package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +33 -17
  234. package/payload/doctrine-kit/DOCTRINE.md +92 -458
  235. package/payload/doctrine-kit/README.md +24 -55
  236. package/payload/doctrine-kit/checks/check-doctrine-registration.gate +1 -1
  237. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +48 -3
  238. package/payload/drift-kit/README.md +43 -89
  239. package/payload/drift-kit/templates/close-knowledge.md +7 -22
  240. package/payload/drift-kit/templates/drift-config.knobs +1 -0
  241. package/payload/drift-kit/templates/economics.md +10 -48
  242. package/payload/drift-kit/templates/kpi-deprecated-surface.sh +31 -9
  243. package/payload/drift-kit/templates/kpis.list +2 -1
  244. package/payload/drift-kit/templates/price-table.tsv +1 -1
  245. package/payload/evidence-kit/README.md +23 -46
  246. package/payload/evidence-kit/checks/check-battery-roster.gate +1 -1
  247. package/payload/evidence-kit/checks/check-evidence-baseline.gate +2 -2
  248. package/payload/evidence-kit/checks/check-evidence-manifest.gate +1 -1
  249. package/payload/evidence-kit/checks/check-producer-liveness.gate +3 -0
  250. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.knobs +7 -0
  251. package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.knobs +7 -0
  252. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +7 -7
  253. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/TASK-QUEUE.md +3 -1
  254. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/args +1 -0
  255. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/expect.txt +2 -0
  256. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/scripts/evidence-config.knobs +4 -0
  257. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/validate-baseline.txt +1 -0
  258. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/TASK-QUEUE.md +3 -1
  259. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/args +1 -0
  260. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/scripts/evidence-config.knobs +3 -0
  261. package/payload/evidence-kit/gate-tests/check-evidence-baseline.test.sh +134 -14
  262. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/scripts/{evidence-config.sh → evidence-config.knobs} +3 -5
  263. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/scripts/{evidence-config.sh → evidence-config.knobs} +3 -5
  264. package/payload/evidence-kit/gate-tests/check-evidence-manifest.test.sh +5 -4
  265. package/payload/evidence-kit/gate-tests/diff-baseline-status.test.sh +128 -0
  266. package/payload/evidence-kit/gate-tests/evidence-lib.test.sh +51 -45
  267. package/payload/evidence-kit/gate-tests/pre-hook.test.sh +66 -0
  268. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +29 -16
  269. package/payload/evidence-kit/templates/evidence-config.knobs +1 -0
  270. package/payload/gate-sdk/README.md +48 -79
  271. package/payload/gate-sdk/bin/build-native.sh +27 -4
  272. package/payload/gate-sdk/bin/run-gates.ps1 +266 -0
  273. package/payload/gate-sdk/bin/run-gates.sh +53 -277
  274. package/payload/gate-sdk/checks/check-action-gh-repo.gate +1 -1
  275. package/payload/gate-sdk/checks/check-action-job-ref.gate +3 -0
  276. package/payload/gate-sdk/checks/check-action-permissions.gate +3 -0
  277. package/payload/gate-sdk/checks/check-action-pinning.gate +1 -1
  278. package/payload/gate-sdk/checks/check-action-run-path.gate +3 -0
  279. package/payload/gate-sdk/checks/check-action-run-shell.gate +3 -0
  280. package/payload/gate-sdk/checks/check-commit-msg.gate +2 -1
  281. package/payload/gate-sdk/checks/check-commit-subject.gate +1 -1
  282. package/payload/gate-sdk/checks/check-core-files.gate +1 -1
  283. package/payload/gate-sdk/checks/check-crate-arms.gate +3 -0
  284. package/payload/gate-sdk/checks/check-enforcement-fresh.gate +3 -2
  285. package/payload/gate-sdk/checks/check-exec-bit.gate +1 -1
  286. package/payload/gate-sdk/checks/check-front-end-fail-open.gate +3 -0
  287. package/payload/gate-sdk/checks/check-gate-assertions.gate +2 -2
  288. package/payload/gate-sdk/checks/check-gate-binary-fresh.gate +1 -1
  289. package/payload/gate-sdk/checks/check-gate-exemption-tasks.gate +1 -1
  290. package/payload/gate-sdk/checks/check-gate-fail-closed.gate +1 -1
  291. package/payload/gate-sdk/checks/check-gate-fixture-coverage.gate +1 -1
  292. package/payload/gate-sdk/checks/check-gate-output.gate +1 -1
  293. package/payload/gate-sdk/checks/check-gate-substrate-parity.gate +3 -0
  294. package/payload/gate-sdk/checks/check-graph.gate +2 -1
  295. package/payload/gate-sdk/checks/check-hook-exec-bit.gate +1 -1
  296. package/payload/gate-sdk/checks/check-identity.gate +1 -1
  297. package/payload/gate-sdk/checks/check-install-disposition.gate +3 -0
  298. package/payload/gate-sdk/checks/check-kit-enum.gate +1 -1
  299. package/payload/gate-sdk/checks/check-kit-registration.gate +1 -1
  300. package/payload/gate-sdk/checks/check-kit-roots-dialect.gate +3 -0
  301. package/payload/gate-sdk/checks/check-packed-links.gate +3 -0
  302. package/payload/gate-sdk/checks/check-path-dialect.gate +3 -0
  303. package/payload/gate-sdk/checks/check-pipe-membership.gate +3 -0
  304. package/payload/gate-sdk/checks/check-portability-floor.gate +4 -0
  305. package/payload/gate-sdk/checks/check-projection-roster.gate +4 -0
  306. package/payload/gate-sdk/checks/check-reads-couples.gate +1 -1
  307. package/payload/gate-sdk/checks/check-root-tiering.gate +1 -1
  308. package/payload/gate-sdk/checks/check-shellcheck.gate +3 -0
  309. package/payload/gate-sdk/checks/check-template-copy-parity.gate +1 -1
  310. package/payload/gate-sdk/checks/check-tree-terms.gate +2 -1
  311. package/payload/gate-sdk/checks/check-workflow-tiering.gate +1 -1
  312. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/args +2 -0
  313. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/expect.txt +1 -0
  314. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/scripts/gate-sdk-config.knobs +1 -0
  315. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/tree/notes.md +3 -0
  316. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/tree/workflows/ci.yml +8 -0
  317. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/args +3 -0
  318. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/expect.txt +1 -0
  319. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/scripts/gate-sdk-config.knobs +1 -0
  320. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/tree/notes.md +3 -0
  321. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/tree/workflows/ci.yml +8 -0
  322. package/payload/gate-sdk/gate-tests/check-action-permissions/bad/args +3 -0
  323. package/payload/gate-sdk/gate-tests/check-action-permissions/bad/expect.txt +5 -0
  324. package/payload/gate-sdk/gate-tests/check-action-permissions/bad/tree/workflows/empty-allowlist.yml +29 -0
  325. package/payload/gate-sdk/gate-tests/check-action-permissions/bad/tree/workflows/gates.yml +25 -0
  326. package/payload/gate-sdk/gate-tests/check-action-permissions/good/args +5 -0
  327. package/payload/gate-sdk/gate-tests/check-action-permissions/good/expect.txt +1 -0
  328. package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/action.yml +9 -0
  329. package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/not-actions.yml +7 -0
  330. package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/workflows/declared.yml +69 -0
  331. package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/workflows/valves.yml +22 -0
  332. package/payload/gate-sdk/gate-tests/check-action-run-path/bad/args +4 -0
  333. package/payload/gate-sdk/gate-tests/check-action-run-path/bad/expect.txt +2 -0
  334. package/payload/gate-sdk/gate-tests/check-action-run-path/bad/tree/scripts/present.sh +3 -0
  335. package/payload/gate-sdk/gate-tests/check-action-run-path/bad/tree/workflows/ci.yml +14 -0
  336. package/payload/gate-sdk/gate-tests/check-action-run-path/good/args +5 -0
  337. package/payload/gate-sdk/gate-tests/check-action-run-path/good/expect.txt +1 -0
  338. package/payload/gate-sdk/gate-tests/check-action-run-path/good/tree/scripts/build.sh +3 -0
  339. package/payload/gate-sdk/gate-tests/check-action-run-path/good/tree/sub/scripts/inner.sh +3 -0
  340. package/payload/gate-sdk/gate-tests/check-action-run-path/good/tree/workflows/ci.yml +36 -0
  341. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/args +4 -2
  342. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/expect.txt +2 -0
  343. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/tree/workflows/runner-dialect.yml +36 -0
  344. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/args +3 -2
  345. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/expect.txt +1 -1
  346. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/workflows/runner-dialect.yml +71 -0
  347. package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +102 -9
  348. package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/smoke/install.sh +1 -1
  349. package/payload/gate-sdk/gate-tests/check-assertion-strength/good/smoke/install.sh +1 -1
  350. package/payload/gate-sdk/gate-tests/check-assertion-strength.test.sh +55 -0
  351. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/expect.txt +1 -0
  352. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/msg.txt +4 -0
  353. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/patterns.list +5 -1
  354. package/payload/gate-sdk/gate-tests/check-commit-msg/good/msg.txt +7 -0
  355. package/payload/gate-sdk/gate-tests/check-commit-msg/good/patterns.list +5 -1
  356. package/payload/gate-sdk/gate-tests/check-commit-subject.test.sh +2 -2
  357. package/payload/gate-sdk/gate-tests/check-core-files.test.sh +1 -1
  358. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/scripts/gate-sdk-config.knobs +3 -0
  359. package/payload/gate-sdk/gate-tests/check-crate-arms/good/scripts/gate-sdk-config.knobs +3 -0
  360. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/SPEC.md +3 -0
  361. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/checks/check-demo.gate +1 -0
  362. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/probe.conf +1 -0
  363. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/templates/guide.md +3 -0
  364. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/docs/enforcement.md +33 -0
  365. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/scripts/gate-sdk-config.knobs +1 -0
  366. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/scripts/gates.list +1 -0
  367. package/payload/gate-sdk/gate-tests/check-exec-bit.test.sh +1 -1
  368. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/args +3 -0
  369. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/expect.txt +2 -0
  370. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/gate-sdk/bin/run-gates.ps1 +5 -0
  371. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/gate-sdk/bin/run-gates.sh +9 -0
  372. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/args +4 -0
  373. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/expect.txt +1 -0
  374. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/gate-sdk/bin/run-gates.ps1 +5 -0
  375. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/gate-sdk/bin/run-gates.sh +9 -0
  376. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/SPEC.md +4 -1
  377. package/payload/gate-sdk/gate-tests/check-gate-assertions.test.sh +1 -1
  378. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.knobs +2 -0
  379. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.knobs +2 -0
  380. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +6 -12
  381. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +5 -3
  382. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/TASK-QUEUE.md +3 -1
  383. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks.test.sh +4 -2
  384. package/payload/gate-sdk/gate-tests/check-gate-output.test.sh +1 -1
  385. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/ci/build-artifact.sh +9 -0
  386. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/ci.yml +9 -0
  387. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +4 -2
  388. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.knobs +5 -0
  389. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +6 -0
  390. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/ci/build-artifact.sh +9 -0
  391. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/ci.yml +16 -0
  392. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -3
  393. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.knobs +5 -0
  394. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +1 -1
  395. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +222 -197
  396. package/payload/gate-sdk/gate-tests/check-graph/bad/SPEC-example-gate.md +7 -2
  397. package/payload/gate-sdk/gate-tests/check-graph/bad/expect.txt +4 -0
  398. package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-second-gate.md +3 -1
  399. package/payload/gate-sdk/gate-tests/check-graph-cap.test.sh +1 -1
  400. package/payload/gate-sdk/gate-tests/check-graph-refs.test.sh +8 -8
  401. package/payload/gate-sdk/gate-tests/check-graph-theme.test.sh +2 -2
  402. package/payload/gate-sdk/gate-tests/check-graph-tree.test.sh +49 -14
  403. package/payload/gate-sdk/gate-tests/check-identity/bad/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +4 -4
  404. package/payload/gate-sdk/gate-tests/check-identity/good/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +4 -4
  405. package/payload/gate-sdk/gate-tests/check-identity.test.sh +1 -1
  406. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-eta.sh +7 -0
  407. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-iota.sh +7 -0
  408. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-theta.sh +7 -0
  409. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-zeta.gate +3 -0
  410. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/smoke/install.sh +1 -1
  411. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/args +8 -5
  412. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/expect.txt +5 -0
  413. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/native/src/installer/recipe.rs +10 -0
  414. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +2 -3
  415. package/payload/gate-sdk/gate-tests/check-install-disposition/good/args +8 -4
  416. package/payload/gate-sdk/gate-tests/check-install-disposition/good/expect.txt +2 -0
  417. package/payload/gate-sdk/gate-tests/check-install-disposition/good/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +2 -3
  418. package/payload/gate-sdk/gate-tests/check-install-disposition/good/{alpha-kit → site-kit}/checks/check-alpha.sh +1 -1
  419. package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-beta.gate +3 -0
  420. package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-gamma.sh +6 -0
  421. package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-omega.sh +7 -0
  422. package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-psi.sh +7 -0
  423. package/payload/gate-sdk/gate-tests/check-install-disposition/good/{alpha-kit → site-kit}/smoke/install.sh +2 -2
  424. package/payload/gate-sdk/gate-tests/check-kit-registration/bad/registry-doc.md +15 -12
  425. package/payload/gate-sdk/gate-tests/check-kit-registration/good/args +7 -5
  426. package/payload/gate-sdk/gate-tests/check-kit-registration/good/scripts/gate-sdk-config.knobs +2 -0
  427. package/payload/gate-sdk/gate-tests/check-kit-registration.test.sh +2 -2
  428. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/args +5 -0
  429. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/expect.txt +1 -0
  430. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/alpha-kit/checks/placeholder.txt +3 -0
  431. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/alpha-kit/gate-tests/alpha.test.sh +3 -0
  432. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/alpha-kit/lib/alpha.sh +3 -0
  433. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/beta-kit/checks/placeholder.txt +3 -0
  434. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/beta-kit/gate-tests/beta.test.sh +3 -0
  435. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/beta-kit/lib/beta.sh +3 -0
  436. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/gate-sdk/checks/placeholder.txt +3 -0
  437. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/gate-sdk/lib/gate.sh +3 -0
  438. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/scripts/gate-sdk-config.knobs +7 -0
  439. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/scripts/gates.list +3 -0
  440. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/args +7 -0
  441. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/expect.txt +1 -0
  442. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/alpha-kit/checks/placeholder.txt +3 -0
  443. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/alpha-kit/gate-tests/alpha.test.sh +3 -0
  444. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/alpha-kit/lib/alpha.sh +3 -0
  445. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/beta-kit/checks/placeholder.txt +3 -0
  446. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/beta-kit/gate-tests/beta.test.sh +3 -0
  447. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/beta-kit/lib/beta.sh +3 -0
  448. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/gate-sdk/checks/placeholder.txt +3 -0
  449. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/gate-sdk/lib/gate.sh +3 -0
  450. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/scripts/gates.list +3 -0
  451. package/payload/gate-sdk/gate-tests/check-packed-links/bad/alpha-kit/README.md +5 -0
  452. package/payload/gate-sdk/gate-tests/check-packed-links/bad/args +5 -0
  453. package/payload/gate-sdk/gate-tests/check-packed-links/bad/beta-kit/README.md +5 -0
  454. package/payload/gate-sdk/gate-tests/check-packed-links/bad/expect.txt +2 -0
  455. package/payload/gate-sdk/gate-tests/check-packed-links/bad/scripts/gate-sdk-config.knobs +4 -0
  456. package/payload/gate-sdk/gate-tests/check-packed-links/good/alpha-kit/README.md +5 -0
  457. package/payload/gate-sdk/gate-tests/check-packed-links/good/args +8 -0
  458. package/payload/gate-sdk/gate-tests/check-packed-links/good/beta-kit/README.md +9 -0
  459. package/payload/gate-sdk/gate-tests/check-packed-links/good/expect.txt +1 -0
  460. package/payload/gate-sdk/gate-tests/check-packed-links/good/gamma-kit/SPEC.md +4 -0
  461. package/payload/gate-sdk/gate-tests/check-packed-links/good/scripts/gate-sdk-config.knobs +6 -0
  462. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/args +3 -0
  463. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/expect.txt +15 -0
  464. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/native/src/primitive.rs +19 -0
  465. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/native/src/producer.rs +8 -0
  466. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/native/src/walk.rs +13 -0
  467. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/bound-root.sh +5 -0
  468. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/case-arm.sh +6 -0
  469. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/commented.sh +5 -0
  470. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/common-dir.sh +4 -0
  471. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/glob-test.sh +4 -0
  472. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/late-anchor.sh +7 -0
  473. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/logical-readback.sh +5 -0
  474. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/probe.sh +7 -0
  475. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/two-root.sh +5 -0
  476. package/payload/gate-sdk/gate-tests/check-path-dialect/good/args +3 -0
  477. package/payload/gate-sdk/gate-tests/check-path-dialect/good/expect.txt +13 -0
  478. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/commented.rs +5 -0
  479. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/local.rs +12 -0
  480. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/namespace.rs +11 -0
  481. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/typed.rs +10 -0
  482. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/verdict.rs +5 -0
  483. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/walk.rs +24 -0
  484. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/anchored.sh +6 -0
  485. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/cd-only.sh +7 -0
  486. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/commented.sh +6 -0
  487. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/one-root.sh +4 -0
  488. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/probe.sh +8 -0
  489. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/rooted.sh +23 -0
  490. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/subshell.sh +6 -0
  491. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/two-line.sh +8 -0
  492. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/verdict.sh +7 -0
  493. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/args +4 -0
  494. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/expect.txt +6 -0
  495. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/scripts/gate-sdk-config.knobs +1 -0
  496. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/array-grep.sh +6 -0
  497. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/echo-max-count.sh +5 -0
  498. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/gate-tests/membership.test.sh +6 -0
  499. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/loop-head.sh +5 -0
  500. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/tests/relocated.test.sh +6 -0
  501. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/args +5 -0
  502. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/expect.txt +3 -0
  503. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/full-reader.sh +4 -0
  504. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/gate-tests/check-x/bad/violating.test.sh +6 -0
  505. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/gate-tests/clean.test.sh +8 -0
  506. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/loop-membership.sh +8 -0
  507. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/no-pipefail.sh +6 -0
  508. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/one-line-producer.sh +5 -0
  509. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/args +2 -0
  510. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/expect.txt +8 -0
  511. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/patterns.list +4 -0
  512. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/scripts/gate-sdk-config.knobs +4 -0
  513. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/empty-reason-verb +5 -0
  514. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/strings.ps1 +6 -0
  515. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/too-far-verb +5 -0
  516. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/undeclared-verb +3 -0
  517. package/payload/gate-sdk/gate-tests/check-portability-floor/good/args +2 -0
  518. package/payload/gate-sdk/gate-tests/check-portability-floor/good/expect.txt +1 -0
  519. package/payload/gate-sdk/gate-tests/check-portability-floor/good/patterns.list +5 -0
  520. package/payload/gate-sdk/gate-tests/check-portability-floor/good/scripts/gate-sdk-config.knobs +4 -0
  521. package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/front.ps1 +7 -0
  522. package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/plain-verb +5 -0
  523. package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/portability-patterns.list +5 -0
  524. package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/upgrade-verb +7 -0
  525. package/payload/gate-sdk/gate-tests/check-portability-floor.test.sh +154 -0
  526. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/demo-kit/checks/check-beta.gate +2 -0
  527. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/docs/roster.md +11 -0
  528. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/expect.txt +7 -0
  529. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/check-alpha.gate +2 -0
  530. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/check-gamma.gate +2 -0
  531. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/check-plain.gate +1 -0
  532. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/gate-sdk-config.knobs +3 -0
  533. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/gates.list +4 -0
  534. package/payload/gate-sdk/gate-tests/check-projection-roster/good/demo-kit/checks/check-beta.gate +2 -0
  535. package/payload/gate-sdk/gate-tests/check-projection-roster/good/docs/roster.md +16 -0
  536. package/payload/gate-sdk/gate-tests/check-projection-roster/good/expect.txt +1 -0
  537. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-alpha.gate +2 -0
  538. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-delta.gate +2 -0
  539. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-epsilon.gate +2 -0
  540. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-plain.gate +1 -0
  541. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/gate-sdk-config.knobs +4 -0
  542. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/gates.list +5 -0
  543. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.knobs +4 -0
  544. package/payload/gate-sdk/gate-tests/check-readme-roster/good/args +1 -1
  545. package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.knobs +4 -0
  546. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/expect.txt +1 -1
  547. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/sandbox-gate.sh +4 -4
  548. package/payload/gate-sdk/gate-tests/check-reads-couples/good/sandbox-gate.sh +4 -4
  549. package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +25 -20
  550. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/alpha-kit/smoke/install.sh +1 -1
  551. package/payload/gate-sdk/gate-tests/{check-template-registry-parity/bad/scripts/gate-sdk-config.sh → check-smoke-entry-guard/bad/scripts/gate-sdk-config.knobs} +2 -3
  552. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/install.sh +1 -1
  553. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/violation.sh +1 -1
  554. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/args +1 -1
  555. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/beta-kit/smoke/install.sh +1 -1
  556. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/scripts/gate-sdk-config.knobs +4 -0
  557. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/args +3 -1
  558. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/session-note.sh +6 -0
  559. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/expect.txt +1 -1
  560. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/session-note.sh +6 -0
  561. package/payload/gate-sdk/gate-tests/check-template-copy-parity.test.sh +1 -1
  562. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +2 -0
  563. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/drift-kit/templates/kpis.list +18 -0
  564. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +2 -0
  565. package/payload/gate-sdk/gate-tests/{check-smoke-entry-guard/bad/scripts/gate-sdk-config.sh → check-template-registry-parity/bad/scripts/gate-sdk-config.knobs} +2 -3
  566. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +3 -1
  567. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/drift-kit/templates/kpis.list +17 -0
  568. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -1
  569. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.knobs +4 -0
  570. package/payload/gate-sdk/gate-tests/check-test-hermetic-smoke.test.sh +5 -5
  571. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +1 -0
  572. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/patterns.list +4 -0
  573. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/accounts.txt +1 -0
  574. package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -1
  575. package/payload/gate-sdk/gate-tests/check-tree-terms/good/patterns.list +5 -1
  576. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/anchored.txt +1 -0
  577. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/handles.txt +2 -0
  578. package/payload/gate-sdk/gate-tests/check-tree-terms.test.sh +44 -5
  579. package/payload/gate-sdk/gate-tests/emit-arm-shape.test.sh +95 -0
  580. package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +10 -10
  581. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +10 -184
  582. package/payload/gate-sdk/gate-tests/reads-census.test.sh +96 -0
  583. package/payload/gate-sdk/gate-tests/run-arm-contract.test.sh +190 -0
  584. package/payload/gate-sdk/gate-tests/run-dispatch-streams.test.sh +64 -41
  585. package/payload/gate-sdk/gate-tests/run-for-path.test.sh +2 -2
  586. package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +121 -16
  587. package/payload/gate-sdk/gate-tests/run-gates-linked-worktree.test.sh +136 -0
  588. package/payload/gate-sdk/lib/gate.sh +231 -484
  589. package/payload/gate-sdk/lib/test-hermetic.sh +39 -9
  590. package/payload/gate-sdk/templates/check-skeleton.sh +3 -2
  591. package/payload/gate-sdk/templates/gates-workflow.yml +23 -10
  592. package/payload/gate-sdk/templates/msg-patterns.list +14 -5
  593. package/payload/gate-sdk/templates/portability-patterns.list +56 -0
  594. package/payload/guard-kit/README.md +43 -47
  595. package/payload/guard-kit/checks/check-door-binding.gate +3 -0
  596. package/payload/guard-kit/gate-tests/check-door-binding/bad/alpha-kit/README.md +6 -0
  597. package/payload/guard-kit/gate-tests/check-door-binding/bad/alpha-kit/templates/alpha-config.knobs +3 -0
  598. package/payload/guard-kit/gate-tests/check-door-binding/bad/args +5 -0
  599. package/payload/guard-kit/gate-tests/check-door-binding/bad/beta-kit/lib/beta.sh +6 -0
  600. package/payload/guard-kit/gate-tests/check-door-binding/bad/expect.txt +5 -0
  601. package/payload/guard-kit/gate-tests/check-door-binding/bad/scripts/gate-sdk-config.knobs +4 -0
  602. package/payload/guard-kit/gate-tests/check-door-binding/bad/scripts/guard-config.knobs +3 -0
  603. package/payload/guard-kit/gate-tests/check-door-binding/bad/site/banner.md +8 -0
  604. package/payload/guard-kit/gate-tests/check-door-binding/bad/site/landing.md +11 -0
  605. package/payload/guard-kit/gate-tests/check-door-binding/good/alpha-kit/README.md +8 -0
  606. package/payload/guard-kit/gate-tests/check-door-binding/good/alpha-kit/templates/settings-hooks.json +20 -0
  607. package/payload/guard-kit/gate-tests/check-door-binding/good/args +7 -0
  608. package/payload/guard-kit/gate-tests/check-door-binding/good/beta-kit/lib/beta.sh +6 -0
  609. package/payload/guard-kit/gate-tests/check-door-binding/good/expect.txt +1 -0
  610. package/payload/guard-kit/gate-tests/check-door-binding/good/scripts/gate-sdk-config.knobs +4 -0
  611. package/payload/guard-kit/gate-tests/check-door-binding/good/scripts/guard-config.knobs +3 -0
  612. package/payload/guard-kit/gate-tests/check-door-binding/good/site/mirror.md +12 -0
  613. package/payload/guard-kit/gate-tests/check-door-binding/good/site/register.md +24 -0
  614. package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +40 -27
  615. package/payload/guard-kit/gate-tests/consumer-rules.test.sh +189 -0
  616. package/payload/guard-kit/gate-tests/door-binding-corpus.test.sh +72 -0
  617. package/payload/guard-kit/gate-tests/git-mutation-under-producer.test.sh +48 -23
  618. package/payload/guard-kit/gate-tests/guard-config-knobs.test.sh +170 -0
  619. package/payload/guard-kit/gate-tests/rewrite.test.sh +73 -0
  620. package/payload/guard-kit/gate-tests/scan-prompts.test.sh +174 -8
  621. package/payload/guard-kit/gate-tests/scratch-run.test.sh +149 -13
  622. package/payload/guard-kit/gate-tests/worktree-confinement.test.sh +169 -0
  623. package/payload/guard-kit/guard-tests/background-cases.tsv +14 -5
  624. package/payload/guard-kit/guard-tests/cases.tsv +360 -54
  625. package/payload/guard-kit/guard-tests/powershell-background-cases.tsv +29 -0
  626. package/payload/guard-kit/guard-tests/powershell-cases.tsv +81 -0
  627. package/payload/guard-kit/templates/close-triage.md +15 -62
  628. package/payload/guard-kit/templates/guard-config.knobs +26 -0
  629. package/payload/guard-kit/templates/settings-allow.json +15 -0
  630. package/payload/guard-kit/templates/settings-hooks.json +5 -5
  631. package/payload/lifecycle-kit/README.md +48 -76
  632. package/payload/lifecycle-kit/checks/check-audit-roster.gate +3 -0
  633. package/payload/lifecycle-kit/checks/check-close-surfaces.gate +1 -1
  634. package/payload/lifecycle-kit/checks/check-dispatch-entry.gate +3 -0
  635. package/payload/lifecycle-kit/checks/check-gap-inbox-neutrality.gate +1 -1
  636. package/payload/lifecycle-kit/checks/check-lesson-disposition.gate +1 -1
  637. package/payload/lifecycle-kit/checks/check-lifecycle-registration.gate +1 -1
  638. package/payload/lifecycle-kit/checks/check-merge-attrs.gate +1 -1
  639. package/payload/lifecycle-kit/checks/check-scratch-citation.gate +1 -1
  640. package/payload/lifecycle-kit/checks/check-shim-restatement.gate +1 -1
  641. package/payload/lifecycle-kit/checks/check-skill-binding.gate +1 -1
  642. package/payload/lifecycle-kit/checks/check-stage-entry.gate +2 -2
  643. package/payload/lifecycle-kit/checks/check-stage-evidence.gate +1 -1
  644. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.gate +2 -2
  645. package/payload/lifecycle-kit/checks/check-stamp-subject.gate +3 -0
  646. package/payload/lifecycle-kit/checks/check-survey-record.gate +2 -2
  647. package/payload/lifecycle-kit/gate-tests/boundary-scratch-wipe.test.sh +93 -18
  648. package/payload/lifecycle-kit/gate-tests/boundary-stage-journal.test.sh +196 -0
  649. package/payload/lifecycle-kit/gate-tests/boundary-worktree-refusal.test.sh +214 -0
  650. package/payload/lifecycle-kit/gate-tests/check-audit-roster/bad/args +2 -0
  651. package/payload/lifecycle-kit/gate-tests/check-audit-roster/bad/expect.txt +6 -0
  652. package/payload/lifecycle-kit/gate-tests/check-audit-roster/bad/roster.txt +34 -0
  653. package/payload/lifecycle-kit/gate-tests/check-audit-roster/good/args +2 -0
  654. package/payload/lifecycle-kit/gate-tests/check-audit-roster/good/expect.txt +1 -0
  655. package/payload/lifecycle-kit/gate-tests/check-audit-roster/good/roster.txt +22 -0
  656. package/payload/lifecycle-kit/gate-tests/check-audit-roster.test.sh +101 -0
  657. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/scripts/lifecycle-config.knobs +2 -0
  658. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/owners/worktrees/inbox.md +5 -0
  659. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/scripts/lifecycle-config.knobs +2 -0
  660. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +21 -4
  661. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/args +6 -0
  662. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/expect.txt +1 -0
  663. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/head.txt +5 -0
  664. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/marker.txt +1 -0
  665. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/msg.txt +4 -0
  666. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/paths.txt +1 -0
  667. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/staged.txt +5 -0
  668. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/args +6 -0
  669. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/expect.txt +1 -0
  670. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/head.txt +5 -0
  671. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/marker.txt +1 -0
  672. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/msg.txt +4 -0
  673. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/paths.txt +2 -0
  674. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/staged.txt +6 -0
  675. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry.test.sh +60 -0
  676. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +1 -1
  677. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/AGENT.md +1 -5
  678. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/AGENT.md +1 -5
  679. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +1 -1
  680. package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +2 -2
  681. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/scripts/lifecycle-config.knobs +2 -0
  682. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/scripts/lifecycle-config.knobs +2 -0
  683. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/surfaces/worktrees/queue.md +13 -0
  684. package/payload/lifecycle-kit/gate-tests/check-shim-restatement.test.sh +1 -1
  685. package/payload/lifecycle-kit/gate-tests/check-skill-binding.test.sh +1 -1
  686. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +158 -11
  687. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +27 -2
  688. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/align.md +4 -1
  689. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/build.md +4 -1
  690. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/close.md +5 -0
  691. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/scope.md +4 -1
  692. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/validate.md +1 -1
  693. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/expect.txt +1 -1
  694. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/align.md +4 -1
  695. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/build.md +4 -1
  696. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/close.md +4 -1
  697. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/scope.md +4 -1
  698. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/validate.md +4 -1
  699. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage.test.sh +73 -0
  700. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/args +4 -0
  701. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/expect.txt +1 -0
  702. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/head.txt +5 -0
  703. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/msg.txt +4 -0
  704. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/staged.txt +6 -0
  705. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/args +4 -0
  706. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/expect.txt +1 -0
  707. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/head.txt +5 -0
  708. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/msg.txt +4 -0
  709. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/staged.txt +7 -0
  710. package/payload/lifecycle-kit/gate-tests/check-stamp-subject.test.sh +59 -0
  711. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +3 -0
  712. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +24 -0
  713. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -1
  714. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +10 -0
  715. package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +56 -5
  716. package/payload/lifecycle-kit/gate-tests/dispatch-marker.test.sh +152 -0
  717. package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +23 -48
  718. package/payload/lifecycle-kit/gate-tests/gap-inbox-route.test.sh +7 -5
  719. package/payload/lifecycle-kit/gate-tests/lead-journal-open.test.sh +119 -0
  720. package/payload/lifecycle-kit/gate-tests/preflight-valve.test.sh +170 -0
  721. package/payload/lifecycle-kit/gate-tests/rename-iteration.test.sh +5 -3
  722. package/payload/lifecycle-kit/gate-tests/ruling-staleness.test.sh +89 -0
  723. package/payload/lifecycle-kit/gate-tests/stamp-before-write.test.sh +66 -0
  724. package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +12 -6
  725. package/payload/lifecycle-kit/templates/consult.md +9 -63
  726. package/payload/lifecycle-kit/templates/lead.md +143 -431
  727. package/payload/lifecycle-kit/templates/lifecycle-config.knobs +1 -0
  728. package/payload/lifecycle-kit/templates/release-sweep.md +6 -35
  729. package/payload/lifecycle-kit/templates/stages/align.md +14 -82
  730. package/payload/lifecycle-kit/templates/stages/build.md +30 -98
  731. package/payload/lifecycle-kit/templates/stages/close.md +21 -170
  732. package/payload/lifecycle-kit/templates/stages/scope.md +42 -167
  733. package/payload/lifecycle-kit/templates/stages/spec.md +31 -97
  734. package/payload/lifecycle-kit/templates/stages/validate.md +22 -59
  735. package/payload/lifecycle-kit/templates/upgrade.md +6 -37
  736. package/payload/queue-kit/README.md +33 -48
  737. package/payload/queue-kit/checks/check-deferred-board-tags.gate +3 -0
  738. package/payload/queue-kit/checks/check-queue-entry-budget.gate +2 -2
  739. package/payload/queue-kit/checks/check-queue-hygiene.gate +2 -2
  740. package/payload/queue-kit/checks/check-queue-prose-precondition.gate +1 -1
  741. package/payload/queue-kit/checks/check-queue-sections.gate +1 -1
  742. package/payload/queue-kit/checks/check-queue-slug-liveness.gate +2 -2
  743. package/payload/queue-kit/checks/check-queue-wrap.gate +2 -2
  744. package/payload/queue-kit/checks/check-roadmap-fresh.gate +3 -2
  745. package/payload/queue-kit/checks/check-tag-lead-line.gate +2 -2
  746. package/payload/queue-kit/checks/check-task-conservation.gate +1 -1
  747. package/payload/queue-kit/checks/check-task-names.gate +2 -2
  748. package/payload/queue-kit/gate-tests/check-deferred-board-tags/bad/TASK-QUEUE.md +41 -0
  749. package/payload/queue-kit/gate-tests/check-deferred-board-tags/bad/expect.txt +6 -0
  750. package/payload/queue-kit/gate-tests/check-deferred-board-tags/bad/widget-kit/README.md +3 -0
  751. package/payload/queue-kit/gate-tests/check-deferred-board-tags/good/TASK-QUEUE.md +39 -0
  752. package/payload/queue-kit/gate-tests/check-deferred-board-tags/good/expect.txt +1 -0
  753. package/payload/queue-kit/gate-tests/check-deferred-board-tags/good/widget-kit/README.md +3 -0
  754. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/TASK-QUEUE.md +76 -31
  755. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/expect.txt +12 -4
  756. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/scripts/queue-config.knobs +4 -0
  757. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/TASK-QUEUE.md +58 -19
  758. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/expect.txt +8 -4
  759. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/scripts/queue-config.knobs +4 -0
  760. package/payload/queue-kit/gate-tests/check-queue-entry-budget.test.sh +124 -0
  761. package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/TASK-QUEUE.md +11 -1
  762. package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/expect.txt +2 -0
  763. package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +30 -11
  764. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/TASK-QUEUE.md +3 -1
  765. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/expect.txt +1 -0
  766. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/good/TASK-QUEUE.md +22 -6
  767. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/TASK-QUEUE.md +3 -1
  768. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/docs/page.md +1 -1
  769. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/expect.txt +3 -1
  770. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/scripts/queue-config.knobs +1 -0
  771. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/TASK-QUEUE.md +6 -2
  772. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/docs/page.md +3 -3
  773. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/docs/worktrees/page.md +4 -0
  774. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/scripts/queue-config.knobs +1 -0
  775. package/payload/queue-kit/gate-tests/check-queue-slug-liveness.test.sh +100 -0
  776. package/payload/queue-kit/gate-tests/check-queue-wrap/bad/TASK-QUEUE.md +3 -1
  777. package/payload/queue-kit/gate-tests/check-queue-wrap/good/TASK-QUEUE.md +20 -6
  778. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/TASK-QUEUE.md +15 -8
  779. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/scripts/queue-config.knobs +5 -0
  780. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/TASK-QUEUE.md +13 -6
  781. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/scripts/queue-config.knobs +5 -0
  782. package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/TASK-QUEUE.md +28 -7
  783. package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/expect.txt +10 -2
  784. package/payload/queue-kit/gate-tests/check-tag-lead-line/good/TASK-QUEUE.md +30 -8
  785. package/payload/queue-kit/gate-tests/check-task-names/bad/TASK-QUEUE.md +18 -3
  786. package/payload/queue-kit/gate-tests/check-task-names/bad/expect.txt +9 -0
  787. package/payload/queue-kit/gate-tests/check-task-names/good/TASK-QUEUE.md +20 -6
  788. package/payload/queue-kit/gate-tests/entry-history.test.sh +197 -0
  789. package/payload/queue-kit/gate-tests/queue-counts.test.sh +77 -73
  790. package/payload/queue-kit/gate-tests/queue-edges.test.sh +168 -87
  791. package/payload/queue-kit/gate-tests/queue-index.test.sh +30 -16
  792. package/payload/queue-kit/gate-tests/roadmap.test.sh +65 -58
  793. package/payload/queue-kit/templates/TASK-QUEUE.md +36 -23
  794. package/payload/queue-kit/templates/queue-config.knobs +1 -0
  795. package/payload/site-kit/README.md +26 -45
  796. package/payload/site-kit/checks/check-docs-cname-parity.gate +1 -1
  797. package/payload/site-kit/checks/check-docs-highlight-coverage.gate +4 -0
  798. package/payload/site-kit/checks/check-docs-liquid-parse.gate +3 -0
  799. package/payload/site-kit/checks/check-docs-render-fidelity.gate +3 -0
  800. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/args +1 -1
  801. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/scripts/site-config.knobs +2 -0
  802. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/args +2 -2
  803. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/scripts/site-config.knobs +2 -0
  804. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/docs/_layouts/default.html +11 -0
  805. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/expect.txt +4 -0
  806. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/scripts/highlight-tokens.list +7 -0
  807. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/scripts/site-config.knobs +3 -0
  808. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/docs/_layouts/default.html +14 -0
  809. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/expect.txt +1 -0
  810. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/scripts/highlight-tokens.list +7 -0
  811. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/scripts/site-config.knobs +1 -0
  812. package/payload/site-kit/gate-tests/check-docs-liquid-parse/bad/docs/_layouts/default.html +4 -0
  813. package/payload/site-kit/gate-tests/check-docs-liquid-parse/bad/docs/span.md +3 -0
  814. package/payload/site-kit/gate-tests/check-docs-liquid-parse/bad/expect.txt +2 -0
  815. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/_layouts/default.html +4 -0
  816. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/front.md +7 -0
  817. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/loop.md +5 -0
  818. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/plain.html +1 -0
  819. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/raw.md +3 -0
  820. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/search.json +4 -0
  821. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/expect.txt +1 -0
  822. package/payload/site-kit/gate-tests/check-docs-liquid-parse-parser.test.sh +62 -0
  823. package/payload/site-kit/gate-tests/check-docs-render-fidelity-batch.test.sh +40 -45
  824. package/payload/site-kit/gate-tests/check-docs-render-fidelity-foreign.test.sh +7 -4
  825. package/payload/site-kit/gate-tests/check-docs-render-fidelity-span.test.sh +7 -4
  826. package/payload/site-kit/gate-tests/check-docs-render-fidelity-table.test.sh +7 -4
  827. package/payload/site-kit/templates/site-health.yml +67 -4
  828. package/profiles.list +4 -5
  829. package/lib/common/digest.sh +0 -18
  830. package/lib/common/lock.sh +0 -75
  831. package/lib/common/profile.sh +0 -91
  832. package/lib/common/recipe.sh +0 -106
  833. package/lib/diff.sh +0 -66
  834. package/lib/doctor.sh +0 -164
  835. package/lib/init.sh +0 -428
  836. package/lib/uninstall.sh +0 -214
  837. package/lib/update.sh +0 -34
  838. package/payload/canon-kit/SPEC.md +0 -2443
  839. package/payload/canon-kit/checks/check-surface-duplication.sh +0 -106
  840. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.sh +0 -6
  841. package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.sh +0 -6
  842. package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/canon-config.sh +0 -10
  843. package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/canon-config.sh +0 -10
  844. package/payload/canon-kit/gate-tests/check-measured-claim/bad/scripts/canon-config.sh +0 -6
  845. package/payload/canon-kit/gate-tests/check-measured-claim/good/scripts/canon-config.sh +0 -6
  846. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +0 -8
  847. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +0 -8
  848. package/payload/canon-kit/gate-tests/check-prose-enum/bad/scripts/canon-config.sh +0 -4
  849. package/payload/canon-kit/gate-tests/check-prose-enum/good/scripts/canon-config.sh +0 -4
  850. package/payload/canon-kit/gate-tests/check-prose-tells/bad/scripts/canon-config.sh +0 -8
  851. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/scripts/canon-config.sh +0 -5
  852. package/payload/canon-kit/gate-tests/check-spec-pointer/good/scripts/canon-config.sh +0 -5
  853. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/scripts/canon-config.sh +0 -6
  854. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/scripts/canon-config.sh +0 -6
  855. package/payload/canon-kit/lib/spec.sh +0 -560
  856. package/payload/canon-kit/smoke/install.sh +0 -58
  857. package/payload/canon-kit/smoke/violation.sh +0 -22
  858. package/payload/canon-kit/templates/canon-config.sh +0 -2
  859. package/payload/context-kit/SPEC.md +0 -1134
  860. package/payload/context-kit/bin/always-loaded.sh +0 -70
  861. package/payload/context-kit/bin/env-probe.sh +0 -142
  862. package/payload/context-kit/bin/md-index.sh +0 -80
  863. package/payload/context-kit/bin/md-section.sh +0 -63
  864. package/payload/context-kit/bin/pub-index.sh +0 -90
  865. package/payload/context-kit/bin/run-index-tests.sh +0 -91
  866. package/payload/context-kit/gate-tests/check-footprint-fresh/good/args +0 -4
  867. package/payload/context-kit/gate-tests/check-footprint-fresh/good/emit.txt +0 -12
  868. package/payload/context-kit/gate-tests/check-footprint-fresh/good/projection.txt +0 -12
  869. package/payload/context-kit/index-tests/expected/toolfloor.txt +0 -23
  870. package/payload/context-kit/index-tests/toolfloor-cases.sh +0 -49
  871. package/payload/context-kit/lib/context.sh +0 -56
  872. package/payload/context-kit/lib/pub-lang/rust.sh +0 -26
  873. package/payload/context-kit/lib/pub-lang/ts.sh +0 -32
  874. package/payload/context-kit/lib/toolfloor.sh +0 -58
  875. package/payload/context-kit/smoke/agents-md.sh +0 -139
  876. package/payload/context-kit/smoke/install.sh +0 -64
  877. package/payload/context-kit/smoke/violation.sh +0 -21
  878. package/payload/context-kit/templates/context-config.sh +0 -2
  879. package/payload/delegation-kit/SPEC.md +0 -2078
  880. package/payload/delegation-kit/bin/run-budget-guard-tests.sh +0 -88
  881. package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +0 -97
  882. package/payload/delegation-kit/bin/run-trend-tests.sh +0 -63
  883. package/payload/delegation-kit/bin/run-usage-tests.sh +0 -226
  884. package/payload/delegation-kit/bin/usage-trend.sh +0 -120
  885. package/payload/delegation-kit/bin/usage-verdict.sh +0 -144
  886. package/payload/delegation-kit/bin/wait-probe.sh +0 -184
  887. package/payload/delegation-kit/gate-tests/subagent-stop-liveness.test.sh +0 -99
  888. package/payload/delegation-kit/lib/delegation.sh +0 -84
  889. package/payload/delegation-kit/smoke/install.sh +0 -83
  890. package/payload/delegation-kit/smoke/violation.sh +0 -16
  891. package/payload/delegation-kit/templates/agent-budget-guard.sh +0 -18
  892. package/payload/delegation-kit/templates/agent-dispatch-guard.sh +0 -61
  893. package/payload/delegation-kit/templates/delegation-config.sh +0 -6
  894. package/payload/delegation-kit/templates/statusline-usage.sh +0 -101
  895. package/payload/delegation-kit/templates/subagent-stop-liveness.sh +0 -56
  896. package/payload/delegation-kit/templates/usage-poller.sh +0 -67
  897. package/payload/delegation-kit/usage-tests/budget-guard-cases.tsv +0 -20
  898. package/payload/doctrine-kit/SPEC.md +0 -385
  899. package/payload/doctrine-kit/bin/install-doctrine.sh +0 -194
  900. package/payload/doctrine-kit/bin/stage-rules.sh +0 -51
  901. package/payload/doctrine-kit/lib/doctrine.sh +0 -29
  902. package/payload/doctrine-kit/smoke/install.sh +0 -203
  903. package/payload/doctrine-kit/smoke/violation.sh +0 -13
  904. package/payload/drift-kit/SPEC.md +0 -1187
  905. package/payload/drift-kit/bin/drift-report.sh +0 -155
  906. package/payload/drift-kit/bin/kfric.sh +0 -61
  907. package/payload/drift-kit/bin/overhead-meter.sh +0 -106
  908. package/payload/drift-kit/bin/stage-economics.sh +0 -465
  909. package/payload/drift-kit/kpis/kpi-always-loaded.sh +0 -39
  910. package/payload/drift-kit/kpis/kpi-amendment-age.sh +0 -33
  911. package/payload/drift-kit/kpis/kpi-deferred-age.sh +0 -46
  912. package/payload/drift-kit/kpis/kpi-gate-backlog.sh +0 -52
  913. package/payload/drift-kit/kpis/kpi-gate-runtime.sh +0 -31
  914. package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +0 -42
  915. package/payload/drift-kit/kpis/kpi-knowledge-friction.sh +0 -21
  916. package/payload/drift-kit/kpis/kpi-overhead.sh +0 -44
  917. package/payload/drift-kit/kpis/kpi-price-table-age.sh +0 -68
  918. package/payload/drift-kit/kpis/kpi-prompt-friction.sh +0 -38
  919. package/payload/drift-kit/kpis/kpi-queue-net-delta.sh +0 -74
  920. package/payload/drift-kit/kpis/kpi-settings-local.sh +0 -21
  921. package/payload/drift-kit/kpis/kpi-task-split.sh +0 -43
  922. package/payload/drift-kit/lib/drift.sh +0 -43
  923. package/payload/drift-kit/smoke/install.sh +0 -537
  924. package/payload/drift-kit/smoke/overhead-fixture.jsonl +0 -4
  925. package/payload/drift-kit/templates/drift-config.sh +0 -2
  926. package/payload/evidence-kit/SPEC.md +0 -740
  927. package/payload/evidence-kit/bin/diff-baseline.sh +0 -34
  928. package/payload/evidence-kit/bin/run-validate.sh +0 -124
  929. package/payload/evidence-kit/checks/check-producer-liveness.sh +0 -75
  930. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +0 -7
  931. package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +0 -7
  932. package/payload/evidence-kit/lib/evidence.sh +0 -193
  933. package/payload/evidence-kit/smoke/install.sh +0 -59
  934. package/payload/evidence-kit/smoke/violation.sh +0 -8
  935. package/payload/evidence-kit/templates/evidence-config.sh +0 -2
  936. package/payload/gate-sdk/SPEC.md +0 -10872
  937. package/payload/gate-sdk/bin/gen-pre-commit.sh +0 -297
  938. package/payload/gate-sdk/bin/install-hooks.sh +0 -60
  939. package/payload/gate-sdk/bin/port-blockers.sh +0 -473
  940. package/payload/gate-sdk/bin/run-consumer-smoke.sh +0 -239
  941. package/payload/gate-sdk/bin/run-gate-tests.sh +0 -179
  942. package/payload/gate-sdk/bin/upgrade-smoke.sh +0 -236
  943. package/payload/gate-sdk/checks/check-action-run-shell.sh +0 -223
  944. package/payload/gate-sdk/checks/check-crate-arms.sh +0 -62
  945. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +0 -450
  946. package/payload/gate-sdk/checks/check-install-disposition.sh +0 -93
  947. package/payload/gate-sdk/checks/check-shellcheck.sh +0 -57
  948. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/scripts/gate-sdk-config.sh +0 -2
  949. package/payload/gate-sdk/gate-tests/check-crate-arms/good/scripts/gate-sdk-config.sh +0 -2
  950. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/args +0 -4
  951. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/emit.txt +0 -14
  952. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/projection.txt +0 -14
  953. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +0 -2
  954. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +0 -2
  955. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +0 -6
  956. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +0 -3
  957. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +0 -6
  958. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +0 -3
  959. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/installer/lib/common/recipe.sh +0 -9
  960. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-beta.gate +0 -3
  961. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-gamma.sh +0 -6
  962. package/payload/gate-sdk/gate-tests/check-install-disposition/good/installer/lib/common/recipe.sh +0 -10
  963. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.sh +0 -5
  964. package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.sh +0 -5
  965. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/scripts/gate-sdk-config.sh +0 -5
  966. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +0 -5
  967. package/payload/gate-sdk/gate-tests/declaration-lib-parity.test.sh +0 -211
  968. package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +0 -112
  969. package/payload/gate-sdk/lib/consumer-smoke.sh +0 -69
  970. package/payload/gate-sdk/lib/declaration.sh +0 -59
  971. package/payload/gate-sdk/lib/inject.sh +0 -80
  972. package/payload/gate-sdk/smoke/install.sh +0 -171
  973. package/payload/gate-sdk/smoke/violation.sh +0 -13
  974. package/payload/guard-kit/SPEC.md +0 -1415
  975. package/payload/guard-kit/bin/compare-settings-allow.sh +0 -115
  976. package/payload/guard-kit/bin/run-guard-tests.sh +0 -110
  977. package/payload/guard-kit/bin/scan-prompts.sh +0 -166
  978. package/payload/guard-kit/bin/scratch-run.sh +0 -34
  979. package/payload/guard-kit/gate-tests/guard-read-path.test.sh +0 -52
  980. package/payload/guard-kit/lib/guard.sh +0 -1014
  981. package/payload/guard-kit/smoke/install.sh +0 -26
  982. package/payload/guard-kit/templates/bash-guard.sh +0 -20
  983. package/payload/guard-kit/templates/escalation-guard.sh +0 -27
  984. package/payload/guard-kit/templates/guard-config.sh +0 -8
  985. package/payload/guard-kit/templates/wakeup-guard.sh +0 -20
  986. package/payload/lifecycle-kit/SPEC.md +0 -2884
  987. package/payload/lifecycle-kit/bin/cite-survey.sh +0 -81
  988. package/payload/lifecycle-kit/bin/enter-stage.sh +0 -380
  989. package/payload/lifecycle-kit/bin/file-gap.sh +0 -101
  990. package/payload/lifecycle-kit/bin/file-survey.sh +0 -69
  991. package/payload/lifecycle-kit/bin/install-lifecycle.sh +0 -36
  992. package/payload/lifecycle-kit/bin/session-id.sh +0 -75
  993. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/scripts/lifecycle-config.sh +0 -4
  994. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/scripts/lifecycle-config.sh +0 -4
  995. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/scripts/lifecycle-config.sh +0 -4
  996. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/scripts/lifecycle-config.sh +0 -4
  997. package/payload/lifecycle-kit/gate-tests/workflow-state-guard.test.sh +0 -100
  998. package/payload/lifecycle-kit/lib/stages.sh +0 -194
  999. package/payload/lifecycle-kit/smoke/install.sh +0 -434
  1000. package/payload/lifecycle-kit/smoke/violation.sh +0 -8
  1001. package/payload/lifecycle-kit/templates/lifecycle-config.sh +0 -2
  1002. package/payload/lifecycle-kit/templates/workflow-state-guard.sh +0 -29
  1003. package/payload/queue-kit/SPEC.md +0 -1436
  1004. package/payload/queue-kit/bin/lesson-sink.sh +0 -28
  1005. package/payload/queue-kit/bin/queue-counts.sh +0 -35
  1006. package/payload/queue-kit/bin/queue-edges.sh +0 -78
  1007. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/scripts/queue-config.sh +0 -6
  1008. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/scripts/queue-config.sh +0 -6
  1009. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/scripts/queue-config.sh +0 -3
  1010. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/scripts/queue-config.sh +0 -3
  1011. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/scripts/queue-config.sh +0 -6
  1012. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/scripts/queue-config.sh +0 -6
  1013. package/payload/queue-kit/gate-tests/queue-lib-parity.test.sh +0 -215
  1014. package/payload/queue-kit/lib/queue.sh +0 -129
  1015. package/payload/queue-kit/smoke/install.sh +0 -25
  1016. package/payload/queue-kit/smoke/violation.sh +0 -8
  1017. package/payload/queue-kit/templates/queue-config.sh +0 -2
  1018. package/payload/site-kit/SPEC.md +0 -601
  1019. package/payload/site-kit/checks/check-docs-render-fidelity.sh +0 -242
  1020. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/scripts/site-config.sh +0 -7
  1021. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/scripts/site-config.sh +0 -7
  1022. package/payload/site-kit/lib/site.sh +0 -43
  1023. package/payload/site-kit/smoke/install.sh +0 -34
  1024. package/payload/site-kit/smoke/violation.sh +0 -20
  1025. /package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/{check-ported.gate → check-stage-entry.gate} +0 -0
@@ -1,1415 +0,0 @@
1
- # guard-kit — permission-friction reduction for agent sessions
2
-
3
- A command no allowlist entry matches is not refused — it is decided **out of
4
- band**, by whatever a harness does when nothing matches: interrupt a human, or
5
- run a model to judge the call. Either way that decision is invisible to the
6
- agent — nothing about it lands in the transcript, so the agent cannot notice,
7
- count, or fix the friction it causes — and either way it is paid per call, out
8
- of the operator's attention or out of latency and tokens, compounding as the
9
- command surface grows. The kit closes the
10
- loop: a `PreToolUse` guard decides at call time (block with a corrective
11
- message, steer to a better form, auto-allow the provably safe, log every
12
- fall-through), a scanner ranks the logged prompt sources, a curation pass
13
- keeps the committed allowlist durable and the per-user overlay small, and a
14
- recurring close-stage triage step makes the whole loop a habit instead of a
15
- one-off cleanup.
16
-
17
- The kit carries the guard framework, the harness-generic ruleset, and the
18
- triage tooling; every project-specific guard rule (build-tool hygiene,
19
- container concurrency, test-suite serialization) is consumer rule content
20
- and never ships. guard-kit registers **no
21
- gates**: its runtime surfaces are hooks and advisory `bin/` tools, so
22
- nothing joins `gates.list`; it follows gate-sdk's layout and smoke
23
- conventions without depending on its registry.
24
-
25
- ## The friction loop
26
-
27
- 1. **Call time** — the consumer's `bash-guard.sh` (copied from
28
- `templates/`, wired as the `PreToolUse(Bash)` hook) inspects each
29
- command: block, steer, rewrite, auto-allow, or fall through. Every
30
- fall-through — exactly the set of commands whose decision was made out of
31
- band — is appended to the friction log. That decision is invisible to the
32
- agent whichever way it went, so this log is the only record.
33
- 2. **Close time** — `bin/scan-prompts.sh` filters the log against the
34
- committed allowlist and ranks what survives (§scan-prompts states the
35
- local-overlay upper bound), grouped by command
36
- pattern. Each recurring pattern is resolved by the **triage criterion**
37
- (below); `bin/compare-settings-allow.sh` lists the local-overlay entries
38
- a committed glob already grants (the prune set) and those a declared probe
39
- proves too broad (the narrowing set). Then the
40
- log is cleared — its named reclaim path.
41
- 3. **Steady state** — friction low and justified: the committed
42
- `settings.json` carries every durable pattern (reviewable, shared), the
43
- local `settings.local.json` stays near-empty, and the guard encodes the
44
- steering rules no static glob can express.
45
-
46
- ### What the steering is buying
47
-
48
- The guard's blocks **serialize**: a compound the agent wanted as one call becomes
49
- several, and a convenient spelling becomes a written-out one. That cost is real
50
- and paid every session, so the rationale is stated here rather than assumed — and
51
- it is not "the agent would otherwise be interrupted". Steering does not stop a
52
- decision from being *made*; it moves the call onto the path where the decision is
53
- already made, the static match, and off the path where something else must decide.
54
- Three things pay for the serialization, and none of them turns on *which* thing
55
- decides:
56
-
57
- - **The match short-circuits everything downstream.** An allow/ask/deny match
58
- resolves the call there. Whatever a harness does with an unmatched command, the
59
- matched form skips it — so the bare spelling is the cheaper one on every axis a
60
- harness charges, without knowing which axis that is.
61
- - **The match verdict is deterministic; the out-of-band one is not.** A steered
62
- command's outcome is a property of a reviewed settings file, stable across
63
- sessions and auditable without running anything. An unmatched command's outcome
64
- is a judgment made per call. This is the half of the win that survives a harness
65
- getting cheap at deciding.
66
- - **The tool-hygiene rules are untouched by any of it.** Read over `cat`, Glob
67
- over `find`, Grep over a working-tree `git grep`, `git rm` over `rm`, a scratch
68
- dir over the repo root — each steers to a better tool or a safer form, and would
69
- earn the guard's keep with no permission mechanism in the picture at all.
70
-
71
- **The honest limit.** None of this is measured. Whether N matched calls beat one
72
- unmatched call in wall-clock is an empirical question the kit does not answer, and
73
- a harness whose unmatched path is cheap narrows the first bullet toward nothing.
74
- The ruling therefore rests on the second and third, which do not turn on cost: the
75
- guard is worth its serialization because it makes the outcome deterministic and
76
- the tool choice better — not because it dodges an interrupt. A message that names
77
- one harness's consequence is wrong in the same way whichever consequence it names,
78
- which is why none of them do.
79
-
80
- ### The triage criterion
81
-
82
- Allowlist and guard are two tools with distinct jobs — resolve each
83
- recurring pattern by the criterion, never by defaulting to the allowlist:
84
-
85
- - **Allowlist** (`Bash(...)` in the committed settings) when the command is
86
- safe *and already in the form to reinforce* — static, glob-matched,
87
- declarative.
88
- - **Guard rule** when a *better form exists* and the agent should be steered
89
- to it, or when the allow/deny needs logic a static glob cannot express.
90
- - **Habit change** (a noted convention) for true one-offs.
91
-
92
- Caution: an allowlist entry can *mask* a steering opportunity — before
93
- blessing a form, confirm it is the one to reinforce; if a better form
94
- exists, steer to it in the guard rather than permitting the worse one.
95
-
96
- Note: the harness matches the allowlist **per segment** of a compound
97
- command, so a glob on the core command does not cover the `echo` banners,
98
- `wc`, redirects, or `;`-chained diagnostics wrapped around it — one
99
- unmatched segment takes the whole line off the match path. The read-only banner/diagnostic
100
- tools an agent habitually chains (`echo`, `wc`, `grep`, `ls`, `command -v`)
101
- are therefore themselves legitimate allowlist entries; allowlist them, or
102
- run the core command bare.
103
-
104
- ## The guard framework (`lib/guard.sh`)
105
-
106
- Primitives a consumer guard composes; each emits the harness's
107
- `PreToolUse` hook protocol:
108
-
109
- - `guard_read_input` — read stdin **once** into the global `GUARD_INPUT`,
110
- returning non-zero when stdin yielded nothing. Called **directly**, never in a
111
- command substitution, and before the first field accessor. It exists because
112
- the payload was otherwise unreadable past its first field: `guard_read_command`
113
- is invoked as `cmd="$(guard_read_command)"`, so any cache it set died with the
114
- substitution's subshell and stdin was already consumed — a rule needing a
115
- second field could not get one.
116
- - `guard_input_field <jq-path>` — the value at `<jq-path>` in `GUARD_INPUT`, or
117
- nothing when `GUARD_INPUT` is unset or empty or the path is absent. The
118
- accessor a rule reaching past the headline fields uses.
119
- - `guard_read_command` — parse the hook JSON, emit the command;
120
- **fail-open** on any parse problem (exit 0) so a guard can never wedge
121
- the agent.
122
- - `guard_read_path` — the same accessor for `.tool_input.file_path`, the field a
123
- path-bearing tool call carries where a Bash call carries a command. It returns
124
- **non-zero, emitting nothing**, when the field is absent, empty, or the payload
125
- will not parse — so a matcher covering a call without one falls through instead
126
- of blocking. That return contract is the whole design: an accessor returning
127
- success on a missing field passes every happy path and wedges every other call
128
- its matcher covers. Generic over any path-bearing tool; it names no path and no
129
- rule, which is what keeps the rule in the kit that owns the file.
130
- - `guard_block <msg>` — exit 2 with the message on stderr. Every block
131
- message is self-describing: it names the offending pattern *and* the
132
- corrective form, so the why of a rule rides to the agent in the rejection
133
- itself, not in a code comment.
134
- - `guard_advise <msg>` — allow, but feed the message back as
135
- `additionalContext` (steering without blocking).
136
- - `guard_allow <reason>` — silent grant via `permissionDecision: allow`.
137
- - `guard_rewrite <cmd> <reason>` — behavior-preserving rewrite via
138
- `updatedInput` (grant the better spelling of the same command).
139
- - `guard_log_fallthrough` — append the (truncated, newline-flattened)
140
- command to the friction log; best-effort, never affects the decision.
141
- - `guard_allow_match <string> <pattern>` — the shell-glob match core: true when
142
- the string matches a committed allow pattern, with the harness `:*` prefix
143
- idiom (`Bash(printf:*)` ≡ any `printf …`) normalized to a trailing `*`. Not a
144
- hook primitive — a shared helper, one implementation behind
145
- compare-settings-allow's redundancy detection and rule 19's silent-grant
146
- guard so the two never drift.
147
- - `guard_skeleton <cmd> <inert-class>…` — the context-aware normalizer, and the
148
- only place a rule learns what part of a command is live. It returns the command
149
- with every region of the named inert classes replaced by a placeholder token,
150
- leaving everything else byte-identical. Four classes: **`sq`** (single-quoted
151
- spans), **`dq`** (double-quoted spans), **`hd`** (heredoc bodies, from the line
152
- after an opener to its terminator line), and **`hdq`** — the subset of `hd`
153
- whose **delimiter is quoted** (`<<'EOF'`), where the shell itself guarantees
154
- the body does not expand. `hdq` exists because that guarantee is what lets the
155
- one rule that must keep heredoc bodies live keep only the bodies that can
156
- actually expand. Each rule names the classes inert **for it**, in one argument, at one
157
- call site — the classes were never the disagreement, since every rule agrees
158
- that *some* regions are inert; the disagreement was that each decided privately
159
- and none recorded why. Not a hook primitive, and a pure function of its
160
- arguments: no config read, no subprocess, no global.
161
- - `guard_split_compound <skeleton>` — the compound splitter: emits one segment
162
- per line, splitting on the harness's statement separators (`;`, `&&`, `||`,
163
- `|`). Also not a hook primitive — the single implementation every consumer
164
- that reasons *per segment* shares (rules 8/12/14/15/17/18/19/21, the read-compound
165
- carve-out of rules 9/10, and scan-prompts' `allowed()`), so the harness's
166
- per-segment matching surface is modelled in exactly one place and cannot drift
167
- between them. Fed a `guard_skeleton` view, so a separator inside a quoted
168
- argument is never mistaken for a statement break. Its separator class carries
169
- **no newline**, and it does not need one: it *emits* segments as lines and
170
- every consumer reads lines, so a newline already present in the input is
171
- already a boundary before the substitution runs.
172
-
173
- **Placeholder, never deletion, and this is a correctness point rather than
174
- taste.** Deleting an inert span **fuses adjacent tokens**: a pattern glued to its
175
- flag loses the boundary between them and the residue reads as one word that was
176
- never in the command. The normalizer substitutes, so the skeleton has the same
177
- token count and the same statement structure as the command it models.
178
-
179
- **The heredoc class marks the body extent only.** The opener line and everything
180
- after the terminator stay fully live, so a heredoc-bearing call is still matched
181
- on its executable text — neither blanking everything after a `<<` (which blinds
182
- the guard to real commands in the same call) nor stripping quotes alone (which
183
- still refuses a double-quoted mention). The extent is decidable without a shell
184
- parser because the terminator is a literal token alone on its line, which is the
185
- property the class rests on.
186
-
187
- **Two bounds, stated rather than discovered later.** A heredoc with an
188
- **unquoted** delimiter does expand, so `hd` is not inert for the expansion rule
189
- even though it is inert for every glyph rule — which is why classes are declared
190
- per rule and not fixed per region, and why the rule that cannot take `hd` takes
191
- `hdq` instead rather than going without. Only the delimiter's quoting decides
192
- this, never the body's content, so the test is decidable at the opener; a
193
- delimiter escaped rather than quoted (`<<\EOF`) is not recognized and its body
194
- stays live, which is the conservative direction. And the normalizer models **quoting, not
195
- shell semantics**: a construct that survives its scan and is not one of the three
196
- classes is treated as live, the fail-toward-matching direction and the one a
197
- guard should err in. That bound is why the command/process-substitution and
198
- backtick tests in rules 9, 10, 11, 12, 13, 14, 15, 17, 18 and 21 read the **raw**
199
- command rather than
200
- a skeleton and must keep doing so — a `"$(…)"` inside double quotes still
201
- executes, so a rule that declared `dq` inert for *that* test would hand an
202
- auto-allow to a command substitution it could not see. Those tests are
203
- conservative declines, not verdict matching. **That roster is derived from the
204
- rule bodies, not from memory**: it named rules that carry no raw test and
205
- omitted rules that do until it was re-read against them, which is the same
206
- drift the number-bearing cross-references below take and the reason each is
207
- re-derived rather than carried.
208
-
209
- **Rule 12 is the one rule that reaches its verdict off the raw command, and the
210
- exception is forced rather than chosen.** Its predicate is *the pattern literal
211
- `-f` will scan argv for*, and a skeleton replaces exactly that literal with a
212
- placeholder — the quoted operand is the normal spelling — so a skeleton view
213
- would blind the rule to the only thing it tests. It pays for the exception in the
214
- same conservative direction every other clause takes: it declines outright on any
215
- expansion, substitution or backtick (rule 6 blocks the expansion and substitution
216
- shapes; the backtick decline is this rule's own arm, per the raw-command reading
217
- above), and a
218
- pattern operand carrying a stray quote — the evidence that the compound split
219
- landed *inside* a quoted span — declines rather than guesses at the operand.
220
-
221
- **`GUARD_INPUT` first, stdin otherwise, and the fallback is the whole point of
222
- the shape.** `guard_read_command` and `guard_read_path` parse `GUARD_INPUT` when
223
- it is set and non-empty and read stdin exactly as they always did otherwise, so
224
- every consumer copy that never opted in keeps working byte-identically without an
225
- edit — it never sets `GUARD_INPUT`, so both readers take the stdin path. A guard
226
- that wants a second field opts in by adding one line, `guard_read_input || exit 0`
227
- ahead of the first accessor, which is what the shipped template carries. Making
228
- `guard_read_input` mandatory was refused: it would break every consumer copy on
229
- upgrade for a field only one rule needs.
230
-
231
- **What a `PreToolUse` payload actually carries, recorded so no session re-buys
232
- the probe.** Top-level keys: `agent_id`, `agent_type`, `cwd`, `effort`,
233
- `hook_event_name`, `permission_mode`, `prompt_id`, `session_id`, `tool_input`,
234
- `tool_name`, `tool_use_id`, `transcript_path`. On a Bash call `tool_input` carries
235
- `command`, `description`, and `run_in_background` — a JSON boolean `true` on a
236
- backgrounded call, and **absent** on a foreground one. It is a fact about this
237
- framework's own inputs, so without it each session re-establishes it from the
238
- vendor hook reference.
239
-
240
- **The live permission mode is in that payload and no rule reads it.**
241
- `permission_mode` sits alongside the fields the accessors pick off, so a rule
242
- whose rationale is mode-*conditional* — "no allowlist entry can suppress this
243
- prompt" is false under an auto-approving mode and true under the others —
244
- asserts a mode rather than reading one. Whether a guard *should* read the mode is
245
- a consumer decision and is not settled here; the same holds for `agent_id`,
246
- `agent_type` and `effort`, each of which belongs to a question of its own.
247
-
248
- Fail-open is the default posture. The one sanctioned fail-closed shape is a
249
- deny-guard whose hook *matcher* already proves the tool identity (see
250
- wakeup-guard): there, a logging or parse failure still denies.
251
-
252
- **A third posture, fail-open-but-loud**, covers a deny-guard whose matcher
253
- proves the tool but whose rule turns on a **payload field**. The gap is real
254
- rather than a technicality: wakeup-guard's rule *is* the tool, so a parse
255
- failure that denies costs nothing, while a rule needing a field cannot say
256
- that — denying on a parse failure would wedge every call its matcher covers.
257
- Passing silently is the opposite failure and the worse one, since it ships an
258
- unenforceable claim that reports success. So the guard **allows the call and
259
- emits an advisory naming the rule it could not enforce**: a degraded
260
- enforcement is visible, never silently folded. One delivery constraint comes
261
- with the posture and is easy to miss — `guard_advise` is itself jq-backed, so a
262
- guard degrading *because* `jq` is absent cannot reach for it and must emit the
263
- advisory envelope directly, or the loud half is lost in exactly the case it was
264
- written for.
265
-
266
- delegation-kit is this framework's second and third consumer, and they do not
267
- cost the kit alike. `agent-budget-guard.sh` composes these primitives into a
268
- `PreToolUse(Agent)` hook that blocks on a PAUSE budget verdict and advises
269
- otherwise — cite-only; no guard-kit mechanism moves for it.
270
- `agent-dispatch-guard.sh` shares that matcher and enforces delegation-kit's
271
- dispatch-shape rules; guard-kit mechanism **does** move for that one, by
272
- exactly one clause — the fail-open-but-loud posture above, which it is the
273
- shipped instance of (delegation-kit/SPEC.md §The delegation model).
274
-
275
- lifecycle-kit is the fourth consumer, on the same axis: its
276
- `templates/workflow-state-guard.sh` is a `PreToolUse(Write|Edit)` hook refusing a
277
- direct write to the lifecycle state file, and guard-kit mechanism **does** move
278
- for it, again by exactly one clause — `guard_read_path` above. Nothing else was
279
- missing: `guard_block` and `guard_advise` never read a command, so they were
280
- already tool-agnostic. This is the rule the three consumers now make explicit —
281
- **the kit owning the rule ships the guard**, riding `lib/guard.sh` through the
282
- `GUARD_KIT_LIB` indirection, and guard-kit moves only where the lib lacks a
283
- primitive. The state file's path lives with lifecycle-kit, never here, so
284
- guard-kit gains no dependency on a kit it does not otherwise know about
285
- (lifecycle-kit/SPEC.md §check-stage-evidence).
286
-
287
- ## Consumer rules
288
-
289
- A consumer's project-specific block/steer/allow rules live in its copy of
290
- `templates/bash-guard.sh`, composed from the `lib/guard.sh` primitives above and
291
- placed **before** the generic ruleset — the template marks the position. The
292
- template's head reads the payload once (`guard_read_input || exit 0`) before the
293
- first field accessor, which is what makes a rule reading a tool-input field
294
- beyond the command reachable in a shipped guard rather than only in the tests; a
295
- copy without that line still runs every rule, on the fallback above. Order
296
- is the whole reason the seam sits here: a project rule that fires must fire
297
- ahead of the generic rule it refines, or the generic verdict wins and the
298
- project rule is dead code.
299
-
300
- This is a placement contract, not a mechanism: guard-kit ships no consumer rule
301
- and names none. What a project blocks or steers is its own toolchain knowledge
302
- and stays in its copy, which is why the copy legitimately diverges from the
303
- template here and why no rule content crosses into the kit.
304
-
305
- **Placement is a verification decision before it is a seam one, and this is the
306
- sentence that makes the contract usable.** The generic lane carries §Testing's
307
- decision-table obligation — every rule there owes a firing and a non-firing case,
308
- and the table is the only instrument that reads a *block* at all. The consumer
309
- lane carries none: a rule in a consumer's copy is reachable by no table in this
310
- kit, so it ships hand-verified and its narrowing cannot be measured. A rule that
311
- qualifies for either lane therefore belongs in the generic one. That a consumer's
312
- own rules have no verification lane at all is a real gap and a separate one; it
313
- is named here rather than solved, since solving it designs a testing lane for
314
- consumer copies.
315
-
316
- ## The generic ruleset
317
-
318
- Rules that encode **harness behavior, shell-substrate behavior, or behavior over
319
- an artifact whose grammar a kit owns**, never any project's toolchain — shipped
320
- as `lib/guard.sh` functions the template guard invokes. Order is load-bearing
321
- where noted.
322
-
323
- **The clause has taken two widenings, and each is recorded with the rule that
324
- forced it, because a rule slipped in unremarked is what would rot it.**
325
-
326
- - **The shell-substrate half was added for rule 12, and it admits nothing a
327
- project owns.** A `-f` pattern match seeing the matcher's own argv is a
328
- property of the shell substrate every consumer of this kit runs on — neither
329
- harness behavior nor any project's toolchain — so the narrower sentence left
330
- it in a gap it had no reason to leave.
331
- - **The kit-artifact half was added for rule 14, and it takes the same form and
332
- passes the same test.** Rule 14 is neither of the two earlier classes as they
333
- were written: what it reads is evidence-kit's `pid=<n> run=<key>` record and
334
- the OS's process table. It interprets **no project vocabulary at all** — it
335
- reads a PID and asks whether it is alive — so the test rule 12's widening had
336
- to pass is the test this one passes: **it admits nothing a project owns**. A
337
- kit's own artifact grammar is shipped mechanism, which is exactly what
338
- CLAUDE.md §The provenance seam distinguishes from private rule content.
339
-
340
- A project's toolchain stays out on the same words as before, under both.
341
-
342
- **Naming one harness's forms in a corrective costs portability, not privacy, and
343
- the cost is recorded rather than pre-paid.** Rule 13's block message names a
344
- backgrounded condition wait and the harness's event-stream form, because a
345
- corrective that named neither would be unfollowable. A harness tool name is
346
- public, documented, and shared by every consumer of that harness, so it is not
347
- private rule content and the provenance seam — a privacy boundary over private
348
- vocabularies (CLAUDE.md §The provenance seam) — does not reach it. What such a
349
- literal does cost is portability: a second harness with different form names is
350
- what would force these into a configurable slot, and building that slot before
351
- that harness exists would be designing against no case.
352
-
353
- 1. **`cd` in a compound command** — blocked: cwd drift, plus a compound the
354
- allowlist cannot match, so the call is decided out of band. Corrective form:
355
- absolute paths, or `git -C <dir>` for git.
356
- 2. **`git -C <repo-root>` when cwd is the root** — blocked: the absolute
357
- `-C` target matches no allowlist entry and falls off the match path, while
358
- the bare `git` form is allowlisted and resolves on it. Pinned with a trailing space to the exact
359
- root, so `git -C <root>/subdir` and a foreign-repo `-C` are untouched.
360
- 3. **Bare-name scratch redirect** — a `>`/`>>` to a slash-free
361
- `*.err`/`*.out`/`*.log` target is blocked (it lands in the tracked tree
362
- and risks a `git add -A`); the no-slash class lets path-bearing targets,
363
- `/dev/null`, and fd-dups through. The corrective message points at the
364
- consumer's gitignored scratch dirs (`GUARD_KIT_SCRATCH_DIRS`).
365
- 4. **Absolute-path execution of a known read-only repo script** — silently
366
- rewritten to the repo-relative form via `guard_rewrite` (the relative
367
- spelling is what allowlist globs match). The roster is the
368
- `GUARD_KIT_RO_SCRIPTS` globs (default `check-*.sh`). Any other
369
- absolute repo-script spelling gets a corrective block. **Placed before**
370
- rule 5, which would otherwise steer the same command less precisely.
371
- 5. **Repo-root absolute prefix (non-script)** — any other command carrying
372
- the literal repo-root prefix is steered to the repo-relative spelling.
373
- `git` is excluded — rule 2 already owns its `-C` handling.
374
- 6. **Shell expansion / assignment** — a residual `${…}`/`$(…)`/`<(…)`/
375
- `$NAME` in the skeleton is blocked (the harness's matcher refuses every
376
- expansion before allowlist matching). **Declares `sq hdq`** for the expansion
377
- check and **`sq dq hdq`** for the assignment check, and every part of that is
378
- deliberate rather than inherited. `dq` stays live for the expansion check:
379
- inside single quotes `$` is literal (`awk '$1'`), but a double-quoted `"$x"`
380
- still expands and must stay visible. `hd` is **not** declared, since an
381
- unquoted-delimiter heredoc body expands too — but `hdq` is, because a
382
- **quoted** delimiter makes the shell itself the guarantee that the body
383
- cannot expand. That is what stops the rule refusing prose that merely
384
- *names* a substitution: a journal entry, a queue entry being appended, or a
385
- commit message written through `git commit -F - <<'MSG'`. The assignment
386
- check adds `dq` because a `NAME="value"` assigns whatever the quotes hold. A
387
- standalone `NAME=value` assignment is
388
- caught separately, since the expansion check only sees a *used* `$VAR`.
389
- 7. **Unquoted brace glyph** — the harness's matcher refuses the bare `{` glyph
390
- before allowlist matching, the same behavior class rule 6 pre-empts for
391
- `$`-expansions, so a `{` surviving in the skeleton is handled by shape.
392
- **Declares `sq dq hd`, and the difference from rule 6 is the point rather
393
- than an accident of two adjacent lines.** Rule 6's reason to keep
394
- double-quoted spans live does not carry here: `{` is a **matcher glyph, not a
395
- shell expansion**, so a double-quoted brace is exactly as inert as a
396
- single-quoted one, and a heredoc-body brace is inert whatever the delimiter.
397
- This is what stops a working POSIX quantifier (`grep -rnE "^[a-z]{2,}"`)
398
- being refused, and it is equally what stops the **wrong corrective**: a block
399
- message owes the offending pattern *and* the corrective form, and *write out
400
- the brace expansion, spell the members* is inapplicable to a quantifier that
401
- has no members and to a heredoc body that has nothing to respell. A block
402
- whose corrective cannot be followed fails that contract however right its
403
- verdict. A **bare `{}` placeholder** (`find … -exec cmd {} +`,
404
- `xargs -I{}`), when every residual brace is exactly `{}`, is rewritten
405
- via `guard_rewrite` — each `{}` single-quoted to `'{}'`,
406
- behavior-preserving (the shell passes a literal `{}` either way) and
407
- invisible to the matcher on the same premise as rule 6's strip. Every
408
- expanding form is **blocked** with the written-out corrective:
409
- git-ref shorthand (`@{u}`, `@{-n}`, `<ref>@{n}`) names the explicit
410
- spelling (`origin/<branch>..HEAD`, or the resolved ref/hash);
411
- list/range (`{a,b}`, `{a..b}`) names the spelled-out members or a loop;
412
- any other residual `{` gets the generic corrective (quote it if literal —
413
- an unquoted awk/sed program — write it out if it expands). There is no
414
- legitimate brace-glob convenience to preserve:
415
- since every bare `{` already costs an out-of-band decision no allowlist entry
416
- can suppress, block-and-steer strictly dominates; a brace in any inert region
417
- passes untouched. **Placed before both auto-allow rules**
418
- so their literal-target premise holds for braces as well.
419
- 8. **`sed` reading or rewriting a file** — blocked with the steer to the
420
- harness's file tools: `sed -i` (or any short bundle carrying `i`) to the
421
- Edit tool, a **file operand** to the Read tool's offset/limit. A `sed` fed
422
- by a pipe is a text filter with no tool equivalent and is untouched, so the
423
- discriminator is the operand, not the binary — logic no allowlist glob can
424
- express, which is why this is a rule and not a deny entry. Segments are
425
- analyzed only when they *lead* with `sed`, so a `-i` flag on any other
426
- command (`grep -i`) is invisible to it; within a segment, options are walked
427
- so `-e`/`-f` consume their argument and the first bare operand is the script
428
- — a *second* bare operand is the file that fires the rule. **Placed before
429
- both auto-allow rules:** a consumer that widens `GUARD_KIT_RO_BINS` with
430
- `sed` would otherwise have rule 18 silently grant an in-place rewrite.
431
- 9. **Listing-only `find`** — a bare `find` that only lists is blocked with
432
- the steer to the harness's Glob tool (the same shape as rule 8's `sed`
433
- read-steer: a better tool exists, and Glob returns paths registered for a
434
- later Read). Fires on the conjunction no allowlist glob can express: every
435
- segment leads with `find` and carries **no action predicate**
436
- (`-exec`/`-execdir`/`-ok`/`-okdir`/`-delete`/`-fls`/`-fprint`/`-fprint0`/
437
- `-fprintf` — find(1) mechanism, a lib literal), with **no composition** — no
438
- pipe, `&&`/`||` chain, background, or redirect. A lone listing fires, and so
439
- does a **`;`-sequence of listings**: a `;`-compound is not composition but a
440
- batch of independent listings, exactly what the Glob steer collapses into one
441
- call. A literal `echo`/`printf` banner segment between them is the natural
442
- separator of such a batch and is tolerated; at least one segment must be a
443
- listing. A piped `find` is a legitimate producer (rule 18 may still
444
- auto-allow it), an action-predicate `find` is an executor, a redirected
445
- `find` has a downstream reader, and a **mixed** compound (a segment that is
446
- neither a listing nor a banner) all pass untouched. **Placed before both
447
- auto-allow rules** (same reasoning as rule 8): a bare listing meets the steer
448
- rather than a silent read-only-pipeline grant, since `find` is in the default
449
- `GUARD_KIT_RO_BINS` roster. A consumer needing different behavior shadows
450
- the rule in its consumer-rules section.
451
- 10. **Bare single-file `cat`** — a `cat` read is blocked with the steer to the
452
- harness's Read tool (rule 8's read-steer shape: Read returns numbered lines
453
- registered for a later Edit). Fires on the conjunction no allowlist glob
454
- expresses: every segment leads with `cat` and carries **exactly one**
455
- non-flag operand (flags are allowed, `cat -n <file>`), with **no
456
- composition** — no pipe, heredoc, redirect, substitution, `&&`/`||` chain,
457
- or background. A lone `cat <file>` fires, and so does a **`;`-batch of
458
- reads** (`cat a; cat b`): a `;`-compound of single-file reads is a batch,
459
- not composition, and collapses into successive Read calls — the ergonomic
460
- case the steer exists for. A literal `echo`/`printf` banner segment between
461
- reads is the natural separator of such a batch and is tolerated: it is
462
- redundant once the batch moves to the Read tool, which shows each filename
463
- itself. At least one segment must be a read. Multi-file concatenation, a
464
- piped or heredoc'd `cat`, a redirected `cat`, an `&&`-chain, and a **mixed**
465
- or banner-only compound are composition (or carry no read the Read tool
466
- replaces) and pass untouched. **Placed before both auto-allow rules** (same
467
- reasoning as rule 8): a bare `cat <file>` meets the steer rather than a
468
- silent read-only-pipeline grant, since `cat` is in the default
469
- `GUARD_KIT_RO_BINS` roster.
470
- 11. **Working-tree `git grep`** — a `git grep` that searches the working tree
471
- is blocked with the steer to the harness's Grep tool (rule 8's read-steer
472
- shape: Grep returns matching lines with files registered for a later Read).
473
- Fires on the discriminator no allowlist glob expresses: the command leads
474
- with `git grep`, names no revision, and does not scope elsewhere — the
475
- index (`--cached`/`--staged`), a non-repo search (`--no-index`), or an
476
- untracked-file search (`--untracked`). "Names a revision" is read off the
477
- positional grammar: the pattern is one positional (or supplied by
478
- `-e`/`-f`), so a *further* bare positional before any `--` is a tree-ish
479
- the Grep tool cannot reach — `git grep foo` steers while `git grep foo
480
- HEAD` passes, and a `-- <path>` limiter keeps the search in the working
481
- tree and still steers. A piped `git grep` is a producer and never reaches
482
- this rule (the consumer disqualifies it). Conservative by construction: an
483
- unrecognized option-with-argument or a glued pattern flag biases toward
484
- passing, never a false steer of a history search.
485
- 12. **Self-matching process-liveness predicate** — a `pgrep`/`pkill -f` whose
486
- pattern literal the command's own text repeats is **blocked**. `-f` matches
487
- against full argv, and the waiter's own argv — the harness's wrapper included
488
- — carries that literal, so `until ! pgrep -f '<script>'; do …; done` has a
489
- permanently-true condition and never exits. It reds nothing: the work
490
- completes correctly and the only symptom is the foreground cap absorbing an
491
- unbounded loop, which reads from outside as a fixed cap-length wait. Fires on
492
- the conjunction no allowlist glob expresses: a segment whose **command word**
493
- is `pgrep` or `pkill` — read past a leading `until`/`while`/`if`/`!`, which do
494
- not change which binary runs, so the loop-headed spelling the rule exists for
495
- is reached — carrying `-f` (bare or bundled in a short cluster), whose pattern
496
- operand is a literal occurring **elsewhere** in the same command. The
497
- corrective names both sanctioned forms: wait on the work's own artifact, or
498
- `kill -0` against a **recorded PID** where liveness genuinely is the condition
499
- — whoever started that producer, a child the session backgrounded itself
500
- included, whose PID it recorded at launch as a `<key>.run` record under its
501
- scratch directory. That clause is owned by
502
- delegation-kit/SPEC.md §The delegation model and this text carries it, the
503
- record's naming convention included — rule 14 reads that same set, so a
504
- corrective that named the PID but not where it lives would send a blocked
505
- session to write the one artifact shape neither reader can find.
506
- A PID is an identity; a pattern is a
507
- guess about a process table that includes the guesser. The refusal of the
508
- bracket-trick repair as the *sanctioned* form is delegation-kit's ruling and
509
- its grounds live there (delegation-kit/SPEC.md §The delegation model); this
510
- rule exists because a correct form one character from an incorrect one will be
511
- got wrong. Conservative by construction, in this ruleset's established
512
- directions: an expansion or substitution anywhere in the command declines
513
- outright (rule 6 already blocks those shapes); a `pgrep` without `-f` matches
514
- process **names** rather than argv and is untouched; an unrecognized option, an
515
- option whose argument cannot be walked, or a second bare operand declines; and
516
- a pattern occurring nowhere else in the command is a genuine query and passes.
517
- Each biases toward passing rather than toward a false block. **Placed with the
518
- read-steer rules and before both auto-allow rules**, on rule 8's stated
519
- reasoning: `pgrep` is a plausible member of a widened `GUARD_KIT_RO_BINS` — it
520
- is, after all, a read-only query — and a consumer who added it would otherwise
521
- have rule 18 silently bless a waiter that can never exit.
522
- 13. **Bare foreground `sleep`** — a `sleep` standing in for a wait is
523
- **blocked**, and the discriminator is the whole rule: a blanket `sleep` block
524
- is wrong and is refused. The sanctioned wait *is* a condition loop, and such
525
- a loop is expressly legitimate **in either spelling** —
526
- `until <cond>; do sleep N; done` and `while <cond>; do sleep N; done` alike,
527
- because the span walk below reads `do … done` and never the loop keyword, so
528
- correcting a wait loop's polarity is free at the guard. So the rule fires on
529
- exactly one shape — a bare foreground `sleep` in command position, outside
530
- every loop wrapper — and never on a `sleep` inside a loop body. *The
531
- discriminator is new territory:* this ruleset carries exactly one shell-keyword
532
- parse and this rule is where it came from — rule 15's wait-loop exemption now
533
- shares it rather than copying it, so the ruleset keeps one keyword-parsing
534
- dialect. This one takes the skeleton view (so a `sleep` merely *named* in a
535
- quoted span or a heredoc body is already inert), then walks it for `do … done`
536
- spans and treats a `sleep` inside one as **inert** — structurally the carve-out
537
- `_guard_is_banner` already performs for `echo`/`printf` segments in the batched-read
538
- rules, applied to a keyword span instead of a segment. A `sleep` outside every
539
- such span fires. Where the wrapper cannot be resolved — an unbalanced `do`/`done`,
540
- or a span the rule cannot attribute — it **declines**, the direction every
541
- other conservative clause here takes; a `sleep` that is an *argument* rather
542
- than a command word never fires at all. **Blocks** rather than advises, on
543
- rule 19's reasoning: no consumer allowlist is presumed to grant a bare
544
- `sleep`, so the rule fires on a command that would be decided out of band
545
- anyway and converts that decision into a durable steer at no extra cost. *The
546
- corrective names the property and both forms* rather than one spelling: a wait
547
- must end when its condition goes true, not when a duration expires; a
548
- backgrounded command that *exits* on the condition fires one notification the
549
- moment the condition holds, while the harness's event-stream form stays armed
550
- to its deadline after its event fires when the command it was armed with is
551
- unbounded, which makes it the second choice for a single completion. *It also
552
- names the loop's polarity*, because that is the next mistake and it is the one
553
- with an attested cost: `until` takes a done predicate, `while` takes a
554
- still-running one such as a PID's liveness, and inverting them yields a loop
555
- that exits at once with the producer still running
556
- (delegation-kit/SPEC.md §bin/wait-probe measured it). Naming one form teaches a spelling; naming the property
557
- and sorting both under it teaches the rule — the discriminator is owned by
558
- delegation-kit/SPEC.md §The delegation model. **Placed with rule 12, before both
559
- auto-allow rules,** for the same reason: `sleep` is not on the default
560
- read-only roster, but the placement argument is about what a consumer may add
561
- and the whole family of steer rules already sits there.
562
- 14. **Tracked-tree mutation under a live producer** — a `git` command that
563
- writes the index, the worktree or a ref is **blocked** while a `*.run`
564
- record under a `GUARD_KIT_SCRATCH_DIRS` member names a live PID. The record
565
- is the launch-time liveness record a session writes when it backgrounds a
566
- shell child (delegation-kit/SPEC.md §The delegation model owns that rule;
567
- evidence-kit/SPEC.md §The producer-liveness lock owns the `pid=<n>
568
- run=<key>` grammar and the PID predicate, and neither is re-decided here).
569
- **The act set is bounded and named rather than gestured at**: `add`,
570
- `commit`, `rm`, `mv`, `restore`, `checkout`, `switch`, `reset`, `stash`,
571
- `merge`, `rebase`, `cherry-pick`, `revert`, `apply`, `am`, `clean`.
572
- Read-only git — `status`, `log`, `diff`, `show`, `rev-parse`, `ls-files` —
573
- passes, and so does every non-`git` command. **`Write`/`Edit` are
574
- deliberately outside the rule**: a mutating session's mandated journal write
575
- lands through them and the scratch directory is gitignored, so a rule
576
- reaching them would refuse the very mechanic the resume-journal contract
577
- requires *while a wait is in progress*.
578
- **This is the enforcement half of the waiting rule, and it works by
579
- relocation.** The turn-end passes no `PreToolUse` chokepoint, so it is
580
- unreachable from this ruleset (delegation-kit/SPEC.md §Operative residency);
581
- the **harm** it causes arrives as an ordinary tool call at a chokepoint
582
- already wired, which is what this rule fires on. The harness's own turn-end
583
- event does reach it on a different axis, measured rather than assumed
584
- (delegation-kit/SPEC.md §The turn-end liveness probe (template)), and
585
- observing there is not refusing there — so this rule stays the enforcement
586
- and is unchanged.
587
- **Why the block is right even though it over-reaches, stated rather than
588
- softened.** A read-only producer takes no harm from a commit, and the record
589
- cannot say which kind it is. This ruleset's established direction is to bias
590
- toward passing; that direction is **not** taken here, and the ground is that
591
- the biased-toward-passing reading is what has failed every time this rule
592
- fired. The corrective is cheap and names both exits: **wait for the producer
593
- on its own artifact, or delete the record if the producer is done** — and
594
- deleting a record whose producer has exited is not a workaround, it is the
595
- statement of fact becoming false and being retracted.
596
- **Conservative in this ruleset's other established directions**, which are
597
- kept: an expansion or substitution anywhere in the command declines outright
598
- (rule 6 already blocks those shapes); a record that does not parse declines
599
- rather than blocks, because a guard is not the place a corruption verdict is
600
- taken and `check-producer-liveness` already exits 2 on one; git's global
601
- options are walked so `git -C <dir> commit` is reached, but an option the
602
- walk does not recognize declines rather than guess which token is the
603
- subcommand; and an unrecognized `git` subcommand declines. Each biases
604
- toward passing rather than toward a false block, which is the calibration
605
- the previous paragraph departs from **only** on the read-only producer.
606
- **Placed with rules 12 and 13, before every auto-allow rule.** It is the
607
- third member of the wait-discipline family and inherits their placement
608
- argument (`git` is not on the default `GUARD_KIT_RO_BINS` roster, but a
609
- consumer that widened it would otherwise have the read-only-pipeline rule
610
- silently grant the mutation). **Two collisions make the placement necessary
611
- rather than tidy**, and both are with rules that sit *after* the
612
- auto-allows: rule 19 would block a chained `git commit` first and hand back
613
- *run it bare* — a corrective that is wrong under a live producer and that
614
- the session can follow; and rule 20 **advises** on `git commit --amend`, so
615
- a rewrite under a live producer would proceed with a re-verification steer
616
- instead of stopping.
617
- **The bound this rule ships with is narrowed at the launch chokepoint, not
618
- closed.** A session that backgrounds without recording is still invisible
619
- here; rule 15 advises at the launch itself, which makes the omission visible
620
- at the moment it is made without refusing it.
621
- 15. **Backgrounded launch that records no producer** — a backgrounding Bash call
622
- that neither writes a liveness record nor meets an exemption below is
623
- **advised**: the message names the record, its grammar, its home, and the two
624
- things it buys — rule 14's reach, and the next arrival's ability to tell
625
- whether the producer is still writing.
626
- **Two backgrounding forms, and both arms ship in one rule.** *Harness form* —
627
- `.tool_input.run_in_background` is `true`, read through `guard_input_field`
628
- (§The guard framework records the field and its shape). *Shell form* — the
629
- skeleton (`sq dq hd`) ends a statement with a bare `&` that is neither the
630
- `&&` operator nor a redirect's fd-dup. Building only the shell arm was
631
- refused as worse than not building it: every attested firing used the harness
632
- form, so a shell-only rule would cover the spelling nobody uses and pass the
633
- one that fires — coverage in appearance
634
- (delegation-kit/SPEC.md §The delegation model).
635
- **The record-writing test reads the command text, and that is forced rather
636
- than chosen.** At `PreToolUse` the child has not started and no record can
637
- exist yet, so the only thing observable at this chokepoint is whether the
638
- launch is *going to* write one: the call writes a record when its skeleton
639
- carries a redirect whose target is a path under a `GUARD_KIT_SCRATCH_DIRS`
640
- member ending in `.run`. That is the honest predicate, and it is part of why
641
- the rule advises rather than refuses.
642
- **Three exemptions, each reusing machinery already in the lib.** (1) *The call
643
- writes a record* — the obligation is discharged inline. (2) *The call is a
644
- wait loop* — a backgrounded `until <cond>; do sleep N; done` is the sanctioned
645
- primitive rule 13 steers **toward**, a waiter rather than a producer, and
646
- advising there would make the ruleset warn against the form its own corrective
647
- recommends; detected by the `do … done` span walk rule 13 already performs.
648
- (3) *The call is a read-only pipeline* — every segment leads with a
649
- `GUARD_KIT_RO_BINS` member and every redirect target is `/dev/null` or an
650
- fd-dup, rule 18's own test, since a child that writes nothing has nothing for
651
- a later commit to corrupt.
652
- **Advises rather than blocks, and the refusal of a block is reasoned rather
653
- than hedged.** The guard cannot tell a producer from a trivial child — a
654
- backgrounded `printf` and a backgrounded gate battery are the same shape at
655
- this chokepoint — so a block's false-fire population is every short-lived
656
- backgrounded call in the tree, and this ruleset's established direction is to
657
- bias toward passing. Rule 14 departs from that direction on an attested record
658
- of failure; this rule has none to depart on: both attested firings
659
- (2026-08-19 and 2026-08-21, the second self-disclosed) produced no orphan, so
660
- the harm is latent and a block is not warranted by a latent harm when the
661
- reminder is what was missing. The harm already has a block — rule 14 refuses
662
- the mutation — and this rule covers the **omission** that hides it, one step
663
- upstream, where a second refusal buys a second stop rather than a second
664
- catch. Both firings were a session that *knew* the rule and forgot it at the
665
- call, which is exactly what an `additionalContext` note at the call fixes, at
666
- the cost of one sentence rather than a stopped turn.
667
- **The re-opening condition is named rather than left to judgment:** a firing
668
- of the recording omission *after* this advisory ships is the attested record
669
- rule 14's own departure required, and the block is then the next step.
670
- **The honest limit.** An advisory does not refuse. A session determined to
671
- background without recording still can, so rule 14's bound — *only for a
672
- session that recorded* — is **narrowed rather than closed**. What closes at
673
- this chokepoint is the silent case: the omission is now visible at the moment
674
- it is made, to the only party that can fix it.
675
- Conservative in this ruleset's established directions: an expansion or
676
- substitution anywhere in the command declines outright (rule 6 blocks those
677
- shapes already), an unbalanced `do`/`done` declines, and an absent
678
- `GUARD_INPUT` on a call carrying no shell `&` simply leaves the harness arm
679
- unavailable and the rule inert — the graceful degradation §The guard
680
- framework's `GUARD_INPUT`-then-stdin fallback buys. **Placed with rules 12, 13
681
- and 14 as the fourth member of the wait-discipline family, before both
682
- auto-allow rules**, and the placement is required rather than tidy: a
683
- backgrounded read-only pipeline is granted outright by rule 18, so a rule
684
- sitting after the auto-allows would never run on the shapes it exists for.
685
- **No knob is minted, and that is a seam decision rather than an economy**: a
686
- producer roster — *which backgrounded commands are worth a record* — is
687
- exactly the consumer vocabulary the provenance seam keeps out of a kit, so the
688
- rule recognizes shapes and advises, and a consumer wanting a narrower
689
- population narrows the two knobs that already exist.
690
- 16. **Auto-allow `: > file` truncation** — a leading `:` plus redirect
691
- defeats the permission matcher, so it is always decided out of band. Granted
692
- silently when the command is *only* `:` followed by redirects and every target is
693
- gitignored (`git check-ignore`): truncating scratch is safe; a tracked
694
- file must still take that decision. The `git` subprocess is gated behind the rare
695
- `:`-redirect match; expansions (rule 6) and brace forms (rule 7) are
696
- already blocked, so a surviving target is a literal path.
697
- 17. **Auto-allow an append-only write to a gitignored target** — the mandated
698
- resume-journal append that
699
- delegation-kit/SPEC.md §Resume journal — agent writes, scratch reset sweeps
700
- obliges is a redirect, and the harness checks a redirect
701
- **target** as a file write, so no `Bash(…)` allow entry can grant it: such a
702
- rule grants the command and never the target. Granted silently when **every
703
- clause below** holds, falling through untouched otherwise:
704
- - **(0) Not a backgrounded launch.** A statement-ending `&` refuses before
705
- any other clause is read: a backgrounded append is rule 15's subject, and
706
- granting it here would bless a launch the liveness-record rule is about.
707
- - **(a) Append-only.** Every redirect operator is `>>` (an fd prefix
708
- allowed: `2>>`); a single truncating `>` **anywhere** refuses. This clause
709
- carries the append-only split — a mistyped redirect must not be able to
710
- destroy a journal — and it is the one no settings rule can express, since a
711
- redirect-target check is a **file-write** check and cannot tell `>>` from
712
- `>`. That is why the grant is a hook rather than an anchored `Edit` rule,
713
- which would reach the target correctly and grant the truncating form with it.
714
- - **(b) Every target gitignored**, on rule 16's exact `git check-ignore
715
- --quiet --` predicate and its exact subprocess, gated behind the same
716
- rarity: `git` is reached only once (a) and (c) have already matched.
717
- - **(c) The leading command emits to stdout and nothing else**, and the
718
- command is one statement. The roster is `GUARD_KIT_APPEND_BINS`.
719
- - **(d) Conservative decline on anything unmodelled** — a command or process
720
- substitution or a backtick anywhere in the **raw** command, or a redirect
721
- target that survives normalization carrying a quote. Declares `sq dq hd`.
722
-
723
- **Why (c) is the clause the safety argument rests on.** A
724
- `permissionDecision: allow` blesses the whole call, so a rule keyed on the
725
- redirect alone would grant `rm -rf .tmp/../.git >> .tmp/j.md` — the target is
726
- gitignored, the operator is `>>`, and the command destroys the repository.
727
- Bounding the *emitter* is what makes the grant safe, and bounding it to
728
- **stdout-only** emitters is what makes the bound checkable: `cat`, `printf`
729
- and `echo` write nowhere the redirect does not send them, so the redirect
730
- target is the whole of what the call can touch. `tee` is deliberately **off**
731
- the roster despite being the obvious fourth member — it takes a path
732
- **argument**, so `tee -a <tracked file>` writes a tracked file with no
733
- redirect at all and (a) and (b) never see it. The honest limit is the mirror
734
- of the one rule 18 carries for `GUARD_KIT_RO_BINS`, reached from the writing
735
- side rather than the reading side: the grant is exactly as safe as the
736
- roster's stdout-only property, which the rule asserts of the roster and
737
- cannot verify of a member.
738
- **One statement is one segment plus its own heredoc residue, never one
739
- segment.** `guard_split_compound` emits per **line** and `guard_skeleton`'s
740
- `hd` class leaves a heredoc's body placeholder and terminator on lines of
741
- their own, so the mandated `cat >> … <<'EOF'` form splits into *three*
742
- segments and a one-segment test would refuse the exact command this rule
743
- exists to grant. The test is therefore that every segment past the first is
744
- exactly the residue the first segment's own openers produce — which still
745
- refuses a second statement on a line of its own (`printf x >> .tmp/j.md`,
746
- newline, `rm -rf …`), the hazard the one-statement bound is for.
747
- **Two inert targets are exempt from (a) and (b)**, and the carve-out is
748
- precedented rather than invented: `/dev/null` and an fd-dup (`&1`, `&2`) are
749
- what rule 18 already treats as targets that are not files. Neither is a file
750
- the append-only split protects and neither is a path `git check-ignore` can
751
- answer about. Every **other** target takes both tests, and at least one such
752
- target must exist — a call redirecting only to inert targets has no append to
753
- grant. Seeing an fd-dup at all takes this rule's own operator-and-target
754
- scan, because `_guard_redirect_targets`' target class excludes `&` and drops
755
- an fd-dup target entirely.
756
- **The raw-command arm is not redundant with rule 6**, and that was measured
757
- rather than assumed: rule 6 blocks `${…}`, `$(…)`, `<(…)` and `$NAME` and
758
- exits 2 first, but **not** `>(…)`, which does run its command. An auto-allow
759
- may not rest on a coverage claim that is only mostly true, so this rule takes
760
- the same full raw-command decline rule 18 takes.
761
- **Placed immediately after rule 16 and before rule 18**, and the position is
762
- load-bearing rather than tidy: placing it after the decorated-allowlist rule
763
- would be wrong because that rule blocks a bare allow entry decorated by a
764
- trailing redirect, which is one plausible spelling of the very command this
765
- rule grants.
766
- **The mandated in-turn wait is a stated non-target**, recorded so the
767
- omission is not read as an oversight: its `kill -0 "$pid"` loop is
768
- ungrantable by a settings rule for the same structural reason — the mandated
769
- form *is* a loop condition, so it is decorated by construction — but a grant
770
- minted around the currently-sanctioned loop form would be shaped to a
771
- primitive that measurement may correct, and a guard on the wrong primitive
772
- inherits its failure. Measure first, then grant. **The measurement has since
773
- returned and the precondition is discharged**, so what remains is the grant
774
- itself rather than the question it waited on: the backgrounded condition loop
775
- stands unchanged as the sanctioned form and the correction landed on the
776
- loop's *polarity*, so a grant is now shaped to `while kill -0 "$pid" …` as
777
- well as `until <cond> …` (delegation-kit/SPEC.md §bin/wait-probe holds the
778
- trials; §Operative residency holds the finding). Recorded here rather than
779
- left as a closed refusal because the two read differently: this one is now
780
- unblocked work, and rule 6 decides the mandated spelling out of band on every
781
- call until it is minted.
782
- 18. **Auto-allow read-only pipeline** — granted silently when every pipe
783
- segment leads with a roster binary (`GUARD_KIT_RO_BINS`, default the
784
- grep/head/cat/find/jq family) and every redirect target is `/dev/null`
785
- or an fd-dup. Declares `sq dq hd`. Conservative by construction:
786
- command/process substitution, a leftover quote after normalization, any
787
- statement separator, a non-`/dev/null` redirect, or a `find` with a write
788
- action all refuse and fall through. **`xargs` is on the roster but is not
789
- a text filter — it executes a command** — so it carries a discriminator
790
- rather than riding the leads-with test: an `xargs` segment counts read-only
791
- only when the command it runs is itself a roster binary (or absent, since
792
- bare `xargs` defaults to `echo`). Without it, roster membership alone would
793
- silently grant `find . -type f | xargs rm -rf` and
794
- `grep -rln foo src | xargs sed -i s/a/b/`. Unrecognized `xargs` options and
795
- a nested `xargs` decline rather than guess. The discriminator makes an
796
- `xargs` segment exactly as safe as the segment it runs and no safer, which
797
- is the honest bound: roster membership does not by itself prove an
798
- *invocation* read-only (`sort -o` writes a file), and that weaker predicate
799
- is a separate, already-filed gap this rule inherits rather than introduces.
800
- Two carve-outs widen the grant, and
801
- neither widens it past what the segment-by-segment safety argument already
802
- covers:
803
- - **A literal `echo`/`printf` banner segment is skipped**, the tolerance
804
- rules 9 and 10 already carry on the stated ground that a banner is the
805
- natural separator of a batched read; `_guard_is_banner` is shared and this
806
- is its third caller. The asymmetry was the accident, not the tolerance. At
807
- least one non-banner roster segment must remain, so a banner-only pipeline
808
- is not granted.
809
- - **The lead segment may instead be a bare committed allow entry** — an
810
- exact `Bash(<cmd>)` with no glob, on rule 19's own reasoning that a
811
- glob-headed family coexists with allowlisted decorators and would admit
812
- far more than the reviewed command. The shape this repairs is an
813
- allowlisted script piped into `head`: the lead is statically allowlisted,
814
- so it was reviewed; every tail segment leads with a roster binary, so it
815
- is read-only. The widened lead applies **only where something decorates
816
- it** (more than one segment): an undecorated allowlisted command already
817
- resolves on the static match, and intercepting it here would take it off
818
- the friction log for no gain. Reads `GUARD_KIT_SETTINGS`, and the
819
- **fail-open contract travels with the read**: no `jq`, no settings file,
820
- or a parse error and the lead-widening silently declines, leaving the rule
821
- exactly as it behaves without it. A grant that depends on a settings read
822
- must never turn a missing settings file into a grant, and declining is the
823
- only direction that cannot.
824
- 19. **Decorated allowlisted command** — the leading command exactly matches a
825
- committed **bare** allow entry (a `Bash(<cmd>)` with no `:*`/`*` glob) but
826
- the command decorates it — `&&`/`;`/`|` chaining, a trailing redirect, or
827
- `2>&1` — which leaves a segment nothing grants, so the whole call falls off
828
- the match path and is decided out of band, and no allowlist entry pre-empts that.
829
- **Blocked** with the steer *run it bare — the bare form is statically
830
- allowed; the decoration is what costs the decision.* Block, not advise: the rule fires
831
- only on commands that were going to be decided out of band anyway, so blocking
832
- converts that decision into a durable steer at no extra cost, and an advise would *grant* the
833
- decorated command (its extra segments the allowlist never reviewed).
834
- **Bare leads only:** a glob-headed family (`Bash(git log:*)`) coexists with
835
- allowlisted decorators, so only an exact bare entry qualifies as the lead;
836
- widening to glob leads is possible later without a new name. **Never
837
- intercepts a silent grant:** the harness matches per segment, so a compound
838
- whose every segment matches the committed allowlist resolves on the match
839
- and blocking it would regress — the rule therefore fires only when a
840
- non-leading segment (or a redirect on the lead) fails to match any committed
841
- allow entry, reusing `guard_allow_match`'s shell-glob semantics. Reads
842
- `GUARD_KIT_SETTINGS`; **fail-open** — no `jq`, no settings file, or a
843
- parse error and the rule silently declines and falls through. Placed after
844
- the auto-allow rules (16, 17, 18) so a silently granted read-only pipeline never
845
- reaches it — which is also **why the allowlisted-lead grant lives in rule 18
846
- and not here**. Grant, not fall-through, is what removes the friction of an
847
- allowlisted command decorated only by a read-only reduction of its own
848
- output, and this rule's own text refuses to grant, correctly: granting here
849
- would bless segments the allowlist never reviewed. Rule 18 is already the
850
- sanctioned place for a grant of exactly that shape and is already ordered
851
- ahead of this rule, so a granted pipeline never arrives and nothing
852
- ungranted becomes granted that either half would not have granted alone.
853
- Declares `sq dq hd`.
854
- 20. **Git history-rewrite advisory** — a `git commit` carrying `--amend`, `-F`,
855
- or `--file`, or a `git reset --soft`, gets a `guard_advise` steer carrying
856
- the checklist from DOCTRINE.md's *Re-verify volatile state before a git
857
- history rewrite* rule (verify HEAD before amend/squash; re-stage and verify
858
- staged content after a soft reset; write any `commit -F` message file fresh
859
- this turn). Advisory, not a block: each is a legitimate command, so the rule
860
- injects the re-verification context and lets the command proceed. The
861
- DOCTRINE.md rule is cited by **name**, not number — the doctrine's craft
862
- rules renumber as it grows, and this ruleset renumbers on its own account
863
- too — this rule's own number moved when rules 12 and 13 were inserted ahead
864
- of it, again when rule 14 was, again when rule 15 was, and again when the
865
- append grant landed as rule 17 — so a
866
- doc-qualified number would rot on either renumber and read ambiguously
867
- against the local numbering. Placed
868
- after the auto-allow rules (16, 17, 18) and the decorated-allowlist rule (19),
869
- so it fires only on a bare rewrite command none of those claimed; a
870
- decorated form meets rule 19's block first and the advisory fires on the
871
- re-issued bare command.
872
- 21. **Bare `rm` of a tracked path** — an `rm` statement naming a git-tracked
873
- file (`git ls-files --error-unmatch`) is **blocked** with the steer to
874
- `git rm -q <path>`, which deletes and stages that one deletion in a single
875
- motion. The deletion is the point: a bare `rm` leaves it unstaged, so it
876
- lands only via a later `git add -A` — the form the shared-index discipline
877
- warns against, since it sweeps a concurrent session's foreign path into the
878
- commit. Block, not advise, on rule 19's reasoning: no consumer allowlist is
879
- presumed to grant `rm`, so the rule fires on a command that would be decided
880
- out of band anyway and converts that decision into a durable steer. Fires per statement
881
- (`;`/`&&`/`||`/`|` split), so a decorated form steers on the same premise as
882
- the bare one. Conservative by construction: expansions and backticks decline
883
- outright (rule 6 already blocks the expansions; the backtick arm is this
884
- rule's own), option words are skipped, and a
885
- tracked *directory* under `rm -r` does not match `--error-unmatch` — each
886
- biases toward passing rather than a false steer. An untracked or gitignored
887
- target never matches, so scratch deletion is untouched.
888
- 22. **Fall-through logging** — anything neither blocked nor auto-allowed is
889
- appended to the friction log. Always last; never affects the decision.
890
-
891
- **Nothing above claims the sleep half was already enforced.** Before rule 13, no
892
- rule in this ruleset enforced the never-poll rule's `sleep` half and rule 13 is
893
- the first; whether a mechanism *outside* a consumer's tree blocks a foreground
894
- `sleep` is an open question, unprobed as to cause, and no clause here rests a
895
- coverage claim on one. The rule is built as though nothing outside the tree
896
- enforced it — the only construction that is correct whichever way that resolves.
897
-
898
- ### Consumer rules
899
-
900
- Project rules — build-cache hygiene, container-build concurrency,
901
- test-suite serialization, disk reclaim, tool-specific steering — live in a
902
- marked section of the consumer's copied `bash-guard.sh`, before the generic
903
- ruleset. Two ordering disciplines, attested in production use and kept as
904
- guidance: a command about to be *blocked* must never first trigger a
905
- side-effecting rule (place blocks before any reclaim/cleanup rule), and a
906
- steering rule must precede the broader rule that would catch the same
907
- command less precisely. A third, on the match surface: a substring rule
908
- sees the entire tool input, heredoc bodies included, so prose that merely
909
- *names* a guarded command — a `git commit -F -` message describing one —
910
- false-blocks. Match against a `guard_skeleton` view naming the classes inert
911
- for the rule (`sq dq hd` for any rule that does not itself test for an
912
- expansion), which neutralizes quoted spans and heredoc bodies alike, and keep
913
- longer prose out of the match surface via a quoted `-m` span or a `-F <file>`
914
- the hook never reads.
915
-
916
- ## scratch-run
917
-
918
- `bin/scratch-run.sh <script> [args…]` closes a loop the steering rules
919
- themselves open. The generic ruleset pushes probes and multi-line sweeps
920
- into the consumer's gitignored scratch dir (`GATE_SDK_TMP_DIR`) and refuses
921
- the harness scratchpad by name — yet nothing allowlists *executing* what
922
- lands there, so every run of a steered-to script is decided out of band, forever. The
923
- runner is the fixed, allowlistable path that ends it: given a target inside
924
- the scratch dir it **echoes the script's contents to stdout** (a header
925
- naming the path, then the body), then **executes it**, passing stdout,
926
- stderr and the child's exit code through and forwarding `[args…]` verbatim
927
- without interpreting them.
928
-
929
- The echo is the point, not a convenience. A bare scratch-glob allowlist
930
- would auto-approve executing any script at that path with its contents
931
- visible only in an earlier write call — turning a visible command into a
932
- silent *and* opaque one, the opposite of what the permission decision was buying.
933
- Echo-at-execution makes the silent run **self-documenting**: the executed
934
- lines land in the transcript at the moment they run, which is the evidence
935
- surface a supervisor's post-commit review reads. Steering the agent to
936
- inline the script instead is known-insufficient — it serves a short probe
937
- and not the genuine multi-line sweeps (loops, arrays, command
938
- substitution) that are exactly the recurring case.
939
-
940
- **What the allowlist entry buys, and what it costs.** The consumer's entry
941
- names this fixed path with a wildcard tail, and a guard only ever inspects
942
- the **outer command string** — so an allowlisted invocation of the runner
943
- carries no expansion and no decoration, passes, and the script's
944
- *contents* are never guard-inspected at all. State that plainly rather than
945
- as a convenience: the generic rules that would refuse an expansion-bearing
946
- one-liner do not reach the same code once it sits inside a scratch file.
947
- The echoed body is the **compensating control**, and it relocates review
948
- rather than removing it — from *before* execution, where the permission
949
- decision put it, to *after*, in the transcript a supervisor reads. That is
950
- the actual posture of the entry, and a consumer unwilling to move review
951
- downstream should simply not add it: the tool still runs without it, and its
952
- runs still take that decision.
953
-
954
- **Fail-closed on reach.** A target resolving outside the scratch dir is
955
- refused before any echo or execution, so the tool cannot become a general
956
- "run this arbitrary path unreviewed" bypass: its reach is exactly the
957
- scratch surface the guard already steers into. The test reads the
958
- *resolved* path, never the spelling, so a traversal out of the dir refuses
959
- like any other outsider. Refusal, an absent target, and a missing argument
960
- are each exit 2 — which the passthrough makes ambiguous by construction,
961
- since a child exiting 2 is indistinguishable by code alone; the echo is the
962
- discriminator, as a refusal prints no body. Content-agnostic generic
963
- mechanism: the scratch dir comes from gate-sdk's existing `GATE_SDK_TMP_DIR`
964
- and no kit knob is added, while the consumer's allowlist entry for the fixed
965
- path is that consumer's settings, never a kit literal.
966
-
967
- ## scan-prompts
968
-
969
- Advisory: surfaces recurring permission-friction sources from the friction
970
- log, filtering against **both** settings files (`GUARD_KIT_SETTINGS` and
971
- `GUARD_KIT_SETTINGS_LOCAL`) and the harness's built-in read-only git/docker
972
- auto-allows. Matching is **per compound segment**, the same surface the
973
- harness matches on (§The guard framework, `guard_split_compound`): a logged
974
- command is granted only when *every* segment is, so a whole-string glob that
975
- spans a compound the harness would split and refuse — `Bash(git status:*)`
976
- against `git status && rm -rf x` — does not read as allowed and is counted as
977
- prompting.
978
-
979
- **What "prompting" names in this tool's output.** The word is the tool's shipped
980
- vocabulary and stays as it is; what it counts is the set of calls **nothing in the
981
- allowlist grants**, whose decision the harness therefore made out of band. On a
982
- harness that interrupts, that set is literally the prompts; on one that decides
983
- another way, it is the same set under an inherited name. The count is the same
984
- number either way, and it is the number the triage criterion reads.
985
-
986
- The friction log's fall-throughs split three ways:
987
- - **Committed-covered** — every segment matches the committed allowlist or a
988
- harness built-in. Silently granted, reinforced; off every list.
989
- - **Prompting** — some segment nothing grants. The headline `<n> prompting
990
- call(s)`, grouped and ranked by pattern (leading binary, plus subcommand for
991
- the common multi-command binaries), triaged at close by the criterion above.
992
- - **Overlay-covered** — granted, but at least one segment relies on the
993
- uncommitted `GUARD_KIT_SETTINGS_LOCAL` overlay. It *did not prompt*, so it is
994
- excluded from the headline (the count is a true prompt count, not an upper
995
- bound), yet it is exactly the promote-or-prune candidate the close step must
996
- see — so it is ranked in a **separate, visibly-advisory section** below the
997
- headline, never mixed into it.
998
-
999
- `--count` emits the compact `<patterns>/<occurrences>` prompting token for a
1000
- drift-KPI consumer (overlay-covered excluded, so the KPI reads true); an
1001
- explicit file argument overrides the log path (test capability). Its behavior
1002
- — the three-way split, the per-segment matching, the true count — is pinned by
1003
- `gate-tests/scan-prompts.test.sh`.
1004
-
1005
- ## compare-settings-allow
1006
-
1007
- Advisory: lists local-overlay allow entries already granted by a glob in
1008
- the committed settings — the deterministic prune-candidate set for the
1009
- close-stage audit. A committed pattern subsumes a local entry when the
1010
- local string matches it under shell-glob semantics; the harness `:*` prefix
1011
- idiom (`Bash(printf:*)` ≡ any `printf …`) is normalized to a trailing `*`
1012
- so one glob test covers both forms — the match core is `guard_allow_match`
1013
- in `lib/guard.sh`, shared with rule 19. Read-only — reports candidates, never
1014
- mutates (the operator prunes). It is the detector, not the policy: a
1015
- non-redundant local entry can still be one-off junk worth pruning by
1016
- judgment.
1017
-
1018
- The tool asks a **second question over the same two files**: which local entries
1019
- are *too broad*. Redundancy asks whether a committed glob already grants a local
1020
- entry; breadth asks whether a local glob would auto-allow a command the consumer
1021
- called bad. Both are one call to `guard_allow_match` — the breadth question
1022
- simply swaps its arguments, `guard_allow_match <probe> <local-glob>`, so there is
1023
- no second matching implementation and the `:*` normalization is shared. The two
1024
- findings are reported as distinct sets, and breadth is advisory in the same sense
1025
- as redundancy: the report names the local glob and the one probe that witnesses
1026
- its breadth, and the operator disposes — narrow the glob, or record that the
1027
- breadth is intended.
1028
-
1029
- The probe set is consumer config (`GUARD_KIT_BREADTH_PROBES`, §Layout and
1030
- configuration), and it is **probes rather than a roster**: each entry is a single
1031
- witness whose auto-allowance would be bad, not a member of a set claimed
1032
- complete. A missing probe costs one witness and can never produce a false green,
1033
- because no completeness is claimed — and nothing here may come to claim it, since
1034
- a report worded as coverage would be the false-confidence proxy gate-sdk/SPEC.md
1035
- §When a gate earns its place refuses. With no probes declared the breadth section
1036
- is omitted entirely rather than printed clean, so a consumer that declared no
1037
- vocabulary cannot read silence as coverage.
1038
-
1039
- **The second disposition has a mechanism, and where the ruling lives is what makes
1040
- it durable.** `GUARD_KIT_BREADTH_DECLARED` (§Layout and configuration) maps a
1041
- permission-rule string to the reason that breadth was ruled intended — a pair,
1042
- never a bare list, since a bare list re-loses the reason it exists to keep. It
1043
- lives in the **committed** config the consumer tracks, so the ruling survives in a
1044
- reviewable surface rather than in a session's memory or a commit message, which
1045
- spec-over-precedent says is not ground truth. That fixes where a declaration
1046
- *lives*; it does not widen what the breadth question *reads*, which stays the
1047
- local overlay named above. An over-broad local glob keeps re-reporting until a
1048
- **committed** declaration rules it, and a per-clone declaration cannot silence
1049
- one.
1050
-
1051
- **The declaration match is exact-string, never glob.** An entry is declared when
1052
- the exact local allow-rule string is a key of the map — a key test and nothing
1053
- else. Routing it through `guard_allow_match` is refused: the kit's one matcher
1054
- would let a single declaration silence globs the operator's ruling never named,
1055
- which is a declaration widening itself, and a durable ruling about intended
1056
- breadth is a ruling about **one** glob. The consequence is stated rather than left
1057
- to be discovered — narrowing a declared glob, or re-spelling it, drops its
1058
- declaration and the entry re-reports. That is correct, since the ruling was taken
1059
- on the old string, and it is what keeps a declaration from outliving the glob it
1060
- ruled.
1061
-
1062
- **A declared glob is not dropped from the report.** The over-broad set partitions
1063
- in two and both halves print:
1064
-
1065
- - **narrowing candidates** — over-broad and undeclared, printed with the
1066
- two-disposition help text above.
1067
- - **declared intended** — over-broad and declared, printed as
1068
- `<glob> ⊇ <probe> — <reason>` under its own heading, with help text naming
1069
- the committed config as where the ruling lives.
1070
-
1071
- Dropping a declared glob would make the knob a silencer whose contents nobody ever
1072
- reads, and a field with no named reader is removed rather than shipped
1073
- (canon-kit/SPEC.md §The causal-completeness check, point 4). An over-broad set
1074
- that is **entirely** declared therefore prints the declared section and **no**
1075
- narrowing section: *no over-broad local entries* would be false there. With no
1076
- over-broad entries at all the report is unchanged, and with the map empty — the
1077
- default, and the shipped state for a consumer who declares nothing — the partition
1078
- is trivial, the declared subsection is omitted, and every byte of output matches
1079
- the tool as it behaved before the declaration shipped. The asymmetry with
1080
- `GUARD_KIT_BREADTH_PROBES` is deliberate: an empty probe set omits the whole
1081
- breadth section because silence there could be misread as coverage, while an empty
1082
- declaration set omits only the declared subsection, where no coverage claim is
1083
- available to misread and an absent section says exactly that nothing was declared.
1084
-
1085
- **The honest limit: a declaration can outlive its subject and nothing notices.**
1086
- The knob records a ruling; it does not verify that the glob it names is still in
1087
- `GUARD_KIT_SETTINGS_LOCAL`, still over-broad, or still real. A stale declaration
1088
- is silent. A stale-declaration report was weighed and refused, because it would
1089
- print every declaration naming a **committed** glob as stale — and a committed
1090
- glob was never in this report to begin with, so a declaration naming one is a
1091
- durable record that the report itself does not read. That is exactly the shape a
1092
- re-derivation of the committed allowlist produces when it rules a glob safe and
1093
- keeps it broad, and it is stated rather than covered; the gap is filed rather than
1094
- flagged-and-skipped. Nothing here makes a gate of the tool either: the placement
1095
- ruling below is unchanged and unweakened by a knob that records exactly the
1096
- operator intent that ruling turns on.
1097
-
1098
- This is the criterion's home rather than a gate, and the placement is ruled
1099
- rather than defaulted: the subject is a gitignored per-machine file CI cannot
1100
- see, and the verdict is operator-intent-dependent (a blanket grant is fine in a
1101
- throwaway sandbox), which is the high-false-positive shape §When a gate earns its
1102
- place holds back for an attested miss. What replaces the gate is a scheduled
1103
- reader — §The close-stage triage step — the same mechanism the redundancy
1104
- criterion has relied on since it shipped.
1105
-
1106
- **That ruling is about this subject, not about allow-list checking generally**,
1107
- and the boundary is stated because the section otherwise reads as covering the
1108
- whole surface and the next reader re-derives it. Both clauses are load-bearing
1109
- and both fail on the *committed* file: it is tracked, so CI sees it, and "does
1110
- this path exist" is a binary filesystem fact no operator intent can move. A
1111
- committed-allow-list predicate of that shape is therefore gated, and gated
1112
- elsewhere — context-kit/SPEC.md §check-settings-paths, with the kit that already
1113
- owns the committed settings file as a gate subject. This kit holds the three
1114
- `.permissions.allow[]` readers in the tree and still ships no gates; co-location
1115
- by parsing technique does not outrank placement by governed surface.
1116
-
1117
- `--count` emits both bare counts on one line, redundancy first and breadth
1118
- second, and the breadth number counts the **narrowing candidates** rather than
1119
- every over-broad entry: the count's one purpose is *how much is outstanding*, and
1120
- a declared entry is not outstanding. A third number for the declared count is
1121
- refused — no reader needs it, and the two-number line is a shape a consumer may
1122
- already parse.
1123
-
1124
- ## wakeup-guard (template)
1125
-
1126
- Optional second guard, same framework, opposite posture: blocks
1127
- self-scheduled wakeups (`ScheduleWakeup`/`CronCreate`) unconditionally and
1128
- logs each attempt — a stored prompt re-fires in a later session as if the
1129
- user typed it, long after its premises are stale, and the scheduling call
1130
- is invisible at the moment it matters. Fail-closed (the matcher proves the
1131
- tool identity, so a logging failure still denies). The attempt log is
1132
- reviewed and deleted in the same close-stage triage pass as the friction
1133
- log. Deliberate scheduling stays possible by disabling the hook for a
1134
- session — the block is the default, not a capability removal.
1135
-
1136
- ### escalation-guard (template)
1137
-
1138
- `templates/escalation-guard.sh` is the wakeup-guard's sibling — same framework,
1139
- a tool-targeted matcher, a separate opt-in hook — but **advisory, not
1140
- fail-closed**, and the opposite failure posture: an advisory never blocks a
1141
- message, so any inability to inspect the payload passes silently. Registered as
1142
- a `PreToolUse(SendMessage)` hook, it fires only on a message addressed to the
1143
- lead (a background stage session reaches the live lead as `main`) and advises,
1144
- feeding `additionalContext`, when that message lacks any of the decision-shape
1145
- headers **Question / Options / Recommendation / Evidence**. A downward or
1146
- peer-directed message, or one already carrying those headers, passes untouched.
1147
-
1148
- It is the mechanical floor under lifecycle-kit's lead protocol
1149
- (lifecycle-kit/SPEC.md §templates/lead.md): prompts request the escalation
1150
- shape, this guard enforces it. The header grammar is the kit's mechanism; the
1151
- ruling-class roster — what a stage session must escalate at all — stays consumer
1152
- config in the dispatched agent-definition, never here. Opt-in is the consumer's
1153
- settings registration, the same valve as the wakeup-guard; absent it the
1154
- template is inert prose, the intended default (this repo leaves it unwired, as
1155
- it does the wakeup-guard). That stated default is the *only* enforcement of the
1156
- wiring: no gate observes it — `check-settings-pins` and `check-memory-off` stay
1157
- green whether the hook is wired or not — so a session decides whether to wire an
1158
- optional guard by reading this section, never by predicting a gate's verdict or
1159
- reading the guard's own source to infer one. It sources no config and writes no
1160
- log — the advisory is transient, so nothing accrues for the close-stage triage.
1161
-
1162
- ## The close-stage triage step
1163
-
1164
- `templates/close-triage.md` is the recurring step a consumer splices into
1165
- its close-stage skill — it fills the tooling-friction placeholder in
1166
- lifecycle-kit's close template. The step: run `scan-prompts`, resolve each
1167
- recurring pattern by the triage criterion; review and delete the wakeup
1168
- log if present; run `compare-settings-allow` and take its **two**
1169
- dispositions — prune the listed redundant local entries, and for each entry the
1170
- breadth report names as a narrowing candidate, either narrow the glob or record
1171
- that its breadth is intended as a `GUARD_KIT_BREADTH_DECLARED` entry in the
1172
- committed config, which is what moves it into the report's declared section and
1173
- stops it re-reporting — then by judgment prune the remaining one-off exact-string local
1174
- entries and promote recurring safe patterns to the committed settings as
1175
- globs; clear the friction log. Two judgments the reports cannot make sit in
1176
- that last step. An entry naming a **script path** rather than a fixed command is
1177
- not content-pinned — it grants whatever the file says at run time — and its
1178
- sanctioned form is `bin/scratch-run.sh` (§scratch-run), whose echo is the
1179
- compensating control; and widening the committed set is the consumer's call,
1180
- since a session does not widen its own auto-allow set on its own say-so. Goal: the local set stays small, every
1181
- durable pattern lives in the committed, reviewable allowlist, and no local glob
1182
- auto-allows a command the consumer declared bad. One step, two reports, one
1183
- reader — no new invocation point and no new schedule.
1184
-
1185
- The friction log is a capture-tier surface with no forcing function — nothing
1186
- refuses a close that skips it — so it declares itself advisory on the
1187
- close-surface roster (lifecycle-kit/SPEC.md §The close-surface roster), naming
1188
- the clear above as its reclaim path:
1189
-
1190
- close-surface: .workflow/prompt-friction.log advisory reclaim=: > .workflow/prompt-friction.log
1191
-
1192
- ## Layout and configuration
1193
-
1194
- ```
1195
- guard-kit/
1196
- lib/guard.sh # primitives + generic ruleset functions
1197
- bin/scan-prompts.sh
1198
- bin/compare-settings-allow.sh
1199
- bin/scratch-run.sh # echo-then-exec runner for scratch scripts
1200
- bin/run-guard-tests.sh # decision-table runner
1201
- guard-tests/cases.tsv # expected-decision <TAB> command
1202
- guard-tests/escalation-cases.tsv # expected-decision <TAB> to <TAB> message
1203
- guard-tests/background-cases.tsv # expected-decision <TAB> run_in_background <TAB> command
1204
- gate-tests/scratch-run.test.sh # bespoke unit test, run by gate-sdk's runner
1205
- gate-tests/scan-prompts.test.sh # bespoke unit test, run by gate-sdk's runner
1206
- gate-tests/compare-settings-allow.test.sh # bespoke unit test, run by gate-sdk's runner
1207
- templates/bash-guard.sh # consumer copy: generic rules on, marked
1208
- # consumer-rules section
1209
- templates/wakeup-guard.sh
1210
- templates/escalation-guard.sh
1211
- templates/guard-config.sh
1212
- templates/settings-hooks.json # the PreToolUse wiring snippet
1213
- templates/close-triage.md
1214
- smoke/install.sh
1215
- ```
1216
-
1217
- Config follows the established kit pattern: copy
1218
- `templates/guard-config.sh` into the gates dir (or point
1219
- `GUARD_KIT_CONFIG_FILE` elsewhere) and override any knob; defaults fill
1220
- what the consumer left unset, and a set-but-missing `GUARD_KIT_CONFIG_FILE`
1221
- exits 2 rather than silently running on defaults. In a hook that sources the
1222
- lib, that exit 2 surfaces as a hook block carrying the not-found message —
1223
- loud on the first guarded command, the intended fail-closed (the guards
1224
- gate the lib source on file existence only, so the message is never
1225
- swallowed; a lib that is not vendored at all stays fail-open). Knobs (this
1226
- repo's layout as defaults):
1227
-
1228
- - `GUARD_KIT_LIB` — the vendored `lib/guard.sh` path the copied guards
1229
- source (the test runner points it at the tree under test); default
1230
- `guard-kit/lib/guard.sh`. Env or the copied guard's head only — it
1231
- resolves before the config file loads, so `guard-config.sh` cannot set
1232
- it.
1233
- - `GUARD_KIT_LOG` — default
1234
- `${GATE_SDK_WORKFLOW_DIR:-.workflow}/prompt-friction.log`.
1235
- - `GUARD_KIT_WAKEUP_LOG` — default
1236
- `${GATE_SDK_WORKFLOW_DIR:-.workflow}/wakeup-attempts.log`.
1237
- - `GUARD_KIT_SETTINGS` — default `.claude/settings.json`.
1238
- - `GUARD_KIT_SETTINGS_LOCAL` — default `.claude/settings.local.json`.
1239
- - `GUARD_KIT_BREADTH_PROBES` — array of permission-rule strings, each a witness
1240
- that a local glob is too broad (§compare-settings-allow); default empty, in
1241
- which case the breadth report is absent and the tool behaves exactly as it did
1242
- before the criterion shipped. Entries are full permission-rule strings rather
1243
- than bare commands, matching the settings vocabulary the tool already reads on
1244
- both sides, so a consumer can probe non-`Bash` rules with the same mechanism.
1245
- The kit ships **no** default probes: every string naming a command is the
1246
- consumer's vocabulary, never the kit's (CLAUDE.md §The provenance seam).
1247
- - `GUARD_KIT_BREADTH_DECLARED` — associative array recording the breadths ruled
1248
- intended (§compare-settings-allow): the key is a permission-rule string, the
1249
- value the reason that breadth was ruled intended; default empty, in which case
1250
- the declared subsection is absent and the tool behaves exactly as it did before
1251
- the declaration shipped. **Associative rather than a delimited indexed array,
1252
- and the choice is not cosmetic:** a permission rule may contain any character a
1253
- command may, so every single-character separator an indexed array would need
1254
- (`|`, `::`, a tab) is a character a legitimate rule can carry, and the knob
1255
- would ship a grammar that cannot express part of its own subject. An
1256
- associative key holds the rule verbatim, and a key is unique by construction, so
1257
- the *which reason wins* question the delimited shape would raise cannot arise.
1258
- Report order never depends on the map's iteration order: the tool walks the
1259
- settings file's own allow list and looks each entry up, so the map is never
1260
- iterated and the unordered iteration never reaches output. The kit ships **no**
1261
- default declarations, on the same seam reasoning as the probes above.
1262
- - `GUARD_KIT_RO_SCRIPTS` — array of globs eligible for the
1263
- absolute→relative rewrite (rule 4); default `("check-*.sh")`.
1264
- - `GUARD_KIT_RO_BINS` — read-only pipeline roster (rule 18); default the
1265
- grep/head/cat/find/jq family, plus `xargs`, whose membership is qualified by
1266
- rule 18's discriminator rather than granting on the leads-with test alone.
1267
- - `GUARD_KIT_APPEND_BINS` — the emitter roster of the append grant (rule 17);
1268
- default `(cat printf echo)`. A knob rather than a kit literal on
1269
- `GUARD_KIT_RO_BINS`'s reasoning: a consumer whose mandated write rides a
1270
- different emitter shadows the array instead of forking the rule, and three
1271
- POSIX utility names are shipped mechanism rather than a vocabulary, so
1272
- defaulting them crosses no provenance seam. The roster's contract is **writes
1273
- only to its stdout**, and a consumer adding a command that writes anywhere
1274
- else widens the grant past rule 17(c)'s safety argument — the same widening
1275
- hazard `GUARD_KIT_RO_BINS` carries, stated here because this roster's members
1276
- are what bound a *write* rather than a read.
1277
- - `GUARD_KIT_SCRATCH_DIRS` — gitignored scratch dirs named in the
1278
- rule-3 corrective message; default `(".tmp")`.
1279
-
1280
- Both logs are per-iteration scratch: a consumer gitignores them even where
1281
- its workflow dir is otherwise committed.
1282
-
1283
- ## Testing
1284
-
1285
- The gate contracts do not fit hooks (a guard speaks exit-2 + hook JSON, not
1286
- `OK:`/`FAIL:` lines), so the kit ships its own decision-table runner
1287
- instead of `gate-tests/`: `guard-tests/cases.tsv` pairs an expected
1288
- decision (`block`/`advise`/`allow`/`rewrite`/`fallthrough`) with a command;
1289
- `bin/run-guard-tests.sh` feeds each through the template guard as hook JSON
1290
- on stdin and asserts the exit code and output class, failing on any
1291
- mismatch. Every generic rule carries at least one firing and one
1292
- non-firing case (the fixture-pair discipline, transplanted). Two substitutions
1293
- make a command expressible in one tab-separated cell: `@ROOT@` becomes the git
1294
- sandbox root, and `@NL@` becomes a newline — without the second a heredoc case
1295
- cannot be written at all, and the heredoc class would ship untested.
1296
-
1297
- **The runner drives each case from inside the sandbox**, which decides how a
1298
- target is spelled and is stated because getting it wrong reads as a rule defect
1299
- rather than as a spelling one: a path is written **relative** unless the case is
1300
- *about* an absolute one, since rule 5 blocks any command carrying the repo-root
1301
- prefix and an `@ROOT@`-absolute target therefore never reaches the rule under
1302
- test. `@ROOT@` is for the cases whose subject is the absolute form — rules 2, 4
1303
- and 5 — and for a foreign-repo contrast.
1304
-
1305
- **Any ad-hoc invocation of a consumer's guard script must set `GUARD_KIT_LOG` to
1306
- a scratch path**, because the logger's default is the *live* friction log and a
1307
- throwaway probe otherwise files its synthetic commands as real friction. The
1308
- kit's own runners all set it — the decision table into its sandbox, the
1309
- `scan-prompts` fixture into its own — so the convention is invisible until a
1310
- hand-written latency or behaviour probe drives `bash-guard.sh` in a loop and
1311
- poisons the next close's ranking with its payload. Measured rather than
1312
- hypothetical: one such probe contributed 30 of 237 ranked prompting calls at a
1313
- single close, ranking second. **No scanner is proposed:** the polluting caller is
1314
- a one-off script in the gitignored scratch dir, so there is no committed corpus
1315
- to scan and the convention is carried by this sentence and by
1316
- `bin/scratch-run.sh`'s echo-at-execution.
1317
-
1318
- **The decision table is the instrument for any change to what the guard
1319
- refuses, and its red condition is not monotone.** A change that *narrows*
1320
- refusal cannot be cleared by inspection, because the table fails on a verdict
1321
- mismatch **in either direction** rather than on a violation count: every
1322
- existing case whose command carries a double-quoted brace, a heredoc, a banner
1323
- segment, an append redirect to a gitignored target, or an allowlisted lead with
1324
- a read-only tail must have its expected
1325
- column **re-derived**, never assumed still correct. Rule 17's landing is the
1326
- worked instance and the cheap one: it narrowed refusal and flipped exactly one
1327
- pre-existing row, which the table reported and inspection had not.
1328
- `bin/scan-prompts.sh` cannot
1329
- substitute for it, and the reason is structural rather than a matter of
1330
- precision: `guard_block` exits 2 before `guard_log_fallthrough` runs, so a
1331
- blocked command never reaches `GUARD_KIT_LOG` and that report is blind to every
1332
- block the guard makes. A change converting a block into a grant therefore reads
1333
- as a pure improvement on the scan and as nothing at all — which is why the
1334
- table, not the scan, is what a narrowing change is measured on.
1335
-
1336
- The same runner drives the escalation-guard from a second table,
1337
- `guard-tests/escalation-cases.tsv` (`<decision> <TAB> <to> <TAB> <message>`),
1338
- feeding a `SendMessage`-shaped payload instead of a command: a firing case (a
1339
- headerless message to `main` → advise) and its non-firing pair (a fully shaped
1340
- block, and a non-`main` recipient → fallthrough) hold the same fixture-pair
1341
- discipline for the advisory.
1342
-
1343
- A **third** table, `guard-tests/background-cases.tsv`
1344
- (`<decision> <TAB> <run_in_background> <TAB> <command>`), extends that same
1345
- precedent to rule 15's harness arm, and it is forced rather than tidy: the
1346
- `cases.tsv` grammar pairs a decision with a *command*, and the harness arm's
1347
- input is a **tool parameter**, so that arm cannot be written there at all and
1348
- would otherwise ship untested — the coverage-in-appearance this rule's own design
1349
- refuses. The runner feeds a Bash-shaped payload carrying the flag. Rows, each a
1350
- firing/non-firing pair: harness-form background with no record → advise;
1351
- harness-form background writing a `.run` record → fallthrough; harness-form
1352
- background of a wait loop → fallthrough; harness-form background of a read-only
1353
- pipeline → the auto-allow it already earns; and a foreground call carrying
1354
- neither → fallthrough, which is what proves the rule inert off the backgrounding
1355
- path. The shell-`&` arm *is* a command, so its firing and non-firing rows stay in
1356
- `cases.tsv`. Rule 15 emits an **advise**, so it converts a `fallthrough` row into
1357
- an `advise` row wherever it fires: every existing row whose command carries a
1358
- trailing `&` has its expected column re-derived under the non-monotone rule
1359
- above, never assumed still correct.
1360
-
1361
- `smoke/install.sh` copies the templates into the scratch consumer (guard
1362
- and config into the gates dir, hook wiring into `.claude/settings.json`,
1363
- log paths gitignored) and then drives one crafted payload directly through
1364
- the installed guard, asserting a block — the install is self-verifying.
1365
- There is no `smoke/violation.sh`: the kit registers no gates, so no
1366
- battery-reddening violation is craftable (gate-sdk/SPEC.md §Consumer smoke
1367
- makes that file conditional on exactly this).
1368
-
1369
- `compare-settings-allow`'s breadth criterion takes the same bespoke lane for the
1370
- same reason, at `gate-tests/compare-settings-allow.test.sh`: a firing probe
1371
- (a blanket local glob reported with its witness), a non-firing one (a narrow
1372
- entry reporting clean), and the empty-knob silence that proves the section is
1373
- omitted rather than printed clean — which, with `GUARD_KIT_BREADTH_DECLARED`
1374
- empty, also proves the declared subsection absent. The declaration's own cases sit
1375
- beside them: a declared over-broad entry printing in the declared section with its
1376
- reason and **not** in the narrowing set; an all-declared over-broad set printing
1377
- the declared section, no narrowing section and no false clean line; `--count`'s
1378
- breadth number excluding the declared entry; and an exactness case — a declaration
1379
- differing from the local entry by one character leaves that entry in the narrowing
1380
- set, which is the assertion that the lookup never became a glob match. It drives the tool through
1381
- `GUARD_KIT_CONFIG_FILE` pointed at a sandbox config, so the consumer's own probe
1382
- array cannot leak into the fixture.
1383
-
1384
- A shipped `bin/` tool that is not a hook takes neither lane. `bin/scratch-run.sh`
1385
- (§scratch-run) is tested by a bespoke unit test at
1386
- `gate-tests/scratch-run.test.sh`, asserting echo-then-exec on an in-scratch
1387
- target, pass-through of args and exit code, and the fail-closed refusal of an
1388
- out-of-scratch one. It is **not** a `guard-tests/` row: that table's grammar is a
1389
- decision paired with a command, which cannot express any of the three. It is not
1390
- a gate either, so no `good/`+`bad/` fixture pair is owed — but shipped mechanism
1391
- owes a test, and the bespoke-unit-test lane is gate-sdk's
1392
- `<tests-dir>/*.test.sh` (gate-sdk/SPEC.md §run-gate-tests), which admits a tests
1393
- dir carrying unit tests and no fixture pair. Homing it there is what puts it
1394
- under `check-test-hermetic`, whose assertion A enumerates
1395
- `<kit-root>/gate-tests/*.test.sh` — the enforcement a kit-local runner would
1396
- forfeit. A kit's first `gate-tests/` directory also obliges a fixture-runner
1397
- line in the consumer's battery, which `check-kit-registration` reads from
1398
- `git ls-files`: the line belongs in the same commit as the test, never a
1399
- follow-up.
1400
-
1401
- A gateless kit shapes gate-sdk's discovery rule: `gate_kit_roots` recognizes a
1402
- sibling kit by its `checks/` *or* `smoke/` directory. Keying on `checks/`
1403
- alone would leave this kit undiscovered — its `smoke/install.sh` would never
1404
- run under `run-consumer-smoke.sh`, and its `lib/` and `bin/` would escape
1405
- `check-shellcheck`'s self-lint sweep.
1406
-
1407
- ## Out of scope
1408
-
1409
- Every toolchain- and product-coupled guard rule is consumer rule content:
1410
- build-cache hygiene, container-build concurrency and restart discipline,
1411
- test-suite serialization rosters, proactive disk reclaim, tool-preference
1412
- steering, and any read-only script roster beyond `check-*.sh`. So are
1413
- allowlist contents beyond the read-only core, and a memory-policy write
1414
- guard (a product ruling, not friction mechanism). The split is framework
1415
- and generic rules here, a consumer's rules in its own copied guard.