checkwright 0.21.0 → 0.23.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 (489) hide show
  1. package/README.md +1013 -50
  2. package/lib/common/digest.sh +18 -0
  3. package/lib/common/lock.sh +40 -0
  4. package/lib/common/profile.sh +33 -0
  5. package/lib/common/recipe.sh +56 -43
  6. package/lib/diff.sh +64 -0
  7. package/lib/doctor.sh +81 -7
  8. package/lib/init.sh +167 -52
  9. package/lib/uninstall.sh +212 -0
  10. package/lib/update.sh +34 -0
  11. package/package.json +2 -2
  12. package/payload/artifact/targets.list +30 -0
  13. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  14. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
  15. package/payload/canon-kit/README.md +2 -0
  16. package/payload/canon-kit/SPEC.md +666 -59
  17. package/payload/canon-kit/checks/check-amendment-queue.sh +1 -0
  18. package/payload/canon-kit/checks/check-comment-tier.gate +3 -0
  19. package/payload/canon-kit/checks/check-deprecation-task.gate +3 -0
  20. package/payload/canon-kit/checks/check-docs-cmd.gate +3 -0
  21. package/payload/canon-kit/checks/check-docs-link-convention.sh +12 -4
  22. package/payload/canon-kit/checks/check-install-claim.gate +3 -0
  23. package/payload/canon-kit/checks/check-knob-citation.gate +3 -0
  24. package/payload/canon-kit/checks/check-knob-default-coupling.sh +1 -0
  25. package/payload/canon-kit/checks/check-manifest-count.gate +3 -0
  26. package/payload/canon-kit/checks/check-manifest-temporal.gate +3 -0
  27. package/payload/canon-kit/checks/check-md-refs.gate +3 -0
  28. package/payload/canon-kit/checks/check-measured-claim.gate +3 -0
  29. package/payload/canon-kit/checks/check-payload-claim.gate +3 -0
  30. package/payload/canon-kit/checks/check-prose-enum.gate +3 -0
  31. package/payload/canon-kit/checks/check-prose-tells.sh +1 -0
  32. package/payload/canon-kit/checks/check-spec-derivable-section.gate +3 -0
  33. package/payload/canon-kit/checks/check-spec-dod-singleton.gate +3 -0
  34. package/payload/canon-kit/checks/check-spec-embedded-source.sh +1 -0
  35. package/payload/canon-kit/checks/check-spec-fence-balance.gate +3 -0
  36. package/payload/canon-kit/checks/check-spec-pointer.gate +3 -0
  37. package/payload/canon-kit/checks/check-surface-duplication.sh +1 -0
  38. package/payload/canon-kit/checks/check-todo-task-liveness.gate +3 -0
  39. package/payload/canon-kit/checks/check-tracking-claim.gate +3 -0
  40. package/payload/canon-kit/gate-tests/check-comment-tier/bad/.workflow/fixture-state.txt +4 -0
  41. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.gate +4 -0
  42. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.rs +5 -0
  43. package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +4 -0
  44. package/payload/canon-kit/gate-tests/check-comment-tier/bad/templates/bad-tmpl.sh +4 -0
  45. package/payload/canon-kit/gate-tests/check-comment-tier/good/.workflow/fixture-state.txt +3 -0
  46. package/payload/canon-kit/gate-tests/check-comment-tier/good/expect.txt +1 -1
  47. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.gate +4 -0
  48. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.rs +5 -0
  49. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
  50. package/payload/canon-kit/gate-tests/check-comment-tier/good/templates/good-tmpl.sh +5 -0
  51. package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +29 -5
  52. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/.workflow/fixture-state.txt +3 -0
  53. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.gate +2 -0
  54. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.rs +4 -0
  55. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/expect.txt +3 -0
  56. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.sh +6 -5
  57. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/templates/tmpl.sh +5 -0
  58. package/payload/canon-kit/gate-tests/check-deprecation-task/good/.workflow/fixture-state.txt +3 -0
  59. package/payload/canon-kit/gate-tests/check-deprecation-task/good/expect.txt +1 -1
  60. package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.gate +2 -0
  61. package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.rs +4 -0
  62. package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.sh +6 -5
  63. package/payload/canon-kit/gate-tests/check-deprecation-task/good/templates/tmpl.sh +5 -0
  64. package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +4 -3
  65. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/OUTSIDE.md +4 -0
  66. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/index.md +3 -0
  67. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/OUTSIDE.md +4 -0
  68. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +8 -0
  69. package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +94 -0
  70. package/payload/canon-kit/gate-tests/check-knob-citation.test.sh +2 -2
  71. package/payload/canon-kit/gate-tests/check-manifest-count/good/SPEC.md +4 -0
  72. package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +32 -8
  73. package/payload/canon-kit/gate-tests/check-md-refs.test.sh +61 -9
  74. package/payload/canon-kit/gate-tests/check-measured-claim/bad/SPEC.md +12 -0
  75. package/payload/canon-kit/gate-tests/check-measured-claim/bad/expect.txt +3 -0
  76. package/payload/canon-kit/gate-tests/check-measured-claim/bad/scripts/canon-config.sh +6 -0
  77. package/payload/canon-kit/gate-tests/check-measured-claim/good/SPEC.md +23 -0
  78. package/payload/canon-kit/gate-tests/check-measured-claim/good/expect.txt +1 -0
  79. package/payload/canon-kit/gate-tests/check-measured-claim/good/scripts/canon-config.sh +6 -0
  80. package/payload/canon-kit/gate-tests/check-measured-claim.test.sh +90 -0
  81. package/payload/canon-kit/gate-tests/check-payload-claim/bad/README.md +15 -0
  82. package/payload/canon-kit/gate-tests/check-payload-claim/bad/expect.txt +2 -0
  83. package/payload/canon-kit/gate-tests/check-payload-claim/bad/install.md +19 -0
  84. package/payload/canon-kit/gate-tests/check-payload-claim/bad/posts/note.md +6 -0
  85. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +8 -0
  86. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/payload-claims.sh +7 -0
  87. package/payload/canon-kit/gate-tests/check-payload-claim/good/README.md +15 -0
  88. package/payload/canon-kit/gate-tests/check-payload-claim/good/expect.txt +2 -0
  89. package/payload/canon-kit/gate-tests/check-payload-claim/good/install.md +20 -0
  90. package/payload/canon-kit/gate-tests/check-payload-claim/good/posts/note.md +6 -0
  91. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +8 -0
  92. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/payload-claims.sh +7 -0
  93. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +27 -4
  94. package/payload/canon-kit/gate-tests/check-spec-dod-singleton.test.sh +21 -7
  95. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/.workflow/fixture-state.txt +2 -0
  96. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.gate +2 -0
  97. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.rs +4 -0
  98. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +4 -0
  99. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/templates/tmpl.sh +5 -0
  100. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +1 -0
  101. package/payload/canon-kit/gate-tests/check-spec-pointer/good/.workflow/fixture-state.txt +2 -0
  102. package/payload/canon-kit/gate-tests/check-spec-pointer/good/expect.txt +1 -1
  103. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.gate +2 -0
  104. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.rs +4 -0
  105. package/payload/canon-kit/gate-tests/check-spec-pointer/good/templates/tmpl.sh +5 -0
  106. package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +1 -0
  107. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/.workflow/fixture-state.txt +3 -0
  108. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.gate +2 -0
  109. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.rs +4 -0
  110. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/expect.txt +3 -0
  111. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/templates/tmpl.sh +5 -0
  112. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/.workflow/fixture-state.txt +3 -0
  113. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/expect.txt +1 -1
  114. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.gate +2 -0
  115. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.rs +4 -0
  116. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/templates/tmpl.sh +5 -0
  117. package/payload/canon-kit/gate-tests/check-tracking-claim.test.sh +1 -2
  118. package/payload/canon-kit/lib/spec.sh +109 -70
  119. package/payload/canon-kit/smoke/install.sh +21 -1
  120. package/payload/canon-kit/templates/SPEC-amendment.md +9 -2
  121. package/payload/context-kit/README.md +4 -1
  122. package/payload/context-kit/SPEC.md +166 -9
  123. package/payload/context-kit/bin/env-probe.sh +19 -6
  124. package/payload/context-kit/checks/check-brevity.sh +1 -0
  125. package/payload/context-kit/checks/check-footprint-fresh.sh +1 -0
  126. package/payload/context-kit/checks/check-memory-off.sh +1 -0
  127. package/payload/context-kit/checks/check-settings-paths.sh +94 -0
  128. package/payload/context-kit/checks/check-settings-pins.sh +1 -0
  129. package/payload/context-kit/gate-tests/check-settings-paths/bad/args +1 -0
  130. package/payload/context-kit/gate-tests/check-settings-paths/bad/expect.txt +3 -0
  131. package/payload/context-kit/gate-tests/check-settings-paths/bad/settings.json +12 -0
  132. package/payload/context-kit/gate-tests/check-settings-paths/bad/tools/real-tool.sh +4 -0
  133. package/payload/context-kit/gate-tests/check-settings-paths/good/args +1 -0
  134. package/payload/context-kit/gate-tests/check-settings-paths/good/expect.txt +1 -0
  135. package/payload/context-kit/gate-tests/check-settings-paths/good/settings.json +16 -0
  136. package/payload/context-kit/gate-tests/check-settings-paths/good/tools/real-tool.sh +4 -0
  137. package/payload/context-kit/index-tests/expected/toolfloor.txt +9 -0
  138. package/payload/context-kit/index-tests/toolfloor-cases.sh +20 -0
  139. package/payload/context-kit/lib/toolfloor.sh +15 -4
  140. package/payload/context-kit/smoke/agents-md.sh +12 -1
  141. package/payload/context-kit/smoke/install.sh +4 -1
  142. package/payload/delegation-kit/README.md +3 -3
  143. package/payload/delegation-kit/SPEC.md +499 -26
  144. package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +97 -0
  145. package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +1 -0
  146. package/payload/delegation-kit/checks/check-gate-tamper.sh +2 -1
  147. package/payload/delegation-kit/checks/check-rule-citation.sh +1 -0
  148. package/payload/delegation-kit/lib/delegation.sh +1 -0
  149. package/payload/delegation-kit/smoke/install.sh +2 -1
  150. package/payload/delegation-kit/templates/agent-dispatch-guard.sh +61 -0
  151. package/payload/delegation-kit/templates/agent-execution.md +127 -12
  152. package/payload/delegation-kit/templates/delegation-config.sh +4 -0
  153. package/payload/delegation-kit/templates/dispatch-checklists.md +1 -1
  154. package/payload/delegation-kit/templates/statusline-usage.sh +23 -1
  155. package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +30 -0
  156. package/payload/doctrine-kit/DOCTRINE.md +112 -11
  157. package/payload/doctrine-kit/README.md +12 -3
  158. package/payload/doctrine-kit/SPEC.md +163 -11
  159. package/payload/doctrine-kit/bin/install-doctrine.sh +167 -17
  160. package/payload/doctrine-kit/checks/check-doctrine-registration.sh +41 -11
  161. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/DOCTRINE.md +3 -0
  162. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/DOCTRINE.md +3 -0
  163. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +82 -2
  164. package/payload/doctrine-kit/smoke/install.sh +167 -1
  165. package/payload/drift-kit/README.md +3 -2
  166. package/payload/drift-kit/SPEC.md +264 -22
  167. package/payload/drift-kit/bin/kfric.sh +21 -2
  168. package/payload/drift-kit/bin/stage-economics.sh +157 -3
  169. package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +42 -0
  170. package/payload/drift-kit/smoke/install.sh +183 -1
  171. package/payload/drift-kit/templates/economics.md +9 -0
  172. package/payload/drift-kit/templates/kpis.list +6 -1
  173. package/payload/evidence-kit/README.md +20 -6
  174. package/payload/evidence-kit/SPEC.md +355 -17
  175. package/payload/evidence-kit/bin/run-validate.sh +51 -9
  176. package/payload/evidence-kit/checks/check-battery-roster.sh +87 -0
  177. package/payload/evidence-kit/checks/check-evidence-baseline.sh +1 -0
  178. package/payload/evidence-kit/checks/check-evidence-manifest.sh +1 -0
  179. package/payload/evidence-kit/checks/check-producer-liveness.sh +35 -0
  180. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/args +1 -0
  181. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/expect.txt +1 -0
  182. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/runner.md +14 -0
  183. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +7 -0
  184. package/payload/evidence-kit/gate-tests/check-battery-roster/good/args +1 -0
  185. package/payload/evidence-kit/gate-tests/check-battery-roster/good/expect.txt +1 -0
  186. package/payload/evidence-kit/gate-tests/check-battery-roster/good/runner.md +14 -0
  187. package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +7 -0
  188. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +68 -0
  189. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/args +1 -0
  190. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/expect.txt +1 -0
  191. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/run-validate.lock +1 -0
  192. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/args +1 -0
  193. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/expect.txt +2 -0
  194. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/run-validate.lock +1 -0
  195. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +109 -0
  196. package/payload/evidence-kit/lib/evidence.sh +18 -0
  197. package/payload/evidence-kit/smoke/install.sh +17 -3
  198. package/payload/gate-sdk/README.md +17 -1
  199. package/payload/gate-sdk/SPEC.md +4427 -92
  200. package/payload/gate-sdk/bin/build-native.sh +38 -0
  201. package/payload/gate-sdk/bin/enforcement-map.sh +2 -1
  202. package/payload/gate-sdk/bin/gen-pre-commit.sh +32 -2
  203. package/payload/gate-sdk/bin/port-blockers.sh +445 -0
  204. package/payload/gate-sdk/bin/run-consumer-smoke.sh +129 -2
  205. package/payload/gate-sdk/bin/run-gate-tests.sh +61 -9
  206. package/payload/gate-sdk/bin/run-gates.sh +37 -2
  207. package/payload/gate-sdk/bin/upgrade-smoke.sh +55 -7
  208. package/payload/gate-sdk/checks/check-action-gh-repo.gate +3 -0
  209. package/payload/gate-sdk/checks/check-action-pinning.gate +3 -0
  210. package/payload/gate-sdk/checks/check-action-run-shell.sh +4 -1
  211. package/payload/gate-sdk/checks/check-assertion-strength.gate +3 -0
  212. package/payload/gate-sdk/checks/check-commit-msg.sh +1 -0
  213. package/payload/gate-sdk/checks/check-commit-subject.sh +1 -0
  214. package/payload/gate-sdk/checks/check-core-files.sh +28 -4
  215. package/payload/gate-sdk/checks/check-crate-arms.sh +61 -0
  216. package/payload/gate-sdk/checks/check-enforcement-fresh.sh +1 -0
  217. package/payload/gate-sdk/checks/check-exec-bit.sh +21 -1
  218. package/payload/gate-sdk/checks/check-gate-assertions.sh +31 -6
  219. package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +107 -0
  220. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +7 -7
  221. package/payload/gate-sdk/checks/check-gate-fail-closed.sh +1 -0
  222. package/payload/gate-sdk/checks/check-gate-fixture-coverage.sh +1 -0
  223. package/payload/gate-sdk/checks/check-gate-output.sh +41 -3
  224. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +333 -0
  225. package/payload/gate-sdk/checks/check-graph.sh +5 -5
  226. package/payload/gate-sdk/checks/check-hook-exec-bit.sh +1 -0
  227. package/payload/gate-sdk/checks/check-identity.sh +1 -0
  228. package/payload/gate-sdk/checks/check-install-disposition.sh +92 -0
  229. package/payload/gate-sdk/checks/check-kit-enum.sh +1 -0
  230. package/payload/gate-sdk/checks/check-kit-registration.gate +3 -0
  231. package/payload/gate-sdk/checks/check-readme-roster.sh +6 -0
  232. package/payload/gate-sdk/checks/check-reads-couples.sh +71 -21
  233. package/payload/gate-sdk/checks/check-root-tiering.sh +1 -0
  234. package/payload/gate-sdk/checks/check-shellcheck.sh +1 -0
  235. package/payload/gate-sdk/checks/check-smoke-entry-guard.gate +3 -0
  236. package/payload/gate-sdk/checks/check-template-copy-parity.sh +1 -0
  237. package/payload/gate-sdk/checks/check-template-registry-parity.gate +3 -0
  238. package/payload/gate-sdk/checks/check-test-hermetic.gate +3 -0
  239. package/payload/gate-sdk/checks/check-tree-terms.sh +1 -0
  240. package/payload/gate-sdk/checks/check-workflow-tiering.sh +2 -1
  241. package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +16 -1
  242. package/payload/gate-sdk/gate-tests/check-core-files.test.sh +64 -0
  243. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/crate/Cargo.toml +7 -0
  244. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/crate/src/lib.rs +12 -0
  245. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/expect.txt +5 -0
  246. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/scripts/gate-sdk-config.sh +2 -0
  247. package/payload/gate-sdk/gate-tests/check-crate-arms/good/crate/Cargo.toml +7 -0
  248. package/payload/gate-sdk/gate-tests/check-crate-arms/good/crate/src/lib.rs +11 -0
  249. package/payload/gate-sdk/gate-tests/check-crate-arms/good/expect.txt +2 -0
  250. package/payload/gate-sdk/gate-tests/check-crate-arms/good/scripts/gate-sdk-config.sh +2 -0
  251. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -1
  252. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/args +2 -0
  253. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/expect.txt +5 -0
  254. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/kitroot/checks/check-vendored.gate +2 -0
  255. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/check-ported.gate +2 -0
  256. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +2 -0
  257. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gates.list +4 -0
  258. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stamp.txt +1 -0
  259. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stub-bin +6 -0
  260. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/args +2 -0
  261. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/expect.txt +5 -0
  262. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/kitroot/checks/check-vendored.gate +2 -0
  263. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/check-ported.gate +2 -0
  264. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +2 -0
  265. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gates.list +4 -0
  266. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stamp.txt +1 -0
  267. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stub-bin +5 -0
  268. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +81 -0
  269. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +3 -1
  270. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +3 -1
  271. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +3 -1
  272. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
  273. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-native-sample.gate +3 -0
  274. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +1 -0
  275. package/payload/gate-sdk/gate-tests/check-gate-output/bad/expect.txt +3 -0
  276. package/payload/gate-sdk/gate-tests/check-gate-output/bad/gates.list +1 -0
  277. package/payload/gate-sdk/gate-tests/check-gate-output/bad/native/Cargo.toml +4 -0
  278. package/payload/gate-sdk/gate-tests/check-gate-output/bad/native/src/gates/native_sample.rs +7 -0
  279. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-native-sample.gate +3 -0
  280. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +1 -0
  281. package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
  282. package/payload/gate-sdk/gate-tests/check-gate-output/good/gates.list +1 -0
  283. package/payload/gate-sdk/gate-tests/check-gate-output/good/native/Cargo.toml +4 -0
  284. package/payload/gate-sdk/gate-tests/check-gate-output/good/native/src/gates/native_sample.rs +11 -0
  285. package/payload/gate-sdk/gate-tests/check-gate-output.test.sh +111 -0
  286. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/args +2 -0
  287. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/conservation.md +7 -0
  288. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +12 -0
  289. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/impl/gate.rs +2 -0
  290. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kitroot/check-orphan.rs +3 -0
  291. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/publish.yml +15 -0
  292. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +3 -0
  293. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.gate +1 -0
  294. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.sh +3 -0
  295. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +1 -0
  296. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +6 -0
  297. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +3 -0
  298. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +3 -0
  299. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/targets.list +3 -0
  300. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/args +2 -0
  301. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/conservation.md +8 -0
  302. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -0
  303. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/impl/gate.rs +2 -0
  304. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kitroot/check-other.rs +3 -0
  305. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/publish.yml +15 -0
  306. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +3 -0
  307. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-ported.gate +2 -0
  308. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +6 -0
  309. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +2 -0
  310. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +3 -0
  311. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/targets.list +2 -0
  312. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +184 -0
  313. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-alpha.sh +6 -0
  314. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-delta.sh +5 -0
  315. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-epsilon.sh +6 -0
  316. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/smoke/install.sh +7 -0
  317. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/args +6 -0
  318. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/expect.txt +1 -0
  319. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/installer/lib/common/recipe.sh +9 -0
  320. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/scripts/gate-sdk-config.sh +5 -0
  321. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-alpha.sh +6 -0
  322. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-beta.gate +3 -0
  323. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-gamma.sh +6 -0
  324. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/smoke/install.sh +8 -0
  325. package/payload/gate-sdk/gate-tests/check-install-disposition/good/args +6 -0
  326. package/payload/gate-sdk/gate-tests/check-install-disposition/good/expect.txt +1 -0
  327. package/payload/gate-sdk/gate-tests/check-install-disposition/good/installer/lib/common/recipe.sh +10 -0
  328. package/payload/gate-sdk/gate-tests/check-install-disposition/good/scripts/gate-sdk-config.sh +5 -0
  329. package/payload/gate-sdk/gate-tests/check-kit-registration.test.sh +6 -5
  330. package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +139 -0
  331. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/templates/widgets.list +4 -0
  332. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-one.sh +3 -0
  333. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-two.sh +3 -0
  334. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +4 -0
  335. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +1 -0
  336. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/scripts/gate-sdk-config.sh +5 -0
  337. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/templates/widgets.list +4 -0
  338. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-one.sh +3 -0
  339. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-two.sh +3 -0
  340. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +8 -0
  341. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/rules.list +5 -0
  342. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/table.tsv +4 -0
  343. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -0
  344. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +5 -0
  345. package/payload/gate-sdk/gate-tests/check-test-hermetic-smoke.test.sh +2 -3
  346. package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +4 -4
  347. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +151 -1
  348. package/payload/gate-sdk/gate-tests/run-dispatch-streams.test.sh +73 -0
  349. package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +144 -0
  350. package/payload/gate-sdk/lib/consumer-smoke.sh +41 -4
  351. package/payload/gate-sdk/lib/gate.sh +208 -9
  352. package/payload/gate-sdk/lib/inject.sh +46 -1
  353. package/payload/gate-sdk/lib/test-hermetic.sh +26 -0
  354. package/payload/gate-sdk/smoke/install.sh +61 -1
  355. package/payload/guard-kit/README.md +18 -14
  356. package/payload/guard-kit/SPEC.md +366 -72
  357. package/payload/guard-kit/bin/compare-settings-allow.sh +40 -7
  358. package/payload/guard-kit/bin/run-guard-tests.sh +1 -0
  359. package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +64 -0
  360. package/payload/guard-kit/gate-tests/guard-read-path.test.sh +52 -0
  361. package/payload/guard-kit/guard-tests/cases.tsv +49 -7
  362. package/payload/guard-kit/lib/guard.sh +277 -54
  363. package/payload/guard-kit/templates/close-triage.md +38 -10
  364. package/payload/guard-kit/templates/guard-config.sh +3 -0
  365. package/payload/guard-kit/templates/settings-hooks.json +7 -1
  366. package/payload/lifecycle-kit/README.md +12 -1
  367. package/payload/lifecycle-kit/SPEC.md +991 -41
  368. package/payload/lifecycle-kit/bin/cite-survey.sh +81 -0
  369. package/payload/lifecycle-kit/bin/enter-stage.sh +139 -13
  370. package/payload/lifecycle-kit/bin/file-gap.sh +60 -2
  371. package/payload/lifecycle-kit/bin/file-survey.sh +69 -0
  372. package/payload/lifecycle-kit/checks/check-close-surfaces.sh +1 -0
  373. package/payload/lifecycle-kit/checks/check-gap-inbox-neutrality.gate +3 -0
  374. package/payload/lifecycle-kit/checks/check-lesson-disposition.gate +3 -0
  375. package/payload/lifecycle-kit/checks/check-lifecycle-registration.gate +3 -0
  376. package/payload/lifecycle-kit/checks/check-merge-attrs.gate +3 -0
  377. package/payload/lifecycle-kit/checks/check-scratch-citation.gate +3 -0
  378. package/payload/lifecycle-kit/checks/check-shim-restatement.gate +3 -0
  379. package/payload/lifecycle-kit/checks/check-skill-binding.gate +3 -0
  380. package/payload/lifecycle-kit/checks/check-stage-entry.sh +1 -0
  381. package/payload/lifecycle-kit/checks/check-stage-evidence.gate +3 -0
  382. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.gate +3 -0
  383. package/payload/lifecycle-kit/checks/check-survey-record.gate +3 -0
  384. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +1 -2
  385. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/args +2 -0
  386. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/expect.txt +3 -0
  387. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/gap-inbox.md +5 -0
  388. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/args +2 -0
  389. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/expect.txt +1 -0
  390. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/gap-inbox.md +4 -0
  391. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +2 -3
  392. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +2 -3
  393. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +1 -0
  394. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +1 -0
  395. package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +3 -3
  396. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/expect.txt +1 -0
  397. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/scripts/lifecycle-config.sh +4 -0
  398. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/surfaces/queue.md +13 -0
  399. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/expect.txt +1 -0
  400. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/scripts/lifecycle-config.sh +4 -0
  401. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/surfaces/queue.md +31 -0
  402. package/payload/lifecycle-kit/gate-tests/check-shim-restatement.test.sh +2 -3
  403. package/payload/lifecycle-kit/gate-tests/check-skill-binding.test.sh +2 -3
  404. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +2 -3
  405. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +9 -5
  406. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/args +2 -0
  407. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +4 -0
  408. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +18 -0
  409. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/args +2 -0
  410. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -0
  411. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +13 -0
  412. package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +83 -0
  413. package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +122 -0
  414. package/payload/lifecycle-kit/gate-tests/rename-iteration.test.sh +142 -0
  415. package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +102 -0
  416. package/payload/lifecycle-kit/gate-tests/workflow-state-guard.test.sh +100 -0
  417. package/payload/lifecycle-kit/lib/stages.sh +12 -2
  418. package/payload/lifecycle-kit/smoke/install.sh +83 -4
  419. package/payload/lifecycle-kit/templates/consult.md +73 -0
  420. package/payload/lifecycle-kit/templates/lead.md +139 -7
  421. package/payload/lifecycle-kit/templates/stages/align.md +12 -0
  422. package/payload/lifecycle-kit/templates/stages/build.md +8 -0
  423. package/payload/lifecycle-kit/templates/stages/close.md +45 -5
  424. package/payload/lifecycle-kit/templates/stages/scope.md +42 -3
  425. package/payload/lifecycle-kit/templates/stages/spec.md +13 -1
  426. package/payload/lifecycle-kit/templates/stages/validate.md +8 -0
  427. package/payload/lifecycle-kit/templates/workflow-state-guard.sh +29 -0
  428. package/payload/queue-kit/README.md +6 -1
  429. package/payload/queue-kit/SPEC.md +350 -6
  430. package/payload/queue-kit/bin/queue-counts.sh +35 -0
  431. package/payload/queue-kit/bin/queue-edges.sh +78 -0
  432. package/payload/queue-kit/checks/check-queue-entry-budget.gate +3 -0
  433. package/payload/queue-kit/checks/check-queue-hygiene.gate +3 -0
  434. package/payload/queue-kit/checks/check-queue-prose-precondition.sh +1 -0
  435. package/payload/queue-kit/checks/check-queue-sections.gate +3 -0
  436. package/payload/queue-kit/checks/check-queue-slug-liveness.gate +3 -0
  437. package/payload/queue-kit/checks/check-queue-wrap.gate +3 -0
  438. package/payload/queue-kit/checks/check-roadmap-fresh.sh +1 -0
  439. package/payload/queue-kit/checks/check-tag-lead-line.gate +3 -0
  440. package/payload/queue-kit/checks/check-task-conservation.gate +4 -0
  441. package/payload/queue-kit/checks/check-task-names.gate +3 -0
  442. package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +5 -0
  443. package/payload/queue-kit/gate-tests/queue-counts.test.sh +116 -0
  444. package/payload/queue-kit/gate-tests/queue-edges.test.sh +130 -0
  445. package/payload/queue-kit/gate-tests/queue-lib-parity.test.sh +215 -0
  446. package/payload/queue-kit/lib/queue.sh +4 -19
  447. package/payload/queue-kit/smoke/install.sh +4 -1
  448. package/payload/queue-kit/templates/TASK-QUEUE.md +3 -0
  449. package/payload/site-kit/SPEC.md +64 -27
  450. package/payload/site-kit/checks/check-docs-cname-parity.sh +1 -0
  451. package/payload/site-kit/checks/check-docs-render-fidelity.sh +1 -0
  452. package/payload/site-kit/smoke/install.sh +9 -1
  453. package/profiles.list +36 -8
  454. package/payload/canon-kit/checks/check-comment-tier.sh +0 -211
  455. package/payload/canon-kit/checks/check-deprecation-task.sh +0 -90
  456. package/payload/canon-kit/checks/check-docs-cmd.sh +0 -153
  457. package/payload/canon-kit/checks/check-install-claim.sh +0 -146
  458. package/payload/canon-kit/checks/check-knob-citation.sh +0 -117
  459. package/payload/canon-kit/checks/check-manifest-count.sh +0 -46
  460. package/payload/canon-kit/checks/check-manifest-temporal.sh +0 -83
  461. package/payload/canon-kit/checks/check-md-refs.sh +0 -128
  462. package/payload/canon-kit/checks/check-prose-enum.sh +0 -115
  463. package/payload/canon-kit/checks/check-spec-derivable-section.sh +0 -69
  464. package/payload/canon-kit/checks/check-spec-dod-singleton.sh +0 -45
  465. package/payload/canon-kit/checks/check-spec-fence-balance.sh +0 -42
  466. package/payload/canon-kit/checks/check-spec-pointer.sh +0 -180
  467. package/payload/canon-kit/checks/check-todo-task-liveness.sh +0 -80
  468. package/payload/canon-kit/checks/check-tracking-claim.sh +0 -136
  469. package/payload/gate-sdk/checks/check-action-gh-repo.sh +0 -321
  470. package/payload/gate-sdk/checks/check-action-pinning.sh +0 -55
  471. package/payload/gate-sdk/checks/check-assertion-strength.sh +0 -134
  472. package/payload/gate-sdk/checks/check-kit-registration.sh +0 -68
  473. package/payload/gate-sdk/checks/check-smoke-entry-guard.sh +0 -53
  474. package/payload/gate-sdk/checks/check-test-hermetic.sh +0 -119
  475. package/payload/lifecycle-kit/checks/check-lesson-disposition.sh +0 -98
  476. package/payload/lifecycle-kit/checks/check-lifecycle-registration.sh +0 -54
  477. package/payload/lifecycle-kit/checks/check-merge-attrs.sh +0 -69
  478. package/payload/lifecycle-kit/checks/check-shim-restatement.sh +0 -97
  479. package/payload/lifecycle-kit/checks/check-skill-binding.sh +0 -59
  480. package/payload/lifecycle-kit/checks/check-stage-evidence.sh +0 -81
  481. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.sh +0 -47
  482. package/payload/queue-kit/checks/check-queue-entry-budget.sh +0 -104
  483. package/payload/queue-kit/checks/check-queue-hygiene.sh +0 -81
  484. package/payload/queue-kit/checks/check-queue-sections.sh +0 -44
  485. package/payload/queue-kit/checks/check-queue-slug-liveness.sh +0 -63
  486. package/payload/queue-kit/checks/check-queue-wrap.sh +0 -56
  487. package/payload/queue-kit/checks/check-tag-lead-line.sh +0 -70
  488. package/payload/queue-kit/checks/check-task-conservation.sh +0 -50
  489. package/payload/queue-kit/checks/check-task-names.sh +0 -128
