checkwright 0.23.0 → 0.25.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 (375) hide show
  1. package/README.md +175 -13
  2. package/lib/common/lock.sh +7 -0
  3. package/lib/common/recipe.sh +1 -1
  4. package/lib/diff.sh +2 -0
  5. package/lib/init.sh +40 -16
  6. package/lib/uninstall.sh +2 -0
  7. package/package.json +2 -2
  8. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  9. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
  10. package/payload/canon-kit/README.md +2 -0
  11. package/payload/canon-kit/SPEC.md +454 -28
  12. package/payload/canon-kit/checks/check-amendment-queue.gate +3 -0
  13. package/payload/canon-kit/checks/check-amendment-update-target.gate +3 -0
  14. package/payload/canon-kit/checks/check-docs-link-convention.gate +3 -0
  15. package/payload/canon-kit/checks/check-knob-default-coupling.gate +3 -0
  16. package/payload/canon-kit/checks/check-prose-tells.gate +3 -0
  17. package/payload/canon-kit/checks/check-spec-embedded-source.gate +3 -0
  18. package/payload/canon-kit/checks/check-unmarked-claim.gate +3 -0
  19. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/SPEC-orphan.md +6 -0
  20. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/TASK-QUEUE.md +7 -2
  21. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/expect.txt +8 -0
  22. package/payload/canon-kit/gate-tests/check-amendment-update-target/bad/SPEC-thing.md +26 -0
  23. package/payload/canon-kit/gate-tests/check-amendment-update-target/bad/expect.txt +8 -0
  24. package/payload/canon-kit/gate-tests/check-amendment-update-target/good/SPEC-widget.md +47 -0
  25. package/payload/canon-kit/gate-tests/check-amendment-update-target/good/expect.txt +1 -0
  26. package/payload/canon-kit/gate-tests/check-amendment-update-target.test.sh +82 -0
  27. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.sh +3 -0
  28. package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +1 -0
  29. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
  30. package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +4 -4
  31. package/payload/canon-kit/gate-tests/check-knob-default-coupling.test.sh +2 -2
  32. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/SPEC-wire.md +18 -0
  33. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/expect.txt +3 -1
  34. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/widget.proto +13 -0
  35. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/SPEC-wire.md +22 -0
  36. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/SPEC.md +17 -0
  37. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/widget.proto +13 -0
  38. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/SPEC.md +11 -0
  39. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/expect.txt +3 -0
  40. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/scripts/canon-config.sh +6 -0
  41. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/SPEC.md +18 -0
  42. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/expect.txt +1 -0
  43. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/scripts/canon-config.sh +6 -0
  44. package/payload/canon-kit/gate-tests/check-unmarked-claim.test.sh +85 -0
  45. package/payload/canon-kit/lib/spec.sh +16 -0
  46. package/payload/canon-kit/smoke/install.sh +3 -1
  47. package/payload/canon-kit/templates/SPEC-amendment.md +17 -2
  48. package/payload/context-kit/README.md +6 -4
  49. package/payload/context-kit/SPEC.md +256 -76
  50. package/payload/context-kit/bin/always-loaded.sh +5 -21
  51. package/payload/context-kit/bin/env-probe.sh +2 -17
  52. package/payload/context-kit/checks/check-brevity.gate +3 -0
  53. package/payload/context-kit/checks/check-footprint-fresh.gate +3 -0
  54. package/payload/context-kit/checks/check-memory-off.gate +3 -0
  55. package/payload/context-kit/checks/check-settings-paths.gate +3 -0
  56. package/payload/context-kit/checks/check-settings-pins.gate +3 -0
  57. package/payload/context-kit/gate-tests/check-brevity.test.sh +3 -2
  58. package/payload/context-kit/gate-tests/check-memory-off/bad/scripts/context-config.sh +4 -0
  59. package/payload/context-kit/gate-tests/check-memory-off/good/scripts/context-config.sh +4 -0
  60. package/payload/context-kit/gate-tests/check-memory-off.test.sh +18 -4
  61. package/payload/context-kit/gate-tests/check-settings-pins.test.sh +70 -0
  62. package/payload/context-kit/index-tests/expected/toolfloor.txt +5 -5
  63. package/payload/context-kit/index-tests/toolfloor-cases.sh +5 -5
  64. package/payload/context-kit/lib/context.sh +56 -0
  65. package/payload/context-kit/lib/toolfloor.sh +1 -1
  66. package/payload/context-kit/smoke/agents-md.sh +16 -4
  67. package/payload/context-kit/smoke/install.sh +3 -2
  68. package/payload/context-kit/templates/session-context.sh +5 -5
  69. package/payload/delegation-kit/README.md +11 -1
  70. package/payload/delegation-kit/SPEC.md +652 -11
  71. package/payload/delegation-kit/bin/wait-probe.sh +184 -0
  72. package/payload/delegation-kit/checks/check-agent-tier-explicit.gate +3 -0
  73. package/payload/delegation-kit/checks/check-gate-tamper.gate +3 -0
  74. package/payload/delegation-kit/checks/check-rule-citation.gate +3 -0
  75. package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/added-exemptions +5 -0
  76. package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/expect.txt +2 -0
  77. package/payload/delegation-kit/gate-tests/check-gate-tamper.test.sh +108 -0
  78. package/payload/delegation-kit/gate-tests/subagent-stop-liveness.test.sh +99 -0
  79. package/payload/delegation-kit/smoke/install.sh +21 -1
  80. package/payload/delegation-kit/templates/agent-execution.md +88 -4
  81. package/payload/delegation-kit/templates/subagent-stop-liveness.sh +56 -0
  82. package/payload/doctrine-kit/SPEC.md +1 -1
  83. package/payload/doctrine-kit/checks/check-doctrine-registration.gate +3 -0
  84. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +2 -3
  85. package/payload/doctrine-kit/smoke/install.sh +17 -4
  86. package/payload/drift-kit/README.md +2 -2
  87. package/payload/drift-kit/SPEC.md +71 -7
  88. package/payload/drift-kit/bin/stage-economics.sh +1 -1
  89. package/payload/drift-kit/lib/drift.sh +43 -0
  90. package/payload/drift-kit/smoke/install.sh +21 -14
  91. package/payload/evidence-kit/README.md +3 -1
  92. package/payload/evidence-kit/SPEC.md +160 -19
  93. package/payload/evidence-kit/checks/check-battery-roster.gate +3 -0
  94. package/payload/evidence-kit/checks/check-evidence-baseline.gate +3 -0
  95. package/payload/evidence-kit/checks/check-evidence-manifest.gate +3 -0
  96. package/payload/evidence-kit/checks/check-producer-liveness.sh +42 -2
  97. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +4 -3
  98. package/payload/evidence-kit/gate-tests/check-evidence-baseline.test.sh +8 -5
  99. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/WORKFLOW-STATE.txt +1 -1
  100. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/scripts/evidence-config.sh +9 -0
  101. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/WORKFLOW-STATE.txt +1 -1
  102. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/scripts/evidence-config.sh +9 -0
  103. package/payload/evidence-kit/gate-tests/check-evidence-manifest.test.sh +6 -4
  104. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +42 -1
  105. package/payload/evidence-kit/lib/evidence.sh +2 -0
  106. package/payload/evidence-kit/smoke/install.sh +1 -1
  107. package/payload/gate-sdk/README.md +17 -9
  108. package/payload/gate-sdk/SPEC.md +4680 -295
  109. package/payload/gate-sdk/bin/build-native.sh +66 -1
  110. package/payload/gate-sdk/bin/install-hooks.sh +14 -2
  111. package/payload/gate-sdk/bin/port-blockers.sh +37 -9
  112. package/payload/gate-sdk/bin/run-gate-tests.sh +1 -2
  113. package/payload/gate-sdk/bin/run-gates.sh +137 -13
  114. package/payload/gate-sdk/bin/upgrade-smoke.sh +21 -16
  115. package/payload/gate-sdk/checks/check-action-run-shell.sh +2 -1
  116. package/payload/gate-sdk/checks/check-commit-msg.gate +3 -0
  117. package/payload/gate-sdk/checks/check-commit-subject.gate +3 -0
  118. package/payload/gate-sdk/checks/check-core-files.gate +3 -0
  119. package/payload/gate-sdk/checks/check-crate-arms.sh +1 -0
  120. package/payload/gate-sdk/checks/check-enforcement-fresh.gate +3 -0
  121. package/payload/gate-sdk/checks/check-exec-bit.gate +3 -0
  122. package/payload/gate-sdk/checks/check-gate-assertions.gate +3 -0
  123. package/payload/gate-sdk/checks/check-gate-binary-fresh.gate +3 -0
  124. package/payload/gate-sdk/checks/check-gate-exemption-tasks.gate +3 -0
  125. package/payload/gate-sdk/checks/check-gate-fail-closed.gate +3 -0
  126. package/payload/gate-sdk/checks/check-gate-fixture-coverage.gate +3 -0
  127. package/payload/gate-sdk/checks/check-gate-output.gate +3 -0
  128. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +132 -15
  129. package/payload/gate-sdk/checks/check-graph.gate +3 -0
  130. package/payload/gate-sdk/checks/check-hook-exec-bit.gate +3 -0
  131. package/payload/gate-sdk/checks/check-identity.gate +3 -0
  132. package/payload/gate-sdk/checks/check-install-disposition.sh +1 -0
  133. package/payload/gate-sdk/checks/check-kit-enum.gate +3 -0
  134. package/payload/gate-sdk/checks/check-readme-roster.gate +3 -0
  135. package/payload/gate-sdk/checks/check-reads-couples.gate +3 -0
  136. package/payload/gate-sdk/checks/check-root-tiering.gate +3 -0
  137. package/payload/gate-sdk/checks/check-shellcheck.sh +1 -0
  138. package/payload/gate-sdk/checks/check-template-copy-parity.gate +3 -0
  139. package/payload/gate-sdk/checks/check-tree-terms.gate +3 -0
  140. package/payload/gate-sdk/checks/check-workflow-tiering.gate +3 -0
  141. package/payload/gate-sdk/gate-tests/check-commit-subject.test.sh +17 -12
  142. package/payload/gate-sdk/gate-tests/check-core-files.test.sh +4 -5
  143. package/payload/gate-sdk/gate-tests/check-exec-bit/bad/dump.txt +2 -1
  144. package/payload/gate-sdk/gate-tests/check-exec-bit/bad/expect.txt +2 -1
  145. package/payload/gate-sdk/gate-tests/check-exec-bit/good/dump.txt +3 -0
  146. package/payload/gate-sdk/gate-tests/check-exec-bit/good/expect.txt +1 -1
  147. package/payload/gate-sdk/gate-tests/check-exec-bit.test.sh +3 -4
  148. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/expect.txt +5 -1
  149. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/SPEC.md +22 -0
  150. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-count.sh +11 -0
  151. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-extra.sh +14 -0
  152. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-zero.sh +7 -0
  153. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -1
  154. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/SPEC.md +27 -0
  155. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/check-qux.sh +13 -0
  156. package/payload/gate-sdk/gate-tests/check-gate-assertions.test.sh +117 -0
  157. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +26 -4
  158. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/args +6 -1
  159. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +2 -0
  160. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/kitroot/checks/check-vendored-descriptor.gate +4 -0
  161. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/kitroot/checks/check-vendored.sh +14 -0
  162. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/scripts/check-descriptor.gate +4 -0
  163. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/scripts/check-held.sh +8 -0
  164. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/args +8 -1
  165. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +3 -0
  166. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/kitroot/checks/check-vendored-descriptor.gate +4 -0
  167. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/kitroot/checks/check-vendored.sh +14 -0
  168. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/scripts/check-descriptor.gate +4 -0
  169. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/scripts/check-held.sh +8 -0
  170. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks.test.sh +77 -0
  171. package/payload/gate-sdk/gate-tests/check-gate-output.test.sh +4 -5
  172. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +9 -0
  173. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kit-spec.md +6 -0
  174. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +1 -0
  175. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-bare.sh +4 -0
  176. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-both.sh +5 -0
  177. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-heldtwice.sh +5 -0
  178. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-nospec.sh +4 -0
  179. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +2 -0
  180. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-twice.sh +5 -0
  181. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-ungrounded.sh +5 -0
  182. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +6 -0
  183. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +2 -1
  184. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kit-spec.md +12 -0
  185. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +1 -0
  186. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-held.sh +5 -0
  187. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +1 -0
  188. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +49 -4
  189. package/payload/gate-sdk/gate-tests/check-graph/bad/SPEC-example-gate.md +15 -5
  190. package/payload/gate-sdk/gate-tests/check-graph/bad/expect.txt +12 -0
  191. package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-example-gate.md +27 -5
  192. package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-second-gate.md +12 -0
  193. package/payload/gate-sdk/gate-tests/check-graph-cap.test.sh +5 -4
  194. package/payload/gate-sdk/gate-tests/check-graph-refs.test.sh +14 -12
  195. package/payload/gate-sdk/gate-tests/check-graph-theme.test.sh +43 -17
  196. package/payload/gate-sdk/gate-tests/check-graph-tree.test.sh +190 -0
  197. package/payload/gate-sdk/gate-tests/check-identity/bad/gh-hosts.yml +9 -0
  198. package/payload/gate-sdk/gate-tests/check-identity/bad/identity.conf +4 -2
  199. package/payload/gate-sdk/gate-tests/check-identity/bad/scripts/gate-sdk-config.sh +10 -0
  200. package/payload/gate-sdk/gate-tests/check-identity/good/gh-hosts.yml +11 -0
  201. package/payload/gate-sdk/gate-tests/check-identity/good/identity.conf +5 -1
  202. package/payload/gate-sdk/gate-tests/check-identity/good/scripts/gate-sdk-config.sh +10 -0
  203. package/payload/gate-sdk/gate-tests/check-identity.test.sh +114 -0
  204. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/check-native-sample.gate +3 -0
  205. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/gates.list +4 -1
  206. package/payload/gate-sdk/gate-tests/check-kit-enum/good/check-native-sample.gate +3 -0
  207. package/payload/gate-sdk/gate-tests/check-kit-enum/good/expect.txt +1 -1
  208. package/payload/gate-sdk/gate-tests/check-kit-enum/good/gates.list +5 -2
  209. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/args +3 -1
  210. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/delta-kit/README.md +15 -0
  211. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/delta-kit/checks/check-delta-one.gate +2 -0
  212. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/delta-kit/checks/check-delta-two.sh +3 -0
  213. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/expect.txt +3 -1
  214. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.sh +1 -1
  215. package/payload/gate-sdk/gate-tests/check-readme-roster/good/args +3 -1
  216. package/payload/gate-sdk/gate-tests/check-readme-roster/good/delta-kit/README.md +13 -0
  217. package/payload/gate-sdk/gate-tests/check-readme-roster/good/delta-kit/checks/check-delta-one.gate +2 -0
  218. package/payload/gate-sdk/gate-tests/check-readme-roster/good/epsilon-kit/README.md +14 -0
  219. package/payload/gate-sdk/gate-tests/check-readme-roster/good/epsilon-kit/checks/check-eps-one.sh +3 -0
  220. package/payload/gate-sdk/gate-tests/check-readme-roster/good/epsilon-kit/checks/check-eps-two.gate +2 -0
  221. package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.sh +1 -1
  222. package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +87 -89
  223. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/agent-budget-guard.sh +4 -0
  224. package/payload/gate-sdk/gate-tests/check-template-copy-parity.test.sh +56 -0
  225. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +5 -0
  226. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/multi.txt +4 -0
  227. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/second-leak.txt +2 -0
  228. package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -1
  229. package/payload/gate-sdk/gate-tests/check-tree-terms/good/patterns.list +3 -0
  230. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/anchored.txt +4 -0
  231. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/msg-patterns.list +2 -0
  232. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/msg-patterns.local.list +3 -0
  233. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/worktrees/vendored-note.txt +3 -0
  234. package/payload/gate-sdk/gate-tests/check-tree-terms.test.sh +94 -0
  235. package/payload/gate-sdk/gate-tests/declaration-lib-parity.test.sh +211 -0
  236. package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +16 -15
  237. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +94 -1
  238. package/payload/gate-sdk/lib/gate.sh +232 -25
  239. package/payload/gate-sdk/smoke/install.sh +28 -1
  240. package/payload/guard-kit/README.md +4 -3
  241. package/payload/guard-kit/SPEC.md +578 -47
  242. package/payload/guard-kit/bin/compare-settings-allow.sh +36 -12
  243. package/payload/guard-kit/bin/run-guard-tests.sh +27 -4
  244. package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +46 -1
  245. package/payload/guard-kit/gate-tests/git-mutation-under-producer.test.sh +105 -0
  246. package/payload/guard-kit/guard-tests/background-cases.tsv +14 -0
  247. package/payload/guard-kit/guard-tests/cases.tsv +67 -9
  248. package/payload/guard-kit/lib/guard.sh +361 -18
  249. package/payload/guard-kit/templates/bash-guard.sh +2 -0
  250. package/payload/guard-kit/templates/close-triage.md +10 -3
  251. package/payload/guard-kit/templates/guard-config.sh +3 -0
  252. package/payload/lifecycle-kit/README.md +3 -2
  253. package/payload/lifecycle-kit/SPEC.md +509 -77
  254. package/payload/lifecycle-kit/bin/enter-stage.sh +72 -33
  255. package/payload/lifecycle-kit/bin/file-gap.sh +2 -2
  256. package/payload/lifecycle-kit/checks/check-close-surfaces.gate +3 -0
  257. package/payload/lifecycle-kit/checks/check-stage-entry.gate +3 -0
  258. package/payload/lifecycle-kit/gate-tests/boundary-scratch-wipe.test.sh +4 -4
  259. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +1 -1
  260. package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/.workflow/WORKFLOW-STATE.txt +3 -3
  261. package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/.workflow/WORKFLOW-STATE.txt +3 -3
  262. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +22 -22
  263. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/.workflow/WORKFLOW-STATE.txt +2 -2
  264. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/.workflow/WORKFLOW-STATE.txt +2 -2
  265. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +120 -10
  266. package/payload/lifecycle-kit/gate-tests/gap-inbox-route.test.sh +123 -0
  267. package/payload/lifecycle-kit/gate-tests/rename-iteration.test.sh +11 -11
  268. package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +16 -5
  269. package/payload/lifecycle-kit/lib/stages.sh +5 -0
  270. package/payload/lifecycle-kit/smoke/install.sh +29 -15
  271. package/payload/lifecycle-kit/templates/lead.md +32 -0
  272. package/payload/lifecycle-kit/templates/stages/align.md +20 -2
  273. package/payload/lifecycle-kit/templates/stages/build.md +3 -3
  274. package/payload/lifecycle-kit/templates/stages/close.md +20 -6
  275. package/payload/lifecycle-kit/templates/stages/scope.md +20 -1
  276. package/payload/lifecycle-kit/templates/stages/spec.md +1 -1
  277. package/payload/lifecycle-kit/templates/stages/validate.md +1 -1
  278. package/payload/lifecycle-kit/templates/workflow-state-guard.sh +1 -1
  279. package/payload/queue-kit/README.md +10 -10
  280. package/payload/queue-kit/SPEC.md +379 -84
  281. package/payload/queue-kit/bin/queue-counts.sh +1 -1
  282. package/payload/queue-kit/checks/check-queue-entry-budget.gate +1 -1
  283. package/payload/queue-kit/checks/check-queue-prose-precondition.gate +3 -0
  284. package/payload/queue-kit/checks/check-roadmap-fresh.gate +3 -0
  285. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/TASK-QUEUE.md +15 -0
  286. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/expect.txt +2 -0
  287. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/TASK-QUEUE.md +7 -0
  288. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/expect.txt +4 -0
  289. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/expect.txt +1 -1
  290. package/payload/queue-kit/gate-tests/queue-counts.test.sh +1 -1
  291. package/payload/queue-kit/gate-tests/queue-index.test.sh +55 -119
  292. package/payload/queue-kit/gate-tests/roadmap.test.sh +22 -12
  293. package/payload/queue-kit/lib/queue.sh +0 -49
  294. package/payload/queue-kit/smoke/install.sh +1 -1
  295. package/payload/site-kit/SPEC.md +41 -2
  296. package/payload/site-kit/checks/check-docs-cname-parity.gate +3 -0
  297. package/payload/site-kit/checks/check-docs-render-fidelity.sh +1 -0
  298. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/args +5 -4
  299. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/args +6 -5
  300. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/checks/check-sample.gate +3 -0
  301. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/expect.txt +1 -1
  302. package/payload/site-kit/smoke/install.sh +1 -1
  303. package/payload/canon-kit/checks/check-amendment-queue.sh +0 -117
  304. package/payload/canon-kit/checks/check-docs-link-convention.sh +0 -79
  305. package/payload/canon-kit/checks/check-knob-default-coupling.sh +0 -240
  306. package/payload/canon-kit/checks/check-prose-tells.sh +0 -208
  307. package/payload/canon-kit/checks/check-spec-embedded-source.sh +0 -134
  308. package/payload/context-kit/bin/footprint.sh +0 -144
  309. package/payload/context-kit/checks/check-brevity.sh +0 -124
  310. package/payload/context-kit/checks/check-footprint-fresh.sh +0 -39
  311. package/payload/context-kit/checks/check-memory-off.sh +0 -113
  312. package/payload/context-kit/checks/check-settings-paths.sh +0 -94
  313. package/payload/context-kit/checks/check-settings-pins.sh +0 -111
  314. package/payload/context-kit/gate-tests/check-memory-off/bad/args +0 -1
  315. package/payload/context-kit/gate-tests/check-memory-off/good/args +0 -1
  316. package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +0 -62
  317. package/payload/delegation-kit/checks/check-gate-tamper.sh +0 -140
  318. package/payload/delegation-kit/checks/check-rule-citation.sh +0 -77
  319. package/payload/doctrine-kit/checks/check-doctrine-registration.sh +0 -246
  320. package/payload/drift-kit/bin/trajectory.sh +0 -242
  321. package/payload/evidence-kit/checks/check-battery-roster.sh +0 -87
  322. package/payload/evidence-kit/checks/check-evidence-baseline.sh +0 -104
  323. package/payload/evidence-kit/checks/check-evidence-manifest.sh +0 -105
  324. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/args +0 -3
  325. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/args +0 -3
  326. package/payload/gate-sdk/bin/enforcement-map.sh +0 -273
  327. package/payload/gate-sdk/checks/check-commit-msg.sh +0 -51
  328. package/payload/gate-sdk/checks/check-commit-subject.sh +0 -44
  329. package/payload/gate-sdk/checks/check-core-files.sh +0 -76
  330. package/payload/gate-sdk/checks/check-enforcement-fresh.sh +0 -38
  331. package/payload/gate-sdk/checks/check-exec-bit.sh +0 -96
  332. package/payload/gate-sdk/checks/check-gate-assertions.sh +0 -148
  333. package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +0 -107
  334. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +0 -106
  335. package/payload/gate-sdk/checks/check-gate-fail-closed.sh +0 -85
  336. package/payload/gate-sdk/checks/check-gate-fixture-coverage.sh +0 -93
  337. package/payload/gate-sdk/checks/check-gate-output.sh +0 -103
  338. package/payload/gate-sdk/checks/check-graph.sh +0 -632
  339. package/payload/gate-sdk/checks/check-hook-exec-bit.sh +0 -46
  340. package/payload/gate-sdk/checks/check-identity.sh +0 -135
  341. package/payload/gate-sdk/checks/check-kit-enum.sh +0 -95
  342. package/payload/gate-sdk/checks/check-readme-roster.sh +0 -108
  343. package/payload/gate-sdk/checks/check-reads-couples.sh +0 -200
  344. package/payload/gate-sdk/checks/check-root-tiering.sh +0 -67
  345. package/payload/gate-sdk/checks/check-template-copy-parity.sh +0 -127
  346. package/payload/gate-sdk/checks/check-tree-terms.sh +0 -66
  347. package/payload/gate-sdk/checks/check-workflow-tiering.sh +0 -85
  348. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/args +0 -1
  349. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/args +0 -1
  350. package/payload/gate-sdk/gate-tests/check-identity/bad/args +0 -1
  351. package/payload/gate-sdk/gate-tests/check-identity/good/args +0 -1
  352. package/payload/lifecycle-kit/bin/close-surfaces.sh +0 -94
  353. package/payload/lifecycle-kit/checks/check-close-surfaces.sh +0 -64
  354. package/payload/lifecycle-kit/checks/check-stage-entry.sh +0 -198
  355. package/payload/queue-kit/bin/queue-index.sh +0 -182
  356. package/payload/queue-kit/bin/roadmap.sh +0 -76
  357. package/payload/queue-kit/checks/check-queue-prose-precondition.sh +0 -64
  358. package/payload/queue-kit/checks/check-roadmap-fresh.sh +0 -111
  359. package/payload/site-kit/checks/check-docs-cname-parity.sh +0 -81
  360. /package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/{gates → scripts}/check-sample.sh +0 -0
  361. /package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/{gates → scripts}/check-sample.sh +0 -0
  362. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{check-gamma.sh → scripts/check-gamma.sh} +0 -0
  363. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{gate-tests → scripts/gate-tests}/check-alpha/bad/.keep +0 -0
  364. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{gate-tests → scripts/gate-tests}/check-alpha/good/.keep +0 -0
  365. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{gates.list → scripts/gates.list} +0 -0
  366. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{check-beta.sh → scripts/check-beta.sh} +0 -0
  367. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{gate-tests → scripts/gate-tests}/check-alpha/bad/.keep +0 -0
  368. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{gate-tests → scripts/gate-tests}/check-alpha/good/.keep +0 -0
  369. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{gates.list → scripts/gates.list} +0 -0
  370. /package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/{site-config.sh → scripts/site-config.sh} +0 -0
  371. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree → docs}/CNAME +0 -0
  372. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree → docs}/index.md +0 -0
  373. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree/docs → docs}/posts/2026-01-01-legacy.md +0 -0
  374. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree/pkg → pkg}/gate-tests/fixture.md +0 -0
  375. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{site-config.sh → scripts/site-config.sh} +0 -0
