checkwright 0.22.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 (346) hide show
  1. package/README.md +687 -90
  2. package/lib/common/lock.sh +38 -9
  3. package/lib/common/profile.sh +33 -0
  4. package/lib/common/recipe.sh +49 -33
  5. package/lib/diff.sh +64 -0
  6. package/lib/doctor.sh +67 -42
  7. package/lib/init.sh +23 -31
  8. package/lib/uninstall.sh +212 -0
  9. package/lib/update.sh +34 -0
  10. package/package.json +2 -2
  11. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  12. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
  13. package/payload/canon-kit/README.md +1 -0
  14. package/payload/canon-kit/SPEC.md +410 -58
  15. package/payload/canon-kit/checks/check-amendment-queue.sh +1 -0
  16. package/payload/canon-kit/checks/check-comment-tier.gate +3 -0
  17. package/payload/canon-kit/checks/check-deprecation-task.gate +3 -0
  18. package/payload/canon-kit/checks/check-docs-cmd.gate +3 -0
  19. package/payload/canon-kit/checks/check-docs-link-convention.sh +1 -0
  20. package/payload/canon-kit/checks/check-install-claim.gate +3 -0
  21. package/payload/canon-kit/checks/check-knob-citation.gate +3 -0
  22. package/payload/canon-kit/checks/check-knob-default-coupling.sh +1 -0
  23. package/payload/canon-kit/checks/check-manifest-count.gate +3 -0
  24. package/payload/canon-kit/checks/check-manifest-temporal.gate +3 -0
  25. package/payload/canon-kit/checks/check-md-refs.gate +3 -0
  26. package/payload/canon-kit/checks/check-measured-claim.gate +3 -0
  27. package/payload/canon-kit/checks/check-payload-claim.gate +3 -0
  28. package/payload/canon-kit/checks/check-prose-enum.gate +3 -0
  29. package/payload/canon-kit/checks/check-prose-tells.sh +1 -0
  30. package/payload/canon-kit/checks/check-spec-derivable-section.gate +3 -0
  31. package/payload/canon-kit/checks/check-spec-dod-singleton.gate +3 -0
  32. package/payload/canon-kit/checks/check-spec-embedded-source.sh +1 -0
  33. package/payload/canon-kit/checks/check-spec-fence-balance.gate +3 -0
  34. package/payload/canon-kit/checks/check-spec-pointer.gate +3 -0
  35. package/payload/canon-kit/checks/check-surface-duplication.sh +1 -0
  36. package/payload/canon-kit/checks/check-todo-task-liveness.gate +3 -0
  37. package/payload/canon-kit/checks/check-tracking-claim.gate +3 -0
  38. package/payload/canon-kit/gate-tests/check-comment-tier/bad/.workflow/fixture-state.txt +4 -0
  39. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.gate +4 -0
  40. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.rs +5 -0
  41. package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +4 -0
  42. package/payload/canon-kit/gate-tests/check-comment-tier/bad/templates/bad-tmpl.sh +4 -0
  43. package/payload/canon-kit/gate-tests/check-comment-tier/good/.workflow/fixture-state.txt +3 -0
  44. package/payload/canon-kit/gate-tests/check-comment-tier/good/expect.txt +1 -1
  45. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.gate +4 -0
  46. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.rs +5 -0
  47. package/payload/canon-kit/gate-tests/check-comment-tier/good/templates/good-tmpl.sh +5 -0
  48. package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +3 -2
  49. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/.workflow/fixture-state.txt +3 -0
  50. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.gate +2 -0
  51. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.rs +4 -0
  52. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/expect.txt +3 -0
  53. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.sh +6 -5
  54. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/templates/tmpl.sh +5 -0
  55. package/payload/canon-kit/gate-tests/check-deprecation-task/good/.workflow/fixture-state.txt +3 -0
  56. package/payload/canon-kit/gate-tests/check-deprecation-task/good/expect.txt +1 -1
  57. package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.gate +2 -0
  58. package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.rs +4 -0
  59. package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.sh +6 -5
  60. package/payload/canon-kit/gate-tests/check-deprecation-task/good/templates/tmpl.sh +5 -0
  61. package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +4 -3
  62. package/payload/canon-kit/gate-tests/check-knob-citation.test.sh +2 -2
  63. package/payload/canon-kit/gate-tests/check-manifest-count/good/SPEC.md +4 -0
  64. package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +27 -5
  65. package/payload/canon-kit/gate-tests/check-md-refs.test.sh +61 -9
  66. package/payload/canon-kit/gate-tests/check-measured-claim/bad/SPEC.md +12 -0
  67. package/payload/canon-kit/gate-tests/check-measured-claim/bad/expect.txt +3 -0
  68. package/payload/canon-kit/gate-tests/check-measured-claim/bad/scripts/canon-config.sh +6 -0
  69. package/payload/canon-kit/gate-tests/check-measured-claim/good/SPEC.md +23 -0
  70. package/payload/canon-kit/gate-tests/check-measured-claim/good/expect.txt +1 -0
  71. package/payload/canon-kit/gate-tests/check-measured-claim/good/scripts/canon-config.sh +6 -0
  72. package/payload/canon-kit/gate-tests/check-measured-claim.test.sh +90 -0
  73. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +3 -3
  74. package/payload/canon-kit/gate-tests/check-spec-dod-singleton.test.sh +21 -7
  75. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/.workflow/fixture-state.txt +2 -0
  76. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.gate +2 -0
  77. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.rs +4 -0
  78. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +3 -0
  79. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/templates/tmpl.sh +5 -0
  80. package/payload/canon-kit/gate-tests/check-spec-pointer/good/.workflow/fixture-state.txt +2 -0
  81. package/payload/canon-kit/gate-tests/check-spec-pointer/good/expect.txt +1 -1
  82. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.gate +2 -0
  83. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.rs +4 -0
  84. package/payload/canon-kit/gate-tests/check-spec-pointer/good/templates/tmpl.sh +5 -0
  85. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/.workflow/fixture-state.txt +3 -0
  86. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.gate +2 -0
  87. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.rs +4 -0
  88. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/expect.txt +3 -0
  89. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/templates/tmpl.sh +5 -0
  90. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/.workflow/fixture-state.txt +3 -0
  91. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/expect.txt +1 -1
  92. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.gate +2 -0
  93. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.rs +4 -0
  94. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/templates/tmpl.sh +5 -0
  95. package/payload/canon-kit/gate-tests/check-tracking-claim.test.sh +1 -2
  96. package/payload/canon-kit/lib/spec.sh +91 -62
  97. package/payload/canon-kit/smoke/install.sh +1 -0
  98. package/payload/canon-kit/templates/SPEC-amendment.md +4 -1
  99. package/payload/context-kit/README.md +4 -1
  100. package/payload/context-kit/SPEC.md +143 -10
  101. package/payload/context-kit/bin/env-probe.sh +19 -6
  102. package/payload/context-kit/checks/check-brevity.sh +1 -0
  103. package/payload/context-kit/checks/check-footprint-fresh.sh +1 -0
  104. package/payload/context-kit/checks/check-memory-off.sh +1 -0
  105. package/payload/context-kit/checks/check-settings-paths.sh +94 -0
  106. package/payload/context-kit/checks/check-settings-pins.sh +1 -0
  107. package/payload/context-kit/gate-tests/check-settings-paths/bad/args +1 -0
  108. package/payload/context-kit/gate-tests/check-settings-paths/bad/expect.txt +3 -0
  109. package/payload/context-kit/gate-tests/check-settings-paths/bad/settings.json +12 -0
  110. package/payload/context-kit/gate-tests/check-settings-paths/bad/tools/real-tool.sh +4 -0
  111. package/payload/context-kit/gate-tests/check-settings-paths/good/args +1 -0
  112. package/payload/context-kit/gate-tests/check-settings-paths/good/expect.txt +1 -0
  113. package/payload/context-kit/gate-tests/check-settings-paths/good/settings.json +16 -0
  114. package/payload/context-kit/gate-tests/check-settings-paths/good/tools/real-tool.sh +4 -0
  115. package/payload/context-kit/index-tests/expected/toolfloor.txt +9 -0
  116. package/payload/context-kit/index-tests/toolfloor-cases.sh +20 -0
  117. package/payload/context-kit/lib/toolfloor.sh +15 -4
  118. package/payload/context-kit/smoke/agents-md.sh +12 -1
  119. package/payload/context-kit/smoke/install.sh +1 -0
  120. package/payload/delegation-kit/README.md +3 -3
  121. package/payload/delegation-kit/SPEC.md +116 -13
  122. package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +1 -0
  123. package/payload/delegation-kit/checks/check-gate-tamper.sh +1 -0
  124. package/payload/delegation-kit/checks/check-rule-citation.sh +1 -0
  125. package/payload/delegation-kit/templates/agent-execution.md +38 -14
  126. package/payload/delegation-kit/templates/statusline-usage.sh +23 -1
  127. package/payload/doctrine-kit/DOCTRINE.md +86 -12
  128. package/payload/doctrine-kit/README.md +7 -3
  129. package/payload/doctrine-kit/SPEC.md +102 -9
  130. package/payload/doctrine-kit/bin/install-doctrine.sh +83 -13
  131. package/payload/doctrine-kit/checks/check-doctrine-registration.sh +41 -11
  132. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/DOCTRINE.md +3 -0
  133. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/DOCTRINE.md +3 -0
  134. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +82 -2
  135. package/payload/doctrine-kit/smoke/install.sh +90 -0
  136. package/payload/drift-kit/SPEC.md +13 -4
  137. package/payload/drift-kit/bin/kfric.sh +21 -2
  138. package/payload/drift-kit/smoke/install.sh +28 -0
  139. package/payload/evidence-kit/checks/check-battery-roster.sh +1 -0
  140. package/payload/evidence-kit/checks/check-evidence-baseline.sh +1 -0
  141. package/payload/evidence-kit/checks/check-evidence-manifest.sh +1 -0
  142. package/payload/evidence-kit/checks/check-producer-liveness.sh +1 -0
  143. package/payload/gate-sdk/README.md +13 -0
  144. package/payload/gate-sdk/SPEC.md +2611 -151
  145. package/payload/gate-sdk/bin/build-native.sh +38 -0
  146. package/payload/gate-sdk/bin/enforcement-map.sh +2 -1
  147. package/payload/gate-sdk/bin/gen-pre-commit.sh +23 -3
  148. package/payload/gate-sdk/bin/port-blockers.sh +445 -0
  149. package/payload/gate-sdk/bin/run-consumer-smoke.sh +8 -1
  150. package/payload/gate-sdk/bin/run-gate-tests.sh +26 -5
  151. package/payload/gate-sdk/bin/run-gates.sh +8 -2
  152. package/payload/gate-sdk/bin/upgrade-smoke.sh +52 -4
  153. package/payload/gate-sdk/checks/check-action-gh-repo.gate +1 -0
  154. package/payload/gate-sdk/checks/check-action-pinning.gate +1 -0
  155. package/payload/gate-sdk/checks/check-action-run-shell.sh +1 -0
  156. package/payload/gate-sdk/checks/check-assertion-strength.gate +3 -0
  157. package/payload/gate-sdk/checks/check-commit-msg.sh +1 -0
  158. package/payload/gate-sdk/checks/check-commit-subject.sh +1 -0
  159. package/payload/gate-sdk/checks/check-core-files.sh +1 -0
  160. package/payload/gate-sdk/checks/check-crate-arms.sh +61 -0
  161. package/payload/gate-sdk/checks/check-enforcement-fresh.sh +1 -0
  162. package/payload/gate-sdk/checks/check-exec-bit.sh +1 -0
  163. package/payload/gate-sdk/checks/check-gate-assertions.sh +31 -6
  164. package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +2 -1
  165. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +1 -0
  166. package/payload/gate-sdk/checks/check-gate-fail-closed.sh +1 -0
  167. package/payload/gate-sdk/checks/check-gate-fixture-coverage.sh +1 -0
  168. package/payload/gate-sdk/checks/check-gate-output.sh +33 -3
  169. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +36 -5
  170. package/payload/gate-sdk/checks/check-graph.sh +1 -0
  171. package/payload/gate-sdk/checks/check-hook-exec-bit.sh +1 -0
  172. package/payload/gate-sdk/checks/check-identity.sh +1 -0
  173. package/payload/gate-sdk/checks/check-install-disposition.sh +92 -0
  174. package/payload/gate-sdk/checks/check-kit-enum.sh +1 -0
  175. package/payload/gate-sdk/checks/check-kit-registration.gate +3 -0
  176. package/payload/gate-sdk/checks/check-readme-roster.sh +1 -0
  177. package/payload/gate-sdk/checks/check-reads-couples.sh +3 -2
  178. package/payload/gate-sdk/checks/check-root-tiering.sh +1 -0
  179. package/payload/gate-sdk/checks/check-shellcheck.sh +1 -0
  180. package/payload/gate-sdk/checks/check-smoke-entry-guard.gate +3 -0
  181. package/payload/gate-sdk/checks/check-template-copy-parity.sh +1 -0
  182. package/payload/gate-sdk/checks/check-template-registry-parity.gate +3 -0
  183. package/payload/gate-sdk/checks/check-test-hermetic.gate +3 -0
  184. package/payload/gate-sdk/checks/check-tree-terms.sh +1 -0
  185. package/payload/gate-sdk/checks/check-workflow-tiering.sh +2 -1
  186. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/crate/Cargo.toml +7 -0
  187. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/crate/src/lib.rs +12 -0
  188. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/expect.txt +5 -0
  189. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/scripts/gate-sdk-config.sh +2 -0
  190. package/payload/gate-sdk/gate-tests/check-crate-arms/good/crate/Cargo.toml +7 -0
  191. package/payload/gate-sdk/gate-tests/check-crate-arms/good/crate/src/lib.rs +11 -0
  192. package/payload/gate-sdk/gate-tests/check-crate-arms/good/expect.txt +2 -0
  193. package/payload/gate-sdk/gate-tests/check-crate-arms/good/scripts/gate-sdk-config.sh +2 -0
  194. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -1
  195. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-native-sample.gate +3 -0
  196. package/payload/gate-sdk/gate-tests/check-gate-output/bad/expect.txt +3 -0
  197. package/payload/gate-sdk/gate-tests/check-gate-output/bad/gates.list +1 -0
  198. package/payload/gate-sdk/gate-tests/check-gate-output/bad/native/Cargo.toml +4 -0
  199. package/payload/gate-sdk/gate-tests/check-gate-output/bad/native/src/gates/native_sample.rs +7 -0
  200. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-native-sample.gate +3 -0
  201. package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -1
  202. package/payload/gate-sdk/gate-tests/check-gate-output/good/gates.list +1 -0
  203. package/payload/gate-sdk/gate-tests/check-gate-output/good/native/Cargo.toml +4 -0
  204. package/payload/gate-sdk/gate-tests/check-gate-output/good/native/src/gates/native_sample.rs +11 -0
  205. package/payload/gate-sdk/gate-tests/check-gate-output.test.sh +111 -0
  206. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +1 -1
  207. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +65 -4
  208. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-alpha.sh +6 -0
  209. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-delta.sh +5 -0
  210. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-epsilon.sh +6 -0
  211. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/smoke/install.sh +7 -0
  212. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/args +6 -0
  213. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/expect.txt +1 -0
  214. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/installer/lib/common/recipe.sh +9 -0
  215. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/scripts/gate-sdk-config.sh +5 -0
  216. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-alpha.sh +6 -0
  217. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-beta.gate +3 -0
  218. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-gamma.sh +6 -0
  219. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/smoke/install.sh +8 -0
  220. package/payload/gate-sdk/gate-tests/check-install-disposition/good/args +6 -0
  221. package/payload/gate-sdk/gate-tests/check-install-disposition/good/expect.txt +1 -0
  222. package/payload/gate-sdk/gate-tests/check-install-disposition/good/installer/lib/common/recipe.sh +10 -0
  223. package/payload/gate-sdk/gate-tests/check-install-disposition/good/scripts/gate-sdk-config.sh +5 -0
  224. package/payload/gate-sdk/gate-tests/check-kit-registration.test.sh +6 -5
  225. package/payload/gate-sdk/gate-tests/check-test-hermetic-smoke.test.sh +2 -3
  226. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +111 -1
  227. package/payload/gate-sdk/gate-tests/run-dispatch-streams.test.sh +73 -0
  228. package/payload/gate-sdk/lib/consumer-smoke.sh +24 -12
  229. package/payload/gate-sdk/lib/gate.sh +135 -11
  230. package/payload/gate-sdk/lib/inject.sh +25 -0
  231. package/payload/gate-sdk/lib/test-hermetic.sh +26 -0
  232. package/payload/gate-sdk/smoke/install.sh +42 -0
  233. package/payload/guard-kit/README.md +14 -11
  234. package/payload/guard-kit/SPEC.md +278 -62
  235. package/payload/guard-kit/bin/run-guard-tests.sh +1 -0
  236. package/payload/guard-kit/gate-tests/guard-read-path.test.sh +52 -0
  237. package/payload/guard-kit/guard-tests/cases.tsv +49 -7
  238. package/payload/guard-kit/lib/guard.sh +276 -54
  239. package/payload/guard-kit/templates/close-triage.md +5 -5
  240. package/payload/guard-kit/templates/settings-hooks.json +7 -1
  241. package/payload/lifecycle-kit/README.md +11 -1
  242. package/payload/lifecycle-kit/SPEC.md +441 -37
  243. package/payload/lifecycle-kit/bin/cite-survey.sh +81 -0
  244. package/payload/lifecycle-kit/bin/enter-stage.sh +126 -10
  245. package/payload/lifecycle-kit/bin/file-gap.sh +27 -10
  246. package/payload/lifecycle-kit/bin/file-survey.sh +21 -2
  247. package/payload/lifecycle-kit/checks/check-close-surfaces.sh +1 -0
  248. package/payload/lifecycle-kit/checks/check-gap-inbox-neutrality.gate +3 -0
  249. package/payload/lifecycle-kit/checks/check-lesson-disposition.gate +3 -0
  250. package/payload/lifecycle-kit/checks/check-lifecycle-registration.gate +3 -0
  251. package/payload/lifecycle-kit/checks/check-merge-attrs.gate +3 -0
  252. package/payload/lifecycle-kit/checks/check-scratch-citation.gate +3 -0
  253. package/payload/lifecycle-kit/checks/check-shim-restatement.gate +3 -0
  254. package/payload/lifecycle-kit/checks/check-skill-binding.gate +3 -0
  255. package/payload/lifecycle-kit/checks/check-stage-entry.sh +1 -0
  256. package/payload/lifecycle-kit/checks/check-stage-evidence.gate +3 -0
  257. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.gate +3 -0
  258. package/payload/lifecycle-kit/checks/check-survey-record.gate +3 -0
  259. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +1 -2
  260. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/args +2 -0
  261. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/expect.txt +3 -0
  262. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/gap-inbox.md +5 -0
  263. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/args +2 -0
  264. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/expect.txt +1 -0
  265. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/gap-inbox.md +4 -0
  266. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +2 -3
  267. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +2 -3
  268. package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +2 -3
  269. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/expect.txt +1 -0
  270. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/scripts/lifecycle-config.sh +4 -0
  271. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/surfaces/queue.md +13 -0
  272. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/expect.txt +1 -0
  273. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/scripts/lifecycle-config.sh +4 -0
  274. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/surfaces/queue.md +31 -0
  275. package/payload/lifecycle-kit/gate-tests/check-shim-restatement.test.sh +2 -3
  276. package/payload/lifecycle-kit/gate-tests/check-skill-binding.test.sh +2 -3
  277. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +2 -3
  278. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +9 -5
  279. package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +2 -3
  280. package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +54 -26
  281. package/payload/lifecycle-kit/gate-tests/rename-iteration.test.sh +142 -0
  282. package/payload/lifecycle-kit/gate-tests/workflow-state-guard.test.sh +100 -0
  283. package/payload/lifecycle-kit/lib/stages.sh +4 -0
  284. package/payload/lifecycle-kit/smoke/install.sh +67 -4
  285. package/payload/lifecycle-kit/templates/lead.md +36 -0
  286. package/payload/lifecycle-kit/templates/stages/close.md +30 -11
  287. package/payload/lifecycle-kit/templates/stages/scope.md +9 -4
  288. package/payload/lifecycle-kit/templates/stages/spec.md +5 -1
  289. package/payload/lifecycle-kit/templates/workflow-state-guard.sh +29 -0
  290. package/payload/queue-kit/README.md +3 -1
  291. package/payload/queue-kit/SPEC.md +123 -3
  292. package/payload/queue-kit/bin/queue-counts.sh +35 -0
  293. package/payload/queue-kit/checks/check-queue-entry-budget.gate +3 -0
  294. package/payload/queue-kit/checks/check-queue-hygiene.gate +3 -0
  295. package/payload/queue-kit/checks/check-queue-prose-precondition.sh +1 -0
  296. package/payload/queue-kit/checks/check-queue-sections.gate +3 -0
  297. package/payload/queue-kit/checks/check-queue-slug-liveness.gate +3 -0
  298. package/payload/queue-kit/checks/check-queue-wrap.gate +3 -0
  299. package/payload/queue-kit/checks/check-roadmap-fresh.sh +1 -0
  300. package/payload/queue-kit/checks/check-tag-lead-line.gate +3 -0
  301. package/payload/queue-kit/checks/check-task-conservation.gate +4 -0
  302. package/payload/queue-kit/checks/check-task-names.gate +3 -0
  303. package/payload/queue-kit/gate-tests/queue-counts.test.sh +116 -0
  304. package/payload/queue-kit/gate-tests/queue-lib-parity.test.sh +215 -0
  305. package/payload/queue-kit/lib/queue.sh +4 -19
  306. package/payload/site-kit/SPEC.md +23 -0
  307. package/payload/site-kit/checks/check-docs-cname-parity.sh +1 -0
  308. package/payload/site-kit/checks/check-docs-render-fidelity.sh +1 -0
  309. package/profiles.list +36 -8
  310. package/payload/canon-kit/checks/check-comment-tier.sh +0 -216
  311. package/payload/canon-kit/checks/check-deprecation-task.sh +0 -90
  312. package/payload/canon-kit/checks/check-docs-cmd.sh +0 -153
  313. package/payload/canon-kit/checks/check-install-claim.sh +0 -146
  314. package/payload/canon-kit/checks/check-knob-citation.sh +0 -117
  315. package/payload/canon-kit/checks/check-manifest-count.sh +0 -46
  316. package/payload/canon-kit/checks/check-manifest-temporal.sh +0 -83
  317. package/payload/canon-kit/checks/check-md-refs.sh +0 -128
  318. package/payload/canon-kit/checks/check-payload-claim.sh +0 -133
  319. package/payload/canon-kit/checks/check-prose-enum.sh +0 -115
  320. package/payload/canon-kit/checks/check-spec-derivable-section.sh +0 -69
  321. package/payload/canon-kit/checks/check-spec-dod-singleton.sh +0 -45
  322. package/payload/canon-kit/checks/check-spec-fence-balance.sh +0 -42
  323. package/payload/canon-kit/checks/check-spec-pointer.sh +0 -187
  324. package/payload/canon-kit/checks/check-todo-task-liveness.sh +0 -80
  325. package/payload/canon-kit/checks/check-tracking-claim.sh +0 -136
  326. package/payload/gate-sdk/checks/check-assertion-strength.sh +0 -134
  327. package/payload/gate-sdk/checks/check-kit-registration.sh +0 -68
  328. package/payload/gate-sdk/checks/check-smoke-entry-guard.sh +0 -53
  329. package/payload/gate-sdk/checks/check-template-registry-parity.sh +0 -81
  330. package/payload/gate-sdk/checks/check-test-hermetic.sh +0 -119
  331. package/payload/lifecycle-kit/checks/check-lesson-disposition.sh +0 -98
  332. package/payload/lifecycle-kit/checks/check-lifecycle-registration.sh +0 -54
  333. package/payload/lifecycle-kit/checks/check-merge-attrs.sh +0 -69
  334. package/payload/lifecycle-kit/checks/check-shim-restatement.sh +0 -97
  335. package/payload/lifecycle-kit/checks/check-skill-binding.sh +0 -59
  336. package/payload/lifecycle-kit/checks/check-stage-evidence.sh +0 -81
  337. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.sh +0 -47
  338. package/payload/lifecycle-kit/checks/check-survey-record.sh +0 -102
  339. package/payload/queue-kit/checks/check-queue-entry-budget.sh +0 -106
  340. package/payload/queue-kit/checks/check-queue-hygiene.sh +0 -81
  341. package/payload/queue-kit/checks/check-queue-sections.sh +0 -44
  342. package/payload/queue-kit/checks/check-queue-slug-liveness.sh +0 -63
  343. package/payload/queue-kit/checks/check-queue-wrap.sh +0 -56
  344. package/payload/queue-kit/checks/check-tag-lead-line.sh +0 -70
  345. package/payload/queue-kit/checks/check-task-conservation.sh +0 -50
  346. package/payload/queue-kit/checks/check-task-names.sh +0 -128
