checkwright 0.0.1 → 0.17.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 (839) hide show
  1. package/README.md +260 -4
  2. package/bin/checkwright.sh +53 -0
  3. package/lib/common/lock.sh +28 -0
  4. package/lib/common/profile.sh +58 -0
  5. package/lib/common/recipe.sh +93 -0
  6. package/lib/doctor.sh +90 -0
  7. package/lib/init.sh +289 -0
  8. package/package.json +15 -3
  9. package/payload/canon-kit/README.md +78 -0
  10. package/payload/canon-kit/SPEC.md +1264 -0
  11. package/payload/canon-kit/checks/check-amendment-queue.sh +115 -0
  12. package/payload/canon-kit/checks/check-comment-tier.sh +211 -0
  13. package/payload/canon-kit/checks/check-deprecation-task.sh +90 -0
  14. package/payload/canon-kit/checks/check-docs-cmd.sh +153 -0
  15. package/payload/canon-kit/checks/check-docs-link-convention.sh +71 -0
  16. package/payload/canon-kit/checks/check-knob-citation.sh +117 -0
  17. package/payload/canon-kit/checks/check-knob-default-coupling.sh +239 -0
  18. package/payload/canon-kit/checks/check-manifest-count.sh +46 -0
  19. package/payload/canon-kit/checks/check-manifest-temporal.sh +83 -0
  20. package/payload/canon-kit/checks/check-md-refs.sh +115 -0
  21. package/payload/canon-kit/checks/check-prose-enum.sh +115 -0
  22. package/payload/canon-kit/checks/check-prose-tells.sh +207 -0
  23. package/payload/canon-kit/checks/check-spec-derivable-section.sh +69 -0
  24. package/payload/canon-kit/checks/check-spec-dod-singleton.sh +45 -0
  25. package/payload/canon-kit/checks/check-spec-embedded-source.sh +133 -0
  26. package/payload/canon-kit/checks/check-spec-fence-balance.sh +42 -0
  27. package/payload/canon-kit/checks/check-spec-pointer.sh +176 -0
  28. package/payload/canon-kit/checks/check-surface-duplication.sh +105 -0
  29. package/payload/canon-kit/checks/check-todo-task-liveness.sh +80 -0
  30. package/payload/canon-kit/checks/check-tracking-claim.sh +136 -0
  31. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/SPEC-tidy.md +5 -0
  32. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/TASK-QUEUE.md +15 -0
  33. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/expect.txt +1 -0
  34. package/payload/canon-kit/gate-tests/check-amendment-queue/good/SPEC-widget.md +6 -0
  35. package/payload/canon-kit/gate-tests/check-amendment-queue/good/TASK-QUEUE.md +15 -0
  36. package/payload/canon-kit/gate-tests/check-amendment-queue/good/expect.txt +1 -0
  37. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.sh +25 -0
  38. package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +1 -0
  39. package/payload/canon-kit/gate-tests/check-comment-tier/good/expect.txt +1 -0
  40. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +32 -0
  41. package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +146 -0
  42. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/TASK-QUEUE.md +19 -0
  43. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.sh +6 -0
  44. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/expect.txt +1 -0
  45. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.sh +5 -0
  46. package/payload/canon-kit/gate-tests/check-deprecation-task/good/TASK-QUEUE.md +21 -0
  47. package/payload/canon-kit/gate-tests/check-deprecation-task/good/expect.txt +1 -0
  48. package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.sh +5 -0
  49. package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.sh +5 -0
  50. package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +98 -0
  51. package/payload/canon-kit/gate-tests/check-docs-cmd/bad/args +1 -0
  52. package/payload/canon-kit/gate-tests/check-docs-cmd/bad/doc.md +9 -0
  53. package/payload/canon-kit/gate-tests/check-docs-cmd/bad/expect.txt +1 -0
  54. package/payload/canon-kit/gate-tests/check-docs-cmd/good/args +1 -0
  55. package/payload/canon-kit/gate-tests/check-docs-cmd/good/bin/tool.sh +3 -0
  56. package/payload/canon-kit/gate-tests/check-docs-cmd/good/doc.md +18 -0
  57. package/payload/canon-kit/gate-tests/check-docs-cmd/good/expect.txt +1 -0
  58. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/args +4 -0
  59. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/demokit/index.md +5 -0
  60. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/index.md +3 -0
  61. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/expect.txt +1 -0
  62. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/args +4 -0
  63. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/demokit/index.md +6 -0
  64. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/index.md +3 -0
  65. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +3 -0
  66. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/expect.txt +1 -0
  67. package/payload/canon-kit/gate-tests/check-knob-citation/bad/SPEC.md +10 -0
  68. package/payload/canon-kit/gate-tests/check-knob-citation/bad/expect.txt +1 -0
  69. package/payload/canon-kit/gate-tests/check-knob-citation/good/SPEC.md +19 -0
  70. package/payload/canon-kit/gate-tests/check-knob-citation/good/expect.txt +1 -0
  71. package/payload/canon-kit/gate-tests/check-knob-citation.test.sh +71 -0
  72. package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/expect.txt +1 -0
  73. package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/scripts/gate-sdk-config.sh +4 -0
  74. package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/widget-kit/SPEC.md +4 -0
  75. package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/widget-kit/lib/widget-cli.sh +3 -0
  76. package/payload/canon-kit/gate-tests/check-knob-default-coupling/bad/widget-kit/lib/widget.sh +5 -0
  77. package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/expect.txt +1 -0
  78. package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/scripts/gate-sdk-config.sh +5 -0
  79. package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/widget-kit/SPEC.md +7 -0
  80. package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/widget-kit/lib/widget-cli.sh +3 -0
  81. package/payload/canon-kit/gate-tests/check-knob-default-coupling/good/widget-kit/lib/widget.sh +5 -0
  82. package/payload/canon-kit/gate-tests/check-knob-default-coupling.test.sh +73 -0
  83. package/payload/canon-kit/gate-tests/check-manifest-count/bad/SPEC.md +15 -0
  84. package/payload/canon-kit/gate-tests/check-manifest-count/bad/expect.txt +1 -0
  85. package/payload/canon-kit/gate-tests/check-manifest-count/good/SPEC.md +37 -0
  86. package/payload/canon-kit/gate-tests/check-manifest-count/good/expect.txt +1 -0
  87. package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +104 -0
  88. package/payload/canon-kit/gate-tests/check-manifest-temporal/bad/SPEC.md +6 -0
  89. package/payload/canon-kit/gate-tests/check-manifest-temporal/bad/expect.txt +1 -0
  90. package/payload/canon-kit/gate-tests/check-manifest-temporal/good/SPEC.md +17 -0
  91. package/payload/canon-kit/gate-tests/check-manifest-temporal/good/expect.txt +1 -0
  92. package/payload/canon-kit/gate-tests/check-md-refs/bad/args +1 -0
  93. package/payload/canon-kit/gate-tests/check-md-refs/bad/doc.md +3 -0
  94. package/payload/canon-kit/gate-tests/check-md-refs/bad/expect.txt +1 -0
  95. package/payload/canon-kit/gate-tests/check-md-refs/good/args +1 -0
  96. package/payload/canon-kit/gate-tests/check-md-refs/good/doc.md +3 -0
  97. package/payload/canon-kit/gate-tests/check-md-refs/good/expect.txt +1 -0
  98. package/payload/canon-kit/gate-tests/check-md-refs/good/target.md +1 -0
  99. package/payload/canon-kit/gate-tests/check-md-refs.test.sh +82 -0
  100. package/payload/canon-kit/gate-tests/check-prose-enum/bad/SPEC.md +4 -0
  101. package/payload/canon-kit/gate-tests/check-prose-enum/bad/expect.txt +1 -0
  102. package/payload/canon-kit/gate-tests/check-prose-enum/bad/scripts/canon-config.sh +4 -0
  103. package/payload/canon-kit/gate-tests/check-prose-enum/good/SPEC.md +16 -0
  104. package/payload/canon-kit/gate-tests/check-prose-enum/good/expect.txt +1 -0
  105. package/payload/canon-kit/gate-tests/check-prose-enum/good/scripts/canon-config.sh +4 -0
  106. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +127 -0
  107. package/payload/canon-kit/gate-tests/check-prose-tells/bad/expect.txt +1 -0
  108. package/payload/canon-kit/gate-tests/check-prose-tells/bad/prose.md +15 -0
  109. package/payload/canon-kit/gate-tests/check-prose-tells/bad/scripts/canon-config.sh +8 -0
  110. package/payload/canon-kit/gate-tests/check-prose-tells/good/expect.txt +1 -0
  111. package/payload/canon-kit/gate-tests/check-prose-tells/good/prose.md +21 -0
  112. package/payload/canon-kit/gate-tests/check-prose-tells/good/scripts/canon-config.sh +8 -0
  113. package/payload/canon-kit/gate-tests/check-spec-derivable-section/bad/SPEC.md +20 -0
  114. package/payload/canon-kit/gate-tests/check-spec-derivable-section/bad/expect.txt +1 -0
  115. package/payload/canon-kit/gate-tests/check-spec-derivable-section/good/SPEC.md +13 -0
  116. package/payload/canon-kit/gate-tests/check-spec-derivable-section/good/expect.txt +1 -0
  117. package/payload/canon-kit/gate-tests/check-spec-dod-singleton/bad/SPEC.md +15 -0
  118. package/payload/canon-kit/gate-tests/check-spec-dod-singleton/bad/expect.txt +1 -0
  119. package/payload/canon-kit/gate-tests/check-spec-dod-singleton/good/SPEC.md +13 -0
  120. package/payload/canon-kit/gate-tests/check-spec-dod-singleton/good/expect.txt +1 -0
  121. package/payload/canon-kit/gate-tests/check-spec-dod-singleton.test.sh +63 -0
  122. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/SPEC.md +16 -0
  123. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/expect.txt +1 -0
  124. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/widget.sh +9 -0
  125. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/SPEC.md +19 -0
  126. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/expect.txt +1 -0
  127. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/widget.sh +9 -0
  128. package/payload/canon-kit/gate-tests/check-spec-fence-balance/bad/args +1 -0
  129. package/payload/canon-kit/gate-tests/check-spec-fence-balance/bad/doc.md +8 -0
  130. package/payload/canon-kit/gate-tests/check-spec-fence-balance/bad/expect.txt +1 -0
  131. package/payload/canon-kit/gate-tests/check-spec-fence-balance/good/args +1 -0
  132. package/payload/canon-kit/gate-tests/check-spec-fence-balance/good/doc.md +9 -0
  133. package/payload/canon-kit/gate-tests/check-spec-fence-balance/good/expect.txt +1 -0
  134. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/README.md +4 -0
  135. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/SPEC-target.md +6 -0
  136. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/SPEC-widget.md +5 -0
  137. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/cand-tmpl.md +5 -0
  138. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +1 -0
  139. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/scripts/canon-config.sh +5 -0
  140. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +5 -0
  141. package/payload/canon-kit/gate-tests/check-spec-pointer/good/README.md +4 -0
  142. package/payload/canon-kit/gate-tests/check-spec-pointer/good/SPEC-target.md +6 -0
  143. package/payload/canon-kit/gate-tests/check-spec-pointer/good/SPEC-widget.md +5 -0
  144. package/payload/canon-kit/gate-tests/check-spec-pointer/good/cand-tmpl.md +7 -0
  145. package/payload/canon-kit/gate-tests/check-spec-pointer/good/expect.txt +1 -0
  146. package/payload/canon-kit/gate-tests/check-spec-pointer/good/scripts/canon-config.sh +5 -0
  147. package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +6 -0
  148. package/payload/canon-kit/gate-tests/check-surface-duplication/bad/GLOSSARY.md +11 -0
  149. package/payload/canon-kit/gate-tests/check-surface-duplication/bad/VISION.md +6 -0
  150. package/payload/canon-kit/gate-tests/check-surface-duplication/bad/expect.txt +1 -0
  151. package/payload/canon-kit/gate-tests/check-surface-duplication/good/GLOSSARY.md +11 -0
  152. package/payload/canon-kit/gate-tests/check-surface-duplication/good/VISION.md +6 -0
  153. package/payload/canon-kit/gate-tests/check-surface-duplication/good/expect.txt +1 -0
  154. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/TASK-QUEUE.md +19 -0
  155. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.sh +5 -0
  156. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/expect.txt +1 -0
  157. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/TASK-QUEUE.md +23 -0
  158. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/expect.txt +1 -0
  159. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.sh +5 -0
  160. package/payload/canon-kit/gate-tests/check-tracking-claim/bad/README.md +4 -0
  161. package/payload/canon-kit/gate-tests/check-tracking-claim/bad/args +1 -0
  162. package/payload/canon-kit/gate-tests/check-tracking-claim/bad/expect.txt +1 -0
  163. package/payload/canon-kit/gate-tests/check-tracking-claim/bad/kept.txt +1 -0
  164. package/payload/canon-kit/gate-tests/check-tracking-claim/good/README.md +7 -0
  165. package/payload/canon-kit/gate-tests/check-tracking-claim/good/args +1 -0
  166. package/payload/canon-kit/gate-tests/check-tracking-claim/good/expect.txt +1 -0
  167. package/payload/canon-kit/gate-tests/check-tracking-claim/good/kept.txt +1 -0
  168. package/payload/canon-kit/gate-tests/check-tracking-claim/good/roster.list +1 -0
  169. package/payload/canon-kit/gate-tests/check-tracking-claim.test.sh +86 -0
  170. package/payload/canon-kit/lib/spec.sh +475 -0
  171. package/payload/canon-kit/smoke/install.sh +36 -0
  172. package/payload/canon-kit/smoke/violation.sh +22 -0
  173. package/payload/canon-kit/templates/SPEC-amendment.md +55 -0
  174. package/payload/canon-kit/templates/canon-config.sh +2 -0
  175. package/payload/context-kit/README.md +82 -0
  176. package/payload/context-kit/SPEC.md +785 -0
  177. package/payload/context-kit/bin/always-loaded.sh +86 -0
  178. package/payload/context-kit/bin/env-probe.sh +144 -0
  179. package/payload/context-kit/bin/footprint.sh +144 -0
  180. package/payload/context-kit/bin/md-index.sh +80 -0
  181. package/payload/context-kit/bin/md-section.sh +63 -0
  182. package/payload/context-kit/bin/pub-index.sh +90 -0
  183. package/payload/context-kit/bin/run-index-tests.sh +91 -0
  184. package/payload/context-kit/checks/check-brevity.sh +123 -0
  185. package/payload/context-kit/checks/check-footprint-fresh.sh +38 -0
  186. package/payload/context-kit/checks/check-memory-off.sh +112 -0
  187. package/payload/context-kit/checks/check-settings-pins.sh +110 -0
  188. package/payload/context-kit/gate-tests/check-brevity/bad/CLAUDE.md +14 -0
  189. package/payload/context-kit/gate-tests/check-brevity/bad/args +2 -0
  190. package/payload/context-kit/gate-tests/check-brevity/bad/expect.txt +1 -0
  191. package/payload/context-kit/gate-tests/check-brevity/good/CLAUDE.md +20 -0
  192. package/payload/context-kit/gate-tests/check-brevity/good/args +2 -0
  193. package/payload/context-kit/gate-tests/check-brevity/good/expect.txt +1 -0
  194. package/payload/context-kit/gate-tests/check-brevity.test.sh +89 -0
  195. package/payload/context-kit/gate-tests/check-footprint-fresh/bad/args +4 -0
  196. package/payload/context-kit/gate-tests/check-footprint-fresh/bad/emit.txt +12 -0
  197. package/payload/context-kit/gate-tests/check-footprint-fresh/bad/expect.txt +1 -0
  198. package/payload/context-kit/gate-tests/check-footprint-fresh/bad/projection.txt +11 -0
  199. package/payload/context-kit/gate-tests/check-footprint-fresh/good/args +4 -0
  200. package/payload/context-kit/gate-tests/check-footprint-fresh/good/emit.txt +12 -0
  201. package/payload/context-kit/gate-tests/check-footprint-fresh/good/expect.txt +1 -0
  202. package/payload/context-kit/gate-tests/check-footprint-fresh/good/projection.txt +12 -0
  203. package/payload/context-kit/gate-tests/check-memory-off/bad/args +1 -0
  204. package/payload/context-kit/gate-tests/check-memory-off/bad/expect.txt +1 -0
  205. package/payload/context-kit/gate-tests/check-memory-off/bad/memory/example-fact.md +6 -0
  206. package/payload/context-kit/gate-tests/check-memory-off/good/args +1 -0
  207. package/payload/context-kit/gate-tests/check-memory-off/good/expect.txt +1 -0
  208. package/payload/context-kit/gate-tests/check-memory-off/good/memory/.gitkeep +0 -0
  209. package/payload/context-kit/gate-tests/check-memory-off.test.sh +54 -0
  210. package/payload/context-kit/gate-tests/check-settings-pins/bad/args +1 -0
  211. package/payload/context-kit/gate-tests/check-settings-pins/bad/expect.txt +1 -0
  212. package/payload/context-kit/gate-tests/check-settings-pins/bad/settings-pins.conf +3 -0
  213. package/payload/context-kit/gate-tests/check-settings-pins/bad/settings.json +6 -0
  214. package/payload/context-kit/gate-tests/check-settings-pins/good/args +1 -0
  215. package/payload/context-kit/gate-tests/check-settings-pins/good/expect.txt +1 -0
  216. package/payload/context-kit/gate-tests/check-settings-pins/good/settings-pins.conf +3 -0
  217. package/payload/context-kit/gate-tests/check-settings-pins/good/settings.json +6 -0
  218. package/payload/context-kit/index-tests/corpus/baseline.txt +2 -0
  219. package/payload/context-kit/index-tests/corpus/hook-sample.txt +4 -0
  220. package/payload/context-kit/index-tests/corpus/sample.md +23 -0
  221. package/payload/context-kit/index-tests/corpus/sample.rs +24 -0
  222. package/payload/context-kit/index-tests/corpus/sample.ts +34 -0
  223. package/payload/context-kit/index-tests/corpus/surface.md +6 -0
  224. package/payload/context-kit/index-tests/expected/always-loaded.txt +1 -0
  225. package/payload/context-kit/index-tests/expected/md-index.txt +6 -0
  226. package/payload/context-kit/index-tests/expected/md-section.txt +6 -0
  227. package/payload/context-kit/index-tests/expected/pub-index-shadow.txt +2 -0
  228. package/payload/context-kit/index-tests/expected/pub-index-ts.txt +12 -0
  229. package/payload/context-kit/index-tests/expected/pub-index.txt +10 -0
  230. package/payload/context-kit/index-tests/expected/toolfloor.txt +14 -0
  231. package/payload/context-kit/index-tests/toolfloor-cases.sh +29 -0
  232. package/payload/context-kit/lib/pub-lang/rust.sh +26 -0
  233. package/payload/context-kit/lib/pub-lang/ts.sh +32 -0
  234. package/payload/context-kit/lib/toolfloor.sh +47 -0
  235. package/payload/context-kit/smoke/agents-md.sh +116 -0
  236. package/payload/context-kit/smoke/install.sh +60 -0
  237. package/payload/context-kit/smoke/violation.sh +21 -0
  238. package/payload/context-kit/templates/close-brevity.md +30 -0
  239. package/payload/context-kit/templates/context-config.sh +2 -0
  240. package/payload/context-kit/templates/session-context.sh +133 -0
  241. package/payload/context-kit/templates/settings-sessionstart.json +12 -0
  242. package/payload/delegation-kit/README.md +87 -0
  243. package/payload/delegation-kit/SPEC.md +780 -0
  244. package/payload/delegation-kit/bin/run-budget-guard-tests.sh +88 -0
  245. package/payload/delegation-kit/bin/run-trend-tests.sh +63 -0
  246. package/payload/delegation-kit/bin/run-usage-tests.sh +226 -0
  247. package/payload/delegation-kit/bin/usage-trend.sh +120 -0
  248. package/payload/delegation-kit/bin/usage-verdict.sh +144 -0
  249. package/payload/delegation-kit/checks/check-gate-tamper.sh +139 -0
  250. package/payload/delegation-kit/checks/check-rule-citation.sh +76 -0
  251. package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/args +1 -0
  252. package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/expect.txt +1 -0
  253. package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/staged-files +5 -0
  254. package/payload/delegation-kit/gate-tests/check-gate-tamper/good/added-exemptions +2 -0
  255. package/payload/delegation-kit/gate-tests/check-gate-tamper/good/args +1 -0
  256. package/payload/delegation-kit/gate-tests/check-gate-tamper/good/expect.txt +1 -0
  257. package/payload/delegation-kit/gate-tests/check-gate-tamper/good/staged-files +5 -0
  258. package/payload/delegation-kit/gate-tests/check-rule-citation/bad/args +1 -0
  259. package/payload/delegation-kit/gate-tests/check-rule-citation/bad/expect.txt +1 -0
  260. package/payload/delegation-kit/gate-tests/check-rule-citation/bad/spec.md +9 -0
  261. package/payload/delegation-kit/gate-tests/check-rule-citation/bad/tmpl.md +4 -0
  262. package/payload/delegation-kit/gate-tests/check-rule-citation/good/args +1 -0
  263. package/payload/delegation-kit/gate-tests/check-rule-citation/good/expect.txt +1 -0
  264. package/payload/delegation-kit/gate-tests/check-rule-citation/good/spec.md +20 -0
  265. package/payload/delegation-kit/gate-tests/check-rule-citation/good/tmpl.md +5 -0
  266. package/payload/delegation-kit/lib/delegation.sh +81 -0
  267. package/payload/delegation-kit/smoke/install.sh +61 -0
  268. package/payload/delegation-kit/smoke/violation.sh +16 -0
  269. package/payload/delegation-kit/templates/agent-budget-guard.sh +18 -0
  270. package/payload/delegation-kit/templates/agent-execution.md +136 -0
  271. package/payload/delegation-kit/templates/delegation-config.sh +2 -0
  272. package/payload/delegation-kit/templates/dispatch-checklists.md +60 -0
  273. package/payload/delegation-kit/templates/statusline-usage.sh +79 -0
  274. package/payload/delegation-kit/templates/usage-poller.sh +67 -0
  275. package/payload/delegation-kit/usage-tests/budget-guard-cases.tsv +20 -0
  276. package/payload/delegation-kit/usage-tests/cases.tsv +44 -0
  277. package/payload/delegation-kit/usage-tests/trend-history.log +20 -0
  278. package/payload/doctrine-kit/DOCTRINE.md +386 -0
  279. package/payload/doctrine-kit/README.md +70 -0
  280. package/payload/doctrine-kit/SPEC.md +233 -0
  281. package/payload/doctrine-kit/bin/install-doctrine.sh +44 -0
  282. package/payload/doctrine-kit/bin/stage-rules.sh +51 -0
  283. package/payload/doctrine-kit/checks/check-doctrine-registration.sh +216 -0
  284. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/AGENT.md +14 -0
  285. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/DOCTRINE.md +12 -0
  286. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/args +1 -0
  287. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/expect.txt +1 -0
  288. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/AGENT.md +15 -0
  289. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/DOCTRINE.md +12 -0
  290. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/args +1 -0
  291. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/expect.txt +1 -0
  292. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +208 -0
  293. package/payload/doctrine-kit/lib/doctrine.sh +29 -0
  294. package/payload/doctrine-kit/smoke/install.sh +24 -0
  295. package/payload/doctrine-kit/smoke/violation.sh +13 -0
  296. package/payload/drift-kit/README.md +115 -0
  297. package/payload/drift-kit/SPEC.md +828 -0
  298. package/payload/drift-kit/bin/drift-report.sh +152 -0
  299. package/payload/drift-kit/bin/kfric.sh +42 -0
  300. package/payload/drift-kit/bin/overhead-meter.sh +106 -0
  301. package/payload/drift-kit/bin/stage-economics.sh +311 -0
  302. package/payload/drift-kit/bin/trajectory.sh +242 -0
  303. package/payload/drift-kit/kpis/kpi-always-loaded.sh +39 -0
  304. package/payload/drift-kit/kpis/kpi-amendment-age.sh +33 -0
  305. package/payload/drift-kit/kpis/kpi-deferred-age.sh +44 -0
  306. package/payload/drift-kit/kpis/kpi-gate-backlog.sh +52 -0
  307. package/payload/drift-kit/kpis/kpi-gate-runtime.sh +31 -0
  308. package/payload/drift-kit/kpis/kpi-knowledge-friction.sh +21 -0
  309. package/payload/drift-kit/kpis/kpi-overhead.sh +44 -0
  310. package/payload/drift-kit/kpis/kpi-price-table-age.sh +68 -0
  311. package/payload/drift-kit/kpis/kpi-prompt-friction.sh +38 -0
  312. package/payload/drift-kit/kpis/kpi-settings-local.sh +21 -0
  313. package/payload/drift-kit/kpis/kpi-task-split.sh +43 -0
  314. package/payload/drift-kit/smoke/install.sh +348 -0
  315. package/payload/drift-kit/smoke/overhead-fixture.jsonl +4 -0
  316. package/payload/drift-kit/templates/close-knowledge.md +24 -0
  317. package/payload/drift-kit/templates/drift-config.sh +2 -0
  318. package/payload/drift-kit/templates/economics.md +45 -0
  319. package/payload/drift-kit/templates/kpi-deprecated-surface.sh +32 -0
  320. package/payload/drift-kit/templates/kpis.list +22 -0
  321. package/payload/drift-kit/templates/price-table.tsv +21 -0
  322. package/payload/evidence-kit/README.md +59 -0
  323. package/payload/evidence-kit/SPEC.md +261 -0
  324. package/payload/evidence-kit/bin/diff-baseline.sh +34 -0
  325. package/payload/evidence-kit/bin/run-validate.sh +82 -0
  326. package/payload/evidence-kit/checks/check-evidence-baseline.sh +103 -0
  327. package/payload/evidence-kit/checks/check-evidence-manifest.sh +104 -0
  328. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/TASK-QUEUE.md +3 -0
  329. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/args +2 -0
  330. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/expect.txt +1 -0
  331. package/payload/evidence-kit/gate-tests/check-evidence-baseline/bad/validate-baseline.txt +3 -0
  332. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/TASK-QUEUE.md +3 -0
  333. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/args +2 -0
  334. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/expect.txt +1 -0
  335. package/payload/evidence-kit/gate-tests/check-evidence-baseline/good/validate-baseline.txt +3 -0
  336. package/payload/evidence-kit/gate-tests/check-evidence-baseline.test.sh +84 -0
  337. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/TASK-QUEUE.md +1 -0
  338. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/WORKFLOW-STATE.txt +3 -0
  339. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/args +3 -0
  340. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/expect.txt +1 -0
  341. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/validate-evidence.txt +2 -0
  342. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/TASK-QUEUE.md +1 -0
  343. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/WORKFLOW-STATE.txt +3 -0
  344. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/args +3 -0
  345. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/expect.txt +1 -0
  346. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/validate-evidence.txt +2 -0
  347. package/payload/evidence-kit/gate-tests/check-evidence-manifest.test.sh +107 -0
  348. package/payload/evidence-kit/gate-tests/evidence-lib.test.sh +82 -0
  349. package/payload/evidence-kit/lib/evidence.sh +173 -0
  350. package/payload/evidence-kit/smoke/install.sh +45 -0
  351. package/payload/evidence-kit/smoke/violation.sh +8 -0
  352. package/payload/evidence-kit/templates/evidence-config.sh +2 -0
  353. package/payload/gate-sdk/README.md +124 -0
  354. package/payload/gate-sdk/SPEC.md +1861 -0
  355. package/payload/gate-sdk/bin/enforcement-map.sh +272 -0
  356. package/payload/gate-sdk/bin/gen-pre-commit.sh +267 -0
  357. package/payload/gate-sdk/bin/install-hooks.sh +48 -0
  358. package/payload/gate-sdk/bin/run-consumer-smoke.sh +112 -0
  359. package/payload/gate-sdk/bin/run-gate-tests.sh +128 -0
  360. package/payload/gate-sdk/bin/run-gates.sh +147 -0
  361. package/payload/gate-sdk/bin/upgrade-smoke.sh +163 -0
  362. package/payload/gate-sdk/checks/check-action-pinning.sh +55 -0
  363. package/payload/gate-sdk/checks/check-action-run-shell.sh +219 -0
  364. package/payload/gate-sdk/checks/check-assertion-strength.sh +134 -0
  365. package/payload/gate-sdk/checks/check-commit-msg.sh +50 -0
  366. package/payload/gate-sdk/checks/check-commit-subject.sh +43 -0
  367. package/payload/gate-sdk/checks/check-core-files.sh +52 -0
  368. package/payload/gate-sdk/checks/check-enforcement-fresh.sh +37 -0
  369. package/payload/gate-sdk/checks/check-exec-bit.sh +76 -0
  370. package/payload/gate-sdk/checks/check-gate-assertions.sh +123 -0
  371. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +106 -0
  372. package/payload/gate-sdk/checks/check-gate-fail-closed.sh +84 -0
  373. package/payload/gate-sdk/checks/check-gate-fixture-coverage.sh +92 -0
  374. package/payload/gate-sdk/checks/check-gate-output.sh +65 -0
  375. package/payload/gate-sdk/checks/check-graph.sh +632 -0
  376. package/payload/gate-sdk/checks/check-hook-exec-bit.sh +45 -0
  377. package/payload/gate-sdk/checks/check-identity.sh +134 -0
  378. package/payload/gate-sdk/checks/check-kit-enum.sh +94 -0
  379. package/payload/gate-sdk/checks/check-kit-registration.sh +68 -0
  380. package/payload/gate-sdk/checks/check-readme-roster.sh +102 -0
  381. package/payload/gate-sdk/checks/check-reads-couples.sh +148 -0
  382. package/payload/gate-sdk/checks/check-root-tiering.sh +66 -0
  383. package/payload/gate-sdk/checks/check-shellcheck.sh +55 -0
  384. package/payload/gate-sdk/checks/check-smoke-entry-guard.sh +53 -0
  385. package/payload/gate-sdk/checks/check-template-copy-parity.sh +126 -0
  386. package/payload/gate-sdk/checks/check-test-hermetic.sh +119 -0
  387. package/payload/gate-sdk/checks/check-tree-terms.sh +61 -0
  388. package/payload/gate-sdk/checks/check-workflow-tiering.sh +84 -0
  389. package/payload/gate-sdk/gate-tests/check-action-pinning/bad/args +1 -0
  390. package/payload/gate-sdk/gate-tests/check-action-pinning/bad/expect.txt +1 -0
  391. package/payload/gate-sdk/gate-tests/check-action-pinning/bad/tree/mutable.yml +11 -0
  392. package/payload/gate-sdk/gate-tests/check-action-pinning/bad/tree/nested/pinned.yml +5 -0
  393. package/payload/gate-sdk/gate-tests/check-action-pinning/good/args +1 -0
  394. package/payload/gate-sdk/gate-tests/check-action-pinning/good/expect.txt +1 -0
  395. package/payload/gate-sdk/gate-tests/check-action-pinning/good/tree/nested/deep.yml +5 -0
  396. package/payload/gate-sdk/gate-tests/check-action-pinning/good/tree/no-refs.yaml +8 -0
  397. package/payload/gate-sdk/gate-tests/check-action-pinning/good/tree/pinned.yml +10 -0
  398. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/args +3 -0
  399. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/expect.txt +1 -0
  400. package/payload/gate-sdk/gate-tests/check-action-run-shell/bad/tree/workflows/ci.yml +15 -0
  401. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/args +3 -0
  402. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/expect.txt +1 -0
  403. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/action.yml +14 -0
  404. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/not-actions.yml +16 -0
  405. package/payload/gate-sdk/gate-tests/check-action-run-shell/good/tree/workflows/ci.yml +106 -0
  406. package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +88 -0
  407. package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/args +3 -0
  408. package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/bin/verdict.sh +5 -0
  409. package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/expect.txt +1 -0
  410. package/payload/gate-sdk/gate-tests/check-assertion-strength/bad/smoke/install.sh +11 -0
  411. package/payload/gate-sdk/gate-tests/check-assertion-strength/good/args +3 -0
  412. package/payload/gate-sdk/gate-tests/check-assertion-strength/good/bin/verdict.sh +5 -0
  413. package/payload/gate-sdk/gate-tests/check-assertion-strength/good/expect.txt +1 -0
  414. package/payload/gate-sdk/gate-tests/check-assertion-strength/good/smoke/install.sh +16 -0
  415. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/args +2 -0
  416. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/expect.txt +1 -0
  417. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/msg.txt +5 -0
  418. package/payload/gate-sdk/gate-tests/check-commit-msg/bad/patterns.list +5 -0
  419. package/payload/gate-sdk/gate-tests/check-commit-msg/good/args +2 -0
  420. package/payload/gate-sdk/gate-tests/check-commit-msg/good/expect.txt +1 -0
  421. package/payload/gate-sdk/gate-tests/check-commit-msg/good/msg.txt +5 -0
  422. package/payload/gate-sdk/gate-tests/check-commit-msg/good/patterns.list +5 -0
  423. package/payload/gate-sdk/gate-tests/check-commit-subject/bad/args +2 -0
  424. package/payload/gate-sdk/gate-tests/check-commit-subject/bad/expect.txt +1 -0
  425. package/payload/gate-sdk/gate-tests/check-commit-subject/bad/msg.txt +4 -0
  426. package/payload/gate-sdk/gate-tests/check-commit-subject/good/args +2 -0
  427. package/payload/gate-sdk/gate-tests/check-commit-subject/good/expect.txt +1 -0
  428. package/payload/gate-sdk/gate-tests/check-commit-subject/good/msg.txt +5 -0
  429. package/payload/gate-sdk/gate-tests/check-commit-subject.test.sh +73 -0
  430. package/payload/gate-sdk/gate-tests/check-core-files/bad/args +1 -0
  431. package/payload/gate-sdk/gate-tests/check-core-files/bad/core-files.list +3 -0
  432. package/payload/gate-sdk/gate-tests/check-core-files/bad/expect.txt +1 -0
  433. package/payload/gate-sdk/gate-tests/check-core-files/bad/present.txt +1 -0
  434. package/payload/gate-sdk/gate-tests/check-core-files/good/args +1 -0
  435. package/payload/gate-sdk/gate-tests/check-core-files/good/core-files.list +5 -0
  436. package/payload/gate-sdk/gate-tests/check-core-files/good/expect.txt +1 -0
  437. package/payload/gate-sdk/gate-tests/check-core-files/good/nested/also-present.txt +1 -0
  438. package/payload/gate-sdk/gate-tests/check-core-files/good/present.txt +1 -0
  439. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/args +4 -0
  440. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/emit.txt +14 -0
  441. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/expect.txt +1 -0
  442. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/bad/projection.txt +7 -0
  443. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/args +4 -0
  444. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/emit.txt +14 -0
  445. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/expect.txt +1 -0
  446. package/payload/gate-sdk/gate-tests/check-enforcement-fresh/good/projection.txt +14 -0
  447. package/payload/gate-sdk/gate-tests/check-exec-bit/bad/args +1 -0
  448. package/payload/gate-sdk/gate-tests/check-exec-bit/bad/dump.txt +7 -0
  449. package/payload/gate-sdk/gate-tests/check-exec-bit/bad/expect.txt +1 -0
  450. package/payload/gate-sdk/gate-tests/check-exec-bit/good/args +1 -0
  451. package/payload/gate-sdk/gate-tests/check-exec-bit/good/dump.txt +7 -0
  452. package/payload/gate-sdk/gate-tests/check-exec-bit/good/expect.txt +1 -0
  453. package/payload/gate-sdk/gate-tests/check-exec-bit.test.sh +46 -0
  454. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/args +1 -0
  455. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/expect.txt +1 -0
  456. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/SPEC.md +13 -0
  457. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-baz.sh +13 -0
  458. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-foo.sh +10 -0
  459. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/args +1 -0
  460. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -0
  461. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/SPEC.md +20 -0
  462. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/check-baz.sh +12 -0
  463. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/check-foo.sh +9 -0
  464. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +9 -0
  465. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/args +1 -0
  466. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +1 -0
  467. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +11 -0
  468. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/TASK-QUEUE.md +9 -0
  469. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/args +1 -0
  470. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
  471. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/gates/check-sample.sh +11 -0
  472. package/payload/gate-sdk/gate-tests/check-gate-fail-closed/bad/args +1 -0
  473. package/payload/gate-sdk/gate-tests/check-gate-fail-closed/bad/expect.txt +1 -0
  474. package/payload/gate-sdk/gate-tests/check-gate-fail-closed/bad/gates/check-sample.sh +8 -0
  475. package/payload/gate-sdk/gate-tests/check-gate-fail-closed/good/args +1 -0
  476. package/payload/gate-sdk/gate-tests/check-gate-fail-closed/good/expect.txt +1 -0
  477. package/payload/gate-sdk/gate-tests/check-gate-fail-closed/good/gates/check-sample.sh +8 -0
  478. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/args +1 -0
  479. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/check-gamma.sh +4 -0
  480. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/expect.txt +1 -0
  481. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/gate-tests/check-alpha/bad/.keep +0 -0
  482. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/gate-tests/check-alpha/good/.keep +0 -0
  483. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/gates.list +4 -0
  484. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/args +1 -0
  485. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/check-beta.sh +5 -0
  486. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/expect.txt +1 -0
  487. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/gate-tests/check-alpha/bad/.keep +0 -0
  488. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/gate-tests/check-alpha/good/.keep +0 -0
  489. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/gates.list +5 -0
  490. package/payload/gate-sdk/gate-tests/check-gate-output/bad/args +1 -0
  491. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +4 -0
  492. package/payload/gate-sdk/gate-tests/check-gate-output/bad/expect.txt +1 -0
  493. package/payload/gate-sdk/gate-tests/check-gate-output/bad/gates.list +2 -0
  494. package/payload/gate-sdk/gate-tests/check-gate-output/good/args +1 -0
  495. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +9 -0
  496. package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
  497. package/payload/gate-sdk/gate-tests/check-gate-output/good/gates.list +3 -0
  498. package/payload/gate-sdk/gate-tests/check-graph/bad/SPEC-example-gate.md +12 -0
  499. package/payload/gate-sdk/gate-tests/check-graph/bad/args +1 -0
  500. package/payload/gate-sdk/gate-tests/check-graph/bad/expect.txt +1 -0
  501. package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-example-gate.md +20 -0
  502. package/payload/gate-sdk/gate-tests/check-graph/good/args +3 -0
  503. package/payload/gate-sdk/gate-tests/check-graph/good/expect.txt +1 -0
  504. package/payload/gate-sdk/gate-tests/check-graph-cap.test.sh +51 -0
  505. package/payload/gate-sdk/gate-tests/check-graph-refs.test.sh +55 -0
  506. package/payload/gate-sdk/gate-tests/check-graph-theme.test.sh +63 -0
  507. package/payload/gate-sdk/gate-tests/check-hook-exec-bit/bad/args +1 -0
  508. package/payload/gate-sdk/gate-tests/check-hook-exec-bit/bad/expect.txt +1 -0
  509. package/payload/gate-sdk/gate-tests/check-hook-exec-bit/bad/hooks/pre-commit +2 -0
  510. package/payload/gate-sdk/gate-tests/check-hook-exec-bit/good/args +1 -0
  511. package/payload/gate-sdk/gate-tests/check-hook-exec-bit/good/expect.txt +1 -0
  512. package/payload/gate-sdk/gate-tests/check-hook-exec-bit/good/hooks/pre-commit +2 -0
  513. package/payload/gate-sdk/gate-tests/check-identity/bad/args +1 -0
  514. package/payload/gate-sdk/gate-tests/check-identity/bad/expect.txt +1 -0
  515. package/payload/gate-sdk/gate-tests/check-identity/bad/git-config-email +1 -0
  516. package/payload/gate-sdk/gate-tests/check-identity/bad/git-remotes +2 -0
  517. package/payload/gate-sdk/gate-tests/check-identity/bad/identity.conf +4 -0
  518. package/payload/gate-sdk/gate-tests/check-identity/good/args +1 -0
  519. package/payload/gate-sdk/gate-tests/check-identity/good/expect.txt +1 -0
  520. package/payload/gate-sdk/gate-tests/check-identity/good/git-config-email +1 -0
  521. package/payload/gate-sdk/gate-tests/check-identity/good/git-remotes +3 -0
  522. package/payload/gate-sdk/gate-tests/check-identity/good/identity.conf +5 -0
  523. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/args +1 -0
  524. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/check-sample.sh +5 -0
  525. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/expect.txt +1 -0
  526. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/gates.list +4 -0
  527. package/payload/gate-sdk/gate-tests/check-kit-enum/good/args +1 -0
  528. package/payload/gate-sdk/gate-tests/check-kit-enum/good/check-sample.sh +5 -0
  529. package/payload/gate-sdk/gate-tests/check-kit-enum/good/expect.txt +1 -0
  530. package/payload/gate-sdk/gate-tests/check-kit-enum/good/gates.list +3 -0
  531. package/payload/gate-sdk/gate-tests/check-kit-registration/bad/args +4 -0
  532. package/payload/gate-sdk/gate-tests/check-kit-registration/bad/expect.txt +1 -0
  533. package/payload/gate-sdk/gate-tests/check-kit-registration/bad/registry-doc.md +20 -0
  534. package/payload/gate-sdk/gate-tests/check-kit-registration/good/args +5 -0
  535. package/payload/gate-sdk/gate-tests/check-kit-registration/good/expect.txt +1 -0
  536. package/payload/gate-sdk/gate-tests/check-kit-registration.test.sh +75 -0
  537. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/alpha-kit/README.md +14 -0
  538. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/alpha-kit/checks/check-alpha-one.sh +3 -0
  539. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/alpha-kit/checks/check-alpha-two.sh +3 -0
  540. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/args +4 -0
  541. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/expect.txt +1 -0
  542. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/gamma-kit/README.md +5 -0
  543. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/gamma-kit/checks/check-gamma-one.sh +3 -0
  544. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.sh +5 -0
  545. package/payload/gate-sdk/gate-tests/check-readme-roster/good/alpha-kit/README.md +16 -0
  546. package/payload/gate-sdk/gate-tests/check-readme-roster/good/alpha-kit/checks/check-alpha-one.sh +3 -0
  547. package/payload/gate-sdk/gate-tests/check-readme-roster/good/alpha-kit/checks/check-alpha-two.sh +3 -0
  548. package/payload/gate-sdk/gate-tests/check-readme-roster/good/args +6 -0
  549. package/payload/gate-sdk/gate-tests/check-readme-roster/good/beta-kit/smoke/install.sh +3 -0
  550. package/payload/gate-sdk/gate-tests/check-readme-roster/good/expect.txt +1 -0
  551. package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.sh +5 -0
  552. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/args +2 -0
  553. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/corpus/sub/deep.md +1 -0
  554. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/corpus/top.md +1 -0
  555. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/expect.txt +1 -0
  556. package/payload/gate-sdk/gate-tests/check-reads-couples/bad/sandbox-gate.sh +6 -0
  557. package/payload/gate-sdk/gate-tests/check-reads-couples/good/args +3 -0
  558. package/payload/gate-sdk/gate-tests/check-reads-couples/good/corpus/sub/deep.md +1 -0
  559. package/payload/gate-sdk/gate-tests/check-reads-couples/good/corpus/top.md +1 -0
  560. package/payload/gate-sdk/gate-tests/check-reads-couples/good/expect.txt +1 -0
  561. package/payload/gate-sdk/gate-tests/check-reads-couples/good/sandbox-gate.sh +8 -0
  562. package/payload/gate-sdk/gate-tests/check-root-tiering/bad/allow.list +1 -0
  563. package/payload/gate-sdk/gate-tests/check-root-tiering/bad/args +1 -0
  564. package/payload/gate-sdk/gate-tests/check-root-tiering/bad/expect.txt +1 -0
  565. package/payload/gate-sdk/gate-tests/check-root-tiering/bad/root/README.md +1 -0
  566. package/payload/gate-sdk/gate-tests/check-root-tiering/bad/root/stray.txt +1 -0
  567. package/payload/gate-sdk/gate-tests/check-root-tiering/good/allow.list +3 -0
  568. package/payload/gate-sdk/gate-tests/check-root-tiering/good/args +1 -0
  569. package/payload/gate-sdk/gate-tests/check-root-tiering/good/expect.txt +1 -0
  570. package/payload/gate-sdk/gate-tests/check-root-tiering/good/root/LICENSE +1 -0
  571. package/payload/gate-sdk/gate-tests/check-root-tiering/good/root/README.md +1 -0
  572. package/payload/gate-sdk/gate-tests/check-root-tiering/good/root/somedir/keep.txt +1 -0
  573. package/payload/gate-sdk/gate-tests/check-shellcheck/bad/args +1 -0
  574. package/payload/gate-sdk/gate-tests/check-shellcheck/bad/expect.txt +1 -0
  575. package/payload/gate-sdk/gate-tests/check-shellcheck/bad/warn.sh +5 -0
  576. package/payload/gate-sdk/gate-tests/check-shellcheck/good/args +1 -0
  577. package/payload/gate-sdk/gate-tests/check-shellcheck/good/expect.txt +1 -0
  578. package/payload/gate-sdk/gate-tests/check-shellcheck/good/ok.sh +4 -0
  579. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/alpha-kit/smoke/install.sh +4 -0
  580. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/alpha-kit/smoke/violation.sh +7 -0
  581. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/args +4 -0
  582. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/expect.txt +1 -0
  583. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/bad/scripts/gate-sdk-config.sh +5 -0
  584. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/install.sh +4 -0
  585. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/alpha-kit/smoke/violation.sh +4 -0
  586. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/args +6 -0
  587. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/beta-kit/smoke/install.sh +4 -0
  588. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/expect.txt +1 -0
  589. package/payload/gate-sdk/gate-tests/check-smoke-entry-guard/good/scripts/gate-sdk-config.sh +5 -0
  590. package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/args +9 -0
  591. package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/delegation-kit/templates/agent-budget-guard.sh +16 -0
  592. package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/expect.txt +1 -0
  593. package/payload/gate-sdk/gate-tests/check-template-copy-parity/bad/scripts/agent-budget-guard.sh +17 -0
  594. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/args +8 -0
  595. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/agent-budget-guard.sh +16 -0
  596. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/delegation-config.sh +3 -0
  597. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/delegation-kit/templates/usage-poller.sh +6 -0
  598. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/expect.txt +1 -0
  599. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/agent-budget-guard.sh +16 -0
  600. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/delegation-config.sh +4 -0
  601. package/payload/gate-sdk/gate-tests/check-test-hermetic/bad/args +3 -0
  602. package/payload/gate-sdk/gate-tests/check-test-hermetic/bad/expect.txt +1 -0
  603. package/payload/gate-sdk/gate-tests/check-test-hermetic/bad/leaky.test.sh +5 -0
  604. package/payload/gate-sdk/gate-tests/check-test-hermetic/good/args +3 -0
  605. package/payload/gate-sdk/gate-tests/check-test-hermetic/good/exempt.test.sh +4 -0
  606. package/payload/gate-sdk/gate-tests/check-test-hermetic/good/expect.txt +1 -0
  607. package/payload/gate-sdk/gate-tests/check-test-hermetic/good/sourced.test.sh +5 -0
  608. package/payload/gate-sdk/gate-tests/check-test-hermetic-smoke.test.sh +84 -0
  609. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/args +2 -0
  610. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +1 -0
  611. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/patterns.list +3 -0
  612. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/leak.txt +1 -0
  613. package/payload/gate-sdk/gate-tests/check-tree-terms/good/args +2 -0
  614. package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -0
  615. package/payload/gate-sdk/gate-tests/check-tree-terms/good/patterns.list +3 -0
  616. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/clean.txt +1 -0
  617. package/payload/gate-sdk/gate-tests/check-workflow-tiering/bad/.workflow/payload.txt +1 -0
  618. package/payload/gate-sdk/gate-tests/check-workflow-tiering/bad/.workflow/projection.txt +1 -0
  619. package/payload/gate-sdk/gate-tests/check-workflow-tiering/bad/expect.txt +1 -0
  620. package/payload/gate-sdk/gate-tests/check-workflow-tiering/good/.workflow/projection.txt +1 -0
  621. package/payload/gate-sdk/gate-tests/check-workflow-tiering/good/.workflow/wire.txt +1 -0
  622. package/payload/gate-sdk/gate-tests/check-workflow-tiering/good/expect.txt +1 -0
  623. package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +87 -0
  624. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +78 -0
  625. package/payload/gate-sdk/gate-tests/run-for-path.test.sh +77 -0
  626. package/payload/gate-sdk/lib/consumer-smoke.sh +32 -0
  627. package/payload/gate-sdk/lib/gate.sh +216 -0
  628. package/payload/gate-sdk/lib/inject.sh +35 -0
  629. package/payload/gate-sdk/lib/test-hermetic.sh +11 -0
  630. package/payload/gate-sdk/smoke/install.sh +84 -0
  631. package/payload/gate-sdk/smoke/violation.sh +13 -0
  632. package/payload/gate-sdk/templates/check-skeleton.sh +23 -0
  633. package/payload/gate-sdk/templates/gates-workflow.yml +55 -0
  634. package/payload/gate-sdk/templates/msg-patterns.list +21 -0
  635. package/payload/guard-kit/README.md +65 -0
  636. package/payload/guard-kit/SPEC.md +590 -0
  637. package/payload/guard-kit/bin/compare-settings-allow.sh +58 -0
  638. package/payload/guard-kit/bin/run-guard-tests.sh +86 -0
  639. package/payload/guard-kit/bin/scan-prompts.sh +166 -0
  640. package/payload/guard-kit/bin/scratch-run.sh +34 -0
  641. package/payload/guard-kit/gate-tests/scan-prompts.test.sh +70 -0
  642. package/payload/guard-kit/gate-tests/scratch-run.test.sh +62 -0
  643. package/payload/guard-kit/guard-tests/cases.tsv +117 -0
  644. package/payload/guard-kit/guard-tests/escalation-cases.tsv +13 -0
  645. package/payload/guard-kit/lib/guard.sh +448 -0
  646. package/payload/guard-kit/smoke/install.sh +26 -0
  647. package/payload/guard-kit/templates/bash-guard.sh +18 -0
  648. package/payload/guard-kit/templates/close-triage.md +31 -0
  649. package/payload/guard-kit/templates/escalation-guard.sh +27 -0
  650. package/payload/guard-kit/templates/guard-config.sh +2 -0
  651. package/payload/guard-kit/templates/settings-hooks.json +19 -0
  652. package/payload/guard-kit/templates/wakeup-guard.sh +20 -0
  653. package/payload/lifecycle-kit/README.md +106 -0
  654. package/payload/lifecycle-kit/SPEC.md +1469 -0
  655. package/payload/lifecycle-kit/bin/close-surfaces.sh +94 -0
  656. package/payload/lifecycle-kit/bin/enter-stage.sh +215 -0
  657. package/payload/lifecycle-kit/bin/file-gap.sh +43 -0
  658. package/payload/lifecycle-kit/bin/install-lifecycle.sh +36 -0
  659. package/payload/lifecycle-kit/bin/session-id.sh +75 -0
  660. package/payload/lifecycle-kit/checks/check-close-surfaces.sh +63 -0
  661. package/payload/lifecycle-kit/checks/check-lesson-disposition.sh +98 -0
  662. package/payload/lifecycle-kit/checks/check-lifecycle-registration.sh +54 -0
  663. package/payload/lifecycle-kit/checks/check-merge-attrs.sh +69 -0
  664. package/payload/lifecycle-kit/checks/check-shim-restatement.sh +97 -0
  665. package/payload/lifecycle-kit/checks/check-skill-binding.sh +59 -0
  666. package/payload/lifecycle-kit/checks/check-stage-entry.sh +197 -0
  667. package/payload/lifecycle-kit/checks/check-stage-evidence.sh +81 -0
  668. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.sh +47 -0
  669. package/payload/lifecycle-kit/gate-tests/boundary-scratch-wipe.test.sh +96 -0
  670. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/args +1 -0
  671. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/expect.txt +1 -0
  672. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/owners/inbox.md +5 -0
  673. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/bad/scripts/lifecycle-config.sh +4 -0
  674. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/args +1 -0
  675. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/expect.txt +1 -0
  676. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/owners/inbox.md +5 -0
  677. package/payload/lifecycle-kit/gate-tests/check-close-surfaces/good/scripts/lifecycle-config.sh +4 -0
  678. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +66 -0
  679. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/args +2 -0
  680. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/evidence.txt +2 -0
  681. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/expect.txt +1 -0
  682. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/queue-head.md +8 -0
  683. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/bad/queue-work.md +5 -0
  684. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/args +2 -0
  685. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/evidence.txt +3 -0
  686. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/expect.txt +1 -0
  687. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/queue-head.md +8 -0
  688. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition/good/queue-work.md +5 -0
  689. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +56 -0
  690. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/AGENT.md +11 -0
  691. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/args +1 -0
  692. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/bad/expect.txt +1 -0
  693. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/AGENT.md +11 -0
  694. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/args +1 -0
  695. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration/good/expect.txt +1 -0
  696. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +59 -0
  697. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +6 -0
  698. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/expect.txt +1 -0
  699. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +5 -0
  700. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/expect.txt +1 -0
  701. package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +113 -0
  702. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/args +2 -0
  703. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/commands/build.md +6 -0
  704. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/corpus.md +4 -0
  705. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/bad/expect.txt +1 -0
  706. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/args +2 -0
  707. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/commands/build.md +5 -0
  708. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/corpus.md +4 -0
  709. package/payload/lifecycle-kit/gate-tests/check-shim-restatement/good/expect.txt +1 -0
  710. package/payload/lifecycle-kit/gate-tests/check-shim-restatement.test.sh +80 -0
  711. package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/args +1 -0
  712. package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/commands/build.md +5 -0
  713. package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/expect.txt +1 -0
  714. package/payload/lifecycle-kit/gate-tests/check-skill-binding/bad/templates/build.md +7 -0
  715. package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/args +1 -0
  716. package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/commands/build.md +7 -0
  717. package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/expect.txt +1 -0
  718. package/payload/lifecycle-kit/gate-tests/check-skill-binding/good/templates/build.md +7 -0
  719. package/payload/lifecycle-kit/gate-tests/check-skill-binding.test.sh +84 -0
  720. package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/.workflow/WORKFLOW-STATE.txt +7 -0
  721. package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/TASK-QUEUE.md +13 -0
  722. package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/expect.txt +1 -0
  723. package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/.workflow/WORKFLOW-STATE.txt +7 -0
  724. package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/TASK-QUEUE.md +13 -0
  725. package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/expect.txt +1 -0
  726. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +251 -0
  727. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/.workflow/WORKFLOW-STATE.txt +6 -0
  728. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/TASK-QUEUE.md +13 -0
  729. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/expect.txt +1 -0
  730. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/.workflow/WORKFLOW-STATE.txt +6 -0
  731. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/TASK-QUEUE.md +13 -0
  732. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/expect.txt +1 -0
  733. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +115 -0
  734. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/args +1 -0
  735. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/align.md +2 -0
  736. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/build.md +2 -0
  737. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/scope.md +2 -0
  738. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/commands/validate.md +2 -0
  739. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/bad/expect.txt +1 -0
  740. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/args +1 -0
  741. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/align.md +2 -0
  742. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/build.md +2 -0
  743. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/close.md +2 -0
  744. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/scope.md +2 -0
  745. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/commands/validate.md +2 -0
  746. package/payload/lifecycle-kit/gate-tests/check-stage-skill-coverage/good/expect.txt +1 -0
  747. package/payload/lifecycle-kit/lib/stages.sh +179 -0
  748. package/payload/lifecycle-kit/smoke/install.sh +341 -0
  749. package/payload/lifecycle-kit/smoke/violation.sh +8 -0
  750. package/payload/lifecycle-kit/templates/lead.md +271 -0
  751. package/payload/lifecycle-kit/templates/lifecycle-config.sh +2 -0
  752. package/payload/lifecycle-kit/templates/skills/align.md +65 -0
  753. package/payload/lifecycle-kit/templates/skills/build.md +78 -0
  754. package/payload/lifecycle-kit/templates/skills/close.md +122 -0
  755. package/payload/lifecycle-kit/templates/skills/release-sweep.md +39 -0
  756. package/payload/lifecycle-kit/templates/skills/scope.md +112 -0
  757. package/payload/lifecycle-kit/templates/skills/spec.md +91 -0
  758. package/payload/lifecycle-kit/templates/skills/upgrade.md +41 -0
  759. package/payload/lifecycle-kit/templates/skills/validate.md +54 -0
  760. package/payload/queue-kit/README.md +62 -0
  761. package/payload/queue-kit/SPEC.md +366 -0
  762. package/payload/queue-kit/bin/lesson-sink.sh +28 -0
  763. package/payload/queue-kit/bin/queue-index.sh +131 -0
  764. package/payload/queue-kit/checks/check-queue-hygiene.sh +81 -0
  765. package/payload/queue-kit/checks/check-queue-prose-precondition.sh +63 -0
  766. package/payload/queue-kit/checks/check-queue-sections.sh +44 -0
  767. package/payload/queue-kit/checks/check-queue-slug-liveness.sh +63 -0
  768. package/payload/queue-kit/checks/check-queue-wrap.sh +56 -0
  769. package/payload/queue-kit/checks/check-tag-lead-line.sh +66 -0
  770. package/payload/queue-kit/checks/check-task-conservation.sh +50 -0
  771. package/payload/queue-kit/checks/check-task-names.sh +128 -0
  772. package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/TASK-QUEUE.md +17 -0
  773. package/payload/queue-kit/gate-tests/check-queue-hygiene/bad/expect.txt +1 -0
  774. package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +25 -0
  775. package/payload/queue-kit/gate-tests/check-queue-hygiene/good/expect.txt +1 -0
  776. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/TASK-QUEUE.md +15 -0
  777. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/bad/expect.txt +1 -0
  778. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/good/TASK-QUEUE.md +25 -0
  779. package/payload/queue-kit/gate-tests/check-queue-prose-precondition/good/expect.txt +1 -0
  780. package/payload/queue-kit/gate-tests/check-queue-sections/bad/TASK-QUEUE.md +13 -0
  781. package/payload/queue-kit/gate-tests/check-queue-sections/bad/expect.txt +1 -0
  782. package/payload/queue-kit/gate-tests/check-queue-sections/good/TASK-QUEUE.md +15 -0
  783. package/payload/queue-kit/gate-tests/check-queue-sections/good/expect.txt +1 -0
  784. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/TASK-QUEUE.md +17 -0
  785. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/docs/page.md +4 -0
  786. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/expect.txt +1 -0
  787. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/bad/scripts/queue-config.sh +3 -0
  788. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/TASK-QUEUE.md +19 -0
  789. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/docs/page.md +5 -0
  790. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/expect.txt +1 -0
  791. package/payload/queue-kit/gate-tests/check-queue-slug-liveness/good/scripts/queue-config.sh +3 -0
  792. package/payload/queue-kit/gate-tests/check-queue-wrap/bad/TASK-QUEUE.md +15 -0
  793. package/payload/queue-kit/gate-tests/check-queue-wrap/bad/expect.txt +1 -0
  794. package/payload/queue-kit/gate-tests/check-queue-wrap/good/TASK-QUEUE.md +25 -0
  795. package/payload/queue-kit/gate-tests/check-queue-wrap/good/expect.txt +1 -0
  796. package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/TASK-QUEUE.md +22 -0
  797. package/payload/queue-kit/gate-tests/check-tag-lead-line/bad/expect.txt +1 -0
  798. package/payload/queue-kit/gate-tests/check-tag-lead-line/good/TASK-QUEUE.md +29 -0
  799. package/payload/queue-kit/gate-tests/check-tag-lead-line/good/expect.txt +1 -0
  800. package/payload/queue-kit/gate-tests/check-task-names/bad/TASK-QUEUE.md +18 -0
  801. package/payload/queue-kit/gate-tests/check-task-names/bad/expect.txt +1 -0
  802. package/payload/queue-kit/gate-tests/check-task-names/good/TASK-QUEUE.md +25 -0
  803. package/payload/queue-kit/gate-tests/check-task-names/good/expect.txt +1 -0
  804. package/payload/queue-kit/gate-tests/queue-index.test.sh +118 -0
  805. package/payload/queue-kit/lib/queue.sh +107 -0
  806. package/payload/queue-kit/smoke/install.sh +21 -0
  807. package/payload/queue-kit/smoke/violation.sh +8 -0
  808. package/payload/queue-kit/templates/TASK-QUEUE.md +43 -0
  809. package/payload/queue-kit/templates/queue-config.sh +2 -0
  810. package/payload/site-kit/README.md +61 -0
  811. package/payload/site-kit/SPEC.md +263 -0
  812. package/payload/site-kit/checks/check-docs-cname-parity.sh +80 -0
  813. package/payload/site-kit/checks/check-docs-render-fidelity.sh +167 -0
  814. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/args +4 -0
  815. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/expect.txt +1 -0
  816. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/site-config.sh +7 -0
  817. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/tree/CNAME +1 -0
  818. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/tree/README.md +5 -0
  819. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/args +5 -0
  820. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/expect.txt +1 -0
  821. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/site-config.sh +7 -0
  822. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/CNAME +1 -0
  823. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/docs/posts/2026-01-01-legacy.md +4 -0
  824. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/index.md +4 -0
  825. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/tree/pkg/gate-tests/fixture.md +5 -0
  826. package/payload/site-kit/gate-tests/check-docs-render-fidelity/bad/args +8 -0
  827. package/payload/site-kit/gate-tests/check-docs-render-fidelity/bad/expect.txt +1 -0
  828. package/payload/site-kit/gate-tests/check-docs-render-fidelity/bad/tree/docs/install.md +38 -0
  829. package/payload/site-kit/gate-tests/check-docs-render-fidelity/good/args +6 -0
  830. package/payload/site-kit/gate-tests/check-docs-render-fidelity/good/expect.txt +1 -0
  831. package/payload/site-kit/gate-tests/check-docs-render-fidelity/good/tree/docs/install.md +35 -0
  832. package/payload/site-kit/gate-tests/check-docs-render-fidelity-foreign.test.sh +87 -0
  833. package/payload/site-kit/gate-tests/check-docs-render-fidelity-span.test.sh +80 -0
  834. package/payload/site-kit/gate-tests/check-docs-render-fidelity-table.test.sh +90 -0
  835. package/payload/site-kit/lib/site.sh +29 -0
  836. package/payload/site-kit/smoke/install.sh +26 -0
  837. package/payload/site-kit/smoke/violation.sh +20 -0
  838. package/payload/site-kit/templates/site-health.yml +164 -0
  839. package/profiles.list +53 -0
