@bonesofspring/ai-rules 0.2.84 → 0.2.87

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 (445) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/bin/lib/engine-scripts.js +4 -0
  3. package/bin/lib/seed-ai-local-team.js +39 -2
  4. package/bin/opencode-install.js +3 -2
  5. package/docs/OPENCODE-COMPATIBILITY.md +6 -4
  6. package/docs/OPENCODE.md +8 -5
  7. package/docs/PRESET-CONTRIBUTION.md +19 -10
  8. package/docs/TEAM-DB.md +76 -3
  9. package/docs/TOKEN-ECONOMY.md +20 -0
  10. package/docs/openapi/team-db.v1.json +7069 -5895
  11. package/package.json +5 -2
  12. package/presets/_shared/ai-local/scripts/report-step-cost.mjs +544 -0
  13. package/presets/_shared/ai-local/scripts/team-db-api.mjs +253 -15
  14. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +310 -4
  15. package/presets/_shared/ai-local/scripts/team-db-project.mjs +733 -8
  16. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +44 -0
  17. package/presets/_shared/ai-local/scripts/team-db.mjs +43 -3
  18. package/presets/_shared/assets/model-tiers.json +6 -0
  19. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +3 -3
  20. package/presets/_shared/hooks/guard-shell-command.mjs.tmpl +125 -105
  21. package/presets/claude/android-kotlin/hooks/guard-shell-command.mjs +125 -105
  22. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +3 -3
  23. package/presets/claude/go/hooks/guard-shell-command.mjs +125 -105
  24. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +3 -3
  25. package/presets/claude/ios-swift/hooks/guard-shell-command.mjs +125 -105
  26. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +3 -3
  27. package/presets/claude/java/hooks/guard-shell-command.mjs +125 -105
  28. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +3 -3
  29. package/presets/claude/mcp-ts/hooks/guard-shell-command.mjs +125 -105
  30. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +3 -3
  31. package/presets/claude/mol/hooks/guard-shell-command.mjs +125 -105
  32. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +3 -3
  33. package/presets/claude/next/agents/build-verifier.md +2 -1
  34. package/presets/claude/next/agents/feature-developer.md +1 -1
  35. package/presets/claude/next/hooks/guard-shell-command.mjs +125 -105
  36. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +3 -3
  37. package/presets/claude/nuxt/hooks/guard-shell-command.mjs +125 -105
  38. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +3 -3
  39. package/presets/claude/php-hexagonal/hooks/guard-shell-command.mjs +125 -105
  40. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +3 -3
  41. package/presets/claude/php-laravel/hooks/guard-shell-command.mjs +125 -105
  42. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +3 -3
  43. package/presets/claude/svelte/hooks/guard-shell-command.mjs +125 -105
  44. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +3 -3
  45. package/presets/cursor/android-kotlin/hooks/guard-shell-command.mjs +125 -105
  46. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +3 -3
  47. package/presets/cursor/go/hooks/guard-shell-command.mjs +125 -105
  48. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +3 -3
  49. package/presets/cursor/ios-swift/hooks/guard-shell-command.mjs +125 -105
  50. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +3 -3
  51. package/presets/cursor/java/hooks/guard-shell-command.mjs +125 -105
  52. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +3 -3
  53. package/presets/cursor/mcp-ts/hooks/guard-shell-command.mjs +125 -105
  54. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +3 -3
  55. package/presets/cursor/mol/hooks/guard-shell-command.mjs +125 -105
  56. package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +3 -3
  57. package/presets/cursor/next/agents/build-verifier.md +2 -1
  58. package/presets/cursor/next/agents/feature-developer.md +1 -1
  59. package/presets/cursor/next/hooks/guard-shell-command.mjs +125 -105
  60. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +3 -3
  61. package/presets/cursor/nuxt/hooks/guard-shell-command.mjs +125 -105
  62. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +3 -3
  63. package/presets/cursor/php-hexagonal/hooks/guard-shell-command.mjs +125 -105
  64. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +3 -3
  65. package/presets/cursor/php-laravel/hooks/guard-shell-command.mjs +125 -105
  66. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +3 -3
  67. package/presets/cursor/svelte/hooks/guard-shell-command.mjs +125 -105
  68. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +3 -3
  69. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  70. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +3 -3
  71. package/presets/mavis/go/adapter-map.json +1 -1
  72. package/presets/mavis/go/rules/agent-team-orchestrator.md +3 -3
  73. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  74. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +3 -3
  75. package/presets/mavis/java/adapter-map.json +1 -1
  76. package/presets/mavis/java/rules/agent-team-orchestrator.md +3 -3
  77. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  78. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +3 -3
  79. package/presets/mavis/mol/adapter-map.json +1 -1
  80. package/presets/mavis/mol/rules/agent-team-orchestrator.md +3 -3
  81. package/presets/mavis/next/adapter-map.json +1 -1
  82. package/presets/mavis/next/agents/build-verifier.md +2 -1
  83. package/presets/mavis/next/agents/feature-developer.md +1 -1
  84. package/presets/mavis/next/rules/agent-team-orchestrator.md +3 -3
  85. package/presets/mavis/nuxt/adapter-map.json +1 -1
  86. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +3 -3
  87. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  88. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +3 -3
  89. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  90. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +3 -3
  91. package/presets/mavis/svelte/adapter-map.json +1 -1
  92. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +3 -3
  93. package/presets/opencode/android-kotlin/OPENCODE.md +5 -66
  94. package/presets/opencode/android-kotlin/adapter-map.json +42 -42
  95. package/presets/opencode/android-kotlin/agents/accessibility-reviewer.md +1 -1
  96. package/presets/opencode/android-kotlin/agents/api-contract-reviewer.md +1 -1
  97. package/presets/opencode/android-kotlin/agents/build-verifier.md +1 -1
  98. package/presets/opencode/android-kotlin/agents/ci-investigator.md +1 -1
  99. package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -1
  100. package/presets/opencode/android-kotlin/agents/codebase-analyzer.md +1 -1
  101. package/presets/opencode/android-kotlin/agents/debugger.md +1 -1
  102. package/presets/opencode/android-kotlin/agents/feature-developer.md +1 -1
  103. package/presets/opencode/android-kotlin/agents/instrumentation-test-generator.md +1 -1
  104. package/presets/opencode/android-kotlin/agents/instrumentation-test-healer.md +1 -1
  105. package/presets/opencode/android-kotlin/agents/instrumentation-test-planner.md +1 -1
  106. package/presets/opencode/android-kotlin/agents/migration-specialist.md +1 -1
  107. package/presets/opencode/android-kotlin/agents/mockup-reviewer.md +1 -1
  108. package/presets/opencode/android-kotlin/agents/openspec-author.md +1 -1
  109. package/presets/opencode/android-kotlin/agents/performance-auditor.md +1 -1
  110. package/presets/opencode/android-kotlin/agents/qa-tester.md +1 -1
  111. package/presets/opencode/android-kotlin/agents/security-reviewer.md +1 -1
  112. package/presets/opencode/android-kotlin/agents/solution-architect.md +1 -1
  113. package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
  114. package/presets/opencode/android-kotlin/agents/task-router.md +1 -1
  115. package/presets/opencode/android-kotlin/agents/tech-writer.md +1 -1
  116. package/presets/opencode/android-kotlin/agents/unit-test-generator.md +1 -1
  117. package/presets/opencode/android-kotlin/agents/unit-test-healer.md +1 -1
  118. package/presets/opencode/android-kotlin/agents/unit-test-planner.md +1 -1
  119. package/presets/opencode/android-kotlin/commands/task-continue.md +1 -1
  120. package/presets/opencode/android-kotlin/hooks/README.md +11 -1
  121. package/presets/opencode/android-kotlin/hooks/guard-shell-command.mjs +155 -0
  122. package/presets/opencode/android-kotlin/plugins/rule-attach/globs.json +167 -0
  123. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +5 -5
  124. package/presets/opencode/go/OPENCODE.md +5 -51
  125. package/presets/opencode/go/adapter-map.json +45 -45
  126. package/presets/opencode/go/agents/api-contract-reviewer.md +1 -1
  127. package/presets/opencode/go/agents/build-verifier.md +1 -1
  128. package/presets/opencode/go/agents/ci-investigator.md +1 -1
  129. package/presets/opencode/go/agents/code-reviewer.md +1 -1
  130. package/presets/opencode/go/agents/codebase-analyzer.md +1 -1
  131. package/presets/opencode/go/agents/debugger.md +1 -1
  132. package/presets/opencode/go/agents/feature-developer.md +1 -1
  133. package/presets/opencode/go/agents/integration-test-generator.md +1 -1
  134. package/presets/opencode/go/agents/integration-test-healer.md +1 -1
  135. package/presets/opencode/go/agents/integration-test-planner.md +1 -1
  136. package/presets/opencode/go/agents/migration-specialist.md +1 -1
  137. package/presets/opencode/go/agents/openspec-author.md +1 -1
  138. package/presets/opencode/go/agents/performance-auditor.md +1 -1
  139. package/presets/opencode/go/agents/qa-tester.md +1 -1
  140. package/presets/opencode/go/agents/security-reviewer.md +1 -1
  141. package/presets/opencode/go/agents/solution-architect.md +1 -1
  142. package/presets/opencode/go/agents/task-analyst.md +1 -1
  143. package/presets/opencode/go/agents/task-router.md +1 -1
  144. package/presets/opencode/go/agents/tech-writer.md +1 -1
  145. package/presets/opencode/go/agents/unit-test-generator.md +1 -1
  146. package/presets/opencode/go/agents/unit-test-healer.md +1 -1
  147. package/presets/opencode/go/agents/unit-test-planner.md +1 -1
  148. package/presets/opencode/go/commands/task-continue.md +1 -1
  149. package/presets/opencode/go/hooks/README.md +11 -1
  150. package/presets/opencode/go/hooks/guard-shell-command.mjs +154 -0
  151. package/presets/opencode/go/plugins/rule-attach/globs.json +198 -0
  152. package/presets/opencode/go/rules/agent-team-orchestrator.md +5 -5
  153. package/presets/opencode/ios-swift/OPENCODE.md +5 -66
  154. package/presets/opencode/ios-swift/adapter-map.json +41 -41
  155. package/presets/opencode/ios-swift/agents/accessibility-reviewer.md +1 -1
  156. package/presets/opencode/ios-swift/agents/api-contract-reviewer.md +1 -1
  157. package/presets/opencode/ios-swift/agents/build-verifier.md +1 -1
  158. package/presets/opencode/ios-swift/agents/ci-investigator.md +1 -1
  159. package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -1
  160. package/presets/opencode/ios-swift/agents/codebase-analyzer.md +1 -1
  161. package/presets/opencode/ios-swift/agents/debugger.md +1 -1
  162. package/presets/opencode/ios-swift/agents/feature-developer.md +1 -1
  163. package/presets/opencode/ios-swift/agents/migration-specialist.md +1 -1
  164. package/presets/opencode/ios-swift/agents/mockup-reviewer.md +1 -1
  165. package/presets/opencode/ios-swift/agents/openspec-author.md +1 -1
  166. package/presets/opencode/ios-swift/agents/performance-auditor.md +1 -1
  167. package/presets/opencode/ios-swift/agents/qa-tester.md +1 -1
  168. package/presets/opencode/ios-swift/agents/security-reviewer.md +1 -1
  169. package/presets/opencode/ios-swift/agents/solution-architect.md +1 -1
  170. package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
  171. package/presets/opencode/ios-swift/agents/task-router.md +1 -1
  172. package/presets/opencode/ios-swift/agents/tech-writer.md +1 -1
  173. package/presets/opencode/ios-swift/agents/unit-test-generator.md +1 -1
  174. package/presets/opencode/ios-swift/agents/unit-test-healer.md +1 -1
  175. package/presets/opencode/ios-swift/agents/unit-test-planner.md +1 -1
  176. package/presets/opencode/ios-swift/agents/xcuitest-test-generator.md +1 -1
  177. package/presets/opencode/ios-swift/agents/xcuitest-test-healer.md +1 -1
  178. package/presets/opencode/ios-swift/agents/xcuitest-test-planner.md +1 -1
  179. package/presets/opencode/ios-swift/commands/task-continue.md +1 -1
  180. package/presets/opencode/ios-swift/hooks/README.md +11 -1
  181. package/presets/opencode/ios-swift/hooks/guard-shell-command.mjs +154 -0
  182. package/presets/opencode/ios-swift/plugins/rule-attach/globs.json +160 -0
  183. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +5 -5
  184. package/presets/opencode/java/OPENCODE.md +5 -58
  185. package/presets/opencode/java/adapter-map.json +45 -45
  186. package/presets/opencode/java/agents/api-contract-reviewer.md +1 -1
  187. package/presets/opencode/java/agents/build-verifier.md +1 -1
  188. package/presets/opencode/java/agents/ci-investigator.md +1 -1
  189. package/presets/opencode/java/agents/code-reviewer.md +1 -1
  190. package/presets/opencode/java/agents/codebase-analyzer.md +1 -1
  191. package/presets/opencode/java/agents/debugger.md +1 -1
  192. package/presets/opencode/java/agents/feature-developer.md +1 -1
  193. package/presets/opencode/java/agents/integration-test-generator.md +1 -1
  194. package/presets/opencode/java/agents/integration-test-healer.md +1 -1
  195. package/presets/opencode/java/agents/integration-test-planner.md +1 -1
  196. package/presets/opencode/java/agents/migration-specialist.md +1 -1
  197. package/presets/opencode/java/agents/openspec-author.md +1 -1
  198. package/presets/opencode/java/agents/performance-auditor.md +1 -1
  199. package/presets/opencode/java/agents/qa-tester.md +1 -1
  200. package/presets/opencode/java/agents/security-reviewer.md +1 -1
  201. package/presets/opencode/java/agents/solution-architect.md +1 -1
  202. package/presets/opencode/java/agents/task-analyst.md +1 -1
  203. package/presets/opencode/java/agents/task-router.md +1 -1
  204. package/presets/opencode/java/agents/tech-writer.md +1 -1
  205. package/presets/opencode/java/agents/unit-test-generator.md +1 -1
  206. package/presets/opencode/java/agents/unit-test-healer.md +1 -1
  207. package/presets/opencode/java/agents/unit-test-planner.md +1 -1
  208. package/presets/opencode/java/commands/task-continue.md +1 -1
  209. package/presets/opencode/java/hooks/README.md +11 -1
  210. package/presets/opencode/java/hooks/guard-shell-command.mjs +155 -0
  211. package/presets/opencode/java/plugins/rule-attach/globs.json +230 -0
  212. package/presets/opencode/java/rules/agent-team-orchestrator.md +5 -5
  213. package/presets/opencode/mcp-ts/OPENCODE.md +5 -48
  214. package/presets/opencode/mcp-ts/adapter-map.json +36 -36
  215. package/presets/opencode/mcp-ts/agents/build-verifier.md +1 -1
  216. package/presets/opencode/mcp-ts/agents/feature-developer.md +1 -1
  217. package/presets/opencode/mcp-ts/agents/security-reviewer.md +1 -1
  218. package/presets/opencode/mcp-ts/agents/solution-architect.md +1 -1
  219. package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
  220. package/presets/opencode/mcp-ts/agents/task-router.md +1 -1
  221. package/presets/opencode/mcp-ts/commands/task-continue.md +1 -1
  222. package/presets/opencode/mcp-ts/hooks/README.md +11 -1
  223. package/presets/opencode/mcp-ts/hooks/guard-shell-command.mjs +154 -0
  224. package/presets/opencode/mcp-ts/plugins/rule-attach/globs.json +151 -0
  225. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +5 -5
  226. package/presets/opencode/mol/OPENCODE.md +5 -56
  227. package/presets/opencode/mol/adapter-map.json +31 -31
  228. package/presets/opencode/mol/agents/accessibility-reviewer.md +1 -1
  229. package/presets/opencode/mol/agents/api-contract-reviewer.md +1 -1
  230. package/presets/opencode/mol/agents/build-verifier.md +1 -1
  231. package/presets/opencode/mol/agents/ci-investigator.md +1 -1
  232. package/presets/opencode/mol/agents/code-reviewer.md +1 -1
  233. package/presets/opencode/mol/agents/codebase-analyzer.md +1 -1
  234. package/presets/opencode/mol/agents/debugger.md +1 -1
  235. package/presets/opencode/mol/agents/feature-developer.md +1 -1
  236. package/presets/opencode/mol/agents/migration-specialist.md +1 -1
  237. package/presets/opencode/mol/agents/mockup-reviewer.md +1 -1
  238. package/presets/opencode/mol/agents/openspec-author.md +1 -1
  239. package/presets/opencode/mol/agents/performance-auditor.md +1 -1
  240. package/presets/opencode/mol/agents/playwright-test-generator.md +1 -1
  241. package/presets/opencode/mol/agents/playwright-test-healer.md +1 -1
  242. package/presets/opencode/mol/agents/playwright-test-planner.md +1 -1
  243. package/presets/opencode/mol/agents/qa-tester.md +1 -1
  244. package/presets/opencode/mol/agents/security-reviewer.md +1 -1
  245. package/presets/opencode/mol/agents/solution-architect.md +1 -1
  246. package/presets/opencode/mol/agents/task-analyst.md +1 -1
  247. package/presets/opencode/mol/agents/task-router.md +1 -1
  248. package/presets/opencode/mol/agents/tech-writer.md +1 -1
  249. package/presets/opencode/mol/agents/unit-test-generator.md +1 -1
  250. package/presets/opencode/mol/agents/unit-test-healer.md +1 -1
  251. package/presets/opencode/mol/agents/unit-test-planner.md +1 -1
  252. package/presets/opencode/mol/commands/task-continue.md +1 -1
  253. package/presets/opencode/mol/hooks/README.md +11 -1
  254. package/presets/opencode/mol/hooks/guard-shell-command.mjs +153 -0
  255. package/presets/opencode/mol/plugins/rule-attach/globs.json +112 -0
  256. package/presets/opencode/mol/rules/agent-team-orchestrator.md +5 -5
  257. package/presets/opencode/next/OPENCODE.md +5 -55
  258. package/presets/opencode/next/adapter-map.json +56 -56
  259. package/presets/opencode/next/agents/accessibility-reviewer.md +1 -1
  260. package/presets/opencode/next/agents/api-contract-reviewer.md +1 -1
  261. package/presets/opencode/next/agents/build-verifier.md +3 -2
  262. package/presets/opencode/next/agents/ci-investigator.md +1 -1
  263. package/presets/opencode/next/agents/code-reviewer.md +1 -1
  264. package/presets/opencode/next/agents/codebase-analyzer.md +1 -1
  265. package/presets/opencode/next/agents/debugger.md +1 -1
  266. package/presets/opencode/next/agents/feature-developer.md +2 -2
  267. package/presets/opencode/next/agents/migration-specialist.md +1 -1
  268. package/presets/opencode/next/agents/mockup-reviewer.md +1 -1
  269. package/presets/opencode/next/agents/openspec-author.md +1 -1
  270. package/presets/opencode/next/agents/performance-auditor.md +1 -1
  271. package/presets/opencode/next/agents/playwright-test-generator.md +1 -1
  272. package/presets/opencode/next/agents/playwright-test-healer.md +1 -1
  273. package/presets/opencode/next/agents/playwright-test-planner.md +1 -1
  274. package/presets/opencode/next/agents/qa-tester.md +1 -1
  275. package/presets/opencode/next/agents/security-reviewer.md +1 -1
  276. package/presets/opencode/next/agents/solution-architect.md +1 -1
  277. package/presets/opencode/next/agents/task-analyst.md +1 -1
  278. package/presets/opencode/next/agents/task-router.md +1 -1
  279. package/presets/opencode/next/agents/tech-writer.md +1 -1
  280. package/presets/opencode/next/agents/unit-test-generator.md +1 -1
  281. package/presets/opencode/next/agents/unit-test-healer.md +1 -1
  282. package/presets/opencode/next/agents/unit-test-planner.md +1 -1
  283. package/presets/opencode/next/commands/task-continue.md +1 -1
  284. package/presets/opencode/next/hooks/README.md +11 -1
  285. package/presets/opencode/next/hooks/guard-shell-command.mjs +153 -0
  286. package/presets/opencode/next/plugins/rule-attach/globs.json +276 -0
  287. package/presets/opencode/next/rules/agent-team-orchestrator.md +5 -5
  288. package/presets/opencode/nuxt/OPENCODE.md +5 -54
  289. package/presets/opencode/nuxt/adapter-map.json +51 -51
  290. package/presets/opencode/nuxt/agents/accessibility-reviewer.md +1 -1
  291. package/presets/opencode/nuxt/agents/api-contract-reviewer.md +1 -1
  292. package/presets/opencode/nuxt/agents/build-verifier.md +1 -1
  293. package/presets/opencode/nuxt/agents/ci-investigator.md +1 -1
  294. package/presets/opencode/nuxt/agents/code-reviewer.md +1 -1
  295. package/presets/opencode/nuxt/agents/codebase-analyzer.md +1 -1
  296. package/presets/opencode/nuxt/agents/debugger.md +1 -1
  297. package/presets/opencode/nuxt/agents/feature-developer.md +1 -1
  298. package/presets/opencode/nuxt/agents/migration-specialist.md +1 -1
  299. package/presets/opencode/nuxt/agents/mockup-reviewer.md +1 -1
  300. package/presets/opencode/nuxt/agents/openspec-author.md +1 -1
  301. package/presets/opencode/nuxt/agents/performance-auditor.md +1 -1
  302. package/presets/opencode/nuxt/agents/playwright-test-generator.md +1 -1
  303. package/presets/opencode/nuxt/agents/playwright-test-healer.md +1 -1
  304. package/presets/opencode/nuxt/agents/playwright-test-planner.md +1 -1
  305. package/presets/opencode/nuxt/agents/qa-tester.md +1 -1
  306. package/presets/opencode/nuxt/agents/security-reviewer.md +1 -1
  307. package/presets/opencode/nuxt/agents/solution-architect.md +1 -1
  308. package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
  309. package/presets/opencode/nuxt/agents/task-router.md +1 -1
  310. package/presets/opencode/nuxt/agents/tech-writer.md +1 -1
  311. package/presets/opencode/nuxt/agents/unit-test-generator.md +1 -1
  312. package/presets/opencode/nuxt/agents/unit-test-healer.md +1 -1
  313. package/presets/opencode/nuxt/agents/unit-test-planner.md +1 -1
  314. package/presets/opencode/nuxt/commands/task-continue.md +1 -1
  315. package/presets/opencode/nuxt/hooks/README.md +11 -1
  316. package/presets/opencode/nuxt/hooks/guard-shell-command.mjs +153 -0
  317. package/presets/opencode/nuxt/plugins/rule-attach/globs.json +266 -0
  318. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +5 -5
  319. package/presets/opencode/php-hexagonal/OPENCODE.md +5 -60
  320. package/presets/opencode/php-hexagonal/adapter-map.json +45 -45
  321. package/presets/opencode/php-hexagonal/agents/api-contract-reviewer.md +1 -1
  322. package/presets/opencode/php-hexagonal/agents/build-verifier.md +1 -1
  323. package/presets/opencode/php-hexagonal/agents/ci-investigator.md +1 -1
  324. package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -1
  325. package/presets/opencode/php-hexagonal/agents/codebase-analyzer.md +1 -1
  326. package/presets/opencode/php-hexagonal/agents/debugger.md +1 -1
  327. package/presets/opencode/php-hexagonal/agents/feature-developer.md +1 -1
  328. package/presets/opencode/php-hexagonal/agents/integration-test-generator.md +1 -1
  329. package/presets/opencode/php-hexagonal/agents/integration-test-healer.md +1 -1
  330. package/presets/opencode/php-hexagonal/agents/integration-test-planner.md +1 -1
  331. package/presets/opencode/php-hexagonal/agents/migration-specialist.md +1 -1
  332. package/presets/opencode/php-hexagonal/agents/openspec-author.md +1 -1
  333. package/presets/opencode/php-hexagonal/agents/performance-auditor.md +1 -1
  334. package/presets/opencode/php-hexagonal/agents/qa-tester.md +1 -1
  335. package/presets/opencode/php-hexagonal/agents/security-reviewer.md +1 -1
  336. package/presets/opencode/php-hexagonal/agents/solution-architect.md +1 -1
  337. package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
  338. package/presets/opencode/php-hexagonal/agents/task-router.md +1 -1
  339. package/presets/opencode/php-hexagonal/agents/tech-writer.md +1 -1
  340. package/presets/opencode/php-hexagonal/agents/unit-test-generator.md +1 -1
  341. package/presets/opencode/php-hexagonal/agents/unit-test-healer.md +1 -1
  342. package/presets/opencode/php-hexagonal/agents/unit-test-planner.md +1 -1
  343. package/presets/opencode/php-hexagonal/commands/task-continue.md +1 -1
  344. package/presets/opencode/php-hexagonal/hooks/README.md +11 -1
  345. package/presets/opencode/php-hexagonal/hooks/guard-shell-command.mjs +155 -0
  346. package/presets/opencode/php-hexagonal/plugins/rule-attach/globs.json +242 -0
  347. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +5 -5
  348. package/presets/opencode/php-laravel/OPENCODE.md +5 -60
  349. package/presets/opencode/php-laravel/adapter-map.json +45 -45
  350. package/presets/opencode/php-laravel/agents/api-contract-reviewer.md +1 -1
  351. package/presets/opencode/php-laravel/agents/build-verifier.md +1 -1
  352. package/presets/opencode/php-laravel/agents/ci-investigator.md +1 -1
  353. package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -1
  354. package/presets/opencode/php-laravel/agents/codebase-analyzer.md +1 -1
  355. package/presets/opencode/php-laravel/agents/debugger.md +1 -1
  356. package/presets/opencode/php-laravel/agents/feature-developer.md +1 -1
  357. package/presets/opencode/php-laravel/agents/integration-test-generator.md +1 -1
  358. package/presets/opencode/php-laravel/agents/integration-test-healer.md +1 -1
  359. package/presets/opencode/php-laravel/agents/integration-test-planner.md +1 -1
  360. package/presets/opencode/php-laravel/agents/migration-specialist.md +1 -1
  361. package/presets/opencode/php-laravel/agents/openspec-author.md +1 -1
  362. package/presets/opencode/php-laravel/agents/performance-auditor.md +1 -1
  363. package/presets/opencode/php-laravel/agents/qa-tester.md +1 -1
  364. package/presets/opencode/php-laravel/agents/security-reviewer.md +1 -1
  365. package/presets/opencode/php-laravel/agents/solution-architect.md +1 -1
  366. package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
  367. package/presets/opencode/php-laravel/agents/task-router.md +1 -1
  368. package/presets/opencode/php-laravel/agents/tech-writer.md +1 -1
  369. package/presets/opencode/php-laravel/agents/unit-test-generator.md +1 -1
  370. package/presets/opencode/php-laravel/agents/unit-test-healer.md +1 -1
  371. package/presets/opencode/php-laravel/agents/unit-test-planner.md +1 -1
  372. package/presets/opencode/php-laravel/commands/task-continue.md +1 -1
  373. package/presets/opencode/php-laravel/hooks/README.md +11 -1
  374. package/presets/opencode/php-laravel/hooks/guard-shell-command.mjs +155 -0
  375. package/presets/opencode/php-laravel/plugins/rule-attach/globs.json +232 -0
  376. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +5 -5
  377. package/presets/opencode/platform-contract.json +4 -0
  378. package/presets/opencode/plugins/output-guard/README.md +1 -1
  379. package/presets/opencode/plugins/output-guard/index.ts +8 -2
  380. package/presets/opencode/plugins/output-guard/rewrite.ts +37 -0
  381. package/presets/opencode/plugins/rule-attach/README.md +34 -0
  382. package/presets/opencode/plugins/rule-attach/attach.ts +224 -0
  383. package/presets/opencode/plugins/rule-attach/index.ts +169 -0
  384. package/presets/opencode/plugins/rule-attach/package.json +9 -0
  385. package/presets/opencode/plugins/task-status/README.md +1 -1
  386. package/presets/opencode/plugins/task-status/deepseek.ts +13 -3
  387. package/presets/opencode/plugins/task-status/task-view.ts +4 -1
  388. package/presets/opencode/plugins/task-status/tui.tsx +4 -6
  389. package/presets/opencode/plugins/task-status/types.ts +5 -1
  390. package/presets/opencode/svelte/OPENCODE.md +5 -54
  391. package/presets/opencode/svelte/adapter-map.json +51 -51
  392. package/presets/opencode/svelte/agents/accessibility-reviewer.md +1 -1
  393. package/presets/opencode/svelte/agents/api-contract-reviewer.md +1 -1
  394. package/presets/opencode/svelte/agents/build-verifier.md +1 -1
  395. package/presets/opencode/svelte/agents/ci-investigator.md +1 -1
  396. package/presets/opencode/svelte/agents/code-reviewer.md +1 -1
  397. package/presets/opencode/svelte/agents/codebase-analyzer.md +1 -1
  398. package/presets/opencode/svelte/agents/debugger.md +1 -1
  399. package/presets/opencode/svelte/agents/feature-developer.md +1 -1
  400. package/presets/opencode/svelte/agents/migration-specialist.md +1 -1
  401. package/presets/opencode/svelte/agents/mockup-reviewer.md +1 -1
  402. package/presets/opencode/svelte/agents/openspec-author.md +1 -1
  403. package/presets/opencode/svelte/agents/performance-auditor.md +1 -1
  404. package/presets/opencode/svelte/agents/playwright-test-generator.md +1 -1
  405. package/presets/opencode/svelte/agents/playwright-test-healer.md +1 -1
  406. package/presets/opencode/svelte/agents/playwright-test-planner.md +1 -1
  407. package/presets/opencode/svelte/agents/qa-tester.md +1 -1
  408. package/presets/opencode/svelte/agents/security-reviewer.md +1 -1
  409. package/presets/opencode/svelte/agents/solution-architect.md +1 -1
  410. package/presets/opencode/svelte/agents/task-analyst.md +1 -1
  411. package/presets/opencode/svelte/agents/task-router.md +1 -1
  412. package/presets/opencode/svelte/agents/tech-writer.md +1 -1
  413. package/presets/opencode/svelte/agents/unit-test-generator.md +1 -1
  414. package/presets/opencode/svelte/agents/unit-test-healer.md +1 -1
  415. package/presets/opencode/svelte/agents/unit-test-planner.md +1 -1
  416. package/presets/opencode/svelte/commands/task-continue.md +1 -1
  417. package/presets/opencode/svelte/hooks/README.md +11 -1
  418. package/presets/opencode/svelte/hooks/guard-shell-command.mjs +153 -0
  419. package/presets/opencode/svelte/plugins/rule-attach/globs.json +245 -0
  420. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +5 -5
  421. package/presets/zcode/android-kotlin/adapter-map.json +1 -1
  422. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +3 -3
  423. package/presets/zcode/go/adapter-map.json +1 -1
  424. package/presets/zcode/go/rules/agent-team-orchestrator.md +3 -3
  425. package/presets/zcode/ios-swift/adapter-map.json +1 -1
  426. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +3 -3
  427. package/presets/zcode/java/adapter-map.json +1 -1
  428. package/presets/zcode/java/rules/agent-team-orchestrator.md +3 -3
  429. package/presets/zcode/mcp-ts/adapter-map.json +1 -1
  430. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +3 -3
  431. package/presets/zcode/mol/adapter-map.json +1 -1
  432. package/presets/zcode/mol/rules/agent-team-orchestrator.md +3 -3
  433. package/presets/zcode/next/adapter-map.json +1 -1
  434. package/presets/zcode/next/agents/build-verifier.md +2 -1
  435. package/presets/zcode/next/agents/feature-developer.md +1 -1
  436. package/presets/zcode/next/rules/agent-team-orchestrator.md +3 -3
  437. package/presets/zcode/nuxt/adapter-map.json +1 -1
  438. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +3 -3
  439. package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
  440. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +3 -3
  441. package/presets/zcode/php-laravel/adapter-map.json +1 -1
  442. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +3 -3
  443. package/presets/zcode/svelte/adapter-map.json +1 -1
  444. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +3 -3
  445. package/scripts/report-context-cost.mjs +1 -20
