@bonesofspring/ai-rules 0.2.71 → 0.2.73

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 (660) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +7 -6
  3. package/bin/lib/ai-local-drift.js +4 -4
  4. package/bin/lib/engine-scripts.js +11 -0
  5. package/bin/lib/seed-ai-local-team.js +9 -5
  6. package/docs/OPENCODE.md +4 -2
  7. package/docs/TEAM-DB.md +27 -9
  8. package/package.json +1 -1
  9. package/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs +201 -0
  10. package/presets/_shared/ai-local/scripts/incidents.mjs +452 -0
  11. package/presets/_shared/ai-local/scripts/manifest.mjs +19 -1
  12. package/presets/_shared/ai-local/scripts/record-usage.mjs +163 -0
  13. package/presets/_shared/ai-local/scripts/team-db-project.mjs +75 -11
  14. package/presets/_shared/ai-local/scripts/team-db.mjs +125 -40
  15. package/presets/_shared/ai-local/scripts/tracker-planned-drain.mjs +335 -0
  16. package/presets/_shared/ai-local/scripts/verification.mjs +374 -0
  17. package/presets/_shared/core/agent-team/agent-artifact-contracts.md +9 -0
  18. package/presets/_shared/core/agent-team/agent-task-metrics.md +61 -1
  19. package/presets/_shared/core/agent-team/agent-team-intake.md +2 -2
  20. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +5 -4
  21. package/presets/_shared/core/agent-team/incident-registry.md +47 -0
  22. package/presets/_shared/core/architecture/feature-delivery-workflow.md +1 -1
  23. package/presets/_shared/core/quality/self-review-and-context-hygiene.md +1 -0
  24. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +108 -1
  25. package/presets/claude/android-kotlin/agents/build-verifier.md +1 -1
  26. package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -1
  27. package/presets/claude/android-kotlin/agents/debugger.md +1 -1
  28. package/presets/claude/android-kotlin/agents/feature-developer.md +1 -1
  29. package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
  30. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +108 -1
  31. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-intake.md +2 -2
  32. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  33. package/presets/claude/go/agents/build-verifier.md +1 -1
  34. package/presets/claude/go/agents/code-reviewer.md +1 -1
  35. package/presets/claude/go/agents/debugger.md +1 -1
  36. package/presets/claude/go/agents/feature-developer.md +1 -1
  37. package/presets/claude/go/agents/task-analyst.md +1 -1
  38. package/presets/claude/go/hooks/chain-team-phases.sh +108 -1
  39. package/presets/claude/go/rules/architecture/feature-delivery.md +1 -1
  40. package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +2 -2
  41. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  42. package/presets/claude/ios-swift/agents/build-verifier.md +1 -1
  43. package/presets/claude/ios-swift/agents/code-reviewer.md +1 -1
  44. package/presets/claude/ios-swift/agents/debugger.md +1 -1
  45. package/presets/claude/ios-swift/agents/feature-developer.md +1 -1
  46. package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
  47. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +108 -1
  48. package/presets/claude/ios-swift/rules/architecture/feature-delivery.md +1 -1
  49. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +2 -2
  50. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  51. package/presets/claude/java/agents/build-verifier.md +1 -1
  52. package/presets/claude/java/agents/code-reviewer.md +1 -1
  53. package/presets/claude/java/agents/debugger.md +1 -1
  54. package/presets/claude/java/agents/feature-developer.md +1 -1
  55. package/presets/claude/java/agents/task-analyst.md +1 -1
  56. package/presets/claude/java/hooks/chain-team-phases.sh +108 -1
  57. package/presets/claude/java/rules/architecture/feature-delivery.md +1 -1
  58. package/presets/claude/java/rules/tooling-and-review/agent-team-intake.md +2 -2
  59. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  60. package/presets/claude/mcp-ts/agents/build-verifier.md +1 -1
  61. package/presets/claude/mcp-ts/agents/feature-developer.md +1 -1
  62. package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
  63. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +108 -1
  64. package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +1 -1
  65. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-intake.md +2 -2
  66. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  67. package/presets/claude/mol/agents/build-verifier.md +1 -1
  68. package/presets/claude/mol/agents/code-reviewer.md +1 -1
  69. package/presets/claude/mol/agents/debugger.md +1 -1
  70. package/presets/claude/mol/agents/feature-developer.md +1 -1
  71. package/presets/claude/mol/agents/task-analyst.md +1 -1
  72. package/presets/claude/mol/hooks/chain-team-phases.sh +108 -1
  73. package/presets/claude/mol/rules/architecture/feature-delivery-workflow.md +1 -1
  74. package/presets/claude/mol/rules/tooling-and-review/agent-team-intake.md +2 -2
  75. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  76. package/presets/claude/next/REPO_AGENTS.md +16 -0
  77. package/presets/claude/next/agents/README.md +4 -3
  78. package/presets/claude/next/agents/accessibility-reviewer.md +4 -1
  79. package/presets/claude/next/agents/api-contract-reviewer.md +6 -3
  80. package/presets/claude/next/agents/build-verifier.md +6 -3
  81. package/presets/claude/next/agents/ci-investigator.md +1 -1
  82. package/presets/claude/next/agents/code-reviewer.md +7 -4
  83. package/presets/claude/next/agents/codebase-analyzer.md +4 -1
  84. package/presets/claude/next/agents/debugger.md +2 -2
  85. package/presets/claude/next/agents/feature-developer.md +2 -2
  86. package/presets/claude/next/agents/migration-specialist.md +4 -1
  87. package/presets/claude/next/agents/mockup-reviewer.md +5 -2
  88. package/presets/claude/next/agents/openspec-author.md +4 -1
  89. package/presets/claude/next/agents/performance-auditor.md +4 -1
  90. package/presets/claude/next/agents/playwright-test-generator.md +5 -2
  91. package/presets/claude/next/agents/playwright-test-healer.md +5 -2
  92. package/presets/claude/next/agents/playwright-test-planner.md +5 -2
  93. package/presets/claude/next/agents/qa-tester.md +5 -2
  94. package/presets/claude/next/agents/security-reviewer.md +4 -1
  95. package/presets/claude/next/agents/solution-architect.md +4 -1
  96. package/presets/claude/next/agents/task-analyst.md +5 -2
  97. package/presets/claude/next/agents/task-router.md +8 -5
  98. package/presets/claude/next/agents/tech-writer.md +4 -1
  99. package/presets/claude/next/agents/unit-test-generator.md +5 -2
  100. package/presets/claude/next/agents/unit-test-healer.md +5 -2
  101. package/presets/claude/next/agents/unit-test-planner.md +5 -2
  102. package/presets/claude/next/ai-local/conventions.md +26 -1
  103. package/presets/claude/next/hooks/chain-team-phases.sh +108 -1
  104. package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +2 -2
  105. package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +2 -2
  106. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  107. package/presets/claude/nuxt/agents/build-verifier.md +1 -1
  108. package/presets/claude/nuxt/agents/code-reviewer.md +1 -1
  109. package/presets/claude/nuxt/agents/debugger.md +1 -1
  110. package/presets/claude/nuxt/agents/feature-developer.md +1 -1
  111. package/presets/claude/nuxt/agents/task-analyst.md +1 -1
  112. package/presets/claude/nuxt/hooks/chain-team-phases.sh +108 -1
  113. package/presets/claude/nuxt/rules/architecture/feature-delivery-workflow.md +1 -1
  114. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-intake.md +2 -2
  115. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  116. package/presets/claude/php-hexagonal/agents/build-verifier.md +1 -1
  117. package/presets/claude/php-hexagonal/agents/code-reviewer.md +1 -1
  118. package/presets/claude/php-hexagonal/agents/debugger.md +1 -1
  119. package/presets/claude/php-hexagonal/agents/feature-developer.md +1 -1
  120. package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
  121. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +108 -1
  122. package/presets/claude/php-hexagonal/rules/architecture/feature-delivery.md +1 -1
  123. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-intake.md +2 -2
  124. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  125. package/presets/claude/php-laravel/agents/build-verifier.md +1 -1
  126. package/presets/claude/php-laravel/agents/code-reviewer.md +1 -1
  127. package/presets/claude/php-laravel/agents/debugger.md +1 -1
  128. package/presets/claude/php-laravel/agents/feature-developer.md +1 -1
  129. package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
  130. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +108 -1
  131. package/presets/claude/php-laravel/rules/architecture/feature-delivery.md +1 -1
  132. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-intake.md +2 -2
  133. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  134. package/presets/claude/svelte/agents/build-verifier.md +1 -1
  135. package/presets/claude/svelte/agents/code-reviewer.md +1 -1
  136. package/presets/claude/svelte/agents/debugger.md +1 -1
  137. package/presets/claude/svelte/agents/feature-developer.md +1 -1
  138. package/presets/claude/svelte/agents/task-analyst.md +1 -1
  139. package/presets/claude/svelte/hooks/chain-team-phases.sh +108 -1
  140. package/presets/claude/svelte/rules/architecture/feature-delivery-workflow.md +1 -1
  141. package/presets/claude/svelte/rules/tooling-and-review/agent-team-intake.md +2 -2
  142. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +5 -4
  143. package/presets/cursor/android-kotlin/agents/build-verifier.md +1 -1
  144. package/presets/cursor/android-kotlin/agents/code-reviewer.md +1 -1
  145. package/presets/cursor/android-kotlin/agents/debugger.md +1 -1
  146. package/presets/cursor/android-kotlin/agents/feature-developer.md +1 -1
  147. package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
  148. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +108 -1
  149. package/presets/cursor/android-kotlin/rules/agent-team-intake.mdc +2 -2
  150. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
  151. package/presets/cursor/go/agents/build-verifier.md +1 -1
  152. package/presets/cursor/go/agents/code-reviewer.md +1 -1
  153. package/presets/cursor/go/agents/debugger.md +1 -1
  154. package/presets/cursor/go/agents/feature-developer.md +1 -1
  155. package/presets/cursor/go/agents/task-analyst.md +1 -1
  156. package/presets/cursor/go/hooks/chain-team-phases.sh +108 -1
  157. package/presets/cursor/go/rules/agent-team-intake.mdc +2 -2
  158. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
  159. package/presets/cursor/ios-swift/agents/build-verifier.md +1 -1
  160. package/presets/cursor/ios-swift/agents/code-reviewer.md +1 -1
  161. package/presets/cursor/ios-swift/agents/debugger.md +1 -1
  162. package/presets/cursor/ios-swift/agents/feature-developer.md +1 -1
  163. package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
  164. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +108 -1
  165. package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +2 -2
  166. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
  167. package/presets/cursor/java/agents/build-verifier.md +1 -1
  168. package/presets/cursor/java/agents/code-reviewer.md +1 -1
  169. package/presets/cursor/java/agents/debugger.md +1 -1
  170. package/presets/cursor/java/agents/feature-developer.md +1 -1
  171. package/presets/cursor/java/agents/task-analyst.md +1 -1
  172. package/presets/cursor/java/hooks/chain-team-phases.sh +108 -1
  173. package/presets/cursor/java/rules/agent-team-intake.mdc +2 -2
  174. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
  175. package/presets/cursor/mcp-ts/agents/build-verifier.md +1 -1
  176. package/presets/cursor/mcp-ts/agents/feature-developer.md +1 -1
  177. package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
  178. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +108 -1
  179. package/presets/cursor/mcp-ts/rules/agent-team-intake.mdc +2 -2
  180. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
  181. package/presets/cursor/mol/agents/build-verifier.md +1 -1
  182. package/presets/cursor/mol/agents/code-reviewer.md +1 -1
  183. package/presets/cursor/mol/agents/debugger.md +1 -1
  184. package/presets/cursor/mol/agents/feature-developer.md +1 -1
  185. package/presets/cursor/mol/agents/task-analyst.md +1 -1
  186. package/presets/cursor/mol/hooks/chain-team-phases.sh +108 -1
  187. package/presets/cursor/mol/rules/agent-team-intake.mdc +2 -2
  188. package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +1 -1
  189. package/presets/cursor/next/AGENTS.md +2 -1
  190. package/presets/cursor/next/REPO_AGENTS.md +16 -0
  191. package/presets/cursor/next/agents/README.md +4 -3
  192. package/presets/cursor/next/agents/api-contract-reviewer.md +1 -1
  193. package/presets/cursor/next/agents/build-verifier.md +1 -1
  194. package/presets/cursor/next/agents/code-reviewer.md +1 -1
  195. package/presets/cursor/next/agents/debugger.md +1 -1
  196. package/presets/cursor/next/agents/feature-developer.md +1 -1
  197. package/presets/cursor/next/agents/mockup-reviewer.md +1 -1
  198. package/presets/cursor/next/agents/task-analyst.md +1 -1
  199. package/presets/cursor/next/agents/task-router.md +4 -4
  200. package/presets/cursor/next/ai-local/conventions.md +6 -1
  201. package/presets/cursor/next/hooks/chain-team-phases.sh +108 -1
  202. package/presets/cursor/next/rules/agent-team-intake.mdc +2 -2
  203. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
  204. package/presets/cursor/next/rules/feature-delivery-workflow.mdc +1 -1
  205. package/presets/cursor/nuxt/agents/build-verifier.md +1 -1
  206. package/presets/cursor/nuxt/agents/code-reviewer.md +1 -1
  207. package/presets/cursor/nuxt/agents/debugger.md +1 -1
  208. package/presets/cursor/nuxt/agents/feature-developer.md +1 -1
  209. package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
  210. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +108 -1
  211. package/presets/cursor/nuxt/rules/agent-team-intake.mdc +2 -2
  212. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
  213. package/presets/cursor/php-hexagonal/agents/build-verifier.md +1 -1
  214. package/presets/cursor/php-hexagonal/agents/code-reviewer.md +1 -1
  215. package/presets/cursor/php-hexagonal/agents/debugger.md +1 -1
  216. package/presets/cursor/php-hexagonal/agents/feature-developer.md +1 -1
  217. package/presets/cursor/php-hexagonal/agents/task-analyst.md +1 -1
  218. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +108 -1
  219. package/presets/cursor/php-hexagonal/rules/agent-team-intake.mdc +2 -2
  220. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
  221. package/presets/cursor/php-laravel/agents/build-verifier.md +1 -1
  222. package/presets/cursor/php-laravel/agents/code-reviewer.md +1 -1
  223. package/presets/cursor/php-laravel/agents/debugger.md +1 -1
  224. package/presets/cursor/php-laravel/agents/feature-developer.md +1 -1
  225. package/presets/cursor/php-laravel/agents/task-analyst.md +1 -1
  226. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +108 -1
  227. package/presets/cursor/php-laravel/rules/agent-team-intake.mdc +2 -2
  228. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
  229. package/presets/cursor/svelte/agents/build-verifier.md +1 -1
  230. package/presets/cursor/svelte/agents/code-reviewer.md +1 -1
  231. package/presets/cursor/svelte/agents/debugger.md +1 -1
  232. package/presets/cursor/svelte/agents/feature-developer.md +1 -1
  233. package/presets/cursor/svelte/agents/task-analyst.md +1 -1
  234. package/presets/cursor/svelte/hooks/chain-team-phases.sh +108 -1
  235. package/presets/cursor/svelte/rules/agent-team-intake.mdc +2 -2
  236. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
  237. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  238. package/presets/mavis/android-kotlin/agents/README.md +3 -3
  239. package/presets/mavis/android-kotlin/agents/build-verifier.md +1 -1
  240. package/presets/mavis/android-kotlin/agents/code-reviewer.md +1 -1
  241. package/presets/mavis/android-kotlin/agents/debugger.md +1 -1
  242. package/presets/mavis/android-kotlin/agents/feature-developer.md +1 -1
  243. package/presets/mavis/android-kotlin/agents/task-analyst.md +1 -1
  244. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +108 -1
  245. package/presets/mavis/android-kotlin/rules/agent-team-intake.md +2 -2
  246. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +5 -4
  247. package/presets/mavis/go/adapter-map.json +1 -1
  248. package/presets/mavis/go/agents/README.md +2 -2
  249. package/presets/mavis/go/agents/build-verifier.md +1 -1
  250. package/presets/mavis/go/agents/code-reviewer.md +1 -1
  251. package/presets/mavis/go/agents/debugger.md +1 -1
  252. package/presets/mavis/go/agents/feature-developer.md +1 -1
  253. package/presets/mavis/go/agents/task-analyst.md +1 -1
  254. package/presets/mavis/go/hooks/chain-team-phases.sh +108 -1
  255. package/presets/mavis/go/rules/agent-team-intake.md +2 -2
  256. package/presets/mavis/go/rules/agent-team-orchestrator.md +5 -4
  257. package/presets/mavis/go/rules/feature-delivery-workflow.md +1 -1
  258. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  259. package/presets/mavis/ios-swift/agents/README.md +3 -3
  260. package/presets/mavis/ios-swift/agents/build-verifier.md +1 -1
  261. package/presets/mavis/ios-swift/agents/code-reviewer.md +1 -1
  262. package/presets/mavis/ios-swift/agents/debugger.md +1 -1
  263. package/presets/mavis/ios-swift/agents/feature-developer.md +1 -1
  264. package/presets/mavis/ios-swift/agents/task-analyst.md +1 -1
  265. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +108 -1
  266. package/presets/mavis/ios-swift/rules/agent-team-intake.md +2 -2
  267. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +5 -4
  268. package/presets/mavis/ios-swift/rules/feature-delivery-workflow.md +1 -1
  269. package/presets/mavis/java/adapter-map.json +1 -1
  270. package/presets/mavis/java/agents/README.md +2 -2
  271. package/presets/mavis/java/agents/build-verifier.md +1 -1
  272. package/presets/mavis/java/agents/code-reviewer.md +1 -1
  273. package/presets/mavis/java/agents/debugger.md +1 -1
  274. package/presets/mavis/java/agents/feature-developer.md +1 -1
  275. package/presets/mavis/java/agents/task-analyst.md +1 -1
  276. package/presets/mavis/java/hooks/chain-team-phases.sh +108 -1
  277. package/presets/mavis/java/rules/agent-team-intake.md +2 -2
  278. package/presets/mavis/java/rules/agent-team-orchestrator.md +5 -4
  279. package/presets/mavis/java/rules/feature-delivery-workflow.md +1 -1
  280. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  281. package/presets/mavis/mcp-ts/agents/README.md +1 -1
  282. package/presets/mavis/mcp-ts/agents/build-verifier.md +1 -1
  283. package/presets/mavis/mcp-ts/agents/feature-developer.md +1 -1
  284. package/presets/mavis/mcp-ts/agents/task-analyst.md +1 -1
  285. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +108 -1
  286. package/presets/mavis/mcp-ts/rules/agent-team-intake.md +2 -2
  287. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +5 -4
  288. package/presets/mavis/mcp-ts/rules/feature-delivery-workflow.md +1 -1
  289. package/presets/mavis/mol/adapter-map.json +1 -1
  290. package/presets/mavis/mol/agents/README.md +3 -3
  291. package/presets/mavis/mol/agents/build-verifier.md +1 -1
  292. package/presets/mavis/mol/agents/code-reviewer.md +1 -1
  293. package/presets/mavis/mol/agents/debugger.md +1 -1
  294. package/presets/mavis/mol/agents/feature-developer.md +1 -1
  295. package/presets/mavis/mol/agents/task-analyst.md +1 -1
  296. package/presets/mavis/mol/hooks/chain-team-phases.sh +108 -1
  297. package/presets/mavis/mol/rules/agent-team-intake.md +2 -2
  298. package/presets/mavis/mol/rules/agent-team-orchestrator.md +5 -4
  299. package/presets/mavis/mol/rules/feature-delivery-workflow.md +1 -1
  300. package/presets/mavis/next/MAVIS.md +2 -1
  301. package/presets/mavis/next/REPO_AGENTS.md +16 -0
  302. package/presets/mavis/next/adapter-map.json +1 -1
  303. package/presets/mavis/next/agents/README.md +3 -3
  304. package/presets/mavis/next/agents/accessibility-reviewer.md +4 -1
  305. package/presets/mavis/next/agents/api-contract-reviewer.md +5 -2
  306. package/presets/mavis/next/agents/build-verifier.md +6 -3
  307. package/presets/mavis/next/agents/ci-investigator.md +1 -1
  308. package/presets/mavis/next/agents/code-reviewer.md +7 -4
  309. package/presets/mavis/next/agents/codebase-analyzer.md +4 -1
  310. package/presets/mavis/next/agents/debugger.md +2 -2
  311. package/presets/mavis/next/agents/feature-developer.md +2 -2
  312. package/presets/mavis/next/agents/migration-specialist.md +4 -1
  313. package/presets/mavis/next/agents/mockup-reviewer.md +4 -1
  314. package/presets/mavis/next/agents/openspec-author.md +4 -1
  315. package/presets/mavis/next/agents/performance-auditor.md +4 -1
  316. package/presets/mavis/next/agents/playwright-test-generator.md +5 -2
  317. package/presets/mavis/next/agents/playwright-test-healer.md +5 -2
  318. package/presets/mavis/next/agents/playwright-test-planner.md +5 -2
  319. package/presets/mavis/next/agents/qa-tester.md +5 -2
  320. package/presets/mavis/next/agents/security-reviewer.md +4 -1
  321. package/presets/mavis/next/agents/solution-architect.md +4 -1
  322. package/presets/mavis/next/agents/task-analyst.md +5 -2
  323. package/presets/mavis/next/agents/task-router.md +8 -5
  324. package/presets/mavis/next/agents/tech-writer.md +4 -1
  325. package/presets/mavis/next/agents/unit-test-generator.md +5 -2
  326. package/presets/mavis/next/agents/unit-test-healer.md +5 -2
  327. package/presets/mavis/next/agents/unit-test-planner.md +5 -2
  328. package/presets/mavis/next/ai-local/conventions.md +6 -1
  329. package/presets/mavis/next/hooks/chain-team-phases.sh +108 -1
  330. package/presets/mavis/next/rules/agent-team-intake.md +2 -2
  331. package/presets/mavis/next/rules/agent-team-orchestrator.md +5 -4
  332. package/presets/mavis/next/rules/feature-delivery-workflow.md +2 -2
  333. package/presets/mavis/nuxt/adapter-map.json +1 -1
  334. package/presets/mavis/nuxt/agents/README.md +3 -3
  335. package/presets/mavis/nuxt/agents/build-verifier.md +1 -1
  336. package/presets/mavis/nuxt/agents/code-reviewer.md +1 -1
  337. package/presets/mavis/nuxt/agents/debugger.md +1 -1
  338. package/presets/mavis/nuxt/agents/feature-developer.md +1 -1
  339. package/presets/mavis/nuxt/agents/task-analyst.md +1 -1
  340. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +108 -1
  341. package/presets/mavis/nuxt/rules/agent-team-intake.md +2 -2
  342. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +5 -4
  343. package/presets/mavis/nuxt/rules/feature-delivery-workflow.md +1 -1
  344. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  345. package/presets/mavis/php-hexagonal/agents/README.md +2 -2
  346. package/presets/mavis/php-hexagonal/agents/build-verifier.md +1 -1
  347. package/presets/mavis/php-hexagonal/agents/code-reviewer.md +1 -1
  348. package/presets/mavis/php-hexagonal/agents/debugger.md +1 -1
  349. package/presets/mavis/php-hexagonal/agents/feature-developer.md +1 -1
  350. package/presets/mavis/php-hexagonal/agents/task-analyst.md +1 -1
  351. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +108 -1
  352. package/presets/mavis/php-hexagonal/rules/agent-team-intake.md +2 -2
  353. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +5 -4
  354. package/presets/mavis/php-hexagonal/rules/feature-delivery-workflow.md +1 -1
  355. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  356. package/presets/mavis/php-laravel/agents/README.md +2 -2
  357. package/presets/mavis/php-laravel/agents/build-verifier.md +1 -1
  358. package/presets/mavis/php-laravel/agents/code-reviewer.md +1 -1
  359. package/presets/mavis/php-laravel/agents/debugger.md +1 -1
  360. package/presets/mavis/php-laravel/agents/feature-developer.md +1 -1
  361. package/presets/mavis/php-laravel/agents/task-analyst.md +1 -1
  362. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +108 -1
  363. package/presets/mavis/php-laravel/rules/agent-team-intake.md +2 -2
  364. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +5 -4
  365. package/presets/mavis/php-laravel/rules/feature-delivery-workflow.md +1 -1
  366. package/presets/mavis/svelte/adapter-map.json +1 -1
  367. package/presets/mavis/svelte/agents/README.md +3 -3
  368. package/presets/mavis/svelte/agents/build-verifier.md +1 -1
  369. package/presets/mavis/svelte/agents/code-reviewer.md +1 -1
  370. package/presets/mavis/svelte/agents/debugger.md +1 -1
  371. package/presets/mavis/svelte/agents/feature-developer.md +1 -1
  372. package/presets/mavis/svelte/agents/task-analyst.md +1 -1
  373. package/presets/mavis/svelte/hooks/chain-team-phases.sh +108 -1
  374. package/presets/mavis/svelte/rules/agent-team-intake.md +2 -2
  375. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +5 -4
  376. package/presets/mavis/svelte/rules/feature-delivery-workflow.md +1 -1
  377. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  378. package/presets/opencode/android-kotlin/agents/README.md +4 -4
  379. package/presets/opencode/android-kotlin/agents/build-verifier.md +1 -1
  380. package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -1
  381. package/presets/opencode/android-kotlin/agents/debugger.md +1 -1
  382. package/presets/opencode/android-kotlin/agents/feature-developer.md +1 -1
  383. package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
  384. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +108 -1
  385. package/presets/opencode/android-kotlin/rules/agent-team-intake.md +2 -2
  386. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +5 -4
  387. package/presets/opencode/go/adapter-map.json +1 -1
  388. package/presets/opencode/go/agents/README.md +3 -3
  389. package/presets/opencode/go/agents/build-verifier.md +1 -1
  390. package/presets/opencode/go/agents/code-reviewer.md +1 -1
  391. package/presets/opencode/go/agents/debugger.md +1 -1
  392. package/presets/opencode/go/agents/feature-developer.md +1 -1
  393. package/presets/opencode/go/agents/task-analyst.md +1 -1
  394. package/presets/opencode/go/hooks/chain-team-phases.sh +108 -1
  395. package/presets/opencode/go/rules/agent-team-intake.md +2 -2
  396. package/presets/opencode/go/rules/agent-team-orchestrator.md +5 -4
  397. package/presets/opencode/go/rules/feature-delivery-workflow.md +1 -1
  398. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  399. package/presets/opencode/ios-swift/agents/README.md +4 -4
  400. package/presets/opencode/ios-swift/agents/build-verifier.md +1 -1
  401. package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -1
  402. package/presets/opencode/ios-swift/agents/debugger.md +1 -1
  403. package/presets/opencode/ios-swift/agents/feature-developer.md +1 -1
  404. package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
  405. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +108 -1
  406. package/presets/opencode/ios-swift/rules/agent-team-intake.md +2 -2
  407. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +5 -4
  408. package/presets/opencode/ios-swift/rules/feature-delivery-workflow.md +1 -1
  409. package/presets/opencode/java/adapter-map.json +1 -1
  410. package/presets/opencode/java/agents/README.md +3 -3
  411. package/presets/opencode/java/agents/build-verifier.md +1 -1
  412. package/presets/opencode/java/agents/code-reviewer.md +1 -1
  413. package/presets/opencode/java/agents/debugger.md +1 -1
  414. package/presets/opencode/java/agents/feature-developer.md +1 -1
  415. package/presets/opencode/java/agents/task-analyst.md +1 -1
  416. package/presets/opencode/java/hooks/chain-team-phases.sh +108 -1
  417. package/presets/opencode/java/rules/agent-team-intake.md +2 -2
  418. package/presets/opencode/java/rules/agent-team-orchestrator.md +5 -4
  419. package/presets/opencode/java/rules/feature-delivery-workflow.md +1 -1
  420. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  421. package/presets/opencode/mcp-ts/agents/README.md +2 -2
  422. package/presets/opencode/mcp-ts/agents/build-verifier.md +1 -1
  423. package/presets/opencode/mcp-ts/agents/feature-developer.md +1 -1
  424. package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
  425. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +108 -1
  426. package/presets/opencode/mcp-ts/rules/agent-team-intake.md +2 -2
  427. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +5 -4
  428. package/presets/opencode/mcp-ts/rules/feature-delivery-workflow.md +1 -1
  429. package/presets/opencode/mol/adapter-map.json +1 -1
  430. package/presets/opencode/mol/agents/README.md +4 -4
  431. package/presets/opencode/mol/agents/build-verifier.md +1 -1
  432. package/presets/opencode/mol/agents/code-reviewer.md +1 -1
  433. package/presets/opencode/mol/agents/debugger.md +1 -1
  434. package/presets/opencode/mol/agents/feature-developer.md +1 -1
  435. package/presets/opencode/mol/agents/task-analyst.md +1 -1
  436. package/presets/opencode/mol/hooks/chain-team-phases.sh +108 -1
  437. package/presets/opencode/mol/rules/agent-team-intake.md +2 -2
  438. package/presets/opencode/mol/rules/agent-team-orchestrator.md +5 -4
  439. package/presets/opencode/mol/rules/feature-delivery-workflow.md +1 -1
  440. package/presets/opencode/next/OPENCODE.md +2 -1
  441. package/presets/opencode/next/REPO_AGENTS.md +16 -0
  442. package/presets/opencode/next/adapter-map.json +1 -1
  443. package/presets/opencode/next/agents/README.md +4 -4
  444. package/presets/opencode/next/agents/accessibility-reviewer.md +4 -1
  445. package/presets/opencode/next/agents/api-contract-reviewer.md +5 -2
  446. package/presets/opencode/next/agents/build-verifier.md +6 -3
  447. package/presets/opencode/next/agents/ci-investigator.md +1 -1
  448. package/presets/opencode/next/agents/code-reviewer.md +7 -4
  449. package/presets/opencode/next/agents/codebase-analyzer.md +4 -1
  450. package/presets/opencode/next/agents/debugger.md +2 -2
  451. package/presets/opencode/next/agents/feature-developer.md +2 -2
  452. package/presets/opencode/next/agents/migration-specialist.md +4 -1
  453. package/presets/opencode/next/agents/mockup-reviewer.md +4 -1
  454. package/presets/opencode/next/agents/openspec-author.md +4 -1
  455. package/presets/opencode/next/agents/performance-auditor.md +4 -1
  456. package/presets/opencode/next/agents/playwright-test-generator.md +5 -2
  457. package/presets/opencode/next/agents/playwright-test-healer.md +5 -2
  458. package/presets/opencode/next/agents/playwright-test-planner.md +5 -2
  459. package/presets/opencode/next/agents/qa-tester.md +5 -2
  460. package/presets/opencode/next/agents/security-reviewer.md +4 -1
  461. package/presets/opencode/next/agents/solution-architect.md +4 -1
  462. package/presets/opencode/next/agents/task-analyst.md +5 -2
  463. package/presets/opencode/next/agents/task-router.md +8 -5
  464. package/presets/opencode/next/agents/tech-writer.md +4 -1
  465. package/presets/opencode/next/agents/unit-test-generator.md +5 -2
  466. package/presets/opencode/next/agents/unit-test-healer.md +5 -2
  467. package/presets/opencode/next/agents/unit-test-planner.md +5 -2
  468. package/presets/opencode/next/ai-local/conventions.md +6 -1
  469. package/presets/opencode/next/hooks/chain-team-phases.sh +108 -1
  470. package/presets/opencode/next/rules/agent-team-intake.md +2 -2
  471. package/presets/opencode/next/rules/agent-team-orchestrator.md +5 -4
  472. package/presets/opencode/next/rules/feature-delivery-workflow.md +2 -2
  473. package/presets/opencode/nuxt/adapter-map.json +1 -1
  474. package/presets/opencode/nuxt/agents/README.md +4 -4
  475. package/presets/opencode/nuxt/agents/build-verifier.md +1 -1
  476. package/presets/opencode/nuxt/agents/code-reviewer.md +1 -1
  477. package/presets/opencode/nuxt/agents/debugger.md +1 -1
  478. package/presets/opencode/nuxt/agents/feature-developer.md +1 -1
  479. package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
  480. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +108 -1
  481. package/presets/opencode/nuxt/rules/agent-team-intake.md +2 -2
  482. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +5 -4
  483. package/presets/opencode/nuxt/rules/feature-delivery-workflow.md +1 -1
  484. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  485. package/presets/opencode/php-hexagonal/agents/README.md +3 -3
  486. package/presets/opencode/php-hexagonal/agents/build-verifier.md +1 -1
  487. package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -1
  488. package/presets/opencode/php-hexagonal/agents/debugger.md +1 -1
  489. package/presets/opencode/php-hexagonal/agents/feature-developer.md +1 -1
  490. package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
  491. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +108 -1
  492. package/presets/opencode/php-hexagonal/rules/agent-team-intake.md +2 -2
  493. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +5 -4
  494. package/presets/opencode/php-hexagonal/rules/feature-delivery-workflow.md +1 -1
  495. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  496. package/presets/opencode/php-laravel/agents/README.md +3 -3
  497. package/presets/opencode/php-laravel/agents/build-verifier.md +1 -1
  498. package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -1
  499. package/presets/opencode/php-laravel/agents/debugger.md +1 -1
  500. package/presets/opencode/php-laravel/agents/feature-developer.md +1 -1
  501. package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
  502. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +108 -1
  503. package/presets/opencode/php-laravel/rules/agent-team-intake.md +2 -2
  504. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +5 -4
  505. package/presets/opencode/php-laravel/rules/feature-delivery-workflow.md +1 -1
  506. package/presets/opencode/plugins/output-guard/README.md +25 -6
  507. package/presets/opencode/plugins/output-guard/index.ts +27 -9
  508. package/presets/opencode/plugins/output-guard/rewrite.ts +113 -4
  509. package/presets/opencode/svelte/adapter-map.json +1 -1
  510. package/presets/opencode/svelte/agents/README.md +4 -4
  511. package/presets/opencode/svelte/agents/build-verifier.md +1 -1
  512. package/presets/opencode/svelte/agents/code-reviewer.md +1 -1
  513. package/presets/opencode/svelte/agents/debugger.md +1 -1
  514. package/presets/opencode/svelte/agents/feature-developer.md +1 -1
  515. package/presets/opencode/svelte/agents/task-analyst.md +1 -1
  516. package/presets/opencode/svelte/hooks/chain-team-phases.sh +108 -1
  517. package/presets/opencode/svelte/rules/agent-team-intake.md +2 -2
  518. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +5 -4
  519. package/presets/opencode/svelte/rules/feature-delivery-workflow.md +1 -1
  520. package/presets/zcode/android-kotlin/adapter-map.json +1 -1
  521. package/presets/zcode/android-kotlin/agents/README.md +3 -3
  522. package/presets/zcode/android-kotlin/agents/build-verifier.md +1 -1
  523. package/presets/zcode/android-kotlin/agents/code-reviewer.md +1 -1
  524. package/presets/zcode/android-kotlin/agents/debugger.md +1 -1
  525. package/presets/zcode/android-kotlin/agents/feature-developer.md +1 -1
  526. package/presets/zcode/android-kotlin/agents/task-analyst.md +1 -1
  527. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +108 -1
  528. package/presets/zcode/android-kotlin/rules/agent-team-intake.md +2 -2
  529. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +5 -4
  530. package/presets/zcode/go/adapter-map.json +1 -1
  531. package/presets/zcode/go/agents/README.md +2 -2
  532. package/presets/zcode/go/agents/build-verifier.md +1 -1
  533. package/presets/zcode/go/agents/code-reviewer.md +1 -1
  534. package/presets/zcode/go/agents/debugger.md +1 -1
  535. package/presets/zcode/go/agents/feature-developer.md +1 -1
  536. package/presets/zcode/go/agents/task-analyst.md +1 -1
  537. package/presets/zcode/go/hooks/chain-team-phases.sh +108 -1
  538. package/presets/zcode/go/rules/agent-team-intake.md +2 -2
  539. package/presets/zcode/go/rules/agent-team-orchestrator.md +5 -4
  540. package/presets/zcode/go/rules/feature-delivery-workflow.md +1 -1
  541. package/presets/zcode/ios-swift/adapter-map.json +1 -1
  542. package/presets/zcode/ios-swift/agents/README.md +3 -3
  543. package/presets/zcode/ios-swift/agents/build-verifier.md +1 -1
  544. package/presets/zcode/ios-swift/agents/code-reviewer.md +1 -1
  545. package/presets/zcode/ios-swift/agents/debugger.md +1 -1
  546. package/presets/zcode/ios-swift/agents/feature-developer.md +1 -1
  547. package/presets/zcode/ios-swift/agents/task-analyst.md +1 -1
  548. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +108 -1
  549. package/presets/zcode/ios-swift/rules/agent-team-intake.md +2 -2
  550. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +5 -4
  551. package/presets/zcode/ios-swift/rules/feature-delivery-workflow.md +1 -1
  552. package/presets/zcode/java/adapter-map.json +1 -1
  553. package/presets/zcode/java/agents/README.md +2 -2
  554. package/presets/zcode/java/agents/build-verifier.md +1 -1
  555. package/presets/zcode/java/agents/code-reviewer.md +1 -1
  556. package/presets/zcode/java/agents/debugger.md +1 -1
  557. package/presets/zcode/java/agents/feature-developer.md +1 -1
  558. package/presets/zcode/java/agents/task-analyst.md +1 -1
  559. package/presets/zcode/java/hooks/chain-team-phases.sh +108 -1
  560. package/presets/zcode/java/rules/agent-team-intake.md +2 -2
  561. package/presets/zcode/java/rules/agent-team-orchestrator.md +5 -4
  562. package/presets/zcode/java/rules/feature-delivery-workflow.md +1 -1
  563. package/presets/zcode/mcp-ts/adapter-map.json +1 -1
  564. package/presets/zcode/mcp-ts/agents/README.md +1 -1
  565. package/presets/zcode/mcp-ts/agents/build-verifier.md +1 -1
  566. package/presets/zcode/mcp-ts/agents/feature-developer.md +1 -1
  567. package/presets/zcode/mcp-ts/agents/task-analyst.md +1 -1
  568. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +108 -1
  569. package/presets/zcode/mcp-ts/rules/agent-team-intake.md +2 -2
  570. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +5 -4
  571. package/presets/zcode/mcp-ts/rules/feature-delivery-workflow.md +1 -1
  572. package/presets/zcode/mol/adapter-map.json +1 -1
  573. package/presets/zcode/mol/agents/README.md +3 -3
  574. package/presets/zcode/mol/agents/build-verifier.md +1 -1
  575. package/presets/zcode/mol/agents/code-reviewer.md +1 -1
  576. package/presets/zcode/mol/agents/debugger.md +1 -1
  577. package/presets/zcode/mol/agents/feature-developer.md +1 -1
  578. package/presets/zcode/mol/agents/task-analyst.md +1 -1
  579. package/presets/zcode/mol/hooks/chain-team-phases.sh +108 -1
  580. package/presets/zcode/mol/rules/agent-team-intake.md +2 -2
  581. package/presets/zcode/mol/rules/agent-team-orchestrator.md +5 -4
  582. package/presets/zcode/mol/rules/feature-delivery-workflow.md +1 -1
  583. package/presets/zcode/next/REPO_AGENTS.md +16 -0
  584. package/presets/zcode/next/adapter-map.json +1 -1
  585. package/presets/zcode/next/agents/README.md +3 -3
  586. package/presets/zcode/next/agents/accessibility-reviewer.md +4 -1
  587. package/presets/zcode/next/agents/api-contract-reviewer.md +5 -2
  588. package/presets/zcode/next/agents/build-verifier.md +6 -3
  589. package/presets/zcode/next/agents/ci-investigator.md +1 -1
  590. package/presets/zcode/next/agents/code-reviewer.md +7 -4
  591. package/presets/zcode/next/agents/codebase-analyzer.md +4 -1
  592. package/presets/zcode/next/agents/debugger.md +2 -2
  593. package/presets/zcode/next/agents/feature-developer.md +2 -2
  594. package/presets/zcode/next/agents/migration-specialist.md +4 -1
  595. package/presets/zcode/next/agents/mockup-reviewer.md +4 -1
  596. package/presets/zcode/next/agents/openspec-author.md +4 -1
  597. package/presets/zcode/next/agents/performance-auditor.md +4 -1
  598. package/presets/zcode/next/agents/playwright-test-generator.md +5 -2
  599. package/presets/zcode/next/agents/playwright-test-healer.md +5 -2
  600. package/presets/zcode/next/agents/playwright-test-planner.md +5 -2
  601. package/presets/zcode/next/agents/qa-tester.md +5 -2
  602. package/presets/zcode/next/agents/security-reviewer.md +4 -1
  603. package/presets/zcode/next/agents/solution-architect.md +4 -1
  604. package/presets/zcode/next/agents/task-analyst.md +5 -2
  605. package/presets/zcode/next/agents/task-router.md +8 -5
  606. package/presets/zcode/next/agents/tech-writer.md +4 -1
  607. package/presets/zcode/next/agents/unit-test-generator.md +5 -2
  608. package/presets/zcode/next/agents/unit-test-healer.md +5 -2
  609. package/presets/zcode/next/agents/unit-test-planner.md +5 -2
  610. package/presets/zcode/next/ai-local/conventions.md +6 -1
  611. package/presets/zcode/next/hooks/chain-team-phases.sh +108 -1
  612. package/presets/zcode/next/rules/agent-team-intake.md +2 -2
  613. package/presets/zcode/next/rules/agent-team-orchestrator.md +5 -4
  614. package/presets/zcode/next/rules/feature-delivery-workflow.md +2 -2
  615. package/presets/zcode/nuxt/adapter-map.json +1 -1
  616. package/presets/zcode/nuxt/agents/README.md +3 -3
  617. package/presets/zcode/nuxt/agents/build-verifier.md +1 -1
  618. package/presets/zcode/nuxt/agents/code-reviewer.md +1 -1
  619. package/presets/zcode/nuxt/agents/debugger.md +1 -1
  620. package/presets/zcode/nuxt/agents/feature-developer.md +1 -1
  621. package/presets/zcode/nuxt/agents/task-analyst.md +1 -1
  622. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +108 -1
  623. package/presets/zcode/nuxt/rules/agent-team-intake.md +2 -2
  624. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +5 -4
  625. package/presets/zcode/nuxt/rules/feature-delivery-workflow.md +1 -1
  626. package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
  627. package/presets/zcode/php-hexagonal/agents/README.md +2 -2
  628. package/presets/zcode/php-hexagonal/agents/build-verifier.md +1 -1
  629. package/presets/zcode/php-hexagonal/agents/code-reviewer.md +1 -1
  630. package/presets/zcode/php-hexagonal/agents/debugger.md +1 -1
  631. package/presets/zcode/php-hexagonal/agents/feature-developer.md +1 -1
  632. package/presets/zcode/php-hexagonal/agents/task-analyst.md +1 -1
  633. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +108 -1
  634. package/presets/zcode/php-hexagonal/rules/agent-team-intake.md +2 -2
  635. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +5 -4
  636. package/presets/zcode/php-hexagonal/rules/feature-delivery-workflow.md +1 -1
  637. package/presets/zcode/php-laravel/adapter-map.json +1 -1
  638. package/presets/zcode/php-laravel/agents/README.md +2 -2
  639. package/presets/zcode/php-laravel/agents/build-verifier.md +1 -1
  640. package/presets/zcode/php-laravel/agents/code-reviewer.md +1 -1
  641. package/presets/zcode/php-laravel/agents/debugger.md +1 -1
  642. package/presets/zcode/php-laravel/agents/feature-developer.md +1 -1
  643. package/presets/zcode/php-laravel/agents/task-analyst.md +1 -1
  644. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +108 -1
  645. package/presets/zcode/php-laravel/rules/agent-team-intake.md +2 -2
  646. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +5 -4
  647. package/presets/zcode/php-laravel/rules/feature-delivery-workflow.md +1 -1
  648. package/presets/zcode/svelte/adapter-map.json +1 -1
  649. package/presets/zcode/svelte/agents/README.md +3 -3
  650. package/presets/zcode/svelte/agents/build-verifier.md +1 -1
  651. package/presets/zcode/svelte/agents/code-reviewer.md +1 -1
  652. package/presets/zcode/svelte/agents/debugger.md +1 -1
  653. package/presets/zcode/svelte/agents/feature-developer.md +1 -1
  654. package/presets/zcode/svelte/agents/task-analyst.md +1 -1
  655. package/presets/zcode/svelte/hooks/chain-team-phases.sh +108 -1
  656. package/presets/zcode/svelte/rules/agent-team-intake.md +2 -2
  657. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +5 -4
  658. package/presets/zcode/svelte/rules/feature-delivery-workflow.md +1 -1
  659. package/scripts/aggregate-agent-task-metrics.mjs +201 -0
  660. package/scripts/report-context-cost.mjs +126 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.73
