@bonesofspring/ai-rules 0.2.61 → 0.2.64

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 (538) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +13 -6
  3. package/bin/cli.js +7 -5
  4. package/bin/lib/ai-local-drift.js +7 -6
  5. package/bin/lib/engine-scripts.js +4 -0
  6. package/bin/lib/engine-upgrade.js +10 -2
  7. package/bin/lib/manifest-schema.js +12 -0
  8. package/bin/lib/seed-ai-local-team.js +16 -0
  9. package/bin/mavis-install.js +4 -1
  10. package/bin/opencode-install.js +22 -4
  11. package/bin/zcode-install.js +4 -1
  12. package/docs/MAVIS.md +5 -2
  13. package/docs/MCP-CATALOG.md +1 -1
  14. package/docs/OPENCODE-COMPATIBILITY.md +3 -2
  15. package/docs/OPENCODE.md +27 -4
  16. package/docs/PLATFORMS.md +1 -1
  17. package/docs/PRESET-CONTRIBUTION.md +20 -17
  18. package/docs/TEAM-DB.md +78 -5
  19. package/docs/openapi/team-db.v1.json +4817 -2795
  20. package/mcp/defectdojo-mcp.mjs +41 -11
  21. package/mcp/lib/defectdojo.mjs +45 -2
  22. package/package.json +10 -4
  23. package/presets/_shared/ai-local/scripts/aggregate-agent-task-metrics.mjs +279 -0
  24. package/presets/_shared/ai-local/scripts/check-write-scope.mjs +176 -28
  25. package/presets/_shared/ai-local/scripts/lock.mjs +60 -121
  26. package/presets/_shared/ai-local/scripts/team-db-api.mjs +471 -7
  27. package/presets/_shared/ai-local/scripts/team-db-backlog.mjs +1366 -0
  28. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +573 -7
  29. package/presets/_shared/ai-local/scripts/team-db-project.mjs +288 -4
  30. package/presets/_shared/ai-local/scripts/team-db-scheduler.mjs +82 -10
  31. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +83 -0
  32. package/presets/_shared/ai-local/scripts/team-db.mjs +69 -6
  33. package/presets/_shared/ai-local/scripts/upstream-research.mjs +3 -0
  34. package/presets/_shared/core/agent-team/agent-artifact-contracts.md +4 -0
  35. package/presets/_shared/core/agent-team/agent-task-metrics.md +7 -2
  36. package/presets/_shared/core/agent-team/agent-team-intake.md +1 -0
  37. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +6 -2
  38. package/presets/_shared/core/meta/preset-pr-checklist.md +4 -4
  39. package/presets/_shared/core/meta/preset-twin-sync.md +1 -1
  40. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +225 -0
  41. package/presets/_shared/hooks/check-preset-update.mjs +4 -3
  42. package/presets/_shared/hooks/run-hook.mjs +2 -1
  43. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +225 -0
  44. package/presets/claude/android-kotlin/hooks/check-preset-update.mjs +4 -3
  45. package/presets/claude/android-kotlin/hooks/run-hook.mjs +2 -1
  46. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-intake.md +1 -0
  47. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +6 -2
  48. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  49. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-twin-sync.md +1 -1
  50. package/presets/claude/go/hooks/chain-team-phases.sh +225 -0
  51. package/presets/claude/go/hooks/check-preset-update.mjs +4 -3
  52. package/presets/claude/go/hooks/run-hook.mjs +2 -1
  53. package/presets/claude/go/rules/tooling-and-review/agent-team-intake.md +1 -0
  54. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +6 -2
  55. package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  56. package/presets/claude/go/rules/tooling-and-review/preset-twin-sync.md +1 -1
  57. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +225 -0
  58. package/presets/claude/ios-swift/hooks/check-preset-update.mjs +4 -3
  59. package/presets/claude/ios-swift/hooks/run-hook.mjs +2 -1
  60. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-intake.md +1 -0
  61. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +6 -2
  62. package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  63. package/presets/claude/ios-swift/rules/tooling-and-review/preset-twin-sync.md +1 -1
  64. package/presets/claude/java/hooks/chain-team-phases.sh +225 -0
  65. package/presets/claude/java/hooks/check-preset-update.mjs +4 -3
  66. package/presets/claude/java/hooks/run-hook.mjs +2 -1
  67. package/presets/claude/java/rules/tooling-and-review/agent-team-intake.md +1 -0
  68. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +6 -2
  69. package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  70. package/presets/claude/java/rules/tooling-and-review/preset-twin-sync.md +1 -1
  71. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +225 -0
  72. package/presets/claude/mcp-ts/hooks/check-preset-update.mjs +4 -3
  73. package/presets/claude/mcp-ts/hooks/run-hook.mjs +2 -1
  74. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-intake.md +1 -0
  75. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +6 -2
  76. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  77. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-twin-sync.md +1 -1
  78. package/presets/claude/mol/hooks/chain-team-phases.sh +225 -0
  79. package/presets/claude/mol/hooks/check-preset-update.mjs +4 -3
  80. package/presets/claude/mol/hooks/run-hook.mjs +2 -1
  81. package/presets/claude/mol/rules/tooling-and-review/agent-team-intake.md +1 -0
  82. package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +6 -2
  83. package/presets/claude/mol/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  84. package/presets/claude/mol/rules/tooling-and-review/preset-twin-sync.md +1 -1
  85. package/presets/claude/next/agents/build-verifier.md +16 -3
  86. package/presets/claude/next/agents/code-reviewer.md +1 -0
  87. package/presets/claude/next/agents/feature-developer.md +2 -1
  88. package/presets/claude/next/agents/mockup-reviewer.md +2 -1
  89. package/presets/claude/next/agents/task-analyst.md +4 -0
  90. package/presets/claude/next/commands/task.md +7 -1
  91. package/presets/claude/next/commands/technical-retro.md +7 -1
  92. package/presets/claude/next/commands/upstream-research.md +1 -1
  93. package/presets/claude/next/hooks/chain-team-phases.sh +225 -0
  94. package/presets/claude/next/hooks/check-preset-update.mjs +4 -3
  95. package/presets/claude/next/hooks/run-hook.mjs +2 -1
  96. package/presets/claude/next/rules/tooling-and-review/agent-team-intake.md +1 -0
  97. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +6 -2
  98. package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  99. package/presets/claude/next/rules/tooling-and-review/preset-twin-sync.md +1 -1
  100. package/presets/claude/next/skills/figma-fidelity/SKILL.md +4 -1
  101. package/presets/claude/next/skills/mockup-review/SKILL.md +4 -0
  102. package/presets/claude/next/team/README.md +5 -1
  103. package/presets/claude/next/team/upstream/jobs.json +34 -0
  104. package/presets/claude/nuxt/hooks/chain-team-phases.sh +225 -0
  105. package/presets/claude/nuxt/hooks/check-preset-update.mjs +4 -3
  106. package/presets/claude/nuxt/hooks/run-hook.mjs +2 -1
  107. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-intake.md +1 -0
  108. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +6 -2
  109. package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  110. package/presets/claude/nuxt/rules/tooling-and-review/preset-twin-sync.md +1 -1
  111. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +225 -0
  112. package/presets/claude/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  113. package/presets/claude/php-hexagonal/hooks/run-hook.mjs +2 -1
  114. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-intake.md +1 -0
  115. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +6 -2
  116. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  117. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-twin-sync.md +1 -1
  118. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +225 -0
  119. package/presets/claude/php-laravel/hooks/check-preset-update.mjs +4 -3
  120. package/presets/claude/php-laravel/hooks/run-hook.mjs +2 -1
  121. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-intake.md +1 -0
  122. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +6 -2
  123. package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  124. package/presets/claude/php-laravel/rules/tooling-and-review/preset-twin-sync.md +1 -1
  125. package/presets/claude/svelte/hooks/chain-team-phases.sh +225 -0
  126. package/presets/claude/svelte/hooks/check-preset-update.mjs +4 -3
  127. package/presets/claude/svelte/hooks/run-hook.mjs +2 -1
  128. package/presets/claude/svelte/rules/tooling-and-review/agent-team-intake.md +1 -0
  129. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +6 -2
  130. package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +4 -4
  131. package/presets/claude/svelte/rules/tooling-and-review/preset-twin-sync.md +1 -1
  132. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +225 -0
  133. package/presets/cursor/android-kotlin/hooks/check-preset-update.mjs +4 -3
  134. package/presets/cursor/android-kotlin/hooks/run-hook.mjs +2 -1
  135. package/presets/cursor/android-kotlin/rules/agent-team-intake.mdc +1 -0
  136. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +2 -1
  137. package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +4 -4
  138. package/presets/cursor/android-kotlin/rules/preset-twin-sync.mdc +1 -1
  139. package/presets/cursor/go/hooks/chain-team-phases.sh +225 -0
  140. package/presets/cursor/go/hooks/check-preset-update.mjs +4 -3
  141. package/presets/cursor/go/hooks/run-hook.mjs +2 -1
  142. package/presets/cursor/go/rules/agent-team-intake.mdc +1 -0
  143. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +2 -1
  144. package/presets/cursor/go/rules/preset-pr-checklist.mdc +4 -4
  145. package/presets/cursor/go/rules/preset-twin-sync.mdc +1 -1
  146. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +225 -0
  147. package/presets/cursor/ios-swift/hooks/check-preset-update.mjs +4 -3
  148. package/presets/cursor/ios-swift/hooks/run-hook.mjs +2 -1
  149. package/presets/cursor/ios-swift/rules/agent-team-intake.mdc +1 -0
  150. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +2 -1
  151. package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +4 -4
  152. package/presets/cursor/ios-swift/rules/preset-twin-sync.mdc +1 -1
  153. package/presets/cursor/java/hooks/chain-team-phases.sh +225 -0
  154. package/presets/cursor/java/hooks/check-preset-update.mjs +4 -3
  155. package/presets/cursor/java/hooks/run-hook.mjs +2 -1
  156. package/presets/cursor/java/rules/agent-team-intake.mdc +1 -0
  157. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +2 -1
  158. package/presets/cursor/java/rules/preset-pr-checklist.mdc +4 -4
  159. package/presets/cursor/java/rules/preset-twin-sync.mdc +1 -1
  160. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +225 -0
  161. package/presets/cursor/mcp-ts/hooks/check-preset-update.mjs +4 -3
  162. package/presets/cursor/mcp-ts/hooks/run-hook.mjs +2 -1
  163. package/presets/cursor/mcp-ts/rules/agent-team-intake.mdc +1 -0
  164. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +2 -1
  165. package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +4 -4
  166. package/presets/cursor/mcp-ts/rules/preset-twin-sync.mdc +1 -1
  167. package/presets/cursor/mol/hooks/chain-team-phases.sh +225 -0
  168. package/presets/cursor/mol/hooks/check-preset-update.mjs +4 -3
  169. package/presets/cursor/mol/hooks/run-hook.mjs +2 -1
  170. package/presets/cursor/mol/rules/agent-team-intake.mdc +1 -0
  171. package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +2 -1
  172. package/presets/cursor/mol/rules/preset-pr-checklist.mdc +4 -4
  173. package/presets/cursor/mol/rules/preset-twin-sync.mdc +1 -1
  174. package/presets/cursor/next/agents/build-verifier.md +16 -3
  175. package/presets/cursor/next/agents/code-reviewer.md +1 -0
  176. package/presets/cursor/next/agents/feature-developer.md +2 -1
  177. package/presets/cursor/next/agents/mockup-reviewer.md +2 -1
  178. package/presets/cursor/next/agents/task-analyst.md +4 -0
  179. package/presets/cursor/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -0
  180. package/presets/cursor/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
  181. package/presets/cursor/next/commands/task.md +7 -1
  182. package/presets/cursor/next/commands/technical-retro.md +7 -1
  183. package/presets/cursor/next/commands/upstream-research.md +1 -1
  184. package/presets/cursor/next/hooks/chain-team-phases.sh +225 -0
  185. package/presets/cursor/next/hooks/check-preset-update.mjs +4 -3
  186. package/presets/cursor/next/hooks/run-hook.mjs +2 -1
  187. package/presets/cursor/next/rules/agent-team-intake.mdc +1 -0
  188. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +2 -1
  189. package/presets/cursor/next/rules/preset-pr-checklist.mdc +4 -4
  190. package/presets/cursor/next/rules/preset-twin-sync.mdc +1 -1
  191. package/presets/cursor/next/skills/figma-fidelity/SKILL.md +4 -1
  192. package/presets/cursor/next/skills/mockup-review/SKILL.md +4 -0
  193. package/presets/cursor/next/team/README.md +5 -1
  194. package/presets/cursor/next/team/upstream/jobs.json +34 -0
  195. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +225 -0
  196. package/presets/cursor/nuxt/hooks/check-preset-update.mjs +4 -3
  197. package/presets/cursor/nuxt/hooks/run-hook.mjs +2 -1
  198. package/presets/cursor/nuxt/rules/agent-team-intake.mdc +1 -0
  199. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +2 -1
  200. package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +4 -4
  201. package/presets/cursor/nuxt/rules/preset-twin-sync.mdc +1 -1
  202. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +225 -0
  203. package/presets/cursor/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  204. package/presets/cursor/php-hexagonal/hooks/run-hook.mjs +2 -1
  205. package/presets/cursor/php-hexagonal/rules/agent-team-intake.mdc +1 -0
  206. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +2 -1
  207. package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +4 -4
  208. package/presets/cursor/php-hexagonal/rules/preset-twin-sync.mdc +1 -1
  209. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +225 -0
  210. package/presets/cursor/php-laravel/hooks/check-preset-update.mjs +4 -3
  211. package/presets/cursor/php-laravel/hooks/run-hook.mjs +2 -1
  212. package/presets/cursor/php-laravel/rules/agent-team-intake.mdc +1 -0
  213. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +2 -1
  214. package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +4 -4
  215. package/presets/cursor/php-laravel/rules/preset-twin-sync.mdc +1 -1
  216. package/presets/cursor/svelte/hooks/chain-team-phases.sh +225 -0
  217. package/presets/cursor/svelte/hooks/check-preset-update.mjs +4 -3
  218. package/presets/cursor/svelte/hooks/run-hook.mjs +2 -1
  219. package/presets/cursor/svelte/rules/agent-team-intake.mdc +1 -0
  220. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +2 -1
  221. package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +4 -4
  222. package/presets/cursor/svelte/rules/preset-twin-sync.mdc +1 -1
  223. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  224. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +225 -0
  225. package/presets/mavis/android-kotlin/hooks/check-preset-update.mjs +4 -3
  226. package/presets/mavis/android-kotlin/rules/agent-team-intake.md +1 -0
  227. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +6 -2
  228. package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +4 -4
  229. package/presets/mavis/android-kotlin/rules/preset-twin-sync.md +1 -1
  230. package/presets/mavis/go/adapter-map.json +1 -1
  231. package/presets/mavis/go/hooks/chain-team-phases.sh +225 -0
  232. package/presets/mavis/go/hooks/check-preset-update.mjs +4 -3
  233. package/presets/mavis/go/rules/agent-team-intake.md +1 -0
  234. package/presets/mavis/go/rules/agent-team-orchestrator.md +6 -2
  235. package/presets/mavis/go/rules/preset-pr-checklist.md +4 -4
  236. package/presets/mavis/go/rules/preset-twin-sync.md +1 -1
  237. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  238. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +225 -0
  239. package/presets/mavis/ios-swift/hooks/check-preset-update.mjs +4 -3
  240. package/presets/mavis/ios-swift/rules/agent-team-intake.md +1 -0
  241. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +6 -2
  242. package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +4 -4
  243. package/presets/mavis/ios-swift/rules/preset-twin-sync.md +1 -1
  244. package/presets/mavis/java/adapter-map.json +1 -1
  245. package/presets/mavis/java/hooks/chain-team-phases.sh +225 -0
  246. package/presets/mavis/java/hooks/check-preset-update.mjs +4 -3
  247. package/presets/mavis/java/rules/agent-team-intake.md +1 -0
  248. package/presets/mavis/java/rules/agent-team-orchestrator.md +6 -2
  249. package/presets/mavis/java/rules/preset-pr-checklist.md +4 -4
  250. package/presets/mavis/java/rules/preset-twin-sync.md +1 -1
  251. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  252. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +225 -0
  253. package/presets/mavis/mcp-ts/hooks/check-preset-update.mjs +4 -3
  254. package/presets/mavis/mcp-ts/rules/agent-team-intake.md +1 -0
  255. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +6 -2
  256. package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +4 -4
  257. package/presets/mavis/mcp-ts/rules/preset-twin-sync.md +1 -1
  258. package/presets/mavis/mol/adapter-map.json +1 -1
  259. package/presets/mavis/mol/hooks/chain-team-phases.sh +225 -0
  260. package/presets/mavis/mol/hooks/check-preset-update.mjs +4 -3
  261. package/presets/mavis/mol/rules/agent-team-intake.md +1 -0
  262. package/presets/mavis/mol/rules/agent-team-orchestrator.md +6 -2
  263. package/presets/mavis/mol/rules/preset-pr-checklist.md +4 -4
  264. package/presets/mavis/mol/rules/preset-twin-sync.md +1 -1
  265. package/presets/mavis/next/adapter-map.json +9 -1
  266. package/presets/mavis/next/agents/build-verifier.md +16 -3
  267. package/presets/mavis/next/agents/code-reviewer.md +1 -0
  268. package/presets/mavis/next/agents/feature-developer.md +2 -1
  269. package/presets/mavis/next/agents/mockup-reviewer.md +2 -1
  270. package/presets/mavis/next/agents/task-analyst.md +4 -0
  271. package/presets/mavis/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -0
  272. package/presets/mavis/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
  273. package/presets/mavis/next/commands/task.md +7 -1
  274. package/presets/mavis/next/commands/technical-retro.md +7 -1
  275. package/presets/mavis/next/commands/upstream-research.md +1 -1
  276. package/presets/mavis/next/hooks/chain-team-phases.sh +225 -0
  277. package/presets/mavis/next/hooks/check-preset-update.mjs +4 -3
  278. package/presets/mavis/next/rules/agent-team-intake.md +1 -0
  279. package/presets/mavis/next/rules/agent-team-orchestrator.md +6 -2
  280. package/presets/mavis/next/rules/preset-pr-checklist.md +4 -4
  281. package/presets/mavis/next/rules/preset-twin-sync.md +1 -1
  282. package/presets/mavis/next/skills/figma-fidelity/SKILL.md +4 -1
  283. package/presets/mavis/next/skills/mockup-review/SKILL.md +4 -0
  284. package/presets/mavis/next/team/README.md +5 -1
  285. package/presets/mavis/next/team/upstream/jobs.json +34 -0
  286. package/presets/mavis/nuxt/adapter-map.json +1 -1
  287. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +225 -0
  288. package/presets/mavis/nuxt/hooks/check-preset-update.mjs +4 -3
  289. package/presets/mavis/nuxt/rules/agent-team-intake.md +1 -0
  290. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +6 -2
  291. package/presets/mavis/nuxt/rules/preset-pr-checklist.md +4 -4
  292. package/presets/mavis/nuxt/rules/preset-twin-sync.md +1 -1
  293. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  294. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +225 -0
  295. package/presets/mavis/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  296. package/presets/mavis/php-hexagonal/rules/agent-team-intake.md +1 -0
  297. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +6 -2
  298. package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +4 -4
  299. package/presets/mavis/php-hexagonal/rules/preset-twin-sync.md +1 -1
  300. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  301. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +225 -0
  302. package/presets/mavis/php-laravel/hooks/check-preset-update.mjs +4 -3
  303. package/presets/mavis/php-laravel/rules/agent-team-intake.md +1 -0
  304. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +6 -2
  305. package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +4 -4
  306. package/presets/mavis/php-laravel/rules/preset-twin-sync.md +1 -1
  307. package/presets/mavis/svelte/adapter-map.json +1 -1
  308. package/presets/mavis/svelte/hooks/chain-team-phases.sh +225 -0
  309. package/presets/mavis/svelte/hooks/check-preset-update.mjs +4 -3
  310. package/presets/mavis/svelte/rules/agent-team-intake.md +1 -0
  311. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +6 -2
  312. package/presets/mavis/svelte/rules/preset-pr-checklist.md +4 -4
  313. package/presets/mavis/svelte/rules/preset-twin-sync.md +1 -1
  314. package/presets/opencode/android-kotlin/OPENCODE.md +4 -1
  315. package/presets/opencode/android-kotlin/README.md +1 -0
  316. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  317. package/presets/opencode/android-kotlin/hooks/README.md +4 -2
  318. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +225 -0
  319. package/presets/opencode/android-kotlin/hooks/check-preset-update.mjs +4 -3
  320. package/presets/opencode/android-kotlin/rules/agent-team-intake.md +1 -0
  321. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +6 -2
  322. package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +4 -4
  323. package/presets/opencode/android-kotlin/rules/preset-twin-sync.md +1 -1
  324. package/presets/opencode/go/OPENCODE.md +4 -1
  325. package/presets/opencode/go/README.md +1 -0
  326. package/presets/opencode/go/adapter-map.json +1 -1
  327. package/presets/opencode/go/hooks/README.md +4 -2
  328. package/presets/opencode/go/hooks/chain-team-phases.sh +225 -0
  329. package/presets/opencode/go/hooks/check-preset-update.mjs +4 -3
  330. package/presets/opencode/go/rules/agent-team-intake.md +1 -0
  331. package/presets/opencode/go/rules/agent-team-orchestrator.md +6 -2
  332. package/presets/opencode/go/rules/preset-pr-checklist.md +4 -4
  333. package/presets/opencode/go/rules/preset-twin-sync.md +1 -1
  334. package/presets/opencode/ios-swift/OPENCODE.md +4 -1
  335. package/presets/opencode/ios-swift/README.md +1 -0
  336. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  337. package/presets/opencode/ios-swift/hooks/README.md +4 -2
  338. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +225 -0
  339. package/presets/opencode/ios-swift/hooks/check-preset-update.mjs +4 -3
  340. package/presets/opencode/ios-swift/rules/agent-team-intake.md +1 -0
  341. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +6 -2
  342. package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +4 -4
  343. package/presets/opencode/ios-swift/rules/preset-twin-sync.md +1 -1
  344. package/presets/opencode/java/OPENCODE.md +4 -1
  345. package/presets/opencode/java/README.md +1 -0
  346. package/presets/opencode/java/adapter-map.json +1 -1
  347. package/presets/opencode/java/hooks/README.md +4 -2
  348. package/presets/opencode/java/hooks/chain-team-phases.sh +225 -0
  349. package/presets/opencode/java/hooks/check-preset-update.mjs +4 -3
  350. package/presets/opencode/java/rules/agent-team-intake.md +1 -0
  351. package/presets/opencode/java/rules/agent-team-orchestrator.md +6 -2
  352. package/presets/opencode/java/rules/preset-pr-checklist.md +4 -4
  353. package/presets/opencode/java/rules/preset-twin-sync.md +1 -1
  354. package/presets/opencode/mcp-ts/OPENCODE.md +4 -1
  355. package/presets/opencode/mcp-ts/README.md +1 -0
  356. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  357. package/presets/opencode/mcp-ts/hooks/README.md +4 -2
  358. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +225 -0
  359. package/presets/opencode/mcp-ts/hooks/check-preset-update.mjs +4 -3
  360. package/presets/opencode/mcp-ts/rules/agent-team-intake.md +1 -0
  361. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +6 -2
  362. package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +4 -4
  363. package/presets/opencode/mcp-ts/rules/preset-twin-sync.md +1 -1
  364. package/presets/opencode/mol/OPENCODE.md +4 -1
  365. package/presets/opencode/mol/README.md +1 -0
  366. package/presets/opencode/mol/adapter-map.json +1 -1
  367. package/presets/opencode/mol/hooks/README.md +4 -2
  368. package/presets/opencode/mol/hooks/chain-team-phases.sh +225 -0
  369. package/presets/opencode/mol/hooks/check-preset-update.mjs +4 -3
  370. package/presets/opencode/mol/rules/agent-team-intake.md +1 -0
  371. package/presets/opencode/mol/rules/agent-team-orchestrator.md +6 -2
  372. package/presets/opencode/mol/rules/preset-pr-checklist.md +4 -4
  373. package/presets/opencode/mol/rules/preset-twin-sync.md +1 -1
  374. package/presets/opencode/next/OPENCODE.md +4 -1
  375. package/presets/opencode/next/README.md +1 -0
  376. package/presets/opencode/next/adapter-map.json +9 -1
  377. package/presets/opencode/next/agents/build-verifier.md +16 -3
  378. package/presets/opencode/next/agents/code-reviewer.md +1 -0
  379. package/presets/opencode/next/agents/feature-developer.md +2 -1
  380. package/presets/opencode/next/agents/mockup-reviewer.md +2 -1
  381. package/presets/opencode/next/agents/task-analyst.md +4 -0
  382. package/presets/opencode/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -0
  383. package/presets/opencode/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
  384. package/presets/opencode/next/commands/task.md +7 -1
  385. package/presets/opencode/next/commands/technical-retro.md +7 -1
  386. package/presets/opencode/next/commands/upstream-research.md +1 -1
  387. package/presets/opencode/next/hooks/README.md +4 -2
  388. package/presets/opencode/next/hooks/chain-team-phases.sh +225 -0
  389. package/presets/opencode/next/hooks/check-preset-update.mjs +4 -3
  390. package/presets/opencode/next/rules/agent-team-intake.md +1 -0
  391. package/presets/opencode/next/rules/agent-team-orchestrator.md +6 -2
  392. package/presets/opencode/next/rules/preset-pr-checklist.md +4 -4
  393. package/presets/opencode/next/rules/preset-twin-sync.md +1 -1
  394. package/presets/opencode/next/skills/figma-fidelity/SKILL.md +4 -1
  395. package/presets/opencode/next/skills/mockup-review/SKILL.md +4 -0
  396. package/presets/opencode/next/team/README.md +5 -1
  397. package/presets/opencode/next/team/upstream/jobs.json +34 -0
  398. package/presets/opencode/nuxt/OPENCODE.md +4 -1
  399. package/presets/opencode/nuxt/README.md +1 -0
  400. package/presets/opencode/nuxt/adapter-map.json +1 -1
  401. package/presets/opencode/nuxt/hooks/README.md +4 -2
  402. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +225 -0
  403. package/presets/opencode/nuxt/hooks/check-preset-update.mjs +4 -3
  404. package/presets/opencode/nuxt/rules/agent-team-intake.md +1 -0
  405. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +6 -2
  406. package/presets/opencode/nuxt/rules/preset-pr-checklist.md +4 -4
  407. package/presets/opencode/nuxt/rules/preset-twin-sync.md +1 -1
  408. package/presets/opencode/php-hexagonal/OPENCODE.md +4 -1
  409. package/presets/opencode/php-hexagonal/README.md +1 -0
  410. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  411. package/presets/opencode/php-hexagonal/hooks/README.md +4 -2
  412. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +225 -0
  413. package/presets/opencode/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  414. package/presets/opencode/php-hexagonal/rules/agent-team-intake.md +1 -0
  415. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +6 -2
  416. package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +4 -4
  417. package/presets/opencode/php-hexagonal/rules/preset-twin-sync.md +1 -1
  418. package/presets/opencode/php-laravel/OPENCODE.md +4 -1
  419. package/presets/opencode/php-laravel/README.md +1 -0
  420. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  421. package/presets/opencode/php-laravel/hooks/README.md +4 -2
  422. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +225 -0
  423. package/presets/opencode/php-laravel/hooks/check-preset-update.mjs +4 -3
  424. package/presets/opencode/php-laravel/rules/agent-team-intake.md +1 -0
  425. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +6 -2
  426. package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +4 -4
  427. package/presets/opencode/php-laravel/rules/preset-twin-sync.md +1 -1
  428. package/presets/opencode/platform-contract.json +6 -0
  429. package/presets/opencode/plugins/task-status/README.md +92 -0
  430. package/presets/opencode/plugins/task-status/details-data.ts +130 -0
  431. package/presets/opencode/plugins/task-status/details.tsx +84 -0
  432. package/presets/opencode/plugins/task-status/eta.ts +230 -0
  433. package/presets/opencode/plugins/task-status/index.ts +6 -0
  434. package/presets/opencode/plugins/task-status/package.json +10 -0
  435. package/presets/opencode/plugins/task-status/task-view.ts +606 -0
  436. package/presets/opencode/plugins/task-status/tui.tsx +139 -0
  437. package/presets/opencode/svelte/OPENCODE.md +4 -1
  438. package/presets/opencode/svelte/README.md +1 -0
  439. package/presets/opencode/svelte/adapter-map.json +1 -1
  440. package/presets/opencode/svelte/hooks/README.md +4 -2
  441. package/presets/opencode/svelte/hooks/chain-team-phases.sh +225 -0
  442. package/presets/opencode/svelte/hooks/check-preset-update.mjs +4 -3
  443. package/presets/opencode/svelte/rules/agent-team-intake.md +1 -0
  444. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +6 -2
  445. package/presets/opencode/svelte/rules/preset-pr-checklist.md +4 -4
  446. package/presets/opencode/svelte/rules/preset-twin-sync.md +1 -1
  447. package/presets/zcode/android-kotlin/adapter-map.json +1 -1
  448. package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +225 -0
  449. package/presets/zcode/android-kotlin/hooks/check-preset-update.mjs +4 -3
  450. package/presets/zcode/android-kotlin/rules/agent-team-intake.md +1 -0
  451. package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +6 -2
  452. package/presets/zcode/android-kotlin/rules/preset-pr-checklist.md +4 -4
  453. package/presets/zcode/android-kotlin/rules/preset-twin-sync.md +1 -1
  454. package/presets/zcode/go/adapter-map.json +1 -1
  455. package/presets/zcode/go/hooks/chain-team-phases.sh +225 -0
  456. package/presets/zcode/go/hooks/check-preset-update.mjs +4 -3
  457. package/presets/zcode/go/rules/agent-team-intake.md +1 -0
  458. package/presets/zcode/go/rules/agent-team-orchestrator.md +6 -2
  459. package/presets/zcode/go/rules/preset-pr-checklist.md +4 -4
  460. package/presets/zcode/go/rules/preset-twin-sync.md +1 -1
  461. package/presets/zcode/ios-swift/adapter-map.json +1 -1
  462. package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +225 -0
  463. package/presets/zcode/ios-swift/hooks/check-preset-update.mjs +4 -3
  464. package/presets/zcode/ios-swift/rules/agent-team-intake.md +1 -0
  465. package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +6 -2
  466. package/presets/zcode/ios-swift/rules/preset-pr-checklist.md +4 -4
  467. package/presets/zcode/ios-swift/rules/preset-twin-sync.md +1 -1
  468. package/presets/zcode/java/adapter-map.json +1 -1
  469. package/presets/zcode/java/hooks/chain-team-phases.sh +225 -0
  470. package/presets/zcode/java/hooks/check-preset-update.mjs +4 -3
  471. package/presets/zcode/java/rules/agent-team-intake.md +1 -0
  472. package/presets/zcode/java/rules/agent-team-orchestrator.md +6 -2
  473. package/presets/zcode/java/rules/preset-pr-checklist.md +4 -4
  474. package/presets/zcode/java/rules/preset-twin-sync.md +1 -1
  475. package/presets/zcode/mcp-ts/adapter-map.json +1 -1
  476. package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +225 -0
  477. package/presets/zcode/mcp-ts/hooks/check-preset-update.mjs +4 -3
  478. package/presets/zcode/mcp-ts/rules/agent-team-intake.md +1 -0
  479. package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +6 -2
  480. package/presets/zcode/mcp-ts/rules/preset-pr-checklist.md +4 -4
  481. package/presets/zcode/mcp-ts/rules/preset-twin-sync.md +1 -1
  482. package/presets/zcode/mol/adapter-map.json +1 -1
  483. package/presets/zcode/mol/hooks/chain-team-phases.sh +225 -0
  484. package/presets/zcode/mol/hooks/check-preset-update.mjs +4 -3
  485. package/presets/zcode/mol/rules/agent-team-intake.md +1 -0
  486. package/presets/zcode/mol/rules/agent-team-orchestrator.md +6 -2
  487. package/presets/zcode/mol/rules/preset-pr-checklist.md +4 -4
  488. package/presets/zcode/mol/rules/preset-twin-sync.md +1 -1
  489. package/presets/zcode/next/adapter-map.json +9 -1
  490. package/presets/zcode/next/agents/build-verifier.md +16 -3
  491. package/presets/zcode/next/agents/code-reviewer.md +1 -0
  492. package/presets/zcode/next/agents/feature-developer.md +2 -1
  493. package/presets/zcode/next/agents/mockup-reviewer.md +2 -1
  494. package/presets/zcode/next/agents/task-analyst.md +4 -0
  495. package/presets/zcode/next/ai-local/rules-library/storybook-dev-compare-figma.md +1 -0
  496. package/presets/zcode/next/ai-local/rules-library/ui-change-review-gate.md +1 -0
  497. package/presets/zcode/next/commands/task.md +7 -1
  498. package/presets/zcode/next/commands/technical-retro.md +7 -1
  499. package/presets/zcode/next/commands/upstream-research.md +1 -1
  500. package/presets/zcode/next/hooks/chain-team-phases.sh +225 -0
  501. package/presets/zcode/next/hooks/check-preset-update.mjs +4 -3
  502. package/presets/zcode/next/rules/agent-team-intake.md +1 -0
  503. package/presets/zcode/next/rules/agent-team-orchestrator.md +6 -2
  504. package/presets/zcode/next/rules/preset-pr-checklist.md +4 -4
  505. package/presets/zcode/next/rules/preset-twin-sync.md +1 -1
  506. package/presets/zcode/next/skills/figma-fidelity/SKILL.md +4 -1
  507. package/presets/zcode/next/skills/mockup-review/SKILL.md +4 -0
  508. package/presets/zcode/next/team/README.md +5 -1
  509. package/presets/zcode/next/team/upstream/jobs.json +34 -0
  510. package/presets/zcode/nuxt/adapter-map.json +1 -1
  511. package/presets/zcode/nuxt/hooks/chain-team-phases.sh +225 -0
  512. package/presets/zcode/nuxt/hooks/check-preset-update.mjs +4 -3
  513. package/presets/zcode/nuxt/rules/agent-team-intake.md +1 -0
  514. package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +6 -2
  515. package/presets/zcode/nuxt/rules/preset-pr-checklist.md +4 -4
  516. package/presets/zcode/nuxt/rules/preset-twin-sync.md +1 -1
  517. package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
  518. package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +225 -0
  519. package/presets/zcode/php-hexagonal/hooks/check-preset-update.mjs +4 -3
  520. package/presets/zcode/php-hexagonal/rules/agent-team-intake.md +1 -0
  521. package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +6 -2
  522. package/presets/zcode/php-hexagonal/rules/preset-pr-checklist.md +4 -4
  523. package/presets/zcode/php-hexagonal/rules/preset-twin-sync.md +1 -1
  524. package/presets/zcode/php-laravel/adapter-map.json +1 -1
  525. package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +225 -0
  526. package/presets/zcode/php-laravel/hooks/check-preset-update.mjs +4 -3
  527. package/presets/zcode/php-laravel/rules/agent-team-intake.md +1 -0
  528. package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +6 -2
  529. package/presets/zcode/php-laravel/rules/preset-pr-checklist.md +4 -4
  530. package/presets/zcode/php-laravel/rules/preset-twin-sync.md +1 -1
  531. package/presets/zcode/svelte/adapter-map.json +1 -1
  532. package/presets/zcode/svelte/hooks/chain-team-phases.sh +225 -0
  533. package/presets/zcode/svelte/hooks/check-preset-update.mjs +4 -3
  534. package/presets/zcode/svelte/rules/agent-team-intake.md +1 -0
  535. package/presets/zcode/svelte/rules/agent-team-orchestrator.md +6 -2
  536. package/presets/zcode/svelte/rules/preset-pr-checklist.md +4 -4
  537. package/presets/zcode/svelte/rules/preset-twin-sync.md +1 -1
  538. package/scripts/aggregate-agent-task-metrics.mjs +48 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,90 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ### Upstream research