@@ -12,7 +12,7 @@ Write only team artifacts under `.ai.local/team/**`. Do not edit production code
12
12
 
13
13
  ## Rules to load (subagent context)
14
14
 
15
- This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting:
15
+ This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting; a rule the `rule-attach` plugin already attached to your context need not be Read again:
16
16
 
17
17
  - `.opencode/rules/next-app-core.md`
18
18
  - `.opencode/rules/package-manager.md`
@@ -8,7 +8,7 @@ permission:
8
8
 
9
9
  ## Rules to load (subagent context)
10
10
 
11
- This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting:
11
+ This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting; a rule the `rule-attach` plugin already attached to your context need not be Read again:
12
12
 
13
13
  - `.opencode/rules/next-app-core.md`
14
14
  - `.opencode/rules/package-manager.md`
@@ -12,7 +12,7 @@ Write only team artifacts under `.ai.local/team/**`. Do not edit production code
12
12
 
13
13
  ## Rules to load (subagent context)
14
14
 
15
- This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting:
15
+ This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting; a rule the `rule-attach` plugin already attached to your context need not be Read again:
16
16
 
17
17
  - `.opencode/rules/next-app-core.md`
18
18
  - `.opencode/rules/package-manager.md`
@@ -12,7 +12,7 @@ Write only team artifacts under `.ai.local/team/**`. Do not edit production code
12
12
 