4
+
5
+ ### `team` — planned tracker drain
6
+
7
+ - **Job.** `presets/cursor/next/team/upstream/jobs.json` adds `tracker-planned-drain` beside `upstream-research`: `interval`, `everySeconds` 300, `Europe/Moscow`, `concurrency: skip`, `misfire: run-once`, `timeoutMs` 14400000, argv `node ../scripts/tracker-planned-drain.mjs --team-root .`. In this repository `init`/`update` still copy that file only when `scheduler/jobs.json` is absent. The template sits under `team/upstream/`, which the published tarball excludes, so a consumer install gets no `scheduler/jobs.json`.
8
+ - **Published child.** `tracker-planned-drain.mjs` joins `ENGINE_SCRIPTS` (it is not in `REPO_ONLY_ENGINE_SCRIPTS`) and is mirrored into `.ai.local/scripts/`. A packed consumer seeds the module; `upstream-research.mjs` stays repository-only.
9
+ - **One tick.** The child uses the existing launch queue. A full tracker slot exits idle and enqueues nothing. Otherwise it enqueues the head ready stored-`planned` item that has no open queue entry and no `tracker-<id>` or `<id>` task row, claims one entry, bootstraps the task folder the way the chain-hook stop seam does (`prompt.md` plus `pipeline.json` with empty `steps`; an existing pipeline is left as-is), and runs exactly one `task-run start`. It then polls until the linked team task and the tracker item are both terminal, so `concurrency: skip` holds the next tick. The child never writes `status.json` or `metrics.json`.
10
+ - **Stored status.** `completed` stores the item `completed`. `changes_requested` and `validation_failed` store `cancelled` with `cancelReason` `task <state>`. `blocked` stays stored-`planned`, and the next tick does not enqueue. `backlog`, a terminal stored status, and an item that already has a task row are not selected. An empty tracker is idle (`no planned head`).
11
+ - **Kill switch.** `AI_RULES_TEAM_DB_DISABLE=1` returns idle `disabled` and writes nothing.
12
+ - **Tests.** `test-team-db-tracker-queue.mjs` covers the tick. `test-cli-init-clean.mjs` asserts a fresh repository `next` install seeds both jobs and `jobs get` accepts the drain. `test-pack-repo-only.mjs` asserts the consumer seed includes `tracker-planned-drain.mjs` and still omits the job file and `upstream-research.mjs`.
13
+
14
+ ### `preset` — research gate, rebuild lock, lean subagent blocks
15
+
16
+ - **Research gate (R1–R3).** The root entry every platform installs gains one section after § Presence-based load. A request that only asks to analyze, investigate, measure, or estimate (no make / fix / add verb) **MUST** go to `codebase-analyzer` or a `spike` pipeline; the boundary is the read count — one read stays a pure question with no file. A session approaching ~50 turns **MUST** checkpoint (`focus.md` + `artifact-manifest.json` + `.memlog.md`) and hand off to a fresh session; a research fact **MUST** reach `analysis.md` with its `path:line` before the same file is read a second time. The Cursor map carries the matching MUST line under § When to use `/task`, and `agent-team-intake` points at the same boundary instead of contradicting it. No new always-on rule file, so the always-on count stays 3–10.
17
+ - **Output guard (R4).** The 8–20 KB band's whole-line gap hint is `grep -n '<term>' <file>`, with the term taken from the **elided** slice. When that slice holds no usable token the hint is omitted and only the `elided lines A..B` marker remains — a fabricated `grep -n 'error'` matches nothing. No `sed -n` range survives in `rewrite.ts` or its README, and one output carries one command instead of the `search:` line duplicating `read more:`.
18
+ - **Rebuild lock (R5).** `team-db.mjs init|sync|migrate-tasks --rebuild` takes `.ai.local/team/.rebuild.lock`, outer to the tracker lock and to SQLite's `busy_timeout`, and releases it on every error path. A second rebuild fails fast with `E_REBUILD_BUSY` (exit 4) instead of moving `team.db` aside again. Documented in `docs/TEAM-DB.md`.
19
+ - **Subagent read set (R6).** `getRequiredRulesForAgent` splits by Next role, not only the implementer: every Next agent's «Rules to load» required list is 5–7 paths (was 8–15) and the rest is conditional; `check-claude-agent-blocks.mjs` asserts the band. `zoneRulesByRole` keeps the full list, so the anti-hallucination floor gate still sees it.
20
+ - **Installed behaviour.** Generated platform trees, the dogfood `.cursor` / `.claude` / `.mavis` / `.opencode` / `.zcode` trees plus root `AGENTS.md`, `.ai.local/scripts/**`, and the CLI goldens are regenerated. `test-output-guard.mjs` asserts the grep hint and both team-db suites cover the rebuild lock, including a release-on-failure case and `init` / `sync --rebuild` contention.
21
+ - **Aside-file ignore lines.** The seeded `.ai.local/.gitignore` gains `team.db.corrupt-*` and `team.db.mismatch-*`: a `sync --rebuild` moves `team.db` with both companions aside under those names, so an untouched pattern let a ~140 MB database copy reach the index. `update` appends both lines to an existing ignore file, `test-cli-init-clean.mjs` asserts them, and `docs/TEAM-DB.md` lists them.
22
+
23
+ ## 0.2.72
24
+
25
+ ### `team` — usage ledger, verification evidence, incident registry
26
+
27
+ - **Published engine modules.** `record-usage.mjs`, `verification.mjs`, and `incidents.mjs` join `ENGINE_SCRIPTS` and are seeded into `.ai.local/scripts/`. `record-usage` was repo-local; the CLI and the metrics prose now ship together.
28
+ - **Token usage.** `attempt_finished` keeps a host `usage` object only after an allowlist (`input`, `output`, `reasoning`, `cacheRead`, `cacheWrite`, `costUsd`, `model`, `origin`). `record-usage.mjs` appends one `usage_recorded` event per observable turn. A host object wins for that attempt; the two paths are never added. A missing count stays `null`. `aggregate-agent-task-metrics.mjs` reports usage at task, agent, and model level with `reportedAttempts / attempts`.
29
+ - **Verification evidence.** `verification.mjs record` stores the command, exit code, a capped secret-redacted log tail, and a git snapshot that ignores `.ai.local/**`. `check --strict` exits 1 when that snapshot is stale and 2 when it is missing. A `build-verifier` finish without an explicit record seeds `verification.json` once (`gate.status: snapshot-only`) and never refreshes it. Closure warns and writes one `verification_stale` event; it does not block.
30
+ - **Incident registry.** `incidents.mjs` appends to `<team>/incidents.jsonl`. The signature is `scope | failure | rule`. Two occurrences in 30 days stabilize a class. `promote` requires `ci`, `test`, `lint`, or `policy-check` and writes an inactive draft under `.ai.local/rules-library/`; a human moves it into `.ai.local/rules/`. Secrets are rejected at write time. `advise` is a targeted lookup.
31
+ - **Ledger.** `usage_recorded`, `verification_recorded`, and `verification_stale` join the allowed event types.
32
+ - **Tests.** `test-verification-evidence.mjs`, `test-incidents-registry.mjs`, and `test-agent-task-metrics-usage.mjs` run inside `check-preset-structure.sh`.
33
+
34
+ ### `orchestrator` — review roles on `cheap`, session handoff
35
+
36
+ - **Tiers.** `code-reviewer`, `build-verifier`, `api-contract-reviewer`, and `mockup-reviewer` resolve as `cheap`. `feature-developer` stays `standard`. `strong` is architecture, security, migration, and performance; `mockup-reviewer` is not on `strong`. The mapped id is passed as written — do not append `#high`. Without `.ai.local/team/model-tiers.json`, those four roles omit the model and the session model applies.
37
+ - **Dogfood map.** This repository's `model-tiers.json` sets `cheap` to `deepseek/deepseek-flash#max`. `standard` stays `deepseek/deepseek-flash` with no variant.
38
+ - **Handoff.** A session approaching ~50 turns finishes the current wave, checkpoints `focus.md` + `artifact-manifest.json` + `.memlog.md`, and continues in a fresh session. A wave that cannot finish before the cap checkpoints its partial state the same way.
39
+ - **Artifact reads.** Read the manifest entry, not a completed artifact body. A large artifact is read in offset/limit ranges.
40
+
41
+ ### `opencode` — structured output-guard band and model bench
42
+
43
+ - **8–20 KB.** A replaced tool result in that band names the gap: a whole-line gap is `sed -n`, a mid-line cut (including a one-line payload) is `tail -c`, and JSON keys are listed only when they sit in the gap. Above 20 KB stays the flat head + tail. `AI_RULES_OUTPUT_GUARD_SHAPE=flat` forces the flat renderer inside the band.
44
+ - **Error results.** A `tool-result` whose type is `error` is recorded. `results.jsonl` gains optional `error: true`; absence means non-error, including rows written before the field existed. `report-context-cost.mjs` prints `readCountPerPath` and `mcpErrors`.
45
+ - **Bench.** `bench-efficiency.mjs --model-b` compares two models with the guard on and returns an `owner-gate` verdict; the harness does not choose a route. `--shape flat|structured` selects the renderer under test.
46
+
3
47
  ## 0.2.71
