checkwright 0.21.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (489) hide show
  1. package/README.md +1013 -50
  2. package/lib/common/digest.sh +18 -0
  3. package/lib/common/lock.sh +40 -0
  4. package/lib/common/profile.sh +33 -0
  5. package/lib/common/recipe.sh +56 -43
  6. package/lib/diff.sh +64 -0
  7. package/lib/doctor.sh +81 -7
  8. package/lib/init.sh +167 -52
  9. package/lib/uninstall.sh +212 -0
  10. package/lib/update.sh +34 -0
  11. package/package.json +2 -2
  12. package/payload/artifact/targets.list +30 -0
  13. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  14. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
  15. package/payload/canon-kit/README.md +2 -0
  16. package/payload/canon-kit/SPEC.md +666 -59
  17. package/payload/canon-kit/checks/check-amendment-queue.sh +1 -0
  18. package/payload/canon-kit/checks/check-comment-tier.gate +3 -0
  19. package/payload/canon-kit/checks/check-deprecation-task.gate +3 -0
  20. package/payload/canon-kit/checks/check-docs-cmd.gate +3 -0
  21. package/payload/canon-kit/checks/check-docs-link-convention.sh +12 -4
  22. package/payload/canon-kit/checks/check-install-claim.gate +3 -0
  23. package/payload/canon-kit/checks/check-knob-citation.gate +3 -0
  24. package/payload/canon-kit/checks/check-knob-default-coupling.sh +1 -0
  25. package/payload/canon-kit/checks/check-manifest-count.gate +3 -0
  26. package/payload/canon-kit/checks/check-manifest-temporal.gate +3 -0
  27. package/payload/canon-kit/checks/check-md-refs.gate +3 -0
  28. package/payload/canon-kit/checks/check-measured-claim.gate +3 -0
  29. package/payload/canon-kit/checks/check-payload-claim.gate +3 -0
  30. package/payload/canon-kit/checks/check-prose-enum.gate +3 -0
  31. package/payload/canon-kit/checks/check-prose-tells.sh +1 -0
  32. package/payload/canon-kit/checks/check-spec-derivable-section.gate +3 -0
  33. package/payload/canon-kit/checks/check-spec-dod-singleton.gate +3 -0
  34. package/payload/canon-kit/checks/check-spec-embedded-source.sh +1 -0
  35. package/payload/canon-kit/checks/check-spec-fence-balance.gate +3 -0
  36. package/payload/canon-kit/checks/check-spec-pointer.gate +3 -0
  37. package/payload/canon-kit/checks/check-surface-duplication.sh +1 -0
  38. package/payload/canon-kit/checks/check-todo-task-liveness.gate +3 -0
  39. package/payload/canon-kit/checks/check-tracking-claim.gate +3 -0
  40. package/payload/canon-kit/gate-tests/check-comment-tier/bad/.workflow/fixture-state.txt +4 -0
  41. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.gate +4 -0
  42. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.rs +5 -0
  43. package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +4 -0
  44. package/payload/canon-kit/gate-tests/check-comment-tier/bad/templates/bad-tmpl.sh +4 -0
  45. package/payload/canon-kit/gate-tests/check-comment-tier/good/.workflow/fixture-state.txt +3 -0
  46. package/payload/canon-kit/gate-tests/check-comment-tier/good/expect.txt +1 -1
  47. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.gate +4 -0
  48. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.rs +5 -0
  49. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
  50. package/payload/canon-kit/gate-tests/check-comment-tier/good/templates/good-tmpl.sh +5 -0
  51. package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +29 -5
  52. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/.workflow/fixture-state.txt +3 -0
  53. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.gate +2 -0
  54. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.rs +4 -0
  55. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/expect.txt +3 -0
  56. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.sh +6 -5
  57. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/templates/tmpl.sh +5 -0
  58. package/payload/canon-kit/gate-tests/check-deprecation-task/good/.workflow/fixture-state.txt +3 -0
  59. package/payload/canon-kit/gate-tests/check-deprecation-task/good/expect.txt +1 -1
  60. package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.gate +2 -0
  61. package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.rs +4 -0
  62. package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.sh +6 -5
  63. package/payload/canon-kit/gate-tests/check-deprecation-task/good/templates/tmpl.sh +5 -0
  64. package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +4 -3
  65. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/OUTSIDE.md +4 -0
  66. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/index.md +3 -0
  67. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/OUTSIDE.md +4 -0
  68. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +8 -0
  69. package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +94 -0
  70. package/payload/canon-kit/gate-tests/check-knob-citation.test.sh +2 -2
  71. package/payload/canon-kit/gate-tests/check-manifest-count/good/SPEC.md +4 -0
  72. package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +32 -8
  73. package/payload/canon-kit/gate-tests/check-md-refs.test.sh +61 -9
  74. package/payload/canon-kit/gate-tests/check-measured-claim/bad/SPEC.md +12 -0
  75. package/payload/canon-kit/gate-tests/check-measured-claim/bad/expect.txt +3 -0
  76. package/payload/canon-kit/gate-tests/check-measured-claim/bad/scripts/canon-config.sh +6 -0
  77. package/payload/canon-kit/gate-tests/check-measured-claim/good/SPEC.md +23 -0
  78. package/payload/canon-kit/gate-tests/check-measured-claim/good/expect.txt +1 -0
  79. package/payload/canon-kit/gate-tests/check-measured-claim/good/scripts/canon-config.sh +6 -0
  80. package/payload/canon-kit/gate-tests/check-measured-claim.test.sh +90 -0
  81. package/payload/canon-kit/gate-tests/check-payload-claim/bad/README.md +15 -0
  82. package/payload/canon-kit/gate-tests/check-payload-claim/bad/expect.txt +2 -0
  83. package/payload/canon-kit/gate-tests/check-payload-claim/bad/install.md +19 -0
  84. package/payload/canon-kit/gate-tests/check-payload-claim/bad/posts/note.md +6 -0
  85. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +8 -0
  86. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/payload-claims.sh +7 -0
  87. package/payload/canon-kit/gate-tests/check-payload-claim/good/README.md +15 -0
  88. package/payload/canon-kit/gate-tests/check-payload-claim/good/expect.txt +2 -0
  89. package/payload/canon-kit/gate-tests/check-payload-claim/good/install.md +20 -0
  90. package/payload/canon-kit/gate-tests/check-payload-claim/good/posts/note.md +6 -0
  91. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +8 -0
  92. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/payload-claims.sh +7 -0
  93. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +27 -4
  94. package/payload/canon-kit/gate-tests/check-spec-dod-singleton.test.sh +21 -7
  95. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/.workflow/fixture-state.txt +2 -0
  96. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.gate +2 -0
  97. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.rs +4 -0
  98. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +4 -0
  99. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/templates/tmpl.sh +5 -0
  100. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +1 -0
  101. package/payload/canon-kit/gate-tests/check-spec-pointer/good/.workflow/fixture-state.txt +2 -0
  102. package/payload/canon-kit/gate-tests/check-spec-pointer/good/expect.txt +1 -1
  103. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.gate +2 -0
  104. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.rs +4 -0
  105. package/payload/canon-kit/gate-tests/check-spec-pointer/good/templates/tmpl.sh +5 -0
  106. package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +1 -0
  107. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/.workflow/fixture-state.txt +3 -0
  108. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.gate +2 -0
  109. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.rs +4 -0
  110. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/expect.txt +3 -0
  111. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/templates/tmpl.sh +5 -0
  112. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/.workflow/fixture-state.txt +3 -0
  113. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/expect.txt +1 -1
  114. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.gate +2 -0
  115. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.rs +4 -0
  116. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/templates/tmpl.sh +5 -0
  117. package/payload/canon-kit/gate-tests/check-tracking-claim.test.sh +1 -2
  118. package/payload/canon-kit/lib/spec.sh +109 -70
  119. package/payload/canon-kit/smoke/install.sh +21 -1
  120. package/payload/canon-kit/templates/SPEC-amendment.md +9 -2
  121. package/payload/context-kit/README.md +4 -1
  122. package/payload/context-kit/SPEC.md +166 -9
  123. package/payload/context-kit/bin/env-probe.sh +19 -6
  124. package/payload/context-kit/checks/check-brevity.sh +1 -0
  125. package/payload/context-kit/checks/check-footprint-fresh.sh +1 -0
  126. package/payload/context-kit/checks/check-memory-off.sh +1 -0
  127. package/payload/context-kit/checks/check-settings-paths.sh +94 -0
  128. package/payload/context-kit/checks/check-settings-pins.sh +1 -0
  129. package/payload/context-kit/gate-tests/check-settings-paths/bad/args +1 -0
  130. package/payload/context-kit/gate-tests/check-settings-paths/bad/expect.txt +3 -0
  131. package/payload/context-kit/gate-tests/check-settings-paths/bad/settings.json +12 -0
  132. package/payload/context-kit/gate-tests/check-settings-paths/bad/tools/real-tool.sh +4 -0
  133. package/payload/context-kit/gate-tests/check-settings-paths/good/args +1 -0
  134. package/payload/context-kit/gate-tests/check-settings-paths/good/expect.txt +1 -0
  135. package/payload/context-kit/gate-tests/check-settings-paths/good/settings.json +16 -0
  136. package/payload/context-kit/gate-tests/check-settings-paths/good/tools/real-tool.sh +4 -0
  137. package/payload/context-kit/index-tests/expected/toolfloor.txt +9 -0
  138. package/payload/context-kit/index-tests/toolfloor-cases.sh +20 -0
  139. package/payload/context-kit/lib/toolfloor.sh +15 -4
  140. package/payload/context-kit/smoke/agents-md.sh +12 -1
  141. package/payload/context-kit/smoke/install.sh +4 -1
  142. package/payload/delegation-kit/README.md +3 -3
  143. package/payload/delegation-kit/SPEC.md +499 -26
  144. package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +97 -0
  145. package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +1 -0
  146. package/payload/delegation-kit/checks/check-gate-tamper.sh +2 -1
  147. package/payload/delegation-kit/checks/check-rule-citation.sh +1 -0
  148. package/payload/delegation-kit/lib/delegation.sh +1 -0
  149. package/payload/delegation-kit/smoke/install.sh +2 -1
  150. package/payload/delegation-kit/templates/agent-dispatch-guard.sh +61 -0
  151. package/payload/delegation-kit/templates/agent-execution.md +127 -12
  152. package/payload/delegation-kit/templates/delegation-config.sh +4 -0
  153. package/payload/delegation-kit/templates/dispatch-checklists.md +1 -1
  154. package/payload/delegation-kit/templates/statusline-usage.sh +23 -1
  155. package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +30 -0
  156. package/payload/doctrine-kit/DOCTRINE.md +112 -11
  157. package/payload/doctrine-kit/README.md +12 -3
  158. package/payload/doctrine-kit/SPEC.md +163 -11
  159. package/payload/doctrine-kit/bin/install-doctrine.sh +167 -17
  160. package/payload/doctrine-kit/checks/check-doctrine-registration.sh +41 -11
  161. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/DOCTRINE.md +3 -0
  162. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/DOCTRINE.md +3 -0
  163. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +82 -2
  164. package/payload/doctrine-kit/smoke/install.sh +167 -1
  165. package/payload/drift-kit/README.md +3 -2
  166. package/payload/drift-kit/SPEC.md +264 -22
  167. package/payload/drift-kit/bin/kfric.sh +21 -2
  168. package/payload/drift-kit/bin/stage-economics.sh +157 -3
  169. package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +42 -0
  170. package/payload/drift-kit/smoke/install.sh +183 -1
  171. package/payload/drift-kit/templates/economics.md +9 -0
  172. package/payload/drift-kit/templates/kpis.list +6 -1
  173. package/payload/evidence-kit/README.md +20 -6
  174. package/payload/evidence-kit/SPEC.md +355 -17
  175. package/payload/evidence-kit/bin/run-validate.sh +51 -9
  176. package/payload/evidence-kit/checks/check-battery-roster.sh +87 -0
  177. package/payload/evidence-kit/checks/check-evidence-baseline.sh +1 -0
  178. package/payload/evidence-kit/checks/check-evidence-manifest.sh +1 -0
  179. package/payload/evidence-kit/checks/check-producer-liveness.sh +35 -0
  180. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/args +1 -0
  181. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/expect.txt +1 -0
  182. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/runner.md +14 -0
  183. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +7 -0
  184. package/payload/evidence-kit/gate-tests/check-battery-roster/good/args +1 -0
  185. package/payload/evidence-kit/gate-tests/check-battery-roster/good/expect.txt +1 -0
  186. package/payload/evidence-kit/gate-tests/check-battery-roster/good/runner.md +14 -0
  187. package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +7 -0
  188. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +68 -0
  189. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/args +1 -0
  190. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/expect.txt +1 -0
  191. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/run-validate.lock +1 -0
  192. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/args +1 -0
  193. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/expect.txt +2 -0
  194. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/run-validate.lock +1 -0
  195. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +109 -0
  196. package/payload/evidence-kit/lib/evidence.sh +18 -0
  197. package/payload/evidence-kit/smoke/install.sh +17 -3
  198. package/payload/gate-sdk/README.md +17 -1
  199. package/payload/gate-sdk/SPEC.md +4427 -92
  200. package/payload/gate-sdk/bin/build-native.sh +38 -0
  201. package/payload/gate-sdk/bin/enforcement-map.sh +2 -1
  202. package/payload/gate-sdk/bin/gen-pre-commit.sh +32 -2
  203. package/payload/gate-sdk/bin/port-blockers.sh +445 -0
  204. package/payload/gate-sdk/bin/run-consumer-smoke.sh +129 -2
  205. package/payload/gate-sdk/bin/run-gate-tests.sh +61 -9
  206. package/payload/gate-sdk/bin/run-gates.sh +37 -2
  207. package/payload/gate-sdk/bin/upgrade-smoke.sh +55 -7
  208. package/payload/gate-sdk/checks/check-action-gh-repo.gate +3 -0
  209. package/payload/gate-sdk/checks/check-action-pinning.gate +3 -0
  210. package/payload/gate-sdk/checks/check-action-run-shell.sh +4 -1
  211. package/payload/gate-sdk/checks/check-assertion-strength.gate +3 -0
  212. package/payload/gate-sdk/checks/check-commit-msg.sh +1 -0
  213. package/payload/gate-sdk/checks/check-commit-subject.sh +1 -0
  214. package/payload/gate-sdk/checks/check-core-files.sh +28 -4
  215. package/payload/gate-sdk/checks/check-crate-arms.sh +61 -0
  216. package/payload/gate-sdk/checks/check-enforcement-fresh.sh +1 -0
  217. package/payload/gate-sdk/checks/check-exec-bit.sh +21 -1
  218. package/payload/gate-sdk/checks/check-gate-assertions.sh +31 -6
  219. package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +107 -0
  220. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +7 -7
  221. package/payload/gate-sdk/checks/check-gate-fail-closed.sh +1 -0
  222. package/payload/gate-sdk/checks/check-gate-fixture-coverage.sh +1 -0
  223. package/payload/gate-sdk/checks/check-gate-output.sh +41 -3
  224. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +333 -0
  225. package/payload/gate-sdk/checks/check-graph.sh +5 -5
  226. package/payload/gate-sdk/checks/check-hook-exec-bit.sh +1 -0
  227. package/payload/gate-sdk/checks/check-identity.sh +1 -0
  228. package/payload/gate-sdk/checks/check-install-disposition.sh +92 -0
  229. package/payload/gate-sdk/checks/check-kit-enum.sh +1 -0
  230. package/payload/gate-sdk/checks/check-kit-registration.gate +3 -0
  231. package/payload/gate-sdk/checks/check-readme-roster.sh +6 -0
  232. package/payload/gate-sdk/checks/check-reads-couples.sh +71 -21
  233. package/payload/gate-sdk/checks/check-root-tiering.sh +1 -0
  234. package/payload/gate-sdk/checks/check-shellcheck.sh +1 -0
  235. package/payload/gate-sdk/checks/check-smoke-entry-guard.gate +3 -0
  236. package/payload/gate-sdk/checks/check-template-copy-parity.sh +1 -0
  237. package/payload/gate-sdk/checks/check-template-registry-parity.gate +3 -0
  238. package/payload/gate-sdk/checks/check-test-hermetic.gate +3 -0
  239. package/payload/gate-sdk/checks/check-tree-terms.sh +1 -0
  240. package/payload/gate-sdk/checks/check-workflow-tiering.sh +2 -1
  241. package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +16 -1
  242. package/payload/gate-sdk/gate-tests/check-core-files.test.sh +64 -0
  243. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/crate/Cargo.toml +7 -0
  244. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/crate/src/lib.rs +12 -0
  245. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/expect.txt +5 -0
  246. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/scripts/gate-sdk-config.sh +2 -0
  247. package/payload/gate-sdk/gate-tests/check-crate-arms/good/crate/Cargo.toml +7 -0
  248. package/payload/gate-sdk/gate-tests/check-crate-arms/good/crate/src/lib.rs +11 -0
  249. package/payload/gate-sdk/gate-tests/check-crate-arms/good/expect.txt +2 -0
  250. package/payload/gate-sdk/gate-tests/check-crate-arms/good/scripts/gate-sdk-config.sh +2 -0
  251. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -1
  252. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/args +2 -0
  253. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/expect.txt +5 -0
  254. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/kitroot/checks/check-vendored.gate +2 -0
  255. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/check-ported.gate +2 -0
  256. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +2 -0
  257. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gates.list +4 -0
  258. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stamp.txt +1 -0
  259. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stub-bin +6 -0
  260. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/args +2 -0
  261. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/expect.txt +5 -0
  262. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/kitroot/checks/check-vendored.gate +2 -0
  263. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/check-ported.gate +2 -0
  264. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +2 -0
  265. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gates.list +4 -0
  266. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stamp.txt +1 -0
  267. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stub-bin +5 -0
  268. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +81 -0
  269. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +3 -1
  270. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +3 -1
  271. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +3 -1
  272. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
  273. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-native-sample.gate +3 -0
  274. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +1 -0
  275. package/payload/gate-sdk/gate-tests/check-gate-output/bad/expect.txt +3 -0
  276. package/payload/gate-sdk/gate-tests/check-gate-output/bad/gates.list +1 -0
  277. package/payload/gate-sdk/gate-tests/check-gate-output/bad/native/Cargo.toml +4 -0
  278. package/payload/gate-sdk/gate-tests/check-gate-output/bad/native/src/gates/native_sample.rs +7 -0
  279. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-native-sample.gate +3 -0
  280. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +1 -0
  281. package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
  282. package/payload/gate-sdk/gate-tests/check-gate-output/good/gates.list +1 -0
  283. package/payload/gate-sdk/gate-tests/check-gate-output/good/native/Cargo.toml +4 -0
  284. package/payload/gate-sdk/gate-tests/check-gate-output/good/native/src/gates/native_sample.rs +11 -0
  285. package/payload/gate-sdk/gate-tests/check-gate-output.test.sh +111 -0
  286. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/args +2 -0
  287. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/conservation.md +7 -0
  288. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +12 -0
  289. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/impl/gate.rs +2 -0
  290. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kitroot/check-orphan.rs +3 -0
  291. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/publish.yml +15 -0
  292. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +3 -0
  293. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.gate +1 -0
  294. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.sh +3 -0
  295. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +1 -0
  296. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +6 -0
  297. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +3 -0
  298. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +3 -0
  299. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/targets.list +3 -0
  300. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/args +2 -0
  301. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/conservation.md +8 -0
  302. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -0
  303. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/impl/gate.rs +2 -0
  304. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kitroot/check-other.rs +3 -0
  305. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/publish.yml +15 -0
  306. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +3 -0
  307. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-ported.gate +2 -0
  308. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +6 -0
  309. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +2 -0
  310. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +3 -0
  311. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/targets.list +2 -0
  312. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +184 -0
  313. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-alpha.sh +6 -0
  314. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-delta.sh +5 -0
  315. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-epsilon.sh +6 -0
  316. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/smoke/install.sh +7 -0
  317. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/args +6 -0
  318. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/expect.txt +1 -0
  319. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/installer/lib/common/recipe.sh +9 -0
  320. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/scripts/gate-sdk-config.sh +5 -0
  321. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-alpha.sh +6 -0
  322. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-beta.gate +3 -0
  323. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-gamma.sh +6 -0
  324. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/smoke/install.sh +8 -0
  325. package/payload/gate-sdk/gate-tests/check-install-disposition/good/args +6 -0
  326. package/payload/gate-sdk/gate-tests/check-install-disposition/good/expect.txt +1 -0
  327. package/payload/gate-sdk/gate-tests/check-install-disposition/good/installer/lib/common/recipe.sh +10 -0
  328. package/payload/gate-sdk/gate-tests/check-install-disposition/good/scripts/gate-sdk-config.sh +5 -0
  329. package/payload/gate-sdk/gate-tests/check-kit-registration.test.sh +6 -5
  330. package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +139 -0
  331. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/templates/widgets.list +4 -0
  332. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-one.sh +3 -0
  333. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-two.sh +3 -0
  334. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +4 -0
  335. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +1 -0
  336. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/scripts/gate-sdk-config.sh +5 -0
  337. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/templates/widgets.list +4 -0
  338. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-one.sh +3 -0
  339. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-two.sh +3 -0
  340. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +8 -0
  341. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/rules.list +5 -0
  342. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/table.tsv +4 -0
  343. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -0
  344. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +5 -0
  345. package/payload/gate-sdk/gate-tests/check-test-hermetic-smoke.test.sh +2 -3
  346. package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +4 -4
  347. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +151 -1
  348. package/payload/gate-sdk/gate-tests/run-dispatch-streams.test.sh +73 -0
  349. package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +144 -0
  350. package/payload/gate-sdk/lib/consumer-smoke.sh +41 -4
  351. package/payload/gate-sdk/lib/gate.sh +208 -9
  352. package/payload/gate-sdk/lib/inject.sh +46 -1
  353. package/payload/gate-sdk/lib/test-hermetic.sh +26 -0
  354. package/payload/gate-sdk/smoke/install.sh +61 -1
  355. package/payload/guard-kit/README.md +18 -14
  356. package/payload/guard-kit/SPEC.md +366 -72
  357. package/payload/guard-kit/bin/compare-settings-allow.sh +40 -7
  358. package/payload/guard-kit/bin/run-guard-tests.sh +1 -0
  359. package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +64 -0
  360. package/payload/guard-kit/gate-tests/guard-read-path.test.sh +52 -0
  361. package/payload/guard-kit/guard-tests/cases.tsv +49 -7
  362. package/payload/guard-kit/lib/guard.sh +277 -54
  363. package/payload/guard-kit/templates/close-triage.md +38 -10
  364. package/payload/guard-kit/templates/guard-config.sh +3 -0
  365. package/payload/guard-kit/templates/settings-hooks.json +7 -1
  366. package/payload/lifecycle-kit/README.md +12 -1
  367. package/payload/lifecycle-kit/SPEC.md +991 -41
  368. package/payload/lifecycle-kit/bin/cite-survey.sh +81 -0
  369. package/payload/lifecycle-kit/bin/enter-stage.sh +139 -13
  370. package/payload/lifecycle-kit/bin/file-gap.sh +60 -2
  371. package/payload/lifecycle-kit/bin/file-survey.sh +69 -0
  372. package/payload/lifecycle-kit/checks/check-close-surfaces.sh +1 -0
  373. package/payload/lifecycle-kit/checks/check-gap-inbox-neutrality.gate +3 -0
  374. package/payload/lifecycle-kit/checks/check-lesson-disposition.gate +3 -0
  375. package/payload/lifecycle-kit/checks/check-lifecycle-registration.gate +3 -0
  376. package/payload/lifecycle-kit/checks/check-merge-attrs.gate +3 -0
  377. package/payload/lifecycle-kit/checks/check-scratch-citation.gate +3 -0
  378. package/payload/lifecycle-kit/checks/check-shim-restatement.gate +3 -0
  379. package/payload/lifecycle-kit/checks/check-skill-binding.gate +3 -0
  380. package/payload/lifecycle-kit/checks/check-stage-entry.sh +1 -0
  381. package/payload/lifecycle-kit/checks/check-stage-evidence.gate +3 -0
  382. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.gate +3 -0
  383. package/payload/lifecycle-kit/checks/check-survey-record.gate +3 -0
  384. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +1 -2
  385. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/args +2 -0
  386. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/expect.txt +3 -0
  387. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/gap-inbox.md +5 -0
  388. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/args +2 -0
  389. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/expect.txt +1 -0
  390. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/gap-inbox.md +4 -0
  391. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +2 -3
  392. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +2 -3
  393. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +1 -0
  394. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +1 -0
  395. package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +3 -3
  396. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/expect.txt +1 -0
  397. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/scripts/lifecycle-config.sh +4 -0
  398. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/surfaces/queue.md +13 -0
  399. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/expect.txt +1 -0
  400. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/scripts/lifecycle-config.sh +4 -0
  401. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/surfaces/queue.md +31 -0
  402. package/payload/lifecycle-kit/gate-tests/check-shim-restatement.test.sh +2 -3
  403. package/payload/lifecycle-kit/gate-tests/check-skill-binding.test.sh +2 -3
  404. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +2 -3
  405. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +9 -5
  406. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/args +2 -0
  407. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +4 -0
  408. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +18 -0
  409. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/args +2 -0
  410. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -0
  411. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +13 -0
  412. package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +83 -0
  413. package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +122 -0
  414. package/payload/lifecycle-kit/gate-tests/rename-iteration.test.sh +142 -0
  415. package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +102 -0
  416. package/payload/lifecycle-kit/gate-tests/workflow-state-guard.test.sh +100 -0
  417. package/payload/lifecycle-kit/lib/stages.sh +12 -2
  418. package/payload/lifecycle-kit/smoke/install.sh +83 -4
  419. package/payload/lifecycle-kit/templates/consult.md +73 -0
  420. package/payload/lifecycle-kit/templates/lead.md +139 -7
  421. package/payload/lifecycle-kit/templates/stages/align.md +12 -0
  422. package/payload/lifecycle-kit/templates/stages/build.md +8 -0
  423. package/payload/lifecycle-kit/templates/stages/close.md +45 -5
  424. package/payload/lifecycle-kit/templates/stages/scope.md +42 -3
  425. package/payload/lifecycle-kit/templates/stages/spec.md +13 -1
  426. package/payload/lifecycle-kit/templates/stages/validate.md +8 -0
  427. package/payload/lifecycle-kit/templates/workflow-state-guard.sh +29 -0
  428. package/payload/queue-kit/README.md +6 -1
  429. package/payload/queue-kit/SPEC.md +350 -6
  430. package/payload/queue-kit/bin/queue-counts.sh +35 -0
  431. package/payload/queue-kit/bin/queue-edges.sh +78 -0
  432. package/payload/queue-kit/checks/check-queue-entry-budget.gate +3 -0
  433. package/payload/queue-kit/checks/check-queue-hygiene.gate +3 -0
  434. package/payload/queue-kit/checks/check-queue-prose-precondition.sh +1 -0
  435. package/payload/queue-kit/checks/check-queue-sections.gate +3 -0
  436. package/payload/queue-kit/checks/check-queue-slug-liveness.gate +3 -0
  437. package/payload/queue-kit/checks/check-queue-wrap.gate +3 -0
  438. package/payload/queue-kit/checks/check-roadmap-fresh.sh +1 -0
  439. package/payload/queue-kit/checks/check-tag-lead-line.gate +3 -0
  440. package/payload/queue-kit/checks/check-task-conservation.gate +4 -0
  441. package/payload/queue-kit/checks/check-task-names.gate +3 -0
  442. package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +5 -0
  443. package/payload/queue-kit/gate-tests/queue-counts.test.sh +116 -0
  444. package/payload/queue-kit/gate-tests/queue-edges.test.sh +130 -0
  445. package/payload/queue-kit/gate-tests/queue-lib-parity.test.sh +215 -0
  446. package/payload/queue-kit/lib/queue.sh +4 -19
  447. package/payload/queue-kit/smoke/install.sh +4 -1
  448. package/payload/queue-kit/templates/TASK-QUEUE.md +3 -0
  449. package/payload/site-kit/SPEC.md +64 -27
  450. package/payload/site-kit/checks/check-docs-cname-parity.sh +1 -0
  451. package/payload/site-kit/checks/check-docs-render-fidelity.sh +1 -0
  452. package/payload/site-kit/smoke/install.sh +9 -1
  453. package/profiles.list +36 -8
  454. package/payload/canon-kit/checks/check-comment-tier.sh +0 -211
  455. package/payload/canon-kit/checks/check-deprecation-task.sh +0 -90
  456. package/payload/canon-kit/checks/check-docs-cmd.sh +0 -153
  457. package/payload/canon-kit/checks/check-install-claim.sh +0 -146
  458. package/payload/canon-kit/checks/check-knob-citation.sh +0 -117
  459. package/payload/canon-kit/checks/check-manifest-count.sh +0 -46
  460. package/payload/canon-kit/checks/check-manifest-temporal.sh +0 -83
  461. package/payload/canon-kit/checks/check-md-refs.sh +0 -128
  462. package/payload/canon-kit/checks/check-prose-enum.sh +0 -115
  463. package/payload/canon-kit/checks/check-spec-derivable-section.sh +0 -69
  464. package/payload/canon-kit/checks/check-spec-dod-singleton.sh +0 -45
  465. package/payload/canon-kit/checks/check-spec-fence-balance.sh +0 -42
  466. package/payload/canon-kit/checks/check-spec-pointer.sh +0 -180
  467. package/payload/canon-kit/checks/check-todo-task-liveness.sh +0 -80
  468. package/payload/canon-kit/checks/check-tracking-claim.sh +0 -136
  469. package/payload/gate-sdk/checks/check-action-gh-repo.sh +0 -321
  470. package/payload/gate-sdk/checks/check-action-pinning.sh +0 -55
  471. package/payload/gate-sdk/checks/check-assertion-strength.sh +0 -134
  472. package/payload/gate-sdk/checks/check-kit-registration.sh +0 -68
  473. package/payload/gate-sdk/checks/check-smoke-entry-guard.sh +0 -53
  474. package/payload/gate-sdk/checks/check-test-hermetic.sh +0 -119
  475. package/payload/lifecycle-kit/checks/check-lesson-disposition.sh +0 -98
  476. package/payload/lifecycle-kit/checks/check-lifecycle-registration.sh +0 -54
  477. package/payload/lifecycle-kit/checks/check-merge-attrs.sh +0 -69
  478. package/payload/lifecycle-kit/checks/check-shim-restatement.sh +0 -97
  479. package/payload/lifecycle-kit/checks/check-skill-binding.sh +0 -59
  480. package/payload/lifecycle-kit/checks/check-stage-evidence.sh +0 -81
  481. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.sh +0 -47
  482. package/payload/queue-kit/checks/check-queue-entry-budget.sh +0 -104
  483. package/payload/queue-kit/checks/check-queue-hygiene.sh +0 -81
  484. package/payload/queue-kit/checks/check-queue-sections.sh +0 -44
  485. package/payload/queue-kit/checks/check-queue-slug-liveness.sh +0 -63
  486. package/payload/queue-kit/checks/check-queue-wrap.sh +0 -56
  487. package/payload/queue-kit/checks/check-tag-lead-line.sh +0 -70
  488. package/payload/queue-kit/checks/check-task-conservation.sh +0 -50
  489. package/payload/queue-kit/checks/check-task-names.sh +0 -128
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env bash
2
+ # spec: delegation-kit/SPEC.md §Testing — decision-table runner for the Agent dispatch-shape guard (D1 fork ban, D2 read-only isolation claim, D3 nested-dispatch advisory)
3
+ #
4
+ # usage: run-dispatch-guard-tests.sh [cases.tsv]
5
+ set -uo pipefail
6
+
7
+ KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
8
+ GUARD="$KIT/templates/agent-dispatch-guard.sh"
9
+ LIB="$KIT/../guard-kit/lib/guard.sh"
10
+ CASES="${1:-$KIT/usage-tests/dispatch-guard-cases.tsv}"
11
+
12
+ for f in "$GUARD" "$LIB" "$CASES"; do
13
+ [[ -f "$f" ]] || { echo "run-dispatch-guard-tests: missing $f" >&2; exit 2; }
14
+ done
15
+ command -v jq >/dev/null 2>&1 || { echo "run-dispatch-guard-tests: jq not found on PATH" >&2; exit 2; }
16
+
17
+ # spec: delegation-kit/SPEC.md §Testing — strip ambient DELEGATION_KIT_* at every guard invocation, the discipline run-budget-guard-tests.sh already uses, so a consumer's live roster or config-file pointer cannot leak into the fixture
18
+ DK_UNSET=()
19
+ while IFS= read -r name; do DK_UNSET+=(-u "$name"); done < <(env | grep -o '^DELEGATION_KIT_[A-Za-z0-9_]*')
20
+
21
+ SANDBOX="$(mktemp -d)"
22
+ trap 'rm -rf "$SANDBOX"' EXIT
23
+ ROSTER_CFG="$SANDBOX/roster-config.sh"
24
+ ERR="$SANDBOX/err"
25
+ printf '%s\n' 'DELEGATION_KIT_READONLY_TYPES=(ro-type)' > "$ROSTER_CFG"
26
+
27
+ classify() {
28
+ local rc="$1" out="$2"
29
+ if [[ "$rc" -eq 2 ]]; then echo block; return; fi
30
+ if [[ "$rc" -ne 0 ]]; then echo "exit$rc"; return; fi
31
+ if grep -q '"additionalContext"' <<<"$out"; then echo advise; return; fi
32
+ if [[ -z "$out" ]]; then echo fallthrough; return; fi
33
+ echo unknown
34
+ }
35
+
36
+ # spec: delegation-kit/SPEC.md §Testing — builds a real hook payload (tool_input plus, for a nested case, the top-level agent_id/agent_type the harness only sets inside a subagent), so the guard's own jq extraction is exercised rather than a hand-rolled shortcut
37
+ build_payload() {
38
+ local type="$1" isolation="$2" nested="$3" nb='false'
39
+ [[ "$nested" == yes ]] && nb='true'
40
+ jq -nc --arg t "$type" --arg iso "$isolation" --argjson nested "$nb" '
41
+ {tool_name: "Agent",
42
+ tool_input: (
43
+ (if $t != "" then {subagent_type: $t} else {} end)
44
+ + (if $iso != "" then {isolation: $iso} else {} end)
45
+ )}
46
+ + (if $nested then {agent_id: "agent_child", agent_type: "stage-session"} else {} end)
47
+ '
48
+ }
49
+
50
+ fails=0
51
+ ran=0
52
+
53
+ while IFS=$'\t' read -r want rawtype isolation nested desc; do
54
+ [[ -z "${want// }" ]] && continue
55
+ [[ "$want" == \#* ]] && continue
56
+
57
+ type="$rawtype"
58
+ cfg_file="$ROSTER_CFG"
59
+ case "$rawtype" in
60
+ noroster:*) type="${rawtype#noroster:}"; cfg_file="" ;;
61
+ esac
62
+
63
+ iso="$isolation"; [[ "$iso" == "-" ]] && iso=""
64
+ nst="$nested"; [[ "$nst" != "yes" ]] && nst="no"
65
+
66
+ if [[ "$rawtype" == "UNPARSEABLE" ]]; then
67
+ payload='this is not { json'
68
+ else
69
+ payload="$(build_payload "$type" "$iso" "$nst")"
70
+ fi
71
+
72
+ envargs=(GUARD_KIT_LIB="$LIB")
73
+ [[ -n "$cfg_file" ]] && envargs+=(DELEGATION_KIT_CONFIG_FILE="$cfg_file")
74
+
75
+ out="$( cd "$SANDBOX" && printf '%s' "$payload" \
76
+ | env "${DK_UNSET[@]}" "${envargs[@]}" bash "$GUARD" 2>"$ERR" )"
77
+ rc=$?
78
+ err="$(cat "$ERR" 2>/dev/null)"
79
+ got="$(classify "$rc" "$out")"
80
+ ran=$((ran + 1))
81
+
82
+ if [[ "$got" != "$want" ]]; then
83
+ echo " FAIL [$desc]: want '$want', got '$got' (rc=$rc) -- out=$out err=$err"
84
+ fails=$((fails + 1))
85
+ fi
86
+ done < "$CASES"
87
+
88
+ if [[ "$ran" -eq 0 ]]; then
89
+ echo "run-dispatch-guard-tests: no cases parsed from $CASES" >&2
90
+ exit 2
91
+ fi
92
+ if [[ "$fails" -gt 0 ]]; then
93
+ echo "run-dispatch-guard-tests: $fails/$ran case(s) failed"
94
+ exit 1
95
+ fi
96
+ echo "run-dispatch-guard-tests: ok ($ran cases across D1/D2/D3 and the degradation posture)"
97
+ exit 0
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # graph: couples=.claude/agents/*.md dir=one valve=none tier=precommit
3
+ # install: on-surface
3
4
  # spec: delegation-kit/SPEC.md §check-agent-tier-explicit — every agent definition under the scanned directory declares a `model:` field in its frontmatter (an explicit `inherit` passes; only omission reds)