13
13
  ## Rules to load (subagent context)
14
14
 
15
- This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting:
15
+ This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting; a rule the `rule-attach` plugin already attached to your context need not be Read again:
16
16
 
17
17
  - `.opencode/rules/next-app-core.md`
18
18
  - `.opencode/rules/package-manager.md`
@@ -12,7 +12,7 @@ Write only team artifacts under `.ai.local/team/**`. Do not edit production code
12
12
 
13
13
  ## Rules to load (subagent context)
14
14
 
15
- This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting:
15
+ This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting; a rule the `rule-attach` plugin already attached to your context need not be Read again:
16
16
 
17
17
  - `.opencode/rules/next-app-core.md`
18
18
  - `.opencode/rules/package-manager.md`
@@ -12,7 +12,7 @@ Write only team artifacts under `.ai.local/team/**`. Do not edit production code
12
12
 
13
13
  ## Rules to load (subagent context)
14
14
 
15
- This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting:
15
+ This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting; a rule the `rule-attach` plugin already attached to your context need not be Read again:
16
16
 
17
17
  - `.opencode/rules/next-app-core.md`
18
18
  - `.opencode/rules/package-manager.md`
@@ -18,7 +18,7 @@ Write team artifacts under `.ai.local/team/**` and scoped files (`docs/**`, `REA
18
18
 
19
19
  ## Rules to load (subagent context)
20
20
 
21
- This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting:
21
+ This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting; a rule the `rule-attach` plugin already attached to your context need not be Read again:
22
22
 
23
23
  - `.opencode/rules/next-app-core.md`
24
24
  - `.opencode/rules/package-manager.md`
@@ -8,7 +8,7 @@ permission:
8
8
 
9
9
  ## Rules to load (subagent context)
10
10
 
11
- This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting:
11
+ This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting; a rule the `rule-attach` plugin already attached to your context need not be Read again:
12
12
 
13
13
  - `.opencode/rules/next-app-core.md`
14
14
  - `.opencode/rules/package-manager.md`
@@ -8,7 +8,7 @@ permission:
8
8
 
9
9
  ## Rules to load (subagent context)
10
10
 
11
- This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting:
11
+ This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting; a rule the `rule-attach` plugin already attached to your context need not be Read again:
12
12
 
13
13
  - `.opencode/rules/next-app-core.md`
14
14
  - `.opencode/rules/package-manager.md`
@@ -12,7 +12,7 @@ Write only team artifacts under `.ai.local/team/**`. Do not edit production code
12
12
 
13
13
  ## Rules to load (subagent context)
14
14
 
15
- This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting:
15
+ This subagent does **not** inherit `opencode.json` `instructions`. Read these rules explicitly before acting; a rule the `rule-attach` plugin already attached to your context need not be Read again:
16
16
 
17
17
  - `.opencode/rules/next-app-core.md`
18
18
  - `.opencode/rules/package-manager.md`
@@ -51,7 +51,7 @@ printf '%s\n' '{"action":"resume_blocked"}' | TEAM_TASK_SLUG=<slug> bash .openco
51
51
  4. Fallback only for an installed hook that predates the action (the call answers `{}`): run `{"status":"completed","action":"bootstrap"}` then `{"status":"completed"}`. The second run opens the gate or advances; the retried producer is not ledgered, so record it in `.memlog.md`.
52
52
  6. **Other resume**: restore `pipelineIndex` / `currentAgent` from status and invoke that agent.
53
53
  7. **Paused** (`state: paused`, sentinel removed): if `awaitingHumanGate` is still true, use the human-gate resume path above. Otherwise close the pause through the installed hook with `{"status":"completed"}` and no `action`, then re-read `status.json` and the hook `followup_message`; do not advance by hand.
54
- 8. After the invoked agent completes, `chain-team-phases.sh` on `subagentStop` continues the chain when `autoChain: true`.
54
+ 8. After the invoked agent completes, run `chain-team-phases.sh` yourself — no `subagentStop` event exists on this host, so the chain continues only when that run happens and `autoChain: true`.
55
55
 
56
56
  ## Checkpoint & resume
57
57
 
@@ -22,9 +22,19 @@ When the recorded package is older than the npm latest, open the reply with a le
22
22
 
23
23
  `list-ai-local.mjs` — run before reading or editing paths: `node .opencode/hooks/list-ai-local.mjs`. Pass the repo-relative paths. Not auto-registered.
24
24
 
25
+ `guard-shell-command.mjs` — the shared shell guard as a runnable CLI
26
+ (`node .opencode/hooks/guard-shell-command.mjs < event.json`) and a module
27
+ (`import { evaluate }`). It answers `allow` / `ask` for destructive git,
28
+ mass-kill, package-manager mismatch and a busy dev-server port.
29
+
25
30
  ## Omitted
26
31
 
27
32
  - `hooks.json` — no native registration schema in this preset
28
- - `guard-shell-command.mjs` — not wired; no native hook schema, do not describe it as enforcement
29
33
  - `run-hook.mjs` — not wired; no native hook schema, the chain hook stays a manual runner
30
34
  - `hooks/examples/**` — hook plugin port is a follow-up
35
+
36
+ `guard-shell-command.mjs` ships and runs, but no host event calls it: the
37
+ OpenCode v2.4.1 bridge registers `ctx.session.hook` for `context`, `compaction`,
38
+ `generate`, and `prompt` only (the probe recorded all four), so a
39
+ `tool.execute.after` registration is never dispatched. The enforced layer is
40
+ `opencode.json` `permission.bash`. Do not describe the guard as enforcement.
@@ -0,0 +1,153 @@
1
+ #!/usr/bin/env node
2
+ // Shell guard for Cursor `beforeShellExecution` and Claude `PreToolUse`.
3
+ // Rendered from `presets/_shared/hooks/guard-shell-command.mjs.tmpl`; edit the
4
+ // template, never a rendered copy.
5
+ // Next.js: npm, yarn, and pnpm scripts are allowed; package-manager mismatch checks apply when a JS lockfile/package.json exists.
6
+ const SERVER_COMMAND = new RegExp("next\\s+(dev|start)|(^|[;&|]\\s*)(?:(?:yarn|pnpm|npm(?:\\s+run)?|npx)\\s+)?(?:storybook|vite|webpack)(?:\\s|$)|(^|[;&|]\\s*)(?:yarn|pnpm|npm)\\s+(?:run\\s+)?dev(?:\\s|$)");
7
+ const SERVER_PORTS = [3000,6006];
8
+ import fs from 'node:fs';
9
+ import net from 'node:net';
10
+ import path from 'node:path';
11
+ import { fileURLToPath } from 'node:url';
12
+
13
+ const allowed = () => ({ permission: 'allow' });
14
+
15
+ const ask = (userMessage, agentMessage) => ({
16
+ permission: 'ask',
17
+ user_message: userMessage,
18
+ agent_message: agentMessage || userMessage,
19
+ });
20
+
21
+ const portIsOpen = (port) =>
22
+ new Promise((resolve) => {
23
+ const socket = net.createConnection({ host: '127.0.0.1', port });
24
+ const done = (open) => {
25
+ socket.destroy();
26
+ resolve(open);
27
+ };
28
+ socket.once('connect', () => done(true));
29
+ socket.once('error', () => done(false));
30
+ socket.setTimeout(400, () => done(false));
31
+ });
32
+
33
+ /**
34
+ * The decision for one shell event: `{ permission, user_message, agent_message }`.
35
+ *
36
+ * Shared by the CLI below and any host that can import the rendered file, so
37
+ * the verdict cannot drift between them. Two effects are injected — a project
38
+ * file read and a TCP probe — because a plugin has no stdin to read and no
39
+ * guaranteed working directory. Never throws: an unreadable event is an allow,
40
+ * the same fail-open the hook always had.
41
+ */
42
+ export const evaluate = async (event, options = {}) => {
43
+ const {
44
+ root = process.cwd(),
45
+ exists = (file) => fs.existsSync(file),
46
+ readText = (file) => fs.readFileSync(file, 'utf8'),
47
+ canConnect = portIsOpen,
48
+ } = options;
49
+ const at = (file) => path.join(root, file);
50
+ if (!event || typeof event !== 'object') return allowed();
51
+
52
+ const command = String(event.command || event.input?.command || event.tool_input?.command || '');
53
+ if (!command.trim()) return allowed();
54
+
55
+ const dangerousGit = /\bgit\s+(reset\s+--hard|clean\s+-[^\n]*f|push\s+--force|push\s+-f|checkout\s+--\s+)/;
56
+ if (dangerousGit.test(command)) {
57
+ return ask(
58
+ 'This command looks destructive for git state. Review it before continuing.',
59
+ 'A project hook flagged a destructive git command. Ask the user before running it.',
60
+ );
61
+ }
62
+
63
+ if (/\b(?:pkill|killall)\b|\bxargs\s+kill\b/.test(command)) {
64
+ return ask(
65
+ 'This command can stop processes the task does not own. Name the process you started, or use `node .ai.local/scripts/processes.mjs stop`.',
66
+ 'Never mass-kill processes. Stop the recorded pid through processes.mjs; ask before pkill, killall, or xargs kill.',
67
+ );
68
+ }
69
+
70
+ const managerByFile = [
71
+ ['yarn.lock', 'yarn'],
72
+ ['pnpm-lock.yaml', 'pnpm'],
73
+ ['package-lock.json', 'npm'],
74
+ ].find(([file]) => exists(at(file)));
75
+
76
+ let expected = managerByFile?.[1];
77
+ if (!expected && exists(at('package.json'))) {
78
+ try {
79
+ const pkg = JSON.parse(readText(at('package.json')));
80
+ const pm = typeof pkg.packageManager === 'string' ? pkg.packageManager : '';
81
+ expected = pm.split('@')[0] || undefined;
82
+ } catch {
83
+ // Ignore invalid package.json in the hook; the agent can diagnose it later.
84
+ }
85
+ }
86
+
87
+ const used = expected ? command.match(/(^|[;&|]\s*)(npm|yarn|pnpm)\s+/)?.[2] : undefined;
88
+ if (used && used !== expected) {
89
+ return ask(
90
+ `This repository appears to use ${expected}, but the command uses ${used}. Confirm before continuing.`,
91
+ `Use ${expected} for package scripts and installs unless the user explicitly approves ${used}.`,
92
+ );
93
+ }
94
+
95
+ // Only a server-start shaped command is worth probing: the hook must not slow
96
+ // down or interrogate every shell call.
97
+ const explicitPortMatch = command.match(/--port[=\s]+(\d{2,5})|\bPORT=(\d{2,5})/);
98
+ const explicitPort = Number(explicitPortMatch?.[1] || explicitPortMatch?.[2] || 0) || null;
99
+ const startsServer = SERVER_COMMAND ? SERVER_COMMAND.test(command) : false;
100
+ const portsToProbe = startsServer ? (explicitPort ? [explicitPort] : SERVER_PORTS) : [];
101
+
102
+ for (const port of portsToProbe) {
103
+ if (!(await canConnect(port))) continue;
104
+ return ask(
105
+ `Port ${port} is already listening. Reuse the running server, or stop the recorded process before starting another.`,
106
+ `A server may already serve port ${port}. Probe it first, reuse it, or stop it with \`node .ai.local/scripts/processes.mjs stop\`; never start a duplicate.`,
107
+ );
108
+ }
109
+
110
+ return allowed();
111
+ };
112
+
113
+ /** The host answers: Claude's `PreToolUse` envelope, or the neutral decision. */
114
+ const answer = (event, decision) => {
115
+ const claudePreTool = event !== null && event.hook_event_name === 'PreToolUse';
116
+ if (!claudePreTool) {
117
+ process.stdout.write(JSON.stringify(decision));
118
+ } else {
119
+ const verdict = decision.permission === 'ask' || decision.permission === 'deny' ? decision.permission : 'allow';
120
+ const hookSpecificOutput = { hookEventName: 'PreToolUse', permissionDecision: verdict };
121
+ if (decision.user_message && verdict !== 'allow') {
122
+ hookSpecificOutput.permissionDecisionReason = decision.user_message;
123
+ }
124
+ process.stdout.write(JSON.stringify({ hookSpecificOutput }));
125
+ }
126
+ process.exit(0);
127
+ };
128
+
129
+ const main = async () => {
130
+ let event = null;
131
+ try {
132
+ const parsed = JSON.parse(fs.readFileSync(0, 'utf8'));
133
+ event = parsed && typeof parsed === 'object' ? parsed : null;
134
+ } catch {
135
+ event = null;
136
+ }
137
+ answer(event, await evaluate(event));
138
+ };
139
+
140
+ const invokedDirectly = (() => {
141
+ if (process.argv[1] === undefined) return false;
142
+ // Realpath on both sides: `os.tmpdir()` and `/tmp` are symlinks on macOS, so a
143
+ // plain resolve marks a script it cannot start.
144
+ try {
145
+ return fs.realpathSync(process.argv[1]) === fs.realpathSync(fileURLToPath(import.meta.url));
146
+ } catch {
147
+ return path.resolve(process.argv[1]) === path.resolve(fileURLToPath(import.meta.url));
148
+ }
149
+ })();
150
+
151
+ if (invokedDirectly) {
152
+ await main();
153
+ }
@@ -0,0 +1,276 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "source": "presets/cursor/next/rules/*.mdc frontmatter (alwaysApply: true excluded)",
4
+ "rules": [
5
+ {
6
+ "stem": "api-services",
7
+ "globs": [
8
+ "app/src/api/services/**/*.ts"
9
+ ]
10
+ },
11
+ {
12
+ "stem": "architecture-boundaries-ui",
13
+ "globs": [
14
+ "app/src/ui/**/*.tsx",
15
+ "app/src/ui/**/*.ts"
16
+ ]
17
+ },
18
+ {
19
+ "stem": "architecture-boundaries",
20
+ "globs": [
21
+ "app/src/api/**/*",
22
+ "app/src/store/**/*",
23
+ "app/src/types/**/*",
24
+ "app/src/lib/**/*"
25
+ ]
26
+ },
27
+ {
28
+ "stem": "component-catalog-gate",
29
+ "globs": [
30
+ "app/src/ui/**/*",
31
+ "storybook/**/*",
32
+ "stories/**/*"
33
+ ]
34
+ },
35
+ {
36
+ "stem": "css-property-order-stylelint",
37
+ "globs": [
38
+ "app/src/ui/**/*.styles.ts",
39
+ "app/src/ui/**/*.styles.tsx",
40
+ "app/src/ui/**/styles.ts",
41
+ "app/src/ui/**/styles.tsx",
42
+ "app/**/*.css"
43
+ ]
44
+ },
45
+ {
46
+ "stem": "design-tokens-binding",
47
+ "globs": [
48
+ "app/src/ui/**/*.ts",
49
+ "app/src/ui/**/*.tsx",
50
+ "app/src/ui/**/*.css",
51
+ "app/src/styles/**/*.css",
52
+ "app/src/styles/**/*.ts",
53
+ "app/src/styles/**/*.tsx"
54
+ ]
55
+ },
56
+ {
57
+ "stem": "forms-validation",
58
+ "globs": [
59
+ "app/src/**/*Form*.tsx",
60
+ "app/src/**/*Form*.ts",
61
+ "app/src/**/*Modal*.tsx"
62
+ ]
63
+ },
64
+ {
65
+ "stem": "http-client",
66
+ "globs": [
67
+ "app/src/lib/clients/HttpClient/**/*.ts",
68
+ "app/src/api/clients/**/*.ts"
69
+ ]
70
+ },
71
+ {
72
+ "stem": "language-policy",
73
+ "globs": [
74
+ ".ai.local/**/*",
75
+ "AGENTS.md",
76
+ ".cursor/**/*"
77
+ ]
78
+ },
79
+ {
80
+ "stem": "layer-barrel-exports",
81
+ "globs": [
82
+ "app/src/**/index.ts"
83
+ ]
84
+ },
85
+ {
86
+ "stem": "navigation-router-stack",
87
+ "globs": [
88
+ "app/src/app/**/*",
89
+ "app/**/app/**/*",
90
+ "app/src/pages/**/*"
91
+ ]
92
+ },
93
+ {
94
+ "stem": "navigation-router-ui",
95
+ "globs": [
96
+ "app/src/ui/**/*.tsx"
97
+ ]
98
+ },
99
+ {
100
+ "stem": "next-app-router",
101
+ "globs": [
102
+ "app/src/app/**/*",
103
+ "app/**/app/**/*"
104
+ ]
105
+ },
106
+ {
107
+ "stem": "next-static-export",
108
+ "globs": [
109
+ "app/next.config.*",
110
+ "app/src/pages/**/*",
111
+ "app/src/pages/_*.tsx"
112
+ ]
113
+ },
114
+ {
115
+ "stem": "no-props-spread",
116
+ "globs": [
117
+ "app/src/**/*.tsx"
118
+ ]
119
+ },
120
+ {
121
+ "stem": "no-type-assertion-as-import-export",
122
+ "globs": [
123
+ "app/src/api/**/*",
124
+ "app/src/store/**/*",
125
+ "app/src/types/**/*"
126
+ ]
127
+ },
128
+ {
129
+ "stem": "playwright-agents",
130
+ "globs": [
131
+ "app/__tests__/e2e/**/*"
132
+ ]
133
+ },
134
+ {
135
+ "stem": "preset-goals",
136
+ "globs": [
137
+ "packages/ai-rules/presets/**/*",
138
+ "packages/ai-rules/scripts/**/*",
139
+ "packages/ai-rules/docs/**/*"
140
+ ]
141
+ },
142
+ {
143
+ "stem": "preset-layering",
144
+ "globs": [
145
+ "packages/ai-rules/presets/**/*",
146
+ "packages/ai-rules/scripts/**/*",
147
+ "packages/ai-rules/docs/**/*"
148
+ ]
149
+ },
150
+ {
151
+ "stem": "preset-no-cross-stack-leakage",
152
+ "globs": [
153
+ "packages/ai-rules/presets/**/*",
154
+ "packages/ai-rules/scripts/**/*",
155
+ "packages/ai-rules/docs/**/*"
156
+ ]
157
+ },
158
+ {
159
+ "stem": "preset-pr-checklist",
160
+ "globs": [
161
+ "packages/ai-rules/presets/**/*",
162
+ "packages/ai-rules/scripts/**/*",
163
+ "packages/ai-rules/docs/**/*"
164
+ ]
165
+ },
166
+ {
167
+ "stem": "preset-token-budget",
168
+ "globs": [
169
+ "packages/ai-rules/presets/**/*",
170
+ "packages/ai-rules/scripts/**/*",
171
+ "packages/ai-rules/docs/**/*"
172
+ ]
173
+ },
174
+ {
175
+ "stem": "preset-twin-sync",
176
+ "globs": [
177
+ "packages/ai-rules/presets/**/*",
178
+ "packages/ai-rules/scripts/**/*",
179
+ "packages/ai-rules/docs/**/*"
180
+ ]
181
+ },
182
+ {
183
+ "stem": "preset-writing-style",
184
+ "globs": [
185
+ "packages/ai-rules/presets/**/*",
186
+ "packages/ai-rules/scripts/**/*",
187
+ "packages/ai-rules/docs/**/*"
188
+ ]
189
+ },
190
+ {
191
+ "stem": "product-specs-authoring",
192
+ "globs": [
193
+ "docs/specs/**/*"
194
+ ]
195
+ },
196
+ {
197
+ "stem": "product-specs",
198
+ "globs": [
199
+ "docs/specs/**/*"
200
+ ]
201
+ },
202
+ {
203
+ "stem": "public-imports",
204
+ "globs": [
205
+ "app/src/ui/**/*",
206
+ "app/src/store/**/*",
207
+ "app/src/lib/**/*",
208
+ "app/src/types/**/*",
209
+ "app/src/api/**/*"
210
+ ]
211
+ },
212
+ {
213
+ "stem": "react-a11y-coding",
214
+ "globs": [
215
+ "app/src/ui/**/*.tsx",
216
+ "app/src/ui/**/*.ts"
217
+ ]
218
+ },
219
+ {
220
+ "stem": "react-next-anti-hallucination",
221
+ "globs": [
222
+ "app/src/**/*.ts",
223
+ "app/src/**/*.tsx",
224
+ "app/**/*.ts",
225
+ "app/**/*.tsx"
226
+ ]
227
+ },
228
+ {
229
+ "stem": "react-ui",
230
+ "globs": [
231
+ "app/src/ui/**/*.tsx",
232
+ "app/src/ui/**/*.ts"
233
+ ]
234
+ },
235
+ {
236
+ "stem": "security-next",
237
+ "globs": [
238
+ "**/*Auth*.{ts,tsx}",
239
+ "**/*Session*.{ts,tsx}",
240
+ "**/auth*.{ts,tsx}",
241
+ "**/session*.{ts,tsx}",
242
+ "**/.env*",
243
+ "app/**/middleware.ts",
244
+ "app/src/**/*middleware*.{ts,tsx}",
245
+ "app/**/proxy.ts",
246
+ "app/src/**/proxy*.{ts,tsx}",
247
+ "app/src/**/*action*.{ts,tsx}"
248
+ ]
249
+ },
250
+ {
251
+ "stem": "store-rtk",
252
+ "globs": [
253
+ "app/src/store/**/*.ts"
254
+ ]
255
+ },
256
+ {
257
+ "stem": "tests-e2e-structure",
258
+ "globs": [
259
+ "app/__tests__/e2e/**/*"
260
+ ]
261
+ },
262
+ {
263
+ "stem": "tests-unit",
264
+ "globs": [
265
+ "app/__tests__/unit/**/*.spec.{ts,tsx}",
266
+ "app/__tests__/unit/**/*.test.{ts,tsx}"
267
+ ]
268
+ },
269
+ {
270
+ "stem": "types-jsdoc",
271
+ "globs": [
272
+ "app/src/types/**/*.ts"
273
+ ]
274
+ }
275
+ ]
276
+ }
@@ -64,7 +64,7 @@ flowchart TD
64
64
  pipeline["pipeline.json"]
