@bonesofspring/ai-rules 0.2.73 → 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 (419) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/README.md +2 -2
  3. package/bin/lib/engine-scripts.js +12 -0
  4. package/docs/TEAM-DB.md +96 -5
  5. package/docs/TOKEN-ECONOMY.md +18 -5
  6. package/docs/openapi/team-db.v1.json +1164 -224
  7. package/package.json +2 -2
  8. package/presets/_shared/ai-local/scripts/action-signals.mjs +225 -0
  9. package/presets/_shared/ai-local/scripts/actions-report.mjs +210 -0
  10. package/presets/_shared/ai-local/scripts/check-write-scope.mjs +56 -26
  11. package/presets/_shared/ai-local/scripts/lock.mjs +103 -30
  12. package/presets/_shared/ai-local/scripts/processes.mjs +5 -4
  13. package/presets/_shared/ai-local/scripts/rr-scheduler-start.mjs +161 -0
  14. package/presets/_shared/ai-local/scripts/rule-improver.mjs +4 -0
  15. package/presets/_shared/ai-local/scripts/run-compact.mjs +132 -0
  16. package/presets/_shared/ai-local/scripts/signals.mjs +3 -1
  17. package/presets/_shared/ai-local/scripts/team-db-api.mjs +354 -11
  18. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +309 -4
  19. package/presets/_shared/ai-local/scripts/team-db-project.mjs +515 -26
  20. package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +32 -2
  21. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +185 -1
  22. package/presets/_shared/ai-local/scripts/team-db-task-runner.mjs +3 -1
  23. package/presets/_shared/core/agent-team/agent-task-metrics.md +29 -0
  24. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +1 -1
  25. package/presets/_shared/core/meta/preset-pr-checklist.md +2 -2
  26. package/presets/_shared/core/quality/context-and-iteration.md +1 -1
  27. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +18 -1
  28. package/presets/_shared/hooks/compact-shell-output.mjs +68 -0
  29. package/presets/claude/android-kotlin/commands/README.md +4 -0
  30. package/presets/claude/android-kotlin/commands/rr-scheduler-start.md +32 -0
  31. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +18 -1
  32. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  33. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  34. package/presets/claude/android-kotlin/team/README.md +1 -1
  35. package/presets/claude/go/commands/README.md +4 -0
  36. package/presets/claude/go/commands/rr-scheduler-start.md +32 -0
  37. package/presets/claude/go/hooks/chain-team-phases.sh +18 -1
  38. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  39. package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  40. package/presets/claude/go/team/README.md +1 -1
  41. package/presets/claude/ios-swift/commands/README.md +4 -0
  42. package/presets/claude/ios-swift/commands/rr-scheduler-start.md +32 -0
  43. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +18 -1
  44. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  45. package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  46. package/presets/claude/ios-swift/team/README.md +1 -1
  47. package/presets/claude/java/commands/README.md +4 -0
  48. package/presets/claude/java/commands/rr-scheduler-start.md +32 -0
  49. package/presets/claude/java/hooks/chain-team-phases.sh +18 -1
  50. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  51. package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  52. package/presets/claude/java/team/README.md +1 -1
  53. package/presets/claude/mcp-ts/commands/README.md +4 -0
  54. package/presets/claude/mcp-ts/commands/rr-scheduler-start.md +32 -0
  55. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +18 -1
  56. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  57. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  58. package/presets/claude/mcp-ts/team/README.md +1 -1
  59. package/presets/claude/mol/commands/README.md +4 -0
  60. package/presets/claude/mol/commands/rr-scheduler-start.md +32 -0
  61. package/presets/claude/mol/hooks/chain-team-phases.sh +18 -1
  62. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  63. package/presets/claude/mol/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  64. package/presets/claude/mol/team/README.md +1 -1
  65. package/presets/claude/next/agents/build-verifier.md +1 -1
  66. package/presets/claude/next/agents/code-reviewer.md +2 -0
  67. package/presets/claude/next/commands/README.md +4 -0
  68. package/presets/claude/next/commands/rr-scheduler-start.md +32 -0
  69. package/presets/claude/next/hooks/chain-team-phases.sh +18 -1
  70. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  71. package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  72. package/presets/claude/next/team/README.md +1 -1
  73. package/presets/claude/nuxt/commands/README.md +4 -0
  74. package/presets/claude/nuxt/commands/rr-scheduler-start.md +32 -0
  75. package/presets/claude/nuxt/hooks/chain-team-phases.sh +18 -1
  76. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  77. package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  78. package/presets/claude/nuxt/team/README.md +1 -1
  79. package/presets/claude/php-hexagonal/commands/README.md +4 -0
  80. package/presets/claude/php-hexagonal/commands/rr-scheduler-start.md +32 -0
  81. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +18 -1
  82. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  83. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  84. package/presets/claude/php-hexagonal/team/README.md +1 -1
  85. package/presets/claude/php-laravel/commands/README.md +4 -0
  86. package/presets/claude/php-laravel/commands/rr-scheduler-start.md +32 -0
  87. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +18 -1
  88. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  89. package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  90. package/presets/claude/php-laravel/team/README.md +1 -1
  91. package/presets/claude/svelte/commands/README.md +4 -0
  92. package/presets/claude/svelte/commands/rr-scheduler-start.md +32 -0
  93. package/presets/claude/svelte/hooks/chain-team-phases.sh +18 -1
  94. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
  95. package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +2 -2
  96. package/presets/claude/svelte/team/README.md +1 -1
  97. package/presets/cursor/android-kotlin/commands/README.md +4 -0
  98. package/presets/cursor/android-kotlin/commands/rr-scheduler-start.md +32 -0
  99. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +18 -1
  100. package/presets/cursor/android-kotlin/hooks/compact-shell-output.mjs +68 -0
  101. package/presets/cursor/android-kotlin/hooks.json +7 -0
  102. package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +2 -2
  103. package/presets/cursor/android-kotlin/team/README.md +1 -1
  104. package/presets/cursor/go/commands/README.md +4 -0
  105. package/presets/cursor/go/commands/rr-scheduler-start.md +32 -0
  106. package/presets/cursor/go/hooks/chain-team-phases.sh +18 -1
  107. package/presets/cursor/go/hooks/compact-shell-output.mjs +68 -0
  108. package/presets/cursor/go/hooks.json +7 -0
  109. package/presets/cursor/go/rules/preset-pr-checklist.mdc +2 -2
  110. package/presets/cursor/go/team/README.md +1 -1
  111. package/presets/cursor/ios-swift/commands/README.md +4 -0
  112. package/presets/cursor/ios-swift/commands/rr-scheduler-start.md +32 -0
  113. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +18 -1
  114. package/presets/cursor/ios-swift/hooks/compact-shell-output.mjs +68 -0
  115. package/presets/cursor/ios-swift/hooks.json +7 -0
  116. package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +2 -2
  117. package/presets/cursor/ios-swift/team/README.md +1 -1
  118. package/presets/cursor/java/commands/README.md +4 -0
  119. package/presets/cursor/java/commands/rr-scheduler-start.md +32 -0
  120. package/presets/cursor/java/hooks/chain-team-phases.sh +18 -1
  121. package/presets/cursor/java/hooks/compact-shell-output.mjs +68 -0
  122. package/presets/cursor/java/hooks.json +7 -0
  123. package/presets/cursor/java/rules/preset-pr-checklist.mdc +2 -2
  124. package/presets/cursor/java/team/README.md +1 -1
  125. package/presets/cursor/mcp-ts/commands/README.md +4 -0
  126. package/presets/cursor/mcp-ts/commands/rr-scheduler-start.md +32 -0
  127. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +18 -1
  128. package/presets/cursor/mcp-ts/hooks/compact-shell-output.mjs +68 -0
  129. package/presets/cursor/mcp-ts/hooks.json +7 -0
  130. package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +2 -2
  131. package/presets/cursor/mcp-ts/team/README.md +1 -1
  132. package/presets/cursor/mol/commands/README.md +4 -0
  133. package/presets/cursor/mol/commands/rr-scheduler-start.md +32 -0
  134. package/presets/cursor/mol/hooks/chain-team-phases.sh +18 -1
  135. package/presets/cursor/mol/hooks/compact-shell-output.mjs +68 -0
  136. package/presets/cursor/mol/hooks.json +7 -0
  137. package/presets/cursor/mol/rules/preset-pr-checklist.mdc +2 -2
  138. package/presets/cursor/mol/team/README.md +1 -1
  139. package/presets/cursor/next/agents/build-verifier.md +1 -1
  140. package/presets/cursor/next/agents/code-reviewer.md +2 -0
  141. package/presets/cursor/next/commands/README.md +4 -0
  142. package/presets/cursor/next/commands/rr-scheduler-start.md +32 -0
  143. package/presets/cursor/next/hooks/chain-team-phases.sh +18 -1
  144. package/presets/cursor/next/hooks/compact-shell-output.mjs +68 -0
  145. package/presets/cursor/next/hooks.json +7 -0
  146. package/presets/cursor/next/rules/preset-pr-checklist.mdc +2 -2
  147. package/presets/cursor/next/team/README.md +1 -1
  148. package/presets/cursor/nuxt/commands/README.md +4 -0
  149. package/presets/cursor/nuxt/commands/rr-scheduler-start.md +32 -0
  150. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +18 -1
  151. package/presets/cursor/nuxt/hooks/compact-shell-output.mjs +68 -0
  152. package/presets/cursor/nuxt/hooks.json +7 -0
  153. package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +2 -2
  154. package/presets/cursor/nuxt/team/README.md +1 -1
  155. package/presets/cursor/php-hexagonal/commands/README.md +4 -0
  156. package/presets/cursor/php-hexagonal/commands/rr-scheduler-start.md +32 -0
  157. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +18 -1
  158. package/presets/cursor/php-hexagonal/hooks/compact-shell-output.mjs +68 -0
  159. package/presets/cursor/php-hexagonal/hooks.json +7 -0
  160. package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +2 -2
  161. package/presets/cursor/php-hexagonal/team/README.md +1 -1
  162. package/presets/cursor/php-laravel/commands/README.md +4 -0
  163. package/presets/cursor/php-laravel/commands/rr-scheduler-start.md +32 -0
  164. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +18 -1
  165. package/presets/cursor/php-laravel/hooks/compact-shell-output.mjs +68 -0
  166. package/presets/cursor/php-laravel/hooks.json +7 -0
  167. package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +2 -2
  168. package/presets/cursor/php-laravel/team/README.md +1 -1
  169. package/presets/cursor/svelte/commands/README.md +4 -0
  170. package/presets/cursor/svelte/commands/rr-scheduler-start.md +32 -0
  171. package/presets/cursor/svelte/hooks/chain-team-phases.sh +18 -1
  172. package/presets/cursor/svelte/hooks/compact-shell-output.mjs +68 -0
  173. package/presets/cursor/svelte/hooks.json +7 -0
  174. package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +2 -2
  175. package/presets/cursor/svelte/team/README.md +1 -1
  176. package/presets/mavis/android-kotlin/adapter-map.json +17 -1
  177. package/presets/mavis/android-kotlin/commands/README.md +4 -0
  178. package/presets/mavis/android-kotlin/commands/rr-scheduler-start.md +27 -0
  179. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +18 -1
  180. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +1 -1
  181. package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +2 -2
  182. package/presets/mavis/android-kotlin/team/README.md +1 -1
  183. package/presets/mavis/go/adapter-map.json +17 -1
  184. package/presets/mavis/go/commands/README.md +4 -0
  185. package/presets/mavis/go/commands/rr-scheduler-start.md +27 -0
  186. package/presets/mavis/go/hooks/chain-team-phases.sh +18 -1
  187. package/presets/mavis/go/rules/agent-team-orchestrator.md +1 -1
  188. package/presets/mavis/go/rules/preset-pr-checklist.md +2 -2
  189. package/presets/mavis/go/team/README.md +1 -1
  190. package/presets/mavis/ios-swift/adapter-map.json +17 -1
  191. package/presets/mavis/ios-swift/commands/README.md +4 -0
  192. package/presets/mavis/ios-swift/commands/rr-scheduler-start.md +27 -0
  193. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +18 -1
  194. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +1 -1
  195. package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +2 -2
  196. package/presets/mavis/ios-swift/team/README.md +1 -1
  197. package/presets/mavis/java/adapter-map.json +17 -1
  198. package/presets/mavis/java/commands/README.md +4 -0
  199. package/presets/mavis/java/commands/rr-scheduler-start.md +27 -0
  200. package/presets/mavis/java/hooks/chain-team-phases.sh +18 -1
  201. package/presets/mavis/java/rules/agent-team-orchestrator.md +1 -1
  202. package/presets/mavis/java/rules/preset-pr-checklist.md +2 -2
  203. package/presets/mavis/java/team/README.md +1 -1
  204. package/presets/mavis/mcp-ts/adapter-map.json +17 -1
  205. package/presets/mavis/mcp-ts/commands/README.md +4 -0
  206. package/presets/mavis/mcp-ts/commands/rr-scheduler-start.md +27 -0
  207. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +18 -1
  208. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +1 -1
  209. package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +2 -2
  210. package/presets/mavis/mcp-ts/team/README.md +1 -1
  211. package/presets/mavis/mol/adapter-map.json +17 -1
  212. package/presets/mavis/mol/commands/README.md +4 -0
  213. package/presets/mavis/mol/commands/rr-scheduler-start.md +27 -0
  214. package/presets/mavis/mol/hooks/chain-team-phases.sh +18 -1
  215. package/presets/mavis/mol/rules/agent-team-orchestrator.md +1 -1
  216. package/presets/mavis/mol/rules/preset-pr-checklist.md +2 -2
  217. package/presets/mavis/mol/team/README.md +1 -1
  218. package/presets/mavis/next/adapter-map.json +17 -1
  219. package/presets/mavis/next/agents/build-verifier.md +1 -1
  220. package/presets/mavis/next/agents/code-reviewer.md +2 -0
  221. package/presets/mavis/next/commands/README.md +4 -0
  222. package/presets/mavis/next/commands/rr-scheduler-start.md +27 -0
  223. package/presets/mavis/next/hooks/chain-team-phases.sh +18 -1
  224. package/presets/mavis/next/rules/agent-team-orchestrator.md +1 -1
  225. package/presets/mavis/next/rules/preset-pr-checklist.md +2 -2
  226. package/presets/mavis/next/team/README.md +1 -1
  227. package/presets/mavis/nuxt/adapter-map.json +17 -1
  228. package/presets/mavis/nuxt/commands/README.md +4 -0
  229. package/presets/mavis/nuxt/commands/rr-scheduler-start.md +27 -0
  230. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +18 -1
  231. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +1 -1
  232. package/presets/mavis/nuxt/rules/preset-pr-checklist.md +2 -2
  233. package/presets/mavis/nuxt/team/README.md +1 -1
  234. package/presets/mavis/php-hexagonal/adapter-map.json +17 -1
  235. package/presets/mavis/php-hexagonal/commands/README.md +4 -0
  236. package/presets/mavis/php-hexagonal/commands/rr-scheduler-start.md +27 -0
  237. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +18 -1
  238. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
  239. package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +2 -2
  240. package/presets/mavis/php-hexagonal/team/README.md +1 -1
  241. package/presets/mavis/php-laravel/adapter-map.json +17 -1
  242. package/presets/mavis/php-laravel/commands/README.md +4 -0
  243. package/presets/mavis/php-laravel/commands/rr-scheduler-start.md +27 -0
  244. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +18 -1
  245. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +1 -1
  246. package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +2 -2
  247. package/presets/mavis/php-laravel/team/README.md +1 -1
  248. package/presets/mavis/svelte/adapter-map.json +17 -1
  249. package/presets/mavis/svelte/commands/README.md +4 -0
  250. package/presets/mavis/svelte/commands/rr-scheduler-start.md +27 -0
  251. package/presets/mavis/svelte/hooks/chain-team-phases.sh +18 -1
  252. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +1 -1
  253. package/presets/mavis/svelte/rules/preset-pr-checklist.md +2 -2
  254. package/presets/mavis/svelte/team/README.md +1 -1
  255. package/presets/opencode/android-kotlin/adapter-map.json +17 -1
  256. package/presets/opencode/android-kotlin/commands/README.md +4 -0
  257. package/presets/opencode/android-kotlin/commands/rr-scheduler-start.md +35 -0
  258. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +18 -1
  259. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +1 -1
  260. package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +2 -2
  261. package/presets/opencode/android-kotlin/team/README.md +1 -1
  262. package/presets/opencode/go/adapter-map.json +17 -1
  263. package/presets/opencode/go/commands/README.md +4 -0
  264. package/presets/opencode/go/commands/rr-scheduler-start.md +35 -0
  265. package/presets/opencode/go/hooks/chain-team-phases.sh +18 -1
  266. package/presets/opencode/go/rules/agent-team-orchestrator.md +1 -1
  267. package/presets/opencode/go/rules/preset-pr-checklist.md +2 -2
  268. package/presets/opencode/go/team/README.md +1 -1
  269. package/presets/opencode/ios-swift/adapter-map.json +17 -1
  270. package/presets/opencode/ios-swift/commands/README.md +4 -0
  271. package/presets/opencode/ios-swift/commands/rr-scheduler-start.md +35 -0
  272. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +18 -1
  273. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +1 -1
  274. package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +2 -2
  275. package/presets/opencode/ios-swift/team/README.md +1 -1
  276. package/presets/opencode/java/adapter-map.json +17 -1
  277. package/presets/opencode/java/commands/README.md +4 -0
  278. package/presets/opencode/java/commands/rr-scheduler-start.md +35 -0
  279. package/presets/opencode/java/hooks/chain-team-phases.sh +18 -1
  280. package/presets/opencode/java/rules/agent-team-orchestrator.md +1 -1
  281. package/presets/opencode/java/rules/preset-pr-checklist.md +2 -2
  282. package/presets/opencode/java/team/README.md +1 -1
  283. package/presets/opencode/mcp-ts/adapter-map.json +17 -1
  284. package/presets/opencode/mcp-ts/commands/README.md +4 -0
  285. package/presets/opencode/mcp-ts/commands/rr-scheduler-start.md +35 -0
  286. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +18 -1
  287. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +1 -1
  288. package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +2 -2
  289. package/presets/opencode/mcp-ts/team/README.md +1 -1
  290. package/presets/opencode/mol/adapter-map.json +17 -1
  291. package/presets/opencode/mol/commands/README.md +4 -0
  292. package/presets/opencode/mol/commands/rr-scheduler-start.md +35 -0
  293. package/presets/opencode/mol/hooks/chain-team-phases.sh +18 -1
  294. package/presets/opencode/mol/rules/agent-team-orchestrator.md +1 -1
  295. package/presets/opencode/mol/rules/preset-pr-checklist.md +2 -2
  296. package/presets/opencode/mol/team/README.md +1 -1
  297. package/presets/opencode/next/adapter-map.json +17 -1
  298. package/presets/opencode/next/agents/build-verifier.md +1 -1
  299. package/presets/opencode/next/agents/code-reviewer.md +2 -0
  300. package/presets/opencode/next/commands/README.md +4 -0
  301. package/presets/opencode/next/commands/rr-scheduler-start.md +35 -0
  302. package/presets/opencode/next/hooks/chain-team-phases.sh +18 -1
  303. package/presets/opencode/next/rules/agent-team-orchestrator.md +1 -1
  304. package/presets/opencode/next/rules/preset-pr-checklist.md +2 -2
  305. package/presets/opencode/next/team/README.md +1 -1
  306. package/presets/opencode/nuxt/adapter-map.json +17 -1
  307. package/presets/opencode/nuxt/commands/README.md +4 -0
  308. package/presets/opencode/nuxt/commands/rr-scheduler-start.md +35 -0
  309. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +18 -1
  310. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +1 -1
  311. package/presets/opencode/nuxt/rules/preset-pr-checklist.md +2 -2
  312. package/presets/opencode/nuxt/team/README.md +1 -1
  313. package/presets/opencode/php-hexagonal/adapter-map.json +17 -1
  314. package/presets/opencode/php-hexagonal/commands/README.md +4 -0
  315. package/presets/opencode/php-hexagonal/commands/rr-scheduler-start.md +35 -0
  316. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +18 -1
  317. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
  318. package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +2 -2
  319. package/presets/opencode/php-hexagonal/team/README.md +1 -1
  320. package/presets/opencode/php-laravel/adapter-map.json +17 -1
  321. package/presets/opencode/php-laravel/commands/README.md +4 -0
  322. package/presets/opencode/php-laravel/commands/rr-scheduler-start.md +35 -0
  323. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +18 -1
  324. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +1 -1
  325. package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +2 -2
  326. package/presets/opencode/php-laravel/team/README.md +1 -1
  327. package/presets/opencode/plugins/output-guard/README.md +45 -3
  328. package/presets/opencode/plugins/output-guard/actions.ts +201 -0
  329. package/presets/opencode/plugins/output-guard/index.ts +147 -6
  330. package/presets/opencode/plugins/output-guard/rewrite.ts +10 -1
  331. package/presets/opencode/svelte/adapter-map.json +17 -1
  332. package/presets/opencode/svelte/commands/README.md +4 -0
  333. package/presets/opencode/svelte/commands/rr-scheduler-start.md +35 -0
  334. package/presets/opencode/svelte/hooks/chain-team-phases.sh +18 -1
  335. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +1 -1
  336. package/presets/opencode/svelte/rules/preset-pr-checklist.md +2 -2
  337. package/presets/opencode/svelte/team/README.md +1 -1
  338. package/presets/zcode/android-kotlin/adapter-map.json +17 -1
  339. package/presets/zcode/android-kotlin/commands/README.md +4 -0
  340. package/presets/zcode/android-kotlin/commands/rr-scheduler-start.md +35 -0
  341. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +18 -1
  342. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +1 -1
  343. package/presets/zcode/android-kotlin/rules/preset-pr-checklist.md +2 -2
  344. package/presets/zcode/android-kotlin/team/README.md +1 -1
  345. package/presets/zcode/go/adapter-map.json +17 -1
  346. package/presets/zcode/go/commands/README.md +4 -0
  347. package/presets/zcode/go/commands/rr-scheduler-start.md +35 -0
  348. package/presets/zcode/go/hooks/chain-team-phases.sh +18 -1
  349. package/presets/zcode/go/rules/agent-team-orchestrator.md +1 -1
  350. package/presets/zcode/go/rules/preset-pr-checklist.md +2 -2
  351. package/presets/zcode/go/team/README.md +1 -1
  352. package/presets/zcode/ios-swift/adapter-map.json +17 -1
  353. package/presets/zcode/ios-swift/commands/README.md +4 -0
  354. package/presets/zcode/ios-swift/commands/rr-scheduler-start.md +35 -0
  355. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +18 -1
  356. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +1 -1
  357. package/presets/zcode/ios-swift/rules/preset-pr-checklist.md +2 -2
  358. package/presets/zcode/ios-swift/team/README.md +1 -1
  359. package/presets/zcode/java/adapter-map.json +17 -1
  360. package/presets/zcode/java/commands/README.md +4 -0
  361. package/presets/zcode/java/commands/rr-scheduler-start.md +35 -0
  362. package/presets/zcode/java/hooks/chain-team-phases.sh +18 -1
  363. package/presets/zcode/java/rules/agent-team-orchestrator.md +1 -1
  364. package/presets/zcode/java/rules/preset-pr-checklist.md +2 -2
  365. package/presets/zcode/java/team/README.md +1 -1
  366. package/presets/zcode/mcp-ts/adapter-map.json +17 -1
  367. package/presets/zcode/mcp-ts/commands/README.md +4 -0
  368. package/presets/zcode/mcp-ts/commands/rr-scheduler-start.md +35 -0
  369. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +18 -1
  370. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +1 -1
  371. package/presets/zcode/mcp-ts/rules/preset-pr-checklist.md +2 -2
  372. package/presets/zcode/mcp-ts/team/README.md +1 -1
  373. package/presets/zcode/mol/adapter-map.json +17 -1
  374. package/presets/zcode/mol/commands/README.md +4 -0
  375. package/presets/zcode/mol/commands/rr-scheduler-start.md +35 -0
  376. package/presets/zcode/mol/hooks/chain-team-phases.sh +18 -1
  377. package/presets/zcode/mol/rules/agent-team-orchestrator.md +1 -1
  378. package/presets/zcode/mol/rules/preset-pr-checklist.md +2 -2
  379. package/presets/zcode/mol/team/README.md +1 -1
  380. package/presets/zcode/next/adapter-map.json +17 -1
  381. package/presets/zcode/next/agents/build-verifier.md +1 -1
  382. package/presets/zcode/next/agents/code-reviewer.md +2 -0
  383. package/presets/zcode/next/commands/README.md +4 -0
  384. package/presets/zcode/next/commands/rr-scheduler-start.md +35 -0
  385. package/presets/zcode/next/hooks/chain-team-phases.sh +18 -1
  386. package/presets/zcode/next/rules/agent-team-orchestrator.md +1 -1
  387. package/presets/zcode/next/rules/preset-pr-checklist.md +2 -2
  388. package/presets/zcode/next/team/README.md +1 -1
  389. package/presets/zcode/nuxt/adapter-map.json +17 -1
  390. package/presets/zcode/nuxt/commands/README.md +4 -0
  391. package/presets/zcode/nuxt/commands/rr-scheduler-start.md +35 -0
  392. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +18 -1
  393. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +1 -1
  394. package/presets/zcode/nuxt/rules/preset-pr-checklist.md +2 -2
  395. package/presets/zcode/nuxt/team/README.md +1 -1
  396. package/presets/zcode/php-hexagonal/adapter-map.json +17 -1
  397. package/presets/zcode/php-hexagonal/commands/README.md +4 -0
  398. package/presets/zcode/php-hexagonal/commands/rr-scheduler-start.md +35 -0
  399. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +18 -1
  400. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
  401. package/presets/zcode/php-hexagonal/rules/preset-pr-checklist.md +2 -2
  402. package/presets/zcode/php-hexagonal/team/README.md +1 -1
  403. package/presets/zcode/php-laravel/adapter-map.json +17 -1
  404. package/presets/zcode/php-laravel/commands/README.md +4 -0
  405. package/presets/zcode/php-laravel/commands/rr-scheduler-start.md +35 -0
  406. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +18 -1
  407. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +1 -1
  408. package/presets/zcode/php-laravel/rules/preset-pr-checklist.md +2 -2
  409. package/presets/zcode/php-laravel/team/README.md +1 -1
  410. package/presets/zcode/svelte/adapter-map.json +17 -1
  411. package/presets/zcode/svelte/commands/README.md +4 -0
  412. package/presets/zcode/svelte/commands/rr-scheduler-start.md +35 -0
  413. package/presets/zcode/svelte/hooks/chain-team-phases.sh +18 -1
  414. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +1 -1
  415. package/presets/zcode/svelte/rules/preset-pr-checklist.md +2 -2
  416. package/presets/zcode/svelte/team/README.md +1 -1
  417. package/scripts/close-agent-task-human-gate.mjs +3 -3
  418. package/scripts/report-context-cost.mjs +10 -3
  419. package/scripts/aggregate-agent-task-metrics.mjs +0 -480
