@bonesofspring/ai-rules 0.2.78 → 0.2.80

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 (340) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +4 -2
  3. package/bin/lib/engine-scripts.js +6 -0
  4. package/bin/lib/seed-ai-local-team.js +2 -0
  5. package/docs/TEAM-DB.md +118 -15
  6. package/docs/openapi/team-db.v1.json +2879 -1858
  7. package/package.json +5 -1
  8. package/presets/_shared/ai-local/scripts/check-task-repositories.mjs +264 -0
  9. package/presets/_shared/ai-local/scripts/rr-migrate-repositories.mjs +481 -0
  10. package/presets/_shared/ai-local/scripts/team-db-api.mjs +211 -12
  11. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +289 -3
  12. package/presets/_shared/ai-local/scripts/team-db-project.mjs +857 -1
  13. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +68 -0
  14. package/presets/_shared/ai-local/scripts/team-db-tracker.mjs +29 -10
  15. package/presets/_shared/ai-local/scripts/team-db.mjs +46 -1
  16. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +69 -1
  17. package/presets/claude/android-kotlin/agents/task-router.md +2 -0
  18. package/presets/claude/android-kotlin/commands/README.md +1 -0
  19. package/presets/claude/android-kotlin/commands/rr-migrate-repositories.md +59 -0
  20. package/presets/claude/android-kotlin/commands/task.md +4 -0
  21. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +69 -1
  22. package/presets/claude/go/agents/task-router.md +2 -0
  23. package/presets/claude/go/commands/README.md +1 -0
  24. package/presets/claude/go/commands/rr-migrate-repositories.md +59 -0
  25. package/presets/claude/go/commands/task.md +4 -0
  26. package/presets/claude/go/hooks/chain-team-phases.sh +69 -1
  27. package/presets/claude/ios-swift/agents/task-router.md +2 -0
  28. package/presets/claude/ios-swift/commands/README.md +1 -0
  29. package/presets/claude/ios-swift/commands/rr-migrate-repositories.md +59 -0
  30. package/presets/claude/ios-swift/commands/task.md +4 -0
  31. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +69 -1
  32. package/presets/claude/java/agents/task-router.md +2 -0
  33. package/presets/claude/java/commands/README.md +1 -0
  34. package/presets/claude/java/commands/rr-migrate-repositories.md +59 -0
  35. package/presets/claude/java/commands/task.md +4 -0
  36. package/presets/claude/java/hooks/chain-team-phases.sh +69 -1
  37. package/presets/claude/mcp-ts/agents/task-router.md +2 -0
  38. package/presets/claude/mcp-ts/commands/README.md +1 -0
  39. package/presets/claude/mcp-ts/commands/rr-migrate-repositories.md +59 -0
  40. package/presets/claude/mcp-ts/commands/task.md +4 -0
  41. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +69 -1
  42. package/presets/claude/mol/agents/task-router.md +2 -0
  43. package/presets/claude/mol/commands/README.md +1 -0
  44. package/presets/claude/mol/commands/rr-migrate-repositories.md +59 -0
  45. package/presets/claude/mol/commands/task.md +4 -0
  46. package/presets/claude/mol/hooks/chain-team-phases.sh +69 -1
  47. package/presets/claude/next/agents/task-router.md +2 -0
  48. package/presets/claude/next/commands/README.md +1 -0
  49. package/presets/claude/next/commands/rr-migrate-repositories.md +59 -0
  50. package/presets/claude/next/commands/task.md +4 -0
  51. package/presets/claude/next/commands/ui-start.md +12 -4
  52. package/presets/claude/next/commands/ui-stop.md +5 -2
  53. package/presets/claude/next/hooks/chain-team-phases.sh +69 -1
  54. package/presets/claude/nuxt/agents/task-router.md +2 -0
  55. package/presets/claude/nuxt/commands/README.md +1 -0
  56. package/presets/claude/nuxt/commands/rr-migrate-repositories.md +59 -0
  57. package/presets/claude/nuxt/commands/task.md +4 -0
  58. package/presets/claude/nuxt/hooks/chain-team-phases.sh +69 -1
  59. package/presets/claude/php-hexagonal/agents/task-router.md +2 -0
  60. package/presets/claude/php-hexagonal/commands/README.md +1 -0
  61. package/presets/claude/php-hexagonal/commands/rr-migrate-repositories.md +59 -0
  62. package/presets/claude/php-hexagonal/commands/task.md +4 -0
  63. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +69 -1
  64. package/presets/claude/php-laravel/agents/task-router.md +2 -0
  65. package/presets/claude/php-laravel/commands/README.md +1 -0
  66. package/presets/claude/php-laravel/commands/rr-migrate-repositories.md +59 -0
  67. package/presets/claude/php-laravel/commands/task.md +4 -0
  68. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +69 -1
  69. package/presets/claude/svelte/agents/task-router.md +2 -0
  70. package/presets/claude/svelte/commands/README.md +1 -0
  71. package/presets/claude/svelte/commands/rr-migrate-repositories.md +59 -0
  72. package/presets/claude/svelte/commands/task.md +4 -0
  73. package/presets/claude/svelte/hooks/chain-team-phases.sh +69 -1
  74. package/presets/cursor/android-kotlin/agents/task-router.md +2 -0
  75. package/presets/cursor/android-kotlin/commands/README.md +1 -0
  76. package/presets/cursor/android-kotlin/commands/rr-migrate-repositories.md +59 -0
  77. package/presets/cursor/android-kotlin/commands/task.md +4 -0
  78. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +69 -1
  79. package/presets/cursor/go/agents/task-router.md +2 -0
  80. package/presets/cursor/go/commands/README.md +1 -0
  81. package/presets/cursor/go/commands/rr-migrate-repositories.md +59 -0
  82. package/presets/cursor/go/commands/task.md +4 -0
  83. package/presets/cursor/go/hooks/chain-team-phases.sh +69 -1
  84. package/presets/cursor/ios-swift/agents/task-router.md +2 -0
  85. package/presets/cursor/ios-swift/commands/README.md +1 -0
  86. package/presets/cursor/ios-swift/commands/rr-migrate-repositories.md +59 -0
  87. package/presets/cursor/ios-swift/commands/task.md +4 -0
  88. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +69 -1
  89. package/presets/cursor/java/agents/task-router.md +2 -0
  90. package/presets/cursor/java/commands/README.md +1 -0
  91. package/presets/cursor/java/commands/rr-migrate-repositories.md +59 -0
  92. package/presets/cursor/java/commands/task.md +4 -0
  93. package/presets/cursor/java/hooks/chain-team-phases.sh +69 -1
  94. package/presets/cursor/mcp-ts/agents/task-router.md +2 -0
  95. package/presets/cursor/mcp-ts/commands/README.md +1 -0
  96. package/presets/cursor/mcp-ts/commands/rr-migrate-repositories.md +59 -0
  97. package/presets/cursor/mcp-ts/commands/task.md +4 -0
  98. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +69 -1
  99. package/presets/cursor/mol/agents/task-router.md +2 -0
  100. package/presets/cursor/mol/commands/README.md +1 -0
  101. package/presets/cursor/mol/commands/rr-migrate-repositories.md +59 -0
  102. package/presets/cursor/mol/commands/task.md +4 -0
  103. package/presets/cursor/mol/hooks/chain-team-phases.sh +69 -1
  104. package/presets/cursor/next/agents/task-router.md +2 -0
  105. package/presets/cursor/next/commands/README.md +1 -0
  106. package/presets/cursor/next/commands/rr-migrate-repositories.md +59 -0
  107. package/presets/cursor/next/commands/task.md +4 -0
  108. package/presets/cursor/next/commands/ui-start.md +12 -4
  109. package/presets/cursor/next/commands/ui-stop.md +5 -2
  110. package/presets/cursor/next/hooks/chain-team-phases.sh +69 -1
  111. package/presets/cursor/nuxt/agents/task-router.md +2 -0
  112. package/presets/cursor/nuxt/commands/README.md +1 -0
  113. package/presets/cursor/nuxt/commands/rr-migrate-repositories.md +59 -0
  114. package/presets/cursor/nuxt/commands/task.md +4 -0
  115. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +69 -1
  116. package/presets/cursor/php-hexagonal/agents/task-router.md +2 -0
  117. package/presets/cursor/php-hexagonal/commands/README.md +1 -0
  118. package/presets/cursor/php-hexagonal/commands/rr-migrate-repositories.md +59 -0
  119. package/presets/cursor/php-hexagonal/commands/task.md +4 -0
  120. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +69 -1
  121. package/presets/cursor/php-laravel/agents/task-router.md +2 -0
  122. package/presets/cursor/php-laravel/commands/README.md +1 -0
  123. package/presets/cursor/php-laravel/commands/rr-migrate-repositories.md +59 -0
  124. package/presets/cursor/php-laravel/commands/task.md +4 -0
  125. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +69 -1
  126. package/presets/cursor/svelte/agents/task-router.md +2 -0
  127. package/presets/cursor/svelte/commands/README.md +1 -0
  128. package/presets/cursor/svelte/commands/rr-migrate-repositories.md +59 -0
  129. package/presets/cursor/svelte/commands/task.md +4 -0
  130. package/presets/cursor/svelte/hooks/chain-team-phases.sh +69 -1
  131. package/presets/mavis/android-kotlin/adapter-map.json +9 -1
  132. package/presets/mavis/android-kotlin/agents/task-router.md +2 -0
  133. package/presets/mavis/android-kotlin/commands/README.md +1 -0
  134. package/presets/mavis/android-kotlin/commands/rr-migrate-repositories.md +54 -0
  135. package/presets/mavis/android-kotlin/commands/task.md +4 -0
  136. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +69 -1
  137. package/presets/mavis/go/adapter-map.json +9 -1
  138. package/presets/mavis/go/agents/task-router.md +2 -0
  139. package/presets/mavis/go/commands/README.md +1 -0
  140. package/presets/mavis/go/commands/rr-migrate-repositories.md +54 -0
  141. package/presets/mavis/go/commands/task.md +4 -0
  142. package/presets/mavis/go/hooks/chain-team-phases.sh +69 -1
  143. package/presets/mavis/ios-swift/adapter-map.json +9 -1
  144. package/presets/mavis/ios-swift/agents/task-router.md +2 -0
  145. package/presets/mavis/ios-swift/commands/README.md +1 -0
  146. package/presets/mavis/ios-swift/commands/rr-migrate-repositories.md +54 -0
  147. package/presets/mavis/ios-swift/commands/task.md +4 -0
  148. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +69 -1
  149. package/presets/mavis/java/adapter-map.json +9 -1
  150. package/presets/mavis/java/agents/task-router.md +2 -0
  151. package/presets/mavis/java/commands/README.md +1 -0
  152. package/presets/mavis/java/commands/rr-migrate-repositories.md +54 -0
  153. package/presets/mavis/java/commands/task.md +4 -0
  154. package/presets/mavis/java/hooks/chain-team-phases.sh +69 -1
  155. package/presets/mavis/mcp-ts/adapter-map.json +9 -1
  156. package/presets/mavis/mcp-ts/agents/task-router.md +2 -0
  157. package/presets/mavis/mcp-ts/commands/README.md +1 -0
  158. package/presets/mavis/mcp-ts/commands/rr-migrate-repositories.md +54 -0
  159. package/presets/mavis/mcp-ts/commands/task.md +4 -0
  160. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +69 -1
  161. package/presets/mavis/mol/adapter-map.json +9 -1
  162. package/presets/mavis/mol/agents/task-router.md +2 -0
  163. package/presets/mavis/mol/commands/README.md +1 -0
  164. package/presets/mavis/mol/commands/rr-migrate-repositories.md +54 -0
  165. package/presets/mavis/mol/commands/task.md +4 -0
  166. package/presets/mavis/mol/hooks/chain-team-phases.sh +69 -1
  167. package/presets/mavis/next/adapter-map.json +9 -1
  168. package/presets/mavis/next/agents/task-router.md +2 -0
  169. package/presets/mavis/next/commands/README.md +1 -0
  170. package/presets/mavis/next/commands/rr-migrate-repositories.md +54 -0
  171. package/presets/mavis/next/commands/task.md +4 -0
  172. package/presets/mavis/next/commands/ui-start.md +12 -4
  173. package/presets/mavis/next/commands/ui-stop.md +5 -2
  174. package/presets/mavis/next/hooks/chain-team-phases.sh +69 -1
  175. package/presets/mavis/nuxt/adapter-map.json +9 -1
  176. package/presets/mavis/nuxt/agents/task-router.md +2 -0
  177. package/presets/mavis/nuxt/commands/README.md +1 -0
  178. package/presets/mavis/nuxt/commands/rr-migrate-repositories.md +54 -0
  179. package/presets/mavis/nuxt/commands/task.md +4 -0
  180. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +69 -1
  181. package/presets/mavis/php-hexagonal/adapter-map.json +9 -1
  182. package/presets/mavis/php-hexagonal/agents/task-router.md +2 -0
  183. package/presets/mavis/php-hexagonal/commands/README.md +1 -0
  184. package/presets/mavis/php-hexagonal/commands/rr-migrate-repositories.md +54 -0
  185. package/presets/mavis/php-hexagonal/commands/task.md +4 -0
  186. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +69 -1
  187. package/presets/mavis/php-laravel/adapter-map.json +9 -1
  188. package/presets/mavis/php-laravel/agents/task-router.md +2 -0
  189. package/presets/mavis/php-laravel/commands/README.md +1 -0
  190. package/presets/mavis/php-laravel/commands/rr-migrate-repositories.md +54 -0
  191. package/presets/mavis/php-laravel/commands/task.md +4 -0
  192. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +69 -1
  193. package/presets/mavis/svelte/adapter-map.json +9 -1
  194. package/presets/mavis/svelte/agents/task-router.md +2 -0
  195. package/presets/mavis/svelte/commands/README.md +1 -0
  196. package/presets/mavis/svelte/commands/rr-migrate-repositories.md +54 -0
  197. package/presets/mavis/svelte/commands/task.md +4 -0
  198. package/presets/mavis/svelte/hooks/chain-team-phases.sh +69 -1
  199. package/presets/opencode/android-kotlin/adapter-map.json +9 -1
  200. package/presets/opencode/android-kotlin/agents/task-router.md +2 -0
  201. package/presets/opencode/android-kotlin/commands/README.md +1 -0
  202. package/presets/opencode/android-kotlin/commands/rr-migrate-repositories.md +62 -0
  203. package/presets/opencode/android-kotlin/commands/task.md +4 -0
  204. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +69 -1
  205. package/presets/opencode/go/adapter-map.json +9 -1
  206. package/presets/opencode/go/agents/task-router.md +2 -0
  207. package/presets/opencode/go/commands/README.md +1 -0
  208. package/presets/opencode/go/commands/rr-migrate-repositories.md +62 -0
  209. package/presets/opencode/go/commands/task.md +4 -0
  210. package/presets/opencode/go/hooks/chain-team-phases.sh +69 -1
  211. package/presets/opencode/ios-swift/adapter-map.json +9 -1
  212. package/presets/opencode/ios-swift/agents/task-router.md +2 -0
  213. package/presets/opencode/ios-swift/commands/README.md +1 -0
  214. package/presets/opencode/ios-swift/commands/rr-migrate-repositories.md +62 -0
  215. package/presets/opencode/ios-swift/commands/task.md +4 -0
  216. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +69 -1
  217. package/presets/opencode/java/adapter-map.json +9 -1
  218. package/presets/opencode/java/agents/task-router.md +2 -0
  219. package/presets/opencode/java/commands/README.md +1 -0
  220. package/presets/opencode/java/commands/rr-migrate-repositories.md +62 -0
  221. package/presets/opencode/java/commands/task.md +4 -0
  222. package/presets/opencode/java/hooks/chain-team-phases.sh +69 -1
  223. package/presets/opencode/mcp-ts/adapter-map.json +9 -1
  224. package/presets/opencode/mcp-ts/agents/task-router.md +2 -0
  225. package/presets/opencode/mcp-ts/commands/README.md +1 -0
  226. package/presets/opencode/mcp-ts/commands/rr-migrate-repositories.md +62 -0
  227. package/presets/opencode/mcp-ts/commands/task.md +4 -0
  228. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +69 -1
  229. package/presets/opencode/mol/adapter-map.json +9 -1
  230. package/presets/opencode/mol/agents/task-router.md +2 -0
  231. package/presets/opencode/mol/commands/README.md +1 -0
  232. package/presets/opencode/mol/commands/rr-migrate-repositories.md +62 -0
  233. package/presets/opencode/mol/commands/task.md +4 -0
  234. package/presets/opencode/mol/hooks/chain-team-phases.sh +69 -1
  235. package/presets/opencode/next/adapter-map.json +9 -1
  236. package/presets/opencode/next/agents/task-router.md +2 -0
  237. package/presets/opencode/next/commands/README.md +1 -0
  238. package/presets/opencode/next/commands/rr-migrate-repositories.md +62 -0
  239. package/presets/opencode/next/commands/task.md +4 -0
  240. package/presets/opencode/next/commands/ui-start.md +12 -4
  241. package/presets/opencode/next/commands/ui-stop.md +5 -2
  242. package/presets/opencode/next/hooks/chain-team-phases.sh +69 -1
  243. package/presets/opencode/nuxt/adapter-map.json +9 -1
  244. package/presets/opencode/nuxt/agents/task-router.md +2 -0
  245. package/presets/opencode/nuxt/commands/README.md +1 -0
  246. package/presets/opencode/nuxt/commands/rr-migrate-repositories.md +62 -0
  247. package/presets/opencode/nuxt/commands/task.md +4 -0
  248. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +69 -1
  249. package/presets/opencode/php-hexagonal/adapter-map.json +9 -1
  250. package/presets/opencode/php-hexagonal/agents/task-router.md +2 -0
  251. package/presets/opencode/php-hexagonal/commands/README.md +1 -0
  252. package/presets/opencode/php-hexagonal/commands/rr-migrate-repositories.md +62 -0
  253. package/presets/opencode/php-hexagonal/commands/task.md +4 -0
  254. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +69 -1
  255. package/presets/opencode/php-laravel/adapter-map.json +9 -1
  256. package/presets/opencode/php-laravel/agents/task-router.md +2 -0
  257. package/presets/opencode/php-laravel/commands/README.md +1 -0
  258. package/presets/opencode/php-laravel/commands/rr-migrate-repositories.md +62 -0
  259. package/presets/opencode/php-laravel/commands/task.md +4 -0
  260. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +69 -1
  261. package/presets/opencode/plugins/task-status/README.md +15 -7
  262. package/presets/opencode/plugins/task-status/deepseek.ts +193 -0
  263. package/presets/opencode/plugins/task-status/details-data.ts +39 -2
  264. package/presets/opencode/plugins/task-status/prompt-text.ts +18 -8
  265. package/presets/opencode/plugins/task-status/task-view.ts +253 -63
  266. package/presets/opencode/plugins/task-status/tui.tsx +48 -11
  267. package/presets/opencode/svelte/adapter-map.json +9 -1
  268. package/presets/opencode/svelte/agents/task-router.md +2 -0
  269. package/presets/opencode/svelte/commands/README.md +1 -0
  270. package/presets/opencode/svelte/commands/rr-migrate-repositories.md +62 -0
  271. package/presets/opencode/svelte/commands/task.md +4 -0
  272. package/presets/opencode/svelte/hooks/chain-team-phases.sh +69 -1
  273. package/presets/zcode/android-kotlin/adapter-map.json +9 -1
  274. package/presets/zcode/android-kotlin/agents/task-router.md +2 -0
  275. package/presets/zcode/android-kotlin/commands/README.md +1 -0
  276. package/presets/zcode/android-kotlin/commands/rr-migrate-repositories.md +62 -0
  277. package/presets/zcode/android-kotlin/commands/task.md +4 -0
  278. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +69 -1
  279. package/presets/zcode/go/adapter-map.json +9 -1
  280. package/presets/zcode/go/agents/task-router.md +2 -0
  281. package/presets/zcode/go/commands/README.md +1 -0
  282. package/presets/zcode/go/commands/rr-migrate-repositories.md +62 -0
  283. package/presets/zcode/go/commands/task.md +4 -0
  284. package/presets/zcode/go/hooks/chain-team-phases.sh +69 -1
  285. package/presets/zcode/ios-swift/adapter-map.json +9 -1
  286. package/presets/zcode/ios-swift/agents/task-router.md +2 -0
  287. package/presets/zcode/ios-swift/commands/README.md +1 -0
  288. package/presets/zcode/ios-swift/commands/rr-migrate-repositories.md +62 -0
  289. package/presets/zcode/ios-swift/commands/task.md +4 -0
  290. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +69 -1
  291. package/presets/zcode/java/adapter-map.json +9 -1
  292. package/presets/zcode/java/agents/task-router.md +2 -0
  293. package/presets/zcode/java/commands/README.md +1 -0
  294. package/presets/zcode/java/commands/rr-migrate-repositories.md +62 -0
  295. package/presets/zcode/java/commands/task.md +4 -0
  296. package/presets/zcode/java/hooks/chain-team-phases.sh +69 -1
  297. package/presets/zcode/mcp-ts/adapter-map.json +9 -1
  298. package/presets/zcode/mcp-ts/agents/task-router.md +2 -0
  299. package/presets/zcode/mcp-ts/commands/README.md +1 -0
  300. package/presets/zcode/mcp-ts/commands/rr-migrate-repositories.md +62 -0
  301. package/presets/zcode/mcp-ts/commands/task.md +4 -0
  302. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +69 -1
  303. package/presets/zcode/mol/adapter-map.json +9 -1
  304. package/presets/zcode/mol/agents/task-router.md +2 -0
  305. package/presets/zcode/mol/commands/README.md +1 -0
  306. package/presets/zcode/mol/commands/rr-migrate-repositories.md +62 -0
  307. package/presets/zcode/mol/commands/task.md +4 -0
  308. package/presets/zcode/mol/hooks/chain-team-phases.sh +69 -1
  309. package/presets/zcode/next/adapter-map.json +9 -1
  310. package/presets/zcode/next/agents/task-router.md +2 -0
  311. package/presets/zcode/next/commands/README.md +1 -0
  312. package/presets/zcode/next/commands/rr-migrate-repositories.md +62 -0
  313. package/presets/zcode/next/commands/task.md +4 -0
  314. package/presets/zcode/next/commands/ui-start.md +12 -4
  315. package/presets/zcode/next/commands/ui-stop.md +5 -2
  316. package/presets/zcode/next/hooks/chain-team-phases.sh +69 -1
  317. package/presets/zcode/nuxt/adapter-map.json +9 -1
  318. package/presets/zcode/nuxt/agents/task-router.md +2 -0
  319. package/presets/zcode/nuxt/commands/README.md +1 -0
  320. package/presets/zcode/nuxt/commands/rr-migrate-repositories.md +62 -0
  321. package/presets/zcode/nuxt/commands/task.md +4 -0
  322. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +69 -1
  323. package/presets/zcode/php-hexagonal/adapter-map.json +9 -1
  324. package/presets/zcode/php-hexagonal/agents/task-router.md +2 -0
  325. package/presets/zcode/php-hexagonal/commands/README.md +1 -0
  326. package/presets/zcode/php-hexagonal/commands/rr-migrate-repositories.md +62 -0
  327. package/presets/zcode/php-hexagonal/commands/task.md +4 -0
  328. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +69 -1
  329. package/presets/zcode/php-laravel/adapter-map.json +9 -1
  330. package/presets/zcode/php-laravel/agents/task-router.md +2 -0
  331. package/presets/zcode/php-laravel/commands/README.md +1 -0
  332. package/presets/zcode/php-laravel/commands/rr-migrate-repositories.md +62 -0
  333. package/presets/zcode/php-laravel/commands/task.md +4 -0
  334. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +69 -1
  335. package/presets/zcode/svelte/adapter-map.json +9 -1
  336. package/presets/zcode/svelte/agents/task-router.md +2 -0
  337. package/presets/zcode/svelte/commands/README.md +1 -0
  338. package/presets/zcode/svelte/commands/rr-migrate-repositories.md +62 -0
  339. package/presets/zcode/svelte/commands/task.md +4 -0
  340. package/presets/zcode/svelte/hooks/chain-team-phases.sh +69 -1
