@bonesofspring/ai-rules 0.2.51 → 0.2.53

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 (376) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/README.md +27 -3
  3. package/bin/cli.js +565 -61
  4. package/bin/lib/ai-local-drift.js +55 -14
  5. package/bin/lib/engine-scripts.js +10 -0
  6. package/bin/lib/mcp/clients.js +168 -0
  7. package/bin/lib/mcp/credentials.js +298 -0
  8. package/bin/lib/mcp/doctor.js +394 -0
  9. package/bin/lib/mcp/prompt.js +115 -0
  10. package/bin/lib/mcp/registry.js +170 -0
  11. package/bin/lib/mcp/run.js +123 -0
  12. package/bin/lib/merged-config.js +45 -0
  13. package/bin/lib/seed-ai-local-team.js +23 -7
  14. package/bin/lib/tool-installs.js +27 -0
  15. package/bin/mavis-install.js +2 -0
  16. package/bin/opencode-install.js +2 -0
  17. package/docs/LOCAL-OVERLAY.md +1 -1
  18. package/docs/MCP-SETUP.md +62 -0
  19. package/docs/PRESET-CONTRIBUTION.md +14 -10
  20. package/docs/TEAM-DB.md +173 -0
  21. package/docs/openapi/team-db.v1.json +5085 -0
  22. package/mcp/gitlab.mjs +123 -0
  23. package/mcp/lib/envfile.mjs +126 -0
  24. package/mcp/lib/yandex.mjs +384 -0
  25. package/mcp/yandex-mcp-proxy.mjs +155 -0
  26. package/mcp/yandex-token-refresh.mjs +65 -0
  27. package/package.json +18 -1
  28. package/presets/_shared/ai-local/scripts/manifest.mjs +112 -3
  29. package/presets/_shared/ai-local/scripts/rule-improver.mjs +428 -91
  30. package/presets/_shared/ai-local/scripts/run.mjs +22 -4
  31. package/presets/_shared/ai-local/scripts/signals.mjs +4 -1
  32. package/presets/_shared/ai-local/scripts/team-db-api.mjs +1275 -0
  33. package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +1067 -0
  34. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +1301 -0
  35. package/presets/_shared/ai-local/scripts/team-db-project.mjs +1506 -0
  36. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +831 -0
  37. package/presets/_shared/ai-local/scripts/team-db.mjs +251 -0
  38. package/presets/_shared/core/meta/preset-pr-checklist.md +1 -1
  39. package/presets/_shared/core/quality/interactive-questions.md +8 -8
  40. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +109 -0
  41. package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -0
  42. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +109 -0
  43. package/presets/claude/android-kotlin/rules/tooling-and-review/interactive-questions.md +8 -8
  44. package/presets/claude/android-kotlin/rules/tooling-and-review/language-policy.md +1 -1
  45. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  46. package/presets/claude/android-kotlin/team/README.md +10 -0
  47. package/presets/claude/go/agents/code-reviewer.md +1 -0
  48. package/presets/claude/go/hooks/chain-team-phases.sh +109 -0
  49. package/presets/claude/go/rules/tooling-and-review/interactive-questions.md +8 -8
  50. package/presets/claude/go/rules/tooling-and-review/language-policy.md +1 -1
  51. package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  52. package/presets/claude/go/team/README.md +10 -0
  53. package/presets/claude/ios-swift/agents/code-reviewer.md +1 -0
  54. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +109 -0
  55. package/presets/claude/ios-swift/rules/tooling-and-review/interactive-questions.md +8 -8
  56. package/presets/claude/ios-swift/rules/tooling-and-review/language-policy.md +1 -1
  57. package/presets/claude/ios-swift/rules/tooling-and-review/post-change-build.md +1 -1
  58. package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  59. package/presets/claude/ios-swift/team/README.md +10 -0
  60. package/presets/claude/java/agents/code-reviewer.md +1 -0
  61. package/presets/claude/java/hooks/chain-team-phases.sh +109 -0
  62. package/presets/claude/java/rules/tooling-and-review/interactive-questions.md +8 -8
  63. package/presets/claude/java/rules/tooling-and-review/language-policy.md +1 -1
  64. package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  65. package/presets/claude/java/team/README.md +10 -0
  66. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +109 -0
  67. package/presets/claude/mcp-ts/rules/tooling-and-review/interactive-questions.md +8 -8
  68. package/presets/claude/mcp-ts/rules/tooling-and-review/language-policy.md +1 -1
  69. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  70. package/presets/claude/mcp-ts/team/README.md +10 -0
  71. package/presets/claude/next/MCP.md +7 -0
  72. package/presets/claude/next/README.md +1 -1
  73. package/presets/claude/next/REPO_AGENTS.md +1 -1
  74. package/presets/claude/next/agents/README.md +3 -3
  75. package/presets/claude/next/agents/build-verifier.md +9 -3
  76. package/presets/claude/next/agents/code-reviewer.md +2 -1
  77. package/presets/claude/next/agents/codebase-analyzer.md +1 -1
  78. package/presets/claude/next/agents/feature-developer.md +18 -8
  79. package/presets/claude/next/agents/openspec-author.md +1 -1
  80. package/presets/claude/next/agents/playwright-test-generator.md +22 -68
  81. package/presets/claude/next/agents/playwright-test-healer.md +27 -54
  82. package/presets/claude/next/agents/playwright-test-planner.md +18 -51
  83. package/presets/claude/next/agents/task-analyst.md +25 -9
  84. package/presets/claude/next/agents/task-router.md +1 -1
  85. package/presets/claude/next/agents/tech-writer.md +1 -1
  86. package/presets/claude/next/hooks/chain-team-phases.sh +109 -0
  87. package/presets/claude/next/mcp.json +3 -3
  88. package/presets/claude/next/rules/anti-hallucination/react-next-anti-hallucination.md +1 -1
  89. package/presets/claude/next/rules/architecture/layer-barrel-exports.md +1 -1
  90. package/presets/claude/next/rules/architecture/reference-features.md +1 -1
  91. package/presets/claude/next/rules/stack/navigation-router-ui.md +1 -1
  92. package/presets/claude/next/rules/stack/navigation-router.md +14 -0
  93. package/presets/claude/next/rules/stack/next-app-core.md +19 -17
  94. package/presets/claude/next/rules/stack/next-app-router.md +5 -17
  95. package/presets/claude/next/rules/stack/next-static-export.md +1 -1
  96. package/presets/claude/next/rules/tooling-and-review/interactive-questions.md +8 -8
  97. package/presets/claude/next/rules/tooling-and-review/language-policy.md +1 -1
  98. package/presets/claude/next/rules/tooling-and-review/post-change-lint.md +1 -1
  99. package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  100. package/presets/claude/next/rules/tooling-and-review/preset-token-budget.md +1 -1
  101. package/presets/claude/next/rules/tooling-and-review/security-next.md +28 -3
  102. package/presets/claude/next/rules/ui-and-accessibility/css-property-order.md +1 -1
  103. package/presets/claude/next/rules/ui-and-accessibility/design-tokens-binding.md +4 -4
  104. package/presets/claude/next/rules/ui-and-accessibility/forms-validation.md +2 -2
  105. package/presets/claude/next/team/README.md +21 -0
  106. package/presets/claude/next/team/fixtures/feature-with-figma-url.json +10 -0
  107. package/presets/claude/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
  108. package/presets/claude/next/team/fixtures/mockup-review-standalone.json +9 -0
  109. package/presets/claude/next/team/fixtures/ux-design-standalone.json +9 -0
  110. package/presets/claude/nuxt/agents/code-reviewer.md +1 -0
  111. package/presets/claude/nuxt/hooks/chain-team-phases.sh +109 -0
  112. package/presets/claude/nuxt/rules/architecture/layer-barrel-exports.md +1 -1
  113. package/presets/claude/nuxt/rules/stack/navigation-router-ui.md +1 -1
  114. package/presets/claude/nuxt/rules/tooling-and-review/interactive-questions.md +8 -8
  115. package/presets/claude/nuxt/rules/tooling-and-review/language-policy.md +1 -1
  116. package/presets/claude/nuxt/rules/tooling-and-review/post-change-lint.md +1 -1
  117. package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  118. package/presets/claude/nuxt/team/README.md +10 -0
  119. package/presets/claude/php-hexagonal/agents/code-reviewer.md +1 -0
  120. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +109 -0
  121. package/presets/claude/php-hexagonal/rules/tooling-and-review/interactive-questions.md +8 -8
  122. package/presets/claude/php-hexagonal/rules/tooling-and-review/language-policy.md +1 -1
  123. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  124. package/presets/claude/php-hexagonal/team/README.md +10 -0
  125. package/presets/claude/php-laravel/agents/code-reviewer.md +1 -0
  126. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +109 -0
  127. package/presets/claude/php-laravel/rules/tooling-and-review/interactive-questions.md +8 -8
  128. package/presets/claude/php-laravel/rules/tooling-and-review/language-policy.md +1 -1
  129. package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  130. package/presets/claude/php-laravel/team/README.md +10 -0
  131. package/presets/claude/svelte/agents/code-reviewer.md +1 -0
  132. package/presets/claude/svelte/hooks/chain-team-phases.sh +109 -0
  133. package/presets/claude/svelte/rules/architecture/layer-barrel-exports.md +1 -1
  134. package/presets/claude/svelte/rules/tooling-and-review/interactive-questions.md +8 -8
  135. package/presets/claude/svelte/rules/tooling-and-review/language-policy.md +1 -1
  136. package/presets/claude/svelte/rules/tooling-and-review/post-change-lint.md +1 -1
  137. package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +1 -1
  138. package/presets/claude/svelte/team/README.md +10 -0
  139. package/presets/cursor/android-kotlin/agents/code-reviewer.md +1 -0
  140. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +109 -0
  141. package/presets/cursor/android-kotlin/rules/README.md +1 -0
  142. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +3 -3
  143. package/presets/cursor/android-kotlin/rules/interactive-questions.mdc +8 -8
  144. package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +1 -1
  145. package/presets/cursor/android-kotlin/team/README.md +10 -0
  146. package/presets/cursor/go/agents/code-reviewer.md +1 -0
  147. package/presets/cursor/go/hooks/chain-team-phases.sh +109 -0
  148. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +2 -2
  149. package/presets/cursor/go/rules/interactive-questions.mdc +8 -8
  150. package/presets/cursor/go/rules/preset-pr-checklist.mdc +1 -1
  151. package/presets/cursor/go/team/README.md +10 -0
  152. package/presets/cursor/ios-swift/agents/code-reviewer.md +1 -0
  153. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +109 -0
  154. package/presets/cursor/ios-swift/rules/README.md +1 -0
  155. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +3 -3
  156. package/presets/cursor/ios-swift/rules/interactive-questions.mdc +8 -8
  157. package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +1 -1
  158. package/presets/cursor/ios-swift/team/README.md +10 -0
  159. package/presets/cursor/java/agents/code-reviewer.md +1 -0
  160. package/presets/cursor/java/hooks/chain-team-phases.sh +109 -0
  161. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +2 -2
  162. package/presets/cursor/java/rules/interactive-questions.mdc +8 -8
  163. package/presets/cursor/java/rules/preset-pr-checklist.mdc +1 -1
  164. package/presets/cursor/java/team/README.md +10 -0
  165. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +109 -0
  166. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +2 -2
  167. package/presets/cursor/mcp-ts/rules/interactive-questions.mdc +8 -8
  168. package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +1 -1
  169. package/presets/cursor/mcp-ts/team/README.md +10 -0
  170. package/presets/cursor/next/MCP.md +14 -0
  171. package/presets/cursor/next/REPO_AGENTS.md +1 -1
  172. package/presets/cursor/next/agents/code-reviewer.md +1 -0
  173. package/presets/cursor/next/agents/playwright-test-healer.md +1 -0
  174. package/presets/cursor/next/ai-local/rules-library/router-pages.md +5 -5
  175. package/presets/cursor/next/hooks/chain-team-phases.sh +109 -0
  176. package/presets/cursor/next/mcp.json +3 -3
  177. package/presets/cursor/next/rules/README.md +1 -1
  178. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
  179. package/presets/cursor/next/rules/css-property-order-stylelint.mdc +1 -1
  180. package/presets/cursor/next/rules/design-tokens-binding.mdc +4 -4
  181. package/presets/cursor/next/rules/forms-validation.mdc +2 -2
  182. package/presets/cursor/next/rules/interactive-questions.mdc +8 -8
  183. package/presets/cursor/next/rules/navigation-router-stack.mdc +14 -1
  184. package/presets/cursor/next/rules/next-app-core.mdc +19 -17
  185. package/presets/cursor/next/rules/next-app-router.mdc +5 -17
  186. package/presets/cursor/next/rules/next-static-export.mdc +1 -1
  187. package/presets/cursor/next/rules/preset-pr-checklist.mdc +1 -1
  188. package/presets/cursor/next/rules/preset-token-budget.mdc +1 -1
  189. package/presets/cursor/next/rules/react-next-anti-hallucination.mdc +1 -1
  190. package/presets/cursor/next/rules/reference-features.mdc +1 -1
  191. package/presets/cursor/next/rules/security-next.mdc +28 -3
  192. package/presets/cursor/next/team/README.md +21 -0
  193. package/presets/cursor/next/team/fixtures/feature-with-figma-url.json +10 -0
  194. package/presets/cursor/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
  195. package/presets/cursor/next/team/fixtures/mockup-review-standalone.json +9 -0
  196. package/presets/cursor/next/team/fixtures/ux-design-standalone.json +9 -0
  197. package/presets/cursor/nuxt/agents/code-reviewer.md +1 -0
  198. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +109 -0
  199. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
  200. package/presets/cursor/nuxt/rules/interactive-questions.mdc +8 -8
  201. package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +1 -1
  202. package/presets/cursor/nuxt/team/README.md +10 -0
  203. package/presets/cursor/php-hexagonal/agents/code-reviewer.md +1 -0
  204. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +109 -0
  205. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +2 -2
  206. package/presets/cursor/php-hexagonal/rules/interactive-questions.mdc +8 -8
  207. package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +1 -1
  208. package/presets/cursor/php-hexagonal/team/README.md +10 -0
  209. package/presets/cursor/php-laravel/agents/code-reviewer.md +1 -0
  210. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +109 -0
  211. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +2 -2
  212. package/presets/cursor/php-laravel/rules/interactive-questions.mdc +8 -8
  213. package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +1 -1
  214. package/presets/cursor/php-laravel/team/README.md +10 -0
  215. package/presets/cursor/svelte/agents/code-reviewer.md +1 -0
  216. package/presets/cursor/svelte/hooks/chain-team-phases.sh +109 -0
  217. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
  218. package/presets/cursor/svelte/rules/interactive-questions.mdc +8 -8
  219. package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +1 -1
  220. package/presets/cursor/svelte/team/README.md +10 -0
  221. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  222. package/presets/mavis/android-kotlin/agents/code-reviewer.md +1 -0
  223. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +109 -0
  224. package/presets/mavis/android-kotlin/rules/interactive-questions.md +8 -8
  225. package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +1 -1
  226. package/presets/mavis/android-kotlin/team/README.md +10 -0
  227. package/presets/mavis/go/adapter-map.json +1 -1
  228. package/presets/mavis/go/agents/code-reviewer.md +1 -0
  229. package/presets/mavis/go/hooks/chain-team-phases.sh +109 -0
  230. package/presets/mavis/go/rules/interactive-questions.md +8 -8
  231. package/presets/mavis/go/rules/preset-pr-checklist.md +1 -1
  232. package/presets/mavis/go/team/README.md +10 -0
  233. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  234. package/presets/mavis/ios-swift/agents/code-reviewer.md +1 -0
  235. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +109 -0
  236. package/presets/mavis/ios-swift/rules/interactive-questions.md +8 -8
  237. package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +1 -1
  238. package/presets/mavis/ios-swift/team/README.md +10 -0
  239. package/presets/mavis/java/adapter-map.json +1 -1
  240. package/presets/mavis/java/agents/code-reviewer.md +1 -0
  241. package/presets/mavis/java/hooks/chain-team-phases.sh +109 -0
  242. package/presets/mavis/java/rules/interactive-questions.md +8 -8
  243. package/presets/mavis/java/rules/preset-pr-checklist.md +1 -1
  244. package/presets/mavis/java/team/README.md +10 -0
  245. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  246. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +109 -0
  247. package/presets/mavis/mcp-ts/rules/interactive-questions.md +8 -8
  248. package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +1 -1
  249. package/presets/mavis/mcp-ts/team/README.md +10 -0
  250. package/presets/mavis/next/MCP.md +14 -0
  251. package/presets/mavis/next/REPO_AGENTS.md +1 -1
  252. package/presets/mavis/next/adapter-map.json +1 -1
  253. package/presets/mavis/next/agents/code-reviewer.md +1 -0
  254. package/presets/mavis/next/agents/playwright-test-healer.md +1 -0
  255. package/presets/mavis/next/ai-local/rules-library/router-pages.md +5 -5
  256. package/presets/mavis/next/hooks/chain-team-phases.sh +109 -0
  257. package/presets/mavis/next/mcp.json +3 -3
  258. package/presets/mavis/next/rules/css-property-order-stylelint.md +1 -1
  259. package/presets/mavis/next/rules/design-tokens-binding.md +4 -4
  260. package/presets/mavis/next/rules/forms-validation.md +2 -2
  261. package/presets/mavis/next/rules/interactive-questions.md +8 -8
  262. package/presets/mavis/next/rules/navigation-router-stack.md +12 -0
  263. package/presets/mavis/next/rules/next-app-core.md +18 -17
  264. package/presets/mavis/next/rules/next-app-router.md +4 -17
  265. package/presets/mavis/next/rules/next-static-export.md +1 -1
  266. package/presets/mavis/next/rules/preset-pr-checklist.md +1 -1
  267. package/presets/mavis/next/rules/react-next-anti-hallucination.md +1 -1
  268. package/presets/mavis/next/rules/reference-features.md +1 -1
  269. package/presets/mavis/next/rules/security-next.md +24 -3
  270. package/presets/mavis/next/team/README.md +21 -0
  271. package/presets/mavis/next/team/fixtures/feature-with-figma-url.json +10 -0
  272. package/presets/mavis/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
  273. package/presets/mavis/next/team/fixtures/mockup-review-standalone.json +9 -0
  274. package/presets/mavis/next/team/fixtures/ux-design-standalone.json +9 -0
  275. package/presets/mavis/nuxt/adapter-map.json +1 -1
  276. package/presets/mavis/nuxt/agents/code-reviewer.md +1 -0
  277. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +109 -0
  278. package/presets/mavis/nuxt/rules/interactive-questions.md +8 -8
  279. package/presets/mavis/nuxt/rules/preset-pr-checklist.md +1 -1
  280. package/presets/mavis/nuxt/team/README.md +10 -0
  281. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  282. package/presets/mavis/php-hexagonal/agents/code-reviewer.md +1 -0
  283. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +109 -0
  284. package/presets/mavis/php-hexagonal/rules/interactive-questions.md +8 -8
  285. package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +1 -1
  286. package/presets/mavis/php-hexagonal/team/README.md +10 -0
  287. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  288. package/presets/mavis/php-laravel/agents/code-reviewer.md +1 -0
  289. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +109 -0
  290. package/presets/mavis/php-laravel/rules/interactive-questions.md +8 -8
  291. package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +1 -1
  292. package/presets/mavis/php-laravel/team/README.md +10 -0
  293. package/presets/mavis/svelte/adapter-map.json +1 -1
  294. package/presets/mavis/svelte/agents/code-reviewer.md +1 -0
  295. package/presets/mavis/svelte/hooks/chain-team-phases.sh +109 -0
  296. package/presets/mavis/svelte/rules/interactive-questions.md +8 -8
  297. package/presets/mavis/svelte/rules/preset-pr-checklist.md +1 -1
  298. package/presets/mavis/svelte/team/README.md +10 -0
  299. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  300. package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -0
  301. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +109 -0
  302. package/presets/opencode/android-kotlin/rules/interactive-questions.md +8 -8
  303. package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +1 -1
  304. package/presets/opencode/android-kotlin/team/README.md +10 -0
  305. package/presets/opencode/go/adapter-map.json +1 -1
  306. package/presets/opencode/go/agents/code-reviewer.md +1 -0
  307. package/presets/opencode/go/hooks/chain-team-phases.sh +109 -0
  308. package/presets/opencode/go/rules/interactive-questions.md +8 -8
  309. package/presets/opencode/go/rules/preset-pr-checklist.md +1 -1
  310. package/presets/opencode/go/team/README.md +10 -0
  311. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  312. package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -0
  313. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +109 -0
  314. package/presets/opencode/ios-swift/rules/interactive-questions.md +8 -8
  315. package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +1 -1
  316. package/presets/opencode/ios-swift/team/README.md +10 -0
  317. package/presets/opencode/java/adapter-map.json +1 -1
  318. package/presets/opencode/java/agents/code-reviewer.md +1 -0
  319. package/presets/opencode/java/hooks/chain-team-phases.sh +109 -0
  320. package/presets/opencode/java/rules/interactive-questions.md +8 -8
  321. package/presets/opencode/java/rules/preset-pr-checklist.md +1 -1
  322. package/presets/opencode/java/team/README.md +10 -0
  323. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  324. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +109 -0
  325. package/presets/opencode/mcp-ts/rules/interactive-questions.md +8 -8
  326. package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +1 -1
  327. package/presets/opencode/mcp-ts/team/README.md +10 -0
  328. package/presets/opencode/next/MCP.md +14 -0
  329. package/presets/opencode/next/REPO_AGENTS.md +1 -1
  330. package/presets/opencode/next/adapter-map.json +1 -1
  331. package/presets/opencode/next/agents/code-reviewer.md +1 -0
  332. package/presets/opencode/next/agents/playwright-test-healer.md +1 -0
  333. package/presets/opencode/next/ai-local/rules-library/router-pages.md +5 -5
  334. package/presets/opencode/next/hooks/chain-team-phases.sh +109 -0
  335. package/presets/opencode/next/opencode.json +3 -3
  336. package/presets/opencode/next/rules/css-property-order-stylelint.md +1 -1
  337. package/presets/opencode/next/rules/design-tokens-binding.md +4 -4
  338. package/presets/opencode/next/rules/forms-validation.md +2 -2
  339. package/presets/opencode/next/rules/interactive-questions.md +8 -8
  340. package/presets/opencode/next/rules/navigation-router-stack.md +12 -0
  341. package/presets/opencode/next/rules/next-app-core.md +18 -17
  342. package/presets/opencode/next/rules/next-app-router.md +4 -17
  343. package/presets/opencode/next/rules/next-static-export.md +1 -1
  344. package/presets/opencode/next/rules/preset-pr-checklist.md +1 -1
  345. package/presets/opencode/next/rules/react-next-anti-hallucination.md +1 -1
  346. package/presets/opencode/next/rules/reference-features.md +1 -1
  347. package/presets/opencode/next/rules/security-next.md +24 -3
  348. package/presets/opencode/next/team/README.md +21 -0
  349. package/presets/opencode/next/team/fixtures/feature-with-figma-url.json +10 -0
  350. package/presets/opencode/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
  351. package/presets/opencode/next/team/fixtures/mockup-review-standalone.json +9 -0
  352. package/presets/opencode/next/team/fixtures/ux-design-standalone.json +9 -0
  353. package/presets/opencode/nuxt/adapter-map.json +1 -1
  354. package/presets/opencode/nuxt/agents/code-reviewer.md +1 -0
  355. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +109 -0
  356. package/presets/opencode/nuxt/rules/interactive-questions.md +8 -8
  357. package/presets/opencode/nuxt/rules/preset-pr-checklist.md +1 -1
  358. package/presets/opencode/nuxt/team/README.md +10 -0
  359. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  360. package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -0
  361. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +109 -0
  362. package/presets/opencode/php-hexagonal/rules/interactive-questions.md +8 -8
  363. package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +1 -1
  364. package/presets/opencode/php-hexagonal/team/README.md +10 -0
  365. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  366. package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -0
  367. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +109 -0
  368. package/presets/opencode/php-laravel/rules/interactive-questions.md +8 -8
  369. package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +1 -1
  370. package/presets/opencode/php-laravel/team/README.md +10 -0
  371. package/presets/opencode/svelte/adapter-map.json +1 -1
  372. package/presets/opencode/svelte/agents/code-reviewer.md +1 -0
  373. package/presets/opencode/svelte/hooks/chain-team-phases.sh +109 -0
  374. package/presets/opencode/svelte/rules/interactive-questions.md +8 -8
  375. package/presets/opencode/svelte/rules/preset-pr-checklist.md +1 -1
  376. package/presets/opencode/svelte/team/README.md +10 -0