@@ -1,9 +1,12 @@
1
1
  # guard-kit — permission-friction reduction for agent sessions
2
2
 
3
- A permission prompt the human approves is invisible to the agent — nothing
4
- about it lands in the transcript, so the agent cannot notice, count, or fix
5
- the friction it causes. The cost lands on the operator, silently and
6
- per-prompt, and compounds as the command surface grows. The kit closes the
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
7
10
  loop: a `PreToolUse` guard decides at call time (block with a corrective
8
11
  message, steer to a better form, auto-allow the provably safe, log every
9
12
  fall-through), a scanner ranks the logged prompt sources, a curation pass
@@ -24,21 +27,56 @@ conventions without depending on its registry.
24
27
  1. **Call time** — the consumer's `bash-guard.sh` (copied from
25
28
  `templates/`, wired as the `PreToolUse(Bash)` hook) inspects each
26
29
  command: block, steer, rewrite, auto-allow, or fall through. Every
27
- fall-through — exactly the set of commands that may have prompted — is
28
- appended to the friction log. An *approved* prompt is invisible to the
29
- agent, so this log is the only record.
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.
30
33
  2. **Close time** — `bin/scan-prompts.sh` filters the log against the
31
34
  committed allowlist and ranks what survives (§scan-prompts states the
32
35
  local-overlay upper bound), grouped by command
