@bonesofspring/ai-rules 0.2.44 → 0.2.46

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 (383) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/bin/lib/engine-scripts.js +6 -1
  3. package/docs/MAVIS.md +1 -1
  4. package/docs/OPENCODE.md +1 -1
  5. package/package.json +1 -1
  6. package/presets/_shared/ai-local/scripts/efficacy-oracle.mjs +10 -2
  7. package/presets/_shared/ai-local/scripts/manifest.mjs +406 -0
  8. package/presets/_shared/core/agent-team/agent-artifact-contracts.md +23 -1
  9. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +11 -2
  10. package/presets/_shared/core/review/code-review-mr.md +9 -0
  11. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +2 -2
  12. package/presets/claude/android-kotlin/agents/build-verifier.md +1 -1
  13. package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -1
  14. package/presets/claude/android-kotlin/agents/debugger.md +1 -1
  15. package/presets/claude/android-kotlin/agents/feature-developer.md +1 -1
  16. package/presets/claude/android-kotlin/agents/qa-tester.md +1 -1
  17. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +2 -2
  18. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +11 -2
  19. package/presets/claude/android-kotlin/rules/tooling-and-review/code-review.md +9 -0
  20. package/presets/claude/android-kotlin/team/README.md +17 -0
  21. package/presets/claude/go/agents/build-verifier.md +1 -1
  22. package/presets/claude/go/agents/code-reviewer.md +1 -1
  23. package/presets/claude/go/agents/debugger.md +1 -1
  24. package/presets/claude/go/agents/feature-developer.md +1 -1
  25. package/presets/claude/go/agents/qa-tester.md +1 -1
  26. package/presets/claude/go/hooks/chain-team-phases.sh +2 -2
  27. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +11 -2
  28. package/presets/claude/go/rules/tooling-and-review/code-review.md +9 -0
  29. package/presets/claude/go/team/README.md +17 -0
  30. package/presets/claude/ios-swift/agents/build-verifier.md +1 -1
  31. package/presets/claude/ios-swift/agents/code-reviewer.md +1 -1
  32. package/presets/claude/ios-swift/agents/debugger.md +1 -1
  33. package/presets/claude/ios-swift/agents/feature-developer.md +1 -1
  34. package/presets/claude/ios-swift/agents/qa-tester.md +1 -1
  35. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +2 -2
  36. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +11 -2
  37. package/presets/claude/ios-swift/rules/tooling-and-review/code-review.md +9 -0
  38. package/presets/claude/ios-swift/team/README.md +17 -0
  39. package/presets/claude/java/agents/build-verifier.md +1 -1
  40. package/presets/claude/java/agents/code-reviewer.md +1 -1
  41. package/presets/claude/java/agents/debugger.md +1 -1
  42. package/presets/claude/java/agents/feature-developer.md +1 -1
  43. package/presets/claude/java/agents/qa-tester.md +1 -1
  44. package/presets/claude/java/hooks/chain-team-phases.sh +2 -2
  45. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +11 -2
  46. package/presets/claude/java/rules/tooling-and-review/code-review.md +9 -0
  47. package/presets/claude/java/team/README.md +17 -0
  48. package/presets/claude/mcp-ts/agents/build-verifier.md +1 -1
  49. package/presets/claude/mcp-ts/agents/feature-developer.md +1 -1
  50. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +2 -2
  51. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +11 -2
  52. package/presets/claude/mcp-ts/rules/tooling-and-review/code-review.md +9 -0
  53. package/presets/claude/mcp-ts/team/README.md +17 -0
  54. package/presets/claude/next/agents/build-verifier.md +1 -1
  55. package/presets/claude/next/agents/code-reviewer.md +1 -1
  56. package/presets/claude/next/agents/debugger.md +1 -1
  57. package/presets/claude/next/agents/feature-developer.md +1 -1
  58. package/presets/claude/next/agents/qa-tester.md +1 -1
  59. package/presets/claude/next/agents/security-reviewer.md +5 -0
  60. package/presets/claude/next/hooks/chain-team-phases.sh +2 -2
  61. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +11 -2
  62. package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +9 -0
  63. package/presets/claude/next/team/README.md +17 -0
  64. package/presets/claude/nuxt/agents/build-verifier.md +1 -1
  65. package/presets/claude/nuxt/agents/code-reviewer.md +1 -1
  66. package/presets/claude/nuxt/agents/debugger.md +1 -1
  67. package/presets/claude/nuxt/agents/feature-developer.md +1 -1
  68. package/presets/claude/nuxt/agents/qa-tester.md +1 -1
  69. package/presets/claude/nuxt/hooks/chain-team-phases.sh +2 -2
  70. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +11 -2
  71. package/presets/claude/nuxt/rules/tooling-and-review/code-review-mr.md +9 -0
  72. package/presets/claude/nuxt/team/README.md +17 -0
  73. package/presets/claude/php-hexagonal/agents/build-verifier.md +1 -1
  74. package/presets/claude/php-hexagonal/agents/code-reviewer.md +1 -1
  75. package/presets/claude/php-hexagonal/agents/debugger.md +1 -1
  76. package/presets/claude/php-hexagonal/agents/feature-developer.md +1 -1
  77. package/presets/claude/php-hexagonal/agents/qa-tester.md +1 -1
  78. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +2 -2
  79. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +11 -2
  80. package/presets/claude/php-hexagonal/rules/tooling-and-review/code-review.md +9 -0
  81. package/presets/claude/php-hexagonal/team/README.md +17 -0
  82. package/presets/claude/php-laravel/agents/build-verifier.md +1 -1
  83. package/presets/claude/php-laravel/agents/code-reviewer.md +1 -1
  84. package/presets/claude/php-laravel/agents/debugger.md +1 -1
  85. package/presets/claude/php-laravel/agents/feature-developer.md +1 -1
  86. package/presets/claude/php-laravel/agents/qa-tester.md +1 -1
  87. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +2 -2
  88. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +11 -2
  89. package/presets/claude/php-laravel/rules/tooling-and-review/code-review.md +9 -0
  90. package/presets/claude/php-laravel/team/README.md +17 -0
  91. package/presets/claude/svelte/agents/build-verifier.md +1 -1
  92. package/presets/claude/svelte/agents/code-reviewer.md +1 -1
  93. package/presets/claude/svelte/agents/debugger.md +1 -1
  94. package/presets/claude/svelte/agents/feature-developer.md +1 -1
  95. package/presets/claude/svelte/agents/qa-tester.md +1 -1
  96. package/presets/claude/svelte/hooks/chain-team-phases.sh +2 -2
  97. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +11 -2
  98. package/presets/claude/svelte/rules/tooling-and-review/code-review-mr.md +9 -0
  99. package/presets/claude/svelte/team/README.md +17 -0
  100. package/presets/cursor/android-kotlin/agents/build-verifier.md +1 -1
  101. package/presets/cursor/android-kotlin/agents/code-reviewer.md +1 -1
  102. package/presets/cursor/android-kotlin/agents/debugger.md +1 -1
  103. package/presets/cursor/android-kotlin/agents/feature-developer.md +1 -1
  104. package/presets/cursor/android-kotlin/agents/qa-tester.md +1 -1
  105. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +2 -2
  106. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
  107. package/presets/cursor/android-kotlin/rules/code-review-mr.mdc +9 -0
  108. package/presets/cursor/android-kotlin/team/README.md +17 -0
  109. package/presets/cursor/go/agents/build-verifier.md +1 -1
  110. package/presets/cursor/go/agents/code-reviewer.md +1 -1
  111. package/presets/cursor/go/agents/debugger.md +1 -1
  112. package/presets/cursor/go/agents/feature-developer.md +1 -1
  113. package/presets/cursor/go/agents/qa-tester.md +1 -1
  114. package/presets/cursor/go/hooks/chain-team-phases.sh +2 -2
  115. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
  116. package/presets/cursor/go/rules/code-review-mr.mdc +9 -0
  117. package/presets/cursor/go/team/README.md +17 -0
  118. package/presets/cursor/ios-swift/agents/build-verifier.md +1 -1
  119. package/presets/cursor/ios-swift/agents/code-reviewer.md +1 -1
  120. package/presets/cursor/ios-swift/agents/debugger.md +1 -1
  121. package/presets/cursor/ios-swift/agents/feature-developer.md +1 -1
  122. package/presets/cursor/ios-swift/agents/qa-tester.md +1 -1
  123. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +2 -2
  124. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
  125. package/presets/cursor/ios-swift/rules/code-review-mr.mdc +9 -0
  126. package/presets/cursor/ios-swift/team/README.md +17 -0
  127. package/presets/cursor/java/agents/build-verifier.md +1 -1
  128. package/presets/cursor/java/agents/code-reviewer.md +1 -1
  129. package/presets/cursor/java/agents/debugger.md +1 -1
  130. package/presets/cursor/java/agents/feature-developer.md +1 -1
  131. package/presets/cursor/java/agents/qa-tester.md +1 -1
  132. package/presets/cursor/java/hooks/chain-team-phases.sh +2 -2
  133. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
  134. package/presets/cursor/java/rules/code-review-mr.mdc +9 -0
  135. package/presets/cursor/java/team/README.md +17 -0
  136. package/presets/cursor/mcp-ts/agents/build-verifier.md +1 -1
  137. package/presets/cursor/mcp-ts/agents/feature-developer.md +1 -1
  138. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +2 -2
  139. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
  140. package/presets/cursor/mcp-ts/rules/code-review-mr.mdc +9 -0
  141. package/presets/cursor/mcp-ts/team/README.md +17 -0
  142. package/presets/cursor/next/agents/build-verifier.md +1 -1
  143. package/presets/cursor/next/agents/code-reviewer.md +1 -1
  144. package/presets/cursor/next/agents/debugger.md +1 -1
  145. package/presets/cursor/next/agents/feature-developer.md +1 -1
  146. package/presets/cursor/next/agents/qa-tester.md +1 -1
  147. package/presets/cursor/next/agents/security-reviewer.md +5 -0
  148. package/presets/cursor/next/hooks/chain-team-phases.sh +2 -2
  149. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
  150. package/presets/cursor/next/rules/code-review-mr.mdc +9 -0
  151. package/presets/cursor/next/team/README.md +17 -0
  152. package/presets/cursor/nuxt/agents/build-verifier.md +1 -1
  153. package/presets/cursor/nuxt/agents/code-reviewer.md +1 -1
  154. package/presets/cursor/nuxt/agents/debugger.md +1 -1
  155. package/presets/cursor/nuxt/agents/feature-developer.md +1 -1
  156. package/presets/cursor/nuxt/agents/qa-tester.md +1 -1
  157. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +2 -2
  158. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
  159. package/presets/cursor/nuxt/rules/code-review-mr.mdc +9 -0
  160. package/presets/cursor/nuxt/team/README.md +17 -0
  161. package/presets/cursor/php-hexagonal/agents/build-verifier.md +1 -1
  162. package/presets/cursor/php-hexagonal/agents/code-reviewer.md +1 -1
  163. package/presets/cursor/php-hexagonal/agents/debugger.md +1 -1
  164. package/presets/cursor/php-hexagonal/agents/feature-developer.md +1 -1
  165. package/presets/cursor/php-hexagonal/agents/qa-tester.md +1 -1
  166. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +2 -2
  167. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
  168. package/presets/cursor/php-hexagonal/rules/code-review-mr.mdc +9 -0
  169. package/presets/cursor/php-hexagonal/team/README.md +17 -0
  170. package/presets/cursor/php-laravel/agents/build-verifier.md +1 -1
  171. package/presets/cursor/php-laravel/agents/code-reviewer.md +1 -1
  172. package/presets/cursor/php-laravel/agents/debugger.md +1 -1
  173. package/presets/cursor/php-laravel/agents/feature-developer.md +1 -1
  174. package/presets/cursor/php-laravel/agents/qa-tester.md +1 -1
  175. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +2 -2
  176. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
  177. package/presets/cursor/php-laravel/rules/code-review-mr.mdc +9 -0
  178. package/presets/cursor/php-laravel/team/README.md +17 -0
  179. package/presets/cursor/svelte/agents/build-verifier.md +1 -1
  180. package/presets/cursor/svelte/agents/code-reviewer.md +1 -1
  181. package/presets/cursor/svelte/agents/debugger.md +1 -1
  182. package/presets/cursor/svelte/agents/feature-developer.md +1 -1
  183. package/presets/cursor/svelte/agents/qa-tester.md +1 -1
  184. package/presets/cursor/svelte/hooks/chain-team-phases.sh +2 -2
  185. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
  186. package/presets/cursor/svelte/rules/code-review-mr.mdc +9 -0
  187. package/presets/cursor/svelte/team/README.md +17 -0
  188. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  189. package/presets/mavis/android-kotlin/agents/build-verifier.md +1 -1
  190. package/presets/mavis/android-kotlin/agents/code-reviewer.md +1 -1
  191. package/presets/mavis/android-kotlin/agents/debugger.md +1 -1
  192. package/presets/mavis/android-kotlin/agents/feature-developer.md +1 -1
  193. package/presets/mavis/android-kotlin/agents/qa-tester.md +1 -1
  194. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +2 -2
  195. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +11 -2
  196. package/presets/mavis/android-kotlin/rules/code-review-mr.md +9 -0
  197. package/presets/mavis/android-kotlin/team/README.md +17 -0
  198. package/presets/mavis/go/adapter-map.json +1 -1
  199. package/presets/mavis/go/agents/build-verifier.md +1 -1
  200. package/presets/mavis/go/agents/code-reviewer.md +1 -1
  201. package/presets/mavis/go/agents/debugger.md +1 -1
  202. package/presets/mavis/go/agents/feature-developer.md +1 -1
  203. package/presets/mavis/go/agents/qa-tester.md +1 -1
  204. package/presets/mavis/go/hooks/chain-team-phases.sh +2 -2
  205. package/presets/mavis/go/rules/agent-team-orchestrator.md +11 -2
  206. package/presets/mavis/go/rules/code-review-mr.md +9 -0
  207. package/presets/mavis/go/team/README.md +17 -0
  208. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  209. package/presets/mavis/ios-swift/agents/build-verifier.md +1 -1
  210. package/presets/mavis/ios-swift/agents/code-reviewer.md +1 -1
  211. package/presets/mavis/ios-swift/agents/debugger.md +1 -1
  212. package/presets/mavis/ios-swift/agents/feature-developer.md +1 -1
  213. package/presets/mavis/ios-swift/agents/qa-tester.md +1 -1
  214. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +2 -2
  215. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +11 -2
  216. package/presets/mavis/ios-swift/rules/code-review-mr.md +9 -0
  217. package/presets/mavis/ios-swift/team/README.md +17 -0
  218. package/presets/mavis/java/adapter-map.json +1 -1
  219. package/presets/mavis/java/agents/build-verifier.md +1 -1
  220. package/presets/mavis/java/agents/code-reviewer.md +1 -1
  221. package/presets/mavis/java/agents/debugger.md +1 -1
  222. package/presets/mavis/java/agents/feature-developer.md +1 -1
  223. package/presets/mavis/java/agents/qa-tester.md +1 -1
  224. package/presets/mavis/java/hooks/chain-team-phases.sh +2 -2
  225. package/presets/mavis/java/rules/agent-team-orchestrator.md +11 -2
  226. package/presets/mavis/java/rules/code-review-mr.md +9 -0
  227. package/presets/mavis/java/team/README.md +17 -0
  228. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  229. package/presets/mavis/mcp-ts/agents/build-verifier.md +1 -1
  230. package/presets/mavis/mcp-ts/agents/feature-developer.md +1 -1
  231. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +2 -2
  232. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +11 -2
  233. package/presets/mavis/mcp-ts/rules/code-review-mr.md +9 -0
  234. package/presets/mavis/mcp-ts/team/README.md +17 -0
  235. package/presets/mavis/next/adapter-map.json +1 -1
  236. package/presets/mavis/next/agents/build-verifier.md +1 -1
  237. package/presets/mavis/next/agents/code-reviewer.md +1 -1
  238. package/presets/mavis/next/agents/debugger.md +1 -1
  239. package/presets/mavis/next/agents/feature-developer.md +1 -1
  240. package/presets/mavis/next/agents/qa-tester.md +1 -1
  241. package/presets/mavis/next/agents/security-reviewer.md +5 -0
  242. package/presets/mavis/next/hooks/chain-team-phases.sh +2 -2
  243. package/presets/mavis/next/rules/agent-team-orchestrator.md +11 -2
  244. package/presets/mavis/next/rules/code-review-mr.md +9 -0
  245. package/presets/mavis/next/team/README.md +17 -0
  246. package/presets/mavis/nuxt/adapter-map.json +1 -1
  247. package/presets/mavis/nuxt/agents/build-verifier.md +1 -1
  248. package/presets/mavis/nuxt/agents/code-reviewer.md +1 -1
  249. package/presets/mavis/nuxt/agents/debugger.md +1 -1
  250. package/presets/mavis/nuxt/agents/feature-developer.md +1 -1
  251. package/presets/mavis/nuxt/agents/qa-tester.md +1 -1
  252. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +2 -2
  253. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +11 -2
  254. package/presets/mavis/nuxt/rules/code-review-mr.md +9 -0
  255. package/presets/mavis/nuxt/team/README.md +17 -0
  256. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  257. package/presets/mavis/php-hexagonal/agents/build-verifier.md +1 -1
  258. package/presets/mavis/php-hexagonal/agents/code-reviewer.md +1 -1
  259. package/presets/mavis/php-hexagonal/agents/debugger.md +1 -1
  260. package/presets/mavis/php-hexagonal/agents/feature-developer.md +1 -1
  261. package/presets/mavis/php-hexagonal/agents/qa-tester.md +1 -1
  262. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +2 -2
  263. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +11 -2
  264. package/presets/mavis/php-hexagonal/rules/code-review-mr.md +9 -0
  265. package/presets/mavis/php-hexagonal/team/README.md +17 -0
  266. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  267. package/presets/mavis/php-laravel/agents/build-verifier.md +1 -1
  268. package/presets/mavis/php-laravel/agents/code-reviewer.md +1 -1
  269. package/presets/mavis/php-laravel/agents/debugger.md +1 -1
  270. package/presets/mavis/php-laravel/agents/feature-developer.md +1 -1
  271. package/presets/mavis/php-laravel/agents/qa-tester.md +1 -1
  272. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +2 -2
  273. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +11 -2
  274. package/presets/mavis/php-laravel/rules/code-review-mr.md +9 -0
  275. package/presets/mavis/php-laravel/team/README.md +17 -0
  276. package/presets/mavis/svelte/adapter-map.json +1 -1
  277. package/presets/mavis/svelte/agents/build-verifier.md +1 -1
  278. package/presets/mavis/svelte/agents/code-reviewer.md +1 -1
  279. package/presets/mavis/svelte/agents/debugger.md +1 -1
  280. package/presets/mavis/svelte/agents/feature-developer.md +1 -1
  281. package/presets/mavis/svelte/agents/qa-tester.md +1 -1
  282. package/presets/mavis/svelte/hooks/chain-team-phases.sh +2 -2
  283. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +11 -2
  284. package/presets/mavis/svelte/rules/code-review-mr.md +9 -0
  285. package/presets/mavis/svelte/team/README.md +17 -0
  286. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  287. package/presets/opencode/android-kotlin/agents/build-verifier.md +1 -1
  288. package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -1
  289. package/presets/opencode/android-kotlin/agents/debugger.md +1 -1
  290. package/presets/opencode/android-kotlin/agents/feature-developer.md +1 -1
  291. package/presets/opencode/android-kotlin/agents/qa-tester.md +1 -1
  292. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +2 -2
  293. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +11 -2
  294. package/presets/opencode/android-kotlin/rules/code-review-mr.md +9 -0
  295. package/presets/opencode/android-kotlin/team/README.md +17 -0
  296. package/presets/opencode/go/adapter-map.json +1 -1
  297. package/presets/opencode/go/agents/build-verifier.md +1 -1
  298. package/presets/opencode/go/agents/code-reviewer.md +1 -1
  299. package/presets/opencode/go/agents/debugger.md +1 -1
  300. package/presets/opencode/go/agents/feature-developer.md +1 -1
  301. package/presets/opencode/go/agents/qa-tester.md +1 -1
  302. package/presets/opencode/go/hooks/chain-team-phases.sh +2 -2
  303. package/presets/opencode/go/rules/agent-team-orchestrator.md +11 -2
  304. package/presets/opencode/go/rules/code-review-mr.md +9 -0
  305. package/presets/opencode/go/team/README.md +17 -0
  306. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  307. package/presets/opencode/ios-swift/agents/build-verifier.md +1 -1
  308. package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -1
  309. package/presets/opencode/ios-swift/agents/debugger.md +1 -1
  310. package/presets/opencode/ios-swift/agents/feature-developer.md +1 -1
  311. package/presets/opencode/ios-swift/agents/qa-tester.md +1 -1
  312. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +2 -2
  313. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +11 -2
  314. package/presets/opencode/ios-swift/rules/code-review-mr.md +9 -0
  315. package/presets/opencode/ios-swift/team/README.md +17 -0
  316. package/presets/opencode/java/adapter-map.json +1 -1
  317. package/presets/opencode/java/agents/build-verifier.md +1 -1
  318. package/presets/opencode/java/agents/code-reviewer.md +1 -1
  319. package/presets/opencode/java/agents/debugger.md +1 -1
  320. package/presets/opencode/java/agents/feature-developer.md +1 -1
  321. package/presets/opencode/java/agents/qa-tester.md +1 -1
  322. package/presets/opencode/java/hooks/chain-team-phases.sh +2 -2
  323. package/presets/opencode/java/rules/agent-team-orchestrator.md +11 -2
  324. package/presets/opencode/java/rules/code-review-mr.md +9 -0
  325. package/presets/opencode/java/team/README.md +17 -0
  326. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  327. package/presets/opencode/mcp-ts/agents/build-verifier.md +1 -1
  328. package/presets/opencode/mcp-ts/agents/feature-developer.md +1 -1
  329. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +2 -2
  330. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +11 -2
  331. package/presets/opencode/mcp-ts/rules/code-review-mr.md +9 -0
  332. package/presets/opencode/mcp-ts/team/README.md +17 -0
  333. package/presets/opencode/next/adapter-map.json +1 -1
  334. package/presets/opencode/next/agents/build-verifier.md +1 -1
  335. package/presets/opencode/next/agents/code-reviewer.md +1 -1
  336. package/presets/opencode/next/agents/debugger.md +1 -1
  337. package/presets/opencode/next/agents/feature-developer.md +1 -1
  338. package/presets/opencode/next/agents/qa-tester.md +1 -1
  339. package/presets/opencode/next/agents/security-reviewer.md +5 -0
  340. package/presets/opencode/next/hooks/chain-team-phases.sh +2 -2
  341. package/presets/opencode/next/rules/agent-team-orchestrator.md +11 -2
  342. package/presets/opencode/next/rules/code-review-mr.md +9 -0
  343. package/presets/opencode/next/team/README.md +17 -0
  344. package/presets/opencode/nuxt/adapter-map.json +1 -1
  345. package/presets/opencode/nuxt/agents/build-verifier.md +1 -1
  346. package/presets/opencode/nuxt/agents/code-reviewer.md +1 -1
  347. package/presets/opencode/nuxt/agents/debugger.md +1 -1
  348. package/presets/opencode/nuxt/agents/feature-developer.md +1 -1
  349. package/presets/opencode/nuxt/agents/qa-tester.md +1 -1
  350. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +2 -2
  351. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +11 -2
  352. package/presets/opencode/nuxt/rules/code-review-mr.md +9 -0
  353. package/presets/opencode/nuxt/team/README.md +17 -0
  354. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  355. package/presets/opencode/php-hexagonal/agents/build-verifier.md +1 -1
  356. package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -1
  357. package/presets/opencode/php-hexagonal/agents/debugger.md +1 -1
  358. package/presets/opencode/php-hexagonal/agents/feature-developer.md +1 -1
  359. package/presets/opencode/php-hexagonal/agents/qa-tester.md +1 -1
  360. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +2 -2
  361. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +11 -2
  362. package/presets/opencode/php-hexagonal/rules/code-review-mr.md +9 -0
  363. package/presets/opencode/php-hexagonal/team/README.md +17 -0
  364. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  365. package/presets/opencode/php-laravel/agents/build-verifier.md +1 -1
  366. package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -1
  367. package/presets/opencode/php-laravel/agents/debugger.md +1 -1
  368. package/presets/opencode/php-laravel/agents/feature-developer.md +1 -1
  369. package/presets/opencode/php-laravel/agents/qa-tester.md +1 -1
  370. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +2 -2
  371. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +11 -2
  372. package/presets/opencode/php-laravel/rules/code-review-mr.md +9 -0
  373. package/presets/opencode/php-laravel/team/README.md +17 -0
  374. package/presets/opencode/svelte/adapter-map.json +1 -1
  375. package/presets/opencode/svelte/agents/build-verifier.md +1 -1
  376. package/presets/opencode/svelte/agents/code-reviewer.md +1 -1
  377. package/presets/opencode/svelte/agents/debugger.md +1 -1
  378. package/presets/opencode/svelte/agents/feature-developer.md +1 -1
  379. package/presets/opencode/svelte/agents/qa-tester.md +1 -1
  380. package/presets/opencode/svelte/hooks/chain-team-phases.sh +2 -2
  381. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +11 -2
  382. package/presets/opencode/svelte/rules/code-review-mr.md +9 -0
  383. package/presets/opencode/svelte/team/README.md +17 -0