4
48
 
5
49
  ### `team-tasks-ui` — catalog price tiers, model metadata, notes
package/README.md CHANGED
@@ -25,7 +25,7 @@ Run `init` from the **app root** (`--cwd` if needed). Default `--preset` is `nex
25
25
  | Root agents | `REPO_AGENTS.md` → `AGENTS.md` (same file on all five; ZCode loads it natively) | | | | |
26
26
  | `/task` artifacts | **`.ai.local/team/`** (shared; templates refreshed; `tasks/<slug>/` never overwritten) | | | |
27
27
  | Template drift | **`.ai.local/.template-base.json`** (shared; one record per tree of files that hold a shipped template byte; `update` prints one drift line, `update --merge-ai-local` fast-forwards a file only when its recorded base still matches and reports the rest) | | | |
28
- | Self-learning engine | **`.ai.local/scripts/`** (shared; twenty-two scripts — the six self-learning engine modules, `manifest.mjs`, the `dump-output.mjs` output externalizer, the ten `team-db*.mjs` projection, scheduler and lifecycle modules, the read-only `check-write-scope.mjs` write audit, the `aggregate-agent-task-metrics.mjs` aggregator, and the `processes.mjs` + `process-lease.mjs` process manager; existing files never overwritten. The repository-only `upstream-research.mjs` is not published) | | | |
28
+ | Self-learning engine | **`.ai.local/scripts/`** (shared; twenty-four published scripts — the six self-learning engine modules, `manifest.mjs`, `dump-output.mjs`, the eight `team-db*.mjs` modules, `check-write-scope.mjs`, `aggregate-agent-task-metrics.mjs`, `record-usage.mjs`, `verification.mjs`, `incidents.mjs`, `processes.mjs`, `process-lease.mjs`, and `tracker-planned-drain.mjs`; existing files never overwritten. The repository-only `upstream-research.mjs` is not published) | | | |
29
29
  | Specs seed | `docs/specs/` copied only if the directory is **absent** | | | |
30
30
 
31
31
  OpenCode also ships **`.opencode/plugins/task-status/`**, a TUI sidebar for the active `/task` run (slug, state, elapsed time, step, remaining-time estimate, soft-stop). OpenCode auto-loads it; it needs no `opencode.json` entry, is refreshed by `update`, and is a viewer only — the chain hook stays manual.
@@ -61,8 +61,8 @@ node .ai.local/scripts/run.mjs --dry-run # read-only preview: decision, target,
61
61
  `init` seeds the engine with **skip-if-exists** — a modified `run.mjs` stays yours and is reported as kept; there is no
62
62
  `--force`. The seeded tree is byte-identical to `presets/_shared/ai-local/scripts/`, and `.ai.local/.gitignore` (created
63
63
  when absent, missing required lines appended to an existing file) ignores `*.lock`, `*.tmp`, `.rollback/`, `STOP`,
64
- `ESTOP`, `team.db`, `team.db-wal`, `team.db-shm`, `team-db-errors.log`, `team/scheduler/runs/`, and
65
- `team/scheduler/state.json`; the root `.gitignore` is never edited.
64
+ `ESTOP`, `team.db`, `team.db-wal`, `team.db-shm`, `team-db-errors.log`, `team.db.corrupt-*`,
65
+ `team.db.mismatch-*`, `team/scheduler/runs/`, and `team/scheduler/state.json`; the root `.gitignore` is never edited.
66
66
 
67
67
  Upgrade a seeded module with `update --fix`: it writes a module only when its current bytes still match the shipped digest
68
68
  recorded in `.ai.local/.template-base.json`. A module you edited is reported `kept modified` and stays byte-identical; a
@@ -175,10 +175,11 @@ pre-v2 database is rebuilt from the files on the next `sync`.
175
175
  the published npm package; they are used only in the `@bonesofspring/ai-rules` repository
176
176
  itself. A consumer install seeds no job and no runner.
177
177
 
178
- In this repository the `next` preset carries a weekly `upstream-research` job and a read-only
179
- `opencode` agent for it. `init`/`update` seed the job definition into
178
+ In this repository the `next` preset carries a weekly `upstream-research` job, the
179
+ `tracker-planned-drain` interval job (300 seconds, `concurrency: skip`), and a read-only
180
+ `opencode` agent for the weekly review. `init`/`update` seed that jobs file into
180
181
  `.ai.local/team/scheduler/jobs.json` when the file is absent; an operator-edited definition is
181
- never overwritten. The runner probes `opencode`, loads `upstream/projects.json` and
182
+ never overwritten. The weekly runner probes `opencode`, loads `upstream/projects.json` and
182
183
  `upstream/config.json`, fetches each due clone with `git fetch --depth 1`, labels the window
183
184
  (`range`, `baseline`, `unprovable`, `no-change`), validates the agent's marked JSON, re-checks
184
185
  every citation inside the clone, dedupes by mechanism against the committed
@@ -94,10 +94,10 @@ function digestFile(filePath) {
94
94
  * move would silently overwrite it.
95
95
  *
96
96
  * `source` stays part of the decision rather than becoming a label: per-tool
97
- * template trees differ (`presets/claude/next/ai-local/conventions.md` ships
98
- * fewer sections than `cursor/next`), so a foreign pass must not rewrite a rel
99
- * another tool seeded. Every pass classifies, so the writing tool's own pass is
100
- * the one that decides — a foreign source no longer disables the feature.
97
+ * template trees may differ (`presets/claude/next/ai-local/rules/task-levels.md`
98
+ * ships fewer sections than `cursor/next`), so a foreign pass must not rewrite a
99
+ * rel another tool seeded. Every pass classifies, so the writing tool's own pass
100
+ * is the one that decides — a foreign source no longer disables the feature.
101
101
  *
102
102
  * @param {{ consumer?: Digest | null, base?: BaseEntry | null, template?: Digest | null, source: string }} input
103
103
  * @returns {'noop' | 'adopt' | 'fast-forward' | 'drift'}
@@ -49,6 +49,8 @@ const ENGINE_SCRIPTS = [
49
49
  'team-db-api.mjs',
50
50
  'team-db-openapi.mjs',
51
51
  'team-db-scheduler.mjs',
52
+ // Five-minute tracker drain: one stored-planned item, one /task, skip while it runs.
53
+ 'tracker-planned-drain.mjs',
52
54
  // The weekly upstream evolution review: opencode probe, registry/cursor,
53
55
  // change window, read-only agent call, dedupe, digest and promotion record.
54
56
  'upstream-research.mjs',
@@ -65,6 +67,15 @@ const ENGINE_SCRIPTS = [
65
67
  // Role/task metrics aggregation used by technical-retro; ships with the engine
66
68
  // so a consumer can run it from `.ai.local/scripts/` without the package.
67
69
  'aggregate-agent-task-metrics.mjs',
70
+ // Token usage per attempt: one `usage_recorded` event per observable turn.
71
+ // The host `usage` object on a receipt is the higher-precedence path; this CLI
72
+ // covers hosts that expose counts turn by turn.
73
+ 'record-usage.mjs',
74
+ // Persisted verification evidence: command + exit + capped log tail bound to a
75
+ // git snapshot, with a freshness check closure can read.
76
+ 'verification.mjs',
77
+ // Append-only incident registry: recurrence threshold, promotion gate, advice.
78
+ 'incidents.mjs',
68
79
  ];
69
80
 
70
81
  /** Package `presets/`-relative directory holding the engine source of truth. */
@@ -32,6 +32,10 @@ const AI_LOCAL_GITIGNORE = [
32
32
  'team.db-wal',
33
33
  'team.db-shm',
34
34
  'team-db-errors.log',
35
+ '# A corrupt or fingerprint-stale projection moved aside by `sync --rebuild`;',
36
+ '# same database bytes, only the name differs, so it is ignored the same way.',
37
+ 'team.db.corrupt-*',
38
+ 'team.db.mismatch-*',
35
39
  '# Per-session slug bindings for the chain hook; runtime state, never commit.',
36
40
  'team/.session-leases/',
37
41
  '# Scheduler runtime state; jobs.json stays tracked (jobs as code).',
@@ -369,11 +373,11 @@ function copyTemplates(presetTeamSrc, dest) {
369
373
  copyFile(source, target);
370
374
  written.push(`.ai.local/team/upstream/${name}`);
371
375
  }
372
- // The shipped weekly `upstream-research` job seeds only when absent, like the
373
- // research data above: the template carries the definition the docs advertise,
374
- // and an operator-edited `scheduler/jobs.json` (tracked on purpose — jobs as
375
- // code) is never overwritten. The scheduler owns the file under
376
- // `scheduler/`; the template lives beside the other upstream templates.
376
+ // The shipped jobs seed only when absent, like the research data above: the
377
+ // template carries `upstream-research` and `tracker-planned-drain`, and an
378
+ // operator-edited `scheduler/jobs.json` (tracked on purpose — jobs as code)
379
+ // is never overwritten. The scheduler owns the file under `scheduler/`; the
380
+ // template lives beside the other upstream templates.
377
381
  {
378
382
  const jobsSource = path.join(upstreamSrc, 'jobs.json');
379
383
  const jobsTarget = path.join(dest, 'scheduler', 'jobs.json');
package/docs/OPENCODE.md CHANGED
@@ -62,7 +62,7 @@ OpenCode has **no** `.mdc` `alwaysApply` / `globs` engine. The preset uses three
62
62
 
63
63
  **Every turn:** read root `AGENTS.md`, then `.opencode/AGENTS.md`, then the four essential rules. Probe `.ai.local` (see [`LOCAL-OVERLAY.md`](./LOCAL-OVERLAY.md)).
64
64
 
65
- Do not pin a model in this preset — use the operator’s OpenCode provider config.
65
+ Do not pin a provider model in agent frontmatter. A tier resolves through `.ai.local/team/model-tiers.json` when that file exists; otherwise the session model applies.
66
66
 
67
67
  ## Task pipeline (semi-auto)
68
68
 
@@ -88,7 +88,9 @@ Full team layout: `.ai.local/team/README.md`.
88
88
  `ctx.session.hook("context")`, which receives the assembled model messages before
89
89
  dispatch. A `tool-result` over 8 KB is written to
90
90
  `.ai.local/team/output-guard/<sessionID>/outputs/` and replaced with a bounded
91
- head + tail, the path, and one `grep` / `sed` hint. It works for every prompt,
91
+ head + tail. The 8–20 KB band uses the structured shape: a whole-line gap is a `sed -n` range, a mid-line cut is a `tail -c` byte window, and JSON keys are listed only when they sit in that gap. Above 20 KB stays the flat renderer.
92
+ `AI_RULES_OUTPUT_GUARD_SHAPE=flat` forces the flat renderer inside the band.
93
+ It works for every prompt,
92
94
  including one without `/task`.
93
95
 
94
96
  - `AI_RULES_OUTPUT_GUARD=0` disables it; `AI_RULES_OUTPUT_GUARD_BYTES` changes the threshold.
package/docs/TEAM-DB.md CHANGED
@@ -19,10 +19,11 @@ The projection is installed by `init` as eight `team-db*.mjs` modules under `.ai
19
19
 