6
+
7
+ - **The weekly job actually ships.** `presets/cursor/next/team/upstream/jobs.json` is the preset-owned definition of the advertised `upstream-research` job (cron `0 9 * * 1` `Europe/Moscow`, pipeline payload over `upstream/prompt.md`, 75-minute timeout, `skip` concurrency, `run-once` misfire); `init`/`update` seed it into `.ai.local/team/scheduler/jobs.json` when the file is absent, and an operator-edited definition is never overwritten. `test-upstream-research.mjs` is reachable from its own `test:upstream` script and the preset-structure composite.
8
+ - **A clone target is bounded.** `projects[].fetchStrategy.path` is capped at 200 characters (`REGISTRY_BOUNDS.fetchPathMax`); a longer path is refused with `E_REGISTRY_FETCH` and the field name, so a registry entry cannot hand `git fetch` an unbounded target.
9
+
10
+ ### Scheduler and pipeline
11
+
12
+ - **One exclusive create claims the scheduler lease.** `team-db.mjs schedule` read the lease and then wrote it, so two simultaneous starts could both see an empty root and both write one; the claim is now a single `wx` create, the loser exits `4` with `E_BUSY` exactly like a sequential second start, and a stale lease is re-read immediately before removal, so a lease another start reclaimed in the meantime is left standing.
13
+ - **Pipeline placeholders are a closed vocabulary.** `PROMPT_TOKENS` (`{{job.id}}`, `{{run.id}}`, `{{run.dir}}`, `{{team.root}}`, `{{now}}`) is the one list shared by `validateJob` and the render pass: a `payload.promptTemplate` with any other `{{token}}` is refused at definition time with the offending placeholder and the allowed list, so a run cannot start with a raw token left in the prompt. An absent template stays a runtime `E_PROMPT_MISSING`, not a definition error.
14
+ - **Bootstrap starts the first executable step.** The idempotent `bootstrap` action activated `steps[0]` even when that step was `skipIf`-matched, while the advance path skipped it; it now uses `findNextExecutableStep`, records that `pipelineIndex`, and reports a skip instead of a phantom attempt when every step is skipIf-matched.
15
+ - **Windows `.cmd` arguments keep embedded quotes.** `quoteWindowsArg` doubles a `"` as `""` per the cmd.exe convention; the previous `\"` ended the quoted argument instead of escaping the quote inside it.
16
+
17
+ ### Preset tooling
18
+
19
+ - **The preset-tree lock is token-owned and reclaim-safe.** `owner.json` now carries a random `token`; `release` refuses a token that does not match, so a `--pid` override or a recycled pid cannot release a stolen lock. Reclaim runs under an exclusive `<lock>.reclaim` guard whose winner re-reads the owner, an owner-less directory younger than 30 s is held as warming instead of stolen (the old `mkdir` + separate `owner.json` write could lose a directory another process had just created), and a stale guard only delays the next reclaimer. `fix:generated`, `check:fast`, and `check:preset-structure` pass the token they acquired.
20
+ - **The generated-tree cache keys on the platform contract.** `presets/<platform>/platform-contract.json` is a generator input, so it joins `presets/cursor/<stack>`, `presets/_shared`, `scripts/lib`, and `package.json` in the cache digest; flipping a stack's release state now misses the cache instead of false-PASSing a stale subtree. `test-generated-cache.mjs` adds a real-generator equivalence check: a cold fill and a hit must byte-match a fresh `generateMavisStack` run.
21
+
22
+ ### Install and upgrade
23
+
24
+ - **A record entry without a source is unattributable.** `.ai.local/.template-base.json` entries without `source` used to fall back to the rendered source, so `doctor` and `update --check` could report `current` — "matches the shipped template" — for bytes the package never attributed. They now report `no recorded source`, the rel is never planned for writing, and a module with no recorded base still takes the `unattributable` path.
25
+ - **One line per engine rel.** `update --fix` printed the write result and then let the drift pass classify the same rel again, producing a duplicate line; the engine plan now owns its rels on both `--check` and `--fix`, so each rel is reported once.
26
+
27
+ ### DefectDojo import scan
28
+
29
+ - **`dd_import_scan` reads inside the project root only.** The report file must be repo-relative: an absolute path (POSIX, Windows drive, UNC), any `..` traversal (raw, percent-encoded, or backslash), and a symlink that leaves the real project root are refused before any read or upload; a malformed encoding is denied closed. Declared integer arguments (`id`, `product`, `engagement`) are validated at runtime, and an unexpected failure returns a generic message to the client while the stack goes to the server log, so a local path never reaches the model.
30
+
31
+ ### Operator app
32
+
33
+ - **The job form runs on one resolver.** The private `apps/team-tasks-ui` create/edit form uses `react-hook-form` with a yup resolver (`mode: 'onTouched'`): submit stays disabled while the model is invalid, a field the API names is marked in place, a create-mode `409` names the duplicate id, and an edit-mode `409` renders the reload banner that re-reads the stored revision.
34
+ - **A lossy write is refused, not invented.** `toJobWrite` returns `null` when a stored definition lacks the field its own kind requires (cron `expression`, interval `everySeconds`, command `argv`, pipeline `promptTemplate`/`runner`); the job detail toggle rejects with `E_VALIDATION` and says to rewrite the definition instead of substituting `''`, `0`, or `[]` into a `PUT`.
35
+ - **Backlog actions validate in place.** The dialog renders a field error through the DS control (`errorMessage`/`note`) and takes `SLUG_PATTERN` from the API layer, so the client and the service share one slug grammar.
36
+
37
+ ### Backlog tracker
38
+
39
+ - **The `backlog` verb family.** `team-db.mjs backlog` adds the file-authoritative plan store (`backlog/items/*.json` committed, `backlog/queue/` ignored): `add`, `set`, `show`, `list`, `ready`, `validate`, `import` (the versioned envelope, idempotent by id, `--dry-run`), `enqueue`, `cancel`, `drain --claim`, `recover` and `prune`. The stored status lattice is the decision; every operational status (`effectiveStatus`, `ready`, `waitingOn`) is derived from the items, the queue entries and the hook-owned task state. The deterministic total order is `priority` ascending (lower runs first, default 5) → `createdAt` → `id`.
40
+ - **The launch queue.** `backlog/config.json` carries `maxActive` (1…8, default 1); a task in a holding state (`in_progress`, `awaiting_artifact_receipt`, `blocked`) occupies a slot, one at a human gate does not. `backlog drain --claim` grants at most one claim and never starts a run; the hook stop seam consumes the claim, re-checks the graph at claim time, and `AI_RULES_TEAM_DB_BACKLOG_DRAIN_DISABLE=1` stops only the auto-drain. Claims older than 90 s with no task row are released on the next drain.
41
+ - **Seven backlog routes.** `GET/POST /api/v1/backlog`, `GET/POST /api/v1/backlog/queue` + `POST …/queue/{entryId}/cancel`, and `GET/PUT /api/v1/backlog/{id}` take the HTTP API from 32 to **39 operations**; migration `0003-backlog` projects the store, and the kill switch `AI_RULES_TEAM_DB_DISABLE=1` turns the projection off while the backlog file verbs stay usable.
42
+ - **Operator pages.** The private `apps/team-tasks-ui` app gains `/backlog` (the ordered list and the queue section of one snapshot, five states at three viewports) and `/backlog/[id]` (dependency state, queue history and the `stored` vs `task` completion source). The no-build `team-db-dashboard.mjs` is unchanged.
43
+ - **Gates.** `test-team-db-backlog.mjs`, `test-team-db-backlog-order.mjs`, `-project`, `-queue`, and `-import` join `yarn test:team-db`, and `test-team-db-schema.mjs` covers migration `0003-backlog`.
44
+
45
+ ### Gates
46
+
47
+ - **The new seams are covered.** `test-team-db-scheduler.mjs` races two starts (one `E_BUSY`, exit `4`), refuses an unknown placeholder, and pins the cmd.exe quote convention; `test-preset-tree-lock.mjs` covers token-guarded release, the warming window, the guard re-read, and a two-contender race; `test-generated-cache.mjs` asserts real-generator equivalence; `test-engine-upgrade.mjs` covers the empty/missing source and the duplicate-line fix; `test-cli-mcp-registration.mjs` covers import containment and error sanitization; `test-cli-update.mjs` covers the seed-when-absent job; `test-chain-team-phases-coverage.mjs` covers bootstrap `skipIf`; `test-upstream-research.mjs` runs from `test:upstream` and the preset-structure composite. Platform smoke runs `doctor` on the five-platform multi install instead of a separate Cursor project.
48
+
49
+ ## 0.2.64
50
+
51
+ ### Composed-order gate, metrics bootstrap, and the shipped aggregator
52
+
53
+ - **Composed-order review.** A re-parenting change now freezes `hostCard.order[]` and per-node `order`/`siblingIndex` in `figma-contract.json`; `mockup-review`, `figma-fidelity` G4, `task-analyst`, `code-reviewer`, and the `ui-change-review-gate` seed require the host card's child order, not only the component subtree. A component-only review is incomplete.
54
+ - **Metrics bootstrap and profile revision.** The chain hook gains an idempotent `bootstrap` action that creates `task_started` and the first `attempt_started` before `steps[0]`; `/task` calls it. A plan revision records `profile_changed` and aligns `metrics.task.profile` with `pipeline.profile`.
55
+ - **Out-of-band accounting.** `out_of_band_start` / `out_of_band_end` record `out_of_band_started` / `out_of_band_finished` with `outOfBandId`, `agent`, `reason`, `durationMs`, `outcome` — reported separately from attempt duration and gate wait, without an invented `attemptId`.
56
+ - **Shipped metrics aggregator.** `aggregate-agent-task-metrics.mjs` ships to `.ai.local/scripts`; it adds `--slug`, per-task `taskReports[]` (`elapsedMs`, `activeMs`, `gateWaitMs`, `outOfBandMs`), and a top-level `outOfBand` summary. `technical-retro` uses it.
57
+ - **Narrow-width a11y sweep.** `figma-fidelity` checks the WCAG 1.4.10 320 px width plus the project's mobile frame widths and samples text-over-artwork pixels; artwork entering the text ink box is a blocker.
58
+
59
+ ### OpenCode task-status plugin
60
+
61
+ - **Shipped TUI sidebar.** `init opencode` and `update` copy `presets/opencode/plugins/task-status/` to `.opencode/plugins/task-status/`; OpenCode auto-loads it from there, so no `opencode.json` `plugins` entry is needed. The plugin shows the active `/task` run in the TUI `sidebar.content` slot (slug, state, elapsed time, current step, soft-stop) and reads `.ai.local/team/` from the session directory. It is TUI-only; OpenCode Desktop does not render it, and the chain hook stays manual.
62
+ - **Managed install surface.** The plugin files join the OpenCode install manifest: `update` refreshes them, `doctor` reports missing/modified copies, and `clean opencode` removes unchanged ones.
63
+ - **Remaining-time estimate.** The sidebar row `eta` shows `~p50 · p90` for the remaining plan steps, from per-agent attempt medians and per-step retry rates across every `metrics.json` under the team root. Calibrated on 66 ledgers: 52% of runs finish below the p50, 89% below the p90; the row hides on a human gate, pause, stale run, or completion. It estimates agent work — gates and step parallelism stay out, so the real wait is often 20–25% shorter.
64
+
65
+ ### Preset update notice
66
+
67
+ - **The `Shape:` sample carries the recorded version.** `check-preset-update.mjs` interpolated `latest` but left `<installed>` as a literal, so an agent that copied the sample verbatim printed the placeholder to the user instead of the installed version.
68
+ - **ZCode installs are checked.** `TOOL_ROOTS` includes `.zcode`, so a ZCode-only install is compared with the latest release and appears in the notice.
69
+
70
+ ### Release gate and a fast loop gate
71
+
72
+ - **`yarn release:gate`.** The full structure composite, the `.ai.local` engine tests, and the strict product-specs dogfood run in one release-only command. It refuses `AI_RULES_SKIP_HOOK_TESTS=1` / `AI_RULES_SKIP_PACK_TESTS=1` and a dirty tracked tree, records the release `HEAD`, and writes a report under `.release-gate/`.
73
+ - **`yarn check:fast`.** The loop gate is now `check-preset-fast.sh` (~50 s: generated drift, twin drift, token budget, frontmatter, consumer links, next attached budget, OpenCode platform contract self-test), not the composite with the hook suites skipped. `test-cli-init-clean` moves to the delta gates and CI.
74
+ - **`yarn check:changed`.** The delta classifier prints `affected loop gates` and a separate `release-only gates` line; the preset-domain list names the targeted checks instead of `check:preset-structure (full)`.
75
+ - **Preset agent DoD.** `feature-developer` and `build-verifier` send preset-source changes to `check:changed` + `check:fast`; the full gate is release-only. The PR checklist separates merge from release.
76
+ - **`check:all` removed.** It duplicated the composite; use `yarn release:gate`.
77
+
78
+ ## 0.2.62
79
+
80
+ ### Engine lock and write audit
81
+
82
+ - **One lock protocol.** `<lock>.d` is the only mutual exclusion for the self-learning journal: a `mkdir` with `owner.json`, no `perl`, no `flock`, no shell. Before, a host with `perl` and a container without it locked different paths (`flock` on the file, `mkdir` on the sibling directory) and could enter together; the `AI_RULES_LOCK_NO_PERL` switch and the short-lived `perl` helper are gone, which also removes one fork per acquisition and the `lock timeout` it could raise while the mutex was free.
83
+ - **Reclaim cannot evict a live owner.** A dead owner is removed inside an atomic `<lock>.d.reclaim` guard, and the owner is re-read after the guard is taken. The previous rename could move a directory another contender had just created, admitting two writers to the journal and the manifest. Fixture: `test-platform-lock-exclusion.mjs` (cross-mode exclusion both ways, plus a five-iteration two-contender reclaim race).
84
+ - **Step-scoped write audit.** `check-write-scope.mjs --step <id> --save-baseline` records every dirty path with its content hash before a step writes; the audit then reports only paths the step created or changed. `--base HEAD` alone attributed every earlier step of the session to the current one, because agents never commit. `--paths` and `--base` stay as escape hatches.
85
+ - **A legacy pipeline is a skip.** `check-write-scope.mjs` exits `3` (SKIP, with `skipReason` and a `hint` in the JSON payload) when the pipeline has no step ids or no `writeScopes`. `build-verifier` records that under `## Soft notes` instead of failing, so a mandatory gate no longer becomes unsatisfiable for work that predates the schema. Step ids are backfillable with `team-db.mjs migrate-tasks`; `writeScopes` are only ever declared by `task-router`.
86
+ - **Install surface.** `.ai.local/.gitignore` gains `team/.write-scope/`; `update` adds the line to an existing ignore file and seeds the unchanged scripts.
87
+
3
88
  ## 0.2.61