@@ -3,17 +3,18 @@
3
3
  Permission-friction reduction for coding-agent sessions. A `PreToolUse` guard
4
4
  decides at call time — **block** with a corrective message, **steer** to a
5
5
  better form, **rewrite** to the allowlisted spelling, **auto-allow** the
6
- provably safe, or log the fall-through — a scanner ranks what actually
7
- prompted, a curation tool finds the redundant local overrides, and a
6
+ provably safe, or log the fall-through — a scanner ranks what the allowlist
7
+ failed to cover, a curation tool finds the redundant local overrides, and a
8
8
  close-stage triage step makes the whole loop a habit.
9
9
 
10
- Why: a permission prompt the human approves is invisible to the agent — nothing
11
- lands in the transcript, so the agent cannot notice, count, or fix the friction
12
- it causes. The cost lands on the operator, silently and per-prompt, and
13
- compounds as the command surface grows. The kit closes the loop by making the
14
- fall-through set — exactly the commands that may have prompted — the one thing
15
- that *is* recorded. See [SPEC.md](SPEC.md) for the framework, the generic
16
- ruleset, and the triage criterion.
10
+ Why: a command no allowlist entry matches is decided **out of band** — by
11
+ interrupting a human, or by a model asked to judge the call — and that decision
12
+ is invisible to the agent either way, so it cannot notice, count, or fix the
13
+ friction it causes. The cost is paid per call, out of the operator's attention or
14
+ out of latency and tokens, and compounds as the command surface grows. The kit
15
+ closes the loop by making the fall-through set — exactly the commands nothing
16
+ granted — the one thing that *is* recorded. See [SPEC.md](SPEC.md) for the
17
+ framework, the generic ruleset, what the steering buys, and the triage criterion.
17
18
 