20
20
  The same seeded set is `ENGINE_SCRIPTS` in `bin/lib/engine-scripts.js`: the eight `team-db*.mjs`
21
21
  modules plus the self-learning engine, `manifest.mjs`, `dump-output.mjs`,
22
- `check-write-scope.mjs`, `aggregate-agent-task-metrics.mjs`, and the `processes.mjs` +
23
- `process-lease.mjs` process manager (twenty published entries;
24
- `node -e "require('./bin/lib/engine-scripts.js').SHIPPED_ENGINE_SCRIPTS.length"` prints the
25
- shipped count). One further module, `upstream-research.mjs`, is declared in
22
+ `check-write-scope.mjs`, `aggregate-agent-task-metrics.mjs`, `record-usage.mjs`,
23
+ `verification.mjs`, `incidents.mjs`, `tracker-planned-drain.mjs`, and the `processes.mjs` +
24
+ `process-lease.mjs` process manager (twenty-five entries;
25
+ `node -e "require('./bin/lib/engine-scripts.js').ENGINE_SCRIPTS.length"` prints the shipped
26
+ count). One further module, `upstream-research.mjs`, is declared in
26
27
  `REPO_ONLY_ENGINE_SCRIPTS`: it exists in this repository's preset source and dogfood mirror but
27
28
  is excluded from the published tarball, and a consumer install skips it without a warning.