65
65
  step0["steps 0..N"]
66
66
  gate{"humanGates?"}
67
- hook["subagentStop hook"]
67
+ hook["chain hook (run by hand)"]
68
68
  retro["/technical-retro"]
69
69
 
70
70
  task --> router
@@ -217,7 +217,7 @@ Additional states: `blocked` — a step (or a parallel producer) cannot proceed;
217
217
  - The reclaim runs only inside the hook, immediately before a new attempt is activated. Never hand-reclaim an attempt by editing `.ai.local/team/tasks/<slug>` lifecycle files.
218
218
  - In graph mode, a stale attempt on an in-flight step of another agent is reclaimed by that step's own activation or terminal receipt, not by an unrelated step; recovery is a receipt or `/task-continue <slug>`.
219
219
 
220
- On each `subagentStop`, the hook reconciles `status.state` from the completing producer's terminal `artifact-manifest.json` receipt (`completed` \| `changes_requested` \| `validation_failed`) when agents left lifecycle fields untouched. Parent orchestrators must wait for that handoff before invoking the next step.
220
+ No `subagentStop` event exists on this host: after each producer receipt the agent runs `chain-team-phases.sh`, and that run reconciles `status.state` from the completing producer's terminal `artifact-manifest.json` receipt (`completed` \| `changes_requested` \| `validation_failed`) when agents left lifecycle fields untouched. Do not invoke the next step until the run lands that handoff.
221
221
 
