@bonesofspring/ai-rules 0.2.74 → 0.2.76

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 (301) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +2 -2
  3. package/bin/lib/engine-scripts.js +4 -0
  4. package/docs/TEAM-DB.md +10 -0
  5. package/docs/TOKEN-ECONOMY.md +18 -5
  6. package/package.json +2 -2
  7. package/presets/_shared/ai-local/scripts/check-write-scope.mjs +56 -26
  8. package/presets/_shared/ai-local/scripts/lock.mjs +103 -30
  9. package/presets/_shared/ai-local/scripts/rule-improver.mjs +4 -0
  10. package/presets/_shared/ai-local/scripts/run-compact.mjs +132 -0
  11. package/presets/_shared/ai-local/scripts/signals.mjs +3 -1
  12. package/presets/_shared/ai-local/scripts/team-db-api.mjs +7 -2
  13. package/presets/_shared/ai-local/scripts/team-db-project.mjs +276 -1
  14. package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +32 -2
  15. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +99 -0
  16. package/presets/_shared/ai-local/scripts/team-db-task-runner.mjs +3 -1
  17. package/presets/_shared/core/agent-team/agent-task-metrics.md +29 -0
  18. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +1 -1
  19. package/presets/_shared/core/meta/preset-pr-checklist.md +2 -2
  20. package/presets/_shared/core/quality/context-and-iteration.md +1 -1
  21. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +4 -1
  22. package/presets/_shared/hooks/compact-shell-output.mjs +68 -0
  23. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +4 -1
  24. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  25. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  26. package/presets/claude/android-kotlin/team/README.md +1 -1
  27. package/presets/claude/go/hooks/chain-team-phases.sh +4 -1
  28. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  29. package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  30. package/presets/claude/go/team/README.md +1 -1
  31. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +4 -1
  32. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  33. package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  34. package/presets/claude/ios-swift/team/README.md +1 -1
  35. package/presets/claude/java/hooks/chain-team-phases.sh +4 -1
  36. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  37. package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  38. package/presets/claude/java/team/README.md +1 -1
  39. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +4 -1
  40. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  41. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  42. package/presets/claude/mcp-ts/team/README.md +1 -1
  43. package/presets/claude/mol/hooks/chain-team-phases.sh +4 -1
  44. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  45. package/presets/claude/mol/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  46. package/presets/claude/mol/team/README.md +1 -1
  47. package/presets/claude/next/agents/build-verifier.md +1 -1
  48. package/presets/claude/next/agents/code-reviewer.md +2 -0
  49. package/presets/claude/next/hooks/chain-team-phases.sh +4 -1
  50. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  51. package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  52. package/presets/claude/next/team/README.md +1 -1
  53. package/presets/claude/nuxt/hooks/chain-team-phases.sh +4 -1
  54. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  55. package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  56. package/presets/claude/nuxt/team/README.md +1 -1
  57. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +4 -1
  58. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  59. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  60. package/presets/claude/php-hexagonal/team/README.md +1 -1
  61. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +4 -1
  62. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  63. package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  64. package/presets/claude/php-laravel/team/README.md +1 -1
  65. package/presets/claude/svelte/hooks/chain-team-phases.sh +4 -1
  66. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  67. package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  68. package/presets/claude/svelte/team/README.md +1 -1
  69. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +4 -1
  70. package/presets/cursor/android-kotlin/hooks/compact-shell-output.mjs +68 -0
  71. package/presets/cursor/android-kotlin/hooks.json +7 -0
  72. package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +2 -2
  73. package/presets/cursor/android-kotlin/team/README.md +1 -1
  74. package/presets/cursor/go/hooks/chain-team-phases.sh +4 -1
  75. package/presets/cursor/go/hooks/compact-shell-output.mjs +68 -0
  76. package/presets/cursor/go/hooks.json +7 -0
  77. package/presets/cursor/go/rules/preset-pr-checklist.mdc +2 -2
  78. package/presets/cursor/go/team/README.md +1 -1
  79. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +4 -1
  80. package/presets/cursor/ios-swift/hooks/compact-shell-output.mjs +68 -0
  81. package/presets/cursor/ios-swift/hooks.json +7 -0
  82. package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +2 -2
  83. package/presets/cursor/ios-swift/team/README.md +1 -1
  84. package/presets/cursor/java/hooks/chain-team-phases.sh +4 -1
  85. package/presets/cursor/java/hooks/compact-shell-output.mjs +68 -0
  86. package/presets/cursor/java/hooks.json +7 -0
  87. package/presets/cursor/java/rules/preset-pr-checklist.mdc +2 -2
  88. package/presets/cursor/java/team/README.md +1 -1
  89. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +4 -1
  90. package/presets/cursor/mcp-ts/hooks/compact-shell-output.mjs +68 -0
  91. package/presets/cursor/mcp-ts/hooks.json +7 -0
  92. package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +2 -2
  93. package/presets/cursor/mcp-ts/team/README.md +1 -1
  94. package/presets/cursor/mol/hooks/chain-team-phases.sh +4 -1
  95. package/presets/cursor/mol/hooks/compact-shell-output.mjs +68 -0
  96. package/presets/cursor/mol/hooks.json +7 -0
  97. package/presets/cursor/mol/rules/preset-pr-checklist.mdc +2 -2
  98. package/presets/cursor/mol/team/README.md +1 -1
  99. package/presets/cursor/next/agents/build-verifier.md +1 -1
  100. package/presets/cursor/next/agents/code-reviewer.md +2 -0
  101. package/presets/cursor/next/hooks/chain-team-phases.sh +4 -1
  102. package/presets/cursor/next/hooks/compact-shell-output.mjs +68 -0
  103. package/presets/cursor/next/hooks.json +7 -0
  104. package/presets/cursor/next/rules/preset-pr-checklist.mdc +2 -2
  105. package/presets/cursor/next/team/README.md +1 -1
  106. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +4 -1
  107. package/presets/cursor/nuxt/hooks/compact-shell-output.mjs +68 -0
  108. package/presets/cursor/nuxt/hooks.json +7 -0
  109. package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +2 -2
  110. package/presets/cursor/nuxt/team/README.md +1 -1
  111. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +4 -1
  112. package/presets/cursor/php-hexagonal/hooks/compact-shell-output.mjs +68 -0
  113. package/presets/cursor/php-hexagonal/hooks.json +7 -0
  114. package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +2 -2
  115. package/presets/cursor/php-hexagonal/team/README.md +1 -1
  116. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +4 -1
  117. package/presets/cursor/php-laravel/hooks/compact-shell-output.mjs +68 -0
  118. package/presets/cursor/php-laravel/hooks.json +7 -0
  119. package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +2 -2
  120. package/presets/cursor/php-laravel/team/README.md +1 -1
  121. package/presets/cursor/svelte/hooks/chain-team-phases.sh +4 -1
  122. package/presets/cursor/svelte/hooks/compact-shell-output.mjs +68 -0
  123. package/presets/cursor/svelte/hooks.json +7 -0
  124. package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +2 -2
  125. package/presets/cursor/svelte/team/README.md +1 -1
  126. package/presets/mavis/android-kotlin/adapter-map.json +9 -1
  127. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +4 -1
  128. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +1 -1
  129. package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +2 -2
  130. package/presets/mavis/android-kotlin/team/README.md +1 -1
  131. package/presets/mavis/go/adapter-map.json +9 -1
  132. package/presets/mavis/go/hooks/chain-team-phases.sh +4 -1
  133. package/presets/mavis/go/rules/agent-team-orchestrator.md +1 -1
  134. package/presets/mavis/go/rules/preset-pr-checklist.md +2 -2
  135. package/presets/mavis/go/team/README.md +1 -1
  136. package/presets/mavis/ios-swift/adapter-map.json +9 -1
  137. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +4 -1
  138. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +1 -1
  139. package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +2 -2
  140. package/presets/mavis/ios-swift/team/README.md +1 -1
  141. package/presets/mavis/java/adapter-map.json +9 -1
  142. package/presets/mavis/java/hooks/chain-team-phases.sh +4 -1
  143. package/presets/mavis/java/rules/agent-team-orchestrator.md +1 -1
  144. package/presets/mavis/java/rules/preset-pr-checklist.md +2 -2
  145. package/presets/mavis/java/team/README.md +1 -1
  146. package/presets/mavis/mcp-ts/adapter-map.json +9 -1
  147. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +4 -1
  148. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +1 -1
  149. package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +2 -2
  150. package/presets/mavis/mcp-ts/team/README.md +1 -1
  151. package/presets/mavis/mol/adapter-map.json +9 -1
  152. package/presets/mavis/mol/hooks/chain-team-phases.sh +4 -1
  153. package/presets/mavis/mol/rules/agent-team-orchestrator.md +1 -1
  154. package/presets/mavis/mol/rules/preset-pr-checklist.md +2 -2
  155. package/presets/mavis/mol/team/README.md +1 -1
  156. package/presets/mavis/next/adapter-map.json +9 -1
  157. package/presets/mavis/next/agents/build-verifier.md +1 -1
  158. package/presets/mavis/next/agents/code-reviewer.md +2 -0
  159. package/presets/mavis/next/hooks/chain-team-phases.sh +4 -1
  160. package/presets/mavis/next/rules/agent-team-orchestrator.md +1 -1
  161. package/presets/mavis/next/rules/preset-pr-checklist.md +2 -2
  162. package/presets/mavis/next/team/README.md +1 -1
  163. package/presets/mavis/nuxt/adapter-map.json +9 -1
  164. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +4 -1
  165. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +1 -1
  166. package/presets/mavis/nuxt/rules/preset-pr-checklist.md +2 -2
  167. package/presets/mavis/nuxt/team/README.md +1 -1
  168. package/presets/mavis/php-hexagonal/adapter-map.json +9 -1
  169. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +4 -1
  170. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
  171. package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +2 -2
  172. package/presets/mavis/php-hexagonal/team/README.md +1 -1
  173. package/presets/mavis/php-laravel/adapter-map.json +9 -1
  174. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +4 -1
  175. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +1 -1
  176. package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +2 -2
  177. package/presets/mavis/php-laravel/team/README.md +1 -1
  178. package/presets/mavis/svelte/adapter-map.json +9 -1
  179. package/presets/mavis/svelte/hooks/chain-team-phases.sh +4 -1
  180. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +1 -1
  181. package/presets/mavis/svelte/rules/preset-pr-checklist.md +2 -2
  182. package/presets/mavis/svelte/team/README.md +1 -1
  183. package/presets/opencode/android-kotlin/adapter-map.json +9 -1
  184. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +4 -1
  185. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +1 -1
  186. package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +2 -2
  187. package/presets/opencode/android-kotlin/team/README.md +1 -1
  188. package/presets/opencode/go/adapter-map.json +9 -1
  189. package/presets/opencode/go/hooks/chain-team-phases.sh +4 -1
  190. package/presets/opencode/go/rules/agent-team-orchestrator.md +1 -1
  191. package/presets/opencode/go/rules/preset-pr-checklist.md +2 -2
  192. package/presets/opencode/go/team/README.md +1 -1
  193. package/presets/opencode/ios-swift/adapter-map.json +9 -1
  194. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +4 -1
  195. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +1 -1
  196. package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +2 -2
  197. package/presets/opencode/ios-swift/team/README.md +1 -1
  198. package/presets/opencode/java/adapter-map.json +9 -1
  199. package/presets/opencode/java/hooks/chain-team-phases.sh +4 -1
  200. package/presets/opencode/java/rules/agent-team-orchestrator.md +1 -1
  201. package/presets/opencode/java/rules/preset-pr-checklist.md +2 -2
  202. package/presets/opencode/java/team/README.md +1 -1
  203. package/presets/opencode/mcp-ts/adapter-map.json +9 -1
  204. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +4 -1
  205. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +1 -1
  206. package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +2 -2
  207. package/presets/opencode/mcp-ts/team/README.md +1 -1
  208. package/presets/opencode/mol/adapter-map.json +9 -1
  209. package/presets/opencode/mol/hooks/chain-team-phases.sh +4 -1
  210. package/presets/opencode/mol/rules/agent-team-orchestrator.md +1 -1
  211. package/presets/opencode/mol/rules/preset-pr-checklist.md +2 -2
  212. package/presets/opencode/mol/team/README.md +1 -1
  213. package/presets/opencode/next/adapter-map.json +9 -1
  214. package/presets/opencode/next/agents/build-verifier.md +1 -1
  215. package/presets/opencode/next/agents/code-reviewer.md +2 -0
  216. package/presets/opencode/next/hooks/chain-team-phases.sh +4 -1
  217. package/presets/opencode/next/rules/agent-team-orchestrator.md +1 -1
  218. package/presets/opencode/next/rules/preset-pr-checklist.md +2 -2
  219. package/presets/opencode/next/team/README.md +1 -1
  220. package/presets/opencode/nuxt/adapter-map.json +9 -1
  221. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +4 -1
  222. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +1 -1
  223. package/presets/opencode/nuxt/rules/preset-pr-checklist.md +2 -2
  224. package/presets/opencode/nuxt/team/README.md +1 -1
  225. package/presets/opencode/php-hexagonal/adapter-map.json +9 -1
  226. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +4 -1
  227. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
  228. package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +2 -2
  229. package/presets/opencode/php-hexagonal/team/README.md +1 -1
  230. package/presets/opencode/php-laravel/adapter-map.json +9 -1
  231. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +4 -1
  232. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +1 -1
  233. package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +2 -2
  234. package/presets/opencode/php-laravel/team/README.md +1 -1
  235. package/presets/opencode/plugins/output-guard/README.md +3 -2
  236. package/presets/opencode/plugins/output-guard/rewrite.ts +10 -1
  237. package/presets/opencode/svelte/adapter-map.json +9 -1
  238. package/presets/opencode/svelte/hooks/chain-team-phases.sh +4 -1
  239. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +1 -1
  240. package/presets/opencode/svelte/rules/preset-pr-checklist.md +2 -2
  241. package/presets/opencode/svelte/team/README.md +1 -1
  242. package/presets/zcode/android-kotlin/adapter-map.json +9 -1
  243. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +4 -1
  244. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +1 -1
  245. package/presets/zcode/android-kotlin/rules/preset-pr-checklist.md +2 -2
  246. package/presets/zcode/android-kotlin/team/README.md +1 -1
  247. package/presets/zcode/go/adapter-map.json +9 -1
  248. package/presets/zcode/go/hooks/chain-team-phases.sh +4 -1
  249. package/presets/zcode/go/rules/agent-team-orchestrator.md +1 -1
  250. package/presets/zcode/go/rules/preset-pr-checklist.md +2 -2
  251. package/presets/zcode/go/team/README.md +1 -1
  252. package/presets/zcode/ios-swift/adapter-map.json +9 -1
  253. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +4 -1
  254. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +1 -1
  255. package/presets/zcode/ios-swift/rules/preset-pr-checklist.md +2 -2
  256. package/presets/zcode/ios-swift/team/README.md +1 -1
  257. package/presets/zcode/java/adapter-map.json +9 -1
  258. package/presets/zcode/java/hooks/chain-team-phases.sh +4 -1
  259. package/presets/zcode/java/rules/agent-team-orchestrator.md +1 -1
  260. package/presets/zcode/java/rules/preset-pr-checklist.md +2 -2
  261. package/presets/zcode/java/team/README.md +1 -1
  262. package/presets/zcode/mcp-ts/adapter-map.json +9 -1
  263. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +4 -1
  264. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +1 -1
  265. package/presets/zcode/mcp-ts/rules/preset-pr-checklist.md +2 -2
  266. package/presets/zcode/mcp-ts/team/README.md +1 -1
  267. package/presets/zcode/mol/adapter-map.json +9 -1
  268. package/presets/zcode/mol/hooks/chain-team-phases.sh +4 -1
  269. package/presets/zcode/mol/rules/agent-team-orchestrator.md +1 -1
  270. package/presets/zcode/mol/rules/preset-pr-checklist.md +2 -2
  271. package/presets/zcode/mol/team/README.md +1 -1
  272. package/presets/zcode/next/adapter-map.json +9 -1
  273. package/presets/zcode/next/agents/build-verifier.md +1 -1
  274. package/presets/zcode/next/agents/code-reviewer.md +2 -0
  275. package/presets/zcode/next/hooks/chain-team-phases.sh +4 -1
  276. package/presets/zcode/next/rules/agent-team-orchestrator.md +1 -1
  277. package/presets/zcode/next/rules/preset-pr-checklist.md +2 -2
  278. package/presets/zcode/next/team/README.md +1 -1
  279. package/presets/zcode/nuxt/adapter-map.json +9 -1
  280. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +4 -1
  281. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +1 -1
  282. package/presets/zcode/nuxt/rules/preset-pr-checklist.md +2 -2
  283. package/presets/zcode/nuxt/team/README.md +1 -1
  284. package/presets/zcode/php-hexagonal/adapter-map.json +9 -1
  285. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +4 -1
  286. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
  287. package/presets/zcode/php-hexagonal/rules/preset-pr-checklist.md +2 -2
  288. package/presets/zcode/php-hexagonal/team/README.md +1 -1
  289. package/presets/zcode/php-laravel/adapter-map.json +9 -1
  290. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +4 -1
  291. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +1 -1
  292. package/presets/zcode/php-laravel/rules/preset-pr-checklist.md +2 -2
  293. package/presets/zcode/php-laravel/team/README.md +1 -1
  294. package/presets/zcode/svelte/adapter-map.json +9 -1
  295. package/presets/zcode/svelte/hooks/chain-team-phases.sh +4 -1
  296. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +1 -1
  297. package/presets/zcode/svelte/rules/preset-pr-checklist.md +2 -2
  298. package/presets/zcode/svelte/team/README.md +1 -1
  299. package/scripts/close-agent-task-human-gate.mjs +3 -3
  300. package/scripts/report-context-cost.mjs +10 -3
  301. package/scripts/aggregate-agent-task-metrics.mjs +0 -480