28
29
 
@@ -63,11 +64,18 @@ team.db
63
64
  team.db-wal
64
65
  team.db-shm
65
66
  team-db-errors.log
67
+ team.db.corrupt-*
68
+ team.db.mismatch-*
66
69
  team/scheduler/runs/
67
70
  team/scheduler/state.json
68
71
  team/output-guard/
69
72
  ```
70
73
 
74
+ The two `team.db.<reason>-*` patterns cover the whole file set a rebuild moves aside
75
+ (`team.db.corrupt-<stamp>`, `team.db.mismatch-<stamp>`, and their `-wal` / `-shm`
76
+ companions): same database bytes under a new name, so an untouched pattern would let a
77
+ ~140 MB copy reach the index.
78
+
71
79
  `team/scheduler/jobs.json` stays tracked: definitions are code, run output is not. `team/output-guard/` holds the OpenCode output-guard spill files; runtime state, never commit. The
72
80
  consumer root `.gitignore` is never created or edited. Never commit the database even
73
81
  for a demo: it contains copies of prompts and task documents.
@@ -150,6 +158,12 @@ vocabulary: `0` ok, `1` a validation refusal carrying its named code (`E_TRACKER
150
158
  `E_TRACKER_TRANSITION`, `E_TRACKER_REVISION`, `E_SCHEMA`), `3` usage, `4` the tree lock was