@@ -44,6 +44,15 @@ Procedure details live in skill `code-review`. Required shape:
44
44
  - Vague («looks risky») is not a finding — cite evidence or ask for surrounding file context.
45
45
  - End with a verdict on its own line: **`Safe to merge | needs changes | reject`**.
46
46
 
47
+ ## Verdict and terminal receipt
48
+
49
+ The verdict and the receipt are the same decision expressed twice — never let a fixable defect hide behind "notes".
50
+
51
+ - Any `blocker` or `important` finding (a scale that names `high`/`medium` maps them here) means the MR is **not** mergeable as-is: emit receipt outcome `changes_requested` so the orchestrator runs its existing developer retry, not `completed`.
52
+ - 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.
53
+ - 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.
54
+ - 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.
55
+
47
56
  ## Stack notes
48
57
 
49
58
  On-demand rule for review flows (not always-on).
@@ -56,6 +56,23 @@ Bootstrap a slug by **writing** `pipeline.json` (editor Write tool). Do not `mkd
56
56
 
57
57
  Prefer `phase: executing`. States: `in_progress`, `completed`, `awaiting_approval` (`/task-continue`), `changes_requested`, `validation_failed`, `blocked` (graph mode still dispatches independent ready steps), `awaiting_artifact_receipt`.
58
58
 
59
+ ## artifact-manifest.json — write protocol
60
+
61
+ The manifest is a **whole-file merge target**. Producers rewrite it, and every write refreshes `updatedAt`, so a fragment/replace edit of the JSON fails its match and aborts the receipt. Merge by entry `id` and rewrite the file:
62
+
63
+ ```bash
64
+ node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> \
65
+ --outcome completed --paths brief.md,decomposition.md --acs AC-1 --tasks T1 --attempt <attemptId>
66
+ node .ai.local/scripts/manifest.mjs check --slug <slug>
67
+ ```
68
+
69
+ - Absent file → `manifest.mjs init --slug <slug>` (the hook seeds the same skeleton).
70
+ - Never patch the JSON with a fragment/replace edit (`edit`, `str_replace`, `apply_patch`): a foreign parallel write or a refreshed `updatedAt` breaks the match, the produced artifact ends up without a receipt, and the step stalls in `awaiting_artifact_receipt`.
71
+ - Merge or parse error → re-read and merge again, at most twice, then report `blocked` with the error. Never leave the file truncated.
72
+ - Parallel wave → the writer holds `.manifest.lock` in the task directory, so concurrent producers serialize; a hand-written merge must take the same lock.
73
+ - Plan closure → tick (`- [ ]` → `- [x]`) every `tasks.md` row this receipt closes, in the same turn. An unticked row makes `openspec list` report stale progress and hides the exit criteria from the next agent.
74
+ - Schema and completion conventions: `agent-team/agent-artifact-contracts.md`.
75
+
59
76
  ## Commands
60
77
 
61
78
  ```bash