222
222
  **A dispatch is not a completion.** When the host hands back a session handle, a job id, or control before the specialist's turn ends, the step is still open: do not dispatch the next step, do not report the step done, and do not run the chain hook until the specialist reports back and the hook records the receipt. A background handle is a start signal only.
223
223
 
@@ -269,12 +269,12 @@ Use Task tool or `/agent-name`. Pass: slug, artifact paths, step `scope` if set.
269
269
  ### Model when invoking (Task)
270
270
 
271
271
  1. Read `steps[i].model` if present; else use the agent’s frontmatter `model` (see `agents/README.md` matrix).
272
- 2. Resolve the tier through `.ai.local/team/model-tiers.json` → `tiers.<tier>` when that file exists. The user approved that map, so passing an explicit model is allowed. Pass the resolved `providerID/modelID` (or `providerID/modelID#variant`) to the Task/subagent tool.
272
+ 2. Resolve the tier through `.ai.local/team/model-tiers.json` → `tiers.<tier>` when that file is an approved map. An empty `tiers` object with an empty `approvedBy` is the unfilled template: omit the model and the session model applies. Once `approvedBy` is set or any tier value is set, the file is the map, so passing an explicit model is allowed. Pass the resolved `providerID/modelID` (or `providerID/modelID#variant`) to the Task/subagent tool.
273
273
  - **`cheap`** → router, analyst, tech-writer, codebase-analyzer, and the review roles `code-reviewer`, `build-verifier`, `api-contract-reviewer`, `mockup-reviewer`. Resolve the provider through `.ai.local/team/model-tiers.json`. Do not write a provider id into the agent file. Pass the mapped id as written; do not append `#high`.
