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