@@ -106,7 +106,17 @@ run the core command bare.
106
106
  Primitives a consumer guard composes; each emits the harness's
107
107
  `PreToolUse` hook protocol:
108
108
 
109
- - `guard_read_command` — parse the hook JSON on stdin, emit the command;
109
+ - `guard_read_input` — read stdin **once** into the global `GUARD_INPUT`,
110
+ returning non-zero when stdin yielded nothing. Called **directly**, never in a
111
+ command substitution, and before the first field accessor. It exists because
112
+ the payload was otherwise unreadable past its first field: `guard_read_command`
113
+ is invoked as `cmd="$(guard_read_command)"`, so any cache it set died with the
114
+ substitution's subshell and stdin was already consumed — a rule needing a
115
+ second field could not get one.
116
+ - `guard_input_field <jq-path>` — the value at `<jq-path>` in `GUARD_INPUT`, or
117
+ nothing when `GUARD_INPUT` is unset or empty or the path is absent. The
118
+ accessor a rule reaching past the headline fields uses.
119
+ - `guard_read_command` — parse the hook JSON, emit the command;
110
120
  **fail-open** on any parse problem (exit 0) so a guard can never wedge
111
121
  the agent.
112
122
  - `guard_read_path` — the same accessor for `.tool_input.file_path`, the field a