@@ -51,4 +51,4 @@ A self-review defect that changes the output appends one `review-ledger.md` row
51
51
 
52
52
  ## Receipt binding
53
53
 
54
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
54
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -72,4 +72,4 @@ Write `.ai.local/team/tasks/<slug>/review.md` with verdict APPROVE | REQUEST_CHA
72
72
 
73
73
  ## Receipt binding
74
74
 
75
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
75
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -65,4 +65,4 @@ If a Sentry/Datadog (or similar) MCP is ready and the task is a production error
65
65
 
66
66
  ## Receipt binding
67
67
 
68
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
68
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -111,4 +111,4 @@ Load requestable rule `mcp-usage` when verifying third-party library APIs (Conte
111
111
 
112
112
  ## Receipt binding
113
113
 
114
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
114
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -31,4 +31,4 @@ Coordinate with existing plans under `.ai.local/team/tasks/<slug>/`.
31
31
 
32
32
  ## Receipt binding
33
33
 
34
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
34
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -742,9 +742,9 @@ function readBoundReceiptOutcome(agent, step, resolved) {
742
742
  const seeded = writeSkeletonManifest(manifestPath);
743
743
  const stepIndex = typeof resolved.entry.stepIndex === 'number' ? resolved.entry.stepIndex : 0;
744
744
  if (seeded) {
745
- return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: artifact-manifest.json is missing and the skeleton could not be written (${seeded}). Create .ai.local/team/tasks/${slug}/artifact-manifest.json with {schemaVersion:1, slug, artifacts:[]}, add the receipt for artifactOutputId "${expectedOutputId}", then resume with: /task-continue ${slug}` };
745
+ return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: artifact-manifest.json is missing and the skeleton could not be written (${seeded}). Create it with "node .ai.local/scripts/manifest.mjs init --slug ${slug}", then merge the receipt for artifactOutputId "${expectedOutputId}" with "node .ai.local/scripts/manifest.mjs upsert --slug ${slug} --id ${expectedOutputId} --producer ${agent} --outcome completed --paths <artifact>.md" (whole-file merge; never patch the JSON), then resume with: /task-continue ${slug}` };
746
746
  }
747
- return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: no artifact-manifest.json for step ${stepIndex} (${agent}). Wrote a skeleton {schemaVersion:1, slug, artifacts:[]}. Expected artifactOutputId "${expectedOutputId}". Write the artifact and its receipt, then resume with: /task-continue ${slug}` };
747
+ return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: no artifact-manifest.json for step ${stepIndex} (${agent}). Wrote a skeleton {schemaVersion:1, slug, artifacts:[]}. Expected artifactOutputId "${expectedOutputId}". Write the artifact, then merge its receipt with "node .ai.local/scripts/manifest.mjs upsert --slug ${slug} --id ${expectedOutputId} --producer ${agent} --outcome completed --paths <artifact>.md" (whole-file merge; never patch the JSON), then resume with: /task-continue ${slug}` };
748
748
  }