@@ -2897,6 +2897,10 @@ if (status.state === 'awaiting_artifact_receipt') {
2897
2897
  emitArtifactStall(artifactStallMessage, !wasWaitingForReceipt);
2898
2898
  process.exit(0);
2899
2899
  }
2900
+ // Snapshot before `finishActiveAttempt` writes `lastCompletedAttempt`: the
2901
+ // repositories intake gate judges a task at its first receipt, so a folder whose
2902
+ // first step already completed is never re-judged.
2903
+ const hadPriorCompletion = Boolean(status.lastCompletedAttempt);
2900
2904
  let finishedAttempt = finishActiveAttempt();
2901
2905
  // The just-finished attempt's metric is already written; a pause now blocks
2902
2906
  // every handoff, including the unattributable-stop repair path below.
@@ -2924,7 +2928,7 @@ if (!finishedAttempt && activeAttemptCountBeforeFinish > 0) {
2924
2928
  }
2925
2929
  }
2926
2930
  endHumanGateIfResumed();
2927
- if (steps.length === 0 || pipeline.autoChain === false) {
2931
+ if (steps.length === 0) {
2928
2932
  writeStatus({});
2929
2933
  process.stdout.write('{}');
2930
2934
  process.exit(0);
@@ -2971,6 +2975,70 @@ const waveIndexes = activeWave
2971
2975
  ? [idx]
2972
2976
  : (isGraphMode() && finishedAttempt ? [completedStepIndex] : null));
2973
2977
 
2978
+ /**
2979
+ * Intake invariant: a task records which repositories it touches — or says that
2980
+ * it does not know. Judged on the first receipt of a task: the router's, or the
2981
+ * first step's when a pipeline runs without one. A task that already completed a
2982
+ * step predates the invariant and is never re-judged.
2983
+ * `intakeExemption: { approvedBy, reason, at }` is the recorded escape hatch; a
2984
+ * bare boolean does not count, so an exemption always names who approved it. The
2985
+ * shape mirrors `check-task-repositories.mjs`, which audits the same field after
2986
+ * the fact.
2987
+ */
2988
+ const REPOSITORY_INFERENCES = new Set(['evidence-paths', 'repo-scope-only', 'unknown', 'ambiguous']);
2989
+ const EXEMPTION_DATE = /^\d{4}-\d{2}-\d{2}$/;
2990
+ function repositoriesIntakeViolation(record) {
2991
+ if (!record) return 'has no `repositories` array';
2992
+ const ids = record.repositories;
2993
+ const inference = record.repositoriesInference;
2994
+ if (!Array.isArray(ids)) return 'carries no `repositories` array';
2995
+ if (ids.some((id) => typeof id !== 'string' || id.trim() === '')) return 'carries a `repositories` entry that is not a non-empty registry id';
2996
+ if (ids.length === 0) {
2997
+ return inference === 'unknown' ? null : 'carries `repositories: []` without `"repositoriesInference": "unknown"`';
2998
+ }
2999
+ if (inference !== undefined && !REPOSITORY_INFERENCES.has(inference)) return `carries an unknown \`repositoriesInference\` value "${inference}"`;
3000
+ if (inference === 'unknown') return 'lists repositories beside `"repositoriesInference": "unknown"`';
3001
+ let known = null;
3002
+ try {
3003
+ const registry = JSON.parse(fs.readFileSync(path.join(TEAM_ROOT, 'repositories.json'), 'utf8'));
3004
+ known = new Set((Array.isArray(registry.repositories) ? registry.repositories : []).map((row) => row && row.id).filter((id) => typeof id === 'string'));
3005
+ } catch { known = null; }
3006
+ if (known && known.size > 0) {
3007
+ const unknownIds = ids.filter((id) => !known.has(id));
3008
+ if (unknownIds.length > 0) return `names ${unknownIds.join(', ')} — not in .ai.local/team/repositories.json`;
3009
+ }
3010
+ return null;
3011
+ }
3012
+ function repositoriesIntakeExemption(record) {
3013
+ const entry = record && record.intakeExemption;
3014
+ if (!entry || typeof entry !== 'object') return null;
3015
+ const approvedBy = typeof entry.approvedBy === 'string' ? entry.approvedBy.trim() : '';
3016
+ const reason = typeof entry.reason === 'string' ? entry.reason.trim() : '';
3017
+ const at = typeof entry.at === 'string' ? entry.at.trim() : '';
3018
+ if (approvedBy === '' || reason.length < 10 || !EXEMPTION_DATE.test(at)) return null;
3019
+ return { approvedBy, reason, at };
3020
+ }
3021
+ const repositoriesGateApplies = Boolean(finishedAttempt)
3022
+ && (completedAgent === 'task-router' || (!hadPriorCompletion && completedStepIndex === 0));
3023
+ if (repositoriesGateApplies) {
3024
+ const violation = repositoriesIntakeViolation(pipeline);
3025
+ if (violation) {
3026
+ const exemption = repositoriesIntakeExemption(pipeline);
3027
+ if (!exemption) {
3028
+ appendMetric({ type: 'intake_repositories_blocked', at: now, stepIndex: completedStepIndex, agent: completedAgent, violation, source: 'hook', attributionConfidence: 'high' });
3029
+ writeStatus({ state: 'blocked', phase: 'blocked', currentAgent: 'task-router' });
3030
+ out(`pipeline.json for "${slug}" ${violation}. Intake stays open until the repositories are recorded: set "repositories" to the ids in .ai.local/team/repositories.json with "repositoriesInference": "evidence-paths" (or "repo-scope-only"), or "repositories": [] with "repositoriesInference": "unknown" when the request names none. Rewrite pipeline.json through the task-router, then resume via /task-continue ${slug}. A task that predates the invariant carries "intakeExemption": { "approvedBy": "<human>", "reason": "<why, 10+ characters>", "at": "YYYY-MM-DD" } — a bare boolean is not accepted.`);
3031
+ process.exit(0);
3032
+ }
3033
+ appendMetric({ type: 'intake_repositories_exempted', at: now, stepIndex: completedStepIndex, agent: completedAgent, violation, approvedBy: exemption.approvedBy, reason: exemption.reason, exemptedAt: exemption.at, source: 'hook', attributionConfidence: 'high' });
3034
+ }
3035
+ }
3036
+ if (pipeline.autoChain === false) {
3037
+ writeStatus({});
3038
+ process.stdout.write('{}');
3039
+ process.exit(0);
3040
+ }
3041
+
2974
3042
 
2975
3043
  if (waveIndexes) {
2976
3044
  const waveAgents = waveIndexes.flatMap((i) => getStepAgents(steps[i]));
@@ -248,6 +248,8 @@ Do **not** add a dedicated `spec-author` agent for `docs/specs/**`. Do not requi
248
248
 
249
249
  **specMode (optional `pipeline.json` field):** `none` for spike/research; `generate` for `spec-gen` / `/spec-start`; `consume` default when INDEX exists. Echo top-level `specMode`. Brief `## Spec mode` wins on conflict.
250
250
 
251
+ **repositories (mandatory `pipeline.json` field):** echo `"repositories": [<ids>]` and `"repositoriesInference": "evidence-paths" | "repo-scope-only" | "unknown" | "ambiguous"` immediately after `specMode`, before `summary`; the ids come from `.ai.local/team/repositories.json` and are never defaulted to the workspace repository. Then record the same list as link rows through `node .ai.local/scripts/team-db.mjs repositories apply --file -` — one `{"links": [{taskSlug, repositoryId, source: "intake", inference: "evidence-paths"}]}` envelope per touched repository (the verb takes the envelope, never a bare row). When the request names no repository, write `"repositories": []` with `"unknown"` and one `{"attributions": [{taskSlug, verdict: "unknown", evidence: ""}]}` envelope; `yarn check:task-repositories` fails a folder without the field.
252
+
251
253
  Do **not** add a pipeline step for `spec-discovery`. Instruct analyst to load that skill only when the user/AC asks research-before-spec.
252
254
 
253
255
  ## Runtime initialization
@@ -10,6 +10,7 @@ Slash commands are copied to `.cursor/commands/` on `ai-rules init cursor --pres
10
10
  | **`/task-evil <description>`** | **Autonomous pipeline:** no plan confirmation, no human gates, no questions; chooses recommended options and records assumptions in `decisions.md`; stops only on a hard blocker. Quality gates and commit/push deny stay. |
11
11
  | `/task-continue <slug>` | After human gate or pause |
12
12
  | `/migrate-tasks` | Create or reconcile `.ai.local/team/team.db`; writes only the delta |
13
+ | `/rr-migrate-repositories` | Scan repositories on disk, add the missing ones to the local registry, and project the file into `team.db` |
13
14
  | `/technical-retro [slug]` | Retro; with slug — “Agent work” section |
14
15
  | `/update` | Reinstall each installed tool with the preset recorded at init |
15
16
 
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: rr-migrate-repositories
3
+ description: Scan repositories on disk, add the missing ones to the local registry, and project the file into team.db.
4
+ ---
5
+
6
+ # Migrate repositories
7
+
8
+ Turn the repositories already cloned on this machine into registry records, then
9
+ sync the registry file into the team database.
10
+
11
+ ## What to do
12
+
13
+ 1. From the repository root, run:
14
+
15
+ ```bash
16
+ node .ai.local/scripts/rr-migrate-repositories.mjs
17
+ ```
18
+
19
+ 2. Report the summary in the user's native language, keeping the counters
20
+ verbatim: `scanned`, `repositories`, `duplicates`, `create`, `update`,
21
+ `unchanged`, `not-on-disk`, and the `project` line.
22
+ 3. A `disabled by AI_RULES_TEAM_DB_DISABLE` line means the plan was computed and
23
+ nothing was written; exit 0 is the documented fallback. Relay it and stop.
24
+ 4. Any non-zero exit: quote stderr and stop.
25
+
26
+ ## Arguments
27
+
28
+ - `--scan <dir>` — directory to scan; repeatable. Default: the parent of the
29
+ repository root (the repository root itself when its parent is `$HOME`), so
30
+ sibling clones are picked up.
31
+ - `--depth <n>` — directory levels below a scan root (default `4`).
32
+ - `--dry-run` — print the plan and write nothing.
33
+ - `--no-update` — create missing records only; never touch an existing one.
34
+ - `--team-root <dir>` — team store root (default `<repo-root>/.ai.local/team`).
35
+ - `--json` — machine-readable summary.
36
+
37
+ ## What the script does
38
+
39
+ - Walks the scan roots; a directory with `.git` is a repository and is not
40
+ descended into. Submodule checkouts and linked worktrees are skipped.
41
+ - Collapses clones that share one remote to the shallowest path.
42
+ - Keeps the id of a record whose locator already exists, so a re-run is
43
+ idempotent; a new id is the slug of the directory name, with a parent prefix
44
+ when that slug is taken.
45
+ - Creates missing records through `team-db.mjs repositories apply`, updates a
46
+ changed `name`, `locator`, or `status` through `repositories put`, then runs
47
+ `repositories project`. The lock-guarded verb is the only writer.
48
+ - Never deletes a record: a repository missing from this scan may simply live
49
+ outside the scanned roots.
50
+
51
+ `.ai.local/team/repositories.json` is local-only and git-ignored. The database is
52
+ derived: deleting `team.db` costs a rebuild, not the records.
53
+
54
+ ## Do not
55
+
56
+ - Hand-edit `.ai.local/team/repositories.json`; the verb owns the write lock.
57
+ - Commit the registry file or `team.db*`.
58
+ - Delete registry records to make a scan look clean.
59
+ - Pass `--scan` a filesystem root without a matching `--depth`.
@@ -41,6 +41,10 @@ Examples:
41
41
  7. **After each agent** — wait for hook handoff / reconciliation terminal receipt → `status.state`; do not start the next step until `status.json` reflects handoff (or until there is a `followup_message` from the hook).
42
42
  8. **Human gate** — if after the current step there is a gate in `humanGates` (`after:<agent>`), after the agent finishes **stop** and ask for `/task-continue <slug>`.
43
43
 
44
+ ## Repositories (mandatory)
45
+
46
+ The repositories a task touches are part of its intake: `pipeline.json` must carry `"repositories": [<registry ids>]`, or `"repositories": []` together with `"repositoriesInference": "unknown"` when the request names none. The router reads `.ai.local/team/repositories.json` and records the same list as link rows; the field is never defaulted; `node .ai.local/scripts/check-task-repositories.mjs` audits the store and the chain hook blocks a task-router receipt that omits it. See `agents/task-router.md`.
47
+
44
48
  ## Plan contract
45
49
 
46
50
  Intake runs the planning workflow before any implementation: **goal frame** (goal, user value, success + result-evaluation criteria) → **requirements + AC-IDs** → **information-sufficiency** verdict (`sufficient` | `insufficient`) → decompose with a **dependency graph** (`dependsOn[]`, DAG, critical path) and, for large flows, **epics / stages** with exit criteria. The plan is revisable: a **plan revision** is a named, recorded operation (`planRevision`), and progress is checkpointed to `.memlog.md` (with the optional `contextBudget` note) so a run can resume.
@@ -2952,6 +2952,10 @@ if (status.state === 'awaiting_artifact_receipt') {
2952
2952
  emitArtifactStall(artifactStallMessage, !wasWaitingForReceipt);
2953
2953
  process.exit(0);
2954
2954
  }
2955
+ // Snapshot before `finishActiveAttempt` writes `lastCompletedAttempt`: the
2956
+ // repositories intake gate judges a task at its first receipt, so a folder whose
2957
+ // first step already completed is never re-judged.
2958
+ const hadPriorCompletion = Boolean(status.lastCompletedAttempt);
2955
2959
  let finishedAttempt = finishActiveAttempt();
2956
2960
  // The just-finished attempt's metric is already written; a pause now blocks
2957
2961
  // every handoff, including the unattributable-stop repair path below.
@@ -2979,7 +2983,7 @@ if (!finishedAttempt && activeAttemptCountBeforeFinish > 0) {
2979
2983
  }
2980
2984
  }
2981
2985
  endHumanGateIfResumed();
2982
- if (steps.length === 0 || pipeline.autoChain === false) {
2986
+ if (steps.length === 0) {
2983
2987
  writeStatus({});
2984
2988
  process.stdout.write('{}');
2985
2989
  process.exit(0);
@@ -3026,6 +3030,70 @@ const waveIndexes = activeWave
3026
3030
  ? [idx]
3027
3031
  : (isGraphMode() && finishedAttempt ? [completedStepIndex] : null));
3028
3032
 
3033
+ /**
3034
+ * Intake invariant: a task records which repositories it touches — or says that
3035
+ * it does not know. Judged on the first receipt of a task: the router's, or the
3036
+ * first step's when a pipeline runs without one. A task that already completed a
3037
+ * step predates the invariant and is never re-judged.
3038
+ * `intakeExemption: { approvedBy, reason, at }` is the recorded escape hatch; a
3039
+ * bare boolean does not count, so an exemption always names who approved it. The
3040
+ * shape mirrors `check-task-repositories.mjs`, which audits the same field after
3041
+ * the fact.
3042
+ */
3043
+ const REPOSITORY_INFERENCES = new Set(['evidence-paths', 'repo-scope-only', 'unknown', 'ambiguous']);
3044
+ const EXEMPTION_DATE = /^\d{4}-\d{2}-\d{2}$/;
3045
+ function repositoriesIntakeViolation(record) {
3046
+ if (!record) return 'has no `repositories` array';
3047
+ const ids = record.repositories;
3048
+ const inference = record.repositoriesInference;
3049
+ if (!Array.isArray(ids)) return 'carries no `repositories` array';
3050
+ if (ids.some((id) => typeof id !== 'string' || id.trim() === '')) return 'carries a `repositories` entry that is not a non-empty registry id';
3051
+ if (ids.length === 0) {
3052
+ return inference === 'unknown' ? null : 'carries `repositories: []` without `"repositoriesInference": "unknown"`';
3053
+ }
3054
+ if (inference !== undefined && !REPOSITORY_INFERENCES.has(inference)) return `carries an unknown \`repositoriesInference\` value "${inference}"`;
3055
+ if (inference === 'unknown') return 'lists repositories beside `"repositoriesInference": "unknown"`';
3056
+ let known = null;
3057
+ try {
3058
+ const registry = JSON.parse(fs.readFileSync(path.join(TEAM_ROOT, 'repositories.json'), 'utf8'));
3059
+ known = new Set((Array.isArray(registry.repositories) ? registry.repositories : []).map((row) => row && row.id).filter((id) => typeof id === 'string'));
3060
+ } catch { known = null; }
3061
+ if (known && known.size > 0) {
3062
+ const unknownIds = ids.filter((id) => !known.has(id));
3063
+ if (unknownIds.length > 0) return `names ${unknownIds.join(', ')} — not in .ai.local/team/repositories.json`;
3064
+ }
3065
+ return null;
3066
+ }
3067
+ function repositoriesIntakeExemption(record) {
3068
+ const entry = record && record.intakeExemption;
3069
+ if (!entry || typeof entry !== 'object') return null;
3070
+ const approvedBy = typeof entry.approvedBy === 'string' ? entry.approvedBy.trim() : '';
3071
+ const reason = typeof entry.reason === 'string' ? entry.reason.trim() : '';
3072
+ const at = typeof entry.at === 'string' ? entry.at.trim() : '';
3073
+ if (approvedBy === '' || reason.length < 10 || !EXEMPTION_DATE.test(at)) return null;
3074
+ return { approvedBy, reason, at };
3075
+ }
3076
+ const repositoriesGateApplies = Boolean(finishedAttempt)
3077
+ && (completedAgent === 'task-router' || (!hadPriorCompletion && completedStepIndex === 0));
3078
+ if (repositoriesGateApplies) {
3079
+ const violation = repositoriesIntakeViolation(pipeline);
3080
+ if (violation) {
3081
+ const exemption = repositoriesIntakeExemption(pipeline);
3082
+ if (!exemption) {
3083
+ appendMetric({ type: 'intake_repositories_blocked', at: now, stepIndex: completedStepIndex, agent: completedAgent, violation, source: 'hook', attributionConfidence: 'high' });
3084
+ writeStatus({ state: 'blocked', phase: 'blocked', currentAgent: 'task-router' });
3085
+ out(`pipeline.json for "${slug}" ${violation}. Intake stays open until the repositories are recorded: set "repositories" to the ids in .ai.local/team/repositories.json with "repositoriesInference": "evidence-paths" (or "repo-scope-only"), or "repositories": [] with "repositoriesInference": "unknown" when the request names none. Rewrite pipeline.json through the task-router, then resume via /task-continue ${slug}. A task that predates the invariant carries "intakeExemption": { "approvedBy": "<human>", "reason": "<why, 10+ characters>", "at": "YYYY-MM-DD" } — a bare boolean is not accepted.`);
3086
+ process.exit(0);
3087
+ }
3088
+ appendMetric({ type: 'intake_repositories_exempted', at: now, stepIndex: completedStepIndex, agent: completedAgent, violation, approvedBy: exemption.approvedBy, reason: exemption.reason, exemptedAt: exemption.at, source: 'hook', attributionConfidence: 'high' });
3089
+ }
3090
+ }
3091
+ if (pipeline.autoChain === false) {
3092
+ writeStatus({});
3093
+ process.stdout.write('{}');
3094
+ process.exit(0);
3095
+ }
3096
+
3029
3097
 
3030
3098
  if (waveIndexes) {
3031
3099
  const waveAgents = waveIndexes.flatMap((i) => getStepAgents(steps[i]));
@@ -264,6 +264,8 @@ Do **not** add a dedicated `spec-author` agent for `docs/specs/**`. Do not requi
264
264
 
265
265
  **specMode (optional `pipeline.json` field):** `none` for spike/research; `generate` for `spec-gen` / `/spec-start`; `consume` default when INDEX exists. Echo top-level `specMode`. Brief `## Spec mode` wins on conflict.
266
266
 
267
+ **repositories (mandatory `pipeline.json` field):** echo `"repositories": [<ids>]` and `"repositoriesInference": "evidence-paths" | "repo-scope-only" | "unknown" | "ambiguous"` immediately after `specMode`, before `summary`; the ids come from `.ai.local/team/repositories.json` and are never defaulted to the workspace repository. Then record the same list as link rows through `node .ai.local/scripts/team-db.mjs repositories apply --file -` — one `{"links": [{taskSlug, repositoryId, source: "intake", inference: "evidence-paths"}]}` envelope per touched repository (the verb takes the envelope, never a bare row). When the request names no repository, write `"repositories": []` with `"unknown"` and one `{"attributions": [{taskSlug, verdict: "unknown", evidence: ""}]}` envelope; `yarn check:task-repositories` fails a folder without the field.
268
+
267
269
  Do **not** add a pipeline step for `spec-discovery`. Instruct analyst to load that skill only when the user/AC asks research-before-spec.
268
270
 
269
271
  ## Runtime initialization
@@ -11,6 +11,7 @@ Slash-command definitions and on-demand scenarios. Copied to `.claude/commands/`
11
11
  | `update.md` | Reinstall each installed tool with the preset recorded at init |
12
12
  | `/upstream-research` | Repository-only (not in the published package): queue the weekly upstream evolution review; run one `schedule --once` tick when the timer is offline |
13
13
  | `migrate-tasks.md` | Create or reconcile `.ai.local/team/team.db`; writes only the delta |
14
+ | `rr-migrate-repositories.md` | Scan repositories on disk, add the missing ones to the local registry, and project the file into `team.db` |
14
15
 
15
16
  `/task-evil` is intentionally autonomous: no plan confirmation, no human gates, no questions; recommended assumptions are recorded in `decisions.md`, and only hard blockers stop the run. On OpenCode, the command selects the `task-evil` primary agent with a hard `question: deny`, broad shell access except `git commit`/`git push` (and `npx jest*`), and edits limited to `.ai.local/team/**`.
16
17
 
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: rr-migrate-repositories
3
+ description: Scan repositories on disk, add the missing ones to the local registry, and project the file into team.db.
4
+ ---
5
+
6
+ # Migrate repositories
7
+
8
+ Turn the repositories already cloned on this machine into registry records, then
9
+ sync the registry file into the team database.
10
+
11
+ ## What to do
12
+
13
+ 1. From the repository root, run:
14
+
15
+ ```bash
16
+ node .ai.local/scripts/rr-migrate-repositories.mjs
17
+ ```
18
+
19
+ 2. Report the summary in the user's native language, keeping the counters
20
+ verbatim: `scanned`, `repositories`, `duplicates`, `create`, `update`,
21
+ `unchanged`, `not-on-disk`, and the `project` line.
22
+ 3. A `disabled by AI_RULES_TEAM_DB_DISABLE` line means the plan was computed and
23
+ nothing was written; exit 0 is the documented fallback. Relay it and stop.
24
+ 4. Any non-zero exit: quote stderr and stop.
25
+
26
+ ## Arguments
27
+
28
+ - `--scan <dir>` — directory to scan; repeatable. Default: the parent of the
29
+ repository root (the repository root itself when its parent is `$HOME`), so
30
+ sibling clones are picked up.
31
+ - `--depth <n>` — directory levels below a scan root (default `4`).
32
+ - `--dry-run` — print the plan and write nothing.
33
+ - `--no-update` — create missing records only; never touch an existing one.
34
+ - `--team-root <dir>` — team store root (default `<repo-root>/.ai.local/team`).
35
+ - `--json` — machine-readable summary.
36
+
37
+ ## What the script does
38
+
39
+ - Walks the scan roots; a directory with `.git` is a repository and is not
40
+ descended into. Submodule checkouts and linked worktrees are skipped.
41
+ - Collapses clones that share one remote to the shallowest path.
42
+ - Keeps the id of a record whose locator already exists, so a re-run is
43
+ idempotent; a new id is the slug of the directory name, with a parent prefix
44
+ when that slug is taken.
45
+ - Creates missing records through `team-db.mjs repositories apply`, updates a
46
+ changed `name`, `locator`, or `status` through `repositories put`, then runs
47
+ `repositories project`. The lock-guarded verb is the only writer.
48
+ - Never deletes a record: a repository missing from this scan may simply live
49
+ outside the scanned roots.
50
+
51
+ `.ai.local/team/repositories.json` is local-only and git-ignored. The database is
52
+ derived: deleting `team.db` costs a rebuild, not the records.
53
+
54
+ ## Do not
55
+
56
+ - Hand-edit `.ai.local/team/repositories.json`; the verb owns the write lock.
57
+ - Commit the registry file or `team.db*`.
58
+ - Delete registry records to make a scan look clean.
59
+ - Pass `--scan` a filesystem root without a matching `--depth`.
@@ -45,6 +45,10 @@ Examples:
45
45
  7. **After each agent** — wait for hook handoff / reconciliation terminal receipt → `status.state`; do not start the next step until `status.json` reflects handoff (or until hook returns `followup_message`). A Task call that returns a session handle has only **started** the agent: keep the step open until it reports back.
46
46
  8. **Human gate** — if there is a gate in `humanGates` after the current step (`after:<agent>`), **stop** after the agent finishes and ask for `/task-continue <slug>`.
47
47
 
48
+ ## Repositories (mandatory)
49
+
50
+ The repositories a task touches are part of its intake: `pipeline.json` must carry `"repositories": [<registry ids>]`, or `"repositories": []` together with `"repositoriesInference": "unknown"` when the request names none. The router reads `.ai.local/team/repositories.json` and records the same list as link rows; the field is never defaulted; `node .ai.local/scripts/check-task-repositories.mjs` audits the store and the chain hook blocks a task-router receipt that omits it. See `agents/task-router.md`.
51
+
48
52
  ## Plan contract
49
53
 
50
54
  Intake runs the planning workflow before any implementation: **goal frame** (goal, user value, success + result-evaluation criteria) → **requirements + AC-IDs** → **information-sufficiency** verdict (`sufficient` | `insufficient`) → decompose with a **dependency graph** (`dependsOn[]`, DAG, critical path) and, for large flows, **epics / stages** with exit criteria. The plan is revisable: a **plan revision** is a named, recorded operation (`planRevision`), and progress is checkpointed to `.memlog.md` (with the optional `contextBudget` note) so a run can resume.
@@ -17,10 +17,11 @@ from the current source, and guarantee the host team-db API the UI reads from.
17
17
  node apps/team-tasks-ui/scripts/stack.mjs start
18
18
  ```
19
19
 
20
- 2. Quote the command's stdout verbatim: the `ui:` line and the `api:` line,
21
- including the owner state. On success the script prints
22
- `ui: http://127.0.0.1:4300` and
23
- `api: http://127.0.0.1:4178 (owner: pre-existing|started-by-this-script)`.
20
+ 2. Quote the command's stdout verbatim: the `ui:`, `api:`, and `processes:`
21
+ lines, including the owner state. On success the script prints
22
+ `ui: http://127.0.0.1:4300`,
23
+ `api: http://127.0.0.1:4178 (owner: pre-existing|started-by-this-script)`, and
24
+ `processes: http://127.0.0.1:4179 (owner: pre-existing|started-by-this-script)`.
24
25
  3. On a non-zero exit, quote the `error:` line verbatim and stop. Do not retry
25
26
  with a different compose command and do not start the API by hand.
26
27
  4. The start is restart-safe: when the `team-tasks-ui` project is already
@@ -44,6 +45,13 @@ node apps/team-tasks-ui/scripts/stack.mjs start
44
45
  git-ignored `.ai.local/.ui/api.json` marker.
45
46
  - Repairs a missing derived database once through `team-db.mjs sync`, and never
46
47
  repairs an API this script did not start.
48
+ - Guarantees the process view the `/processes` page reads: when
49
+ `127.0.0.1:4179` refuses the connection, the script runs
50
+ `node .ai.local/scripts/processes.mjs serve` through the process manager
51
+ (`processes.mjs start --name process-view`). The lease in
52
+ `.ai.local/.processes/` is the ownership record, so a second start never binds
53
+ a second listener, an owned view that answers a non-200 is stopped and started
54
+ once, and a listener the script cannot prove is left alone and reported.
47
55
 
48
56
  ## Do not
49
57
 
@@ -5,8 +5,8 @@ description: Stop the team-tasks UI compose project and the team-db API that /ui
5
5
 
6
6
  # Stop the team-tasks UI
7
7
 
8
- Take down the `apps/team-tasks-ui` Docker Compose project and stop the host
9
- team-db API only when `/ui-start` started it.
8
+ Take down the `apps/team-tasks-ui` Docker Compose project, and stop the host
9
+ team-db API and process view only when `/ui-start` started them.
10
10
 
11
11
  ## What to do
12
12
 
@@ -29,6 +29,9 @@ node apps/team-tasks-ui/scripts/stack.mjs stop
29
29
  network.
30
30
  - Stops only the API process recorded in `.ai.local/.ui/api.json` whose live
31
31
  command line is still `team-db.mjs serve`, then removes that marker.
32
+ - Stops the process view through `processes.mjs stop --name process-view`, so
33
+ only a listener that manager recorded is signalled; a foreign one is left
34
+ running and reported.
32
35
  - Leaves a foreign API alone: a process the marker does not prove is never
33
36
  signalled.
34
37
 
@@ -2953,6 +2953,10 @@ if (status.state === 'awaiting_artifact_receipt') {
2953
2953
  emitArtifactStall(artifactStallMessage, !wasWaitingForReceipt);
2954
2954
  process.exit(0);
2955
2955
  }
2956
+ // Snapshot before `finishActiveAttempt` writes `lastCompletedAttempt`: the
2957
+ // repositories intake gate judges a task at its first receipt, so a folder whose
2958
+ // first step already completed is never re-judged.
2959
+ const hadPriorCompletion = Boolean(status.lastCompletedAttempt);
2956
2960
  let finishedAttempt = finishActiveAttempt();
2957
2961
  // The just-finished attempt's metric is already written; a pause now blocks
2958
2962
  // every handoff, including the unattributable-stop repair path below.
@@ -2980,7 +2984,7 @@ if (!finishedAttempt && activeAttemptCountBeforeFinish > 0) {
2980
2984
  }
2981
2985
  }
2982
2986
  endHumanGateIfResumed();
2983
- if (steps.length === 0 || pipeline.autoChain === false) {
2987
+ if (steps.length === 0) {
2984
2988
  writeStatus({});
2985
2989
  process.stdout.write('{}');
2986
2990
  process.exit(0);
@@ -3027,6 +3031,70 @@ const waveIndexes = activeWave
3027
3031
  ? [idx]
3028
3032
  : (isGraphMode() && finishedAttempt ? [completedStepIndex] : null));
3029
3033
 
3034
+ /**
3035
+ * Intake invariant: a task records which repositories it touches — or says that
3036
+ * it does not know. Judged on the first receipt of a task: the router's, or the
3037
+ * first step's when a pipeline runs without one. A task that already completed a
3038
+ * step predates the invariant and is never re-judged.
3039
+ * `intakeExemption: { approvedBy, reason, at }` is the recorded escape hatch; a
3040
+ * bare boolean does not count, so an exemption always names who approved it. The
3041
+ * shape mirrors `check-task-repositories.mjs`, which audits the same field after
3042
+ * the fact.
3043
+ */
3044
+ const REPOSITORY_INFERENCES = new Set(['evidence-paths', 'repo-scope-only', 'unknown', 'ambiguous']);
3045
+ const EXEMPTION_DATE = /^\d{4}-\d{2}-\d{2}$/;
3046
+ function repositoriesIntakeViolation(record) {
3047
+ if (!record) return 'has no `repositories` array';
3048
+ const ids = record.repositories;
3049
+ const inference = record.repositoriesInference;
3050
+ if (!Array.isArray(ids)) return 'carries no `repositories` array';
3051
+ if (ids.some((id) => typeof id !== 'string' || id.trim() === '')) return 'carries a `repositories` entry that is not a non-empty registry id';
3052
+ if (ids.length === 0) {
3053
+ return inference === 'unknown' ? null : 'carries `repositories: []` without `"repositoriesInference": "unknown"`';
3054
+ }
3055
+ if (inference !== undefined && !REPOSITORY_INFERENCES.has(inference)) return `carries an unknown \`repositoriesInference\` value "${inference}"`;
3056
+ if (inference === 'unknown') return 'lists repositories beside `"repositoriesInference": "unknown"`';
3057
+ let known = null;
3058
+ try {
3059
+ const registry = JSON.parse(fs.readFileSync(path.join(TEAM_ROOT, 'repositories.json'), 'utf8'));
3060
+ known = new Set((Array.isArray(registry.repositories) ? registry.repositories : []).map((row) => row && row.id).filter((id) => typeof id === 'string'));
3061
+ } catch { known = null; }
3062
+ if (known && known.size > 0) {
3063
+ const unknownIds = ids.filter((id) => !known.has(id));
3064
+ if (unknownIds.length > 0) return `names ${unknownIds.join(', ')} — not in .ai.local/team/repositories.json`;
3065
+ }
3066
+ return null;
3067
+ }
3068
+ function repositoriesIntakeExemption(record) {
3069
+ const entry = record && record.intakeExemption;
3070
+ if (!entry || typeof entry !== 'object') return null;
3071
+ const approvedBy = typeof entry.approvedBy === 'string' ? entry.approvedBy.trim() : '';
3072
+ const reason = typeof entry.reason === 'string' ? entry.reason.trim() : '';
3073
+ const at = typeof entry.at === 'string' ? entry.at.trim() : '';
3074
+ if (approvedBy === '' || reason.length < 10 || !EXEMPTION_DATE.test(at)) return null;
3075
+ return { approvedBy, reason, at };
3076
+ }
3077
+ const repositoriesGateApplies = Boolean(finishedAttempt)
3078
+ && (completedAgent === 'task-router' || (!hadPriorCompletion && completedStepIndex === 0));
3079
+ if (repositoriesGateApplies) {
3080
+ const violation = repositoriesIntakeViolation(pipeline);
3081
+ if (violation) {
3082
+ const exemption = repositoriesIntakeExemption(pipeline);
3083
+ if (!exemption) {
3084
+ appendMetric({ type: 'intake_repositories_blocked', at: now, stepIndex: completedStepIndex, agent: completedAgent, violation, source: 'hook', attributionConfidence: 'high' });
3085
+ writeStatus({ state: 'blocked', phase: 'blocked', currentAgent: 'task-router' });
3086
+ out(`pipeline.json for "${slug}" ${violation}. Intake stays open until the repositories are recorded: set "repositories" to the ids in .ai.local/team/repositories.json with "repositoriesInference": "evidence-paths" (or "repo-scope-only"), or "repositories": [] with "repositoriesInference": "unknown" when the request names none. Rewrite pipeline.json through the task-router, then resume via /task-continue ${slug}. A task that predates the invariant carries "intakeExemption": { "approvedBy": "<human>", "reason": "<why, 10+ characters>", "at": "YYYY-MM-DD" } — a bare boolean is not accepted.`);
3087
+ process.exit(0);
3088
+ }
3089
+ appendMetric({ type: 'intake_repositories_exempted', at: now, stepIndex: completedStepIndex, agent: completedAgent, violation, approvedBy: exemption.approvedBy, reason: exemption.reason, exemptedAt: exemption.at, source: 'hook', attributionConfidence: 'high' });
3090
+ }
3091
+ }
3092
+ if (pipeline.autoChain === false) {
3093
+ writeStatus({});
3094
+ process.stdout.write('{}');
3095
+ process.exit(0);
3096
+ }
3097
+
3030
3098
 
3031
3099
  if (waveIndexes) {
3032
3100
  const waveAgents = waveIndexes.flatMap((i) => getStepAgents(steps[i]));
@@ -208,6 +208,8 @@ Do **not** add a dedicated `spec-author` agent for `docs/specs/**`. Do not requi
208
208
 
209
209
  **specMode (optional `pipeline.json` field):** `none` for spike/research; `generate` for `spec-gen` / `/spec-start`; `consume` default when INDEX exists. Echo top-level `specMode`. Brief `## Spec mode` wins on conflict.
210
210
 
211
+ **repositories (mandatory `pipeline.json` field):** echo `"repositories": [<ids>]` and `"repositoriesInference": "evidence-paths" | "repo-scope-only" | "unknown" | "ambiguous"` immediately after `specMode`, before `summary`; the ids come from `.ai.local/team/repositories.json` and are never defaulted to the workspace repository. Then record the same list as link rows through `node .ai.local/scripts/team-db.mjs repositories apply --file -` — one `{"links": [{taskSlug, repositoryId, source: "intake", inference: "evidence-paths"}]}` envelope per touched repository (the verb takes the envelope, never a bare row). When the request names no repository, write `"repositories": []` with `"unknown"` and one `{"attributions": [{taskSlug, verdict: "unknown", evidence: ""}]}` envelope; `yarn check:task-repositories` fails a folder without the field.
212
+
211
213
  Do **not** add a pipeline step for `spec-discovery`. Instruct analyst to load that skill only when the user/AC asks research-before-spec.
212
214
 
213
215
  ## Runtime initialization
@@ -11,6 +11,7 @@ Slash commands are copied to `.claude/commands/` on `ai-rules init claude --pres
11
11
  | `/technical-retro [slug]` | Retro; with slug — “Agent work” block |
12
12
  | `update.md` | Reinstall each installed tool with the preset recorded at init |
13
13
  | `migrate-tasks.md` | Create or reconcile `.ai.local/team/team.db`; writes only the delta |
14
+ | `rr-migrate-repositories.md` | Scan repositories on disk, add the missing ones to the local registry, and project the file into `team.db` |
14
15
 
15
16
  ## `/task` examples
16
17
 
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: rr-migrate-repositories
3
+ description: Scan repositories on disk, add the missing ones to the local registry, and project the file into team.db.
4
+ ---
5
+
6
+ # Migrate repositories
7
+
8
+ Turn the repositories already cloned on this machine into registry records, then
9
+ sync the registry file into the team database.
10
+
11
+ ## What to do
12
+
13
+ 1. From the repository root, run:
14
+
15
+ ```bash
16
+ node .ai.local/scripts/rr-migrate-repositories.mjs
17
+ ```
18
+
19
+ 2. Report the summary in the user's native language, keeping the counters
20
+ verbatim: `scanned`, `repositories`, `duplicates`, `create`, `update`,
21
+ `unchanged`, `not-on-disk`, and the `project` line.
22
+ 3. A `disabled by AI_RULES_TEAM_DB_DISABLE` line means the plan was computed and
23
+ nothing was written; exit 0 is the documented fallback. Relay it and stop.
24
+ 4. Any non-zero exit: quote stderr and stop.
25
+
26
+ ## Arguments
27
+
28
+ - `--scan <dir>` — directory to scan; repeatable. Default: the parent of the
29
+ repository root (the repository root itself when its parent is `$HOME`), so
30
+ sibling clones are picked up.
31
+ - `--depth <n>` — directory levels below a scan root (default `4`).
32
+ - `--dry-run` — print the plan and write nothing.
33
+ - `--no-update` — create missing records only; never touch an existing one.
34
+ - `--team-root <dir>` — team store root (default `<repo-root>/.ai.local/team`).
35
+ - `--json` — machine-readable summary.
36
+
37
+ ## What the script does
38
+
39
+ - Walks the scan roots; a directory with `.git` is a repository and is not
40
+ descended into. Submodule checkouts and linked worktrees are skipped.
41
+ - Collapses clones that share one remote to the shallowest path.
42
+ - Keeps the id of a record whose locator already exists, so a re-run is
43
+ idempotent; a new id is the slug of the directory name, with a parent prefix
44
+ when that slug is taken.
45
+ - Creates missing records through `team-db.mjs repositories apply`, updates a
46
+ changed `name`, `locator`, or `status` through `repositories put`, then runs
47
+ `repositories project`. The lock-guarded verb is the only writer.
48
+ - Never deletes a record: a repository missing from this scan may simply live
49
+ outside the scanned roots.
50
+
51
+ `.ai.local/team/repositories.json` is local-only and git-ignored. The database is
52
+ derived: deleting `team.db` costs a rebuild, not the records.
53
+
54
+ ## Do not
55
+
56
+ - Hand-edit `.ai.local/team/repositories.json`; the verb owns the write lock.
57
+ - Commit the registry file or `team.db*`.
58
+ - Delete registry records to make a scan look clean.
59
+ - Pass `--scan` a filesystem root without a matching `--depth`.
@@ -44,6 +44,10 @@ Examples:
44
44
  6. **After each agent** — wait for hook handoff / reconciliation terminal receipt → `status.state`; do not start the next step until `status.json` reflects the handoff (or until there is a hook `followup_message`).
45
45
  7. **Human gate** — if after the current step there is a gate in `humanGates` (`after:<agent>`), after the agent finishes **stop** and ask for `/task-continue <slug>`.
46
46
 
47
+ ## Repositories (mandatory)
48
+
49
+ The repositories a task touches are part of its intake: `pipeline.json` must carry `"repositories": [<registry ids>]`, or `"repositories": []` together with `"repositoriesInference": "unknown"` when the request names none. The router reads `.ai.local/team/repositories.json` and records the same list as link rows; the field is never defaulted; `node .ai.local/scripts/check-task-repositories.mjs` audits the store and the chain hook blocks a task-router receipt that omits it. See `agents/task-router.md`.
50
+
47
51
  ## Plan contract
48
52
 
49
53
  Intake runs the planning workflow before any implementation: **goal frame** (goal, user value, success + result-evaluation criteria) → **requirements + AC-IDs** → **information-sufficiency** verdict (`sufficient` | `insufficient`) → decompose with a **dependency graph** (`dependsOn[]`, DAG, critical path) and, for large flows, **epics / stages** with exit criteria. The plan is revisable: a **plan revision** is a named, recorded operation (`planRevision`), and progress is checkpointed to `.memlog.md` (with the optional `contextBudget` note) so a run can resume.