@bonesofspring/ai-rules 0.2.11 → 0.2.13

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 (593) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +5 -1
  3. package/bin/cli.js +4 -0
  4. package/package.json +1 -1
  5. package/presets/_shared/README.md +1 -1
  6. package/presets/_shared/core/agent-team/agent-artifact-contracts.md +114 -0
  7. package/presets/_shared/core/agent-team/agent-task-metrics.md +30 -0
  8. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +71 -4
  9. package/presets/_shared/core/meta/preset-layering.md +1 -1
  10. package/presets/_shared/core/meta/preset-no-cross-stack-leakage.md +5 -5
  11. package/presets/_shared/core/meta/preset-pr-checklist.md +1 -1
  12. package/presets/_shared/core/meta/preset-twin-sync.md +4 -0
  13. package/presets/_shared/core/review/technical-retro.md +2 -0
  14. package/presets/claude/go/agents/build-verifier.md +11 -4
  15. package/presets/claude/go/agents/code-reviewer.md +8 -1
  16. package/presets/claude/go/agents/feature-developer.md +8 -1
  17. package/presets/claude/go/agents/task-analyst.md +8 -1
  18. package/presets/claude/go/agents/task-router.md +35 -3
  19. package/presets/claude/go/commands/task-continue.md +17 -16
  20. package/presets/claude/go/commands/task.md +11 -5
  21. package/presets/claude/go/commands/technical-retro.md +4 -0
  22. package/presets/claude/go/hooks/chain-team-phases.sh +411 -69
  23. package/presets/claude/go/rules/README.md +6 -0
  24. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +33 -4
  25. package/presets/claude/go/rules/tooling-and-review/preset-layering.md +1 -1
  26. package/presets/claude/go/rules/tooling-and-review/preset-no-cross-stack-leakage.md +5 -5
  27. package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  28. package/presets/claude/go/rules/tooling-and-review/preset-twin-sync.md +4 -0
  29. package/presets/claude/go/rules/tooling-and-review/technical-retro.md +2 -0
  30. package/presets/claude/go/team/README.md +19 -0
  31. package/presets/claude/ios-swift/agents/build-verifier.md +11 -4
  32. package/presets/claude/ios-swift/agents/code-reviewer.md +9 -14
  33. package/presets/claude/ios-swift/agents/feature-developer.md +8 -1
  34. package/presets/claude/ios-swift/agents/task-analyst.md +8 -1
  35. package/presets/claude/ios-swift/agents/task-router.md +33 -1
  36. package/presets/claude/ios-swift/commands/task-continue.md +17 -16
  37. package/presets/claude/ios-swift/commands/task.md +11 -5
  38. package/presets/claude/ios-swift/commands/technical-retro.md +4 -0
  39. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +393 -70
  40. package/presets/claude/ios-swift/rules/README.md +6 -0
  41. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +36 -1
  42. package/presets/claude/ios-swift/rules/tooling-and-review/preset-layering.md +1 -1
  43. package/presets/claude/ios-swift/rules/tooling-and-review/preset-no-cross-stack-leakage.md +5 -5
  44. package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  45. package/presets/claude/ios-swift/rules/tooling-and-review/preset-twin-sync.md +4 -0
  46. package/presets/claude/ios-swift/rules/tooling-and-review/technical-retro.md +2 -0
  47. package/presets/claude/ios-swift/team/README.md +19 -0
  48. package/presets/claude/java/agents/build-verifier.md +11 -4
  49. package/presets/claude/java/agents/code-reviewer.md +8 -1
  50. package/presets/claude/java/agents/feature-developer.md +8 -1
  51. package/presets/claude/java/agents/task-analyst.md +8 -1
  52. package/presets/claude/java/agents/task-router.md +33 -1
  53. package/presets/claude/java/commands/task-continue.md +17 -16
  54. package/presets/claude/java/commands/task.md +11 -5
  55. package/presets/claude/java/commands/technical-retro.md +4 -0
  56. package/presets/claude/java/hooks/chain-team-phases.sh +411 -69
  57. package/presets/claude/java/rules/README.md +6 -0
  58. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +33 -4
  59. package/presets/claude/java/rules/tooling-and-review/preset-layering.md +1 -1
  60. package/presets/claude/java/rules/tooling-and-review/preset-no-cross-stack-leakage.md +5 -5
  61. package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  62. package/presets/claude/java/rules/tooling-and-review/preset-twin-sync.md +4 -0
  63. package/presets/claude/java/rules/tooling-and-review/technical-retro.md +2 -0
  64. package/presets/claude/java/team/README.md +19 -0
  65. package/presets/claude/mcp-ts/agents/build-verifier.md +11 -4
  66. package/presets/claude/mcp-ts/agents/feature-developer.md +7 -1
  67. package/presets/claude/mcp-ts/agents/task-analyst.md +8 -1
  68. package/presets/claude/mcp-ts/agents/task-router.md +35 -3
  69. package/presets/claude/mcp-ts/commands/task-continue.md +21 -20
  70. package/presets/claude/mcp-ts/commands/task.md +11 -5
  71. package/presets/claude/mcp-ts/commands/technical-retro.md +4 -0
  72. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +397 -55
  73. package/presets/claude/mcp-ts/rules/README.md +6 -0
  74. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +33 -4
  75. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-layering.md +1 -1
  76. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-no-cross-stack-leakage.md +5 -5
  77. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  78. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-twin-sync.md +4 -0
  79. package/presets/claude/mcp-ts/rules/tooling-and-review/technical-retro.md +2 -4
  80. package/presets/claude/mcp-ts/team/README.md +19 -0
  81. package/presets/claude/next/agents/accessibility-reviewer.md +6 -12
  82. package/presets/claude/next/agents/api-contract-reviewer.md +6 -12
  83. package/presets/claude/next/agents/build-verifier.md +10 -14
  84. package/presets/claude/next/agents/ci-investigator.md +7 -13
  85. package/presets/claude/next/agents/code-reviewer.md +9 -14
  86. package/presets/claude/next/agents/debugger.md +6 -12
  87. package/presets/claude/next/agents/feature-developer.md +8 -1
  88. package/presets/claude/next/agents/migration-specialist.md +6 -12
  89. package/presets/claude/next/agents/performance-auditor.md +5 -11
  90. package/presets/claude/next/agents/qa-tester.md +6 -12
  91. package/presets/claude/next/agents/security-reviewer.md +6 -12
  92. package/presets/claude/next/agents/solution-architect.md +6 -12
  93. package/presets/claude/next/agents/task-analyst.md +10 -16
  94. package/presets/claude/next/agents/task-router.md +33 -1
  95. package/presets/claude/next/agents/tech-writer.md +6 -13
  96. package/presets/claude/next/agents/unit-test-generator.md +6 -10
  97. package/presets/claude/next/agents/unit-test-healer.md +6 -10
  98. package/presets/claude/next/agents/unit-test-planner.md +5 -11
  99. package/presets/claude/next/commands/task-continue.md +17 -16
  100. package/presets/claude/next/commands/task.md +11 -5
  101. package/presets/claude/next/commands/technical-retro.md +4 -0
  102. package/presets/claude/next/hooks/chain-team-phases.sh +413 -70
  103. package/presets/claude/next/rules/README.md +6 -0
  104. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +32 -3
  105. package/presets/claude/next/rules/tooling-and-review/preset-layering.md +1 -1
  106. package/presets/claude/next/rules/tooling-and-review/preset-no-cross-stack-leakage.md +5 -5
  107. package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  108. package/presets/claude/next/rules/tooling-and-review/preset-twin-sync.md +4 -0
  109. package/presets/claude/next/rules/tooling-and-review/technical-retro.md +2 -0
  110. package/presets/claude/next/team/README.md +32 -1
  111. package/presets/claude/next/team/fixtures/artifact-manifest.example.json +61 -0
  112. package/presets/claude/next/team/fixtures/bugfix-standard.json +10 -0
  113. package/presets/claude/next/team/fixtures/feature-full.json +10 -0
  114. package/presets/claude/next/team/fixtures/feature-light.json +10 -0
  115. package/presets/claude/php-hexagonal/CLAUDE.md +31 -0
  116. package/presets/claude/php-hexagonal/MCP.md +15 -0
  117. package/presets/claude/php-hexagonal/README.md +26 -0
  118. package/presets/claude/php-hexagonal/REPO_AGENTS.md +46 -0
  119. package/presets/claude/php-hexagonal/agents/README.md +32 -0
  120. package/presets/claude/php-hexagonal/agents/api-contract-reviewer.md +23 -0
  121. package/presets/claude/php-hexagonal/agents/build-verifier.md +52 -0
  122. package/presets/claude/php-hexagonal/agents/ci-investigator.md +21 -0
  123. package/presets/claude/php-hexagonal/agents/code-reviewer.md +47 -0
  124. package/presets/claude/php-hexagonal/agents/codebase-analyzer.md +28 -0
  125. package/presets/claude/php-hexagonal/agents/debugger.md +29 -0
  126. package/presets/claude/php-hexagonal/agents/feature-developer.md +54 -0
  127. package/presets/claude/php-hexagonal/agents/integration-test-generator.md +22 -0
  128. package/presets/claude/php-hexagonal/agents/integration-test-healer.md +22 -0
  129. package/presets/claude/php-hexagonal/agents/integration-test-planner.md +22 -0
  130. package/presets/claude/php-hexagonal/agents/migration-specialist.md +31 -0
  131. package/presets/claude/php-hexagonal/agents/performance-auditor.md +22 -0
  132. package/presets/claude/php-hexagonal/agents/qa-tester.md +24 -0
  133. package/presets/claude/php-hexagonal/agents/security-reviewer.md +20 -0
  134. package/presets/claude/php-hexagonal/agents/solution-architect.md +28 -0
  135. package/presets/claude/php-hexagonal/agents/task-analyst.md +32 -0
  136. package/presets/claude/php-hexagonal/agents/task-router.md +101 -0
  137. package/presets/claude/php-hexagonal/agents/tech-writer.md +15 -0
  138. package/presets/claude/php-hexagonal/agents/unit-test-generator.md +21 -0
  139. package/presets/claude/php-hexagonal/agents/unit-test-healer.md +13 -0
  140. package/presets/claude/php-hexagonal/agents/unit-test-planner.md +26 -0
  141. package/presets/claude/php-hexagonal/commands/README.md +13 -0
  142. package/presets/claude/php-hexagonal/commands/feature-continue.md +51 -0
  143. package/presets/claude/php-hexagonal/commands/feature-start.md +30 -0
  144. package/presets/claude/php-hexagonal/commands/task-continue.md +50 -0
  145. package/presets/claude/php-hexagonal/commands/task.md +55 -0
  146. package/presets/claude/php-hexagonal/commands/technical-retro.md +62 -0
  147. package/presets/claude/php-hexagonal/hooks/README.md +16 -0
  148. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +724 -0
  149. package/presets/claude/php-hexagonal/hooks/examples/README.md +18 -0
  150. package/presets/claude/php-hexagonal/hooks/examples/format-edited.example.sh +11 -0
  151. package/presets/claude/php-hexagonal/hooks/examples/secret-guard.example.sh +10 -0
  152. package/presets/claude/php-hexagonal/hooks/examples/test-on-save.example.sh +19 -0
  153. package/presets/claude/php-hexagonal/hooks/guard-shell-command.sh +80 -0
  154. package/presets/claude/php-hexagonal/mcp.json +11 -0
  155. package/presets/claude/php-hexagonal/rules/README.md +67 -0
  156. package/presets/claude/php-hexagonal/rules/api-and-data/README.md +14 -0
  157. package/presets/claude/php-hexagonal/rules/api-and-data/adapters-driven.md +38 -0
  158. package/presets/claude/php-hexagonal/rules/api-and-data/adapters-driving.md +38 -0
  159. package/presets/claude/php-hexagonal/rules/api-and-data/api-grpc.md +29 -0
  160. package/presets/claude/php-hexagonal/rules/api-and-data/api-http.md +36 -0
  161. package/presets/claude/php-hexagonal/rules/api-and-data/messaging-adapters.md +37 -0
  162. package/presets/claude/php-hexagonal/rules/api-and-data/persistence-adapters.md +33 -0
  163. package/presets/claude/php-hexagonal/rules/architecture/README.md +16 -0
  164. package/presets/claude/php-hexagonal/rules/architecture/application-usecases.md +31 -0
  165. package/presets/claude/php-hexagonal/rules/architecture/boundaries.md +34 -0
  166. package/presets/claude/php-hexagonal/rules/architecture/composition-root.md +33 -0
  167. package/presets/claude/php-hexagonal/rules/architecture/domain-layer.md +37 -0
  168. package/presets/claude/php-hexagonal/rules/architecture/feature-delivery.md +53 -0
  169. package/presets/claude/php-hexagonal/rules/architecture/module-public-api.md +31 -0
  170. package/presets/claude/php-hexagonal/rules/architecture/ports-interfaces.md +34 -0
  171. package/presets/claude/php-hexagonal/rules/architecture/reference-features.md +39 -0
  172. package/presets/claude/php-hexagonal/rules/stack/README.md +10 -0
  173. package/presets/claude/php-hexagonal/rules/stack/php-app-core.md +35 -0
  174. package/presets/claude/php-hexagonal/rules/stack/php-conventions.md +51 -0
  175. package/presets/claude/php-hexagonal/rules/testing/README.md +11 -0
  176. package/presets/claude/php-hexagonal/rules/testing/e2e.md +35 -0
  177. package/presets/claude/php-hexagonal/rules/testing/integration.md +31 -0
  178. package/presets/claude/php-hexagonal/rules/testing/unit.md +32 -0
  179. package/presets/claude/php-hexagonal/rules/tooling-and-review/README.md +21 -0
  180. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-intake.md +26 -0
  181. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +208 -0
  182. package/presets/claude/php-hexagonal/rules/tooling-and-review/anti-sycophancy-discipline.md +29 -0
  183. package/presets/claude/php-hexagonal/rules/tooling-and-review/code-quality.md +53 -0
  184. package/presets/claude/php-hexagonal/rules/tooling-and-review/code-review.md +60 -0
  185. package/presets/claude/php-hexagonal/rules/tooling-and-review/design-guidance.md +111 -0
  186. package/presets/claude/php-hexagonal/rules/tooling-and-review/php-tooling.md +39 -0
  187. package/presets/claude/php-hexagonal/rules/tooling-and-review/post-change-test.md +31 -0
  188. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-layering.md +36 -0
  189. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-no-cross-stack-leakage.md +69 -0
  190. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +39 -0
  191. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-token-budget.md +41 -0
  192. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-twin-sync.md +50 -0
  193. package/presets/claude/php-hexagonal/rules/tooling-and-review/security-php.md +29 -0
  194. package/presets/claude/php-hexagonal/rules/tooling-and-review/technical-retro.md +22 -0
  195. package/presets/claude/php-hexagonal/rules/ui-and-accessibility/README.md +5 -0
  196. package/presets/claude/php-hexagonal/skills/README.md +5 -0
  197. package/presets/claude/php-hexagonal/skills/ci-investigation/SKILL.md +11 -0
  198. package/presets/claude/php-hexagonal/skills/code-review/SKILL.md +25 -0
  199. package/presets/claude/php-hexagonal/skills/debug-investigation/SKILL.md +15 -0
  200. package/presets/claude/php-hexagonal/skills/feature-delivery/SKILL.md +30 -0
  201. package/presets/claude/php-hexagonal/skills/integration-testing/SKILL.md +15 -0
  202. package/presets/claude/php-hexagonal/skills/technical-retro/SKILL.md +54 -0
  203. package/presets/claude/php-hexagonal/skills/unit-testing/SKILL.md +14 -0
  204. package/presets/claude/php-hexagonal/skills/write-adr/SKILL.md +41 -0
  205. package/presets/claude/php-hexagonal/team/README.md +48 -0
  206. package/presets/claude/php-hexagonal/team/conventions.md +21 -0
  207. package/presets/claude/php-hexagonal/team/fixtures/bugfix-standard.json +37 -0
  208. package/presets/claude/php-hexagonal/team/fixtures/feature-full.json +25 -0
  209. package/presets/claude/php-hexagonal/team/fixtures/feature-light.json +17 -0
  210. package/presets/claude/php-laravel/CLAUDE.md +20 -0
  211. package/presets/claude/php-laravel/MCP.md +5 -0
  212. package/presets/claude/php-laravel/README.md +30 -0
  213. package/presets/claude/php-laravel/REPO_AGENTS.md +47 -0
  214. package/presets/claude/php-laravel/agents/README.md +32 -0
  215. package/presets/claude/php-laravel/agents/api-contract-reviewer.md +23 -0
  216. package/presets/claude/php-laravel/agents/build-verifier.md +52 -0
  217. package/presets/claude/php-laravel/agents/ci-investigator.md +21 -0
  218. package/presets/claude/php-laravel/agents/code-reviewer.md +47 -0
  219. package/presets/claude/php-laravel/agents/codebase-analyzer.md +28 -0
  220. package/presets/claude/php-laravel/agents/debugger.md +29 -0
  221. package/presets/claude/php-laravel/agents/feature-developer.md +54 -0
  222. package/presets/claude/php-laravel/agents/integration-test-generator.md +22 -0
  223. package/presets/claude/php-laravel/agents/integration-test-healer.md +22 -0
  224. package/presets/claude/php-laravel/agents/integration-test-planner.md +22 -0
  225. package/presets/claude/php-laravel/agents/migration-specialist.md +31 -0
  226. package/presets/claude/php-laravel/agents/performance-auditor.md +22 -0
  227. package/presets/claude/php-laravel/agents/qa-tester.md +30 -0
  228. package/presets/claude/php-laravel/agents/security-reviewer.md +32 -0
  229. package/presets/claude/php-laravel/agents/solution-architect.md +29 -0
  230. package/presets/claude/php-laravel/agents/task-analyst.md +32 -0
  231. package/presets/claude/php-laravel/agents/task-router.md +120 -0
  232. package/presets/claude/php-laravel/agents/tech-writer.md +15 -0
  233. package/presets/claude/php-laravel/agents/unit-test-generator.md +21 -0
  234. package/presets/claude/php-laravel/agents/unit-test-healer.md +13 -0
  235. package/presets/claude/php-laravel/agents/unit-test-planner.md +26 -0
  236. package/presets/claude/php-laravel/commands/README.md +13 -0
  237. package/presets/claude/php-laravel/commands/feature-continue.md +51 -0
  238. package/presets/claude/php-laravel/commands/feature-start.md +30 -0
  239. package/presets/claude/php-laravel/commands/task-continue.md +50 -0
  240. package/presets/claude/php-laravel/commands/task.md +55 -0
  241. package/presets/claude/php-laravel/commands/technical-retro.md +62 -0
  242. package/presets/claude/php-laravel/hooks/README.md +16 -0
  243. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +724 -0
  244. package/presets/claude/php-laravel/hooks/examples/README.md +18 -0
  245. package/presets/claude/php-laravel/hooks/examples/format-edited.example.sh +11 -0
  246. package/presets/claude/php-laravel/hooks/examples/secret-guard.example.sh +10 -0
  247. package/presets/claude/php-laravel/hooks/examples/test-on-save.example.sh +19 -0
  248. package/presets/claude/php-laravel/hooks/guard-shell-command.sh +80 -0
  249. package/presets/claude/php-laravel/mcp.json +11 -0
  250. package/presets/claude/php-laravel/rules/README.md +67 -0
  251. package/presets/claude/php-laravel/rules/api-and-data/README.md +3 -0
  252. package/presets/claude/php-laravel/rules/api-and-data/eloquent-persistence.md +31 -0
  253. package/presets/claude/php-laravel/rules/api-and-data/events-listeners.md +31 -0
  254. package/presets/claude/php-laravel/rules/api-and-data/form-requests.md +29 -0
  255. package/presets/claude/php-laravel/rules/api-and-data/http-layer.md +32 -0
  256. package/presets/claude/php-laravel/rules/api-and-data/jobs-queues.md +41 -0
  257. package/presets/claude/php-laravel/rules/api-and-data/policies-authorization.md +29 -0
  258. package/presets/claude/php-laravel/rules/api-and-data/routes-api.md +29 -0
  259. package/presets/claude/php-laravel/rules/architecture/README.md +3 -0
  260. package/presets/claude/php-laravel/rules/architecture/actions-services.md +30 -0
  261. package/presets/claude/php-laravel/rules/architecture/boundaries.md +34 -0
  262. package/presets/claude/php-laravel/rules/architecture/domain-layer.md +24 -0
  263. package/presets/claude/php-laravel/rules/architecture/feature-delivery.md +51 -0
  264. package/presets/claude/php-laravel/rules/architecture/module-public-api.md +29 -0
  265. package/presets/claude/php-laravel/rules/architecture/reference-features.md +40 -0
  266. package/presets/claude/php-laravel/rules/architecture/service-providers.md +28 -0
  267. package/presets/claude/php-laravel/rules/stack/README.md +3 -0
  268. package/presets/claude/php-laravel/rules/stack/laravel-app-core.md +32 -0
  269. package/presets/claude/php-laravel/rules/stack/laravel-conventions.md +38 -0
  270. package/presets/claude/php-laravel/rules/testing/README.md +3 -0
  271. package/presets/claude/php-laravel/rules/testing/e2e.md +34 -0
  272. package/presets/claude/php-laravel/rules/testing/integration.md +30 -0
  273. package/presets/claude/php-laravel/rules/testing/unit.md +30 -0
  274. package/presets/claude/php-laravel/rules/tooling-and-review/README.md +3 -0
  275. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-intake.md +21 -0
  276. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +205 -0
  277. package/presets/claude/php-laravel/rules/tooling-and-review/anti-sycophancy-discipline.md +29 -0
  278. package/presets/claude/php-laravel/rules/tooling-and-review/code-quality.md +52 -0
  279. package/presets/claude/php-laravel/rules/tooling-and-review/code-review.md +58 -0
  280. package/presets/claude/php-laravel/rules/tooling-and-review/design-guidance.md +111 -0
  281. package/presets/claude/php-laravel/rules/tooling-and-review/php-tooling.md +37 -0
  282. package/presets/claude/php-laravel/rules/tooling-and-review/post-change-test.md +29 -0
  283. package/presets/claude/php-laravel/rules/tooling-and-review/preset-layering.md +33 -0
  284. package/presets/claude/php-laravel/rules/tooling-and-review/preset-no-cross-stack-leakage.md +66 -0
  285. package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +36 -0
  286. package/presets/claude/php-laravel/rules/tooling-and-review/preset-token-budget.md +38 -0
  287. package/presets/claude/php-laravel/rules/tooling-and-review/preset-twin-sync.md +47 -0
  288. package/presets/claude/php-laravel/rules/tooling-and-review/security-php.md +58 -0
  289. package/presets/claude/php-laravel/rules/tooling-and-review/technical-retro.md +17 -0
  290. package/presets/claude/php-laravel/rules/ui-and-accessibility/README.md +3 -0
  291. package/presets/claude/php-laravel/skills/README.md +5 -0
  292. package/presets/claude/php-laravel/skills/ci-investigation/SKILL.md +11 -0
  293. package/presets/claude/php-laravel/skills/code-review/SKILL.md +25 -0
  294. package/presets/claude/php-laravel/skills/debug-investigation/SKILL.md +15 -0
  295. package/presets/claude/php-laravel/skills/feature-delivery/SKILL.md +30 -0
  296. package/presets/claude/php-laravel/skills/integration-testing/SKILL.md +15 -0
  297. package/presets/claude/php-laravel/skills/technical-retro/SKILL.md +54 -0
  298. package/presets/claude/php-laravel/skills/unit-testing/SKILL.md +14 -0
  299. package/presets/claude/php-laravel/skills/write-adr/SKILL.md +41 -0
  300. package/presets/claude/php-laravel/team/README.md +28 -0
  301. package/presets/claude/php-laravel/team/conventions.md +21 -0
  302. package/presets/claude/php-laravel/team/fixtures/bugfix-standard.json +12 -0
  303. package/presets/claude/php-laravel/team/fixtures/feature-full.json +15 -0
  304. package/presets/claude/php-laravel/team/fixtures/feature-light.json +8 -0
  305. package/presets/cursor/go/agents/build-verifier.md +10 -3
  306. package/presets/cursor/go/agents/code-reviewer.md +8 -1
  307. package/presets/cursor/go/agents/feature-developer.md +8 -1
  308. package/presets/cursor/go/agents/task-analyst.md +8 -1
  309. package/presets/cursor/go/agents/task-router.md +33 -1
  310. package/presets/cursor/go/commands/task-continue.md +17 -16
  311. package/presets/cursor/go/commands/task.md +11 -5
  312. package/presets/cursor/go/commands/technical-retro.md +4 -0
  313. package/presets/cursor/go/hooks/chain-team-phases.sh +411 -69
  314. package/presets/cursor/go/rules/README.md +6 -0
  315. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +33 -4
  316. package/presets/cursor/go/rules/preset-layering.mdc +1 -1
  317. package/presets/cursor/go/rules/preset-no-cross-stack-leakage.mdc +5 -5
  318. package/presets/cursor/go/rules/preset-pr-checklist.mdc +1 -1
  319. package/presets/cursor/go/rules/preset-twin-sync.mdc +4 -0
  320. package/presets/cursor/go/rules/technical-retro.mdc +2 -0
  321. package/presets/cursor/go/team/README.md +19 -0
  322. package/presets/cursor/ios-swift/agents/build-verifier.md +11 -4
  323. package/presets/cursor/ios-swift/agents/code-reviewer.md +9 -14
  324. package/presets/cursor/ios-swift/agents/feature-developer.md +8 -1
  325. package/presets/cursor/ios-swift/agents/task-analyst.md +8 -1
  326. package/presets/cursor/ios-swift/agents/task-router.md +33 -1
  327. package/presets/cursor/ios-swift/commands/task-continue.md +17 -16
  328. package/presets/cursor/ios-swift/commands/task.md +11 -5
  329. package/presets/cursor/ios-swift/commands/technical-retro.md +4 -0
  330. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +411 -70
  331. package/presets/cursor/ios-swift/rules/README.md +6 -0
  332. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +26 -1
  333. package/presets/cursor/ios-swift/rules/preset-layering.mdc +1 -1
  334. package/presets/cursor/ios-swift/rules/preset-no-cross-stack-leakage.mdc +5 -5
  335. package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +1 -1
  336. package/presets/cursor/ios-swift/rules/preset-twin-sync.mdc +4 -0
  337. package/presets/cursor/ios-swift/rules/technical-retro.mdc +2 -0
  338. package/presets/cursor/ios-swift/team/README.md +19 -0
  339. package/presets/cursor/java/agents/build-verifier.md +11 -4
  340. package/presets/cursor/java/agents/code-reviewer.md +8 -1
  341. package/presets/cursor/java/agents/feature-developer.md +8 -1
  342. package/presets/cursor/java/agents/task-analyst.md +8 -1
  343. package/presets/cursor/java/agents/task-router.md +33 -1
  344. package/presets/cursor/java/commands/task-continue.md +17 -16
  345. package/presets/cursor/java/commands/task.md +11 -5
  346. package/presets/cursor/java/commands/technical-retro.md +4 -0
  347. package/presets/cursor/java/hooks/chain-team-phases.sh +411 -69
  348. package/presets/cursor/java/rules/README.md +6 -0
  349. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +33 -4
  350. package/presets/cursor/java/rules/preset-layering.mdc +1 -1
  351. package/presets/cursor/java/rules/preset-no-cross-stack-leakage.mdc +5 -5
  352. package/presets/cursor/java/rules/preset-pr-checklist.mdc +1 -1
  353. package/presets/cursor/java/rules/preset-twin-sync.mdc +4 -0
  354. package/presets/cursor/java/rules/technical-retro.mdc +2 -0
  355. package/presets/cursor/java/team/README.md +19 -0
  356. package/presets/cursor/mcp-ts/agents/build-verifier.md +10 -3
  357. package/presets/cursor/mcp-ts/agents/feature-developer.md +7 -1
  358. package/presets/cursor/mcp-ts/agents/task-analyst.md +8 -1
  359. package/presets/cursor/mcp-ts/agents/task-router.md +33 -1
  360. package/presets/cursor/mcp-ts/commands/task-continue.md +19 -18
  361. package/presets/cursor/mcp-ts/commands/task.md +11 -5
  362. package/presets/cursor/mcp-ts/commands/technical-retro.md +4 -0
  363. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +397 -55
  364. package/presets/cursor/mcp-ts/rules/README.md +6 -0
  365. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +33 -4
  366. package/presets/cursor/mcp-ts/rules/preset-layering.mdc +1 -1
  367. package/presets/cursor/mcp-ts/rules/preset-no-cross-stack-leakage.mdc +5 -5
  368. package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +1 -1
  369. package/presets/cursor/mcp-ts/rules/preset-twin-sync.mdc +4 -0
  370. package/presets/cursor/mcp-ts/rules/technical-retro.mdc +2 -4
  371. package/presets/cursor/mcp-ts/team/README.md +19 -0
  372. package/presets/cursor/next/agents/accessibility-reviewer.md +7 -14
  373. package/presets/cursor/next/agents/api-contract-reviewer.md +7 -14
  374. package/presets/cursor/next/agents/build-verifier.md +10 -15
  375. package/presets/cursor/next/agents/ci-investigator.md +7 -14
  376. package/presets/cursor/next/agents/code-reviewer.md +9 -14
  377. package/presets/cursor/next/agents/debugger.md +6 -12
  378. package/presets/cursor/next/agents/feature-developer.md +8 -1
  379. package/presets/cursor/next/agents/migration-specialist.md +7 -14
  380. package/presets/cursor/next/agents/performance-auditor.md +6 -13
  381. package/presets/cursor/next/agents/qa-tester.md +6 -13
  382. package/presets/cursor/next/agents/security-reviewer.md +7 -14
  383. package/presets/cursor/next/agents/solution-architect.md +6 -12
  384. package/presets/cursor/next/agents/task-analyst.md +10 -16
  385. package/presets/cursor/next/agents/task-router.md +33 -1
  386. package/presets/cursor/next/agents/tech-writer.md +6 -13
  387. package/presets/cursor/next/agents/unit-test-generator.md +6 -11
  388. package/presets/cursor/next/agents/unit-test-healer.md +6 -11
  389. package/presets/cursor/next/agents/unit-test-planner.md +6 -13
  390. package/presets/cursor/next/commands/task-continue.md +17 -16
  391. package/presets/cursor/next/commands/task.md +11 -5
  392. package/presets/cursor/next/commands/technical-retro.md +4 -0
  393. package/presets/cursor/next/hooks/chain-team-phases.sh +417 -70
  394. package/presets/cursor/next/rules/README.md +6 -0
  395. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +33 -4
  396. package/presets/cursor/next/rules/preset-layering.mdc +1 -1
  397. package/presets/cursor/next/rules/preset-no-cross-stack-leakage.mdc +5 -5
  398. package/presets/cursor/next/rules/preset-pr-checklist.mdc +1 -1
  399. package/presets/cursor/next/rules/preset-twin-sync.mdc +4 -0
  400. package/presets/cursor/next/rules/technical-retro.mdc +2 -0
  401. package/presets/cursor/next/team/README.md +33 -2
  402. package/presets/cursor/next/team/fixtures/artifact-manifest.example.json +61 -0
  403. package/presets/cursor/next/team/fixtures/bugfix-standard.json +10 -0
  404. package/presets/cursor/next/team/fixtures/feature-full.json +10 -0
  405. package/presets/cursor/next/team/fixtures/feature-light.json +10 -0
  406. package/presets/cursor/next/team/fixtures/metrics-scenarios/tasks/human-gate/metrics.json +69 -0
  407. package/presets/cursor/next/team/fixtures/metrics-scenarios/tasks/missing-ledger/status.json +5 -0
  408. package/presets/cursor/next/team/fixtures/metrics-scenarios/tasks/parallel-receipts/metrics.json +79 -0
  409. package/presets/cursor/next/team/fixtures/metrics-scenarios/tasks/serial-retry/metrics.json +124 -0
  410. package/presets/cursor/next/team/fixtures/metrics-scenarios/tasks/validation-failed/metrics.json +124 -0
  411. package/presets/cursor/next/team/fixtures/metrics.example.json +54 -0
  412. package/presets/cursor/php-hexagonal/AGENTS.md +39 -0
  413. package/presets/cursor/php-hexagonal/BUGBOT.md +11 -0
  414. package/presets/cursor/php-hexagonal/MCP.md +15 -0
  415. package/presets/cursor/php-hexagonal/README.md +26 -0
  416. package/presets/cursor/php-hexagonal/REPO_AGENTS.md +46 -0
  417. package/presets/cursor/php-hexagonal/agents/README.md +36 -0
  418. package/presets/cursor/php-hexagonal/agents/api-contract-reviewer.md +23 -0
  419. package/presets/cursor/php-hexagonal/agents/build-verifier.md +52 -0
  420. package/presets/cursor/php-hexagonal/agents/ci-investigator.md +21 -0
  421. package/presets/cursor/php-hexagonal/agents/code-reviewer.md +47 -0
  422. package/presets/cursor/php-hexagonal/agents/codebase-analyzer.md +28 -0
  423. package/presets/cursor/php-hexagonal/agents/debugger.md +29 -0
  424. package/presets/cursor/php-hexagonal/agents/feature-developer.md +54 -0
  425. package/presets/cursor/php-hexagonal/agents/integration-test-generator.md +22 -0
  426. package/presets/cursor/php-hexagonal/agents/integration-test-healer.md +22 -0
  427. package/presets/cursor/php-hexagonal/agents/integration-test-planner.md +22 -0
  428. package/presets/cursor/php-hexagonal/agents/migration-specialist.md +31 -0
  429. package/presets/cursor/php-hexagonal/agents/performance-auditor.md +22 -0
  430. package/presets/cursor/php-hexagonal/agents/qa-tester.md +24 -0
  431. package/presets/cursor/php-hexagonal/agents/security-reviewer.md +20 -0
  432. package/presets/cursor/php-hexagonal/agents/solution-architect.md +28 -0
  433. package/presets/cursor/php-hexagonal/agents/task-analyst.md +32 -0
  434. package/presets/cursor/php-hexagonal/agents/task-router.md +101 -0
  435. package/presets/cursor/php-hexagonal/agents/tech-writer.md +15 -0
  436. package/presets/cursor/php-hexagonal/agents/unit-test-generator.md +21 -0
  437. package/presets/cursor/php-hexagonal/agents/unit-test-healer.md +13 -0
  438. package/presets/cursor/php-hexagonal/agents/unit-test-planner.md +26 -0
  439. package/presets/cursor/php-hexagonal/commands/README.md +54 -0
  440. package/presets/cursor/php-hexagonal/commands/feature-continue.md +19 -0
  441. package/presets/cursor/php-hexagonal/commands/feature-start.md +33 -0
  442. package/presets/cursor/php-hexagonal/commands/task-continue.md +50 -0
  443. package/presets/cursor/php-hexagonal/commands/task.md +55 -0
  444. package/presets/cursor/php-hexagonal/commands/technical-retro.md +85 -0
  445. package/presets/cursor/php-hexagonal/hooks/README.md +12 -0
  446. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +724 -0
  447. package/presets/cursor/php-hexagonal/hooks/examples/README.md +18 -0
  448. package/presets/cursor/php-hexagonal/hooks/examples/format-edited.example.sh +11 -0
  449. package/presets/cursor/php-hexagonal/hooks/examples/secret-guard.example.sh +10 -0
  450. package/presets/cursor/php-hexagonal/hooks/examples/test-on-save.example.sh +19 -0
  451. package/presets/cursor/php-hexagonal/hooks/guard-shell-command.sh +80 -0
  452. package/presets/cursor/php-hexagonal/hooks.json +17 -0
  453. package/presets/cursor/php-hexagonal/mcp.json +11 -0
  454. package/presets/cursor/php-hexagonal/rules/README.md +106 -0
  455. package/presets/cursor/php-hexagonal/rules/adapters-driven.mdc +41 -0
  456. package/presets/cursor/php-hexagonal/rules/adapters-driving.mdc +42 -0
  457. package/presets/cursor/php-hexagonal/rules/agent-team-intake.mdc +20 -0
  458. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +202 -0
  459. package/presets/cursor/php-hexagonal/rules/anti-sycophancy-discipline.mdc +30 -0
  460. package/presets/cursor/php-hexagonal/rules/api-grpc.mdc +31 -0
  461. package/presets/cursor/php-hexagonal/rules/api-http.mdc +40 -0
  462. package/presets/cursor/php-hexagonal/rules/application-usecases.mdc +33 -0
  463. package/presets/cursor/php-hexagonal/rules/architecture-boundaries.mdc +36 -0
  464. package/presets/cursor/php-hexagonal/rules/code-quality-and-refactoring.mdc +54 -0
  465. package/presets/cursor/php-hexagonal/rules/code-review-mr.mdc +54 -0
  466. package/presets/cursor/php-hexagonal/rules/composition-root.mdc +37 -0
  467. package/presets/cursor/php-hexagonal/rules/design-guidance.mdc +112 -0
  468. package/presets/cursor/php-hexagonal/rules/domain-layer.mdc +39 -0
  469. package/presets/cursor/php-hexagonal/rules/feature-delivery-workflow.mdc +47 -0
  470. package/presets/cursor/php-hexagonal/rules/messaging-adapters.mdc +38 -0
  471. package/presets/cursor/php-hexagonal/rules/module-public-api.mdc +32 -0
  472. package/presets/cursor/php-hexagonal/rules/persistence-adapters.mdc +35 -0
  473. package/presets/cursor/php-hexagonal/rules/php-app-core.mdc +37 -0
  474. package/presets/cursor/php-hexagonal/rules/php-conventions.mdc +53 -0
  475. package/presets/cursor/php-hexagonal/rules/php-tooling.mdc +38 -0
  476. package/presets/cursor/php-hexagonal/rules/ports-interfaces.mdc +37 -0
  477. package/presets/cursor/php-hexagonal/rules/post-change-test.mdc +30 -0
  478. package/presets/cursor/php-hexagonal/rules/preset-layering.mdc +36 -0
  479. package/presets/cursor/php-hexagonal/rules/preset-no-cross-stack-leakage.mdc +69 -0
  480. package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +39 -0
  481. package/presets/cursor/php-hexagonal/rules/preset-token-budget.mdc +41 -0
  482. package/presets/cursor/php-hexagonal/rules/preset-twin-sync.mdc +50 -0
  483. package/presets/cursor/php-hexagonal/rules/reference-features.mdc +40 -0
  484. package/presets/cursor/php-hexagonal/rules/security-php.mdc +33 -0
  485. package/presets/cursor/php-hexagonal/rules/technical-retro.mdc +16 -0
  486. package/presets/cursor/php-hexagonal/rules/tests-e2e.mdc +36 -0
  487. package/presets/cursor/php-hexagonal/rules/tests-integration.mdc +33 -0
  488. package/presets/cursor/php-hexagonal/rules/tests-unit.mdc +35 -0
  489. package/presets/cursor/php-hexagonal/skills/README.md +5 -0
  490. package/presets/cursor/php-hexagonal/skills/ci-investigation/SKILL.md +11 -0
  491. package/presets/cursor/php-hexagonal/skills/code-review/SKILL.md +25 -0
  492. package/presets/cursor/php-hexagonal/skills/debug-investigation/SKILL.md +15 -0
  493. package/presets/cursor/php-hexagonal/skills/feature-delivery/SKILL.md +30 -0
  494. package/presets/cursor/php-hexagonal/skills/integration-testing/SKILL.md +15 -0
  495. package/presets/cursor/php-hexagonal/skills/technical-retro/SKILL.md +54 -0
  496. package/presets/cursor/php-hexagonal/skills/unit-testing/SKILL.md +14 -0
  497. package/presets/cursor/php-hexagonal/skills/write-adr/SKILL.md +41 -0
  498. package/presets/cursor/php-hexagonal/team/README.md +52 -0
  499. package/presets/cursor/php-hexagonal/team/conventions.md +21 -0
  500. package/presets/cursor/php-hexagonal/team/fixtures/bugfix-standard.json +37 -0
  501. package/presets/cursor/php-hexagonal/team/fixtures/feature-full.json +25 -0
  502. package/presets/cursor/php-hexagonal/team/fixtures/feature-light.json +17 -0
  503. package/presets/cursor/php-laravel/AGENTS.md +39 -0
  504. package/presets/cursor/php-laravel/BUGBOT.md +9 -0
  505. package/presets/cursor/php-laravel/MCP.md +5 -0
  506. package/presets/cursor/php-laravel/README.md +33 -0
  507. package/presets/cursor/php-laravel/REPO_AGENTS.md +47 -0
  508. package/presets/cursor/php-laravel/agents/README.md +36 -0
  509. package/presets/cursor/php-laravel/agents/api-contract-reviewer.md +23 -0
  510. package/presets/cursor/php-laravel/agents/build-verifier.md +52 -0
  511. package/presets/cursor/php-laravel/agents/ci-investigator.md +21 -0
  512. package/presets/cursor/php-laravel/agents/code-reviewer.md +47 -0
  513. package/presets/cursor/php-laravel/agents/codebase-analyzer.md +28 -0
  514. package/presets/cursor/php-laravel/agents/debugger.md +29 -0
  515. package/presets/cursor/php-laravel/agents/feature-developer.md +54 -0
  516. package/presets/cursor/php-laravel/agents/integration-test-generator.md +22 -0
  517. package/presets/cursor/php-laravel/agents/integration-test-healer.md +22 -0
  518. package/presets/cursor/php-laravel/agents/integration-test-planner.md +22 -0
  519. package/presets/cursor/php-laravel/agents/migration-specialist.md +31 -0
  520. package/presets/cursor/php-laravel/agents/performance-auditor.md +22 -0
  521. package/presets/cursor/php-laravel/agents/qa-tester.md +30 -0
  522. package/presets/cursor/php-laravel/agents/security-reviewer.md +32 -0
  523. package/presets/cursor/php-laravel/agents/solution-architect.md +29 -0
  524. package/presets/cursor/php-laravel/agents/task-analyst.md +32 -0
  525. package/presets/cursor/php-laravel/agents/task-router.md +120 -0
  526. package/presets/cursor/php-laravel/agents/tech-writer.md +15 -0
  527. package/presets/cursor/php-laravel/agents/unit-test-generator.md +21 -0
  528. package/presets/cursor/php-laravel/agents/unit-test-healer.md +13 -0
  529. package/presets/cursor/php-laravel/agents/unit-test-planner.md +26 -0
  530. package/presets/cursor/php-laravel/commands/README.md +54 -0
  531. package/presets/cursor/php-laravel/commands/feature-continue.md +19 -0
  532. package/presets/cursor/php-laravel/commands/feature-start.md +33 -0
  533. package/presets/cursor/php-laravel/commands/task-continue.md +50 -0
  534. package/presets/cursor/php-laravel/commands/task.md +55 -0
  535. package/presets/cursor/php-laravel/commands/technical-retro.md +85 -0
  536. package/presets/cursor/php-laravel/hooks/README.md +12 -0
  537. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +724 -0
  538. package/presets/cursor/php-laravel/hooks/examples/README.md +18 -0
  539. package/presets/cursor/php-laravel/hooks/examples/format-edited.example.sh +11 -0
  540. package/presets/cursor/php-laravel/hooks/examples/secret-guard.example.sh +10 -0
  541. package/presets/cursor/php-laravel/hooks/examples/test-on-save.example.sh +19 -0
  542. package/presets/cursor/php-laravel/hooks/guard-shell-command.sh +80 -0
  543. package/presets/cursor/php-laravel/hooks.json +17 -0
  544. package/presets/cursor/php-laravel/mcp.json +11 -0
  545. package/presets/cursor/php-laravel/rules/README.md +111 -0
  546. package/presets/cursor/php-laravel/rules/actions-services.mdc +33 -0
  547. package/presets/cursor/php-laravel/rules/agent-team-intake.mdc +20 -0
  548. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +203 -0
  549. package/presets/cursor/php-laravel/rules/anti-sycophancy-discipline.mdc +30 -0
  550. package/presets/cursor/php-laravel/rules/architecture-boundaries.mdc +37 -0
  551. package/presets/cursor/php-laravel/rules/code-quality-and-refactoring.mdc +54 -0
  552. package/presets/cursor/php-laravel/rules/code-review-mr.mdc +56 -0
  553. package/presets/cursor/php-laravel/rules/design-guidance.mdc +112 -0
  554. package/presets/cursor/php-laravel/rules/domain-layer.mdc +27 -0
  555. package/presets/cursor/php-laravel/rules/eloquent-persistence.mdc +34 -0
  556. package/presets/cursor/php-laravel/rules/events-listeners.mdc +34 -0
  557. package/presets/cursor/php-laravel/rules/feature-delivery-workflow.mdc +50 -0
  558. package/presets/cursor/php-laravel/rules/form-requests.mdc +32 -0
  559. package/presets/cursor/php-laravel/rules/http-layer.mdc +35 -0
  560. package/presets/cursor/php-laravel/rules/jobs-queues.mdc +44 -0
  561. package/presets/cursor/php-laravel/rules/laravel-app-core.mdc +35 -0
  562. package/presets/cursor/php-laravel/rules/laravel-conventions.mdc +41 -0
  563. package/presets/cursor/php-laravel/rules/module-public-api.mdc +31 -0
  564. package/presets/cursor/php-laravel/rules/php-tooling.mdc +39 -0
  565. package/presets/cursor/php-laravel/rules/policies-authorization.mdc +32 -0
  566. package/presets/cursor/php-laravel/rules/post-change-test.mdc +31 -0
  567. package/presets/cursor/php-laravel/rules/preset-layering.mdc +36 -0
  568. package/presets/cursor/php-laravel/rules/preset-no-cross-stack-leakage.mdc +69 -0
  569. package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +39 -0
  570. package/presets/cursor/php-laravel/rules/preset-token-budget.mdc +41 -0
  571. package/presets/cursor/php-laravel/rules/preset-twin-sync.mdc +50 -0
  572. package/presets/cursor/php-laravel/rules/reference-features.mdc +42 -0
  573. package/presets/cursor/php-laravel/rules/routes-api.mdc +32 -0
  574. package/presets/cursor/php-laravel/rules/security-php.mdc +61 -0
  575. package/presets/cursor/php-laravel/rules/service-providers.mdc +31 -0
  576. package/presets/cursor/php-laravel/rules/technical-retro.mdc +16 -0
  577. package/presets/cursor/php-laravel/rules/tests-e2e.mdc +36 -0
  578. package/presets/cursor/php-laravel/rules/tests-integration.mdc +33 -0
  579. package/presets/cursor/php-laravel/rules/tests-unit.mdc +33 -0
  580. package/presets/cursor/php-laravel/skills/README.md +5 -0
  581. package/presets/cursor/php-laravel/skills/ci-investigation/SKILL.md +11 -0
  582. package/presets/cursor/php-laravel/skills/code-review/SKILL.md +25 -0
  583. package/presets/cursor/php-laravel/skills/debug-investigation/SKILL.md +15 -0
  584. package/presets/cursor/php-laravel/skills/feature-delivery/SKILL.md +30 -0
  585. package/presets/cursor/php-laravel/skills/integration-testing/SKILL.md +15 -0
  586. package/presets/cursor/php-laravel/skills/technical-retro/SKILL.md +54 -0
  587. package/presets/cursor/php-laravel/skills/unit-testing/SKILL.md +14 -0
  588. package/presets/cursor/php-laravel/skills/write-adr/SKILL.md +41 -0
  589. package/presets/cursor/php-laravel/team/README.md +28 -0
  590. package/presets/cursor/php-laravel/team/conventions.md +21 -0
  591. package/presets/cursor/php-laravel/team/fixtures/bugfix-standard.json +12 -0
  592. package/presets/cursor/php-laravel/team/fixtures/feature-full.json +15 -0
  593. package/presets/cursor/php-laravel/team/fixtures/feature-light.json +8 -0