33
36
  pattern. Each recurring pattern is resolved by the **triage criterion**
34
37
  (below); `bin/compare-settings-allow.sh` lists the local-overlay entries
35
- a committed glob already grants (the deterministic prune set). Then the
38
+ a committed glob already grants (the prune set) and those a declared probe
39
+ proves too broad (the narrowing set). Then the
36
40
  log is cleared — its named reclaim path.
37
41
  3. **Steady state** — friction low and justified: the committed
38
42
  `settings.json` carries every durable pattern (reviewable, shared), the
39
43
  local `settings.local.json` stays near-empty, and the guard encodes the
40
44
  steering rules no static glob can express.
41
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
+
42
80
  ### The triage criterion
43
81
 
44
82
  Allowlist and guard are two tools with distinct jobs — resolve each
@@ -58,7 +96,7 @@ exists, steer to it in the guard rather than permitting the worse one.
58
96
  Note: the harness matches the allowlist **per segment** of a compound
59
97
  command, so a glob on the core command does not cover the `echo` banners,
60
98
  `wc`, redirects, or `;`-chained diagnostics wrapped around it — one
61
- unmatched segment re-prompts the whole line. The read-only banner/diagnostic
99
+ unmatched segment takes the whole line off the match path. The read-only banner/diagnostic
62
100
  tools an agent habitually chains (`echo`, `wc`, `grep`, `ls`, `command -v`)
