@bonesofspring/ai-rules 0.2.33 → 0.2.34

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 (396) hide show
  1. package/docs/PRESET-CONTRIBUTION.md +2 -2
  2. package/package.json +4 -1
  3. package/presets/_shared/README.md +1 -1
  4. package/presets/_shared/core/agent-team/agent-artifact-contracts.md +22 -0
  5. package/presets/_shared/core/agent-team/agent-task-metrics.md +12 -1
  6. package/presets/_shared/core/agent-team/agent-team-intake.md +1 -1
  7. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +18 -4
  8. package/presets/_shared/core/agent-team/plan-graph.md +28 -0
  9. package/presets/_shared/core/agent-team/task-classification.md +2 -0
  10. package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
  11. package/presets/claude/android-kotlin/agents/task-router.md +10 -0
  12. package/presets/claude/android-kotlin/commands/task-continue.md +1 -1
  13. package/presets/claude/android-kotlin/commands/task.md +1 -1
  14. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +369 -16
  15. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-intake.md +1 -1
  16. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
  17. package/presets/claude/android-kotlin/team/README.md +4 -1
  18. package/presets/claude/go/agents/task-analyst.md +1 -1
  19. package/presets/claude/go/agents/task-router.md +10 -0
  20. package/presets/claude/go/commands/task-continue.md +1 -1
  21. package/presets/claude/go/commands/task.md +1 -1
  22. package/presets/claude/go/hooks/chain-team-phases.sh +367 -16
  23. package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +1 -1
  24. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
  25. package/presets/claude/go/team/README.md +4 -1
  26. package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
  27. package/presets/claude/ios-swift/agents/task-router.md +10 -0
  28. package/presets/claude/ios-swift/commands/task-continue.md +1 -1
  29. package/presets/claude/ios-swift/commands/task.md +1 -1
  30. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +369 -16
  31. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +1 -1
  32. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
  33. package/presets/claude/ios-swift/team/README.md +4 -1
  34. package/presets/claude/java/agents/task-analyst.md +1 -1
  35. package/presets/claude/java/agents/task-router.md +10 -0
  36. package/presets/claude/java/commands/task-continue.md +1 -1
  37. package/presets/claude/java/commands/task.md +1 -1
  38. package/presets/claude/java/hooks/chain-team-phases.sh +367 -16
  39. package/presets/claude/java/rules/tooling-and-review/agent-team-intake.md +1 -1
  40. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
  41. package/presets/claude/java/team/README.md +4 -1
  42. package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
  43. package/presets/claude/mcp-ts/agents/task-router.md +10 -0
  44. package/presets/claude/mcp-ts/commands/task-continue.md +1 -1
  45. package/presets/claude/mcp-ts/commands/task.md +1 -1
  46. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +367 -16
  47. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-intake.md +1 -1
  48. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
  49. package/presets/claude/mcp-ts/team/README.md +4 -1
  50. package/presets/claude/next/agents/task-analyst.md +1 -1
  51. package/presets/claude/next/agents/task-router.md +10 -0
  52. package/presets/claude/next/commands/task-continue.md +1 -1
  53. package/presets/claude/next/commands/task.md +1 -1
  54. package/presets/claude/next/hooks/chain-team-phases.sh +369 -16
  55. package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +1 -1
  56. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
  57. package/presets/claude/next/team/README.md +4 -1
  58. package/presets/claude/next/team/fixtures/artifact-manifest.example.json +1 -1
  59. package/presets/claude/next/team/fixtures/feature-parallel.json +84 -0
  60. package/presets/claude/nuxt/agents/task-analyst.md +1 -1
  61. package/presets/claude/nuxt/agents/task-router.md +10 -0
  62. package/presets/claude/nuxt/commands/task-continue.md +1 -1
  63. package/presets/claude/nuxt/commands/task.md +1 -1
  64. package/presets/claude/nuxt/hooks/chain-team-phases.sh +369 -16
  65. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-intake.md +1 -1
  66. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
  67. package/presets/claude/nuxt/team/README.md +4 -1
  68. package/presets/claude/nuxt/team/fixtures/artifact-manifest.example.json +1 -1
  69. package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
  70. package/presets/claude/php-hexagonal/agents/task-router.md +10 -0
  71. package/presets/claude/php-hexagonal/commands/task-continue.md +1 -1
  72. package/presets/claude/php-hexagonal/commands/task.md +1 -1
  73. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +367 -16
  74. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-intake.md +1 -1
  75. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
  76. package/presets/claude/php-hexagonal/team/README.md +4 -1
  77. package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
  78. package/presets/claude/php-laravel/agents/task-router.md +10 -0
  79. package/presets/claude/php-laravel/commands/task-continue.md +1 -1
  80. package/presets/claude/php-laravel/commands/task.md +1 -1
  81. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +367 -16
  82. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-intake.md +1 -1
  83. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
  84. package/presets/claude/php-laravel/team/README.md +4 -1
  85. package/presets/claude/svelte/agents/task-analyst.md +1 -1
  86. package/presets/claude/svelte/agents/task-router.md +10 -0
  87. package/presets/claude/svelte/commands/task-continue.md +1 -1
  88. package/presets/claude/svelte/commands/task.md +1 -1
  89. package/presets/claude/svelte/hooks/chain-team-phases.sh +369 -16
  90. package/presets/claude/svelte/rules/tooling-and-review/agent-team-intake.md +1 -1
  91. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +12 -1
  92. package/presets/claude/svelte/team/README.md +4 -1
  93. package/presets/claude/svelte/team/fixtures/artifact-manifest.example.json +1 -1
  94. package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
  95. package/presets/cursor/android-kotlin/agents/task-router.md +10 -0
  96. package/presets/cursor/android-kotlin/commands/task-continue.md +1 -1
  97. package/presets/cursor/android-kotlin/commands/task.md +1 -1
  98. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +369 -16
  99. package/presets/cursor/android-kotlin/rules/agent-team-intake.mdc +1 -1
  100. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +12 -1
  101. package/presets/cursor/android-kotlin/team/README.md +4 -1
  102. package/presets/cursor/go/agents/task-analyst.md +1 -1
  103. package/presets/cursor/go/agents/task-router.md +10 -0
  104. package/presets/cursor/go/commands/task-continue.md +1 -1
  105. package/presets/cursor/go/commands/task.md +1 -1
  106. package/presets/cursor/go/hooks/chain-team-phases.sh +367 -16
  107. package/presets/cursor/go/rules/agent-team-intake.mdc +1 -1
  108. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +12 -1
  109. package/presets/cursor/go/team/README.md +4 -1
  110. package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
  111. package/presets/cursor/ios-swift/agents/task-router.md +10 -0
  112. package/presets/cursor/ios-swift/commands/task-continue.md +1 -1
  113. package/presets/cursor/ios-swift/commands/task.md +1 -1
  114. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +369 -16
  115. package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +1 -1
  116. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +12 -1
  117. package/presets/cursor/ios-swift/team/README.md +4 -1
  118. package/presets/cursor/java/agents/task-analyst.md +1 -1
  119. package/presets/cursor/java/agents/task-router.md +10 -0
  120. package/presets/cursor/java/commands/task-continue.md +1 -1
  121. package/presets/cursor/java/commands/task.md +1 -1
  122. package/presets/cursor/java/hooks/chain-team-phases.sh +367 -16
  123. package/presets/cursor/java/rules/agent-team-intake.mdc +1 -1
  124. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +12 -1
  125. package/presets/cursor/java/team/README.md +4 -1
  126. package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
  127. package/presets/cursor/mcp-ts/agents/task-router.md +10 -0
  128. package/presets/cursor/mcp-ts/commands/task-continue.md +1 -1
  129. package/presets/cursor/mcp-ts/commands/task.md +1 -1
  130. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +367 -16
  131. package/presets/cursor/mcp-ts/rules/agent-team-intake.mdc +1 -1
  132. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +12 -1
  133. package/presets/cursor/mcp-ts/team/README.md +4 -1
  134. package/presets/cursor/next/agents/task-analyst.md +1 -1
  135. package/presets/cursor/next/agents/task-router.md +10 -0
  136. package/presets/cursor/next/commands/task-continue.md +1 -1
  137. package/presets/cursor/next/commands/task.md +1 -1
  138. package/presets/cursor/next/hooks/chain-team-phases.sh +369 -16
  139. package/presets/cursor/next/rules/agent-team-intake.mdc +1 -1
  140. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +12 -1
  141. package/presets/cursor/next/team/README.md +4 -1
  142. package/presets/cursor/next/team/fixtures/artifact-manifest.example.json +1 -1
  143. package/presets/cursor/next/team/fixtures/feature-parallel.json +84 -0
  144. package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
  145. package/presets/cursor/nuxt/agents/task-router.md +10 -0
  146. package/presets/cursor/nuxt/commands/task-continue.md +1 -1
  147. package/presets/cursor/nuxt/commands/task.md +1 -1
  148. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +369 -16
  149. package/presets/cursor/nuxt/rules/agent-team-intake.mdc +1 -1
  150. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +12 -1
  151. package/presets/cursor/nuxt/team/README.md +4 -1
  152. package/presets/cursor/nuxt/team/fixtures/artifact-manifest.example.json +1 -1
  153. package/presets/cursor/php-hexagonal/agents/task-analyst.md +1 -1
  154. package/presets/cursor/php-hexagonal/agents/task-router.md +10 -0
  155. package/presets/cursor/php-hexagonal/commands/task-continue.md +1 -1
  156. package/presets/cursor/php-hexagonal/commands/task.md +1 -1
  157. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +367 -16
  158. package/presets/cursor/php-hexagonal/rules/agent-team-intake.mdc +1 -1
  159. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +12 -1
  160. package/presets/cursor/php-hexagonal/team/README.md +4 -1
  161. package/presets/cursor/php-laravel/agents/task-analyst.md +1 -1
  162. package/presets/cursor/php-laravel/agents/task-router.md +10 -0
  163. package/presets/cursor/php-laravel/commands/task-continue.md +1 -1
  164. package/presets/cursor/php-laravel/commands/task.md +1 -1
  165. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +367 -16
  166. package/presets/cursor/php-laravel/rules/agent-team-intake.mdc +1 -1
  167. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +12 -1
  168. package/presets/cursor/php-laravel/team/README.md +4 -1
  169. package/presets/cursor/svelte/agents/task-analyst.md +1 -1
  170. package/presets/cursor/svelte/agents/task-router.md +10 -0
  171. package/presets/cursor/svelte/commands/task-continue.md +1 -1
  172. package/presets/cursor/svelte/commands/task.md +1 -1
  173. package/presets/cursor/svelte/hooks/chain-team-phases.sh +369 -16
  174. package/presets/cursor/svelte/rules/agent-team-intake.mdc +1 -1
  175. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +12 -1
  176. package/presets/cursor/svelte/team/README.md +4 -1
  177. package/presets/cursor/svelte/team/fixtures/artifact-manifest.example.json +1 -1
  178. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  179. package/presets/mavis/android-kotlin/agents/task-analyst.md +1 -1
  180. package/presets/mavis/android-kotlin/agents/task-router.md +10 -0
  181. package/presets/mavis/android-kotlin/commands/task-continue.md +1 -1
  182. package/presets/mavis/android-kotlin/commands/task.md +1 -1
  183. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +369 -16
  184. package/presets/mavis/android-kotlin/rules/agent-team-intake.md +1 -1
  185. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +18 -4
  186. package/presets/mavis/android-kotlin/team/README.md +4 -1
  187. package/presets/mavis/go/adapter-map.json +1 -1
  188. package/presets/mavis/go/agents/task-analyst.md +1 -1
  189. package/presets/mavis/go/agents/task-router.md +10 -0
  190. package/presets/mavis/go/commands/task-continue.md +1 -1
  191. package/presets/mavis/go/commands/task.md +1 -1
  192. package/presets/mavis/go/hooks/chain-team-phases.sh +367 -16
  193. package/presets/mavis/go/rules/agent-team-intake.md +1 -1
  194. package/presets/mavis/go/rules/agent-team-orchestrator.md +18 -4
  195. package/presets/mavis/go/team/README.md +4 -1
  196. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  197. package/presets/mavis/ios-swift/agents/task-analyst.md +1 -1
  198. package/presets/mavis/ios-swift/agents/task-router.md +10 -0
  199. package/presets/mavis/ios-swift/commands/task-continue.md +1 -1
  200. package/presets/mavis/ios-swift/commands/task.md +1 -1
  201. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +369 -16
  202. package/presets/mavis/ios-swift/rules/agent-team-intake.md +1 -1
  203. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +18 -4
  204. package/presets/mavis/ios-swift/team/README.md +4 -1
  205. package/presets/mavis/java/adapter-map.json +1 -1
  206. package/presets/mavis/java/agents/task-analyst.md +1 -1
  207. package/presets/mavis/java/agents/task-router.md +10 -0
  208. package/presets/mavis/java/commands/task-continue.md +1 -1
  209. package/presets/mavis/java/commands/task.md +1 -1
  210. package/presets/mavis/java/hooks/chain-team-phases.sh +367 -16
  211. package/presets/mavis/java/rules/agent-team-intake.md +1 -1
  212. package/presets/mavis/java/rules/agent-team-orchestrator.md +18 -4
  213. package/presets/mavis/java/team/README.md +4 -1
  214. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  215. package/presets/mavis/mcp-ts/agents/task-analyst.md +1 -1
  216. package/presets/mavis/mcp-ts/agents/task-router.md +10 -0
  217. package/presets/mavis/mcp-ts/commands/task-continue.md +1 -1
  218. package/presets/mavis/mcp-ts/commands/task.md +1 -1
  219. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +367 -16
  220. package/presets/mavis/mcp-ts/rules/agent-team-intake.md +1 -1
  221. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +18 -4
  222. package/presets/mavis/mcp-ts/team/README.md +4 -1
  223. package/presets/mavis/next/adapter-map.json +9 -1
  224. package/presets/mavis/next/agents/task-analyst.md +1 -1
  225. package/presets/mavis/next/agents/task-router.md +10 -0
  226. package/presets/mavis/next/commands/task-continue.md +1 -1
  227. package/presets/mavis/next/commands/task.md +1 -1
  228. package/presets/mavis/next/hooks/chain-team-phases.sh +369 -16
  229. package/presets/mavis/next/rules/agent-team-intake.md +1 -1
  230. package/presets/mavis/next/rules/agent-team-orchestrator.md +18 -4
  231. package/presets/mavis/next/team/README.md +4 -1
  232. package/presets/mavis/next/team/fixtures/artifact-manifest.example.json +1 -1
  233. package/presets/mavis/next/team/fixtures/feature-parallel.json +84 -0
  234. package/presets/mavis/nuxt/adapter-map.json +1 -1
  235. package/presets/mavis/nuxt/agents/task-analyst.md +1 -1
  236. package/presets/mavis/nuxt/agents/task-router.md +10 -0
  237. package/presets/mavis/nuxt/commands/task-continue.md +1 -1
  238. package/presets/mavis/nuxt/commands/task.md +1 -1
  239. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +369 -16
  240. package/presets/mavis/nuxt/rules/agent-team-intake.md +1 -1
  241. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +18 -4
  242. package/presets/mavis/nuxt/team/README.md +4 -1
  243. package/presets/mavis/nuxt/team/fixtures/artifact-manifest.example.json +1 -1
  244. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  245. package/presets/mavis/php-hexagonal/agents/task-analyst.md +1 -1
  246. package/presets/mavis/php-hexagonal/agents/task-router.md +10 -0
  247. package/presets/mavis/php-hexagonal/commands/task-continue.md +1 -1
  248. package/presets/mavis/php-hexagonal/commands/task.md +1 -1
  249. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +367 -16
  250. package/presets/mavis/php-hexagonal/rules/agent-team-intake.md +1 -1
  251. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +18 -4
  252. package/presets/mavis/php-hexagonal/team/README.md +4 -1
  253. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  254. package/presets/mavis/php-laravel/agents/task-analyst.md +1 -1
  255. package/presets/mavis/php-laravel/agents/task-router.md +10 -0
  256. package/presets/mavis/php-laravel/commands/task-continue.md +1 -1
  257. package/presets/mavis/php-laravel/commands/task.md +1 -1
  258. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +367 -16
  259. package/presets/mavis/php-laravel/rules/agent-team-intake.md +1 -1
  260. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +18 -4
  261. package/presets/mavis/php-laravel/team/README.md +4 -1
  262. package/presets/mavis/svelte/adapter-map.json +1 -1
  263. package/presets/mavis/svelte/agents/task-analyst.md +1 -1
  264. package/presets/mavis/svelte/agents/task-router.md +10 -0
  265. package/presets/mavis/svelte/commands/task-continue.md +1 -1
  266. package/presets/mavis/svelte/commands/task.md +1 -1
  267. package/presets/mavis/svelte/hooks/chain-team-phases.sh +369 -16
  268. package/presets/mavis/svelte/rules/agent-team-intake.md +1 -1
  269. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +18 -4
  270. package/presets/mavis/svelte/team/README.md +4 -1
  271. package/presets/mavis/svelte/team/fixtures/artifact-manifest.example.json +1 -1
  272. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  273. package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
  274. package/presets/opencode/android-kotlin/agents/task-router.md +10 -0
  275. package/presets/opencode/android-kotlin/commands/task-continue.md +1 -1
  276. package/presets/opencode/android-kotlin/commands/task.md +1 -1
  277. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +369 -16
  278. package/presets/opencode/android-kotlin/rules/agent-team-intake.md +1 -1
  279. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +18 -4
  280. package/presets/opencode/android-kotlin/team/README.md +4 -1
  281. package/presets/opencode/go/adapter-map.json +1 -1
  282. package/presets/opencode/go/agents/task-analyst.md +1 -1
  283. package/presets/opencode/go/agents/task-router.md +10 -0
  284. package/presets/opencode/go/commands/task-continue.md +1 -1
  285. package/presets/opencode/go/commands/task.md +1 -1
  286. package/presets/opencode/go/hooks/chain-team-phases.sh +367 -16
  287. package/presets/opencode/go/rules/agent-team-intake.md +1 -1
  288. package/presets/opencode/go/rules/agent-team-orchestrator.md +18 -4
  289. package/presets/opencode/go/team/README.md +4 -1
  290. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  291. package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
  292. package/presets/opencode/ios-swift/agents/task-router.md +10 -0
  293. package/presets/opencode/ios-swift/commands/task-continue.md +1 -1
  294. package/presets/opencode/ios-swift/commands/task.md +1 -1
  295. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +369 -16
  296. package/presets/opencode/ios-swift/rules/agent-team-intake.md +1 -1
  297. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +18 -4
  298. package/presets/opencode/ios-swift/team/README.md +4 -1
  299. package/presets/opencode/java/adapter-map.json +1 -1
  300. package/presets/opencode/java/agents/task-analyst.md +1 -1
  301. package/presets/opencode/java/agents/task-router.md +10 -0
  302. package/presets/opencode/java/commands/task-continue.md +1 -1
  303. package/presets/opencode/java/commands/task.md +1 -1
  304. package/presets/opencode/java/hooks/chain-team-phases.sh +367 -16
  305. package/presets/opencode/java/rules/agent-team-intake.md +1 -1
  306. package/presets/opencode/java/rules/agent-team-orchestrator.md +18 -4
  307. package/presets/opencode/java/team/README.md +4 -1
  308. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  309. package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
  310. package/presets/opencode/mcp-ts/agents/task-router.md +10 -0
  311. package/presets/opencode/mcp-ts/commands/task-continue.md +1 -1
  312. package/presets/opencode/mcp-ts/commands/task.md +1 -1
  313. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +367 -16
  314. package/presets/opencode/mcp-ts/rules/agent-team-intake.md +1 -1
  315. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +18 -4
  316. package/presets/opencode/mcp-ts/team/README.md +4 -1
  317. package/presets/opencode/next/adapter-map.json +9 -1
  318. package/presets/opencode/next/agents/task-analyst.md +1 -1
  319. package/presets/opencode/next/agents/task-router.md +10 -0
  320. package/presets/opencode/next/commands/task-continue.md +1 -1
  321. package/presets/opencode/next/commands/task.md +1 -1
  322. package/presets/opencode/next/hooks/chain-team-phases.sh +369 -16
  323. package/presets/opencode/next/rules/agent-team-intake.md +1 -1
  324. package/presets/opencode/next/rules/agent-team-orchestrator.md +18 -4
  325. package/presets/opencode/next/team/README.md +4 -1
  326. package/presets/opencode/next/team/fixtures/artifact-manifest.example.json +1 -1
  327. package/presets/opencode/next/team/fixtures/feature-parallel.json +84 -0
  328. package/presets/opencode/nuxt/adapter-map.json +1 -1
  329. package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
  330. package/presets/opencode/nuxt/agents/task-router.md +10 -0
  331. package/presets/opencode/nuxt/commands/task-continue.md +1 -1
  332. package/presets/opencode/nuxt/commands/task.md +1 -1
  333. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +369 -16
  334. package/presets/opencode/nuxt/rules/agent-team-intake.md +1 -1
  335. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +18 -4
  336. package/presets/opencode/nuxt/team/README.md +4 -1
  337. package/presets/opencode/nuxt/team/fixtures/artifact-manifest.example.json +1 -1
  338. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  339. package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
  340. package/presets/opencode/php-hexagonal/agents/task-router.md +10 -0
  341. package/presets/opencode/php-hexagonal/commands/task-continue.md +1 -1
  342. package/presets/opencode/php-hexagonal/commands/task.md +1 -1
  343. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +367 -16
  344. package/presets/opencode/php-hexagonal/rules/agent-team-intake.md +1 -1
  345. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +18 -4
  346. package/presets/opencode/php-hexagonal/team/README.md +4 -1
  347. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  348. package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
  349. package/presets/opencode/php-laravel/agents/task-router.md +10 -0
  350. package/presets/opencode/php-laravel/commands/task-continue.md +1 -1
  351. package/presets/opencode/php-laravel/commands/task.md +1 -1
  352. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +367 -16
  353. package/presets/opencode/php-laravel/rules/agent-team-intake.md +1 -1
  354. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +18 -4
  355. package/presets/opencode/php-laravel/team/README.md +4 -1
  356. package/presets/opencode/svelte/adapter-map.json +1 -1
  357. package/presets/opencode/svelte/agents/task-analyst.md +1 -1
  358. package/presets/opencode/svelte/agents/task-router.md +10 -0
  359. package/presets/opencode/svelte/commands/task-continue.md +1 -1
  360. package/presets/opencode/svelte/commands/task.md +1 -1
  361. package/presets/opencode/svelte/hooks/chain-team-phases.sh +369 -16
  362. package/presets/opencode/svelte/rules/agent-team-intake.md +1 -1
  363. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +18 -4
  364. package/presets/opencode/svelte/team/README.md +4 -1
  365. package/presets/opencode/svelte/team/fixtures/artifact-manifest.example.json +1 -1
  366. package/scripts/_lib/agent-write-scopes.json +27 -0
  367. package/scripts/check-parallel-plan.sh +353 -0
  368. package/scripts/check-preset-prompt-persistence.sh +51 -24
  369. package/scripts/check-preset-structure.sh +2 -0
  370. package/scripts/check-step-graph-contract.sh +123 -0
  371. package/scripts/fixtures/cli-golden/claude/next.json +10 -9
  372. package/scripts/fixtures/cli-golden/cursor/next.json +10 -9
  373. package/scripts/fixtures/cli-golden/mavis/android-kotlin.json +8 -8
  374. package/scripts/fixtures/cli-golden/mavis/go.json +8 -8
  375. package/scripts/fixtures/cli-golden/mavis/ios-swift.json +8 -8
  376. package/scripts/fixtures/cli-golden/mavis/java.json +8 -8
  377. package/scripts/fixtures/cli-golden/mavis/mcp-ts.json +8 -8
  378. package/scripts/fixtures/cli-golden/mavis/next.json +10 -9
  379. package/scripts/fixtures/cli-golden/mavis/nuxt.json +9 -9
  380. package/scripts/fixtures/cli-golden/mavis/php-hexagonal.json +8 -8
  381. package/scripts/fixtures/cli-golden/mavis/php-laravel.json +8 -8
  382. package/scripts/fixtures/cli-golden/mavis/svelte.json +9 -9
  383. package/scripts/fixtures/cli-golden/opencode/android-kotlin.json +8 -8
  384. package/scripts/fixtures/cli-golden/opencode/go.json +8 -8
  385. package/scripts/fixtures/cli-golden/opencode/ios-swift.json +8 -8
  386. package/scripts/fixtures/cli-golden/opencode/java.json +8 -8
  387. package/scripts/fixtures/cli-golden/opencode/mcp-ts.json +8 -8
  388. package/scripts/fixtures/cli-golden/opencode/next.json +10 -9
  389. package/scripts/fixtures/cli-golden/opencode/nuxt.json +9 -9
  390. package/scripts/fixtures/cli-golden/opencode/php-hexagonal.json +8 -8
  391. package/scripts/fixtures/cli-golden/opencode/php-laravel.json +8 -8
  392. package/scripts/fixtures/cli-golden/opencode/svelte.json +9 -9
  393. package/scripts/test-agent-task-metrics-hooks.mjs +167 -0
  394. package/scripts/test-chain-team-phases-coverage.mjs +129 -0
  395. package/scripts/test-parallel-plan-fixtures.mjs +173 -0
  396. package/scripts/test-preset-prompt-persistence-fixtures.mjs +58 -1