749
749
  try {
750
750
  const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
@@ -78,7 +78,7 @@ Each slug has one `artifact-manifest.json` at `.ai.local/team/tasks/<slug>/`. Sc
78
78
 
79
79
  - Read the manifest before broad prior-artifact discovery. Each step receives authoritative input entry IDs, owns named output entry IDs, and finishes with one terminal receipt linked to AC/task IDs.
80
80
  - Markdown remains detailed evidence; the manifest records producer, status, authoritative paths, timestamps, outcome, and evidence paths.
81
- - Agents upsert only the items they own in `manifest.artifacts[]` and preserve all foreign items in that array. Parallel agents use distinct IDs; the parent/orchestrator serializes manifest merges. The top-level array key is `artifacts` — not `entries`; see `agent-artifact-contracts.md` for the schema callout.
81
+ - Agents upsert only the items they own in `manifest.artifacts[]` and preserve all foreign items in that array. Parallel agents use distinct IDs. Every write is a whole-file merge through `node .ai.local/scripts/manifest.mjs upsert …` under `.manifest.lock` (see the installed `team/README.md` § artifact-manifest.json — write protocol); the parent does not need to serialize merges, and a fragment/replace edit of the JSON is forbidden. The top-level array key is `artifacts` — not `entries`; see `agent-artifact-contracts.md` for the schema callout.
82
82
  - The orchestration runtime/hook is the single writer for `status.json` lifecycle fields and `metrics.json`. Agents read status for eligibility but never rewrite state, gate, retry, attempt, timestamp, or metrics fields.
83
83
  - Missing/stale manifests are reported as a handoff gap; fall back to `brief.md`, `decomposition.md`, and `pipeline.json` rather than inventing authority.
84
84
 
@@ -44,6 +44,15 @@ Procedure details live in skill `code-review`. Required shape:
44
44
  - Vague («looks risky») is not a finding — cite evidence or ask for surrounding file context.
45
45
  - End with a verdict on its own line: **`Safe to merge | needs changes | reject`**.
46
46
 
47
+ ## Verdict and terminal receipt
48
+
49
+ The verdict and the receipt are the same decision expressed twice — never let a fixable defect hide behind "notes".
50
+
51
+ - Any `blocker` or `important` finding (a scale that names `high`/`medium` maps them here) means the MR is **not** mergeable as-is: emit receipt outcome `changes_requested` so the orchestrator runs its existing developer retry, not `completed`.
52
+ - 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.
53
+ - 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.
54
+ - 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.
55
+
47
56
  ## Stack notes
48
57
 
49
58
  - Hexagonal boundaries: `architecture-boundaries`, `domain-layer`, ports vs adapters; Spring/JPA only at edges.
@@ -56,6 +56,23 @@ Bootstrap a slug by **writing** `pipeline.json` (editor Write tool). Do not `mkd
56
56
 
57
57
  Prefer `phase: executing`. States: `in_progress`, `completed`, `awaiting_approval` (`/task-continue`), `changes_requested`, `validation_failed`, `blocked` (graph mode still dispatches independent ready steps), `awaiting_artifact_receipt`.
58
58
 
59
+ ## artifact-manifest.json — write protocol
60
+
61
+ The manifest is a **whole-file merge target**. Producers rewrite it, and every write refreshes `updatedAt`, so a fragment/replace edit of the JSON fails its match and aborts the receipt. Merge by entry `id` and rewrite the file:
62
+
63
+ ```bash
64
+ node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> \
65
+ --outcome completed --paths brief.md,decomposition.md --acs AC-1 --tasks T1 --attempt <attemptId>
66
+ node .ai.local/scripts/manifest.mjs check --slug <slug>
67
+ ```
68
+
69
+ - Absent file → `manifest.mjs init --slug <slug>` (the hook seeds the same skeleton).
70
+ - Never patch the JSON with a fragment/replace edit (`edit`, `str_replace`, `apply_patch`): a foreign parallel write or a refreshed `updatedAt` breaks the match, the produced artifact ends up without a receipt, and the step stalls in `awaiting_artifact_receipt`.
71
+ - Merge or parse error → re-read and merge again, at most twice, then report `blocked` with the error. Never leave the file truncated.
72
+ - Parallel wave → the writer holds `.manifest.lock` in the task directory, so concurrent producers serialize; a hand-written merge must take the same lock.
73
+ - Plan closure → tick (`- [ ]` → `- [x]`) every `tasks.md` row this receipt closes, in the same turn. An unticked row makes `openspec list` report stale progress and hides the exit criteria from the next agent.
74
+ - Schema and completion conventions: `agent-team/agent-artifact-contracts.md`.
75
+
59
76
  ## Commands
60
77
 
61
78
  ```bash
@@ -52,4 +52,4 @@ A self-review defect that changes the output appends one `review-ledger.md` row
52
52
 
53
53
  ## Receipt binding
54
54
 
55
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
55
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -112,4 +112,4 @@ Load requestable rule `mcp-usage` when verifying third-party library APIs (Conte
112
112
 
113
113
  ## Receipt binding
114
114
 
115
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
115
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -730,9 +730,9 @@ function readBoundReceiptOutcome(agent, step, resolved) {
730
730
  const seeded = writeSkeletonManifest(manifestPath);
731
731
  const stepIndex = typeof resolved.entry.stepIndex === 'number' ? resolved.entry.stepIndex : 0;
732
732
  if (seeded) {
733
- return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: artifact-manifest.json is missing and the skeleton could not be written (${seeded}). Create .ai.local/team/tasks/${slug}/artifact-manifest.json with {schemaVersion:1, slug, artifacts:[]}, add the receipt for artifactOutputId "${expectedOutputId}", then resume with: /task-continue ${slug}` };
733
+ return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: artifact-manifest.json is missing and the skeleton could not be written (${seeded}). Create it with "node .ai.local/scripts/manifest.mjs init --slug ${slug}", then merge the receipt for artifactOutputId "${expectedOutputId}" with "node .ai.local/scripts/manifest.mjs upsert --slug ${slug} --id ${expectedOutputId} --producer ${agent} --outcome completed --paths <artifact>.md" (whole-file merge; never patch the JSON), then resume with: /task-continue ${slug}` };
734
734
  }
735
- return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: no artifact-manifest.json for step ${stepIndex} (${agent}). Wrote a skeleton {schemaVersion:1, slug, artifacts:[]}. Expected artifactOutputId "${expectedOutputId}". Write the artifact and its receipt, then resume with: /task-continue ${slug}` };
735
+ return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: no artifact-manifest.json for step ${stepIndex} (${agent}). Wrote a skeleton {schemaVersion:1, slug, artifacts:[]}. Expected artifactOutputId "${expectedOutputId}". Write the artifact, then merge its receipt with "node .ai.local/scripts/manifest.mjs upsert --slug ${slug} --id ${expectedOutputId} --producer ${agent} --outcome completed --paths <artifact>.md" (whole-file merge; never patch the JSON), then resume with: /task-continue ${slug}` };
736
736
  }
