@bonesofspring/ai-rules 0.2.77 → 0.2.78

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 (665) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +1 -1
  3. package/bin/lib/engine-scripts.js +3 -0
  4. package/docs/LOCAL-OVERLAY.md +4 -4
  5. package/docs/PRESET-CONTRIBUTION.md +9 -8
  6. package/docs/TEAM-DB.md +43 -8
  7. package/package.json +2 -1
  8. package/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs +23 -0
  9. package/presets/_shared/ai-local/scripts/check-verification.mjs +275 -0
  10. package/presets/_shared/ai-local/scripts/check-write-scope.mjs +72 -18
  11. package/presets/_shared/ai-local/scripts/manifest.mjs +78 -4
  12. package/presets/_shared/ai-local/scripts/rule-improver.mjs +366 -13
  13. package/presets/_shared/ai-local/scripts/run.mjs +29 -6
  14. package/presets/_shared/ai-local/scripts/team-db-project.mjs +208 -3
  15. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +76 -15
  16. package/presets/_shared/ai-local/scripts/team-db.mjs +19 -4
  17. package/presets/_shared/core/agent-team/agent-artifact-contracts.md +9 -4
  18. package/presets/_shared/core/agent-team/task-framing.md +1 -0
  19. package/presets/_shared/core/meta/preset-layering.md +4 -4
  20. package/presets/_shared/core/meta/preset-pr-checklist.md +2 -1
  21. package/presets/_shared/core/meta/preset-twin-sync.md +12 -5
  22. package/presets/_shared/core/quality/self-review-and-context-hygiene.md +1 -1
  23. package/presets/_shared/core/quality/verification-before-completion.md +28 -4
  24. package/presets/_shared/core/review/code-review-mr.md +1 -0
  25. package/presets/_shared/core/review/receiving-code-review.md +1 -0
  26. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +313 -26
  27. package/presets/claude/android-kotlin/CLAUDE.md +1 -1
  28. package/presets/claude/android-kotlin/agents/build-verifier.md +1 -1
  29. package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -1
  30. package/presets/claude/android-kotlin/agents/debugger.md +1 -1
  31. package/presets/claude/android-kotlin/agents/feature-developer.md +1 -1
  32. package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
  33. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +313 -26
  34. package/presets/claude/android-kotlin/rules/tooling-and-review/ai-local-overlay.md +1 -1
  35. package/presets/claude/android-kotlin/rules/tooling-and-review/code-review.md +1 -0
  36. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-layering.md +4 -4
  37. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +2 -1
  38. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-twin-sync.md +12 -5
  39. package/presets/claude/go/CLAUDE.md +1 -1
  40. package/presets/claude/go/agents/build-verifier.md +1 -1
  41. package/presets/claude/go/agents/code-reviewer.md +1 -1
  42. package/presets/claude/go/agents/debugger.md +1 -1
  43. package/presets/claude/go/agents/feature-developer.md +1 -1
  44. package/presets/claude/go/agents/task-analyst.md +1 -1
  45. package/presets/claude/go/hooks/chain-team-phases.sh +313 -26
  46. package/presets/claude/go/rules/tooling-and-review/ai-local-overlay.md +1 -1
  47. package/presets/claude/go/rules/tooling-and-review/code-review.md +1 -0
  48. package/presets/claude/go/rules/tooling-and-review/preset-layering.md +4 -4
  49. package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +2 -1
  50. package/presets/claude/go/rules/tooling-and-review/preset-twin-sync.md +12 -5
  51. package/presets/claude/ios-swift/CLAUDE.md +1 -1
  52. package/presets/claude/ios-swift/agents/build-verifier.md +4 -1
  53. package/presets/claude/ios-swift/agents/code-reviewer.md +1 -1
  54. package/presets/claude/ios-swift/agents/debugger.md +1 -1
  55. package/presets/claude/ios-swift/agents/feature-developer.md +1 -1
  56. package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
  57. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +313 -26
  58. package/presets/claude/ios-swift/rules/tooling-and-review/ai-local-overlay.md +1 -1
  59. package/presets/claude/ios-swift/rules/tooling-and-review/code-review.md +1 -0
  60. package/presets/claude/ios-swift/rules/tooling-and-review/preset-layering.md +4 -4
  61. package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +2 -1
  62. package/presets/claude/ios-swift/rules/tooling-and-review/preset-twin-sync.md +12 -5
  63. package/presets/claude/java/CLAUDE.md +1 -1
  64. package/presets/claude/java/agents/build-verifier.md +1 -1
  65. package/presets/claude/java/agents/code-reviewer.md +1 -1
  66. package/presets/claude/java/agents/debugger.md +1 -1
  67. package/presets/claude/java/agents/feature-developer.md +1 -1
  68. package/presets/claude/java/agents/task-analyst.md +1 -1
  69. package/presets/claude/java/hooks/chain-team-phases.sh +313 -26
  70. package/presets/claude/java/rules/tooling-and-review/ai-local-overlay.md +1 -1
  71. package/presets/claude/java/rules/tooling-and-review/code-review.md +1 -0
  72. package/presets/claude/java/rules/tooling-and-review/preset-layering.md +4 -4
  73. package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +2 -1
  74. package/presets/claude/java/rules/tooling-and-review/preset-twin-sync.md +12 -5
  75. package/presets/claude/mcp-ts/CLAUDE.md +1 -1
  76. package/presets/claude/mcp-ts/agents/build-verifier.md +1 -1
  77. package/presets/claude/mcp-ts/agents/feature-developer.md +1 -1
  78. package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
  79. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +313 -26
  80. package/presets/claude/mcp-ts/rules/tooling-and-review/ai-local-overlay.md +1 -1
  81. package/presets/claude/mcp-ts/rules/tooling-and-review/code-review.md +1 -0
  82. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-layering.md +4 -4
  83. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +2 -1
  84. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-twin-sync.md +12 -5
  85. package/presets/claude/mol/CLAUDE.md +1 -1
  86. package/presets/claude/mol/agents/build-verifier.md +4 -1
  87. package/presets/claude/mol/agents/code-reviewer.md +1 -1
  88. package/presets/claude/mol/agents/debugger.md +1 -1
  89. package/presets/claude/mol/agents/feature-developer.md +1 -1
  90. package/presets/claude/mol/agents/task-analyst.md +1 -1
  91. package/presets/claude/mol/hooks/chain-team-phases.sh +313 -26
  92. package/presets/claude/mol/rules/tooling-and-review/ai-local-overlay.md +1 -1
  93. package/presets/claude/mol/rules/tooling-and-review/code-review-mr.md +1 -0
  94. package/presets/claude/mol/rules/tooling-and-review/preset-layering.md +4 -4
  95. package/presets/claude/mol/rules/tooling-and-review/preset-pr-checklist.md +2 -1
  96. package/presets/claude/mol/rules/tooling-and-review/preset-twin-sync.md +12 -5
  97. package/presets/claude/next/CLAUDE.md +1 -1
  98. package/presets/claude/next/agents/build-verifier.md +6 -1
  99. package/presets/claude/next/agents/code-reviewer.md +1 -1
  100. package/presets/claude/next/agents/debugger.md +1 -1
  101. package/presets/claude/next/agents/feature-developer.md +1 -1
  102. package/presets/claude/next/agents/task-analyst.md +1 -1
  103. package/presets/claude/next/hooks/chain-team-phases.sh +313 -26
  104. package/presets/claude/next/rules/tooling-and-review/ai-local-overlay.md +2 -1
  105. package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +1 -0
  106. package/presets/claude/next/rules/tooling-and-review/preset-layering.md +4 -4
  107. package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +2 -1
  108. package/presets/claude/next/rules/tooling-and-review/preset-twin-sync.md +12 -5
  109. package/presets/claude/nuxt/CLAUDE.md +1 -1
  110. package/presets/claude/nuxt/agents/build-verifier.md +4 -1
  111. package/presets/claude/nuxt/agents/code-reviewer.md +1 -1
  112. package/presets/claude/nuxt/agents/debugger.md +1 -1
  113. package/presets/claude/nuxt/agents/feature-developer.md +1 -1
  114. package/presets/claude/nuxt/agents/task-analyst.md +1 -1
  115. package/presets/claude/nuxt/hooks/chain-team-phases.sh +313 -26
  116. package/presets/claude/nuxt/rules/tooling-and-review/ai-local-overlay.md +1 -1
  117. package/presets/claude/nuxt/rules/tooling-and-review/code-review-mr.md +1 -0
  118. package/presets/claude/nuxt/rules/tooling-and-review/preset-layering.md +4 -4
  119. package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +2 -1
  120. package/presets/claude/nuxt/rules/tooling-and-review/preset-twin-sync.md +12 -5
  121. package/presets/claude/php-hexagonal/CLAUDE.md +1 -1
  122. package/presets/claude/php-hexagonal/agents/build-verifier.md +1 -1
  123. package/presets/claude/php-hexagonal/agents/code-reviewer.md +1 -1
  124. package/presets/claude/php-hexagonal/agents/debugger.md +1 -1
  125. package/presets/claude/php-hexagonal/agents/feature-developer.md +1 -1
  126. package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
  127. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +313 -26
  128. package/presets/claude/php-hexagonal/rules/tooling-and-review/ai-local-overlay.md +1 -1
  129. package/presets/claude/php-hexagonal/rules/tooling-and-review/code-review.md +1 -0
  130. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-layering.md +4 -4
  131. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +2 -1
  132. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-twin-sync.md +12 -5
  133. package/presets/claude/php-laravel/CLAUDE.md +1 -1
  134. package/presets/claude/php-laravel/agents/build-verifier.md +1 -1
  135. package/presets/claude/php-laravel/agents/code-reviewer.md +1 -1
  136. package/presets/claude/php-laravel/agents/debugger.md +1 -1
  137. package/presets/claude/php-laravel/agents/feature-developer.md +1 -1
  138. package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
  139. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +313 -26
  140. package/presets/claude/php-laravel/rules/tooling-and-review/ai-local-overlay.md +1 -1
  141. package/presets/claude/php-laravel/rules/tooling-and-review/code-review.md +1 -0
  142. package/presets/claude/php-laravel/rules/tooling-and-review/preset-layering.md +4 -4
  143. package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +2 -1
  144. package/presets/claude/php-laravel/rules/tooling-and-review/preset-twin-sync.md +12 -5
  145. package/presets/claude/svelte/CLAUDE.md +1 -1
  146. package/presets/claude/svelte/agents/build-verifier.md +4 -1
  147. package/presets/claude/svelte/agents/code-reviewer.md +1 -1
  148. package/presets/claude/svelte/agents/debugger.md +1 -1
  149. package/presets/claude/svelte/agents/feature-developer.md +1 -1
  150. package/presets/claude/svelte/agents/task-analyst.md +1 -1
  151. package/presets/claude/svelte/hooks/chain-team-phases.sh +313 -26
  152. package/presets/claude/svelte/rules/tooling-and-review/ai-local-overlay.md +1 -1
  153. package/presets/claude/svelte/rules/tooling-and-review/code-review-mr.md +1 -0
  154. package/presets/claude/svelte/rules/tooling-and-review/preset-layering.md +4 -4
  155. package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +2 -1
  156. package/presets/claude/svelte/rules/tooling-and-review/preset-twin-sync.md +12 -5
  157. package/presets/cursor/android-kotlin/agents/build-verifier.md +1 -1
  158. package/presets/cursor/android-kotlin/agents/code-reviewer.md +1 -1
  159. package/presets/cursor/android-kotlin/agents/debugger.md +1 -1
  160. package/presets/cursor/android-kotlin/agents/feature-developer.md +1 -1
  161. package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
  162. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +313 -26
  163. package/presets/cursor/android-kotlin/rules/ai-local-overlay.mdc +1 -1
  164. package/presets/cursor/android-kotlin/rules/code-review-mr.mdc +1 -0
  165. package/presets/cursor/android-kotlin/rules/preset-layering.mdc +4 -4
  166. package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +2 -1
  167. package/presets/cursor/android-kotlin/rules/preset-twin-sync.mdc +12 -5
  168. package/presets/cursor/go/agents/build-verifier.md +1 -1
  169. package/presets/cursor/go/agents/code-reviewer.md +1 -1
  170. package/presets/cursor/go/agents/debugger.md +1 -1
  171. package/presets/cursor/go/agents/feature-developer.md +1 -1
  172. package/presets/cursor/go/agents/task-analyst.md +1 -1
  173. package/presets/cursor/go/hooks/chain-team-phases.sh +313 -26
  174. package/presets/cursor/go/rules/ai-local-overlay.mdc +1 -1
  175. package/presets/cursor/go/rules/code-review-mr.mdc +1 -0
  176. package/presets/cursor/go/rules/preset-layering.mdc +4 -4
  177. package/presets/cursor/go/rules/preset-pr-checklist.mdc +2 -1
  178. package/presets/cursor/go/rules/preset-twin-sync.mdc +12 -5
  179. package/presets/cursor/ios-swift/agents/build-verifier.md +4 -1
  180. package/presets/cursor/ios-swift/agents/code-reviewer.md +1 -1
  181. package/presets/cursor/ios-swift/agents/debugger.md +1 -1
  182. package/presets/cursor/ios-swift/agents/feature-developer.md +1 -1
  183. package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
  184. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +313 -26
  185. package/presets/cursor/ios-swift/rules/ai-local-overlay.mdc +1 -1
  186. package/presets/cursor/ios-swift/rules/code-review-mr.mdc +1 -0
  187. package/presets/cursor/ios-swift/rules/preset-layering.mdc +4 -4
  188. package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +2 -1
  189. package/presets/cursor/ios-swift/rules/preset-twin-sync.mdc +12 -5
  190. package/presets/cursor/java/agents/build-verifier.md +1 -1
  191. package/presets/cursor/java/agents/code-reviewer.md +1 -1
  192. package/presets/cursor/java/agents/debugger.md +1 -1
  193. package/presets/cursor/java/agents/feature-developer.md +1 -1
  194. package/presets/cursor/java/agents/task-analyst.md +1 -1
  195. package/presets/cursor/java/hooks/chain-team-phases.sh +313 -26
  196. package/presets/cursor/java/rules/ai-local-overlay.mdc +1 -1
  197. package/presets/cursor/java/rules/code-review-mr.mdc +1 -0
  198. package/presets/cursor/java/rules/preset-layering.mdc +4 -4
  199. package/presets/cursor/java/rules/preset-pr-checklist.mdc +2 -1
  200. package/presets/cursor/java/rules/preset-twin-sync.mdc +12 -5
  201. package/presets/cursor/mcp-ts/agents/build-verifier.md +1 -1
  202. package/presets/cursor/mcp-ts/agents/feature-developer.md +1 -1
  203. package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
  204. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +313 -26
  205. package/presets/cursor/mcp-ts/rules/ai-local-overlay.mdc +1 -1
  206. package/presets/cursor/mcp-ts/rules/code-review-mr.mdc +1 -0
  207. package/presets/cursor/mcp-ts/rules/preset-layering.mdc +4 -4
  208. package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +2 -1
  209. package/presets/cursor/mcp-ts/rules/preset-twin-sync.mdc +12 -5
  210. package/presets/cursor/mol/agents/build-verifier.md +4 -1
  211. package/presets/cursor/mol/agents/code-reviewer.md +1 -1
  212. package/presets/cursor/mol/agents/debugger.md +1 -1
  213. package/presets/cursor/mol/agents/feature-developer.md +1 -1
  214. package/presets/cursor/mol/agents/task-analyst.md +1 -1
  215. package/presets/cursor/mol/hooks/chain-team-phases.sh +313 -26
  216. package/presets/cursor/mol/rules/ai-local-overlay.mdc +1 -1
  217. package/presets/cursor/mol/rules/code-review-mr.mdc +1 -0
  218. package/presets/cursor/mol/rules/preset-layering.mdc +4 -4
  219. package/presets/cursor/mol/rules/preset-pr-checklist.mdc +2 -1
  220. package/presets/cursor/mol/rules/preset-twin-sync.mdc +12 -5
  221. package/presets/cursor/next/agents/build-verifier.md +6 -1
  222. package/presets/cursor/next/agents/code-reviewer.md +1 -1
  223. package/presets/cursor/next/agents/debugger.md +1 -1
  224. package/presets/cursor/next/agents/feature-developer.md +1 -1
  225. package/presets/cursor/next/agents/task-analyst.md +1 -1
  226. package/presets/cursor/next/hooks/chain-team-phases.sh +313 -26
  227. package/presets/cursor/next/rules/ai-local-overlay.mdc +2 -1
  228. package/presets/cursor/next/rules/code-review-mr.mdc +1 -0
  229. package/presets/cursor/next/rules/preset-layering.mdc +4 -4
  230. package/presets/cursor/next/rules/preset-pr-checklist.mdc +2 -1
  231. package/presets/cursor/next/rules/preset-twin-sync.mdc +12 -5
  232. package/presets/cursor/nuxt/agents/build-verifier.md +4 -1
  233. package/presets/cursor/nuxt/agents/code-reviewer.md +1 -1
  234. package/presets/cursor/nuxt/agents/debugger.md +1 -1
  235. package/presets/cursor/nuxt/agents/feature-developer.md +1 -1
  236. package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
  237. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +313 -26
  238. package/presets/cursor/nuxt/rules/ai-local-overlay.mdc +1 -1
  239. package/presets/cursor/nuxt/rules/code-review-mr.mdc +1 -0
  240. package/presets/cursor/nuxt/rules/preset-layering.mdc +4 -4
  241. package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +2 -1
  242. package/presets/cursor/nuxt/rules/preset-twin-sync.mdc +12 -5
  243. package/presets/cursor/php-hexagonal/agents/build-verifier.md +1 -1
  244. package/presets/cursor/php-hexagonal/agents/code-reviewer.md +1 -1
  245. package/presets/cursor/php-hexagonal/agents/debugger.md +1 -1
  246. package/presets/cursor/php-hexagonal/agents/feature-developer.md +1 -1
  247. package/presets/cursor/php-hexagonal/agents/task-analyst.md +1 -1
  248. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +313 -26
  249. package/presets/cursor/php-hexagonal/rules/ai-local-overlay.mdc +1 -1
  250. package/presets/cursor/php-hexagonal/rules/code-review-mr.mdc +1 -0
  251. package/presets/cursor/php-hexagonal/rules/preset-layering.mdc +4 -4
  252. package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +2 -1
  253. package/presets/cursor/php-hexagonal/rules/preset-twin-sync.mdc +12 -5
  254. package/presets/cursor/php-laravel/agents/build-verifier.md +1 -1
  255. package/presets/cursor/php-laravel/agents/code-reviewer.md +1 -1
  256. package/presets/cursor/php-laravel/agents/debugger.md +1 -1
  257. package/presets/cursor/php-laravel/agents/feature-developer.md +1 -1
  258. package/presets/cursor/php-laravel/agents/task-analyst.md +1 -1
  259. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +313 -26
  260. package/presets/cursor/php-laravel/rules/ai-local-overlay.mdc +1 -1
  261. package/presets/cursor/php-laravel/rules/code-review-mr.mdc +1 -0
  262. package/presets/cursor/php-laravel/rules/preset-layering.mdc +4 -4
  263. package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +2 -1
  264. package/presets/cursor/php-laravel/rules/preset-twin-sync.mdc +12 -5
  265. package/presets/cursor/svelte/agents/build-verifier.md +4 -1
  266. package/presets/cursor/svelte/agents/code-reviewer.md +1 -1
  267. package/presets/cursor/svelte/agents/debugger.md +1 -1
  268. package/presets/cursor/svelte/agents/feature-developer.md +1 -1
  269. package/presets/cursor/svelte/agents/task-analyst.md +1 -1
  270. package/presets/cursor/svelte/hooks/chain-team-phases.sh +313 -26
  271. package/presets/cursor/svelte/rules/ai-local-overlay.mdc +1 -1
  272. package/presets/cursor/svelte/rules/code-review-mr.mdc +1 -0
  273. package/presets/cursor/svelte/rules/preset-layering.mdc +4 -4
  274. package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +2 -1
  275. package/presets/cursor/svelte/rules/preset-twin-sync.mdc +12 -5
  276. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  277. package/presets/mavis/android-kotlin/agents/build-verifier.md +1 -1
  278. package/presets/mavis/android-kotlin/agents/code-reviewer.md +1 -1
  279. package/presets/mavis/android-kotlin/agents/debugger.md +1 -1
  280. package/presets/mavis/android-kotlin/agents/feature-developer.md +1 -1
  281. package/presets/mavis/android-kotlin/agents/task-analyst.md +1 -1
  282. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +313 -26
  283. package/presets/mavis/android-kotlin/rules/ai-local-overlay.md +1 -1
  284. package/presets/mavis/android-kotlin/rules/code-review-mr.md +1 -0
  285. package/presets/mavis/android-kotlin/rules/preset-layering.md +4 -4
  286. package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +2 -1
  287. package/presets/mavis/android-kotlin/rules/preset-twin-sync.md +12 -5
  288. package/presets/mavis/go/adapter-map.json +1 -1
  289. package/presets/mavis/go/agents/build-verifier.md +1 -1
  290. package/presets/mavis/go/agents/code-reviewer.md +1 -1
  291. package/presets/mavis/go/agents/debugger.md +1 -1
  292. package/presets/mavis/go/agents/feature-developer.md +1 -1
  293. package/presets/mavis/go/agents/task-analyst.md +1 -1
  294. package/presets/mavis/go/hooks/chain-team-phases.sh +313 -26
  295. package/presets/mavis/go/rules/ai-local-overlay.md +1 -1
  296. package/presets/mavis/go/rules/code-review-mr.md +1 -0
  297. package/presets/mavis/go/rules/preset-layering.md +4 -4
  298. package/presets/mavis/go/rules/preset-pr-checklist.md +2 -1
  299. package/presets/mavis/go/rules/preset-twin-sync.md +12 -5
  300. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  301. package/presets/mavis/ios-swift/agents/build-verifier.md +4 -1
  302. package/presets/mavis/ios-swift/agents/code-reviewer.md +1 -1
  303. package/presets/mavis/ios-swift/agents/debugger.md +1 -1
  304. package/presets/mavis/ios-swift/agents/feature-developer.md +1 -1
  305. package/presets/mavis/ios-swift/agents/task-analyst.md +1 -1
  306. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +313 -26
  307. package/presets/mavis/ios-swift/rules/ai-local-overlay.md +1 -1
  308. package/presets/mavis/ios-swift/rules/code-review-mr.md +1 -0
  309. package/presets/mavis/ios-swift/rules/preset-layering.md +4 -4
  310. package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +2 -1
  311. package/presets/mavis/ios-swift/rules/preset-twin-sync.md +12 -5
  312. package/presets/mavis/java/adapter-map.json +1 -1
  313. package/presets/mavis/java/agents/build-verifier.md +1 -1
  314. package/presets/mavis/java/agents/code-reviewer.md +1 -1
  315. package/presets/mavis/java/agents/debugger.md +1 -1
  316. package/presets/mavis/java/agents/feature-developer.md +1 -1
  317. package/presets/mavis/java/agents/task-analyst.md +1 -1
  318. package/presets/mavis/java/hooks/chain-team-phases.sh +313 -26
  319. package/presets/mavis/java/rules/ai-local-overlay.md +1 -1
  320. package/presets/mavis/java/rules/code-review-mr.md +1 -0
  321. package/presets/mavis/java/rules/preset-layering.md +4 -4
  322. package/presets/mavis/java/rules/preset-pr-checklist.md +2 -1
  323. package/presets/mavis/java/rules/preset-twin-sync.md +12 -5
  324. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  325. package/presets/mavis/mcp-ts/agents/build-verifier.md +1 -1
  326. package/presets/mavis/mcp-ts/agents/feature-developer.md +1 -1
  327. package/presets/mavis/mcp-ts/agents/task-analyst.md +1 -1
  328. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +313 -26
  329. package/presets/mavis/mcp-ts/rules/ai-local-overlay.md +1 -1
  330. package/presets/mavis/mcp-ts/rules/code-review-mr.md +1 -0
  331. package/presets/mavis/mcp-ts/rules/preset-layering.md +4 -4
  332. package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +2 -1
  333. package/presets/mavis/mcp-ts/rules/preset-twin-sync.md +12 -5
  334. package/presets/mavis/mol/adapter-map.json +1 -1
  335. package/presets/mavis/mol/agents/build-verifier.md +4 -1
  336. package/presets/mavis/mol/agents/code-reviewer.md +1 -1
  337. package/presets/mavis/mol/agents/debugger.md +1 -1
  338. package/presets/mavis/mol/agents/feature-developer.md +1 -1
  339. package/presets/mavis/mol/agents/task-analyst.md +1 -1
  340. package/presets/mavis/mol/hooks/chain-team-phases.sh +313 -26
  341. package/presets/mavis/mol/rules/ai-local-overlay.md +1 -1
  342. package/presets/mavis/mol/rules/code-review-mr.md +1 -0
  343. package/presets/mavis/mol/rules/preset-layering.md +4 -4
  344. package/presets/mavis/mol/rules/preset-pr-checklist.md +2 -1
  345. package/presets/mavis/mol/rules/preset-twin-sync.md +12 -5
  346. package/presets/mavis/next/adapter-map.json +1 -1
  347. package/presets/mavis/next/agents/build-verifier.md +6 -1
  348. package/presets/mavis/next/agents/code-reviewer.md +1 -1
  349. package/presets/mavis/next/agents/debugger.md +1 -1
  350. package/presets/mavis/next/agents/feature-developer.md +1 -1
  351. package/presets/mavis/next/agents/task-analyst.md +1 -1
  352. package/presets/mavis/next/hooks/chain-team-phases.sh +313 -26
  353. package/presets/mavis/next/rules/ai-local-overlay.md +2 -1
  354. package/presets/mavis/next/rules/code-review-mr.md +1 -0
  355. package/presets/mavis/next/rules/preset-layering.md +4 -4
  356. package/presets/mavis/next/rules/preset-pr-checklist.md +2 -1
  357. package/presets/mavis/next/rules/preset-twin-sync.md +12 -5
  358. package/presets/mavis/nuxt/adapter-map.json +1 -1
  359. package/presets/mavis/nuxt/agents/build-verifier.md +4 -1
  360. package/presets/mavis/nuxt/agents/code-reviewer.md +1 -1
  361. package/presets/mavis/nuxt/agents/debugger.md +1 -1
  362. package/presets/mavis/nuxt/agents/feature-developer.md +1 -1
  363. package/presets/mavis/nuxt/agents/task-analyst.md +1 -1
  364. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +313 -26
  365. package/presets/mavis/nuxt/rules/ai-local-overlay.md +1 -1
  366. package/presets/mavis/nuxt/rules/code-review-mr.md +1 -0
  367. package/presets/mavis/nuxt/rules/preset-layering.md +4 -4
  368. package/presets/mavis/nuxt/rules/preset-pr-checklist.md +2 -1
  369. package/presets/mavis/nuxt/rules/preset-twin-sync.md +12 -5
  370. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  371. package/presets/mavis/php-hexagonal/agents/build-verifier.md +1 -1
  372. package/presets/mavis/php-hexagonal/agents/code-reviewer.md +1 -1
  373. package/presets/mavis/php-hexagonal/agents/debugger.md +1 -1
  374. package/presets/mavis/php-hexagonal/agents/feature-developer.md +1 -1
  375. package/presets/mavis/php-hexagonal/agents/task-analyst.md +1 -1
  376. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +313 -26
  377. package/presets/mavis/php-hexagonal/rules/ai-local-overlay.md +1 -1
  378. package/presets/mavis/php-hexagonal/rules/code-review-mr.md +1 -0
  379. package/presets/mavis/php-hexagonal/rules/preset-layering.md +4 -4
  380. package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +2 -1
  381. package/presets/mavis/php-hexagonal/rules/preset-twin-sync.md +12 -5
  382. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  383. package/presets/mavis/php-laravel/agents/build-verifier.md +1 -1
  384. package/presets/mavis/php-laravel/agents/code-reviewer.md +1 -1
  385. package/presets/mavis/php-laravel/agents/debugger.md +1 -1
  386. package/presets/mavis/php-laravel/agents/feature-developer.md +1 -1
  387. package/presets/mavis/php-laravel/agents/task-analyst.md +1 -1
  388. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +313 -26
  389. package/presets/mavis/php-laravel/rules/ai-local-overlay.md +1 -1
  390. package/presets/mavis/php-laravel/rules/code-review-mr.md +1 -0
  391. package/presets/mavis/php-laravel/rules/preset-layering.md +4 -4
  392. package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +2 -1
  393. package/presets/mavis/php-laravel/rules/preset-twin-sync.md +12 -5
  394. package/presets/mavis/svelte/adapter-map.json +1 -1
  395. package/presets/mavis/svelte/agents/build-verifier.md +4 -1
  396. package/presets/mavis/svelte/agents/code-reviewer.md +1 -1
  397. package/presets/mavis/svelte/agents/debugger.md +1 -1
  398. package/presets/mavis/svelte/agents/feature-developer.md +1 -1
  399. package/presets/mavis/svelte/agents/task-analyst.md +1 -1
  400. package/presets/mavis/svelte/hooks/chain-team-phases.sh +313 -26
  401. package/presets/mavis/svelte/rules/ai-local-overlay.md +1 -1
  402. package/presets/mavis/svelte/rules/code-review-mr.md +1 -0
  403. package/presets/mavis/svelte/rules/preset-layering.md +4 -4
  404. package/presets/mavis/svelte/rules/preset-pr-checklist.md +2 -1
  405. package/presets/mavis/svelte/rules/preset-twin-sync.md +12 -5
  406. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  407. package/presets/opencode/android-kotlin/agents/build-verifier.md +1 -1
  408. package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -1
  409. package/presets/opencode/android-kotlin/agents/debugger.md +1 -1
  410. package/presets/opencode/android-kotlin/agents/feature-developer.md +1 -1
  411. package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
  412. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +313 -26
  413. package/presets/opencode/android-kotlin/rules/ai-local-overlay.md +1 -1
  414. package/presets/opencode/android-kotlin/rules/code-review-mr.md +1 -0
  415. package/presets/opencode/android-kotlin/rules/preset-layering.md +4 -4
  416. package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +2 -1
  417. package/presets/opencode/android-kotlin/rules/preset-twin-sync.md +12 -5
  418. package/presets/opencode/go/adapter-map.json +1 -1
  419. package/presets/opencode/go/agents/build-verifier.md +1 -1
  420. package/presets/opencode/go/agents/code-reviewer.md +1 -1
  421. package/presets/opencode/go/agents/debugger.md +1 -1
  422. package/presets/opencode/go/agents/feature-developer.md +1 -1
  423. package/presets/opencode/go/agents/task-analyst.md +1 -1
  424. package/presets/opencode/go/hooks/chain-team-phases.sh +313 -26
  425. package/presets/opencode/go/rules/ai-local-overlay.md +1 -1
  426. package/presets/opencode/go/rules/code-review-mr.md +1 -0
  427. package/presets/opencode/go/rules/preset-layering.md +4 -4
  428. package/presets/opencode/go/rules/preset-pr-checklist.md +2 -1
  429. package/presets/opencode/go/rules/preset-twin-sync.md +12 -5
  430. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  431. package/presets/opencode/ios-swift/agents/build-verifier.md +4 -1
  432. package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -1
  433. package/presets/opencode/ios-swift/agents/debugger.md +1 -1
  434. package/presets/opencode/ios-swift/agents/feature-developer.md +1 -1
  435. package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
  436. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +313 -26
  437. package/presets/opencode/ios-swift/rules/ai-local-overlay.md +1 -1
  438. package/presets/opencode/ios-swift/rules/code-review-mr.md +1 -0
  439. package/presets/opencode/ios-swift/rules/preset-layering.md +4 -4
  440. package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +2 -1
  441. package/presets/opencode/ios-swift/rules/preset-twin-sync.md +12 -5
  442. package/presets/opencode/java/adapter-map.json +1 -1
  443. package/presets/opencode/java/agents/build-verifier.md +1 -1
  444. package/presets/opencode/java/agents/code-reviewer.md +1 -1
  445. package/presets/opencode/java/agents/debugger.md +1 -1
  446. package/presets/opencode/java/agents/feature-developer.md +1 -1
  447. package/presets/opencode/java/agents/task-analyst.md +1 -1
  448. package/presets/opencode/java/hooks/chain-team-phases.sh +313 -26
  449. package/presets/opencode/java/rules/ai-local-overlay.md +1 -1
  450. package/presets/opencode/java/rules/code-review-mr.md +1 -0
  451. package/presets/opencode/java/rules/preset-layering.md +4 -4
  452. package/presets/opencode/java/rules/preset-pr-checklist.md +2 -1
  453. package/presets/opencode/java/rules/preset-twin-sync.md +12 -5
  454. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  455. package/presets/opencode/mcp-ts/agents/build-verifier.md +1 -1
  456. package/presets/opencode/mcp-ts/agents/feature-developer.md +1 -1
  457. package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
  458. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +313 -26
  459. package/presets/opencode/mcp-ts/rules/ai-local-overlay.md +1 -1
  460. package/presets/opencode/mcp-ts/rules/code-review-mr.md +1 -0
  461. package/presets/opencode/mcp-ts/rules/preset-layering.md +4 -4
  462. package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +2 -1
  463. package/presets/opencode/mcp-ts/rules/preset-twin-sync.md +12 -5
  464. package/presets/opencode/mol/adapter-map.json +1 -1
  465. package/presets/opencode/mol/agents/build-verifier.md +4 -1
  466. package/presets/opencode/mol/agents/code-reviewer.md +1 -1
  467. package/presets/opencode/mol/agents/debugger.md +1 -1
  468. package/presets/opencode/mol/agents/feature-developer.md +1 -1
  469. package/presets/opencode/mol/agents/task-analyst.md +1 -1
  470. package/presets/opencode/mol/hooks/chain-team-phases.sh +313 -26
  471. package/presets/opencode/mol/rules/ai-local-overlay.md +1 -1
  472. package/presets/opencode/mol/rules/code-review-mr.md +1 -0
  473. package/presets/opencode/mol/rules/preset-layering.md +4 -4
  474. package/presets/opencode/mol/rules/preset-pr-checklist.md +2 -1
  475. package/presets/opencode/mol/rules/preset-twin-sync.md +12 -5
  476. package/presets/opencode/next/adapter-map.json +1 -1
  477. package/presets/opencode/next/agents/build-verifier.md +6 -1
  478. package/presets/opencode/next/agents/code-reviewer.md +1 -1
  479. package/presets/opencode/next/agents/debugger.md +1 -1
  480. package/presets/opencode/next/agents/feature-developer.md +1 -1
  481. package/presets/opencode/next/agents/task-analyst.md +1 -1
  482. package/presets/opencode/next/hooks/chain-team-phases.sh +313 -26
  483. package/presets/opencode/next/rules/ai-local-overlay.md +2 -1
  484. package/presets/opencode/next/rules/code-review-mr.md +1 -0
  485. package/presets/opencode/next/rules/preset-layering.md +4 -4
  486. package/presets/opencode/next/rules/preset-pr-checklist.md +2 -1
  487. package/presets/opencode/next/rules/preset-twin-sync.md +12 -5
  488. package/presets/opencode/nuxt/adapter-map.json +1 -1
  489. package/presets/opencode/nuxt/agents/build-verifier.md +4 -1
  490. package/presets/opencode/nuxt/agents/code-reviewer.md +1 -1
  491. package/presets/opencode/nuxt/agents/debugger.md +1 -1
  492. package/presets/opencode/nuxt/agents/feature-developer.md +1 -1
  493. package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
  494. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +313 -26
  495. package/presets/opencode/nuxt/rules/ai-local-overlay.md +1 -1
  496. package/presets/opencode/nuxt/rules/code-review-mr.md +1 -0
  497. package/presets/opencode/nuxt/rules/preset-layering.md +4 -4
  498. package/presets/opencode/nuxt/rules/preset-pr-checklist.md +2 -1
  499. package/presets/opencode/nuxt/rules/preset-twin-sync.md +12 -5
  500. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  501. package/presets/opencode/php-hexagonal/agents/build-verifier.md +1 -1
  502. package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -1
  503. package/presets/opencode/php-hexagonal/agents/debugger.md +1 -1
  504. package/presets/opencode/php-hexagonal/agents/feature-developer.md +1 -1
  505. package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
  506. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +313 -26
  507. package/presets/opencode/php-hexagonal/rules/ai-local-overlay.md +1 -1
  508. package/presets/opencode/php-hexagonal/rules/code-review-mr.md +1 -0
  509. package/presets/opencode/php-hexagonal/rules/preset-layering.md +4 -4
  510. package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +2 -1
  511. package/presets/opencode/php-hexagonal/rules/preset-twin-sync.md +12 -5
  512. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  513. package/presets/opencode/php-laravel/agents/build-verifier.md +1 -1
  514. package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -1
  515. package/presets/opencode/php-laravel/agents/debugger.md +1 -1
  516. package/presets/opencode/php-laravel/agents/feature-developer.md +1 -1
  517. package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
  518. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +313 -26
  519. package/presets/opencode/php-laravel/rules/ai-local-overlay.md +1 -1
  520. package/presets/opencode/php-laravel/rules/code-review-mr.md +1 -0
  521. package/presets/opencode/php-laravel/rules/preset-layering.md +4 -4
  522. package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +2 -1
  523. package/presets/opencode/php-laravel/rules/preset-twin-sync.md +12 -5
  524. package/presets/opencode/svelte/adapter-map.json +1 -1
  525. package/presets/opencode/svelte/agents/build-verifier.md +4 -1
  526. package/presets/opencode/svelte/agents/code-reviewer.md +1 -1
  527. package/presets/opencode/svelte/agents/debugger.md +1 -1
  528. package/presets/opencode/svelte/agents/feature-developer.md +1 -1
  529. package/presets/opencode/svelte/agents/task-analyst.md +1 -1
  530. package/presets/opencode/svelte/hooks/chain-team-phases.sh +313 -26
  531. package/presets/opencode/svelte/rules/ai-local-overlay.md +1 -1
  532. package/presets/opencode/svelte/rules/code-review-mr.md +1 -0
  533. package/presets/opencode/svelte/rules/preset-layering.md +4 -4
  534. package/presets/opencode/svelte/rules/preset-pr-checklist.md +2 -1
  535. package/presets/opencode/svelte/rules/preset-twin-sync.md +12 -5
  536. package/presets/zcode/android-kotlin/adapter-map.json +1 -1
  537. package/presets/zcode/android-kotlin/agents/build-verifier.md +1 -1
  538. package/presets/zcode/android-kotlin/agents/code-reviewer.md +1 -1
  539. package/presets/zcode/android-kotlin/agents/debugger.md +1 -1
  540. package/presets/zcode/android-kotlin/agents/feature-developer.md +1 -1
  541. package/presets/zcode/android-kotlin/agents/task-analyst.md +1 -1
  542. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +313 -26
  543. package/presets/zcode/android-kotlin/rules/ai-local-overlay.md +1 -1
  544. package/presets/zcode/android-kotlin/rules/code-review-mr.md +1 -0
  545. package/presets/zcode/android-kotlin/rules/preset-layering.md +4 -4
  546. package/presets/zcode/android-kotlin/rules/preset-pr-checklist.md +2 -1
  547. package/presets/zcode/android-kotlin/rules/preset-twin-sync.md +12 -5
  548. package/presets/zcode/go/adapter-map.json +1 -1
  549. package/presets/zcode/go/agents/build-verifier.md +1 -1
  550. package/presets/zcode/go/agents/code-reviewer.md +1 -1
  551. package/presets/zcode/go/agents/debugger.md +1 -1
  552. package/presets/zcode/go/agents/feature-developer.md +1 -1
  553. package/presets/zcode/go/agents/task-analyst.md +1 -1
  554. package/presets/zcode/go/hooks/chain-team-phases.sh +313 -26
  555. package/presets/zcode/go/rules/ai-local-overlay.md +1 -1
  556. package/presets/zcode/go/rules/code-review-mr.md +1 -0
  557. package/presets/zcode/go/rules/preset-layering.md +4 -4
  558. package/presets/zcode/go/rules/preset-pr-checklist.md +2 -1
  559. package/presets/zcode/go/rules/preset-twin-sync.md +12 -5
  560. package/presets/zcode/ios-swift/adapter-map.json +1 -1
  561. package/presets/zcode/ios-swift/agents/build-verifier.md +4 -1
  562. package/presets/zcode/ios-swift/agents/code-reviewer.md +1 -1
  563. package/presets/zcode/ios-swift/agents/debugger.md +1 -1
  564. package/presets/zcode/ios-swift/agents/feature-developer.md +1 -1
  565. package/presets/zcode/ios-swift/agents/task-analyst.md +1 -1
  566. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +313 -26
  567. package/presets/zcode/ios-swift/rules/ai-local-overlay.md +1 -1
  568. package/presets/zcode/ios-swift/rules/code-review-mr.md +1 -0
  569. package/presets/zcode/ios-swift/rules/preset-layering.md +4 -4
  570. package/presets/zcode/ios-swift/rules/preset-pr-checklist.md +2 -1
  571. package/presets/zcode/ios-swift/rules/preset-twin-sync.md +12 -5
  572. package/presets/zcode/java/adapter-map.json +1 -1
  573. package/presets/zcode/java/agents/build-verifier.md +1 -1
  574. package/presets/zcode/java/agents/code-reviewer.md +1 -1
  575. package/presets/zcode/java/agents/debugger.md +1 -1
  576. package/presets/zcode/java/agents/feature-developer.md +1 -1
  577. package/presets/zcode/java/agents/task-analyst.md +1 -1
  578. package/presets/zcode/java/hooks/chain-team-phases.sh +313 -26
  579. package/presets/zcode/java/rules/ai-local-overlay.md +1 -1
  580. package/presets/zcode/java/rules/code-review-mr.md +1 -0
  581. package/presets/zcode/java/rules/preset-layering.md +4 -4
  582. package/presets/zcode/java/rules/preset-pr-checklist.md +2 -1
  583. package/presets/zcode/java/rules/preset-twin-sync.md +12 -5
  584. package/presets/zcode/mcp-ts/adapter-map.json +1 -1
  585. package/presets/zcode/mcp-ts/agents/build-verifier.md +1 -1
  586. package/presets/zcode/mcp-ts/agents/feature-developer.md +1 -1
  587. package/presets/zcode/mcp-ts/agents/task-analyst.md +1 -1
  588. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +313 -26
  589. package/presets/zcode/mcp-ts/rules/ai-local-overlay.md +1 -1
  590. package/presets/zcode/mcp-ts/rules/code-review-mr.md +1 -0
  591. package/presets/zcode/mcp-ts/rules/preset-layering.md +4 -4
  592. package/presets/zcode/mcp-ts/rules/preset-pr-checklist.md +2 -1
  593. package/presets/zcode/mcp-ts/rules/preset-twin-sync.md +12 -5
  594. package/presets/zcode/mol/adapter-map.json +1 -1
  595. package/presets/zcode/mol/agents/build-verifier.md +4 -1
  596. package/presets/zcode/mol/agents/code-reviewer.md +1 -1
  597. package/presets/zcode/mol/agents/debugger.md +1 -1
  598. package/presets/zcode/mol/agents/feature-developer.md +1 -1
  599. package/presets/zcode/mol/agents/task-analyst.md +1 -1
  600. package/presets/zcode/mol/hooks/chain-team-phases.sh +313 -26
  601. package/presets/zcode/mol/rules/ai-local-overlay.md +1 -1
  602. package/presets/zcode/mol/rules/code-review-mr.md +1 -0
  603. package/presets/zcode/mol/rules/preset-layering.md +4 -4
  604. package/presets/zcode/mol/rules/preset-pr-checklist.md +2 -1
  605. package/presets/zcode/mol/rules/preset-twin-sync.md +12 -5
  606. package/presets/zcode/next/adapter-map.json +1 -1
  607. package/presets/zcode/next/agents/build-verifier.md +6 -1
  608. package/presets/zcode/next/agents/code-reviewer.md +1 -1
  609. package/presets/zcode/next/agents/debugger.md +1 -1
  610. package/presets/zcode/next/agents/feature-developer.md +1 -1
  611. package/presets/zcode/next/agents/task-analyst.md +1 -1
  612. package/presets/zcode/next/hooks/chain-team-phases.sh +313 -26
  613. package/presets/zcode/next/rules/ai-local-overlay.md +2 -1
  614. package/presets/zcode/next/rules/code-review-mr.md +1 -0
  615. package/presets/zcode/next/rules/preset-layering.md +4 -4
  616. package/presets/zcode/next/rules/preset-pr-checklist.md +2 -1
  617. package/presets/zcode/next/rules/preset-twin-sync.md +12 -5
  618. package/presets/zcode/nuxt/adapter-map.json +1 -1
  619. package/presets/zcode/nuxt/agents/build-verifier.md +4 -1
  620. package/presets/zcode/nuxt/agents/code-reviewer.md +1 -1
  621. package/presets/zcode/nuxt/agents/debugger.md +1 -1
  622. package/presets/zcode/nuxt/agents/feature-developer.md +1 -1
  623. package/presets/zcode/nuxt/agents/task-analyst.md +1 -1
  624. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +313 -26
  625. package/presets/zcode/nuxt/rules/ai-local-overlay.md +1 -1
  626. package/presets/zcode/nuxt/rules/code-review-mr.md +1 -0
  627. package/presets/zcode/nuxt/rules/preset-layering.md +4 -4
  628. package/presets/zcode/nuxt/rules/preset-pr-checklist.md +2 -1
  629. package/presets/zcode/nuxt/rules/preset-twin-sync.md +12 -5
  630. package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
  631. package/presets/zcode/php-hexagonal/agents/build-verifier.md +1 -1
  632. package/presets/zcode/php-hexagonal/agents/code-reviewer.md +1 -1
  633. package/presets/zcode/php-hexagonal/agents/debugger.md +1 -1
  634. package/presets/zcode/php-hexagonal/agents/feature-developer.md +1 -1
  635. package/presets/zcode/php-hexagonal/agents/task-analyst.md +1 -1
  636. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +313 -26
  637. package/presets/zcode/php-hexagonal/rules/ai-local-overlay.md +1 -1
  638. package/presets/zcode/php-hexagonal/rules/code-review-mr.md +1 -0
  639. package/presets/zcode/php-hexagonal/rules/preset-layering.md +4 -4
  640. package/presets/zcode/php-hexagonal/rules/preset-pr-checklist.md +2 -1
  641. package/presets/zcode/php-hexagonal/rules/preset-twin-sync.md +12 -5
  642. package/presets/zcode/php-laravel/adapter-map.json +1 -1
  643. package/presets/zcode/php-laravel/agents/build-verifier.md +1 -1
  644. package/presets/zcode/php-laravel/agents/code-reviewer.md +1 -1
  645. package/presets/zcode/php-laravel/agents/debugger.md +1 -1
  646. package/presets/zcode/php-laravel/agents/feature-developer.md +1 -1
  647. package/presets/zcode/php-laravel/agents/task-analyst.md +1 -1
  648. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +313 -26
  649. package/presets/zcode/php-laravel/rules/ai-local-overlay.md +1 -1
  650. package/presets/zcode/php-laravel/rules/code-review-mr.md +1 -0
  651. package/presets/zcode/php-laravel/rules/preset-layering.md +4 -4
  652. package/presets/zcode/php-laravel/rules/preset-pr-checklist.md +2 -1
  653. package/presets/zcode/php-laravel/rules/preset-twin-sync.md +12 -5
  654. package/presets/zcode/svelte/adapter-map.json +1 -1
  655. package/presets/zcode/svelte/agents/build-verifier.md +4 -1
  656. package/presets/zcode/svelte/agents/code-reviewer.md +1 -1
  657. package/presets/zcode/svelte/agents/debugger.md +1 -1
  658. package/presets/zcode/svelte/agents/feature-developer.md +1 -1
  659. package/presets/zcode/svelte/agents/task-analyst.md +1 -1
  660. package/presets/zcode/svelte/hooks/chain-team-phases.sh +313 -26
  661. package/presets/zcode/svelte/rules/ai-local-overlay.md +1 -1
  662. package/presets/zcode/svelte/rules/code-review-mr.md +1 -0
  663. package/presets/zcode/svelte/rules/preset-layering.md +4 -4
  664. package/presets/zcode/svelte/rules/preset-pr-checklist.md +2 -1
  665. package/presets/zcode/svelte/rules/preset-twin-sync.md +12 -5