151
159
  contended (`E_TRACKER_BUSY`).
152
160
 
161
+ A `--rebuild` of `init`, `sync` or `migrate-tasks` takes the team-root rebuild lock
162
+ (`.ai.local/team/.rebuild.lock.d`, a transient directory) before it touches the database: a
163
+ second rebuild that meets it fails fast with `E_REBUILD_BUSY` (exit 4) instead of moving
164
+ `team.db` aside a second time. Lock order is fixed — rebuild lock outer, tracker lock inner,
165
+ SQLite `busy_timeout` last — and a plain `sync` takes no rebuild lock.
166
+
153
167
  `search <query>` answers from the FTS5 projection: it calls `searchProjection` (`MATCH` when the
154
168
  `search_fts` table exists, the escaped `LIKE` fallback otherwise) and never builds SQL from the
155
169
  input. It opens the database read-only, defaults to 5 hits, clamps `--limit` to 1…20 (a larger
@@ -358,8 +372,10 @@ only in the `@bonesofspring/ai-rules` repository. The published tarball excludes
358
372
  a consumer install seeds no job and no runner. The rest of this section documents the workflow
359
373
  for repository maintainers.
360
374
 
361
- The `next` preset carries one `pipeline` job, `upstream-research`, and one engine module,
362
- `.ai.local/scripts/upstream-research.mjs`. The job renders `upstream/prompt.md` and runs the
375
+ The `next` preset template carries the weekly `upstream-research` pipeline job and
376
+ `tracker-planned-drain` (`interval`, `everySeconds` 300, `concurrency: skip`), plus the
377
+ repository-only engine module `.ai.local/scripts/upstream-research.mjs`. The weekly job renders
378
+ `upstream/prompt.md` and runs the
363
379
  module with `--prompt {promptFile} --team-root . --repo-root ../..`; it is a normal
364
380
  definition in `scheduler/jobs.json`, so `jobs list|get|put|enable|disable|run`, the API job
365
381
  routes, and every consumer UI work unchanged. `init`/`update` seed the definition into
@@ -668,9 +684,11 @@ node scripts/test-team-db-efficiency.mjs
668
684
  planted defect, not only on the happy path. `test-team-db-efficiency.mjs` pins the v5
669
685
  telemetry plane: usage precedence, duplicate observation days, coverage `null` at `0/0`, the
670
686
  watermark re-run, the lease window, classifier parity with `report-efficiency.mjs`, and the
671
- `record-usage` CLI surface. `record-usage.mjs` is repo-local: it has no preset twin and
672
- `package.json#files` excludes `.ai.local/**`, so an installed package gets the orchestrator
673
- prose without the CLI until P2 ships a twin or drops the prose.
687
+ `record-usage` CLI surface. `record-usage.mjs` is a published engine module: it ships from
688
+ `presets/_shared/ai-local/scripts/` and is seeded into a consumer's `.ai.local/scripts/`, so the
689
+ orchestrator prose and the CLI travel together. The same seeding carries `verification.mjs`
690
+ (persisted gate evidence with a freshness check) and `incidents.mjs` (recurrence threshold and
691
+ promotion gate).
674
692
 
675
693
  Links: [`../README.md`](../README.md), [`PRESET-CONTRIBUTION.md`](PRESET-CONTRIBUTION.md),
676
694
  the OpenSpec change `openspec/changes/2026-11-10-preset-task-scheduler-impl/`, and ADRs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonesofspring/ai-rules",
3
- "version": "0.2.71",
3
+ "version": "0.2.73",
4
4
  "description": "Presets of Cursor, Claude, Mavis, OpenCode, and ZCode rules/commands for Revy Ross personal use",
5
5
  "license": "MIT",
6
6
  "author": "Revy Ross",
@@ -81,11 +81,127 @@ function readMetrics(filePath) {
81
81
  }
82
82
  }