4
89
 
5
90
  ### Cross-platform support
package/README.md CHANGED
@@ -28,6 +28,8 @@ Run `init` from the **app root** (`--cwd` if needed). Default `--preset` is `nex
28
28
  | Self-learning engine | **`.ai.local/scripts/`** (shared; sixteen scripts — the six self-learning engine modules, `manifest.mjs`, the seven `team-db*.mjs` projection and scheduler modules, the `upstream-research.mjs` review, and the read-only `check-write-scope.mjs` write audit; existing files never overwritten) | | | |
29
29
  | Specs seed | `docs/specs/` copied only if the directory is **absent** | | | |
30
30
 
31
+ OpenCode also ships **`.opencode/plugins/task-status/`**, a TUI sidebar for the active `/task` run (slug, state, elapsed time, step, remaining-time estimate, soft-stop). OpenCode auto-loads it; it needs no `opencode.json` entry, is refreshed by `update`, and is a viewer only — the chain hook stays manual.
32
+
31
33
  ### Project MCP catalog
32
34
 
33
35
  `init mcp` writes the third-party servers this package ships plus Storybook, DefectDojo, and the packaged GitLab / GitHub / Yandex runtime entries into every installed client; `--tools` narrows the list to the clients you name. Entries render in each client's native shape and merge like `init`: extra servers, the consumer's `env` / `headers`, and other top-level keys stay. Names: `context7`, `playwright` (Claude's id is `playwright-test`), `chrome-devtools`, `next-devtools`, `semgrep`, `sentry`, `figma-desktop` (alias `figma`, the local `http://127.0.0.1:3845/mcp` server), `figma-cloud` (the remote `https://mcp.figma.com/mcp` server), `storybook` (`http://localhost:6200/mcp`), `defectdojo`, `gitlab`, `github`, `yandex-tracker`, and `yandex-wiki`; `--all` selects every one. The last five are packaged runtime entries: they are registered without credentials and need `mcp setup <provider>` once (DefectDojo reads `.env.defectdojo`). Next.js DevTools needs a running `next dev` on Next.js 16+; Semgrep needs the `semgrep` CLI; Sentry uses OAuth.