@@ -2560,6 +2560,115 @@ if (!input || input.status !== 'completed') {
2560
2560
  process.exit(0);
2561
2561
  }
2562
2562
 
2563
+ // --- TEAM_DB_PROJECTION -------------------------------------------------------
2564
+ // The status, metrics, compaction and focus writes are already durable when this
2565
+ // postflight starts. The projection is a bounded child process: it must never
2566
+ // fail this stop, never change hook stdout/stderr beyond the capability line,
2567
+ // and never write a task file. A disabled switch, a missing script, or a
2568
+ // runtime without `node:sqlite` is a skip; a child failure is one log line.
2569
+ // This is a plain region marker, not a `hook-slot`: the block is identical in
2570
+ // all 40 rendered bodies and needs no per-stack fragment.
2571
+ // <<<team-db-projection>>>
2572
+ function teamDbTruthy(value) {
2573
+ if (typeof value !== 'string') return false;
2574
+ const normalized = value.trim().toLowerCase();
2575
+ return normalized === '1' || normalized === 'true' || normalized === 'yes';
2576
+ }
2577
+
2578
+ function teamDbLogPath(env) {
2579
+ const override = typeof env.AI_RULES_TEAM_DB_LOG === 'string' ? env.AI_RULES_TEAM_DB_LOG.trim() : '';
2580
+ if (override) return path.resolve(override);
2581
+ return path.join(process.cwd(), '.ai.local', 'team', 'team-db-errors.log');
2582
+ }
2583
+
2584
+ function teamDbLogPhase(env) {
2585
+ const value = typeof env.AI_RULES_TEAM_DB_SEAM === 'string' ? env.AI_RULES_TEAM_DB_SEAM.trim() : '';
2586
+ return value === 'hook' || value === 'receipt' || value === 'cli' || value === 'serve' ? value : 'hook';
2587
+ }
2588
+
2589
+ // One line per failure, newest 200 lines and at most 64 KiB. Never a prompt
2590
+ // body: only the code and the message this block owns.
2591
+ function teamDbLogFailure(env, code, message) {
2592
+ try {
2593
+ const target = teamDbLogPath(env);
2594
+ fs.mkdirSync(path.dirname(target), { recursive: true });
2595
+ const line = new Date().toISOString() + ' ' + code + ' ' + teamDbLogPhase(env) + ' ' + message;
2596
+ fs.appendFileSync(target, line + '\n');
2597
+ let content = fs.readFileSync(target, 'utf8');
2598
+ let lines = content.split('\n').filter(function (entry) { return entry.length > 0; });
2599
+ if (lines.length > 200) lines = lines.slice(lines.length - 200);
2600
+ while (Buffer.byteLength(lines.join('\n') + '\n', 'utf8') > 65536 && lines.length > 1) lines.shift();
2601
+ content = lines.join('\n') + (lines.length > 0 ? '\n' : '');
2602
+ fs.writeFileSync(target, content);
2603
+ } catch (error) {
2604
+ /* a log failure is not a stop failure */
2605
+ }
2606
+ }
2607
+
2608
+ function teamDbSqliteAvailable(env) {
2609
+ if (teamDbTruthy(env.AI_RULES_TEAM_DB_FORCE_FALLBACK)) return false;
2610
+ const match = /^(\d+)\.(\d+)\.(\d+)/.exec(String(process.versions.node || ''));
2611
+ if (!match) return false;
2612
+ const major = Number(match[1]);
2613
+ const minor = Number(match[2]);
2614
+ if (major < 22) return false;
2615
+ if (major === 22 && minor < 13) return false;
2616
+ try {
2617
+ const sqlite = require('node:sqlite');
2618
+ return typeof sqlite.DatabaseSync === 'function';
2619
+ } catch (error) {
2620
+ return false;
2621
+ }
2622
+ }
2623
+
2624
+ function teamDbProject() {
2625
+ try {
2626
+ const env = process.env;
2627
+ if (teamDbTruthy(env.AI_RULES_TEAM_DB_DISABLE)) return;
2628
+ // Same pattern as POSTFLIGHT_SLUG_RE above: the slug is re-derived from
2629
+ // `active-task.json` on this path too, so it cannot escape the tree.
2630
+ const slugPattern = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
2631
+ let slug = '';
2632
+ try {
2633
+ const active = JSON.parse(fs.readFileSync(path.join(process.cwd(), '.ai.local', 'team', 'active-task.json'), 'utf8'));
2634
+ slug = typeof active.slug === 'string' ? active.slug : '';
2635
+ } catch (error) {
2636
+ return;
2637
+ }
2638
+ if (!slug || slug.length > 48 || !slugPattern.test(slug)) return;
2639
+ const taskDir = path.join(process.cwd(), '.ai.local', 'team', 'tasks', slug);
2640
+ if (!fs.existsSync(path.join(taskDir, 'status.json'))) return;
2641
+ const script = path.join(process.cwd(), '.ai.local', 'scripts', 'team-db.mjs');
2642
+ if (!fs.existsSync(script)) return;
2643
+ if (!teamDbSqliteAvailable(env)) {
2644
+ process.stderr.write('team-db: projection skipped (node:sqlite unavailable); file-only mode\n');
2645
+ return;
2646
+ }
2647
+ const result = spawnSync(
2648
+ process.execPath,
2649
+ ['.ai.local/scripts/team-db.mjs', 'sync', '--slug', slug, '--quiet', '--no-rebuild', '--deadline-ms', '4500'],
2650
+ { cwd: process.cwd(), env: env, encoding: 'utf8', timeout: 5000, killSignal: 'SIGKILL', stdio: ['ignore', 'pipe', 'pipe'] },
2651
+ );
2652
+ if (result.error && result.error.code === 'ETIMEDOUT') {
2653
+ teamDbLogFailure(env, 'E_PROJECTION_TIMEOUT', 'projection exceeded 5000 ms and was killed');
2654
+ return;
2655
+ }
2656
+ if (result.error) {
2657
+ teamDbLogFailure(env, 'E_PROJECTION_FAILED', 'projection could not start: ' + String(result.error.code || 'unknown'));
2658
+ return;
2659
+ }
2660
+ if (typeof result.status === 'number' && result.status !== 0) {
2661
+ teamDbLogFailure(env, 'E_PROJECTION_FAILED', 'projection exited ' + result.status);
2662
+ }
2663
+ } catch (error) {
2664
+ /* the seam never fails the stop */
2665
+ }
2666
+ }
2667
+
2668
+ teamDbProject();
2669
+ // <<<team-db-projection-end>>>
2670
+ // --- end TEAM_DB_PROJECTION ---------------------------------------------------
2671
+
2563
2672
  // Ratchet: off for `light` pipelines and `spike` intents. A policy skip is