18
19
  Unlike the other kits, guard-kit registers **no gates**: its surfaces are
19
20
  hooks and advisory `bin/` tools, so nothing joins `gates.list`. It follows
@@ -37,7 +38,9 @@ Vendor the kit beside [gate-sdk](../gate-sdk/), then:
37
38
 
38
39
  2. Wire the hooks — merge `templates/settings-hooks.json` into
39
40
  `.claude/settings.json` (the `bash-guard` on `PreToolUse(Bash)`; the optional
40
- `wakeup-guard` on `ScheduleWakeup|CronCreate`).
41
+ `wakeup-guard` on `ScheduleWakeup|CronCreate`; and an optional third block
42
+ showing the path-shaped shape a consumer kit's own guard registers under —
43
+ lifecycle-kit's `workflow-state-guard` is the shipped instance).
41
44
 
42
45
  3. Gitignore the two scratch logs (`.workflow/prompt-friction.log`,
43
46
  `.workflow/wakeup-attempts.log`) — both are per-iteration, cleared at close.
@@ -54,7 +57,7 @@ its contents are your project's vocabulary, not the kit's.
54
57
  ## Use
55
58
 
56
59
  ```bash
57
- bash guard-kit/bin/scan-prompts.sh # rank what prompted, filtered by the allowlist
60
+ bash guard-kit/bin/scan-prompts.sh # rank what nothing granted, filtered by the allowlist
58
61
  bash guard-kit/bin/scan-prompts.sh --count # <patterns>/<occurrences> token (drift KPI)
59
62
  bash guard-kit/bin/compare-settings-allow.sh # local-overlay entries a committed glob already grants, and those a probe proves too broad
60
63
  ```