274
274
  - **`standard`** → implementation and the other non-review specialists. `feature-developer` stays on this tier.
275
275
  - **`strong`** → architecture, security, migration, performance. Never downgrade a `strong` step to the parent default, and do not put `mockup-reviewer` on `strong`.
276
- - When `steps[i].model` is omitted and the agent file has no `model`, those four review roles stay `cheap` when `.ai.local/team/model-tiers.json` exists. Without that file, omit the model and the session model applies.
277
- - If a tier is declared but the file has no mapping, **STOP** and report `model-tier-unmapped`; do not silently inherit the parent model.
276
+ - When `steps[i].model` is omitted and the agent file has no `model`, those four review roles stay `cheap` when the map has a `cheap` value. Without the file, or while the template is still empty, omit the model and the session model applies.
277
+ - If a tier is declared, the map is approved, and that tier has no mapping, **STOP** and report `model-tier-unmapped`; do not silently inherit the parent model.
278
278
  3. If the tool does not accept a model (Cursor/Claude adapters), record the resolved tier in the handoff and let the platform pin apply.
279
279
  4. Parallel steps: apply the step-level `model` to **each** agent in the array (or omit → each agent’s own frontmatter).
280
280
  5. The tier never changes the step order, gates, receipts, or retry policy.
@@ -1,57 +1,8 @@
1
1
  # Nuxt 3 stack — OpenCode agent team