2564
2673
  // silent on purpose — a warning on every light receipt would make the
2565
2674
  // containment warnings below unreadable.
@@ -7,7 +7,7 @@ paths: []
7
7
 
8
8
  # Interactive questions (requestable)
9
9
 
10
- How to put a user-only decision to the user. Load when the answer blocks the work and the host offers an interactive question tool (OpenCode `question`, Claude Code `AskUserQuestion`, a client dialog). The always-on quality rule keeps the short preference; this file carries the full contract.
10
+ How to put a user-only decision to the user. Load when the answer blocks the work and the host offers an interactive question tool. The always-on quality rule keeps the short preference; this file carries the full contract.
11
11
 
12
12
  ## When to ask
13
13
 
@@ -17,16 +17,16 @@ How to put a user-only decision to the user. Load when the answer blocks the wor
17
17
 
18
18
  ## Widget format
19
19
 
20
- 4. **Header** → a short label (≤30 characters).
21
- 5. **Option label** → 1–5 words, in the user's terms.
20
+ 4. **Header** → a short label. Stay inside the host schema's length limit.
21
+ 5. **Option label** → a few words, in the user's terms, inside the host schema's label limit.
22
22
  6. **Option description** → the consequence or the trade-off, not a restatement of the label.
23
- 7. **Two to five options.** Put the option you recommend first and justify it in its description; do not pad the list with options you cannot defend.
24
- 8. **Multi-select** only when the choices are not mutually exclusive. The host's own free-form entry does not count toward the range.
23
+ 7. **Option count** → the host schema's range. Put the option you recommend first and justify it in its description; do not pad the list with options you cannot defend.
24
+ 8. **Multi-select** only when the choices are not mutually exclusive. A free-form entry the host adds itself does not count toward the range.
25
25
 