@@ -233,7 +233,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
233
233
  | `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
234
234
  | `model` | `cheap` \| `standard` \| `strong` — optional tier override |
235
235
 
236
- `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.
236
+ `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.
237
237
 
238
238
  ## Rules (strict)
239
239
 
@@ -23,7 +23,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
23
23
  - [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
24
24
  - [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
25
25
  - [ ] **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`.
26
- - [ ] **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
26
+ - [ ] **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
27
27
  - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
28
28
  - [ ] **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
29
29
  - [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
@@ -40,6 +40,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
40
40
  - Budget: `preset-token-budget`
41
41
  - Leakage: `preset-no-cross-stack-leakage`
42
42
  - Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
43
- - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
43
+ - 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`
44
44
  - Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
45
45
  - 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).
@@ -3,7 +3,7 @@
3
3
  "platform": "mavis",
4
4
  "stack": "java",
5
5
  "semanticSource": "cursor/java",
6
- "sourceRevision": "a455ed6cd1b5d5d0cd3a3506a7a33ce250b1410228ec1d251978bbb2fed4c750",
6
+ "sourceRevision": "dca08d35c8580d467adbe01cf718623546ed8fe01c6746a0468d4852f48b041b",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -251,6 +251,14 @@
251
251
  "loadMode": "manual",
252
252
  "reason": "No file-defined slash command API; keep as an explicit procedure plus exec --file"
253
253
  },
254
+ {
255
+ "source": "commands/rr-scheduler-start.md",
256
+ "target": "commands/rr-scheduler-start.md",
257
+ "category": "commands",
258
+ "disposition": "transform",
259
+ "loadMode": "manual",
260
+ "reason": "No file-defined slash command API; keep as an explicit procedure plus exec --file"
261
+ },
254
262
  {
255
263
  "source": "commands/spec-start.md",
256
264
  "target": "commands/spec-start.md",
@@ -316,6 +324,14 @@
316
324
  "loadMode": "manual",
317
325
  "reason": "Agent-run version check on the first reply; no native session hook on Mavis"
318
326
  },
327
+ {
328
+ "source": "hooks/compact-shell-output.mjs",
329
+ "target": null,
330
+ "category": "hooks",
331
+ "disposition": "omit",
332
+ "loadMode": "not-installed",
333
+ "reason": "omit: Cursor preToolUse rewrite; the large-output guard has no Mavis hook event"
334
+ },
319
335
  {
320
336
  "source": "hooks/examples/format-edited.example.sh",
321
337
  "target": null,
@@ -52,3 +52,7 @@ Procedure files are copied to `.mavis/commands/` on `ai-rules init mavis --prese
52
52
  - Hooks: `../hooks/chain-team-phases.sh` only (semi-auto runner; no `hooks.json` in mavis)
53
53
 
54
54
  Edit procedure files in this preset folder or in the installed `.mavis/commands/` copy after `init`.
55
+
56
+ ## Scheduler
57
+
58
+ - **`/rr-scheduler-start`** — start the team-db scheduler, or restart it when one already holds the lease. `init` seeds `.ai.local/scripts/rr-scheduler-start.mjs`.
@@ -0,0 +1,27 @@
1
+ # Start or restart the scheduler
2
+
3
+ Bring up `team-db.mjs schedule` for this repository. When a scheduler already holds the lease, stop that process and start a new one.
4
+
5
+ ## What to do
6
+
7
+ 1. From the repository root, run:
8
+
9
+ ```bash
10
+ node .ai.local/scripts/rr-scheduler-start.mjs
11
+ ```
12
+
13
+ 2. Quote the stdout verbatim. A start prints `scheduler: started pid <pid>`. A restart prints `scheduler: restarted pid <pid> (stopped <previous>)`, plus the `processes:` lines from the manager.
14
+ 3. On a non-zero exit, quote the `error:` line verbatim and stop. Do not start `team-db.mjs schedule` by hand and do not signal a pid the script did not name.
15
+
16
+ ## What the script does
17
+
18
+ - Stops a scheduler this repository recorded, via `processes.mjs stop --name scheduler`.
19
+ - Signals a scheduler that was started outside the manager only when `scheduler.lock` names a live pid whose command line is `team-db.mjs schedule`. `SIGTERM`, then `SIGKILL` if it is still alive after 8 seconds. An in-flight child can outlive that kill.
20
+ - Removes `scheduler.lock` when its pid is already dead, so a crash does not block the next start for 90 seconds.
21
+ - Starts the timer through `processes.mjs start --name scheduler` with `exec node .ai.local/scripts/team-db.mjs schedule`, then waits until the new lease is fresh.
22
+
23
+ ## Do not
24
+
25
+ - Write `status.json`, `metrics.json`, or any task or lifecycle file.
26
+ - Run `pkill`, `killall`, or `kill` against a pid the script did not print.
27
+ - Start a second `team-db.mjs schedule` after a non-zero exit.
@@ -58,12 +58,29 @@ function readSessionLease(id) {
58
58
  return null;
59
59
  }
60
60
  }