@@ -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,9 +27,9 @@ 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
@@ -40,6 +43,40 @@ conventions without depending on its registry.
40
43
  local `settings.local.json` stays near-empty, and the guard encodes the
41
44
  steering rules no static glob can express.
42
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
+
43
80
  ### The triage criterion
44
81
 
45
82
  Allowlist and guard are two tools with distinct jobs — resolve each
@@ -59,7 +96,7 @@ exists, steer to it in the guard rather than permitting the worse one.
59
96
  Note: the harness matches the allowlist **per segment** of a compound
60
97
  command, so a glob on the core command does not cover the `echo` banners,
61
98
  `wc`, redirects, or `;`-chained diagnostics wrapped around it — one
62
- 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
63
100
  tools an agent habitually chains (`echo`, `wc`, `grep`, `ls`, `command -v`)
64
101
  are therefore themselves legitimate allowlist entries; allowlist them, or
65
102
  run the core command bare.
@@ -72,6 +109,14 @@ Primitives a consumer guard composes; each emits the harness's
72
109
  - `guard_read_command` — parse the hook JSON on stdin, emit the command;
73
110
  **fail-open** on any parse problem (exit 0) so a guard can never wedge
74
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.
75
120
  - `guard_block <msg>` — exit 2 with the message on stderr. Every block