4
5
  #
5
6
  # usage: check-agent-tier-explicit.sh [agent-dir]
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
  # graph: couples=kit:*.sh dir=one valve=none tier=precommit
3
- # spec: delegation-kit/SPEC.md §Validate after every agent commit — a gate-weakening commit is blocked by shape (A gate edits stay meta-isolated; B a new path-exemption can't excuse a co-staged file)
3
+ # install: zero-config
4
+ # spec: delegation-kit/SPEC.md §Verify after every agent commit — a gate-weakening commit is blocked by shape (A gate edits stay meta-isolated; B a new path-exemption can't excuse a co-staged file)
4
5
  #
5
6
  # --fixture <dir> injects staged-files / added-exemptions lists; live mode reads git diff --cached.
6
7
  set -uo pipefail
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # graph: couples=delegation-kit/SPEC.md,delegation-kit/templates/agent-execution.md dir=one valve=none tier=precommit
3
+ # install: on-surface
3
4
  # spec: delegation-kit/SPEC.md §One template, a resident pointer — every `the template's **<name>** rule` citation in SPEC §The delegation model resolves to a template bullet's bold lead-in (forward direction only)
4
5
  #
5
6
  # usage: check-rule-citation.sh [spec-file [template-file]]
@@ -31,6 +31,7 @@ unset _dk_cfg
31
31
 