63
101
  are therefore themselves legitimate allowlist entries; allowlist them, or
64
102
  run the core command bare.
@@ -71,6 +109,14 @@ Primitives a consumer guard composes; each emits the harness's
71
109
  - `guard_read_command` — parse the hook JSON on stdin, emit the command;
72
110
  **fail-open** on any parse problem (exit 0) so a guard can never wedge
73
111
  the agent.
112
+ - `guard_read_path` — the same accessor for `.tool_input.file_path`, the field a
113
+ path-bearing tool call carries where a Bash call carries a command. It returns
114
+ **non-zero, emitting nothing**, when the field is absent, empty, or the payload
115
+ will not parse — so a matcher covering a call without one falls through instead
116
+ of blocking. That return contract is the whole design: an accessor returning
117
+ success on a missing field passes every happy path and wedges every other call
118
+ its matcher covers. Generic over any path-bearing tool; it names no path and no
119
+ rule, which is what keeps the rule in the kit that owns the file.
74
120
  - `guard_block <msg>` — exit 2 with the message on stderr. Every block
75
121
  message is self-describing: it names the offending pattern *and* the
76
122
  corrective form, so the why of a rule rides to the agent in the rejection
@@ -88,24 +134,112 @@ Primitives a consumer guard composes; each emits the harness's
88
134
  hook primitive — a shared helper, one implementation behind
89
135
  compare-settings-allow's redundancy detection and rule 14's silent-grant
90
136
  guard so the two never drift.
137
+ - `guard_skeleton <cmd> <inert-class>…` — the context-aware normalizer, and the
138
+ only place a rule learns what part of a command is live. It returns the command
139
+ with every region of the named inert classes replaced by a placeholder token,
140
+ leaving everything else byte-identical. Four classes: **`sq`** (single-quoted
141
+ spans), **`dq`** (double-quoted spans), **`hd`** (heredoc bodies, from the line
142
+ after an opener to its terminator line), and **`hdq`** — the subset of `hd`
143
+ whose **delimiter is quoted** (`<<'EOF'`), where the shell itself guarantees
144
+ the body does not expand. `hdq` exists because that guarantee is what lets the
145
+ one rule that must keep heredoc bodies live keep only the bodies that can
146
+ actually expand. Each rule names the classes inert **for it**, in one argument, at one
147
+ call site — the classes were never the disagreement, since every rule agrees
148
+ that *some* regions are inert; the disagreement was that each decided privately
149
+ and none recorded why. Not a hook primitive, and a pure function of its
150
+ arguments: no config read, no subprocess, no global.
91
151
  - `guard_split_compound <skeleton>` — the compound splitter: emits one segment