@@ -0,0 +1,27 @@
1
+ {
2
+ "$comment": "Conservative agent -> write-scope fallback for check-parallel-plan.sh static analysis (architecture.md T1.3, fallback B). Authority A is steps[].writeScopes[] in pipeline.json. confidence 'declared' = the agent writes only these team paths; 'derived' = best-effort; 'unknown' = the agent may write anywhere, so the unit conflicts with everything and must always declare steps[].writeScopes to join a wave.",
3
+ "task-router": { "confidence": "declared", "scopes": [".ai.local/team/tasks/<slug>/pipeline.json"] },
4
+ "task-analyst": { "confidence": "declared", "scopes": [".ai.local/team/tasks/<slug>/brief.md", ".ai.local/team/tasks/<slug>/decomposition.md", ".ai.local/team/tasks/<slug>/ux-design.md"] },
5
+ "solution-architect": { "confidence": "declared", "scopes": [".ai.local/team/tasks/<slug>/architecture.md"] },
6
+ "migration-specialist": { "confidence": "declared", "scopes": [".ai.local/team/tasks/<slug>/migration-plan.md"] },
7
+ "debugger": { "confidence": "derived", "scopes": [".ai.local/team/tasks/<slug>/debug-report.md"] },
8
+ "ci-investigator": { "confidence": "derived", "scopes": [".ai.local/team/tasks/<slug>/ci-report.md"] },
9
+ "feature-developer": { "confidence": "unknown", "scopes": [] },
10
+ "build-verifier": { "confidence": "declared", "scopes": [".ai.local/team/tasks/<slug>/validation-report.md"] },
11
+ "code-reviewer": { "confidence": "declared", "scopes": [".ai.local/team/tasks/<slug>/review.md"] },
12
+ "security-reviewer": { "confidence": "declared", "scopes": [".ai.local/team/tasks/<slug>/security-review.md"] },
13
+ "accessibility-reviewer": { "confidence": "declared", "scopes": [".ai.local/team/tasks/<slug>/a11y-review.md"] },
14
+ "performance-auditor": { "confidence": "declared", "scopes": [".ai.local/team/tasks/<slug>/perf-report.md"] },
15
+ "api-contract-reviewer": { "confidence": "declared", "scopes": [".ai.local/team/tasks/<slug>/api-contract-review.md"] },
16
+ "mockup-reviewer": { "confidence": "declared", "scopes": [".ai.local/team/tasks/<slug>/mockup-review.md", ".ai.local/team/tasks/<slug>/figma-contract.json"] },
17
+ "tech-writer": { "confidence": "declared", "scopes": [".ai.local/team/tasks/<slug>/documentation.md"] },
18
+ "openspec-author": { "confidence": "declared", "scopes": ["openspec/changes"] },
19
+ "qa-tester": { "confidence": "unknown", "scopes": [] },
20
+ "unit-test-planner": { "confidence": "declared", "scopes": [".ai.local/team/tasks/<slug>/unit-test-plan.md"] },
21
+ "unit-test-generator": { "confidence": "unknown", "scopes": [] },
22
+ "unit-test-healer": { "confidence": "unknown", "scopes": [] },
23
+ "playwright-test-planner": { "confidence": "declared", "scopes": ["app/__tests__/e2e"] },
24
+ "playwright-test-generator": { "confidence": "unknown", "scopes": [] },
25
+ "playwright-test-healer": { "confidence": "unknown", "scopes": [] },
26
+ "aggregate-task-metrics": { "confidence": "unknown", "scopes": [] }
27
+ }
@@ -0,0 +1,353 @@
1
+ #!/usr/bin/env bash
2
+ # Parallel-plan structural gate (reliable-subagent-parallelism, AC-1 / AC-2 / AC-7).
3
+ #
4
+ # Validates the `pipeline.json` step graph + conflict model documented in
5
+ # `presets/_shared/core/agent-team/plan-graph.md` § Pipeline step graph /
6
+ # § Conflict model:
7
+ #
8
+ # 1. dependsOn entries resolve to a step `id` or a step `taskIds` member
9
+ # 2. the resolved graph is acyclic
10
+ # 3. `id` uniqueness (no collision with another `id` or a `taskIds` value)
11
+ # 4. writeScopes well-formedness (array of repo-relative paths, no globs,
12
+ # no `..`, no absolute path, no lifecycle file)
13
+ # 5. `parallel: true` steps: agents distinct + per-agent artifact outputs distinct
14
+ # 6. `mockup-reviewer` is never in a parallel / multi-agent step
15
+ # 7. topological wave conflict predicate: every same-level wave is
16
+ # conflict-free (C1..C6 pairwise)
17
+ # 8. non-vacuity: at least one fixture carries a `parallel: true` step and at
18
+ # least one carries a multi-step `dependsOn` wave (refuses to vacuous-PASS)
19
+ #
20
+ # Usage:
21
+ # check-parallel-plan.sh # scan presets/**/team/fixtures/*.json
22
+ # check-parallel-plan.sh --pipeline FILE # validate one pipeline file
23
+ #
24
+ # `AI_RULES_PRESETS_ROOT` overrides the presets root (used by the fixture test).
25
+ set -euo pipefail
26
+
27
+ ROOT="$(cd "$(dirname "$0")/../../.." && pwd)"
28
+ export AI_RULES_PRESETS_ROOT="${AI_RULES_PRESETS_ROOT:-$ROOT/packages/ai-rules/presets}"
29
+ export AI_RULES_WRITE_SCOPES="${AI_RULES_WRITE_SCOPES:-$ROOT/packages/ai-rules/scripts/_lib/agent-write-scopes.json}"
30
+
31
+ python3 - "$@" <<'PY'
32
+ from __future__ import annotations
33
+
34
+ import json
35
+ import os
36
+ import re
37
+ import sys
38
+ from pathlib import Path
39
+
40
+ presets = Path(os.environ["AI_RULES_PRESETS_ROOT"])
41
+ write_scopes_path = Path(os.environ["AI_RULES_WRITE_SCOPES"])
42
+
43
+ LIFECYCLE = {"status.json", "metrics.json", "artifact-manifest.json", ".metrics-receipts.json"}
44
+ GLOB_CHARS = ("*", "?", "[")
45
+ NONKEBAB = re.compile(r"[^a-z0-9._-]")
46
+
47
+
48
+ def load_fallback() -> dict:
49
+ try:
50
+ data = json.loads(write_scopes_path.read_text(encoding="utf-8"))
51
+ except (OSError, json.JSONDecodeError):
52
+ return {}
53
+ return {k: v for k, v in data.items() if not k.startswith("$") and isinstance(v, dict)}
54
+
55
+
56
+ FALLBACK = load_fallback()
57
+
58
+
59
+ def agents_of(step: dict) -> list:
60
+ agent = step.get("agent")
61
+ if isinstance(agent, list):
62
+ return [a for a in agent if isinstance(a, str)]
63
+ if isinstance(agent, str):
64
+ return [agent]
65
+ return []
66
+
67
+
68
+ def normalize(scope: str) -> str:
69
+ return scope.rstrip("/")
70
+
71
+
72
+ def overlap(a: str, b: str) -> bool:
73
+ left, right = normalize(a), normalize(b)
74
+ return left == right or left.startswith(right + "/") or right.startswith(left + "/")
75
+
76
+
77
+ def validate_scopes(step: dict, label: str, errors: list) -> None:
78
+ scopes = step.get("writeScopes")
79
+ if scopes is None:
80
+ return
81
+ if not isinstance(scopes, list) or not scopes:
82
+ errors.append(f"{label}: writeScopes must be a non-empty array of strings")
83
+ return
84
+ for scope in scopes:
85
+ if not isinstance(scope, str) or not scope:
86
+ errors.append(f"{label}: writeScopes entry must be a non-empty string")
87
+ continue
88
+ if scope.startswith("/") or scope.startswith("..") or scope == "." or "/../" in f"/{scope}/":
89
+ errors.append(f"{label}: writeScope '{scope}' must be repo-relative without '..'")
90
+ if any(ch in scope for ch in GLOB_CHARS):
91
+ errors.append(f"{label}: writeScope '{scope}' must not contain glob characters")
92
+ for segment in scope.split("/"):
93
+ if segment and segment != "<slug>" and NONKEBAB.search(segment):
94
+ errors.append(f"{label}: writeScope '{scope}' segment '{segment}' has invalid characters")
95
+ for segment in scope.split("/"):
96
+ if segment in LIFECYCLE or segment.endswith(".lock"):
97
+ errors.append(f"{label}: writeScope '{scope}' names lifecycle state (hook-only)")
98
+
99
+
100
+ def scope_set(step: dict, agents: list) -> list | None:
101
+ declared = step.get("writeScopes")
102
+ if isinstance(declared, list) and declared:
103
+ return declared
104
+ union: list = []
105
+ for agent in agents:
106
+ entry = FALLBACK.get(agent)
107
+ if not entry or entry.get("confidence") == "unknown" or not entry.get("scopes"):
108
+ return None
109
+ union.extend(entry["scopes"])
110
+ return union or None
111
+
112
+
113
+ def output_ids(step: dict, agents: list) -> list:
114
+ ids = []
115
+ per_agent = step.get("artifactOutputIds")
116
+ for agent in agents:
117
+ if isinstance(per_agent, dict) and isinstance(per_agent.get(agent), str):
118
+ ids.append(per_agent[agent])
119
+ elif isinstance(step.get("artifactOutputId"), str):
120
+ ids.append(step["artifactOutputId"])
121
+ else:
122
+ ids.append(agent)
123
+ return ids
124
+
125
+
126
+ def validate_pipeline(steps: list, source: str, errors: list) -> dict:
127
+ """Validate one pipeline `steps[]`; append errors; return scan stats."""
128
+ stats = {"parallel": 0, "multi_step_wave": False}
129
+ if not isinstance(steps, list):
130
+ errors.append(f"{source}: steps must be an array")
131
+ return stats
132
+
133
+ ids: dict[str, int] = {}
134
+ task_ids: dict[str, int] = {}
135
+ for index, step in enumerate(steps):
136
+ if not isinstance(step, dict):
137
+ errors.append(f"{source}: step {index} must be an object")
138
+ continue
139
+ sid = step.get("id")
140
+ if isinstance(sid, str) and sid:
141
+ if sid in ids or sid in task_ids:
142
+ errors.append(f"{source}: step id '{sid}' collides with another id/taskIds")
143
+ ids[sid] = index
144
+ for tid in step.get("taskIds") or []:
145
+ if not isinstance(tid, str):
146
+ continue
147
+ if tid in task_ids and task_ids[tid] != index:
148
+ errors.append(f"{source}: taskIds '{tid}' is duplicated across steps")
149
+ task_ids[tid] = index
150
+
151
+ def resolve(dep: str) -> int | None:
152
+ if dep in ids:
153
+ return ids[dep]
154
+ if dep in task_ids:
155
+ return task_ids[dep]
156
+ return None
157
+
158
+ for index, step in enumerate(steps):
159
+ if not isinstance(step, dict):
160
+ continue
161
+ label = f"{source}: step {index} ({step.get('id') or step.get('agent')})"
162
+ validate_scopes(step, label, errors)
163
+ if step.get("parallel") is True:
164
+ stats["parallel"] += 1
165
+ agents = agents_of(step)
166
+ if len(agents) < 2:
167
+ errors.append(f"{label}: parallel: true requires an agent array with >=2 agents")
168
+ if len(set(agents)) != len(agents):
169
+ errors.append(f"{label}: parallel: true agents must be distinct")
170
+ outs = output_ids(step, agents)
171
+ if len(set(outs)) != len(outs):
172
+ errors.append(f"{label}: parallel: true artifact outputs must be distinct per agent")
173
+ if "mockup-reviewer" in agents_of(step):
174
+ if step.get("parallel") is True or len(agents_of(step)) > 1:
175
+ errors.append(f"{label}: mockup-reviewer must never be in a parallel/multi-agent step")
176
+
177
+ # Dependency resolution + acyclicity.
178
+ deps: dict[int, list[int]] = {}
179
+ for index, step in enumerate(steps):
180
+ if not isinstance(step, dict):
181
+ continue
182
+ raw = step.get("dependsOn")
183
+ if raw is None:
184
+ deps[index] = []
185
+ continue
186
+ if not isinstance(raw, list):
187
+ errors.append(f"{source}: step {index} dependsOn must be an array")
188
+ deps[index] = []
189
+ continue
190
+ resolved = []
191
+ for dep in raw:
192
+ target = resolve(dep) if isinstance(dep, str) else None
193
+ if target is None:
194
+ errors.append(f"{source}: step {index} dependsOn '{dep}' does not resolve to a step id/taskIds")
195
+ continue
196
+ resolved.append(target)
197
+ deps[index] = resolved
198
+
199
+ colors: dict[int, int] = {}
200
+
201
+ def visit(node: int, stack: list) -> None:
202
+ if colors.get(node) == 1:
203
+ errors.append(f"{source}: dependency cycle via {stack + [node]}")
204
+ return
205
+ if colors.get(node) == 2:
206
+ return
207
+ colors[node] = 1
208
+ for nxt in deps.get(node, []):
209
+ visit(nxt, stack + [node])
210
+ colors[node] = 2
211
+
212
+ for node in deps:
213
+ visit(node, [])
214
+
215
+ # Topological levels -> waves.
216
+ levels: dict[int, int] = {}
217
+
218
+ def level_of(node: int, guard: set) -> int:
219
+ if node in levels:
220
+ return levels[node]
221
+ if node in guard:
222
+ return 0
223
+ guard = guard | {node}
224
+ base = 0
225
+ for nxt in deps.get(node, []):
226
+ base = max(base, level_of(nxt, guard) + 1)
227
+ levels[node] = base
228
+ return base
229
+
230
+ # Linear pipelines (no step declares dependsOn) are never scheduled as a
231
+ # wave, so the conflict predicate is graph-only (mirrors the hook's
232
+ # `isGraphMode()` switch).
233
+ graph_mode = any(
234
+ isinstance(step, dict) and step.get("dependsOn") is not None for step in steps
235
+ )
236
+ if not graph_mode:
237
+ return stats
238
+
239
+ waves: dict[int, list[int]] = {}
240
+ for node in deps:
241
+ waves.setdefault(level_of(node, set()), []).append(node)
242
+
243
+ if any(len(wave) > 1 for wave in waves.values()):
244
+ stats["multi_step_wave"] = True
245
+
246
+ for level, wave in sorted(waves.items()):
247
+ if len(wave) < 2:
248
+ continue
249
+ for a_pos, left in enumerate(wave):
250
+ for right in wave[a_pos + 1:]:
251
+ left_step, right_step = steps[left], steps[right]
252
+ pair = f"{source}: wave L{level} steps {left}/{right}"
253
+ left_agents, right_agents = agents_of(left_step), agents_of(right_step)
254
+ if set(left_agents) & set(right_agents):
255
+ errors.append(f"{pair}: same agent in one wave (C2)")
256
+ left_outs, right_outs = set(output_ids(left_step, left_agents)), set(output_ids(right_step, right_agents))
257
+ if left_outs & right_outs:
258
+ errors.append(f"{pair}: shared artifactOutputId in one wave (C3)")
259
+ left_scopes, right_scopes = scope_set(left_step, left_agents), scope_set(right_step, right_agents)
260
+ if left_scopes is None or right_scopes is None:
261
+ errors.append(f"{pair}: undeclared/unknown writeScopes — declare steps[].writeScopes to prove conflict-freedom (C1)")
262
+ else:
263
+ for a in left_scopes:
264
+ for b in right_scopes:
265
+ if overlap(a, b):
266
+ errors.append(f"{pair}: writeScopes overlap '{a}' ~ '{b}' (C1)")
267
+ inputs = set(right_step.get("artifactInputIds") or [])
268
+ if left_outs & inputs:
269
+ errors.append(f"{pair}: producer->consumer artifact edge must be a dependsOn edge, not a wave (C5)")
270
+ inputs_left = set(left_step.get("artifactInputIds") or [])
271
+ if right_outs & inputs_left:
272
+ errors.append(f"{pair}: producer->consumer artifact edge must be a dependsOn edge, not a wave (C5)")
273
+ return stats
274
+
275
+
276
+ def load_pipeline(path: Path) -> dict | None:
277
+ try:
278
+ return json.loads(path.read_text(encoding="utf-8"))
279
+ except (OSError, json.JSONDecodeError) as error:
280
+ print(f"FAIL: {path}: invalid JSON ({error})")
281
+ return None
282
+
283
+
284
+ def main(argv: list) -> int:
285
+ errors: list[str] = []
286
+ totals = {"parallel": 0, "multi_step_wave": False, "files": 0}
287
+
288
+ if argv[:1] == ["--pipeline"]:
289
+ if len(argv) < 2:
290
+ print("FAIL: --pipeline requires a file path")
291
+ return 1
292
+ path = Path(argv[1])
293
+ data = load_pipeline(path)
294
+ if data is None:
295
+ return 1
296
+ steps = data.get("steps")
297
+ if steps is None:
298
+ print(f"OK: {path} has no steps[] (not a pipeline file)")
299
+ return 0
300
+ totals["files"] = 1
301
+ stats = validate_pipeline(steps, str(path), errors)
302
+ totals["parallel"] += stats["parallel"]
303
+ totals["multi_step_wave"] = totals["multi_step_wave"] or stats["multi_step_wave"]
304
+ if errors:
305
+ print(f"FAIL: parallel-plan drift ({len(errors)}):")
306
+ for line in errors:
307
+ print(f" - {line}")
308
+ return 1
309
+ print(f"OK: {path} is a valid parallel/graph plan")
310
+ return 0
311
+
312
+ if not presets.is_dir():
313
+ print(f"FAIL: presets root not found: {presets}")
314
+ return 1
315
+
316
+ for path in sorted(presets.rglob("team/fixtures/*.json")):
317
+ if not path.is_file():
318
+ continue
319
+ data = load_pipeline(path)
320
+ if data is None:
321
+ errors.append(f"{path}: invalid JSON")
322
+ continue
323
+ steps = data.get("steps")
324
+ if steps is None:
325
+ continue
326
+ totals["files"] += 1
327
+ stats = validate_pipeline(steps, str(path.relative_to(presets)), errors)
328
+ totals["parallel"] += stats["parallel"]
329
+ totals["multi_step_wave"] = totals["multi_step_wave"] or stats["multi_step_wave"]
330
+
331
+ if totals["files"] == 0:
332
+ print("FAIL: no pipeline fixtures found — refusing to vacuous-PASS")
333
+ return 1
334
+ if totals["parallel"] == 0 or not totals["multi_step_wave"]:
335
+ errors.append(
336
+ "no fixture exercises both a parallel: true step and a multi-step dependsOn wave — refusing to vacuous-PASS"
337
+ )
338
+
339
+ if errors:
340
+ print(f"FAIL: parallel-plan drift ({len(errors)}):")
341
+ for line in errors:
342
+ print(f" - {line}")
343
+ return 1
344
+
345
+ print(
346
+ f"OK: parallel-plan contract holds across {totals['files']} pipeline fixtures "
347
+ f"({totals['parallel']} parallel step(s); multi-step wave present)"
348
+ )
349
+ return 0
350
+
351
+
352
+ sys.exit(main(sys.argv[1:]))
353
+ PY
@@ -1,18 +1,21 @@
1
1
  #!/usr/bin/env bash