@@ -52,7 +54,7 @@ node .ai.local/scripts/run.mjs --strict # read-only check: exit 1 when capture
52
54
  node .ai.local/scripts/run.mjs --dry-run # read-only preview: decision, target, before/after, exact writes
53
55
  ```
54
56
 
55
- `build-verifier` and `code-reviewer` also run the read-only write audit `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <step-id>`: it labels every changed path `declared`, `derived`, or `out-of-scope` against the step's `writeScopes`. It is never a hook gate.
57
+ `build-verifier` and `code-reviewer` also run the read-only write audit `node .ai.local/scripts/check-write-scope.mjs --slug <slug> --step <step-id>`: it labels every changed path `declared`, `derived`, or `out-of-scope` against the step's `writeScopes`. The orchestrator saves the step baseline (`--step <step-id> --save-baseline`) before the step writes, so the audit covers that step rather than the whole session. A pipeline that predates `writeScopes` exits `3` (skip), never a failure. It is never a hook gate.
56
58
 
57
59
  `init` seeds the engine with **skip-if-exists** — a modified `run.mjs` stays yours and is reported as kept; there is no
58
60
  `--force`. The seeded tree is byte-identical to `presets/_shared/ai-local/scripts/`, and `.ai.local/.gitignore` (created
@@ -136,6 +138,9 @@ node .ai.local/scripts/team-db.mjs check # schema, fingerprint, i
136
138
  node .ai.local/scripts/team-db.mjs serve # http://127.0.0.1:4178 + dashboard
137
139
  node .ai.local/scripts/team-db.mjs schedule # the timer: claims, runs, captures, reconciles
138
140
  node .ai.local/scripts/team-db.mjs jobs list # definitions + next fire, file-authoritative
141
+ node .ai.local/scripts/team-db.mjs backlog list # the ordered backlog: items, ready set, waiting-on
142
+ node .ai.local/scripts/team-db.mjs backlog enqueue --file <path|-> # record one launch request
143
+ node .ai.local/scripts/team-db.mjs backlog drain --claim # grant one claim, never start a run
139
144
  AI_RULES_TEAM_DB_DISABLE=1 node .ai.local/scripts/team-db.mjs sync # no-op: file-only mode
140
145
  ```