@@ -83,7 +83,10 @@ function firstSeenAtOf(file, value, now) {
83
83
  try {
84
84
  if (Date.now() - fs.statSync(file).mtimeMs > LEASE_TTL_MS) return now;
85
85
  const previous = JSON.parse(fs.readFileSync(file, 'utf8'));
86
- if (previous && previous.slug === value && typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
86
+ if (previous && previous.slug === value) {
87
+ if (typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
88
+ if (typeof previous.updatedAt === 'string') return previous.updatedAt;
89
+ }
87
90
  } catch {}
88
91
  return now;
89
92
  }
@@ -238,7 +238,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
238
238
  | `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
239
239
  | `model` | `cheap` \| `standard` \| `strong` — optional tier override |
240
240
 
241
- `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`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
241
+ `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`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Automatic selection only considers steps with an `id`, because the baseline file is keyed by it. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. Exit `2` is a usage error (unknown `--step`, unreadable `pipeline.json`, failed git ref): the audit did not run and the result is neither a pass nor a finding — fix the invocation and re-run. A `no-baseline` skip is an orchestration defect: the step wrote without its baseline, so no path can be attributed to it — save the baseline and re-run the audit instead of reading the skip as a pass. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
242
242
 
243
243
  ## Rules (strict)
244
244
 
@@ -31,7 +31,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
31
31
  - [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
32
32
  - [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
33
33
  - [ ] **i18n anchors:** kept-marked Cyrillic fragments in `tests-unit.md(c)` stay consistent with their English counterparts. Run `packages/ai-rules/scripts/check-preset-i18n.sh`.
34
- - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, and `sync-dogfood-opencode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
34
+ - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, and `sync-dogfood-zcode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
35
35
  - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
36
36
  - [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
37
37
  - [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
@@ -48,6 +48,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
48
48
  - Budget: `preset-token-budget`
49
49
  - Leakage: `preset-no-cross-stack-leakage`
50
50
  - Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
51
- - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
51
+ - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, `sync-dogfood-zcode.sh`
52
52
  - Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
53
53
  - Orchestrator: when editing presets, load this checklist + twin-sync
@@ -112,7 +112,7 @@ Use the hook path for the platform that installed the tree: `.cursor`, `.claude`
112
112
  - **Manifest field name:** receipts go in `artifacts[]`. Anything written under `entries` is ignored — the hook reads only `artifacts` and prints a dual-read warning naming the file. See `agent-team/agent-artifact-contracts.md` § Schema field name.
113
113
  - **Evidence paths:** `authoritativePaths[]` is relative to the task directory (`brief.md`). A repo-root path (`.ai.local/team/tasks/<slug>/brief.md`) is rejected. Put anything outside the task directory — e.g. `openspec/changes/**` — in `evidencePaths[]`.
114
114
  - Manifest schema: shared core `agent-team/agent-artifact-contracts.md`. Read it first; producers upsert only their IDs.
115
- - Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
115
+ - Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
116
116
  - Commit `.ai.local/team/` templates (and slugs if you want them in clones).
117
117
 
118
118
  ## Plan graph & checkpoint (optional)
@@ -85,7 +85,10 @@ function firstSeenAtOf(file, value, now) {
85
85
  try {
86
86
  if (Date.now() - fs.statSync(file).mtimeMs > LEASE_TTL_MS) return now;
87
87
  const previous = JSON.parse(fs.readFileSync(file, 'utf8'));
88
- if (previous && previous.slug === value && typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
88
+ if (previous && previous.slug === value) {
89
+ if (typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
90
+ if (typeof previous.updatedAt === 'string') return previous.updatedAt;
91
+ }
89
92
  } catch {}
90
93
  return now;
91
94
  }
@@ -238,7 +238,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
238
238
  | `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
239
239
  | `model` | `cheap` \| `standard` \| `strong` — optional tier override |
240
240
 
241
- `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`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
241
+ `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`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Automatic selection only considers steps with an `id`, because the baseline file is keyed by it. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. Exit `2` is a usage error (unknown `--step`, unreadable `pipeline.json`, failed git ref): the audit did not run and the result is neither a pass nor a finding — fix the invocation and re-run. A `no-baseline` skip is an orchestration defect: the step wrote without its baseline, so no path can be attributed to it — save the baseline and re-run the audit instead of reading the skip as a pass. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
242
242
 
243
243
  ## Rules (strict)
244
244
 
@@ -31,7 +31,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
31
31
  - [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
32
32
  - [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
33
33
  - [ ] **i18n anchors:** kept-marked Cyrillic fragments in `tests-unit.md(c)` stay consistent with their English counterparts. Run `packages/ai-rules/scripts/check-preset-i18n.sh`.
34
- - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, and `sync-dogfood-opencode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
34
+ - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, and `sync-dogfood-zcode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
35
35
  - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
36
36
  - [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
37
37
  - [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
@@ -48,6 +48,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
48
48
  - Budget: `preset-token-budget`
49
49
  - Leakage: `preset-no-cross-stack-leakage`
50
50
  - Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
51
- - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
51
+ - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, `sync-dogfood-zcode.sh`
52
52
  - Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
53
53
  - Orchestrator: when editing presets, load this checklist + twin-sync
@@ -112,7 +112,7 @@ Use the hook path for the platform that installed the tree: `.cursor`, `.claude`
112
112
  - **Manifest field name:** receipts go in `artifacts[]`. Anything written under `entries` is ignored — the hook reads only `artifacts` and prints a dual-read warning naming the file. See `agent-team/agent-artifact-contracts.md` § Schema field name.
113
113
  - **Evidence paths:** `authoritativePaths[]` is relative to the task directory (`brief.md`). A repo-root path (`.ai.local/team/tasks/<slug>/brief.md`) is rejected. Put anything outside the task directory — e.g. `openspec/changes/**` — in `evidencePaths[]`.
114
114
  - Manifest schema: shared core `agent-team/agent-artifact-contracts.md`. Read it first; producers upsert only their IDs.
115
- - Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
115
+ - Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
116
116
  - Commit `.ai.local/team/` templates (and slugs if you want them in clones).
117
117
 
118
118
  ## Plan graph & checkpoint (optional)
@@ -85,7 +85,10 @@ function firstSeenAtOf(file, value, now) {
85
85
  try {
86
86
  if (Date.now() - fs.statSync(file).mtimeMs > LEASE_TTL_MS) return now;
87
87
  const previous = JSON.parse(fs.readFileSync(file, 'utf8'));
88
- if (previous && previous.slug === value && typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
88
+ if (previous && previous.slug === value) {
89
+ if (typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
90
+ if (typeof previous.updatedAt === 'string') return previous.updatedAt;
91
+ }
89
92
  } catch {}
90
93
  return now;
91
94
  }
@@ -238,7 +238,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
238
238
  | `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
239
239
  | `model` | `cheap` \| `standard` \| `strong` — optional tier override |
240
240
 
241
- `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`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
241
+ `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`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Automatic selection only considers steps with an `id`, because the baseline file is keyed by it. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. Exit `2` is a usage error (unknown `--step`, unreadable `pipeline.json`, failed git ref): the audit did not run and the result is neither a pass nor a finding — fix the invocation and re-run. A `no-baseline` skip is an orchestration defect: the step wrote without its baseline, so no path can be attributed to it — save the baseline and re-run the audit instead of reading the skip as a pass. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
242
242
 
243
243
  ## Rules (strict)
244
244
 
@@ -31,7 +31,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
31
31
  - [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
32
32
  - [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
33
33
  - [ ] **i18n anchors:** kept-marked Cyrillic fragments in `tests-unit.md(c)` stay consistent with their English counterparts. Run `packages/ai-rules/scripts/check-preset-i18n.sh`.
34
- - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, and `sync-dogfood-opencode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
34
+ - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, and `sync-dogfood-zcode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
35
35
  - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
36
36
  - [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
37
37
  - [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
@@ -48,6 +48,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
48
48
  - Budget: `preset-token-budget`
49
49
  - Leakage: `preset-no-cross-stack-leakage`
50
50
  - Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
51
- - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
51
+ - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, `sync-dogfood-zcode.sh`
52
52
  - Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
53
53
  - Orchestrator: when editing presets, load this checklist + twin-sync
@@ -112,7 +112,7 @@ Use the hook path for the platform that installed the tree: `.cursor`, `.claude`
112
112
  - **Manifest field name:** receipts go in `artifacts[]`. Anything written under `entries` is ignored — the hook reads only `artifacts` and prints a dual-read warning naming the file. See `agent-team/agent-artifact-contracts.md` § Schema field name.
113
113
  - **Evidence paths:** `authoritativePaths[]` is relative to the task directory (`brief.md`). A repo-root path (`.ai.local/team/tasks/<slug>/brief.md`) is rejected. Put anything outside the task directory — e.g. `openspec/changes/**` — in `evidencePaths[]`.
114
114
  - Manifest schema: shared core `agent-team/agent-artifact-contracts.md`. Read it first; producers upsert only their IDs.
115
- - Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
115
+ - Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
116
116
  - Commit `.ai.local/team/` templates (and slugs if you want them in clones).
117
117
 
118
118
  ## Plan graph & checkpoint (optional)
@@ -83,7 +83,10 @@ function firstSeenAtOf(file, value, now) {
83
83
  try {
84
84
  if (Date.now() - fs.statSync(file).mtimeMs > LEASE_TTL_MS) return now;
85
85
  const previous = JSON.parse(fs.readFileSync(file, 'utf8'));
86
- if (previous && previous.slug === value && typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
86
+ if (previous && previous.slug === value) {
87
+ if (typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
88
+ if (typeof previous.updatedAt === 'string') return previous.updatedAt;
89
+ }
87
90
  } catch {}
88
91
  return now;
89
92
  }
@@ -238,7 +238,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
238
238
  | `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
239
239
  | `model` | `cheap` \| `standard` \| `strong` — optional tier override |
240
240
 
241
- `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`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
241
+ `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`. The orchestrator writes the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit sees this step's paths and not the earlier ones. Automatic selection only considers steps with an `id`, because the baseline file is keyed by it. Exit `3` is a skip, not a failure: a pipeline that predates step ids or `writeScopes` is not auditable, and the reason goes under `## Soft notes`. Exit `2` is a usage error (unknown `--step`, unreadable `pipeline.json`, failed git ref): the audit did not run and the result is neither a pass nor a finding — fix the invocation and re-run. A `no-baseline` skip is an orchestration defect: the step wrote without its baseline, so no path can be attributed to it — save the baseline and re-run the audit instead of reading the skip as a pass. `build-verifier` hard-fails an out-of-scope implementation write; `code-reviewer` reports a reviewer-step path as advisory.
242
242
 
243
243
  ## Rules (strict)
244
244
 
@@ -31,7 +31,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
31
31
  - [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
32
32
  - [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
33
33
  - [ ] **i18n anchors:** kept-marked Cyrillic fragments in `tests-unit.md(c)` stay consistent with their English counterparts. Run `packages/ai-rules/scripts/check-preset-i18n.sh`.
34
- - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, and `sync-dogfood-opencode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
34
+ - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, and `sync-dogfood-zcode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
35
35
  - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
36
36
  - [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
37
37
  - [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
@@ -48,6 +48,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
48
48
  - Budget: `preset-token-budget`
49
49
  - Leakage: `preset-no-cross-stack-leakage`
50
50
  - Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
51
- - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
51
+ - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, `sync-dogfood-zcode.sh`
52
52
  - Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
53
53
  - Orchestrator: when editing presets, load this checklist + twin-sync
@@ -112,7 +112,7 @@ Use the hook path for the platform that installed the tree: `.cursor`, `.claude`
112
112
  - **Manifest field name:** receipts go in `artifacts[]`. Anything written under `entries` is ignored — the hook reads only `artifacts` and prints a dual-read warning naming the file. See `agent-team/agent-artifact-contracts.md` § Schema field name.
113
113
  - **Evidence paths:** `authoritativePaths[]` is relative to the task directory (`brief.md`). A repo-root path (`.ai.local/team/tasks/<slug>/brief.md`) is rejected. Put anything outside the task directory — e.g. `openspec/changes/**` — in `evidencePaths[]`.
114
114
  - Manifest schema: shared core `agent-team/agent-artifact-contracts.md`. Read it first; producers upsert only their IDs.
115
- - Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
115
+ - Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
116
116
  - Commit `.ai.local/team/` templates (and slugs if you want them in clones).
117
117
 
118
118
  ## Plan graph & checkpoint (optional)
@@ -65,7 +65,10 @@ function firstSeenAtOf(file, value, now) {
65
65
  try {
66
66
  if (Date.now() - fs.statSync(file).mtimeMs > LEASE_TTL_MS) return now;
67
67
  const previous = JSON.parse(fs.readFileSync(file, 'utf8'));
68
- if (previous && previous.slug === value && typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
68
+ if (previous && previous.slug === value) {
69
+ if (typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
70
+ if (typeof previous.updatedAt === 'string') return previous.updatedAt;
71
+ }
69
72
  } catch {}
70
73
  return now;
71
74
  }
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ // Cursor preToolUse: rewrite an eligible simple command so its output is stored
3
+ // and only the short view reaches the model. Fail open. Edit this shared source;
4
+ // the generator copies it into each Cursor stack.
5
+
6
+ import fs from 'node:fs';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ const SLUG_MAX = 48;
10
+ const SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
11
+ const ELIGIBLE =
12
+ /^(?:(?:yarn|pnpm|npm|npx|bun)\s+(?:run\s+)?(?:test|lint)(?::\S+)?|git\s+(?:log|diff)|go\s+test|cargo\s+test|pytest|phpunit)\b/;
13
+ const META = /[|&;<>()\n`]|\$\(/;
14
+
15
+ const slugOf = (env) => {
16
+ const value = typeof env?.TEAM_TASK_SLUG === 'string' ? env.TEAM_TASK_SLUG : '';
17
+ if (value.length === 0 || value.length > SLUG_MAX || !SLUG_RE.test(value)) return '';
18
+ return value;
19
+ };
20
+
21
+ /** Return the rewritten shell string, or null to leave the command unchanged. */
22
+ export const rewriteCommand = (command, env) => {
23
+ const slug = slugOf(env);
24
+ if (slug === '') return null;
25
+ const text = typeof command === 'string' ? command.trim() : '';
26
+ if (text === '' || META.test(text)) return null;
27
+ if (text.split(/\s+/).some((token) => token.includes("'") || token.includes('"'))) return null;
28
+ if (text.includes('dump-output.mjs') || text.includes('run-compact.mjs')) return null;
29
+ if (!ELIGIBLE.test(text)) return null;
30
+ return `node .ai.local/scripts/run-compact.mjs --task ${slug} -- ${text}`;
31
+ };
32
+
33
+ const allow = () => {
34
+ process.stdout.write('{"permission":"allow"}');
35
+ };
36
+
37
+ const commandOf = (event) => {
38
+ if (typeof event.command === 'string') return event.command;
39
+ if (typeof event.input?.command === 'string') return event.input.command;
40
+ if (typeof event.tool_input?.command === 'string') return event.tool_input.command;
41
+ return '';
42
+ };
43
+
44
+ const invokedDirectly = (() => {
45
+ if (!process.argv[1]) return false;
46
+ try {
47
+ return fs.realpathSync(process.argv[1]) === fs.realpathSync(fileURLToPath(import.meta.url));
48
+ } catch {
49
+ return false;
50
+ }
51
+ })();
52
+
53
+ if (invokedDirectly) {
54
+ try {
55
+ const parsed = JSON.parse(fs.readFileSync(0, 'utf8'));
56
+ const event = parsed && typeof parsed === 'object' ? parsed : null;
57
+ const rewritten = event ? rewriteCommand(commandOf(event), process.env) : null;
58
+ if (rewritten === null) {
59
+ allow();
60
+ } else {
61
+ process.stdout.write(
62
+ JSON.stringify({ permission: 'allow', updated_input: { command: rewritten } }),
63
+ );
64
+ }
65
+ } catch {
66
+ allow();
67
+ }
68
+ }
@@ -17,6 +17,13 @@
17
17
  "failClosed": true
18
18
  }
19
19
  ],