@@ -0,0 +1,1469 @@
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>
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
+ The header once carried a `[stage:]` field as well. It was a second copy of a
38
+ derivable fact — every stage entry already stamps its `<stage>` — bought at one
39
+ queue write per stage entry, and kept in sync only by an assertion that existed
40
+ for no other purpose. Deriving the cursor from the stamps retires the copy, the
41
+ write, and the assertion together (derivation-first). A consumer upgrading
42
+ mid-iteration needs no migration step: every header reader strips an optional
43
+ trailing bracketed field, so a residual `[stage:]` is inert and the next
44
+ iteration-boundary reset rewrites the header without it.
45
+
46
+ Both surfaces are **single-writer and branch-scoped**: an iteration owns exactly
47
+ one branch (its home branch) and every stamp lands there, so
48
+ concurrency between operators is git branch topology, not a multi-writer state
49
+ file. The integration branch is the degenerate single-operator home; a second
50
+ concurrent operator cuts a branch at their scope entry. The merge semantics that
51
+ make this safe — the iteration-scoped surfaces resolve to the arriving branch at
52
+ a merge — are §Multi-operator semantics.
53
+
54
+ The default motion is the linear stage walk; the gate-legal shapes for leaving
55
+ it — abandon, split, reopen — are specified in §Deviation transitions, not
56
+ improvised.
57
+
58
+ ### The stamp protocol
59
+
60
+ The **arriving** stage's skill *stamps* the evidence file as its first step —
61
+ and that stamp is the whole transition, because the last stamp is the cursor.
62
+ Nothing flips. The departing session writes nothing, so no uncommitted stage
63
+ line crosses the session boundary. The entry commit stages the evidence file,
64
+ so every state-coupled gate re-fires on it: the prior stage's
65
+ machine-expressible exit is re-verified *at the entry* (`check-stage-evidence`),
66
+ and `check-stage-entry` extends that one hop back. A self-asserted "stage
67
+ complete" marker would prove a claim, not completion — the kit deliberately
68
+ has none.
69
+
70
+ **What the entry re-fires, and what it does not.** The entry commit stages the
71
+ evidence file alone, so the gates coupled to it — `check-stage-entry`,
72
+ `check-stage-evidence`, `check-evidence-manifest`, `check-trajectory-fresh`,
73
+ and any gate globbing the workflow dir — re-fire at every entry exactly as
74
+ before. Queue-only-coupled gates do not: the queue is not written at an entry,
75
+ so their re-run would be a no-op on unchanged input, and each of
76
+ them couples some *other* input that fires it on the change it actually gates.
77
+ What is genuinely given up is the incidental *periodic sweep* — the guarantee
78
+ that those gates ran at least once per stage regardless of what changed, which
79
+ could catch drift introduced out of band (a `--no-verify` commit, an edit
80
+ outside every coupled glob). The full battery at the validate stage is the
81
+ surviving sweep and the stronger one: it runs every gate, not the
82
+ queue-coupled subset. The per-entry queue re-fire was a side effect of the flip,
83
+ never the designed sweep — an accepted, costed loss.
84
+
85
+ Mid-iteration the queue file is written only for real **work-state**
86
+ transitions: promotion and naming (the first stage), the Done move riding each
87
+ amendment-merge commit, and the closing dispositions. Stage motion never
88
+ touches it.
89
+
90
+ The **deterministic half** of that first step — read the iteration from the
91
+ header, read the id from `session-id.sh`, append the stamp — is mechanized by
92
+ `bin/enter-stage.sh <stage>`, the same
93
+ writer/asserter split as `gen-pre-commit.sh` ↔ `check-graph`: the skill
94
+ invokes it, **judgment stays in the skill** (what the stage means, its exit
95
+ condition, when to enter it at all), and the stage gates stay the independent
96
+ verifier. The tool takes no `--force` flag, so the compliant path is the easy
97
+ one — an operator who intends to override writes the stamp by hand, exactly
98
+ as before the tool existed. Committing the stamp remains the skill's
99
+ business — **never with `--no-verify`**: `enter-stage.sh` refuses to write
100
+ while `check-stage-entry` is red, so the hook a bypass skips is exactly the
101
+ battery that would confirm the stamp just written. A stage entry is never the
102
+ one-off-with-cause that a bypass is reserved for.
103
+
104
+ The first stage is the iteration boundary: `enter-stage.sh` *truncates* the
105
+ evidence file back to its header (git history is the permanent audit trail;
106
+ the gates only read the current iteration) and stamps under the
107
+ unnamed-iteration sentinel `—`, rewritten to the real name when the stage
108
+ names the iteration. Later stages only append.
109
+
110
+ **The no-cursor window.** Because the cursor is the last stamp, it has an empty
111
+ state the header never had — and one of its two shapes is reachable in normal
112
+ operation. The boundary truncation leaves the evidence file holding its prose
113
+ preamble and `---` with **no data line**, and the cursor is empty until the
114
+ boundary stamp lands milliseconds later; the second shape is an absent file
115
+ entirely (an unvendored or pre-upgrade consumer). Every reader of the cursor —
116
+ inside this kit and in every consuming kit that derives it — **states its own
117
+ behavior for that window** rather than inheriting whatever its parser happens
118
+ to emit. The shared derivation `lifecycle_current_stage` reports it as empty
119
+ with a *success* status, because "no cursor" is a legitimate state and not an
120
+ error; what it means is the caller's ruling, and each caller's is recorded in
121
+ its own section.
122
+
123
+ **Honest limit:** a stamp proves the stage skill was *invoked*, not that its
124
+ work was done faithfully — strictly better than skip-and-no-trace, but not
125
+ proof of done. The `<session-id>` field is **read, not hand-picked**:
126
+ `bin/session-id.sh` prints the canonical id by a fixed derivation order
127
+ (§bin/session-id.sh), which rotates per session (including across a context
128
+ clear), and the stage skills stamp exactly what it prints, so each stage's
129
+ provenance is observed, not guessed.
130
+ `check-stage-evidence`'s invocation floor keys on `<iteration> <stage>`; it
131
+ additionally reads the session id to enforce cross-stage distinctness under
132
+ the default `stage` posture (a stage entry must carry a fresh session; the
133
+ `iteration` posture of `LIFECYCLE_KIT_SESSION_BOUNDARY` relaxes exactly this —
134
+ see §check-stage-evidence).
135
+
136
+ **Same-stage re-entry (N sibling sessions per stage).** Entering the
137
+ currently-stamped stage from a *new* session is legal and appends a fresh
138
+ stamp: `enter-stage.sh`'s idempotence guard keys on the full
139
+ `(iteration, stage, session-id)` triple, so only the *same* session re-entering
140
+ is a no-op, and `check-stage-entry` assertion A keys on the *predecessor* stamp,
141
+ which the stage's first entry satisfied for every sibling. So N sessions may
142
+ enter one stage — a multi-session build, or a lead's intra-stage batch split
143
+ (§templates/lead.md) — serialized by the shared index/HEAD like any concurrent
144
+ sessions; each leaves its own stamp, so per-batch provenance rides the existing
145
+ stamp grammar with no new field. A sibling's entry simply appends another stamp
146
+ naming the same stage, which leaves the cursor where it already was — there is
147
+ no once-per-stage write left to make idempotent.
148
+
149
+ **The optional lead never becomes a second state source.** An iteration may run
150
+ with a live *lead* session (§templates/lead.md) that dispatches its stage
151
+ sessions and answers their escalations so a blocked stage resumes in place
152
+ rather than restarting. The lead writes no state: every stamp
153
+ originates in a stage session through `enter-stage.sh`, exactly as above, so the
154
+ stamp protocol stays the only iteration state and a lead crash costs
155
+ nothing the tracked surfaces do not already hold. The lead is a boundary skill,
156
+ not a stage — it stamps nothing and joins no stage set, so the coverage gate
157
+ never reads it (the release-sweep precedent, §templates/lead.md).
158
+
159
+ ### Deviation transitions
160
+
161
+ The stages walk `scope → align → build → validate → close` in order by
162
+ default; the gate-legal shapes for leaving that walk are specified here, not
163
+ improvised. Each composes mechanism the kit already owns — `enter-stage.sh`'s
164
+ boundary reset, canon-kit's amendment pairing, queue-kit's tag algebra — so
165
+ **no new tooling, state, stamp grammar, or tag is introduced**, and a
166
+ harness-less consumer keeps every shape. `check-stage-entry` and the stamp
167
+ protocol bar an ad-hoc abandon, which is why each hatch is spelled against the
168
+ existing gates.
169
+
170
+ **The demote ritual** is the shared step the other shapes compose. To take a
171
+ promoted entry out of a live iteration: move it back to the deferred queue
172
+ section restoring its design-pending tag, and delete its amendment file in the
173
+ same commit. Git history preserves the design — a later scope re-promotes by
174
+ resurrecting the file from history rather than re-deriving it. The enforcement
175
+ is already on the books: canon-kit's `check-amendment-queue` reds the commit on
176
+ a deferred entry that still carries a spec ref, or an orphaned amendment left on
177
+ disk. If the validate baseline carries a scenario keyed to the demoted entry,
178
+ that scenario is re-scoped or removed in the same commit — a coverage-honesty
179
+ obligation, not a gate one (`check-evidence-baseline`'s slug-liveness passes
180
+ regardless, since a demoted entry stays a live queue task).
181
+
182
+ **Abandon** ends an iteration without a close. Disposition every active entry
183
+ explicitly — demote it (ritual above) or carry it (it stays active with its
184
+ amendment and the next iteration adopts it); sink or delete every Lessons entry
185
+ under the existing disposition rules (the first-stage entry refuses a non-empty
186
+ Lessons section, so this is already forced). Then the next `enter-stage.sh
187
+ scope` *is* the abandon: scope has no mandatory predecessor, so the entry is
188
+ gate-legal from any stage, and the boundary reset drops the dead iteration's
189
+ stamps exactly as it drops a closed one's (git history is the permanent audit
190
+ trail — the existing boundary doctrine, not a new rule). The abandon commit's
191
+ subject names the abandoned iteration; no stamp grammar changes.
192
+
193
+ **Split mid-flight** narrows a live iteration. The iteration name never changes
194
+ once set — every stamp already written carries it, and a rename-in-place is
195
+ barred because it would orphan those stamps against `check-stage-evidence`'s
196
+ name-axis agreement — its staleness assertion reds every stamp whose iteration
197
+ is not the header's. So splitting is demotion: demote the split-out subset
198
+ via the ritual and drive the remaining queue through the remaining stages; the
199
+ subset re-promotes at a later scope under its own iteration.
200
+
201
+ **Reopen after close** is barred as an in-place edit. Stamps are append-only
202
+ within an iteration and scope is the only reset, so there is no gate-legal way
203
+ to continue a closed iteration's evidence file — and no history rewrite is
204
+ sanctioned to fake one (doctrine-kit rule 16 territory). The sanctioned shape
205
+ is a successor iteration: a post-close defect files as a debt entry and the
206
+ follow-up iteration proceeds normally; the closed iteration's record stays
207
+ immutable.
208
+
209
+ **The close-merge** is the concurrent-close shape, and like the others it
210
+ composes existing mechanism (the merge-supersede rule of §Multi-operator
211
+ semantics, not new tooling). Iteration boundaries serialize on the integration
212
+ branch: the closing operator reconciles *on their iteration branch* — merges the
213
+ integration branch in, where the `merge=iteration-scoped` driver resolves the
214
+ iteration-scoped surfaces to their own (arriving) side and humans resolve the
215
+ content conflicts — re-runs the full battery green, then lands
216
+ fast-forward-only on the integration branch. The integration branch never hosts
217
+ a conflict resolution, so "arriving iteration" is always well-defined (ours on
218
+ the iteration branch) and every merged tree passed the battery post-reconcile.
219
+
220
+ ## Layout and configuration
221
+
222
+ The kit is vendored beside gate-sdk (conventionally at `lifecycle-kit/`); its
223
+ gates are registered in the consumer's `gates.list` by name and resolve
224
+ through gate-sdk's multi-kit path (consumer gates dir first, then each kit's
225
+ `checks/`). Stage skills adopt `templates/skills/*.md` in one of two modes —
226
+ copied into the consumer's agent-skill directory with each named slot
227
+ overwritten, or a thin binding shim that references the template (the grammar
228
+ and the contract both modes satisfy are §templates/skills/).
229
+
230
+ The stage machine itself is config with this repo's lifecycle as the
231
+ default: copy `templates/lifecycle-config.sh` into the gates dir as
232
+ `lifecycle-config.sh` (or point `LIFECYCLE_KIT_CONFIG_FILE` elsewhere) and
233
+ set only what you override — this roster owns every knob and its default;
234
+ the template carries no second copy. The loader validates the machine
235
+ (unknown stages in the map, a waiver token colliding with a stage name, a
236
+ non-integer n-gram width, a malformed preflight entry) and exits 2 on a
237
+ malformed config — a broken machine must not gate anything.
238
+
239
+ Knob-rename compat precedent: before the first release tag a knob rename is
240
+ compat-free — no read-the-old-name shim, no deprecation window — because no
241
+ external consumer can have vendored the kit yet (the first tag is a
242
+ launch-comms prerequisite). From the first tag onward a rename owes the
243
+ queue-bound deprecation mechanism and a tightened-gates/release-note
244
+ declaration (the deprecation-lifecycle and upgrade-path rungs).
245
+
246
+ - `LIFECYCLE_KIT_STAGES` — the stage roster, in order; default
247
+ `(scope align build validate close)`.
248
+ - `LIFECYCLE_KIT_PREDECESSOR` — associative map stage → the predecessor whose
249
+ stamp `check-stage-entry` requires; default `([align]=scope [build]=scope
250
+ [validate]=build [close]=validate)` (`build` keys to `scope` because the
251
+ audit stage is trigger-gated; §check-stage-entry).
252
+ - `LIFECYCLE_KIT_FIRST_STAGE` — the stage whose entry is the iteration boundary
253
+ (§bin/enter-stage.sh truncation); default `scope`.
254
+ - `LIFECYCLE_KIT_DRAIN_STAGE` — the stage whose entry requires the active queue
255
+ sections empty; default `validate`; empty disables the drain assertion. Must
256
+ not be terminal: at least one `LIFECYCLE_KIT_PREDECESSOR` entry names it, or
257
+ config load fails (the drain-exempt backstop; §check-stage-entry).
258
+ - `LIFECYCLE_KIT_ACTIVE_SECTIONS` — the queue sections the drain assertion
259
+ reads; default `("New Features" "Technical Debt")`. Independent of
260
+ canon-kit's `CANON_KIT_ACTIVE_SECTIONS` (read by `check-amendment-queue`'s
261
+ misfiled-spec-ready clause) though their defaults coincide — a consumer
262
+ retargeting one alone splits the drain assertion's view from
263
+ `check-amendment-queue`'s, with no gate to notice. A known, accepted
264
+ coupling: kit independence outranks unifying the knob.
265
+ - `LIFECYCLE_KIT_AUDIT_STAGE` — the trigger-gated audit stage assertion C looks
266
+ for; default `align`; empty disables the audit machinery entirely.
267
+ - `LIFECYCLE_KIT_AUDIT_ENTRY_STAGE` — the stage whose entry assertion C blocks
268
+ on a cross-component signal with no audit stamp; default `build` when an
269
+ audit stage is set, else empty.
270
+ - `LIFECYCLE_KIT_WAIVER_TOKEN` — the stamp token recording the user's explicit
271
+ audit waiver; default `<audit-stage>-waived`; must not collide with a
272
+ stage name.
273
+ - `LIFECYCLE_KIT_AMENDMENT_GLOB` / `LIFECYCLE_KIT_ROSTER_BASENAME` — the amendment
274
+ filename shape and the canonical-spec basename assertion C scans
275
+ (template dirs pruned); defaults `SPEC-*.md` / `SPEC.md`.
276
+ - `LIFECYCLE_KIT_CONTRACT_TOKENS` — the amendment-body substrings assertion C
277
+ reads as a cross-component contract signal; default `("SPEC.md" "proto/")`.
278
+ - `LIFECYCLE_KIT_SKILLS_DIR` — the agent-skill directory
279
+ `check-stage-skill-coverage` scans; default `.claude/commands`.
280
+ - `LIFECYCLE_KIT_AGENT_FILE` — the always-loaded agent file
281
+ `bin/install-lifecycle.sh` writes the registration block into and
282
+ `check-lifecycle-registration` reads it back from; default `CLAUDE.md`
283
+ (the `DOCTRINE_KIT_AGENT_FILE` sibling).
284
+ - `LIFECYCLE_KIT_QUEUE_FILE` / `LIFECYCLE_KIT_STATE_FILE` — the governed header and
285
+ stamp files, defaulting through gate-sdk's `GATE_SDK_QUEUE_FILE` /
286
+ `GATE_SDK_WORKFLOW_DIR`.
287
+ - `LIFECYCLE_KIT_SESSION_ID` — the harness-neutral stamp-id override, source 1
288
+ of the derivation order (§bin/session-id.sh); default unset.
289
+ - `LIFECYCLE_KIT_SESSION_BOUNDARY` — `stage` or `iteration`; default `stage`.
290
+ The knob lives on the session-span/evidence axis only (ruled; no role
291
+ values): manual-versus-lead is the driver/role axis and rides context-kit's
292
+ session-role signal, never this knob.
293
+ The consumer's session-boundary posture: at `stage`, distinct stages of
294
+ one iteration may not share a session id (§check-stage-evidence); at
295
+ `iteration`, that cross-stage distinctness check alone is skipped —
296
+ attribution still rides the stamps, and every other assertion holds. The
297
+ loader validates the value alongside its machine checks and exits 2 on
298
+ anything else. `enter-stage.sh` does not read it — stamping is
299
+ posture-independent; `templates/lead.md` consumes it as the inline-run
300
+ posture prose.
301
+ - `LIFECYCLE_KIT_LESSON_EVIDENCE_FILE` — the kit-owned lesson-disposition stamp
302
+ file; default `${GATE_SDK_WORKFLOW_DIR:-.workflow}/lesson-evidence.txt`,
303
+ read by `check-lesson-disposition` and the boundary-reset built-in.
304
+ - `LIFECYCLE_KIT_GAP_INBOX_FILE` — the committed append-only gap inbox
305
+ (§The committed gap inbox); default
306
+ `${GATE_SDK_WORKFLOW_DIR:-.workflow}/gap-inbox.md`, written by `bin/file-gap.sh`,
307
+ its `merge=union` attribute verified by `check-merge-attrs`, drained by the
308
+ close skill and read for emptiness by `bin/enter-stage.sh`'s boundary refusal.
309
+ - `LIFECYCLE_KIT_CLOSE_SURFACE_GLOBS` — the consumer's `close-surface:`
310
+ declaration surfaces beyond the resolved kit roots (§The close-surface
311
+ roster); default `*/SPEC.md`. It deliberately does **not** default to
312
+ `CANON_KIT_MANIFEST_FILES`: reading another kit's knob would make lifecycle-kit
313
+ depend on canon-kit's configuration for a value the consumer already owns, and
314
+ the one cross-kit knob read in the tree today is precedent, not a ruling. The
315
+ declaration vocabulary is kit-owned and carries no consumer content; the roster
316
+ is derived, never a kit literal — a kit shipping the *names* of a consumer's
317
+ inbound surfaces would publish that consumer's private workflow.
318
+ - `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` — extra files reset to their header at the
319
+ iteration boundary; default empty.
320
+ - `LIFECYCLE_KIT_BOUNDARY_PRESERVE` — keep-list of scratch-dir **basenames** the
321
+ iteration-boundary wipe spares (§bin/enter-stage.sh); default empty, so an
322
+ unset-knob consumer gets a clean wipe of an already-disposable surface.
323
+ Boundary-only, and paired with the scratch dir it reads (`GATE_SDK_TMP_DIR`)
324
+ rather than adding a directory knob of its own. **The tier split matters:** the
325
+ `.gitkeep` exemption is a kit invariant this knob cannot unset, and `PRESERVE`
326
+ is the consumer keep-list layered on top — a reader who takes the knob for the
327
+ wipe's only keep rule would reintroduce the tracked-file deletion.
328
+ - `LIFECYCLE_KIT_BOUNDARY_REQUIRE` — array of repo-relative files each of which
329
+ must carry a data line naming the closing iteration before the iteration
330
+ boundary may be crossed (§bin/enter-stage.sh); a missing member is a
331
+ fail-closed refusal; default empty (an unconfigured consumer sees no change).
332
+ - `LIFECYCLE_KIT_ENTRY_PREFLIGHT` — per-stage `<stage>=<command>` entries run
333
+ alongside the built-in pre-flight (§bin/enter-stage.sh); default empty.
334
+ - `LIFECYCLE_KIT_SHIM_NGRAM` — the shared-n-gram width `check-shim-restatement`
335
+ trips at (positive integer; §check-shim-restatement); default `9`.
336
+ - `LIFECYCLE_KIT_SHIM_DEDUP_CORPUS` — that gate's corpus file list; default
337
+ empty for the computed `CLAUDE.md`-plus-kit-templates default.
338
+
339
+ `.gitattributes` (repo root) is a consumer surface the kit writes but adds **no
340
+ knob** for: the `merge=iteration-scoped` supersede set derives from the existing
341
+ boundary-truncate knobs (`LIFECYCLE_KIT_STATE_FILE`,
342
+ `LIFECYCLE_KIT_LESSON_EVIDENCE_FILE`, and each `LIFECYCLE_KIT_BOUNDARY_TRUNCATE`
343
+ member), so a reshaped truncate set flows into the attribute block by
344
+ construction — §Multi-operator semantics, §bin/install-lifecycle.sh.
345
+
346
+ ## Multi-operator semantics
347
+
348
+ The contributor altitude of the coordination map: a second operator running
349
+ their own concurrent iteration on the same repo. The two narrower altitudes are
350
+ ruled elsewhere and stay untouched — sub-agents within one session
351
+ (delegation-kit's serialize-or-worktree rules) and sessions within one iteration
352
+ (§templates/lead.md: one live iteration, stages serialized through the stamp
353
+ protocol). Fork contributors are out of scope: an outside PR never stamps
354
+ state — it only passes the battery in CI.
355
+
356
+ **The topology ruling — state surfaces stay single-writer; concurrency is git
357
+ topology.** The header line, the evidence file, and every boundary-truncated
358
+ surface are *iteration-scoped*: an iteration owns exactly one branch (its home
359
+ branch), and every stamp lands there. One live iteration per branch —
360
+ the second concurrent operator cuts a branch at their scope entry; the
361
+ integration branch is the degenerate single-operator home, which is why a
362
+ single-operator repo's own dogfood changes nothing. Branch naming is prose
363
+ guidance (name the branch after the iteration), not mechanism — no knob, no
364
+ gate. Ruled out, each because it composes worse than git already does: per-operator
365
+ state files or stamp-attribution fields (multi-writer surfaces and a new stamp
366
+ grammar — operator attribution already rides the git author on every stamp
367
+ commit); a lock or lease on the integration branch (state the kit refuses to
368
+ own, where git already provides the isolation).
369
+
370
+ **The merge-supersede rule.** At any branch merge, the iteration-scoped surfaces
371
+ resolve wholesale to the *arriving* (checked-out) iteration's version — the other
372
+ side's content is per-iteration scratch the boundary doctrine already declares
373
+ dead (git history is the permanent audit trail). The supersede set is **derived,
374
+ never maintained**: it is exactly what `bin/enter-stage.sh` truncates at the
375
+ iteration boundary — `LIFECYCLE_KIT_STATE_FILE`,
376
+ `LIFECYCLE_KIT_LESSON_EVIDENCE_FILE`, and the `LIFECYCLE_KIT_BOUNDARY_TRUNCATE`
377
+ members — rendered by `lifecycle_supersede_set` (§lib/stages.sh). The queue file
378
+ is deliberately *not* in the set: its body (backlog sections, lessons) is shared
379
+ content that merges like any prose, and only its header line is iteration-scoped
380
+ — resolved by hand to the arriving iteration, with a wrong resolution going red
381
+ at the next commit because `check-stage-evidence` requires the header's name to
382
+ agree with every stamp's, and the state file already took the arriving side by
383
+ driver. Contention on the queue is lower than it reads: since the cursor left
384
+ the header, **stage motion writes no queue at all**, so the file changes only on
385
+ real work-state transitions (promotion and naming, a Done move, the closing
386
+ dispositions) rather than once per stage entry per operator.
387
+ Held-constant baselines and append-across-iterations evidence keep normal merge
388
+ semantics: their conflicts are real disagreements. The kit owns exactly one
389
+ `union`-driver surface — the committed gap inbox (§The committed gap inbox),
390
+ whose append-only bullets must survive a concurrent merge rather than supersede
391
+ — rendered into the attribute block beside the supersede set and verified by the
392
+ same gate; a consumer with its own *tracked* shared append log points it at git's
393
+ built-in `union` driver the same way — sanctioned shape, git-native. (Gitignored
394
+ per-checkout scratch — friction logs — never merges and needs no rule.)
395
+
396
+ **`.gitattributes` — the rule mechanized.** Each supersede-set path carries
397
+ `merge=iteration-scoped`; the driver definition (`git config
398
+ merge.iteration-scoped.driver true` — keep ours) is per-clone config installed by
399
+ `bin/install-lifecycle.sh` beside its registration block (the `install-hooks.sh`
400
+ opt-in class). Honest limit: on a clone without the driver installed the
401
+ attribute is inert and the file conflicts normally — the rule above then governs
402
+ the hand resolution, so the uninstalled path degrades to judgment, never to
403
+ silence. Writer/asserter split: the installer emits the attribute block
404
+ (marker-bounded, `lib/inject.sh`), `check-merge-attrs` verifies it — the
405
+ `gen-pre-commit.sh` ↔ `check-graph` precedent.
406
+
407
+ **Who may stamp, at this altitude.** Unchanged: the arriving stage session
408
+ stamps,
409
+ and only on its own iteration's home branch. A session never stamps a branch whose
410
+ iteration it is not driving; cross-iteration discoveries (a lesson, a deferred
411
+ filing) land on the discoverer's own branch and reconcile at merge.
412
+
413
+ **Causal-completeness core: no new state surface.** The design adds no stamp
414
+ grammar, no queue tag, no evidence file. Every existing producer/consumer pair
415
+ (`enter-stage.sh`, the stage gates, the drift report) keeps working per-branch
416
+ unmodified. The two added surfaces each have a named reader at a named
417
+ transition: the `merge=iteration-scoped` lines are read by git's merge machinery
418
+ at a merge and by `check-merge-attrs` at pre-commit; the `merge.iteration-scoped`
419
+ driver config is read by git's merge machinery when an attributed path needs a
420
+ three-way merge (not readable by a pre-commit gate — per-clone state, its absence
421
+ the recorded honest limit above). The close-merge protocol (§Deviation
422
+ transitions) is produced by the closing operator's close session and consumed by
423
+ the integration branch's battery — the reconcile commit re-fires every
424
+ queue/state-coupled gate, which is what makes the header hand-resolution
425
+ enforceable.
426
+
427
+ ## The committed gap inbox
428
+
429
+ Mid-iteration work-state writes race the stage session holding the shared git
430
+ index: a gap surfaced mid-stage has no committed place to land except the queue
431
+ file that stage session is already contending on. So mid-iteration gap *filing*
432
+ gets a committed, append-only channel of its own — distinct from the
433
+ knowledge-friction log, which stays the narrow sensor for a fact re-derived
434
+ because no doc owns it (drift-kit/SPEC.md §The knowledge-friction loop): a
435
+ *work-shaped* finding (a gap, a task, a defect) is backlog, not knowledge
436
+ friction, and routes here.
437
+
438
+ **The surface.** `.workflow/gap-inbox.md` (knob `LIFECYCLE_KIT_GAP_INBOX_FILE`,
439
+ §Layout and configuration) is a committed, append-only capture buffer. Grammar:
440
+ a `# contract:` prose header, then one `- <YYYY-MM-DD> — <gap prose>` bullet per
441
+ gap. Committed, not gitignored — a per-clone buffer fragments the backlog across
442
+ operators, the finding that rules the gitignored friction log out as the channel.
443
+
444
+ **The affordance.** `bin/file-gap.sh "<gap prose>"` (the `bin/kfric.sh` pattern:
445
+ repo-root cd, config-via-env, exit 2 on an empty argument) appends one dated
446
+ bullet, seeding the contract header when the inbox does not yet exist. It is
447
+ advisory tooling, not a gate — no fixture pair is owed; the raw append (a bullet
448
+ line into the inbox) stays a legal fallback, the grammar being the surface's
449
+ contract, not the writer.
450
+
451
+ It also **warns at the point of capture**, reading the cursor
452
+ (`lifecycle_current_stage`) to say which consequence the filer is buying: an
453
+ ordinary filing is told the bullet blocks the next first-stage entry until the
454
+ drain, and a filing made while the cursor sits at the **last configured stage**
455
+ is told that once that stage finishes, none is left to drain it. The warning
456
+ goes to stderr so the stamped bullet stays the tool's stdout contract. It is a
457
+ warning and not a refusal deliberately: refusing capture does not dissolve a
458
+ real finding, it pushes it back into session context — the deferred-capture
459
+ antipattern this inbox exists to prevent.
460
+
461
+ **Merge semantics.** The inbox carries `merge=union` (git-native, so no per-clone
462
+ driver registration), not the keep-ours `merge=iteration-scoped` the
463
+ boundary-truncated surfaces carry: an iteration-scoped surface is per-iteration
464
+ scratch superseded at the boundary, but a gap filed on either side of a
465
+ concurrent merge must survive. The installer emits the line and
466
+ `check-merge-attrs` verifies it (§bin/install-lifecycle.sh, §check-merge-attrs).
467
+
468
+ **The boundary refusal.** `bin/enter-stage.sh`'s first-stage (iteration-boundary)
469
+ entry refuses while the inbox holds bullets (exit 1, the untriaged bullets
470
+ printed, nothing written — the same refusal contract as the non-empty Lessons
471
+ section), so no gap outlives its iteration untriaged (the gap-disposition rule:
472
+ costed and filed, never flagged-and-skipped).
473
+
474
+ The refusal names **two** recoveries, because the drain and the filing window do
475
+ not coincide. A bullet filed *during* the iteration is drained by the closing
476
+ stage, and the refusal points there. A bullet filed *after* that stage has run
477
+ has no drainer left in the machine — the detection is still right, and what
478
+ would fail is a message describing a stage that is not coming back — so the
479
+ refusal also tells the entering session to disposition the bullets itself:
480
+ promote each directly to the deferred queue (or fix it), truncate the inbox,
481
+ commit, re-run. Deleting a bullet without a disposition is not a drain. No
482
+ second detector is added for the post-close window: the existing refusal already
483
+ detects it, and what was missing was the message's actionability.
484
+
485
+ That refusal is the inbox's
486
+ forcing function, so the inbox declares itself on the close-surface roster
487
+ (§The close-surface roster) here, where the forcing function is documented:
488
+
489
+ close-surface: .workflow/gap-inbox.md forced=lifecycle-kit/SPEC.md §bin/enter-stage.sh
490
+
491
+ **Producers and consumers.** Producer: any mid-iteration session (lead or stage)
492
+ via `bin/file-gap.sh` — the knob default makes the channel live everywhere the
493
+ kit is vendored. Consumers: the close skill's drain step (§templates/skills/)
494
+ dispositions every bullet — promoted to a deferred `[needs-spec]` queue entry,
495
+ fixed inline that session, or discarded with cause in the close commit message —
496
+ then truncates the inbox to its header; the boundary refusal reads emptiness at
497
+ the next scope entry as the backstop. Each bullet's two fields have named
498
+ readers: the date feeds close's staleness judgment, the prose is the disposition
499
+ body.
500
+
501
+ ## The close-surface roster
502
+
503
+ Close reads a set of **inbound triage surfaces** — capture logs, harvest sinks,
504
+ the gap inbox, the queue's Lessons section. Enumerated only as prose, that set
505
+ has no closure: a surface close never reads leaves no trace anywhere, and a
506
+ sixth inbox added without being named costs nothing at the moment of the mistake
507
+ and everything afterwards. The roster replaces the enumeration with a
508
+ derivation, and gives each surface a mode so a skip is a *visible* judgment
509
+ rather than an invisible omission.
510
+
511
+ **The declaration.** A surface declares itself in the section that already owns
512
+ it — one full-line directive, the same shape and altitude as canon-kit's `spec:`
513
+ and `contract:` directives (the derivation skips fenced blocks, so the grammar
514
+ is quotable where it is specified — `check-spec-pointer`'s carve-out, for the
515
+ same reason):
516
+
517
+ ```
518
+ close-surface: <path> <mode> [reclaim=<command>]
519
+ ```
520
+
521
+ - `<path>` — repo-relative, or a `<file>#<section>` locator when the surface is
522
+ a section of a larger file; the fragment is the heading in anchor form (spaces
523
+ as `-`), since `<path>` is the line's first whitespace-delimited token.
524
+ - `<mode>` — exactly one of:
525
+ - `forced=<owner-path> §<section>` — a structural forcing function exists and
526
+ the citation names it. The gap inbox's is the iteration-boundary entry
527
+ refusal; the Lessons section's is that refusal's sibling assertion.
528
+ - `advisory` — no forcing function. Close reads it by procedure, and a skip is
529
+ **sanctioned and visible** rather than undetected. An advisory surface is not
530
+ a lesser surface; it is one whose skip is a judgment someone may audit.
531
+ - `reclaim=<command>` — required when `<path>` is a capture-tier (gitignored)
532
+ member, naming the drain that empties it. It runs to end of line, so it is
533
+ written last. The runtime-artifact lifecycle rule already demands a paired
534
+ reclaim path for every write path; this is where that pairing becomes
535
+ machine-readable.
536
+
537
+ Declaration lives with the owner, never in a central list: a central list is a
538
+ second source that drifts from the surface it names, and the one-owner rule puts
539
+ the fact where the surface is defined.
540
+
541
+ A `forced=` declaration belongs on a **manifest surface**, and that is
542
+ load-bearing rather than incidental — it is what gives the citation its
543
+ resolver. `check-spec-pointer`'s prose-citation pass sweeps the manifest set for
544
+ a free-prose `<path>.md §<heading>` citation and resolves it in prefix mode; a
545
+ `forced=` citation *is* that shape, so it resolves today with no new code. The
546
+ restriction binds `forced=` only, not the directive as such: an `advisory`
547
+ declaration carries no citation and so needs no resolver, which is what lets a
548
+ consumer-owned capture surface declare itself in the binding that owns it
549
+ (a stage-skill binding is not a manifest surface). The honest limit follows from
550
+ the same seam — a `forced=` declaration authored outside the manifest set would
551
+ carry an unresolved citation, and no gate here catches that, because the
552
+ resolver is canon-kit's and lifecycle-kit does not depend on canon-kit.
553
+
554
+ **The derivation** is `bin/close-surfaces.sh`, never a maintained registry. Two
555
+ sources, unioned: every `close-surface:` declaration across the resolved kit
556
+ roots and the consumer's configured declaration surfaces; and every **gitignored
557
+ member of the workflow directory** — capture-tier by definition (gate-sdk/SPEC.md
558
+ §The workflow directory), therefore close-inbound by definition. The second
559
+ source is the closure that makes the roster fail loudly: a capture surface added
560
+ with no declaration appears as `(undeclared)` rather than not appearing at all.
561
+ The roster reports the hole instead of inheriting it, which is the whole
562
+ difference between a derived roster and a maintained one.
563
+
564
+ **Ruled out: shrinking the roster by merging the two capture logs.** The obvious
565
+ way to make close's inbox count smaller is to merge the two friction capture logs
566
+ behind one file with a type column. It is ruled out, on this roster's own
567
+ evidence:
568
+
569
+ - The logs are owned by **different kits**, and the dependency runs one way only
570
+ — the drift-kit KPI already reaches into guard-kit through the shared kit-root
571
+ resolution, so guard-kit cannot depend back without a cycle. A merged log has
572
+ no legal owner short of the base gate framework, which is not a friction sink.
573
+ - Their producers are not the same kind of act: one is a **harness hook
574
+ fallthrough** writing raw command text at the moment of a prompt, undated and
575
+ ungrammared; the other is a **deliberate structured capture**. A type column
576
+ would not unify them, it would document that they were never one stream.
577
+ - Their consumers are disjoint — allowlist-filtering and pattern-ranking on one
578
+ side, doc-owner remediation on the other. Every consumer would filter by type
579
+ first, re-deriving the two logs at read time, which is the tell that the merge
580
+ moves the split rather than removing it.
581
+ - Their reclaim moments are independent whole-file truncations. Sharing one file
582
+ makes each sweep's drain erase the other type's untriaged lines.
583
+
584
+ The complaint the merge reached for is real — the two frictions compete for one
585
+ triage attention and were ranked against each other by nothing — and the roster
586
+ answers it directly: both appear on one derived roster, with modes, which is what
587
+ "ranked against each other" needs. Merging the files was the proxy, not the thing.
588
+
589
+ ## Per-component contracts
590
+
591
+ ### lib/stages.sh
592
+
593
+ The sourced config loader: consumer config first, defaults fill what it left
594
+ unset (an explicitly empty value disables a knob where the contract says so),
595
+ then validation. Also owns the shared state adapters
596
+ (`lifecycle_header`, `lifecycle_header_iter`, `lifecycle_current_stage`,
597
+ `lifecycle_stage_known`) — both gates must read the two axes identically, and
598
+ a shared adapter removes that drift axis.
599
+
600
+ `lifecycle_current_stage <state-file>` is the **cursor derivation**: the last
601
+ data line's `<stage>` token, the read `bin/enter-stage.sh` already performed
602
+ inline, hoisted so every lifecycle reader shares one definition of "current
603
+ stage". It prints empty and returns *success* for both no-cursor shapes (§The
604
+ state machine) — an absent file and a file with no data line — because "no
605
+ cursor" is a legitimate state rather than a parse failure; its two callers
606
+ each rule on what it means for them (§check-stage-entry, §check-stage-evidence).
607
+ `lifecycle_header_iter` keeps stripping an optional trailing bracketed field:
608
+ that strip is now **residual-field healing**, letting a pre-upgrade header
609
+ still carrying `[stage:]` read as the bare iteration name. The cross-kit
610
+ readers deliberately do *not* call this helper — each derives the cursor
611
+ itself from a path it already configures, so no consumer kit gains a
612
+ lifecycle-kit dependency.
613
+
614
+ The loader also owns `lifecycle_registration_block`,
615
+ which renders the resident registration block (§bin/install-lifecycle.sh) from the
616
+ live config so `bin/install-lifecycle.sh` and `check-lifecycle-registration`
617
+ derive one text and cannot drift. Three more renderers follow the same
618
+ writer/asserter shape for the merge-attribute surface: `lifecycle_supersede_set`
619
+ prints the derived iteration-scoped supersede set (the state file, the kit-owned
620
+ lesson-evidence file, and each `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` member — exactly
621
+ what `bin/enter-stage.sh` truncates at the boundary); `lifecycle_union_set`
622
+ prints the derived union-merge set (the gap inbox — §The committed gap inbox);
623
+ and `lifecycle_merge_attrs_block` renders the supersede set as
624
+ `<path> merge=iteration-scoped` lines and the union set as `<path> merge=union`
625
+ lines, so `bin/install-lifecycle.sh` (writer) and `check-merge-attrs` (asserter)
626
+ read one set (§Multi-operator semantics). Values and adapters only, never
627
+ gate structure (gate-sdk's `lib/gate.sh` rule).
628
+
629
+ ### bin/session-id.sh
630
+
631
+ Prints the canonical stamp id so a stage skill reads it rather than guessing.
632
+ The id derives by a fixed source order, first hit wins, every source ending in
633
+ the same normalization — strip a leading `agent-` token if present, then take
634
+ the first 8 characters:
635
+
636
+ 1. `LIFECYCLE_KIT_SESSION_ID` — a harness-neutral consumer override: a consumer
637
+ whose harness exposes a session identity by any means wires it here.
638
+ 2. `CLAUDE_CODE_SESSION_ID` — the shipped default source, harness-specific by
639
+ nature: this harness exports the current session's transcript uuid into every
640
+ Bash environment, identifying the session directly rather than inferring it
641
+ from file mtimes. Taken directly here only when `CLAUDE_CODE_CHILD_SESSION`
642
+ is unset; when the flag is set a lead-dispatched stage session
643
+ (§templates/lead.md) may see the *lead's* uuid here, so source 3 verifies
644
+ the flag before trusting it and can route back to this uuid.
645
+ 3. The newest transcript under the sessions dir (default
646
+ `<config-home>/projects/<cwd-slug>` — `$CLAUDE_CONFIG_DIR` or `~/.claude`,
647
+ and the cwd with every non-alphanumeric char mapped to `-`; override
648
+ `LIFECYCLE_KIT_SESSIONS_DIR`), the top-level glob widened with
649
+ `<dir>/*/subagents/*.jsonl` so a dispatched session with neither env var
650
+ still resolves without a per-dispatch override. Newest-file selection is the
651
+ documented single-operator assumption (one live session per project tree) —
652
+ and the widened glob makes it bite *within* one session too: a top-level
653
+ session that reaches this source (its Bash environment lacking the source-2
654
+ uuid) right after one of its subagents finishes picks that subagent's
655
+ transcript when it out-mtimes the session's own, so a lead deriving its own
656
+ id here (the session-role marker, §templates/lead.md) can name the wrong
657
+ session and misfire the suppression — a lead in that position verifies the
658
+ printed id against its own transcript before writing the marker. A
659
+ dispatched child (source 2 skipped, `CLAUDE_CODE_SESSION_ID` carrying the
660
+ lead's uuid) narrows this scan to `<dir>/<lead-uuid>/subagents/*.jsonl`
661
+ alone, excluding the lead's own top-level transcript — concurrently written,
662
+ and able to out-mtime the dispatched session's — from the candidate set. The
663
+ flag is verified, not trusted, because this harness sets it in top-level
664
+ sessions too: a non-empty narrowed scan is a genuine child (newest subagent
665
+ transcript wins); an empty scan with `<dir>/<lead-uuid>.jsonl` present marks
666
+ the flag spurious — a genuine child's transcript lives under `subagents/`
667
+ while it runs, so an empty scan plus a top-level transcript for the env uuid
668
+ means the uuid names a live top-level session, and the derivation falls back
669
+ to `CLAUDE_CODE_SESSION_ID` (source 2's answer). An empty scan with no such
670
+ top-level transcript exits 2 — only a wrong sessions dir or a broken layout
671
+ still reaches it. Two races are accepted: a genuine child stamping before
672
+ its transcript's first write would fall back to the lead's uuid (theoretical
673
+ — a child's transcript has its first writes by the time it can run a tool
674
+ call), and a spurious-flagged session that dispatched subagents earlier in
675
+ the same session stamps the newest subagent's id (a provenance smudge, not a
676
+ correctness break, unchanged from the prior trusting behavior). An absent dir
677
+ or transcript exits 2.
678
+
679
+ Not a gate — a `bin/` helper invoked (now internally, by `enter-stage.sh`) for
680
+ the `<session-id>` field; the stage skills reach it through `enter-stage.sh`
681
+ rather than calling it directly.
682
+
683
+ ### bin/enter-stage.sh
684
+
685
+ The deterministic writer for a stage transition: `enter-stage.sh <stage>`
686
+ appends the invocation stamp, reading `session-id.sh` for
687
+ the id — never an argument, so the no-hand-picking rule rides into the tool.
688
+ `<stage>` must be a configured stage; anything else is a usage error (exit 2).
689
+ An ordinary stage **writes the evidence file only** — the appended stamp *is*
690
+ the transition, since the last stamp is the cursor, so the queue file is not
691
+ touched and need not be committed. The first stage
692
+ (`LIFECYCLE_KIT_FIRST_STAGE`)
693
+ performs the iteration-boundary reset instead — truncating the state file and
694
+ every file in `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` back to its contract header and
695
+ restarting the header at the unnamed-iteration form. That header rewrite is
696
+ also where a residual pre-upgrade `[stage:]` field is dropped, so a consumer
697
+ that vendored the cursor extraction mid-iteration heals at its next boundary
698
+ without a migration step. `LIFECYCLE_KIT_BOUNDARY_TRUNCATE`
699
+ is a generic per-iteration reset knob — no consumer surface is named in
700
+ the kit; a downstream kit whose per-iteration file must start each cycle from
701
+ its contract header adds itself here, as evidence-kit's manifest does. The
702
+ kit-owned `LIFECYCLE_KIT_LESSON_EVIDENCE_FILE` resets by the same rule as a
703
+ **built-in member** — the kit owns that surface, so it does not ride the
704
+ consumer knob (git history keeps the retired stamps).
705
+
706
+ The boundary reset additionally **wipes the scratch dir** (`GATE_SDK_TMP_DIR`),
707
+ deleting every member whose basename is neither `.gitkeep` nor a
708
+ `LIFECYCLE_KIT_BOUNDARY_PRESERVE` entry — at any depth the wipe reaches — and
709
+ naming the wiped set in its report the way it already names the truncated set.
710
+ Truncate and wipe share the boundary trigger and the report line and **nothing
711
+ else**: truncate rewrites a *tracked* file down to its `# contract:` header, so
712
+ the file survives with an empty body; the wipe *deletes* untracked scratch
713
+ members outright. `PRESERVE` is therefore a keep-list for the delete and never a
714
+ truncate target. The wipe runs last — after the truncate loop and after
715
+ enter-stage removes its own temp files — so those temporaries are never
716
+ candidates, and it is **boundary-only**: an ordinary stage entry appends and
717
+ touches no scratch. It is unconditional over the directory because scratch is
718
+ disposable *by definition*; a consumer's persistent measurement trends live
719
+ outside it by retention contract. A delete that fails because a preserved
720
+ basename sits inside an otherwise-doomed subdirectory is noise, never an abort.
721
+
722
+ `.gitkeep` is a **kit invariant, not configuration** — the consumer cannot unset
723
+ it. The kit must not delete a file the consumer tracks: doing so removes a
724
+ tracked file at the boundary and dirties the tree at the very moment the
725
+ first-stage session commits the reset. The exemption is *not* about the directory
726
+ surviving (the tool `mkdir -p`s the scratch dir, and the wipe removes members,
727
+ not the dir); it is recorded with its real reason so a later reader does not
728
+ retire it as redundant, and it is generic-consumer mechanism rather than a fact
729
+ about any one checkout — a consumer that gitignores its scratch dir wholesale
730
+ never exercises it. Shipping the exemption as `PRESERVE`'s *default* is **ruled
731
+ out**: a defaulted bash array is replaced, not merged, when a consumer assigns
732
+ it, so protection would decrease as configuration increases and any consumer
733
+ setting `PRESERVE` for its own reasons would silently lose the exemption. A
734
+ git-aware "spare any tracked file" rule is **ruled out** too — it makes
735
+ filesystem behavior git-dependent for one case, and it would spare any tracked
736
+ file parked in scratch, re-opening the accumulation the wipe exists to close.
737
+
738
+ The scratch dir has a **second reclaimer, and the two do not overlap.**
739
+ context-kit's session-context hook sweeps the same directory at *every* session
740
+ start, age-guarded precisely so a concurrent same-checkout session's in-flight
741
+ scratch survives (context-kit/SPEC.md §The session-context hook). The boundary
742
+ wipe is deliberately **not** age-guarded: it fires once, at the iteration
743
+ transition, where the only scratch a consumer means to carry across is by
744
+ definition named in `PRESERVE` — an age guard there would leave the previous
745
+ iteration's fresh residue behind, which is the whole thing being reclaimed. Two
746
+ triggers, two postures, one directory; neither mechanism reads the other.
747
+
748
+ The boundary entry also
749
+ **refuses outright when `## Lessons Learned` is non-empty** (exit 1, the
750
+ untriaged entries printed, nothing written — the same refusal contract as the
751
+ built-in pre-flight): an untriaged lesson must not cross into the next
752
+ iteration, so no `[attend]` injection (queue-kit §bin/queue-index.sh) can
753
+ outlive the iteration that filed it. It **likewise refuses while the gap inbox
754
+ (`LIFECYCLE_KIT_GAP_INBOX_FILE`) holds bullets** — the same refusal contract, so
755
+ a mid-iteration gap the close skill did not drain (§The committed gap inbox)
756
+ cannot cross the boundary untriaged; an absent inbox has no bullets and passes. The boundary entry additionally **refuses
757
+ when a `LIFECYCLE_KIT_BOUNDARY_REQUIRE` member lacks a disposition line for the
758
+ closing iteration** (exit 1, nothing written, the same refusal contract): each
759
+ member must carry a data line whose first token is the closing iteration's name,
760
+ so a consumer wiring its release-disposition evidence here makes the close-stage
761
+ disposition a mechanical boundary precondition rather than a decorative stamp.
762
+ The check is **value-agnostic by construction** — it tests the first token only
763
+ and never parses the value field — so a disposition grammar gaining a value (as
764
+ it did with `deferred:<version>`, §templates/skills/) needs no
765
+ widening here; recorded so a future value addition does not re-derive it.
766
+ Fail-closed: a member that does not exist on disk is a refusal naming the path. A
767
+ never-named (`—`) closing iteration has nothing to disposition and skips the
768
+ check. `--simulate` relays the would-be refusal the way it does for lessons. The
769
+ require-check runs after the Lessons refusal and before the boundary truncation,
770
+ so a member that is also a `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` file is verified by
771
+ the same boundary that then consumes it. **Pre-flight,
772
+ not enforcement:** before writing, it runs the built-in `check-stage-entry`
773
+ for the entered stage plus each `LIFECYCLE_KIT_ENTRY_PREFLIGHT` command whose
774
+ stage key matches, and refuses
775
+ (exit 1, findings printed, no writes) when any is red. The hand-off keeps the
776
+ same `<queue> <state>` argv it always had, but **the temp file swapped sides**:
777
+ because the cursor is the last stamp, the candidate transition now lives in a
778
+ temp *state* file under `${GATE_SDK_TMP_DIR}` carrying the not-yet-written
779
+ stamp, while the live queue passes through untouched (the boundary reset, which
780
+ does rewrite the header, passes a temp queue as well). The refusal is advisory
781
+ in the same sense the gate is at commit time (no `--force`, so the easy path is
782
+ the compliant one). `LIFECYCLE_KIT_ENTRY_PREFLIGHT` is a generic per-stage hook
783
+ — no consumer surface is named in the kit; a downstream kit whose gate is the
784
+ real precondition for a stage wires itself here (as evidence-kit's manifest gate
785
+ does for close entry), turning a would-be pre-commit deadlock into a loud
786
+ refusal at the entry. **`--simulate <stage>` — the read-only preflight mode:**
787
+ it runs everything a real entry runs up to the write — config load and stage
788
+ validation, header parse, session-id derivation, the idempotence probe (a
789
+ would-be no-op is reported as such and exits 0), the candidate-stamp temp
790
+ state build, `check-stage-entry`, every matching `LIFECYCLE_KIT_ENTRY_PREFLIGHT`
791
+ entry, and the iteration-boundary Lessons check — then stops: no stamp, no
792
+ boundary truncation, the temp files removed. Every output
793
+ line is prefixed `enter-stage (simulate):` so a transcript can never read as
794
+ a stamp. Exit 0 = the real entry would proceed (or no-op); exit 1 = it would
795
+ refuse, with the refusing check's output relayed line-by-line; exit 2 =
796
+ usage/config error, as a real entry. Not a gate — exercised in `smoke/`
797
+ beside the existing enter-stage coverage (would-pass, would-refuse,
798
+ would-no-op, nothing written). **Idempotent:** if the
799
+ state file already ends with a stamp for the same `<iteration> <stage> <id>`,
800
+ it reports and exits 0 without appending, so a crashed-and-resumed session
801
+ re-runs its entry step safely. It reads the `lib/stages.sh` knobs
802
+ (`LIFECYCLE_KIT_QUEUE_FILE`, `LIFECYCLE_KIT_STATE_FILE`, `LIFECYCLE_KIT_STAGES`,
803
+ `LIFECYCLE_KIT_FIRST_STAGE`, `LIFECYCLE_KIT_BOUNDARY_TRUNCATE`,
804
+ `LIFECYCLE_KIT_BOUNDARY_PRESERVE`,
805
+ `LIFECYCLE_KIT_BOUNDARY_REQUIRE`, `LIFECYCLE_KIT_LESSON_EVIDENCE_FILE`, and
806
+ `LIFECYCLE_KIT_ENTRY_PREFLIGHT`). Advisory tooling,
807
+ not a gate: no fixture pair is owed; it is exercised end-to-end in
808
+ `smoke/install.sh` — including the boundary require-check scenarios (a member
809
+ naming the closing iteration passes; a member missing the line, a member absent
810
+ from disk, and a never-named closing iteration each take their branch).
811
+
812
+ ### bin/install-lifecycle.sh
813
+
814
+ `bin/install-lifecycle.sh [agent-file]` writes the resident registration block
815
+ into the always-loaded agent file (`LIFECYCLE_KIT_AGENT_FILE`, default
816
+ `CLAUDE.md`; the positional override points a smoke or fixture at a scratch
817
+ tree without touching consumer config), idempotently. The block is bounded by
818
+ fixed marker lines (`<!-- lifecycle-kit:begin -->` … `<!-- lifecycle-kit:end -->`);
819
+ a run replaces the content between the markers when present and appends the
820
+ block when absent, so re-running never duplicates. A begin marker without its
821
+ end is a malformed target (exit 2, rather than guess the bounds); the agent
822
+ file must already exist — the installer edits an always-loaded file, it does
823
+ not mint one — so a missing target is exit 2. The marker insert/replace itself
824
+ is not the installer's code: it rides gate-sdk's shared `lib/inject.sh`
825
+ helper (`inject_marker_block`), the one copy `install-doctrine.sh` also uses,
826
+ so no second replace path exists to drift.
827
+
828
+ The block is pointer-only, its roster derived: `lib/stages.sh`'s
829
+ `lifecycle_registration_block` renders the one line that the repo runs the
830
+ state machine on `LIFECYCLE_KIT_QUEUE_FILE`, the stage roster as skill
831
+ invocations (`/<stage>` for each `LIFECYCLE_KIT_STAGES` member), and the
832
+ markdown link to the kit SPEC — never stage prose, and never a hand-listed
833
+ roster, so a consumer's reshaped stage set flows into the block by
834
+ construction. The installer and `check-lifecycle-registration` share that one
835
+ renderer, so the emitted block and the block the gate certifies cannot
836
+ diverge.
837
+
838
+ The same run performs two further steps for the multi-operator merge surface
839
+ (§Multi-operator semantics). **The merge-attribute step** injects a
840
+ marker-bounded block (`# lifecycle-kit:merge:begin` … `# lifecycle-kit:merge:end`,
841
+ `inject_marker_block` again) into `.gitattributes` (repo root) rendered from
842
+ `lifecycle_merge_attrs_block` — one `merge=iteration-scoped` line per supersede
843
+ member (keep-ours) and one `merge=union` line per union member (the gap inbox,
844
+ git-native) — so a reshaped supersede or union set flows into the attribute lines
845
+ by construction and `check-merge-attrs` certifies the same rendering. Unlike the agent file, the installer legitimately **mints
846
+ `.gitattributes` when absent** (it is not an always-loaded file the consumer
847
+ authored). **The driver-config step** registers the keep-ours driver — `git
848
+ config merge.iteration-scoped.driver true` — per-clone (the `install-hooks.sh`
849
+ opt-in class); a non-repo cwd degrades to a printed skip, never a hard failure,
850
+ leaving the `.gitattributes` attribute inert until a clone installs the driver.
851
+ The union attribute needs no such step — `merge=union` is git-native, so its
852
+ line is live the moment `.gitattributes` carries it.
853
+ Advisory tooling, not a gate: no fixture pair is owed; every step is exercised
854
+ end-to-end in `smoke/install.sh`.
855
+
856
+ ### bin/close-surfaces.sh
857
+
858
+ Prints the derived close-surface roster (§The close-surface roster), one row per
859
+ surface, tab-separated `<path> <mode> <reclaim> <owner>`, sorted by path. A
860
+ field with nothing declared is `-`; an owner-less row is a capture surface source
861
+ 2 found with no declaration, whose mode reads `(undeclared)`. The mode is echoed
862
+ verbatim — a malformed one is passed through for `check-close-surfaces` to rule
863
+ on, so the derivation never silently repairs what the gate exists to catch.
864
+
865
+ The declaration surfaces are the resolved kit roots' `LIFECYCLE_KIT_ROSTER_BASENAME`
866
+ files plus every `LIFECYCLE_KIT_CLOSE_SURFACE_GLOBS` match (gate-sdk's kit-root
867
+ resolution, consumer-first with kit shadowing — the order every kit registry
868
+ already uses); duplicates collapse. Follows the affordance contract:
869
+ repo-root `cd`, config-via-env, exit 2 on a non-repo cwd, an unreadable
870
+ declaration surface, or a `git check-ignore` that could not decide. Advisory
871
+ tooling, no fixture pair owed — the gate below is what blocks.
872
+
873
+ ### check-close-surfaces
874
+
875
+ Three assertions, over the derived roster: (A) **no undeclared surface** — every
876
+ capture-tier workflow-dir member carries a declaration; (B) **every declaration
877
+ carries a mode**, and a `forced=` mode's citation is *well-formed* — a
878
+ repo-relative `<path>.md` followed by `§<section>`; (C) **every capture-tier
879
+ declaration names a reclaim command**.
880
+
881
+ Assertion B is shape-only, and resolution is somebody else's job already:
882
+ `check-spec-pointer`'s prose pass resolves a `forced=` citation on any manifest
883
+ surface (§The close-surface roster). Taking the presence-and-shape half here is
884
+ not a preference — `heading_present` is defined *inside*
885
+ `canon-kit/checks/check-spec-pointer.sh`, not exported from a library, so there
886
+ is no resolver a second gate could call. Reaching it would mean either copying
887
+ the resolver, which canon-kit's own tiering rule bans, or making lifecycle-kit
888
+ depend on canon-kit — the same ownership-cycle argument that rules out the log
889
+ merge. The honest arrangement is a pair of gates independently reading one
890
+ surface, each asserting what it owns.
891
+
892
+ The gate reads the roster by running the affordance, so a roster it could not
893
+ derive is fail-closed (exit 2), as is an unreadable declaration surface. An
894
+ optional scan-root argument (passed through to the affordance) is the fixture
895
+ capability: `git check-ignore` never reports a *tracked* path, and a fixture file
896
+ must be tracked to survive a clone, so a case dir cannot hold a capture-tier
897
+ member. The `good/`+`bad/` pair therefore covers assertion B on a consumer-set
898
+ `LIFECYCLE_KIT_CLOSE_SURFACE_GLOBS`, and the bespoke
899
+ `gate-tests/check-close-surfaces.test.sh` builds sandbox repos with a real
900
+ `.gitignore` for assertions A and C — the `check-exec-bit` precedent. Tier
901
+ `precommit`; the `# graph:` manifest couples the workflow dir and the
902
+ declaration surfaces.
903
+
904
+ Calibration and honest limit: the gate asserts the roster is **complete and
905
+ moded**, never that close actually *read* a surface. Reading is a session act
906
+ with no mechanical residue short of a per-surface disposition stamp, which is the
907
+ heavier design this deliberately does not take: the marking converts an invisible
908
+ omission into a sanctioned one, and a stamp would convert it into a gated one at
909
+ the cost of a stamp-per-surface-per-iteration ritual. The lighter disposition
910
+ comes first because an advisory surface's skip is often correct, and gating a
911
+ correct action is the failure mode the gap-inbox refusal already demonstrated.
912
+ The un-gateable half rides the Enforcement-first carve-out's cadence — a class on
913
+ the consumer's close-stage audit roster (doctrine-kit/DOCTRINE.md
914
+ §Methodology-maintenance rules).
915
+
916
+ ### check-lifecycle-registration
917
+
918
+ Invariant: the configured agent file (`LIFECYCLE_KIT_AGENT_FILE`) carries a
919
+ lifecycle-kit marker block whose inner content byte-matches the block
920
+ regenerated from the live stage machine (`lifecycle_registration_block`). The
921
+ block is derived from the machine, and a reshaped machine — a renamed or
922
+ reordered stage, a relocated queue file — or a hand-edit stales it *by
923
+ construction*, on the exact path the kit advertises (reshape the config,
924
+ re-run the installer): the drift-prone-generated-surface case where a gate is
925
+ owed (the enforcement-first weighing). The freshness posture is
926
+ `check-doctrine-registration`'s, byte-strict like `check-docs-mirror-fresh`.
927
+
928
+ A missing block is a finding with the install remedy; a block present but out
929
+ of lockstep is a finding printing the diff and the regenerate remedy (both
930
+ exit 1). Resolution fails closed: a missing agent file, a begin marker without
931
+ its end, or an errored awk capture is exit 2 — a half-written or unreadable
932
+ target must not pass as clean. The gate satisfies the four gate-sdk contracts
933
+ (gate-sdk/SPEC.md §The gate model): the single `LIFECYCLE-REGISTRATION: clean`
934
+ line and a `help:` remedy on each finding path (output); exit 2 on an
935
+ unreadable target (fail-closed); a `good/`+`bad/` fixture pair under
936
+ `gate-tests/` (byte-lockstep-clean and stale-block) plus a sibling `*.test.sh`
937
+ for the block-absent, unpaired-marker, and agent-missing cases the one-pair
938
+ harness cannot hold (fixture-pair); and registration in this repo's
939
+ `gates.list` where its own always-loaded file is the scan target (self-lint).
940
+ Positional form `check-lifecycle-registration.sh [agent-file]` points the
941
+ fixtures at a synthetic agent file. Its `# graph:` manifest couples the agent
942
+ file and `lib/stages.sh` — the config that feeds the block — so an edit to
943
+ either re-fires the gate.
944
+
945
+ ### check-stage-evidence
946
+
947
+ Invariant: the evidence file's stamps are well-formed and every one of them
948
+ belongs to the header's iteration. Each stage skill appends a stamp as its
949
+ first step, and since the last stamp *is* the current stage, "the current
950
+ stage has a matching stamp" holds by construction — so the gate does not
951
+ assert it, because a tautology is not an invariant. What it asserts is the
952
+ **name-axis agreement** between the two surfaces, carried by the staleness
953
+ assertion: every data line's iteration must be the header's. That assertion is
954
+ what forces the first stage to rewrite its `—` bootstrap stamp once it names
955
+ the iteration, and it is the sole remaining enforcer of header↔stamp
956
+ agreement, not a bystander to it.
957
+
958
+ The gate's one no-cursor ruling: a state file that exists but carries **no
959
+ stamp** is a red, with the same shape as the missing-file message. The
960
+ window is legitimate *inside* `enter-stage.sh`'s boundary reset, which stamps
961
+ in the same motion; by commit time an unstamped file means no stage was ever
962
+ invoked, which is precisely what this gate exists to reject — and with the
963
+ stage axis off the header, nothing else would have caught it (an empty file
964
+ gives the grammar and staleness passes nothing to reject).
965
+
966
+ The stamp file is additionally kept provably bounded: every data line
967
+ must be grammatically well-formed — exactly four fields, stage ∈ the
968
+ configured stage set plus the waiver token (a stamp token but never a header
969
+ stage), date `YYYY-MM-DD`; every data line's iteration must be the current
970
+ one, stale lines from a prior iteration are rejected; and the `—`
971
+ unnamed-iteration sentinel may appear only while the header itself is unnamed.
972
+ It also reads the `<session-id>` field (which it once ignored) for one
973
+ cross-stage invariant, active at the default `stage` posture of
974
+ `LIFECYCLE_KIT_SESSION_BOUNDARY` (§Layout and configuration): within the
975
+ current iteration, two *different* stages may not share one session id — a
976
+ stage entry is a context boundary and demands a fresh session, so a duplicate
977
+ (e.g. build == validate) is a self-reported skip and fails. The rule constrains
978
+ *cross-stage* sharing only: **same-stage re-entries are in-contract** — a
979
+ multi-session build, or a lead's N sibling batch sessions of one stage
980
+ (§The state machine), may share or rotate ids freely, a sanctioned pattern
981
+ rather than merely unpunished. This owner-doc statement is the home of the rule
982
+ the gate's own distinctness message echoes. Waiver-token stamps are exempt
983
+ (never a stage, so never in the map). At the
984
+ `iteration` posture the gate skips only this distinctness map; stamp grammar,
985
+ staleness, and sentinel scoping hold
986
+ identically, and a reused session id remains on the audit trail — it just
987
+ stops failing the gate.
988
+
989
+ Calibration: the `—` sentinel is the bootstrap name for a new iteration
990
+ before the first stage names it. Any stage past the first carrying `—` in the
991
+ header is rejected (the unnamed-iteration guard, which reads the name axis from
992
+ the header and the stage axis from the cursor — it works only because the two
993
+ axes stay independently sourced); admitting `—` at every stage — an
994
+ attested bug — would let an unnamed iteration reach the final stage
995
+ undetected, so the allowance is stage-scoped, not global. The data section
996
+ begins after the first `---` separator; prose above it is not validated
997
+ line-by-line. Argument mode `$1 $2` (queue, state) with configured defaults
998
+ makes the gate fixture-capable; the sentinel-scoping interplay that exceeds
999
+ one good/bad pair is covered by `gate-tests/check-stage-evidence.test.sh`.
1000
+
1001
+ Honest limit: the stamp proves the stage skill was *invoked*, never that it
1002
+ produced its green result — a validate stamp says validate ran, not that the
1003
+ suites passed. That gap is closed by evidence-kit, which commits a per-run
1004
+ evidence manifest (a suite verdict per line) and, via the optional
1005
+ `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` integration, couples a close entry to
1006
+ the full green block.
1007
+
1008
+ ### check-stage-entry
1009
+
1010
+ Invariant: the stage being *entered* re-verifies its prior stage's static
1011
+ exit, extending the invocation-stamp floor `check-stage-evidence` provides
1012
+ for the current stage one hop back (a shared surface, a distinct invariant:
1013
+ *stamp grammar + name-axis agreement* there, *prior-stage invoked +
1014
+ entered-stage static exit* here). It reads the entered stage from the **cursor**
1015
+ — the state file's last stamp — and the iteration from the header. An empty
1016
+ cursor is unreachable by construction here and stays a hard parse error rather
1017
+ than a disarm: `enter-stage.sh` hands the gate a temp state file that always
1018
+ carries the candidate stamp, and at commit time the entry commit stages that
1019
+ same stamp. It owns three assertions, (A)
1020
+ prerequisite-stamp ordering — for an entered stage X the file carries a
1021
+ stamp for X's configured mandatory predecessor, which closes the "jumped
1022
+ straight to the last stage with no prior stamp" hole its sibling — which no
1023
+ longer asserts any stage coverage at all — cannot see; (B) drain-entry
1024
+ queue-empty —
1025
+ a drain-stage entry requires the configured active queue sections to carry
1026
+ no top-level `- ` entry, catching entry-on-incomplete-build, with one modeled
1027
+ residue class: an entry whose **lead line** carries `[drain-exempt: <reason>]`
1028
+ (syntax: queue-kit/SPEC.md §The tag algebra) is skipped at drain-stage entry —
1029
+ a drain-spanning feature whose remaining half *is* drain-stage work. The
1030
+ reason must be non-empty (empty is malformed, red); it is echoed in the
1031
+ refusal/clean detail, the audit trail its semantic reader. The **backstop**:
1032
+ at entry to every drain *successor* — each stage whose
1033
+ `LIFECYCLE_KIT_PREDECESSOR` value is the drain stage; the map is many-to-one,
1034
+ so every match backstops and a tagged entry drains by whichever successor is
1035
+ entered first — assertion B runs with **no** exemption: nothing may remain
1036
+ active, tagged or not. So untagged entries drain by drain-stage entry, tagged
1037
+ entries by successor entry. A roster whose drain stage is terminal (zero
1038
+ successors) is refused fail-closed at config load (§lib/stages.sh's
1039
+ validator): an exemption with no reachable backstop would be permanent.
1040
+ Ruled-but-unpromoted work is never exempt residue — it files as Deferred
1041
+ `[needs-spec]` for a later scope's promotion (deferred-filing is the model
1042
+ for designed-but-unscheduled work); and (C)
1043
+ audit-trigger — an audit-entry-stage header carrying a cross-component
1044
+ amendment signal but no `<iter> <audit-stage>` stamp demands either that
1045
+ stamp or an explicit recorded waiver line, mechanizing the audit stage's
1046
+ self-reported cross-component trigger so a missed trigger cannot silently
1047
+ skip the audit. The signal reads the on-disk amendment tree (cwd-relative,
1048
+ gate-sdk prune set applied, and `templates/` paths excluded — a shipped
1049
+ `SPEC-amendment.md` skeleton is a copyable stub, not a live amendment, the
1050
+ same exclusion canon-kit's finders apply): it fires when amendment files span
1051
+ ≥2 component dirs, OR when a single amendment's component set — its own dir ∪
1052
+ the contract-surface tokens in its body that resolve to a roster dir — is ≥2.
1053
+ The
1054
+ waiver rides the same file the stamps do (auditable) and is written only on
1055
+ an explicit user ruling — never self-issued by the entering session; it
1056
+ satisfies only assertion C (assertion A's predecessor scan matches the audit
1057
+ stage exactly, so a waiver is never read as an audit *stamp*).
1058
+
1059
+ Calibration: the predecessor map deliberately omits a **trigger-gated stage**
1060
+ as anyone's mandatory predecessor — the audit stage, and equally a trigger-gated
1061
+ *authoring* stage where a roster splits one out (§templates/skills/) — because
1062
+ demanding its stamp before a successor would false-fire on an iteration that
1063
+ legitimately skipped it (an amendment-free iteration runs no audit; a debt-only
1064
+ one runs no authoring stage); the build→align re-check when align *did* run is
1065
+ the build skill's step-0 procedural precondition, not this gate. A trigger-gated
1066
+ authoring stage takes **no assertion-C sibling**, a mechanized trigger considered
1067
+ and deferred: its trigger is procedural (the prior stage's next-stage
1068
+ recommendation) and already backstopped by canon-kit's bidirectional
1069
+ amendment-pairing rule — a feature entry carries a `[spec:]` ref only when the
1070
+ amendment exists on disk, so a skipped authoring stage cannot ship a feature
1071
+ without its amendment. The disanalogy with assertion C is decisive: C mechanizes
1072
+ because the *audit* it gates is otherwise-unverifiable judgment, whereas an
1073
+ authoring stage's *output* — the amendment — is otherwise-verified by that
1074
+ bidirectional rule, so a process assertion there would only duplicate the
1075
+ on-disk-amendment signal or smear canon-kit's feature-section grammar into this
1076
+ gate. Assertion C's honest limit: it
1077
+ approximates "changes ≥2 components' *contracts*" with "touches or names ≥2
1078
+ component surfaces" — it can over-demand (the cheap waiver valve absorbs
1079
+ that) and can under-detect a purely semantic cross-component impact; it
1080
+ converts a silent skip into a stamp, a recorded waiver, or a narrow
1081
+ false-negative, strictly better than self-report. The good/bad pair covers
1082
+ assertion A; `gate-tests/check-stage-entry.test.sh` covers B and C over nine
1083
+ sandbox scenarios (untagged residue red, tagged residue at drain entry green,
1084
+ empty-reason tag red, tagged residue at successor entry red; two-dir
1085
+ amendments ±waiver, a single-amendment cross-component body, a
1086
+ single-component amendment, and a `templates/` stub that must not fabricate a
1087
+ second component). Suite *runs* and other
1088
+ non-static exits are not re-runnable as pre-commit gates and stay
1089
+ human-judged at the stage approval; the prerequisite-stamp floor is their
1090
+ mechanical residual.
1091
+
1092
+ ### check-stage-skill-coverage
1093
+
1094
+ Invariant: the configured stage set and the skills dir (`LIFECYCLE_KIT_SKILLS_DIR`,
1095
+ default `.claude/commands`; override with the first argument) cover each other,
1096
+ both directions. Forward: every `LIFECYCLE_KIT_STAGES` member has a `<stage>.md`
1097
+ skill file — a stage with no skill cannot be entered. Reverse: every skill file
1098
+ that invokes `enter-stage.sh` names a live stage in the token it passes. The
1099
+ `enter-stage.sh` invocation is the mechanical marker separating a stage skill
1100
+ from an ordinary one, so a retired stage's orphan skill (its `.md` still
1101
+ invoking a now-unknown stage) reddens without false-flagging a non-stage skill
1102
+ like `/agent-execution`, which never invokes `enter-stage.sh`. A skills dir that
1103
+ does not exist is fail-closed (exit 2). The `# graph:` couples the skills dir at
1104
+ `tier=precommit`; the whole-tree `run-gates.sh` battery backstops a stage-set
1105
+ edit (`lifecycle-config.sh`), which is not itself in the coupled surface.
1106
+
1107
+ ### check-skill-binding
1108
+
1109
+ Invariant: every skill under `LIFECYCLE_KIT_SKILLS_DIR` (default `.claude/commands`;
1110
+ override with the first argument) that carries a binding directive — `Execute
1111
+ the template at <path>, applying the bindings below.` — (a) names a template
1112
+ file that exists and (b) binds exactly that template's slot set: an unbound slot
1113
+ is red, an orphan binding naming no slot is red. A skill with no directive is
1114
+ not read, so a copy-and-specialize skill carrying no such line is untouched —
1115
+ the same directive-as-selector mechanism `check-stage-skill-coverage` uses on
1116
+ `enter-stage.sh`. A bound skill need not be a stage skill: `/agent-execution`
1117
+ binds a delegation-kit template, which the gate accepts unchanged (the resolved
1118
+ template path may point at any kit). Template slots are the `*<slot-name: …>*` opening
1119
+ tokens; a shim's bindings are the `**slot-name** —` lead lines under
1120
+ `## Bindings`; the directive's template path resolves relative to the current
1121
+ directory (the tree root at pre-commit). A skills dir that does not exist is
1122
+ fail-closed (exit 2). The `# graph:` couples the skills dir, the lifecycle
1123
+ templates dir, and each out-of-tree bound template (e.g.
1124
+ `delegation-kit/templates/agent-execution.md`) at `tier=precommit`, so a slot
1125
+ added to a template or a binding changed in a shim fires the gate. The good/bad pair drives the unbound-slot case;
1126
+ `gate-tests/check-skill-binding.test.sh` covers the orphan-binding,
1127
+ missing-template, and skip (no-directive / no-slots) cases the one pair cannot.
1128
+
1129
+ ### check-shim-restatement
1130
+
1131
+ Invariant: no binding shim under `LIFECYCLE_KIT_SKILLS_DIR` shares a normalized word
1132
+ n-gram of length ≥ `LIFECYCLE_KIT_SHIM_NGRAM` with any surface in the dedup corpus
1133
+ `LIFECYCLE_KIT_SHIM_DEDUP_CORPUS` — the duplication tripwire under the same
1134
+ directive-as-selector rule `check-skill-binding` uses (a file with no `Execute
1135
+ the template …` directive is not a shim and is not read). The corpus defaults to
1136
+ the consumer's always-loaded agent file (`LIFECYCLE_KIT_AGENT_FILE`, default
1137
+ `CLAUDE.md`) plus every kit's `templates/**/*.md`
1138
+ (kit set from `gate_kit_roots`); an explicit `LIFECYCLE_KIT_SHIM_DEDUP_CORPUS` or
1139
+ positional corpus arguments override it — the latter is the hermetic-fixture
1140
+ affordance. Comparison normalizes first — lowercase, punctuation stripped to a
1141
+ word boundary, whitespace collapsed — so cosmetic rewording does not evade the
1142
+ tripwire; a resolved corpus that yields no n-grams is fail-closed (exit 2), never
1143
+ a false clean.
1144
+
1145
+ `LIFECYCLE_KIT_SHIM_NGRAM` is calibrated to the smallest window with zero false
1146
+ positives on the post-rewrite corpus, with a floor of 8 words so a citation line
1147
+ (a path plus a §heading) never fires — this repo's default is 9, the width at
1148
+ which the 8-word §heading `This repo is governed by its own kits` stops
1149
+ tripping. Honest limit: the n-gram holds the *copy shape* only. Which tier a
1150
+ fact belongs to stays semantic judgment — a paraphrase below N words passes the
1151
+ gate and is still a defect to fix on sight (the same doctrine as
1152
+ check-comment-tier's floor). The `# graph:` couples the skills dir, `CLAUDE.md`,
1153
+ and the kit template dirs at `tier=precommit`, so editing a shim or a corpus
1154
+ surface fires the gate. Because the corpus find recurses but the `kit:templates/*.md`
1155
+ couple does not, the one kit template *sub*directory that holds bound
1156
+ templates — `lifecycle-kit/templates/skills/*.md` (the stage-skill templates each
1157
+ stage shim binds) — is coupled explicitly beside it; a shim's own template is its
1158
+ likeliest collision surface, so it must re-trigger the gate. A red run names the
1159
+ shim, the corpus surface, and the shared n-gram, so the fix (delete the
1160
+ restatement, keep a citation) is mechanical. The good/bad pair drives the plain restatement/clean split;
1161
+ `gate-tests/check-shim-restatement.test.sh` covers the no-directive skip, the
1162
+ short-corpus fail-closed, and the below-N paraphrase the one pair cannot.
1163
+
1164
+ ### check-lesson-disposition
1165
+
1166
+ Invariant: every `## Lessons Learned` entry present at HEAD and absent from the
1167
+ worktree leaves a well-formed disposition stamp in
1168
+ `LIFECYCLE_KIT_LESSON_EVIDENCE_FILE` — a lesson cannot be cleared without a
1169
+ recorded rule/task/harvest/discard call. The evidence home is a stamped file,
1170
+ not the commit body, because the battery runs at pre-commit when no commit
1171
+ message exists yet, so only a file is mechanically decidable (the
1172
+ `check-stage-evidence` fail-closed precedent). Each data line is
1173
+ ``<iteration> lesson <rule <file> | task <slug> | harvest <tag> | discard <reason>> — <lead-line prefix>``;
1174
+ the `` — `` separates the disposition from the
1175
+ lead-line prefix that joins it to the removed entry (a stored prefix matches a
1176
+ removed entry when it is a leading substring of that entry's normalized lead
1177
+ line). Both grammar (each line well-formed, a known disposition kind) and
1178
+ per-entry matching (every removal has a stamp) hold; an unreadable evidence
1179
+ surface is fail-closed (exit 2). Shape validation only: `harvest <tag>` is not
1180
+ checked against `QUEUE_KIT_LESSON_TAGS` — that would cross-couple the kits'
1181
+ configs; the close skill and `check-tag-lead-line` hold the vocabulary.
1182
+
1183
+ Calibration: diffing HEAD against the worktree is fixture-hostile (a committed
1184
+ fixture has HEAD == worktree, so the removal case has no static representation —
1185
+ the `check-task-conservation` precedent), so the gate takes optional
1186
+ `[queue-head] [queue-worktree] [evidence-file]` override args and its good/bad
1187
+ pair drives all three hermetically (the `check-trajectory-fresh` synthetic-args
1188
+ precedent); `gate-tests/check-lesson-disposition.test.sh` covers the malformed
1189
+ grammar, still-present-not-removed, and prefix-join cases the one pair cannot.
1190
+ The `# graph:` couples the queue file and the evidence file at
1191
+ `tier=precommit`.
1192
+
1193
+ ### check-merge-attrs
1194
+
1195
+ Invariant, over two derived sets: bidirectional set-parity between the derived
1196
+ iteration-scoped supersede set (`lifecycle_supersede_set`, §lib/stages.sh) and
1197
+ the paths carrying `merge=iteration-scoped` in the consumer's `.gitattributes`
1198
+ (default `.gitattributes`; override with the first argument), plus **forward-only**
1199
+ parity between the derived union set (`lifecycle_union_set` — the gap inbox) and
1200
+ the paths carrying `merge=union`. The iteration-scoped forward direction — a
1201
+ supersede-set path with no `merge=iteration-scoped` line — catches an
1202
+ unmechanized rule (a merge would silently take the wrong side on that surface).
1203
+ Its reverse direction is the safety edge: a `merge=iteration-scoped` attribute on
1204
+ a path *outside* the derived set silently discards merge content on a real
1205
+ surface, so a smuggled line is red, not config. The gate scans every
1206
+ `merge=iteration-scoped` line in the file — inside the installer's marker block
1207
+ or not — so the reverse edge holds against a hand-added line anywhere. The union
1208
+ set is **forward-only by design** — a union member with no `merge=union` line is
1209
+ red (a filed gap would be silently dropped at a concurrent merge), but a
1210
+ `merge=union` line *outside* the derived set is **not** flagged: `merge=union` is
1211
+ a git-native driver a consumer's own tracked append log legitimately carries
1212
+ (§Multi-operator semantics), so there is no smuggling to catch. A missing
1213
+ `.gitattributes` reports every derived surface as unmechanized (exit 1, the
1214
+ install remedy); an unreadable one, an empty supersede set (a lifecycle always
1215
+ owns at least its state + lesson-evidence files), or an empty union set (it
1216
+ always owns at least its gap inbox), is fail-closed (exit 2).
1217
+
1218
+ The gate satisfies the four gate-sdk contracts (gate-sdk/SPEC.md §The gate model):
1219
+ the single `MERGE-ATTRS: clean` line and a `help:` remedy on the finding path
1220
+ (output); exit 2 on an unreadable target or an empty derived set (fail-closed); a
1221
+ `good/`+`bad/` fixture pair under `gate-tests/` — the good case the default
1222
+ state+lesson attribution plus the gap-inbox union line, the bad case a smuggled
1223
+ reverse-edge line — plus `gate-tests/check-merge-attrs.test.sh` for the
1224
+ iteration-scoped forward-missing and missing-file findings, the union
1225
+ forward-missing finding, the union no-reverse-edge case (a `merge=union` line
1226
+ outside the derived set stays clean), and a real two-branch merge in a sandbox
1227
+ repo that asserts the keep-ours driver resolves an attributed surface to the
1228
+ arriving side (fixture-pair); and
1229
+ registration in this repo's `gates.list` where its own `.gitattributes` is the
1230
+ scan target (self-lint). Its `# graph:` couples `.gitattributes` and
1231
+ `lib/stages.sh` (the config the supersede set derives from) at `tier=precommit`;
1232
+ a reshaped `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` in the consumer config is backstopped
1233
+ by the whole-tree `run-gates.sh` battery (the `check-stage-skill-coverage`
1234
+ precedent).
1235
+
1236
+ ### templates/skills/
1237
+
1238
+ The stage-skill templates (`scope`/`align`/`build`/`validate`/`close`) carry
1239
+ the generic stage spine — the stamp first step (performed by invoking
1240
+ `enter-stage.sh <stage>` and stating in one line what it does), each stage's
1241
+ trigger/ordering rules, and its stage-local doctrine — with **named slots**
1242
+ where the consumer's rule content goes. The templates are the owned surface:
1243
+ this section states the contract a consumer skill must satisfy and never
1244
+ restates what a template carries.
1245
+
1246
+ Alongside the default-roster templates the kit ships **`spec.md`**, an optional
1247
+ **amendment-authoring** stage template — the generative half of design, split
1248
+ out from `scope` on a roster that carries a dedicated authoring stage (the
1249
+ ontology: scope bounds the units, the authoring stage authors the amendments,
1250
+ the audit stage independently verifies them). It is a full stage (it invokes
1251
+ `enter-stage.sh` and stamps), **trigger-gated exactly like the audit stage**: it
1252
+ runs only when an iteration promotes a feature to author, it **appends** rather
1253
+ than resets (only the first stage resets the evidence file), and it takes `scope`
1254
+ as its predecessor without being named any stage's mandatory predecessor
1255
+ (§check-stage-entry's trigger-gated-stage calibration). The kit **default roster
1256
+ does not bind it** — the split is demand-gated and non-breaking; a consumer
1257
+ activates it through `LIFECYCLE_KIT_STAGES` / `LIFECYCLE_KIT_PREDECESSOR`
1258
+ (§Layout and configuration). This is the supported roster shape for a
1259
+ trigger-gated authoring stage, the same class as the trigger-gated audit stage.
1260
+ The generic authoring how-to `spec.md` single-sources — causal completeness and
1261
+ canon-kit's bidirectional queue pairing — is the content `scope`'s conditional
1262
+ authoring step points at, so a default-roster `scope` that still authors reads it
1263
+ there.
1264
+
1265
+ A consumer skill adopts a template in one of two modes; either way the executed
1266
+ skill states in one line what the stamp step does and supplies every
1267
+ slot's content:
1268
+
1269
+ - **Consume-by-reference (the default)** — the consumer skill is a thin
1270
+ **binding shim** whose body is a single directive line, `Execute the template
1271
+ at <repo-relative path>, applying the bindings below.`, followed by a
1272
+ `## Bindings` section with exactly one entry per template slot. The template
1273
+ stays the executed surface; the shim carries only consumer content, so generic
1274
+ doctrine has one owner and never drifts across a copy. This is the documented
1275
+ default because it tracks the kit: a re-vendor reaches the template, and
1276
+ `check-skill-binding` + `check-shim-restatement` hold the shim to a thin
1277
+ reference. This repo dogfoods it (`.claude/commands/*.md`).
1278
+ - **Copy-and-specialize (the sanctioned fork)** — the template is copied into
1279
+ the consumer's skills dir and each slot overwritten in place; self-contained
1280
+ and legible, structure copied not imported, so the skill stands alone
1281
+ (gate-sdk's check-skeleton shape). It is a fork with its consequence owned:
1282
+ you own the ritual prose, an upgrade's re-vendor does not reach it, and the
1283
+ shim gates do not cover it. It is kept deliberately — the blessed escape hatch
1284
+ that keeps legitimate structural divergence (different stages, a reshaped
1285
+ machine) visible and contained, and the harness-agnostic floor the bare-bash
1286
+ upgrade smoke assumes; removing it would drive forks into edits of the
1287
+ vendored template, which break Phase-A upgrade determinism with no gate to
1288
+ catch them.
1289
+
1290
+ A consumer reaching for the fork to express *prose* divergence rather than
1291
+ structural divergence signals the slot vocabulary is too thin; the fix is
1292
+ richer slots pulling those cases back under shim protection, not more copying.
1293
+ No gate or telemetry watches for it — which mode a consumer picks is their tree,
1294
+ not this one.
1295
+
1296
+ **Named slots (template grammar).** Each consumer placeholder is a named slot
1297
+ `*<slot-name: guidance>*` — `slot-name` matches `[a-z][a-z0-9-]*`, is unique
1298
+ within its template, and precedes the `:` and the guidance a copy-editor or
1299
+ shim author replaces. A copy-and-specialize consumer overwrites the whole
1300
+ `*<…>*` span; a shim binds the slot by name in a `## Bindings` entry
1301
+ `**slot-name** — <consumer content>` (multi-line content indents under its lead
1302
+ line), and carries nothing else — doctrine restated from the template in a shim
1303
+ is the defect the reference mode removes. `check-skill-binding` holds the
1304
+ shim↔template slot parity.
1305
+
1306
+ **Authoring rule (a binding shim binds residue, cites procedure, restates
1307
+ nothing).** A binding a slot supplies carries only what is local to this
1308
+ consumer — the residue: which surfaces to sweep, which config knobs, which log
1309
+ sinks. Procedure and always-loaded fact that a kit template or the consumer's
1310
+ `CLAUDE.md` already owns are named by a citation (a path plus a §heading), never
1311
+ copied into the shim: a shim is loaded on every stage invocation, so a
1312
+ restatement there is a per-session token tax on a fact with an owner, and it
1313
+ drifts the moment the owner changes. `check-shim-restatement` is the tripwire
1314
+ for the copy shape; the tier judgment (residue vs owned fact) stays the author's.
1315
+
1316
+ The `close` template carries a **release-disposition step**: every close
1317
+ dispositions the iteration at the release boundary — reading the consumer's
1318
+ `release-policy` slot and either executing its release procedure or stamping an
1319
+ explicit no-release line into the consumer-named disposition-evidence file
1320
+ (`<iteration> release <version|none|deferred:<version>> — <basis>`, the
1321
+ `check-lesson-disposition` contract shape at the release boundary).
1322
+
1323
+ The third value carries a release the criteria **earn** but an operator ruling
1324
+ holds back, which `none` ("nothing to release") cannot express — a reader forced
1325
+ to tell the two apart by parsing basis prose has no mechanical signal at all. It
1326
+ is `deferred:<version>` and not a bare `deferred` because the thing that must
1327
+ survive is the *earned bump level*; a bare token drops it and the next release
1328
+ re-derives which floor it inherits. The producer derives `<version>` as the
1329
+ version the criteria *would have shipped as* had the release not been held: the
1330
+ bump the note's upgrade-contract sections floor, applied over the newest
1331
+ already-released note — never the next version the project happens to reach.
1332
+ Stating that rule is what keeps the field mechanically derivable rather than an
1333
+ operator's guess, since without a defined scale the discharge comparison has
1334
+ none. The criteria themselves stay in the basis prose and are not structured
1335
+ fields: the release note's upgrade-contract sections already own them, and a
1336
+ structured list here would be a second copy of that surface — the line carries
1337
+ the *level*, the note owns the *criteria*.
1338
+
1339
+ **Outstanding-deferral is derived, never tracked.** A `deferred:<version>` line
1340
+ is **outstanding** until a later line dispositions a release at or above
1341
+ `<version>`; that later line **discharges** it. Nothing records discharge
1342
+ separately — the release actually happening *is* the discharge, so there is no
1343
+ second state to drift. This is what keeps a consumer's gate over the value
1344
+ low-false-positive: a deferral cannot linger past the release that consumes it,
1345
+ and one that genuinely has not been consumed *should* keep firing.
1346
+
1347
+ A consumer deriving that outstanding set reads the disposition file as
1348
+ **history ∪ live** — not replacement, not fallback — the same reader
1349
+ drift-kit/SPEC.md §The stage-economics meter applies to the stage stamps and
1350
+ `drift-kit/bin/trajectory.sh` already ships. The file is typically a `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` member,
1351
+ so a carrying line survives only in committed history and a live-only reader sees
1352
+ nothing; conversely a history-only reader is blind at exactly the moment that
1353
+ matters most for a precommit gate — the pre-commit of the very close commit
1354
+ writing the `deferred:` line, when that line is live and not yet committed.
1355
+ The live arm covers the uncommitted tail, the history arm covers everything
1356
+ truncation has taken, and the union costs nothing because a line in both arms is
1357
+ the same line. Truncation-immunity is a property of the *reader*, and every
1358
+ reader of a truncated evidence file needs it.
1359
+
1360
+ **The kit wires no gate over the value**, consistent with the release-sweep stamp
1361
+ file: the disposition file is operator evidence riding the release commit, the
1362
+ kit defines the value and the outstanding/discharged derivation, and a consumer
1363
+ may gate it. That split is the provenance seam — the *grammar* is generic
1364
+ lifecycle mechanism, the *bump criteria* being carried are consumer release
1365
+ policy, so the kit ships no list of criteria. The step runs after the surface-mutating
1366
+ close steps and before the brevity pass, since the note is itself such a write;
1367
+ silence is not a disposition. The `release-policy` slot carries the consumer's
1368
+ procedure and criteria by citation, the disposition-evidence path, and any
1369
+ boundary-only sub-procedure such as a major-only deprecation sweep; a consumer
1370
+ with no release process binds a plain `none`-every-iteration line. The
1371
+ disposition line's mechanical reader is `enter-stage.sh`'s boundary require-check
1372
+ (§bin/enter-stage.sh, `LIFECYCLE_KIT_BOUNDARY_REQUIRE`) when a consumer wires the
1373
+ file into that knob.
1374
+
1375
+ Beside the stage skills sits `release-sweep.md` — a **boundary skill**, not a
1376
+ stage: it invokes no `enter-stage.sh` and stamps no state, so
1377
+ `check-stage-skill-coverage` never reads it (it governs only the configured
1378
+ stage set). It is the deprecation disposition walk at a major — invoked from
1379
+ close's release-disposition step when the derived bump is a major — forcing every
1380
+ marker on the `CANON_KIT_DEPRECATION_MARKERS` roster to a stamped disposition —
1381
+ decommission, carry-forward, or un-deprecate — the `check-lesson-disposition`
1382
+ contract shape at a release boundary. canon-kit's `check-deprecation-task` holds
1383
+ each marker bound to a live task between majors; this sweep forces the standing
1384
+ inventory to a decision at the boundary the deprecations were promised against.
1385
+ It carries **named slots** (`inventory-command`, `evidence-gate`), so like the
1386
+ stage skills it adopts the binding-shim grammar (§templates/skills/) and
1387
+ `check-skill-binding` holds the slot pairing; the stamp file is operator
1388
+ evidence riding the release commit — the kit wires no gate over it (a consumer
1389
+ may, through `evidence-gate`).
1390
+
1391
+ Beside it sits `upgrade.md` — another **boundary skill**, not a stage: it
1392
+ invokes no `enter-stage.sh` and stamps no state, so `check-stage-skill-coverage`
1393
+ never reads it. It is the phase-B disposition walk a consumer runs when moving
1394
+ their vendored kits from one release to the next — the judgment half of the
1395
+ two-phase upgrade contract whose deterministic half (the wholesale kit-sync) and
1396
+ whose executable proof both live in gate-sdk (gate-sdk/SPEC.md §upgrade-smoke),
1397
+ against the release-note grammar docs/install.md §The upgrade contract owns. Its
1398
+ ritual registers the target note's newly-declared gates (a new gate's only
1399
+ delivery channel to an upgrading consumer — the phase-A sync never re-runs the
1400
+ installer), dispositions each red gate (fix-the-tree or exempt-with-cause, never
1401
+ a weakened gate), and closes on the semantic-residual audit: the upgrade is the
1402
+ cadence at which a consumer judges the ungateable third of a template-slot change
1403
+ — the shim fill that clears both `check-skill-binding` (slot-set drift) and
1404
+ `check-shim-restatement` (verbatim copy) yet duplicates what the new slot now
1405
+ means to own. It carries named slots (`gates-list`, `disposition-evidence`), so
1406
+ like the stage skills it adopts the binding-shim grammar (§templates/skills/) and
1407
+ `check-skill-binding` holds the slot pairing when a consumer binds it. This repo
1408
+ binds no command for it — the repo is the kit source, never a vendored consumer,
1409
+ so it never upgrades itself; the template ships for consumers and the upgrade
1410
+ smoke exercises the mechanics it narrates.
1411
+
1412
+ ### templates/lead.md
1413
+
1414
+ The **iteration lead** template — an optional live session that dispatches an
1415
+ iteration's stage sessions and answers their escalations, closing the
1416
+ restart-cost of a stage that would otherwise stop and surface to the user cold
1417
+ (§The state machine). Like `release-sweep.md` it is a **boundary skill, not a
1418
+ stage**: it invokes no `enter-stage.sh` and joins no stage set, so
1419
+ `check-stage-skill-coverage` never reads it. Like release-sweep it carries
1420
+ named slots, so it adopts the binding-shim grammar (§templates/skills/) — a
1421
+ consumer copies-and-specializes it or binds it through a thin shim, and
1422
+ `check-skill-binding` holds the slot pairing either way (this repo's
1423
+ `.claude/commands/lead.md` shim).
1424
+
1425
+ The template owns the orchestration protocol whole: the two lead postures
1426
+ (**unified** — the scope session stays live as the lead, one session holding
1427
+ judgment and dispatch on one model tier; **split** — a routing-tier lead
1428
+ dispatches scope as a stage session on the judgment tier and keeps it
1429
+ resumable as the iteration's *intent oracle*, ruling machinery questions
1430
+ itself, forwarding intent questions to the oracle with the working-state
1431
+ excerpt each turns on, and falling back to the governed surfaces — then the
1432
+ operator — when the oracle is gone; posture and tier assignment are standing
1433
+ dispatch policy in the ruling-config slot), the lead model (dispatch a
1434
+ stage session as a background agent whose prompt is that stage's ordinary skill
1435
+ invocation, with the inline-run posture sentence reading
1436
+ `LIFECYCLE_KIT_SESSION_BOUNDARY` — inline stage runs banned under `stage`,
1437
+ the sanctioned blocked-dispatch fallback under `iteration`), the
1438
+ opening-an-iteration contract (the lead never selects the unit set — it relays
1439
+ the operator's standing directive, a theme bounding scope's survey and never a
1440
+ slug list, verbatim in the scope dispatch, and routes scope's proposed set back
1441
+ as an ordinary escalation; selection is scope's contract, and a lead-authored
1442
+ menu pre-empts the premise re-verification), the four-header
1443
+ escalation block (Question / Options / Recommendation / Evidence), the split-channel design (routine narration to the
1444
+ resume journal, escalations to the message channel), the compact economics —
1445
+ the split-where-the-tail-dominates rule, the unified posture's handoff compact,
1446
+ and operator-suggested compacts at the acceptance
1447
+ boundaries that pay under the cold-wakes-times-compressible-residue rule —
1448
+ with the dispatch-granularity rule (batch units sharing a kit or SPEC
1449
+ surface, split on a model-tier change or a delegation-kit split trigger) and
1450
+ the lead-owns-batching clause (an intra-stage batch split is N sibling stage
1451
+ sessions the lead dispatches and validates — each a same-stage re-entry,
1452
+ §The state machine — and a stage session never dispatches a sibling stage
1453
+ session), and
1454
+ the stamps-authoritative invariant carried from §The state machine as the
1455
+ design's load-bearing rule — with its two corollaries: the lead never
1456
+ hand-derives prior-stage completeness from WORKFLOW-STATE or the git log (it
1457
+ dispatches and trusts `enter-stage.sh`'s fail-closed refusal, or gates an
1458
+ expensive dispatch with `--simulate`, §bin/enter-stage.sh), and a ruling
1459
+ whose acting session is not imminent is filed to a durable governed surface
1460
+ in the moment it is made. The template also carries the lead's first step —
1461
+ writing the session-role marker context-kit's hook reads
1462
+ (context-kit/SPEC.md §The session-context hook). Dispatch safety is not re-owned — it inherits
1463
+ delegation-kit's protocol by citation (delegation-kit/SPEC.md §The delegation
1464
+ model: background dispatch, the per-dispatch budget guard, validate after any
1465
+ agent commit). Consumer residue stays in named slots — the tracked
1466
+ agent-definition carrying the standing dispatch policy the dispatch names (the
1467
+ ruling-class roster and everything else true of every dispatch, not improvised
1468
+ per prompt), and whether the consumer wires the optional escalation-shape guard
1469
+ (guard-kit/SPEC.md §wakeup-guard) or leaves it inert.