141
146
 
@@ -143,8 +148,8 @@ Requires Node 22.13.0+ for `node:sqlite`; older runtimes stay file-only with one
143
148
  `migrate-tasks` is the one-command path: it creates the database when it is absent and writes
144
149
  only the delta against an existing one, so a fresh workspace and a populated database converge
145
150
  in one invocation.
146
- `team-db.mjs serve` binds loopback only, is read-only apart from the six documented mutations
147
- (`POST /api/v1/sync`, the task delete, and four job writes), and serves the OpenAPI 3.1
151
+ `team-db.mjs serve` binds loopback only, is read-only apart from the ten documented mutations
152
+ (`POST /api/v1/sync`, the task delete, the four job writes and the four backlog writes), and serves the OpenAPI 3.1
148
153
  document at `/openapi.json`. Details, environment names, retention, and rollback:
149
154
  [`docs/TEAM-DB.md`](docs/TEAM-DB.md).
150
155
 
@@ -164,7 +169,9 @@ pre-v2 database is rebuilt from the files on the next `sync`.
164
169
  ### Upstream research
165
170
 
166
171
  The `next` preset ships a weekly `upstream-research` job and a read-only `opencode` agent for
167
- it. The runner (`.ai.local/scripts/upstream-research.mjs`) probes `opencode`, loads
172
+ it. `init`/`update` seed the job definition into `.ai.local/team/scheduler/jobs.json` when the
173
+ file is absent; an operator-edited definition is never overwritten. The runner
174
+ (`.ai.local/scripts/upstream-research.mjs`) probes `opencode`, loads
168
175
  `upstream/projects.json` and `upstream/config.json`, fetches each due clone with