32
32
  declare -p DELEGATION_KIT_GATE_FILES &>/dev/null || DELEGATION_KIT_GATE_FILES=(
33
33
  "${GATE_SDK_GATES_DIR:-scripts}/check-*.sh"
34
+ "${GATE_SDK_GATES_DIR:-scripts}/check-*.gate"
34
35
  "${GATE_SDK_GATES_DIR:-scripts}/lib/gate.sh"
35
36
  "${GATE_SDK_GATES_DIR:-scripts}/run-gate-tests.sh"
36
37
  )
@@ -15,6 +15,7 @@ cat >> scripts/gates.list <<'EOF'
15
15
  # delegation-kit
16
16
  check-gate-tamper
17
17
  check-agent-tier-explicit
18
+ check-rule-citation
18
19
  EOF
19
20
 
20
21
  snap="$(mktemp)"
@@ -59,4 +60,4 @@ cmp -s "$pp/usage.before" "$pp/usage.txt" || {
59
60
  rm -rf "$pp"
60
61
 
61
62
  bash "$SDK/bin/gen-pre-commit.sh" --write >/dev/null
62
- bash "$SDK/checks/check-graph.sh" --emit > .workflow/CHECK-GRAPH.html
63
+ bash "$SDK/checks/check-graph.sh" --emit > scripts/CHECK-GRAPH.html
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env bash
2
+ # spec: delegation-kit/SPEC.md §The delegation model — consumer-copy PreToolUse(Agent) dispatch-shape guard: D1 fork ban, D2 read-only isolation claim, D3 nested-dispatch advisory; register under matcher `Agent` beside the budget guard (§Layout and configuration)
3
+ set -uo pipefail
4
+
5
+ # shellcheck disable=SC2034 # consumed by the sourced lib/guard.sh (guard_block/guard_advise)
6
+ GUARD_NAME="agent-dispatch-guard"
7
+ GUARD_KIT_LIB="${GUARD_KIT_LIB:-guard-kit/lib/guard.sh}"
8
+ [[ -f "$GUARD_KIT_LIB" ]] || exit 0
9
+ # shellcheck source=/dev/null # vendored lib path is resolved at runtime; fail-open above if absent, but the lib's own exit 2 (set-but-missing config) must stay loud
10
+ source "$GUARD_KIT_LIB"
11
+
12
+ # spec: delegation-kit/SPEC.md §The delegation model — D2's roster is the only knob read here, so delegation-kit's validating loader is deliberately not sourced: a malformed *unrelated* knob must not wedge every dispatch
13
+ _adg_cfg="${DELEGATION_KIT_CONFIG_FILE:-${GATE_SDK_GATES_DIR:-scripts}/delegation-config.sh}"
14
+ _adg_roster_unreadable=""
15
+ if [[ -n "${DELEGATION_KIT_CONFIG_FILE:-}" && ! -f "$_adg_cfg" ]]; then
16
+ _adg_roster_unreadable="DELEGATION_KIT_CONFIG_FILE names no readable file"
17
+ elif [[ -f "$_adg_cfg" ]]; then
18
+ # shellcheck source=/dev/null # consumer-supplied config, path is config
19
+ source "$_adg_cfg"
20
+ fi
21
+ declare -p DELEGATION_KIT_READONLY_TYPES >/dev/null 2>&1 || DELEGATION_KIT_READONLY_TYPES=()
22
+
23
+ # spec: delegation-kit/SPEC.md §The delegation model — fail-open-but-loud: keep every advisory literal below free of any character JSON must escape, because the jq-absent arm hand-writes the envelope with no escaper
24
+ _adg_advise() {
25
+ local msg="agent-dispatch-guard: $1"
26
+ command -v jq >/dev/null 2>&1 && guard_advise "$msg"
27
+ printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","additionalContext":"%s"}}\n' "$msg"
28
+ exit 0
29
+ }
30
+
31
+ _adg_degraded() {
32
+ _adg_advise "allowed this dispatch WITHOUT enforcing the fork ban (D1) or the read-only isolation claim (D2) — $1. Check the dispatch by hand: no fork, and a child claimed read-only takes isolation: worktree (delegation-kit/SPEC.md §The delegation model)."
33
+ }
34
+
35
+ input="$(cat 2>/dev/null || true)"
36
+
37
+ command -v jq >/dev/null 2>&1 || _adg_degraded "jq is not on PATH, so the payload could not be read"
38
+
39
+ _adg_fields="$(printf '%s' "$input" | jq -r 'if (.tool_input | type) == "object" then [(.tool_input.subagent_type // ""), (.tool_input.isolation // ""), (if .agent_id then "nested" else "" end)] | @tsv else empty end' 2>/dev/null || true)"
40
+ [[ -n "$_adg_fields" ]] || _adg_degraded "the hook payload did not parse, or carried no tool_input object"
41
+
42
+ # spec: delegation-kit/SPEC.md §The delegation model — split on a non-whitespace separator: bash collapses runs of a *whitespace* IFS, so a tab split would silently shift an absent middle field onto the next name
43
+ IFS=$'\037' read -r _adg_type _adg_isolation _adg_nested <<<"${_adg_fields//$'\t'/$'\037'}"
44
+
45
+ # spec: delegation-kit/SPEC.md §The delegation model — D1 precedes D2 because the fork ban is unconditional and its message is the more specific one for a dispatch violating both
46
+ if [[ "$_adg_type" == "fork" ]]; then
47
+ guard_block "a fork inherits the dispatcher's whole context, toolset and model tier and disclaims nothing, so any narrowing this prompt states exists only as a sentence. Two lawful alternatives: dispatch a TYPED agent whose definition carries the narrower authority, brief and tier, so the narrowing is structural rather than requested; or, where the child does the same job at the same authority and you only want parallelism or its own index, dispatch that typed agent with isolation: worktree. There is no per-dispatch override — a knob here would restore the honour system this rule replaced, so the valve is unregistering the hook. The full protocol is /agent-execution (delegation-kit/SPEC.md §The delegation model)."
48
+ fi
49
+
50
+ if [[ -n "$_adg_type" && "$_adg_isolation" != "worktree" && ${#DELEGATION_KIT_READONLY_TYPES[@]} -gt 0 ]]; then
51
+ for _adg_ro in "${DELEGATION_KIT_READONLY_TYPES[@]}"; do
52
+ [[ "$_adg_type" == "$_adg_ro" ]] && guard_block "'$_adg_type' is declared a read-only dispatch type (DELEGATION_KIT_READONLY_TYPES), but this dispatch's shape grants write reach — a subagent inherits its toolset from its type whatever the prompt says, and a type carrying no Edit or Write still reaches git through its shell. Make the claim with the shape: add isolation: worktree, whose commits and index are the child's own, and which the harness auto-cleans when the child really was read-only. If this type is not in fact dispatched read-only, drop it from the roster rather than working around the rule here (delegation-kit/SPEC.md §The delegation model)."
53
+ done
54
+ fi
55
+
56
+ _adg_notes=""
57
+ [[ -n "$_adg_roster_unreadable" ]] && _adg_notes="D2 (the read-only isolation claim) went unenforced on this dispatch: $_adg_roster_unreadable. "
58
+ [[ "$_adg_nested" == "nested" ]] && _adg_notes="${_adg_notes}you are yourself a dispatched agent, so this call creates a grandchild with no upward channel to you: it cannot message you mid-run, and neither level knows its own address or its parent's. Give it return-value-only work, or grant it a durable path in the main checkout, named absolutely in its prompt, and read that path yourself (delegation-kit/SPEC.md §Operative residency)."
59
+
60
+ [[ -n "$_adg_notes" ]] || exit 0
61
+ _adg_advise "$_adg_notes"
@@ -11,6 +11,13 @@ For a **deletion, rename, or heavy cross-spec audit** dispatch, also load the
11
11
  mechanical pre-flight in [dispatch-checklists.md](dispatch-checklists.md) — a
12
12
  reach-through, not a change to this protocol; every rule below still applies.
13
13
 
14
+ Two bullets below — **Background + notification, never poll** and **Findings you
15
+ will act on are durable before you act on them** — bind a dispatched role that
16
+ fires no trigger loading this template, so each is also stated as a bare
17
+ imperative in the consumer's always-loaded agent definition under
18
+ delegation-kit/SPEC.md §Operative residency. That copy is sanctioned rather than
19
+ drift: do not delete it on sight, and when either rule changes here, propagate.
20
+
14
21
  - **Supervisor owns rulings; agents surface, never guess.** SECURITY and design
15
22
  rulings (e.g. a privileged caller set, a naming collision) are decided by the
16
23
  supervisor and handed down; an agent that hits anything its brief doesn't cover
@@ -40,7 +47,7 @@ reach-through, not a change to this protocol; every rule below still applies.
40
47
  role has.
41
48
  - **Serialize on shared files; ≤`DELEGATION_KIT_FAN_WIDTH`-wide otherwise.**
42
49
  Agents that edit a shared file (see the roster below) run one at a time —
43
- dispatch, await notification, validate, dispatch the next. Independent
50
+ dispatch, await notification, verify, dispatch the next. Independent
44
51
  read-only units may run ≤`DELEGATION_KIT_FAN_WIDTH`-wide. **The git index and
45
52
  HEAD are shared files for every agent that commits**, independent of
46
53
  source-file disjointness: two committing agents racing `git add`/`git commit`
@@ -50,12 +57,62 @@ reach-through, not a change to this protocol; every rule below still applies.
50
57
  ≤`DELEGATION_KIT_FAN_WIDTH`-wide bound for **read-only** fan-outs. "No lockfile
51
58
  churn" is a false safety signal — the index is shared regardless.
52
59
  Serialization is by **completion**, not by notification: the next dispatch
53
- begins after the previous one has *returned and been validated*. A supervisor
60
+ begins after the previous one has *returned and been verified*. A supervisor
54
61
  reaches that point via the completion notification; a **dispatched agent**
55
62
  reaches it in-turn, awaiting each child before dispatching the next (it cannot
56
63
  end its turn to wait — see the backgrounding rule). The ordering requirement
57
64
  is identical for both; only the waiting mechanism differs, and neither role
58
65
  may overlap two agents on a shared file or the git index.
66
+ - **Never dispatch a fork to narrow a child.** A fork is wrong exactly when the
67
+ dispatch's purpose is that the child does *less* than the parent: a fork
68
+ inherits the parent's context, toolset and model tier whole and disclaims
69
+ nothing, so every narrowing survives only as a sentence in the prompt. Three
70
+ dispatching contexts, each with its own grounds. A **read-only audit or
71
+ survey** wants narrower *authority* — the fork carries the parent's full
72
+ reach, so the restriction is a request, and one such fork completed a whole
73
+ stage, commits included. A **tier-split oracle** wants narrower *cost* — the
74
+ fork inherits the dispatcher's model, which is exactly the split the posture
75
+ exists to make (a lead posture that dispatches its own oracle is the named
76
+ instance). A **rule-injection dispatch** wants a *different* brief — attested
77
+ where five sibling forks each carried a line explaining that the roster's
78
+ agent definitions do not carry it, so fork was chosen to inject rules the
79
+ types lack and every one still paid to re-materialize its parent's context.
80
+ The boundary, stated honestly: a fork stays correct where the child does the
81
+ **same job at the same authority** and only parallelism or isolation is
82
+ wanted. The dispatch guard blocks there too, because a hook cannot read
83
+ intent and no sanctioned fork use exists in this doctrine — the valve is
84
+ unregistering the hook, never a per-dispatch knob, which would restore the
85
+ honour system the rule replaced (delegation-kit/SPEC.md §The delegation
86
+ model). Grounds measured rather than asserted: in one audited iteration ten
87
+ of twenty-four dispatched agents were forks, carrying 20.90 USD of 158.70 USD
88
+ of priced burn.
89
+ - **A read-only claim is made by isolation, not by sentence.** A brief saying
90
+ "read-only, no edits" makes no claim: a subagent inherits its toolset from its
91
+ **type**, never from the instruction text. The claim is made by
92
+ `isolation: worktree`. Take it for an agent that *will* commit — an **own
93
+ index**, the **Serialize on shared files** rule above — and for any agent
94
+ *claimed* read-only, as **write confinement**. Grounds for this rule and the
95
+ next: delegation-kit/SPEC.md §The delegation model.
96
+ - **Isolation charges three harness costs, and paying them is the parent's job.**
97
+ **(1) The worktree's base is configuration, and the default is not HEAD.**
98
+ `worktree.baseRef` selects it: `fresh` (the default) branches from
99
+ `origin/<default-branch>`, `head` from the dispatcher's local HEAD. Set it
100
+ deliberately, and pin it, before you design around it. Under `fresh` a child
101
+ reads the *pre-change* tree: read your exposure with
102
+ `git log origin/<default-branch>..HEAD` before dispatching. Naming a commit in
103
+ the prompt does not make the checkout that commit, so state the rev and have
104
+ the child verify it with `git rev-parse HEAD` and read every target with
105
+ `git show <rev>:<path>`. **A child whose target is unreadable at that rev stops
106
+ and says so**, and never falls back to the dispatch prompt's own paraphrase of
107
+ it. **(2) The worktree lands inside the repo and untracked**, so an in-flight
108
+ isolated agent reads as a dirty tree and aborts every clean-tree precondition —
109
+ a consumer smoke, a packaging step, any commit. Gitignore the path, and reap
110
+ agents at the boundary with `git worktree list` rather than off `git status`.
111
+ **(3) An isolated child sees only committed state.** Untracked and gitignored
112
+ files are in no commit, so no base ref reaches them and naming a rev does not
113
+ help. **A sweep whose corpus includes an untracked surface is not delegable to
114
+ an isolated agent**: read that surface yourself, or pass its content in the
115
+ prompt.
59
116
  - **One commit per unit, sized to finish within budget.** Each unit gets its own
60
117
  commit (+ a `[blocked-by: prior]` tag where ordered). A unit that investigates
61
118
  long before its first commit is the only thing an interrupt can destroy —
@@ -97,13 +154,48 @@ reach-through, not a change to this protocol; every rule below still applies.
97
154
  their final message — which makes the journal mechanic non-functional exactly
98
155
  when it matters (a long, interruptible run). So: for a **read-only fan-out**
99
156
  (audit, survey), the return value *is* the contract — don't rely on a journal.
100
- Reserve the journal / worktree isolation for agents that **mutate files**, and
101
- for those grant the journal path explicitly before dispatch rather than
102
- assuming the write succeeds. A contract has two ends, though: the child owes
157
+ Reserve the **journal** for agents that **mutate files**, and for those grant
158
+ the journal path explicitly before dispatch rather than assuming the write
159
+ succeeds. **Worktree isolation is not reserved with it** — the two answer
160
+ different questions, and bundling them read as *a read-only fan-out needs no
161
+ isolation*, which is the reading that licensed an unreviewed commit on the
162
+ shared branch. A read-only fan-out takes isolation precisely *because* it is
163
+ claimed read-only (the **A read-only claim is made by isolation, not by
164
+ sentence** rule above). A contract has two ends, though: the child owes
103
165
  no journal, and the **parent** owes the durable landing of what it received
104
166
  before acting on it (next bullet). The caveat is about a backgrounded child's
105
167
  write failing silently, so it never licensed the parent — which has already
106
168
  demonstrated it can write, being the session that granted the path.
169
+ - **A child's only upward route is a durable artifact.** Probed, not assumed: a
170
+ child's sends to an invented dispatcher name and to its own agent type both
171
+ failed, only a send addressed to the **top-level session** arrived, and
172
+ neither level knows its own identity or its parent's. There is therefore no
173
+ address a child can use to reach the agent that dispatched it, and four
174
+ dispositions follow. **(1) A durable artifact, for anything mid-run** — the
175
+ dispatcher mints a path, names it **absolute into the main checkout** in the
176
+ prompt, and the child writes as it goes. That is already the journal rule
177
+ above; it is now also the *only* upward route there is, and it is stronger
178
+ than a message would be, because a file survives a child that dies before
179
+ returning. A **stop signal takes the same shape** — a sentinel the child
180
+ checks — so it is cooperative by construction and a wedged child stays out of
181
+ reach. **(2) Return-value only, otherwise** — a fan-out needing no mid-run
182
+ channel needs no artifact, which is the read-only carve-out above. **(3) The
183
+ downward half is a dispatch-shape rule** — a dispatcher that wants control
184
+ over its fan-out dispatches in the background and keeps the handle; what
185
+ actually failed was a dispatcher blocked on a foreground dispatch, holding
186
+ neither the handle nor a turn. **(4) Naming the address a child should use is
187
+ refused** — there is none, and the refusal is stated rather than omitted
188
+ because it is the first thing both original filings reached for. Two
189
+ corollaries defeat the workarounds a reader would otherwise invent: a message
190
+ that does reach the top-level session is attributed to the sender's **type**,
191
+ so a fan-out wider than one is ambiguous at the receiving end; and a child
192
+ resumed by a message from its dispatcher still cannot reply, so being
193
+ addressed creates no return path. One live hazard rides with them: the
194
+ message and stop tools may be **deferred** for a dispatched agent — callable
195
+ only after a discovery call it has to know to make — so a child that needs to
196
+ escalate may not hold the channel at all. Hence the obligation, which is the
197
+ part that binds you: **a dispatcher handing out work that will need a mid-run
198
+ channel grants a durable path with it**, and reads that path itself.
107
199
 
108
200
  - **Findings you will act on are durable before you act on them.** A child's
109
201
  return value lives only in your context, and your context dies with your
@@ -112,13 +204,25 @@ reach-through, not a change to this protocol; every rule below still applies.
112
204
  survives you: a commit, or your own journal. The write is the parent's,
113
205
  discharged on receipt, not a chore delegated back to the child. This binds
114
206
  whoever holds findings they will act on, at any depth. It costs one write per
115
- returned child, not a running narration. A session that is itself dispatched
116
- writes to the journal path it was granted; a top-level session has no journal
117
- in this contract and discharges by committing, which it is by construction
118
- able to do.
119
- - **Validate after every agent commit** — a sub-agent's "passed" claim is not
207
+ returned child, not a running narration. The obligation is **durability**, and
208
+ committing and journalling are two ways to discharge it — a session uses
209
+ whichever is available to it. A dispatched session journals, to the path it was
210
+ granted, because it cannot commit. A top-level session commits, because it can.
211
+ A top-level session that *cannot* commit right now — another session is holding
212
+ the shared index, the normal condition while an iteration is running — journals
213
+ for as long as that holds, and discharges by committing when the index frees.
214
+ Neither the supervising role nor a session running outside any dispatch is
215
+ exempt: the axis is what the session can do at this moment, never what it is.
216
+ - **Verify after every agent commit** — a sub-agent's "passed" claim is not
120
217
  trustworthy. Re-run the relevant gates (the sweep's own gate) and the consumer
121
- validate battery below. **Diff every gate change in an agent commit before
218
+ validate battery below — the act is `verify`, the artifact is the battery.
219
+ **Never verify a unit by re-running the producer of what it delivered**: where
220
+ the unit's deliverable *is* an evidence artifact, the verify is a **read** of
221
+ the committed artifact, because re-running its sole writer overwrites or
222
+ duplicates the record instead of checking it. Having already run the wrong
223
+ check, read delegation-kit/SPEC.md §Verify after every agent commit for which
224
+ of the two re-runs you are holding — only one of them leaves evidence to
225
+ restore. **Diff every gate change in an agent commit before
122
226
  accepting** — a gate modification inside a feature commit is a supervisor-owned
123
227
  ruling; an agent blocked by a gate will weaken it (a false exemption) to make
124
228
  its commit pass instead of fixing the code. "The gate is in my way" almost
@@ -127,8 +231,19 @@ reach-through, not a change to this protocol; every rule below still applies.
127
231
  two attested shapes (a gate edit co-staged with product code; a new path/glob
128
232
  exemption co-staged with the file it excuses) — but it does **not** catch
129
233
  semantic weakening inside a legitimate scripts-only commit, so the by-eye diff
130
- review remains your duty (delegation-kit/SPEC.md §Validate after every agent
234
+ review remains your duty (delegation-kit/SPEC.md §Verify after every agent
131
235
  commit — the honest limit).
236
+ - **A child's citation is a pointer to verify, never evidence in itself.** A
237
+ returned `file:line` is not checked by confirming the range resolves: that
238
+ catches a wrong number and misses a wrong spelling, a moved passage, and a
239
+ sibling instance the sweep never reported. **Re-read the passage** in the parent
240
+ before acting on it. Both halves are attested here — a census that fabricated a
241
+ `file:line` and a negative claim, both false; and a re-verification of nineteen
242
+ agent-sourced cites that found no bad ranges yet still surfaced a marker cited
243
+ under a spelling the tree does not use, plus an entire family member the census
244
+ never mentioned. Quotation with attribution is precisely the signal a reader uses
245
+ to decide a claim has already been checked, so an unverified one defeats normal
246
+ trust rather than merely being wrong.
132
247
  - **Budget-check before *each* dispatch in a fan-out**, not once at the start.
133
248
  `bash delegation-kit/bin/usage-verdict.sh` (verdict exit 0/1/2 from `usage.txt` —
134
249
  it folds in the reading-age and window-validity checks so a dead-window pct
@@ -1,2 +1,6 @@
1
1
  # shellcheck shell=bash
2
2
  # spec: delegation-kit/SPEC.md §Layout and configuration — the knob table (every knob, its default, when to set it) and how to install this config; set only what you override
3
+
4
+ # spec: delegation-kit/SPEC.md §Layout and configuration — D2's roster: the consumer's own read-only-dispatched agent-type names; default empty (D2 inert) — never a kit-shipped vocabulary (CLAUDE.md §The provenance seam)
5
+ # shellcheck disable=SC2034 # consumed by templates/agent-dispatch-guard.sh after sourcing
6
+ # DELEGATION_KIT_READONLY_TYPES=()
@@ -1,7 +1,7 @@
1
1
  DISPATCH CHECKLISTS — a reach-through from [agent-execution.md](agent-execution.md),
2
2
  loaded only when a dispatch is a deletion, a rename, or a heavy cross-spec audit.
3
3
  It adds no new protocol: the safety, budget, resume-journal, and
4
- validate-after-commit rules stay in `agent-execution.md` and still apply in full.
4
+ verify-after-commit rules stay in `agent-execution.md` and still apply in full.
5
5
  This file is the mechanical pre-flight for those dispatch shapes — the steps an
6
6
  agent skips by reflex and the supervisor pays for later. Owned by
7
7
  delegation-kit/SPEC.md §One template, a resident pointer.
@@ -42,7 +42,24 @@ _remaining() {
42
42
  else printf '%dh%dm' "$hours" "$minutes"; fi
43
43
  }
44
44
 
45
- ITER=""; STAGE=""
45
+ # spec: delegation-kit/SPEC.md §The statusline template — the section vocabulary is the counter tool's, never this template's: each label is the initial of a name the tool returned, widened to two characters for every counter as soon as two returned names share one, so a colliding pair stays readable and the group stays aligned
46
+ _counters() {
47
+ local name n labels=() nums=() dup=0 out="" i j w=1
48
+ while IFS=$'\t' read -r name n; do
49
+ [ -n "$name" ] && { labels+=("$name"); nums+=("$n"); }
50
+ done <<< "$1"
51
+ [ "${#labels[@]}" -gt 0 ] || return
52
+ for (( i = 0; i < ${#labels[@]}; i++ )); do
53
+ for (( j = i + 1; j < ${#labels[@]}; j++ )); do
54
+ [ "${labels[i]:0:1}" = "${labels[j]:0:1}" ] && dup=1
55
+ done
56
+ done
57
+ [ "$dup" -eq 1 ] && w=2
58
+ for (( i = 0; i < ${#labels[@]}; i++ )); do out+="${out:+ }${labels[i]:0:$w}${nums[i]}"; done
59
+ printf '%s' "$out"
60
+ }
61
+
62
+ ITER=""; STAGE=""; COUNTS=""
46
63
  ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
47
64
  if [ -n "$ROOT" ] && [ -f "$ROOT/TASK-QUEUE.md" ]; then
48
65
  HEADER=$(grep -m1 '^## Iteration:' "$ROOT/TASK-QUEUE.md")
@@ -52,6 +69,10 @@ fi
52
69
  if [ -n "$ROOT" ] && [ -f "$ROOT/.workflow/WORKFLOW-STATE.txt" ]; then
53
70
  STAGE=$(awk '/^---[[:space:]]*$/ { f = 1; next } f && NF { l = $2 } END { print l }' "$ROOT/.workflow/WORKFLOW-STATE.txt")
54
71
  fi
72
+ # spec: delegation-kit/SPEC.md §The statusline template — a subprocess and never a source: the counter's library exits 2 at source time on a malformed queue config, which in this shell would take the whole status bar down for a component worth four characters
73
+ if [ -n "$ROOT" ] && [ -x "$ROOT/queue-kit/bin/queue-counts.sh" ]; then
74
+ COUNTS=$(bash "$ROOT/queue-kit/bin/queue-counts.sh" 2>/dev/null) || COUNTS=""
75
+ fi
55
76
 
56
77
  USAGE_FILE="${DELEGATION_KIT_USAGE_FILE:-${CLAUDE_CONFIG_DIR:-$HOME/.claude}/usage.txt}"
57
78
  CRED_FILE="${DELEGATION_KIT_CRED_FILE:-${USAGE_FILE%/*}/.credentials.json}"
@@ -76,4 +97,5 @@ SB="[${MODEL:-?}${EFFORT:+-$EFFORT}]·ctx $(_gauge "$CTX")"
76
97
  SB="$SB·5h $(_gauge "${FIVE_H:-0}")"; [ -n "$FIVE_H_RESETS" ] && SB="$SB $(_remaining "$FIVE_H_RESETS")"
77
98
  [ -n "$SEVEN_D" ] && { SB="$SB·7d $(_gauge "$SEVEN_D")"; [ -n "$SEVEN_D_RESETS" ] && SB="$SB $(_remaining "$SEVEN_D_RESETS")"; }
78
99
  [ -n "$ITER" ] && SB="$SB·⟳ ${ITER}${STAGE:+@$STAGE}"
100
+ [ -n "$COUNTS" ] && { GROUP=$(_counters "$COUNTS"); [ -n "$GROUP" ] && SB="$SB·$GROUP"; }
79
101
  printf '%s\n' "$SB"
@@ -0,0 +1,30 @@
1
+ # Agent dispatch-guard decision table — <decision><TAB><subagent_type><TAB><isolation><TAB><nested><TAB><desc>.
2
+ # decision is block (exit 2) / advise (exit 0, additionalContext) / fallthrough
3
+ # (exit 0, no output). Tab-separated; # and blank lines ignored. '-' marks an
4
+ # absent isolation/nested value — never a truly empty field between tabs, since
5
+ # a whitespace IFS collapses runs of empty fields (the exact bug the guard's own
6
+ # jq-to-read split works around; see agent-dispatch-guard.sh).
7
+ #
8
+ # The runner fixes one roster for the whole table: DELEGATION_KIT_READONLY_TYPES=(ro-type).
9
+ # A subagent_type prefixed 'noroster:' runs with no roster config at all (an
10
+ # empty declare), proving D2 stays inert on the roster's absence rather than on
11
+ # this type's absence from a populated one; the prefix is stripped before it
12
+ # reaches the guard's payload. subagent_type UNPARSEABLE sends invalid JSON on
13
+ # stdin instead of a built payload.
14
+
15
+ # D1 — the fork ban is unconditional
16
+ block fork - - a fork dispatch blocks regardless of isolation or roster
17
+ fallthrough noroster:other-type - - a typed, non-fork dispatch is not blocked (no roster configured)
18
+
19
+ # D2 — a declared read-only type without isolation: worktree
20
+ block ro-type - - a rostered type dispatched without isolation: worktree blocks
21
+ fallthrough ro-type worktree - the same rostered type with isolation: worktree does not block
22
+ fallthrough other-type - - a typed dispatch outside a populated roster does not block
23
+ fallthrough noroster:ro-type - - D2 stays inert against an empty roster, even naming the type that would otherwise match
24
+
25
+ # D3 — nested-dispatch advisory (never blocks)
26
+ advise other-type - yes a payload carrying agent_id advises: this dispatch creates a grandchild
27
+ fallthrough other-type - - a payload with no agent_id falls through D3 untouched
28
+
29
+ # Degradation — fail-open, but loud
30
+ advise UNPARSEABLE - - an unparseable payload advises rather than blocks, naming what could not be enforced