@@ -52,6 +52,8 @@ if (!slug) {
52
52
  const taskDir = path.join(TEAM_ROOT, 'tasks', slug);
53
53
  const statusPath = path.join(taskDir, 'status.json');
54
54
  const pipelinePath = path.join(taskDir, 'pipeline.json');
55
+ const METRICS_PATH = path.join(taskDir, 'metrics.json');
56
+ const METRICS_LOCK = `${METRICS_PATH}.lock`;
55
57
 
56
58
  if (!fs.existsSync(statusPath)) {
57
59
  process.stdout.write('{}');
@@ -59,18 +61,190 @@ if (!fs.existsSync(statusPath)) {
59
61
  }
60
62
 
61
63
  let status;
64
+ const now = new Date().toISOString();
65
+ const STACK = 'mcp-ts';
66
+ const PLATFORM = 'cursor';
67
+
68
+ function waitForMetricsLock() {
69
+ for (let attempt = 0; attempt < 200; attempt += 1) {
70
+ try { fs.mkdirSync(METRICS_LOCK); return; } catch (error) {
71
+ if (error && error.code !== 'EEXIST') throw error;
72
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 10);
73
+ }
74
+ }
75
+ throw new Error('metrics lock timeout');
76
+ }
77
+ let taskLockHeld = false;
78
+ function releaseTaskLock() {
79
+ if (!taskLockHeld) return;
80
+ taskLockHeld = false;
81
+ try { fs.rmdirSync(METRICS_LOCK); } catch {}
82
+ }
83
+ waitForMetricsLock();
84
+ taskLockHeld = true;
85
+ process.on('exit', releaseTaskLock);
62
86
  try {
63
87
  status = JSON.parse(fs.readFileSync(statusPath, 'utf8'));
64
88
  } catch {
89
+ releaseTaskLock();
65
90
  process.stdout.write('{}');
66
91
  process.exit(0);
67
92
  }
93
+ function mutateMetrics(mutator) {
94
+ const acquiredHere = !taskLockHeld;
95
+ if (acquiredHere) waitForMetricsLock();
96
+ try {
97
+ let metrics;
98
+ try { metrics = JSON.parse(fs.readFileSync(METRICS_PATH, 'utf8')); } catch {
99
+ const runId = status.metricsRunId || `${slug}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
100
+ status.metricsRunId = runId;
101
+ metrics = { schemaVersion: 1, task: { runId, slug, preset: 'ai-rules', stack: STACK, platform: PLATFORM, intent: status.intent || 'unknown', profile: 'unknown' }, events: [] };
102
+ metrics.events.push({ eventId: `${runId}:task_started`, type: 'task_started', at: now, source: 'hook', attributionConfidence: 'high' });
103
+ }
104
+ mutator(metrics);
105
+ const temporary = `${METRICS_PATH}.${process.pid}.${Date.now()}.tmp`;
106
+ fs.writeFileSync(temporary, JSON.stringify(metrics, null, 2) + '\n');
107
+ fs.renameSync(temporary, METRICS_PATH);
108
+ } finally {
109
+ if (acquiredHere) { try { fs.rmdirSync(METRICS_LOCK); } catch {} }
110
+ }
111
+ }
112
+ function appendMetric(event) { mutateMetrics((metrics) => metrics.events.push({ eventId: `${metrics.task.runId}:${Date.now()}:${Math.random().toString(16).slice(2)}`, ...event })); }
113
+ function nextAttemptOrdinal(stepIndex, agent) {
114
+ try {
115
+ const metrics = JSON.parse(fs.readFileSync(METRICS_PATH, 'utf8'));
116
+ return metrics.events.reduce((highest, event) => event.type === 'attempt_started' && event.stepIndex === stepIndex && event.agent === agent ? Math.max(highest, Number(event.attempt) || 0) : highest, 0) + 1;
117
+ } catch { return 1; }
118
+ }
119
+ function roleFor(agent) {
120
+ if (/analyst|architect|router|migration/.test(agent || '')) return 'planning';
121
+ if (/verifier/.test(agent || '')) return 'validation';
122
+ if (/reviewer|auditor/.test(agent || '')) return 'review';
123
+ if (/test|qa/.test(agent || '')) return 'testing';
124
+ if (/writer/.test(agent || '')) return 'docs';
125
+ return 'implementation';
126
+ }
127
+ const DEFAULT_ARTIFACT_OUTPUT_IDS = {
128
+ 'task-router': 'routing',
129
+ 'task-analyst': 'analysis',
130
+ 'solution-architect': 'architecture',
131
+ 'migration-specialist': 'migration-plan',
132
+ debugger: 'debug',
133
+ 'ci-investigator': 'ci',
134
+ 'feature-developer': 'implementation',
135
+ 'build-verifier': 'validation',
136
+ 'code-reviewer': 'review',
137
+ 'security-reviewer': 'security-review',
138
+ 'accessibility-reviewer': 'a11y-review',
139
+ 'performance-auditor': 'perf-report',
140
+ 'api-contract-reviewer': 'api-contract-review',
141
+ 'tech-writer': 'documentation',
142
+ };
143
+ function artifactOutputIdFor(step, agent) {
144
+ if (step && typeof step.artifactOutputId === 'string') return step.artifactOutputId;
145
+ if (step?.artifactOutputIds && typeof step.artifactOutputIds[agent] === 'string') return step.artifactOutputIds[agent];
146
+ return DEFAULT_ARTIFACT_OUTPUT_IDS[agent] || agent;
147
+ }
148
+ function activateAttempts(step, stepIndex) {
149
+ const active = { ...(status.activeAttempts || {}) }; const agents = getStepAgents(step);
150
+ const parallelGroupId = step.parallel && agents.length > 1 ? `${status.metricsRunId || slug}:step-${stepIndex}` : null;
151
+ for (const agent of agents) {
152
+ const attempt = nextAttemptOrdinal(stepIndex, agent); const runId = status.metricsRunId || `${slug}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
153
+ status.metricsRunId = runId; const attemptId = `${runId}:step-${stepIndex}:${agent}:attempt-${attempt}`;
154
+ if (active[attemptId]) continue;
155
+ active[attemptId] = { agent, stepIndex, attempt, startedAt: now, parallelGroupId };
156
+ appendMetric({ type: 'attempt_started', at: now, attemptId, stepIndex, stepLabel: step.label || null, agent, role: roleFor(agent), attempt, parallelGroupId, source: 'hook', attributionConfidence: 'high' });
157
+ }
158
+ status.activeAttempts = active;
159
+ }
160
+ function resolvedAttempt() {
161
+ const active = status.activeAttempts || {}; const entries = Object.entries(active);
162
+ const stableAttemptId = hookInput.attemptId;
163
+ if (stableAttemptId) {
164
+ return active[stableAttemptId] ? { attemptId: stableAttemptId, entry: active[stableAttemptId], confidence: 'high' } : null;
165
+ }
166
+ if (entries.length === 1) return { attemptId: entries[0][0], entry: entries[0][1], confidence: 'high' };
167
+ try { const receipts = JSON.parse(fs.readFileSync(path.join(taskDir, '.metrics-receipts.json'), 'utf8')); const receipt = Array.isArray(receipts) ? receipts.find((item) => active[item.attemptId]) : null; if (receipt) return { attemptId: receipt.attemptId, entry: active[receipt.attemptId], confidence: 'fallback', source: 'agent' }; } catch {}
168
+ return null;
169
+ }
170
+ function readBoundReceiptOutcome(agent, step, resolved) {
171
+ if (!agent || !resolved) return { outcome: null, receiptRequired: false };
172
+ const manifestPath = path.join(taskDir, 'artifact-manifest.json');
173
+ if (!fs.existsSync(manifestPath)) return { outcome: null, receiptRequired: false };
174
+ try {
175
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
176
+ const artifacts = Array.isArray(manifest.artifacts) ? manifest.artifacts : [];
177
+ const expectedOutputId = artifactOutputIdFor(step, agent);
178
+ const attemptStartedAt = Date.parse(resolved.entry.startedAt);
179
+ const owned = artifacts
180
+ .filter((entry) => {
181
+ if (!entry || entry.producer !== agent || !entry.receipt || typeof entry.receipt.outcome !== 'string') return false;
182
+ const boundByAttempt = typeof entry.receipt.attemptId === 'string' && entry.receipt.attemptId === resolved.attemptId;
183
+ const boundByOutput = entry.receipt.attemptId == null && entry.id === expectedOutputId;
184
+ if (!boundByAttempt && !boundByOutput) return false;
185
+ const terminalAt = Date.parse(entry.timestamps?.completedAt || entry.timestamps?.updatedAt || '');
186
+ return Number.isFinite(terminalAt) && (!Number.isFinite(attemptStartedAt) || terminalAt >= attemptStartedAt);
187
+ })
188
+ .sort((a, b) => {
189
+ const ta = Date.parse(a.timestamps?.completedAt || a.timestamps?.updatedAt || 0) || 0;
190
+ const tb = Date.parse(b.timestamps?.completedAt || b.timestamps?.updatedAt || 0) || 0;
191
+ return tb - ta;
192
+ });
193
+ return { outcome: owned[0]?.receipt?.outcome || null, receiptRequired: true };
194
+ } catch {
195
+ return { outcome: null, receiptRequired: false };
196
+ }
197
+ }
198
+ function reconcileStatusFromManifest(agent, step, resolved) {
199
+ const terminal = new Set(['completed', 'blocked', 'changes_requested', 'validation_failed']);
200
+ const { outcome, receiptRequired } = readBoundReceiptOutcome(agent, step, resolved);
201
+ if (terminal.has(outcome)) {
202
+ status.state = outcome;
203
+ return outcome;
204
+ }
205
+ if (receiptRequired) {
206
+ status.state = 'awaiting_artifact_receipt';
207
+ status.phase = 'blocked';
208
+ return status.state;
209
+ }
210
+ if (terminal.has(status.state)) return status.state;
211
+ // Host reported subagent completed and no blocking receipt → treat as completed for metrics/advance.
212
+ if (hookInput.status === 'completed') {
213
+ status.state = 'completed';
214
+ return 'completed';
215
+ }
216
+ return status.state;
217
+ }
218
+
219
+ function finishActiveAttempt() {
220
+ const resolved = resolvedAttempt(); if (!resolved) return null;
221
+ const durationMs = Date.parse(now) - Date.parse(resolved.entry.startedAt);
222
+ const outcome = ['completed', 'blocked', 'changes_requested', 'validation_failed'].includes(status.state) ? status.state : 'unknown';
223
+ appendMetric({ type: 'attempt_finished', at: now, attemptId: resolved.attemptId, outcome, durationMs: Number.isFinite(durationMs) && durationMs >= 0 ? durationMs : null, retryAfterFix: status.retryAfterFix || null, source: resolved.source || 'hook', attributionConfidence: resolved.confidence });
224
+ const active = { ...(status.activeAttempts || {}) }; delete active[resolved.attemptId]; status.activeAttempts = active; status.lastCompletedAttempt = { attemptId: resolved.attemptId, completedAt: now }; return { ...resolved, outcome };
225
+ }
226
+ function beginHumanGate() { const eventId = `${status.metricsRunId || slug}:gate:${Date.now()}`; appendMetric({ eventId, type: 'human_gate_started', at: now, source: 'hook', attributionConfidence: 'high' }); status.activeHumanGateEventId = eventId; }
227
+ function endHumanGateIfResumed() {
228
+ if (!status.activeHumanGateEventId || status.awaitingHumanGate || status.state === 'awaiting_approval') return;
229
+ appendMetric({ type: 'human_gate_ended', at: now, gateStartedEventId: status.activeHumanGateEventId, source: 'hook', attributionConfidence: 'high' });
230
+ delete status.activeHumanGateEventId;
231
+ }
232
+ function completeTaskMetrics() { appendMetric({ type: 'task_completed', at: now, outcome: status.state === 'completed' ? 'completed' : 'unknown', source: 'hook', attributionConfidence: 'high' }); }
233
+ function recordSkippedStep(step, stepIndex) {
234
+ for (const agent of getStepAgents(step)) {
235
+ const runId = status.metricsRunId || `${slug}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
236
+ status.metricsRunId = runId;
237
+ const attempt = nextAttemptOrdinal(stepIndex, agent);
238
+ appendMetric({ type: 'attempt_skipped', at: now, attemptId: `${runId}:step-${stepIndex}:${agent}:attempt-${attempt}`, stepIndex, stepLabel: step.label || null, agent, role: roleFor(agent), attempt, outcome: 'skipped', source: 'hook', attributionConfidence: 'high' });
239
+ }
240
+ }
68
241
 
69
- const now = new Date().toISOString();
70
242
 
71
243
  function writeStatus(next) {
72
244
  status = { ...status, ...next, slug, updatedAt: now };
73
- fs.writeFileSync(statusPath, JSON.stringify(status, null, 2) + '\n');
245
+ const temporary = `${statusPath}.${process.pid}.${Date.now()}.tmp`;
246
+ fs.writeFileSync(temporary, JSON.stringify(status, null, 2) + '\n');
247
+ fs.renameSync(temporary, statusPath);
74
248
  }
75
249
 
76
250
  function out(message) {
@@ -108,9 +282,8 @@ function skipIfMatches(skipIf, dir) {
108
282
 
109
283
  function findNextExecutableStep(steps, startIdx, dir) {
110
284
  for (let i = startIdx; i < steps.length; i++) {
111
- if (!skipIfMatches(steps[i].skipIf, dir)) {
112
- return { step: steps[i], index: i };
113
- }
285
+ if (!skipIfMatches(steps[i].skipIf, dir)) return { step: steps[i], index: i };
286
+ recordSkippedStep(steps[i], i);
114
287
  }
115
288
  return null;
116
289
  }
@@ -118,19 +291,19 @@ function findNextExecutableStep(steps, startIdx, dir) {
118
291
  const AGENT_HANDOFF = {
119
292
  'task-analyst': (s) =>
120
293
  `Invoke task-analyst for slug "${s}". Write brief.md and decomposition.md under .cursor/team/tasks/${s}/. ` +
121
- `Set status.json: phase executing, state awaiting_approval if human gate applies. Do not use legacy phase analysis.`,
294
+ `Upsert the analysis receipt in artifact-manifest.json; do not mutate status.json lifecycle fields. Do not use legacy phase analysis.`,
122
295
  'solution-architect': (s) =>
123
- `Invoke solution-architect for slug "${s}". Read brief.md; write architecture.md for MCP tool/resource/prompt contracts and module boundaries. Update status.json when done.`,
296
+ `Invoke solution-architect for slug "${s}". Read brief.md; write architecture.md for MCP tool/resource/prompt contracts and module boundaries. Upsert the owned terminal receipt in artifact-manifest.json; do not mutate status.json lifecycle fields.`,
124
297
  'feature-developer': (s) =>
125
298
  `Invoke feature-developer for slug "${s}". Read brief.md, decomposition.md, validation-report.md, architecture.md, security-review.md, debug-report.md if present. ` +
126
299
  `Follow feature-delivery-workflow.mdc and reference-features.mdc. Mandatory flow: contract → schema → handler → registration → unit/contract verification → package validation. ` +
127
- `Include schema/handler unit tests before handoff. Update status.json when done.`,
300
+ `Include schema/handler unit tests before handoff. Upsert the owned terminal receipt in artifact-manifest.json; do not mutate status.json lifecycle fields.`,
128
301
  'build-verifier': (s) =>
129
302
  `Invoke build-verifier (readonly) for slug "${s}". Follow mcp-ts-tooling.mdc and post-change-test.mdc. ` +
130
303
  `Discover package manager; run typecheck + project tests — never Playwright/XCUITest/Next lint recipes/Go tools as required gates. ` +
131
- `For preset packaging: yarn check:preset-structure (mcp-ts STACKS + MCP_TS_FORBIDDEN_*). Write validation-report.md. Set state completed or validation_failed. Do not edit production code.`,
304
+ `For preset packaging: yarn check:preset-structure (mcp-ts STACKS + MCP_TS_FORBIDDEN_*). Write validation-report.md and emit receipt outcome completed or validation_failed. Do not edit production code.`,
132
305
  'security-reviewer': (s) =>
133
- `Invoke security-reviewer (readonly) for slug "${s}". Follow security-mcp.mdc and mcp-auth-secrets.mdc; write security-review.md. Update status.json when done.`,
306
+ `Invoke security-reviewer (readonly) for slug "${s}". Follow security-mcp.mdc and mcp-auth-secrets.mdc; write security-review.md. Upsert the owned terminal receipt in artifact-manifest.json; do not mutate status.json lifecycle fields.`,
134
307
  };
135
308
 
136
309
  const REVIEW_AGENTS = new Set([
@@ -138,16 +311,35 @@ const REVIEW_AGENTS = new Set([
138
311
  ]);
139
312
 
140
313
 
141
- function handoffForAgent(agent, scope) {
314
+ function metricsHandoff(agent) {
315
+ const matches = Object.entries(status.activeAttempts || {}).filter(([, entry]) => entry.agent === agent);
316
+ if (matches.length === 1) {
317
+ return ` Metrics attemptId: ${matches[0][0]}; write owned artifact-manifest receipt outcome. If the hook cannot identify a parallel stop, append a minimal { attemptId, outcome } receipt to .metrics-receipts.json; do not mutate status.json or calculate duration.`;
318
+ }
319
+ return ' Metrics: use the supplied attemptId when available; for a parallel completion, write a minimal { attemptId, outcome } receipt to .metrics-receipts.json rather than relying on currentAgent. Do not calculate duration.';
320
+ }
321
+
322
+ function artifactHandoff(step, agent) {
323
+ const inputIds = Array.isArray(step?.artifactInputIds) ? step.artifactInputIds.join(', ') : 'manifest defaults';
324
+ return ` Artifact inputs: ${inputIds}; owned output ID: ${artifactOutputIdFor(step, agent)}. Bind the terminal receipt to the supplied attemptId.`;
325
+ }
326
+
327
+ function handoffForAgent(agent, scope, step = null) {
142
328
  const fn = AGENT_HANDOFF[agent];
143
- return fn ? fn(slug, scope) : `Invoke ${agent} subagent for slug "${slug}". Update status.json when done.`;
329
+ const handoff = fn ? fn(slug, scope) : `Invoke ${agent} subagent for slug "${slug}". Upsert the owned terminal receipt in artifact-manifest.json; do not mutate status.json lifecycle fields.`;
330
+ return handoff + artifactHandoff(step, agent) + metricsHandoff(agent);
144
331
  }
145
332
 
146
333
  function handoffForParallelStep(step) {
147
334
  const agents = getStepAgents(step);
335
+ const attemptIds = Object.entries(status.activeAttempts || {})
336
+ .filter(([, entry]) => agents.includes(entry.agent))
337
+ .map(([attemptId, entry]) => `${entry.agent}=${attemptId}`);
148
338
  return (
149
339
  `Invoke IN PARALLEL (one message, multiple Task calls): ${agents.join(' AND ')} for slug "${slug}". ` +
150
- `Each agent writes its artifact and appends itself to status.json parallelCompleted when done.`
340
+ `Each agent writes its artifact and owned receipt; the hook records parallelCompleted from stops. Do not mutate status.json lifecycle fields. ` +
341
+ `Artifact inputs: ${Array.isArray(step.artifactInputIds) ? step.artifactInputIds.join(', ') : 'manifest defaults'}; owned output IDs: ${agents.map((agent) => `${agent}=${artifactOutputIdFor(step, agent)}`).join('; ')}. ` +
342
+ `Metrics attemptIds: ${attemptIds.join('; ')}. If the hook cannot identify a parallel stop, append a minimal { attemptId, outcome } receipt to .metrics-receipts.json; do not calculate duration.`
151
343
  );
152
344
  }
153
345
 
@@ -179,34 +371,42 @@ function legacyFlow() {
179
371
  out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
180
372
  process.exit(0);
181
373
  }
182
- if (status.state === 'changes_requested' && REVIEW_AGENTS.has(status.currentAgent)) {
374
+ function scheduleLegacyRetry(agent, retryAfterFix) {
375
+ const stepIndex = typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0;
376
+ const predecessorAttemptId = status.lastCompletedAttempt?.attemptId || null;
377
+ appendMetric({ type: 'retry_scheduled', at: now, attemptId: predecessorAttemptId, nextAgent: agent, retryAfterFix: retryAfterFix || null, source: 'hook', attributionConfidence: 'unknown' });
378
+ activateAttempts({ agent }, stepIndex);
379
+ }
380
+ if (status.state === 'changes_requested') {
381
+ const reviewer = status.currentAgent;
382
+ if (!reviewer) {
383
+ process.stdout.write('{}');
384
+ process.exit(0);
385
+ }
386
+ scheduleLegacyRetry('feature-developer', reviewer);
183
387
  writeStatus({
184
388
  currentAgent: 'feature-developer',
185
389
  state: 'in_progress',
186
390
  phase: 'executing',
187
- retryAfterFix: status.currentAgent,
391
+ retryAfterFix: reviewer,
188
392
  });
189
- out(
190
- handoffForAgent('feature-developer') +
191
- ` After fixes, re-run ${status.currentAgent}.`,
192
- );
393
+ out(handoffForAgent('feature-developer') + ` After fixes, re-run ${reviewer}.`);
193
394
  process.exit(0);
194
395
  }
195
396
  if (status.state === 'validation_failed' && status.currentAgent === 'build-verifier') {
397
+ scheduleLegacyRetry('feature-developer', 'build-verifier');
196
398
  writeStatus({
197
399
  currentAgent: 'feature-developer',
198
400
  state: 'in_progress',
199
401
  phase: 'executing',
200
402
  retryAfterFix: 'build-verifier',
201
403
  });
202
- out(
203
- handoffForAgent('feature-developer') +
204
- ` Read validation-report.md. After fixes, re-run build-verifier.`,
205
- );
404
+ out(handoffForAgent('feature-developer') + ' Read validation-report.md. After fixes, re-run build-verifier.');
206
405
  process.exit(0);
207
406
  }
208
407
  if (status.state === 'completed' && status.retryAfterFix) {
209
408
  const retry = status.retryAfterFix;
409
+ scheduleLegacyRetry(retry, null);
210
410
  writeStatus({ currentAgent: retry, state: 'in_progress', retryAfterFix: null });
211
411
  out(handoffForAgent(retry));
212
412
  process.exit(0);
@@ -220,6 +420,56 @@ function legacyFlow() {
220
420
  process.exit(0);
221
421
  }
222
422
 
423
+
424
+ if (hookInput.action === 'end_human_gate') {
425
+ status.awaitingHumanGate = false;
426
+ if (status.state === 'awaiting_approval') {
427
+ status.state = 'in_progress';
428
+ status.phase = status.phase === 'human_gate' ? 'executing' : status.phase;
429
+ }
430
+ if (status.activeHumanGateEventId) {
431
+ appendMetric({
432
+ type: 'human_gate_ended',
433
+ at: now,
434
+ gateStartedEventId: status.activeHumanGateEventId,
435
+ source: 'orchestrator',
436
+ attributionConfidence: 'high',
437
+ });
438
+ delete status.activeHumanGateEventId;
439
+ }
440
+ if (hookInput.activateNext && fs.existsSync(pipelinePath)) {
441
+ let resumePipeline = null;
442
+ try { resumePipeline = JSON.parse(fs.readFileSync(pipelinePath, 'utf8')); } catch {}
443
+ if (resumePipeline) {
444
+ const resumeSteps = resumePipeline.steps || [];
445
+ const resumeStart = (typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0) + 1;
446
+ const resumeNext = findNextExecutableStep(resumeSteps, resumeStart, taskDir);
447
+ if (resumeNext) {
448
+ const resumeAgents = getStepAgents(resumeNext.step);
449
+ activateAttempts(resumeNext.step, resumeNext.index);
450
+ writeStatus({
451
+ pipelineIndex: resumeNext.index,
452
+ currentAgent: resumeAgents[0],
453
+ phase: 'executing',
454
+ state: 'in_progress',
455
+ awaitingHumanGate: false,
456
+ parallelCompleted: [],
457
+ });
458
+ if (resumeNext.step.parallel && resumeAgents.length > 1) out(handoffForParallelStep(resumeNext.step));
459
+ else out(handoffForAgent(resumeAgents[0], resumeNext.step.scope, resumeNext.step));
460
+ process.exit(0);
461
+ }
462
+ }
463
+ }
464
+ writeStatus({
465
+ awaitingHumanGate: false,
466
+ state: status.state,
467
+ phase: status.phase,
468
+ });
469
+ process.stdout.write(JSON.stringify({ ok: true, action: 'end_human_gate', activeHumanGateEventId: status.activeHumanGateEventId || null }));
470
+ process.exit(0);
471
+ }
472
+
223
473
  if (!fs.existsSync(pipelinePath)) {
224
474
  legacyFlow();
225
475
  }
@@ -232,7 +482,30 @@ try {
232
482
  }
233
483
 
234
484
  const steps = pipeline.steps || [];
485
+ const initialIdx = typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0;
486
+ const initialStep = steps[initialIdx];
487
+ const activeAttemptCountBeforeFinish = Object.keys(status.activeAttempts || {}).length;
488
+ const completingAgentHint = (() => {
489
+ const resolved = resolvedAttempt();
490
+ if (resolved?.entry?.agent) return resolved.entry.agent;
491
+ if (status.currentAgent) return status.currentAgent;
492
+ return getStepAgents(initialStep)[0];
493
+ })();
494
+ const reconcilingAttempt = resolvedAttempt();
495
+ reconcileStatusFromManifest(completingAgentHint, initialStep, reconcilingAttempt);
496
+ if (status.state === 'awaiting_artifact_receipt') {
497
+ writeStatus({});
498
+ process.stdout.write('{}');
499
+ process.exit(0);
500
+ }
501
+ const finishedAttempt = finishActiveAttempt();
502
+ if (!finishedAttempt && (hookInput.attemptId || activeAttemptCountBeforeFinish > 0)) {
503
+ process.stdout.write('{}');
504
+ process.exit(0);
505
+ }
506
+ endHumanGateIfResumed();
235
507
  if (steps.length === 0 || pipeline.autoChain === false) {
508
+ writeStatus({});
236
509
  process.stdout.write('{}');
237
510
  process.exit(0);
238
511
  }
@@ -242,68 +515,135 @@ if (status.awaitingHumanGate || status.state === 'awaiting_approval') {
242
515
  process.exit(0);
243
516
  }
244
517
 
245
- if (status.state === 'changes_requested' && REVIEW_AGENTS.has(status.currentAgent)) {
246
- const reviewer = status.currentAgent;
518
+ function nearestPrecedingStepIndex(agent, fromIndex, fallback) {
519
+ for (let index = fromIndex - 1; index >= 0; index -= 1) {
520
+ if (getStepAgents(steps[index]).includes(agent)) return index;
521
+ }
522
+ const match = steps.findIndex((step) => getStepAgents(step).includes(agent));
523
+ return match >= 0 ? match : fallback;
524
+ }
525
+ function scheduleRetry(agent, retryAfterFix, predecessor, explicitStepIndex = null) {
526
+ const currentIndex = typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0;
527
+ const stepIndex = Number.isInteger(explicitStepIndex) ? explicitStepIndex : nearestPrecedingStepIndex(agent, currentIndex, currentIndex);
528
+ const predecessorAttemptId = predecessor?.attemptId || status.lastCompletedAttempt?.attemptId || null;
529
+ appendMetric({ type: 'retry_scheduled', at: now, attemptId: predecessorAttemptId, nextAgent: agent, retryAfterFix: retryAfterFix || null, source: 'hook', attributionConfidence: predecessor ? predecessor.confidence : 'unknown' });
530
+ activateAttempts(steps[stepIndex] || { agent }, stepIndex);
531
+ return stepIndex;
532
+ }
533
+
534
+ const idx = typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0;
535
+ const currentStep = steps[idx];
536
+ const completedAgent = finishedAttempt?.entry?.agent || status.currentAgent || getStepAgents(currentStep)[0];
537
+ const stepAgents = getStepAgents(currentStep);
538
+ if (currentStep?.parallel && stepAgents.length > 1) {
539
+ const done = [...(status.parallelCompleted || [])];
540
+ const outcomes = { ...(status.parallelOutcomes || {}) };
541
+ if (finishedAttempt && completedAgent) {
542
+ if (!done.includes(completedAgent)) done.push(completedAgent);
543
+ outcomes[completedAgent] = {
544
+ outcome: finishedAttempt.outcome || status.state,
545
+ attemptId: finishedAttempt.attemptId,
546
+ confidence: finishedAttempt.confidence,
547
+ };
548
+ }
549
+ writeStatus({ parallelCompleted: done, parallelOutcomes: outcomes });
550
+ const remaining = stepAgents.filter((agent) => !done.includes(agent));
551
+ if (remaining.length > 0) {
552
+ process.stdout.write('{}');
553
+ process.exit(0);
554
+ }
555
+
556
+ const blockedProducer = stepAgents.find((agent) => outcomes[agent]?.outcome === 'blocked');
557
+ if (blockedProducer) {
558
+ writeStatus({ parallelCompleted: [], parallelOutcomes: {}, state: 'blocked', phase: 'blocked', currentAgent: blockedProducer });
559
+ process.stdout.write('{}');
560
+ process.exit(0);
561
+ }
562
+
563
+ const retryReviewer = stepAgents.find((agent) => outcomes[agent]?.outcome === 'changes_requested');
564
+ if (retryReviewer) {
565
+ const retryAfterFixStepIndex = idx;
566
+ const predecessor = outcomes[retryReviewer]
567
+ ? {
568
+ attemptId: outcomes[retryReviewer].attemptId,
569
+ confidence: outcomes[retryReviewer].confidence,
570
+ }
571
+ : finishedAttempt;
572
+ const developerIndex = scheduleRetry('feature-developer', retryReviewer, predecessor);
573
+ writeStatus({
574
+ pipelineIndex: developerIndex,
575
+ currentAgent: 'feature-developer',
576
+ state: 'in_progress',
577
+ phase: 'executing',
578
+ retryAfterFix: retryReviewer,
579
+ retryAfterFixStepIndex,
580
+ parallelCompleted: [],
581
+ parallelOutcomes: {},
582
+ });
583
+ out(handoffForAgent('feature-developer', steps[developerIndex]?.scope, steps[developerIndex]) + ` After fixes, re-run ${retryReviewer}.`);
584
+ process.exit(0);
585
+ }
586
+
587
+ writeStatus({ parallelCompleted: [], parallelOutcomes: {}, state: 'completed' });
588
+ }
589
+
590
+ if (status.state === 'blocked') {
591
+ writeStatus({ state: 'blocked', phase: 'blocked', currentAgent: completedAgent });
592
+ process.stdout.write('{}');
593
+ process.exit(0);
594
+ }
595
+
596
+ if (status.state === 'changes_requested') {
597
+ const reviewer = status.currentAgent || finishedAttempt?.entry?.agent;
598
+ if (!reviewer) {
599
+ process.stdout.write('{}');
600
+ process.exit(0);
601
+ }
602
+ const retryAfterFixStepIndex = typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0;
603
+ const developerIndex = scheduleRetry('feature-developer', reviewer, finishedAttempt);
247
604
  writeStatus({
605
+ pipelineIndex: developerIndex,
248
606
  currentAgent: 'feature-developer',
249
607
  state: 'in_progress',
250
608
  phase: 'executing',
251
609
  retryAfterFix: reviewer,
610
+ retryAfterFixStepIndex,
252
611
  });
253
- out(
254
- handoffForAgent('feature-developer') +
255
- ` After fixes, re-run ${reviewer}.`,
256
- );
612
+ out(handoffForAgent('feature-developer', steps[developerIndex]?.scope, steps[developerIndex]) + ` After fixes, re-run ${reviewer}.`);
257
613
  process.exit(0);
258
614
  }
259
615
 
260
616
  if (status.state === 'validation_failed' && status.currentAgent === 'build-verifier') {
617
+ const retryAfterFixStepIndex = typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0;
618
+ const developerIndex = scheduleRetry('feature-developer', 'build-verifier', finishedAttempt);
261
619
  writeStatus({
620
+ pipelineIndex: developerIndex,
262
621
  currentAgent: 'feature-developer',
263
622
  state: 'in_progress',
264
623
  phase: 'executing',
265
624
  retryAfterFix: 'build-verifier',
625
+ retryAfterFixStepIndex,
266
626
  });
267
- out(
268
- handoffForAgent('feature-developer') +
269
- ` Read validation-report.md. After fixes, re-run build-verifier.`,
270
- );
627
+ out(handoffForAgent('feature-developer', steps[developerIndex]?.scope, steps[developerIndex]) + ' Read validation-report.md. After fixes, re-run build-verifier.');
271
628
  process.exit(0);
272
629
  }
273
630
 
274
631
  if (status.state === 'completed' && status.retryAfterFix) {
275
632
  const retry = status.retryAfterFix;
276
- writeStatus({ currentAgent: retry, state: 'in_progress', retryAfterFix: null });
277
- out(handoffForAgent(retry));
633
+ const retryIndex = scheduleRetry(retry, null, finishedAttempt, status.retryAfterFixStepIndex);
634
+ writeStatus({ pipelineIndex: retryIndex, currentAgent: retry, state: 'in_progress', retryAfterFix: null, retryAfterFixStepIndex: null });
635
+ out(handoffForAgent(retry, steps[retryIndex]?.scope, steps[retryIndex]));
278
636
  process.exit(0);
279
637
  }
280
638
 
281
- const idx = typeof status.pipelineIndex === 'number' ? status.pipelineIndex : 0;
282
- const currentStep = steps[idx];
283
639
  if (!currentStep) {
284
640
  writeStatus({ phase: 'done', state: 'completed', currentAgent: null });
285
641
  out(`Pipeline complete for "${slug}". Run /technical-retro ${slug}.`);
286
642
  process.exit(0);
287
643
  }
288
644
 
289
- const completedAgent = status.currentAgent || getStepAgents(currentStep)[0];
290
- const stepAgents = getStepAgents(currentStep);
291
-
292
- if (currentStep.parallel && stepAgents.length > 1) {
293
- const done = [...(status.parallelCompleted || [])];
294
- if (completedAgent && !done.includes(completedAgent)) {
295
- done.push(completedAgent);
296
- }
297
- writeStatus({ parallelCompleted: done });
298
- const remaining = stepAgents.filter((a) => !done.includes(a));
299
- if (remaining.length > 0) {
300
- process.stdout.write('{}');
301
- process.exit(0);
302
- }
303
- writeStatus({ parallelCompleted: [] });
304
- }
305
-
306
645
  if (hasGateAfterStep(currentStep, pipeline.humanGates)) {
646
+ beginHumanGate();
307
647
  writeStatus({
308
648
  awaitingHumanGate: true,
309
649
  state: 'awaiting_approval',
@@ -315,6 +655,7 @@ if (hasGateAfterStep(currentStep, pipeline.humanGates)) {
315
655
 
316
656
  const next = findNextExecutableStep(steps, idx + 1, taskDir);
317
657
  if (!next) {
658
+ completeTaskMetrics();
318
659
  writeStatus({
319
660
  pipelineIndex: steps.length,
320
661
  phase: 'done',
@@ -329,6 +670,7 @@ if (!next) {
329
670
  const { step: nextStep, index: nextIdx } = next;
330
671
  const nextAgents = getStepAgents(nextStep);
331
672
 
673
+ activateAttempts(nextStep, nextIdx);
332
674
  writeStatus({
333
675
  pipelineIndex: nextIdx,
334
676
  currentAgent: nextAgents[0],
@@ -341,6 +683,6 @@ writeStatus({
341
683
  if (nextStep.parallel && nextAgents.length > 1) {
342
684
  out(handoffForParallelStep(nextStep));
343
685
  } else {
344
- out(handoffForAgent(nextAgents[0], nextStep.scope));
686
+ out(handoffForAgent(nextAgents[0], nextStep.scope, nextStep));
345
687
  }
346
688
  NODE
@@ -50,3 +50,9 @@
50
50
  ## Catalog
51
51
 
52
52
  See Claude `rules/README.md` mapping table for the full Cursor→Claude stem list.
53
+
54
+ ## Metrics policy mapping
55
+
56
+ | Shared core | Runtime integration | Loading |
57
+ |-------------|---------------------|---------|
58
+ | `agent-team/agent-task-metrics.md` | `agent-team-orchestrator` + `hooks/chain-team-phases.sh` | requestable/on-demand; never session-start |