checkwright 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1025) hide show
  1. package/README.md +35 -1361
  2. package/bin/checkwright.ps1 +157 -0
  3. package/bin/checkwright.sh +187 -44
  4. package/package.json +15 -14
  5. package/payload/artifact/aarch64-apple-darwin/checkwright-gates +0 -0
  6. package/payload/artifact/aarch64-apple-darwin/checkwright-gates.sha256 +1 -0
  7. package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe +0 -0
  8. package/payload/artifact/aarch64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -0
  9. package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates +0 -0
  10. package/payload/artifact/aarch64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
  11. package/payload/artifact/targets.list +120 -24
  12. package/payload/artifact/x86_64-apple-darwin/checkwright-gates +0 -0
  13. package/payload/artifact/x86_64-apple-darwin/checkwright-gates.sha256 +1 -0
  14. package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe +0 -0
  15. package/payload/artifact/x86_64-pc-windows-msvc/checkwright-gates.exe.sha256 +1 -0
  16. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  17. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
  18. package/payload/canon-kit/README.md +23 -37
  19. package/payload/canon-kit/checks/check-amendment-queue.gate +2 -2
  20. package/payload/canon-kit/checks/check-amendment-retired-spelling.gate +3 -0
  21. package/payload/canon-kit/checks/check-amendment-update-target.gate +1 -1
  22. package/payload/canon-kit/checks/check-comment-tier.gate +1 -1
  23. package/payload/canon-kit/checks/check-deprecation-task.gate +2 -1
  24. package/payload/canon-kit/checks/check-docs-cmd.gate +2 -2
  25. package/payload/canon-kit/checks/check-docs-link-convention.gate +1 -1
  26. package/payload/canon-kit/checks/check-docs-restatement-parity.gate +4 -0
  27. package/payload/canon-kit/checks/check-fence-command-head.gate +3 -0
  28. package/payload/canon-kit/checks/check-fence-run.gate +3 -0
  29. package/payload/canon-kit/checks/check-install-claim.gate +2 -1
  30. package/payload/canon-kit/checks/check-knob-citation.gate +1 -1
  31. package/payload/canon-kit/checks/check-manifest-count.gate +1 -1
  32. package/payload/canon-kit/checks/check-manifest-temporal.gate +1 -1
  33. package/payload/canon-kit/checks/check-md-refs.gate +1 -1
  34. package/payload/canon-kit/checks/check-md-unwrapped.gate +3 -0
  35. package/payload/canon-kit/checks/check-measured-claim.gate +2 -1
  36. package/payload/canon-kit/checks/check-payload-claim.gate +2 -1
  37. package/payload/canon-kit/checks/check-prose-bounds.gate +3 -0
  38. package/payload/canon-kit/checks/check-prose-enum.gate +2 -1
  39. package/payload/canon-kit/checks/check-prose-tells.gate +1 -1
  40. package/payload/canon-kit/checks/check-provenance-seam.gate +3 -0
  41. package/payload/canon-kit/checks/check-spec-derivable-section.gate +1 -1
  42. package/payload/canon-kit/checks/check-spec-dod-singleton.gate +1 -1
  43. package/payload/canon-kit/checks/check-spec-embedded-source.gate +1 -1
  44. package/payload/canon-kit/checks/check-spec-fence-balance.gate +1 -1
  45. package/payload/canon-kit/checks/check-spec-pointer.gate +2 -2
  46. package/payload/canon-kit/checks/check-surface-duplication.gate +3 -0
  47. package/payload/canon-kit/checks/check-todo-task-liveness.gate +1 -1
  48. package/payload/canon-kit/checks/check-tracking-claim.gate +1 -1
  49. package/payload/canon-kit/checks/check-unmarked-claim.gate +2 -1
  50. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/SPEC-tidy.md +3 -0
  51. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/TASK-QUEUE.md +37 -8
  52. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/expect.txt +6 -3
  53. package/payload/canon-kit/gate-tests/check-amendment-queue/good/SPEC-widget.md +7 -0
  54. package/payload/canon-kit/gate-tests/check-amendment-queue/good/TASK-QUEUE.md +11 -3
  55. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/SPEC-nosection.md +16 -0
  56. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/SPEC-thing.md +26 -0
  57. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/expect.txt +8 -0
  58. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/surface/one.md +4 -0
  59. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/bad/surface/two.md +3 -0
  60. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/SPEC-tidy.md +20 -0
  61. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/SPEC-widget.md +37 -0
  62. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/component/README.md +4 -0
  63. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/component/SPEC.md +4 -0
  64. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/expect.txt +1 -0
  65. package/payload/canon-kit/gate-tests/check-amendment-retired-spelling/good/unnamed.md +4 -0
  66. package/payload/canon-kit/gate-tests/check-amendment-update-target.test.sh +1 -1
  67. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +1 -1
  68. package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +37 -26
  69. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/TASK-QUEUE.md +3 -1
  70. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.knobs +2 -0
  71. package/payload/canon-kit/gate-tests/check-deprecation-task/good/TASK-QUEUE.md +6 -2
  72. package/payload/canon-kit/gate-tests/check-deprecation-task/good/expect.txt +1 -1
  73. package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.knobs +2 -0
  74. package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +12 -10
  75. package/payload/canon-kit/gate-tests/check-docs-cmd/good/doc.md +4 -1
  76. package/payload/canon-kit/gate-tests/check-docs-cmd.test.sh +61 -0
  77. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/expect.txt +3 -0
  78. package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +21 -2
  79. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/expect.txt +2 -0
  80. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/kit/README.md +10 -0
  81. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/kit/index.md +11 -0
  82. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/scripts/canon-config.knobs +2 -0
  83. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/bad/scripts/gate-sdk-config.knobs +2 -0
  84. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/expect.txt +1 -0
  85. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/kit/README.md +12 -0
  86. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/kit/index.md +13 -0
  87. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/scripts/canon-config.knobs +2 -0
  88. package/payload/canon-kit/gate-tests/check-docs-restatement-parity/good/scripts/gate-sdk-config.knobs +2 -0
  89. package/payload/canon-kit/gate-tests/check-fence-command-head/bad/args +1 -0
  90. package/payload/canon-kit/gate-tests/check-fence-command-head/bad/doc.md +16 -0
  91. package/payload/canon-kit/gate-tests/check-fence-command-head/bad/expect.txt +5 -0
  92. package/payload/canon-kit/gate-tests/check-fence-command-head/good/args +1 -0
  93. package/payload/canon-kit/gate-tests/check-fence-command-head/good/bin/run.sh +3 -0
  94. package/payload/canon-kit/gate-tests/check-fence-command-head/good/doc.md +41 -0
  95. package/payload/canon-kit/gate-tests/check-fence-command-head/good/expect.txt +1 -0
  96. package/payload/canon-kit/gate-tests/check-fence-command-head/good/lib/tool.sh +5 -0
  97. package/payload/canon-kit/gate-tests/check-fence-command-head/good/scripts/canon-config.knobs +2 -0
  98. package/payload/canon-kit/gate-tests/check-fence-run/bad/args +1 -0
  99. package/payload/canon-kit/gate-tests/check-fence-run/bad/doc.md +32 -0
  100. package/payload/canon-kit/gate-tests/check-fence-run/bad/expect.txt +7 -0
  101. package/payload/canon-kit/gate-tests/check-fence-run/good/args +1 -0
  102. package/payload/canon-kit/gate-tests/check-fence-run/good/doc.md +31 -0
  103. package/payload/canon-kit/gate-tests/check-fence-run/good/expect.txt +1 -0
  104. package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/canon-config.knobs +7 -0
  105. package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/canon-config.knobs +7 -0
  106. package/payload/canon-kit/gate-tests/check-knob-citation.test.sh +42 -7
  107. package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +1 -2
  108. package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +2 -3
  109. package/payload/canon-kit/gate-tests/check-knob-default-coupling.test.sh +37 -8
  110. package/payload/canon-kit/gate-tests/check-manifest-count/bad/SPEC.md +3 -0
  111. package/payload/canon-kit/gate-tests/check-manifest-count/good/SPEC.md +10 -0
  112. package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +6 -6
  113. package/payload/canon-kit/gate-tests/check-md-refs.test.sh +1 -1
  114. package/payload/canon-kit/gate-tests/check-md-unwrapped/bad/doc.md +13 -0
  115. package/payload/canon-kit/gate-tests/check-md-unwrapped/bad/expect.txt +4 -0
  116. package/payload/canon-kit/gate-tests/check-md-unwrapped/bad/scripts/canon-config.knobs +2 -0
  117. package/payload/canon-kit/gate-tests/check-md-unwrapped/good/doc.md +45 -0
  118. package/payload/canon-kit/gate-tests/check-md-unwrapped/good/expect.txt +1 -0
  119. package/payload/canon-kit/gate-tests/check-md-unwrapped/good/scripts/canon-config.knobs +4 -0
  120. package/payload/canon-kit/gate-tests/check-measured-claim/bad/SPEC.md +3 -0
  121. package/payload/canon-kit/gate-tests/check-measured-claim/bad/expect.txt +1 -0
  122. package/payload/canon-kit/gate-tests/check-measured-claim/bad/scripts/canon-config.knobs +4 -0
  123. package/payload/canon-kit/gate-tests/check-measured-claim/good/SPEC.md +8 -0
  124. package/payload/canon-kit/gate-tests/check-measured-claim/good/scripts/canon-config.knobs +4 -0
  125. package/payload/canon-kit/gate-tests/check-measured-claim/good/worktrees/SPEC.md +12 -0
  126. package/payload/canon-kit/gate-tests/check-measured-claim.test.sh +32 -13
  127. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.knobs +6 -0
  128. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.knobs +6 -0
  129. package/payload/canon-kit/gate-tests/check-prose-bounds/bad/CLAUDE.md +9 -0
  130. package/payload/canon-kit/gate-tests/check-prose-bounds/bad/SPEC.md +11 -0
  131. package/payload/canon-kit/gate-tests/check-prose-bounds/bad/expect.txt +3 -0
  132. package/payload/canon-kit/gate-tests/check-prose-bounds/bad/scripts/canon-config.knobs +3 -0
  133. package/payload/canon-kit/gate-tests/check-prose-bounds/good/CLAUDE.md +10 -0
  134. package/payload/canon-kit/gate-tests/check-prose-bounds/good/SPEC.md +27 -0
  135. package/payload/canon-kit/gate-tests/check-prose-bounds/good/expect.txt +1 -0
  136. package/payload/canon-kit/gate-tests/check-prose-bounds/good/scripts/canon-config.knobs +3 -0
  137. package/payload/canon-kit/gate-tests/check-prose-bounds.test.sh +98 -0
  138. package/payload/canon-kit/gate-tests/check-prose-enum/bad/scripts/canon-config.knobs +3 -0
  139. package/payload/canon-kit/gate-tests/check-prose-enum/good/scripts/canon-config.knobs +3 -0
  140. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +55 -25
  141. package/payload/canon-kit/gate-tests/check-prose-tells/bad/prose.md +2 -0
  142. package/payload/canon-kit/gate-tests/check-prose-tells/bad/scripts/canon-config.knobs +5 -0
  143. package/payload/canon-kit/gate-tests/check-prose-tells/good/prose.md +6 -0
  144. package/payload/canon-kit/gate-tests/check-prose-tells/good/scripts/{canon-config.sh → canon-config.knobs} +2 -5
  145. package/payload/canon-kit/gate-tests/check-prose-tells/good/worktrees/prose.md +17 -0
  146. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/TASK-QUEUE.md +15 -0
  147. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/expect.txt +8 -0
  148. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/scripts/canon-config.knobs +3 -0
  149. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/scripts/gate-sdk-config.knobs +2 -0
  150. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/scripts/lifecycle-config.knobs +12 -0
  151. package/payload/canon-kit/gate-tests/check-provenance-seam/bad/widget-toolkit/SPEC.md +27 -0
  152. package/payload/canon-kit/gate-tests/check-provenance-seam/good/TASK-QUEUE.md +15 -0
  153. package/payload/canon-kit/gate-tests/check-provenance-seam/good/expect.txt +1 -0
  154. package/payload/canon-kit/gate-tests/check-provenance-seam/good/scripts/canon-config.knobs +3 -0
  155. package/payload/canon-kit/gate-tests/check-provenance-seam/good/scripts/gate-sdk-config.knobs +2 -0
  156. package/payload/canon-kit/gate-tests/check-provenance-seam/good/scripts/lifecycle-config.knobs +12 -0
  157. package/payload/canon-kit/gate-tests/check-provenance-seam/good/widget-toolkit/SPEC.md +20 -0
  158. package/payload/canon-kit/gate-tests/check-provenance-seam.test.sh +136 -0
  159. package/payload/canon-kit/gate-tests/check-spec-dod-singleton.test.sh +1 -1
  160. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/README.md +6 -0
  161. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/SPEC-widget.md +5 -0
  162. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.rs +2 -0
  163. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +4 -0
  164. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/scripts/canon-config.knobs +6 -0
  165. package/payload/canon-kit/gate-tests/check-spec-pointer/good/README.md +15 -0
  166. package/payload/canon-kit/gate-tests/check-spec-pointer/good/SPEC-widget.md +10 -0
  167. package/payload/canon-kit/gate-tests/check-spec-pointer/good/expect.txt +1 -1
  168. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.rs +2 -0
  169. package/payload/canon-kit/gate-tests/check-spec-pointer/good/scripts/canon-config.knobs +6 -0
  170. package/payload/canon-kit/gate-tests/check-spec-pointer/good/vendored-kit/notes.txt +4 -0
  171. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/TASK-QUEUE.md +3 -1
  172. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/TASK-QUEUE.md +9 -3
  173. package/payload/canon-kit/gate-tests/check-tracking-claim.test.sh +1 -1
  174. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/SPEC.md +3 -0
  175. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/expect.txt +1 -0
  176. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/scripts/canon-config.knobs +4 -0
  177. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/SPEC.md +3 -0
  178. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/scripts/canon-config.knobs +4 -0
  179. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/worktrees/SPEC.md +11 -0
  180. package/payload/canon-kit/gate-tests/check-unmarked-claim.test.sh +53 -28
  181. package/payload/canon-kit/templates/SPEC-amendment.md +46 -25
  182. package/payload/canon-kit/templates/canon-config.knobs +1 -0
  183. package/payload/context-kit/README.md +33 -61
  184. package/payload/context-kit/checks/check-brevity.gate +2 -2
  185. package/payload/context-kit/checks/check-footprint-fresh.gate +3 -2
  186. package/payload/context-kit/checks/check-memory-off.gate +1 -1
  187. package/payload/context-kit/checks/check-settings-paths.gate +2 -2
  188. package/payload/context-kit/checks/check-settings-pins.gate +1 -1
  189. package/payload/context-kit/checks/check-surface-ratchet.gate +3 -0
  190. package/payload/context-kit/gate-tests/check-brevity/bad/CLAUDE.md +9 -2
  191. package/payload/context-kit/gate-tests/check-brevity/bad/expect.txt +1 -0
  192. package/payload/context-kit/gate-tests/check-brevity/good/CLAUDE.md +9 -4
  193. package/payload/context-kit/gate-tests/check-brevity/good/expect.txt +1 -1
  194. package/payload/context-kit/gate-tests/check-brevity.test.sh +107 -24
  195. package/payload/context-kit/gate-tests/check-footprint-fresh/good/CLAUDE.md +6 -0
  196. package/payload/context-kit/gate-tests/check-footprint-fresh/good/demo-kit/SPEC.md +3 -0
  197. package/payload/context-kit/gate-tests/check-footprint-fresh/good/demo-kit/templates/guide.md +3 -0
  198. package/payload/context-kit/gate-tests/check-footprint-fresh/good/docs/footprint.md +30 -0
  199. package/payload/context-kit/gate-tests/check-memory-off/bad/scripts/{context-config.sh → context-config.knobs} +1 -3
  200. package/payload/context-kit/gate-tests/check-memory-off/good/scripts/{context-config.sh → context-config.knobs} +1 -3
  201. package/payload/context-kit/gate-tests/check-memory-off.test.sh +1 -1
  202. package/payload/context-kit/gate-tests/check-settings-paths/bad/expect.txt +2 -0
  203. package/payload/context-kit/gate-tests/check-settings-paths/bad/settings.json +21 -0
  204. package/payload/context-kit/gate-tests/check-settings-paths/bad/tools/run-gates.sh +4 -0
  205. package/payload/context-kit/gate-tests/check-settings-paths/good/expect.txt +2 -1
  206. package/payload/context-kit/gate-tests/check-settings-paths/good/settings.json +48 -1
  207. package/payload/context-kit/gate-tests/check-settings-paths/good/tools/run-gates.sh +4 -0
  208. package/payload/context-kit/gate-tests/check-settings-pins.test.sh +1 -1
  209. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/CLAUDE.md +5 -0
  210. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/expect.txt +2 -0
  211. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/scripts/context-config.knobs +4 -0
  212. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/surface-ceiling.txt +2 -0
  213. package/payload/context-kit/gate-tests/check-surface-ratchet/bad/templates/ungoverned.md +3 -0
  214. package/payload/context-kit/gate-tests/check-surface-ratchet/good/CLAUDE.md +3 -0
  215. package/payload/context-kit/gate-tests/check-surface-ratchet/good/expect.txt +1 -0
  216. package/payload/context-kit/gate-tests/check-surface-ratchet/good/scripts/context-config.knobs +4 -0
  217. package/payload/context-kit/gate-tests/check-surface-ratchet/good/surface-ceiling.txt +4 -0
  218. package/payload/context-kit/gate-tests/check-surface-ratchet/good/templates/held.md +4 -0
  219. package/payload/context-kit/gate-tests/check-surface-ratchet.test.sh +76 -0
  220. package/payload/context-kit/index-tests/corpus/baseline.txt +1 -1
  221. package/payload/context-kit/index-tests/corpus/surface.md +1 -6
  222. package/payload/context-kit/index-tests/expected/always-loaded.txt +1 -1
  223. package/payload/context-kit/templates/close-brevity.md +9 -28
  224. package/payload/context-kit/templates/context-config.knobs +1 -0
  225. package/payload/context-kit/templates/session-context.sh +43 -28
  226. package/payload/delegation-kit/README.md +35 -69
  227. package/payload/delegation-kit/checks/check-agent-tier-explicit.gate +1 -1
  228. package/payload/delegation-kit/checks/check-gate-tamper.gate +1 -1
  229. package/payload/delegation-kit/gate-tests/check-gate-tamper.test.sh +23 -2
  230. package/payload/delegation-kit/templates/agent-execution.md +23 -389
  231. package/payload/delegation-kit/templates/delegation-config.knobs +4 -0
  232. package/payload/delegation-kit/templates/dispatch-checklists.md +8 -45
  233. package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +33 -17
  234. package/payload/doctrine-kit/DOCTRINE.md +92 -458
  235. package/payload/doctrine-kit/README.md +24 -55
  236. package/payload/doctrine-kit/checks/check-doctrine-registration.gate +1 -1
  237. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +48 -3
  238. package/payload/drift-kit/README.md +43 -89
  239. package/payload/drift-kit/templates/close-knowledge.md +7 -22
  240. package/payload/drift-kit/templates/drift-config.knobs +1 -0
  241. package/payload/drift-kit/templates/economics.md +10 -48
  242. package/payload/drift-kit/templates/kpi-deprecated-surface.sh +31 -9
  243. package/payload/drift-kit/templates/kpis.list +2 -1
  244. package/payload/drift-kit/templates/price-table.tsv +1 -1
  245. package/payload/evidence-kit/README.md +23 -46
  246. package/payload/evidence-kit/checks/check-battery-roster.gate +1 -1
  247. package/payload/evidence-kit/checks/check-evidence-baseline.gate +2 -2
  248. package/payload/evidence-kit/checks/check-evidence-manifest.gate +1 -1
  249. package/payload/evidence-kit/checks/check-producer-liveness.gate +3 -0
  250. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.knobs +7 -0
  251. package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.knobs +7 -0
  252. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +7 -7
  253. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/TASK-QUEUE.md +3 -1
  254. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/args +1 -0
  255. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/expect.txt +2 -0
  256. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/scripts/evidence-config.knobs +4 -0
  257. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/validate-baseline.txt +1 -0
  258. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/TASK-QUEUE.md +3 -1
  259. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/args +1 -0
  260. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/scripts/evidence-config.knobs +3 -0
  261. package/payload/evidence-kit/gate-tests/check-evidence-baseline.test.sh +134 -14
  262. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/scripts/{evidence-config.sh → evidence-config.knobs} +3 -5
  263. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/scripts/{evidence-config.sh → evidence-config.knobs} +3 -5
  264. package/payload/evidence-kit/gate-tests/check-evidence-manifest.test.sh +5 -4
  265. package/payload/evidence-kit/gate-tests/diff-baseline-status.test.sh +128 -0
  266. package/payload/evidence-kit/gate-tests/evidence-lib.test.sh +51 -45
  267. package/payload/evidence-kit/gate-tests/pre-hook.test.sh +66 -0
  268. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +29 -16
  269. package/payload/evidence-kit/templates/evidence-config.knobs +1 -0
  270. package/payload/gate-sdk/README.md +48 -79
  271. package/payload/gate-sdk/bin/build-native.sh +27 -4
  272. package/payload/gate-sdk/bin/run-gates.ps1 +266 -0
  273. package/payload/gate-sdk/bin/run-gates.sh +53 -277
  274. package/payload/gate-sdk/checks/check-action-gh-repo.gate +1 -1
  275. package/payload/gate-sdk/checks/check-action-job-ref.gate +3 -0
  276. package/payload/gate-sdk/checks/check-action-permissions.gate +3 -0
  277. package/payload/gate-sdk/checks/check-action-pinning.gate +1 -1
  278. package/payload/gate-sdk/checks/check-action-run-path.gate +3 -0
  279. package/payload/gate-sdk/checks/check-action-run-shell.gate +3 -0
  280. package/payload/gate-sdk/checks/check-commit-msg.gate +2 -1
  281. package/payload/gate-sdk/checks/check-commit-subject.gate +1 -1
  282. package/payload/gate-sdk/checks/check-core-files.gate +1 -1
  283. package/payload/gate-sdk/checks/check-crate-arms.gate +3 -0
  284. package/payload/gate-sdk/checks/check-enforcement-fresh.gate +3 -2
  285. package/payload/gate-sdk/checks/check-exec-bit.gate +1 -1
  286. package/payload/gate-sdk/checks/check-front-end-fail-open.gate +3 -0
  287. package/payload/gate-sdk/checks/check-gate-assertions.gate +2 -2
  288. package/payload/gate-sdk/checks/check-gate-binary-fresh.gate +1 -1
  289. package/payload/gate-sdk/checks/check-gate-exemption-tasks.gate +1 -1
  290. package/payload/gate-sdk/checks/check-gate-fail-closed.gate +1 -1
  291. package/payload/gate-sdk/checks/check-gate-fixture-coverage.gate +1 -1
  292. package/payload/gate-sdk/checks/check-gate-output.gate +1 -1
  293. package/payload/gate-sdk/checks/check-gate-substrate-parity.gate +3 -0
  294. package/payload/gate-sdk/checks/check-graph.gate +2 -1
  295. package/payload/gate-sdk/checks/check-hook-exec-bit.gate +1 -1
  296. package/payload/gate-sdk/checks/check-identity.gate +1 -1
  297. package/payload/gate-sdk/checks/check-install-disposition.gate +3 -0
  298. package/payload/gate-sdk/checks/check-kit-enum.gate +1 -1
  299. package/payload/gate-sdk/checks/check-kit-registration.gate +1 -1
  300. package/payload/gate-sdk/checks/check-kit-roots-dialect.gate +3 -0
  301. package/payload/gate-sdk/checks/check-packed-links.gate +3 -0
  302. package/payload/gate-sdk/checks/check-path-dialect.gate +3 -0
  303. package/payload/gate-sdk/checks/check-pipe-membership.gate +3 -0
  304. package/payload/gate-sdk/checks/check-portability-floor.gate +4 -0
  305. package/payload/gate-sdk/checks/check-projection-roster.gate +4 -0
  306. package/payload/gate-sdk/checks/check-reads-couples.gate +1 -1
  307. package/payload/gate-sdk/checks/check-root-tiering.gate +1 -1
  308. package/payload/gate-sdk/checks/check-shellcheck.gate +3 -0
  309. package/payload/gate-sdk/checks/check-template-copy-parity.gate +1 -1
  310. package/payload/gate-sdk/checks/check-tree-terms.gate +2 -1
  311. package/payload/gate-sdk/checks/check-workflow-tiering.gate +1 -1
  312. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/args +2 -0
  313. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/expect.txt +1 -0
  314. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/scripts/gate-sdk-config.knobs +1 -0
  315. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/tree/notes.md +3 -0
  316. package/payload/gate-sdk/gate-tests/check-action-job-ref/bad/tree/workflows/ci.yml +8 -0
  317. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/args +3 -0
  318. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/expect.txt +1 -0
  319. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/scripts/gate-sdk-config.knobs +1 -0
  320. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/tree/notes.md +3 -0
  321. package/payload/gate-sdk/gate-tests/check-action-job-ref/good/tree/workflows/ci.yml +8 -0
  322. package/payload/gate-sdk/gate-tests/check-action-permissions/bad/args +3 -0
  323. package/payload/gate-sdk/gate-tests/check-action-permissions/bad/expect.txt +5 -0
  324. package/payload/gate-sdk/gate-tests/check-action-permissions/bad/tree/workflows/empty-allowlist.yml +29 -0
  325. package/payload/gate-sdk/gate-tests/check-action-permissions/bad/tree/workflows/gates.yml +25 -0
  326. package/payload/gate-sdk/gate-tests/check-action-permissions/good/args +5 -0
  327. package/payload/gate-sdk/gate-tests/check-action-permissions/good/expect.txt +1 -0
  328. package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/action.yml +9 -0
  329. package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/not-actions.yml +7 -0
  330. package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/workflows/declared.yml +69 -0
  331. package/payload/gate-sdk/gate-tests/check-action-permissions/good/tree/workflows/valves.yml +22 -0
  332. package/payload/gate-sdk/gate-tests/check-action-run-path/bad/args +4 -0
  333. package/payload/gate-sdk/gate-tests/check-action-run-path/bad/expect.txt +2 -0
  334. package/payload/gate-sdk/gate-tests/check-action-run-path/bad/tree/scripts/present.sh +3 -0
  335. package/payload/gate-sdk/gate-tests/check-action-run-path/bad/tree/workflows/ci.yml +14 -0
  336. package/payload/gate-sdk/gate-tests/check-action-run-path/good/args +5 -0
  337. package/payload/gate-sdk/gate-tests/check-action-run-path/good/expect.txt +1 -0
  338. package/payload/gate-sdk/gate-tests/check-action-run-path/good/tree/scripts/build.sh +3 -0
  339. package/payload/gate-sdk/gate-tests/check-action-run-path/good/tree/sub/scripts/inner.sh +3 -0
  340. package/payload/gate-sdk/gate-tests/check-action-run-path/good/tree/workflows/ci.yml +36 -0
  341. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/args +4 -2
  342. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/expect.txt +2 -0
  343. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/tree/workflows/runner-dialect.yml +36 -0
  344. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/args +3 -2
  345. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/expect.txt +1 -1
  346. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/workflows/runner-dialect.yml +71 -0
  347. package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +102 -9
  348. package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/smoke/install.sh +1 -1
  349. package/payload/gate-sdk/gate-tests/check-assertion-strength/good/smoke/install.sh +1 -1
  350. package/payload/gate-sdk/gate-tests/check-assertion-strength.test.sh +55 -0
  351. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/expect.txt +1 -0
  352. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/msg.txt +4 -0
  353. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/patterns.list +5 -1
  354. package/payload/gate-sdk/gate-tests/check-commit-msg/good/msg.txt +7 -0
  355. package/payload/gate-sdk/gate-tests/check-commit-msg/good/patterns.list +5 -1
  356. package/payload/gate-sdk/gate-tests/check-commit-subject.test.sh +2 -2
  357. package/payload/gate-sdk/gate-tests/check-core-files.test.sh +1 -1
  358. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/scripts/gate-sdk-config.knobs +3 -0
  359. package/payload/gate-sdk/gate-tests/check-crate-arms/good/scripts/gate-sdk-config.knobs +3 -0
  360. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/SPEC.md +3 -0
  361. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/checks/check-demo.gate +1 -0
  362. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/probe.conf +1 -0
  363. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/demo-kit/templates/guide.md +3 -0
  364. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/docs/enforcement.md +33 -0
  365. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/scripts/gate-sdk-config.knobs +1 -0
  366. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/scripts/gates.list +1 -0
  367. package/payload/gate-sdk/gate-tests/check-exec-bit.test.sh +1 -1
  368. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/args +3 -0
  369. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/expect.txt +2 -0
  370. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/gate-sdk/bin/run-gates.ps1 +5 -0
  371. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/bad/gate-sdk/bin/run-gates.sh +9 -0
  372. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/args +4 -0
  373. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/expect.txt +1 -0
  374. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/gate-sdk/bin/run-gates.ps1 +5 -0
  375. package/payload/gate-sdk/gate-tests/check-front-end-fail-open/good/gate-sdk/bin/run-gates.sh +9 -0
  376. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/SPEC.md +4 -1
  377. package/payload/gate-sdk/gate-tests/check-gate-assertions.test.sh +1 -1
  378. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.knobs +2 -0
  379. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.knobs +2 -0
  380. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +6 -12
  381. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +5 -3
  382. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/TASK-QUEUE.md +3 -1
  383. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks.test.sh +4 -2
  384. package/payload/gate-sdk/gate-tests/check-gate-output.test.sh +1 -1
  385. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/ci/build-artifact.sh +9 -0
  386. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/ci.yml +9 -0
  387. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +4 -2
  388. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.knobs +5 -0
  389. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +6 -0
  390. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/ci/build-artifact.sh +9 -0
  391. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/ci.yml +16 -0
  392. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -3
  393. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.knobs +5 -0
  394. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +1 -1
  395. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +222 -197
  396. package/payload/gate-sdk/gate-tests/check-graph/bad/SPEC-example-gate.md +7 -2
  397. package/payload/gate-sdk/gate-tests/check-graph/bad/expect.txt +4 -0
  398. package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-second-gate.md +3 -1
  399. package/payload/gate-sdk/gate-tests/check-graph-cap.test.sh +1 -1
  400. package/payload/gate-sdk/gate-tests/check-graph-refs.test.sh +8 -8
  401. package/payload/gate-sdk/gate-tests/check-graph-theme.test.sh +2 -2
  402. package/payload/gate-sdk/gate-tests/check-graph-tree.test.sh +49 -14
  403. package/payload/gate-sdk/gate-tests/check-identity/bad/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +4 -4
  404. package/payload/gate-sdk/gate-tests/check-identity/good/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +4 -4
  405. package/payload/gate-sdk/gate-tests/check-identity.test.sh +1 -1
  406. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-eta.sh +7 -0
  407. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-iota.sh +7 -0
  408. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-theta.sh +7 -0
  409. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-zeta.gate +3 -0
  410. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/smoke/install.sh +1 -1
  411. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/args +8 -5
  412. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/expect.txt +5 -0
  413. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/native/src/installer/recipe.rs +10 -0
  414. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +2 -3
  415. package/payload/gate-sdk/gate-tests/check-install-disposition/good/args +8 -4
  416. package/payload/gate-sdk/gate-tests/check-install-disposition/good/expect.txt +2 -0
  417. package/payload/gate-sdk/gate-tests/check-install-disposition/good/scripts/{gate-sdk-config.sh → gate-sdk-config.knobs} +2 -3
  418. package/payload/gate-sdk/gate-tests/check-install-disposition/good/{alpha-kit → site-kit}/checks/check-alpha.sh +1 -1
  419. package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-beta.gate +3 -0
  420. package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-gamma.sh +6 -0
  421. package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-omega.sh +7 -0
  422. package/payload/gate-sdk/gate-tests/check-install-disposition/good/site-kit/checks/check-psi.sh +7 -0
  423. package/payload/gate-sdk/gate-tests/check-install-disposition/good/{alpha-kit → site-kit}/smoke/install.sh +2 -2
  424. package/payload/gate-sdk/gate-tests/check-kit-registration/bad/registry-doc.md +15 -12
  425. package/payload/gate-sdk/gate-tests/check-kit-registration/good/args +7 -5
  426. package/payload/gate-sdk/gate-tests/check-kit-registration/good/scripts/gate-sdk-config.knobs +2 -0
  427. package/payload/gate-sdk/gate-tests/check-kit-registration.test.sh +2 -2
  428. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/args +5 -0
  429. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/expect.txt +1 -0
  430. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/alpha-kit/checks/placeholder.txt +3 -0
  431. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/alpha-kit/gate-tests/alpha.test.sh +3 -0
  432. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/alpha-kit/lib/alpha.sh +3 -0
  433. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/beta-kit/checks/placeholder.txt +3 -0
  434. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/beta-kit/gate-tests/beta.test.sh +3 -0
  435. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/beta-kit/lib/beta.sh +3 -0
  436. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/gate-sdk/checks/placeholder.txt +3 -0
  437. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/gate-sdk/lib/gate.sh +3 -0
  438. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/scripts/gate-sdk-config.knobs +7 -0
  439. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/bad/tree/scripts/gates.list +3 -0
  440. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/args +7 -0
  441. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/expect.txt +1 -0
  442. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/alpha-kit/checks/placeholder.txt +3 -0
  443. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/alpha-kit/gate-tests/alpha.test.sh +3 -0
  444. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/alpha-kit/lib/alpha.sh +3 -0
  445. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/beta-kit/checks/placeholder.txt +3 -0
  446. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/beta-kit/gate-tests/beta.test.sh +3 -0
  447. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/beta-kit/lib/beta.sh +3 -0
  448. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/gate-sdk/checks/placeholder.txt +3 -0
  449. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/gate-sdk/lib/gate.sh +3 -0
  450. package/payload/gate-sdk/gate-tests/check-kit-roots-dialect/good/tree/scripts/gates.list +3 -0
  451. package/payload/gate-sdk/gate-tests/check-packed-links/bad/alpha-kit/README.md +5 -0
  452. package/payload/gate-sdk/gate-tests/check-packed-links/bad/args +5 -0
  453. package/payload/gate-sdk/gate-tests/check-packed-links/bad/beta-kit/README.md +5 -0
  454. package/payload/gate-sdk/gate-tests/check-packed-links/bad/expect.txt +2 -0
  455. package/payload/gate-sdk/gate-tests/check-packed-links/bad/scripts/gate-sdk-config.knobs +4 -0
  456. package/payload/gate-sdk/gate-tests/check-packed-links/good/alpha-kit/README.md +5 -0
  457. package/payload/gate-sdk/gate-tests/check-packed-links/good/args +8 -0
  458. package/payload/gate-sdk/gate-tests/check-packed-links/good/beta-kit/README.md +9 -0
  459. package/payload/gate-sdk/gate-tests/check-packed-links/good/expect.txt +1 -0
  460. package/payload/gate-sdk/gate-tests/check-packed-links/good/gamma-kit/SPEC.md +4 -0
  461. package/payload/gate-sdk/gate-tests/check-packed-links/good/scripts/gate-sdk-config.knobs +6 -0
  462. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/args +3 -0
  463. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/expect.txt +15 -0
  464. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/native/src/primitive.rs +19 -0
  465. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/native/src/producer.rs +8 -0
  466. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/native/src/walk.rs +13 -0
  467. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/bound-root.sh +5 -0
  468. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/case-arm.sh +6 -0
  469. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/commented.sh +5 -0
  470. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/common-dir.sh +4 -0
  471. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/glob-test.sh +4 -0
  472. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/late-anchor.sh +7 -0
  473. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/logical-readback.sh +5 -0
  474. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/probe.sh +7 -0
  475. package/payload/gate-sdk/gate-tests/check-path-dialect/bad/tree/two-root.sh +5 -0
  476. package/payload/gate-sdk/gate-tests/check-path-dialect/good/args +3 -0
  477. package/payload/gate-sdk/gate-tests/check-path-dialect/good/expect.txt +13 -0
  478. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/commented.rs +5 -0
  479. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/local.rs +12 -0
  480. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/namespace.rs +11 -0
  481. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/typed.rs +10 -0
  482. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/verdict.rs +5 -0
  483. package/payload/gate-sdk/gate-tests/check-path-dialect/good/native/src/walk.rs +24 -0
  484. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/anchored.sh +6 -0
  485. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/cd-only.sh +7 -0
  486. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/commented.sh +6 -0
  487. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/one-root.sh +4 -0
  488. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/probe.sh +8 -0
  489. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/rooted.sh +23 -0
  490. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/subshell.sh +6 -0
  491. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/two-line.sh +8 -0
  492. package/payload/gate-sdk/gate-tests/check-path-dialect/good/tree/verdict.sh +7 -0
  493. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/args +4 -0
  494. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/expect.txt +6 -0
  495. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/scripts/gate-sdk-config.knobs +1 -0
  496. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/array-grep.sh +6 -0
  497. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/echo-max-count.sh +5 -0
  498. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/gate-tests/membership.test.sh +6 -0
  499. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/loop-head.sh +5 -0
  500. package/payload/gate-sdk/gate-tests/check-pipe-membership/bad/tree/tests/relocated.test.sh +6 -0
  501. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/args +5 -0
  502. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/expect.txt +3 -0
  503. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/full-reader.sh +4 -0
  504. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/gate-tests/check-x/bad/violating.test.sh +6 -0
  505. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/gate-tests/clean.test.sh +8 -0
  506. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/loop-membership.sh +8 -0
  507. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/no-pipefail.sh +6 -0
  508. package/payload/gate-sdk/gate-tests/check-pipe-membership/good/tree/one-line-producer.sh +5 -0
  509. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/args +2 -0
  510. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/expect.txt +8 -0
  511. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/patterns.list +4 -0
  512. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/scripts/gate-sdk-config.knobs +4 -0
  513. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/empty-reason-verb +5 -0
  514. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/strings.ps1 +6 -0
  515. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/too-far-verb +5 -0
  516. package/payload/gate-sdk/gate-tests/check-portability-floor/bad/tree/undeclared-verb +3 -0
  517. package/payload/gate-sdk/gate-tests/check-portability-floor/good/args +2 -0
  518. package/payload/gate-sdk/gate-tests/check-portability-floor/good/expect.txt +1 -0
  519. package/payload/gate-sdk/gate-tests/check-portability-floor/good/patterns.list +5 -0
  520. package/payload/gate-sdk/gate-tests/check-portability-floor/good/scripts/gate-sdk-config.knobs +4 -0
  521. package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/front.ps1 +7 -0
  522. package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/plain-verb +5 -0
  523. package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/portability-patterns.list +5 -0
  524. package/payload/gate-sdk/gate-tests/check-portability-floor/good/tree/upgrade-verb +7 -0
  525. package/payload/gate-sdk/gate-tests/check-portability-floor.test.sh +154 -0
  526. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/demo-kit/checks/check-beta.gate +2 -0
  527. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/docs/roster.md +11 -0
  528. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/expect.txt +7 -0
  529. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/check-alpha.gate +2 -0
  530. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/check-gamma.gate +2 -0
  531. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/check-plain.gate +1 -0
  532. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/gate-sdk-config.knobs +3 -0
  533. package/payload/gate-sdk/gate-tests/check-projection-roster/bad/scripts/gates.list +4 -0
  534. package/payload/gate-sdk/gate-tests/check-projection-roster/good/demo-kit/checks/check-beta.gate +2 -0
  535. package/payload/gate-sdk/gate-tests/check-projection-roster/good/docs/roster.md +16 -0
  536. package/payload/gate-sdk/gate-tests/check-projection-roster/good/expect.txt +1 -0
  537. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-alpha.gate +2 -0
  538. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-delta.gate +2 -0
  539. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-epsilon.gate +2 -0
  540. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/check-plain.gate +1 -0
  541. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/gate-sdk-config.knobs +4 -0
  542. package/payload/gate-sdk/gate-tests/check-projection-roster/good/scripts/gates.list +5 -0
  543. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.knobs +4 -0
  544. package/payload/gate-sdk/gate-tests/check-readme-roster/good/args +1 -1
  545. package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.knobs +4 -0
  546. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/expect.txt +1 -1
  547. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/sandbox-gate.sh +4 -4
  548. package/payload/gate-sdk/gate-tests/check-reads-couples/good/sandbox-gate.sh +4 -4
  549. package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +25 -20
  550. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/alpha-kit/smoke/install.sh +1 -1
  551. package/payload/gate-sdk/gate-tests/{check-template-registry-parity/bad/scripts/gate-sdk-config.sh → check-smoke-entry-guard/bad/scripts/gate-sdk-config.knobs} +2 -3
  552. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/install.sh +1 -1
  553. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/violation.sh +1 -1
  554. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/args +1 -1
  555. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/beta-kit/smoke/install.sh +1 -1
  556. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/scripts/gate-sdk-config.knobs +4 -0
  557. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/args +3 -1
  558. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/session-note.sh +6 -0
  559. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/expect.txt +1 -1
  560. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/session-note.sh +6 -0
  561. package/payload/gate-sdk/gate-tests/check-template-copy-parity.test.sh +1 -1
  562. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +2 -0
  563. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/drift-kit/templates/kpis.list +18 -0
  564. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +2 -0
  565. package/payload/gate-sdk/gate-tests/{check-smoke-entry-guard/bad/scripts/gate-sdk-config.sh → check-template-registry-parity/bad/scripts/gate-sdk-config.knobs} +2 -3
  566. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +3 -1
  567. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/drift-kit/templates/kpis.list +17 -0
  568. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -1
  569. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.knobs +4 -0
  570. package/payload/gate-sdk/gate-tests/check-test-hermetic-smoke.test.sh +5 -5
  571. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +1 -0
  572. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/patterns.list +4 -0
  573. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/accounts.txt +1 -0
  574. package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -1
  575. package/payload/gate-sdk/gate-tests/check-tree-terms/good/patterns.list +5 -1
  576. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/anchored.txt +1 -0
  577. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/handles.txt +2 -0
  578. package/payload/gate-sdk/gate-tests/check-tree-terms.test.sh +44 -5
  579. package/payload/gate-sdk/gate-tests/emit-arm-shape.test.sh +95 -0
  580. package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +10 -10
  581. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +10 -184
  582. package/payload/gate-sdk/gate-tests/reads-census.test.sh +96 -0
  583. package/payload/gate-sdk/gate-tests/run-arm-contract.test.sh +190 -0
  584. package/payload/gate-sdk/gate-tests/run-dispatch-streams.test.sh +64 -41
  585. package/payload/gate-sdk/gate-tests/run-for-path.test.sh +2 -2
  586. package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +121 -16
  587. package/payload/gate-sdk/gate-tests/run-gates-linked-worktree.test.sh +136 -0
  588. package/payload/gate-sdk/lib/gate.sh +231 -484
  589. package/payload/gate-sdk/lib/test-hermetic.sh +39 -9
  590. package/payload/gate-sdk/templates/check-skeleton.sh +3 -2
  591. package/payload/gate-sdk/templates/gates-workflow.yml +23 -10
  592. package/payload/gate-sdk/templates/msg-patterns.list +14 -5
  593. package/payload/gate-sdk/templates/portability-patterns.list +56 -0
  594. package/payload/guard-kit/README.md +43 -47
  595. package/payload/guard-kit/checks/check-door-binding.gate +3 -0
  596. package/payload/guard-kit/gate-tests/check-door-binding/bad/alpha-kit/README.md +6 -0
  597. package/payload/guard-kit/gate-tests/check-door-binding/bad/alpha-kit/templates/alpha-config.knobs +3 -0
  598. package/payload/guard-kit/gate-tests/check-door-binding/bad/args +5 -0
  599. package/payload/guard-kit/gate-tests/check-door-binding/bad/beta-kit/lib/beta.sh +6 -0
  600. package/payload/guard-kit/gate-tests/check-door-binding/bad/expect.txt +5 -0
  601. package/payload/guard-kit/gate-tests/check-door-binding/bad/scripts/gate-sdk-config.knobs +4 -0
  602. package/payload/guard-kit/gate-tests/check-door-binding/bad/scripts/guard-config.knobs +3 -0
  603. package/payload/guard-kit/gate-tests/check-door-binding/bad/site/banner.md +8 -0
  604. package/payload/guard-kit/gate-tests/check-door-binding/bad/site/landing.md +11 -0
  605. package/payload/guard-kit/gate-tests/check-door-binding/good/alpha-kit/README.md +8 -0
  606. package/payload/guard-kit/gate-tests/check-door-binding/good/alpha-kit/templates/settings-hooks.json +20 -0
  607. package/payload/guard-kit/gate-tests/check-door-binding/good/args +7 -0
  608. package/payload/guard-kit/gate-tests/check-door-binding/good/beta-kit/lib/beta.sh +6 -0
  609. package/payload/guard-kit/gate-tests/check-door-binding/good/expect.txt +1 -0
  610. package/payload/guard-kit/gate-tests/check-door-binding/good/scripts/gate-sdk-config.knobs +4 -0
  611. package/payload/guard-kit/gate-tests/check-door-binding/good/scripts/guard-config.knobs +3 -0
  612. package/payload/guard-kit/gate-tests/check-door-binding/good/site/mirror.md +12 -0
  613. package/payload/guard-kit/gate-tests/check-door-binding/good/site/register.md +24 -0
  614. package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +40 -27
  615. package/payload/guard-kit/gate-tests/consumer-rules.test.sh +189 -0
  616. package/payload/guard-kit/gate-tests/door-binding-corpus.test.sh +72 -0
  617. package/payload/guard-kit/gate-tests/git-mutation-under-producer.test.sh +48 -23
  618. package/payload/guard-kit/gate-tests/guard-config-knobs.test.sh +170 -0
  619. package/payload/guard-kit/gate-tests/rewrite.test.sh +73 -0
  620. package/payload/guard-kit/gate-tests/scan-prompts.test.sh +174 -8
  621. package/payload/guard-kit/gate-tests/scratch-run.test.sh +149 -13
  622. package/payload/guard-kit/gate-tests/worktree-confinement.test.sh +169 -0
  623. package/payload/guard-kit/guard-tests/background-cases.tsv +14 -5
  624. package/payload/guard-kit/guard-tests/cases.tsv +360 -54
  625. package/payload/guard-kit/guard-tests/powershell-background-cases.tsv +29 -0
  626. package/payload/guard-kit/guard-tests/powershell-cases.tsv +81 -0
  627. package/payload/guard-kit/templates/close-triage.md +15 -62
  628. package/payload/guard-kit/templates/guard-config.knobs +26 -0
  629. package/payload/guard-kit/templates/settings-allow.json +15 -0
  630. package/payload/guard-kit/templates/settings-hooks.json +5 -5
  631. package/payload/lifecycle-kit/README.md +48 -76
  632. package/payload/lifecycle-kit/checks/check-audit-roster.gate +3 -0
  633. package/payload/lifecycle-kit/checks/check-close-surfaces.gate +1 -1
  634. package/payload/lifecycle-kit/checks/check-dispatch-entry.gate +3 -0
  635. package/payload/lifecycle-kit/checks/check-gap-inbox-neutrality.gate +1 -1
  636. package/payload/lifecycle-kit/checks/check-lesson-disposition.gate +1 -1
  637. package/payload/lifecycle-kit/checks/check-lifecycle-registration.gate +1 -1
  638. package/payload/lifecycle-kit/checks/check-merge-attrs.gate +1 -1
  639. package/payload/lifecycle-kit/checks/check-scratch-citation.gate +1 -1
  640. package/payload/lifecycle-kit/checks/check-shim-restatement.gate +1 -1
  641. package/payload/lifecycle-kit/checks/check-skill-binding.gate +1 -1
  642. package/payload/lifecycle-kit/checks/check-stage-entry.gate +2 -2
  643. package/payload/lifecycle-kit/checks/check-stage-evidence.gate +1 -1
  644. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.gate +2 -2
  645. package/payload/lifecycle-kit/checks/check-stamp-subject.gate +3 -0
  646. package/payload/lifecycle-kit/checks/check-survey-record.gate +2 -2
  647. package/payload/lifecycle-kit/gate-tests/boundary-scratch-wipe.test.sh +93 -18
  648. package/payload/lifecycle-kit/gate-tests/boundary-stage-journal.test.sh +196 -0
  649. package/payload/lifecycle-kit/gate-tests/boundary-worktree-refusal.test.sh +214 -0
  650. package/payload/lifecycle-kit/gate-tests/check-audit-roster/bad/args +2 -0
  651. package/payload/lifecycle-kit/gate-tests/check-audit-roster/bad/expect.txt +6 -0
  652. package/payload/lifecycle-kit/gate-tests/check-audit-roster/bad/roster.txt +34 -0
  653. package/payload/lifecycle-kit/gate-tests/check-audit-roster/good/args +2 -0
  654. package/payload/lifecycle-kit/gate-tests/check-audit-roster/good/expect.txt +1 -0
  655. package/payload/lifecycle-kit/gate-tests/check-audit-roster/good/roster.txt +22 -0
  656. package/payload/lifecycle-kit/gate-tests/check-audit-roster.test.sh +101 -0
  657. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/scripts/lifecycle-config.knobs +2 -0
  658. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/owners/worktrees/inbox.md +5 -0
  659. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/scripts/lifecycle-config.knobs +2 -0
  660. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +21 -4
  661. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/args +6 -0
  662. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/expect.txt +1 -0
  663. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/head.txt +5 -0
  664. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/marker.txt +1 -0
  665. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/msg.txt +4 -0
  666. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/paths.txt +1 -0
  667. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/bad/staged.txt +5 -0
  668. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/args +6 -0
  669. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/expect.txt +1 -0
  670. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/head.txt +5 -0
  671. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/marker.txt +1 -0
  672. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/msg.txt +4 -0
  673. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/paths.txt +2 -0
  674. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry/good/staged.txt +6 -0
  675. package/payload/lifecycle-kit/gate-tests/check-dispatch-entry.test.sh +60 -0
  676. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +1 -1
  677. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/AGENT.md +1 -5
  678. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/AGENT.md +1 -5
  679. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +1 -1
  680. package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +2 -2
  681. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/scripts/lifecycle-config.knobs +2 -0
  682. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/scripts/lifecycle-config.knobs +2 -0
  683. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/surfaces/worktrees/queue.md +13 -0
  684. package/payload/lifecycle-kit/gate-tests/check-shim-restatement.test.sh +1 -1
  685. package/payload/lifecycle-kit/gate-tests/check-skill-binding.test.sh +1 -1
  686. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +158 -11
  687. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +27 -2
  688. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/align.md +4 -1
  689. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/build.md +4 -1
  690. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/close.md +5 -0
  691. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/scope.md +4 -1
  692. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/validate.md +1 -1
  693. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/expect.txt +1 -1
  694. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/align.md +4 -1
  695. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/build.md +4 -1
  696. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/close.md +4 -1
  697. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/scope.md +4 -1
  698. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/validate.md +4 -1
  699. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage.test.sh +73 -0
  700. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/args +4 -0
  701. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/expect.txt +1 -0
  702. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/head.txt +5 -0
  703. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/msg.txt +4 -0
  704. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/bad/staged.txt +6 -0
  705. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/args +4 -0
  706. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/expect.txt +1 -0
  707. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/head.txt +5 -0
  708. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/msg.txt +4 -0
  709. package/payload/lifecycle-kit/gate-tests/check-stamp-subject/good/staged.txt +7 -0
  710. package/payload/lifecycle-kit/gate-tests/check-stamp-subject.test.sh +59 -0
  711. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +3 -0
  712. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +24 -0
  713. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -1
  714. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +10 -0
  715. package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +56 -5
  716. package/payload/lifecycle-kit/gate-tests/dispatch-marker.test.sh +152 -0
  717. package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +23 -48
  718. package/payload/lifecycle-kit/gate-tests/gap-inbox-route.test.sh +7 -5
  719. package/payload/lifecycle-kit/gate-tests/lead-journal-open.test.sh +119 -0
  720. package/payload/lifecycle-kit/gate-tests/preflight-valve.test.sh +170 -0
  721. package/payload/lifecycle-kit/gate-tests/rename-iteration.test.sh +5 -3
  722. package/payload/lifecycle-kit/gate-tests/ruling-staleness.test.sh +89 -0
  723. package/payload/lifecycle-kit/gate-tests/stamp-before-write.test.sh +66 -0
  724. package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +12 -6
  725. package/payload/lifecycle-kit/templates/consult.md +9 -63
  726. package/payload/lifecycle-kit/templates/lead.md +143 -431
  727. package/payload/lifecycle-kit/templates/lifecycle-config.knobs +1 -0
  728. package/payload/lifecycle-kit/templates/release-sweep.md +6 -35
  729. package/payload/lifecycle-kit/templates/stages/align.md +14 -82
  730. package/payload/lifecycle-kit/templates/stages/build.md +30 -98
  731. package/payload/lifecycle-kit/templates/stages/close.md +21 -170
  732. package/payload/lifecycle-kit/templates/stages/scope.md +42 -167
  733. package/payload/lifecycle-kit/templates/stages/spec.md +31 -97
  734. package/payload/lifecycle-kit/templates/stages/validate.md +22 -59
  735. package/payload/lifecycle-kit/templates/upgrade.md +6 -37
  736. package/payload/queue-kit/README.md +33 -48
  737. package/payload/queue-kit/checks/check-deferred-board-tags.gate +3 -0
  738. package/payload/queue-kit/checks/check-queue-entry-budget.gate +2 -2
  739. package/payload/queue-kit/checks/check-queue-hygiene.gate +2 -2
  740. package/payload/queue-kit/checks/check-queue-prose-precondition.gate +1 -1
  741. package/payload/queue-kit/checks/check-queue-sections.gate +1 -1
  742. package/payload/queue-kit/checks/check-queue-slug-liveness.gate +2 -2
  743. package/payload/queue-kit/checks/check-queue-wrap.gate +2 -2
  744. package/payload/queue-kit/checks/check-roadmap-fresh.gate +3 -2
  745. package/payload/queue-kit/checks/check-tag-lead-line.gate +2 -2
  746. package/payload/queue-kit/checks/check-task-conservation.gate +1 -1
  747. package/payload/queue-kit/checks/check-task-names.gate +2 -2
  748. package/payload/queue-kit/gate-tests/check-deferred-board-tags/bad/TASK-QUEUE.md +41 -0
  749. package/payload/queue-kit/gate-tests/check-deferred-board-tags/bad/expect.txt +6 -0
  750. package/payload/queue-kit/gate-tests/check-deferred-board-tags/bad/widget-kit/README.md +3 -0
  751. package/payload/queue-kit/gate-tests/check-deferred-board-tags/good/TASK-QUEUE.md +39 -0
  752. package/payload/queue-kit/gate-tests/check-deferred-board-tags/good/expect.txt +1 -0
  753. package/payload/queue-kit/gate-tests/check-deferred-board-tags/good/widget-kit/README.md +3 -0
  754. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/TASK-QUEUE.md +76 -31
  755. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/expect.txt +12 -4
  756. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/scripts/queue-config.knobs +4 -0
  757. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/TASK-QUEUE.md +58 -19
  758. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/expect.txt +8 -4
  759. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/scripts/queue-config.knobs +4 -0
  760. package/payload/queue-kit/gate-tests/check-queue-entry-budget.test.sh +124 -0
  761. package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/TASK-QUEUE.md +11 -1
  762. package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/expect.txt +2 -0
  763. package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +30 -11
  764. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/TASK-QUEUE.md +3 -1
  765. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/expect.txt +1 -0
  766. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/good/TASK-QUEUE.md +22 -6
  767. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/TASK-QUEUE.md +3 -1
  768. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/docs/page.md +1 -1
  769. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/expect.txt +3 -1
  770. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/scripts/queue-config.knobs +1 -0
  771. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/TASK-QUEUE.md +6 -2
  772. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/docs/page.md +3 -3
  773. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/docs/worktrees/page.md +4 -0
  774. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/scripts/queue-config.knobs +1 -0
  775. package/payload/queue-kit/gate-tests/check-queue-slug-liveness.test.sh +100 -0
  776. package/payload/queue-kit/gate-tests/check-queue-wrap/bad/TASK-QUEUE.md +3 -1
  777. package/payload/queue-kit/gate-tests/check-queue-wrap/good/TASK-QUEUE.md +20 -6
  778. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/TASK-QUEUE.md +15 -8
  779. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/scripts/queue-config.knobs +5 -0
  780. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/TASK-QUEUE.md +13 -6
  781. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/scripts/queue-config.knobs +5 -0
  782. package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/TASK-QUEUE.md +28 -7
  783. package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/expect.txt +10 -2
  784. package/payload/queue-kit/gate-tests/check-tag-lead-line/good/TASK-QUEUE.md +30 -8
  785. package/payload/queue-kit/gate-tests/check-task-names/bad/TASK-QUEUE.md +18 -3
  786. package/payload/queue-kit/gate-tests/check-task-names/bad/expect.txt +9 -0
  787. package/payload/queue-kit/gate-tests/check-task-names/good/TASK-QUEUE.md +20 -6
  788. package/payload/queue-kit/gate-tests/entry-history.test.sh +197 -0
  789. package/payload/queue-kit/gate-tests/queue-counts.test.sh +77 -73
  790. package/payload/queue-kit/gate-tests/queue-edges.test.sh +168 -87
  791. package/payload/queue-kit/gate-tests/queue-index.test.sh +30 -16
  792. package/payload/queue-kit/gate-tests/roadmap.test.sh +65 -58
  793. package/payload/queue-kit/templates/TASK-QUEUE.md +36 -23
  794. package/payload/queue-kit/templates/queue-config.knobs +1 -0
  795. package/payload/site-kit/README.md +26 -45
  796. package/payload/site-kit/checks/check-docs-cname-parity.gate +1 -1
  797. package/payload/site-kit/checks/check-docs-highlight-coverage.gate +4 -0
  798. package/payload/site-kit/checks/check-docs-liquid-parse.gate +3 -0
  799. package/payload/site-kit/checks/check-docs-render-fidelity.gate +3 -0
  800. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/args +1 -1
  801. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/scripts/site-config.knobs +2 -0
  802. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/args +2 -2
  803. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/scripts/site-config.knobs +2 -0
  804. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/docs/_layouts/default.html +11 -0
  805. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/expect.txt +4 -0
  806. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/scripts/highlight-tokens.list +7 -0
  807. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/bad/scripts/site-config.knobs +3 -0
  808. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/docs/_layouts/default.html +14 -0
  809. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/expect.txt +1 -0
  810. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/scripts/highlight-tokens.list +7 -0
  811. package/payload/site-kit/gate-tests/check-docs-highlight-coverage/good/scripts/site-config.knobs +1 -0
  812. package/payload/site-kit/gate-tests/check-docs-liquid-parse/bad/docs/_layouts/default.html +4 -0
  813. package/payload/site-kit/gate-tests/check-docs-liquid-parse/bad/docs/span.md +3 -0
  814. package/payload/site-kit/gate-tests/check-docs-liquid-parse/bad/expect.txt +2 -0
  815. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/_layouts/default.html +4 -0
  816. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/front.md +7 -0
  817. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/loop.md +5 -0
  818. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/plain.html +1 -0
  819. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/raw.md +3 -0
  820. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/docs/search.json +4 -0
  821. package/payload/site-kit/gate-tests/check-docs-liquid-parse/good/expect.txt +1 -0
  822. package/payload/site-kit/gate-tests/check-docs-liquid-parse-parser.test.sh +62 -0
  823. package/payload/site-kit/gate-tests/check-docs-render-fidelity-batch.test.sh +40 -45
  824. package/payload/site-kit/gate-tests/check-docs-render-fidelity-foreign.test.sh +7 -4
  825. package/payload/site-kit/gate-tests/check-docs-render-fidelity-span.test.sh +7 -4
  826. package/payload/site-kit/gate-tests/check-docs-render-fidelity-table.test.sh +7 -4
  827. package/payload/site-kit/templates/site-health.yml +67 -4
  828. package/profiles.list +4 -5
  829. package/lib/common/digest.sh +0 -18
  830. package/lib/common/lock.sh +0 -75
  831. package/lib/common/profile.sh +0 -91
  832. package/lib/common/recipe.sh +0 -106
  833. package/lib/diff.sh +0 -66
  834. package/lib/doctor.sh +0 -164
  835. package/lib/init.sh +0 -428
  836. package/lib/uninstall.sh +0 -214
  837. package/lib/update.sh +0 -34
  838. package/payload/canon-kit/SPEC.md +0 -2443
  839. package/payload/canon-kit/checks/check-surface-duplication.sh +0 -106
  840. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.sh +0 -6
  841. package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.sh +0 -6
  842. package/payload/canon-kit/gate-tests/check-install-claim/bad/scripts/canon-config.sh +0 -10
  843. package/payload/canon-kit/gate-tests/check-install-claim/good/scripts/canon-config.sh +0 -10
  844. package/payload/canon-kit/gate-tests/check-measured-claim/bad/scripts/canon-config.sh +0 -6
  845. package/payload/canon-kit/gate-tests/check-measured-claim/good/scripts/canon-config.sh +0 -6
  846. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +0 -8
  847. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +0 -8
  848. package/payload/canon-kit/gate-tests/check-prose-enum/bad/scripts/canon-config.sh +0 -4
  849. package/payload/canon-kit/gate-tests/check-prose-enum/good/scripts/canon-config.sh +0 -4
  850. package/payload/canon-kit/gate-tests/check-prose-tells/bad/scripts/canon-config.sh +0 -8
  851. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/scripts/canon-config.sh +0 -5
  852. package/payload/canon-kit/gate-tests/check-spec-pointer/good/scripts/canon-config.sh +0 -5
  853. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/scripts/canon-config.sh +0 -6
  854. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/scripts/canon-config.sh +0 -6
  855. package/payload/canon-kit/lib/spec.sh +0 -560
  856. package/payload/canon-kit/smoke/install.sh +0 -58
  857. package/payload/canon-kit/smoke/violation.sh +0 -22
  858. package/payload/canon-kit/templates/canon-config.sh +0 -2
  859. package/payload/context-kit/SPEC.md +0 -1134
  860. package/payload/context-kit/bin/always-loaded.sh +0 -70
  861. package/payload/context-kit/bin/env-probe.sh +0 -142
  862. package/payload/context-kit/bin/md-index.sh +0 -80
  863. package/payload/context-kit/bin/md-section.sh +0 -63
  864. package/payload/context-kit/bin/pub-index.sh +0 -90
  865. package/payload/context-kit/bin/run-index-tests.sh +0 -91
  866. package/payload/context-kit/gate-tests/check-footprint-fresh/good/args +0 -4
  867. package/payload/context-kit/gate-tests/check-footprint-fresh/good/emit.txt +0 -12
  868. package/payload/context-kit/gate-tests/check-footprint-fresh/good/projection.txt +0 -12
  869. package/payload/context-kit/index-tests/expected/toolfloor.txt +0 -23
  870. package/payload/context-kit/index-tests/toolfloor-cases.sh +0 -49
  871. package/payload/context-kit/lib/context.sh +0 -56
  872. package/payload/context-kit/lib/pub-lang/rust.sh +0 -26
  873. package/payload/context-kit/lib/pub-lang/ts.sh +0 -32
  874. package/payload/context-kit/lib/toolfloor.sh +0 -58
  875. package/payload/context-kit/smoke/agents-md.sh +0 -139
  876. package/payload/context-kit/smoke/install.sh +0 -64
  877. package/payload/context-kit/smoke/violation.sh +0 -21
  878. package/payload/context-kit/templates/context-config.sh +0 -2
  879. package/payload/delegation-kit/SPEC.md +0 -2078
  880. package/payload/delegation-kit/bin/run-budget-guard-tests.sh +0 -88
  881. package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +0 -97
  882. package/payload/delegation-kit/bin/run-trend-tests.sh +0 -63
  883. package/payload/delegation-kit/bin/run-usage-tests.sh +0 -226
  884. package/payload/delegation-kit/bin/usage-trend.sh +0 -120
  885. package/payload/delegation-kit/bin/usage-verdict.sh +0 -144
  886. package/payload/delegation-kit/bin/wait-probe.sh +0 -184
  887. package/payload/delegation-kit/gate-tests/subagent-stop-liveness.test.sh +0 -99
  888. package/payload/delegation-kit/lib/delegation.sh +0 -84
  889. package/payload/delegation-kit/smoke/install.sh +0 -83
  890. package/payload/delegation-kit/smoke/violation.sh +0 -16
  891. package/payload/delegation-kit/templates/agent-budget-guard.sh +0 -18
  892. package/payload/delegation-kit/templates/agent-dispatch-guard.sh +0 -61
  893. package/payload/delegation-kit/templates/delegation-config.sh +0 -6
  894. package/payload/delegation-kit/templates/statusline-usage.sh +0 -101
  895. package/payload/delegation-kit/templates/subagent-stop-liveness.sh +0 -56
  896. package/payload/delegation-kit/templates/usage-poller.sh +0 -67
  897. package/payload/delegation-kit/usage-tests/budget-guard-cases.tsv +0 -20
  898. package/payload/doctrine-kit/SPEC.md +0 -385
  899. package/payload/doctrine-kit/bin/install-doctrine.sh +0 -194
  900. package/payload/doctrine-kit/bin/stage-rules.sh +0 -51
  901. package/payload/doctrine-kit/lib/doctrine.sh +0 -29
  902. package/payload/doctrine-kit/smoke/install.sh +0 -203
  903. package/payload/doctrine-kit/smoke/violation.sh +0 -13
  904. package/payload/drift-kit/SPEC.md +0 -1187
  905. package/payload/drift-kit/bin/drift-report.sh +0 -155
  906. package/payload/drift-kit/bin/kfric.sh +0 -61
  907. package/payload/drift-kit/bin/overhead-meter.sh +0 -106
  908. package/payload/drift-kit/bin/stage-economics.sh +0 -465
  909. package/payload/drift-kit/kpis/kpi-always-loaded.sh +0 -39
  910. package/payload/drift-kit/kpis/kpi-amendment-age.sh +0 -33
  911. package/payload/drift-kit/kpis/kpi-deferred-age.sh +0 -46
  912. package/payload/drift-kit/kpis/kpi-gate-backlog.sh +0 -52
  913. package/payload/drift-kit/kpis/kpi-gate-runtime.sh +0 -31
  914. package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +0 -42
  915. package/payload/drift-kit/kpis/kpi-knowledge-friction.sh +0 -21
  916. package/payload/drift-kit/kpis/kpi-overhead.sh +0 -44
  917. package/payload/drift-kit/kpis/kpi-price-table-age.sh +0 -68
  918. package/payload/drift-kit/kpis/kpi-prompt-friction.sh +0 -38
  919. package/payload/drift-kit/kpis/kpi-queue-net-delta.sh +0 -74
  920. package/payload/drift-kit/kpis/kpi-settings-local.sh +0 -21
  921. package/payload/drift-kit/kpis/kpi-task-split.sh +0 -43
  922. package/payload/drift-kit/lib/drift.sh +0 -43
  923. package/payload/drift-kit/smoke/install.sh +0 -537
  924. package/payload/drift-kit/smoke/overhead-fixture.jsonl +0 -4
  925. package/payload/drift-kit/templates/drift-config.sh +0 -2
  926. package/payload/evidence-kit/SPEC.md +0 -740
  927. package/payload/evidence-kit/bin/diff-baseline.sh +0 -34
  928. package/payload/evidence-kit/bin/run-validate.sh +0 -124
  929. package/payload/evidence-kit/checks/check-producer-liveness.sh +0 -75
  930. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +0 -7
  931. package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +0 -7
  932. package/payload/evidence-kit/lib/evidence.sh +0 -193
  933. package/payload/evidence-kit/smoke/install.sh +0 -59
  934. package/payload/evidence-kit/smoke/violation.sh +0 -8
  935. package/payload/evidence-kit/templates/evidence-config.sh +0 -2
  936. package/payload/gate-sdk/SPEC.md +0 -10872
  937. package/payload/gate-sdk/bin/gen-pre-commit.sh +0 -297
  938. package/payload/gate-sdk/bin/install-hooks.sh +0 -60
  939. package/payload/gate-sdk/bin/port-blockers.sh +0 -473
  940. package/payload/gate-sdk/bin/run-consumer-smoke.sh +0 -239
  941. package/payload/gate-sdk/bin/run-gate-tests.sh +0 -179
  942. package/payload/gate-sdk/bin/upgrade-smoke.sh +0 -236
  943. package/payload/gate-sdk/checks/check-action-run-shell.sh +0 -223
  944. package/payload/gate-sdk/checks/check-crate-arms.sh +0 -62
  945. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +0 -450
  946. package/payload/gate-sdk/checks/check-install-disposition.sh +0 -93
  947. package/payload/gate-sdk/checks/check-shellcheck.sh +0 -57
  948. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/scripts/gate-sdk-config.sh +0 -2
  949. package/payload/gate-sdk/gate-tests/check-crate-arms/good/scripts/gate-sdk-config.sh +0 -2
  950. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/args +0 -4
  951. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/emit.txt +0 -14
  952. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/projection.txt +0 -14
  953. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +0 -2
  954. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +0 -2
  955. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +0 -6
  956. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +0 -3
  957. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +0 -6
  958. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +0 -3
  959. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/installer/lib/common/recipe.sh +0 -9
  960. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-beta.gate +0 -3
  961. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-gamma.sh +0 -6
  962. package/payload/gate-sdk/gate-tests/check-install-disposition/good/installer/lib/common/recipe.sh +0 -10
  963. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.sh +0 -5
  964. package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.sh +0 -5
  965. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/scripts/gate-sdk-config.sh +0 -5
  966. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +0 -5
  967. package/payload/gate-sdk/gate-tests/declaration-lib-parity.test.sh +0 -211
  968. package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +0 -112
  969. package/payload/gate-sdk/lib/consumer-smoke.sh +0 -69
  970. package/payload/gate-sdk/lib/declaration.sh +0 -59
  971. package/payload/gate-sdk/lib/inject.sh +0 -80
  972. package/payload/gate-sdk/smoke/install.sh +0 -171
  973. package/payload/gate-sdk/smoke/violation.sh +0 -13
  974. package/payload/guard-kit/SPEC.md +0 -1415
  975. package/payload/guard-kit/bin/compare-settings-allow.sh +0 -115
  976. package/payload/guard-kit/bin/run-guard-tests.sh +0 -110
  977. package/payload/guard-kit/bin/scan-prompts.sh +0 -166
  978. package/payload/guard-kit/bin/scratch-run.sh +0 -34
  979. package/payload/guard-kit/gate-tests/guard-read-path.test.sh +0 -52
  980. package/payload/guard-kit/lib/guard.sh +0 -1014
  981. package/payload/guard-kit/smoke/install.sh +0 -26
  982. package/payload/guard-kit/templates/bash-guard.sh +0 -20
  983. package/payload/guard-kit/templates/escalation-guard.sh +0 -27
  984. package/payload/guard-kit/templates/guard-config.sh +0 -8
  985. package/payload/guard-kit/templates/wakeup-guard.sh +0 -20
  986. package/payload/lifecycle-kit/SPEC.md +0 -2884
  987. package/payload/lifecycle-kit/bin/cite-survey.sh +0 -81
  988. package/payload/lifecycle-kit/bin/enter-stage.sh +0 -380
  989. package/payload/lifecycle-kit/bin/file-gap.sh +0 -101
  990. package/payload/lifecycle-kit/bin/file-survey.sh +0 -69
  991. package/payload/lifecycle-kit/bin/install-lifecycle.sh +0 -36
  992. package/payload/lifecycle-kit/bin/session-id.sh +0 -75
  993. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/scripts/lifecycle-config.sh +0 -4
  994. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/scripts/lifecycle-config.sh +0 -4
  995. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/scripts/lifecycle-config.sh +0 -4
  996. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/scripts/lifecycle-config.sh +0 -4
  997. package/payload/lifecycle-kit/gate-tests/workflow-state-guard.test.sh +0 -100
  998. package/payload/lifecycle-kit/lib/stages.sh +0 -194
  999. package/payload/lifecycle-kit/smoke/install.sh +0 -434
  1000. package/payload/lifecycle-kit/smoke/violation.sh +0 -8
  1001. package/payload/lifecycle-kit/templates/lifecycle-config.sh +0 -2
  1002. package/payload/lifecycle-kit/templates/workflow-state-guard.sh +0 -29
  1003. package/payload/queue-kit/SPEC.md +0 -1436
  1004. package/payload/queue-kit/bin/lesson-sink.sh +0 -28
  1005. package/payload/queue-kit/bin/queue-counts.sh +0 -35
  1006. package/payload/queue-kit/bin/queue-edges.sh +0 -78
  1007. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/scripts/queue-config.sh +0 -6
  1008. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/scripts/queue-config.sh +0 -6
  1009. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/scripts/queue-config.sh +0 -3
  1010. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/scripts/queue-config.sh +0 -3
  1011. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/scripts/queue-config.sh +0 -6
  1012. package/payload/queue-kit/gate-tests/check-roadmap-fresh/good/scripts/queue-config.sh +0 -6
  1013. package/payload/queue-kit/gate-tests/queue-lib-parity.test.sh +0 -215
  1014. package/payload/queue-kit/lib/queue.sh +0 -129
  1015. package/payload/queue-kit/smoke/install.sh +0 -25
  1016. package/payload/queue-kit/smoke/violation.sh +0 -8
  1017. package/payload/queue-kit/templates/queue-config.sh +0 -2
  1018. package/payload/site-kit/SPEC.md +0 -601
  1019. package/payload/site-kit/checks/check-docs-render-fidelity.sh +0 -242
  1020. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/scripts/site-config.sh +0 -7
  1021. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/scripts/site-config.sh +0 -7
  1022. package/payload/site-kit/lib/site.sh +0 -43
  1023. package/payload/site-kit/smoke/install.sh +0 -34
  1024. package/payload/site-kit/smoke/violation.sh +0 -20
  1025. /package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/{check-ported.gate → check-stage-entry.gate} +0 -0