737
737
  try {
738
738
  const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
@@ -78,7 +78,7 @@ Each slug has one `artifact-manifest.json` at `.ai.local/team/tasks/<slug>/`. Sc
78
78
 
79
79
  - Read the manifest before broad prior-artifact discovery. Each step receives authoritative input entry IDs, owns named output entry IDs, and finishes with one terminal receipt linked to AC/task IDs.
80
80
  - Markdown remains detailed evidence; the manifest records producer, status, authoritative paths, timestamps, outcome, and evidence paths.
81
- - Agents upsert only the items they own in `manifest.artifacts[]` and preserve all foreign items in that array. Parallel agents use distinct IDs; the parent/orchestrator serializes manifest merges. The top-level array key is `artifacts` — not `entries`; see `agent-artifact-contracts.md` for the schema callout.
81
+ - Agents upsert only the items they own in `manifest.artifacts[]` and preserve all foreign items in that array. Parallel agents use distinct IDs. Every write is a whole-file merge through `node .ai.local/scripts/manifest.mjs upsert …` under `.manifest.lock` (see the installed `team/README.md` § artifact-manifest.json — write protocol); the parent does not need to serialize merges, and a fragment/replace edit of the JSON is forbidden. The top-level array key is `artifacts` — not `entries`; see `agent-artifact-contracts.md` for the schema callout.
82
82
  - The orchestration runtime/hook is the single writer for `status.json` lifecycle fields and `metrics.json`. Agents read status for eligibility but never rewrite state, gate, retry, attempt, timestamp, or metrics fields.
83
83
  - Missing/stale manifests are reported as a handoff gap; fall back to `brief.md`, `decomposition.md`, and `pipeline.json` rather than inventing authority.
84
84
 
@@ -44,6 +44,15 @@ Procedure details live in skill `code-review`. Required shape:
44
44
  - Vague («looks risky») is not a finding — cite evidence or ask for surrounding file context.
45
45
  - End with a verdict on its own line: **`Safe to merge | needs changes | reject`**.
46
46
 
47
+ ## Verdict and terminal receipt
48
+
49
+ The verdict and the receipt are the same decision expressed twice — never let a fixable defect hide behind "notes".
50
+
51
+ - Any `blocker` or `important` finding (a scale that names `high`/`medium` maps them here) means the MR is **not** mergeable as-is: emit receipt outcome `changes_requested` so the orchestrator runs its existing developer retry, not `completed`.
52
+ - 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.
53
+ - 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.
54
+ - 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.
55
+
47
56
  ## Stack notes
48
57
 
49
58
  - Check MCP boundaries: registration vs handler vs capability; schema/contract stability; no secret leakage.
@@ -56,6 +56,23 @@ Bootstrap a slug by **writing** `pipeline.json` (editor Write tool). Do not `mkd
56
56
 
57
57
  Prefer `phase: executing`. States: `in_progress`, `completed`, `awaiting_approval` (`/task-continue`), `changes_requested`, `validation_failed`, `blocked` (graph mode still dispatches independent ready steps), `awaiting_artifact_receipt`.
58
58
 
59
+ ## artifact-manifest.json — write protocol
60
+
61
+ The manifest is a **whole-file merge target**. Producers rewrite it, and every write refreshes `updatedAt`, so a fragment/replace edit of the JSON fails its match and aborts the receipt. Merge by entry `id` and rewrite the file:
62
+
63
+ ```bash
64
+ node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> \
65
+ --outcome completed --paths brief.md,decomposition.md --acs AC-1 --tasks T1 --attempt <attemptId>
66
+ node .ai.local/scripts/manifest.mjs check --slug <slug>
67
+ ```
68
+
69
+ - Absent file → `manifest.mjs init --slug <slug>` (the hook seeds the same skeleton).
70
+ - Never patch the JSON with a fragment/replace edit (`edit`, `str_replace`, `apply_patch`): a foreign parallel write or a refreshed `updatedAt` breaks the match, the produced artifact ends up without a receipt, and the step stalls in `awaiting_artifact_receipt`.
71
+ - Merge or parse error → re-read and merge again, at most twice, then report `blocked` with the error. Never leave the file truncated.
72
+ - Parallel wave → the writer holds `.manifest.lock` in the task directory, so concurrent producers serialize; a hand-written merge must take the same lock.
73
+ - Plan closure → tick (`- [ ]` → `- [x]`) every `tasks.md` row this receipt closes, in the same turn. An unticked row makes `openspec list` report stale progress and hides the exit criteria from the next agent.
74
+ - Schema and completion conventions: `agent-team/agent-artifact-contracts.md`.
75
+
59
76
  ## Commands
60
77
 
61
78
  ```bash
@@ -91,7 +91,7 @@ Write the owned terminal receipt described under **Artifact contract**. If **FAI
91
91
 
92
92
  Do not fix code — report only. Do not advance to code-reviewer until PASS.
93
93
 
94
- **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
94
+ **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
95
95
 
96
96
  ## Artifact contract
97
97
 
@@ -91,7 +91,7 @@ Write the owned terminal receipt described under **Artifact contract**. If **REQ
91
91
 
92
92
  Do not mix this output with retrospective facilitation — keep review and retro separate.
93
93
 
94
- **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
94
+ **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
95
95
 
96
96
  ## Design guidance
97
97
 
@@ -104,4 +104,4 @@ Do not perform formal code review or write e2e plans — those are separate agen
104
104
 
105
105
  ## Receipt binding
106
106
 
107
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
107
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -59,7 +59,7 @@ Emit the owned implementation receipt with outcome `completed`. Handoff: tasks d
59
59
 
60
60
  Do not perform formal code review — that is the code-reviewer subagent's job.
61
61
 
62
- **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
62
+ **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
63
63
 
64
64
  ## Design guidance
65
65
 
@@ -62,4 +62,4 @@ Provide summary:
62
62
 
63
63
  ## Receipt binding
64
64
 
65
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
65
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -40,6 +40,11 @@ Write `.ai.local/team/tasks/<slug>/security-review.md`:
40
40
  ## Verdict
41
41
  PASS | PASS_WITH_NOTES | FAIL
42
42
 
43
+ `PASS_WITH_NOTES` is for `low`/informational findings only. A `medium`, `high` or
44
+ `blocker` finding makes the verdict `FAIL`, and `FAIL` emits receipt outcome
45
+ `changes_requested` so the orchestrator runs its existing developer retry — a
46
+ fixable non-cosmetic finding must never be filed as a note.
47
+
43
48
  ## Critical (must fix before merge)
44
49
  - ...
45
50
 
@@ -743,9 +743,9 @@ function readBoundReceiptOutcome(agent, step, resolved) {
743
743
  const seeded = writeSkeletonManifest(manifestPath);
744
744
  const stepIndex = typeof resolved.entry.stepIndex === 'number' ? resolved.entry.stepIndex : 0;
745
745
  if (seeded) {
746
- return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: artifact-manifest.json is missing and the skeleton could not be written (${seeded}). Create .ai.local/team/tasks/${slug}/artifact-manifest.json with {schemaVersion:1, slug, artifacts:[]}, add the receipt for artifactOutputId "${expectedOutputId}", then resume with: /task-continue ${slug}` };
746
+ return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: artifact-manifest.json is missing and the skeleton could not be written (${seeded}). Create it with "node .ai.local/scripts/manifest.mjs init --slug ${slug}", then merge the receipt for artifactOutputId "${expectedOutputId}" with "node .ai.local/scripts/manifest.mjs upsert --slug ${slug} --id ${expectedOutputId} --producer ${agent} --outcome completed --paths <artifact>.md" (whole-file merge; never patch the JSON), then resume with: /task-continue ${slug}` };
747
747
  }
748
- return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: no artifact-manifest.json for step ${stepIndex} (${agent}). Wrote a skeleton {schemaVersion:1, slug, artifacts:[]}. Expected artifactOutputId "${expectedOutputId}". Write the artifact and its receipt, then resume with: /task-continue ${slug}` };
748
+ return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: no artifact-manifest.json for step ${stepIndex} (${agent}). Wrote a skeleton {schemaVersion:1, slug, artifacts:[]}. Expected artifactOutputId "${expectedOutputId}". Write the artifact, then merge its receipt with "node .ai.local/scripts/manifest.mjs upsert --slug ${slug} --id ${expectedOutputId} --producer ${agent} --outcome completed --paths <artifact>.md" (whole-file merge; never patch the JSON), then resume with: /task-continue ${slug}` };
749
749
  }