83
83
 
84
+ /**
85
+ * Usage math for the report. The SQLite projection owns the same AD-3 rules
86
+ * (host `attempt_finished.usage` wins; `usage_recorded` rows collapse per turn)
87
+ * in `team-db-project.mjs`. Keep the two in step: a token kind nobody reported
88
+ * stays `null`, never `0`.
89
+ */
90
+ const usageNumber = (value) =>
91
+ typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : null;
92
+
93
+ const usageEventAt = (event) => {
94
+ const at = Date.parse(event.at ?? '');
95
+ return Number.isFinite(at) ? at : null;
96
+ };
97
+
98
+ const collapseUsageTurns = (events) => {
99
+ const winners = new Map();
100
+ events.forEach((event, index) => {
101
+ if (typeof event.turn !== 'string' || event.turn === '') {
102
+ winners.set(`#${index}`, index);
103
+ return;
104
+ }
105
+ const current = winners.get(event.turn);
106
+ if (current === undefined) {
107
+ winners.set(event.turn, index);
108
+ return;
109
+ }
110
+ const at = usageEventAt(event);
111
+ const currentAt = usageEventAt(events[current]);
112
+ const later = at === null || currentAt === null || at === currentAt ? index > current : at > currentAt;
113
+ if (later) winners.set(event.turn, index);
114
+ });
115
+ const kept = new Set(winners.values());
116
+ return events.filter((event, index) => kept.has(index) || typeof event.turn !== 'string' || event.turn === '');
117
+ };
118
+
119
+ const EMPTY_USAGE = {
120
+ input: null,
121
+ output: null,
122
+ reasoning: null,
123
+ cacheRead: null,
124
+ cacheWrite: null,
125
+ costUsd: null,
126
+ source: null,
127
+ model: null,
128
+ turns: 0,
129
+ };
130
+
131
+ const normalizeUsage = (hostUsage, usageEvents = []) => {
132
+ if (hostUsage && typeof hostUsage === 'object' && !Array.isArray(hostUsage)) {
133
+ const usage = {
134
+ input: usageNumber(hostUsage.input),
135
+ output: usageNumber(hostUsage.output),
136
+ reasoning: usageNumber(hostUsage.reasoning),
137
+ cacheRead: usageNumber(hostUsage.cacheRead),
138
+ cacheWrite: usageNumber(hostUsage.cacheWrite),
139
+ costUsd: usageNumber(hostUsage.costUsd),
140
+ source: 'host',
141
+ model: typeof hostUsage.model === 'string' && hostUsage.model !== '' ? hostUsage.model : null,
142
+ turns: 0,
143
+ };
144
+ const reported = Object.entries(usage).some(
145
+ ([key, value]) => !['source', 'model', 'turns'].includes(key) && value !== null,
146
+ );
147
+ return reported ? usage : { ...EMPTY_USAGE };
148
+ }
149
+ const events = collapseUsageTurns(usageEvents.filter((event) => event && typeof event === 'object'));
150
+ if (events.length === 0) return { ...EMPTY_USAGE };
151
+ const sum = (key) => {
152
+ let total = null;
153
+ for (const event of events) {
154
+ const value = usageNumber(event[key]);
155
+ if (value !== null) total = (total ?? 0) + value;
156
+ }
157
+ return total;
158
+ };
159
+ const model = events.find((event) => typeof event.model === 'string' && event.model !== '')?.model ?? null;
160
+ return {
161
+ ...EMPTY_USAGE,
162
+ input: sum('input'),
163
+ output: sum('output'),
164
+ reasoning: sum('reasoning'),
165
+ cacheRead: sum('cached'),
166
+ cacheWrite: sum('cacheWrite'),
167
+ source: 'cli',
168
+ model,
169
+ turns: events.length,
170
+ };
171
+ };
172
+
173
+ const hasUsage = (usage) =>
174
+ Boolean(usage) &&
175
+ ['input', 'output', 'reasoning', 'cacheRead', 'cacheWrite', 'costUsd'].some((key) => usage[key] !== null);
176
+
177
+ const addUsage = (total, usage) => {
178
+ if (!hasUsage(usage)) return total;
179
+ const next = { ...total };
180
+ for (const key of ['input', 'output', 'reasoning', 'cacheRead', 'cacheWrite', 'costUsd']) {
181
+ if (usage[key] === null) continue;
182
+ next[key] = (next[key] ?? 0) + usage[key];
183
+ }
184
+ next.reported += 1;
185
+ return next;
186
+ };
187
+
188
+ const emptyUsageTotal = () => ({
189
+ input: null,
190
+ output: null,
191
+ reasoning: null,
192
+ cacheRead: null,
193
+ cacheWrite: null,
194
+ costUsd: null,
195
+ reported: 0,
196
+ });
197
+
84
198
  function collect(metrics, filePath) {
85
199
  const starts = new Map();
86
200
  const gateStarts = new Map();
87
201
  const terminalAttempts = new Set();
88
202
  const attemptDurations = [];
203
+ const hostUsage = new Map();
204
+ const usageEventsByAttempt = new Map();
89
205
  let taskCompleted = false;
90
206
  let ledgerIncomplete = false;
91
207
  let taskStartedAt = null;
@@ -93,6 +209,7 @@ function collect(metrics, filePath) {
93
209
  let taskGateWaitMs = 0;
94
210
  let taskOutOfBandMs = 0;
95
211
  let taskOutOfBandCount = 0;
212
+ let taskUsage = emptyUsageTotal();
96
213
 
97
214
  for (const event of metrics.events) {
98
215
  if (event.type === 'task_started') taskStartedAt = event.at;
@@ -143,6 +260,12 @@ function collect(metrics, filePath) {
143
260
  (attributionConfidenceCounts.get(attributionConfidence) ?? 0) + 1,
144
261
  );
145
262
  if (Number.isFinite(event.durationMs)) attemptDurations.push(event.durationMs);
263
+ const usage = normalizeUsage(
264
+ hostUsage.get(event.attemptId) ??
265
+ (event.usage && typeof event.usage === 'object' ? event.usage : null),
266
+ usageEventsByAttempt.get(event.attemptId) ?? [],
267
+ );
268
+ taskUsage = addUsage(taskUsage, usage);
146
269
  attempts.push({
147
270
  ...metrics.task,
148
271
  agent: start.agent ?? 'unknown',
@@ -150,7 +273,25 @@ function collect(metrics, filePath) {
150
273
  durationMs: Number.isFinite(event.durationMs) ? event.durationMs : null,
151
274
  outcome: event.outcome ?? 'unknown',
152
275
  attributionConfidence,
276
+ usage,
277
+ });
278
+ }
279
+ if (event.type === 'attempt_finished' && event.attemptId && event.usage && typeof event.usage === 'object') {
280
+ hostUsage.set(event.attemptId, event.usage);
281
+ }
282
+ if (event.type === 'usage_recorded' && event.attemptId) {
283
+ const list = usageEventsByAttempt.get(event.attemptId) ?? [];
284
+ list.push({
285
+ at: event.at,
286
+ turn: event.turn,
287
+ model: event.model,
288
+ input: event.input,
289
+ output: event.output,
290
+ cached: event.cached,
291
+ cacheWrite: event.cacheWrite,
292
+ reasoning: event.reasoning,
153
293
  });
294
+ usageEventsByAttempt.set(event.attemptId, list);
154
295
  }
155
296
  if (event.type === 'human_gate_started' && event.eventId) {
156
297
  gateStarts.set(event.eventId, event);
@@ -192,6 +333,18 @@ function collect(metrics, filePath) {
192
333
  attemptCount: terminalAttempts.size,
193
334
  completed: taskCompleted,
194
335
  incomplete: ledgerIncomplete,
336
+ usage: {
337
+ reportedAttempts: taskUsage.reported,
338
+ coverage: terminalAttempts.size ? taskUsage.reported / terminalAttempts.size : null,
339
+ tokens: {
340
+ input: taskUsage.input,
341
+ output: taskUsage.output,
342
+ reasoning: taskUsage.reasoning,
343
+ cacheRead: taskUsage.cacheRead,
344
+ cacheWrite: taskUsage.cacheWrite,
345
+ },
346
+ costUsd: taskUsage.costUsd,
347
+ },
195
348
  });
196
349
  }
197
350
  }
@@ -223,6 +376,7 @@ const byAgentRole = groupBy(
223
376
  const sample = group[0];
224
377
  const durations = group.map((item) => item.durationMs).filter((value) => value !== null);
225
378
  const sumDurationMs = durations.reduce((sum, value) => sum + value, 0);
379
+ const usageTotal = group.reduce((total, item) => addUsage(total, item.usage), emptyUsageTotal());
226
380
  return {
227
381
  platform: sample.platform,
228
382
  stack: sample.stack,
@@ -233,6 +387,17 @@ const byAgentRole = groupBy(
233
387
  completedCount: group.filter((item) => item.outcome === 'completed').length,
234
388
  sumDurationMs,
235
389
  avgDurationMs: durations.length ? sumDurationMs / durations.length : null,
390
+ usage: {
391
+ reportedAttempts: usageTotal.reported,
392
+ tokens: {
393
+ input: usageTotal.input,
394
+ output: usageTotal.output,
395
+ reasoning: usageTotal.reasoning,
396
+ cacheRead: usageTotal.cacheRead,
397
+ cacheWrite: usageTotal.cacheWrite,
398
+ },
399
+ costUsd: usageTotal.costUsd,
400
+ },
236
401
  };
237
402
  });
238
403
 
@@ -245,11 +410,47 @@ const taskCountsByRunId = [...new Map(tasks.map((task) => [task.runId, task])).v
245
410
  intent: task.intent,
246
411
  }));