@@ -132,7 +142,7 @@ Primitives a consumer guard composes; each emits the harness's
132
142
  the string matches a committed allow pattern, with the harness `:*` prefix
133
143
  idiom (`Bash(printf:*)` ≡ any `printf …`) normalized to a trailing `*`. Not a
134
144
  hook primitive — a shared helper, one implementation behind
135
- compare-settings-allow's redundancy detection and rule 14's silent-grant
145
+ compare-settings-allow's redundancy detection and rule 19's silent-grant
136
146
  guard so the two never drift.
137
147
  - `guard_skeleton <cmd> <inert-class>…` — the context-aware normalizer, and the
138
148
  only place a rule learns what part of a command is live. It returns the command
@@ -151,7 +161,7 @@ Primitives a consumer guard composes; each emits the harness's
151
161
  - `guard_split_compound <skeleton>` — the compound splitter: emits one segment
152
162
  per line, splitting on the harness's statement separators (`;`, `&&`, `||`,
153
163
  `|`). Also not a hook primitive — the single implementation every consumer
154
- that reasons *per segment* shares (rules 8/13/14/16, the read-compound
164
+ that reasons *per segment* shares (rules 8/12/14/15/17/18/19/21, the read-compound
155
165
  carve-out of rules 9/10, and scan-prompts' `allowed()`), so the harness's
156
166
  per-segment matching surface is modelled in exactly one place and cannot drift
157
167
  between them. Fed a `guard_skeleton` view, so a separator inside a quoted
@@ -185,22 +195,55 @@ stays live, which is the conservative direction. And the normalizer models **quo
185
195
  shell semantics**: a construct that survives its scan and is not one of the three
186
196
  classes is treated as live, the fail-toward-matching direction and the one a
187
197
  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
198
+ backtick tests in rules 9, 10, 11, 12, 13, 14, 15, 17, 18 and 21 read the **raw**
199
+ command rather than
189
200
  a skeleton and must keep doing so — a `"$(…)"` inside double quotes still
190
201
  executes, so a rule that declared `dq` inert for *that* test would hand an
191
202
  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.
203
+ conservative declines, not verdict matching. **That roster is derived from the
204
+ rule bodies, not from memory**: it named rules that carry no raw test and
205
+ omitted rules that do until it was re-read against them, which is the same
206
+ drift the number-bearing cross-references below take and the reason each is
207
+ re-derived rather than carried.
208
+
209
+ **Rule 12 is the one rule that reaches its verdict off the raw command, and the
210
+ exception is forced rather than chosen.** Its predicate is *the pattern literal
211
+ `-f` will scan argv for*, and a skeleton replaces exactly that literal with a
212
+ placeholder — the quoted operand is the normal spelling — so a skeleton view
213
+ would blind the rule to the only thing it tests. It pays for the exception in the
214
+ same conservative direction every other clause takes: it declines outright on any
215
+ expansion, substitution or backtick (rule 6 blocks the expansion and substitution
216
+ shapes; the backtick decline is this rule's own arm, per the raw-command reading
217
+ above), and a
218
+ pattern operand carrying a stray quote — the evidence that the compound split
219
+ landed *inside* a quoted span — declines rather than guesses at the operand.
220
+
221
+ **`GUARD_INPUT` first, stdin otherwise, and the fallback is the whole point of
222
+ the shape.** `guard_read_command` and `guard_read_path` parse `GUARD_INPUT` when
223
+ it is set and non-empty and read stdin exactly as they always did otherwise, so
224
+ every consumer copy that never opted in keeps working byte-identically without an
225
+ edit — it never sets `GUARD_INPUT`, so both readers take the stdin path. A guard
226
+ that wants a second field opts in by adding one line, `guard_read_input || exit 0`
227
+ ahead of the first accessor, which is what the shipped template carries. Making
228
+ `guard_read_input` mandatory was refused: it would break every consumer copy on
229
+ upgrade for a field only one rule needs.
230
+
231
+ **What a `PreToolUse` payload actually carries, recorded so no session re-buys
232
+ the probe.** Top-level keys: `agent_id`, `agent_type`, `cwd`, `effort`,
233
+ `hook_event_name`, `permission_mode`, `prompt_id`, `session_id`, `tool_input`,
234
+ `tool_name`, `tool_use_id`, `transcript_path`. On a Bash call `tool_input` carries
235
+ `command`, `description`, and `run_in_background` — a JSON boolean `true` on a
236
+ backgrounded call, and **absent** on a foreground one. It is a fact about this
237
+ framework's own inputs, so without it each session re-establishes it from the
238
+ vendor hook reference.
239
+
240
+ **The live permission mode is in that payload and no rule reads it.**
241
+ `permission_mode` sits alongside the fields the accessors pick off, so a rule
242
+ whose rationale is mode-*conditional* — "no allowlist entry can suppress this
243
+ prompt" is false under an auto-approving mode and true under the others —
244
+ asserts a mode rather than reading one. Whether a guard *should* read the mode is
245
+ a consumer decision and is not settled here; the same holds for `agent_id`,
246
+ `agent_type` and `effort`, each of which belongs to a question of its own.
204
247
 
205
248
  Fail-open is the default posture. The one sanctioned fail-closed shape is a
206
249
  deny-guard whose hook *matcher* already proves the tool identity (see
@@ -245,7 +288,11 @@ guard-kit gains no dependency on a kit it does not otherwise know about
245
288
 
246
289
  A consumer's project-specific block/steer/allow rules live in its copy of
247
290
  `templates/bash-guard.sh`, composed from the `lib/guard.sh` primitives above and
248
- placed **before** the generic ruleset — the template marks the position. Order
291
+ placed **before** the generic ruleset — the template marks the position. The
292
+ template's head reads the payload once (`guard_read_input || exit 0`) before the
293
+ first field accessor, which is what makes a rule reading a tool-input field
294
+ beyond the command reachable in a shipped guard rather than only in the tests; a
295
+ copy without that line still runs every rule, on the fallback above. Order
249
296
  is the whole reason the seam sits here: a project rule that fires must fire
250
297
  ahead of the generic rule it refines, or the generic verdict wins and the
251
298
  project rule is dead code.
@@ -255,11 +302,53 @@ and names none. What a project blocks or steers is its own toolchain knowledge
255
302
  and stays in its copy, which is why the copy legitimately diverges from the
256
303
  template here and why no rule content crosses into the kit.
257
304
 
305
+ **Placement is a verification decision before it is a seam one, and this is the
306
+ sentence that makes the contract usable.** The generic lane carries §Testing's
307
+ decision-table obligation — every rule there owes a firing and a non-firing case,
308
+ and the table is the only instrument that reads a *block* at all. The consumer
309
+ lane carries none: a rule in a consumer's copy is reachable by no table in this
310
+ kit, so it ships hand-verified and its narrowing cannot be measured. A rule that
311
+ qualifies for either lane therefore belongs in the generic one. That a consumer's
312
+ own rules have no verification lane at all is a real gap and a separate one; it
313
+ is named here rather than solved, since solving it designs a testing lane for
314
+ consumer copies.
315
+
258
316
  ## The generic ruleset
259
317
 
260
- Rules that encode **harness behavior**, not any project's toolchain —
261
- shipped as `lib/guard.sh` functions the template guard invokes. Order is
262
- load-bearing where noted.
318
+ Rules that encode **harness behavior, shell-substrate behavior, or behavior over
319
+ an artifact whose grammar a kit owns**, never any project's toolchain — shipped
320
+ as `lib/guard.sh` functions the template guard invokes. Order is load-bearing
321
+ where noted.
322
+
323
+ **The clause has taken two widenings, and each is recorded with the rule that
324
+ forced it, because a rule slipped in unremarked is what would rot it.**
325
+
326
+ - **The shell-substrate half was added for rule 12, and it admits nothing a
327
+ project owns.** A `-f` pattern match seeing the matcher's own argv is a
328
+ property of the shell substrate every consumer of this kit runs on — neither
329
+ harness behavior nor any project's toolchain — so the narrower sentence left
330
+ it in a gap it had no reason to leave.
331
+ - **The kit-artifact half was added for rule 14, and it takes the same form and
332
+ passes the same test.** Rule 14 is neither of the two earlier classes as they
333
+ were written: what it reads is evidence-kit's `pid=<n> run=<key>` record and
334
+ the OS's process table. It interprets **no project vocabulary at all** — it
335
+ reads a PID and asks whether it is alive — so the test rule 12's widening had
336
+ to pass is the test this one passes: **it admits nothing a project owns**. A
337
+ kit's own artifact grammar is shipped mechanism, which is exactly what
338
+ CLAUDE.md §The provenance seam distinguishes from private rule content.
339
+
340
+ A project's toolchain stays out on the same words as before, under both.
341
+
342
+ **Naming one harness's forms in a corrective costs portability, not privacy, and
343
+ the cost is recorded rather than pre-paid.** Rule 13's block message names a
344
+ backgrounded condition wait and the harness's event-stream form, because a
345
+ corrective that named neither would be unfollowable. A harness tool name is
346
+ public, documented, and shared by every consumer of that harness, so it is not
347
+ private rule content and the provenance seam — a privacy boundary over private
348
+ vocabularies (CLAUDE.md §The provenance seam) — does not reach it. What such a
349
+ literal does cost is portability: a second harness with different form names is
350
+ what would force these into a configurable slot, and building that slot before
351
+ that harness exists would be designing against no case.
263
352
 
264
353
  1. **`cd` in a compound command** — blocked: cwd drift, plus a compound the
265
354
  allowlist cannot match, so the call is decided out of band. Corrective form:
@@ -338,7 +427,7 @@ load-bearing where noted.
338
427
  so `-e`/`-f` consume their argument and the first bare operand is the script
339
428
  — a *second* bare operand is the file that fires the rule. **Placed before
340
429
  both auto-allow rules:** a consumer that widens `GUARD_KIT_RO_BINS` with
341
- `sed` would otherwise have rule 13 silently grant an in-place rewrite.
430
+ `sed` would otherwise have rule 18 silently grant an in-place rewrite.
342
431
  9. **Listing-only `find`** — a bare `find` that only lists is blocked with
343
432
  the steer to the harness's Glob tool (the same shape as rule 8's `sed`
344
433
  read-steer: a better tool exists, and Glob returns paths registered for a
@@ -351,7 +440,7 @@ load-bearing where noted.
351
440
  batch of independent listings, exactly what the Glob steer collapses into one
352
441
  call. A literal `echo`/`printf` banner segment between them is the natural
353
442
  separator of such a batch and is tolerated; at least one segment must be a
354
- listing. A piped `find` is a legitimate producer (rule 13 may still
443
+ listing. A piped `find` is a legitimate producer (rule 18 may still
355
444
  auto-allow it), an action-predicate `find` is an executor, a redirected
356
445
  `find` has a downstream reader, and a **mixed** compound (a segment that is
357
446
  neither a listing nor a banner) all pass untouched. **Placed before both
@@ -393,14 +482,304 @@ load-bearing where noted.
393
482
  this rule (the consumer disqualifies it). Conservative by construction: an
394
483
  unrecognized option-with-argument or a glued pattern flag biases toward
395
484
  passing, never a false steer of a history search.
396
- 12. **Auto-allow `: > file` truncation** — a leading `:` plus redirect
485
+ 12. **Self-matching process-liveness predicate** — a `pgrep`/`pkill -f` whose
486
+ pattern literal the command's own text repeats is **blocked**. `-f` matches
487
+ against full argv, and the waiter's own argv — the harness's wrapper included
488
+ — carries that literal, so `until ! pgrep -f '<script>'; do …; done` has a
489
+ permanently-true condition and never exits. It reds nothing: the work
490
+ completes correctly and the only symptom is the foreground cap absorbing an
491
+ unbounded loop, which reads from outside as a fixed cap-length wait. Fires on
492
+ the conjunction no allowlist glob expresses: a segment whose **command word**
493
+ is `pgrep` or `pkill` — read past a leading `until`/`while`/`if`/`!`, which do
494
+ not change which binary runs, so the loop-headed spelling the rule exists for
495
+ is reached — carrying `-f` (bare or bundled in a short cluster), whose pattern
496
+ operand is a literal occurring **elsewhere** in the same command. The
497
+ corrective names both sanctioned forms: wait on the work's own artifact, or
498
+ `kill -0` against a **recorded PID** where liveness genuinely is the condition
499
+ — whoever started that producer, a child the session backgrounded itself
500
+ included, whose PID it recorded at launch as a `<key>.run` record under its
501
+ scratch directory. That clause is owned by
502
+ delegation-kit/SPEC.md §The delegation model and this text carries it, the
503
+ record's naming convention included — rule 14 reads that same set, so a
504
+ corrective that named the PID but not where it lives would send a blocked
505
+ session to write the one artifact shape neither reader can find.
506
+ A PID is an identity; a pattern is a
507
+ guess about a process table that includes the guesser. The refusal of the
508
+ bracket-trick repair as the *sanctioned* form is delegation-kit's ruling and
509
+ its grounds live there (delegation-kit/SPEC.md §The delegation model); this
510
+ rule exists because a correct form one character from an incorrect one will be
511
+ got wrong. Conservative by construction, in this ruleset's established
512
+ directions: an expansion or substitution anywhere in the command declines
513
+ outright (rule 6 already blocks those shapes); a `pgrep` without `-f` matches
514
+ process **names** rather than argv and is untouched; an unrecognized option, an
515
+ option whose argument cannot be walked, or a second bare operand declines; and
516
+ a pattern occurring nowhere else in the command is a genuine query and passes.
517
+ Each biases toward passing rather than toward a false block. **Placed with the
518
+ read-steer rules and before both auto-allow rules**, on rule 8's stated
519
+ reasoning: `pgrep` is a plausible member of a widened `GUARD_KIT_RO_BINS` — it
520
+ is, after all, a read-only query — and a consumer who added it would otherwise
521
+ have rule 18 silently bless a waiter that can never exit.
522
+ 13. **Bare foreground `sleep`** — a `sleep` standing in for a wait is
523
+ **blocked**, and the discriminator is the whole rule: a blanket `sleep` block
524
+ is wrong and is refused. The sanctioned wait *is* a condition loop, and such
525
+ a loop is expressly legitimate **in either spelling** —
526
+ `until <cond>; do sleep N; done` and `while <cond>; do sleep N; done` alike,
527
+ because the span walk below reads `do … done` and never the loop keyword, so
528
+ correcting a wait loop's polarity is free at the guard. So the rule fires on
529
+ exactly one shape — a bare foreground `sleep` in command position, outside
530
+ every loop wrapper — and never on a `sleep` inside a loop body. *The
531
+ discriminator is new territory:* this ruleset carries exactly one shell-keyword
532
+ parse and this rule is where it came from — rule 15's wait-loop exemption now
533
+ shares it rather than copying it, so the ruleset keeps one keyword-parsing
534
+ dialect. This one takes the skeleton view (so a `sleep` merely *named* in a
535
+ quoted span or a heredoc body is already inert), then walks it for `do … done`
536
+ spans and treats a `sleep` inside one as **inert** — structurally the carve-out
537
+ `_guard_is_banner` already performs for `echo`/`printf` segments in the batched-read
538
+ rules, applied to a keyword span instead of a segment. A `sleep` outside every
539
+ such span fires. Where the wrapper cannot be resolved — an unbalanced `do`/`done`,
540
+ or a span the rule cannot attribute — it **declines**, the direction every
541
+ other conservative clause here takes; a `sleep` that is an *argument* rather
542
+ than a command word never fires at all. **Blocks** rather than advises, on
543
+ rule 19's reasoning: no consumer allowlist is presumed to grant a bare
544
+ `sleep`, so the rule fires on a command that would be decided out of band
545
+ anyway and converts that decision into a durable steer at no extra cost. *The
546
+ corrective names the property and both forms* rather than one spelling: a wait
547
+ must end when its condition goes true, not when a duration expires; a
548
+ backgrounded command that *exits* on the condition fires one notification the
549
+ moment the condition holds, while the harness's event-stream form stays armed
550
+ to its deadline after its event fires when the command it was armed with is
551
+ unbounded, which makes it the second choice for a single completion. *It also
552
+ names the loop's polarity*, because that is the next mistake and it is the one
553
+ with an attested cost: `until` takes a done predicate, `while` takes a
554
+ still-running one such as a PID's liveness, and inverting them yields a loop
555
+ that exits at once with the producer still running
556
+ (delegation-kit/SPEC.md §bin/wait-probe measured it). Naming one form teaches a spelling; naming the property
557
+ and sorting both under it teaches the rule — the discriminator is owned by
558
+ delegation-kit/SPEC.md §The delegation model. **Placed with rule 12, before both
559
+ auto-allow rules,** for the same reason: `sleep` is not on the default
560
+ read-only roster, but the placement argument is about what a consumer may add
561
+ and the whole family of steer rules already sits there.
562
+ 14. **Tracked-tree mutation under a live producer** — a `git` command that
563
+ writes the index, the worktree or a ref is **blocked** while a `*.run`
564
+ record under a `GUARD_KIT_SCRATCH_DIRS` member names a live PID. The record
565
+ is the launch-time liveness record a session writes when it backgrounds a
566
+ shell child (delegation-kit/SPEC.md §The delegation model owns that rule;
567
+ evidence-kit/SPEC.md §The producer-liveness lock owns the `pid=<n>
568
+ run=<key>` grammar and the PID predicate, and neither is re-decided here).
569
+ **The act set is bounded and named rather than gestured at**: `add`,
570
+ `commit`, `rm`, `mv`, `restore`, `checkout`, `switch`, `reset`, `stash`,
571
+ `merge`, `rebase`, `cherry-pick`, `revert`, `apply`, `am`, `clean`.
572
+ Read-only git — `status`, `log`, `diff`, `show`, `rev-parse`, `ls-files` —
573
+ passes, and so does every non-`git` command. **`Write`/`Edit` are
574
+ deliberately outside the rule**: a mutating session's mandated journal write
575
+ lands through them and the scratch directory is gitignored, so a rule
576
+ reaching them would refuse the very mechanic the resume-journal contract
577
+ requires *while a wait is in progress*.
578
+ **This is the enforcement half of the waiting rule, and it works by
579
+ relocation.** The turn-end passes no `PreToolUse` chokepoint, so it is
580
+ unreachable from this ruleset (delegation-kit/SPEC.md §Operative residency);
581
+ the **harm** it causes arrives as an ordinary tool call at a chokepoint
582
+ already wired, which is what this rule fires on. The harness's own turn-end
583
+ event does reach it on a different axis, measured rather than assumed
584
+ (delegation-kit/SPEC.md §The turn-end liveness probe (template)), and
585
+ observing there is not refusing there — so this rule stays the enforcement
586
+ and is unchanged.
587
+ **Why the block is right even though it over-reaches, stated rather than
588
+ softened.** A read-only producer takes no harm from a commit, and the record
589
+ cannot say which kind it is. This ruleset's established direction is to bias
590
+ toward passing; that direction is **not** taken here, and the ground is that
591
+ the biased-toward-passing reading is what has failed every time this rule
592
+ fired. The corrective is cheap and names both exits: **wait for the producer
593
+ on its own artifact, or delete the record if the producer is done** — and
594
+ deleting a record whose producer has exited is not a workaround, it is the
595
+ statement of fact becoming false and being retracted.
596
+ **Conservative in this ruleset's other established directions**, which are
597
+ kept: an expansion or substitution anywhere in the command declines outright
598
+ (rule 6 already blocks those shapes); a record that does not parse declines
599
+ rather than blocks, because a guard is not the place a corruption verdict is
600
+ taken and `check-producer-liveness` already exits 2 on one; git's global
601
+ options are walked so `git -C <dir> commit` is reached, but an option the
602
+ walk does not recognize declines rather than guess which token is the
603
+ subcommand; and an unrecognized `git` subcommand declines. Each biases
604
+ toward passing rather than toward a false block, which is the calibration
605
+ the previous paragraph departs from **only** on the read-only producer.
606
+ **Placed with rules 12 and 13, before every auto-allow rule.** It is the
607
+ third member of the wait-discipline family and inherits their placement
608
+ argument (`git` is not on the default `GUARD_KIT_RO_BINS` roster, but a
609
+ consumer that widened it would otherwise have the read-only-pipeline rule
610
+ silently grant the mutation). **Two collisions make the placement necessary
611
+ rather than tidy**, and both are with rules that sit *after* the
612
+ auto-allows: rule 19 would block a chained `git commit` first and hand back
613
+ *run it bare* — a corrective that is wrong under a live producer and that
614
+ the session can follow; and rule 20 **advises** on `git commit --amend`, so
615
+ a rewrite under a live producer would proceed with a re-verification steer
616
+ instead of stopping.
617
+ **The bound this rule ships with is narrowed at the launch chokepoint, not
618
+ closed.** A session that backgrounds without recording is still invisible
619
+ here; rule 15 advises at the launch itself, which makes the omission visible
620
+ at the moment it is made without refusing it.
621
+ 15. **Backgrounded launch that records no producer** — a backgrounding Bash call
622
+ that neither writes a liveness record nor meets an exemption below is
623
+ **advised**: the message names the record, its grammar, its home, and the two
624
+ things it buys — rule 14's reach, and the next arrival's ability to tell
625
+ whether the producer is still writing.
626
+ **Two backgrounding forms, and both arms ship in one rule.** *Harness form* —
627
+ `.tool_input.run_in_background` is `true`, read through `guard_input_field`
628
+ (§The guard framework records the field and its shape). *Shell form* — the
629
+ skeleton (`sq dq hd`) ends a statement with a bare `&` that is neither the
630
+ `&&` operator nor a redirect's fd-dup. Building only the shell arm was
631
+ refused as worse than not building it: every attested firing used the harness
632
+ form, so a shell-only rule would cover the spelling nobody uses and pass the
633
+ one that fires — coverage in appearance
634
+ (delegation-kit/SPEC.md §The delegation model).
635
+ **The record-writing test reads the command text, and that is forced rather
636
+ than chosen.** At `PreToolUse` the child has not started and no record can
637
+ exist yet, so the only thing observable at this chokepoint is whether the
638
+ launch is *going to* write one: the call writes a record when its skeleton
639
+ carries a redirect whose target is a path under a `GUARD_KIT_SCRATCH_DIRS`
640
+ member ending in `.run`. That is the honest predicate, and it is part of why
641
+ the rule advises rather than refuses.
642
+ **Three exemptions, each reusing machinery already in the lib.** (1) *The call
643
+ writes a record* — the obligation is discharged inline. (2) *The call is a
644
+ wait loop* — a backgrounded `until <cond>; do sleep N; done` is the sanctioned
645
+ primitive rule 13 steers **toward**, a waiter rather than a producer, and
646
+ advising there would make the ruleset warn against the form its own corrective
647
+ recommends; detected by the `do … done` span walk rule 13 already performs.
648
+ (3) *The call is a read-only pipeline* — every segment leads with a
649
+ `GUARD_KIT_RO_BINS` member and every redirect target is `/dev/null` or an
650
+ fd-dup, rule 18's own test, since a child that writes nothing has nothing for
651
+ a later commit to corrupt.
652
+ **Advises rather than blocks, and the refusal of a block is reasoned rather
653
+ than hedged.** The guard cannot tell a producer from a trivial child — a
654
+ backgrounded `printf` and a backgrounded gate battery are the same shape at
655
+ this chokepoint — so a block's false-fire population is every short-lived
656
+ backgrounded call in the tree, and this ruleset's established direction is to
657
+ bias toward passing. Rule 14 departs from that direction on an attested record
658
+ of failure; this rule has none to depart on: both attested firings
659
+ (2026-08-19 and 2026-08-21, the second self-disclosed) produced no orphan, so
660
+ the harm is latent and a block is not warranted by a latent harm when the
661
+ reminder is what was missing. The harm already has a block — rule 14 refuses
662
+ the mutation — and this rule covers the **omission** that hides it, one step
663
+ upstream, where a second refusal buys a second stop rather than a second
664
+ catch. Both firings were a session that *knew* the rule and forgot it at the
665
+ call, which is exactly what an `additionalContext` note at the call fixes, at
666
+ the cost of one sentence rather than a stopped turn.
667
+ **The re-opening condition is named rather than left to judgment:** a firing
668
+ of the recording omission *after* this advisory ships is the attested record
669
+ rule 14's own departure required, and the block is then the next step.
670
+ **The honest limit.** An advisory does not refuse. A session determined to
671
+ background without recording still can, so rule 14's bound — *only for a
672
+ session that recorded* — is **narrowed rather than closed**. What closes at
673
+ this chokepoint is the silent case: the omission is now visible at the moment
674
+ it is made, to the only party that can fix it.
675
+ Conservative in this ruleset's established directions: an expansion or
676
+ substitution anywhere in the command declines outright (rule 6 blocks those
677
+ shapes already), an unbalanced `do`/`done` declines, and an absent
678
+ `GUARD_INPUT` on a call carrying no shell `&` simply leaves the harness arm
679
+ unavailable and the rule inert — the graceful degradation §The guard
680
+ framework's `GUARD_INPUT`-then-stdin fallback buys. **Placed with rules 12, 13
681
+ and 14 as the fourth member of the wait-discipline family, before both
682
+ auto-allow rules**, and the placement is required rather than tidy: a
683
+ backgrounded read-only pipeline is granted outright by rule 18, so a rule
684
+ sitting after the auto-allows would never run on the shapes it exists for.
685
+ **No knob is minted, and that is a seam decision rather than an economy**: a
686
+ producer roster — *which backgrounded commands are worth a record* — is
687
+ exactly the consumer vocabulary the provenance seam keeps out of a kit, so the
688
+ rule recognizes shapes and advises, and a consumer wanting a narrower
689
+ population narrows the two knobs that already exist.
690
+ 16. **Auto-allow `: > file` truncation** — a leading `:` plus redirect
397
691
  defeats the permission matcher, so it is always decided out of band. Granted
398
692
  silently when the command is *only* `:` followed by redirects and every target is
399
693
  gitignored (`git check-ignore`): truncating scratch is safe; a tracked
400
694
  file must still take that decision. The `git` subprocess is gated behind the rare
401
695
  `:`-redirect match; expansions (rule 6) and brace forms (rule 7) are
402
696
  already blocked, so a surviving target is a literal path.
403
- 13. **Auto-allow read-only pipeline** — granted silently when every pipe
697
+ 17. **Auto-allow an append-only write to a gitignored target** — the mandated
698
+ resume-journal append that
699
+ delegation-kit/SPEC.md §Resume journal — agent writes, scratch reset sweeps
700
+ obliges is a redirect, and the harness checks a redirect
701
+ **target** as a file write, so no `Bash(…)` allow entry can grant it: such a
702
+ rule grants the command and never the target. Granted silently when **every
703
+ clause below** holds, falling through untouched otherwise:
704
+ - **(0) Not a backgrounded launch.** A statement-ending `&` refuses before
705
+ any other clause is read: a backgrounded append is rule 15's subject, and
706
+ granting it here would bless a launch the liveness-record rule is about.
707
+ - **(a) Append-only.** Every redirect operator is `>>` (an fd prefix
708
+ allowed: `2>>`); a single truncating `>` **anywhere** refuses. This clause
709
+ carries the append-only split — a mistyped redirect must not be able to
710
+ destroy a journal — and it is the one no settings rule can express, since a
711
+ redirect-target check is a **file-write** check and cannot tell `>>` from
712
+ `>`. That is why the grant is a hook rather than an anchored `Edit` rule,
713
+ which would reach the target correctly and grant the truncating form with it.
714
+ - **(b) Every target gitignored**, on rule 16's exact `git check-ignore
715
+ --quiet --` predicate and its exact subprocess, gated behind the same
716
+ rarity: `git` is reached only once (a) and (c) have already matched.
717
+ - **(c) The leading command emits to stdout and nothing else**, and the
718
+ command is one statement. The roster is `GUARD_KIT_APPEND_BINS`.
719
+ - **(d) Conservative decline on anything unmodelled** — a command or process
720
+ substitution or a backtick anywhere in the **raw** command, or a redirect
721
+ target that survives normalization carrying a quote. Declares `sq dq hd`.
722
+
723
+ **Why (c) is the clause the safety argument rests on.** A
724
+ `permissionDecision: allow` blesses the whole call, so a rule keyed on the
725
+ redirect alone would grant `rm -rf .tmp/../.git >> .tmp/j.md` — the target is
726
+ gitignored, the operator is `>>`, and the command destroys the repository.
727
+ Bounding the *emitter* is what makes the grant safe, and bounding it to
728
+ **stdout-only** emitters is what makes the bound checkable: `cat`, `printf`
729
+ and `echo` write nowhere the redirect does not send them, so the redirect
730
+ target is the whole of what the call can touch. `tee` is deliberately **off**
731
+ the roster despite being the obvious fourth member — it takes a path
732
+ **argument**, so `tee -a <tracked file>` writes a tracked file with no
733
+ redirect at all and (a) and (b) never see it. The honest limit is the mirror
734
+ of the one rule 18 carries for `GUARD_KIT_RO_BINS`, reached from the writing
735
+ side rather than the reading side: the grant is exactly as safe as the
736
+ roster's stdout-only property, which the rule asserts of the roster and
737
+ cannot verify of a member.
738
+ **One statement is one segment plus its own heredoc residue, never one
739
+ segment.** `guard_split_compound` emits per **line** and `guard_skeleton`'s
740
+ `hd` class leaves a heredoc's body placeholder and terminator on lines of
741
+ their own, so the mandated `cat >> … <<'EOF'` form splits into *three*
742
+ segments and a one-segment test would refuse the exact command this rule
743
+ exists to grant. The test is therefore that every segment past the first is
744
+ exactly the residue the first segment's own openers produce — which still
745
+ refuses a second statement on a line of its own (`printf x >> .tmp/j.md`,
746
+ newline, `rm -rf …`), the hazard the one-statement bound is for.
747
+ **Two inert targets are exempt from (a) and (b)**, and the carve-out is
748
+ precedented rather than invented: `/dev/null` and an fd-dup (`&1`, `&2`) are
749
+ what rule 18 already treats as targets that are not files. Neither is a file
750
+ the append-only split protects and neither is a path `git check-ignore` can
751
+ answer about. Every **other** target takes both tests, and at least one such
752
+ target must exist — a call redirecting only to inert targets has no append to
753
+ grant. Seeing an fd-dup at all takes this rule's own operator-and-target
754
+ scan, because `_guard_redirect_targets`' target class excludes `&` and drops
755
+ an fd-dup target entirely.
756
+ **The raw-command arm is not redundant with rule 6**, and that was measured
757
+ rather than assumed: rule 6 blocks `${…}`, `$(…)`, `<(…)` and `$NAME` and
758
+ exits 2 first, but **not** `>(…)`, which does run its command. An auto-allow
759
+ may not rest on a coverage claim that is only mostly true, so this rule takes
760
+ the same full raw-command decline rule 18 takes.
761
+ **Placed immediately after rule 16 and before rule 18**, and the position is
762
+ load-bearing rather than tidy: placing it after the decorated-allowlist rule
763
+ would be wrong because that rule blocks a bare allow entry decorated by a
764
+ trailing redirect, which is one plausible spelling of the very command this
765
+ rule grants.
766
+ **The mandated in-turn wait is a stated non-target**, recorded so the
767
+ omission is not read as an oversight: its `kill -0 "$pid"` loop is
768
+ ungrantable by a settings rule for the same structural reason — the mandated
769
+ form *is* a loop condition, so it is decorated by construction — but a grant
770
+ minted around the currently-sanctioned loop form would be shaped to a
771
+ primitive that measurement may correct, and a guard on the wrong primitive
772
+ inherits its failure. Measure first, then grant. **The measurement has since
773
+ returned and the precondition is discharged**, so what remains is the grant
774
+ itself rather than the question it waited on: the backgrounded condition loop
775
+ stands unchanged as the sanctioned form and the correction landed on the
776
+ loop's *polarity*, so a grant is now shaped to `while kill -0 "$pid" …` as
777
+ well as `until <cond> …` (delegation-kit/SPEC.md §bin/wait-probe holds the
778
+ trials; §Operative residency holds the finding). Recorded here rather than
779
+ left as a closed refusal because the two read differently: this one is now
780
+ unblocked work, and rule 6 decides the mandated spelling out of band on every
781
+ call until it is minted.
782
+ 18. **Auto-allow read-only pipeline** — granted silently when every pipe
404
783
  segment leads with a roster binary (`GUARD_KIT_RO_BINS`, default the
405
784
  grep/head/cat/find/jq family) and every redirect target is `/dev/null`
406
785
  or an fd-dup. Declares `sq dq hd`. Conservative by construction:
@@ -428,7 +807,7 @@ load-bearing where noted.
428
807
  least one non-banner roster segment must remain, so a banner-only pipeline
429
808
  is not granted.
430
809
  - **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
810
+ exact `Bash(<cmd>)` with no glob, on rule 19's own reasoning that a
432
811
  glob-headed family coexists with allowlisted decorators and would admit
433
812
  far more than the reviewed command. The shape this repairs is an
434
813
  allowlisted script piped into `head`: the lead is statically allowlisted,
@@ -442,7 +821,7 @@ load-bearing where noted.
442
821
  exactly as it behaves without it. A grant that depends on a settings read
443
822
  must never turn a missing settings file into a grant, and declining is the
444
823
  only direction that cannot.
445
- 14. **Decorated allowlisted command** — the leading command exactly matches a
824
+ 19. **Decorated allowlisted command** — the leading command exactly matches a
446
825
  committed **bare** allow entry (a `Bash(<cmd>)` with no `:*`/`*` glob) but
447
826
  the command decorates it — `&&`/`;`/`|` chaining, a trailing redirect, or
448
827
  `2>&1` — which leaves a segment nothing grants, so the whole call falls off
@@ -462,17 +841,17 @@ load-bearing where noted.
462
841
  allow entry, reusing `guard_allow_match`'s shell-glob semantics. Reads
463
842
  `GUARD_KIT_SETTINGS`; **fail-open** — no `jq`, no settings file, or a
464
843
  parse error and the rule silently declines and falls through. Placed after
465
- the auto-allow rules (12, 13) so a silently granted read-only pipeline never
466
- reaches it — which is also **why the allowlisted-lead grant lives in rule 13
844
+ the auto-allow rules (16, 17, 18) so a silently granted read-only pipeline never
845
+ reaches it — which is also **why the allowlisted-lead grant lives in rule 18
467
846
  and not here**. Grant, not fall-through, is what removes the friction of an
468
847
  allowlisted command decorated only by a read-only reduction of its own
469
848
  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
849
+ would bless segments the allowlist never reviewed. Rule 18 is already the
471
850
  sanctioned place for a grant of exactly that shape and is already ordered
472
851
  ahead of this rule, so a granted pipeline never arrives and nothing
473
852
  ungranted becomes granted that either half would not have granted alone.
474
853
  Declares `sq dq hd`.
475
- 15. **Git history-rewrite advisory** — a `git commit` carrying `--amend`, `-F`,
854
+ 20. **Git history-rewrite advisory** — a `git commit` carrying `--amend`, `-F`,
476
855
  or `--file`, or a `git reset --soft`, gets a `guard_advise` steer carrying
477
856
  the checklist from DOCTRINE.md's *Re-verify volatile state before a git
478
857
  history rewrite* rule (verify HEAD before amend/squash; re-stage and verify
@@ -480,31 +859,42 @@ load-bearing where noted.
480
859
  this turn). Advisory, not a block: each is a legitimate command, so the rule
481
860
  injects the re-verification context and lets the command proceed. The
482
861
  DOCTRINE.md rule is cited by **name**, not number — the doctrine's craft
483
- rules renumber as it grows, and this ruleset carries its own rule 15, so a
484
- doc-qualified number would both rot on a renumber and read ambiguously
862
+ rules renumber as it grows, and this ruleset renumbers on its own account
863
+ too — this rule's own number moved when rules 12 and 13 were inserted ahead
864
+ of it, again when rule 14 was, again when rule 15 was, and again when the
865
+ append grant landed as rule 17 — so a
866
+ doc-qualified number would rot on either renumber and read ambiguously
485
867
  against the local numbering. Placed
486
- after the auto-allow rules (12, 13) and the decorated-allowlist rule (14),
868
+ after the auto-allow rules (16, 17, 18) and the decorated-allowlist rule (19),
487
869
  so it fires only on a bare rewrite command none of those claimed; a
488
- decorated form meets rule 14's block first and the advisory fires on the
870
+ decorated form meets rule 19's block first and the advisory fires on the
489
871
  re-issued bare command.
490
- 16. **Bare `rm` of a tracked path** — an `rm` statement naming a git-tracked
872
+ 21. **Bare `rm` of a tracked path** — an `rm` statement naming a git-tracked
491
873
  file (`git ls-files --error-unmatch`) is **blocked** with the steer to
492
874
  `git rm -q <path>`, which deletes and stages that one deletion in a single
493
875
  motion. The deletion is the point: a bare `rm` leaves it unstaged, so it
494
876
  lands only via a later `git add -A` — the form the shared-index discipline
495
877
  warns against, since it sweeps a concurrent session's foreign path into the
496
- commit. Block, not advise, on rule 14's reasoning: no consumer allowlist is
878
+ commit. Block, not advise, on rule 19's reasoning: no consumer allowlist is
497
879
  presumed to grant `rm`, so the rule fires on a command that would be decided
498
880
  out of band anyway and converts that decision into a durable steer. Fires per statement
499
881
  (`;`/`&&`/`||`/`|` split), so a decorated form steers on the same premise as
500
882
  the bare one. Conservative by construction: expansions and backticks decline
501
- outright (rule 6 already blocks them), option words are skipped, and a
883
+ outright (rule 6 already blocks the expansions; the backtick arm is this
884
+ rule's own), option words are skipped, and a
502
885
  tracked *directory* under `rm -r` does not match `--error-unmatch` — each
503
886
  biases toward passing rather than a false steer. An untracked or gitignored
504
887
  target never matches, so scratch deletion is untouched.
505
- 17. **Fall-through logging** — anything neither blocked nor auto-allowed is
888
+ 22. **Fall-through logging** — anything neither blocked nor auto-allowed is
506
889
  appended to the friction log. Always last; never affects the decision.
507
890
 
891
+ **Nothing above claims the sleep half was already enforced.** Before rule 13, no
892
+ rule in this ruleset enforced the never-poll rule's `sleep` half and rule 13 is
893
+ the first; whether a mechanism *outside* a consumer's tree blocks a foreground
894
+ `sleep` is an open question, unprobed as to cause, and no clause here rests a
895
+ coverage claim on one. The rule is built as though nothing outside the tree
896
+ enforced it — the only construction that is correct whichever way that resolves.
897
+
508
898
  ### Consumer rules
509
899
 
510
900
  Project rules — build-cache hygiene, container-build concurrency,
@@ -620,7 +1010,7 @@ close-stage audit. A committed pattern subsumes a local entry when the
620
1010
  local string matches it under shell-glob semantics; the harness `:*` prefix
621
1011
  idiom (`Bash(printf:*)` ≡ any `printf …`) is normalized to a trailing `*`
622
1012
  so one glob test covers both forms — the match core is `guard_allow_match`
623
- in `lib/guard.sh`, shared with rule 14. Read-only — reports candidates, never
1013
+ in `lib/guard.sh`, shared with rule 19. Read-only — reports candidates, never
624
1014
  mutates (the operator prunes). It is the detector, not the policy: a
625
1015
  non-redundant local entry can still be one-off junk worth pruning by
626
1016
  judgment.
@@ -646,6 +1036,65 @@ a report worded as coverage would be the false-confidence proxy gate-sdk/SPEC.md
646
1036
  is omitted entirely rather than printed clean, so a consumer that declared no
647
1037
  vocabulary cannot read silence as coverage.
648
1038
 
1039
+ **The second disposition has a mechanism, and where the ruling lives is what makes
1040
+ it durable.** `GUARD_KIT_BREADTH_DECLARED` (§Layout and configuration) maps a
1041
+ permission-rule string to the reason that breadth was ruled intended — a pair,
1042
+ never a bare list, since a bare list re-loses the reason it exists to keep. It
1043
+ lives in the **committed** config the consumer tracks, so the ruling survives in a
1044
+ reviewable surface rather than in a session's memory or a commit message, which
1045
+ spec-over-precedent says is not ground truth. That fixes where a declaration
1046
+ *lives*; it does not widen what the breadth question *reads*, which stays the
1047
+ local overlay named above. An over-broad local glob keeps re-reporting until a
1048
+ **committed** declaration rules it, and a per-clone declaration cannot silence
1049
+ one.
1050
+
1051
+ **The declaration match is exact-string, never glob.** An entry is declared when
1052
+ the exact local allow-rule string is a key of the map — a key test and nothing
1053
+ else. Routing it through `guard_allow_match` is refused: the kit's one matcher
1054
+ would let a single declaration silence globs the operator's ruling never named,
1055
+ which is a declaration widening itself, and a durable ruling about intended
1056
+ breadth is a ruling about **one** glob. The consequence is stated rather than left
1057
+ to be discovered — narrowing a declared glob, or re-spelling it, drops its
1058
+ declaration and the entry re-reports. That is correct, since the ruling was taken
1059
+ on the old string, and it is what keeps a declaration from outliving the glob it
1060
+ ruled.
1061
+
1062
+ **A declared glob is not dropped from the report.** The over-broad set partitions
1063
+ in two and both halves print:
1064
+
1065
+ - **narrowing candidates** — over-broad and undeclared, printed with the
1066
+ two-disposition help text above.
1067
+ - **declared intended** — over-broad and declared, printed as
1068
+ `<glob> ⊇ <probe> — <reason>` under its own heading, with help text naming
1069
+ the committed config as where the ruling lives.
1070
+
1071
+ Dropping a declared glob would make the knob a silencer whose contents nobody ever
1072
+ reads, and a field with no named reader is removed rather than shipped
1073
+ (canon-kit/SPEC.md §The causal-completeness check, point 4). An over-broad set
1074
+ that is **entirely** declared therefore prints the declared section and **no**
1075
+ narrowing section: *no over-broad local entries* would be false there. With no
1076
+ over-broad entries at all the report is unchanged, and with the map empty — the
1077
+ default, and the shipped state for a consumer who declares nothing — the partition
1078
+ is trivial, the declared subsection is omitted, and every byte of output matches
1079
+ the tool as it behaved before the declaration shipped. The asymmetry with
1080
+ `GUARD_KIT_BREADTH_PROBES` is deliberate: an empty probe set omits the whole
1081
+ breadth section because silence there could be misread as coverage, while an empty
1082
+ declaration set omits only the declared subsection, where no coverage claim is
1083
+ available to misread and an absent section says exactly that nothing was declared.
1084
+
1085
+ **The honest limit: a declaration can outlive its subject and nothing notices.**
1086
+ The knob records a ruling; it does not verify that the glob it names is still in
1087
+ `GUARD_KIT_SETTINGS_LOCAL`, still over-broad, or still real. A stale declaration
1088
+ is silent. A stale-declaration report was weighed and refused, because it would
1089
+ print every declaration naming a **committed** glob as stale — and a committed
1090
+ glob was never in this report to begin with, so a declaration naming one is a
1091
+ durable record that the report itself does not read. That is exactly the shape a
1092
+ re-derivation of the committed allowlist produces when it rules a glob safe and
1093
+ keeps it broad, and it is stated rather than covered; the gap is filed rather than
1094
+ flagged-and-skipped. Nothing here makes a gate of the tool either: the placement
1095
+ ruling below is unchanged and unweakened by a knob that records exactly the
1096
+ operator intent that ruling turns on.
1097
+
649
1098
  This is the criterion's home rather than a gate, and the placement is ruled
650
1099
  rather than defaulted: the subject is a gitignored per-machine file CI cannot
651
1100
  see, and the verdict is operator-intent-dependent (a blanket grant is fine in a
@@ -666,7 +1115,11 @@ owns the committed settings file as a gate subject. This kit holds the three
666
1115
  by parsing technique does not outrank placement by governed surface.
667
1116
 
668
1117
  `--count` emits both bare counts on one line, redundancy first and breadth
669
- second.
1118
+ second, and the breadth number counts the **narrowing candidates** rather than
1119
+ every over-broad entry: the count's one purpose is *how much is outstanding*, and
1120
+ a declared entry is not outstanding. A third number for the declared count is
1121
+ refused — no reader needs it, and the two-number line is a shape a consumer may
1122
+ already parse.
670
1123
 
671
1124
  ## wakeup-guard (template)
672
1125
 
@@ -714,8 +1167,10 @@ lifecycle-kit's close template. The step: run `scan-prompts`, resolve each
714
1167
  recurring pattern by the triage criterion; review and delete the wakeup
715
1168
  log if present; run `compare-settings-allow` and take its **two**
716
1169
  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
1170
+ breadth report names as a narrowing candidate, either narrow the glob or record
1171
+ that its breadth is intended as a `GUARD_KIT_BREADTH_DECLARED` entry in the
1172
+ committed config, which is what moves it into the report's declared section and
1173
+ stops it re-reporting — then by judgment prune the remaining one-off exact-string local
719
1174
  entries and promote recurring safe patterns to the committed settings as
720
1175
  globs; clear the friction log. Two judgments the reports cannot make sit in
721
1176
  that last step. An entry naming a **script path** rather than a fixed command is
@@ -745,6 +1200,7 @@ guard-kit/
745
1200
  bin/run-guard-tests.sh # decision-table runner
746
1201
  guard-tests/cases.tsv # expected-decision <TAB> command
747
1202
  guard-tests/escalation-cases.tsv # expected-decision <TAB> to <TAB> message
1203
+ guard-tests/background-cases.tsv # expected-decision <TAB> run_in_background <TAB> command
748
1204
  gate-tests/scratch-run.test.sh # bespoke unit test, run by gate-sdk's runner
749
1205
  gate-tests/scan-prompts.test.sh # bespoke unit test, run by gate-sdk's runner
750
1206
  gate-tests/compare-settings-allow.test.sh # bespoke unit test, run by gate-sdk's runner
@@ -788,11 +1244,36 @@ repo's layout as defaults):
788
1244
  both sides, so a consumer can probe non-`Bash` rules with the same mechanism.
789
1245
  The kit ships **no** default probes: every string naming a command is the
790
1246
  consumer's vocabulary, never the kit's (CLAUDE.md §The provenance seam).
1247
+ - `GUARD_KIT_BREADTH_DECLARED` — associative array recording the breadths ruled
1248
+ intended (§compare-settings-allow): the key is a permission-rule string, the
1249
+ value the reason that breadth was ruled intended; default empty, in which case
1250
+ the declared subsection is absent and the tool behaves exactly as it did before
1251
+ the declaration shipped. **Associative rather than a delimited indexed array,
1252
+ and the choice is not cosmetic:** a permission rule may contain any character a
1253
+ command may, so every single-character separator an indexed array would need
1254
+ (`|`, `::`, a tab) is a character a legitimate rule can carry, and the knob
1255
+ would ship a grammar that cannot express part of its own subject. An
1256
+ associative key holds the rule verbatim, and a key is unique by construction, so
1257
+ the *which reason wins* question the delimited shape would raise cannot arise.
1258
+ Report order never depends on the map's iteration order: the tool walks the
1259
+ settings file's own allow list and looks each entry up, so the map is never
1260
+ iterated and the unordered iteration never reaches output. The kit ships **no**
1261
+ default declarations, on the same seam reasoning as the probes above.
791
1262
  - `GUARD_KIT_RO_SCRIPTS` — array of globs eligible for the
792
1263
  absolute→relative rewrite (rule 4); default `("check-*.sh")`.
793
- - `GUARD_KIT_RO_BINS` — read-only pipeline roster (rule 13); default the
1264
+ - `GUARD_KIT_RO_BINS` — read-only pipeline roster (rule 18); default the
794
1265
  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.
1266
+ rule 18's discriminator rather than granting on the leads-with test alone.
1267
+ - `GUARD_KIT_APPEND_BINS` — the emitter roster of the append grant (rule 17);
1268
+ default `(cat printf echo)`. A knob rather than a kit literal on
1269
+ `GUARD_KIT_RO_BINS`'s reasoning: a consumer whose mandated write rides a
1270
+ different emitter shadows the array instead of forking the rule, and three
1271
+ POSIX utility names are shipped mechanism rather than a vocabulary, so
1272
+ defaulting them crosses no provenance seam. The roster's contract is **writes
1273
+ only to its stdout**, and a consumer adding a command that writes anywhere
1274
+ else widens the grant past rule 17(c)'s safety argument — the same widening
1275
+ hazard `GUARD_KIT_RO_BINS` carries, stated here because this roster's members
1276
+ are what bound a *write* rather than a read.
796
1277
  - `GUARD_KIT_SCRATCH_DIRS` — gitignored scratch dirs named in the
797
1278
  rule-3 corrective message; default `(".tmp")`.
798
1279
 
@@ -813,13 +1294,38 @@ make a command expressible in one tab-separated cell: `@ROOT@` becomes the git
813
1294
  sandbox root, and `@NL@` becomes a newline — without the second a heredoc case
814
1295
  cannot be written at all, and the heredoc class would ship untested.
815
1296
 
1297
+ **The runner drives each case from inside the sandbox**, which decides how a
1298
+ target is spelled and is stated because getting it wrong reads as a rule defect
1299
+ rather than as a spelling one: a path is written **relative** unless the case is
1300
+ *about* an absolute one, since rule 5 blocks any command carrying the repo-root
1301
+ prefix and an `@ROOT@`-absolute target therefore never reaches the rule under
1302
+ test. `@ROOT@` is for the cases whose subject is the absolute form — rules 2, 4
1303
+ and 5 — and for a foreign-repo contrast.
1304
+
1305
+ **Any ad-hoc invocation of a consumer's guard script must set `GUARD_KIT_LOG` to
1306
+ a scratch path**, because the logger's default is the *live* friction log and a
1307
+ throwaway probe otherwise files its synthetic commands as real friction. The
1308
+ kit's own runners all set it — the decision table into its sandbox, the
1309
+ `scan-prompts` fixture into its own — so the convention is invisible until a
1310
+ hand-written latency or behaviour probe drives `bash-guard.sh` in a loop and
1311
+ poisons the next close's ranking with its payload. Measured rather than
1312
+ hypothetical: one such probe contributed 30 of 237 ranked prompting calls at a
1313
+ single close, ranking second. **No scanner is proposed:** the polluting caller is
1314
+ a one-off script in the gitignored scratch dir, so there is no committed corpus
1315
+ to scan and the convention is carried by this sentence and by
1316
+ `bin/scratch-run.sh`'s echo-at-execution.
1317
+
816
1318
  **The decision table is the instrument for any change to what the guard
817
1319
  refuses, and its red condition is not monotone.** A change that *narrows*
818
1320
  refusal cannot be cleared by inspection, because the table fails on a verdict
819
1321
  mismatch **in either direction** rather than on a violation count: every
820
1322
  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
1323
+ segment, an append redirect to a gitignored target, or an allowlisted lead with
1324
+ a read-only tail must have its expected
1325
+ column **re-derived**, never assumed still correct. Rule 17's landing is the
1326
+ worked instance and the cheap one: it narrowed refusal and flipped exactly one
1327
+ pre-existing row, which the table reported and inspection had not.
1328
+ `bin/scan-prompts.sh` cannot
823
1329
  substitute for it, and the reason is structural rather than a matter of
824
1330
  precision: `guard_block` exits 2 before `guard_log_fallthrough` runs, so a
825
1331
  blocked command never reaches `GUARD_KIT_LOG` and that report is blind to every
@@ -834,6 +1340,24 @@ headerless message to `main` → advise) and its non-firing pair (a fully shaped
834
1340
  block, and a non-`main` recipient → fallthrough) hold the same fixture-pair
835
1341
  discipline for the advisory.
836
1342
 
1343
+ A **third** table, `guard-tests/background-cases.tsv`
1344
+ (`<decision> <TAB> <run_in_background> <TAB> <command>`), extends that same
1345
+ precedent to rule 15's harness arm, and it is forced rather than tidy: the
1346
+ `cases.tsv` grammar pairs a decision with a *command*, and the harness arm's
1347
+ input is a **tool parameter**, so that arm cannot be written there at all and
1348
+ would otherwise ship untested — the coverage-in-appearance this rule's own design
1349
+ refuses. The runner feeds a Bash-shaped payload carrying the flag. Rows, each a
1350
+ firing/non-firing pair: harness-form background with no record → advise;
1351
+ harness-form background writing a `.run` record → fallthrough; harness-form
1352
+ background of a wait loop → fallthrough; harness-form background of a read-only
1353
+ pipeline → the auto-allow it already earns; and a foreground call carrying
1354
+ neither → fallthrough, which is what proves the rule inert off the backgrounding
1355
+ path. The shell-`&` arm *is* a command, so its firing and non-firing rows stay in
1356
+ `cases.tsv`. Rule 15 emits an **advise**, so it converts a `fallthrough` row into
1357
+ an `advise` row wherever it fires: every existing row whose command carries a
1358
+ trailing `&` has its expected column re-derived under the non-monotone rule
1359
+ above, never assumed still correct.
1360
+
837
1361
  `smoke/install.sh` copies the templates into the scratch consumer (guard
838
1362
  and config into the gates dir, hook wiring into `.claude/settings.json`,
839
1363
  log paths gitignored) and then drives one crafted payload directly through
@@ -846,7 +1370,14 @@ makes that file conditional on exactly this).
846
1370
  same reason, at `gate-tests/compare-settings-allow.test.sh`: a firing probe
847
1371
  (a blanket local glob reported with its witness), a non-firing one (a narrow
848
1372
  entry reporting clean), and the empty-knob silence that proves the section is
849
- omitted rather than printed clean. It drives the tool through
1373
+ omitted rather than printed clean — which, with `GUARD_KIT_BREADTH_DECLARED`
1374
+ empty, also proves the declared subsection absent. The declaration's own cases sit
1375
+ beside them: a declared over-broad entry printing in the declared section with its
1376
+ reason and **not** in the narrowing set; an all-declared over-broad set printing
1377
+ the declared section, no narrowing section and no false clean line; `--count`'s
1378
+ breadth number excluding the declared entry; and an exactness case — a declaration
1379
+ differing from the local entry by one character leaves that entry in the narrowing
1380
+ set, which is the assertion that the lookup never became a glob match. It drives the tool through
850
1381
  `GUARD_KIT_CONFIG_FILE` pointed at a sandbox config, so the consumer's own probe
851
1382
  array cannot leak into the fixture.
852
1383