750
750
  try {
751
751
  const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
@@ -119,7 +119,7 @@ Each slug has one `artifact-manifest.json` at `.ai.local/team/tasks/<slug>/`. Sc
119
119
 
120
120
  - Read the manifest before broad prior-artifact discovery. Each step receives authoritative input entry IDs, owns named output entry IDs, and finishes with one terminal receipt linked to AC/task IDs.
121
121
  - Markdown remains detailed evidence; the manifest records producer, status, authoritative paths, timestamps, outcome, and evidence paths.
122
- - Agents upsert only the items they own in `manifest.artifacts[]` and preserve all foreign items in that array. Parallel agents use distinct IDs; the parent/orchestrator serializes manifest merges. The top-level array key is `artifacts` — not `entries`; see `agent-artifact-contracts.md` for the schema callout.
122
+ - Agents upsert only the items they own in `manifest.artifacts[]` and preserve all foreign items in that array. Parallel agents use distinct IDs. Every write is a whole-file merge through `node .ai.local/scripts/manifest.mjs upsert …` under `.manifest.lock` (see the installed `team/README.md` § artifact-manifest.json — write protocol); the parent does not need to serialize merges, and a fragment/replace edit of the JSON is forbidden. The top-level array key is `artifacts` — not `entries`; see `agent-artifact-contracts.md` for the schema callout.
123
123
  - The orchestration runtime/hook is the single writer for `status.json` lifecycle fields and `metrics.json`. Agents read status for eligibility but never rewrite state, gate, retry, attempt, timestamp, or metrics fields.
124
124
  - Missing/stale manifests are reported as a handoff gap; fall back to `brief.md`, `decomposition.md`, and `pipeline.json` rather than inventing authority.
125
125
 
@@ -44,6 +44,15 @@ Procedure details live in skill `code-review`. Required shape:
44
44
  - Vague («looks risky») is not a finding — cite evidence or ask for surrounding file context.
45
45
  - End with a verdict on its own line: **`Safe to merge | needs changes | reject`**.
46
46
 
47
+ ## Verdict and terminal receipt
48
+
49
+ The verdict and the receipt are the same decision expressed twice — never let a fixable defect hide behind "notes".
50
+
51
+ - Any `blocker` or `important` finding (a scale that names `high`/`medium` maps them here) means the MR is **not** mergeable as-is: emit receipt outcome `changes_requested` so the orchestrator runs its existing developer retry, not `completed`.
52
+ - 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.
53
+ - 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.
54
+ - 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.
55
+
47
56
  ## Stack notes
48
57
 
49
58
  On-demand rule for review flows. **Procedure and output format:** skill `code-review`.
@@ -57,6 +57,23 @@ Bootstrap a slug by **writing** `pipeline.json` (editor Write tool). Do not `mkd
57
57
 
58
58
  Prefer `phase: executing`. States: `in_progress`, `completed`, `awaiting_approval` (`/task-continue`), `changes_requested`, `validation_failed`, `blocked` (graph mode still dispatches independent ready steps), `awaiting_artifact_receipt`.
59
59
 
60
+ ## artifact-manifest.json — write protocol
61
+
62
+ The manifest is a **whole-file merge target**. Producers rewrite it, and every write refreshes `updatedAt`, so a fragment/replace edit of the JSON fails its match and aborts the receipt. Merge by entry `id` and rewrite the file:
63
+
64
+ ```bash
65
+ node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> \
66
+ --outcome completed --paths brief.md,decomposition.md --acs AC-1 --tasks T1 --attempt <attemptId>
67
+ node .ai.local/scripts/manifest.mjs check --slug <slug>
68
+ ```
69
+
70
+ - Absent file → `manifest.mjs init --slug <slug>` (the hook seeds the same skeleton).
71
+ - Never patch the JSON with a fragment/replace edit (`edit`, `str_replace`, `apply_patch`): a foreign parallel write or a refreshed `updatedAt` breaks the match, the produced artifact ends up without a receipt, and the step stalls in `awaiting_artifact_receipt`.
72
+ - Merge or parse error → re-read and merge again, at most twice, then report `blocked` with the error. Never leave the file truncated.
73
+ - Parallel wave → the writer holds `.manifest.lock` in the task directory, so concurrent producers serialize; a hand-written merge must take the same lock.
74
+ - Plan closure → tick (`- [ ]` → `- [x]`) every `tasks.md` row this receipt closes, in the same turn. An unticked row makes `openspec list` report stale progress and hides the exit criteria from the next agent.
75
+ - Schema and completion conventions: `agent-team/agent-artifact-contracts.md`.
76
+
60
77
  ## Commands
61
78
 
62
79
  ```bash
@@ -78,7 +78,7 @@ Write the owned terminal receipt described under **Artifact contract**. If **FAI
78
78
 
79
79
  Do not fix code — report only. Do not advance to code-reviewer until PASS.
80
80
 
81
- **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
81
+ **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
82
82
 
83
83
  ## Artifact contract
84
84
 
@@ -75,7 +75,7 @@ Write the owned terminal receipt described under **Artifact contract**. If **REQ
75
75
 
76
76
  Do not mix this output with retrospective facilitation — keep review and retro separate.
77
77
 
78
- **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
78
+ **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
79
79
 
80
80
  ## Design guidance
81
81
 
@@ -104,4 +104,4 @@ Do not perform formal code review or write e2e plans — those are separate agen
104
104
 
105
105
  ## Receipt binding
106
106
 
107
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
107
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -47,7 +47,7 @@ Emit the owned implementation receipt with outcome `completed`. Handoff: tasks d
47
47
 
48
48
  Do not perform formal code review — that is the code-reviewer subagent's job.
49
49
 
50
- **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
50
+ **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
51
51
 
52
52
  ## Design guidance
53
53
 
@@ -62,4 +62,4 @@ Provide summary:
62
62
 
63
63
  ## Receipt binding
64
64
 
65
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
65
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -743,9 +743,9 @@ function readBoundReceiptOutcome(agent, step, resolved) {
743
743
  const seeded = writeSkeletonManifest(manifestPath);
744
744
  const stepIndex = typeof resolved.entry.stepIndex === 'number' ? resolved.entry.stepIndex : 0;
745
745
  if (seeded) {
746
- return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: artifact-manifest.json is missing and the skeleton could not be written (${seeded}). Create .ai.local/team/tasks/${slug}/artifact-manifest.json with {schemaVersion:1, slug, artifacts:[]}, add the receipt for artifactOutputId "${expectedOutputId}", then resume with: /task-continue ${slug}` };
746
+ return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: artifact-manifest.json is missing and the skeleton could not be written (${seeded}). Create it with "node .ai.local/scripts/manifest.mjs init --slug ${slug}", then merge the receipt for artifactOutputId "${expectedOutputId}" with "node .ai.local/scripts/manifest.mjs upsert --slug ${slug} --id ${expectedOutputId} --producer ${agent} --outcome completed --paths <artifact>.md" (whole-file merge; never patch the JSON), then resume with: /task-continue ${slug}` };
747
747
  }
748
- return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: no artifact-manifest.json for step ${stepIndex} (${agent}). Wrote a skeleton {schemaVersion:1, slug, artifacts:[]}. Expected artifactOutputId "${expectedOutputId}". Write the artifact and its receipt, then resume with: /task-continue ${slug}` };
748
+ return { outcome: null, receiptRequired: true, stallMessage: `[chain-team-phases] ${slug}: no artifact-manifest.json for step ${stepIndex} (${agent}). Wrote a skeleton {schemaVersion:1, slug, artifacts:[]}. Expected artifactOutputId "${expectedOutputId}". Write the artifact, then merge its receipt with "node .ai.local/scripts/manifest.mjs upsert --slug ${slug} --id ${expectedOutputId} --producer ${agent} --outcome completed --paths <artifact>.md" (whole-file merge; never patch the JSON), then resume with: /task-continue ${slug}` };
749
749
  }
750
750
  try {
751
751
  const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
@@ -102,7 +102,7 @@ Each slug has one `artifact-manifest.json` at `.ai.local/team/tasks/<slug>/`. Sc
102
102
 
103
103
  - Read the manifest before broad prior-artifact discovery. Each step receives authoritative input entry IDs, owns named output entry IDs, and finishes with one terminal receipt linked to AC/task IDs.
104
104
  - Markdown remains detailed evidence; the manifest records producer, status, authoritative paths, timestamps, outcome, and evidence paths.
105
- - Agents upsert only the items they own in `manifest.artifacts[]` and preserve all foreign items in that array. Parallel agents use distinct IDs; the parent/orchestrator serializes manifest merges. The top-level array key is `artifacts` — not `entries`; see `agent-artifact-contracts.md` for the schema callout.
105
+ - Agents upsert only the items they own in `manifest.artifacts[]` and preserve all foreign items in that array. Parallel agents use distinct IDs. Every write is a whole-file merge through `node .ai.local/scripts/manifest.mjs upsert …` under `.manifest.lock` (see the installed `team/README.md` § artifact-manifest.json — write protocol); the parent does not need to serialize merges, and a fragment/replace edit of the JSON is forbidden. The top-level array key is `artifacts` — not `entries`; see `agent-artifact-contracts.md` for the schema callout.
106
106
  - The orchestration runtime/hook is the single writer for `status.json` lifecycle fields and `metrics.json`. Agents read status for eligibility but never rewrite state, gate, retry, attempt, timestamp, or metrics fields.
107
107
  - Missing/stale manifests are reported as a handoff gap; fall back to `brief.md`, `decomposition.md`, and `pipeline.json` rather than inventing authority.
108
108
 
@@ -44,6 +44,15 @@ Procedure details live in skill `code-review`. Required shape:
44
44
  - Vague («looks risky») is not a finding — cite evidence or ask for surrounding file context.
45
45
  - End with a verdict on its own line: **`Safe to merge | needs changes | reject`**.
46
46
 
47
+ ## Verdict and terminal receipt
48
+
49
+ The verdict and the receipt are the same decision expressed twice — never let a fixable defect hide behind "notes".
50
+
51
+ - Any `blocker` or `important` finding (a scale that names `high`/`medium` maps them here) means the MR is **not** mergeable as-is: emit receipt outcome `changes_requested` so the orchestrator runs its existing developer retry, not `completed`.
52
+ - 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.
53
+ - 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.
54
+ - 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.
55
+
47
56
  ## Stack notes
48
57
 
49
58
  On-demand rule for review flows. **Procedure and output format:** skill `code-review`.
@@ -56,6 +56,23 @@ Bootstrap a slug by **writing** `pipeline.json` (editor Write tool). Do not `mkd
56
56
 
57
57
  Prefer `phase: executing`. States: `in_progress`, `completed`, `awaiting_approval` (`/task-continue`), `changes_requested`, `validation_failed`, `blocked` (graph mode still dispatches independent ready steps), `awaiting_artifact_receipt`.
58
58
 
59
+ ## artifact-manifest.json — write protocol
60
+
61
+ The manifest is a **whole-file merge target**. Producers rewrite it, and every write refreshes `updatedAt`, so a fragment/replace edit of the JSON fails its match and aborts the receipt. Merge by entry `id` and rewrite the file:
62
+
63
+ ```bash
64
+ node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> \
65
+ --outcome completed --paths brief.md,decomposition.md --acs AC-1 --tasks T1 --attempt <attemptId>
66
+ node .ai.local/scripts/manifest.mjs check --slug <slug>
67
+ ```
68
+
69
+ - Absent file → `manifest.mjs init --slug <slug>` (the hook seeds the same skeleton).
70
+ - Never patch the JSON with a fragment/replace edit (`edit`, `str_replace`, `apply_patch`): a foreign parallel write or a refreshed `updatedAt` breaks the match, the produced artifact ends up without a receipt, and the step stalls in `awaiting_artifact_receipt`.
71
+ - Merge or parse error → re-read and merge again, at most twice, then report `blocked` with the error. Never leave the file truncated.
72
+ - Parallel wave → the writer holds `.manifest.lock` in the task directory, so concurrent producers serialize; a hand-written merge must take the same lock.
73
+ - Plan closure → tick (`- [ ]` → `- [x]`) every `tasks.md` row this receipt closes, in the same turn. An unticked row makes `openspec list` report stale progress and hides the exit criteria from the next agent.
74
+ - Schema and completion conventions: `agent-team/agent-artifact-contracts.md`.
75
+
59
76
  ## Commands
60
77
 
61
78
  ```bash
@@ -51,4 +51,4 @@ A self-review defect that changes the output appends one `review-ledger.md` row
51
51
 
52
52
  ## Receipt binding
53
53
 
54
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
54
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -72,4 +72,4 @@ Write `.ai.local/team/tasks/<slug>/review.md` with verdict APPROVE | REQUEST_CHA
72
72
 
73
73
  ## Receipt binding
74
74
 
75
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
75
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -65,4 +65,4 @@ If a Sentry/Datadog (or similar) MCP is ready and the task is a production error
65
65
 
66
66
  ## Receipt binding
67
67
 
68
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
68
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -111,4 +111,4 @@ Load requestable rule `mcp-usage` when verifying third-party library APIs (Conte
111
111
 
112
112
  ## Receipt binding
113
113
 
114
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
114
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->
@@ -31,4 +31,4 @@ Coordinate with existing plans under `.ai.local/team/tasks/<slug>/`.
31
31
 
32
32
  ## Receipt binding
33
33
 
34
- > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. <!-- shared-core: receipt-binding -->
34
+ > **Receipt binding.** When writing the terminal receipt to `artifact-manifest.json`, set `entry.receipt.attemptId = <attemptId supplied by the orchestrator>` (the orchestrator provides this via `attemptId` on invocation). The hook at `chain-team-phases.sh:readBoundReceiptOutcome` rejects entries whose `attemptId` does not match the current attempt, or whose `Date.parse(timestamps.completedAt) < Date.parse(attemptStartedAt)`. A missing or stale attemptId causes `awaiting_artifact_receipt` stalls. Write the receipt as a whole-file merge — `node .ai.local/scripts/manifest.mjs upsert --slug <slug> --id <id> --producer <agent> --outcome <outcome> --attempt <attemptId> …` — and never patch the JSON with a fragment/replace edit: a foreign parallel write or a refreshed `updatedAt` breaks the match and aborts the receipt mid-task. If the merge or parse fails, re-read and merge again (at most twice), then report `blocked` with the error. <!-- shared-core: receipt-binding -->