92
152
  per line, splitting on the harness's statement separators (`;`, `&&`, `||`,
93
153
  `|`). Also not a hook primitive — the single implementation every consumer
94
- that reasons *per segment* shares (rules 8/14/16, the read-compound carve-out
95
- of rules 9/10, and scan-prompts' `allowed()`), so the harness's per-segment
96
- matching surface is modelled in exactly one place and cannot drift between
97
- them. Fed a quote-stripped skeleton (`'…'`/`"…"` regions already neutralized
98
- by the caller, as every rule does), so a separator inside a quoted argument is
99
- never mistaken for a statement break.
154
+ that reasons *per segment* shares (rules 8/13/14/16, the read-compound
155
+ carve-out of rules 9/10, and scan-prompts' `allowed()`), so the harness's
156
+ per-segment matching surface is modelled in exactly one place and cannot drift
157
+ between them. Fed a `guard_skeleton` view, so a separator inside a quoted
158
+ argument is never mistaken for a statement break. Its separator class carries
159
+ **no newline**, and it does not need one: it *emits* segments as lines and
160
+ every consumer reads lines, so a newline already present in the input is
161
+ already a boundary before the substitution runs.
162
+
163
+ **Placeholder, never deletion, and this is a correctness point rather than
164
+ taste.** Deleting an inert span **fuses adjacent tokens**: a pattern glued to its
165
+ flag loses the boundary between them and the residue reads as one word that was
166
+ never in the command. The normalizer substitutes, so the skeleton has the same
167
+ token count and the same statement structure as the command it models.
168
+
169
+ **The heredoc class marks the body extent only.** The opener line and everything
170
+ after the terminator stay fully live, so a heredoc-bearing call is still matched
171
+ on its executable text — neither blanking everything after a `<<` (which blinds
172
+ the guard to real commands in the same call) nor stripping quotes alone (which
173
+ still refuses a double-quoted mention). The extent is decidable without a shell
174
+ parser because the terminator is a literal token alone on its line, which is the
175
+ property the class rests on.
176
+
177
+ **Two bounds, stated rather than discovered later.** A heredoc with an
178
+ **unquoted** delimiter does expand, so `hd` is not inert for the expansion rule
179
+ even though it is inert for every glyph rule — which is why classes are declared
180
+ per rule and not fixed per region, and why the rule that cannot take `hd` takes
181
+ `hdq` instead rather than going without. Only the delimiter's quoting decides
182
+ this, never the body's content, so the test is decidable at the opener; a
183
+ delimiter escaped rather than quoted (`<<\EOF`) is not recognized and its body
184
+ stays live, which is the conservative direction. And the normalizer models **quoting, not
185
+ shell semantics**: a construct that survives its scan and is not one of the three
186
+ classes is treated as live, the fail-toward-matching direction and the one a
187
+ guard should err in. That bound is why the command/process-substitution and
188
+ backtick tests in rules 9, 10, 11, 13 and 16 read the **raw** command rather than
189
+ a skeleton and must keep doing so — a `"$(…)"` inside double quotes still
190
+ executes, so a rule that declared `dq` inert for *that* test would hand an
191
+ auto-allow to a command substitution it could not see. Those tests are
192
+ conservative declines, not verdict matching; every rule that reaches a verdict
193
+ reaches it off a skeleton.
194
+
195
+ **The payload carries the live permission mode, and no accessor above reads it.**
196
+ `PreToolUse` delivers `permission_mode` alongside the fields
197
+ `guard_read_command` and `guard_read_path` pick off, so a rule whose rationale is
198
+ mode-*conditional* — "no allowlist entry can suppress this prompt" is false under
199
+ an auto-approving mode and true under the others — currently asserts a mode
200
+ rather than reading one. Recorded here because it is a fact about this framework's
201
+ own inputs: without it, each session re-establishes it from the vendor hook
202
+ reference. Whether a guard *should* read the mode is a consumer decision and is
203
+ not settled here.
100
204
 
101
205
  Fail-open is the default posture. The one sanctioned fail-closed shape is a
102
206
  deny-guard whose hook *matcher* already proves the tool identity (see
103
207
  wakeup-guard): there, a logging or parse failure still denies.
104
208
 
105
- delegation-kit's `agent-budget-guard.sh` is a second framework consumer,
106
- composing these primitives into a `PreToolUse(Agent)` hook that blocks on a
107
- PAUSE budget verdict and advises otherwise (delegation-kit/SPEC.md §The
108
- delegation model) — cite-only; no guard-kit mechanism moves for it.
209
+ **A third posture, fail-open-but-loud**, covers a deny-guard whose matcher
210
+ proves the tool but whose rule turns on a **payload field**. The gap is real
211
+ rather than a technicality: wakeup-guard's rule *is* the tool, so a parse
212
+ failure that denies costs nothing, while a rule needing a field cannot say
213
+ that — denying on a parse failure would wedge every call its matcher covers.
214
+ Passing silently is the opposite failure and the worse one, since it ships an
215
+ unenforceable claim that reports success. So the guard **allows the call and
216
+ emits an advisory naming the rule it could not enforce**: a degraded
217
+ enforcement is visible, never silently folded. One delivery constraint comes
218
+ with the posture and is easy to miss — `guard_advise` is itself jq-backed, so a
219
+ guard degrading *because* `jq` is absent cannot reach for it and must emit the
220
+ advisory envelope directly, or the loud half is lost in exactly the case it was
221
+ written for.
222
+
223
+ delegation-kit is this framework's second and third consumer, and they do not
224
+ cost the kit alike. `agent-budget-guard.sh` composes these primitives into a
225
+ `PreToolUse(Agent)` hook that blocks on a PAUSE budget verdict and advises
226
+ otherwise — cite-only; no guard-kit mechanism moves for it.
227
+ `agent-dispatch-guard.sh` shares that matcher and enforces delegation-kit's
228
+ dispatch-shape rules; guard-kit mechanism **does** move for that one, by
229
+ exactly one clause — the fail-open-but-loud posture above, which it is the
230
+ shipped instance of (delegation-kit/SPEC.md §The delegation model).
231
+
232
+ lifecycle-kit is the fourth consumer, on the same axis: its
233
+ `templates/workflow-state-guard.sh` is a `PreToolUse(Write|Edit)` hook refusing a
234
+ direct write to the lifecycle state file, and guard-kit mechanism **does** move
235
+ for it, again by exactly one clause — `guard_read_path` above. Nothing else was
236
+ missing: `guard_block` and `guard_advise` never read a command, so they were
237
+ already tool-agnostic. This is the rule the three consumers now make explicit —
238
+ **the kit owning the rule ships the guard**, riding `lib/guard.sh` through the
239
+ `GUARD_KIT_LIB` indirection, and guard-kit moves only where the lib lacks a
240
+ primitive. The state file's path lives with lifecycle-kit, never here, so
241
+ guard-kit gains no dependency on a kit it does not otherwise know about
242
+ (lifecycle-kit/SPEC.md §check-stage-evidence).
109
243
 
110
244
  ## Consumer rules
111
245
 
@@ -127,12 +261,12 @@ Rules that encode **harness behavior**, not any project's toolchain —
127
261
  shipped as `lib/guard.sh` functions the template guard invokes. Order is
128
262
  load-bearing where noted.
129
263
 
130
- 1. **`cd` in a compound command** — blocked: cwd drift plus a permission
131
- prompt no allowlist entry suppresses. Corrective form: absolute paths,
132
- or `git -C <dir>` for git.
264
+ 1. **`cd` in a compound command** — blocked: cwd drift, plus a compound the
265
+ allowlist cannot match, so the call is decided out of band. Corrective form:
266
+ absolute paths, or `git -C <dir>` for git.
133
267
  2. **`git -C <repo-root>` when cwd is the root** — blocked: the absolute
134
- `-C` target matches no allowlist entry and re-prompts, while the bare
135
- `git` form is allowlisted. Pinned with a trailing space to the exact
268
+ `-C` target matches no allowlist entry and falls off the match path, while
269
+ the bare `git` form is allowlisted and resolves on it. Pinned with a trailing space to the exact
136
270
  root, so `git -C <root>/subdir` and a foreign-repo `-C` are untouched.
137
271
  3. **Bare-name scratch redirect** — a `>`/`>>` to a slash-free
138
272
  `*.err`/`*.out`/`*.log` target is blocked (it lands in the tracked tree
@@ -149,16 +283,35 @@ load-bearing where noted.
149
283
  the literal repo-root prefix is steered to the repo-relative spelling.
150
284
  `git` is excluded — rule 2 already owns its `-C` handling.
151
285
  6. **Shell expansion / assignment** — a residual `${…}`/`$(…)`/`<(…)`/
152
- `$NAME` after single-quoted regions are stripped is blocked (the harness
153
- prompts on every expansion before allowlist matching). Only
154
- *single*-quoted regions are stripped: inside single quotes `$` is
155
- literal (`awk '$1'`), but a double-quoted `"$x"` still expands and must
156
- stay visible. A standalone `NAME=value` assignment is caught separately,
157
- since the expansion check only sees a *used* `$VAR`.
158
- 7. **Unquoted brace glyph** — the harness prompts on the bare `{` glyph
286
+ `$NAME` in the skeleton is blocked (the harness's matcher refuses every
287
+ expansion before allowlist matching). **Declares `sq hdq`** for the expansion
288
+ check and **`sq dq hdq`** for the assignment check, and every part of that is
289
+ deliberate rather than inherited. `dq` stays live for the expansion check:
290
+ inside single quotes `$` is literal (`awk '$1'`), but a double-quoted `"$x"`
291
+ still expands and must stay visible. `hd` is **not** declared, since an
292
+ unquoted-delimiter heredoc body expands too — but `hdq` is, because a
293
+ **quoted** delimiter makes the shell itself the guarantee that the body
294
+ cannot expand. That is what stops the rule refusing prose that merely
295
+ *names* a substitution: a journal entry, a queue entry being appended, or a
296
+ commit message written through `git commit -F - <<'MSG'`. The assignment
297
+ check adds `dq` because a `NAME="value"` assigns whatever the quotes hold. A
298
+ standalone `NAME=value` assignment is
299
+ caught separately, since the expansion check only sees a *used* `$VAR`.
300
+ 7. **Unquoted brace glyph** — the harness's matcher refuses the bare `{` glyph
159
301
  before allowlist matching, the same behavior class rule 6 pre-empts for
160
- `$`-expansions, so a `{` surviving rule 6's single-quote strip is handled
161
- by shape. A **bare `{}` placeholder** (`find … -exec cmd {} +`,
302
+ `$`-expansions, so a `{` surviving in the skeleton is handled by shape.
303
+ **Declares `sq dq hd`, and the difference from rule 6 is the point rather
304
+ than an accident of two adjacent lines.** Rule 6's reason to keep
305
+ double-quoted spans live does not carry here: `{` is a **matcher glyph, not a
306
+ shell expansion**, so a double-quoted brace is exactly as inert as a
307
+ single-quoted one, and a heredoc-body brace is inert whatever the delimiter.
308
+ This is what stops a working POSIX quantifier (`grep -rnE "^[a-z]{2,}"`)
309
+ being refused, and it is equally what stops the **wrong corrective**: a block
310
+ message owes the offending pattern *and* the corrective form, and *write out
311
+ the brace expansion, spell the members* is inapplicable to a quantifier that
312
+ has no members and to a heredoc body that has nothing to respell. A block
313
+ whose corrective cannot be followed fails that contract however right its
314
+ verdict. A **bare `{}` placeholder** (`find … -exec cmd {} +`,
162
315
  `xargs -I{}`), when every residual brace is exactly `{}`, is rewritten
163
316
  via `guard_rewrite` — each `{}` single-quoted to `'{}'`,
164
317
  behavior-preserving (the shell passes a literal `{}` either way) and
@@ -167,12 +320,12 @@ load-bearing where noted.
167
320
  git-ref shorthand (`@{u}`, `@{-n}`, `<ref>@{n}`) names the explicit
168
321
  spelling (`origin/<branch>..HEAD`, or the resolved ref/hash);
169
322
  list/range (`{a,b}`, `{a..b}`) names the spelled-out members or a loop;
170
- any other residual `{` gets the generic corrective (single-quote if
171
- literal — an awk/sed program in double quotes — write it out if it
172
- expands). There is no legitimate brace-glob convenience to preserve:
173
- since every bare `{` already costs an operator prompt no allowlist entry
174
- can suppress, block-and-steer strictly dominates; only single-quoted
175
- (literal) braces pass untouched. **Placed before both auto-allow rules**
323
+ any other residual `{` gets the generic corrective (quote it if literal —
324
+ an unquoted awk/sed program — write it out if it expands). There is no
325
+ legitimate brace-glob convenience to preserve:
326
+ since every bare `{` already costs an out-of-band decision no allowlist entry
327
+ can suppress, block-and-steer strictly dominates; a brace in any inert region
328
+ passes untouched. **Placed before both auto-allow rules**
176
329
  so their literal-target premise holds for braces as well.
177
330
  8. **`sed` reading or rewriting a file** — blocked with the steer to the
178
331
  harness's file tools: `sed -i` (or any short bundle carrying `i`) to the
@@ -241,40 +394,84 @@ load-bearing where noted.
241
394
  unrecognized option-with-argument or a glued pattern flag biases toward
242
395
  passing, never a false steer of a history search.
243
396
  12. **Auto-allow `: > file` truncation** — a leading `:` plus redirect
244
- defeats the permission matcher, so it always prompts. Granted silently
245
- when the command is *only* `:` followed by redirects and every target is
397
+ defeats the permission matcher, so it is always decided out of band. Granted
398
+ silently when the command is *only* `:` followed by redirects and every target is
246
399
  gitignored (`git check-ignore`): truncating scratch is safe; a tracked
247
- file must still prompt. The `git` subprocess is gated behind the rare
400
+ file must still take that decision. The `git` subprocess is gated behind the rare
248
401
  `:`-redirect match; expansions (rule 6) and brace forms (rule 7) are
249
402
  already blocked, so a surviving target is a literal path.
250
403
  13. **Auto-allow read-only pipeline** — granted silently when every pipe
251
404
  segment leads with a roster binary (`GUARD_KIT_RO_BINS`, default the
252
405
  grep/head/cat/find/jq family) and every redirect target is `/dev/null`
253
- or an fd-dup. Conservative by construction: command/process
254
- substitution, a leftover quote after stripping, any statement separator,
255
- a non-`/dev/null` redirect, or a `find` with a write action all refuse
256
- and fall through.
406
+ or an fd-dup. Declares `sq dq hd`. Conservative by construction:
407
+ command/process substitution, a leftover quote after normalization, any
408
+ statement separator, a non-`/dev/null` redirect, or a `find` with a write
409
+ action all refuse and fall through. **`xargs` is on the roster but is not
410
+ a text filter — it executes a command** — so it carries a discriminator
411
+ rather than riding the leads-with test: an `xargs` segment counts read-only
412
+ only when the command it runs is itself a roster binary (or absent, since
413
+ bare `xargs` defaults to `echo`). Without it, roster membership alone would
414
+ silently grant `find . -type f | xargs rm -rf` and
415
+ `grep -rln foo src | xargs sed -i s/a/b/`. Unrecognized `xargs` options and
416
+ a nested `xargs` decline rather than guess. The discriminator makes an
417
+ `xargs` segment exactly as safe as the segment it runs and no safer, which
418
+ is the honest bound: roster membership does not by itself prove an
419
+ *invocation* read-only (`sort -o` writes a file), and that weaker predicate
420
+ is a separate, already-filed gap this rule inherits rather than introduces.
421
+ Two carve-outs widen the grant, and
422
+ neither widens it past what the segment-by-segment safety argument already
423
+ covers:
424
+ - **A literal `echo`/`printf` banner segment is skipped**, the tolerance
425
+ rules 9 and 10 already carry on the stated ground that a banner is the
426
+ natural separator of a batched read; `_guard_is_banner` is shared and this
427
+ is its third caller. The asymmetry was the accident, not the tolerance. At
428
+ least one non-banner roster segment must remain, so a banner-only pipeline
429
+ is not granted.
430
+ - **The lead segment may instead be a bare committed allow entry** — an
431
+ exact `Bash(<cmd>)` with no glob, on rule 14's own reasoning that a
432
+ glob-headed family coexists with allowlisted decorators and would admit
433
+ far more than the reviewed command. The shape this repairs is an
434
+ allowlisted script piped into `head`: the lead is statically allowlisted,
435
+ so it was reviewed; every tail segment leads with a roster binary, so it
436
+ is read-only. The widened lead applies **only where something decorates
437
+ it** (more than one segment): an undecorated allowlisted command already
438
+ resolves on the static match, and intercepting it here would take it off
439
+ the friction log for no gain. Reads `GUARD_KIT_SETTINGS`, and the
440
+ **fail-open contract travels with the read**: no `jq`, no settings file,
441
+ or a parse error and the lead-widening silently declines, leaving the rule
442
+ exactly as it behaves without it. A grant that depends on a settings read
443
+ must never turn a missing settings file into a grant, and declining is the
444
+ only direction that cannot.
257
445
  14. **Decorated allowlisted command** — the leading command exactly matches a
258
446
  committed **bare** allow entry (a `Bash(<cmd>)` with no `:*`/`*` glob) but
259
447
  the command decorates it — `&&`/`;`/`|` chaining, a trailing redirect, or
260
- `2>&1` — which forces a permission prompt no allowlist entry suppresses.
448
+ `2>&1` — which leaves a segment nothing grants, so the whole call falls off
449
+ the match path and is decided out of band, and no allowlist entry pre-empts that.
261
450
  **Blocked** with the steer *run it bare — the bare form is statically
262
- allowed; the decoration forces a prompt.* Block, not advise: the rule fires
263
- only on commands that would prompt anyway, so blocking converts the prompt
264
- into a durable steer at no extra interrupt, and an advise would *grant* the
451
+ allowed; the decoration is what costs the decision.* Block, not advise: the rule fires
452
+ only on commands that were going to be decided out of band anyway, so blocking
453
+ converts that decision into a durable steer at no extra cost, and an advise would *grant* the
265
454
  decorated command (its extra segments the allowlist never reviewed).
266
455
  **Bare leads only:** a glob-headed family (`Bash(git log:*)`) coexists with
267
456
  allowlisted decorators, so only an exact bare entry qualifies as the lead;
268
457
  widening to glob leads is possible later without a new name. **Never
269
458
  intercepts a silent grant:** the harness matches per segment, so a compound
270
- whose every segment matches the committed allowlist is granted without a
271
- prompt and blocking it would regress — the rule therefore fires only when a
459
+ whose every segment matches the committed allowlist resolves on the match
460
+ and blocking it would regress — the rule therefore fires only when a
272
461
  non-leading segment (or a redirect on the lead) fails to match any committed
273
462
  allow entry, reusing `guard_allow_match`'s shell-glob semantics. Reads
274
463
  `GUARD_KIT_SETTINGS`; **fail-open** — no `jq`, no settings file, or a
275
464
  parse error and the rule silently declines and falls through. Placed after
276
465
  the auto-allow rules (12, 13) so a silently granted read-only pipeline never
277
- reaches it.
466
+ reaches it — which is also **why the allowlisted-lead grant lives in rule 13
467
+ and not here**. Grant, not fall-through, is what removes the friction of an
468
+ allowlisted command decorated only by a read-only reduction of its own
469
+ output, and this rule's own text refuses to grant, correctly: granting here
470
+ would bless segments the allowlist never reviewed. Rule 13 is already the
471
+ sanctioned place for a grant of exactly that shape and is already ordered
472
+ ahead of this rule, so a granted pipeline never arrives and nothing
473
+ ungranted becomes granted that either half would not have granted alone.
474
+ Declares `sq dq hd`.
278
475
  15. **Git history-rewrite advisory** — a `git commit` carrying `--amend`, `-F`,
279
476
  or `--file`, or a `git reset --soft`, gets a `guard_advise` steer carrying
280
477
  the checklist from DOCTRINE.md's *Re-verify volatile state before a git
@@ -297,8 +494,8 @@ load-bearing where noted.
297
494
  lands only via a later `git add -A` — the form the shared-index discipline
298
495
  warns against, since it sweeps a concurrent session's foreign path into the
299
496
  commit. Block, not advise, on rule 14's reasoning: no consumer allowlist is
300
- presumed to grant `rm`, so the rule fires on a command that would prompt
301
- anyway and converts the prompt into a durable steer. Fires per statement
497
+ presumed to grant `rm`, so the rule fires on a command that would be decided
498
+ out of band anyway and converts that decision into a durable steer. Fires per statement
302
499
  (`;`/`&&`/`||`/`|` split), so a decorated form steers on the same premise as
303
500
  the bare one. Conservative by construction: expansions and backticks decline
304
501
  outright (rule 6 already blocks them), option words are skipped, and a
@@ -320,9 +517,11 @@ steering rule must precede the broader rule that would catch the same
320
517
  command less precisely. A third, on the match surface: a substring rule
321
518
  sees the entire tool input, heredoc bodies included, so prose that merely
322
519
  *names* a guarded command — a `git commit -F -` message describing one —
323
- false-blocks. Match against a quote-stripped copy of the command (quoted
324
- spans may then name anything), and keep longer prose out of the match
325
- surface via a quoted `-m` span or a `-F <file>` the hook never reads.
520
+ false-blocks. Match against a `guard_skeleton` view naming the classes inert
521
+ for the rule (`sq dq hd` for any rule that does not itself test for an
522
+ expansion), which neutralizes quoted spans and heredoc bodies alike, and keep
523
+ longer prose out of the match surface via a quoted `-m` span or a `-F <file>`
524
+ the hook never reads.
326
525
 
327
526
  ## scratch-run
328
527
 
@@ -330,7 +529,7 @@ surface via a quoted `-m` span or a `-F <file>` the hook never reads.
330
529
  themselves open. The generic ruleset pushes probes and multi-line sweeps
331
530
  into the consumer's gitignored scratch dir (`GATE_SDK_TMP_DIR`) and refuses
332
531
  the harness scratchpad by name — yet nothing allowlists *executing* what
333
- lands there, so every run of a steered-to script prompts, forever. The
532
+ lands there, so every run of a steered-to script is decided out of band, forever. The
334
533
  runner is the fixed, allowlistable path that ends it: given a target inside
335
534
  the scratch dir it **echoes the script's contents to stdout** (a header
336
535
  naming the path, then the body), then **executes it**, passing stdout,
@@ -340,7 +539,7 @@ without interpreting them.
340
539
  The echo is the point, not a convenience. A bare scratch-glob allowlist
341
540
  would auto-approve executing any script at that path with its contents
342
541
  visible only in an earlier write call — turning a visible command into a
343
- silent *and* opaque one, the opposite of what the prompt was buying.
542
+ silent *and* opaque one, the opposite of what the permission decision was buying.
344
543
  Echo-at-execution makes the silent run **self-documenting**: the executed
345
544
  lines land in the transcript at the moment they run, which is the evidence
346
545
  surface a supervisor's post-commit review reads. Steering the agent to
@@ -357,14 +556,14 @@ as a convenience: the generic rules that would refuse an expansion-bearing
357
556
  one-liner do not reach the same code once it sits inside a scratch file.
358
557
  The echoed body is the **compensating control**, and it relocates review
359
558
  rather than removing it — from *before* execution, where the permission
360
- prompt put it, to *after*, in the transcript a supervisor reads. That is
559
+ decision put it, to *after*, in the transcript a supervisor reads. That is
361
560
  the actual posture of the entry, and a consumer unwilling to move review
362
- downstream should simply not add it: the tool still runs without it, and
363
- still prompts.
561
+ downstream should simply not add it: the tool still runs without it, and its
562
+ runs still take that decision.
364
563
 
365
564
  **Fail-closed on reach.** A target resolving outside the scratch dir is
366
565
  refused before any echo or execution, so the tool cannot become a general
367
- "run this arbitrary path without a prompt" bypass: its reach is exactly the
566
+ "run this arbitrary path unreviewed" bypass: its reach is exactly the
368
567
  scratch surface the guard already steers into. The test reads the
369
568
  *resolved* path, never the spelling, so a traversal out of the dir refuses
370
569
  like any other outsider. Refusal, an absent target, and a missing argument
@@ -377,7 +576,7 @@ path is that consumer's settings, never a kit literal.
377
576
 
378
577
  ## scan-prompts
379
578
 
380
- Advisory: surfaces recurring permission-prompt sources from the friction
579
+ Advisory: surfaces recurring permission-friction sources from the friction
381
580
  log, filtering against **both** settings files (`GUARD_KIT_SETTINGS` and
382
581
  `GUARD_KIT_SETTINGS_LOCAL`) and the harness's built-in read-only git/docker
383
582
  auto-allows. Matching is **per compound segment**, the same surface the
@@ -387,6 +586,13 @@ spans a compound the harness would split and refuse — `Bash(git status:*)`
387
586
  against `git status && rm -rf x` — does not read as allowed and is counted as
388
587
  prompting.
389
588
 
589
+ **What "prompting" names in this tool's output.** The word is the tool's shipped
590
+ vocabulary and stays as it is; what it counts is the set of calls **nothing in the
591
+ allowlist grants**, whose decision the harness therefore made out of band. On a
592
+ harness that interrupts, that set is literally the prompts; on one that decides
593
+ another way, it is the same set under an inherited name. The count is the same
594
+ number either way, and it is the number the triage criterion reads.
595
+
390
596
  The friction log's fall-throughs split three ways:
391
597
  - **Committed-covered** — every segment matches the committed allowlist or a
392
598
  harness built-in. Silently granted, reinforced; off every list.
@@ -417,7 +623,50 @@ so one glob test covers both forms — the match core is `guard_allow_match`
417
623
  in `lib/guard.sh`, shared with rule 14. Read-only — reports candidates, never
418
624
  mutates (the operator prunes). It is the detector, not the policy: a
419
625
  non-redundant local entry can still be one-off junk worth pruning by
420
- judgment. `--count` emits the bare count.
626
+ judgment.
627
+
628
+ The tool asks a **second question over the same two files**: which local entries
629
+ are *too broad*. Redundancy asks whether a committed glob already grants a local
630
+ entry; breadth asks whether a local glob would auto-allow a command the consumer
631
+ called bad. Both are one call to `guard_allow_match` — the breadth question
632
+ simply swaps its arguments, `guard_allow_match <probe> <local-glob>`, so there is
633
+ no second matching implementation and the `:*` normalization is shared. The two
634
+ findings are reported as distinct sets, and breadth is advisory in the same sense
635
+ as redundancy: the report names the local glob and the one probe that witnesses
636
+ its breadth, and the operator disposes — narrow the glob, or record that the
637
+ breadth is intended.
638
+
639
+ The probe set is consumer config (`GUARD_KIT_BREADTH_PROBES`, §Layout and
640
+ configuration), and it is **probes rather than a roster**: each entry is a single
641
+ witness whose auto-allowance would be bad, not a member of a set claimed
642
+ complete. A missing probe costs one witness and can never produce a false green,
643
+ because no completeness is claimed — and nothing here may come to claim it, since
644
+ a report worded as coverage would be the false-confidence proxy gate-sdk/SPEC.md
645
+ §When a gate earns its place refuses. With no probes declared the breadth section
646
+ is omitted entirely rather than printed clean, so a consumer that declared no
647
+ vocabulary cannot read silence as coverage.
648
+
649
+ This is the criterion's home rather than a gate, and the placement is ruled
650
+ rather than defaulted: the subject is a gitignored per-machine file CI cannot
651
+ see, and the verdict is operator-intent-dependent (a blanket grant is fine in a
652
+ throwaway sandbox), which is the high-false-positive shape §When a gate earns its
653
+ place holds back for an attested miss. What replaces the gate is a scheduled
654
+ reader — §The close-stage triage step — the same mechanism the redundancy
655
+ criterion has relied on since it shipped.
656
+
657
+ **That ruling is about this subject, not about allow-list checking generally**,
658
+ and the boundary is stated because the section otherwise reads as covering the
659
+ whole surface and the next reader re-derives it. Both clauses are load-bearing
660
+ and both fail on the *committed* file: it is tracked, so CI sees it, and "does
661
+ this path exist" is a binary filesystem fact no operator intent can move. A
662
+ committed-allow-list predicate of that shape is therefore gated, and gated
663
+ elsewhere — context-kit/SPEC.md §check-settings-paths, with the kit that already
664
+ owns the committed settings file as a gate subject. This kit holds the three
665
+ `.permissions.allow[]` readers in the tree and still ships no gates; co-location
666
+ by parsing technique does not outrank placement by governed surface.
667
+
668
+ `--count` emits both bare counts on one line, redundancy first and breadth
669
+ second.
421
670
 
422
671
  ## wakeup-guard (template)
423
672
 
@@ -463,11 +712,20 @@ log — the advisory is transient, so nothing accrues for the close-stage triage
463
712
  its close-stage skill — it fills the tooling-friction placeholder in
464
713
  lifecycle-kit's close template. The step: run `scan-prompts`, resolve each
465
714
  recurring pattern by the triage criterion; review and delete the wakeup
466
- log if present; run `compare-settings-allow` and prune the listed local
467
- entries, then by judgment prune the remaining one-off exact-string local
715
+ log if present; run `compare-settings-allow` and take its **two**
716
+ dispositions — prune the listed redundant local entries, and for each entry the
717
+ breadth report names, either narrow the glob or record that its breadth is
718
+ intended — then by judgment prune the remaining one-off exact-string local
468
719
  entries and promote recurring safe patterns to the committed settings as
469
- globs; clear the friction log. Goal: the local set stays small and every
470
- durable pattern lives in the committed, reviewable allowlist.
720
+ globs; clear the friction log. Two judgments the reports cannot make sit in
721
+ that last step. An entry naming a **script path** rather than a fixed command is
722
+ not content-pinned — it grants whatever the file says at run time — and its
723
+ sanctioned form is `bin/scratch-run.sh` (§scratch-run), whose echo is the
724
+ compensating control; and widening the committed set is the consumer's call,
725
+ since a session does not widen its own auto-allow set on its own say-so. Goal: the local set stays small, every
726
+ durable pattern lives in the committed, reviewable allowlist, and no local glob
727
+ auto-allows a command the consumer declared bad. One step, two reports, one
728
+ reader — no new invocation point and no new schedule.
471
729
 
472
730
  The friction log is a capture-tier surface with no forcing function — nothing
473
731
  refuses a close that skips it — so it declares itself advisory on the
@@ -488,6 +746,8 @@ guard-kit/
488
746
  guard-tests/cases.tsv # expected-decision <TAB> command
489
747
  guard-tests/escalation-cases.tsv # expected-decision <TAB> to <TAB> message
490
748
  gate-tests/scratch-run.test.sh # bespoke unit test, run by gate-sdk's runner
749
+ gate-tests/scan-prompts.test.sh # bespoke unit test, run by gate-sdk's runner
750
+ gate-tests/compare-settings-allow.test.sh # bespoke unit test, run by gate-sdk's runner
491
751
  templates/bash-guard.sh # consumer copy: generic rules on, marked
492
752
  # consumer-rules section
493
753
  templates/wakeup-guard.sh
@@ -520,10 +780,19 @@ repo's layout as defaults):
520
780
  `${GATE_SDK_WORKFLOW_DIR:-.workflow}/wakeup-attempts.log`.
521
781
  - `GUARD_KIT_SETTINGS` — default `.claude/settings.json`.
522
782
  - `GUARD_KIT_SETTINGS_LOCAL` — default `.claude/settings.local.json`.
783
+ - `GUARD_KIT_BREADTH_PROBES` — array of permission-rule strings, each a witness
784
+ that a local glob is too broad (§compare-settings-allow); default empty, in
785
+ which case the breadth report is absent and the tool behaves exactly as it did
786
+ before the criterion shipped. Entries are full permission-rule strings rather
787
+ than bare commands, matching the settings vocabulary the tool already reads on
788
+ both sides, so a consumer can probe non-`Bash` rules with the same mechanism.
789
+ The kit ships **no** default probes: every string naming a command is the
790
+ consumer's vocabulary, never the kit's (CLAUDE.md §The provenance seam).
523
791
  - `GUARD_KIT_RO_SCRIPTS` — array of globs eligible for the
524
792
  absolute→relative rewrite (rule 4); default `("check-*.sh")`.
525
793
  - `GUARD_KIT_RO_BINS` — read-only pipeline roster (rule 13); default the
526
- grep/head/cat/find/jq family.
794
+ grep/head/cat/find/jq family, plus `xargs`, whose membership is qualified by
795
+ rule 13's discriminator rather than granting on the leads-with test alone.
527
796
  - `GUARD_KIT_SCRATCH_DIRS` — gitignored scratch dirs named in the
528
797
  rule-3 corrective message; default `(".tmp")`.
529
798
 
@@ -539,7 +808,24 @@ decision (`block`/`advise`/`allow`/`rewrite`/`fallthrough`) with a command;
539
808
  `bin/run-guard-tests.sh` feeds each through the template guard as hook JSON
540
809
  on stdin and asserts the exit code and output class, failing on any
541
810
  mismatch. Every generic rule carries at least one firing and one
542
- non-firing case (the fixture-pair discipline, transplanted).
811
+ non-firing case (the fixture-pair discipline, transplanted). Two substitutions
812
+ make a command expressible in one tab-separated cell: `@ROOT@` becomes the git
813
+ sandbox root, and `@NL@` becomes a newline — without the second a heredoc case
814
+ cannot be written at all, and the heredoc class would ship untested.
815
+
816
+ **The decision table is the instrument for any change to what the guard
817
+ refuses, and its red condition is not monotone.** A change that *narrows*
818
+ refusal cannot be cleared by inspection, because the table fails on a verdict
819
+ mismatch **in either direction** rather than on a violation count: every
820
+ existing case whose command carries a double-quoted brace, a heredoc, a banner
821
+ segment, or an allowlisted lead with a read-only tail must have its expected
822
+ column **re-derived**, never assumed still correct. `bin/scan-prompts.sh` cannot
823
+ substitute for it, and the reason is structural rather than a matter of
824
+ precision: `guard_block` exits 2 before `guard_log_fallthrough` runs, so a
825
+ blocked command never reaches `GUARD_KIT_LOG` and that report is blind to every
826
+ block the guard makes. A change converting a block into a grant therefore reads
827
+ as a pure improvement on the scan and as nothing at all — which is why the
828
+ table, not the scan, is what a narrowing change is measured on.
543
829
 
544
830
  The same runner drives the escalation-guard from a second table,
545
831
  `guard-tests/escalation-cases.tsv` (`<decision> <TAB> <to> <TAB> <message>`),
@@ -556,6 +842,14 @@ There is no `smoke/violation.sh`: the kit registers no gates, so no
556
842
  battery-reddening violation is craftable (gate-sdk/SPEC.md §Consumer smoke
557
843
  makes that file conditional on exactly this).
558
844
 
845
+ `compare-settings-allow`'s breadth criterion takes the same bespoke lane for the
846
+ same reason, at `gate-tests/compare-settings-allow.test.sh`: a firing probe
847
+ (a blanket local glob reported with its witness), a non-firing one (a narrow
848
+ entry reporting clean), and the empty-knob silence that proves the section is
849
+ omitted rather than printed clean. It drives the tool through
850
+ `GUARD_KIT_CONFIG_FILE` pointed at a sandbox config, so the consumer's own probe
851
+ array cannot leak into the fixture.
852
+
559
853
  A shipped `bin/` tool that is not a hook takes neither lane. `bin/scratch-run.sh`
560
854
  (§scratch-run) is tested by a bespoke unit test at
561
855
  `gate-tests/scratch-run.test.sh`, asserting echo-then-exec on an in-scratch