2
2
 
3
- Short OpenCode entry. Native discovery: `.opencode/agents/`,
4
- `.opencode/skills/`, `.opencode/commands/`. Rule files under
5
- `.opencode/rules/*.md` are **not** auto-loaded.
3
+ Docs: `docs/OPENCODE.md`.
6
4
 
7
- Root `AGENTS.md` is native always-on. Read it first, then this file.
8
-
9
- ## How to load
10
-
11
- - Essential rules: Read immediately (paths below). Do not preload the catalog.
12
- - Other rules: lazy `Read` `.opencode/rules/<stem>.md` when the task matches.
13
- - Agents: native `@name` / Task from `.opencode/agents/`.
14
- - Commands: native `/task` from `.opencode/commands/`.
15
- - After a producer receipt, run the chain by hand (`projectHooks` is `manual`): `printf '%s\n' '{"status":"completed"}' | TEAM_TASK_SLUG=<slug> bash .opencode/hooks/chain-team-phases.sh`. Agents never write `status.json` / `metrics.json`.
16
-
17
- ## Essential rules (read every turn)
18
-
19
- - `.opencode/rules/nuxt-app-core.md`
20
- - `.opencode/rules/package-manager.md`
21
- - `.opencode/rules/code-quality-and-refactoring.md`
22
- - `.opencode/rules/ai-local-overlay.md`
23
-
24
- Every turn, run `list-ai-local.mjs` from the host hooks directory with the paths this step will touch, then apply the printed `.ai.local/rules/*.md` and
25
- `.ai.local/conventions.md`. Acknowledge `Using .ai.local: <rule-name>`.
26
- Guide: `docs/LOCAL-OVERLAY.md`. These essential rules are a prompt contract.
27
- `nativeProjectRules` is `no-equivalent` — do not claim engine `alwaysApply`.
28
-
29
- See `.opencode/rules/README.md` for the full catalog and loading strategy.
30
-
31
- **Platform docs:** published with the `@bonesofspring/ai-rules` package
32
- (`docs/OPENCODE.md`, `docs/OPENCODE-COMPATIBILITY.md`) — **not** copied into
33
- the consumer repo. Source: https://github.com/bonesofspring/ai-rules
34
-
35
- **Repo-root agents:** see [`AGENTS.md`](../../AGENTS.md) at the project root (cross-tool setup, commands, security, living conventions pointers).
36
-
37
- ## Quick start
38
-
39
- | Task | Where to look |
40
- |------|----------------|
41
- | Any new work task | `/task` → `commands/task.md` + `agent-team-orchestrator.md` (+ `agent-team-intake.md` on-demand) |
42
- | New end-to-end feature | skill `feature-delivery` + `feature-delivery-workflow.md` |
43
- | Stack and layers | `nuxt-app-core.md` |
44
- | At implementation closure | `post-change-lint.md` (**requestable**; `build-verifier` owns the one full run; do not run it after each edit) |
45
- | Code review MR | skill `code-review` + `code-review-mr.md` |
46
- | Security (auth/forms/env) | `security-nuxt.md` + agent `security-reviewer` |
47
- | Technical retro | `/technical-retro` + skill `technical-retro` |
48
-
49
- ## When to use `/task`
50
-
51
- - Implementation, bugfix, migration, tests, MR review, CI-fix — **prefer `/task`**.
52
- - Simple one-liner with no architecture risk — may skip the pipeline if the user explicitly asks.
53
- - “How does X work?” questions — agent `codebase-analyzer` (explain-as-is) or answer without `/task`.
54
-
55
- ## Pipeline routing
56
-
57
- Intent detection, profiles (`full` / `standard` / `light`), and default steps — **only** in `agents/task-router.md`. Schema and examples — `agents/README.md`.
5
+ - Discovery: `.opencode/{agents,skills,commands}/` native; the engine never auto-loads `.opencode/rules/*.md` — `rule-attach` attaches a glob-matched rule once per `(sessionID, stem)` (stack globs, `bash`/`shell`).
6
+ - Essentials: `opencode.json` `instructions` — nuxt-app-core, package-manager, code-quality-and-refactoring, ai-local-overlay; `nativeProjectRules` is `no-equivalent`.
7
+ - Overlay: `node .opencode/hooks/list-ai-local.mjs <paths>` → `.ai.local/rules/*.md`, `.ai.local/conventions.md`, ack `Using .ai.local: <rule-name>` (`docs/LOCAL-OVERLAY.md`).
8
+ - Chain: `projectHooks` is `manual` — `printf '%s\n' '{"status":"completed"}' | TEAM_TASK_SLUG=<slug> bash .opencode/hooks/chain-team-phases.sh`.