@@ -385,6 +385,50 @@ function artifactOutputIdFor(step, agent) {
385
385
  if (step?.artifactOutputIds && typeof step.artifactOutputIds[agent] === 'string') return step.artifactOutputIds[agent];
386
386
  return DEFAULT_ARTIFACT_OUTPUT_IDS[agent] || agent;
387
387
  }
388
+ /**
389
+ * P0-3 (AC-5): `review-ledger.md` belongs to the step that owns the `review`
390
+ * artifact, so only that step's receipt runs the ledger gate. A verifier or an
391
+ * implementer reads the same file but may not write a reviewer's row, so gating
392
+ * them would stall a step with no repair path. `changes_requested` is gated with
393
+ * `completed`: that review is the one that usually introduces the rows.
394
+ */
395
+ const LEDGER_GATE_OUTCOMES = new Set(['completed', 'changes_requested']);
396
+ function ownsReviewLedger(step, agent) {
397
+ if (agent === 'code-reviewer') return true;
398
+ return artifactOutputIdFor(step, agent) === 'review';
399
+ }
400
+ /**
401
+ * AC-4: the step's write-scope baseline is a fact the hook already has at
402
+ * activation, so it saves it there instead of leaving a repair nobody runs. A
403
+ * step with no `writeScopes` keeps the shipped `no-write-scopes` skip; a failed
404
+ * save is a note on stderr, never a failed receipt (a read-only step cannot fix
405
+ * its own audit input). The declared scopes are handed to the save as its seed,
406
+ * so a step armed on a clean tree still records the paths it may write — an
407
+ * `--allow-empty` baseline would satisfy the audit's exit code while attributing
408
+ * nothing. Create-once lives in `check-write-scope --save-baseline`: a re-save
409
+ * after the step wrote would erase its own attribution.
410
+ */
411
+ function saveWriteScopeBaseline(step) {
412
+ const stepId = step && typeof step.id === 'string' && step.id !== '' ? step.id : null;
413
+ const scopes = declaredScopes(step);
414
+ if (!stepId || scopes.length === 0) return;
415
+ const root = process.cwd();
416
+ const script = path.join(root, '.ai.local', 'scripts', 'check-write-scope.mjs');
417
+ if (!fs.existsSync(script)) {
418
+ process.stderr.write(`[chain-team-phases] ${slug}: no .ai.local/scripts/check-write-scope.mjs; step ${stepId} keeps no write-scope baseline.\n`);
419
+ return;
420
+ }
421
+ const { spawnSync } = require('child_process');
422
+ const result = spawnSync(
423
+ process.execPath,
424
+ [script, '--root', root, '--slug', slug, '--step', stepId, '--save-baseline', '--paths', scopes.join(',')],
425
+ { cwd: root, encoding: 'utf8', timeout: 20000 },
426
+ );
427
+ if (result && result.status === 0) return;
428
+ const reason = String((result && (result.stderr || result.stdout)) || '')
429
+ .split('\n').map((line) => line.trim()).filter(Boolean)[0] || `exit ${result ? result.status : 'unknown'}`;
430
+ process.stderr.write(`[chain-team-phases] ${slug}: write-scope baseline for step ${stepId} not saved (${reason}); the audit will skip that step.\n`);
431
+ }
388
432
  function activateAttempts(step, stepIndex, waveId = null, agentsOverride = null) {
389
433
  const agents = Array.isArray(agentsOverride) && agentsOverride.length > 0 ? agentsOverride : getStepAgents(step);
390
434
  const parallelGroupId = step.parallel && getStepAgents(step).length > 1 ? `${status.metricsRunId || slug}:step-${stepIndex}` : null;
@@ -398,6 +442,7 @@ function activateAttempts(step, stepIndex, waveId = null, agentsOverride = null)
398
442
  appendMetric({ type: 'attempt_started', at: now, attemptId, stepIndex, stepLabel: step.label || null, agent, role: roleFor(agent), attempt, parallelGroupId, waveId: waveId || null, source: 'hook', attributionConfidence: 'high' });
399
443
  }