169
176
  `git fetch --depth 1`, labels the window (`range`, `baseline`, `unprovable`, `no-change`),
170
177
  validates the agent's marked JSON, re-checks every citation inside the clone, dedupes by
@@ -217,7 +224,7 @@ Optional check: `yarn check:product-specs [<repo-root>]` (WARN) or `--strict`. T
217
224
 
218
225
  ## Anti-hallucination
219
226
 
220
- Every installed preset ships requestable `anti-hallucination-contract` (not always-on). Writer roles — implementer, unit-test, e2e, qa, and `code-reviewer` — also load that stack's floor stem. `yarn check:preset-structure` fails if a role or skill binding is removed. Register a new skill family in `SKILL_CONTRACT_CLASS` (`writer` or `reader`). Details: [`docs/PRESET-CONTRIBUTION.md`](docs/PRESET-CONTRIBUTION.md).
227
+ Every installed preset ships requestable `anti-hallucination-contract` (not always-on). Writer roles — implementer, unit-test, e2e, qa, and `code-reviewer` — also load that stack's floor stem. `yarn release:gate` fails if a role or skill binding is removed. Register a new skill family in `SKILL_CONTRACT_CLASS` (`writer` or `reader`). Details: [`docs/PRESET-CONTRIBUTION.md`](docs/PRESET-CONTRIBUTION.md).
221
228
 
222
229
  ## Contributing
223
230
 