20
+ "preToolUse": [
21
+ {
22
+ "command": "node .cursor/hooks/compact-shell-output.mjs",
23
+ "matcher": "Shell",
24
+ "timeout": 5
25
+ }
26
+ ],
20
27
  "subagentStop": [
21
28
  {
22
29
  "command": "node .cursor/hooks/run-hook.mjs chain-team-phases",
@@ -32,7 +32,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
32
32
  - [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
33
33
  - [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
34
34
  - [ ] **i18n anchors:** kept-marked Cyrillic fragments in `tests-unit.md(c)` stay consistent with their English counterparts. Run `packages/ai-rules/scripts/check-preset-i18n.sh`.
35
- - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, and `sync-dogfood-opencode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
35
+ - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, and `sync-dogfood-zcode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
36
36
  - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
37
37
  - [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
38
38
  - [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
@@ -49,6 +49,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
49
49
  - Budget: `preset-token-budget`
50
50
  - Leakage: `preset-no-cross-stack-leakage`
51
51
  - Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
52
- - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
52
+ - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, `sync-dogfood-zcode.sh`
53
53
  - Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
54
54
  - Orchestrator: when editing presets, load this checklist + twin-sync
@@ -124,5 +124,5 @@ Use the hook path for the platform that installed the tree: `.cursor`, `.claude`
124
124
  - **Manifest field name:** receipts go in `artifacts[]`. Anything written under `entries` is ignored — the hook reads only `artifacts` and prints a dual-read warning naming the file. See `agent-team/agent-artifact-contracts.md` § Schema field name.
125
125
  - **Evidence paths:** `authoritativePaths[]` is relative to the task directory (`brief.md`). A repo-root path (`.ai.local/team/tasks/<slug>/brief.md`) is rejected. Put anything outside the task directory — e.g. `openspec/changes/**` — in `evidencePaths[]`.
126
126
  - Manifest schema: shared core `agent-team/agent-artifact-contracts.md`. Read it first; producers upsert only their IDs.
127
- - Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
127
+ - Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
128
128
  - Commit `.ai.local/team/` templates (and slugs if you want them in clones).
@@ -66,7 +66,10 @@ function firstSeenAtOf(file, value, now) {
66
66
  try {
67
67
  if (Date.now() - fs.statSync(file).mtimeMs > LEASE_TTL_MS) return now;
68
68
  const previous = JSON.parse(fs.readFileSync(file, 'utf8'));
69
- if (previous && previous.slug === value && typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
69
+ if (previous && previous.slug === value) {
70
+ if (typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
71
+ if (typeof previous.updatedAt === 'string') return previous.updatedAt;
72
+ }
70
73
  } catch {}
71
74
  return now;
72
75
  }
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ // Cursor preToolUse: rewrite an eligible simple command so its output is stored
3
+ // and only the short view reaches the model. Fail open. Edit this shared source;
4
+ // the generator copies it into each Cursor stack.
5
+
6
+ import fs from 'node:fs';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ const SLUG_MAX = 48;
10
+ const SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
11
+ const ELIGIBLE =
12
+ /^(?:(?:yarn|pnpm|npm|npx|bun)\s+(?:run\s+)?(?:test|lint)(?::\S+)?|git\s+(?:log|diff)|go\s+test|cargo\s+test|pytest|phpunit)\b/;
13
+ const META = /[|&;<>()\n`]|\$\(/;
14
+
15
+ const slugOf = (env) => {
16
+ const value = typeof env?.TEAM_TASK_SLUG === 'string' ? env.TEAM_TASK_SLUG : '';
17
+ if (value.length === 0 || value.length > SLUG_MAX || !SLUG_RE.test(value)) return '';
18
+ return value;
19
+ };
20
+
21
+ /** Return the rewritten shell string, or null to leave the command unchanged. */
22
+ export const rewriteCommand = (command, env) => {
23
+ const slug = slugOf(env);
24
+ if (slug === '') return null;
25
+ const text = typeof command === 'string' ? command.trim() : '';
26
+ if (text === '' || META.test(text)) return null;
27
+ if (text.split(/\s+/).some((token) => token.includes("'") || token.includes('"'))) return null;
28
+ if (text.includes('dump-output.mjs') || text.includes('run-compact.mjs')) return null;
29
+ if (!ELIGIBLE.test(text)) return null;
30
+ return `node .ai.local/scripts/run-compact.mjs --task ${slug} -- ${text}`;
31
+ };
32
+
33
+ const allow = () => {
34
+ process.stdout.write('{"permission":"allow"}');
35
+ };
36
+
37
+ const commandOf = (event) => {
38
+ if (typeof event.command === 'string') return event.command;
39
+ if (typeof event.input?.command === 'string') return event.input.command;
40
+ if (typeof event.tool_input?.command === 'string') return event.tool_input.command;
41
+ return '';
42
+ };
43
+
44
+ const invokedDirectly = (() => {
45
+ if (!process.argv[1]) return false;
46
+ try {
47
+ return fs.realpathSync(process.argv[1]) === fs.realpathSync(fileURLToPath(import.meta.url));
48
+ } catch {
49
+ return false;
50
+ }
51
+ })();
52
+
53
+ if (invokedDirectly) {
54
+ try {
55
+ const parsed = JSON.parse(fs.readFileSync(0, 'utf8'));
56
+ const event = parsed && typeof parsed === 'object' ? parsed : null;
57
+ const rewritten = event ? rewriteCommand(commandOf(event), process.env) : null;
58
+ if (rewritten === null) {
59
+ allow();
60
+ } else {
61
+ process.stdout.write(
62
+ JSON.stringify({ permission: 'allow', updated_input: { command: rewritten } }),
63
+ );
64
+ }
65
+ } catch {
66
+ allow();
67
+ }
68
+ }
@@ -17,6 +17,13 @@
17
17
  "failClosed": true
18
18
  }
19
19
  ],
20
+ "preToolUse": [
21
+ {
22
+ "command": "node .cursor/hooks/compact-shell-output.mjs",
23
+ "matcher": "Shell",
24
+ "timeout": 5
25
+ }
26
+ ],
20
27
  "subagentStop": [
21
28
  {
22
29
  "command": "node .cursor/hooks/run-hook.mjs chain-team-phases",
@@ -32,7 +32,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
32
32
  - [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
33
33
  - [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
34
34
  - [ ] **i18n anchors:** kept-marked Cyrillic fragments in `tests-unit.md(c)` stay consistent with their English counterparts. Run `packages/ai-rules/scripts/check-preset-i18n.sh`.
35
- - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, and `sync-dogfood-opencode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
35
+ - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, and `sync-dogfood-zcode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
36
36
  - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
37
37
  - [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
38
38
  - [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
@@ -49,6 +49,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
49
49
  - Budget: `preset-token-budget`
50
50
  - Leakage: `preset-no-cross-stack-leakage`
51
51
  - Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
52
- - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
52
+ - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, `sync-dogfood-zcode.sh`
53
53
  - Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
54
54
  - Orchestrator: when editing presets, load this checklist + twin-sync
@@ -124,5 +124,5 @@ Use the hook path for the platform that installed the tree: `.cursor`, `.claude`
124
124
  - **Manifest field name:** receipts go in `artifacts[]`. Anything written under `entries` is ignored — the hook reads only `artifacts` and prints a dual-read warning naming the file. See `agent-team/agent-artifact-contracts.md` § Schema field name.
125
125
  - **Evidence paths:** `authoritativePaths[]` is relative to the task directory (`brief.md`). A repo-root path (`.ai.local/team/tasks/<slug>/brief.md`) is rejected. Put anything outside the task directory — e.g. `openspec/changes/**` — in `evidencePaths[]`.
126
126
  - Manifest schema: shared core `agent-team/agent-artifact-contracts.md`. Read it first; producers upsert only their IDs.
127
- - Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
127
+ - Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
128
128
  - Commit `.ai.local/team/` templates (and slugs if you want them in clones).
@@ -65,7 +65,10 @@ function firstSeenAtOf(file, value, now) {
65
65
  try {
66
66
  if (Date.now() - fs.statSync(file).mtimeMs > LEASE_TTL_MS) return now;
67
67
  const previous = JSON.parse(fs.readFileSync(file, 'utf8'));
68
- if (previous && previous.slug === value && typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
68
+ if (previous && previous.slug === value) {
69
+ if (typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
70
+ if (typeof previous.updatedAt === 'string') return previous.updatedAt;
71
+ }
69
72
  } catch {}
70
73
  return now;
71
74
  }
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ // Cursor preToolUse: rewrite an eligible simple command so its output is stored
3
+ // and only the short view reaches the model. Fail open. Edit this shared source;
4
+ // the generator copies it into each Cursor stack.
5
+
6
+ import fs from 'node:fs';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ const SLUG_MAX = 48;
10
+ const SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
11
+ const ELIGIBLE =
12
+ /^(?:(?:yarn|pnpm|npm|npx|bun)\s+(?:run\s+)?(?:test|lint)(?::\S+)?|git\s+(?:log|diff)|go\s+test|cargo\s+test|pytest|phpunit)\b/;
13
+ const META = /[|&;<>()\n`]|\$\(/;
14
+
15
+ const slugOf = (env) => {
16
+ const value = typeof env?.TEAM_TASK_SLUG === 'string' ? env.TEAM_TASK_SLUG : '';
17
+ if (value.length === 0 || value.length > SLUG_MAX || !SLUG_RE.test(value)) return '';
18
+ return value;
19
+ };
20
+
21
+ /** Return the rewritten shell string, or null to leave the command unchanged. */
22
+ export const rewriteCommand = (command, env) => {
23
+ const slug = slugOf(env);
24
+ if (slug === '') return null;
25
+ const text = typeof command === 'string' ? command.trim() : '';
26
+ if (text === '' || META.test(text)) return null;
27
+ if (text.split(/\s+/).some((token) => token.includes("'") || token.includes('"'))) return null;
28
+ if (text.includes('dump-output.mjs') || text.includes('run-compact.mjs')) return null;
29
+ if (!ELIGIBLE.test(text)) return null;
30
+ return `node .ai.local/scripts/run-compact.mjs --task ${slug} -- ${text}`;
31
+ };
32
+
33
+ const allow = () => {
34
+ process.stdout.write('{"permission":"allow"}');
35
+ };
36
+
37
+ const commandOf = (event) => {
38
+ if (typeof event.command === 'string') return event.command;
39
+ if (typeof event.input?.command === 'string') return event.input.command;
40
+ if (typeof event.tool_input?.command === 'string') return event.tool_input.command;
41
+ return '';
42
+ };
43
+
44
+ const invokedDirectly = (() => {
45
+ if (!process.argv[1]) return false;
46
+ try {
47
+ return fs.realpathSync(process.argv[1]) === fs.realpathSync(fileURLToPath(import.meta.url));
48
+ } catch {
49
+ return false;
50
+ }
51
+ })();
52
+
53
+ if (invokedDirectly) {
54
+ try {
55
+ const parsed = JSON.parse(fs.readFileSync(0, 'utf8'));
56
+ const event = parsed && typeof parsed === 'object' ? parsed : null;
57
+ const rewritten = event ? rewriteCommand(commandOf(event), process.env) : null;
58
+ if (rewritten === null) {
59
+ allow();
60
+ } else {
61
+ process.stdout.write(
62
+ JSON.stringify({ permission: 'allow', updated_input: { command: rewritten } }),
63
+ );
64
+ }
65
+ } catch {
66
+ allow();
67
+ }
68
+ }
@@ -17,6 +17,13 @@
17
17
  "failClosed": true
18
18
  }
19
19
  ],
20
+ "preToolUse": [
21
+ {
22
+ "command": "node .cursor/hooks/compact-shell-output.mjs",
23
+ "matcher": "Shell",
24
+ "timeout": 5
25
+ }
26
+ ],
20
27
  "subagentStop": [
21
28
  {
22
29
  "command": "node .cursor/hooks/run-hook.mjs chain-team-phases",
@@ -32,7 +32,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
32
32
  - [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
33
33
  - [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
34
34
  - [ ] **i18n anchors:** kept-marked Cyrillic fragments in `tests-unit.md(c)` stay consistent with their English counterparts. Run `packages/ai-rules/scripts/check-preset-i18n.sh`.
35
- - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, and `sync-dogfood-opencode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
35
+ - [ ] **Dogfood:** run `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, and `sync-dogfood-zcode.sh` when those platforms changed, or document an intentional skip, when maintaining this monorepo
36
36
  - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
37
37
  - [ ] **Packaging:** every installable preset ships `REPO_AGENTS.md`; default `hooks.json` does not reference `hooks/examples/`; `_shared/assets/docs-specs/` ships `INDEX.md` + `_templates/{page,feature}.md`; `product-specs` / `product-specs-authoring` stay requestable
38
38
  - [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
@@ -49,6 +49,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
49
49
  - Budget: `preset-token-budget`
50
50
  - Leakage: `preset-no-cross-stack-leakage`
51
51
  - Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
52
- - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
52
+ - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`, `sync-dogfood-zcode.sh`
53
53
  - Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
54
54
  - Orchestrator: when editing presets, load this checklist + twin-sync
@@ -124,5 +124,5 @@ Use the hook path for the platform that installed the tree: `.cursor`, `.claude`
124
124
  - **Manifest field name:** receipts go in `artifacts[]`. Anything written under `entries` is ignored — the hook reads only `artifacts` and prints a dual-read warning naming the file. See `agent-team/agent-artifact-contracts.md` § Schema field name.
125
125
  - **Evidence paths:** `authoritativePaths[]` is relative to the task directory (`brief.md`). A repo-root path (`.ai.local/team/tasks/<slug>/brief.md`) is rejected. Put anything outside the task directory — e.g. `openspec/changes/**` — in `evidencePaths[]`.
126
126
  - Manifest schema: shared core `agent-team/agent-artifact-contracts.md`. Read it first; producers upsert only their IDs.
127
- - Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
127
+ - Metrics: append-only allowlisted events — `agent-team/agent-task-metrics.md`. Aggregate: `node node_modules/@bonesofspring/ai-rules/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs --team-root .ai.local/team`.
128
128
  - Commit `.ai.local/team/` templates (and slugs if you want them in clones).