26
- ## The free-form answer is mandatory, the option is not
26
+ ## Free-form is a property of the host
27
27
 
28
- 9. OpenCode `question` and Claude Code `AskUserQuestion` append their own free-form entry for single and multi select. Never add an “other” option there: option values are labels, so a chosen “Other” returns that word, not the user’s text.
29
- 10. A host without that entry (a custom `dialog.select`, an MCP elicitation `enum`, a headless run) needs an explicit “Other” whose selection opens a text prompt — or prose when the answer cannot be enumerated.
28
+ 9. Use the host's free-form channel. When that channel already accepts typed text, do not add an option labeled "Other": a plain option returns its label, and the typed text belongs in the host's free-form field.
29
+ 10. A host with no free-form channel (an enum that returns only the selected label, a headless run) needs an explicit "Other" whose selection opens a text prompt — or prose when the answer cannot be enumerated.
30
30
 
31
31
  ## Fallback
32
32
 
@@ -3,7 +3,7 @@ description: "Native-language dialogue policy: development/reasoning/artifacts s
3
3
  paths:
4
4
  - .ai.local/**/*
5
5
  - AGENTS.md
6
- - .cursor/**/*
6
+ - .claude/**/*
7
7
  ---
8
8
 
9
9
  <!-- shared-core: agent-team/language-policy.md -->