247
412
 
413
+ const usageTotal = attempts.reduce((total, item) => addUsage(total, item.usage), emptyUsageTotal());
414
+ const usageModels = new Map();
415
+ for (const item of attempts) {
416
+ if (!hasUsage(item.usage) || typeof item.usage.model !== 'string') continue;
417
+ const key = item.usage.model;
418
+ const current = usageModels.get(key) ?? { model: key, attempts: 0, usage: emptyUsageTotal() };
419
+ current.attempts += 1;
420
+ current.usage = addUsage(current.usage, item.usage);
421
+ usageModels.set(key, current);
422
+ }
423
+
248
424
  process.stdout.write(
249
425
  `${JSON.stringify(
250
426
  {
251
427
  schemaVersion: 1,
252
428
  teamRoot,
429
+ usage: {
430
+ attempts: attempts.length,
431
+ reportedAttempts: usageTotal.reported,
432
+ coverage: attempts.length ? usageTotal.reported / attempts.length : null,
433
+ tokens: {
434
+ input: usageTotal.input,
435
+ output: usageTotal.output,
436
+ reasoning: usageTotal.reasoning,
437
+ cacheRead: usageTotal.cacheRead,
438
+ cacheWrite: usageTotal.cacheWrite,
439
+ },
440
+ costUsd: usageTotal.costUsd,
441
+ byModel: [...usageModels.values()].map((entry) => ({
442
+ model: entry.model,
443
+ attempts: entry.attempts,
444
+ tokens: {
445
+ input: entry.usage.input,
446
+ output: entry.usage.output,
447
+ reasoning: entry.usage.reasoning,
448
+ cacheRead: entry.usage.cacheRead,
449
+ cacheWrite: entry.usage.cacheWrite,
450
+ },
451
+ costUsd: entry.usage.costUsd,
452
+ })),
453
+ },
253
454
  agentRole: byAgentRole,
254
455
  taskCountsByRunId,
255
456
  taskReports,