2
2
  # Preset prompt-persistence structural gate.
3
3
  #
4
- # Presence-only, case-insensitive checks that the **persist-the-verbatim-original-prompt**
5
- # contract — every task (whether or not `/task` was invoked) writes the user's raw prompt
6
- # to `.ai.local/team/tasks/<slug>/prompt.md` — is present, wired, and leakage-safe across
7
- # every platform x stack preset tree:
4
+ # Presence-only, case-insensitive checks that the **prompt-persistence** contract — every
5
+ # task (whether or not `/task` was invoked) writes the user's raw prompt to
6
+ # `.ai.local/team/tasks/<slug>/prompt.md`, and every **subsequent user-authored** prompt is
7
+ # appended to `.ai.local/team/tasks/<slug>/prompt-log.md` — is present, wired, and
8
+ # leakage-safe across every platform x stack preset tree:
8
9
  #
9
10
  # G0. Core anchors agent-artifact-contracts.md documents the prompt artifact
10
- # (`## Prompt artifact`, `prompt.md`, `routing`, `authoritativePaths`),
11
- # and the orchestrator + intake core stems reference `prompt.md`.
12
- # A. Command write step commands/task.md contains `prompt.md` + the `**Slug**` step.
13
- # B. Command resume safety commands/task-continue.md contains `prompt.md`.
14
- # C. Orchestrator contract the orchestrator consumer contains `prompt.md`.
15
- # D. Intake contract the intake consumer contains `prompt.md`.
11
+ # (`## Prompt artifact`, `prompt.md`) *and* the append-only ledger
12
+ # (`## Prompt log`, `prompt-log.md`) plus `routing` / `authoritativePaths`,
13
+ # and the orchestrator + intake core stems reference both tokens.
14
+ # A. Command write step commands/task.md contains `prompt.md` + `prompt-log.md` + the
15
+ # `**Slug**` step.
16
+ # B. Command resume safety commands/task-continue.md contains `prompt.md` + `prompt-log.md`.
17
+ # C. Orchestrator contract the orchestrator consumer contains both tokens.
18
+ # D. Intake contract the intake consumer contains both tokens.
16
19
  #