@@ -35,7 +35,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
35
35
  - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
36
36
  - [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
37
37
  - [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
38
- - [ ] **Rule eval (soft):** `node packages/ai-rules/scripts/check-rule-eval.mjs` when rule bodies changed
38
+ - [ ] **Rule eval (hard):** `node packages/ai-rules/scripts/check-rule-eval.mjs` runs inside `yarn check:preset-structure`; keep every registered golden stem paired
39
39
  - [ ] **Anti-hallucination:** `check-anti-hallucination-coverage.mjs` is green inside `yarn check:preset-structure`. Every role loads `anti-hallucination-contract`. Writer roles, including `code-reviewer`, also load `STACK_FLOOR_STEMS`. Register a new skill family in `SKILL_CONTRACT_CLASS` (`writer` or `reader`) or the gate FAILs.
40
40
  - [ ] **Gate:** `yarn check:preset-structure` from `packages/ai-rules/` (twin-map, token-budget, leakage, drift, i18n, local overlay, anti-hallucination coverage)
41
41
 
@@ -90,6 +90,16 @@ printf '%s\n' '{"status":"completed","action":"end_human_gate","activateNext":tr
90
90
 
91
91
  Same JSON on Claude, Mavis, or OpenCode: `bash .<tool>/hooks/chain-team-phases.sh`.
92
92
 
93
+ ## Database projection
94
+
95
+ `team-db.mjs` projects this tree into `.ai.local/team/team.db` (SQLite, WAL). The files remain authoritative: the database is rebuildable and git-ignored (`team.db`, `team.db-wal`, `team.db-shm`, `team-db-errors.log`).
96
+
97
+ - Write points: the chain hook after its file writes, and `manifest.mjs` after a receipt. Both run one bounded 5 s child; a failure logs one line and never fails the file write.
98
+ - No agent writes lifecycle fields through the database. `status.json` / `metrics.json` stay hook-owned.
99
+ - `AI_RULES_TEAM_DB_DISABLE=1` stops every write point and `serve`; a runtime without `node:sqlite` stays file-only with exit 0.
100
+ - Inspect: `node .ai.local/scripts/team-db.mjs sync`, then `check`; `serve` opens the read-only dashboard at `http://127.0.0.1:4178`.
101
+ - Never commit the database. Delete `team.db*` and run `sync` to rebuild.
102
+
93
103
  ## Contracts
94
104
 
95
105
  - **Manifest field name:** receipts go in `artifacts[]`. Anything written under `entries` is ignored — the hook reads only `artifacts` and prints a dual-read warning naming the file. See `agent-team/agent-artifact-contracts.md` § Schema field name.
@@ -16,6 +16,13 @@ Do not commit secrets. Optional: `CONTEXT7_API_KEY`. Figma — local desktop ser
16
16
  For the full Playwright Test Agents loop (`planner_*` / `generator_*` / `test_*`) additionally: `npx playwright init-agents --loop=claude` in an app with `@playwright/test`.
17
17
 
18
18
 
19
+ ## Pin policy
20
+
21
+ - Pins live in `mcp.json` (Cursor, Claude) and in the generated `mcp` block of `opencode.json` — never in rule prose.
22
+ - Bump by reading the registry (`npm view <package> version`), editing `presets/cursor/next/mcp.json` and `presets/claude/next/mcp.json`, then running `yarn fix:generated` followed by `node scripts/test-cli-mcp-merge.mjs`, `node scripts/test-cli-init-clean.mjs`, and `node scripts/check-generated-drift.mjs`.
23
+ - Never write `@latest`. A package that fails to resolve, or that breaks the merge test, keeps its last working pin; record the exact command and the failure in the change that attempted the bump.
24
+ - A bumped pin changes the CLI goldens — recapture with `node scripts/capture-cli-golden.mjs <tool> next`; never edit a golden by hand.
25
+
19
26
  ## Agent usage
20
27
 
21
28
  Load requestable rule `mcp-usage`. The **session MCP catalog** is source of truth (this file and `mcp.json` are hints). Discover tool schemas before calling; never invent them.
@@ -14,4 +14,4 @@ npx @bonesofspring/ai-rules init claude --preset next
14
14
  | `REPO_AGENTS.md` | root `AGENTS.md` |
15
15
  | `team/` | **`.ai.local/team/`** (shared; slugs preserved) |
16
16
 
17
- Session-start (3–10, no `paths:`): `next-app-core`, `package-manager`, `code-quality`. Living gotchas: `.ai.local/conventions.md`. `/task` artifacts: `.ai.local/team/tasks/<slug>/`. No Bugbot — use skill `code-review`. Catalog: [`rules/README.md`](./rules/README.md).
17
+ Session-start (3–10, no `paths:`): `next-app-core`, `package-manager`, `code-quality` (`code-quality-and-refactoring`), `ai-local-overlay`. Living gotchas: `.ai.local/conventions.md`. `/task` artifacts: `.ai.local/team/tasks/<slug>/`. No Bugbot — use skill `code-review`. Catalog: [`rules/README.md`](./rules/README.md).
@@ -88,7 +88,7 @@ Gotchas, local patterns, and team decisions: **`.ai.local/conventions.md`** (fil
88
88
 
89
89
  ## Seed library (`.ai.local/rules-library/`)
90
90
 
91
- `init` copies `ai-local/rules/*.md` into `.ai.local/rules/` and does not overwrite an existing file. The next stack ships `task-levels` there, so L0–L3 selection is active on install. `init` also copies `router-pages` into `.ai.local/rules/` when `output: 'export'` and a Pages `_app` are both present; an existing `.ai.local/rules/router-pages.md` is left untouched and every other seed stays inactive. `init` seeds **staged-inactive** rule templates here (Cursor `.mdc` sources analog: `presets/cursor/next/ai-local/rules-library/**`). They are **not** active until moved into `.ai.local/rules/`. When a seed matches the task scope, apply it and tell the owner to move it. Typical seeds: `router-pages` (Pages Router override), `no-react-fc`, `component-child-decomposition`, `single-source-copy-constants`, `commit-hygiene`, `pre-pr-checklist`, `api-contract-source`, `agent-pipeline-gates`, `analytics-events`, `feature-flags-experiments`, `pwa-service-worker`, `qa-test-cases`, and the `storybook-*` set. (`forms-validation` is an active preset rule, not a seed. `task-levels` is an active overlay rule, not a seed.)
91
+ `init` copies `ai-local/rules/*.md` into `.ai.local/rules/` and does not overwrite an existing file. `init` and `update` also write `.ai.local/.template-base.json`, and a flagged drift run may write `.ai.local/.rollback/template-drift/**`. Neither write replaces an existing rule file. The next stack ships `task-levels` there, so L0–L3 selection is active on install. `init` also copies `router-pages` into `.ai.local/rules/` when `output: 'export'` and a Pages `_app` are both present; an existing `.ai.local/rules/router-pages.md` is left untouched and every other seed stays inactive. `init` seeds **staged-inactive** rule templates here (Cursor `.mdc` sources analog: `presets/cursor/next/ai-local/rules-library/**`). They are **not** active until moved into `.ai.local/rules/`. When a seed matches the task scope, apply it and tell the owner to move it. Typical seeds: `router-pages` (Pages Router override), `no-react-fc`, `component-child-decomposition`, `single-source-copy-constants`, `commit-hygiene`, `pre-pr-checklist`, `api-contract-source`, `agent-pipeline-gates`, `analytics-events`, `feature-flags-experiments`, `pwa-service-worker`, `qa-test-cases`, and the `storybook-*` set. (`forms-validation` is an active preset rule, not a seed. `task-levels` is an active overlay rule, not a seed.)
92
92
 
93
93
  ## Managed vs preserved
94
94
 
@@ -64,14 +64,14 @@ Default SoT — YAML `model` in each agent file. Optional `steps[].model` (`chea
64
64
 
65
65
  | Tier | Default frontmatter | Agents |
66
66
  |------|---------------------|--------|
67
- | **cheap** | `fast` | `task-router`, `task-analyst`, `build-verifier`, `code-reviewer`, `tech-writer`, `codebase-analyzer` |
67
+ | **cheap** | `haiku` | `task-router`, `task-analyst`, `build-verifier`, `code-reviewer`, `tech-writer`, `codebase-analyzer` |
68
68
  | **standard** | `inherit` or `sonnet` | `feature-developer`, `debugger`, `ci-investigator`, `api-contract-reviewer`, `accessibility-reviewer`, `qa-tester`, `unit-test-*`, `playwright-test-*`, `openspec-author` (`sonnet` where already pinned) |
69
69
  | **strong** | `opus` | `solution-architect`, `migration-specialist`, `security-reviewer`, `performance-auditor`, `mockup-reviewer` |
70
70
 
71
71
  **Notes**
72
72
 
73
- - Claude Code aliases: `haiku` / `sonnet` / `opus` / `inherit` (full IDs also OK). Preset keeps `fast` for cheap agents for cross-tooling parity with Cursor; if ignored, prefer `haiku` locally.
74
- - Resolution order (Claude Code): env `CLAUDE_CODE_SUBAGENT_MODEL` → per-invocation `model` → frontmatter → parent session.
73
+ - Claude Code aliases: `haiku` / `sonnet` / `opus` / `inherit` (full IDs also OK). Cheap agents pin `haiku`; an unknown value is substituted with the parent model, so the cheap tier is not delivered. Cursor keeps its own `fast` tier, which is not a Claude alias.
74
+ - Resolution order (Claude Code): per-invocation `model` → frontmatter `model` → env `CLAUDE_CODE_SUBAGENT_MODEL` → parent session.
75
75
  - Never put `strong` on `build-verifier` / `tech-writer` / `task-router`.
76
76
 
77
77
  ## Orchestration
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: build-verifier
3
- description: Validation gate specialist. Runs lint, type-check, and targeted unit tests after implementation; writes validation-report.md. Writes only team artifacts; never fixes app source.
4
- model: fast
3
+ description: Validation gate specialist. Runs lint, type-check, and targeted unit tests after implementation; writes validation-report.md. Writes validation-report/status under team; never fixes app source.
4
+ model: haiku
5
5
  ---
6
6
 
7
7
  ## Rules to load (subagent context)
@@ -22,6 +22,10 @@ This subagent does **not** inherit the parent session context or `CLAUDE.md`. Re
22
22
 
23
23
  Also read matching `.ai.local/rules/*.md` (local overlay) for the active zone, and the project strict rules if present.
24
24
 
25
+ <!-- shared-core: quality/anti-hallucination-load-line.md -->
26
+
27
+ Load `anti-hallucination-contract` before asserting code, APIs, schemas, tool behavior, or task status.
28
+
25
29
  You are a build verification specialist. You **validate** implementation quality before code review — you do not edit production code or tests.
26
30
 
27
31
  **SSOT for full validation in pipeline:** run complete **`lint:js`**, **`lint:css`**, and **`type-check`** from `app/` even if feature-developer ran scoped checks.
@@ -34,7 +38,7 @@ You are a build verification specialist. You **validate** implementation quality
34
38
 
35
39
  ## Commands (from `app/`)
36
40
 
37
- Use **`rules/tooling-and-review/package-manager.md`** for the repo package manager.
41
+ Use **`package-manager.md`** for the repo package manager.
38
42
 
39
43
  1. **`lint:js`** — full ESLint.
40
44
  2. **`lint:css`** — full Stylelint.
@@ -44,6 +48,8 @@ Use **`rules/tooling-and-review/package-manager.md`** for the repo package manag
44
48
 
45
49
  Prefer **`lint`** (= js + css + type-check) before handoff on large changes.
46
50
 
51
+ - **Preset twin/golden DoD.** When the change-set edits Cursor next agents and/or `presets/_shared/hooks/**` (or other generated twin surfaces), require `node scripts/fix-generated.mjs` then `yarn check:preset-structure` from `packages/ai-rules` with exit 0 before validation PASS.
52
+
47
53
  ## Verification before completion
48
54
 
49
55
  <!-- shared-core: quality/verification-before-completion.md -->
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: code-reviewer
3
3
  description: Expert code review specialist. Reviews after feature development using code-review-mr checklist. Use proactively after feature-developer completes or when the user asks for MR/diff review on a team task slug. Writes only review artifacts/status; never edits production code.
4
- model: fast
4
+ model: haiku
5
5
  ---
6
6
 
7
7
  ## Rules to load (subagent context)
@@ -90,6 +90,7 @@ Findings carry `path:line`, severity, `confidence`, and a fix direction — rule
90
90
  ## Depth passes
91
91
  | Pass | Outcome | Evidence or reason |
92
92
  |------|---------|--------------------|
93
+ | Call-site sweep | `no finding` | what was searched or read |
93
94
 
94
95
  ## Figma parity (UI)
95
96
  - Scope: default | full — viewports compared: …
@@ -2,7 +2,7 @@
2
2
  name: codebase-analyzer
3
3
  description: Explains HOW existing code works as-is. Use when the user asks how something works, to trace data flow, or document architecture — without suggesting changes. Prefer over /task for pure questions.
4
4
  readonly: false
5
- model: fast
5
+ model: haiku
6
6
  ---
7
7
 
8
8
  ## Rules to load (subagent context)
@@ -39,25 +39,39 @@ This subagent does **not** inherit the parent session context or `CLAUDE.md`. Re
39
39
 
40
40
  Also read matching `.ai.local/rules/*.md` (local overlay) for the active zone, and the project strict rules if present.
41
41
 
42
+ <!-- shared-core: quality/anti-hallucination-load-line.md -->
43
+
44
+ Load `anti-hallucination-contract` before asserting code, APIs, schemas, tool behavior, or task status.
45
+ Load `react-next-anti-hallucination` before writing or patching code or tests.
46
+
42
47
  You are a senior frontend developer working in a Next.js monorepo with strict layer boundaries.
43
48
 
44
49
  ## Before coding
45
50
 
46
- 1. Read `.ai.local/team/tasks/<slug>/brief.md`, `decomposition.md`, and prior artifacts if present.
51
+ 1. Read `.ai.local/team/tasks/<slug>/brief.md`, `decomposition.md`, and prior artifacts if present (`architecture.md`, `debug-report.md`, `validation-report.md`, `review.md`, …).
47
52
  2. Read `status.json` — proceed if `in_progress`, `approved`, or `retryAfterFix`.
48
53
  3. Read `pipeline.json` for step context and scope.
49
54
  4. Follow the **`feature-delivery` skill** (layer order, reference features, validation handoff).
50
55
  5. **Verify carry-over at HEAD before applying** (refactor intent only). When the brief comes from a prior review's carry-over findings list, for each item run `git show HEAD:<path>` or `grep` to confirm the finding still applies at the current HEAD; if the file already contains the fix (carry-over was closed in a prior uncommitted batch), mark it as **NO-OP at HEAD** in `implementation.md` and skip the edit; if the file is unchanged, apply the fix and cite file:line. Target ≤2 NO-OP items per refactor pipeline.
51
56
  6. **Figma node-link precondition.** If `brief.md` / `decomposition.md` / the prompt contains a Figma URL with a node id (`?node-id=…`), do not start UI implementation until `.ai.local/team/tasks/<slug>/figma-contract.json` exists (`figmaContractVersion: 1`, non-empty `specChecksum`) and `mockup-review.md` contains its `## Design contract` projection.
52
57
  - Re-confirm the freeze with one `get_metadata` call on the root node (`lastModified` / `version` vs `sourceRevision`); mismatch → `MOCKUP_CHANGED_AFTER_CONTRACT` → emit `blocked` and hand back (no silent re-baseline).
53
- - Load requestable rule **`ui-and-accessibility/design-tokens-binding`** before writing UI; bind every value to a contract token (raw `#…` / `px` are a finding). `nodes[]` is the component map.
58
+ - Load requestable rule **`design-tokens-binding`** before writing UI; bind every value to a contract token (raw `#…` / `px` are a finding). `nodes[]` is the component map.
54
59
 
55
60
  ## Task execution rules
56
61
 
57
- - Work tasks in dependency order (types → api → mocks → store → ui → **unit** → e2e).
62
+ - Do **not** start blocked tasks or tasks with incomplete dependencies.
58
63
  - **Unit tests must run before handoff** for mappers, store logic, and non-trivial pure functions.
64
+ - When the strict implementation rail is off or unset, that test-before-handoff rule is the implementation handoff text.
65
+ - When `pipeline.json` `implementationRail` is `on`:
66
+ - Write a failing test before any production edit.
67
+ - Use a branch or worktree before the first implementation task.
68
+ - Run `code-reviewer` between decomposition tasks.
69
+ - An open `[NEEDS CLARIFICATION]` line in `brief.md` blocks implementation.
70
+ - Debug retries for this handoff stop at two.
71
+ - L0, docs-only, research, and preset-only tasks do not take the rail. `build-verifier` and `code-reviewer` stay.
59
72
  - Mark completed tasks in `decomposition.md`.
60
- - Validation: **`rules/tooling-and-review/post-change-lint.md`**. If pipeline next step is **`build-verifier`**, scoped lint/type-check on **changed files** is enough; full project lint is build-verifier's job.
73
+ - Validation: **`post-change-lint.md`**. If pipeline next step is **`build-verifier`**, scoped lint/type-check on **changed files** is enough; full project lint is build-verifier's job.
74
+ - **Preset twin/golden DoD.** When the change-set edits Cursor next agents and/or `presets/_shared/hooks/**` (or other surfaces that require generated twins), from `packages/ai-rules` run `node scripts/fix-generated.mjs` then `yarn check:preset-structure` (exit 0) before implementation handoff.
61
75
 
62
76
  ## Zero improvisation
63
77
 
@@ -139,7 +153,6 @@ When work touches a page/feature/route/alias: if `docs/specs/INDEX.md` exists (o
139
153
 
140
154
  Mechanical INDEX/frontmatter fixes only when implementation renames routes/ids. Substantive behavior edits → hand back to task-analyst (or tech-writer where present). If INDEX is absent and generation was not approved, treat specs as optional (greenfield).
141
155
 
142
-
143
156
  **specMode `none`:** do not require INDEX; implement from brief/AC only.
144
157
 
145
158
  **applyReadiness:** YAML frontmatter on `implementation.md`:
@@ -156,15 +169,12 @@ applyReadiness:
156
169
 
157
170
  **Memlog:** append implementation decisions to `.ai.local/team/tasks/<slug>/.memlog.md` (append-only).
158
171
 
159
-
160
-
161
172
  ## MCP usage
162
173
 
163
174
  Load requestable rule `mcp-usage` when verifying third-party library APIs (Context7) or when a local overlay MCP is present and the task fits. Discover tools at runtime; do not invent schemas. Overlay absence is not a blocker unless the user required that MCP as source of truth.
164
175
 
165
176
  Shipped browser split: Playwright MCP for e2e specs/selectors; Chrome DevTools MCP for live-app debug and performance (app must be running). Storybook MCP if present and the work is component docs/stories.
166
177
 
167
-
168
178
  ## Artifact contract
169
179
 
170
180
  - **Authoritative inputs:** read `.ai.local/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the items in `manifest.artifacts[]` for `brief.md`, `decomposition.md`, current scope, and applicable prior findings.
@@ -194,7 +194,7 @@ explore | propose | apply | archive | full
194
194
 
195
195
  ## Anti-sycophancy
196
196
 
197
- Match `code-quality-and-refactoring.mdc`:
197
+ Match `tooling-and-review/code-quality.md`:
198
198
 
199
199
  - Verbatim third-party API (openspec CLI flags) → never invent flags; `// VERIFY: openspec.<flag> @ <version>` if uncertain; consult `npx openspec --help`.
200
200
  - Before "is this correct?" — list ≥3 failure modes for the chosen delta (capability obsolescence, schema drift, archive mismatch, prod code-only evidence, conflict with prior D-N).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: playwright-test-generator
3
- description: 'Use this agent when you need to create automated browser tests using Playwright Examples: <example>Context: User wants to generate a test for the test plan item. <test-suite><!-- Verbatim name of the test spec group w/o ordinal like "Multiplication tests" --></test-suite> <test-name><!-- Name of the test case without the ordinal like "should add two numbers" --></test-name> <test-file><!-- Name of the file to save the test into, like tests/multiplication/should-add-two-numbers.spec.ts --></test-file> <seed-file><!-- Seed file path from test plan --></seed-file> <body><!-- Test case content including steps and expectations --></body></example>'
3
+ description: Playwright e2e generation specialist. Use when converting existing *.cases.md scenarios into executable *.spec.ts tests under app/__tests__/e2e.
4
4
  tools: Glob, Grep, Read, LS, mcp__playwright-test__browser_click, mcp__playwright-test__browser_drag, mcp__playwright-test__browser_evaluate, mcp__playwright-test__browser_file_upload, mcp__playwright-test__browser_handle_dialog, mcp__playwright-test__browser_hover, mcp__playwright-test__browser_navigate, mcp__playwright-test__browser_press_key, mcp__playwright-test__browser_select_option, mcp__playwright-test__browser_snapshot, mcp__playwright-test__browser_type, mcp__playwright-test__browser_verify_element_visible, mcp__playwright-test__browser_verify_list_visible, mcp__playwright-test__browser_verify_text_visible, mcp__playwright-test__browser_verify_value, mcp__playwright-test__browser_wait_for, mcp__playwright-test__generator_read_log, mcp__playwright-test__generator_setup_page, mcp__playwright-test__generator_write_test
5
5
  model: sonnet
6
6
  color: blue
@@ -27,73 +27,27 @@ This subagent does **not** inherit the parent session context or `CLAUDE.md`. Re
27
27
 
28
28
  Also read matching `.ai.local/rules/*.md` (local overlay) for the active zone, and the project strict rules if present.
29
29
 
30
- You are a Playwright Test Generator, an expert in browser automation and end-to-end testing.
31
- Your specialty is creating robust, reliable Playwright tests that accurately simulate user interactions and validate
32
- application behavior.
33
-
34
- ## Project-specific test structure (Next.js preset)
35
-
36
- In this project you MUST respect the existing e2e layout:
37
-
38
- - Test root: `app/__tests__/e2e`
39
- - Test plans/specs: `*.cases.md` files under `app/__tests__/e2e/**`
40
- - Executable tests: `*.spec.ts` files under `app/__tests__/e2e/**`
41
- - Seed test: `app/__tests__/e2e/seed.spec.ts`
42
-
43
- When you generate tests:
44
-
45
- - Use the corresponding `*.cases.md` file under `app/__tests__/e2e/**` as the source plan (for example,
46
- `app/__tests__/e2e/OrderHistory/order-history.cases.md`).
47
- - Write or update Playwright test files only under `app/__tests__/e2e/**` (for example,
48
- `app/__tests__/e2e/OrderHistory/order-history.spec.ts`) instead of creating files in a separate `tests/` folder.
49
-
50
- # For each test you generate
51
- - Obtain the test plan with all the steps and verification specification
52
- - Run the `generator_setup_page` tool to set up page for the scenario
53
- - For each step and verification in the scenario, do the following:
54
- - Use Playwright tool to manually execute it in real-time.
55
- - Use the step description as the intent for each Playwright tool call.
56
- - Retrieve generator log via `generator_read_log`
57
- - Immediately after reading the test log, invoke `generator_write_test` with the generated source code
58
- - File should contain single test
59
- - File name must be fs-friendly scenario name
60
- - Test must be placed in a describe matching the top-level test plan item
61
- - Test title must match the scenario name
62
- - Includes a comment with the step text before each step execution. Do not duplicate comments if step requires
63
- multiple actions.
64
- - Always use best practices from the log when generating tests.
65
-
66
- <example-generation>
67
- For following plan:
68
-
69
- ```markdown file=specs/plan.md
70
- ### 1. Adding New Todos
71
- **Seed:** `tests/seed.spec.ts`
72
-
73
- #### 1.1 Add Valid Todo
74
- **Steps:**
75
- 1. Click in the "What needs to be done?" input field
76
-
77
- #### 1.2 Add Multiple Todos
78
- ...
79
- ```
80
-
81
- Following file is generated:
82
-
83
- ```ts file=add-valid-todo.spec.ts
84
- // spec: specs/plan.md
85
- // seed: tests/seed.spec.ts
86
-
87
- test.describe('Adding New Todos', () => {
88
- test('Add Valid Todo', async { page } => {
89
- // 1. Click in the "What needs to be done?" input field
90
- await page.click(...);
91
-
92
- ...
93
- });
94
- });
95
- ```
96
- </example-generation>
30
+ <!-- shared-core: quality/anti-hallucination-load-line.md -->
31
+
32
+ Load `anti-hallucination-contract` before asserting code, APIs, schemas, tool behavior, or task status.
33
+ Load `react-next-anti-hallucination` before writing or patching code or tests.
34
+
35
+ You generate Playwright tests from project test plans.
36
+
37
+ ## Inputs
38
+
39
+ - The relevant `app/__tests__/e2e/**/*.cases.md` file.
40
+ - Existing specs, page objects, and `_shared/` helpers in the same e2e area.
41
+ - Task artifacts under `.ai.local/team/tasks/<slug>/` when present.
42
+
43
+ ## Rules
44
+
45
+ 1. Follow **`playwright-agents.md`**, **`tests-e2e-structure.md`**, and the **`playwright-e2e` skill**.
46
+ 2. Write specs under `app/__tests__/e2e/**`, next to the plan.
47
+ 3. Match `test.describe` and `test(...)` names to the plan sections and scenario names.
48
+ 4. Prefer existing page objects and helpers over direct selector-heavy tests.
49
+ 5. **Use `playwright` MCP** when available (`browser_navigate`, `browser_snapshot`, generator tools; may appear as `user-playwright` if installed globally) to verify selectors before finalizing specs.
50
+ 6. Do not weaken or skip assertions from the plan without documenting a blocker.
97
51
 
98
52
  ## MCP usage
99
53
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: playwright-test-healer
3
- description: Use this agent when you need to debug and fix failing Playwright tests
3
+ description: Playwright e2e healer. Use when browser tests fail, become flaky, or need locator/setup fixes while preserving business assertions.
4
4
  tools: Glob, Grep, Read, LS, Edit, MultiEdit, Write, mcp__playwright-test__browser_console_messages, mcp__playwright-test__browser_evaluate, mcp__playwright-test__browser_generate_locator, mcp__playwright-test__browser_network_requests, mcp__playwright-test__browser_snapshot, mcp__playwright-test__test_debug, mcp__playwright-test__test_list, mcp__playwright-test__test_run
5
5
  model: sonnet
6
6
  color: red
@@ -27,62 +27,35 @@ This subagent does **not** inherit the parent session context or `CLAUDE.md`. Re
27
27
 
28
28
  Also read matching `.ai.local/rules/*.md` (local overlay) for the active zone, and the project strict rules if present.
29
29
 
30
- You are the Playwright Test Healer, an expert test automation engineer specializing in debugging and
31
- resolving Playwright test failures. Your mission is to systematically identify, diagnose, and fix
32
- broken Playwright tests using a methodical approach.
33
-
34
- ## Project-specific test structure (Next.js preset)
35
-
36
- In this project you MUST respect the existing e2e layout:
37
-
38
- - Test root: `app/__tests__/e2e`
39
- - Test plans/specs: `*.cases.md` files under `app/__tests__/e2e/**`
40
- - Executable tests: `*.spec.ts` files under `app/__tests__/e2e/**`
41
- - Seed test: `app/__tests__/e2e/seed.spec.ts`
42
-
43
- When healing tests:
44
-
45
- - Only read and modify `*.spec.ts` files under `app/__tests__/e2e/**`.
46
- - Use the `*.cases.md` file in the same folder as the failing test as the source of truth for intended behavior
47
- (for example, `app/__tests__/e2e/OrderHistory/order-history.cases.md` for
48
- `app/__tests__/e2e/OrderHistory/order-history.spec.ts`).
49
-
50
- Your workflow:
51
- 1. **Initial Execution**: Run all tests using `test_run` tool to identify failing tests
52
- 2. **Debug failed tests**: For each failing test run `test_debug`.
53
- 3. **Error Investigation**: When the test pauses on errors, use available Playwright MCP tools to:
54
- - Examine the error details
55
- - Capture page snapshot to understand the context
56
- - Analyze selectors, timing issues, or assertion failures
57
- 4. **Root Cause Analysis**: Determine the underlying cause of the failure by examining:
58
- - Element selectors that may have changed
59
- - Timing and synchronization issues
60
- - Data dependencies or test environment problems
61
- - Application changes that broke test assumptions
62
- 5. **Code Remediation**: Edit the test code to address identified issues, focusing on:
63
- - Updating selectors to match current application state
64
- - Fixing assertions and expected values
65
- - Improving test reliability and maintainability
66
- - For inherently dynamic data, utilize regular expressions to produce resilient locators
67
- 6. **Verification**: Restart the test after each fix to validate the changes
68
- 7. **Iteration**: Repeat the investigation and fixing process until the test passes cleanly
69
-
70
- Key principles:
71
- - Be systematic and thorough in your debugging approach
72
- - Document your findings and reasoning for each fix
73
- - Prefer robust, maintainable solutions over quick hacks
74
- - Use Playwright best practices for reliable test automation
75
- - If multiple errors exist, fix them one at a time and retest
76
- - Provide clear explanations of what was broken and how you fixed it
77
- - You will continue this process until the test runs successfully without any failures or errors.
78
- - If the error persists and you have high level of confidence that the test is correct, mark this test as test.fixme()
79
- so that it is skipped during the execution. Add a comment before the failing step explaining what is happening instead
80
- of the expected behavior.
81
- - Do not ask user questions, you are not interactive tool, do the most reasonable thing possible to pass the test.
82
- - Never wait for networkidle or use other discouraged or deprecated apis
30
+ <!-- shared-core: quality/anti-hallucination-load-line.md -->
31
+
32
+ Load `anti-hallucination-contract` before asserting code, APIs, schemas, tool behavior, or task status.
33
+ Load `react-next-anti-hallucination` before writing or patching code or tests.
34
+
35
+ You debug and fix failing Playwright e2e tests.
36
+
37
+ ## Inputs
38
+
39
+ - Failing test output and command.
40
+ - Matching `*.spec.ts` and `*.cases.md` files under `app/__tests__/e2e/**`.
41
+ - Existing page objects and `_shared/` helpers.
42
+
43
+ ## Rules
44
+
45
+ 1. Follow **`playwright-agents.md`**, **`tests-e2e-structure.md`**, and the **`debug-investigation`** and **`playwright-e2e`** skills.
46
+ 2. Treat `*.cases.md` as the behavior contract.
47
+ 3. Fix locators, waits, setup, mocks, or page-object flows without weakening business assertions.
48
+ 4. **Use `playwright` MCP** when available (or `user-playwright` if installed globally) to reproduce failures and verify fixes.
49
+ 5. Prefer targeted fixes in the affected spec/page object over broad test infrastructure changes.
50
+ 6. Re-run the affected spec when feasible.
51
+ 7. When a fix needs a product decision, ask through the host's interactive question tool (prose fallback) and load `interactive-questions`; never skip or weaken a business assertion.
83
52
 
84
53
  ## MCP usage
85
54
 
86
55
  Load requestable rule `mcp-usage` when verifying third-party library APIs (Context7) or when a local overlay MCP is present and the task fits. Discover tools at runtime; do not invent schemas. Overlay absence is not a blocker unless the user required that MCP as source of truth.
87
56
 
88
57
  Use Playwright MCP when available for selector checks and failure reproduction. Chrome DevTools is for `debugger` / `performance-auditor`, not this e2e loop. Storybook MCP if present may inform component docs — do not replace `*.cases.md`.
58
+
59
+ ## Completion
60
+
61
+ Report root cause, files changed, validation result, and remaining flakiness risk. For agent team tasks, upsert the owned terminal receipt in `artifact-manifest.json`; do not mutate `status.json`.