61
+ // The lease carries the window the projector attributes rows with — never one
62
+ // instant. `firstSeenAt` survives every later write of the same (session, slug)
63
+ // pair; a different slug starts a new window, and a lease older than the TTL
64
+ // starts over instead of claiming an ancient first sighting.
65
+ function firstSeenAtOf(file, value, now) {
66
+ try {
67
+ if (Date.now() - fs.statSync(file).mtimeMs > LEASE_TTL_MS) return now;
68
+ const previous = JSON.parse(fs.readFileSync(file, 'utf8'));
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
+ }
73
+ } catch {}
74
+ return now;
75
+ }
61
76
  function writeSessionLease(id, value) {
62
77
  try {
63
78
  fs.mkdirSync(LEASE_ROOT, { recursive: true });
64
79
  const file = sessionLeasePath(id);
65
80
  const temporary = `${file}.${process.pid}.tmp`;
66
- fs.writeFileSync(temporary, `${JSON.stringify({ slug: value, sessionId: id, updatedAt: new Date().toISOString() })}\n`);
81
+ const now = new Date().toISOString();
82
+ const firstSeenAt = firstSeenAtOf(file, value, now);
83
+ fs.writeFileSync(temporary, `${JSON.stringify({ slug: value, sessionId: id, firstSeenAt, updatedAt: now })}\n`);
67
84
  fs.renameSync(temporary, file);
68
85
  for (const name of fs.readdirSync(LEASE_ROOT)) {
69
86
  if (!name.endsWith('.json')) continue;
@@ -233,7 +233,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
233
233
  | `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
234
234
  | `model` | `cheap` \| `standard` \| `strong` — optional tier override |
235
235
 
236
- `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.
236
+ `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.
237
237
 
238
238
  ## Rules (strict)
239
239
 
@@ -23,7 +23,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
23
23
  - [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
24
24
  - [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
25
25
  - [ ] **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`.
26
- - [ ] **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
26
+ - [ ] **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
27
27
  - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
28
28
  - [ ] **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
29
29
  - [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
@@ -40,6 +40,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
40
40
  - Budget: `preset-token-budget`
41
41
  - Leakage: `preset-no-cross-stack-leakage`
42
42
  - Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
43
- - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
43
+ - 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`
44
44
  - Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
45
45
  - 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).
@@ -3,7 +3,7 @@
3
3
  "platform": "mavis",
4
4
  "stack": "mcp-ts",
5
5
  "semanticSource": "cursor/mcp-ts",
6
- "sourceRevision": "45e094f5a27b52cd6835bae8115528f60ea56df3450bd2111bf7f798ce0bb4f2",
6
+ "sourceRevision": "d78d43d57df29207a35e3fe9d7311ad2f269c962014c77fda5bfc4a0e79b9045",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -107,6 +107,14 @@
107
107
  "loadMode": "manual",
108
108
  "reason": "No file-defined slash command API; keep as an explicit procedure plus exec --file"
109
109
  },
110
+ {
111
+ "source": "commands/rr-scheduler-start.md",
112
+ "target": "commands/rr-scheduler-start.md",
113
+ "category": "commands",
114
+ "disposition": "transform",
115
+ "loadMode": "manual",
116
+ "reason": "No file-defined slash command API; keep as an explicit procedure plus exec --file"
117
+ },
110
118
  {
111
119
  "source": "commands/spec-start.md",
112
120
  "target": "commands/spec-start.md",
@@ -172,6 +180,14 @@
172
180
  "loadMode": "manual",
173
181
  "reason": "Agent-run version check on the first reply; no native session hook on Mavis"
174
182
  },
183
+ {
184
+ "source": "hooks/compact-shell-output.mjs",
185
+ "target": null,
186
+ "category": "hooks",
187
+ "disposition": "omit",
188
+ "loadMode": "not-installed",
189
+ "reason": "omit: Cursor preToolUse rewrite; the large-output guard has no Mavis hook event"
190
+ },
175
191
  {
176
192
  "source": "hooks/examples/format-edited.example.sh",
177
193
  "target": null,
@@ -9,3 +9,7 @@ Slash commands are copied to `.mavis/commands/` (Cursor) or `.claude/commands/`
9
9
  | `/technical-retro` | Retro |
10
10
  | `/update` | Reinstall each installed tool with the preset recorded at init |
11
11
  | `/migrate-tasks` | Create or reconcile `.ai.local/team/team.db`; writes only the delta |
12
+
13
+ ## Scheduler
14
+
15
+ - **`/rr-scheduler-start`** — start the team-db scheduler, or restart it when one already holds the lease. `init` seeds `.ai.local/scripts/rr-scheduler-start.mjs`.
@@ -0,0 +1,27 @@
1
+ # Start or restart the scheduler
2
+
3
+ Bring up `team-db.mjs schedule` for this repository. When a scheduler already holds the lease, stop that process and start a new one.
4
+
5
+ ## What to do
6
+
7
+ 1. From the repository root, run:
8
+
9
+ ```bash
10
+ node .ai.local/scripts/rr-scheduler-start.mjs
11
+ ```
12
+
13
+ 2. Quote the stdout verbatim. A start prints `scheduler: started pid <pid>`. A restart prints `scheduler: restarted pid <pid> (stopped <previous>)`, plus the `processes:` lines from the manager.
14
+ 3. On a non-zero exit, quote the `error:` line verbatim and stop. Do not start `team-db.mjs schedule` by hand and do not signal a pid the script did not name.
15
+
16
+ ## What the script does
17
+
18
+ - Stops a scheduler this repository recorded, via `processes.mjs stop --name scheduler`.
19
+ - Signals a scheduler that was started outside the manager only when `scheduler.lock` names a live pid whose command line is `team-db.mjs schedule`. `SIGTERM`, then `SIGKILL` if it is still alive after 8 seconds. An in-flight child can outlive that kill.
20
+ - Removes `scheduler.lock` when its pid is already dead, so a crash does not block the next start for 90 seconds.
21
+ - Starts the timer through `processes.mjs start --name scheduler` with `exec node .ai.local/scripts/team-db.mjs schedule`, then waits until the new lease is fresh.
22
+
23
+ ## Do not
24
+
25
+ - Write `status.json`, `metrics.json`, or any task or lifecycle file.
26
+ - Run `pkill`, `killall`, or `kill` against a pid the script did not print.
27
+ - Start a second `team-db.mjs schedule` after a non-zero exit.
@@ -60,12 +60,29 @@ function readSessionLease(id) {
60
60
  return null;
61
61
  }
62
62
  }
63
+ // The lease carries the window the projector attributes rows with — never one
64
+ // instant. `firstSeenAt` survives every later write of the same (session, slug)
65
+ // pair; a different slug starts a new window, and a lease older than the TTL
66
+ // starts over instead of claiming an ancient first sighting.
67
+ function firstSeenAtOf(file, value, now) {
68
+ try {
69
+ if (Date.now() - fs.statSync(file).mtimeMs > LEASE_TTL_MS) return now;
70
+ const previous = JSON.parse(fs.readFileSync(file, 'utf8'));
71
+ if (previous && previous.slug === value) {
72
+ if (typeof previous.firstSeenAt === 'string') return previous.firstSeenAt;
73
+ if (typeof previous.updatedAt === 'string') return previous.updatedAt;
74
+ }
75
+ } catch {}
76
+ return now;
77
+ }
63
78
  function writeSessionLease(id, value) {
64
79
  try {
65
80
  fs.mkdirSync(LEASE_ROOT, { recursive: true });
66
81
  const file = sessionLeasePath(id);
67
82
  const temporary = `${file}.${process.pid}.tmp`;
68
- fs.writeFileSync(temporary, `${JSON.stringify({ slug: value, sessionId: id, updatedAt: new Date().toISOString() })}\n`);
83
+ const now = new Date().toISOString();
84
+ const firstSeenAt = firstSeenAtOf(file, value, now);
85
+ fs.writeFileSync(temporary, `${JSON.stringify({ slug: value, sessionId: id, firstSeenAt, updatedAt: now })}\n`);
69
86
  fs.renameSync(temporary, file);
70
87
  for (const name of fs.readdirSync(LEASE_ROOT)) {
71
88
  if (!name.endsWith('.json')) continue;
@@ -233,7 +233,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
233
233
  | `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
234
234
  | `model` | `cheap` \| `standard` \| `strong` — optional tier override |
235
235
 
236
- `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.
236
+ `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.
237
237
 
238
238
  ## Rules (strict)
239
239
 
@@ -23,7 +23,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
23
23
  - [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
24
24
  - [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
25
25
  - [ ] **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`.
26
- - [ ] **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
26
+ - [ ] **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
27
27
  - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
28
28
  - [ ] **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
29
29
  - [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
@@ -40,6 +40,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
40
40
  - Budget: `preset-token-budget`
41
41
  - Leakage: `preset-no-cross-stack-leakage`
42
42
  - Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
43
- - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
43
+ - 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`
44
44
  - Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
45
45
  - 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).
@@ -3,7 +3,7 @@
3
3
  "platform": "mavis",
4
4
  "stack": "mol",
5
5
  "semanticSource": "cursor/mol",
6
- "sourceRevision": "ccf590af02d263e4381b3ca8050b9b5c22d5c375e893cc41d92e05c398be6d8f",
6
+ "sourceRevision": "c49e526c55de10076a87b3777bdf78c4df8106f2380e0ba0a2c8755d012e8e5f",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -485,6 +485,14 @@
485
485
  "loadMode": "manual",
486
486
  "reason": "No file-defined slash command API; keep as an explicit procedure plus exec --file"
487
487
  },
488
+ {
489
+ "source": "commands/rr-scheduler-start.md",
490
+ "target": "commands/rr-scheduler-start.md",
491
+ "category": "commands",
492
+ "disposition": "transform",
493
+ "loadMode": "manual",
494
+ "reason": "No file-defined slash command API; keep as an explicit procedure plus exec --file"
495
+ },
488
496
  {
489
497
  "source": "commands/spec-start.md",
490
498
  "target": "commands/spec-start.md",
@@ -559,6 +567,14 @@
559
567
  "loadMode": "manual",
560
568
  "reason": "Agent-run version check on the first reply; no native session hook on Mavis"
561
569
  },
570
+ {
571
+ "source": "hooks/compact-shell-output.mjs",
572
+ "target": null,
573
+ "category": "hooks",
574
+ "disposition": "omit",
575
+ "loadMode": "not-installed",
576
+ "reason": "omit: Cursor preToolUse rewrite; the large-output guard has no Mavis hook event"
577
+ },
562
578
  {
563
579
  "source": "hooks/examples/format-edited.example.sh",
564
580
  "target": null,
@@ -54,3 +54,7 @@ On OpenCode, `/task-evil` runs as the `task-evil` primary agent: the `question`
54
54
  - Hooks: `../hooks/chain-team-phases.sh` only (semi-auto runner; no `hooks.json` in mavis)
55
55
 
56
56
  Edit procedure files in this preset folder or in the installed `.mavis/commands/` copy after `init`.
57
+
58
+ ## Scheduler
59
+
60
+ - **`/rr-scheduler-start`** — start the team-db scheduler, or restart it when one already holds the lease. `init` seeds `.ai.local/scripts/rr-scheduler-start.mjs`.
@@ -0,0 +1,27 @@
1
+ # Start or restart the scheduler
2
+
3
+ Bring up `team-db.mjs schedule` for this repository. When a scheduler already holds the lease, stop that process and start a new one.
4
+
5
+ ## What to do
6
+
7
+ 1. From the repository root, run:
8
+
9
+ ```bash
10
+ node .ai.local/scripts/rr-scheduler-start.mjs
11
+ ```
12
+
13
+ 2. Quote the stdout verbatim. A start prints `scheduler: started pid <pid>`. A restart prints `scheduler: restarted pid <pid> (stopped <previous>)`, plus the `processes:` lines from the manager.
14
+ 3. On a non-zero exit, quote the `error:` line verbatim and stop. Do not start `team-db.mjs schedule` by hand and do not signal a pid the script did not name.
15
+
16
+ ## What the script does
17
+
18
+ - Stops a scheduler this repository recorded, via `processes.mjs stop --name scheduler`.
19
+ - Signals a scheduler that was started outside the manager only when `scheduler.lock` names a live pid whose command line is `team-db.mjs schedule`. `SIGTERM`, then `SIGKILL` if it is still alive after 8 seconds. An in-flight child can outlive that kill.
20
+ - Removes `scheduler.lock` when its pid is already dead, so a crash does not block the next start for 90 seconds.
21
+ - Starts the timer through `processes.mjs start --name scheduler` with `exec node .ai.local/scripts/team-db.mjs schedule`, then waits until the new lease is fresh.
22
+
23
+ ## Do not
24
+
25
+ - Write `status.json`, `metrics.json`, or any task or lifecycle file.
26
+ - Run `pkill`, `killall`, or `kill` against a pid the script did not print.
27
+ - Start a second `team-db.mjs schedule` after a non-zero exit.
@@ -57,12 +57,29 @@ function readSessionLease(id) {
57
57
  return null;
58
58
  }
59
59
  }
60
+ // The lease carries the window the projector attributes rows with — never one
61
+ // instant. `firstSeenAt` survives every later write of the same (session, slug)
62
+ // pair; a different slug starts a new window, and a lease older than the TTL
63
+ // starts over instead of claiming an ancient first sighting.
64
+ function firstSeenAtOf(file, value, now) {
65
+ try {
66
+ if (Date.now() - fs.statSync(file).mtimeMs > LEASE_TTL_MS) return now;
67
+ const previous = JSON.parse(fs.readFileSync(file, 'utf8'));
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
+ }
72
+ } catch {}
73
+ return now;
74
+ }
60
75
  function writeSessionLease(id, value) {
61
76
  try {
62
77
  fs.mkdirSync(LEASE_ROOT, { recursive: true });
63
78
  const file = sessionLeasePath(id);
64
79
  const temporary = `${file}.${process.pid}.tmp`;
65
- fs.writeFileSync(temporary, `${JSON.stringify({ slug: value, sessionId: id, updatedAt: new Date().toISOString() })}\n`);
80
+ const now = new Date().toISOString();
81
+ const firstSeenAt = firstSeenAtOf(file, value, now);
82
+ fs.writeFileSync(temporary, `${JSON.stringify({ slug: value, sessionId: id, firstSeenAt, updatedAt: now })}\n`);
66
83
  fs.renameSync(temporary, file);
67
84
  for (const name of fs.readdirSync(LEASE_ROOT)) {
68
85
  if (!name.endsWith('.json')) continue;
@@ -233,7 +233,7 @@ On each `subagentStop`, the hook reconciles `status.state` from the completing p
233
233
  | `scope` | e.g. `unit-in-dev`, `e2e-only` — passed to developer/qa |
234
234
  | `model` | `cheap` \| `standard` \| `strong` — optional tier override |
235
235
 
236
- `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.
236
+ `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.
237
237
 
238
238
  ## Rules (strict)
239
239
 
@@ -23,7 +23,7 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
23
23
  - [ ] **README:** stack `rules/README.md` core→stack mapping / catalog updated if stems added
24
24
  - [ ] **CHANGELOG / package README:** note when public preset paths or install surface change
25
25
  - [ ] **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`.
26
- - [ ] **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
26
+ - [ ] **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
27
27
  - [ ] **shared-core drift:** for embed-mode stems, run `packages/ai-rules/scripts/check-shared-core-drift.sh` (or document intentional fork)
28
28
  - [ ] **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
29
29
  - [ ] **UI-only surfaces:** `mockup-reviewer`, `accessibility-reviewer`, `ux-design`, and the stack performance skill ship only on UI stacks (`check-preset-leakage.sh`)
@@ -40,6 +40,6 @@ Checklist for PRs that touch `packages/ai-rules/presets/**` (and dogfood `.curso
40
40
  - Budget: `preset-token-budget`
41
41
  - Leakage: `preset-no-cross-stack-leakage`
42
42
  - Validation: same `check:task` / `check:changed` loop; `yarn release:gate` before a release (`packages/ai-rules/scripts/release-gate.sh`)
43
- - Dogfood scripts: `packages/ai-rules/scripts/sync-dogfood-cursor.sh`, `sync-dogfood-claude.sh`, `sync-dogfood-mavis.sh`, `sync-dogfood-opencode.sh`
43
+ - 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`
44
44
  - Drift script: `packages/ai-rules/scripts/check-shared-core-drift.sh`
45
45
  - Orchestrator: when editing presets, load this checklist + twin-sync
@@ -136,5 +136,5 @@ Use the hook path for the platform that installed the tree: `.cursor`, `.claude`
136
136
  - **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.
137
137
  - **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[]`.
138
138
  - Manifest schema: shared core `agent-team/agent-artifact-contracts.md`. Read it first; producers upsert only their IDs.
139
- - 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`.
139
+ - 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`.
140
140
  - Commit `.ai.local/team/` templates (and slugs if you want them in clones).
@@ -3,7 +3,7 @@
3
3
  "platform": "mavis",
4
4
  "stack": "next",
5
5
  "semanticSource": "cursor/next",
6
- "sourceRevision": "2fc0d4d1b56a16eef7138a9ff6d3841a9beaf7d49d90c9282632c139decaeb21",
6
+ "sourceRevision": "adbff2daf9d6ec609b4a43565d78c28a89b426f2fa9ead622978c39ad9cf8c9a",
7
7
  "entries": [
8
8
  {
9
9
  "source": "AGENTS.md",
@@ -485,6 +485,14 @@
485
485
  "loadMode": "manual",
486
486
  "reason": "No file-defined slash command API; keep as an explicit procedure plus exec --file"
487
487
  },
488
+ {
489
+ "source": "commands/rr-scheduler-start.md",
490
+ "target": "commands/rr-scheduler-start.md",
491
+ "category": "commands",
492
+ "disposition": "transform",
493
+ "loadMode": "manual",
494
+ "reason": "No file-defined slash command API; keep as an explicit procedure plus exec --file"
495
+ },
488
496
  {
489
497
  "source": "commands/spec-start.md",
490
498
  "target": "commands/spec-start.md",
@@ -583,6 +591,14 @@
583
591
  "loadMode": "manual",
584
592
  "reason": "Agent-run version check on the first reply; no native session hook on Mavis"
585
593
  },
594
+ {
595
+ "source": "hooks/compact-shell-output.mjs",
596
+ "target": null,
597
+ "category": "hooks",
598
+ "disposition": "omit",
599
+ "loadMode": "not-installed",
600
+ "reason": "omit: Cursor preToolUse rewrite; the large-output guard has no Mavis hook event"
601
+ },
586
602
  {
587
603
  "source": "hooks/examples/format-edited.example.sh",
588
604
  "target": null,
@@ -86,7 +86,7 @@ git diff --stat <last-green-ref> -- app storybook
86
86
 
87
87
  Before writing `validation-report.md` or claiming PASS: IDENTIFY the commands, RUN them, READ exit codes, VERIFY they match the verdict, THEN claim. Do not mark PASS from memory of a prior developer run.
88
88
 
89
- **Write-scope audit.** When `.ai.local/team/tasks/<slug>/pipeline.json` exists, run `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <implementation-step> --json` before the verdict (in the package repo without a seeded engine copy, use `node packages/ai-rules/presets/_shared/ai-local/scripts/check-write-scope.mjs`). Exit `3` is a **skip, not a failure**: the pipeline predates step ids or `writeScopes`, so quote the printed reason and hint under `## Soft notes` and continue. On exit `0`/`1`, an `out-of-scope` path on an implementation step is a **FAIL**; quote the labelled report and name each path's source. A reviewer-step advisory goes under `## Soft notes`. Never substitute a hand-made path list for the labelled report. The orchestrator writes the step baseline (`--step <id> --save-baseline`) before the step writes, because agents never commit and a bare `HEAD` diff would attribute earlier steps to this one.
89
+ **Write-scope audit.** When `.ai.local/team/tasks/<slug>/pipeline.json` exists, run `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <implementation-step> --json` before the verdict (in the package repo without a seeded engine copy, use `node packages/ai-rules/presets/_shared/ai-local/scripts/check-write-scope.mjs`). Exit `3` is a **skip, not a failure**: the pipeline predates step ids or `writeScopes`, or the step wrote without a saved baseline (`skipReason: no-baseline`), so quote the printed reason and hint under `## Soft notes` and continue. Exit `2` is a **usage error** (unknown step, unreadable `pipeline.json`, failed git ref): the audit did not run, so it is neither a pass nor a finding — quote the message, fix the invocation, and re-run. A `no-baseline` skip is an **orchestration defect, not a pass** — its paths are the whole uncommitted change-set and belong to no step, so the orchestrator saves the step baseline (`--step <id> --save-baseline`) before the step writes and the audit is re-run. On exit `0`/`1`, an `out-of-scope` path on an implementation step is a **FAIL**; quote the labelled report and name each path's source. A reviewer-step advisory goes under `## Soft notes`. Never substitute a hand-made path list for the labelled report.
90
90
 
91
91
  ## Self-review & context hygiene
92
92
 
@@ -49,6 +49,8 @@ You **issue** reviews. Implementers acting on your findings must verify each ite
49
49
  ## Write-scope audit
50
50
 
51
51
  - When `.ai.local/team/tasks/<slug>/pipeline.json` exists, run `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <step-id> --json` before the verdict (in the package repo without a seeded engine copy, use `node packages/ai-rules/presets/_shared/ai-local/scripts/check-write-scope.mjs`).
52
+ - Exit `3` is a skip, not a finding: a `no-baseline` skip means the step wrote without its baseline, so its paths belong to no step — report the reason under `## Warnings` and ask for the baseline, never claim a scope violation.
53
+ - Exit `2` is a usage error (unknown step, unreadable `pipeline.json`): the audit did not run, so quote the message and ask for the invocation to be fixed; it is neither a warning nor a scope violation.
52
54
  - An `out-of-scope` path on a reviewer step is advisory: report it under `## Warnings` with its labelled source; it does not by itself force `REQUEST_CHANGES`.
53
55
  - An `out-of-scope` path the verifier already hard-failed stays a finding; do not re-litigate the gate. Cite the labelled report path, never a hand-made path list.
54
56
 
@@ -60,3 +60,7 @@ On OpenCode, `/task-evil` runs as the `task-evil` primary agent: the `question`
60
60
  - Hooks: `../hooks/chain-team-phases.sh` only (semi-auto runner; no `hooks.json` in mavis)
61
61
 
62
62
  Edit procedure files in this preset folder or in the installed `.mavis/commands/` copy after `init`.
63
+
64
+ ## Scheduler
65
+
66
+ - **`/rr-scheduler-start`** — start the team-db scheduler, or restart it when one already holds the lease. `init` seeds `.ai.local/scripts/rr-scheduler-start.mjs`.
@@ -0,0 +1,27 @@
1
+ # Start or restart the scheduler
2
+
3
+ Bring up `team-db.mjs schedule` for this repository. When a scheduler already holds the lease, stop that process and start a new one.
4
+
5
+ ## What to do
6
+
7
+ 1. From the repository root, run:
8
+
9
+ ```bash
10
+ node .ai.local/scripts/rr-scheduler-start.mjs
11
+ ```
12
+
13
+ 2. Quote the stdout verbatim. A start prints `scheduler: started pid <pid>`. A restart prints `scheduler: restarted pid <pid> (stopped <previous>)`, plus the `processes:` lines from the manager.
14
+ 3. On a non-zero exit, quote the `error:` line verbatim and stop. Do not start `team-db.mjs schedule` by hand and do not signal a pid the script did not name.
15
+
16
+ ## What the script does
17
+
18
+ - Stops a scheduler this repository recorded, via `processes.mjs stop --name scheduler`.
19
+ - Signals a scheduler that was started outside the manager only when `scheduler.lock` names a live pid whose command line is `team-db.mjs schedule`. `SIGTERM`, then `SIGKILL` if it is still alive after 8 seconds. An in-flight child can outlive that kill.
20
+ - Removes `scheduler.lock` when its pid is already dead, so a crash does not block the next start for 90 seconds.
21
+ - Starts the timer through `processes.mjs start --name scheduler` with `exec node .ai.local/scripts/team-db.mjs schedule`, then waits until the new lease is fresh.
22
+
23
+ ## Do not
24
+
25
+ - Write `status.json`, `metrics.json`, or any task or lifecycle file.
26
+ - Run `pkill`, `killall`, or `kill` against a pid the script did not print.
27
+ - Start a second `team-db.mjs schedule` after a non-zero exit.