17
20
  # Cursor/Claude cover all 10 stacks; Mavis/OpenCode cover their
18
21
  # `platform-contract.json:releasedStacks`. Structural only — never semantic.
@@ -40,12 +43,21 @@ PLATFORMS = ("cursor", "claude", "mavis", "opencode")
40
43
  STACKS = ("next", "nuxt", "svelte", "ios-swift", "android-kotlin", "go", "java", "mcp-ts", "php-hexagonal", "php-laravel")
41
44
 
42
45
  PROMPT_TOKEN = "prompt.md"
46
+ PROMPT_LOG_TOKEN = "prompt-log.md"
47
+ PROMPT_TOKENS = (PROMPT_TOKEN, PROMPT_LOG_TOKEN)
43
48
  PROMPT_PATH = ".ai.local/team/tasks/<slug>/prompt.md"
44
49
  SLUG_TOKEN = "**Slug**"
45
50
  CORE_CONTRACTS_REL = "agent-team/agent-artifact-contracts.md"
46
51
  CORE_ORCH_REL = "agent-team/agent-team-orchestrator.md"
47
52
  CORE_INTAKE_REL = "agent-team/agent-team-intake.md"
48
- CONTRACTS_TOKENS = ("prompt.md", "## prompt artifact", "routing", "authoritativepaths")
53
+ CONTRACTS_TOKENS = (
54
+ "prompt.md",
55
+ "## prompt artifact",
56
+ "prompt-log.md",
57
+ "## prompt log",
58
+ "routing",
59
+ "authoritativepaths",
60
+ )
49
61
 
