@bonesofspring/ai-rules 0.2.56 → 0.2.60

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 (572) hide show
  1. package/CHANGELOG.md +116 -1
  2. package/README.md +68 -3
  3. package/bin/cli.js +399 -27
  4. package/bin/lib/engine-scripts.js +3 -0
  5. package/bin/lib/mcp/catalog.js +97 -0
  6. package/bin/lib/mcp/clients.js +35 -2
  7. package/bin/lib/mcp/credentials.js +85 -1
  8. package/bin/lib/mcp/doctor.js +93 -17
  9. package/bin/lib/mcp/registry.js +10 -4
  10. package/bin/lib/seed-ai-local-team.js +8 -5
  11. package/docs/MCP-CATALOG.md +56 -0
  12. package/docs/MCP-SETUP.md +38 -6
  13. package/docs/PRESET-CONTRIBUTION.md +14 -1
  14. package/docs/TEAM-DB.md +34 -1
  15. package/docs/openapi/team-db.v1.json +17 -2
  16. package/mcp/github-proxy.mjs +133 -0
  17. package/mcp/lib/github.mjs +187 -0
  18. package/mcp/lib/streamable-http.mjs +185 -0
  19. package/mcp/lib/yandex.mjs +16 -137
  20. package/package.json +4 -1
  21. package/presets/_shared/ai-local/scripts/check-write-scope.mjs +212 -0
  22. package/presets/_shared/ai-local/scripts/rule-improver.mjs +674 -74
  23. package/presets/_shared/ai-local/scripts/run.mjs +143 -9
  24. package/presets/_shared/ai-local/scripts/team-db-api.mjs +1 -0
  25. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +6 -1
  26. package/presets/_shared/ai-local/scripts/team-db-project.mjs +1 -1
  27. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +79 -9
  28. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +29 -6
  29. package/presets/_shared/core/quality/self-review-and-context-hygiene.md +3 -1
  30. package/presets/_shared/core/review/code-review-mr.md +10 -0
  31. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +163 -16
  32. package/presets/claude/android-kotlin/agents/build-verifier.md +1 -1
  33. package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -1
  34. package/presets/claude/android-kotlin/agents/debugger.md +1 -1
  35. package/presets/claude/android-kotlin/agents/feature-developer.md +1 -1
  36. package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
  37. package/presets/claude/android-kotlin/commands/update.md +1 -0
  38. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +163 -16
  39. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +29 -6
  40. package/presets/claude/android-kotlin/rules/tooling-and-review/code-review.md +10 -0
  41. package/presets/claude/go/agents/build-verifier.md +1 -1
  42. package/presets/claude/go/agents/code-reviewer.md +1 -1
  43. package/presets/claude/go/agents/debugger.md +1 -1
  44. package/presets/claude/go/agents/feature-developer.md +1 -1
  45. package/presets/claude/go/agents/task-analyst.md +1 -1
  46. package/presets/claude/go/commands/update.md +1 -0
  47. package/presets/claude/go/hooks/chain-team-phases.sh +163 -16
  48. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +29 -6
  49. package/presets/claude/go/rules/tooling-and-review/code-review.md +10 -0
  50. package/presets/claude/ios-swift/agents/build-verifier.md +1 -1
  51. package/presets/claude/ios-swift/agents/code-reviewer.md +1 -1
  52. package/presets/claude/ios-swift/agents/debugger.md +1 -1
  53. package/presets/claude/ios-swift/agents/feature-developer.md +1 -1
  54. package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
  55. package/presets/claude/ios-swift/commands/update.md +1 -0
  56. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +163 -16
  57. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +29 -6
  58. package/presets/claude/ios-swift/rules/tooling-and-review/code-review.md +10 -0
  59. package/presets/claude/java/agents/build-verifier.md +1 -1
  60. package/presets/claude/java/agents/code-reviewer.md +1 -1
  61. package/presets/claude/java/agents/debugger.md +1 -1
  62. package/presets/claude/java/agents/feature-developer.md +1 -1
  63. package/presets/claude/java/agents/task-analyst.md +1 -1
  64. package/presets/claude/java/commands/update.md +1 -0
  65. package/presets/claude/java/hooks/chain-team-phases.sh +163 -16
  66. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +29 -6
  67. package/presets/claude/java/rules/tooling-and-review/code-review.md +10 -0
  68. package/presets/claude/mcp-ts/agents/build-verifier.md +1 -1
  69. package/presets/claude/mcp-ts/agents/feature-developer.md +1 -1
  70. package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
  71. package/presets/claude/mcp-ts/commands/update.md +1 -0
  72. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +163 -16
  73. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +29 -6
  74. package/presets/claude/mcp-ts/rules/tooling-and-review/code-review.md +10 -0
  75. package/presets/claude/mol/agents/build-verifier.md +1 -1
  76. package/presets/claude/mol/agents/code-reviewer.md +1 -1
  77. package/presets/claude/mol/agents/debugger.md +1 -1
  78. package/presets/claude/mol/agents/feature-developer.md +1 -1
  79. package/presets/claude/mol/agents/task-analyst.md +1 -1
  80. package/presets/claude/mol/commands/update.md +1 -0
  81. package/presets/claude/mol/hooks/chain-team-phases.sh +163 -16
  82. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +29 -6
  83. package/presets/claude/mol/rules/tooling-and-review/code-review-mr.md +10 -0
  84. package/presets/claude/next/agents/build-verifier.md +18 -1
  85. package/presets/claude/next/agents/code-reviewer.md +9 -1
  86. package/presets/claude/next/agents/debugger.md +1 -1
  87. package/presets/claude/next/agents/feature-developer.md +13 -1
  88. package/presets/claude/next/agents/task-analyst.md +1 -1
  89. package/presets/claude/next/agents/task-router.md +10 -0
  90. package/presets/claude/next/commands/task-continue.md +3 -1
  91. package/presets/claude/next/commands/update.md +1 -0
  92. package/presets/claude/next/hooks/chain-team-phases.sh +163 -16
  93. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +29 -6
  94. package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +12 -1
  95. package/presets/claude/nuxt/agents/build-verifier.md +1 -1
  96. package/presets/claude/nuxt/agents/code-reviewer.md +1 -1
  97. package/presets/claude/nuxt/agents/debugger.md +1 -1
  98. package/presets/claude/nuxt/agents/feature-developer.md +1 -1
  99. package/presets/claude/nuxt/agents/task-analyst.md +1 -1
  100. package/presets/claude/nuxt/commands/update.md +1 -0
  101. package/presets/claude/nuxt/hooks/chain-team-phases.sh +163 -16
  102. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +29 -6
  103. package/presets/claude/nuxt/rules/tooling-and-review/code-review-mr.md +10 -0
  104. package/presets/claude/php-hexagonal/agents/build-verifier.md +1 -1
  105. package/presets/claude/php-hexagonal/agents/code-reviewer.md +1 -1
  106. package/presets/claude/php-hexagonal/agents/debugger.md +1 -1
  107. package/presets/claude/php-hexagonal/agents/feature-developer.md +1 -1
  108. package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
  109. package/presets/claude/php-hexagonal/commands/update.md +1 -0
  110. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +163 -16
  111. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +29 -6
  112. package/presets/claude/php-hexagonal/rules/tooling-and-review/code-review.md +10 -0
  113. package/presets/claude/php-laravel/agents/build-verifier.md +1 -1
  114. package/presets/claude/php-laravel/agents/code-reviewer.md +1 -1
  115. package/presets/claude/php-laravel/agents/debugger.md +1 -1
  116. package/presets/claude/php-laravel/agents/feature-developer.md +1 -1
  117. package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
  118. package/presets/claude/php-laravel/commands/update.md +1 -0
  119. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +163 -16
  120. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +29 -6
  121. package/presets/claude/php-laravel/rules/tooling-and-review/code-review.md +10 -0
  122. package/presets/claude/svelte/agents/build-verifier.md +1 -1
  123. package/presets/claude/svelte/agents/code-reviewer.md +1 -1
  124. package/presets/claude/svelte/agents/debugger.md +1 -1
  125. package/presets/claude/svelte/agents/feature-developer.md +1 -1
  126. package/presets/claude/svelte/agents/task-analyst.md +1 -1
  127. package/presets/claude/svelte/commands/update.md +1 -0
  128. package/presets/claude/svelte/hooks/chain-team-phases.sh +163 -16
  129. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +29 -6
  130. package/presets/claude/svelte/rules/tooling-and-review/code-review-mr.md +10 -0
  131. package/presets/cursor/android-kotlin/agents/build-verifier.md +1 -1
  132. package/presets/cursor/android-kotlin/agents/code-reviewer.md +1 -1
  133. package/presets/cursor/android-kotlin/agents/debugger.md +1 -1
  134. package/presets/cursor/android-kotlin/agents/feature-developer.md +1 -1
  135. package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
  136. package/presets/cursor/android-kotlin/commands/update.md +1 -0
  137. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +163 -16
  138. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
  139. package/presets/cursor/android-kotlin/rules/code-review-mr.mdc +10 -0
  140. package/presets/cursor/go/agents/build-verifier.md +1 -1
  141. package/presets/cursor/go/agents/code-reviewer.md +1 -1
  142. package/presets/cursor/go/agents/debugger.md +1 -1
  143. package/presets/cursor/go/agents/feature-developer.md +1 -1
  144. package/presets/cursor/go/agents/task-analyst.md +1 -1
  145. package/presets/cursor/go/commands/update.md +1 -0
  146. package/presets/cursor/go/hooks/chain-team-phases.sh +163 -16
  147. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
  148. package/presets/cursor/go/rules/code-review-mr.mdc +10 -0
  149. package/presets/cursor/ios-swift/agents/build-verifier.md +1 -1
  150. package/presets/cursor/ios-swift/agents/code-reviewer.md +1 -1
  151. package/presets/cursor/ios-swift/agents/debugger.md +1 -1
  152. package/presets/cursor/ios-swift/agents/feature-developer.md +1 -1
  153. package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
  154. package/presets/cursor/ios-swift/commands/update.md +1 -0
  155. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +163 -16
  156. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
  157. package/presets/cursor/ios-swift/rules/code-review-mr.mdc +10 -0
  158. package/presets/cursor/java/agents/build-verifier.md +1 -1
  159. package/presets/cursor/java/agents/code-reviewer.md +1 -1
  160. package/presets/cursor/java/agents/debugger.md +1 -1
  161. package/presets/cursor/java/agents/feature-developer.md +1 -1
  162. package/presets/cursor/java/agents/task-analyst.md +1 -1
  163. package/presets/cursor/java/commands/update.md +1 -0
  164. package/presets/cursor/java/hooks/chain-team-phases.sh +163 -16
  165. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
  166. package/presets/cursor/java/rules/code-review-mr.mdc +10 -0
  167. package/presets/cursor/mcp-ts/agents/build-verifier.md +1 -1
  168. package/presets/cursor/mcp-ts/agents/feature-developer.md +1 -1
  169. package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
  170. package/presets/cursor/mcp-ts/commands/update.md +1 -0
  171. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +163 -16
  172. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
  173. package/presets/cursor/mcp-ts/rules/code-review-mr.mdc +10 -0
  174. package/presets/cursor/mol/MCP.md +4 -3
  175. package/presets/cursor/mol/agents/build-verifier.md +1 -1
  176. package/presets/cursor/mol/agents/code-reviewer.md +1 -1
  177. package/presets/cursor/mol/agents/debugger.md +1 -1
  178. package/presets/cursor/mol/agents/feature-developer.md +1 -1
  179. package/presets/cursor/mol/agents/task-analyst.md +1 -1
  180. package/presets/cursor/mol/commands/update.md +1 -0
  181. package/presets/cursor/mol/hooks/chain-team-phases.sh +163 -16
  182. package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +1 -1
  183. package/presets/cursor/mol/rules/code-review-mr.mdc +10 -0
  184. package/presets/cursor/next/MCP.md +4 -3
  185. package/presets/cursor/next/agents/README.md +2 -0
  186. package/presets/cursor/next/agents/build-verifier.md +18 -1
  187. package/presets/cursor/next/agents/code-reviewer.md +9 -1
  188. package/presets/cursor/next/agents/debugger.md +1 -1
  189. package/presets/cursor/next/agents/feature-developer.md +13 -1
  190. package/presets/cursor/next/agents/task-analyst.md +1 -1
  191. package/presets/cursor/next/agents/task-router.md +10 -0
  192. package/presets/cursor/next/commands/task-continue.md +3 -1
  193. package/presets/cursor/next/commands/update.md +1 -0
  194. package/presets/cursor/next/hooks/chain-team-phases.sh +163 -16
  195. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
  196. package/presets/cursor/next/rules/code-review-mr.mdc +12 -1
  197. package/presets/cursor/next/team/fixtures/feature-l2-lite.json +27 -0
  198. package/presets/cursor/nuxt/agents/build-verifier.md +1 -1
  199. package/presets/cursor/nuxt/agents/code-reviewer.md +1 -1
  200. package/presets/cursor/nuxt/agents/debugger.md +1 -1
  201. package/presets/cursor/nuxt/agents/feature-developer.md +1 -1
  202. package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
  203. package/presets/cursor/nuxt/commands/update.md +1 -0
  204. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +163 -16
  205. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
  206. package/presets/cursor/nuxt/rules/code-review-mr.mdc +10 -0
  207. package/presets/cursor/php-hexagonal/agents/build-verifier.md +1 -1
  208. package/presets/cursor/php-hexagonal/agents/code-reviewer.md +1 -1
  209. package/presets/cursor/php-hexagonal/agents/debugger.md +1 -1
  210. package/presets/cursor/php-hexagonal/agents/feature-developer.md +1 -1
  211. package/presets/cursor/php-hexagonal/agents/task-analyst.md +1 -1
  212. package/presets/cursor/php-hexagonal/commands/update.md +1 -0
  213. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +163 -16
  214. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
  215. package/presets/cursor/php-hexagonal/rules/code-review-mr.mdc +10 -0
  216. package/presets/cursor/php-laravel/agents/build-verifier.md +1 -1
  217. package/presets/cursor/php-laravel/agents/code-reviewer.md +1 -1
  218. package/presets/cursor/php-laravel/agents/debugger.md +1 -1
  219. package/presets/cursor/php-laravel/agents/feature-developer.md +1 -1
  220. package/presets/cursor/php-laravel/agents/task-analyst.md +1 -1
  221. package/presets/cursor/php-laravel/commands/update.md +1 -0
  222. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +163 -16
  223. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
  224. package/presets/cursor/php-laravel/rules/code-review-mr.mdc +10 -0
  225. package/presets/cursor/svelte/agents/build-verifier.md +1 -1
  226. package/presets/cursor/svelte/agents/code-reviewer.md +1 -1
  227. package/presets/cursor/svelte/agents/debugger.md +1 -1
  228. package/presets/cursor/svelte/agents/feature-developer.md +1 -1
  229. package/presets/cursor/svelte/agents/task-analyst.md +1 -1
  230. package/presets/cursor/svelte/commands/update.md +1 -0
  231. package/presets/cursor/svelte/hooks/chain-team-phases.sh +163 -16
  232. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
  233. package/presets/cursor/svelte/rules/code-review-mr.mdc +10 -0
  234. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  235. package/presets/mavis/android-kotlin/agents/build-verifier.md +1 -1
  236. package/presets/mavis/android-kotlin/agents/code-reviewer.md +1 -1
  237. package/presets/mavis/android-kotlin/agents/debugger.md +1 -1
  238. package/presets/mavis/android-kotlin/agents/feature-developer.md +1 -1
  239. package/presets/mavis/android-kotlin/agents/task-analyst.md +1 -1
  240. package/presets/mavis/android-kotlin/commands/update.md +1 -0
  241. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +163 -16
  242. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +29 -6
  243. package/presets/mavis/android-kotlin/rules/code-review-mr.md +10 -0
  244. package/presets/mavis/go/adapter-map.json +1 -1
  245. package/presets/mavis/go/agents/build-verifier.md +1 -1
  246. package/presets/mavis/go/agents/code-reviewer.md +1 -1
  247. package/presets/mavis/go/agents/debugger.md +1 -1
  248. package/presets/mavis/go/agents/feature-developer.md +1 -1
  249. package/presets/mavis/go/agents/task-analyst.md +1 -1
  250. package/presets/mavis/go/commands/update.md +1 -0
  251. package/presets/mavis/go/hooks/chain-team-phases.sh +163 -16
  252. package/presets/mavis/go/rules/agent-team-orchestrator.md +29 -6
  253. package/presets/mavis/go/rules/code-review-mr.md +10 -0
  254. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  255. package/presets/mavis/ios-swift/agents/build-verifier.md +1 -1
  256. package/presets/mavis/ios-swift/agents/code-reviewer.md +1 -1
  257. package/presets/mavis/ios-swift/agents/debugger.md +1 -1
  258. package/presets/mavis/ios-swift/agents/feature-developer.md +1 -1
  259. package/presets/mavis/ios-swift/agents/task-analyst.md +1 -1
  260. package/presets/mavis/ios-swift/commands/update.md +1 -0
  261. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +163 -16
  262. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +29 -6
  263. package/presets/mavis/ios-swift/rules/code-review-mr.md +10 -0
  264. package/presets/mavis/java/adapter-map.json +1 -1
  265. package/presets/mavis/java/agents/build-verifier.md +1 -1
  266. package/presets/mavis/java/agents/code-reviewer.md +1 -1
  267. package/presets/mavis/java/agents/debugger.md +1 -1
  268. package/presets/mavis/java/agents/feature-developer.md +1 -1
  269. package/presets/mavis/java/agents/task-analyst.md +1 -1
  270. package/presets/mavis/java/commands/update.md +1 -0
  271. package/presets/mavis/java/hooks/chain-team-phases.sh +163 -16
  272. package/presets/mavis/java/rules/agent-team-orchestrator.md +29 -6
  273. package/presets/mavis/java/rules/code-review-mr.md +10 -0
  274. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  275. package/presets/mavis/mcp-ts/agents/build-verifier.md +1 -1
  276. package/presets/mavis/mcp-ts/agents/feature-developer.md +1 -1
  277. package/presets/mavis/mcp-ts/agents/task-analyst.md +1 -1
  278. package/presets/mavis/mcp-ts/commands/update.md +1 -0
  279. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +163 -16
  280. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +29 -6
  281. package/presets/mavis/mcp-ts/rules/code-review-mr.md +10 -0
  282. package/presets/mavis/mol/MCP.md +4 -3
  283. package/presets/mavis/mol/adapter-map.json +1 -1
  284. package/presets/mavis/mol/agents/build-verifier.md +1 -1
  285. package/presets/mavis/mol/agents/code-reviewer.md +1 -1
  286. package/presets/mavis/mol/agents/debugger.md +1 -1
  287. package/presets/mavis/mol/agents/feature-developer.md +1 -1
  288. package/presets/mavis/mol/agents/task-analyst.md +1 -1
  289. package/presets/mavis/mol/commands/update.md +1 -0
  290. package/presets/mavis/mol/hooks/chain-team-phases.sh +163 -16
  291. package/presets/mavis/mol/rules/agent-team-orchestrator.md +29 -6
  292. package/presets/mavis/mol/rules/code-review-mr.md +10 -0
  293. package/presets/mavis/next/MCP.md +4 -3
  294. package/presets/mavis/next/adapter-map.json +9 -1
  295. package/presets/mavis/next/agents/build-verifier.md +18 -1
  296. package/presets/mavis/next/agents/code-reviewer.md +9 -1
  297. package/presets/mavis/next/agents/debugger.md +1 -1
  298. package/presets/mavis/next/agents/feature-developer.md +13 -1
  299. package/presets/mavis/next/agents/task-analyst.md +1 -1
  300. package/presets/mavis/next/agents/task-router.md +10 -0
  301. package/presets/mavis/next/commands/task-continue.md +3 -1
  302. package/presets/mavis/next/commands/update.md +1 -0
  303. package/presets/mavis/next/hooks/chain-team-phases.sh +163 -16
  304. package/presets/mavis/next/rules/agent-team-orchestrator.md +29 -6
  305. package/presets/mavis/next/rules/code-review-mr.md +12 -1
  306. package/presets/mavis/next/team/fixtures/feature-l2-lite.json +27 -0
  307. package/presets/mavis/nuxt/adapter-map.json +1 -1
  308. package/presets/mavis/nuxt/agents/build-verifier.md +1 -1
  309. package/presets/mavis/nuxt/agents/code-reviewer.md +1 -1
  310. package/presets/mavis/nuxt/agents/debugger.md +1 -1
  311. package/presets/mavis/nuxt/agents/feature-developer.md +1 -1
  312. package/presets/mavis/nuxt/agents/task-analyst.md +1 -1
  313. package/presets/mavis/nuxt/commands/update.md +1 -0
  314. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +163 -16
  315. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +29 -6
  316. package/presets/mavis/nuxt/rules/code-review-mr.md +10 -0
  317. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  318. package/presets/mavis/php-hexagonal/agents/build-verifier.md +1 -1
  319. package/presets/mavis/php-hexagonal/agents/code-reviewer.md +1 -1
  320. package/presets/mavis/php-hexagonal/agents/debugger.md +1 -1
  321. package/presets/mavis/php-hexagonal/agents/feature-developer.md +1 -1
  322. package/presets/mavis/php-hexagonal/agents/task-analyst.md +1 -1
  323. package/presets/mavis/php-hexagonal/commands/update.md +1 -0
  324. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +163 -16
  325. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +29 -6
  326. package/presets/mavis/php-hexagonal/rules/code-review-mr.md +10 -0
  327. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  328. package/presets/mavis/php-laravel/agents/build-verifier.md +1 -1
  329. package/presets/mavis/php-laravel/agents/code-reviewer.md +1 -1
  330. package/presets/mavis/php-laravel/agents/debugger.md +1 -1
  331. package/presets/mavis/php-laravel/agents/feature-developer.md +1 -1
  332. package/presets/mavis/php-laravel/agents/task-analyst.md +1 -1
  333. package/presets/mavis/php-laravel/commands/update.md +1 -0
  334. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +163 -16
  335. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +29 -6
  336. package/presets/mavis/php-laravel/rules/code-review-mr.md +10 -0
  337. package/presets/mavis/svelte/adapter-map.json +1 -1
  338. package/presets/mavis/svelte/agents/build-verifier.md +1 -1
  339. package/presets/mavis/svelte/agents/code-reviewer.md +1 -1
  340. package/presets/mavis/svelte/agents/debugger.md +1 -1
  341. package/presets/mavis/svelte/agents/feature-developer.md +1 -1
  342. package/presets/mavis/svelte/agents/task-analyst.md +1 -1
  343. package/presets/mavis/svelte/commands/update.md +1 -0
  344. package/presets/mavis/svelte/hooks/chain-team-phases.sh +163 -16
  345. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +29 -6
  346. package/presets/mavis/svelte/rules/code-review-mr.md +10 -0
  347. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  348. package/presets/opencode/android-kotlin/agents/build-verifier.md +1 -1
  349. package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -1
  350. package/presets/opencode/android-kotlin/agents/debugger.md +1 -1
  351. package/presets/opencode/android-kotlin/agents/feature-developer.md +1 -1
  352. package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
  353. package/presets/opencode/android-kotlin/commands/update.md +1 -0
  354. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +163 -16
  355. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +29 -6
  356. package/presets/opencode/android-kotlin/rules/code-review-mr.md +10 -0
  357. package/presets/opencode/go/adapter-map.json +1 -1
  358. package/presets/opencode/go/agents/build-verifier.md +1 -1
  359. package/presets/opencode/go/agents/code-reviewer.md +1 -1
  360. package/presets/opencode/go/agents/debugger.md +1 -1
  361. package/presets/opencode/go/agents/feature-developer.md +1 -1
  362. package/presets/opencode/go/agents/task-analyst.md +1 -1
  363. package/presets/opencode/go/commands/update.md +1 -0
  364. package/presets/opencode/go/hooks/chain-team-phases.sh +163 -16
  365. package/presets/opencode/go/rules/agent-team-orchestrator.md +29 -6
  366. package/presets/opencode/go/rules/code-review-mr.md +10 -0
  367. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  368. package/presets/opencode/ios-swift/agents/build-verifier.md +1 -1
  369. package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -1
  370. package/presets/opencode/ios-swift/agents/debugger.md +1 -1
  371. package/presets/opencode/ios-swift/agents/feature-developer.md +1 -1
  372. package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
  373. package/presets/opencode/ios-swift/commands/update.md +1 -0
  374. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +163 -16
  375. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +29 -6
  376. package/presets/opencode/ios-swift/rules/code-review-mr.md +10 -0
  377. package/presets/opencode/java/adapter-map.json +1 -1
  378. package/presets/opencode/java/agents/build-verifier.md +1 -1
  379. package/presets/opencode/java/agents/code-reviewer.md +1 -1
  380. package/presets/opencode/java/agents/debugger.md +1 -1
  381. package/presets/opencode/java/agents/feature-developer.md +1 -1
  382. package/presets/opencode/java/agents/task-analyst.md +1 -1
  383. package/presets/opencode/java/commands/update.md +1 -0
  384. package/presets/opencode/java/hooks/chain-team-phases.sh +163 -16
  385. package/presets/opencode/java/rules/agent-team-orchestrator.md +29 -6
  386. package/presets/opencode/java/rules/code-review-mr.md +10 -0
  387. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  388. package/presets/opencode/mcp-ts/agents/build-verifier.md +1 -1
  389. package/presets/opencode/mcp-ts/agents/feature-developer.md +1 -1
  390. package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
  391. package/presets/opencode/mcp-ts/commands/update.md +1 -0
  392. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +163 -16
  393. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +29 -6
  394. package/presets/opencode/mcp-ts/rules/code-review-mr.md +10 -0
  395. package/presets/opencode/mol/MCP.md +4 -3
  396. package/presets/opencode/mol/adapter-map.json +1 -1
  397. package/presets/opencode/mol/agents/build-verifier.md +1 -1
  398. package/presets/opencode/mol/agents/code-reviewer.md +1 -1
  399. package/presets/opencode/mol/agents/debugger.md +1 -1
  400. package/presets/opencode/mol/agents/feature-developer.md +1 -1
  401. package/presets/opencode/mol/agents/task-analyst.md +1 -1
  402. package/presets/opencode/mol/commands/update.md +1 -0
  403. package/presets/opencode/mol/hooks/chain-team-phases.sh +163 -16
  404. package/presets/opencode/mol/rules/agent-team-orchestrator.md +29 -6
  405. package/presets/opencode/mol/rules/code-review-mr.md +10 -0
  406. package/presets/opencode/next/MCP.md +4 -3
  407. package/presets/opencode/next/adapter-map.json +9 -1
  408. package/presets/opencode/next/agents/build-verifier.md +18 -1
  409. package/presets/opencode/next/agents/code-reviewer.md +9 -1
  410. package/presets/opencode/next/agents/debugger.md +1 -1
  411. package/presets/opencode/next/agents/feature-developer.md +13 -1
  412. package/presets/opencode/next/agents/task-analyst.md +1 -1
  413. package/presets/opencode/next/agents/task-router.md +10 -0
  414. package/presets/opencode/next/commands/task-continue.md +3 -1
  415. package/presets/opencode/next/commands/update.md +1 -0
  416. package/presets/opencode/next/hooks/chain-team-phases.sh +163 -16
  417. package/presets/opencode/next/rules/agent-team-orchestrator.md +29 -6
  418. package/presets/opencode/next/rules/code-review-mr.md +12 -1
  419. package/presets/opencode/next/team/fixtures/feature-l2-lite.json +27 -0
  420. package/presets/opencode/nuxt/adapter-map.json +1 -1
  421. package/presets/opencode/nuxt/agents/build-verifier.md +1 -1
  422. package/presets/opencode/nuxt/agents/code-reviewer.md +1 -1
  423. package/presets/opencode/nuxt/agents/debugger.md +1 -1
  424. package/presets/opencode/nuxt/agents/feature-developer.md +1 -1
  425. package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
  426. package/presets/opencode/nuxt/commands/update.md +1 -0
  427. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +163 -16
  428. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +29 -6
  429. package/presets/opencode/nuxt/rules/code-review-mr.md +10 -0
  430. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  431. package/presets/opencode/php-hexagonal/agents/build-verifier.md +1 -1
  432. package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -1
  433. package/presets/opencode/php-hexagonal/agents/debugger.md +1 -1
  434. package/presets/opencode/php-hexagonal/agents/feature-developer.md +1 -1
  435. package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
  436. package/presets/opencode/php-hexagonal/commands/update.md +1 -0
  437. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +163 -16
  438. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +29 -6
  439. package/presets/opencode/php-hexagonal/rules/code-review-mr.md +10 -0
  440. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  441. package/presets/opencode/php-laravel/agents/build-verifier.md +1 -1
  442. package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -1
  443. package/presets/opencode/php-laravel/agents/debugger.md +1 -1
  444. package/presets/opencode/php-laravel/agents/feature-developer.md +1 -1
  445. package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
  446. package/presets/opencode/php-laravel/commands/update.md +1 -0
  447. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +163 -16
  448. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +29 -6
  449. package/presets/opencode/php-laravel/rules/code-review-mr.md +10 -0
  450. package/presets/opencode/svelte/adapter-map.json +1 -1
  451. package/presets/opencode/svelte/agents/build-verifier.md +1 -1
  452. package/presets/opencode/svelte/agents/code-reviewer.md +1 -1
  453. package/presets/opencode/svelte/agents/debugger.md +1 -1
  454. package/presets/opencode/svelte/agents/feature-developer.md +1 -1
  455. package/presets/opencode/svelte/agents/task-analyst.md +1 -1
  456. package/presets/opencode/svelte/commands/update.md +1 -0
  457. package/presets/opencode/svelte/hooks/chain-team-phases.sh +163 -16
  458. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +29 -6
  459. package/presets/opencode/svelte/rules/code-review-mr.md +10 -0
  460. package/presets/zcode/android-kotlin/adapter-map.json +1 -1
  461. package/presets/zcode/android-kotlin/agents/build-verifier.md +1 -1
  462. package/presets/zcode/android-kotlin/agents/code-reviewer.md +1 -1
  463. package/presets/zcode/android-kotlin/agents/debugger.md +1 -1
  464. package/presets/zcode/android-kotlin/agents/feature-developer.md +1 -1
  465. package/presets/zcode/android-kotlin/agents/task-analyst.md +1 -1
  466. package/presets/zcode/android-kotlin/commands/update.md +1 -0
  467. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +163 -16
  468. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +29 -6
  469. package/presets/zcode/android-kotlin/rules/code-review-mr.md +10 -0
  470. package/presets/zcode/go/adapter-map.json +1 -1
  471. package/presets/zcode/go/agents/build-verifier.md +1 -1
  472. package/presets/zcode/go/agents/code-reviewer.md +1 -1
  473. package/presets/zcode/go/agents/debugger.md +1 -1
  474. package/presets/zcode/go/agents/feature-developer.md +1 -1
  475. package/presets/zcode/go/agents/task-analyst.md +1 -1
  476. package/presets/zcode/go/commands/update.md +1 -0
  477. package/presets/zcode/go/hooks/chain-team-phases.sh +163 -16
  478. package/presets/zcode/go/rules/agent-team-orchestrator.md +29 -6
  479. package/presets/zcode/go/rules/code-review-mr.md +10 -0
  480. package/presets/zcode/ios-swift/adapter-map.json +1 -1
  481. package/presets/zcode/ios-swift/agents/build-verifier.md +1 -1
  482. package/presets/zcode/ios-swift/agents/code-reviewer.md +1 -1
  483. package/presets/zcode/ios-swift/agents/debugger.md +1 -1
  484. package/presets/zcode/ios-swift/agents/feature-developer.md +1 -1
  485. package/presets/zcode/ios-swift/agents/task-analyst.md +1 -1
  486. package/presets/zcode/ios-swift/commands/update.md +1 -0
  487. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +163 -16
  488. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +29 -6
  489. package/presets/zcode/ios-swift/rules/code-review-mr.md +10 -0
  490. package/presets/zcode/java/adapter-map.json +1 -1
  491. package/presets/zcode/java/agents/build-verifier.md +1 -1
  492. package/presets/zcode/java/agents/code-reviewer.md +1 -1
  493. package/presets/zcode/java/agents/debugger.md +1 -1
  494. package/presets/zcode/java/agents/feature-developer.md +1 -1
  495. package/presets/zcode/java/agents/task-analyst.md +1 -1
  496. package/presets/zcode/java/commands/update.md +1 -0
  497. package/presets/zcode/java/hooks/chain-team-phases.sh +163 -16
  498. package/presets/zcode/java/rules/agent-team-orchestrator.md +29 -6
  499. package/presets/zcode/java/rules/code-review-mr.md +10 -0
  500. package/presets/zcode/mcp-ts/adapter-map.json +1 -1
  501. package/presets/zcode/mcp-ts/agents/build-verifier.md +1 -1
  502. package/presets/zcode/mcp-ts/agents/feature-developer.md +1 -1
  503. package/presets/zcode/mcp-ts/agents/task-analyst.md +1 -1
  504. package/presets/zcode/mcp-ts/commands/update.md +1 -0
  505. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +163 -16
  506. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +29 -6
  507. package/presets/zcode/mcp-ts/rules/code-review-mr.md +10 -0
  508. package/presets/zcode/mol/MCP.md +4 -3
  509. package/presets/zcode/mol/adapter-map.json +1 -1
  510. package/presets/zcode/mol/agents/build-verifier.md +1 -1
  511. package/presets/zcode/mol/agents/code-reviewer.md +1 -1
  512. package/presets/zcode/mol/agents/debugger.md +1 -1
  513. package/presets/zcode/mol/agents/feature-developer.md +1 -1
  514. package/presets/zcode/mol/agents/task-analyst.md +1 -1
  515. package/presets/zcode/mol/commands/update.md +1 -0
  516. package/presets/zcode/mol/hooks/chain-team-phases.sh +163 -16
  517. package/presets/zcode/mol/rules/agent-team-orchestrator.md +29 -6
  518. package/presets/zcode/mol/rules/code-review-mr.md +10 -0
  519. package/presets/zcode/next/MCP.md +4 -3
  520. package/presets/zcode/next/adapter-map.json +9 -1
  521. package/presets/zcode/next/agents/build-verifier.md +18 -1
  522. package/presets/zcode/next/agents/code-reviewer.md +9 -1
  523. package/presets/zcode/next/agents/debugger.md +1 -1
  524. package/presets/zcode/next/agents/feature-developer.md +13 -1
  525. package/presets/zcode/next/agents/task-analyst.md +1 -1
  526. package/presets/zcode/next/agents/task-router.md +10 -0
  527. package/presets/zcode/next/commands/task-continue.md +3 -1
  528. package/presets/zcode/next/commands/update.md +1 -0
  529. package/presets/zcode/next/hooks/chain-team-phases.sh +163 -16
  530. package/presets/zcode/next/rules/agent-team-orchestrator.md +29 -6
  531. package/presets/zcode/next/rules/code-review-mr.md +12 -1
  532. package/presets/zcode/next/team/fixtures/feature-l2-lite.json +27 -0
  533. package/presets/zcode/nuxt/adapter-map.json +1 -1
  534. package/presets/zcode/nuxt/agents/build-verifier.md +1 -1
  535. package/presets/zcode/nuxt/agents/code-reviewer.md +1 -1
  536. package/presets/zcode/nuxt/agents/debugger.md +1 -1
  537. package/presets/zcode/nuxt/agents/feature-developer.md +1 -1
  538. package/presets/zcode/nuxt/agents/task-analyst.md +1 -1
  539. package/presets/zcode/nuxt/commands/update.md +1 -0
  540. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +163 -16
  541. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +29 -6
  542. package/presets/zcode/nuxt/rules/code-review-mr.md +10 -0
  543. package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
  544. package/presets/zcode/php-hexagonal/agents/build-verifier.md +1 -1
  545. package/presets/zcode/php-hexagonal/agents/code-reviewer.md +1 -1
  546. package/presets/zcode/php-hexagonal/agents/debugger.md +1 -1
  547. package/presets/zcode/php-hexagonal/agents/feature-developer.md +1 -1
  548. package/presets/zcode/php-hexagonal/agents/task-analyst.md +1 -1
  549. package/presets/zcode/php-hexagonal/commands/update.md +1 -0
  550. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +163 -16
  551. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +29 -6
  552. package/presets/zcode/php-hexagonal/rules/code-review-mr.md +10 -0
  553. package/presets/zcode/php-laravel/adapter-map.json +1 -1
  554. package/presets/zcode/php-laravel/agents/build-verifier.md +1 -1
  555. package/presets/zcode/php-laravel/agents/code-reviewer.md +1 -1
  556. package/presets/zcode/php-laravel/agents/debugger.md +1 -1
  557. package/presets/zcode/php-laravel/agents/feature-developer.md +1 -1
  558. package/presets/zcode/php-laravel/agents/task-analyst.md +1 -1
  559. package/presets/zcode/php-laravel/commands/update.md +1 -0
  560. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +163 -16
  561. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +29 -6
  562. package/presets/zcode/php-laravel/rules/code-review-mr.md +10 -0
  563. package/presets/zcode/svelte/adapter-map.json +1 -1
  564. package/presets/zcode/svelte/agents/build-verifier.md +1 -1
  565. package/presets/zcode/svelte/agents/code-reviewer.md +1 -1
  566. package/presets/zcode/svelte/agents/debugger.md +1 -1
  567. package/presets/zcode/svelte/agents/feature-developer.md +1 -1
  568. package/presets/zcode/svelte/agents/task-analyst.md +1 -1
  569. package/presets/zcode/svelte/commands/update.md +1 -0
  570. package/presets/zcode/svelte/hooks/chain-team-phases.sh +163 -16
  571. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +29 -6
  572. package/presets/zcode/svelte/rules/code-review-mr.md +10 -0