400
444
  status.activeAttempts = active;
445
+ saveWriteScopeBaseline(step);
401
446
  }
402
447
  function resolvedAttempt() {
403
448
  const active = status.activeAttempts || {}; const entries = Object.entries(active);
@@ -852,6 +897,76 @@ function productionWriteListError(entry) {
852
897
  }
853
898
  }
854
899
 
900
+ // A2b: a `build-verifier` completion is evidence only when it names the tree it
901
+ // ran on. The report header (`tree: <sha> (+N dirty)`, `run-at: <ISO>`) is
902
+ // compared with the worktree at receipt time through the existing
903
+ // `gitSnapshot()`. A zero-input row is data: only a `zeroInputAllowlist` entry
904
+ // with a reason admits it.
905
+ const REPORT_TREE_RE = /^tree:[ \t]*([0-9a-f]{7,40})[ \t]*\(\+([0-9]+) dirty\)[ \t]*$/m;
906
+ const REPORT_RUN_AT_RE = /^run-at:[ \t]*(\S+)[ \t]*$/m;
907
+ const ZERO_INPUT_ROW_RE = /^[ \t]*[-*][ \t]+`([^`]+)`:[ \t]*checked:[ \t]*0[ \t]*$/gm;
908
+
909
+ function zeroInputAllowlist() {
910
+ const file = path.join(process.cwd(), '.ai.local', 'pipeline-gates.json');
911
+ let parsed = null;
912
+ try { parsed = JSON.parse(fs.readFileSync(file, 'utf8')); } catch { return []; }
913
+ const list = Array.isArray(parsed && parsed.zeroInputAllowlist) ? parsed.zeroInputAllowlist : [];
914
+ return list.filter((item) => item && typeof item.gate === 'string' && item.gate.trim() !== '' && typeof item.reason === 'string' && item.reason.trim() !== '');
915
+ }
916
+
917
+ function zeroInputGates(report) {
918
+ const gates = [];
919
+ ZERO_INPUT_ROW_RE.lastIndex = 0;
920
+ let match;
921
+ while ((match = ZERO_INPUT_ROW_RE.exec(report)) !== null) gates.push(match[1].trim());
922
+ return gates;
923
+ }
924
+
925
+ /**
926
+ * The report a verifier receipt is bound to. On pipeline completion the hook
927
+ * archives the cited body and repoints `authoritativePaths` at
928
+ * `archive/<date>/validation-report.md`; a later reconcile of the same receipt
929
+ * must read the archived copy, not treat the report as missing.
930
+ */
931
+ function verifierReportText(entry) {
932
+ try { return fs.readFileSync(path.join(taskDir, 'validation-report.md'), 'utf8'); } catch {}
933
+ const cited = Array.isArray(entry && entry.authoritativePaths) ? entry.authoritativePaths : [];
934
+ for (const value of cited) {
935
+ const relative = typeof value === 'string' ? value.trim().replace(/\\/g, '/') : '';
936
+ if (!/^archive\/\d{4}-\d{2}-\d{2}\/validation-report\.md$/.test(relative)) continue;
937
+ try { return fs.readFileSync(path.join(taskDir, relative), 'utf8'); } catch {}
938
+ }
939
+ return null;
940
+ }
941
+
942
+ function validateVerifierEvidence(entry) {
943
+ if (!entry || entry.producer !== 'build-verifier') return null;
944
+ const artifactId = entry.id || '(unnamed)';
945
+ const repair = `re-run the named gate on the current tree, then resume with: /task-continue ${slug}`;
946
+ const report = verifierReportText(entry);
947
+ if (report === null) {
948
+ return `[chain-team-phases] ${slug}: receipt "${artifactId}" is a build-verifier completion but validation-report.md is missing. Write it with the "tree: <sha> (+N dirty)" and "run-at: <ISO>" header from the run you are claiming, then ${repair}`;
949
+ }
950
+ const tree = report.match(REPORT_TREE_RE);
951
+ const runAt = report.match(REPORT_RUN_AT_RE);
952
+ if (!tree || !runAt || !Number.isFinite(Date.parse(runAt[1]))) {
953
+ return `[chain-team-phases] ${slug}: receipt "${artifactId}" has a validation-report.md without the required "tree: <sha> (+N dirty)" and "run-at: <ISO>" header lines. Nothing may follow the closing ")" on the tree line — put clarifications under "## Notes". Add the lines from the run you are claiming, then ${repair}`;
954
+ }
955
+ const snapshot = gitSnapshot();
956
+ if (snapshot && !snapshot.head.startsWith(tree[1])) {
957
+ return `[chain-team-phases] ${slug}: receipt "${artifactId}" names tree ${tree[1]} but HEAD is ${snapshot.head.slice(0, 12)}. The gate ran on another revision: ${repair}`;
958
+ }
959
+ if (snapshot && Number(tree[2]) !== snapshot.dirtyFiles) {
960
+ return `[chain-team-phases] ${slug}: receipt "${artifactId}" names (+${tree[2]} dirty) but the worktree carries ${snapshot.dirtyFiles} changed paths. ${repair}`;
961
+ }
962
+ const allowlist = zeroInputAllowlist();
963
+ const blocked = zeroInputGates(report).filter((gate) => !allowlist.some((item) => item.gate === gate));
964
+ if (blocked.length > 0) {
965
+ return `[chain-team-phases] ${slug}: receipt "${artifactId}" reports gate "${blocked[0]}" as checked: 0 without a zeroInputAllowlist entry. List it under zeroInputAllowlist in .ai.local/pipeline-gates.json with a reason, or fix the selection. Then ${repair}`;
966
+ }
967
+ return null;
968
+ }
969
+
855
970
  // A2: a `completed` receipt must cite evidence the harness can inspect. Order is
856
971
  // the message order — the first failing predicate wins, so the operator sees one
857
972
  // actionable line. `authoritativePaths[]` stays task-dir-relative; external
@@ -891,9 +1006,91 @@ function validateCompletedArtifact(entry) {
891
1006
  }
892
1007
  const productionListError = productionWriteListError(entry);
893
1008
  if (productionListError) return productionListError;
1009
+ const evidenceError = validateVerifierEvidence(entry);
1010
+ if (evidenceError) return evidenceError;
1011
+ return null;
1012
+ }
1013
+
1014
+ // P0-3: the reviewer's receipt is the moment the ledger is read, so an
1015
+ // `open`/`accepted`/`deferred` row without an owner or a due date stops there.
1016
+ // The shipped `ledger-check` owns the message text; this seam relays
1017
+ // `failures[].reason` verbatim and holds no copy of its own. A missing script,
1018
+ // a task without a ledger, a timeout, or a child that returns no reason is a
1019
+ // skip — the gate never fails a receipt on its own, but a skip is never silent.
1020
+ function ledgerGateSkip(reason, repair) {
1021
+ process.stderr.write(`[chain-team-phases] ${slug}: ledger gate skipped — ${reason}; ${repair}\n`);
894
1022
  return null;
895
1023
  }
896
1024
 
1025
+ function ledgerCheckStall() {
1026
+ const runByHand = `run it by hand: node .ai.local/scripts/team-db.mjs ledger-check --slug ${slug}`;
1027
+ try {
1028
+ const script = path.join(process.cwd(), '.ai.local', 'scripts', 'team-db.mjs');
1029
+ if (!fs.existsSync(script)) {
1030
+ return ledgerGateSkip(
1031
+ '.ai.local/scripts/team-db.mjs is not installed',
1032
+ 'run "npx @bonesofspring/ai-rules init update" (preset repo: "yarn fix:generated") so the shipped ledger-check lands',
1033
+ );
1034
+ }
1035
+ if (!fs.existsSync(path.join(taskDir, 'review-ledger.md'))) {
1036
+ return ledgerGateSkip(
1037
+ `the task has no review-ledger.md at .ai.local/team/tasks/${slug}/review-ledger.md`,
1038
+ 'write the canonical table when you owe rows, or ignore this line if the task produced none',
1039
+ );
1040
+ }
1041
+ const { spawnSync } = require('child_process');
1042
+ const result = spawnSync(
1043
+ process.execPath,
1044
+ ['.ai.local/scripts/team-db.mjs', 'ledger-check', '--json', '--slug', slug],
1045
+ { cwd: process.cwd(), encoding: 'utf8', timeout: 5000, killSignal: 'SIGKILL', stdio: ['ignore', 'pipe', 'pipe'] },
1046
+ );
1047
+ if (result.error) {
1048
+ return ledgerGateSkip(
1049
+ `ledger-check could not start (${result.error.message})`,
1050
+ `check that Node can run .ai.local/scripts/team-db.mjs, then ${runByHand}`,
1051
+ );
1052
+ }
1053
+ if (result.status === 0) return null;
1054
+ if (result.status === null && result.signal) {
1055
+ return ledgerGateSkip(
1056
+ `ledger-check was killed by ${result.signal} after the 5000 ms budget`,
1057
+ `check the ledger by hand, then ${runByHand}`,
1058
+ );
1059
+ }
1060
+ let reasons = [];
1061
+ try {
1062
+ const payload = JSON.parse(String(result.stdout || '').trim() || '{}');
1063
+ const failures = Array.isArray(payload.failures) ? payload.failures : [];
1064
+ reasons = failures
1065
+ .map((failure) => (failure && typeof failure.reason === 'string' ? failure.reason.trim() : ''))
1066
+ .filter(Boolean);
1067
+ } catch {
1068
+ reasons = [];
1069
+ }
1070
+ if (reasons.length === 0) {
1071
+ // No machine-readable reason: relay the child's own first stderr line
1072
+ // rather than invent one. A child that says nothing is a documented skip.
1073
+ const raw = String(result.stderr || '')
1074
+ .split('\n')
1075
+ .map((line) => line.trim())
1076
+ .filter(Boolean)[0];
1077
+ if (!raw) {
1078
+ return ledgerGateSkip(
1079
+ `ledger-check exited ${result.status} with no reason on stdout or stderr`,
1080
+ runByHand,
1081
+ );
1082
+ }
1083
+ return `[chain-team-phases] ${slug}: review-ledger.md fails ledger-check: ${raw}. Then resume with: /task-continue ${slug}`;
1084
+ }
1085
+ return `[chain-team-phases] ${slug}: review-ledger.md fails ledger-check — ${reasons.join(' | ')}. Fix the rows, then resume with: /task-continue ${slug}`;
1086
+ } catch (error) {
1087
+ return ledgerGateSkip(
1088
+ `the gate itself threw (${error && error.message ? error.message : String(error)})`,
1089
+ runByHand,
1090
+ );
1091
+ }
1092
+ }
1093
+
897
1094
  function readBoundReceiptOutcome(agent, step, resolved) {
898
1095
  if (!agent || !resolved) return { outcome: null, receiptRequired: false };
899
1096
  const manifestPath = path.join(taskDir, 'artifact-manifest.json');
@@ -968,6 +1165,10 @@ function readBoundReceiptOutcome(agent, step, resolved) {
968
1165
  const stallMessage = validateCompletedArtifact(owned[0]);
969
1166
  if (stallMessage) return { outcome: null, receiptRequired: true, stallMessage };
970
1167
  }
1168
+ if (LEDGER_GATE_OUTCOMES.has(outcome) && ownsReviewLedger(step, agent)) {
1169
+ const ledgerStallMessage = ledgerCheckStall();
1170
+ if (ledgerStallMessage) return { outcome: null, receiptRequired: true, stallMessage: ledgerStallMessage };
1171
+ }
971
1172
  return { outcome, receiptRequired: true };
972
1173
  } catch {
973
1174
  return { outcome: null, receiptRequired: false };
@@ -1043,33 +1244,89 @@ function gitSnapshot() {
1043
1244
  }
1044
1245
 
1045
1246
  /**
1046
- * Seed the evidence file when the verifier finishes without an explicit
1047
- * `verification.mjs record`: the snapshot plus a hash of `validation-report.md`.
1048
- * An existing file is never refreshed — its binding must keep pointing at the
1049
- * tree the commands actually ran on.
1247
+ * The report the gate reads: the live body, else the newest archived copy. The
1248
+ * manifest close archives `validation-report.md` under `archive/<date>/`, so a
1249
+ * refresh that read the task root alone would erase the hash the gate still
1250
+ * accepts and hand every later freshness check back to `worktreeHash`.
1251
+ */
1252
+ function evidenceReportText(dir) {
1253
+ try {
1254
+ return { path: 'validation-report.md', text: fs.readFileSync(path.join(dir, 'validation-report.md'), 'utf8') };
1255
+ } catch {}
1256
+ let dates = [];
1257
+ try { dates = fs.readdirSync(path.join(dir, 'archive')).filter((name) => /^\d{4}-\d{2}-\d{2}$/.test(name)).sort(); } catch { return null; }
1258
+ for (let index = dates.length - 1; index >= 0; index -= 1) {
1259
+ const relative = 'archive/' + dates[index] + '/validation-report.md';
1260
+ try { return { path: relative, text: fs.readFileSync(path.join(dir, relative), 'utf8') }; } catch {}
1261
+ }
1262
+ return null;
1263
+ }
1264
+
1265
+ /**
1266
+ * `verification.mjs` takes `${file}.lock` for this file; the hook's
1267
+ * read-modify-write takes the same one, so a concurrent `record` append is not
1268
+ * dropped by the refresh. A lock that cannot be taken is a note, never a failed
1269
+ * receipt.
1270
+ */
1271
+ function withVerificationLock(file, run) {
1272
+ const lockPath = file + '.lock';
1273
+ let held = false;
1274
+ for (let attempt = 0; attempt < 200 && !held; attempt += 1) {
1275
+ try {
1276
+ const fd = fs.openSync(lockPath, 'wx');
1277
+ fs.writeSync(fd, `${process.pid}:${Date.now()}`);
1278
+ fs.closeSync(fd);
1279
+ held = true;
1280
+ } catch (error) {
1281
+ if (error && error.code !== 'EEXIST') return run();
1282
+ let stale = false;
1283
+ try { stale = Date.now() - fs.statSync(lockPath).mtimeMs > 30000; } catch {}
1284
+ if (!stale) break;
1285
+ try { fs.unlinkSync(lockPath); } catch {}
1286
+ }
1287
+ }
1288
+ if (!held) process.stderr.write(`[chain-team-phases] ${slug}: verification.json is locked by another writer; refreshing without the lock.\n`);
1289
+ try {
1290
+ return run();
1291
+ } finally {
1292
+ if (held) { try { fs.unlinkSync(lockPath); } catch {} }
1293
+ }
1294
+ }
1295
+
1296
+ /**
1297
+ * Bind the evidence file to the tree the verifier's commands actually ran on.
1298
+ * Every verifier receipt refreshes it: a retried verifier must not inherit the
1299
+ * attempt-1 tree, because the report gate reads the current one. What the
1300
+ * verifier recorded (`commands[]`, the gate status) is kept — the hook owns the
1301
+ * tree, the verifier owns what ran.
1050
1302
  */
1051
1303
  function ensureVerificationSnapshot(dir, agent) {
1052
- const file = path.join(dir, 'verification.json');
1053
- if (fs.existsSync(file)) return;
1054
1304
  const snapshot = gitSnapshot();
1055
1305
  if (!snapshot) return;
1056
- const reportPath = path.join(dir, 'validation-report.md');
1057
- let report = null;
1058
- try {
1059
- const text = fs.readFileSync(reportPath);
1060
- report = { path: 'validation-report.md', sha256: crypto.createHash('sha256').update(text).digest('hex') };
1061
- } catch {}
1062
- const verification = {
1063
- schemaVersion: 1,
1064
- task: path.basename(dir),
1065
- snapshot,
1066
- report,
1067
- commands: [],
1068
- gate: { status: 'snapshot-only', recordedBy: agent || null, checkedAt: now },
1069
- };
1070
- const temporary = `${file}.${process.pid}.tmp`;
1071
- fs.writeFileSync(temporary, JSON.stringify(verification, null, 2) + '\n');
1072
- fs.renameSync(temporary, file);
1306
+ const file = path.join(dir, 'verification.json');
1307
+ const found = evidenceReportText(dir);
1308
+ const report = found === null ? null : { path: found.path, sha256: crypto.createHash('sha256').update(found.text).digest('hex') };
1309
+ withVerificationLock(file, () => {
1310
+ let previous = null;
1311
+ try { previous = JSON.parse(fs.readFileSync(file, 'utf8')); } catch {}
1312
+ const previousGate = previous && previous.gate && typeof previous.gate === 'object' ? previous.gate : {};
1313
+ const verification = {
1314
+ schemaVersion: 1,
1315
+ task: path.basename(dir),
1316
+ snapshot,
1317
+ report,
1318
+ commands: previous && Array.isArray(previous.commands) ? previous.commands : [],
1319
+ gate: {
1320
+ ...previousGate,
1321
+ status: typeof previousGate.status === 'string' ? previousGate.status : 'snapshot-only',
1322
+ recordedBy: agent || previousGate.recordedBy || null,
1323
+ checkedAt: now,
1324
+ },
1325
+ };
1326
+ const temporary = `${file}.${process.pid}.tmp`;
1327
+ fs.writeFileSync(temporary, JSON.stringify(verification, null, 2) + '\n');
1328
+ fs.renameSync(temporary, file);
1329
+ });
1073
1330
  appendMetric({ type: 'verification_recorded', at: now, kind: 'snapshot-only', agent: agent || null, head: snapshot.head, worktreeHash: snapshot.worktreeHash, source: 'hook', attributionConfidence: 'high' });
1074
1331
  }
1075
1332
 
@@ -1082,9 +1339,19 @@ function verificationFreshness(dir) {
1082
1339
  if (!snapshot || typeof snapshot.head !== 'string') return { present: true, fresh: false, reasons: ['no-snapshot'] };
1083
1340
  const current = gitSnapshot();
1084
1341
  if (!current) return { present: true, fresh: false, reasons: ['no-git'] };
1342
+ // Judge the report the gate judges: its `tree:` header, not the wider worktree
1343
+ // hash. A later edit inside the same report generation moved the hash while the
1344
+ // gate still accepted the report, so the same fresh evidence warned twice.
1345
+ const found = evidenceReportText(dir);
1346
+ const header = found === null ? null : found.text.match(REPORT_TREE_RE);
1085
1347
  const reasons = [];
1086
- if (current.head !== snapshot.head) reasons.push('head-changed');
1087
- if (current.worktreeHash !== snapshot.worktreeHash) reasons.push('worktree-changed');
1348
+ if (header) {
1349
+ if (!current.head.startsWith(header[1])) reasons.push('head-changed');
1350
+ if (Number(header[2]) !== current.dirtyFiles) reasons.push('worktree-changed');
1351
+ } else {
1352
+ if (current.head !== snapshot.head) reasons.push('head-changed');
1353
+ if (current.worktreeHash !== snapshot.worktreeHash) reasons.push('worktree-changed');
1354
+ }
1088
1355
  return { present: true, fresh: reasons.length === 0, reasons };
1089
1356
  }
1090
1357
 
@@ -2368,6 +2635,15 @@ if (hookInput.action === 'bootstrap') {
2368
2635
  }
2369
2636
  const first = firstResolved.step;
2370
2637
  const firstAgents = getStepAgents(first);
2638
+ // A handoff that names no agent cannot name an owned output id either: the
2639
+ // producer would receive `undefined` as its artifact id and stall on a receipt
2640
+ // the hook never accepts. Refuse before anything is armed or written.
2641
+ if (firstAgents.length === 0 || firstAgents.some((agent) => typeof agent !== 'string' || agent.trim() === '')) {
2642
+ const reason = `bootstrap cannot hand over step ${firstResolved.index} ("${first.id || 'step-' + firstResolved.index}"): it declares no resolvable agent, so the owned output id is undefined. Declare steps[].agent (or steps[].artifactOutputId) in pipeline.json with the task-router, then re-run bootstrap.`;
2643
+ process.stderr.write(`[chain-team-phases] ${slug}: ${reason}\n`);
2644
+ process.stdout.write(JSON.stringify({ ok: false, action: 'bootstrap', pipelineIndex: firstResolved.index, reason }));
2645
+ process.exit(0);
2646
+ }
2371
2647
  let metrics = null;
2372
2648
  try { metrics = JSON.parse(fs.readFileSync(METRICS_PATH, 'utf8')); } catch {}
2373
2649
  const hasAttempt = Boolean(
@@ -2393,7 +2669,18 @@ if (hookInput.action === 'bootstrap') {
2393
2669
  awaitingHumanGate: false,
2394
2670
  });
2395
2671
  process.stdout.write(
2396
- JSON.stringify({ ok: true, action: 'bootstrap', pipelineIndex: firstResolved.index, agents: firstAgents, attemptStarted: !hasAttempt }),
2672
+ JSON.stringify({
2673
+ ok: true,
2674
+ action: 'bootstrap',
2675
+ pipelineIndex: firstResolved.index,
2676
+ agents: firstAgents,
2677
+ attemptStarted: !hasAttempt,
2678
+ // Same builder as the advance path: the producer must learn the id and the
2679
+ // attemptId from the hook, not reconstruct them (AC-1). A parallel step has
2680
+ // one attempt per agent, so the single-agent builder would hand the second
2681
+ // producer nothing to act on.
2682
+ followup_message: first.parallel && firstAgents.length > 1 ? handoffForParallelStep(first) : handoffForAgent(firstAgents[0], first.scope, first),
2683
+ }),
2397
2684
  );
2398
2685
  process.exit(0);
2399
2686
  }
@@ -10,7 +10,7 @@ This rule is mandatory. **You MUST** obey it on every turn, without exception.
10
10
 
11
11
  ## On every turn
12
12
 
13
- 1. **Probe** — before answering, run the first existing command: `node .cursor/hooks/list-ai-local.mjs`, `node .claude/hooks/list-ai-local.mjs`, `node .mavis/hooks/list-ai-local.mjs`, `node .opencode/hooks/list-ai-local.mjs`. Pass the repo-relative paths this step will read or edit. When `.ai.local/team/tasks/<slug>/` already exists, add `--record <slug>`.
13
+ 1. **Probe** — before answering, run the first existing command: `node .cursor/hooks/list-ai-local.mjs`, `node .claude/hooks/list-ai-local.mjs`, `node .mavis/hooks/list-ai-local.mjs`, `node .opencode/hooks/list-ai-local.mjs`, `node .zcode/hooks/list-ai-local.mjs`. Pass the repo-relative paths this step will read or edit. When `.ai.local/team/tasks/<slug>/` already exists, add `--record <slug>`.
14
14
  2. **Apply** — read the printed `rules/*.md` and `conventions.md` for that chain. The root `.ai.local` applies to every path. A nested `.ai.local` applies only under its directory. The same rule name on one chain: the deeper file wins; do not read `shadowed`. A sibling package's overlay does not apply. Do **not** load `team/**` or `rules-library/**` as rules.
15
15
  3. **Expand** — a path whose chain adds an overlay is new scope. Read every `new:` file before editing. `--record` writes `.ai.local/team/tasks/<slug>/overlay-scope.json` and appends one `.memlog.md` `event:` per new overlay directory. The session-start index lists prefixes; it is not the apply set. Dialogue language already stored in `prompt.md` stays for the task.
16
16
  4. **Activate seeds** — if `.ai.local/rules-library/<seed>.md` on the active chain matches the task, treat it as the applicable local rule and tell the owner to move it into that overlay's `rules/`. Seeds stay inactive until moved. Do not read the whole library up front.
@@ -83,6 +83,7 @@ The verdict and the receipt are the same decision expressed twice — never let
83
83
  - Reserve a notes-only verdict for `nit`/informational items. Reporting a non-cosmetic fixable defect as a note converts it into unplanned out-of-band work and leaves it unrecorded in the run ledger.
84
84
  - A divergence between the frozen spec/design and the shipped code is a finding, never a note: cite the spec line and the code line in the same finding.
85
85
  - Before freezing a wire contract, confirm the stated behaviour against the repository's existing handler/decoder convention; a spec that contradicts the codebase convention is the same finding class.
86
+ - Every finding you leave `open` in the ledger carries `owner` and `due`, and `accepted`/`deferred` also carry a `followUp` task slug. `node .ai.local/scripts/team-db.mjs ledger-check` refuses the receipt otherwise and the chain hook relays its message verbatim: leaving a finding open is a contract with a person and a date, not a disposition word.
86
87
 
87
88
  ## Stack notes
88
89
 
@@ -18,14 +18,14 @@ Rules for **preset authors** (`packages/ai-rules/presets/**`). Not always-on in
18
18
  | Layer | Where | What to put |
19
19
  |-------|-------|-------------|
20
20
  | **Core** | `presets/_shared/core/**` | Stack-agnostic prose + checklists; no frontmatter; no paths `app/**`, `Features/**`, Playwright, xcodebuild |
21
- | **Stack** | `presets/{cursor\|claude\|mavis\|opencode}/<stack>/` | Domain/tooling, stack always-on set (3–10), stack examples in **Stack notes** |
22
- | **Platform** | Cursor `.mdc` / Claude `.md` / Mavis `.md` / OpenCode `.md` | Frontmatter (`alwaysApply`/`globs` vs `paths:` vs OpenCode `mode`/`permission`), platform-only (`BUGBOT.md`, `CLAUDE.md`) |
21
+ | **Stack** | `presets/{cursor\|claude\|mavis\|opencode\|zcode}/<stack>/` | Domain/tooling, stack always-on set (3–10), stack examples in **Stack notes** |
22
+ | **Platform** | Cursor `.mdc` / Claude `.md` / Mavis `.md` / OpenCode `.md` / ZCode `.md` | Frontmatter (`alwaysApply`/`globs` vs `paths:` vs OpenCode `mode`/`permission`), platform-only (`BUGBOT.md`, `CLAUDE.md`) |
23
23
 
24
24
  ## Where to put a new rule
25
25
 
26
26
  1. Shared principles for all stacks → **core** + adapters with `<!-- shared-core: … -->`.
27
- 2. Only one of the installable stacks (`next` / `nuxt` / `svelte` / `ios-swift` / `android-kotlin` / `go` / `java` / `mcp-ts` / `php-hexagonal` / `php-laravel`) → **stack-specific** (not in `_shared`).
28
- 3. Only Cursor, Claude, Mavis, or OpenCode packaging → platform artifact / frontmatter; do not duplicate semantics.
27
+ 2. Only one of the installable stacks (`next` / `nuxt` / `svelte` / `mol` / `ios-swift` / `android-kotlin` / `go` / `java` / `mcp-ts` / `php-hexagonal` / `php-laravel`) → **stack-specific** (not in `_shared`).
28
+ 3. Only Cursor, Claude, Mavis, OpenCode, or ZCode packaging → platform artifact / frontmatter; do not duplicate semantics.
29
29
 
30
30
  ## SoT
31
31
 
@@ -22,12 +22,13 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
22
22
  - [ ] **Twin:** Cursor change → run `generate-claude.mjs --stack <stack>` and commit the Claude twin **same PR** (**FAIL** if missing or stale on next, nuxt, svelte, ios-swift, android-kotlin, go, java, mcp-ts, php-hexagonal, and php-laravel — see `preset-twin-sync`)
23
23
  - [ ] **Mavis derive:** mapped `cursor/<stack>/` change → `mavis/<stack>/` + `adapter-map.json` **same PR** when the stack is in `releasedStacks` (run `generate-mavis.mjs --stack <stack>` + `check-mavis-adapter-map.mjs`; see `preset-twin-sync` § Mavis derivation)
24
24
  - [ ] **OpenCode derive:** mapped `cursor/<stack>/` change → `opencode/<stack>/` + `adapter-map.json` **same PR** when the stack is in `releasedStacks` (run `generate-opencode.mjs --stack <stack>` + `check-opencode-adapter-map.mjs`; see `preset-twin-sync` § OpenCode derivation)
25
+ - [ ] **ZCode derive:** mapped `cursor/<stack>/` change → `zcode/<stack>/` + `adapter-map.json` **same PR** when the stack is in `releasedStacks` (run `generate-zcode.mjs --stack <stack>` + `check-zcode-adapter-map.mjs`; see `preset-twin-sync` § ZCode derivation)
25
26
  - [ ] **Mapping:** `claude/<stack>/rules/README.md` mapping table is current
26
27
  - [ ] **Token budget:** Cursor `alwaysApply` and Claude session-start both **3–10** (extra slots reserved for `ai-local-overlay`); body sum ≤4000; meta rules not always-on
27
28
  - [ ] **Local overlay coverage:** every installable stack ships `ai-local-overlay.mdc` (Cursor) and `ai-local-overlay.md` (Claude) with `MANDATORY` + acknowledgement format + `docs/LOCAL-OVERLAY.md` pointer; Claude twin listed in `claude/<stack>/rules/README.md` mapping table. Run `packages/ai-rules/scripts/check-local-overlay.sh`.
28
29
  - [ ] **Leakage:** no foreign stack agent stems / handoff strings (`preset-no-cross-stack-leakage`)
29
30
  - [ ] **Hook-only lifecycle:** `status.json` / `metrics.json` writes happen only inside `hooks/`; agents read but never rewrite lifecycle fields. Run `packages/ai-rules/scripts/check-hook-only-lifecycle.sh`.
30
- - [ ] **Chain fork:** the byte-wise MD5 uniqueness of `chain-team-phases.sh` holds pairwise among every stack under `presets/cursor/` × Cursor/Claude platforms, and each released Mavis/OpenCode stack hook must also differ from the Cursor and Claude twins of the same stack. Run `packages/ai-rules/scripts/check-chain-hook-coverage.sh` and `packages/ai-rules/scripts/test-chain-team-phases-coverage.mjs`.
31
+ - [ ] **Chain fork:** the byte-wise MD5 uniqueness of `chain-team-phases.sh` holds pairwise among every stack under `presets/cursor/` × Cursor/Claude platforms, and each released Mavis/OpenCode/ZCode stack hook must also differ from the Cursor and Claude twins of the same stack. Run `packages/ai-rules/scripts/check-chain-hook-coverage.sh` and `packages/ai-rules/scripts/test-chain-team-phases-coverage.mjs`.
31
32
  - [ ] **Twin depth:** domain ≥15 lines; thin aliases documented
32
33
  - [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
33
34
  - [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
@@ -20,21 +20,22 @@ Cursor `.mdc` is the **SoT per stack**; every other platform tree is derived in
20
20
  | **Claude twin** | `cursor/<stack>/rules/*.mdc` | `generate-claude.mjs --stack <stack>`; destination row **required** in `claude/<stack>/rules/README.md` |
21
21
  | **Mavis** | `cursor/<stack>/**` | `generate-mavis.mjs --stack <stack>`; manifest `adapter-map.json` required |
22
22
  | **OpenCode** | `cursor/<stack>/**` | `generate-opencode.mjs --stack <stack>`; manifest `adapter-map.json` required |
23
+ | **ZCode** | `cursor/<stack>/**` | `generate-zcode.mjs --stack <stack>`; manifest `adapter-map.json` required |
23
24
 
24
- Every stack directory under `packages/ai-rules/presets/cursor/` is a twin source; do not hardcode the stack count. Mavis and OpenCode are **platform adapters**, not Claude-style topic twins; never derive OpenCode from Claude.
25
+ Every stack directory under `packages/ai-rules/presets/cursor/` is a twin source; do not hardcode the stack count. Mavis, OpenCode, and ZCode are **platform adapters**, not Claude-style topic twins; never derive one of them from Claude.
25
26
 
26
27
  ```text
27
- _shared/core → cursor/<stack> → { claude/<stack>, mavis/<stack>, opencode/<stack> }
28
+ _shared/core → cursor/<stack> → { claude/<stack>, mavis/<stack>, opencode/<stack>, zcode/<stack> }
28
29
  ```
29
30
 
30
- Validate: `check-mavis-adapter-map.mjs`, `check-opencode-adapter-map.mjs`, `check-shared-core-drift.sh`.
31
+ Validate: `check-mavis-adapter-map.mjs`, `check-opencode-adapter-map.mjs`, `check-zcode-adapter-map.mjs`, `check-shared-core-drift.sh`.
31
32
 
32
33
  ## Same-PR checklist
33
34
 
34
35
  1. Edit the Cursor rule first (body + frontmatter).
35
36
  2. Add or update the Claude README mapping row when the stem/path changed, then run `generate-claude.mjs --stack <stack>`.
36
37
  3. Core changed → sync every `<!-- shared-core: … -->` consumer (`sync-shared-core-embeds.sh`).
37
- 4. Cursor source changed → run `yarn fix:generated` to regenerate Claude, Mavis, and OpenCode and recapture required CLI goldens.
38
+ 4. Cursor source changed → run `yarn fix:generated` to regenerate Claude, Mavis, OpenCode, and ZCode and recapture required CLI goldens.
38
39
 
39
40
  ## Twin depth
40
41
 
@@ -45,6 +46,12 @@ Validate: `check-mavis-adapter-map.mjs`, `check-opencode-adapter-map.mjs`, `chec
45
46
  ## Severity (structure gates)
46
47
 
47
48
  - Missing or stale generated Claude twin for a changed Cursor rule → **FAIL** (every stack under `presets/cursor/`; mapping table required).
48
- - `cursor/<stack>` mapped source changed without mavis / opencode regeneration, or with `adapter-map.json` `sourceRevision` drift → **FAIL**.
49
+ - `cursor/<stack>` mapped source changed without mavis / opencode / zcode regeneration, or with `adapter-map.json` `sourceRevision` drift → **FAIL**.
50
+
51
+ ## Generated vs hand-maintained
52
+
53
+ - Mavis, OpenCode, and ZCode trees are deleted and derived from Cursor on each `fix:generated`.
54
+ - Claude **rules**, `team/upstream`, and the hooks `generateClaudeStack` emits are derived. Claude **agents, commands, skills, `CLAUDE.md`, and `settings.json`** stay hand-maintained twins. Parity is the ratchet in `check-claude-agent-parity.mjs` and `check-preset-twin-drift.mjs`, not a byte copy.
55
+ - `compact-shell-output.mjs` is Cursor-only: it returns Cursor `updated_input`. OpenCode compacts with `.opencode/plugins/output-guard/`. Claude `PreToolUse` returns `permissionDecision` only. Mavis and ZCode omit the hook because they have no registration schema.
49
56
 
50
57
  Dogfood: sync packages → root `.cursor/` after Cursor SoT changes (never the reverse): `sync-dogfood-cursor.sh`.
@@ -47,7 +47,7 @@ Before you run the project gate and write the terminal validation receipt, self-
47
47
 
48
48
  Record a `## Self-review` block in `validation-report.md` (goal/AC coverage, evidence, alignment/drift). Optional loop (see the requestable `self-review-and-context-hygiene` contract). In-task self-learning loop: run `node .ai.local/scripts/run.mjs` at the pre-receipt self-review when the engine exists; capture one wrong-turn with `node .ai.local/scripts/signals.mjs --append '<json>'` and inspect read-only with `node .ai.local/scripts/run.mjs --status`. Keep the loop deterministic: it runs no model-driven pass — rule text is template-derived from the validated signature; a model-driven pass is not part of the loop, and if one is ever added it must be default-off and may write only to the staged band. Ratchet: no self-review / context-health pass / re-anchor ceremony for `bounded`/`spike` tasks (or the `light` profile).
49
49
 
50
- A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | evidence | signature |`; after appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix any header it rejects.
50
+ A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | owner | due | followUp | evidence | signature |`; a row written on or after 2026-11-22 that stays `open`, `accepted`, or `deferred` needs an `owner` that is a person and not a placeholder plus a `due` as YYYY-MM-DD, `accepted` and `deferred` also need a `followUp` naming an existing task slug. A row is legacy — never failed, counted in `legacyRows` — when it has no usable `at`, which is the one date git cannot supply, or when its `at` is before that date; neither clause reads the header. The header only decides a dated row: a post-cutoff row under a stale header still fails, so move the table to the canonical header. After appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix what it rejects.
51
51
 
52
52
  ## Output
53
53
 
@@ -56,6 +56,9 @@ Write `.ai.local/team/tasks/<slug>/validation-report.md`:
56
56
  ```markdown
57
57
  # Validation: <slug>
58
58
 
59
+ tree: <sha> (+N dirty)
60
+ run-at: <ISO>
61
+
59
62
  ## Verdict
60
63
  PASS | FAIL
61
64
 
@@ -54,7 +54,7 @@ Before you emit the terminal review receipt, self-audit the review artifact: eve
54
54
 
55
55
  Record a `## Self-review` block in `review.md` (goal/AC coverage, evidence, alignment/drift). Optional loop (see the requestable `self-review-and-context-hygiene` contract). In-task self-learning loop: run `node .ai.local/scripts/run.mjs` at the pre-receipt self-review when the engine exists; capture one wrong-turn with `node .ai.local/scripts/signals.mjs --append '<json>'` and inspect read-only with `node .ai.local/scripts/run.mjs --status`. Keep the loop deterministic: it runs no model-driven pass — rule text is template-derived from the validated signature; a model-driven pass is not part of the loop, and if one is ever added it must be default-off and may write only to the staged band. Ratchet: no self-review / context-health pass / re-anchor ceremony for `bounded`/`spike` tasks (or the `light` profile).
56
56
 
57
- A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Append each finding to `review-ledger.md` (`disposition: open`) before the receipt. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | evidence | signature |`; after appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix any header it rejects.
57
+ A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Append each finding to `review-ledger.md` (`disposition: open`) before the receipt. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | owner | due | followUp | evidence | signature |`; a row written on or after 2026-11-22 that stays `open`, `accepted`, or `deferred` needs an `owner` that is a person and not a placeholder plus a `due` as YYYY-MM-DD, `accepted` and `deferred` also need a `followUp` naming an existing task slug. A row is legacy — never failed, counted in `legacyRows` — when it has no usable `at`, which is the one date git cannot supply, or when its `at` is before that date; neither clause reads the header. The header only decides a dated row: a post-cutoff row under a stale header still fails, so move the table to the canonical header. After appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix what it rejects.
58
58
 
59
59
  ## Review artifact
60
60
 
@@ -86,7 +86,7 @@ Before you set `fixApplied: true` and emit the terminal receipt, self-audit the
86
86
 
87
87
  Record a `## Self-review` block in `debug-report.md` (goal/AC coverage, evidence, alignment/drift). Optional loop (see the requestable `self-review-and-context-hygiene` contract). In-task self-learning loop: run `node .ai.local/scripts/run.mjs` at the pre-receipt self-review when the engine exists; capture one wrong-turn with `node .ai.local/scripts/signals.mjs --append '<json>'` and inspect read-only with `node .ai.local/scripts/run.mjs --status`. Keep the loop deterministic: it runs no model-driven pass — rule text is template-derived from the validated signature; a model-driven pass is not part of the loop, and if one is ever added it must be default-off and may write only to the staged band. Ratchet: no self-review / context-health pass / re-anchor ceremony for `bounded`/`spike` tasks (or the `light` profile).
88
88
 
89
- A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | evidence | signature |`; after appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix any header it rejects.
89
+ A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | owner | due | followUp | evidence | signature |`; a row written on or after 2026-11-22 that stays `open`, `accepted`, or `deferred` needs an `owner` that is a person and not a placeholder plus a `due` as YYYY-MM-DD, `accepted` and `deferred` also need a `followUp` naming an existing task slug. A row is legacy — never failed, counted in `legacyRows` — when it has no usable `at`, which is the one date git cannot supply, or when its `at` is before that date; neither clause reads the header. The header only decides a dated row: a post-cutoff row under a stale header still fails, so move the table to the canonical header. After appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix what it rejects.
90
90
 
91
91
  ## MCP usage
92
92
 
@@ -83,7 +83,7 @@ Before you emit the terminal implementation receipt (per wave for multi-wave wor
83
83
 
84
84
  Record a `## Self-review` block in `implementation.md` (goal/AC coverage, evidence, alignment/drift). Optional loop (see the requestable `self-review-and-context-hygiene` contract). In-task self-learning loop: run `node .ai.local/scripts/run.mjs` at the pre-receipt self-review when the engine exists; capture one wrong-turn with `node .ai.local/scripts/signals.mjs --append '<json>'` and inspect read-only with `node .ai.local/scripts/run.mjs --status`. Keep the loop deterministic: it runs no model-driven pass — rule text is template-derived from the validated signature; a model-driven pass is not part of the loop, and if one is ever added it must be default-off and may write only to the staged band. Ratchet: no self-review / context-health pass / re-anchor ceremony for `bounded`/`spike` tasks (or the `light` profile).
85
85
 
86
- A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | evidence | signature |`; after appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix any header it rejects.
86
+ A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | owner | due | followUp | evidence | signature |`; a row written on or after 2026-11-22 that stays `open`, `accepted`, or `deferred` needs an `owner` that is a person and not a placeholder plus a `due` as YYYY-MM-DD, `accepted` and `deferred` also need a `followUp` naming an existing task slug. A row is legacy — never failed, counted in `legacyRows` — when it has no usable `at`, which is the one date git cannot supply, or when its `at` is before that date; neither clause reads the header. The header only decides a dated row: a post-cutoff row under a stale header still fails, so move the table to the canonical header. After appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix what it rejects.
87
87
 
88
88
  ## UX design (behavioral)
89
89
 
@@ -52,7 +52,7 @@ Before you emit the terminal analysis receipt, self-audit the goal frame and dec
52
52
 
53
53
  Record a `## Self-review` block in `brief.md` (goal/AC coverage, evidence, alignment/drift). Optional loop (see the requestable `self-review-and-context-hygiene` contract). In-task self-learning loop: run `node .ai.local/scripts/run.mjs` at the pre-receipt self-review when the engine exists; capture one wrong-turn with `node .ai.local/scripts/signals.mjs --append '<json>'` and inspect read-only with `node .ai.local/scripts/run.mjs --status`. Keep the loop deterministic: it runs no model-driven pass — rule text is template-derived from the validated signature; a model-driven pass is not part of the loop, and if one is ever added it must be default-off and may write only to the staged band. Ratchet: no self-review / context-health pass / re-anchor ceremony for `bounded`/`spike` tasks (or the `light` profile).
54
54
 
55
- A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | evidence | signature |`; after appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix any header it rejects.
55
+ A self-review defect that changes the output appends one `review-ledger.md` row (`source: self`, `fair: yes`, `disposition: fixed`) before the receipt. Do not start implementation when `goal.md` is missing. Ledger rows go under the canonical header `| id | at | source | summary | fair | disposition | owner | due | followUp | evidence | signature |`; a row written on or after 2026-11-22 that stays `open`, `accepted`, or `deferred` needs an `owner` that is a person and not a placeholder plus a `due` as YYYY-MM-DD, `accepted` and `deferred` also need a `followUp` naming an existing task slug. A row is legacy — never failed, counted in `legacyRows` — when it has no usable `at`, which is the one date git cannot supply, or when its `at` is before that date; neither clause reads the header. The header only decides a dated row: a post-cutoff row under a stale header still fails, so move the table to the canonical header. After appending, run `node .ai.local/scripts/team-db.mjs ledger-check --slug <slug>` and fix what it rejects.
56
56
 
57
57
  ## Clarification cycle
58
58