50
62
  MAPPING_HEADING = "## Cursor → Claude mapping"
51
63
  ROW_RE = re.compile(r"^\|\s*`([^`]+?\.mdc)`\s*\|\s*`([^`]+?\.md)`\s*\|", re.MULTILINE)
@@ -86,6 +98,10 @@ def rule_relpath(platform: str, stack: str, cursor_name: str, mapping: dict[str,
86
98
  return f"{platform}/{stack}/rules/{stem}.md"
87
99
 
88
100
 
101
+ def missing_tokens(text: str, rel: str, tokens: tuple[str, ...]) -> list[str]:
102
+ return [f"{rel}: missing {token}" for token in tokens if token not in text]
103
+
104
+
89
105
  failures: list[str] = []
90
106
  checks = 0
91
107
 
@@ -107,8 +123,16 @@ checks += 1
107
123
 
108
124
  for core_rel in (CORE_ORCH_REL, CORE_INTAKE_REL):
109
125
  core_path = presets / "_shared" / "core" / core_rel
110
- if not core_path.is_file() or PROMPT_TOKEN not in core_path.read_text(encoding="utf-8"):
111
- print(f"FAIL: prompt-persistence core _shared/core/{core_rel} missing {PROMPT_TOKEN}")
126
+ if not core_path.is_file():
127
+ print(f"FAIL: prompt-persistence core missing _shared/core/{core_rel}")
128
+ sys.exit(1)
129
+ core_stem_text = core_path.read_text(encoding="utf-8")
130
+ missing_stem = [token for token in PROMPT_TOKENS if token not in core_stem_text]
131
+ if missing_stem:
132
+ print(
133
+ f"FAIL: prompt-persistence core _shared/core/{core_rel} "
134
+ f"missing {', '.join(missing_stem)}"
135
+ )
112
136
  sys.exit(1)
113
137
  checks += 1
114
138
 
@@ -127,7 +151,7 @@ for platform in PLATFORMS:
127
151
  misses: list[str] = []
128
152
  mapping = claude_mapping(stack) if platform == "claude" else {}
129
153
 
130
- # --- A: command write step (prompt token + the Slug bootstrap step). ---
154
+ # --- A: command write step (both tokens + the Slug bootstrap step). ---
131
155
  task_rel = f"{platform}/{stack}/commands/task.md"
132
156
  task_path = presets / task_rel
133
157
  checks += 1
@@ -135,19 +159,20 @@ for platform in PLATFORMS:
135
159
  misses.append(f"{task_rel} (file missing)")
136
160
  else:
137
161
  task_text = task_path.read_text(encoding="utf-8")
138
- if PROMPT_TOKEN not in task_text:
139
- misses.append(f"{task_rel}: missing {PROMPT_TOKEN}")
162
+ misses.extend(missing_tokens(task_text, task_rel, PROMPT_TOKENS))
140
163
  if SLUG_TOKEN not in task_text:
141
164
  misses.append(f"{task_rel}: missing slug bootstrap step {SLUG_TOKEN}")
142
165
 
143
- # --- B: command resume safety (prompt token). ---
166
+ # --- B: command resume safety (both tokens). ---
144
167
  cont_rel = f"{platform}/{stack}/commands/task-continue.md"
145
168
  cont_path = presets / cont_rel
146
169
  checks += 1
147
170
  if not cont_path.is_file():
148
171
  misses.append(f"{cont_rel} (file missing)")
149
- elif PROMPT_TOKEN not in cont_path.read_text(encoding="utf-8"):
150
- misses.append(f"{cont_rel}: missing {PROMPT_TOKEN}")
172
+ else:
173
+ misses.extend(
174
+ missing_tokens(cont_path.read_text(encoding="utf-8"), cont_rel, PROMPT_TOKENS)
175
+ )
151
176
 
152
177
  # --- C: orchestrator contract. ---
153
178
  orch_rel = rule_relpath(platform, stack, "agent-team-orchestrator.mdc", mapping)
@@ -155,8 +180,8 @@ for platform in PLATFORMS:
155
180
  checks += 1
156
181
  if not orch_path.is_file():
157
182
  misses.append(f"{orch_rel} (file missing)")
158
- elif PROMPT_TOKEN not in orch_path.read_text(encoding="utf-8"):
159
- misses.append(f"{orch_rel}: missing {PROMPT_TOKEN}")
183
+ else:
184
+ misses.extend(missing_tokens(orch_path.read_text(encoding="utf-8"), orch_rel, PROMPT_TOKENS))
160
185
 
161
186
  # --- D: intake contract. ---
162
187
  intake_rel = rule_relpath(platform, stack, "agent-team-intake.mdc", mapping)
@@ -164,8 +189,10 @@ for platform in PLATFORMS:
164
189
  checks += 1
165
190
  if not intake_path.is_file():
166
191
  misses.append(f"{intake_rel} (file missing)")
167
- elif PROMPT_TOKEN not in intake_path.read_text(encoding="utf-8"):
168
- misses.append(f"{intake_rel}: missing {PROMPT_TOKEN}")
192
+ else:
193
+ misses.extend(
194
+ missing_tokens(intake_path.read_text(encoding="utf-8"), intake_rel, PROMPT_TOKENS)
195
+ )
169
196
 
170
197
  if misses:
171
198
  failures.append(f"{platform}/{stack}")
@@ -185,7 +212,7 @@ if failures:
185
212
  print(
186
213
  f"OK: prompt-persistence present across {len(PLATFORMS)} platforms "
187
214
  f"({checks} file checks; cursor/claude {len(STACKS)} stacks, "
188
- f"mavis/opencode releasedStacks)"
215
+ f"mavis/opencode releasedStacks; prompt.md + prompt-log.md)"
189
216
  )
190
217
  sys.exit(0)
191
218
  PY
@@ -156,6 +156,8 @@ run_gate "shared-core-drift" "$SCRIPT_DIR/check-shared-core-drift.sh" AI_RULES_D
156
156
  run_gate "chain-hook-coverage" "$SCRIPT_DIR/check-chain-hook-coverage.sh"
157
157
  run_gate "task-router-intents" "$SCRIPT_DIR/check-task-router-intents.sh"
158
158
  run_gate "plan-contract" "$SCRIPT_DIR/check-plan-contract.sh"
159
+ run_gate "parallel-plan" "$SCRIPT_DIR/check-parallel-plan.sh"
160
+ run_gate "step-graph-contract" "$SCRIPT_DIR/check-step-graph-contract.sh"
159
161
  run_gate "goal-contract" "$SCRIPT_DIR/check-preset-goal-contract.sh"
160
162
  run_gate "self-review-contract" "$SCRIPT_DIR/check-preset-self-review-contract.sh"
161
163
  run_gate "prompt-persistence" "$SCRIPT_DIR/check-preset-prompt-persistence.sh"
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env bash
2
+ # Step-graph contract parity gate (reliable-subagent-parallelism, AC-4 / AC-8).
3
+ #
4
+ # The pipeline step graph + conflict model is documented in the shared-core
5
+ # orchestrator doc. Three of its consumers are hand-authored / generated per
6
+ # platform x stack and are NOT body-compared by `check-shared-core-drift.sh`
7
+ # (the orchestrator stem is `lineage`; agent prompts carry no shared-core
8
+ # marker). A missed copy is a silent drift blind spot — this gate closes it with
9
+ # a token-presence parity check:
10
+ #
11
+ # A. Orchestrator rule (all platforms/stacks): dependsOn / writeScopes /
12
+ # taskIds / joinedSlots / waveSteps / waveId / blockedSteps / ready queue /
13
+ # conflict-free / mockup-reviewer
14
+ # B. task-router prompt (all platforms/stacks): parallel: true / writeScopes /
15
+ # dependsOn / taskIds / mockup-reviewer
16
+ # C. task-analyst prompt (all platforms/stacks): dependsOn / writeScopes /
17
+ # conflict-free
18
+ #
19
+ # Structural only, case-insensitive; never checks ordering. Refuses to
20
+ # vacuous-PASS when no stack is discovered. `AI_RULES_PRESETS_ROOT` overrides the
21
+ # presets root (used by the fixture test).
22
+ set -euo pipefail
23
+
24
+ ROOT="$(cd "$(dirname "$0")/../../.." && pwd)"
25
+ export AI_RULES_PRESETS_ROOT="${AI_RULES_PRESETS_ROOT:-$ROOT/packages/ai-rules/presets}"
26
+
27
+ python3 <<'PY'
28
+ from __future__ import annotations
29
+
30
+ import json
31
+ import os
32
+ import sys
33
+ from pathlib import Path
34
+
35
+ presets = Path(os.environ["AI_RULES_PRESETS_ROOT"])
36
+ PLATFORMS = ("cursor", "claude", "mavis", "opencode")
37
+ STACKS = ("next", "nuxt", "svelte", "ios-swift", "android-kotlin", "go", "java", "mcp-ts", "php-hexagonal", "php-laravel")
38
+
39
+ ORCHESTRATOR_TOKENS = (
40
+ "dependsOn",
41
+ "writeScopes",
42
+ "taskIds",
43
+ "joinedSlots",
44
+ "waveSteps",
45
+ "waveId",
46
+ "blockedSteps",
47
+ "ready queue",
48
+ "conflict-free",
49
+ "mockup-reviewer",
50
+ )
51
+ ROUTER_TOKENS = ("parallel: true", "writeScopes", "dependsOn", "taskIds", "mockup-reviewer")
52
+ ANALYST_TOKENS = ("dependsOn", "writeScopes", "conflict-free")
53
+
54
+
55
+ def released_contract_stacks(platform: str) -> list[str]:
56
+ contract = presets / platform / "platform-contract.json"
57
+ if not contract.is_file():
58
+ return []
59
+ try:
60
+ data = json.loads(contract.read_text(encoding="utf-8"))
61
+ return list(data.get("releasedStacks") or [])
62
+ except json.JSONDecodeError:
63
+ return []
64
+
65
+
66
+ def orchestrator_relpath(platform: str) -> str:
67
+ if platform == "cursor":
68
+ return "rules/agent-team-orchestrator.mdc"
69
+ if platform == "claude":
70
+ return "rules/tooling-and-review/agent-team-orchestrator.md"
71
+ return "rules/agent-team-orchestrator.md"
72
+
73
+
74
+ def missing_tokens(path: Path, tokens: tuple[str, ...]) -> list[str] | None:
75
+ if not path.is_file():
76
+ return None
77
+ text = path.read_text(encoding="utf-8").lower()
78
+ return [token for token in tokens if token.lower() not in text]
79
+
80
+
81
+ failures: list[str] = []
82
+ checks = 0
83
+
84
+ for platform in PLATFORMS:
85
+ if platform in {"cursor", "claude"}:
86
+ stacks = list(STACKS)
87
+ else:
88
+ stacks = released_contract_stacks(platform)
89
+ if not stacks:
90
+ failures.append(
91
+ f"{platform}: no releasedStacks from platform-contract.json "
92
+ "(missing, malformed, or empty) — refusing to vacuous-PASS"
93
+ )
94
+ continue
95
+ for stack in stacks:
96
+ base = presets / platform / stack
97
+ targets = (
98
+ (base / orchestrator_relpath(platform), ORCHESTRATOR_TOKENS),
99
+ (base / "agents" / "task-router.md", ROUTER_TOKENS),
100
+ (base / "agents" / "task-analyst.md", ANALYST_TOKENS),
101
+ )
102
+ misses: list[str] = []
103
+ for path, tokens in targets:
104
+ checks += 1
105
+ missing = missing_tokens(path, tokens)
106
+ if missing is None:
107
+ misses.append(f"{path.relative_to(presets)} (file missing)")
108
+ elif missing:
109
+ misses.append(f"{path.relative_to(presets)}: missing {', '.join(missing)}")
110
+ if misses:
111
+ failures.append(f"{platform}/{stack}")
112
+ for miss in misses:
113
+ failures.append(f" - {miss}")
114
+
115
+ if failures:
116
+ print(f"FAIL: step-graph contract drift ({checks} file checks):")
117
+ for line in failures:
118
+ print(f" {line}")
119
+ sys.exit(1)
120
+
121
+ print(f"OK: step-graph contract present across {len(PLATFORMS)} platforms ({checks} file checks)")
122
+ sys.exit(0)
123
+ PY