@@ -227,7 +234,7 @@ Every installed preset ships requestable `anti-hallucination-contract` (not alwa
227
234
  - MCP setup: [`docs/MCP-SETUP.md`](docs/MCP-SETUP.md)
228
235
  - MCP catalog: [`docs/MCP-CATALOG.md`](docs/MCP-CATALOG.md)
229
236
  - Dogfood: [`scripts/sync-dogfood-cursor.sh`](scripts/sync-dogfood-cursor.sh), [`scripts/sync-dogfood-claude.sh`](scripts/sync-dogfood-claude.sh), [`scripts/sync-dogfood-mavis.sh`](scripts/sync-dogfood-mavis.sh), [`scripts/sync-dogfood-opencode.sh`](scripts/sync-dogfood-opencode.sh) — seeds `.ai.local/team`, preserves slugs
230
- - Gates: `yarn check:preset-structure`
237
+ - Gates: loop `yarn check:changed` + `yarn check:fast`; release `yarn release:gate`
231
238
 
232
239
  `_shared` is not an installable `--preset`.
233
240
 
package/bin/cli.js CHANGED
@@ -54,7 +54,7 @@ const {
54
54
  process.on('exit', flushAllAiLocalDriftSummaries);
55
55
 
56
56
  const FAIL_PHASE_ENV = 'AI_RULES_CLI_FAIL_PHASE';
57
- const MANIFEST_SCHEMA_VERSION = 2;
57
+ const { MANIFEST_SCHEMA_VERSION } = require('./lib/manifest-schema');
58
58
 
59
59
  /** Single path segment: letters, digits, dot, underscore, hyphen; no separators or "..". */
60
60
  const PRESET_NAME_RE = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
@@ -828,11 +828,13 @@ function cmdUpdate(cwdOption, opts) {
828
828
  console.log(`update: reinstalling ${plan}`);
829
829
  const packageRoot = getPackageRoot();
830
830
  // One plan per command: the engine classifier reads the record before any pass
831
- // can adopt a rel, and `applyEngineUpgrade` writes after the last pass. `--check`
832
- // previews the engine lines from this same plan — the drift pass must not
833
- // classify them a second time with a source that may not match the record.
831
+ // can adopt a rel, and `applyEngineUpgrade` writes after the last pass. The
832
+ // engine rels are owned on both output paths — `--check` previews the lines
833
+ // from this plan, `--fix` prints the write result — so the drift pass must
834
+ // not classify them a second time with a source that may not match the
835
+ // record (duplicate engine lines).
834
836
  const enginePlan = fix || check ? planEngineUpgrade({ cwd, packageRoot }) : null;
835
- if (check) {
837
+ if (enginePlan) {
836
838
  ownEngineCheck(cwd, new Set(enginePlan.entries.map((entry) => entry.rel)));
837
839
  }
838
840
  // One command, one tree, one summary: each tool's pass accumulates, this flushes.
@@ -375,15 +375,16 @@ const driftTotals = new Map();
375
375
  const claimedRels = new Map();
376
376
 
377
377
  /**
378
- * Engine rels one command previews from its own plan (`update --check`). The
379
- * plan already classifies every engine module with the recorded base `source`,
380
- * which is the source `--fix` writes with; a second classification here would
381
- * print a line from a different predicate (and none at all when the base names
382
- * a tool that has since been cleaned). Command-scoped like {@link driftTotals}.
378
+ * Engine rels one command owns via its plan (`update --check` previews them,
379
+ * `update --fix` prints the write result). The plan already classifies every
380
+ * engine module with the recorded base `source`, which is the source `--fix`
381
+ * writes with; a second classification here would print a line from a
382
+ * different predicate (and none at all when the base names a tool that has
383
+ * since been cleaned). Command-scoped like {@link driftTotals}.
383
384
  */
384
385
  const engineCheckOwners = new Map();
385
386
 
386
- /** Hand the engine rels of one `update --check` command to its `planEngineUpgrade` result. */
387
+ /** Hand the engine rels of one `update --check`/`--fix` command to its `planEngineUpgrade` result. */
387
388
  function ownEngineCheck(cwd, rels) {
388
389
  engineCheckOwners.set(path.resolve(cwd), rels);
389
390
  }
@@ -27,6 +27,7 @@ const ENGINE_SCRIPTS = [
27
27
  'efficacy-oracle.mjs',
28
28
  'manifest.mjs',
29
29
  'team-db.mjs',
30
+ 'team-db-backlog.mjs',
30
31
  'team-db-schema.mjs',
31
32
  'team-db-project.mjs',
32
33
  'team-db-api.mjs',
@@ -39,6 +40,9 @@ const ENGINE_SCRIPTS = [
39
40
  // Read-only post-step write-scope audit used by build-verifier and code-reviewer.
40
41
  // Shells out to git, so it is not part of the self-learning loop module set.
41
42
  'check-write-scope.mjs',
43
+ // Role/task metrics aggregation used by technical-retro; ships with the engine
44
+ // so a consumer can run it from `.ai.local/scripts/` without the package.
45
+ 'aggregate-agent-task-metrics.mjs',
42
46
  ];
43
47
 
44
48
  /** Package `presets/`-relative directory holding the engine source of truth. */
@@ -6,7 +6,8 @@
6
6
  * module is written only when its bytes still equal the digest the package
7
7
  * recorded in `.ai.local/.template-base.json` for a previously shipped
8
8
  * template. A consumer edit is reported `modified` and never touched; a module
9
- * with no recorded base is reported unattributable and never written.
9
+ * with no recorded base — or a record entry without a `source` — is reported
10
+ * unattributable and never written.
10
11
  *
11
12
  * The durable backup (`.ai.local/.rollback/engine-<stamp>/<rel>`, keep the last
12
13
  * five runs) is a user-facing restore point. Failure atomicity is separate: the
@@ -69,7 +70,8 @@ function shippedEngineTemplates(packageRoot) {
69
70
  * States: `current` (already at the template, or adoptable), `stale` (bytes
70
71
  * still equal the recorded base and the template moved — the would-write set),
71
72
  * `modified` (consumer bytes differ from the recorded base), `no-base` (no
72
- * recorded base, so the bytes cannot be attributed), `missing`, `symlink`.
73
+ * recorded base, or a base entry without a source, so the bytes cannot be
74
+ * attributed), `missing`, `symlink`.
73
75
  *
74
76
  * `checkOutcome` carries the row's `decide()` outcome in the shipped
75
77
  * `check <outcome> <rel>` vocabulary, so `update --check` previews the engine
@@ -134,6 +136,12 @@ function planEngineUpgrade({ cwd, packageRoot }) {
134
136
  detail = consumer.normSha256 === template.digest.normSha256
135
137
  ? `matches the shipped ${template.name} template`
136
138
  : `${template.name} differs from the shipped template and ${reason}; bytes cannot be attributed (delete the module and re-run init)`;
139
+ } else if (base && !base.source) {
140
+ // A record entry without a source is never attributed (D-3): mapping it
141
+ // onto the fallback source would let decide() report `current` — doctor
142
+ // saying "matches the shipped template" — for bytes never attributed.
143
+ state = 'no-base';
144
+ detail = `${template.name} has no recorded source; bytes cannot be attributed (delete the module and re-run init)`;
137
145
  } else {
138
146
  const source = (base && base.source) || RECORDED_SOURCE_FALLBACK;
139
147
  const outcome = decide({ consumer, base, template: template.digest, source });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Schema version of the per-tool install manifest (`manifest.json` under the
3
+ * tool root). One constant for every writer: `cli.js` reads and upgrades it
4
+ * and writes the cursor manifest, while the mavis/opencode/zcode installers
5
+ * write their own manifests — a bump cannot forget one of the four writers.
6
+ *
7
+ * A v2 manifest lists only preset files, so `doctor` and update pruning can
8
+ * trust it.
9
+ */
10
+ const MANIFEST_SCHEMA_VERSION = 2;
11
+
12
+ module.exports = { MANIFEST_SCHEMA_VERSION };
@@ -19,6 +19,7 @@ const AI_LOCAL_GITIGNORE = [
19
19
  '# Files written by the in-task self-learning engine and by legacy-team',
20
20
  '# migration backups. Local safety net — never commit.',
21
21
  '*.lock',
22
+ '*.lock.d/',
22
23
  '*.tmp',
23
24
  '.rollback/',
24
25
  '.template-base.json',
@@ -36,6 +37,8 @@ const AI_LOCAL_GITIGNORE = [
36
37
  '# Scheduler runtime state; jobs.json stays tracked (jobs as code).',
37
38
  'team/scheduler/runs/',
38
39
  'team/scheduler/state.json',
40
+ '# Per-step write-scope baselines; derived from git, never a project input.',
41
+ 'team/.write-scope/',
39
42
  'team/upstream/cursor.json',
40
43
  '',
41
44
  ].join('\n');
@@ -354,6 +357,19 @@ function copyTemplates(presetTeamSrc, dest) {
354
357
  copyFile(source, target);
355
358
  written.push(`.ai.local/team/upstream/${name}`);
356
359
  }
360
+ // The shipped weekly `upstream-research` job seeds only when absent, like the
361
+ // research data above: the template carries the definition the docs advertise,
362
+ // and an operator-edited `scheduler/jobs.json` (tracked on purpose — jobs as
363
+ // code) is never overwritten. The scheduler owns the file under
364
+ // `scheduler/`; the template lives beside the other upstream templates.
365
+ {
366
+ const jobsSource = path.join(upstreamSrc, 'jobs.json');
367
+ const jobsTarget = path.join(dest, 'scheduler', 'jobs.json');
368
+ if (fs.existsSync(jobsSource) && !fs.existsSync(jobsTarget)) {
369
+ copyFile(jobsSource, jobsTarget);
370
+ written.push('.ai.local/team/scheduler/jobs.json');
371
+ }
372
+ }
357
373
  const gitkeepSrc = path.join(presetTeamSrc, 'tasks', '.gitkeep');
358
374
  if (fs.existsSync(gitkeepSrc) && !hasConsumerTaskSlugs(path.join(dest, 'tasks'))) {
359
375
  copyFile(gitkeepSrc, path.join(dest, 'tasks', '.gitkeep'));
@@ -4,6 +4,7 @@
4
4
  const fs = require('fs');
5
5
  const path = require('path');
6
6
  const { assertSafeDest, escapesRoot, resolveManagedPath } = require('./lib/safe-path');
7
+ const { MANIFEST_SCHEMA_VERSION } = require('./lib/manifest-schema');
7
8
  const {
8
9
  createInstallTransaction,
9
10
  isPlainObject,
@@ -269,7 +270,9 @@ function cmdInitMavis({ preset, cwdOption, helpers }) {
269
270
  managedFiles[item.rel] = sha256File(item.dest);
270
271
  }
271
272
  const manifest = {
272
- schemaVersion: 1,
273
+ // Shared constant (bin/lib/manifest-schema.js): a v2 manifest lists only
274
+ // preset files, so `doctor` and update pruning can trust it.
275
+ schemaVersion: MANIFEST_SCHEMA_VERSION,
273
276
  packageVersion: packageVersion(packageRoot),
274
277
  platform: 'mavis',
275
278
  preset: stack,
@@ -4,6 +4,7 @@
4
4
  const fs = require('fs');
5
5
  const path = require('path');
6
6
  const { assertSafeDest, escapesRoot, resolveManagedPath } = require('./lib/safe-path');
7
+ const { MANIFEST_SCHEMA_VERSION } = require('./lib/manifest-schema');
7
8
  const {
8
9
  createInstallTransaction,
9
10
  isPlainObject,
@@ -65,7 +66,7 @@ function packageVersion(packageRoot) {
65
66
  return loadJson(path.join(packageRoot, 'package.json')).version;
66
67
  }
67
68
 
68
- function buildPlan({ contract, sourceBase, cwd }) {
69
+ function buildPlan({ contract, sourceBase, sharedSourceBase, cwd }) {
69
70
  const files = [];
70
71
  const seen = new Set();
71
72
  const addFile = (source, destRel) => {
@@ -97,6 +98,18 @@ function buildPlan({ contract, sourceBase, cwd }) {
97
98
  }
98
99
  }
99
100
 
101
+ // Shared platform assets (for example the TUI plugins) live beside the stack
102
+ // directories, so every released preset installs the same copy.
103
+ for (const mapping of contract.sharedDirectoryMappings || []) {
104
+ const sourceDir = path.join(sharedSourceBase, mapping.source);
105
+ if (!fs.existsSync(sourceDir)) {
106
+ continue;
107
+ }
108
+ for (const rel of walkFiles(sourceDir)) {
109
+ addFile(path.join(sourceDir, rel), `${mapping.destination}/${rel}`);
110
+ }
111
+ }
112
+
100
113
  const mcpMd = path.join(sourceBase, 'MCP.md');
101
114
  if (fs.existsSync(mcpMd)) {
102
115
  addFile(mcpMd, path.join(contract.managedRoot, 'MCP.md'));
@@ -403,7 +416,7 @@ function cmdInitOpencode({ preset, cwdOption, helpers }) {
403
416
 
404
417
  try {
405
418
  throwIfPhase('validate');
406
- const plan = buildPlan({ contract, sourceBase, cwd });
419
+ const plan = buildPlan({ contract, sourceBase, sharedSourceBase: sourceRoot, cwd });
407
420
  for (const item of plan.files) {
408
421
  if (!fs.existsSync(item.source)) {
409
422
  throw new Error(`Source missing: ${item.source}`);
@@ -466,14 +479,19 @@ function cmdInitOpencode({ preset, cwdOption, helpers }) {
466
479
  managedFiles[item.rel] = sha256File(item.dest);
467
480
  }
468
481
  const manifest = {
469
- schemaVersion: 1,
482
+ // Shared constant (bin/lib/manifest-schema.js): a v2 manifest lists only
483
+ // preset files, so `doctor` and update pruning can trust it.
484
+ schemaVersion: MANIFEST_SCHEMA_VERSION,
470
485
  packageVersion: packageVersion(packageRoot),
471
486
  platform: 'opencode',
472
487
  preset: stack,
473
488
  installedAt: new Date().toISOString(),
474
489
  managedFiles,
475
490
  mergedConfigs,
476
- managedDirectories: (contract.directoryMappings || []).map((entry) => entry.destination),
491
+ managedDirectories: [
492
+ ...(contract.directoryMappings || []).map((entry) => entry.destination),
493
+ ...(contract.sharedDirectoryMappings || []).map((entry) => entry.destination),
494
+ ],
477
495
  shippedMcpServerIds: plan.mcp ? shippedMcpIds(plan.mcp.source) : [],
478
496
  docsSeed: seeded
479
497
  ? { seeded: true }
@@ -7,6 +7,7 @@
7
7
  const fs = require('fs');
8
8
  const path = require('path');
9
9
  const { assertSafeDest, escapesRoot, resolveManagedPath } = require('./lib/safe-path');
10
+ const { MANIFEST_SCHEMA_VERSION } = require('./lib/manifest-schema');
10
11
  const {
11
12
  createInstallTransaction,
12
13
  isPlainObject,
@@ -366,7 +367,9 @@ function cmdInitZcode({ preset, cwdOption, helpers }) {
366
367
  managedFiles[item.rel] = sha256File(item.dest);
367
368
  }
368
369
  const manifest = {
369
- schemaVersion: 1,
370
+ // Shared constant (bin/lib/manifest-schema.js): a v2 manifest lists only
371
+ // preset files, so `doctor` and update pruning can trust it.
372
+ schemaVersion: MANIFEST_SCHEMA_VERSION,
370
373
  packageVersion: packageVersion(packageRoot),
371
374
  platform: 'zcode',
372
375
  preset: stack,
package/docs/MAVIS.md CHANGED
@@ -115,15 +115,18 @@ Desktop/CLI versions in the compatibility doc are **operator snapshots**, not pa
115
115
  | [`MAVIS-COMPATIBILITY.md`](./MAVIS-COMPATIBILITY.md) | Probe evidence and go/no-go |
116
116
  | [`PRESET-CONTRIBUTION.md`](./PRESET-CONTRIBUTION.md) | Sibling adapter authoring |
117
117
 
118
- Validate after preset edits:
118
+ Validate after preset edits (loop):
119
119
 
120
120
  ```bash
121
121
  cd packages/ai-rules
122
- bash scripts/check-preset-structure.sh
122
+ yarn check:changed
123
+ yarn check:fast
123
124
  node scripts/check-mavis-platform-contract.mjs --self-test
124
125
  node scripts/check-mavis-adapter-map.mjs --self-test
125
126
  ```
126
127
 
128
+ The full `scripts/check-preset-structure.sh` composite runs in `yarn release:gate` before a release.
129
+
127
130
  ## Released stacks
128
131
 
129
132
  `init mavis --preset <stack>` and `init multi --preset <stack>` install Mavis for every stack in `presets/mavis/platform-contract.json` `releasedStacks` (all 11). Per-stack always-on rules live in `scripts/lib/stack-platform-profiles.mjs`. Derive with `node scripts/generate-mavis.mjs --stack <stack>` from Cursor SoT — never from Claude.
@@ -61,7 +61,7 @@ Only clients detected in the project are written (`mcp.json` exists, or the inst
61
61
  | Yandex | `.ai-rules/mcp/config.env` or `YANDEX_ORG_ID` | `ai-rules mcp setup yandex` |
62
62
  | DefectDojo | `.env.defectdojo` (project root, ignored) or `DEFECTDOJO_TOKEN` | `ai-rules mcp setup defectdojo` |
63
63
 
64
- The DefectDojo token is never written by the package. `.env.defectdojo` holds `DEFECTDOJO_URL` and `DEFECTDOJO_TOKEN`; the file must be gitignored. `mcp setup defectdojo` proves the pair with `GET /api/v2/findings/` before registering.
64
+ The DefectDojo token is never written by the package. `.env.defectdojo` holds `DEFECTDOJO_URL` and `DEFECTDOJO_TOKEN`; the file must be gitignored. `mcp setup defectdojo` proves the pair with `GET /api/v2/findings/` before registering. `dd_import_scan` reads the report file only inside the project root — repo-relative paths; absolute paths, `..` traversal, and symlinks pointing outside the root are refused before any read or upload.
65
65
 
66
66
  ## Merge rules
67
67
 
@@ -35,7 +35,8 @@ Allowed status values are `confirmed`, `partial`, `unknown`, `manual`, and `no-e
35
35
  | Workspace agent discovery | `confirmed` | opencode.ai/docs/agents | `.opencode/agents/` | Native |
36
36
  | Workspace Skill discovery | `confirmed` | opencode.ai/docs/skills | `.opencode/skills/<name>/SKILL.md` | Native `skill` tool |
37
37
  | Project MCP | `confirmed` | opencode.ai/docs/mcp-servers | `opencode.json` `mcp` | Merge on init |
38
- | Project hooks (`hooks.json`) | `manual` | plugins exist; this preset does not ship them | No confirmed `subagentStop` analog was opened | Manual `chain-team-phases.sh` |
38
+ | TUI plugin discovery | `confirmed` | opencode.ai/docs/plugins | `.opencode/plugins/<name>/` loads automatically | Ships `task-status` TUI sidebar |
39
+ | Project hooks (`hooks.json`) | `manual` | plugins exist; this preset ships a TUI viewer, not a hook plugin | No confirmed `subagentStop` analog was opened | Manual `chain-team-phases.sh` |
39
40
  | Slash commands | `confirmed` | opencode.ai/docs/commands | `.opencode/commands/<name>.md` | Native `/task` |
40
41
  | Plugin / skill / MCP combo | `confirmed` | skills + mcp docs | MCP inflates context | Gate unused servers in operator config |
41
42
  | Native Team lifecycle | `partial` | file pipeline is ai-rules SoT | No native team runtime | Hook owns `status.json` / `metrics.json` |
@@ -45,7 +46,7 @@ Allowed status values are `confirmed`, `partial`, `unknown`, `manual`, and `no-e
45
46
 
46
47
  - Cursor `alwaysApply` / `globs` on OpenCode
47
48
  - Claude topic-folder twins as the OpenCode source
48
- - Auto-registration of `hooks.json` or a TypeScript plugin in v1
49
+ - Auto-registration of `hooks.json` or a hook plugin in v1
49
50
  - `init opencode --dry-run` / manifest preview (v1 is apply + rollback only)
50
51
  - Writes to `~/.config/opencode/**` or `~/.opencode/**`
51
52
 
package/docs/OPENCODE.md CHANGED
@@ -78,10 +78,30 @@ printf '%s\n' '{"status":"completed","attemptId":"<from-status.json>"}' \
78
78
  | TEAM_TASK_SLUG=<slug> bash .opencode/hooks/chain-team-phases.sh
79
79
  ```
80
80
 
81
- Human gates pause with `awaitingHumanGate: true`. Resume with `/task-continue`. There is **no** shipped `hooks.json` or OpenCode plugin in v1.
81
+ Human gates pause with `awaitingHumanGate: true`. Resume with `/task-continue`. There is **no** shipped `hooks.json` or hook plugin in v1.
82
82
 
83
83
  Full team layout: `.ai.local/team/README.md`.
84
84
 
85
+ ## Task status sidebar (TUI plugin)
86
+
87
+ `.opencode/plugins/task-status/` ships with every OpenCode preset. `init` and
88
+ `update` copy it as a managed file; OpenCode auto-loads every plugin under
89
+ `.opencode/plugins/`, so `opencode.json` needs no `plugins` entry.
90
+
91
+ - Reads the nearest `.ai.local/team/` above the session directory and maps the
92
+ active session to a task by its user messages.
93
+ - Renders slug, state, elapsed time, current step, and a soft-stop button in the
94
+ TUI `sidebar.content` slot. Toggle the sidebar with `ctrl+x b`.
95
+ - Shows a `~p50 · p90` estimate for the remaining steps, built from the attempt
96
+ durations of every ledger under the team root; hidden on a human gate, pause,
97
+ stale run, or completion. It estimates agent work, not wall-clock time.
98
+ - The stop button writes `.ai.local/STOP`; the in-flight attempt finishes and no
99
+ next step starts. Resume with `/task-continue <slug>`.
100
+ - TUI-only: OpenCode Desktop does not render TUI plugins.
101
+
102
+ `update` refreshes the installed copy; `clean opencode` removes unchanged files.
103
+ Do not edit the installed copy in place.
104
+
85
105
  ## MCP
86
106
 
87
107
  Preset servers merge into project **`opencode.json`** `mcp`:
@@ -101,7 +121,7 @@ Labels from official OpenCode docs (live CLI probe not yet run). Full matrix: [`
101
121
  | `.opencode/agents` / `skills` / `commands` | **confirmed** (docs) | Native discovery |
102
122
  | `opencode.json` MCP | **confirmed** (docs) | Merge `mcp` |
103
123
  | Glob / alwaysApply rules | **no-equivalent** | Lazy Read catalog under `.opencode/rules/` |
104
- | `hooks.json` / subagentStop | **manual** | `TEAM_TASK_SLUG=<slug> bash .opencode/hooks/chain-team-phases.sh` after receipts; no plugin in v1 |
124
+ | `hooks.json` / subagentStop | **manual** | `TEAM_TASK_SLUG=<slug> bash .opencode/hooks/chain-team-phases.sh` after receipts; the `task-status` TUI plugin is a viewer, not a hook |
105
125
  | Native Team lifecycle | **partial** | File pipeline is SoT; hook is single lifecycle writer |
106
126
 
107
127
  Do not pin OpenCode CLI or TUI versions in the contract.
@@ -139,15 +159,18 @@ row; the job asserts its resolved rules with `opencode debug agents` before the
139
159
  | [`OPENCODE-COMPATIBILITY.md`](./OPENCODE-COMPATIBILITY.md) | Evidence and go/no-go |
140
160
  | [`PRESET-CONTRIBUTION.md`](./PRESET-CONTRIBUTION.md) | Sibling adapter authoring |
141
161
 
142
- Validate after preset edits:
162
+ Validate after preset edits (loop):
143
163
 
144
164
  ```bash
145
165
  cd packages/ai-rules
146
- bash scripts/check-preset-structure.sh
166
+ yarn check:changed
167
+ yarn check:fast
147
168
  node scripts/check-opencode-platform-contract.mjs --self-test
148
169
  node scripts/check-opencode-adapter-map.mjs --self-test
149
170
  ```
150
171
 
172
+ The full `scripts/check-preset-structure.sh` composite runs in `yarn release:gate` before a release.
173
+
151
174
  ## Released stacks
152
175
 
153
176
  `init opencode --preset <stack>` and `init multi --preset <stack>` install OpenCode for every stack in `presets/opencode/platform-contract.json` `releasedStacks` (all 11). Per-stack always-on rules and `permission.edit` allow-lists live in `scripts/lib/stack-platform-profiles.mjs`. Derive with `node scripts/generate-opencode.mjs --stack <stack>` from Cursor SoT — never from Claude.
package/docs/PLATFORMS.md CHANGED
@@ -12,7 +12,7 @@ macOS and Linux are fully supported. Windows is supported with the prerequisites
12
12
  | Node.js for the `team-db` SQLite projection | **>= 22.13** | `team-db.mjs` uses `node:sqlite`. Below 22.13 the projection degrades to file-only with one diagnostic line; the rest of the engine keeps working. |
13
13
  | `git` | required | Install state, generated-file drift, and every gate read the work tree through `git`. |
14
14
  | `bash` | required for the chain hook only | The Cursor/Claude guard and the hook resolver run through Node. `chain-team-phases.sh` itself is still a bash script. |
15
- | `perl` | optional | The engine lock uses a `perl` `flock` fast path. Without `perl` it falls back to a directory lock with the same mutual exclusion. |
15
+ | `perl` | not required | The engine lock is a sibling directory `<lock>.d` (`mkdir` + `owner.json`), so the same path excludes every process on a shared checkout. No `flock` helper and no shell, so a runtime without `perl` is not a slower path. |
16
16
 
17
17
  ### Windows `bash`
18
18