@@ -1,2884 +0,0 @@
1
- # lifecycle-kit — an evidence-stamped iteration lifecycle for stateless agent sessions
2
-
3
- An iteration is a self-contained work cycle driven through a configurable
4
- sequence of stages (default: `scope → [align] → build → validate → close`).
5
- The problem the kit solves: a stateless agent session cannot be trusted to
6
- remember, or even re-read, a process document — so the process state lives in
7
- two governed files a gate can read, and every stage transition leaves
8
- machine-checkable evidence.
9
-
10
- The kit carries the generic state machine only; a consumer's stage names,
11
- exit conditions, and ritual content are config and skill-template fill-ins.
12
- Requires [gate-sdk](../gate-sdk/) (the gates follow its four contracts and
13
- resolve through its registry).
14
-
15
- ## The state machine
16
-
17
- Two governed surfaces, carrying **one axis each**:
18
-
19
- - **The header line**, at the top of the consumer's queue file (default
20
- `TASK-QUEUE.md`), carrying the *slow* axis — the iteration name, and nothing
21
- else:
22
-
23
- ```
24
- ## Iteration: <name>
25
- ```
26
-
27
- - **The evidence file** (default `.workflow/WORKFLOW-STATE.txt`): free prose,
28
- then a `---` separator, then one data line per stage-skill invocation:
29
-
30
- ```
31
- <iteration> <stage> <session-id> <YYYY-MM-DD> <head>
32
- ```
33
-
34
- It carries the *fast* axis too: **the last data line's `<stage>` token is the
35
- cursor** — the single source for "which stage is this iteration in".
36
-
37
- `<head>` is the abbreviated commit `bin/enter-stage.sh` read at the instant
38
- it wrote the stamp, or the literal `none` where it found no git work tree and
39
- no commit to name. It is **required**, and `none` is a value rather than an
40
- omission: a permanently optional field is a permanent disarm switch for the
41
- provenance assertion it exists to serve (§check-stage-evidence), which would
42
- be enforcement-first inverted — the fix shipped beside its bypass. The field
43
- is **appended** rather than inserted, so every positional reader of fields one
44
- to four is unmoved.
45
-
46
- **The five-field grammar is a breaking change to a shipped file format**, and
47
- a consumer vendoring it mid-iteration reds until they rewrite their own
48
- stamps: for each, `<head>` is the first parent of the commit that introduced
49
- that stamp line, recoverable from history, and `none` where it is not — a
50
- stamp whose introducing commit cannot be identified takes `none` rather than
51
- a guess, because a guessed provenance value is indistinguishable from a real
52
- one afterward. That rewrite is a **rewrite and not an introduction**, which is
53
- what the migration clause of the newly-introduced test (§check-stage-evidence)
54
- exists to say. The honest mitigation is the boundary: the first stage's reset
55
- truncates this file, so a consumer upgrading at an iteration boundary pays
56
- nothing.
57
-
58
- The header once carried a `[stage:]` field as well. It was a second copy of a
59
- derivable fact — every stage entry already stamps its `<stage>` — bought at one
60
- queue write per stage entry, and kept in sync only by an assertion that existed
61
- for no other purpose. Deriving the cursor from the stamps retires the copy, the
62
- write, and the assertion together (derivation-first). A consumer upgrading
63
- mid-iteration needs no migration step: every header reader strips an optional
64
- trailing bracketed field, so a residual `[stage:]` is inert and the next
65
- iteration-boundary reset rewrites the header without it.
66
-
67
- Both surfaces are **single-writer and branch-scoped**: an iteration owns exactly
68
- one branch (its home branch) and every stamp lands there, so
69
- concurrency between operators is git branch topology, not a multi-writer state
70
- file. The integration branch is the degenerate single-operator home; a second
71
- concurrent operator cuts a branch at their scope entry. The merge semantics that
72
- make this safe — the iteration-scoped surfaces resolve to the arriving branch at
73
- a merge — are §Multi-operator semantics.
74
-
75
- The default motion is the linear stage walk; the gate-legal shapes for leaving
76
- it — abandon, split, reopen — are specified in §Deviation transitions, not
77
- improvised.
78
-
79
- ### The stamp protocol
80
-
81
- The **arriving** stage's skill *stamps* the evidence file as its first step —
82
- and that stamp is the whole transition, because the last stamp is the cursor.
83
- Nothing flips. The departing session writes nothing, so no uncommitted stage
84
- line crosses the session boundary. The entry commit stages the evidence file,
85
- so every state-coupled gate re-fires on it: the prior stage's
86
- machine-expressible exit is re-verified *at the entry* (`check-stage-evidence`),
87
- and `check-stage-entry` extends that one hop back. A self-asserted "stage
88
- complete" marker would prove a claim, not completion — the kit deliberately
89
- has none.
90
-
91
- **What the entry re-fires, and what it does not.** The entry commit stages the
92
- evidence file alone, so the gates coupled to it — `check-stage-entry`,
93
- `check-stage-evidence`, `check-evidence-manifest`, `check-trajectory-fresh`,
94
- and any gate globbing the workflow dir — re-fire at every entry exactly as
95
- before. Queue-only-coupled gates do not: the queue is not written at an entry,
96
- so their re-run would be a no-op on unchanged input, and each of
97
- them couples some *other* input that fires it on the change it actually gates.
98
- What is genuinely given up is the incidental *periodic sweep* — the guarantee
99
- that those gates ran at least once per stage regardless of what changed, which
100
- could catch drift introduced out of band (a `--no-verify` commit, an edit
101
- outside every coupled glob). The full battery at the validate stage is the
102
- surviving sweep and the stronger one: it runs every gate, not the
103
- queue-coupled subset. The per-entry queue re-fire was a side effect of the flip,
104
- never the designed sweep — an accepted, costed loss.
105
-
106
- Mid-iteration the queue file is written only for real **work-state**
107
- transitions: promotion and naming (the first stage), the Done move riding each
108
- amendment-merge commit, and the closing dispositions. Stage motion never
109
- touches it.
110
-
111
- The **deterministic half** of that first step — read the iteration from the
112
- header, read the id from `session-id.sh`, append the stamp — is mechanized by
113
- `bin/enter-stage.sh <stage>`, the same
114
- writer/asserter split as `gen-pre-commit.sh` ↔ `check-graph`: the skill
115
- invokes it, **judgment stays in the skill** (what the stage means, its exit
116
- condition, when to enter it at all), and the stage gates stay the independent
117
- verifier. The tool takes no `--force` flag, so the compliant path is the easy
118
- one — an operator who intends to override writes the stamp by hand, exactly
119
- as before the tool existed. Committing the stamp remains the skill's
120
- business — **never with `--no-verify`**: `enter-stage.sh` refuses to write
121
- while `check-stage-entry` is red, so the hook a bypass skips is exactly the
122
- battery that would confirm the stamp just written. A stage entry is never the
123
- one-off-with-cause that a bypass is reserved for.
124
-
125
- The first stage is the iteration boundary: `enter-stage.sh` *truncates* the
126
- evidence file back to its header (git history is the permanent audit trail;
127
- the gates only read the current iteration) and stamps under the
128
- unnamed-iteration sentinel `—`, rewritten to the real name when the stage
129
- names the iteration. Later stages only append.
130
-
131
- **The no-cursor window.** Because the cursor is the last stamp, it has an empty
132
- state the header never had — and one of its two shapes is reachable in normal
133
- operation. The boundary truncation leaves the evidence file holding its prose
134
- preamble and `---` with **no data line**, and the cursor is empty until the
135
- boundary stamp lands milliseconds later; the second shape is an absent file
136
- entirely (an unvendored or pre-upgrade consumer). Every reader of the cursor —
137
- inside this kit and in every consuming kit that derives it — **states its own
138
- behavior for that window** rather than inheriting whatever its parser happens
139
- to emit. The shared derivation `lifecycle_current_stage` reports it as empty
140
- with a *success* status, because "no cursor" is a legitimate state and not an
141
- error; what it means is the caller's ruling, and each caller's is recorded in
142
- its own section.
143
-
144
- **Honest limit:** a stamp proves the stage skill was *invoked*, not that its
145
- work was done faithfully — strictly better than skip-and-no-trace, but not
146
- proof of done. The `<session-id>` field is **read, not hand-picked**:
147
- `bin/session-id.sh` prints the canonical id by a fixed derivation order
148
- (§bin/session-id.sh), which rotates per session (including across a context
149
- clear), and the stage skills stamp exactly what it prints, so each stage's
150
- provenance is observed, not guessed.
151
- `check-stage-evidence`'s invocation floor keys on `<iteration> <stage>`; it
152
- additionally reads the session id to enforce cross-stage distinctness under
153
- the default `stage` posture (a stage entry must carry a fresh session; the
154
- `iteration` posture of `LIFECYCLE_KIT_SESSION_BOUNDARY` relaxes exactly this —
155
- see §check-stage-evidence).
156
-
157
- **Same-stage re-entry (N sibling sessions per stage).** Entering the
158
- currently-stamped stage from a *new* session is legal and appends a fresh
159
- stamp: `enter-stage.sh`'s idempotence guard keys on the full
160
- `(iteration, stage, session-id, head)` tuple, so only the *same* session
161
- re-entering **at the same commit** is a no-op — a re-entry after `HEAD` moved
162
- appends a fresh stamp carrying the new head, which is what makes re-running the
163
- tool the stated remedy for a stale recorded head rather than a reported no-op
164
- that changes nothing (§check-stage-evidence). `check-stage-entry` assertion A
165
- keys on the *predecessor* stamp,
166
- which the stage's first entry satisfied for every sibling. So N sessions may
167
- enter one stage — a multi-session build, or a lead's intra-stage batch split
168
- (§templates/lead.md) — serialized by the shared index/HEAD like any concurrent
169
- sessions; each leaves its own stamp, so per-batch provenance rides the existing
170
- stamp grammar with no new field. A sibling's entry simply appends another stamp
171
- naming the same stage, which leaves the cursor where it already was — there is
172
- no once-per-stage write left to make idempotent.
173
-
174
- **The optional lead never becomes a second state source.** An iteration may run
175
- with a live *lead* session (§templates/lead.md) that dispatches its stage
176
- sessions and answers their escalations so a blocked stage resumes in place
177
- rather than restarting. The lead writes no state: every stamp
178
- originates in a stage session through `enter-stage.sh`, exactly as above, so the
179
- stamp protocol stays the only iteration state and a lead crash costs
180
- nothing the tracked surfaces do not already hold. The lead is a boundary skill,
181
- not a stage — it stamps nothing and joins no stage set, so the coverage gate
182
- never reads it (the release-sweep precedent, §templates/lead.md).
183
-
184
- **Honest limit on the lead's dispatch precondition.** A lead dispatches stage
185
- N+1 on stage N's **agent completion notification**, never on an artifact — not
186
- its commit, its stamp, a clean tree, a green battery, or a cleared `--simulate`
187
- (§templates/lead.md). That precondition is **prose-only and human-enforced**, and
188
- the cause is structural rather than budgetary. The signal's **producer is the
189
- harness**, emitting it when the dispatched session's turn ends — outside every
190
- governed tree, which is not a gap to close but the direct reason no gate can read
191
- it; its enabling configuration is the dispatch itself, since the lead dispatches
192
- in the background with notification (delegation-kit/SPEC.md §The delegation
193
- model), so the producer is reachable on the ordinary path. Its **consumer is the
194
- lead**, at the dispatch transition for stage N+1, by the lead's own in-turn wait
195
- rather than a read. Its **truthfulness** is not the harness's to guarantee: a
196
- dispatched session that ends its turn on still-running work emits a notification
197
- that lies, which is what delegation-kit/SPEC.md §Operative residency exists to
198
- prevent. The limit is recorded here rather than left to be inferred from the
199
- absence of a gate, because an unstated version reads as an oversight for a later
200
- session to fix by building the impossible gate. Naming it is also what routes the
201
- enforcement duty to where it *can* be discharged: the **negative is** assertable
202
- from the artifact side. A producer-liveness gate wired into
203
- `LIFECYCLE_KIT_ENTRY_PREFLIGHT` (evidence-kit/SPEC.md §check-producer-liveness)
204
- answers *is the producer still running?* independently of the signal, which is
205
- what covers the case where the signal itself is wrong. Precedent for a
206
- prose-only rule in the same template: the no-sibling-dispatch clause, prose for
207
- the same reason.
208
-
209
- **Honest limit on the lead's post-dispatch check routing.** The rule that the
210
- lead's verify of the evidence-producing stage is a **read** of the committed
211
- evidence rather than a re-run of the producer (§templates/lead.md, applying
212
- delegation-kit/SPEC.md §Verify after every agent commit) is likewise
213
- **prose-only and human-enforced**, and for the generic reason that section
214
- states: the subject is a lead's *choice of command*, which leaves no tracked
215
- artifact any check could read. The nearest artifact-side proxy is
216
- `check-producer-liveness` on the entry-preflight hook (evidence-kit/SPEC.md
217
- §check-producer-liveness), and its coverage boundary must be stated precisely or
218
- this limit reads as closed when it is not: that gate answers *is a producer
219
- running now*, so it covers the **concurrent** case — a producer still live when
220
- the next entry is stamped — and not a **sequential** re-run, where a lead
221
- re-runs the producer after it has cleanly exited, holds no lock, and reds
222
- nothing. The two limits in this section are the same shape from opposite sides
223
- of one dispatch: the one above is about waiting for stage N to be *over*, this
224
- one about which command is safe *once it is*.
225
-
226
- ### Deviation transitions
227
-
228
- The stages walk `scope → align → build → validate → close` in order by
229
- default; the gate-legal shapes for leaving that walk are specified here, not
230
- improvised. Each composes mechanism the kit already owns — `enter-stage.sh`'s
231
- boundary reset, canon-kit's amendment pairing, queue-kit's tag algebra — so
232
- **no new tooling, state, stamp grammar, or tag is introduced**, and a
233
- harness-less consumer keeps every shape. `check-stage-entry` and the stamp
234
- protocol bar an ad-hoc abandon, which is why each hatch is spelled against the
235
- existing gates.
236
-
237
- **The demote ritual** is the shared step the other shapes compose. To take a
238
- promoted entry out of a live iteration: move it back to the deferred queue
239
- section restoring its design-pending tag, and delete its amendment file in the
240
- same commit. Git history preserves the design — a later scope re-promotes by
241
- resurrecting the file from history rather than re-deriving it. The enforcement
242
- is already on the books: canon-kit's `check-amendment-queue` reds the commit on
243
- a deferred entry that still carries a spec ref, or an orphaned amendment left on
244
- disk. If the validate baseline carries a scenario keyed to the demoted entry,
245
- that scenario is re-scoped or removed in the same commit — a coverage-honesty
246
- obligation, not a gate one (`check-evidence-baseline`'s slug-liveness passes
247
- regardless, since a demoted entry stays a live queue task).
248
-
249
- **Abandon** ends an iteration without a close. Disposition every active entry
250
- explicitly — demote it (ritual above) or carry it (it stays active with its
251
- amendment and the next iteration adopts it); sink or delete every Lessons entry
252
- under the existing disposition rules (the first-stage entry refuses a non-empty
253
- Lessons section, so this is already forced). Then the next `enter-stage.sh
254
- scope` *is* the abandon: scope has no mandatory predecessor, so the entry is
255
- gate-legal from any stage, and the boundary reset drops the dead iteration's
256
- stamps exactly as it drops a closed one's (git history is the permanent audit
257
- trail — the existing boundary doctrine, not a new rule). The abandon commit's
258
- subject names the abandoned iteration; no stamp grammar changes.
259
-
260
- **Split mid-flight** narrows a live iteration. The iteration name never changes
261
- once set — every stamp already written carries it, and a rename-in-place is
262
- barred because it would orphan those stamps against `check-stage-evidence`'s
263
- name-axis agreement — its staleness assertion reds every stamp whose iteration
264
- is not the header's. So splitting is demotion: demote the split-out subset
265
- via the ritual and drive the remaining queue through the remaining stages; the
266
- subset re-promotes at a later scope under its own iteration.
267
-
268
- **Reopen after close** is barred as an in-place edit. Stamps are append-only
269
- within an iteration and scope is the only reset, so there is no gate-legal way
270
- to continue a closed iteration's evidence file — and no history rewrite is
271
- sanctioned to fake one (doctrine-kit's *Re-verify volatile state before a git
272
- history rewrite* territory — cited by name, since a rule number re-arms the
273
- drift every later insertion causes). The sanctioned shape
274
- is a successor iteration: a post-close defect files as a debt entry and the
275
- follow-up iteration proceeds normally; the closed iteration's record stays
276
- immutable.
277
-
278
- **The interstitial mitigation** is the shape that fits *between* a close and the
279
- next scope. A repo-local mitigation for a recurring incident may land directly in
280
- that window while the incident's queue entry stays open for the kit-shaped form.
281
- One cap makes it admissible: **it adds no governed name** — canon-kit's
282
- feature/debt litmus read the other way (canon-kit/SPEC.md §The amendment
283
- lifecycle, where a task adding any name to a governed surface is a feature and
284
- needs an amendment). So an interstitial landing is admissible exactly when it is
285
- debt-shaped; anything feature-shaped waits for scope. The entry stays open either
286
- way, because the mitigation is repo-local and the entry's deliverable is not. Like
287
- every shape here it introduces no tooling, state, stamp grammar or tag — the cap
288
- is an existing litmus and the landing is an ordinary commit. It **widens Reopen
289
- after close** rather than competing with it: routing a post-close defect to a debt
290
- entry and a normal follow-up iteration is the right answer for a first occurrence
291
- and the wrong one for the fourth, and the fourth is now countable
292
- (queue-kit/SPEC.md §The tag algebra, the `recurrence:` declaration). The commit
293
- accounting already holds and needs no change — an interstitial commit falls into
294
- the *next* iteration's range and surfaces when that iteration closes
295
- (drift-kit/SPEC.md §The published-evidence extractor).
296
-
297
- **A parallel hotfix track is refused**, recorded here so it is not re-proposed: it
298
- violates scope-gated intake, it contends on live stage surfaces, and most incident
299
- fixes are feature-shaped — so a "hotfix" of them is an unreviewed iteration. The
300
- lane this shape governs already half-existed; what was missing was the signal that
301
- says when to use it.
302
-
303
- **The close-merge** is the concurrent-close shape, and like the others it
304
- composes existing mechanism (the merge-supersede rule of §Multi-operator
305
- semantics, not new tooling). Iteration boundaries serialize on the integration
306
- branch: the closing operator reconciles *on their iteration branch* — merges the
307
- integration branch in, where the `merge=iteration-scoped` driver resolves the
308
- iteration-scoped surfaces to their own (arriving) side and humans resolve the
309
- content conflicts — re-runs the full battery green, then lands
310
- fast-forward-only on the integration branch. The integration branch never hosts
311
- a conflict resolution, so "arriving iteration" is always well-defined (ours on
312
- the iteration branch) and every merged tree passed the battery post-reconcile.
313
-
314
- ## Layout and configuration
315
-
316
- The kit is vendored beside gate-sdk (conventionally at `lifecycle-kit/`); its
317
- gates are registered in the consumer's `gates.list` by name and resolve
318
- through gate-sdk's multi-kit path (consumer gates dir first, then each kit's
319
- `checks/`). The kit's markdown templates are laid out on the stage/boundary axis
320
- this SPEC classifies them by: `templates/*.md` is exactly the **boundary skills**
321
- (`lead.md`, `release-sweep.md`, `upgrade.md`, `consult.md`),
322
- `templates/stages/*.md` exactly
323
- the stage-class templates. Stage skills adopt `templates/stages/*.md` in one of
324
- two modes — copied into the consumer's agent-skill directory with each named slot
325
- overwritten, or a thin binding shim that references the template (the grammar
326
- and the contract both modes satisfy are §templates/stages/).
327
-
328
- The stage machine itself is config with this repo's lifecycle as the
329
- default: copy `templates/lifecycle-config.sh` into the gates dir as
330
- `lifecycle-config.sh` (or point `LIFECYCLE_KIT_CONFIG_FILE` elsewhere) and
331
- set only what you override — this roster owns every knob and its default;
332
- the template carries no second copy. The loader validates the machine
333
- (unknown stages in the map, a waiver token colliding with a stage name, a
334
- non-integer n-gram width, a malformed preflight entry) and exits 2 on a
335
- malformed config — a broken machine must not gate anything.
336
-
337
- Knob-rename compat precedent. A rename carries two obligations of different
338
- natures, and each answers to its own threshold.
339
-
340
- **Declaration — owed from the first release tag, unconditionally.** A tagged
341
- release is a distribution, and whoever vendored it reads the note to learn what
342
- moved. From the first tag onward a rename owes a tightened-gates/release-note
343
- declaration (the deprecation-lifecycle and upgrade-path rungs).
344
-
345
- **Compat shim and deprecation window — owed from the project's declared
346
- general-availability posture onward, never from a tag.** While a project's own
347
- declared stability posture is pre-general-availability, a knob rename is
348
- compat-free: no read-the-old-name shim, no deprecation window, no queue-bound
349
- deprecation marker. The declaration is still owed, so a consumer who vendored
350
- early is never surprised. They are told; they are simply not carried.
351
-
352
- The observable is a declared posture rather than an adoption count, because the
353
- obligation is normative rather than empirical. You owe a migration path because
354
- you promised stability, not because you counted users. A project that has
355
- promised nothing owes nothing, and owes it the instant it promises, whether or
356
- not anyone has installed. "The first observed external install" reads the premise
357
- most literally and is rejected: it cannot be falsified from the tree, and it
358
- makes the obligation turn on a fact outside the project's control. A tag was a
359
- bad proxy for that same reason rather than one that merely aged — it measures
360
- distribution where the obligation tracks promise, so it would have drifted under
361
- any release history, fast or slow.
362
-
363
- **Fail-safe direction.** A project declaring no stability posture at all is
364
- treated as **past** the threshold: the compat obligation applies. Silence must
365
- not read as still-pre-GA, because that is the reading under which a project that
366
- never got round to declaring anything grants itself a permanent exemption. The
367
- window is opened by an explicit pre-GA declaration and by nothing else.
368
-
369
- The clause is knob-scoped, and the scoping is substantive rather than accidental:
370
-
371
- 1. **The mechanism it points at is knob-shaped.** The deprecation path it invokes
372
- is the queue-bound deprecation markers and the release note's `Renamed knobs`
373
- section, whose `old → new` / `old → ∅` grammar is specific to config names. A
374
- rule reaching gate names or file conventions would point at a mechanism that
375
- does not accept them.
376
- 2. **No class is left without a home.** A non-knob rename — a gate name, a file
377
- or directory convention — is structurally accommodated by the release note's
378
- `Behavior changes` section, whose bullet lead is defined as the changed
379
- surface's name (script, knob, template, or file), a definition that already
380
- admits each of those classes. What the note grammar does not yet carry is a
381
- sentence explicitly *routing* non-knob renames there, so this is a sound
382
- structural inference rather than an established convention. The narrow scoping
383
- leaves no rename without a section shaped for it, which is all this reason
384
- claims.
385
- 3. **Widening it would restate a neighbour.** A general "any governed name" rule
386
- is doctrine-tier, and that placement call belongs to doctrine rather than to a
387
- kit SPEC, which would otherwise settle a doctrine question from the inside and
388
- duplicate whatever lands there.
389
-
390
- No gate reads this clause, and that is a ruling rather than an omission. The
391
- predicate a gate would need is *"this commit renames a knob"*, which is not
392
- decidable from a diff without a knob-identity model no kit has; an approximation
393
- would fire on additions and removals alike and be valved into silence. The
394
- clause's reader is the build-stage session performing the rename, which reads it
395
- to decide whether it owes a shim and a deprecation marker.
396
-
397
- A consumer points the general-availability criterion at whatever stability
398
- declaration it maintains. The kit states the criterion and never the instance:
399
- naming one project's channel vocabulary here would ship that project's release
400
- posture as everyone's, and no knob is introduced to read the value either, since
401
- the clause's reader is a human or agent rather than a gate.
402
-
403
- - `LIFECYCLE_KIT_STAGES` — the stage roster, in order; default
404
- `(scope align build validate close)`.
405
- - `LIFECYCLE_KIT_PREDECESSOR` — associative map stage → the predecessor whose
406
- stamp `check-stage-entry` requires; default `([align]=scope [build]=scope
407
- [validate]=build [close]=validate)` (`build` keys to `scope` because the
408
- audit stage is trigger-gated; §check-stage-entry).
409
- - `LIFECYCLE_KIT_FIRST_STAGE` — the stage whose entry is the iteration boundary
410
- (§bin/enter-stage.sh truncation); default `scope`.
411
- - `LIFECYCLE_KIT_DRAIN_STAGE` — the stage whose entry requires the active queue
412
- sections empty; default `validate`; empty disables the drain assertion. Must
413
- not be terminal: at least one `LIFECYCLE_KIT_PREDECESSOR` entry names it, or
414
- config load fails (the drain-exempt backstop; §check-stage-entry).
415
- - `LIFECYCLE_KIT_ACTIVE_SECTIONS` — the queue sections the drain assertion
416
- reads; default `("New Features" "Technical Debt")`. Independent of
417
- canon-kit's `CANON_KIT_ACTIVE_SECTIONS` (read by `check-amendment-queue`'s
418
- misfiled-spec-ready clause) though their defaults coincide — a consumer
419
- retargeting one alone splits the drain assertion's view from
420
- `check-amendment-queue`'s, with no gate to notice. A known, accepted
421
- coupling: kit independence outranks unifying the knob.
422
- - `LIFECYCLE_KIT_AUDIT_STAGE` — the trigger-gated audit stage assertion C looks
423
- for; default `align`; empty disables the audit machinery entirely.
424
- - `LIFECYCLE_KIT_AUDIT_ENTRY_STAGE` — the stage whose entry assertion C blocks
425
- on a cross-component signal with no audit stamp; default `build` when an
426
- audit stage is set, else empty.
427
- - `LIFECYCLE_KIT_WAIVER_TOKEN` — the stamp token recording the user's explicit
428
- audit waiver; default `<audit-stage>-waived`; must not collide with a
429
- stage name.
430
- - `LIFECYCLE_KIT_AMENDMENT_GLOB` / `LIFECYCLE_KIT_ROSTER_BASENAME` — the amendment
431
- filename shape and the canonical-spec basename assertion C scans
432
- (template dirs pruned); defaults `SPEC-*.md` / `SPEC.md`.
433
- - `LIFECYCLE_KIT_CONTRACT_TOKENS` — the amendment-body substrings assertion C
434
- reads as a cross-component contract signal; default `("SPEC.md" "proto/")`.
435
- - `LIFECYCLE_KIT_SKILLS_DIR` — the agent-skill directory
436
- `check-stage-skill-coverage` scans; default `.claude/commands`.
437
- - `LIFECYCLE_KIT_AGENT_FILE` — the always-loaded agent file
438
- `bin/install-lifecycle.sh` writes the registration block into and
439
- `check-lifecycle-registration` reads it back from; default `CLAUDE.md`
440
- (the `DOCTRINE_KIT_AGENT_FILE` sibling).
441
- - `LIFECYCLE_KIT_QUEUE_FILE` / `LIFECYCLE_KIT_STATE_FILE` — the governed header and
442
- stamp files, defaulting through gate-sdk's `GATE_SDK_QUEUE_FILE` /
443
- `GATE_SDK_WORKFLOW_DIR`.
444
- - `LIFECYCLE_KIT_SESSION_ID` — the harness-neutral stamp-id override, source 1
445
- of the derivation order (§bin/session-id.sh); default unset.
446
- - `LIFECYCLE_KIT_SESSION_BOUNDARY` — `stage` or `iteration`; default `stage`.
447
- The knob lives on the session-span/evidence axis only (ruled; no role
448
- values): manual-versus-lead is the driver/role axis and rides context-kit's
449
- session-role signal, never this knob.
450
- The consumer's session-boundary posture: at `stage`, distinct stages of
451
- one iteration may not share a session id (§check-stage-evidence); at
452
- `iteration`, that cross-stage distinctness check alone is skipped —
453
- attribution still rides the stamps, and every other assertion holds. The
454
- loader validates the value alongside its machine checks and exits 2 on
455
- anything else. `enter-stage.sh` does not read it — stamping is
456
- posture-independent; `templates/lead.md` consumes it as the inline-run
457
- posture prose.
458
- - `LIFECYCLE_KIT_LESSON_EVIDENCE_FILE` — the kit-owned lesson-disposition stamp
459
- file; default `${GATE_SDK_WORKFLOW_DIR:-.workflow}/lesson-evidence.txt`,
460
- read by `check-lesson-disposition` and the boundary-reset built-in.
461
- - `LIFECYCLE_KIT_GAP_INBOX_FILE` — the committed append-only gap inbox
462
- (§The committed gap inbox); default
463
- `${GATE_SDK_WORKFLOW_DIR:-.workflow}/gap-inbox.md`, written by `bin/file-gap.sh`,
464
- its `merge=union` attribute verified by `check-merge-attrs`, drained by the
465
- close skill and read for emptiness by `bin/enter-stage.sh`'s boundary refusal.
466
- - `LIFECYCLE_KIT_SURVEY_RECORD_FILE` — the committed per-iteration survey record
467
- (§The survey record); default
468
- `${GATE_SDK_WORKFLOW_DIR:-.workflow}/survey-record.md`, written by
469
- `bin/file-survey.sh`, asserted by `check-survey-record`, its headings printed
470
- and its body truncated by `bin/enter-stage.sh` (a kit-owned boundary built-in,
471
- so it does not ride `LIFECYCLE_KIT_BOUNDARY_TRUNCATE`), and its
472
- `merge=iteration-scoped` attribute verified by `check-merge-attrs`. One knob,
473
- and no second one for the grammar, the witness commands, or an opt-out — each
474
- of those is contract rather than layout.
475
- - `LIFECYCLE_KIT_RECURRENCE_THRESHOLD` — positive integer, default `2`; the
476
- recorded re-filing count at which a **deferred** entry enters the scope stage's
477
- proposed unit set regardless of the standing directive's theme (the pre-emption
478
- rule, §templates/stages/). Two recorded re-filings is a third incidence of the
479
- same finding. It is a stated policy with a stated purpose rather than a derived
480
- number, and a knob for that reason — `QUEUE_KIT_ENTRY_LINE_CAP`'s posture. The
481
- count it is read against is the date count of the entry's `recurrence:`
482
- declaration (queue-kit/SPEC.md §The tag algebra owns that grammar). That rule is
483
- its only reader: queue-kit owns the declaration and reads no threshold,
484
- drift-kit reports the count and applies no verdict.
485
- - `LIFECYCLE_KIT_CLOSE_SURFACE_GLOBS` — the consumer's `close-surface:`
486
- declaration surfaces beyond the resolved kit roots (§The close-surface
487
- roster); default `*/SPEC.md`. It deliberately does **not** default to
488
- `CANON_KIT_MANIFEST_FILES`: reading another kit's knob would make lifecycle-kit
489
- depend on canon-kit's configuration for a value the consumer already owns, and
490
- the one cross-kit knob read in the tree today is precedent, not a ruling. The
491
- declaration vocabulary is kit-owned and carries no consumer content; the roster
492
- is derived, never a kit literal — a kit shipping the *names* of a consumer's
493
- inbound surfaces would publish that consumer's private workflow.
494
- - `LIFECYCLE_KIT_PERMANENT_SURFACE_GLOBS` — array of path globs for the surfaces
495
- held to the no-retrieval-pointer rule (§check-scratch-citation); default the
496
- queue file alone (`LIFECYCLE_KIT_QUEUE_FILE`). That default is the one permanent
497
- surface this kit owns and where both attested firings landed, so it is
498
- non-vacuous in every consumer and over-reaches in none. The roster is consumer
499
- config and the forbidden targets are derived from the consumer's own truncate
500
- configuration, so no kit literal names any surface a consumer happens to have.
501
- - `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` — extra files reset to their header at the
502
- iteration boundary; default empty. Adding a member also widens
503
- `check-scratch-citation`'s forbidden-target set, because both read
504
- `lifecycle_supersede_set`.
505
- - `LIFECYCLE_KIT_BOUNDARY_PRESERVE` — keep-list of scratch-dir **basenames** the
506
- iteration-boundary wipe spares (§bin/enter-stage.sh); default empty, so an
507
- unset-knob consumer gets a clean wipe of an already-disposable surface.
508
- Boundary-only, and paired with the scratch dir it reads (`GATE_SDK_TMP_DIR`)
509
- rather than adding a directory knob of its own. **The tier split matters:** the
510
- `.gitkeep` exemption is a kit invariant this knob cannot unset, and this knob
511
- is the consumer keep-list layered on top — a reader who takes the knob for the
512
- wipe's only keep rule would reintroduce the tracked-file deletion.
513
- - `LIFECYCLE_KIT_BOUNDARY_REQUIRE` — array of repo-relative files each of which
514
- must carry a data line naming the closing iteration before the iteration
515
- boundary may be crossed (§bin/enter-stage.sh); a missing member is a
516
- fail-closed refusal; default empty (an unconfigured consumer sees no change).
517
- - `LIFECYCLE_KIT_ENTRY_PREFLIGHT` — per-stage `<stage>=<command>` entries run
518
- alongside the built-in pre-flight (§bin/enter-stage.sh); default empty.
519
- - `LIFECYCLE_KIT_SHIM_NGRAM` — the shared-n-gram width `check-shim-restatement`
520
- trips at (positive integer; §check-shim-restatement); default `9`.
521
- - `LIFECYCLE_KIT_SHIM_DEDUP_CORPUS` — that gate's corpus file list; default
522
- empty for the computed `CLAUDE.md`-plus-kit-templates default.
523
-
524
- `.gitattributes` (repo root) is a consumer surface the kit writes but adds **no
525
- knob** for: the `merge=iteration-scoped` supersede set derives from the existing
526
- boundary-truncate knobs (`LIFECYCLE_KIT_STATE_FILE`,
527
- `LIFECYCLE_KIT_LESSON_EVIDENCE_FILE`, and each `LIFECYCLE_KIT_BOUNDARY_TRUNCATE`
528
- member), so a reshaped truncate set flows into the attribute block by
529
- construction — §Multi-operator semantics, §bin/install-lifecycle.sh.
530
-
531
- ## Multi-operator semantics
532
-
533
- The contributor altitude of the coordination map: a second operator running
534
- their own concurrent iteration on the same repo. The two narrower altitudes are
535
- ruled elsewhere and stay untouched — sub-agents within one session
536
- (delegation-kit's serialize-or-worktree rules) and sessions within one iteration
537
- (§templates/lead.md: one live iteration, stages serialized through the stamp
538
- protocol). Fork contributors are out of scope: an outside PR never stamps
539
- state — it only passes the battery in CI.
540
-
541
- **The topology ruling — state surfaces stay single-writer; concurrency is git
542
- topology.** The header line, the evidence file, and every boundary-truncated
543
- surface are *iteration-scoped*: an iteration owns exactly one branch (its home
544
- branch), and every stamp lands there. One live iteration per branch —
545
- the second concurrent operator cuts a branch at their scope entry; the
546
- integration branch is the degenerate single-operator home, which is why a
547
- single-operator repo's own dogfood changes nothing. Branch naming is prose
548
- guidance (name the branch after the iteration), not mechanism — no knob, no
549
- gate. Ruled out, each because it composes worse than git already does: per-operator
550
- state files or stamp-attribution fields (multi-writer surfaces and a new stamp
551
- grammar — operator attribution already rides the git author on every stamp
552
- commit); a lock or lease on the integration branch (state the kit refuses to
553
- own, where git already provides the isolation).
554
-
555
- **The merge-supersede rule.** At any branch merge, the iteration-scoped surfaces
556
- resolve wholesale to the *arriving* (checked-out) iteration's version — the other
557
- side's content is per-iteration scratch the boundary doctrine already declares
558
- dead (git history is the permanent audit trail). The supersede set is **derived,
559
- never maintained**: it is exactly what `bin/enter-stage.sh` truncates at the
560
- iteration boundary — `LIFECYCLE_KIT_STATE_FILE`,
561
- `LIFECYCLE_KIT_LESSON_EVIDENCE_FILE`, `LIFECYCLE_KIT_SURVEY_RECORD_FILE`, and
562
- the `LIFECYCLE_KIT_BOUNDARY_TRUNCATE`
563
- members — rendered by `lifecycle_supersede_set` (§lib/stages.sh). The survey
564
- record is in the set for a reason worth stating: a carried survey describes a
565
- tree state the arriving iteration never had, so taking the other side would
566
- hand a stale finding a fresh-looking home (§The survey record). The queue file
567
- is deliberately *not* in the set: its body (backlog sections, lessons) is shared
568
- content that merges like any prose, and only its header line is iteration-scoped
569
- — resolved by hand to the arriving iteration, with a wrong resolution going red
570
- at the next commit because `check-stage-evidence` requires the header's name to
571
- agree with every stamp's, and the state file already took the arriving side by
572
- driver. Contention on the queue is lower than it reads: since the cursor left
573
- the header, **stage motion writes no queue at all**, so the file changes only on
574
- real work-state transitions (promotion and naming, a Done move, the closing
575
- dispositions) rather than once per stage entry per operator.
576
- Held-constant baselines and append-across-iterations evidence keep normal merge
577
- semantics: their conflicts are real disagreements. The kit owns exactly one
578
- `union`-driver surface — the committed gap inbox (§The committed gap inbox),
579
- whose append-only bullets must survive a concurrent merge rather than supersede
580
- — rendered into the attribute block beside the supersede set and verified by the
581
- same gate; a consumer with its own *tracked* shared append log points it at git's
582
- built-in `union` driver the same way — sanctioned shape, git-native. (Gitignored
583
- per-checkout scratch — friction logs — never merges and needs no rule.)
584
-
585
- **`.gitattributes` — the rule mechanized.** Each supersede-set path carries
586
- `merge=iteration-scoped`; the driver definition (`git config
587
- merge.iteration-scoped.driver true` — keep ours) is per-clone config installed by
588
- `bin/install-lifecycle.sh` beside its registration block (the `install-hooks.sh`
589
- opt-in class). Honest limit: on a clone without the driver installed the
590
- attribute is inert and the file conflicts normally — the rule above then governs
591
- the hand resolution, so the uninstalled path degrades to judgment, never to
592
- silence. Writer/asserter split: the installer emits the attribute block
593
- (marker-bounded, `lib/inject.sh`), `check-merge-attrs` verifies it — the
594
- `gen-pre-commit.sh` ↔ `check-graph` precedent.
595
-
596
- **Who may stamp, at this altitude.** Unchanged: the arriving stage session
597
- stamps,
598
- and only on its own iteration's home branch. A session never stamps a branch whose
599
- iteration it is not driving; cross-iteration discoveries (a lesson, a deferred
600
- filing) land on the discoverer's own branch and reconcile at merge.
601
-
602
- **Causal-completeness core: no new state surface.** The design adds no stamp
603
- grammar, no queue tag, no evidence file. Every existing producer/consumer pair
604
- (`enter-stage.sh`, the stage gates, the drift report) keeps working per-branch
605
- unmodified. The two added surfaces each have a named reader at a named
606
- transition: the `merge=iteration-scoped` lines are read by git's merge machinery
607
- at a merge and by `check-merge-attrs` at pre-commit; the `merge.iteration-scoped`
608
- driver config is read by git's merge machinery when an attributed path needs a
609
- three-way merge (not readable by a pre-commit gate — per-clone state, its absence
610
- the recorded honest limit above). The close-merge protocol (§Deviation
611
- transitions) is produced by the closing operator's close session and consumed by
612
- the integration branch's battery — the reconcile commit re-fires every
613
- queue/state-coupled gate, which is what makes the header hand-resolution
614
- enforceable.
615
-
616
- ## The committed gap inbox
617
-
618
- Mid-iteration work-state writes race the stage session holding the shared git
619
- index: a gap surfaced mid-stage has no committed place to land except the queue
620
- file that stage session is already contending on. So mid-iteration gap *filing*
621
- gets a committed, append-only channel of its own — distinct from the
622
- knowledge-friction log, which stays the narrow sensor for a fact re-derived
623
- because no doc owns it (drift-kit/SPEC.md §The knowledge-friction loop): a
624
- *work-shaped* finding (a gap, a task, a defect) is backlog, not knowledge
625
- friction, and routes here.
626
-
627
- **The surface.** `.workflow/gap-inbox.md` (knob `LIFECYCLE_KIT_GAP_INBOX_FILE`,
628
- §Layout and configuration) is a committed, append-only capture buffer. Grammar:
629
- a `# contract:` prose header, then one `- <YYYY-MM-DD> — <gap prose>` bullet per
630
- gap — **one shape for every filing**, with no structured slot between the date
631
- and the prose. A slug named *inside* the prose takes queue-kit's existing
632
- in-body citation form (queue-kit/SPEC.md §The tag algebra), single-backticked,
633
- borrowed rather than re-spelled; it is a citation and never a field, which is
634
- the whole distinction §check-gap-inbox-neutrality holds. Committed, not gitignored — a
635
- per-clone buffer fragments the backlog across
636
- operators, the finding that rules the gitignored friction log out as the channel.
637
- What *append-only* means on this surface is a merge property, and
638
- §Multi-operator semantics owns it: this is the kit's one `union`-driver surface.
639
-
640
- **The affordance.** `bin/file-gap.sh [--] "<gap prose>"` (the `bin/kfric.sh`
641
- pattern: repo-root cd, config-via-env, exit 2 on an empty argument) appends one
642
- dated bullet, seeding the contract header when the inbox does not yet exist. Its
643
- one positional is free text, so it validates that argument's **shape** to
644
- gate-sdk/SPEC.md §The bin/-tool contract — help on stdout at exit 0, an
645
- unrecognized leading `-` refused, `--` ending option processing — which is the
646
- rule this capture affordance's own three attested firings bought. It is
647
- advisory tooling, not a gate — no fixture pair is owed; the raw append (a bullet
648
- line into the inbox) stays a legal fallback, the grammar being the surface's
649
- contract, not the writer.
650
-
651
- It also **resolves the prose against the live slug set** at capture and, on a
652
- match, raises a stderr advisory that **asks** the filer: the prose names live
653
- entry `<slug>` — if this bullet *re-files* that finding, say so in the prose and
654
- say why; if it merely cites, corrects, or argues against that entry, say it is
655
- *distinct* and why, because the closing stage's drain judges the recurrence and
656
- reads what was written. The resolution buys a prompt and nothing else: it writes
657
- no marker, and the bullet it accompanies is the same one shape every filing gets.
658
- The
659
- live set is every column-0 `- **<slug>** —` entry bullet in the queue file
660
- *outside* the fixed-spelling `## Lessons Learned` section — that is exactly
661
- active, deferred, and a configured icebox — and it needs **no section knob of its
662
- own** because both exclusions fall out of grammar the kit already reads. The done
663
- section is excluded by construction: a done entry is a bare-slug line, outside the
664
- entry grammar queue-kit/SPEC.md §The queue format defines. Lessons is excluded by
665
- name, and must be: a lesson lead line is outside that grammar for every *gate*,
666
- but it may legitimately be *written* in the entry shape (`- **slug** [tag] —
667
- prose`), so a grammar-only scan would resolve a live lesson as a queue entry and
668
- ask the filer about something that is not one. The `## Lessons Learned`
669
- literal is fixed spelling rather than config (queue-kit/SPEC.md §The tag algebra),
670
- and this kit already carries it — `bin/enter-stage.sh`'s boundary refusal and
671
- `check-lesson-disposition` both scan it.
672
- The done exclusion is the substantive half: a finding that recurs *after* its fix
673
- landed is a new defect, not a recurrence, and files as one. Resolution is
674
- lifecycle-kit's own awk over the
675
- queue — the shape `check-stage-entry` assertion B already takes — never
676
- queue-kit's `queue_live_slugs`, because reaching for it would close a cross-kit
677
- cycle. queue-kit/SPEC.md §The queue format states that as the general rule (a kit
678
- that cannot depend on queue-kit re-implements the predicate and both ends cite the
679
- owner section), and drift-kit's `kpi-deferred-age` records the same accepted
680
- residual.
681
-
682
- **Why the matcher prompts rather than decides, and why it survives at all.** A
683
- recurrence is a claim about *what a finding is*, not about *what a string
684
- contains*, and no syntactic tell separates "this recurred" from "this is about
685
- that": a bullet can spell the denial out in words and still match. So the
686
- predicate is not sharpened, it is **demoted** — its recall was never the defect,
687
- its authority was. Deleting it would delete the only thing that can produce the
688
- prompt, and the prompt is what reaches the one party who can answer cheaply: a
689
- mid-build filer routinely has not read the queue, which is why the matcher
690
- existed in the first place.
691
-
692
- **Its honest limit.** A bullet describing a recurrence without spelling the slug
693
- raises no advisory at all. That leaves no hole in this channel, because the drain
694
- reads **every** bullet regardless of whether the matcher spoke — which is the
695
- difference between a prompt and a gate, and the reason the judgment had to move
696
- rather than the predicate get sharper.
697
-
698
- **Three alternatives are refused, recorded so they are not re-drafted.** A
699
- *required* recurrence-or-new argument on the affordance turns capture into an
700
- interrogation, and refusing capture does not dissolve a finding — it pushes it
701
- back into session context, the deferred-capture antipattern this inbox exists to
702
- prevent; it is also asked of a party who has not read the queue. An *optional*
703
- `--recurrence <slug>` flag invites the drain to trust a structured claim,
704
- reinstating the same defect one layer up with a better provenance story. And
705
- *narrowing the matcher* — anchoring the slug, exempting a bullet containing a
706
- negation — institutionalizes the evasion: an affordance that must be phrased
707
- around to stay accurate is miscalibrated, and the next filer does not know to
708
- phrase around it. What all three trade against is prose, which the channel
709
- already carries and a judge already reads.
710
-
711
- **A fourth shape is refused — deriving post-close-ness from git — recorded so it
712
- is not re-drafted.** The proposal: rather than reading the cursor, ask "has the
713
- inbox been truncated since the close stamp's commit?", which separates the cases
714
- with no marker field. It is refused on evidence, on four independent grounds.
715
-
716
- - **It is wrong on the case that matters.** The predicate assumes the drain and
717
- the closing stamp are commensurable in commit order. Measured over this
718
- project's four most recently closed iterations they are not: the truncation is
719
- **never** in the stamp's commit and is **always** a later, separately authored
720
- one. So "truncated since the close stamp" is true of every normally-closed
721
- iteration, and the single case it does distinguish — a close that stamped and
722
- then skipped its drain — it answers *close-skipped*, handing the entering
723
- session a recovery naming a stage that is gone. The cursor read is right there,
724
- because close did run.
725
- - **It cannot answer the other case at all.** Where close was genuinely skipped
726
- there is no close-stamp commit to anchor on, so the git predicate degenerates
727
- into "is there a close stamp?" — which is the cursor read, obtained from a file
728
- the tool already holds open.
729
- - **It would be `bin/enter-stage.sh`'s first `git` invocation.** That tool shells
730
- out to git nowhere: every decision it takes is a read of the queue and the
731
- state file. Adding history-dependence to the state machine's only writer makes
732
- the entry decision non-hermetic, and the branch's fixture would have to
733
- construct commit history rather than three files.
734
- - **Its stated virtue does not discriminate.** "Needs no marker field, so
735
- §check-gap-inbox-neutrality's two-field bound stays intact" is equally true of
736
- the cursor read, which writes nothing anywhere. The bound is untouched by both,
737
- so it selects neither.
738
-
739
- **The tool writes no queue file, and that is the load-bearing constraint on the
740
- whole channel.** This inbox exists precisely because a gap surfaced mid-stage has
741
- no committed place to land except the queue file a stage session is already
742
- contending on. A `file-gap.sh` that stamped a `recurrence:` declaration onto a
743
- queue entry would do the one thing the inbox was built to prevent. The queue write
744
- therefore belongs to the closing stage's drain, which writes the queue anyway.
745
-
746
- It also **warns at the point of capture**, reading the cursor
747
- (`lifecycle_current_stage`) to say which consequence the filer is buying: an
748
- ordinary filing is told the bullet blocks the next first-stage entry until the
749
- drain, and a filing made while the cursor sits at the **last configured stage**
750
- is told that once that stage finishes, none is left to drain it. The warning
751
- goes to stderr so the stamped bullet stays the tool's stdout contract. It is a
752
- warning and not a refusal deliberately: refusing capture does not dissolve a
753
- real finding, it pushes it back into session context — the deferred-capture
754
- antipattern this inbox exists to prevent.
755
-
756
- **The drain re-verifies; capture does not.** A bullet's prose is a claim made at
757
- capture speed, and this channel is built to keep capture cheap, so nothing
758
- upstream established it — a bullet can assert a mechanism its filer inferred
759
- rather than ran, and a false premise is paid by whoever drains it. The drain
760
- therefore names, per bullet, the claim its disposition turns on and the command
761
- that establishes it, runs that command, and records in the same commit which
762
- bullets were re-verified and what fell (§templates/stages/ carries the step). The
763
- grounds are attested rather than argued: of the bullets re-verified at one
764
- boundary, two were false at their central claim and each fell to a single
765
- command, and a later bullet carried two false premises at once — one caught by
766
- the filer re-reading the source before the drain, the other only by the draining
767
- session's own probes. The step that reliably ran was the drain.
768
-
769
- **Two capture-time shapes are refused, recorded so they are not re-drafted.** A
770
- filing-time prompt for the establishing command, and a grammar separating
771
- observed fact from inferred mechanism, both add friction at the moment this inbox
772
- exists to keep cheap, and both bill it to the party least able to pay — the
773
- mid-stage filer whose finding otherwise stays in session context. That is the
774
- deferred-capture antipattern the channel was built against, and it is not traded
775
- away to fix a different failure mode. The affordance gains no prompt and no
776
- grammar; §check-gap-inbox-neutrality keeps the bullet's fields at two.
777
-
778
- **Merge semantics.** The inbox carries `merge=union` (git-native, so no per-clone
779
- driver registration), not the keep-ours `merge=iteration-scoped` the
780
- boundary-truncated surfaces carry: an iteration-scoped surface is per-iteration
781
- scratch superseded at the boundary, but a gap filed on either side of a
782
- concurrent merge must survive. The installer emits the line and
783
- `check-merge-attrs` verifies it (§bin/install-lifecycle.sh, §check-merge-attrs).
784
-
785
- **The boundary check: one detector, two dispositions.**
786
- `bin/enter-stage.sh`'s first-stage (iteration-boundary) entry is unchanged in
787
- **detection** — it still fires on any `- ` bullet in the inbox — and
788
- **discriminates** on which of two dispositions it takes, because the drain and
789
- the filing window do not coincide.
790
-
791
- - **Close-skipped** — the closing iteration's cursor never reached the last
792
- configured stage. The entry **refuses** (exit 1, the untriaged bullets
793
- printed, nothing written — the same refusal contract as the non-empty Lessons
794
- section), with the one recovery that applies: run the closing stage's
795
- gap-drain step, truncate the inbox, re-enter. A stage was skipped, so the
796
- recovery is to run it, and no gap outlives its iteration untriaged (the
797
- gap-disposition rule: costed and filed, never flagged-and-skipped).
798
- - **Post-close** — the cursor sits at the last configured stage, so the closing
799
- stage has run and none is coming back. The entry is **admitted**: the bullets
800
- print on stderr as an advisory naming them this iteration's first-stage
801
- intake, and the stamp proceeds. Deleting a bullet without a disposition is
802
- still not a drain.
803
-
804
- The discriminator is the cursor read `lifecycle_closing_stage_reached`
805
- (§lib/stages.sh), the same predicate `bin/file-gap.sh` warns from at capture, so
806
- a filer told "none is left to drain it" is told so by the very test that later
807
- admits the bullet rather than by a lookalike. **Two edges take the post-close
808
- disposition**, both following precedents the script already carries: a closing
809
- iteration that was never named (the `—` placeholder) has no close to have
810
- skipped — the guard `LIFECYCLE_KIT_BOUNDARY_REQUIRE` applies one block down for
811
- the same reason — and an inbox holding bullets with no cursor at all, a fresh
812
- consumer's first boundary, is that case too.
813
-
814
- **No second detector is added for the post-close window**: the existing refusal
815
- already detects it, and what was missing was the message's actionability. That
816
- ruling is **kept and re-read** rather than retired — the two-disposition shape
817
- satisfies it more exactly than the two-recovery message did, since one detector
818
- still fires and what the discriminator picks is only what to do about it.
819
-
820
- **Why admission, and not merely a better-worded refusal.** A refusal that picks
821
- the right message still leaves the queue write where this project's own history
822
- puts it: made **before any stamp exists, by a session that has entered no
823
- stage**, and committed as though by a stage that has not started. Routing a
824
- post-close finding into the first stage's ordinary intake is satisfiable only
825
- *inside* that stage — the intake is its — so the entry has to succeed for the
826
- finding to reach it. What the change buys is that the disposition becomes an
827
- ordinary in-stage queue write in the stage that writes the queue anyway.
828
-
829
- **What the admission costs, and why the loss is smaller than it looks.** The
830
- invariant "no gap outlives its iteration untriaged" is not weakened, because a
831
- post-close bullet never had a drainer in the iteration it was filed in — that is
832
- the defect, and no message could have supplied one. On admission the bullet
833
- stops being post-close: it becomes an ordinary mid-iteration bullet of the
834
- **new** iteration, and it therefore acquires the drainer it never had, that
835
- iteration's mandatory close drain. The first stage is directed to take it
836
- earlier because it is writing the queue anyway; if it does not, close does. That
837
- forcing function is the existing one rather than a new one.
838
-
839
- **The honest limit, stated because it is real.** The finding's *disposition*
840
- then lands in the next iteration's ledger, which cannot be repaired: the finding
841
- postdates its own iteration's close, so no iteration-correct ledger position
842
- exists for it. What is repaired is legibility — a promoted entry's provenance
843
- sentence carries the bullet's own date and names the iteration whose close
844
- generated it, so a reader sees where the finding came from even though its
845
- disposition sits one iteration later. A record that is late and says so is
846
- strictly better than one that is late and silent.
847
-
848
- That check is the inbox's
849
- forcing function — branch-conditional as of the two dispositions above, refusing
850
- on the close-skipped branch and obliging an in-stage disposition on the other —
851
- so the inbox declares itself on the close-surface roster
852
- (§The close-surface roster) here, where the forcing function is documented:
853
-
854
- close-surface: .workflow/gap-inbox.md forced=lifecycle-kit/SPEC.md §bin/enter-stage.sh
855
-
856
- **Producers and consumers.** Producer: any mid-iteration session (lead or stage)
857
- via `bin/file-gap.sh` — the knob default makes the channel live everywhere the
858
- kit is vendored. Consumers, **two**, one per disposition of the boundary check.
859
- The close skill's drain step (§templates/stages/) dispositions every bullet —
860
- promoted to a deferred `[design-pending]` entry, fixed inline that session, or
861
- discarded with cause in the close commit message — then truncates the inbox to
862
- its header. The **first stage's intake step** (§templates/stages/) takes the
863
- bullets the boundary carried, with the same disposition set and the same
864
- truncate-in-the-same-commit rule, run after its stamp; it is reachable at every
865
- boundary with no enabling config, and it exists because a post-close bullet has
866
- no drainer in the iteration that filed it. The boundary check reads emptiness at
867
- the next first-stage entry as the backstop for both.
868
-
869
- **A `recurrence:` date records a session's judgment that a finding re-occurred,
870
- made by reading the bullet's prose. A slug appearing in a bullet is an input to
871
- that judgment and never a verdict; no mechanism produces the declaration.**
872
-
873
- That drain step is the declaration's only **mechanized** producer
874
- (queue-kit/SPEC.md §The tag algebra), and it is the stage that must not skip the
875
- judgment: on a bullet it judges a recurrence it stamps the date onto that entry's
876
- declaration — creating the line when absent, appending the date when present —
877
- **in addition to** its ordinary disposition, never instead of it. It is reachable
878
- at every close with no enabling config, since the drain is already mandatory and
879
- the boundary refusal already forces it.
880
-
881
- The drain is *not* the only producer, and that path is **ruled: sanctioned, and
882
- obliged.** A session that observes a recurrence outside the capture channel
883
- stamps one directly, in the commit it is already making. The obligation attaches
884
- to the **judgment**, not to the channel the observation arrived through — the
885
- failure the counter exists to end is a recurrence *seen and not recorded*, and a
886
- merely permitted write is one a session under pressure correctly declines, which
887
- would answer the question in form and leave it open in substance.
888
-
889
- **A lead cannot discharge that obligation as written, and the channel already
890
- supplies what it can.** §templates/lead.md forbids the lead every queue write, so
891
- a lead that judges a recurrence has exactly one channel — this inbox — and a
892
- lead's judgment is made at the boundary, which is precisely where the check above
893
- stands. The discharge is therefore *stated* rather than invented: **a lead
894
- discharges the obligation by filing the judgment and its grounds into the
895
- bullet's prose**, and the stamp is made by the session that may write the queue,
896
- judging from that prose. That is the shape the drain already has — the bullet's
897
- prose is the grounds the judge reads — so no new authority and no new producer is
898
- created. What the two dispositions above supply is the route's far end: a
899
- boundary-filed lead judgment reaches a judge rather than a refusal.
900
- This settles the **authority** half only; the **reach** half — stages that may
901
- write the queue but never load this rule — is untouched here.
902
-
903
- *Not forbidden*, on three independent grounds. It would strand a class by
904
- construction: this drain runs once, early in close, while close's own later steps
905
- — audits, lesson disposition, staleness reads, release disposition — necessarily
906
- generate findings that postdate it, leaving the one stage downstream of every
907
- drain no legal channel at all. It is already being obeyed at a recorded cost, and
908
- a rule whose disciplined observance produces a known-wrong count is the wrong
909
- rule. And it would red roughly a third of its own precedent — the ground on which
910
- the provenance gate below is refused, a refusal made to keep this route open.
911
-
912
- *Not mechanized*, which is foreclosed rather than weighed: **no mechanism
913
- produces the declaration** is the ruling stated above, and mechanizing this path
914
- reverses it. Independently, the only available mechanism is the capture-time
915
- matcher, whose honest limit above runs in the **under-counting** direction, so
916
- mechanizing on it would dress a known-lossy predicate as a count.
917
-
918
- *Prospective only, operator-ruled 2026-08-17, and this is the ruling's own reach
919
- rather than a narrowing of it.* No session backfills a date onto a judgment an
920
- earlier session declined to stamp. The trade below is what forecloses it: this
921
- rule concedes re-derivability and pays with **auditability by inspection**, so a
922
- date is legible only because the prose it was judged from sits in the same diff —
923
- and for a past decline the judging session is gone and no contemporaneous prose
924
- can be put there. A backfilled date would carry neither property, which is
925
- precisely the artifact this section refuses to ship. The counter-argument is
926
- recorded rather than buried: refutation two above rests on the declines having
927
- produced a known-wrong count, and that count stays wrong. A rule change fixes the
928
- count forward by removing what produced the error; retro-scoring is a different
929
- act on a worse evidence base. Stated here so the reach is read rather than
930
- re-derived.
931
-
932
- Stamping is **idempotent per (slug, date)** — two filings of one slug on
933
- one day record one date, the day being the only resolution the bullet's own
934
- grammar has, and inventing a finer one would claim precision this channel does not
935
- carry.
936
-
937
- **What the judgment rule costs, and what pays for it.** The property the rule
938
- declines to offer is **re-derivability**: a date is *not* reproducible by
939
- re-running any predicate over the queue, so a reader cannot audit the count
940
- without trusting the session that stamped it, and claiming otherwise would be the
941
- dishonest half of the trade. What
942
- pays for it is **auditability by inspection** — the drain stamps the declaration
943
- in the *same commit* that truncates the inbox, so the judgment and the prose it
944
- was made from sit in one diff and a reader auditing a date reads that commit and
945
- sees the bullet the judge read. That same-commit rule is therefore **load-bearing
946
- rather than incidental**: it is the audit artifact. The **invariant** is the
947
- judgment and its grounds landing in one commit; truncating the inbox is one way
948
- of satisfying it and not the thing itself. A direct stamp truncates nothing, so
949
- it discharges the same obligation the only way it can — **the observation is
950
- written into the entry, beside the declaration, in the stamping commit** — and a
951
- reader auditing a direct date finds the grounds there exactly as with a drained
952
- one. The same-commit rule is also what makes the
953
- stamp a **mandated write** in queue-kit's sense — the class
954
- queue-kit/SPEC.md §check-queue-entry-budget defines, and the section a stamping
955
- session reads for its relief when that gate's per-entry cap blocks the stamp;
956
- that grounds write is the same mandated write as the date it accompanies, its
957
- grounds half rather than a discretionary addition, so it claims the same relief.
958
- Neither the class nor the relief is restated here; this section is only the
959
- contract that mandates the write. Re-running a matcher is
960
- replaced by reading the grounds, which is the correct trade when the thing
961
- recorded is a judgment.
962
-
963
- **What the sanction adds is judges.** It adds no *new* class of unverifiability —
964
- re-derivability is conceded above for the drain's own stamps — but the population
965
- that may stamp widens from one stage to every session, and some of those sessions
966
- judge their own tool use, which is a session grading itself. No gate can hold
967
- that and none is proposed; the counterweight is the grounds obligation above,
968
- which makes a thin judgment visibly thin.
969
-
970
- **A provenance gate was drafted here and is refused, recorded so it is not
971
- re-drafted.** Requiring every commit that adds a `recurrence:` date to co-stage
972
- the inbox looks like the enforced replacement for re-derivability. It is not: a
973
- back-test over this project's own history redded roughly one in three of the
974
- commits that had ever stamped one, and it would foreclose the direct-stamp path
975
- above by gating exactly the route the ruling there opens — which makes this
976
- refusal retrospectively correct rather than speculative. A gate that
977
- reds a third of the precedent it was derived from is measuring the rule, not the
978
- tree.
979
-
980
- Each bullet's two fields have named readers: the date feeds close's staleness
981
- judgment and becomes the stamped recurrence date, and the prose is the
982
- disposition body, the grounds the drain judges the recurrence from, the claim the
983
- drain re-verifies, and — via the capture-time advisory on stderr — the field the
984
- filer is asked to write the claim into. There is no third field, which is the point:
985
- §check-gap-inbox-neutrality keeps it that way.
986
-
987
- ## The survey record
988
-
989
- A stage that dispatches a survey — a census, a cohort sweep, a roster built by
990
- applying a criterion set to a corpus — buys a finding that lives in the
991
- dispatching session's context and dies with it. The next stage needing the same
992
- roster has no artifact to read, so it dispatches the same survey again. Neither
993
- session is undisciplined: each is correct in isolation, and the cost is
994
- structural. This surface is where the expensive half of a survey is carried
995
- across the stage boundary.
996
-
997
- **The decomposition that makes carrying safe.** A carried finding has a
998
- staleness problem a re-derivation does not: a census written at scope and read
999
- at build is correct only while the tree it censused holds still, and the stages
1000
- between them are exactly when that tree moves. Sizing that window per *kind* of
1001
- survey is not makeable — it depends on what the next stage does, which the
1002
- author cannot know. So it is answered mechanically per record instead. A survey
1003
- worth carrying ran an **oracle** (the oracle-first doctrine demands it), and
1004
- that splits it in two: a **cheap, re-runnable half** — the oracle's verdict —
1005
- and an **expensive, judgment half** — the reading laid over that verdict against
1006
- a criterion set. The re-derivation re-buys both; this surface carries the
1007
- expensive half and re-runs the cheap one.
1008
-
1009
- > **A carried survey is a citation with a falsifiable staleness witness, never a
1010
- > substitute for the oracle. The consuming stage re-runs the oracle and diffs the
1011
- > surveyed corpus since the recorded revision; if both hold, the recorded
1012
- > judgment stands and is cited rather than re-bought. If either moved, the stage
1013
- > dispatches only the delta.**
1014
-
1015
- A survey therefore stays true exactly as long as its witness holds, and the
1016
- witness is checkable in two commands.
1017
-
1018
- **The surface.** `.workflow/survey-record.md` (knob
1019
- `LIFECYCLE_KIT_SURVEY_RECORD_FILE`, §Layout and configuration) is a committed
1020
- per-iteration record, append-only within the iteration. Grammar: a `# contract:`
1021
- prose header, then one block per survey:
1022
-
1023
- ```
1024
- ## <YYYY-MM-DD> <stage> — <the one-line question this survey answered>
1025
- - corpus: <git pathspec the survey covered>
1026
- - oracle: <the command whose verdict grounds it, or the literal `none`>
1027
- - rev: <full commit sha the survey was taken at>
1028
- - finding: <the judgment, in prose>
1029
- ```
1030
-
1031
- Four fields, and each earns its place by being read at a named transition —
1032
- `corpus` and `rev` by the diff, `oracle` by the re-run, `finding` by the
1033
- consuming session. The heading is the discovery key and it states the
1034
- *question*, because a later stage searches by the question it is about to ask,
1035
- not by the corpus it has not yet chosen.
1036
-
1037
- **No field for "how long this stays true."** Deliberately absent: an author
1038
- cannot know it, and a field carrying a guess would be read as a warrant.
1039
- `corpus` + `rev` + `oracle` let the *reader* compute it, which is the whole
1040
- ruling above.
1041
-
1042
- **Append-only within the iteration, never edited in place.** A survey that
1043
- turned out wrong is superseded by a later block answering the same question, not
1044
- by a correction to the old one — the record is evidence of what was believed
1045
- when, and rewriting it destroys the only thing that makes a stale finding
1046
- diagnosable after the fact.
1047
-
1048
- **The witness — the re-use protocol.** A session about to buy a survey reads the
1049
- record first and, for any block whose heading answers its question, runs the
1050
- witness:
1051
-
1052
- 1. **Corpus still?** `git diff --quiet <rev>..HEAD -- <corpus>` — clean means no
1053
- commit since the survey touched anything it covered.
1054
- 2. **Oracle still?** Re-run `<oracle>` and compare its verdict to the one the
1055
- finding was written against.
1056
-
1057
- **The witness is four strings, and that is what makes a finding portable.** It is
1058
- not a property of the record file: the protocol's whole input is `corpus`,
1059
- `oracle`, `rev` and `finding`, each a short string, and both commands run from
1060
- HEAD. Copied onto another surface the witness is *more* durable than it is here,
1061
- because the copy is not truncated.
1062
-
1063
- Both hold → **cite the record; do not re-buy the survey.** Either moved →
1064
- **dispatch only the delta**, the dispatch prompt naming the record block and the
1065
- diff, so the child re-surveys what changed rather than the corpus. The
1066
- asymmetry is what makes this safe to ship: a false *stale* costs one
1067
- re-derivation — exactly today's cost, so the mechanism's worst case is the
1068
- status quo — while a false *fresh* would need a change touching neither the
1069
- corpus nor the oracle's verdict, in which case the finding is in fact still
1070
- true. The mechanism can only degrade *toward* the behavior it replaces.
1071
-
1072
- **The honest limit.** A survey whose grounds are *not* an oracle — a judgment
1073
- over prose, a reading of history — records `oracle: none`, and that block is a
1074
- **note, not a re-usable survey**: readable for orientation, re-derived before it
1075
- is relied on. Stating that costs one line per record and is the difference
1076
- between a mechanism and a false-assurance surface. An *empty* oracle is the
1077
- silent form of the same thing and is refused (§check-survey-record).
1078
-
1079
- *Ruled out: a timestamp freshness window.* "Trust a survey under N hours old" is
1080
- the per-kind taxonomy in disguise — wrong in both directions (a one-minute-old
1081
- survey is stale if the tree moved; a week-old one is fine if it did not) and it
1082
- buys nothing the two-command witness does not. *Ruled out: auto-invalidating
1083
- every block on any commit* — too coarse to leave the mechanism any use; the
1084
- `corpus` pathspec exists precisely to make invalidation proportionate.
1085
-
1086
- **The affordance.** `bin/file-survey.sh [--] "<question>" "<corpus>" "<oracle>"
1087
- "<finding>"` appends one block, seeding the contract header when the record does
1088
- not yet exist. It follows `bin/file-gap.sh` exactly: repo-root cd,
1089
- config-via-env, exit 2 on a missing or empty argument, and the free-text
1090
- argument-shape contract of gate-sdk/SPEC.md §The bin/-tool contract — whose
1091
- refusal here scans **every** positional, since four slots make arity no
1092
- protection at all. Advisory tooling, not a
1093
- gate — the raw append stays a legal fallback, the grammar being the surface's
1094
- contract rather than the writer.
1095
-
1096
- It **stamps `rev` and the date itself and derives `<stage>` from the cursor**
1097
- (`lifecycle_current_stage`), which is the load-bearing decision in the tool:
1098
- `rev` is the field the entire re-use protocol turns on and exactly the field an
1099
- author would get wrong — a short sha, the rev they *started* at, or none.
1100
- Machine-stamping it is how the mechanism avoids failing silently when someone
1101
- forgets, which is the failure shape that rules out author-supplied conventions
1102
- elsewhere in this kit. A tree with no `HEAD` commit cannot ground a witness, so
1103
- that is a refusal (exit 2) rather than a blank field; a tree with no cursor yet
1104
- stamps the never-named `—` the queue header already uses.
1105
-
1106
- It **deliberately does not** inherit `file-gap.sh`'s slug resolution. A survey's
1107
- prose routinely names queue slugs as its subject, and that resolver scans whole
1108
- prose, so it would stamp a recurrence declaration onto the survey's subject.
1109
- Adding no resolver here is a decision, not an omission.
1110
-
1111
- **A permanent surface carries the finding, never a pointer into here.** A surface
1112
- outside the boundary-truncated set — a queue entry, a SPEC section — must not
1113
- promise a reader retrievable content in this record: the boundary reset below
1114
- empties it, so the pointer resolves to nothing one iteration after it is written,
1115
- and the finding survives only in the evicting commit. It inlines the finding
1116
- together with the block's four witness fields instead, which is what keeps the
1117
- finding *re-usable* rather than merely readable. Naming this record as a
1118
- **subject** is unaffected — "the survey record is per-iteration scratch" promises
1119
- nobody a retrieval — and that distinction is exactly what
1120
- §check-scratch-citation's red condition is calibrated against.
1121
-
1122
- **Commit-pinning the citation is wrong by construction, not merely awkward**, and
1123
- it is the close a reader reaches for first. `bin/file-survey.sh` stamps `rev` as
1124
- HEAD *at filing time*, which precedes the commit that lands the block — so
1125
- `git show <rev>:<record>` reads a blob that does not contain the block being
1126
- cited, and it fails silently by printing a record without it. The sha a pin would
1127
- need is the *landing* commit, which no field carries and which is precisely the
1128
- class of value this section already rules an author gets wrong.
1129
-
1130
- **The affordance that makes inlining one command.** `bin/cite-survey.sh [--]
1131
- "<heading-substring>"` selects the one block whose `## ` heading contains the
1132
- substring and writes it to stdout as an inline-ready snippet — the heading and all
1133
- four fields. It refuses (exit 2) on no match, on an ambiguous match, and on a
1134
- record with no blocks, rather than guessing: the author asked for one finding, and
1135
- a silently-chosen sibling would be pasted onto a permanent surface as if it were
1136
- the one they read. It follows `bin/file-survey.sh` exactly — repo-root cd,
1137
- config-via-env, exit 2 on a missing or empty argument, and — per
1138
- gate-sdk/SPEC.md §The bin/-tool contract — the shape contract for its one
1139
- free-text positional. It is advisory tooling,
1140
- not a gate, the same disposition its sibling carries. It is a census find rather
1141
- than a firing on that last point: it carries `file-gap.sh`'s exact single-argument
1142
- shape and has simply not been run with a flag yet, and while it writes nothing,
1143
- its help behavior was the same misleading error.
1144
-
1145
- It deliberately does **not** rewrite the citing surface. The author chooses where
1146
- the finding belongs and how much of the `finding` prose to carry; a tool that
1147
- spliced would need a marker block, which would make a hand-written citation a
1148
- second-class form of the very thing this rule is trying to make ordinary.
1149
-
1150
- **How this differs from the gap inbox, which it sits beside.** The two are
1151
- sibling committed per-iteration surfaces with deliberately *opposite* semantics
1152
- on both axes, and a reader who meets them apart will assume symmetry and get
1153
- both wrong:
1154
-
1155
- - **Merge.** The gap inbox is `merge=union` — a gap filed on either side of a
1156
- concurrent merge must survive. The survey record is `merge=iteration-scoped`
1157
- (keep-ours): a survey from the other side describes a tree state this clone
1158
- never had, so surviving the merge is the hazard, not the save.
1159
- - **Boundary.** The gap inbox *refuses* the iteration boundary while it holds
1160
- bullets, because every gap owes a disposition. The survey record is
1161
- boundary-**truncated and never refuses**: a survey owes nobody a disposition,
1162
- being scratch whose whole lifetime was the iteration that just ended
1163
- (§bin/enter-stage.sh).
1164
-
1165
- That per-iteration lifetime is delivered by the boundary reset rather than by a
1166
- judgment — which is precisely the window the design needed sized. The record
1167
- resets as a **kit built-in member**, not through the consumer's
1168
- `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` array, by the same rule
1169
- `LIFECYCLE_KIT_LESSON_EVIDENCE_FILE` follows: a defaulted bash array is
1170
- *replaced* when a consumer assigns it, so shipping the record as a default
1171
- member would silently lose the reset in every consumer that sets the knob for
1172
- its own reasons.
1173
-
1174
- Two homes were ruled out, each on grounds that decide it alone. **The resume
1175
- journal** (delegation-kit/SPEC.md §Resume journal — agent writes, scratch reset
1176
- sweeps) is crash recovery for the
1177
- *writing* session, discoverable by its per-session name — a hand-off surface
1178
- must be discoverable by content, by a session that never knew the writer's name
1179
- — and it lives in untracked scratch with a second reclaimer, context-kit's
1180
- session-context hook, whose age guard is shorter than an iteration
1181
- (context-kit/SPEC.md §The session-context hook); a scope-stage journal can be
1182
- swept before the stage that would read it ever runs, silently and
1183
- time-dependently. **The gap inbox** has the right tier and the wrong semantics
1184
- on both axes above: routing surveys there would make the boundary refuse on
1185
- residue nobody owes a disposition for.
1186
-
1187
- **Producers and consumers.** Producer: any session that bought a survey, via
1188
- `bin/file-survey.sh` (the raw append the sanctioned fallback); the knob default
1189
- makes the channel live everywhere the kit is vendored, so the deployed
1190
- configuration that must be set is none. Consumer: the next stage session, at its
1191
- `bin/enter-stage.sh` entry — which prints the record's headings, the questions
1192
- and never the findings — and at the moment it is about to dispatch a survey,
1193
- where the witness applies. Each field's reader at its transition: `corpus` and
1194
- `rev` by the consuming session's `git diff` at the pre-dispatch check, `oracle`
1195
- by the same session at the same transition to re-run, `finding` by that session
1196
- only *after* the witness holds (which is why the entry report prints headings and
1197
- not findings), the `## ` heading by `bin/enter-stage.sh` at every stage entry and
1198
- by `check-survey-record` at commit time as the block delimiter. Third reader, at
1199
- the iteration boundary: the first-stage truncate, which reads the surface as a
1200
- whole and discards it.
1201
-
1202
- **Nothing is produced on the delegation side.** No journal contract moves, no
1203
- dispatch shape changes, no obligation lands on a dispatched child. The producer
1204
- is the *parent*, which is where delegation-kit's durable-before-you-act rule
1205
- already puts the write; this surface gives that existing obligation a home for
1206
- one shape of finding rather than adding an obligation. It is also **not** the
1207
- durable escalation artifact delegation-kit/SPEC.md §The delegation model
1208
- prescribes as a child's upward route: that one is mid-run, dispatcher-minted,
1209
- per-dispatch and written by the child, where this is a hand-off, single-path,
1210
- per-iteration and written by the parent after the child returns. Different
1211
- writer, reader, lifetime and discovery key — they must not be collapsed.
1212
-
1213
- **Open, and shared with the gap inbox:** who commits an append filed by a
1214
- session that is not the stage session. This surface inherits that question and
1215
- does not answer it; the exposure is smaller, since a survey lost to an
1216
- uncommitted append costs a re-derivation, which is today's cost.
1217
-
1218
- ## The close-surface roster
1219
-
1220
- Close reads a set of **inbound triage surfaces** — capture logs, harvest sinks,
1221
- the gap inbox, the queue's Lessons section. Enumerated only as prose, that set
1222
- has no closure: a surface close never reads leaves no trace anywhere, and a
1223
- sixth inbox added without being named costs nothing at the moment of the mistake
1224
- and everything afterwards. The roster replaces the enumeration with a
1225
- derivation, and gives each surface a mode so a skip is a *visible* judgment
1226
- rather than an invisible omission.
1227
-
1228
- **The declaration.** A surface declares itself in the section that already owns
1229
- it — one full-line directive, the same shape and altitude as canon-kit's `spec:`
1230
- and `contract:` directives (the derivation skips fenced blocks, so the grammar
1231
- is quotable where it is specified — `check-spec-pointer`'s carve-out, for the
1232
- same reason):
1233
-
1234
- ```
1235
- close-surface: <path> <mode> [reclaim=<command>]
1236
- ```
1237
-
1238
- - `<path>` — repo-relative, or a `<file>#<section>` locator when the surface is
1239
- a section of a larger file; the fragment is the heading in anchor form (spaces
1240
- as `-`), since `<path>` is the line's first whitespace-delimited token.
1241
- - `<mode>` — exactly one of:
1242
- - `forced=<owner-path> §<section>` — a structural forcing function exists and
1243
- the citation names it. The gap inbox's is the iteration-boundary entry
1244
- refusal; the Lessons section's is that refusal's sibling assertion.
1245
- - `advisory` — no forcing function. Close reads it by procedure, and a skip is
1246
- **sanctioned and visible** rather than undetected. An advisory surface is not
1247
- a lesser surface; it is one whose skip is a judgment someone may audit.
1248
- - `reclaim=<command>` — required when `<path>` is a capture-tier (gitignored)
1249
- member, naming the drain that empties it. It runs to end of line, so it is
1250
- written last. The runtime-artifact lifecycle rule already demands a paired
1251
- reclaim path for every write path; this is where that pairing becomes
1252
- machine-readable.
1253
-
1254
- Declaration lives with the owner, never in a central list: a central list is a
1255
- second source that drifts from the surface it names, and the one-owner rule puts
1256
- the fact where the surface is defined.
1257
-
1258
- A `forced=` declaration belongs on a **manifest surface**, and that is
1259
- load-bearing rather than incidental — it is what gives the citation its
1260
- resolver. `check-spec-pointer`'s prose-citation pass sweeps the manifest set for
1261
- a free-prose `<path>.md §<heading>` citation and resolves it in prefix mode; a
1262
- `forced=` citation *is* that shape, so it resolves today with no new code. The
1263
- restriction binds `forced=` only, not the directive as such: an `advisory`
1264
- declaration carries no citation and so needs no resolver, which is what lets a
1265
- consumer-owned capture surface declare itself in the binding that owns it
1266
- (a stage-skill binding is not a manifest surface). The honest limit follows from
1267
- the same seam — a `forced=` declaration authored outside the manifest set would
1268
- carry an unresolved citation, and no gate here catches that, because the
1269
- resolver is canon-kit's and lifecycle-kit does not depend on canon-kit.
1270
-
1271
- **The derivation** is the `close-surfaces` emit arm
1272
- (§The close-surfaces emit arm), never a maintained registry. Two
1273
- sources, unioned: every `close-surface:` declaration across the resolved kit
1274
- roots and the consumer's configured declaration surfaces; and every **gitignored
1275
- member of the workflow directory** — capture-tier by definition (gate-sdk/SPEC.md
1276
- §The workflow directory), therefore close-inbound by definition. The second
1277
- source is the closure that makes the roster fail loudly: a capture surface added
1278
- with no declaration appears as `(undeclared)` rather than not appearing at all.
1279
- The roster reports the hole instead of inheriting it, which is the whole
1280
- difference between a derived roster and a maintained one.
1281
-
1282
- **Ruled out: shrinking the roster by merging the two capture logs.** The obvious
1283
- way to make close's inbox count smaller is to merge the two friction capture logs
1284
- behind one file with a type column. It is ruled out, on this roster's own
1285
- evidence:
1286
-
1287
- - The logs are owned by **different kits**, and the dependency runs one way only
1288
- — the drift-kit KPI already reaches into guard-kit through the shared kit-root
1289
- resolution, so guard-kit cannot depend back without a cycle. A merged log has
1290
- no legal owner short of the base gate framework, which is not a friction sink.
1291
- - Their producers are not the same kind of act: one is a **harness hook
1292
- fallthrough** writing raw command text at the moment of a prompt, undated and
1293
- ungrammared; the other is a **deliberate structured capture**. A type column
1294
- would not unify them, it would document that they were never one stream.
1295
- - Their consumers are disjoint — allowlist-filtering and pattern-ranking on one
1296
- side, doc-owner remediation on the other. Every consumer would filter by type
1297
- first, re-deriving the two logs at read time, which is the tell that the merge
1298
- moves the split rather than removing it.
1299
- - Their reclaim moments are independent whole-file truncations. Sharing one file
1300
- makes each sweep's drain erase the other type's untriaged lines.
1301
-
1302
- The complaint the merge reached for is real — the two frictions compete for one
1303
- triage attention and were ranked against each other by nothing — and the roster
1304
- answers it directly: both appear on one derived roster, with modes, which is what
1305
- "ranked against each other" needs. Merging the files was the proxy, not the thing.
1306
-
1307
- ## Testing
1308
-
1309
- Every gate ships the ordinary `good/`+`bad/` fixture pair, and the scenarios one
1310
- pair cannot hold live in `gate-tests/*.test.sh` scenario runners. What departs
1311
- from the plain fixture-pair default, and what no single gate's subsection below
1312
- can own, is how those runners **reach** their gate.
1313
-
1314
- A runner that drives a gate names that gate, never a substrate: it resolves through
1315
- `gate_run <name> <checks-dir> <args>` (gate-sdk/SPEC.md §run-gate-tests), which
1316
- dispatches through `gate_command` exactly as the fixture harness does. A member
1317
- that ports to a compiled subcommand therefore leaves its scenario coverage
1318
- running unchanged — the property a path-named runner does not have, since the
1319
- `checks/<name>.sh` it holds stops existing in the motion that lands the
1320
- descriptor. For a case that differs by a knob rather than by argv, `gate_env
1321
- NAME=VALUE` sets that one case's environment in the caller's subshell;
1322
- `check-stage-evidence`'s session-boundary posture cases are the worked instance.
1323
-
1324
- Every gate-driving runner in this kit resolves through `gate_run` rather than a
1325
- held `checks/<name>.sh` path, and the payoff has now been collected **twice**:
1326
- `check-stage-entry`'s runner needed no edit when that gate ported, and
1327
- `check-close-surfaces`' sandbox-repo runner needed none when this one did —
1328
- each already named the gate. Two attestations rather than one exception, which
1329
- is the stronger claim this rule was written to earn.
1330
-
1331
- The rest exercise `bin/` tools, which are advisory tooling with no gate to
1332
- dispatch and so have nothing to say about reach.
1333
-
1334
- `gate-tests/gap-inbox-route.test.sh` is one of those, and it is named because it
1335
- closes a hole rather than adding coverage to a covered path: the
1336
- iteration-boundary gap-inbox check had **no fixture at all**, so both its refusal
1337
- and its recovery text were unpinned while being the thing an entering session
1338
- acts on. It drives `bin/enter-stage.sh` against a sandboxed queue, state file and
1339
- inbox — the harness `gate-tests/boundary-scratch-wipe.test.sh` established — and
1340
- pins the branch both ways: the close-skipped case refuses with the drain recovery
1341
- and writes nothing, the post-close case stamps and carries the bullets with its
1342
- advisory, the never-named and no-cursor edges take the post-close branch, and
1343
- `--simulate` reports each branch with its recovery relayed and writes nothing. No
1344
- fixture *pair* is owed: this is a `bin/` tool, not a gate.
1345
-
1346
- ## Per-component contracts
1347
-
1348
- ### lib/stages.sh
1349
-
1350
- The sourced config loader: consumer config first, defaults fill what it left
1351
- unset (an explicitly empty value disables a knob where the contract says so),
1352
- then validation. Also owns the shared state adapters
1353
- (`lifecycle_header`, `lifecycle_header_iter`, `lifecycle_current_stage`,
1354
- `lifecycle_stage_known`) — both gates must read the two axes identically, and
1355
- a shared adapter removes that drift axis.
1356
-
1357
- `lifecycle_current_stage <state-file>` is the **cursor derivation**: the last
1358
- data line's `<stage>` token, the read `bin/enter-stage.sh` already performed
1359
- inline, hoisted so every lifecycle reader shares one definition of "current
1360
- stage". It prints empty and returns *success* for both no-cursor shapes (§The
1361
- state machine) — an absent file and a file with no data line — because "no
1362
- cursor" is a legitimate state rather than a parse failure; its two callers
1363
- each rule on what it means for them (§check-stage-entry, §check-stage-evidence).
1364
- `lifecycle_header_iter` keeps stripping an optional trailing bracketed field:
1365
- that strip is now **residual-field healing**, letting a pre-upgrade header
1366
- still carrying `[stage:]` read as the bare iteration name. The cross-kit
1367
- readers deliberately do *not* call this helper — each derives the cursor
1368
- itself from a path it already configures, so no consumer kit gains a
1369
- lifecycle-kit dependency.
1370
-
1371
- `lifecycle_closing_stage_reached [<state-file>]` is the **closing-stage
1372
- predicate** built on that cursor: success when the cursor equals the last member
1373
- of `LIFECYCLE_KIT_STAGES`, failure otherwise — including for both no-cursor
1374
- shapes, since a cursor that does not exist has not reached anything. It is
1375
- hoisted rather than spelled at each site because its **two callers must agree by
1376
- construction**: `bin/file-gap.sh` reads it for the capture-time warning that
1377
- tells a filer which consequence they are buying, and `bin/enter-stage.sh` reads
1378
- it at the iteration-boundary gap-inbox check to choose between refusing and
1379
- admitting (§The committed gap inbox). A filer warned that "none is left to drain
1380
- it" is warned by the very test that later admits the bullet, rather than by a
1381
- lookalike that can drift from it. **No knob is minted and none is possible**: the
1382
- last configured stage is already `LIFECYCLE_KIT_STAGES`'s last member, so the
1383
- predicate is config-derived in every consumer with nothing left to configure. It
1384
- is a predicate over the cursor and must not acquire a third caller silently —
1385
- `lifecycle_current_stage` remains the general reader.
1386
-
1387
- The loader also owns `lifecycle_registration_block`,
1388
- which renders the resident registration block (§bin/install-lifecycle.sh) from the
1389
- live config so `bin/install-lifecycle.sh` and `check-lifecycle-registration`
1390
- derive one text and cannot drift. Three more renderers follow the same
1391
- writer/asserter shape for the merge-attribute surface: `lifecycle_supersede_set`
1392
- prints the derived iteration-scoped supersede set (the state file, the two
1393
- kit-owned built-ins — the lesson-evidence file and the survey record — and each
1394
- `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` member: exactly
1395
- what `bin/enter-stage.sh` truncates at the boundary); `lifecycle_union_set`
1396
- prints the derived union-merge set (the gap inbox — §The committed gap inbox);
1397
- and `lifecycle_merge_attrs_block` renders the supersede set as
1398
- `<path> merge=iteration-scoped` lines and the union set as `<path> merge=union`
1399
- lines, so `bin/install-lifecycle.sh` (writer) and `check-merge-attrs` (asserter)
1400
- read one set (§Multi-operator semantics). `lifecycle_supersede_set` has a **third
1401
- reader**, `check-scratch-citation`, which forbids a permanent surface pointing a
1402
- retriever at any of its members — so a consumer adding a
1403
- `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` member gets citation enforcement over it with no
1404
- second roster to keep in step. Values and adapters only, never
1405
- gate structure (gate-sdk's `lib/gate.sh` rule).
1406
-
1407
- ### bin/session-id.sh
1408
-
1409
- Prints the canonical stamp id so a stage skill reads it rather than guessing.
1410
- The id derives by a fixed source order, first hit wins, every source ending in
1411
- the same normalization — strip a leading `agent-` token if present, then take
1412
- the first 8 characters:
1413
-
1414
- 1. `LIFECYCLE_KIT_SESSION_ID` — a harness-neutral consumer override: a consumer
1415
- whose harness exposes a session identity by any means wires it here.
1416
- 2. `CLAUDE_CODE_SESSION_ID` — the shipped default source, harness-specific by
1417
- nature: this harness exports the current session's transcript uuid into every
1418
- Bash environment, identifying the session directly rather than inferring it
1419
- from file mtimes. Taken directly here only when `CLAUDE_CODE_CHILD_SESSION`
1420
- is unset; when the flag is set a lead-dispatched stage session
1421
- (§templates/lead.md) may see the *lead's* uuid here, so source 3 verifies
1422
- the flag before trusting it and can route back to this uuid.
1423
- 3. The newest transcript under the sessions dir (default
1424
- `<config-home>/projects/<cwd-slug>` — `$CLAUDE_CONFIG_DIR` or `~/.claude`,
1425
- and the cwd with every non-alphanumeric char mapped to `-`; override
1426
- `LIFECYCLE_KIT_SESSIONS_DIR`), the top-level glob widened with
1427
- `<dir>/*/subagents/*.jsonl` so a dispatched session with neither env var
1428
- still resolves without a per-dispatch override. Newest-file selection is the
1429
- documented single-operator assumption (one live session per project tree) —
1430
- and the widened glob makes it bite *within* one session too: a top-level
1431
- session that reaches this source (its Bash environment lacking the source-2
1432
- uuid) right after one of its subagents finishes picks that subagent's
1433
- transcript when it out-mtimes the session's own, so a lead deriving its own
1434
- id here (the session-role marker, §templates/lead.md) can name the wrong
1435
- session and misfire the suppression — a lead in that position verifies the
1436
- printed id against its own transcript before writing the marker. A
1437
- dispatched child (source 2 skipped, `CLAUDE_CODE_SESSION_ID` carrying the
1438
- lead's uuid) narrows this scan to `<dir>/<lead-uuid>/subagents/*.jsonl`
1439
- alone, excluding the lead's own top-level transcript — concurrently written,
1440
- and able to out-mtime the dispatched session's — from the candidate set. The
1441
- flag is verified, not trusted, because this harness sets it in top-level
1442
- sessions too: a non-empty narrowed scan is a genuine child (newest subagent
1443
- transcript wins); an empty scan with `<dir>/<lead-uuid>.jsonl` present marks
1444
- the flag spurious — a genuine child's transcript lives under `subagents/`
1445
- while it runs, so an empty scan plus a top-level transcript for the env uuid
1446
- means the uuid names a live top-level session, and the derivation falls back
1447
- to `CLAUDE_CODE_SESSION_ID` (source 2's answer). An empty scan with no such
1448
- top-level transcript exits 2 — only a wrong sessions dir or a broken layout
1449
- still reaches it. Two races are accepted: a genuine child stamping before
1450
- its transcript's first write would fall back to the lead's uuid (theoretical
1451
- — a child's transcript has its first writes by the time it can run a tool
1452
- call), and a spurious-flagged session that dispatched subagents earlier in
1453
- the same session stamps the newest subagent's id (a provenance smudge, not a
1454
- correctness break, unchanged from the prior trusting behavior). An absent dir
1455
- or transcript exits 2.
1456
-
1457
- Not a gate — a `bin/` helper invoked (now internally, by `enter-stage.sh`) for
1458
- the `<session-id>` field; the stage skills reach it through `enter-stage.sh`
1459
- rather than calling it directly.
1460
-
1461
- ### bin/enter-stage.sh
1462
-
1463
- The deterministic writer for a stage transition: `enter-stage.sh <stage>`
1464
- appends the invocation stamp, reading `session-id.sh` for
1465
- the id — never an argument, so the no-hand-picking rule rides into the tool.
1466
- It is the **sole production writer of `<head>`** (§The state machine), read as
1467
- `git rev-parse --short HEAD` in the state file's own work tree at the instant of
1468
- the append, and `none` where that yields nothing — so the field is produced by
1469
- the live path every stage template's first step already invokes rather than only
1470
- under test. It takes no enabling knob: the field is unconditional, which is what
1471
- refusing an optional spelling buys.
1472
- `<stage>` must be a configured stage; anything else is a usage error (exit 2).
1473
- Its positionals are membership-validated rather than free text, so it owes no
1474
- leading-`-` refusal (gate-sdk/SPEC.md §The bin/-tool contract) — but it owes the
1475
- help half, and `-h`/`--help` as the first argument prints usage on stdout and
1476
- exits 0. The measured cost of not owing it is in this tool's own history: a
1477
- session hunting for the rename mode below ran `--help`, got
1478
- `'--help' is not a lifecycle stage`, and worked around a contract for three
1479
- sessions that the usage text would have settled in one command.
1480
- An ordinary stage **writes the evidence file only** — the appended stamp *is*
1481
- the transition, since the last stamp is the cursor, so the queue file is not
1482
- touched and need not be committed. The first stage
1483
- (`LIFECYCLE_KIT_FIRST_STAGE`)
1484
- performs the iteration-boundary reset instead — truncating the state file and
1485
- every file in `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` back to its contract header and
1486
- restarting the header at the unnamed-iteration form. That header rewrite is
1487
- also where a residual pre-upgrade `[stage:]` field is dropped, so a consumer
1488
- that vendored the cursor extraction mid-iteration heals at its next boundary
1489
- without a migration step. `LIFECYCLE_KIT_BOUNDARY_TRUNCATE`
1490
- is a generic per-iteration reset knob — no consumer surface is named in
1491
- the kit; a downstream kit whose per-iteration file must start each cycle from
1492
- its contract header adds itself here, as evidence-kit's manifest does. The two
1493
- kit-owned surfaces — `LIFECYCLE_KIT_LESSON_EVIDENCE_FILE` and
1494
- `LIFECYCLE_KIT_SURVEY_RECORD_FILE` (§The survey record) — reset by the same rule
1495
- as **built-in members**: the kit owns those surfaces, so they do not ride the
1496
- consumer knob (git history keeps the retired stamps and the retired surveys).
1497
-
1498
- That written-surface set is also the **source of the stamp-commit purity
1499
- assertion's exemption** (§check-stage-evidence): the boundary reset is the one
1500
- legitimate reason a stamp commit touches anything besides the state file, so the
1501
- assertion reads the members this reset already resolves rather than a roster
1502
- minted to describe it — which is why widening the reset cannot leave the
1503
- assertion behind.
1504
-
1505
- **What counts as the header, for the truncate.** The retained run is the
1506
- member's leading blank and `#` **comment** lines, stopping at the first data
1507
- line *or* at a markdown `## ` section heading, whichever comes first. The second
1508
- half of that predicate is load-bearing rather than defensive: on a markdown
1509
- surface whose blocks *are* `## ` headings — the survey record — a bare
1510
- "keep every leading `#` line" rule reads the first block's heading as part of
1511
- the header and carries one stale survey across the boundary, with the record's
1512
- own read trigger then advertising it. The failure is silent, survives a green
1513
- battery, and is invisible to any fixture that does not run a real boundary
1514
- entry, which is why the boundary behavior is exercised end-to-end in
1515
- `gate-tests/` rather than reasoned about.
1516
-
1517
- The boundary reset additionally **wipes the scratch dir** (`GATE_SDK_TMP_DIR`),
1518
- deleting every member whose basename is neither `.gitkeep` nor a
1519
- `LIFECYCLE_KIT_BOUNDARY_PRESERVE` entry — at any depth the wipe reaches — and
1520
- naming the wiped set in its report the way it already names the truncated set.
1521
- Truncate and wipe share the boundary trigger and the report line and **nothing
1522
- else**: truncate rewrites a *tracked* file down to its `# contract:` header, so
1523
- the file survives with an empty body; the wipe *deletes* untracked scratch
1524
- members outright. `LIFECYCLE_KIT_BOUNDARY_PRESERVE` is therefore a keep-list for
1525
- the delete and never a
1526
- truncate target. The wipe runs last — after the truncate loop and after
1527
- enter-stage removes its own temp files — so those temporaries are never
1528
- candidates, and it is **boundary-only**: an ordinary stage entry appends and
1529
- touches no scratch. It is unconditional over the directory because scratch is
1530
- disposable *by definition*; a consumer's persistent measurement trends live
1531
- outside it by retention contract. A delete that fails because a preserved
1532
- basename sits inside an otherwise-doomed subdirectory is noise, never an abort.
1533
-
1534
- `.gitkeep` is a **kit invariant, not configuration** — the consumer cannot unset
1535
- it. The kit must not delete a file the consumer tracks: doing so removes a
1536
- tracked file at the boundary and dirties the tree at the very moment the
1537
- first-stage session commits the reset. The exemption is *not* about the directory
1538
- surviving (the tool `mkdir -p`s the scratch dir, and the wipe removes members,
1539
- not the dir); it is recorded with its real reason so a later reader does not
1540
- retire it as redundant, and it is generic-consumer mechanism rather than a fact
1541
- about any one checkout — a consumer that gitignores its scratch dir wholesale
1542
- never exercises it. Shipping the exemption as `LIFECYCLE_KIT_BOUNDARY_PRESERVE`'s
1543
- *default* is **ruled out**: a defaulted bash array is replaced, not merged, when a
1544
- consumer assigns it, so protection would decrease as configuration increases and
1545
- any consumer setting that knob for its own reasons would silently lose the
1546
- exemption. A
1547
- git-aware "spare any tracked file" rule is **ruled out** too — it makes
1548
- filesystem behavior git-dependent for one case, and it would spare any tracked
1549
- file parked in scratch, re-opening the accumulation the wipe exists to close.
1550
-
1551
- The scratch dir has a **second reclaimer, and the two do not overlap.**
1552
- context-kit's session-context hook sweeps the same directory at *every* session
1553
- start, age-guarded precisely so a concurrent same-checkout session's in-flight
1554
- scratch survives (context-kit/SPEC.md §The session-context hook). The boundary
1555
- wipe is deliberately **not** age-guarded: it fires once, at the iteration
1556
- transition, where the only scratch a consumer means to carry across is by
1557
- definition named in `LIFECYCLE_KIT_BOUNDARY_PRESERVE` — an age guard there would
1558
- leave the previous
1559
- iteration's fresh residue behind, which is the whole thing being reclaimed. Two
1560
- triggers, two postures, one directory; neither mechanism reads the other.
1561
-
1562
- The boundary entry also
1563
- **refuses outright when `## Lessons Learned` is non-empty** (exit 1, the
1564
- untriaged entries printed, nothing written — the same refusal contract as the
1565
- built-in pre-flight): an untriaged lesson must not cross into the next
1566
- iteration, so no `[attend]` injection (queue-kit §The queue-index arm) can
1567
- outlive the iteration that filed it. Its **gap-inbox check
1568
- (`LIFECYCLE_KIT_GAP_INBOX_FILE`) is one detector with two dispositions**
1569
- (§The committed gap inbox owns the design): it fires on any bullet, then reads
1570
- `lifecycle_closing_stage_reached` to choose. A **close-skipped** boundary
1571
- refuses on the same contract as the Lessons check, so a mid-iteration gap the
1572
- close skill did not drain cannot cross untriaged; a **post-close** one admits
1573
- the entry and prints the bullets as a stderr advisory naming them the entering
1574
- stage's intake, because no stage of the closing iteration is coming back for
1575
- them. An absent inbox has no bullets and passes either way.
1576
- **The survey record, its neighbour in the boundary reset, deliberately does
1577
- not refuse** (§The survey record): it is truncated like any built-in member, and
1578
- a non-empty one is never a blocker, because a survey owes nobody a disposition —
1579
- it is scratch whose whole lifetime was the iteration just ending. The two
1580
- surfaces sit one line apart in this tool with opposite semantics, so the
1581
- asymmetry is stated rather than left to be inferred. The entry additionally
1582
- carries the record's **read trigger**: when the record is non-empty the report
1583
- prints its `## ` headings — the questions the iteration's prior surveys answered,
1584
- never their findings, since printing a possibly-stale judgment ahead of its
1585
- witness is the failure the witness exists to prevent. It rides the tool every
1586
- stage already invokes as its first step, so it adds no invocation point and no
1587
- schedule, and it lands at the one moment a stage session is guaranteed to be
1588
- looking. The boundary entry additionally **refuses
1589
- when a `LIFECYCLE_KIT_BOUNDARY_REQUIRE` member lacks a disposition line for the
1590
- closing iteration** (exit 1, nothing written, the same refusal contract): each
1591
- member must carry a data line whose first token is the closing iteration's name,
1592
- so a consumer wiring its release-disposition evidence here makes the close-stage
1593
- disposition a mechanical boundary precondition rather than a decorative stamp.
1594
- The check is **value-agnostic by construction** — it tests the first token only
1595
- and never parses the value field — so a disposition grammar gaining a value (as
1596
- it did with `deferred:<version>`, §templates/stages/) needs no
1597
- widening here; recorded so a future value addition does not re-derive it.
1598
- Fail-closed: a member that does not exist on disk is a refusal naming the path. A
1599
- never-named (`—`) closing iteration has nothing to disposition and skips the
1600
- check. `--simulate` relays the would-be refusal the way it does for lessons. The
1601
- require-check runs after the Lessons refusal and before the boundary truncation,
1602
- so a member that is also a `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` file is verified by
1603
- the same boundary that then consumes it. **Pre-flight,
1604
- not enforcement:** before writing, it runs the built-in `check-stage-entry`
1605
- for the entered stage plus each `LIFECYCLE_KIT_ENTRY_PREFLIGHT` command whose
1606
- stage key matches, and refuses
1607
- (exit 1, findings printed, no writes) when any is red. The hand-off keeps the
1608
- same `<queue> <state>` argv it always had, but **the temp file swapped sides**:
1609
- because the cursor is the last stamp, the candidate transition now lives in a
1610
- temp *state* file under `${GATE_SDK_TMP_DIR}` carrying the not-yet-written
1611
- stamp, while the live queue passes through untouched (the boundary reset, which
1612
- does rewrite the header, passes a temp queue as well). The refusal is advisory
1613
- in the same sense the gate is at commit time (no `--force`, so the easy path is
1614
- the compliant one). `LIFECYCLE_KIT_ENTRY_PREFLIGHT` is a generic per-stage hook
1615
- — no consumer surface is named in the kit; a downstream kit whose gate is the
1616
- real precondition for a stage wires itself here (as evidence-kit's manifest gate
1617
- does for close entry), turning a would-be pre-commit deadlock into a loud
1618
- refusal at the entry. **Each entry's `<command>` is split on whitespace and
1619
- exec'd as argv with no interpreter word prepended**, so the configured path rides
1620
- its own exec bit: a consumer wiring a gate here configures the gate's *invocation*
1621
- and not its declaration file, and a configured path that stops being executable —
1622
- a member ported to a binary substrate leaving a data-file descriptor behind — is
1623
- a stage-entry breakage rather than a stale reference. **`--simulate <stage>` — the read-only preflight mode:**
1624
- it runs everything a real entry runs up to the write — config load and stage
1625
- validation, header parse, session-id derivation, the idempotence probe (a
1626
- would-be no-op is reported as such and exits 0), the candidate-stamp temp
1627
- state build, `check-stage-entry`, every matching `LIFECYCLE_KIT_ENTRY_PREFLIGHT`
1628
- entry, and — at an iteration boundary — the Lessons check, the gap-inbox check
1629
- and every `LIFECYCLE_KIT_BOUNDARY_REQUIRE` member, in the order a real entry runs
1630
- them; then it stops: no stamp, no boundary truncation, the temp files removed.
1631
- That roster is stated in full because a roster that stops short of the refusals
1632
- the code runs is read as a guarantee the mode does not give. Every output
1633
- line is prefixed `enter-stage (simulate):` so a transcript can never read as
1634
- a stamp. Exit 0 = the real entry would proceed (or no-op); exit 1 = it would
1635
- refuse, with the refusing check's output relayed line-by-line; exit 2 =
1636
- usage/config error, as a real entry.
1637
-
1638
- **Every refusal's recovery is relayed too, and that is the mode's contract
1639
- rather than a courtesy.** A refusal's `help:` line is its actionable half — the
1640
- real refusal's own design rests on that (§The committed gap inbox) — so each one
1641
- prints under `--simulate` as well, prefixed like every other simulate line. The
1642
- mode's designed consumer is the lead (§templates/lead.md), which gates an
1643
- expensive dispatch on it rather than hand-deriving prior-stage completeness;
1644
- relaying a verdict while withholding the one line that resolves it hands that
1645
- consumer the refusal and keeps the recovery, which is measured rather than
1646
- supposed — a lead reading a simulated boundary refusal escalated a question the
1647
- withheld line answers verbatim. The **gap-inbox check's post-close disposition
1648
- reports the branch it would take**: that the entry would proceed, naming how
1649
- many bullets it would carry into the entering stage's intake, since "would
1650
- refuse" and "would proceed carrying work" are different answers to the question
1651
- the lead is asking. Not a gate — exercised in `smoke/`
1652
- beside the existing enter-stage coverage (would-pass, would-refuse,
1653
- would-no-op, nothing written).
1654
-
1655
- **`--rename <name>` — the mechanized iteration rename.** Naming an iteration is
1656
- a **two-surface** write — the queue header's placeholder and column 1 of the
1657
- first stage's stamp — which `check-stage-evidence` requires to agree, so it rides
1658
- this writer rather than a second tool. `[--simulate] --rename <name>` sets the
1659
- header to `## Iteration: <name>` and rewrites column 1 of **every** data line in
1660
- the state file. Every line rather than only the last is correct by the boundary
1661
- invariant, not by convenience: the first-stage entry truncates the state file, so
1662
- every line below the separator belongs to the current iteration by construction —
1663
- which is exactly what `check-stage-evidence` asserts — and the whole-file rewrite
1664
- therefore also heals a half-landed hand-rename. **It is not stage motion**: no
1665
- stamp is appended and no stage token is written, so the cursor is untouched and
1666
- "stage motion never writes the queue" is unweakened. The precedent for this tool
1667
- writing the queue header at all is the boundary reset, which already does.
1668
-
1669
- Before writing, the mode asserts its **columns-2-to-last witness** — fields 2
1670
- through `NF` of every data line (stage, session id, date, head, and any field a
1671
- later grammar appends) identical before and after. It reads to the end of the
1672
- line rather than to a pinned column because a field riding *outside* the witness
1673
- could be dropped or corrupted by the rename with neither the tool nor its test
1674
- noticing, which is exactly what the four-field spelling did to `<head>` the
1675
- moment that field landed; an explicit column-5 check was refused because it
1676
- re-hardcodes the arity the gap came from. This
1677
- is the content predicate applied by the **writer**, where it is cheap and exact,
1678
- rather than by the `Write`/`Edit` guard: a `PreToolUse` hook sees only *proposed*
1679
- content, so proving "no stage token moved" there means reconstructing the
1680
- pre-edit file and diffing field-wise inside a hook — the same computation with
1681
- less information and no way to refuse cleanly. **Pre-flight, the same contract as
1682
- the stamp path:** the candidate header and candidate state file are built as
1683
- temporaries, `check-stage-evidence` runs against them, and a non-zero exit
1684
- refuses with the gate's output relayed and nothing written. That gate is
1685
- resolved through gate-sdk's `gate_command` rather than named by script path, so
1686
- the arm names a gate and never a substrate: the resolved argv is prefix-shaped,
1687
- so the two positionals ride it unchanged, and an argv the bridge refused to build
1688
- is exit 2 — the dispatcher's own verdict — never a rename pre-flighted by a check
1689
- that did not run. The built-in `check-stage-entry` pre-flight above resolves the
1690
- same way, so both arms of this tool name a gate and neither names a substrate.
1691
- **Refusals** (exit 2,
1692
- nothing written): `<name>` empty; `<name>` equal to the unnamed placeholder,
1693
- which only the boundary reset may write — checked ahead of the grammar that would
1694
- also reject it, so the message names the owning writer instead of reporting a
1695
- malformed name; and `<name>` outside the queue slug grammar `[a-z0-9][a-z0-9-]*`,
1696
- where whitespace is the corrupting case, since column 1 is whitespace-delimited
1697
- and a two-word name silently shifts every field of every stamp.
1698
- **Idempotent** in the stamp path's sense: a header and every column 1 already
1699
- reading `<name>` reports and exits 0 without writing. `--simulate --rename`
1700
- relays what would change, prefixed `enter-stage (simulate):`, and writes nothing.
1701
- The report names both written files and says to commit them together, which makes
1702
- the one-commit coupling a property of the writer instead of a line of prose in
1703
- the calling stage template.
1704
-
1705
- One reader is **invalidated** by a rename rather than served by it, and it is the
1706
- reason the placeholder refusal exists: `LIFECYCLE_KIT_BOUNDARY_REQUIRE`'s check
1707
- matches the closing iteration's name against the first token of a disposition
1708
- line and reds on finding *none*, so a rename landing after the close stage has
1709
- stamped its disposition reds the next boundary. Renaming an iteration that has
1710
- already been dispositioned is a rename to redo at the disposition surface too;
1711
- un-naming one is refused outright.
1712
-
1713
- **Ruled out: a separate `rename-iteration.sh` tool.** It would add a second
1714
- sanctioned writer of the state file, and one-writer is the property the
1715
- `Write`/`Edit` guard's own block message asserts and the whole reason that guard
1716
- exists. Advisory tooling like `--simulate`, so no fixture pair is owed; the
1717
- hermetic cases — both surfaces rewritten, fields 2-4 proved unchanged, the
1718
- half-landed heal, each refusal, the idempotent no-op, and `--simulate --rename`
1719
- writing nothing — live in `gate-tests/`, because a rename cannot be exercised
1720
- against a live checkout's own queue the way `smoke/` exercises the stamp path.
1721
-
1722
- **Idempotent:** if the
1723
- state file already ends with a stamp for the same `<iteration> <stage> <id>`,
1724
- it reports and exits 0 without appending, so a crashed-and-resumed session
1725
- re-runs its entry step safely. It reads the `lib/stages.sh` knobs
1726
- (`LIFECYCLE_KIT_QUEUE_FILE`, `LIFECYCLE_KIT_STATE_FILE`, `LIFECYCLE_KIT_STAGES`,
1727
- `LIFECYCLE_KIT_FIRST_STAGE`, `LIFECYCLE_KIT_BOUNDARY_TRUNCATE`,
1728
- `LIFECYCLE_KIT_BOUNDARY_PRESERVE`,
1729
- `LIFECYCLE_KIT_BOUNDARY_REQUIRE`, `LIFECYCLE_KIT_LESSON_EVIDENCE_FILE`,
1730
- `LIFECYCLE_KIT_SURVEY_RECORD_FILE`, and
1731
- `LIFECYCLE_KIT_ENTRY_PREFLIGHT`).
1732
-
1733
- **This tool depends on `gate-sdk/lib/gate.sh`, and the dependency is stated
1734
- rather than absorbed.** It is sourced at load — from `GATE_SDK_ROOT`, defaulting
1735
- to the sibling `../gate-sdk` — not inside the one arm that dispatches a gate,
1736
- because a missing library that surfaces halfway through a rename is worse than
1737
- one that surfaces before the tool does anything. The dependency is precedented
1738
- inside the kit, where every `checks/` member sources exactly that library, but it
1739
- is new in `bin/`: a tree that vendored lifecycle-kit without gate-sdk cannot run
1740
- the stamp writer at all. The alternative — a second
1741
- dispatch resolver written into `bin/` — is the duplicate the shared substrate
1742
- exists to remove, so the dependency is taken. Advisory tooling,
1743
- not a gate: no fixture pair is owed; it is exercised end-to-end in
1744
- `smoke/install.sh` — including the boundary require-check scenarios (a member
1745
- naming the closing iteration passes; a member missing the line, a member absent
1746
- from disk, and a never-named closing iteration each take their branch).
1747
-
1748
- ### bin/install-lifecycle.sh
1749
-
1750
- `bin/install-lifecycle.sh [agent-file]` writes the resident registration block
1751
- into the always-loaded agent file (`LIFECYCLE_KIT_AGENT_FILE`, default
1752
- `CLAUDE.md`; the positional override points a smoke or fixture at a scratch
1753
- tree without touching consumer config), idempotently. The block is bounded by
1754
- fixed marker lines (`<!-- lifecycle-kit:begin -->` … `<!-- lifecycle-kit:end -->`);
1755
- a run replaces the content between the markers when present and appends the
1756
- block when absent, so re-running never duplicates. A begin marker without its
1757
- end is a malformed target (exit 2, rather than guess the bounds); the agent
1758
- file must already exist — the installer edits an always-loaded file, it does
1759
- not mint one — so a missing target is exit 2. The marker insert/replace itself
1760
- is not the installer's code: it rides gate-sdk's shared `lib/inject.sh`
1761
- helper (`inject_marker_block`), the one copy `install-doctrine.sh` also uses,
1762
- so no second replace path exists to drift.
1763
-
1764
- The block is pointer-only, its roster derived: `lib/stages.sh`'s
1765
- `lifecycle_registration_block` renders the one line that the repo runs the
1766
- state machine on `LIFECYCLE_KIT_QUEUE_FILE`, the stage roster as skill
1767
- invocations (`/<stage>` for each `LIFECYCLE_KIT_STAGES` member), and the
1768
- markdown link to the kit SPEC — never stage prose, and never a hand-listed
1769
- roster, so a consumer's reshaped stage set flows into the block by
1770
- construction. The installer and `check-lifecycle-registration` share that one
1771
- renderer, so the emitted block and the block the gate certifies cannot
1772
- diverge.
1773
-
1774
- The same run performs two further steps for the multi-operator merge surface
1775
- (§Multi-operator semantics). **The merge-attribute step** injects a
1776
- marker-bounded block (`# lifecycle-kit:merge:begin` … `# lifecycle-kit:merge:end`,
1777
- `inject_marker_block` again) into `.gitattributes` (repo root) rendered from
1778
- `lifecycle_merge_attrs_block` — one `merge=iteration-scoped` line per supersede
1779
- member (keep-ours) and one `merge=union` line per union member (the gap inbox,
1780
- git-native) — so a reshaped supersede or union set flows into the attribute lines
1781
- by construction and `check-merge-attrs` certifies the same rendering. Unlike the agent file, the installer legitimately **mints
1782
- `.gitattributes` when absent** (it is not an always-loaded file the consumer
1783
- authored). **The driver-config step** registers the keep-ours driver — `git
1784
- config merge.iteration-scoped.driver true` — per-clone (the `install-hooks.sh`
1785
- opt-in class); a non-repo cwd degrades to a printed skip, never a hard failure,
1786
- leaving the `.gitattributes` attribute inert until a clone installs the driver.
1787
- The union attribute needs no such step — `merge=union` is git-native, so its
1788
- line is live the moment `.gitattributes` carries it.
1789
- Advisory tooling, not a gate: no fixture pair is owed; every step is exercised
1790
- end-to-end in `smoke/install.sh`.
1791
-
1792
- ### The close-surfaces emit arm
1793
-
1794
- Prints the derived close-surface roster (§The close-surface roster), one row per
1795
- surface, tab-separated `<path> <mode> <reclaim> <owner>`, sorted by path. A
1796
- field with nothing declared is `-`; an owner-less row is a capture surface source
1797
- 2 found with no declaration, whose mode reads `(undeclared)`. The mode is echoed
1798
- verbatim — a malformed one is passed through for `check-close-surfaces` to rule
1799
- on, so the derivation never silently repairs what the gate exists to catch. An
1800
- empty roster prints nothing and succeeds: a resolved-empty derivation is an
1801
- answer, never an error.
1802
-
1803
- A **non-gate arm** (gate-sdk/SPEC.md §The non-gate arm), invoked as
1804
- `bash gate-sdk/bin/run-gates.sh --emit close-surfaces [scan-root]` — the
1805
- front-end that resolves the arm's bridged knobs in front of it. Its two callers
1806
- are `check-close-surfaces`, which reaches the derivation **in process** rather
1807
- than spawning anything, and close's own inbound-triage sweep. Nothing stores the
1808
- roster and nothing must: its whole value is that it is recomputed at the moment
1809
- close reads it, so a capture surface added yesterday appears today.
1810
-
1811
- The declaration surfaces are the resolved kit roots' `LIFECYCLE_KIT_ROSTER_BASENAME`
1812
- files plus every `LIFECYCLE_KIT_CLOSE_SURFACE_GLOBS` match (gate-sdk's kit-root
1813
- resolution, consumer-first with kit shadowing — the order every kit registry
1814
- already uses); duplicates collapse. Follows the affordance contract, with the
1815
- `cd` a compiled arm cannot take becoming a **computed base**: the scan-root
1816
- argument, else the repo toplevel, with every path globbed, ignored and printed
1817
- relative to it. Config-via-env across the bridge; and the three exit-2 causes —
1818
- a non-repo base, an unreadable declaration surface, a `git check-ignore` that
1819
- could not decide — become the arm's error return, which the front-end and the
1820
- in-process caller both surface. Advisory tooling, no fixture pair owed — the
1821
- gate below is what blocks, and §The non-gate arm is the second, now-structural
1822
- ground for the same verdict: an arm returning a document has no pass and no
1823
- fail to fixture.
1824
-
1825
- The sort is by path, with the **whole row** as its tie-break, and that is
1826
- observable rather than incidental: one path may be declared on two surfaces, a
1827
- duplication the derivation deliberately does not collapse (it collapses
1828
- duplicate *surfaces*, not duplicate declarations). A path-only sort would leave
1829
- the tie order at the sorter's discretion and churn the gate's error order for no
1830
- edit.
1831
-
1832
- ### check-close-surfaces
1833
-
1834
- Three assertions, over the derived roster: (A) **no undeclared surface** — every
1835
- capture-tier workflow-dir member carries a declaration; (B) **every declaration
1836
- carries a mode**, and a `forced=` mode's citation is *well-formed* — a
1837
- repo-relative `<path>.md` followed by `§<section>`; (C) **every capture-tier
1838
- declaration names a reclaim command**.
1839
-
1840
- Assertion B is shape-only, and resolution is somebody else's job already:
1841
- `check-spec-pointer`'s prose pass resolves a `forced=` citation on any manifest
1842
- surface (§The close-surface roster). Taking the presence-and-shape half here is
1843
- not a preference — canon-kit's heading resolver is defined *inside its own gate*
1844
- rather than exported from a library, and the port to the binary substrate did not
1845
- change that: it is a private function of the compiled member, so there is still
1846
- no resolver a second gate could call. Reaching it would mean either copying
1847
- the resolver, which canon-kit's own tiering rule bans, or making lifecycle-kit
1848
- depend on canon-kit — the same ownership-cycle argument that rules out the log
1849
- merge. The honest arrangement is a pair of gates independently reading one
1850
- surface, each asserting what it owns.
1851
-
1852
- The gate reads the roster by **calling the derivation in process**
1853
- (§The close-surfaces emit arm),
1854
- so a roster it could not derive is fail-closed (exit
1855
- 2), as is an unreadable declaration surface. The in-process call is the point
1856
- rather than an optimization: it makes "the derivation and the gate can never
1857
- disagree" structural instead of conventional. It also means the descriptor
1858
- acquires a **source coupling** — the gate module and the emit module it reaches
1859
- transitively join `couples=` beside the surfaces already named, or the gate
1860
- stays registered, green, and never triggered on the edit that broke it.
1861
-
1862
- An optional scan-root argument (passed through to the derivation as its base) is
1863
- the fixture
1864
- capability: `git check-ignore` never reports a *tracked* path, and a fixture file
1865
- must be tracked to survive a clone, so a case dir cannot hold a capture-tier
1866
- member. The `good/`+`bad/` pair therefore covers assertion B on a consumer-set
1867
- `LIFECYCLE_KIT_CLOSE_SURFACE_GLOBS`, and the bespoke
1868
- `gate-tests/check-close-surfaces.test.sh` builds sandbox repos with a real
1869
- `.gitignore` for assertions A and C — the `check-exec-bit` precedent. Both move
1870
- with the member across a substrate change rather than being re-authored: the
1871
- pair is keyed by gate *name*, and the scenario runner dispatches by name through
1872
- `gate_run` (§Testing). Tier
1873
- `precommit`; the `# graph:` manifest couples the workflow dir, the
1874
- declaration surfaces and the two crate modules.
1875
-
1876
- The three assertions carry `assertion A:` / `assertion B:` / `assertion C:`
1877
- markers in the implementing member's own source, in whatever comment leader its
1878
- substrate spells. That is not decoration: `check-gate-assertions` set-matches
1879
- the enumeration above against those markers and reds on an **empty** set, so a
1880
- port that drops them leaves the gate looking unasserted.
1881
-
1882
- Calibration and honest limit: the gate asserts the roster is **complete and
1883
- moded**, never that close actually *read* a surface. Reading is a session act
1884
- with no mechanical residue short of a per-surface disposition stamp, which is the
1885
- heavier design this deliberately does not take: the marking converts an invisible
1886
- omission into a sanctioned one, and a stamp would convert it into a gated one at
1887
- the cost of a stamp-per-surface-per-iteration ritual. The lighter disposition
1888
- comes first because an advisory surface's skip is often correct, and gating a
1889
- correct action is the failure mode the gap-inbox refusal already demonstrated.
1890
- The un-gateable half rides the Enforcement-first carve-out's cadence — a class on
1891
- the consumer's close-stage audit roster (doctrine-kit/DOCTRINE.md
1892
- §Methodology-maintenance rules).
1893
-
1894
- ### check-lifecycle-registration
1895
-
1896
- Invariant: the configured agent file (`LIFECYCLE_KIT_AGENT_FILE`) carries a
1897
- lifecycle-kit marker block whose inner content byte-matches the block
1898
- regenerated from the live stage machine (`lifecycle_registration_block`). The
1899
- block is derived from the machine, and a reshaped machine — a renamed or
1900
- reordered stage, a relocated queue file — or a hand-edit stales it *by
1901
- construction*, on the exact path the kit advertises (reshape the config,
1902
- re-run the installer): the drift-prone-generated-surface case where a gate is
1903
- owed (the enforcement-first weighing). The freshness posture is
1904
- `check-doctrine-registration`'s, byte-strict like `check-docs-mirror-fresh`.
1905
-
1906
- A missing block is a finding with the install remedy; a block present but out
1907
- of lockstep is a finding printing the diff and the regenerate remedy (both
1908
- exit 1). The stale-block report prints **every** hunk: the format and the
1909
- uncapped contract are the crate renderer's, whose home is
1910
- gate-sdk/SPEC.md §The diff renderer since it stopped being this gate's private
1911
- mechanism, and this gate is its one live consumer. Resolution fails closed: a missing agent file, a begin marker without
1912
- its end, or an errored marker capture is exit 2 — a half-written or unreadable
1913
- target must not pass as clean. The gate satisfies the four gate-sdk contracts
1914
- (gate-sdk/SPEC.md §The gate model): the single `LIFECYCLE-REGISTRATION: clean`
1915
- line and a `help:` remedy on each finding path (output); exit 2 on an
1916
- unreadable target (fail-closed); a `good/`+`bad/` fixture pair under
1917
- `gate-tests/` (byte-lockstep-clean and stale-block) plus a sibling `*.test.sh`
1918
- for the block-absent, unpaired-marker, and agent-missing cases the one-pair
1919
- harness cannot hold (fixture-pair); and registration in this repo's
1920
- `gates.list` where its own always-loaded file is the scan target (self-lint).
1921
- Positional form `check-lifecycle-registration.sh [agent-file]` points the
1922
- fixtures at a synthetic agent file. Its `# graph:` manifest couples the agent
1923
- file and `lib/stages.sh` — the config that feeds the block — so an edit to
1924
- either re-fires the gate.
1925
-
1926
- ### check-stage-evidence
1927
-
1928
- Invariant: the evidence file's stamps are well-formed and every one of them
1929
- belongs to the header's iteration. Each stage skill appends a stamp as its
1930
- first step, and since the last stamp *is* the current stage, "the current
1931
- stage has a matching stamp" holds by construction — so the gate does not
1932
- assert it, because a tautology is not an invariant. What it asserts is the
1933
- **name-axis agreement** between the two surfaces, carried by the staleness
1934
- assertion: every data line's iteration must be the header's. That assertion is
1935
- what forces the first stage to rewrite its `—` bootstrap stamp once it names
1936
- the iteration, and it is the sole remaining enforcer of header↔stamp
1937
- agreement, not a bystander to it.
1938
-
1939
- The gate's one no-cursor ruling: a state file that exists but carries **no
1940
- stamp** is a red, with the same shape as the missing-file message. The
1941
- window is legitimate *inside* `enter-stage.sh`'s boundary reset, which stamps
1942
- in the same motion; by commit time an unstamped file means no stage was ever
1943
- invoked, which is precisely what this gate exists to reject — and with the
1944
- stage axis off the header, nothing else would have caught it (an empty file
1945
- gives the grammar and staleness passes nothing to reject).
1946
-
1947
- The stamp file is additionally kept provably bounded: every data line
1948
- must be grammatically well-formed — exactly five fields, stage ∈ the
1949
- configured stage set plus the waiver token (a stamp token but never a header
1950
- stage), date `YYYY-MM-DD`, and `<head>` either the literal `none` or a
1951
- lowercase hex abbreviation of 7 to 40 characters (§The state machine owns the
1952
- field); every data line's iteration must be the current
1953
- one, stale lines from a prior iteration are rejected; and the `—`
1954
- unnamed-iteration sentinel may appear only while the header itself is unnamed.
1955
- It also reads the `<session-id>` field (which it once ignored) for one
1956
- cross-stage invariant, active at the default `stage` posture of
1957
- `LIFECYCLE_KIT_SESSION_BOUNDARY` (§Layout and configuration): within the
1958
- current iteration, two *different* stages may not share one session id — a
1959
- stage entry is a context boundary and demands a fresh session, so a duplicate
1960
- (e.g. build == validate) is a self-reported skip and fails. The rule constrains
1961
- *cross-stage* sharing only: **same-stage re-entries are in-contract** — a
1962
- multi-session build, or a lead's N sibling batch sessions of one stage
1963
- (§The state machine), may share or rotate ids freely, a sanctioned pattern
1964
- rather than merely unpunished. This owner-doc statement is the home of the rule
1965
- the gate's own distinctness message echoes. Waiver-token stamps are exempt
1966
- (never a stage, so never in the map). At the
1967
- `iteration` posture the gate skips only this distinctness map; stamp grammar,
1968
- staleness, and sentinel scoping hold
1969
- identically, and a reused session id remains on the audit trail — it just
1970
- stops failing the gate.
1971
-
1972
- Calibration: the `—` sentinel is the bootstrap name for a new iteration
1973
- before the first stage names it. Any stage past the first carrying `—` in the
1974
- header is rejected (the unnamed-iteration guard, which reads the name axis from
1975
- the header and the stage axis from the cursor — it works only because the two
1976
- axes stay independently sourced); admitting `—` at every stage — an
1977
- attested bug — would let an unnamed iteration reach the final stage
1978
- undetected, so the allowance is stage-scoped, not global. The data section
1979
- begins after the first `---` separator; prose above it is not validated
1980
- line-by-line. Argument mode `$1 $2` (queue, state) with configured defaults
1981
- makes the gate fixture-capable; the sentinel-scoping interplay that exceeds
1982
- one good/bad pair is covered by `gate-tests/check-stage-evidence.test.sh`, which
1983
- is also where the two assertions below are exercised — each needs a real git
1984
- history, which no static fixture pair can carry.
1985
-
1986
- **The stamp-provenance assertion.** A stamp proves the stage skill was invoked;
1987
- this assertion is what makes it prove the invocation came **first**. For every
1988
- **newly introduced** stamp, inside a git work tree: **`<head>` must name
1989
- `HEAD`** — the recorded abbreviation, at least seven characters, must be a
1990
- prefix of the full `HEAD` sha, so a consumer's `core.abbrev` never enters the
1991
- contract.
1992
-
1993
- A stamp is **newly introduced** when no data line in `HEAD`'s version of the
1994
- state file carries the same `<session-id> <head>` pair. Identity is that pair
1995
- rather than the whole line because `bin/enter-stage.sh --rename` rewrites
1996
- column 1 of every data line and must not read as re-introducing all of them.
1997
- **The migration clause** applies that same reasoning to the one other bulk
1998
- rewrite this format has: a `HEAD`-version data line carrying only **four**
1999
- fields matches any working-tree line with the same `<session-id>`, so the
2000
- one-time five-field migration (§The state machine) is a rewrite and not an
2001
- introduction. Without it the migration commit — and every consumer's own
2002
- rewrite, which that section names as the recovery — would red against an
2003
- assertion no historical stamp can satisfy. The clause is self-retiring:
2004
- four-field lines cease to exist once migrated, and the boundary reset truncates
2005
- the file within one iteration.
2006
-
2007
- What it catches, without a history walk and without a per-stage surface roster:
2008
- a session that stamps first and commits the stamp *after* its work commits has
2009
- moved `HEAD` between the write and the commit, so the recorded head is stale and
2010
- the gate reds naming both commits. **Same-stage re-entry is in reach by shape
2011
- rather than by exemption** — a second session's stamp records its own `HEAD` and
2012
- is committed on it, and the assertion never compares two stamps to each other.
2013
-
2014
- **Four inertness conditions, all stated, because an unstated one reads as
2015
- coverage.** The assertion does not run when
2016
-
2017
- - **(a)** the state file's directory lies in no git work tree, or in a different
2018
- one from the configured surfaces — a vendored tree under test, a sandbox;
2019
- - **(b)** the file handed to the gate is not *this* work tree's own configured
2020
- state file — its repo-root-relative path is not `LIFECYCLE_KIT_STATE_FILE`.
2021
- "Inside a work tree" alone is not the discriminator the amendment behind this
2022
- section assumed it was: a `gate-tests/` fixture tree sits inside the repo like
2023
- everything else, and firing there would assert a recorded head against a repo
2024
- whose history the fixture's stamps were never taken in. That is also what
2025
- keeps this gate's argument mode fixture-capable at no cost to the assertion;
2026
- - **(c)** the state file is not tracked in `HEAD`, because there is then no
2027
- prior version to diff against and "newly introduced" is unanswerable rather
2028
- than false — a consumer's first state-file commit;
2029
- - **(d)** no stamp is newly introduced, which is every battery run that stamps
2030
- nothing.
2031
-
2032
- On the live file, `none` on a newly introduced stamp is a **red**, and that is
2033
- what keeps the inertness from being a disarm. The residual is `git rm --cached`
2034
- of the state file, which would restore condition (c): the same class as
2035
- `--no-verify`, and closed by neither.
2036
-
2037
- **The stamp-commit purity assertion.** The provenance assertion alone is
2038
- defeated by a session that writes the stamp and its work into **one** commit:
2039
- `HEAD` has not moved, so the recorded head is current. The complement closes it.
2040
- Where the state file is among the staged paths *and* introduces a stamp, the
2041
- staged path set must contain **only**:
2042
-
2043
- - the state file — for any stage's stamp; and additionally
2044
- - the queue file, `LIFECYCLE_KIT_LESSON_EVIDENCE_FILE`,
2045
- `LIFECYCLE_KIT_SURVEY_RECORD_FILE`, the members of
2046
- `LIFECYCLE_KIT_BOUNDARY_TRUNCATE`, and `LIFECYCLE_KIT_GAP_INBOX_FILE` — for
2047
- the **first stage**'s stamp only, because the iteration-boundary reset
2048
- legitimately writes all of them in one motion (§bin/enter-stage.sh).
2049
-
2050
- The exemption set is **derived from the configuration the boundary reset already
2051
- reads**, so no roster is minted and none can rot; no knob is added. Widening the
2052
- set can only remove violations and narrowing it can only add them, so a config
2053
- change here is safe to reason about by inspection in both directions. Gating on
2054
- the *staged* set rather than on the working tree is what keeps a sibling
2055
- session's staged file out of this verdict: a stamp nothing is committing is not
2056
- a stamp this commit introduces. It mechanizes a sentence every stage template
2057
- already carries — *commit the stamp on its own* — which is enforcement-first
2058
- applied to prose that had no gate behind it.
2059
-
2060
- **The concurrent-session false fire is real and its remedy is cheap.** Where a
2061
- repo shares its git index between sessions, a sibling committing between a
2062
- stamp's write and its commit moves `HEAD` and reds the stamp. The remedy is to
2063
- re-run `bin/enter-stage.sh`, which appends a fresh stamp at the current `HEAD` —
2064
- a same-stage re-entry, in-contract, and cheaper than any weakening that would
2065
- admit the case the assertion exists to catch. The tool's idempotence guard reads
2066
- the head for exactly this reason (§The state machine).
2067
-
2068
- Honest limit: the stamp proves the stage skill was *invoked*, never that it
2069
- produced its green result — a validate stamp says validate ran, not that the
2070
- suites passed. That gap is closed by evidence-kit, which commits a per-run
2071
- evidence manifest (a suite verdict per line) and, via the optional
2072
- `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` integration, couples a close entry to
2073
- the full green block.
2074
-
2075
- **The one ordering case neither assertion above reaches**, and it is structural
2076
- rather than a gap in their design: a session that does its work, commits it, and
2077
- only *then* runs `bin/enter-stage.sh`. The stamp legitimately records the
2078
- post-work `HEAD`, the stamp commit is pure, both assertions pass — and the work
2079
- still preceded the mark. The interval between stage X-1's stamp and stage X's
2080
- holds X-1's legitimate work and X's illegitimate pre-stamp work, and nothing in
2081
- the tree separates them. Only a *declared* boundary can, and there are two
2082
- candidates: a per-stage output-surface roster, refused because "a stage's own
2083
- output surfaces" is not derivable from the tree — a build stage's are
2084
- approximately everything — and a configured one false-fires when coarse and
2085
- misses when narrow; or an **exit mark**, which this kit does not have and which
2086
- no reading of an entry stamp can supply. Closing the remaining case is therefore
2087
- a **composition** with a deliverable that mints an exit mark, not more work
2088
- inside these assertions. Recording that is what stops the next reader
2089
- re-deriving the refused roster.
2090
-
2091
- What the assertions do close is the generalization that *every entry-time
2092
- assertion is satisfiable retroactively*, which fails for this one: the recorded
2093
- head is bound to a commit that already existed when the stamp was written, and a
2094
- stamp introduced later is checked against the `HEAD` of its own introduction, so
2095
- re-satisfying it means re-stamping — which is a fresh, honest stamp rather than
2096
- a forged one.
2097
-
2098
- **The uncommitted window, and what closes it.** This gate — and every other one
2099
- that would catch a hand-written stamp — fires at *commit*. The cursor, though, is
2100
- the working tree's last stamp, and every reader reads the working tree. So a
2101
- session that hand-edits the state file and simply never commits moves the stage
2102
- cursor for its entire life and is caught by nothing. Content-based detection
2103
- narrows this and does not close it: the `<head>` field makes a hand-written stamp
2104
- name the `HEAD` it claims to have been taken at, so it is not byte-identical to
2105
- `bin/enter-stage.sh`'s for free — but a hand that reads `git rev-parse --short
2106
- HEAD` writes an identical line, and a stamp that is never committed is never
2107
- checked at all.
2108
-
2109
- `templates/workflow-state-guard.sh` closes the part of that window an agent
2110
- tooling actually passes through. It is a `PreToolUse(Write|Edit)` hook (register
2111
- it on the alternation matcher; guard-kit's wiring template carries the block) that
2112
- refuses a write whose target **resolves** to the state file, naming
2113
- `bin/enter-stage.sh` as the sanctioned writer. Resolved, not textual: an absolute
2114
- path, a `./` prefix and a route through a symlinked directory are one file, and a
2115
- textual comparison catches only the spelling it was written against. It reads the
2116
- path through guard-kit's `guard_read_path` and rides `lib/guard.sh` on the
2117
- `GUARD_KIT_LIB` indirection, so lifecycle-kit ships the rule and guard-kit ships
2118
- the mechanism (guard-kit/SPEC.md §The guard framework). The
2119
- `GATE_SDK_WORKFLOW_DIR` indirection is honored, so a consumer who relocated the
2120
- workflow directory gets a guard that follows it. No knob is added: there is no
2121
- value to configure.
2122
-
2123
- The residual is stated because an unstated residual reads as a closed hole. The
2124
- guard reaches agent `Write`/`Edit` tool calls and nothing else — not a `Bash`
2125
- redirect, not `--no-verify` at the commit that would have caught the result, not a
2126
- human editing the file outside the agent tooling, and not any future writer that
2127
- is not one of those tool calls. It narrows the window to the writers the harness
2128
- routes through a hook; it does not close it. And it is inert until wired: shipping
2129
- the template without the settings block yields a file that enforces nothing while
2130
- looking like it does.
2131
-
2132
- ### check-stage-entry
2133
-
2134
- Invariant: the stage being *entered* re-verifies its prior stage's static
2135
- exit, extending the invocation-stamp floor `check-stage-evidence` provides
2136
- for the current stage one hop back (a shared surface, a distinct invariant:
2137
- *stamp grammar + name-axis agreement* there, *prior-stage invoked +
2138
- entered-stage static exit* here). It reads the entered stage from the **cursor**
2139
- — the state file's last stamp — and the iteration from the header, both through
2140
- the shared `lifecycle_current_stage`/`header_iter` derivations, which take
2141
- positional fields one to three. That is why the `<head>` field appended in
2142
- §The state machine moved nothing here, and it is recorded rather than left
2143
- unstated so the next grammar change knows this reader was checked and cleared
2144
- rather than overlooked. An empty
2145
- cursor is unreachable by construction here and stays a hard parse error rather
2146
- than a disarm: `enter-stage.sh` hands the gate a temp state file that always
2147
- carries the candidate stamp, and at commit time the entry commit stages that
2148
- same stamp. It owns three assertions, (A)
2149
- prerequisite-stamp ordering — for an entered stage X the file carries a
2150
- stamp for X's configured mandatory predecessor, which closes the "jumped
2151
- straight to the last stage with no prior stamp" hole its sibling — which no
2152
- longer asserts any stage coverage at all — cannot see; (B) drain-entry
2153
- queue-empty —
2154
- a drain-stage entry requires the configured active queue sections to carry
2155
- no top-level `- ` entry, catching entry-on-incomplete-build, with one modeled
2156
- residue class: an entry whose **lead line** carries `[drain-exempt: <reason>]`
2157
- (syntax: queue-kit/SPEC.md §The tag algebra) is skipped at drain-stage entry —
2158
- a drain-spanning feature whose remaining half *is* drain-stage work. The
2159
- reason must be non-empty (empty is malformed, red); it is echoed in the
2160
- refusal/clean detail, the audit trail its semantic reader. The **backstop**:
2161
- at entry to every drain *successor* — each stage whose
2162
- `LIFECYCLE_KIT_PREDECESSOR` value is the drain stage; the map is many-to-one,
2163
- so every match backstops and a tagged entry drains by whichever successor is
2164
- entered first — assertion B runs with **no** exemption: nothing may remain
2165
- active, tagged or not. So untagged entries drain by drain-stage entry, tagged
2166
- entries by successor entry. A roster whose drain stage is terminal (zero
2167
- successors) is refused fail-closed at config load (§lib/stages.sh's
2168
- validator): an exemption with no reachable backstop would be permanent.
2169
- Ruled-but-unpromoted work is never exempt residue — it files as Deferred
2170
- `[design-pending]` for a later scope's promotion (deferred-filing is the model
2171
- for designed-but-unscheduled work); and (C)
2172
- audit-trigger — an audit-entry-stage header carrying a cross-component
2173
- amendment signal but no `<iter> <audit-stage>` stamp demands either that
2174
- stamp or an explicit recorded waiver line, mechanizing the audit stage's
2175
- self-reported cross-component trigger so a missed trigger cannot silently
2176
- skip the audit. The signal reads the on-disk amendment tree (cwd-relative,
2177
- gate-sdk prune set applied, and `templates/` paths excluded — a shipped
2178
- `SPEC-amendment.md` skeleton is a copyable stub, not a live amendment, the
2179
- same exclusion canon-kit's finders apply): it fires when amendment files span
2180
- ≥2 component dirs, OR when a single amendment's component set — its own dir ∪
2181
- the contract-surface tokens in its body that resolve to a roster dir — is ≥2.
2182
- The
2183
- waiver rides the same file the stamps do (auditable) and is written only on
2184
- an explicit user ruling — never self-issued by the entering session; it
2185
- satisfies only assertion C (assertion A's predecessor scan matches the audit
2186
- stage exactly, so a waiver is never read as an audit *stamp*).
2187
-
2188
- Calibration: the predecessor map deliberately omits a **trigger-gated stage**
2189
- as anyone's mandatory predecessor — the audit stage, and equally a trigger-gated
2190
- *authoring* stage where a roster splits one out (§templates/stages/) — because
2191
- demanding its stamp before a successor would false-fire on an iteration that
2192
- legitimately skipped it (an amendment-free iteration runs no audit; a debt-only
2193
- one runs no authoring stage); the build→align re-check when align *did* run is
2194
- the build skill's step-0 procedural precondition, not this gate. A trigger-gated
2195
- authoring stage takes **no assertion-C sibling**, a mechanized trigger considered
2196
- and deferred: its trigger is procedural (the prior stage's next-stage
2197
- recommendation) and already backstopped by canon-kit's bidirectional
2198
- amendment-pairing rule — a feature entry carries a `[spec:]` ref only when the
2199
- amendment exists on disk, so a skipped authoring stage cannot ship a feature
2200
- without its amendment. The disanalogy with assertion C is decisive: C mechanizes
2201
- because the *audit* it gates is otherwise-unverifiable judgment, whereas an
2202
- authoring stage's *output* — the amendment — is otherwise-verified by that
2203
- bidirectional rule, so a process assertion there would only duplicate the
2204
- on-disk-amendment signal or smear canon-kit's feature-section grammar into this
2205
- gate. Assertion C's honest limit: it
2206
- approximates "changes ≥2 components' *contracts*" with "touches or names ≥2
2207
- component surfaces" — it can over-demand (the cheap waiver valve absorbs
2208
- that) and can under-detect a purely semantic cross-component impact; it
2209
- converts a silent skip into a stamp, a recorded waiver, or a narrow
2210
- false-negative, strictly better than self-report.
2211
-
2212
- **The gate dispatches to the binary substrate** — `checks/check-stage-entry.gate`
2213
- to `native/src/gates/stage_entry.rs`, the shell script deleted — and the port
2214
- asserts nothing new: the three assertions, their calibration and assertion C's
2215
- honest limit are exactly as stated above. The port was held on the config
2216
- bridge's want of a key channel, since the predecessor map is read **by key**
2217
- (gate-sdk/SPEC.md §lib/gate.sh, the keyed arm that retired the hold). Two
2218
- consequences are worth stating where a reader of this gate will look for them.
2219
- Its `couples=` **widens** to reach the amendment and roster corpora assertion C
2220
- scans, which is correct coupling rather than a concession: an amendment landing
2221
- anywhere genuinely changes what C sees, and the shell form's
2222
- `# reads-couples-exempt:` markers were excusing that rather than expressing it.
2223
- And its two whole-tree scans are declared to `--reads` as one root under two
2224
- **filter-knob** names, `LIFECYCLE_KIT_ROSTER_BASENAME` and
2225
- `LIFECYCLE_KIT_AMENDMENT_GLOB` — the channel gate-sdk/SPEC.md §check-reads-couples
2226
- grew for it, so the port **answers** that assertion where the shell member was
2227
- exempt from it. **Honest limit on the crate-side declaration:** neither fixture
2228
- case reaches assertion C, so the crate's declared-roots unit test holds over an
2229
- empty observation for this member and the scans' coverage rests on the
2230
- behavioral test below and on the live battery.
2231
-
2232
- The good/bad pair covers
2233
- assertion A; `gate-tests/check-stage-entry.test.sh` covers B and C over nine
2234
- sandbox scenarios (untagged residue red, tagged residue at drain entry green,
2235
- empty-reason tag red, tagged residue at successor entry red; two-dir
2236
- amendments ±waiver, a single-amendment cross-component body, a
2237
- single-component amendment, and a `templates/` stub that must not fabricate a
2238
- second component). Suite *runs* and other
2239
- non-static exits are not re-runnable as pre-commit gates and stay
2240
- human-judged at the stage approval; the prerequisite-stamp floor is their
2241
- mechanical residual.
2242
-
2243
- ### check-stage-skill-coverage
2244
-
2245
- Invariant: the configured stage set and the skills dir (`LIFECYCLE_KIT_SKILLS_DIR`,
2246
- default `.claude/commands`; override with the first argument) cover each other,
2247
- both directions. Forward: every `LIFECYCLE_KIT_STAGES` member has a `<stage>.md`
2248
- skill file — a stage with no skill cannot be entered. Reverse: every skill file
2249
- that invokes `enter-stage.sh` names a live stage in the token it passes. The
2250
- `enter-stage.sh` invocation is the mechanical marker separating a stage skill
2251
- from an ordinary one, so a retired stage's orphan skill (its `.md` still
2252
- invoking a now-unknown stage) reddens without false-flagging a non-stage skill
2253
- like `/agent-execution`, which never invokes `enter-stage.sh`. A skills dir that
2254
- does not exist is fail-closed (exit 2). The `# graph:` couples the skills dir at
2255
- `tier=precommit`; the whole-tree `run-gates.sh` battery backstops a stage-set
2256
- edit (`lifecycle-config.sh`), which is not itself in the coupled surface.
2257
-
2258
- ### check-skill-binding
2259
-
2260
- Invariant: every skill under `LIFECYCLE_KIT_SKILLS_DIR` (default `.claude/commands`;
2261
- override with the first argument) that carries a binding directive — `Execute
2262
- the template at <path>, applying the bindings below.` — (a) names a template
2263
- file that exists and (b) binds exactly that template's slot set: an unbound slot
2264
- is red, an orphan binding naming no slot is red. A skill with no directive is
2265
- not read, so a copy-and-specialize skill carrying no such line is untouched —
2266
- the same directive-as-selector mechanism `check-stage-skill-coverage` uses on
2267
- `enter-stage.sh`. A bound skill need not be a stage skill: `/agent-execution`
2268
- binds a delegation-kit template, which the gate accepts unchanged (the resolved
2269
- template path may point at any kit). Template slots are the `*<slot-name: …>*` opening
2270
- tokens; a shim's bindings are the `**slot-name** —` lead lines under
2271
- `## Bindings`; the directive's template path resolves relative to the current
2272
- directory (the tree root at pre-commit). A skills dir that does not exist is
2273
- fail-closed (exit 2). The `# graph:` couples the skills dir, the stage-template
2274
- dir, each boundary skill (`lead.md`, `release-sweep.md`, `upgrade.md`,
2275
- `consult.md`), and each out-of-tree bound template (e.g. `delegation-kit/templates/agent-execution.md`)
2276
- at `tier=precommit`, so a slot added to a template or a binding changed in a shim
2277
- fires the gate. The boundary skills are coupled **by name** because this couple
2278
- carries no kit-wide `templates/*.md` glob: a bindable template left off it is one
2279
- whose edits fire nothing, and the gate stays green while the coupling is gone.
2280
- `upgrade.md` is listed even where no consumer binds it — the entry is about the
2281
- template's edits re-triggering the gate, and a consumer that does bind it
2282
- inherits the manifest. The good/bad pair drives the unbound-slot case;
2283
- `gate-tests/check-skill-binding.test.sh` covers the orphan-binding,
2284
- missing-template, and skip (no-directive / no-slots) cases the one pair cannot.
2285
-
2286
- ### check-shim-restatement
2287
-
2288
- Invariant: no binding shim under `LIFECYCLE_KIT_SKILLS_DIR` shares a normalized word
2289
- n-gram of length ≥ `LIFECYCLE_KIT_SHIM_NGRAM` with any surface in the dedup corpus
2290
- `LIFECYCLE_KIT_SHIM_DEDUP_CORPUS` — the duplication tripwire under the same
2291
- directive-as-selector rule `check-skill-binding` uses (a file with no `Execute
2292
- the template …` directive is not a shim and is not read). The corpus defaults to
2293
- the consumer's always-loaded agent file (`LIFECYCLE_KIT_AGENT_FILE`, default
2294
- `CLAUDE.md`) plus every kit's `templates/**/*.md`
2295
- (kit set from `gate_kit_roots`); an explicit `LIFECYCLE_KIT_SHIM_DEDUP_CORPUS` or
2296
- positional corpus arguments override it — the latter is the hermetic-fixture
2297
- affordance. Comparison normalizes first — lowercase, punctuation stripped to a
2298
- word boundary, whitespace collapsed — so cosmetic rewording does not evade the
2299
- tripwire; a resolved corpus that yields no n-grams is fail-closed (exit 2), never
2300
- a false clean.
2301
-
2302
- `LIFECYCLE_KIT_SHIM_NGRAM` is calibrated to the smallest window with zero false
2303
- positives on the post-rewrite corpus, with a floor of 8 words so a citation line
2304
- (a path plus a §heading) never fires — this repo's default is 9, the width at
2305
- which the 8-word §heading `This repo is governed by its own kits` stops
2306
- tripping. Honest limit: the n-gram holds the *copy shape* only. Which tier a
2307
- fact belongs to stays semantic judgment — a paraphrase below N words passes the
2308
- gate and is still a defect to fix on sight (the same doctrine as
2309
- check-comment-tier's floor). The `# graph:` couples the skills dir, `CLAUDE.md`,
2310
- and the kit template dirs at `tier=precommit`, so editing a shim or a corpus
2311
- surface fires the gate. Because the corpus find recurses but the `kit:templates/*.md`
2312
- couple does not, the one kit template *sub*directory it misses —
2313
- `lifecycle-kit/templates/stages/*.md`, the stage-skill templates each stage shim
2314
- binds — is coupled explicitly beside it; a shim's own template is its likeliest
2315
- collision surface, so it must re-trigger the gate. The boundary skills need no
2316
- such entry: they sit at `templates/` root, already inside the plain couple. A red run names the
2317
- shim, the corpus surface, and the shared n-gram, so the fix (delete the
2318
- restatement, keep a citation) is mechanical. The good/bad pair drives the plain restatement/clean split;
2319
- `gate-tests/check-shim-restatement.test.sh` covers the no-directive skip, the
2320
- short-corpus fail-closed, and the below-N paraphrase the one pair cannot.
2321
-
2322
- ### check-lesson-disposition
2323
-
2324
- Invariant: every `## Lessons Learned` entry present at HEAD and absent from the
2325
- worktree leaves a well-formed disposition stamp in
2326
- `LIFECYCLE_KIT_LESSON_EVIDENCE_FILE` — a lesson cannot be cleared without a
2327
- recorded rule/task/harvest/discard call. The evidence home is a stamped file,
2328
- not the commit body, because the battery runs at pre-commit when no commit
2329
- message exists yet, so only a file is mechanically decidable (the
2330
- `check-stage-evidence` fail-closed precedent). Each data line is
2331
- ``<iteration> lesson <rule <file> | task <slug> | harvest <tag> | discard <reason>> — <lead-line prefix>``;
2332
- the `` — `` separates the disposition from the
2333
- lead-line prefix that joins it to the removed entry (a stored prefix matches a
2334
- removed entry when it is a leading substring of that entry's normalized lead
2335
- line). Both grammar (each line well-formed, a known disposition kind) and
2336
- per-entry matching (every removal has a stamp) hold; an unreadable evidence
2337
- surface is fail-closed (exit 2). Shape validation only: `harvest <tag>` is not
2338
- checked against `QUEUE_KIT_LESSON_TAGS` — that would cross-couple the kits'
2339
- configs; the close skill and `check-tag-lead-line` hold the vocabulary.
2340
-
2341
- Calibration: diffing HEAD against the worktree is fixture-hostile (a committed
2342
- fixture has HEAD == worktree, so the removal case has no static representation —
2343
- the `check-task-conservation` precedent), so the gate takes optional
2344
- `[queue-head] [queue-worktree] [evidence-file]` override args and its good/bad
2345
- pair drives all three hermetically (the `check-trajectory-fresh` synthetic-args
2346
- precedent); `gate-tests/check-lesson-disposition.test.sh` covers the malformed
2347
- grammar, still-present-not-removed, and prefix-join cases the one pair cannot.
2348
- The `# graph:` couples the queue file and the evidence file at
2349
- `tier=precommit`.
2350
-
2351
- ### check-merge-attrs
2352
-
2353
- Invariant, over two derived sets: bidirectional set-parity between the derived
2354
- iteration-scoped supersede set (`lifecycle_supersede_set`, §lib/stages.sh) and
2355
- the paths carrying `merge=iteration-scoped` in the consumer's `.gitattributes`
2356
- (default `.gitattributes`; override with the first argument), plus **forward-only**
2357
- parity between the derived union set (`lifecycle_union_set` — the gap inbox) and
2358
- the paths carrying `merge=union`. The iteration-scoped forward direction — a
2359
- supersede-set path with no `merge=iteration-scoped` line — catches an
2360
- unmechanized rule (a merge would silently take the wrong side on that surface).
2361
- Its reverse direction is the safety edge: a `merge=iteration-scoped` attribute on
2362
- a path *outside* the derived set silently discards merge content on a real
2363
- surface, so a smuggled line is red, not config. The gate scans every
2364
- `merge=iteration-scoped` line in the file — inside the installer's marker block
2365
- or not — so the reverse edge holds against a hand-added line anywhere. The union
2366
- set is **forward-only by design** — a union member with no `merge=union` line is
2367
- red (a filed gap would be silently dropped at a concurrent merge), but a
2368
- `merge=union` line *outside* the derived set is **not** flagged: `merge=union` is
2369
- a git-native driver a consumer's own tracked append log legitimately carries
2370
- (§Multi-operator semantics), so there is no smuggling to catch. A missing
2371
- `.gitattributes` reports every derived surface as unmechanized (exit 1, the
2372
- install remedy); an unreadable one, an empty supersede set (a lifecycle always
2373
- owns at least its state file and its two kit-owned built-ins, the
2374
- lesson-evidence file and the survey record), or an empty union set (it
2375
- always owns at least its gap inbox), is fail-closed (exit 2).
2376
-
2377
- The gate satisfies the four gate-sdk contracts (gate-sdk/SPEC.md §The gate model):
2378
- the single `MERGE-ATTRS: clean` line and a `help:` remedy on the finding path
2379
- (output); exit 2 on an unreadable target or an empty derived set (fail-closed); a
2380
- `good/`+`bad/` fixture pair under `gate-tests/` — the good case the default
2381
- state+lesson attribution plus the gap-inbox union line, the bad case a smuggled
2382
- reverse-edge line — plus `gate-tests/check-merge-attrs.test.sh` for the
2383
- iteration-scoped forward-missing and missing-file findings, the union
2384
- forward-missing finding, the union no-reverse-edge case (a `merge=union` line
2385
- outside the derived set stays clean), and a real two-branch merge in a sandbox
2386
- repo that asserts the keep-ours driver resolves an attributed surface to the
2387
- arriving side (fixture-pair); and
2388
- registration in this repo's `gates.list` where its own `.gitattributes` is the
2389
- scan target (self-lint). Its `# graph:` couples `.gitattributes` and
2390
- `lib/stages.sh` (the config the supersede set derives from) at `tier=precommit`;
2391
- a reshaped `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` in the consumer config is backstopped
2392
- by the whole-tree `run-gates.sh` battery (the `check-stage-skill-coverage`
2393
- precedent).
2394
-
2395
- ### check-survey-record
2396
-
2397
- Invariant: every block in the survey record (§The survey record) carries a whole
2398
- witness. Over each `## ` block: all four keys present, in order, one per line
2399
- (and no fifth key, no stray line); `corpus` non-empty; `oracle` non-empty, where
2400
- the literal `none` is legal and is the honest form and an *empty* value is the
2401
- silent form and is refused; and `rev` a full 40-hex sha naming a commit that
2402
- exists — the assertion that catches the short-sha and wrong-rev cases, and the
2403
- reason the field is machine-stamped rather than author-supplied.
2404
-
2405
- An absent record, and a record truncated to its header, are **clean and counted
2406
- inert**: the surface is optional, and a consumer that never files a survey must
2407
- not carry a red gate.
2408
-
2409
- Enforcement-first is why the gate ships in the same unit as the surface rather
2410
- than as follow-up debt: a block missing its witness is *silently unusable*,
2411
- which is the exact failure class the surface exists to close.
2412
-
2413
- **Bare drives the configured record with the full assertion set; an explicit
2414
- file argument drives it hermetically — grammar only, with no rev-existence
2415
- probe.** That split is forced by portability rather than convenience: a fixture's
2416
- `rev` names no commit in the tree the fixture is copied into, so a pair asserting
2417
- existence would go red in every consumer that vendored the kit. Bare also
2418
- degrades to grammar-only outside a git repository, where there is nothing to
2419
- resolve a sha against. The clean line names which mode ran, so a grammar-only
2420
- pass can never be read as a verified one.
2421
-
2422
- The gate satisfies the four gate-sdk contracts (gate-sdk/SPEC.md §The gate
2423
- model): the single `SURVEY-RECORD: clean` line and a `help:` remedy naming the
2424
- grammar and `bin/file-survey.sh` on the finding path (output); exit 2 on an
2425
- unreadable or explicitly-named-but-missing record and on a failed parse
2426
- (fail-closed); a `good/`+`bad/` fixture pair under `gate-tests/` driven through
2427
- the hermetic argument — the good case a two-block record including an
2428
- `oracle: none` note, the bad case a short sha, an empty oracle and a block with
2429
- its `oracle` line missing — plus `gate-tests/check-survey-record.test.sh` for the
2430
- half the pair cannot hold: both arms of the rev-existence probe in a sandbox
2431
- repo (a rev naming a real commit, and a well-formed 40-hex rev naming nothing)
2432
- and the two inert shapes (fixture-pair); and registration in this repo's
2433
- `gates.list`, where its scan target is this repo's own record (self-lint). Its
2434
- `# graph:` couples the record at `tier=precommit`.
2435
-
2436
- *Not gated, and stated so the gate is not mistaken for more than it is:* whether
2437
- a `finding` is **true**, and whether a session holding a fresh record actually
2438
- read it. The first is unmechanizable; the second leaves no tracked artifact —
2439
- the class delegation-kit/SPEC.md §Operative residency rules no gate is owed for.
2440
- The entry report's read trigger (§bin/enter-stage.sh) is the affordance in place
2441
- of an oracle there, and it is weaker than one by construction.
2442
-
2443
- ### check-scratch-citation
2444
-
2445
- Invariant: no surface in `LIFECYCLE_KIT_PERMANENT_SURFACE_GLOBS` carries a
2446
- **retrieval pointer** to a path in the derived boundary-truncated set. The rule
2447
- and why inlining is the right close are §The survey record's; this section owns
2448
- the red condition.
2449
-
2450
- **The forbidden-target set is derived, never maintained** — it is
2451
- `lifecycle_supersede_set` (§lib/stages.sh), already the single derivation behind
2452
- the installer's `.gitattributes` block and `check-merge-attrs`'s parity check.
2453
- This gate is its third reader, which is why a consumer widening its truncate
2454
- configuration gets citation enforcement for free.
2455
-
2456
- **Retrieval-pointer position, stated as the red condition.** A supersede-set path
2457
- that is either **(a)** in markdown link-target position — the parenthesized half
2458
- of a `[text]`-plus-parentheses pair — or **(b)** preceded
2459
- by a colon and whitespace and followed by nothing but a closing quote, comma,
2460
- period, bracket or end of paragraph — the attested form, *"Full finding and its
2461
- two-command witness"* followed by the path. A bare path elsewhere in prose is a
2462
- **mention** and is clean; that is the whole calibration, and it is why this is
2463
- specified as a position rather than as a pattern.
2464
-
2465
- **The scan joins a paragraph's wrapped continuation lines before testing (b), or
2466
- it is blind on its own worked example.** A queue file wraps prose to a budget, so
2467
- a colon and the path it introduces routinely land on different physical lines —
2468
- which is exactly what the attested instance did. The join is
2469
- `check-spec-pointer`'s prose-extraction shape (canon-kit/SPEC.md
2470
- §check-spec-pointer), adopted rather
2471
- than re-decided: concatenate a blank-line-delimited paragraph, match over the
2472
- join, and map a hit back to its physical line through per-line start offsets. A
2473
- scanner that is right on an unwrapped fixture and silently blind on the wrapped
2474
- case it was written for is the failure this forecloses, which is why the `bad/`
2475
- case carries a wrapped instance beside the single-line and markdown-link forms.
2476
-
2477
- **Per-line escape hatch:** a `scratch-citation-exempt:` tag on the line above the
2478
- hit, this repo's established opt-out shape, for a surface that must quote a dead
2479
- citation verbatim in order to describe it. Its reader is this gate's scanner, at
2480
- the transition where it has matched a pointer and is deciding whether to record a
2481
- finding. *Stated so it is not mistaken for more than it is:* the class is real and
2482
- permanent — any entry documenting a citation defect must quote one — but the tree
2483
- carries no live user today, because the entry that motivated the tag completed and
2484
- its prose left the queue with it. The `bad/`+`good/` fixture pair is where the
2485
- hatch is exercised.
2486
-
2487
- The gate satisfies the four gate-sdk contracts: the single
2488
- `SCRATCH-CITATION: clean` line naming how many surfaces were scanned, and a
2489
- `help:` remedy naming `bin/cite-survey.sh` and the exempt tag on the finding path
2490
- (output); exit 2 on an empty derived target set and on a failed parse
2491
- (fail-closed); a `good/`+`bad/` pair whose good case copies the mention forms live
2492
- entries actually use — a path opening a wrapped line after a full stop, a
2493
- prepositional mention, a colon-introduced pointer at a **non**-member path, and a
2494
- tagged dead citation — because a rule that reds any of those is wrong and the
2495
- fixture is what says so (fixture-pair); and registration in this repo's
2496
- `gates.list`, where its surfaces are this repo's own queue and spec set
2497
- (self-lint).
2498
-
2499
- *Not gated:* whether an inlined finding is faithful to the block it came from.
2500
- Nothing tracked relates the two once the record is truncated, and inventing a
2501
- provenance field would re-open the per-iteration lifetime the record's design
2502
- turns on.
2503
-
2504
- ### check-gap-inbox-neutrality
2505
-
2506
- Invariant: the gap inbox (§The committed gap inbox) records observations, not
2507
- conclusions. Two assertions over every non-blank line below the `# contract:`
2508
- header:
2509
-
2510
- - **A — grammar.** Every line is `- <YYYY-MM-DD> — <prose>` with non-empty
2511
- prose. Nothing gated this before, even though the raw append is an explicitly
2512
- legal fallback, so a malformed bullet was found by the drain reading it an
2513
- iteration later.
2514
- - **B — no interposed verdict.** No bullet's prose opens with the retired
2515
- ``recurrence of `<slug>`:`` form. This is the class assertion, and its value is
2516
- that it catches a conclusion reaching the capture surface **by any producer** —
2517
- a stale vendored affordance, a hand append copying an older bullet's shape —
2518
- rather than only the affordance this kit ships. The `help:` line teaches the
2519
- rule rather than the regex: say *why* you believe the bullet re-files an entry,
2520
- in the prose, and let the drain judge.
2521
-
2522
- An absent inbox is **clean, not fail-closed** — never having filed a gap is a
2523
- legal state for a fresh consumer, unlike §check-lifecycle-registration's missing
2524
- agent file, which is an install that did not finish. Fail-closed applies to the
2525
- scanner's own exit status, per gate-sdk's contract.
2526
-
2527
- **Bare drives the configured inbox; an explicit file argument drives it
2528
- hermetically**, the §check-survey-record precedent, which is what lets the
2529
- fixture pair run against a copied inbox.
2530
-
2531
- **Why the tool-side contract is pinned separately.** This gate reads the surface
2532
- and cannot see which producer wrote a line, so it cannot hold the affordance to
2533
- its own contract. `gate-tests/file-gap-recurrence.test.sh` is what does that. The
2534
- two together are the enforcement: the fixture-runner catches the producer
2535
- regressing, the gate catches a verdict arriving by any other route.
2536
-
2537
- The gate satisfies the four gate-sdk contracts (gate-sdk/SPEC.md §The gate
2538
- model): the single `GAP-INBOX-NEUTRALITY: clean` line and a `help:` remedy on the
2539
- finding path (output); exit 2 on an unreadable or explicitly-named-but-missing
2540
- inbox and on a failed parse (fail-closed); a `good/`+`bad/` fixture pair under
2541
- `gate-tests/` driven through the hermetic argument — the good case a record whose
2542
- prose both re-files and disclaims an entry in words, the bad case a retired
2543
- marker beside two broken bullets (fixture-pair); and registration in this repo's
2544
- `gates.list`, where its scan target is this repo's own inbox (self-lint). Its
2545
- `# graph:` couples the inbox at `tier=precommit`.
2546
-
2547
- *Not gated, and stated so the gate is not mistaken for more than it is:* whether
2548
- a bullet's prose states the recurrence claim **at all**, and whether the claim is
2549
- **right**. Assertion B removes the one shape that pre-empts the judge; it cannot
2550
- compel a filer to answer the advisory, and the judgment itself is the drain's
2551
- (§templates/stages/), which is where the amendment deliberately put it.
2552
-
2553
- ### templates/stages/
2554
-
2555
- The stage-skill templates (`scope`/`align`/`build`/`validate`/`close`) carry
2556
- the generic stage spine — the stamp first step (performed by invoking
2557
- `enter-stage.sh <stage>` and stating in one line what it does), each stage's
2558
- trigger/ordering rules, and its stage-local doctrine — with **named slots**
2559
- where the consumer's rule content goes. The templates are the owned surface:
2560
- this section states the contract a consumer skill must satisfy and never
2561
- restates what a template carries.
2562
-
2563
- Alongside the default-roster templates the kit ships **`spec.md`**, an optional
2564
- **amendment-authoring** stage template — the generative half of design, split
2565
- out from `scope` on a roster that carries a dedicated authoring stage (the
2566
- ontology: scope bounds the units, the authoring stage authors the amendments,
2567
- the audit stage independently verifies them). It is a full stage (it invokes
2568
- `enter-stage.sh` and stamps), **trigger-gated exactly like the audit stage**: it
2569
- runs only when an iteration promotes a feature to author, it **appends** rather
2570
- than resets (only the first stage resets the evidence file), and it takes `scope`
2571
- as its predecessor without being named any stage's mandatory predecessor
2572
- (§check-stage-entry's trigger-gated-stage calibration). The kit **default roster
2573
- does not bind it** — the split is demand-gated and non-breaking; a consumer
2574
- activates it through `LIFECYCLE_KIT_STAGES` / `LIFECYCLE_KIT_PREDECESSOR`
2575
- (§Layout and configuration). This is the supported roster shape for a
2576
- trigger-gated authoring stage, the same class as the trigger-gated audit stage.
2577
- The generic authoring how-to `spec.md` single-sources — causal completeness and
2578
- canon-kit's bidirectional queue pairing — is the content `scope`'s conditional
2579
- authoring step points at, so a default-roster `scope` that still authors reads it
2580
- there.
2581
-
2582
- The directory holds the **stage-class** template set, not any one consumer's
2583
- roster: it ships six templates while `LIFECYCLE_KIT_STAGES` defaults to five,
2584
- because `spec.md` serves the split-authoring roster alone. Nothing derives a
2585
- roster from this listing — the glob buys a legible layout, not a derivation.
2586
-
2587
- A consumer skill adopts a template in one of two modes; either way the executed
2588
- skill states in one line what the stamp step does and supplies every
2589
- slot's content:
2590
-
2591
- - **Consume-by-reference (the default)** — the consumer skill is a thin
2592
- **binding shim** whose body is a single directive line, `Execute the template
2593
- at <repo-relative path>, applying the bindings below.`, followed by a
2594
- `## Bindings` section with exactly one entry per template slot. The template
2595
- stays the executed surface; the shim carries only consumer content, so generic
2596
- doctrine has one owner and never drifts across a copy. This is the documented
2597
- default because it tracks the kit: a re-vendor reaches the template, and
2598
- `check-skill-binding` + `check-shim-restatement` hold the shim to a thin
2599
- reference. This repo dogfoods it (`.claude/commands/*.md`).
2600
- - **Copy-and-specialize (the sanctioned fork)** — the template is copied into
2601
- the consumer's skills dir and each slot overwritten in place; self-contained
2602
- and legible, structure copied not imported, so the skill stands alone
2603
- (gate-sdk's check-skeleton shape). It is a fork with its consequence owned:
2604
- you own the ritual prose, an upgrade's re-vendor does not reach it, and the
2605
- shim gates do not cover it. It is kept deliberately — the blessed escape hatch
2606
- that keeps legitimate structural divergence (different stages, a reshaped
2607
- machine) visible and contained, and the harness-agnostic floor the
2608
- upgrade smoke assumes; removing it would drive forks into edits of the
2609
- vendored template, which break Phase-A upgrade determinism with no gate to
2610
- catch them.
2611
-
2612
- A consumer reaching for the fork to express *prose* divergence rather than
2613
- structural divergence signals the slot vocabulary is too thin; the fix is
2614
- richer slots pulling those cases back under shim protection, not more copying.
2615
- No gate or telemetry watches for it — which mode a consumer picks is their tree,
2616
- not this one.
2617
-
2618
- **Named slots (template grammar).** Each consumer placeholder is a named slot
2619
- `*<slot-name: guidance>*` — `slot-name` matches `[a-z][a-z0-9-]*`, is unique
2620
- within its template, and precedes the `:` and the guidance a copy-editor or
2621
- shim author replaces. A copy-and-specialize consumer overwrites the whole
2622
- `*<…>*` span; a shim binds the slot by name in a `## Bindings` entry
2623
- `**slot-name** — <consumer content>` (multi-line content indents under its lead
2624
- line), and carries nothing else — doctrine restated from the template in a shim
2625
- is the defect the reference mode removes. `check-skill-binding` holds the
2626
- shim↔template slot parity.
2627
-
2628
- **Authoring rule (a binding shim binds residue, cites procedure, restates
2629
- nothing).** A binding a slot supplies carries only what is local to this
2630
- consumer — the residue: which surfaces to sweep, which config knobs, which log
2631
- sinks. Procedure and always-loaded fact that a kit template or the consumer's
2632
- `CLAUDE.md` already owns are named by a citation (a path plus a §heading), never
2633
- copied into the shim: a shim is loaded on every stage invocation, so a
2634
- restatement there is a per-session token tax on a fact with an owner, and it
2635
- drifts the moment the owner changes. `check-shim-restatement` is the tripwire
2636
- for the copy shape; the tier judgment (residue vs owned fact) stays the author's.
2637
-
2638
- The `close` template carries a **release-disposition step**: every close
2639
- dispositions the iteration at the release boundary — reading the consumer's
2640
- `release-policy` slot and either executing its release procedure or stamping an
2641
- explicit no-release line into the consumer-named disposition-evidence file
2642
- (`<iteration> release <version|none|deferred:<version>> — <basis>`, the
2643
- `check-lesson-disposition` contract shape at the release boundary).
2644
-
2645
- The third value carries a release the criteria **earn** but an operator ruling
2646
- holds back, which `none` ("nothing to release") cannot express — a reader forced
2647
- to tell the two apart by parsing basis prose has no mechanical signal at all. It
2648
- is `deferred:<version>` and not a bare `deferred` because the thing that must
2649
- survive is the *earned bump level*; a bare token drops it and the next release
2650
- re-derives which floor it inherits. The producer derives `<version>` as the
2651
- version the criteria *would have shipped as* had the release not been held: the
2652
- bump the note's upgrade-contract sections floor, applied over the newest
2653
- already-released note — never the next version the project happens to reach.
2654
- Stating that rule is what keeps the field mechanically derivable rather than an
2655
- operator's guess, since without a defined scale the discharge comparison has
2656
- none. The criteria themselves stay in the basis prose and are not structured
2657
- fields: the release note's upgrade-contract sections already own them, and a
2658
- structured list here would be a second copy of that surface — the line carries
2659
- the *level*, the note owns the *criteria*.
2660
-
2661
- **Outstanding-deferral is derived, never tracked.** A `deferred:<version>` line
2662
- is **outstanding** until a later line dispositions a release at or above
2663
- `<version>`; that later line **discharges** it. Nothing records discharge
2664
- separately — the release actually happening *is* the discharge, so there is no
2665
- second state to drift. This is what keeps a consumer's gate over the value
2666
- low-false-positive: a deferral cannot linger past the release that consumes it,
2667
- and one that genuinely has not been consumed *should* keep firing.
2668
-
2669
- A consumer deriving that outstanding set reads the disposition file as
2670
- **history ∪ live** — not replacement, not fallback — the same reader
2671
- drift-kit/SPEC.md §The stage-economics meter applies to the stage stamps and
2672
- drift-kit's `trajectory` emit arm already ships. The file is typically a `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` member,
2673
- so a carrying line survives only in committed history and a live-only reader sees
2674
- nothing; conversely a history-only reader is blind at exactly the moment that
2675
- matters most for a precommit gate — the pre-commit of the very close commit
2676
- writing the `deferred:` line, when that line is live and not yet committed.
2677
- The live arm covers the uncommitted tail, the history arm covers everything
2678
- truncation has taken, and the union costs nothing because a line in both arms is
2679
- the same line. Truncation-immunity is a property of the *reader*, and every
2680
- reader of a truncated evidence file needs it.
2681
-
2682
- **The kit wires no gate over the value**, consistent with the release-sweep stamp
2683
- file: the disposition file is operator evidence riding the release commit, the
2684
- kit defines the value and the outstanding/discharged derivation, and a consumer
2685
- may gate it. That split is the provenance seam — the *grammar* is generic
2686
- lifecycle mechanism, the *bump criteria* being carried are consumer release
2687
- policy, so the kit ships no list of criteria. The step runs after the surface-mutating
2688
- close steps and before the brevity pass, since the note is itself such a write;
2689
- silence is not a disposition. The `release-policy` slot carries the consumer's
2690
- procedure and criteria by citation, the disposition-evidence path, and any
2691
- boundary-only sub-procedure such as a major-only deprecation sweep; a consumer
2692
- with no release process binds a plain `none`-every-iteration line. The
2693
- disposition line's mechanical reader is `enter-stage.sh`'s boundary require-check
2694
- (§bin/enter-stage.sh, `LIFECYCLE_KIT_BOUNDARY_REQUIRE`) when a consumer wires the
2695
- file into that knob.
2696
-
2697
- ### templates/release-sweep.md
2698
-
2699
- A **boundary skill**, not a stage — which is why it sits at `templates/` root
2700
- beside `lead.md` rather than among the stage templates: it invokes no
2701
- `enter-stage.sh` and stamps no state, so `check-stage-skill-coverage` never reads
2702
- it (it governs only the configured stage set). It is the deprecation disposition
2703
- walk at a major — invoked from
2704
- close's release-disposition step when the derived bump is a major — forcing every
2705
- marker on the `CANON_KIT_DEPRECATION_MARKERS` roster to a stamped disposition —
2706
- decommission, carry-forward, or un-deprecate — the `check-lesson-disposition`
2707
- contract shape at a release boundary. canon-kit's `check-deprecation-task` holds
2708
- each marker bound to a live task between majors; this sweep forces the standing
2709
- inventory to a decision at the boundary the deprecations were promised against.
2710
- It carries **named slots** (`inventory-command`, `evidence-gate`), so like the
2711
- stage skills it adopts the binding-shim grammar (§templates/stages/) and
2712
- `check-skill-binding` holds the slot pairing; the stamp file is operator
2713
- evidence riding the release commit — the kit wires no gate over it (a consumer
2714
- may, through `evidence-gate`).
2715
-
2716
- ### templates/upgrade.md
2717
-
2718
- `upgrade.md` is a **boundary skill** too, at `templates/` root rather than among
2719
- the stage templates: it invokes no `enter-stage.sh` and stamps no state, so
2720
- `check-stage-skill-coverage` never reads it. It is the phase-B disposition walk a consumer runs when moving
2721
- their vendored kits from one release to the next — the judgment half of the
2722
- two-phase upgrade contract whose deterministic half (the wholesale kit-sync) and
2723
- whose executable proof both live in gate-sdk (gate-sdk/SPEC.md §upgrade-smoke),
2724
- against the release-note grammar docs/install.md §The upgrade contract owns. Its
2725
- ritual registers the target note's newly-declared gates (a new gate's only
2726
- delivery channel to an upgrading consumer — the phase-A sync never re-runs the
2727
- installer), dispositions each red gate (fix-the-tree or exempt-with-cause, never
2728
- a weakened gate), and closes on the semantic-residual audit: the upgrade is the
2729
- cadence at which a consumer judges the ungateable third of a template-slot change
2730
- — the shim fill that clears both `check-skill-binding` (slot-set drift) and
2731
- `check-shim-restatement` (verbatim copy) yet duplicates what the new slot now
2732
- means to own. It carries named slots (`gates-list`, `disposition-evidence`), so
2733
- like the stage skills it adopts the binding-shim grammar (§templates/stages/) and
2734
- `check-skill-binding` holds the slot pairing when a consumer binds it. This repo
2735
- binds no command for it — the repo is the kit source, never a vendored consumer,
2736
- so it never upgrades itself; the template ships for consumers and the upgrade
2737
- smoke exercises the mechanics it narrates.
2738
-
2739
- ### templates/lead.md
2740
-
2741
- The **iteration lead** template — an optional live session that dispatches an
2742
- iteration's stage sessions and answers their escalations, closing the
2743
- restart-cost of a stage that would otherwise stop and surface to the user cold
2744
- (§The state machine). Like `release-sweep.md` it is a **boundary skill, not a
2745
- stage**: it invokes no `enter-stage.sh` and joins no stage set, so
2746
- `check-stage-skill-coverage` never reads it. Like release-sweep it carries
2747
- named slots, so it adopts the binding-shim grammar (§templates/stages/) — a
2748
- consumer copies-and-specializes it or binds it through a thin shim, and
2749
- `check-skill-binding` holds the slot pairing either way (this repo's
2750
- `.claude/commands/lead.md` shim).
2751
-
2752
- The template owns the orchestration protocol whole: the two lead postures
2753
- (**unified** — the scope session stays live as the lead, one session holding
2754
- judgment and dispatch on one model tier; **split** — a routing-tier lead
2755
- dispatches scope as a stage session on the judgment tier and keeps it
2756
- resumable as the iteration's *intent oracle*, ruling machinery questions
2757
- itself, forwarding intent questions to the oracle with the working-state
2758
- excerpt each turns on, and falling back to the governed surfaces — then the
2759
- operator — when the oracle is gone; posture and tier assignment are standing
2760
- dispatch policy in the ruling-config slot), the lead model (dispatch a
2761
- stage session as a background agent whose prompt is that stage's ordinary skill
2762
- invocation, with the inline-run posture sentence reading
2763
- `LIFECYCLE_KIT_SESSION_BOUNDARY` — inline stage runs banned under `stage`,
2764
- the sanctioned blocked-dispatch fallback under `iteration`; and the
2765
- completion-notification dispatch precondition, with the prompt-answered-signal
2766
- trap and the gating-versus-liveness boundary that keeps it from reading as a
2767
- reversal of the hand-derivation corollary below — its honest limit is recorded
2768
- in §The state machine and it is standing lead policy under the
2769
- policy-is-config rule), the
2770
- opening-an-iteration contract (the lead never selects the unit set — it relays
2771
- the operator's standing directive, a theme bounding scope's survey and never a
2772
- slug list, verbatim in the scope dispatch, and routes scope's proposed set back
2773
- as an ordinary escalation; selection is scope's contract, and a lead-authored
2774
- menu pre-empts the premise re-verification), the four-header
2775
- escalation block (Question / Options / Recommendation / Evidence) together with
2776
- the one class the lead never rules under either posture — reversing, demoting or
2777
- re-scoping a recorded operator ruling or a stated objective is operator-class and
2778
- is relayed, carved out of the derivable-from-the-governed-surfaces routing rule
2779
- because a session holding contrary evidence reads the surface carrying the ruling
2780
- as stale rather than as closed, the split-channel design (routine narration to the
2781
- resume journal, escalations to the message channel), the compact economics —
2782
- the split-where-the-tail-dominates rule, the unified posture's handoff compact,
2783
- and operator-suggested compacts at the acceptance
2784
- boundaries that pay under the cold-wakes-times-compressible-residue rule —
2785
- with the dispatch-granularity rule (the roster derived from every unit the
2786
- iteration promoted rather than from the amendment set, then batch units
2787
- sharing a kit or SPEC surface, split on a model-tier change or a
2788
- delegation-kit split trigger) and
2789
- the lead-owns-batching clause (an intra-stage batch split is N sibling stage
2790
- sessions the lead dispatches and verifies — each a same-stage re-entry,
2791
- §The state machine — and a stage session never dispatches a sibling stage
2792
- session), and
2793
- the stamps-authoritative invariant carried from §The state machine as the
2794
- design's load-bearing rule — with its two corollaries: the lead never
2795
- hand-derives prior-stage completeness from WORKFLOW-STATE or the git log (it
2796
- dispatches and trusts `enter-stage.sh`'s fail-closed refusal, or gates an
2797
- expensive dispatch with `--simulate`, and reads that same drain-entry verdict
2798
- **before** declaring a stage's batches complete rather than after,
2799
- §bin/enter-stage.sh), and a ruling
2800
- whose acting session is not imminent is filed to a durable governed surface
2801
- in the moment it is made. An earlier second assertion over the drain
2802
- assertion's own population is **ruled out** on record: a batching roster has
2803
- dropped a promoted unit in practice and `check-stage-entry` named
2804
- it at the refused entry, so the defect is detected late — at the price of one
2805
- wasted dispatch — rather than undetected, and a duplicate reading of one fact
2806
- would buy only the timing the simulate read already buys for free.
2807
- The template also carries the lead's first step —
2808
- writing the session-role marker context-kit's hook reads
2809
- (context-kit/SPEC.md §The session-context hook). Dispatch safety is not re-owned — it inherits
2810
- delegation-kit's protocol by citation (delegation-kit/SPEC.md §The delegation
2811
- model: background dispatch, the per-dispatch budget guard, verify after any
2812
- agent commit) — with one lifecycle **instance** the generic rule cannot state
2813
- because it would have to name a stage: when the dispatched stage is the
2814
- evidence-producing one, the lead's verify is a read of the committed evidence
2815
- manifest rather than a re-run of its producer, the harm splitting between an
2816
- inert battery re-run and a destructive producer re-run (delegation-kit/SPEC.md
2817
- §Verify after every agent commit owns the generic rule and the split; its honest
2818
- limit here is recorded in §The state machine). Consumer residue stays in named slots — the tracked
2819
- agent-definition carrying the standing dispatch policy the dispatch names (the
2820
- ruling-class roster and everything else true of every dispatch, not improvised
2821
- per prompt), and whether the consumer wires the optional escalation-shape guard
2822
- (guard-kit/SPEC.md §wakeup-guard) or leaves it inert.
2823
-
2824
- ### templates/consult.md
2825
-
2826
- The **operator strategy session** template, and a **boundary skill** of the class
2827
- §Layout and configuration enumerates: like `lead.md` it invokes no
2828
- `enter-stage.sh`, stamps nothing, and joins no stage set, so
2829
- `check-stage-skill-coverage` never reads it. The classification is what makes it
2830
- cost no new mechanism. A consultation may run before an iteration opens, between
2831
- stages, or across an iteration boundary, and a template with no cursor is at odds
2832
- with none of those. It carries named slots, so it adopts the
2833
- binding-shim grammar (§templates/stages/) and `check-skill-binding` holds the
2834
- slot pairing.
2835
-
2836
- *A seventh stage was ruled out.* It would need a predecessor entry in
2837
- `LIFECYCLE_KIT_STAGES`, a fixed position in the walk, and a stamp — none of which
2838
- a session that may precede or span an iteration has — and it would make
2839
- `check-stage-entry` assertion A demand a consult stamp on every iteration that
2840
- legitimately holds no consultation.
2841
-
2842
- **What the template owns** is a landing contract: the session's exit condition is
2843
- that every ruling the operator closed has reached a governed surface, every
2844
- refused alternative is recorded with its grounds, and every always-loaded surface
2845
- those rulings stale is corrected, flagged, or filed. Two mechanisms are what make
2846
- that reachable rather than aspirational, and both are stated in the ritual. A
2847
- ruling lands **at the moment it closes**, not at exit, so an interrupted session
2848
- loses at most the ruling in flight rather than the session's whole output. And
2849
- the session journals while it cannot commit, on the durability rule at its owning
2850
- tier (delegation-kit/SPEC.md §Resume journal — agent writes, scratch reset
2851
- sweeps), which is what converts a shared index held by a live stage session from
2852
- data loss into latency. The journal's reclaim is the existing boundary wipe of
2853
- the scratch dir (§bin/enter-stage.sh) and no `LIFECYCLE_KIT_BOUNDARY_PRESERVE`
2854
- entry is added — a preserved journal would outlive the session that can interpret
2855
- it, its content having been discharged into a commit at exit.
2856
-
2857
- **Write authority is not this template's to grant.** Who may record a ruling on a
2858
- consumer's ruling record is stated by that record, at the widest tier true for
2859
- every reader of it — every session that closes a ruling with the operator faces
2860
- the question, not only a consult session. What the skill adds on top is
2861
- obligation: elsewhere recording a closed ruling is permitted, here a consultation
2862
- that did not record one has not exited.
2863
-
2864
- Dispatch safety is inherited by citation rather than re-owned
2865
- (delegation-kit/templates/agent-execution.md), on the same rule
2866
- §templates/lead.md follows — a copied protocol is a second content tier that
2867
- drifts. The template does state **tier selection** in its own right, because the
2868
- hazard is sharper here than for a stage session: an unselected dispatch inherits
2869
- the dispatcher's tier, and a consultation runs at the judgment tier while most of
2870
- what it dispatches is read-only research, so an unselected fan-out buys the most
2871
- expensive tier for the cheapest work.
2872
-
2873
- Consumer residue stays in exactly **two named slots**, and the split is the
2874
- provenance seam rather than a convenience — `entry-reading` (the surfaces a
2875
- consultation reads on entry) and `landing-surfaces` (the surfaces a closed ruling
2876
- may land on, by ruling class). A consumer's entry set reaches its private
2877
- context, and a kit literal naming it would publish a private surface; its landing
2878
- set names that consumer's own governance layout, and a kit shipping those names
2879
- would ship one project's layout as everyone's. What stays kit mechanism is the
2880
- shape: a consultation has an entry read-set and an exit landing-set, and every
2881
- closed ruling reaches the landing set before the session ends. Each slot has a
2882
- named reader — the entry step and the exit check respectively — and
2883
- `check-skill-binding` requires the shim to bind exactly that set, so an unbound
2884
- slot or an orphan binding is caught mechanically rather than by review.