@@ -29,7 +29,9 @@ import { pathToFileURL } from 'node:url';
29
29
  import { appendSignal, groupSignatures, isSignalRecord } from './signals.mjs';
30
30
  import {
31
31
  MAX_ACTIVE_RULES,
32
- MAX_TOTAL_LINES,
32
+ MAX_RULE_LINES,
33
+ MAX_CONVENTION_LINES,
34
+ addedLine,
33
35
  canonicalSignature,
34
36
  collectScriptReport,
35
37
  countRulesAndLines,
@@ -37,6 +39,7 @@ import {
37
39
  formatLessonStatus,
38
40
  loadAliasMap,
39
41
  loadCatalog,
42
+ previewImprover,
40
43
  resolveLesson,
41
44
  runImprover,
42
45
  thresholdAction,
@@ -236,14 +239,27 @@ export function statusReport({ baseDir = DEFAULT_BASE_DIR } = {}) {
236
239
 
237
240
  // The engine fails closed on an unreadable rule; the read-only report must
238
241
  // still print, so the envelope degrades to `unreadable` instead of throwing.
242
+ // Two stores, two envelopes: the human `rules/` store and the machine
243
+ // `conventions.md` store each carry their own cap.
239
244
  let envelope;
240
- let envelopeState;
245
+ let rulesState;
246
+ let conventionsState;
241
247
  try {
242
248
  envelope = countRulesAndLines({ rulesDir, conventionsPath });
243
- envelopeState = evaluateEnvelope({ ruleCount: envelope.ruleCount, lineCount: envelope.lineCount });
249
+ rulesState = evaluateEnvelope({
250
+ store: 'rules',
251
+ ruleCount: envelope.rules.ruleCount,
252
+ lineCount: envelope.rules.lineCount,
253
+ });
254
+ conventionsState = evaluateEnvelope({
255
+ store: 'conventions',
256
+ lineCount: envelope.conventions.lineCount,
257
+ });
244
258
  } catch (error) {
245
- envelope = { ruleCount: 0, lineCount: 0 };
246
- envelopeState = { reason: `unreadable — ${error instanceof Error ? error.message : String(error)}` };
259
+ envelope = { rules: { ruleCount: 0, lineCount: 0 }, conventions: { lineCount: 0 } };
260
+ const reason = `unreadable — ${error instanceof Error ? error.message : String(error)}`;
261
+ rulesState = { reason };
262
+ conventionsState = { reason };
247
263
  }
248
264
  const pending = deriveGateSignals({ baseDir }).signals.length;
249
265
 
@@ -251,7 +267,8 @@ export function statusReport({ baseDir = DEFAULT_BASE_DIR } = {}) {
251
267
  lines.push(`store: ${storeState}`);
252
268
  lines.push(`pending derivations: ${pending}` + (pending > 0 ? ' (evidence not captured yet)' : ''));
253
269
  lines.push(
254
- `envelope: ${envelope.ruleCount}/${MAX_ACTIVE_RULES} rules, ${envelope.lineCount}/${MAX_TOTAL_LINES} lines — ${envelopeState.reason}`,
270
+ `rules envelope: ${envelope.rules.lineCount}/${MAX_RULE_LINES} lines, ${envelope.rules.ruleCount}/${MAX_ACTIVE_RULES} rules — ${rulesState.reason}`,
271
+ `conventions envelope: ${envelope.conventions.lineCount}/${MAX_CONVENTION_LINES} lines — ${conventionsState.reason}`,
255
272
  );
256
273
  for (const error of errors) {
257
274
  lines.push(` - malformed store line ${error.line}: ${error.reason}`);
@@ -363,17 +380,132 @@ export function strictReport(health) {
363
380
  return `${lines.join('\n')}\n`;
364
381
  }
365
382
 
366
- const CLI_USAGE = `Usage: node .ai.local/scripts/run.mjs [--status | --strict]
383
+ // --- Read-only preview (`--dry-run`) ------------------------------------------
384
+
385
+ export const DRY_RUN_BANNER = 'DRY RUN — no files, signals, or ledger rows will be written';
386
+
387
+ function previewTarget(target, rootDir) {
388
+ if (typeof target !== 'string') return '(no file)';
389
+ if (!path.isAbsolute(target)) return target;
390
+ const relative = path.relative(rootDir, target);
391
+ return relative.split(path.sep).join('/');
392
+ }
393
+
394
+ function conciseDelta(before, after) {
395
+ if (before == null && after == null) return 'no change';
396
+ if (before == null) return `new file (${String(after).split('\n').length} line(s))`;
397
+ if (after == null) return 'delete file';
398
+ if (before === after) return 'no change';
399
+ const line = addedLine(before, after);
400
+ if (line) return `+ ${line}`;
401
+ const beforeLines = new Set(String(before).split('\n').map((row) => row.trim()).filter(Boolean));
402
+ const afterLines = new Set(String(after).split('\n').map((row) => row.trim()).filter(Boolean));
403
+ let added = 0;
404
+ let removed = 0;
405
+ for (const row of afterLines) if (!beforeLines.has(row)) added += 1;
406
+ for (const row of beforeLines) if (!afterLines.has(row)) removed += 1;
407
+ return `+${added}/-${removed} line(s)`;
408
+ }
409
+
410
+ /**
411
+ * Read-only preview of the loop: the same derive and improver decision path,
412
+ * with every mutating transition recorded instead of executed. No signal is
413
+ * appended, no lock or intent file is created, no target or ledger is written.
414
+ */
415
+ export function dryRunReport({ baseDir = DEFAULT_BASE_DIR, rootDir } = {}) {
416
+ const displayRoot = rootDir ?? path.dirname(baseDir);
417
+ const derived = deriveGateSignals({ baseDir });
418
+ const preview = previewImprover({ baseDir, ...(rootDir ? { rootDir } : {}) });
419
+
420
+ const lines = [DRY_RUN_BANNER, '', 'Self-learning loop — dry run', ''];
421
+ lines.push(`derived: ${derived.signals.length} signal(s) — none appended`);
422
+ for (const signal of derived.signals) {
423
+ lines.push(` - would append ${signal.signature} from ${signal.slug}`);
424
+ }
425
+ for (const item of derived.skipped) {
426
+ lines.push(` - skipped ${item.slug} (${item.kind}): ${item.reason}`);
427
+ }
428
+ for (const error of derived.errors) {
429
+ lines.push(` - derive error: ${error.reason}`);
430
+ }
431
+ lines.push('', 'The improver preview below reflects the current signal store; the derived signals above are not counted into tiers.');
432
+
433
+ const rows = new Map();
434
+ for (const decision of preview.decisions) {
435
+ rows.set(decision.signature, { signature: decision.signature, tier: decision.tier, writes: [] });
436
+ }
437
+ for (const op of preview.writes) {
438
+ const signature = op.entry && typeof op.entry.signature === 'string' ? op.entry.signature : '(no signature)';
439
+ const row = rows.get(signature) ?? { signature, tier: null, writes: [] };
440
+ row.writes.push(op);
441
+ rows.set(signature, row);
442
+ }
443
+ for (const item of preview.skipped) {
444
+ const row = rows.get(item.signature);
445
+ if (row) {
446
+ row.skipped = item.reason;
447
+ continue;
448
+ }
449
+ rows.set(item.signature, { signature: item.signature, tier: null, writes: [], skipped: item.reason });
450
+ }
451
+
452
+ lines.push('');
453
+ if (rows.size === 0) {
454
+ lines.push('no decision planned — nothing would be written');
455
+ }
456
+ for (const row of rows.values()) {
457
+ const tier = row.tier ? `tier ${row.tier.tier} → ${row.tier.action}` : 'no decision';
458
+ lines.push(`${row.signature} — ${tier}`);
459
+ if (row.skipped) {
460
+ lines.push(` skipped: ${row.skipped}`);
461
+ continue;
462
+ }
463
+ const fileOps = row.writes.filter((op) => op.kind === 'file');
464
+ const ledgerOps = row.writes.filter((op) => op.kind === 'ledger');
465
+ if (fileOps.length === 0) {
466
+ lines.push(` target: ${ledgerOps[0]?.entry?.target ?? '(ledger row only)'}`);
467
+ lines.push(' before → after: no target file write');
468
+ }
469
+ for (const op of fileOps) {
470
+ lines.push(` target: ${previewTarget(op.target, displayRoot)}`);
471
+ lines.push(` before → after: ${conciseDelta(op.before, op.after)}`);
472
+ }
473
+ const writeLabels = [
474
+ ...fileOps.map((op) => {
475
+ const mode = op.after == null ? 'delete' : op.before == null ? 'create' : 'update';
476
+ return `file ${previewTarget(op.target, displayRoot)} (${mode})`;
477
+ }),
478
+ ...ledgerOps.map((op) => `ledger ${op.entry?.action ?? 'row'}`),
479
+ ];
480
+ lines.push(` writes: ${writeLabels.length > 0 ? writeLabels.join('; ') : 'none'}`);
481
+ }
482
+ if (preview.rejected.length > 0) {
483
+ lines.push('', `rejected (${preview.rejected.length}) — denylist`);
484
+ for (const item of preview.rejected) lines.push(` - ${item.signature}`);
485
+ }
486
+ if (preview.errors.length > 0) {
487
+ lines.push('', `errors (${preview.errors.length})`);
488
+ for (const error of preview.errors) {
489
+ lines.push(` - ${error.signature ?? 'unknown'}: ${error.reason}`);
490
+ }
491
+ }
492
+ lines.push('', 'none of the writes above were performed');
493
+ return `${lines.join('\n')}\n`;
494
+ }
495
+
496
+ const CLI_USAGE = `Usage: node .ai.local/scripts/run.mjs [--status | --strict | --dry-run]
367
497
 
368
498
  (no flag) run derive → append → improve and print the combined report
369
499
  --status read-only report: per-signature slugs, tier, next action, last
370
500
  capture, errors, cohort readiness, envelope, pending derivations
371
501
  --strict read-only capture check; exit 1 when capture is broken
502
+ --dry-run read-only preview: the same decision path, banner, target,
503
+ before/after and the exact write plan; writes nothing
372
504
 
373
- Both inspection modes are write-free and must not be invoked by the chain hook.
505
+ All inspection modes are write-free and must not be invoked by the chain hook.
374
506
  `;
375
507
 
376
- // CLI entry: `node run.mjs` runs the loop; `--status` / `--strict` inspect it.
508
+ // CLI entry: `node run.mjs` runs the loop; `--status` / `--strict` / `--dry-run` inspect it.
377
509
  if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
378
510
  const args = process.argv.slice(2);
379
511
  if (args.length === 0) {
@@ -384,6 +516,8 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
384
516
  const health = captureHealth();
385
517
  process.stdout.write(strictReport(health));
386
518
  process.exitCode = health.broken ? 1 : 0;
519
+ } else if (args.length === 1 && args[0] === '--dry-run') {
520
+ process.stdout.write(dryRunReport());
387
521
  } else {
388
522
  process.stderr.write(CLI_USAGE);
389
523
  process.exitCode = 2;
@@ -903,6 +903,7 @@ const getHealth = (handle, settings) => {
903
903
  },
904
904
  tasks: { total: Number(totals.total), absent: Number(totals.absent) },
905
905
  projectedAt: totals.projected_at ?? null,
906
+ capabilities: ['sync', 'delete'],
906
907
  };
907
908
  };
908
909
 
@@ -624,8 +624,12 @@ const schemas = {
624
624
  ['total', 'absent'],
625
625
  ),
626
626
  projectedAt: nullable('string'),
627
+ capabilities: {
628
+ type: 'array',
629
+ items: { type: 'string', enum: ['sync', 'delete'] },
630
+ },
627
631
  },
628
- ['status', 'db', 'tasks', 'projectedAt'],
632
+ ['status', 'db', 'tasks', 'projectedAt', 'capabilities'],
629
633
  ),
630
634
  Migration: object(
631
635
  {
@@ -934,6 +938,7 @@ const EXAMPLES = {
934
938
  db: { file: 'team.db', present: true, schemaVersion: 1, fingerprintOk: true, search: 'fts5' },
935
939
  tasks: { total: 90, absent: 0 },
936
940
  projectedAt: '2026-11-06T08:00:04.000Z',
941
+ capabilities: ['sync', 'delete'],
937
942
  },
938
943
  ],
939
944
  Meta: [
@@ -1609,7 +1609,7 @@ export function deleteTaskProjection(options = {}) {
1609
1609
  teamDbFail('E_DISABLED', 'disabled by AI_RULES_TEAM_DB_DISABLE', 1);
1610
1610
  }
1611
1611
  if (!SLUG_RE.test(slug)) {
1612
- teamDbFail('E_USAGE', `delete needs a slug matching ${SLUG_RE.source}`, 3);
1612
+ teamDbFail('E_USAGE', `delete needs --slug matching ${SLUG_RE.source}`, 3);
1613
1613
  }
1614
1614
  const teamRoot = path.resolve(options.teamRoot || process.env.AI_RULES_TEAM_DB_ROOT || DEFAULT_TEAM_ROOT);
1615
1615
  const tasksRoot = path.join(teamRoot, 'tasks');
@@ -33,6 +33,44 @@ export const INDEX_UNAVAILABLE_LINE = `team-db: node:sqlite unavailable (require
33
33
 
34
34
  export const DEFAULT_TEAM_ROOT = path.join(process.cwd(), '.ai.local', 'team');
35
35
 
36
+ /**
37
+ * The released FTS layouts, oldest-first. The current shape is last.
38
+ *
39
+ * A shape is recorded in `schema_meta` under `search_fts_shape` when the search
40
+ * table is created. The registry enumerates **released** shapes only — a shape
41
+ * that was never released would make the registry lie — so the next shape is
42
+ * appended, never edited in place. The registry is not a migration chain: it
43
+ * records which layout is installed, and a drifted layout is reported, never
44
+ * rebuilt.
45
+ */
46
+ export const FTS_SHAPES = [
47
+ {
48
+ id: 'fts5-v1',
49
+ columns: ['task_slug UNINDEXED', 'doc_path UNINDEXED', 'kind UNINDEXED', 'body'],
50
+ tokenizer: 'unicode61 remove_diacritics 2',
51
+ },
52
+ ];
53
+ export const CURRENT_FTS_SHAPE = FTS_SHAPES[FTS_SHAPES.length - 1];
54
+ export const FTS_SHAPE_META_KEY = 'search_fts_shape';
55
+
56
+ /** The five drift states of an installed search table. */
57
+ export const FTS_DRIFT_STATES = ['absent', 'current', 'unrecorded', 'superseded', 'unknown'];
58
+
59
+ /** The installed table's column names, in declaration order. */
60
+ export const ftsColumnNames = (db) =>
61
+ db
62
+ .prepare(`PRAGMA table_info(${SEARCH_TABLE})`)
63
+ .all()
64
+ .map((row) => String(row.name));
65
+
66
+ /** The comparable signature of a shape: its column names, `UNINDEXED` dropped. */
67
+ export const ftsShapeSignature = (shape) =>
68
+ shape.columns.map((column) => column.replace(/\s+UNINDEXED\b/i, '').trim()).join(',');
69
+
70
+ /** The DDL of a shape. */
71
+ export const ftsShapeSql = (shape) =>
72
+ `CREATE VIRTUAL TABLE IF NOT EXISTS ${SEARCH_TABLE} USING fts5(\n ${shape.columns.join(',\n ')},\n tokenize = '${shape.tokenizer}'\n )`;
73
+
36
74
  const SQL = String.raw;
37
75
 
38
76
  export const BASE_SQL = SQL`
@@ -501,17 +539,14 @@ export function ensureSearchIndex(db, options = {}) {
501
539
  writeSchemaMeta(db, 'search', SEARCH_MODE_LIKE);
502
540
  return SEARCH_MODE_LIKE;
503
541
  }
542
+ const existed = tableExists(db, SEARCH_TABLE);
504
543
  try {
505
- db.exec(
506
- `CREATE VIRTUAL TABLE IF NOT EXISTS ${SEARCH_TABLE} USING fts5(
507
- task_slug UNINDEXED,
508
- doc_path UNINDEXED,
509
- kind UNINDEXED,
510
- body,
511
- tokenize = 'unicode61 remove_diacritics 2'
512
- )`,
513
- );
544
+ db.exec(ftsShapeSql(CURRENT_FTS_SHAPE));
514
545
  writeSchemaMeta(db, 'search', SEARCH_MODE_FTS5);
546
+ // The shape token is written only when the table is created: a database
547
+ // that predates the registry keeps an absent token, so its state stays
548
+ // `unrecorded` and keeps being reported.
549
+ if (!existed) writeSchemaMeta(db, FTS_SHAPE_META_KEY, CURRENT_FTS_SHAPE.id);
515
550
  return SEARCH_MODE_FTS5;
516
551
  } catch {
517
552
  writeSchemaMeta(db, 'search', SEARCH_MODE_LIKE);
@@ -519,6 +554,34 @@ export function ensureSearchIndex(db, options = {}) {
519
554
  }
520
555
  }
521
556
 
557
+ /**
558
+ * The drift state of the installed search table.
559
+ *
560
+ * The state is **reported**, never repaired: a drifted table is left as it is,
561
+ * the database stays readable, and the remedy is the existing rebuild path.
562
+ */
563
+ export function detectFtsShapeDrift(db) {
564
+ if (!tableExists(db, SEARCH_TABLE)) {
565
+ return { state: 'absent', recorded: null, shape: null, columns: [] };
566
+ }
567
+ const columns = ftsColumnNames(db);
568
+ const recorded = readSchemaMeta(db, FTS_SHAPE_META_KEY);
569
+ if (recorded === null) {
570
+ return { state: 'unrecorded', recorded: null, shape: null, columns };
571
+ }
572
+ const known = FTS_SHAPES.find((shape) => shape.id === recorded);
573
+ if (!known) {
574
+ return { state: 'unknown', recorded, shape: null, columns };
575
+ }
576
+ if (known.id !== CURRENT_FTS_SHAPE.id) {
577
+ return { state: 'superseded', recorded, shape: known.id, columns };
578
+ }
579
+ if (columns.join(',') !== ftsShapeSignature(known)) {
580
+ return { state: 'unknown', recorded, shape: known.id, columns };
581
+ }
582
+ return { state: 'current', recorded, shape: known.id, columns };
583
+ }
584
+
522
585
  export function readSearchMode(db) {
523
586
  const meta = readSchemaMeta(db, 'search');
524
587
  if (!tableExists(db, SEARCH_TABLE)) return SEARCH_MODE_LIKE;
@@ -783,6 +846,7 @@ export function openTeamDb(options = {}) {
783
846
  schemaVersion: current < SCHEMA_VERSION ? SCHEMA_VERSION : current,
784
847
  fingerprint,
785
848
  searchMode,
849
+ searchShape: detectFtsShapeDrift(db),
786
850
  };
787
851
  } catch (error) {
788
852
  try {
@@ -826,6 +890,12 @@ export function describeHandle(handle) {
826
890
  `search ${handle.searchMode}`,
827
891
  'integrity ok',
828
892
  ];
893
+ // A drifted search layout is reported, never repaired: the state names what
894
+ // is installed, and the rebuild path stays the remedy.
895
+ const shape = handle.searchShape;
896
+ if (shape && shape.state !== 'current' && shape.state !== 'absent') {
897
+ parts.push(`search-shape ${shape.state}`);
898
+ }
829
899
  if (handle.rebuilt) parts.push('rebuilt=1');
830
900
  return `${handle.dbPath}: ok (${parts.join(', ')})`;
831
901
  }
@@ -196,6 +196,16 @@ Additional states: `blocked` — a step (or a parallel producer) cannot proceed;
196
196
  | `validation_failed` | build-verifier failed; re-run developer then build-verifier |
197
197
  | `blocked` | Pipeline / step cannot proceed (e.g. `pipeline_parse_error`, completion of a parallel step whose producer's receipt was missing — see `agent-artifact-contracts.md` § Completion receipts) |
198
198
  | `awaiting_artifact_receipt` | Producer stopped but the bound or assigned-output receipt was missing or stale; hook keeps the attempt active and does not advance. See `agent-artifact-contracts.md` (Schema field name + Receipt binding) for the silent-bug class that lands here. |
199
+ | `paused` | Operator sentinel engaged; the hook recorded the pause and refused to advance or hand off. Remove the sentinel and run `/task-continue`. |
200
+
201
+ ### Operator pause and stale-attempt recovery
202
+
203
+ - Pause new steps with a file at `.ai.local/STOP` (also accepted: `.ai.local/ESTOP`). The chain hook finishes the in-flight attempt and its terminal receipt, records `state: paused` / `phase: paused`, and emits no handoff. An empty or corrupt sentinel still counts as engaged.
204
+ - A paused human gate stays open: the pause check runs before `end_human_gate` closes it, so removing the sentinel and running `/task-continue <slug>` reruns the same gate resume.
205
+ - Remove the sentinel, then run `/task-continue <slug>`. Only the hook writes the `paused` state; never edit `status.json` to pause or resume.
206
+ - An `activeAttempts` entry for the step being activated (or a sibling in the same parallel group) older than `AI_RULES_ATTEMPT_STALE_MS` with no terminal manifest receipt is reclaimed as `attempt_finished` with `outcome: stale` and `source: hook`, removed from `activeAttempts`, and that activation opens a new attempt. The override is **milliseconds** (default `3600000`, one hour); a value below the `60000` floor falls back to the default. An attempt belonging to another step is never reclaimed — its own activation owns it. A terminal receipt always wins; a fresh attempt is never reclaimed. The stale entry stays in the metrics ledger.
207
+ - 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.
208
+ - 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>`.
199
209
 
200
210
  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.
201
211
 
@@ -212,6 +222,8 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
212
222
  | `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
213
223
  | `model` | `cheap` \| `standard` \| `strong` — optional tier override |
214
224
 
225
+ `writeScopes` are reconciled after the step, never in the hook: `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <step-id> --json` labels every changed path `declared`, `derived`, or `out-of-scope`. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
226
+
215
227
  ## Rules (strict)
216
228
 
217
229
  1. **`/task` always starts with task-router** (except user says "skip router" with documented pipeline). When `.ai.local/rules/task-levels.md` selects **L0** or a skip-analyst **L1**, task-router may emit a short `steps[]` list for that level. **L2** / **L3** still attach an OpenSpec change. `pipeline.json` → `steps[]` still schedules the run. This short list does not remove `build-verifier` or `code-reviewer` from implementation pipelines.
@@ -244,13 +256,24 @@ Use Task tool or `/agent-name`. Pass: slug, artifact paths, step `scope` if set.
244
256
  ### Model when invoking (Task)
245
257
 
246
258
  1. Read `steps[i].model` if present; else use the agent’s frontmatter `model` (see `agents/README.md` matrix).
247
- 2. Map abstract tiers:
248
- - **`cheap`** → pass Task `model: "fast"` when the tool accepts it (or rely on agent `fast`).
249
- - **`standard`** → omit Task `model` (frontmatter `inherit` / mid default).
250
- - **`strong`** → **never** pass `fast`; rely on agent pin or parent Max model.
251
- 3. Parallel steps: apply the step-level `model` to **each** agent in the array (or omit → each agent’s own frontmatter).
259
+ 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.
260
+ - **`cheap`** → mechanical steps only (router, analyst, tech-writer, codebase-analyzer).
261
+ - **`standard`** → implementation, verification, review, QA, contract review.
262
+ - **`strong`** → architecture, security, migration, performance, mockup review. Never downgrade a `strong` step to the parent default.
263
+ - If a tier is declared but the file has no mapping, **STOP** and report `model-tier-unmapped`; do not silently inherit the parent model.
264
+ 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.
265
+ 4. Parallel steps: apply the step-level `model` to **each** agent in the array (or omit → each agent’s own frontmatter).
266
+ 5. The tier never changes the step order, gates, receipts, or retry policy.
267
+
268
+ **Token usage.** When the host exposes token counts, append a `usage_recorded` event next to the attempt:
269
+
270
+ ```bash
271
+ node .ai.local/scripts/record-usage.mjs --task <slug> --attempt <attemptId> --input <n> --output <n> [--cached <n>] [--model <id>]
272
+ ```
273
+
274
+ The chain hook also forwards a `usage` object from its input into the `attempt_finished` event. Never estimate or invent token counts; a missing usage record stays missing.
252
275
 
253
- After each agent completes, verify its terminal manifest receipt, then let the orchestration runtime/hook reconcile `status.json` (`completed`, a blocking outcome, or `awaiting_approval`) from that receipt. Do not ask the agent to mutate shared lifecycle fields, and do not invoke the next specialist until the hook has written the handoff / updated `status.json`.
276
+ After each agent completes, verify its terminal manifest receipt, then let the orchestration runtime/hook reconcile `status.json` (`completed`, a blocking outcome, or `awaiting_approval`) from that receipt. Pass the active slug explicitly: `TEAM_TASK_SLUG=<slug> bash .opencode/hooks/chain-team-phases.sh` (or the host's hook path). The `active-task.json` pointer is a single-slot fallback and a parallel session can overwrite it; do not rely on it alone. Do not ask the agent to mutate shared lifecycle fields, and do not invoke the next specialist until the hook has written the handoff / updated `status.json`.
254
277
 
255
278
  ## Legacy mode
256
279
 
@@ -58,7 +58,9 @@ multi-wave work). It ratchets down for bounded/spike tasks (see § Ratchet).
58
58
  - **Opt-in and conditional — only when the engine exists.** In-task self-learning loop: run
59
59
  `node .ai.local/scripts/run.mjs` at the pre-receipt self-review when the engine exists; capture one wrong-turn
60
60
  with `node .ai.local/scripts/signals.mjs --append '<json>'` and inspect read-only with
61
- `node .ai.local/scripts/run.mjs --status`.
61
+ `node .ai.local/scripts/run.mjs --status`. Keep the loop deterministic: it runs no model-driven pass — rule text
62
+ is template-derived from the validated signature; a model-driven pass is not part of the loop, and if one is ever
63
+ added it must be default-off and may write only to the staged band.
62
64
  - The engine enforces the Rule of Three (≥2 distinct tasks → edit a local rule or `conventions.md` gotcha; ≥3 →
63
65
  stage a new rule) and applies or stages per the two-band autonomy policy. Never count the threshold by hand; never
64
66
  edit the engine. Engine absent → nothing to run; say so in the receipt instead of guessing. Not a new pipeline
@@ -30,6 +30,7 @@ A diff-shaped read is a floor, not a review. Run these five passes on every non-
30
30
  - **`finding`** — reported like any other finding, with `path:line`.
31
31
  - **`no finding`** — with one line of evidence: what was searched or read.
32
32
  - **`unable to run`** — with the reason: the pass does not apply to this diff, or an input is missing.
33
+ - **`partial`** — the breadth budget stopped the pass; name every unread path or glob. Use it only on the call-site sweep.
33
34
 
34
35
  An outcome word alone is not a record: `no finding` without its evidence line, or `unable to run` without its reason, is an unfinished pass.
35
36
 
@@ -39,6 +40,15 @@ An outcome word alone is not a record: `no finding` without its evidence line, o
39
40
  4. **Test gap** — not "is there a test" but "which behaviour change would still pass every existing test". That gap is the finding.
40
41
  5. **Half-life** — what breaks in six months: hidden coupling, implicit contract, missing migration, an unowned copy of the same rule.
41
42
 
43
+ ## Review breadth budget
44
+
45
+ - Bound **breadth**, not depth: the call-site sweep and the one-hop consumer read stop at this budget. The five depth passes still run on what was read.
46
+ - Budget: the changed exports, types, routes, and events in the diff, plus one hop of their consumers. Read no consumer that neither the diff nor a recorded finding names.
47
+ - Stop when either limit is reached: 40 changed-symbol call sites, or 15 minutes of breadth reads on one review.
48
+ - When the budget is exhausted, stop the sweep and record `partial` in `## Depth passes` for the call-site sweep, with every unread path or glob named inline.
49
+ - Never claim full coverage after a `partial` row. The verdict follows the findings actually recorded.
50
+ - A deliberate overrun (frozen contract, security boundary, migration) states the limit exceeded in one line; do not extend the budget silently.
51
+
42
52
  ## Constraints
43
53
 
44
54
  - The diff defines the **change under review**, not the boundary of the review. Follow the change one hop out: call sites, consumers, contracts, migrations, and the tests that already cover the touched path. Do not review unchanged code for its own sake — cite it only as evidence about the change.