76
121
  message is self-describing: it names the offending pattern *and* the
77
122
  corrective form, so the why of a rule rides to the agent in the rejection
@@ -89,15 +134,73 @@ Primitives a consumer guard composes; each emits the harness's
89
134
  hook primitive — a shared helper, one implementation behind
90
135
  compare-settings-allow's redundancy detection and rule 14's silent-grant
91
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.
92
151
  - `guard_split_compound <skeleton>` — the compound splitter: emits one segment
93
152
  per line, splitting on the harness's statement separators (`;`, `&&`, `||`,
94
153
  `|`). Also not a hook primitive — the single implementation every consumer
95
- that reasons *per segment* shares (rules 8/14/16, the read-compound carve-out
96
- of rules 9/10, and scan-prompts' `allowed()`), so the harness's per-segment
97
- matching surface is modelled in exactly one place and cannot drift between
98
- them. Fed a quote-stripped skeleton (`'…'`/`"…"` regions already neutralized
99
- by the caller, as every rule does), so a separator inside a quoted argument is
100
- 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.
101
204
 
102
205
  Fail-open is the default posture. The one sanctioned fail-closed shape is a
103
206
  deny-guard whose hook *matcher* already proves the tool identity (see
@@ -126,6 +229,18 @@ dispatch-shape rules; guard-kit mechanism **does** move for that one, by
126
229
  exactly one clause — the fail-open-but-loud posture above, which it is the
127
230
  shipped instance of (delegation-kit/SPEC.md §The delegation model).
128
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).
243
+
129
244
  ## Consumer rules
130
245
 
131
246
  A consumer's project-specific block/steer/allow rules live in its copy of
@@ -146,12 +261,12 @@ Rules that encode **harness behavior**, not any project's toolchain —
146
261
  shipped as `lib/guard.sh` functions the template guard invokes. Order is
147
262
  load-bearing where noted.
148
263
 
149
- 1. **`cd` in a compound command** — blocked: cwd drift plus a permission
150
- prompt no allowlist entry suppresses. Corrective form: absolute paths,
151
- 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.
152
267
  2. **`git -C <repo-root>` when cwd is the root** — blocked: the absolute
153
- `-C` target matches no allowlist entry and re-prompts, while the bare
154
- `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
155
270
  root, so `git -C <root>/subdir` and a foreign-repo `-C` are untouched.
156
271
  3. **Bare-name scratch redirect** — a `>`/`>>` to a slash-free
157
272
  `*.err`/`*.out`/`*.log` target is blocked (it lands in the tracked tree
@@ -168,16 +283,35 @@ load-bearing where noted.
168
283
  the literal repo-root prefix is steered to the repo-relative spelling.
169
284
  `git` is excluded — rule 2 already owns its `-C` handling.
170
285
  6. **Shell expansion / assignment** — a residual `${…}`/`$(…)`/`<(…)`/
171
- `$NAME` after single-quoted regions are stripped is blocked (the harness
172
- prompts on every expansion before allowlist matching). Only
173
- *single*-quoted regions are stripped: inside single quotes `$` is
174
- literal (`awk '$1'`), but a double-quoted `"$x"` still expands and must
175
- stay visible. A standalone `NAME=value` assignment is caught separately,
176
- since the expansion check only sees a *used* `$VAR`.
177
- 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
178
301
  before allowlist matching, the same behavior class rule 6 pre-empts for
179
- `$`-expansions, so a `{` surviving rule 6's single-quote strip is handled
180
- 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 {} +`,
181
315
  `xargs -I{}`), when every residual brace is exactly `{}`, is rewritten
182
316
  via `guard_rewrite` — each `{}` single-quoted to `'{}'`,
183
317
  behavior-preserving (the shell passes a literal `{}` either way) and
@@ -186,12 +320,12 @@ load-bearing where noted.
186
320
  git-ref shorthand (`@{u}`, `@{-n}`, `<ref>@{n}`) names the explicit
187
321
  spelling (`origin/<branch>..HEAD`, or the resolved ref/hash);
188
322
  list/range (`{a,b}`, `{a..b}`) names the spelled-out members or a loop;
189
- any other residual `{` gets the generic corrective (single-quote if
190
- literal — an awk/sed program in double quotes — write it out if it
191
- expands). There is no legitimate brace-glob convenience to preserve:
192
- since every bare `{` already costs an operator prompt no allowlist entry
193
- can suppress, block-and-steer strictly dominates; only single-quoted
194
- (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**
195
329
  so their literal-target premise holds for braces as well.
196
330
  8. **`sed` reading or rewriting a file** — blocked with the steer to the
197
331
  harness's file tools: `sed -i` (or any short bundle carrying `i`) to the
@@ -260,40 +394,84 @@ load-bearing where noted.
260
394
  unrecognized option-with-argument or a glued pattern flag biases toward
261
395
  passing, never a false steer of a history search.
262
396
  12. **Auto-allow `: > file` truncation** — a leading `:` plus redirect
263
- defeats the permission matcher, so it always prompts. Granted silently
264
- 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
265
399
  gitignored (`git check-ignore`): truncating scratch is safe; a tracked
266
- 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
267
401
  `:`-redirect match; expansions (rule 6) and brace forms (rule 7) are
268
402
  already blocked, so a surviving target is a literal path.
269
403
  13. **Auto-allow read-only pipeline** — granted silently when every pipe
270
404
  segment leads with a roster binary (`GUARD_KIT_RO_BINS`, default the
271
405
  grep/head/cat/find/jq family) and every redirect target is `/dev/null`
272
- or an fd-dup. Conservative by construction: command/process
273
- substitution, a leftover quote after stripping, any statement separator,
274
- a non-`/dev/null` redirect, or a `find` with a write action all refuse
275
- 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.
276
445
  14. **Decorated allowlisted command** — the leading command exactly matches a
277
446
  committed **bare** allow entry (a `Bash(<cmd>)` with no `:*`/`*` glob) but
278
447
  the command decorates it — `&&`/`;`/`|` chaining, a trailing redirect, or
279
- `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.
280
450
  **Blocked** with the steer *run it bare — the bare form is statically
281
- allowed; the decoration forces a prompt.* Block, not advise: the rule fires
282
- only on commands that would prompt anyway, so blocking converts the prompt
283
- 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
284
454
  decorated command (its extra segments the allowlist never reviewed).
285
455
  **Bare leads only:** a glob-headed family (`Bash(git log:*)`) coexists with
286
456
  allowlisted decorators, so only an exact bare entry qualifies as the lead;
287
457
  widening to glob leads is possible later without a new name. **Never
288
458
  intercepts a silent grant:** the harness matches per segment, so a compound
289
- whose every segment matches the committed allowlist is granted without a
290
- 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
291
461
  non-leading segment (or a redirect on the lead) fails to match any committed
292
462
  allow entry, reusing `guard_allow_match`'s shell-glob semantics. Reads
293
463
  `GUARD_KIT_SETTINGS`; **fail-open** — no `jq`, no settings file, or a
294
464
  parse error and the rule silently declines and falls through. Placed after
295
465
  the auto-allow rules (12, 13) so a silently granted read-only pipeline never
296
- 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`.
297
475
  15. **Git history-rewrite advisory** — a `git commit` carrying `--amend`, `-F`,
298
476
  or `--file`, or a `git reset --soft`, gets a `guard_advise` steer carrying
299
477
  the checklist from DOCTRINE.md's *Re-verify volatile state before a git
@@ -316,8 +494,8 @@ load-bearing where noted.
316
494
  lands only via a later `git add -A` — the form the shared-index discipline
317
495
  warns against, since it sweeps a concurrent session's foreign path into the
318
496
  commit. Block, not advise, on rule 14's reasoning: no consumer allowlist is
319
- presumed to grant `rm`, so the rule fires on a command that would prompt
320
- 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
321
499
  (`;`/`&&`/`||`/`|` split), so a decorated form steers on the same premise as
322
500
  the bare one. Conservative by construction: expansions and backticks decline
323
501
  outright (rule 6 already blocks them), option words are skipped, and a
@@ -339,9 +517,11 @@ steering rule must precede the broader rule that would catch the same
339
517
  command less precisely. A third, on the match surface: a substring rule
340
518
  sees the entire tool input, heredoc bodies included, so prose that merely
341
519
  *names* a guarded command — a `git commit -F -` message describing one —
342
- false-blocks. Match against a quote-stripped copy of the command (quoted
343
- spans may then name anything), and keep longer prose out of the match
344
- 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.
345
525
 
346
526
  ## scratch-run
347
527
 
@@ -349,7 +529,7 @@ surface via a quoted `-m` span or a `-F <file>` the hook never reads.
349
529
  themselves open. The generic ruleset pushes probes and multi-line sweeps
350
530
  into the consumer's gitignored scratch dir (`GATE_SDK_TMP_DIR`) and refuses
351
531
  the harness scratchpad by name — yet nothing allowlists *executing* what
352
- 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
353
533
  runner is the fixed, allowlistable path that ends it: given a target inside
354
534
  the scratch dir it **echoes the script's contents to stdout** (a header
355
535
  naming the path, then the body), then **executes it**, passing stdout,
@@ -359,7 +539,7 @@ without interpreting them.
359
539
  The echo is the point, not a convenience. A bare scratch-glob allowlist
360
540
  would auto-approve executing any script at that path with its contents
361
541
  visible only in an earlier write call — turning a visible command into a
362
- 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.
363
543
  Echo-at-execution makes the silent run **self-documenting**: the executed
364
544
  lines land in the transcript at the moment they run, which is the evidence
365
545
  surface a supervisor's post-commit review reads. Steering the agent to
@@ -376,14 +556,14 @@ as a convenience: the generic rules that would refuse an expansion-bearing
376
556
  one-liner do not reach the same code once it sits inside a scratch file.
377
557
  The echoed body is the **compensating control**, and it relocates review
378
558
  rather than removing it — from *before* execution, where the permission
379
- 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
380
560
  the actual posture of the entry, and a consumer unwilling to move review
381
- downstream should simply not add it: the tool still runs without it, and
382
- still prompts.
561
+ downstream should simply not add it: the tool still runs without it, and its
562
+ runs still take that decision.
383
563
 
384
564
  **Fail-closed on reach.** A target resolving outside the scratch dir is
385
565
  refused before any echo or execution, so the tool cannot become a general
386
- "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
387
567
  scratch surface the guard already steers into. The test reads the
388
568
  *resolved* path, never the spelling, so a traversal out of the dir refuses
389
569
  like any other outsider. Refusal, an absent target, and a missing argument
@@ -396,7 +576,7 @@ path is that consumer's settings, never a kit literal.
396
576
 
397
577
  ## scan-prompts
398
578
 
399
- Advisory: surfaces recurring permission-prompt sources from the friction
579
+ Advisory: surfaces recurring permission-friction sources from the friction
400
580
  log, filtering against **both** settings files (`GUARD_KIT_SETTINGS` and
401
581
  `GUARD_KIT_SETTINGS_LOCAL`) and the harness's built-in read-only git/docker
402
582
  auto-allows. Matching is **per compound segment**, the same surface the
@@ -406,6 +586,13 @@ spans a compound the harness would split and refuse — `Bash(git status:*)`
406
586
  against `git status && rm -rf x` — does not read as allowed and is counted as
407
587
  prompting.
408
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
+
409
596
  The friction log's fall-throughs split three ways:
410
597
  - **Committed-covered** — every segment matches the committed allowlist or a
411
598
  harness built-in. Silently granted, reinforced; off every list.
@@ -467,6 +654,17 @@ place holds back for an attested miss. What replaces the gate is a scheduled
467
654
  reader — §The close-stage triage step — the same mechanism the redundancy
468
655
  criterion has relied on since it shipped.
469
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
+
470
668
  `--count` emits both bare counts on one line, redundancy first and breadth
471
669
  second.
472
670
 
@@ -593,7 +791,8 @@ repo's layout as defaults):
593
791
  - `GUARD_KIT_RO_SCRIPTS` — array of globs eligible for the
594
792
  absolute→relative rewrite (rule 4); default `("check-*.sh")`.
595
793
  - `GUARD_KIT_RO_BINS` — read-only pipeline roster (rule 13); default the
596
- 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.
597
796
  - `GUARD_KIT_SCRATCH_DIRS` — gitignored scratch dirs named in the
598
797
  rule-3 corrective message; default `(".tmp")`.
599
798
 
@@ -609,7 +808,24 @@ decision (`block`/`advise`/`allow`/`rewrite`/`fallthrough`) with a command;
609
808
  `bin/run-guard-tests.sh` feeds each through the template guard as hook JSON
610
809
  on stdin and asserts the exit code and output class, failing on any
611
810
  mismatch. Every generic rule carries at least one firing and one
612
- 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.
613
829
 
614
830
  The same runner drives the escalation-guard from a second table,
615
831
  `guard-tests/escalation-cases.tsv` (`<decision> <TAB> <to> <TAB> <message>`),
@@ -57,6 +57,7 @@ while IFS=$'\t' read -r want cmd; do
57
57
  [[ -z "${want// }" ]] && continue
58
58
  [[ "$want" == \#* ]] && continue
59
59
  cmd="${cmd//@ROOT@/$SANDBOX}"
60
+ cmd="${cmd//@NL@/$'\n'}"
60
61
  json="$(jq -nc --arg c "$cmd" '{tool_input:{command:$c}}')"
61
62
  out="$(cd "$SANDBOX" && printf '%s' "$json" \
62
63
  | GUARD_KIT_LIB="$LIB" GUARD_KIT_LOG="$LOG" bash "$BASH_GUARD" 2>/dev/null)"
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env bash
2
+ # Direct unit test of lib/guard.sh's guard_read_path — the file-path counterpart
3
+ # of guard_read_command. The absent-field case is the discriminating one: an
4
+ # implementation returning success on a missing file_path passes the happy path
5
+ # and wedges every call its matcher covers, because a consumer reads the
6
+ # non-zero return as "not my call, fall through".
7
+ #
8
+ # Run by run-gate-tests.sh (any <tests-dir>/*.test.sh; must exit 0).
9
+ set -uo pipefail
10
+ source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
11
+
12
+ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # guard-kit/
13
+ # shellcheck source=../lib/guard.sh
14
+ source "$DIR/lib/guard.sh"
15
+
16
+ fails=0
17
+ checks=0
18
+
19
+ eq() { # $1=label $2=got $3=want
20
+ checks=$((checks + 1))
21
+ [[ "$2" == "$3" ]] || { echo " FAIL [$1]: got '$2', want '$3'"; fails=$((fails + 1)); }
22
+ }
23
+
24
+ # a Write payload: the path comes back verbatim, status 0
25
+ got="$(guard_read_path <<<'{"tool_name":"Write","tool_input":{"file_path":".workflow/WORKFLOW-STATE.txt","content":"x"}}')"; rc=$?
26
+ eq "write-path" "$got" ".workflow/WORKFLOW-STATE.txt"
27
+ eq "write-status" "$rc" "0"
28
+
29
+ # an Edit payload carries the same field — the accessor is tool-agnostic
30
+ got="$(guard_read_path <<<'{"tool_name":"Edit","tool_input":{"file_path":"/abs/x.md","old_string":"a","new_string":"b"}}')"
31
+ eq "edit-path" "$got" "/abs/x.md"
32
+
33
+ # the discriminating case: no file_path -> non-zero and no output
34
+ got="$(guard_read_path <<<'{"tool_name":"Bash","tool_input":{"command":"ls"}}')"; rc=$?
35
+ eq "absent-status" "$rc" "1"
36
+ eq "absent-output" "$got" ""
37
+
38
+ # an unparseable payload is the same fall-through, never a block
39
+ got="$(guard_read_path <<<'not json at all')"; rc=$?
40
+ eq "garbage-status" "$rc" "1"
41
+ eq "garbage-output" "$got" ""
42
+
43
+ # an empty file_path is absent, not a path
44
+ got="$(guard_read_path <<<'{"tool_input":{"file_path":""}}')"; rc=$?
45
+ eq "empty-status" "$rc" "1"
46
+
47
+ if [[ "$fails" -gt 0 ]]; then
48
+ echo "guard-read-path.test: $fails of $checks assertion(s) failed"
49
+ exit 1
50
+ fi
51
+ echo "guard-read-path.test: ok ($checks assertions; path extraction plus the absent/unparseable/empty fall-through contract)"
52
+ exit 0