@bonesofspring/ai-rules 0.2.23 → 0.2.24

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 (285) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +5 -1
  3. package/bin/cli.js +32 -9
  4. package/bin/opencode-install.js +531 -0
  5. package/package.json +10 -3
  6. package/presets/_shared/core/agent-team/agent-team-orchestrator.md +2 -2
  7. package/presets/_shared/core/meta/preset-layering.md +3 -3
  8. package/presets/_shared/core/meta/preset-no-cross-stack-leakage.md +1 -1
  9. package/presets/_shared/core/meta/preset-pr-checklist.md +4 -3
  10. package/presets/_shared/core/meta/preset-token-budget.md +3 -0
  11. package/presets/_shared/core/meta/preset-twin-sync.md +16 -0
  12. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-layering.md +3 -3
  13. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
  14. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +4 -3
  15. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-token-budget.md +3 -0
  16. package/presets/claude/android-kotlin/rules/tooling-and-review/preset-twin-sync.md +16 -0
  17. package/presets/claude/go/rules/tooling-and-review/preset-layering.md +3 -3
  18. package/presets/claude/go/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
  19. package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +4 -3
  20. package/presets/claude/go/rules/tooling-and-review/preset-token-budget.md +3 -0
  21. package/presets/claude/go/rules/tooling-and-review/preset-twin-sync.md +16 -0
  22. package/presets/claude/ios-swift/rules/tooling-and-review/preset-layering.md +3 -3
  23. package/presets/claude/ios-swift/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
  24. package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +4 -3
  25. package/presets/claude/ios-swift/rules/tooling-and-review/preset-token-budget.md +3 -0
  26. package/presets/claude/ios-swift/rules/tooling-and-review/preset-twin-sync.md +16 -0
  27. package/presets/claude/java/rules/tooling-and-review/preset-layering.md +3 -3
  28. package/presets/claude/java/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
  29. package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +4 -3
  30. package/presets/claude/java/rules/tooling-and-review/preset-token-budget.md +3 -0
  31. package/presets/claude/java/rules/tooling-and-review/preset-twin-sync.md +16 -0
  32. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-layering.md +3 -3
  33. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
  34. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +4 -3
  35. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-token-budget.md +3 -0
  36. package/presets/claude/mcp-ts/rules/tooling-and-review/preset-twin-sync.md +16 -0
  37. package/presets/claude/next/REPO_AGENTS.md +10 -5
  38. package/presets/claude/next/agents/build-verifier.md +3 -1
  39. package/presets/claude/next/rules/tooling-and-review/ai-local-overlay.md +1 -1
  40. package/presets/claude/next/rules/tooling-and-review/preset-layering.md +3 -3
  41. package/presets/claude/next/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
  42. package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +4 -3
  43. package/presets/claude/next/rules/tooling-and-review/preset-token-budget.md +3 -0
  44. package/presets/claude/next/rules/tooling-and-review/preset-twin-sync.md +16 -0
  45. package/presets/claude/nuxt/rules/tooling-and-review/preset-layering.md +3 -3
  46. package/presets/claude/nuxt/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
  47. package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +4 -3
  48. package/presets/claude/nuxt/rules/tooling-and-review/preset-token-budget.md +3 -0
  49. package/presets/claude/nuxt/rules/tooling-and-review/preset-twin-sync.md +16 -0
  50. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-layering.md +3 -3
  51. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
  52. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +4 -3
  53. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-token-budget.md +3 -0
  54. package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-twin-sync.md +16 -0
  55. package/presets/claude/php-laravel/rules/tooling-and-review/preset-layering.md +3 -3
  56. package/presets/claude/php-laravel/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
  57. package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +4 -3
  58. package/presets/claude/php-laravel/rules/tooling-and-review/preset-token-budget.md +3 -0
  59. package/presets/claude/php-laravel/rules/tooling-and-review/preset-twin-sync.md +16 -0
  60. package/presets/claude/svelte/rules/tooling-and-review/preset-layering.md +3 -3
  61. package/presets/claude/svelte/rules/tooling-and-review/preset-no-cross-stack-leakage.md +1 -1
  62. package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +4 -3
  63. package/presets/claude/svelte/rules/tooling-and-review/preset-token-budget.md +3 -0
  64. package/presets/claude/svelte/rules/tooling-and-review/preset-twin-sync.md +16 -0
  65. package/presets/cursor/android-kotlin/rules/preset-layering.mdc +3 -3
  66. package/presets/cursor/android-kotlin/rules/preset-no-cross-stack-leakage.mdc +1 -1
  67. package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +4 -3
  68. package/presets/cursor/android-kotlin/rules/preset-token-budget.mdc +3 -0
  69. package/presets/cursor/android-kotlin/rules/preset-twin-sync.mdc +16 -0
  70. package/presets/cursor/go/rules/preset-layering.mdc +3 -3
  71. package/presets/cursor/go/rules/preset-no-cross-stack-leakage.mdc +1 -1
  72. package/presets/cursor/go/rules/preset-pr-checklist.mdc +4 -3
  73. package/presets/cursor/go/rules/preset-token-budget.mdc +3 -0
  74. package/presets/cursor/go/rules/preset-twin-sync.mdc +16 -0
  75. package/presets/cursor/ios-swift/rules/preset-layering.mdc +3 -3
  76. package/presets/cursor/ios-swift/rules/preset-no-cross-stack-leakage.mdc +1 -1
  77. package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +4 -3
  78. package/presets/cursor/ios-swift/rules/preset-token-budget.mdc +3 -0
  79. package/presets/cursor/ios-swift/rules/preset-twin-sync.mdc +16 -0
  80. package/presets/cursor/java/rules/preset-layering.mdc +3 -3
  81. package/presets/cursor/java/rules/preset-no-cross-stack-leakage.mdc +1 -1
  82. package/presets/cursor/java/rules/preset-pr-checklist.mdc +4 -3
  83. package/presets/cursor/java/rules/preset-token-budget.mdc +3 -0
  84. package/presets/cursor/java/rules/preset-twin-sync.mdc +16 -0
  85. package/presets/cursor/mcp-ts/rules/preset-layering.mdc +3 -3
  86. package/presets/cursor/mcp-ts/rules/preset-no-cross-stack-leakage.mdc +1 -1
  87. package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +4 -3
  88. package/presets/cursor/mcp-ts/rules/preset-token-budget.mdc +3 -0
  89. package/presets/cursor/mcp-ts/rules/preset-twin-sync.mdc +16 -0
  90. package/presets/cursor/next/REPO_AGENTS.md +10 -5
  91. package/presets/cursor/next/agents/build-verifier.md +3 -1
  92. package/presets/cursor/next/rules/ai-local-overlay.mdc +1 -1
  93. package/presets/cursor/next/rules/preset-layering.mdc +3 -3
  94. package/presets/cursor/next/rules/preset-no-cross-stack-leakage.mdc +1 -1
  95. package/presets/cursor/next/rules/preset-pr-checklist.mdc +4 -3
  96. package/presets/cursor/next/rules/preset-token-budget.mdc +3 -0
  97. package/presets/cursor/next/rules/preset-twin-sync.mdc +16 -0
  98. package/presets/cursor/nuxt/rules/preset-layering.mdc +3 -3
  99. package/presets/cursor/nuxt/rules/preset-no-cross-stack-leakage.mdc +1 -1
  100. package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +4 -3
  101. package/presets/cursor/nuxt/rules/preset-token-budget.mdc +3 -0
  102. package/presets/cursor/nuxt/rules/preset-twin-sync.mdc +16 -0
  103. package/presets/cursor/php-hexagonal/rules/preset-layering.mdc +3 -3
  104. package/presets/cursor/php-hexagonal/rules/preset-no-cross-stack-leakage.mdc +1 -1
  105. package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +4 -3
  106. package/presets/cursor/php-hexagonal/rules/preset-token-budget.mdc +3 -0
  107. package/presets/cursor/php-hexagonal/rules/preset-twin-sync.mdc +16 -0
  108. package/presets/cursor/php-laravel/rules/preset-layering.mdc +3 -3
  109. package/presets/cursor/php-laravel/rules/preset-no-cross-stack-leakage.mdc +1 -1
  110. package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +4 -3
  111. package/presets/cursor/php-laravel/rules/preset-token-budget.mdc +3 -0
  112. package/presets/cursor/php-laravel/rules/preset-twin-sync.mdc +16 -0
  113. package/presets/cursor/svelte/rules/preset-layering.mdc +3 -3
  114. package/presets/cursor/svelte/rules/preset-no-cross-stack-leakage.mdc +1 -1
  115. package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +4 -3
  116. package/presets/cursor/svelte/rules/preset-token-budget.mdc +3 -0
  117. package/presets/cursor/svelte/rules/preset-twin-sync.mdc +16 -0
  118. package/presets/mavis/next/REPO_AGENTS.md +9 -7
  119. package/presets/mavis/next/adapter-map.json +1 -1
  120. package/presets/mavis/next/agents/build-verifier.md +3 -1
  121. package/presets/mavis/next/rules/agent-team-orchestrator.md +2 -2
  122. package/presets/mavis/next/rules/ai-local-overlay.md +1 -1
  123. package/presets/mavis/next/rules/preset-layering.md +3 -3
  124. package/presets/mavis/next/rules/preset-no-cross-stack-leakage.md +1 -1
  125. package/presets/mavis/next/rules/preset-pr-checklist.md +4 -3
  126. package/presets/mavis/next/rules/preset-token-budget.md +3 -0
  127. package/presets/mavis/next/rules/preset-twin-sync.md +16 -0
  128. package/presets/opencode/README.md +61 -0
  129. package/presets/opencode/next/MCP.md +36 -0
  130. package/presets/opencode/next/OPENCODE.md +65 -0
  131. package/presets/opencode/next/README.md +16 -0
  132. package/presets/opencode/next/REPO_AGENTS.md +97 -0
  133. package/presets/opencode/next/adapter-map.json +959 -0
  134. package/presets/opencode/next/agents/README.md +201 -0
  135. package/presets/opencode/next/agents/accessibility-reviewer.md +73 -0
  136. package/presets/opencode/next/agents/api-contract-reviewer.md +69 -0
  137. package/presets/opencode/next/agents/build-verifier.md +124 -0
  138. package/presets/opencode/next/agents/ci-investigator.md +71 -0
  139. package/presets/opencode/next/agents/code-reviewer.md +73 -0
  140. package/presets/opencode/next/agents/codebase-analyzer.md +33 -0
  141. package/presets/opencode/next/agents/debugger.md +88 -0
  142. package/presets/opencode/next/agents/feature-developer.md +109 -0
  143. package/presets/opencode/next/agents/migration-specialist.md +79 -0
  144. package/presets/opencode/next/agents/mockup-reviewer.md +65 -0
  145. package/presets/opencode/next/agents/openspec-author.md +169 -0
  146. package/presets/opencode/next/agents/performance-auditor.md +80 -0
  147. package/presets/opencode/next/agents/playwright-test-generator.md +36 -0
  148. package/presets/opencode/next/agents/playwright-test-healer.md +36 -0
  149. package/presets/opencode/next/agents/playwright-test-planner.md +33 -0
  150. package/presets/opencode/next/agents/qa-tester.md +60 -0
  151. package/presets/opencode/next/agents/security-reviewer.md +66 -0
  152. package/presets/opencode/next/agents/solution-architect.md +80 -0
  153. package/presets/opencode/next/agents/task-analyst.md +178 -0
  154. package/presets/opencode/next/agents/task-router.md +190 -0
  155. package/presets/opencode/next/agents/tech-writer.md +69 -0
  156. package/presets/opencode/next/agents/unit-test-generator.md +39 -0
  157. package/presets/opencode/next/agents/unit-test-healer.md +40 -0
  158. package/presets/opencode/next/agents/unit-test-planner.md +66 -0
  159. package/presets/opencode/next/commands/README.md +49 -0
  160. package/presets/opencode/next/commands/spec-start.md +32 -0
  161. package/presets/opencode/next/commands/task-continue.md +58 -0
  162. package/presets/opencode/next/commands/task.md +58 -0
  163. package/presets/opencode/next/commands/technical-retro.md +88 -0
  164. package/presets/opencode/next/hooks/README.md +22 -0
  165. package/presets/opencode/next/hooks/chain-team-phases.sh +845 -0
  166. package/presets/opencode/next/opencode.json +33 -0
  167. package/presets/opencode/next/rules/README.md +20 -0
  168. package/presets/opencode/next/rules/agent-team-intake.md +11 -0
  169. package/presets/opencode/next/rules/agent-team-orchestrator.md +214 -0
  170. package/presets/opencode/next/rules/ai-local-overlay.md +37 -0
  171. package/presets/opencode/next/rules/anti-sycophancy-discipline.md +23 -0
  172. package/presets/opencode/next/rules/api-services.md +72 -0
  173. package/presets/opencode/next/rules/architecture-boundaries-ui.md +9 -0
  174. package/presets/opencode/next/rules/architecture-boundaries.md +86 -0
  175. package/presets/opencode/next/rules/arrow-functions.md +25 -0
  176. package/presets/opencode/next/rules/code-quality-and-refactoring.md +40 -0
  177. package/presets/opencode/next/rules/code-review-mr.md +40 -0
  178. package/presets/opencode/next/rules/css-property-order-stylelint.md +5 -0
  179. package/presets/opencode/next/rules/design-guidance.md +99 -0
  180. package/presets/opencode/next/rules/feature-delivery-workflow.md +49 -0
  181. package/presets/opencode/next/rules/http-client.md +55 -0
  182. package/presets/opencode/next/rules/layer-barrel-exports.md +68 -0
  183. package/presets/opencode/next/rules/mcp-usage.md +86 -0
  184. package/presets/opencode/next/rules/mockup-review.md +107 -0
  185. package/presets/opencode/next/rules/navigation-router-stack.md +56 -0
  186. package/presets/opencode/next/rules/navigation-router-ui.md +10 -0
  187. package/presets/opencode/next/rules/next-app-core.md +29 -0
  188. package/presets/opencode/next/rules/next-app-router.md +44 -0
  189. package/presets/opencode/next/rules/no-props-spread.md +56 -0
  190. package/presets/opencode/next/rules/no-type-assertion-as-import-export.md +51 -0
  191. package/presets/opencode/next/rules/package-manager.md +11 -0
  192. package/presets/opencode/next/rules/playwright-agents.md +67 -0
  193. package/presets/opencode/next/rules/post-change-lint.md +35 -0
  194. package/presets/opencode/next/rules/preset-layering.md +27 -0
  195. package/presets/opencode/next/rules/preset-no-cross-stack-leakage.md +90 -0
  196. package/presets/opencode/next/rules/preset-pr-checklist.md +36 -0
  197. package/presets/opencode/next/rules/preset-token-budget.md +39 -0
  198. package/presets/opencode/next/rules/preset-twin-sync.md +81 -0
  199. package/presets/opencode/next/rules/product-specs-authoring.md +112 -0
  200. package/presets/opencode/next/rules/product-specs.md +56 -0
  201. package/presets/opencode/next/rules/public-imports.md +50 -0
  202. package/presets/opencode/next/rules/react-a11y-coding.md +31 -0
  203. package/presets/opencode/next/rules/react-next-anti-hallucination.md +60 -0
  204. package/presets/opencode/next/rules/react-ui.md +105 -0
  205. package/presets/opencode/next/rules/reference-features.md +45 -0
  206. package/presets/opencode/next/rules/security-next.md +45 -0
  207. package/presets/opencode/next/rules/store-rtk.md +78 -0
  208. package/presets/opencode/next/rules/technical-retro.md +11 -0
  209. package/presets/opencode/next/rules/tests-e2e-structure.md +72 -0
  210. package/presets/opencode/next/rules/tests-unit.md +72 -0
  211. package/presets/opencode/next/rules/types-jsdoc.md +43 -0
  212. package/presets/opencode/next/rules/ux-design.md +99 -0
  213. package/presets/opencode/next/skills/README.md +21 -0
  214. package/presets/opencode/next/skills/ci-investigation/SKILL.md +44 -0
  215. package/presets/opencode/next/skills/code-review/SKILL.md +44 -0
  216. package/presets/opencode/next/skills/debug-investigation/SKILL.md +59 -0
  217. package/presets/opencode/next/skills/feature-delivery/SKILL.md +39 -0
  218. package/presets/opencode/next/skills/mockup-review/SKILL.md +29 -0
  219. package/presets/opencode/next/skills/playwright-e2e/SKILL.md +33 -0
  220. package/presets/opencode/next/skills/react-performance/SKILL.md +44 -0
  221. package/presets/opencode/next/skills/spec-authoring/SKILL.md +26 -0
  222. package/presets/opencode/next/skills/spec-discovery/SKILL.md +58 -0
  223. package/presets/opencode/next/skills/technical-retro/SKILL.md +54 -0
  224. package/presets/opencode/next/skills/unit-testing/SKILL.md +34 -0
  225. package/presets/opencode/next/skills/ux-design/SKILL.md +36 -0
  226. package/presets/opencode/next/skills/write-adr/SKILL.md +41 -0
  227. package/presets/opencode/next/team/README.md +148 -0
  228. package/presets/opencode/next/team/conventions.md +21 -0
  229. package/presets/opencode/next/team/fixtures/artifact-manifest.example.json +79 -0
  230. package/presets/opencode/next/team/fixtures/bugfix-standard.json +25 -0
  231. package/presets/opencode/next/team/fixtures/feature-full.json +29 -0
  232. package/presets/opencode/next/team/fixtures/feature-light.json +27 -0
  233. package/presets/opencode/next/team/fixtures/feature-with-figma-url.json +17 -0
  234. package/presets/opencode/next/team/fixtures/feature-with-ux-no-figma.json +17 -0
  235. package/presets/opencode/next/team/fixtures/memlog.example.md +9 -0
  236. package/presets/opencode/next/team/fixtures/metrics-scenarios/tasks/human-gate/metrics.json +69 -0
  237. package/presets/opencode/next/team/fixtures/metrics-scenarios/tasks/missing-ledger/status.json +5 -0
  238. package/presets/opencode/next/team/fixtures/metrics-scenarios/tasks/parallel-receipts/metrics.json +79 -0
  239. package/presets/opencode/next/team/fixtures/metrics-scenarios/tasks/serial-retry/metrics.json +124 -0
  240. package/presets/opencode/next/team/fixtures/metrics-scenarios/tasks/validation-failed/metrics.json +124 -0
  241. package/presets/opencode/next/team/fixtures/metrics.example.json +54 -0
  242. package/presets/opencode/next/team/fixtures/mockup-review-fail-embedded-status.json +8 -0
  243. package/presets/opencode/next/team/fixtures/mockup-review-standalone.json +14 -0
  244. package/presets/opencode/next/team/fixtures/ux-design-standalone.json +15 -0
  245. package/presets/opencode/next/team/tasks/.gitkeep +0 -0
  246. package/presets/opencode/platform-contract.json +131 -0
  247. package/scripts/capture-cli-golden.mjs +5 -1
  248. package/scripts/check-chain-hook-coverage.sh +1 -0
  249. package/scripts/check-opencode-adapter-map.mjs +294 -0
  250. package/scripts/check-opencode-local-overlay.mjs +56 -0
  251. package/scripts/check-opencode-platform-contract.mjs +388 -0
  252. package/scripts/check-opencode-token-budget.mjs +48 -0
  253. package/scripts/check-preset-leakage.sh +30 -1
  254. package/scripts/check-preset-structure.sh +45 -0
  255. package/scripts/check-task-router-intents.sh +4 -4
  256. package/scripts/fixtures/cli-golden/claude/next.json +8 -8
  257. package/scripts/fixtures/cli-golden/cursor/next.json +8 -8
  258. package/scripts/fixtures/cli-golden/mavis/next.json +9 -9
  259. package/scripts/fixtures/cli-golden/opencode/next.json +125 -0
  260. package/scripts/fixtures/opencode-adapter-map/invalid-unmapped/cursor/AGENTS.md +1 -0
  261. package/scripts/fixtures/opencode-adapter-map/invalid-unmapped/cursor/rules/extra.mdc +1 -0
  262. package/scripts/fixtures/opencode-adapter-map/invalid-unmapped/cursor/rules/sample.mdc +2 -0
  263. package/scripts/fixtures/opencode-adapter-map/invalid-unmapped/opencode/OPENCODE.md +1 -0
  264. package/scripts/fixtures/opencode-adapter-map/invalid-unmapped/opencode/adapter-map.json +26 -0
  265. package/scripts/fixtures/opencode-adapter-map/invalid-unmapped/opencode/rules/sample.md +2 -0
  266. package/scripts/fixtures/opencode-adapter-map/valid/cursor/AGENTS.md +1 -0
  267. package/scripts/fixtures/opencode-adapter-map/valid/cursor/rules/sample.mdc +2 -0
  268. package/scripts/fixtures/opencode-adapter-map/valid/opencode/OPENCODE.md +1 -0
  269. package/scripts/fixtures/opencode-adapter-map/valid/opencode/adapter-map.json +26 -0
  270. package/scripts/fixtures/opencode-adapter-map/valid/opencode/rules/sample.md +2 -0
  271. package/scripts/fixtures/opencode-platform-contract/invalid-home-destination.json +131 -0
  272. package/scripts/fixtures/opencode-platform-contract/invalid-missing-capability.json +126 -0
  273. package/scripts/fixtures/opencode-platform-contract/invalid-released-unknown-stack.json +133 -0
  274. package/scripts/fixtures/opencode-platform-contract/invalid-unknown-native-path.json +131 -0
  275. package/scripts/fixtures/opencode-platform-contract/invalid-version-pin.json +132 -0
  276. package/scripts/fixtures/opencode-platform-contract/valid.json +131 -0
  277. package/scripts/generate-mavis-next.mjs +9 -7
  278. package/scripts/generate-opencode-next.mjs +831 -0
  279. package/scripts/lib/discover-hooks.mjs +23 -1
  280. package/scripts/sync-dogfood-mavis.sh +90 -0
  281. package/scripts/sync-dogfood-opencode.sh +85 -0
  282. package/scripts/test-agent-task-metrics-hooks.mjs +4 -1
  283. package/scripts/test-chain-team-phases-coverage.mjs +6 -1
  284. package/scripts/test-cli-init-clean.mjs +111 -0
  285. package/scripts/test-opencode-context-budget.mjs +53 -0
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: tech-writer
3
+ description: "Technical documentation specialist. Writes feature READMEs, migration guides, ADR summaries, and changelog entries from completed task artifacts. Docs-only — never edits production application code."
4
+ mode: subagent
5
+ permission:
6
+ edit:
7
+ "*": deny
8
+ ".opencode/team/**": allow
9
+ ---
10
+
11
+ Write only team artifacts under `.opencode/team/**`. Do not edit production code.
12
+
13
+ You are a technical writer for a Next.js frontend team.
14
+
15
+ ## Inputs
16
+
17
+ 1. `.opencode/team/tasks/<slug>/brief.md`, `decomposition.md`, `architecture.md`, `migration-plan.md`, `review.md` as available.
18
+ 2. Git diff summary or list of changed modules.
19
+ 3. User-specified doc target (e.g. `docs/`, feature README, ADR).
20
+
21
+ ## Deliverable
22
+
23
+ Write `.opencode/team/tasks/<slug>/documentation.md` and/or update paths agreed in the task:
24
+
25
+ ```markdown
26
+ # Documentation: <slug>
27
+
28
+ ## Summary
29
+ One paragraph for stakeholders.
30
+
31
+ ## User-facing changes
32
+ ...
33
+
34
+ ## Developer notes
35
+ Setup, config, new public APIs, migration steps.
36
+
37
+ ## Breaking changes
38
+ ...
39
+
40
+ ## Changelog entry
41
+ Conventional commit / release note snippet.
42
+ ```
43
+
44
+ ## Rules
45
+
46
+ - Write for developers consuming the feature or maintaining the code.
47
+ - Link to relevant rules, skills, and file paths — not vague references.
48
+ - Do not duplicate entire decomposition — summarize outcomes and how to use/extend.
49
+ - May create or update files under `docs/**` when the task explicitly requests it; otherwise keep primary output in team artifacts.
50
+
51
+ ## OpenSpec (`openspec/changes/**`, `openspec/specs/**`)
52
+
53
+ The `openspec/**` file tree is owned by the dedicated agent **`openspec-author`**, not by this agent. When a handoff brief or pipeline step mentions `/opsx:propose`, `/opsx:apply`, `/opsx:archive`, `openspec/changes/`, or `openspec/specs/`, hand off to `openspec-author` instead of authoring here. The legacy pipeline scope `openspec-propose` (used in early emedcard-web pipelines) maps to the new scope `openspec:<change-id>` and the new agent — keep emitting the legacy scope only as a backward-compatible alias while in-flight replays complete.
54
+
55
+ ## Product specs (docs/specs)
56
+
57
+ Post-delivery: when behavior or public docs changed and `docs/specs/` is in play, load **`product-specs`** (+ **`product-specs-authoring`** if updating specs). Sync page/feature specs + INDEX in the **same change set**. **Never invent** product behavior without AC/code source; label inferred lines `status: draft`. Soft-fail on miss; no-op if INDEX absent and sync not requested.
58
+
59
+
60
+ ## Artifact contract
61
+
62
+ - **Authoritative inputs:** read `.opencode/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief/decomposition and available architecture/migration/review artifacts.
63
+ - **Owned outputs:** `documentation.md` (and any explicitly requested docs paths); upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `documentation`) and preserve all foreign entries.
64
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
65
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
66
+
67
+ Suggest `/technical-retro <slug>` when this is the final pipeline step.
68
+
69
+ Do not modify application source under `app/src/**` except documentation paths if explicitly requested.
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: unit-test-generator
3
+ description: "Unit test generation specialist. Implements *.spec.ts and *.spec.tsx from unit-test-plan.md following tests-unit rules. Tests only — does not change production code."
4
+ mode: subagent
5
+ permission:
6
+ edit: allow
7
+ ---
8
+
9
+ You generate unit tests from project test plans.
10
+
11
+ ## Inputs
12
+
13
+ - `.opencode/team/tasks/<slug>/unit-test-plan.md`
14
+ - `.opencode/team/tasks/<slug>/brief.md` for AC alignment
15
+ - Existing specs and test utilities in the target module area
16
+
17
+ ## Rules
18
+
19
+ 1. Follow **`unit-testing` skill** and **`tests-unit.md`**.
20
+ 2. Write specs under the mirrored path `app/src/<rel>` → `app/__tests__/unit/<rel>`; do not colocate them under `app/src/**`.
21
+ 3. Use `@testing-library/react` and `userEvent` for components; project test-store/mocks for store/API.
22
+ 4. `describe` / `it` titles in **Russian**, each sentence starting with a capital letter.
23
+ 5. Do not weaken or skip scenarios from the plan without documenting a blocker in the handoff.
24
+ 6. Do **not** modify production code except test files.
25
+
26
+ ## Completion
27
+
28
+ Run affected unit tests from `app/` when feasible. Report files changed, commands run, failures, and gaps.
29
+
30
+ ## Artifact contract
31
+
32
+ - **Authoritative inputs:** read `.opencode/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for `unit-test-plan.md`, brief/decomposition when present, and target modules.
33
+ - **Owned outputs:** generated/updated `*.spec.ts` / `*.spec.tsx` paths; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `unit-test-generator`) and preserve all foreign entries.
34
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
35
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
36
+
37
+ ## Design guidance
38
+
39
+ - Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit.
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: unit-test-healer
3
+ description: "Unit test healer. Fixes failing or flaky unit tests after refactors while preserving behavior assertions. Tests only — minimal production changes only when tests expose a real bug."
4
+ mode: subagent
5
+ permission:
6
+ edit: allow
7
+ ---
8
+
9
+ You debug and fix failing unit tests.
10
+
11
+ ## Inputs
12
+
13
+ - Failing test output and command.
14
+ - Matching `*.spec.ts` / `*.spec.tsx` and `.opencode/team/tasks/<slug>/unit-test-plan.md` if present.
15
+ - Recent diff that may have caused the failure.
16
+
17
+ Use **`unit-testing` skill**, **`debug-investigation` skill**, and **`tests-unit.md`**.
18
+
19
+ ## Rules
20
+
21
+ 1. Treat `unit-test-plan.md` and AC in `brief.md` as the behavior contract when present.
22
+ 2. Fix mocks, selectors, async timing, and outdated snapshots — not business assertions.
23
+ 3. If production code is wrong and tests are correct → document in handoff; apply minimal fix only with clear evidence.
24
+ 4. Prefer targeted fixes in the affected spec over broad test infrastructure changes.
25
+ 5. Re-run the affected test file when feasible.
26
+
27
+ ## Completion
28
+
29
+ Report root cause, files changed, validation result, and remaining risk.
30
+
31
+ ## Artifact contract
32
+
33
+ - **Authoritative inputs:** read `.opencode/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for failing test evidence, `unit-test-plan.md` when present, and recent diff.
34
+ - **Owned outputs:** healed `*.spec.ts` / `*.spec.tsx` paths (and minimal production fixes only when evidenced); upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `unit-test-healer`) and preserve all foreign entries.
35
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
36
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
37
+
38
+ ## Design guidance
39
+
40
+ - Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit.
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: unit-test-planner
3
+ description: "Unit test planning specialist. Creates coverage plans for mappers, thunks, HTTP client behavior, and component logic. Writes unit-test-plan.md and team status; never edits production code."
4
+ mode: subagent
5
+ permission:
6
+ edit:
7
+ "*": deny
8
+ ".opencode/team/**": allow
9
+ ---
10
+
11
+ Write only team artifacts under `.opencode/team/**`. Do not edit production code.
12
+
13
+ You are a unit test planner for a Next.js frontend with Jest/Vitest and Testing Library.
14
+
15
+ Use the **`unit-testing` skill** and **`tests-unit.md`**.
16
+
17
+ ## Inputs
18
+
19
+ 1. `.opencode/team/tasks/<slug>/brief.md` and `decomposition.md`.
20
+ 2. Changed or target modules under `app/src/**`.
21
+ 3. Existing `*.spec.ts` / `*.spec.tsx` in the same areas.
22
+
23
+ ## Work
24
+
25
+ 1. Map acceptance criteria to test scenarios (mappers, store logic, client behavior, components).
26
+ 2. Identify gaps vs existing specs — do not duplicate covered cases.
27
+ 3. Specify mirrored file paths for planned specs: `app/src/<rel>` → `app/__tests__/unit/<rel>`.
28
+ 4. List behavior branches: happy path, edge cases, error paths.
29
+
30
+ ## Output
31
+
32
+ Write `.opencode/team/tasks/<slug>/unit-test-plan.md`:
33
+
34
+ ```markdown
35
+ # Unit test plan: <slug>
36
+
37
+ ## Scope
38
+ Modules and layers covered.
39
+
40
+ ## Scenarios
41
+ ### <module-path>
42
+ | # | Scenario (RU title for it()) | Type | Priority |
43
+ |---|------------------------------|------|----------|
44
+ | 1 | ... | mapper / thunk / component / client | must |
45
+
46
+ ## Out of scope
47
+ ...
48
+
49
+ ## Notes for generator
50
+ Fixtures, mocks, test-store patterns to reuse.
51
+ ```
52
+
53
+ Test titles in the plan must follow Russian capitalization rules from `tests-unit.md`.
54
+
55
+ ## Artifact contract
56
+
57
+ - **Authoritative inputs:** read `.opencode/team/tasks/<slug>/artifact-manifest.json` first; consume handoff `artifactInputIds` when supplied, otherwise consume the manifest entries for brief/decomposition and target modules under `app/src/**`.
58
+ - **Owned outputs:** `unit-test-plan.md`; upsert only the manifest entry assigned by handoff (`artifactOutputId`; fallback `unit-test-planner`) and preserve all foreign entries.
59
+ - **Terminal receipt:** cover applicable AC/task IDs, list authoritative evidence paths, and emit `completed` or `blocked`. Bind it to the supplied `attemptId` when present.
60
+ - **Shared state:** never create or mutate `status.json` or `metrics.json`; the orchestration runtime/hook owns lifecycle, gates, retries, attempts, and timestamps.
61
+
62
+ Do not write `*.spec.ts` files — that is `unit-test-generator`'s job.
63
+
64
+ ## Design guidance
65
+
66
+ - Load `design-guidance` (rule stem) when assessing structure, smells, or pattern fit.
@@ -0,0 +1,49 @@
1
+ # OpenCode commands (next preset)
2
+
3
+ Slash commands are copied to `.opencode/commands/` on `ai-rules init opencode --preset next`. OpenCode loads `/<filename>` natively.
4
+
5
+ ## Agent commands
6
+
7
+ | Command | Purpose |
8
+ |---------|------------|
9
+ | **`/task <description>`** | **Main entry point:** router → pipeline.json → required roles in order |
10
+ | `/task-continue <slug>` | After human gate or pause |
11
+ | `/technical-retro [slug]` | Retro; with slug — “Agent work” section |
12
+
13
+ ## `/task` examples
14
+
15
+ ```
16
+ /task Добавить фильтр по дате в Order History (Add date filter to Order History) <!-- i18n-keep: E4 -->
17
+ → analyst → developer → reviewer → QA
18
+
19
+ /task Order History падает при пустом списке (Order History crashes on empty list) <!-- i18n-keep: E4 -->
20
+ → debugger → developer → reviewer → QA (regression)
21
+
22
+ /task CI упал на lint в PR #142 (CI failed on lint in PR #142) <!-- i18n-keep: E4 -->
23
+ → ci-investigator → developer → reviewer
24
+
25
+ /task Миграция на Next.js 15 (Migrate to Next.js 15) <!-- i18n-keep: E4 -->
26
+ → analyst → migration-specialist → developer → reviewer → QA
27
+
28
+ /task Проверь доступность модалки оплаты (Check payment modal accessibility) <!-- i18n-keep: E4 -->
29
+ → analyst → developer → a11y-reviewer → code-reviewer
30
+
31
+ /task Покрой unit-тестами mapper orders (Cover orders mapper with unit tests) <!-- i18n-keep: E4 -->
32
+ → unit-planner → unit-generator
33
+
34
+ /task Напиши README для новой фичи фильтров (Write README for new filters feature) <!-- i18n-keep: E4 -->
35
+ → analyst → tech-writer
36
+
37
+ /task Сделай ревью изменений в store/orders (Review changes in store/orders) <!-- i18n-keep: E4 -->
38
+ → reviewer only
39
+ ```
40
+
41
+ ## Related files
42
+
43
+ - Subagents: `../agents/` (**22** roles, including `task-router.md`, `codebase-analyzer.md`)
44
+ - Orchestrator: `../rules/agent-team-orchestrator.md`
45
+ - Skills: `../skills/` (`feature-delivery`, `code-review`, `debug-investigation`, `ci-investigation`, `unit-testing`, `playwright-e2e`, `technical-retro`)
46
+ - Artifacts: `../team/README.md` (`pipeline.json`, `status.json`)
47
+ - Hooks: `../hooks/chain-team-phases.sh` only (semi-auto runner; no `hooks.json`)
48
+
49
+ Create and edit commands via `/commands` in Cursor or directly in this preset folder.
@@ -0,0 +1,32 @@
1
+ ---
2
+ description: Bootstrap or generate docs/specs (INDEX + page/feature) via task-analyst author mode. Optional docs-only path with human gate.
3
+ ---
4
+
5
+ ## Invocation arguments
6
+
7
+ $ARGUMENTS
8
+
9
+ # Spec start — generate / bootstrap product specs
10
+
11
+ Routes intent **`spec-gen`** (or bootstrap) → **task-analyst** in **author mode** → human gate (`after:task-analyst`) → stop, or continue to feature-developer if the user asked to implement after.
12
+
13
+ ## What to do
14
+
15
+ 1. Extract description from arguments after `/spec-start` (domain, page/feature ids, sources).
16
+ 2. Generate a **slug** (kebab-case, ≤48 chars), e.g. `spec-<domain>-<id>`.
17
+ 3. Ensure `.opencode/team/tasks/<slug>/` exists (Write artifacts; not Shell mkdir).
18
+ 4. Write `.opencode/team/active-task.json` → `{ "slug": "<slug>" }`.
19
+ 5. Write minimal `pipeline.json`: task-analyst → (optional stop) → feature-developer only if user asked implement-after. **No separate spec-author agent.**
20
+ 6. Invoke **task-analyst** with: author mode; load **`product-specs`** + **`product-specs-authoring`** + skill **`spec-authoring`**; Bootstrap if `docs/specs/` absent, else Generate. Optional: if arguments/AC ask research-before-spec, also load skill **`spec-discovery`** (not default).
21
+ 7. Wait for analyst. **Do not** invoke feature-developer until human gate passes.
22
+
23
+ ## Human gate
24
+
25
+ - Show created/updated spec paths and INDEX diff.
26
+ - Ask user to approve drafts (`status: draft` → promote) or send edits.
27
+ - Continue: `/task-continue <slug>` only after approval when implementation follows; otherwise stop after docs.
28
+
29
+ ## Notes
30
+
31
+ - Greenfield invent of INDEX is allowed **only** via this command, explicit ask, or AC bootstrap language.
32
+ - mcp-ts: analyst-only author/sync (no tech-writer).
@@ -0,0 +1,58 @@
1
+ ---
2
+ description: Continue an agent-team task after a human gate, pause, or review changes request using pipeline.json and status.json.
3
+ ---
4
+
5
+ ## Invocation arguments
6
+
7
+ $ARGUMENTS
8
+
9
+ # Task continue — after human gate or pause
10
+
11
+ Resume the pipeline from `pipeline.json`.
12
+
13
+ ## Arguments
14
+
15
+ `<slug>` — task identifier.
16
+
17
+ ## Preconditions
18
+
19
+ 1. Read `.opencode/team/tasks/<slug>/pipeline.json` and `status.json`.
20
+ 2. Continue if:
21
+ - `awaitingHumanGate: true` or `state: awaiting_approval`, **or**
22
+ - `state: changes_requested` (after review), **or**
23
+ - the task was interrupted and must resume from `pipelineIndex`.
24
+
25
+ ## Algorithm
26
+
27
+ 1. Write `.opencode/team/active-task.json` → `{ "slug": "<slug>" }`.
28
+ 2. **Human gate resume** (`awaitingHumanGate` / `awaiting_approval`):
29
+ 1. **Do not** manually increment `pipelineIndex` or invent `currentAgent` first.
30
+ 2. Close the gate + activate the next attempt via the **installed** hook (single authority for ledger + status):
31
+
32
+ ```bash
33
+ printf '%s\n' '{"status":"completed","action":"end_human_gate","activateNext":true}' | bash .opencode/hooks/chain-team-phases.sh
34
+ ```
35
+
36
+ 3. Re-read `status.json` (and the hook `followup_message`).
37
+ 4. Invoke the subagent named in `status.currentAgent` / followup — do **not** advance the pipeline a second time.
38
+ 3. **Review `changes_requested`** (not a human gate): if `currentAgent` is **`mockup-reviewer`**, this is the FAIL-only mockup gate — do **not** retry `feature-developer`. Read `mockup-review.md` and resume via the human-gate path (`end_human_gate` / `activateNext`). Otherwise: set `currentAgent` to `feature-developer` (same index / find developer in steps), `state: in_progress`, then invoke developer. Do **not** call `end_human_gate` unless `activeHumanGateEventId` is set.
39
+ 4. **`blocked` + `currentAgent: mockup-reviewer`** (`BLOCKED_MCP`): skip-forward via the same `end_human_gate`/`activateNext` path (explicit «proceed without MCP»). Do not invent DS claims.
40
+ 5. **Other resume**: restore `pipelineIndex` / `currentAgent` from status and invoke that agent.
41
+ 6. After the invoked agent completes, `chain-team-phases.sh` on `subagentStop` continues the chain when `autoChain: true`.
42
+
43
+ ## Artifacts for handoff
44
+
45
+ | Agent | Read |
46
+ |-------|------|
47
+ | feature-developer | brief.md (incl. **Related specs**), decomposition.md, ux-design.md (if present), mockup-review.md (if present), validation-report.md (if retry), review.md (if retry), architecture.md; if `docs/specs/INDEX.md` exists → load **`product-specs`** |
48
+ | build-verifier | git diff, decomposition.md |
49
+ | code-reviewer | brief.md, validation-report.md, git diff |
50
+ | mockup-reviewer | mockup-review.md |
51
+ | qa-tester | brief.md, decomposition.md, scope from pipeline step |
52
+
53
+ ## Product specs (docs/specs)
54
+
55
+ When the next agent is **feature-developer** (or other implementer): if `docs/specs/INDEX.md` exists or brief lists approved specs, instruct them to load **`product-specs`** and honor **Related specs** / approved generated specs as behavior SoT. Soft-fail on miss; never invent product behavior.
56
+
57
+ If analyst ran **author mode**, confirm human approved drafts before developer. Pass spec paths + INDEX diff in the handoff. No-op if INDEX is absent and no approved specs.
58
+
@@ -0,0 +1,58 @@
1
+ ---
2
+ description: Route a natural-language task through the agent-team pipeline: task-router, pipeline.json, and the first planned specialist.
3
+ ---
4
+
5
+ ## Invocation arguments
6
+
7
+ $ARGUMENTS
8
+
9
+ # Task — unified entry point (router + pipeline)
10
+
11
+ Main command for task intake. Parent agent = orchestrator (`agent-team-orchestrator.md`). Intake for work requests without `/task` — `agent-team-intake.md`.
12
+
13
+ ## Arguments
14
+
15
+ Everything after `/task` is the task description in natural language.
16
+
17
+ Examples:
18
+
19
+ - `/task Добавить фильтр по дате в Order History` (Add date filter to Order History) <!-- i18n-keep: E4 -->
20
+ - `/task Order History падает при пустом списке — пофикси` (Order History crashes on empty list — fix it) <!-- i18n-keep: E4 -->
21
+ - `/task CI упал на type-check в PR` (CI failed on type-check in PR) <!-- i18n-keep: E4 -->
22
+ - `/task Миграция HTTP-клиента на fetch` (Migrate HTTP client to fetch) <!-- i18n-keep: E4 -->
23
+ - `/task Проверь a11y формы логина` (Check login form a11y) <!-- i18n-keep: E4 -->
24
+ - `/task Покрой unit-тестами mapper payments` (Cover payments mapper with unit tests) <!-- i18n-keep: E4 -->
25
+ - `/task Напиши changelog для релиза фильтров` (Write changelog for filters release) <!-- i18n-keep: E4 -->
26
+ - `/task Сделай ревью моих изменений в store/orders` (Review my changes in store/orders) <!-- i18n-keep: E4 -->
27
+ - `/task Напиши e2e для сценария оплаты` (Write e2e for payment scenario) <!-- i18n-keep: E4 -->
28
+ - `/task Ревью макета https://figma.com/design/...` (Review a Figma mockup) <!-- i18n-keep: E4 -->
29
+ - `/task Разработай UX для Order History` (Design UX flows without Figma) <!-- i18n-keep: E4 -->
30
+
31
+ ## Procedure
32
+
33
+ 1. **Slug** — kebab-case from the description (≤48 characters). Create `.opencode/team/tasks/<slug>/` via **Write** (e.g. placeholder `pipeline.json` or empty marker) — runtime/hook owns `status.json` — **not** via Shell `mkdir` (sandbox → `Operation not permitted`).
34
+ 2. **Router** — invoke subagent **task-router** with the task description and slug path.
35
+ 3. **Plan** — show the user the table from `pipeline.json`: intent, steps, skipped, humanGates.
36
+ 4. **Intent retro** — if `intent === "retro"`, run `/technical-retro` and **stop**.
37
+ 5. **Start** — after router:
38
+ - confirm `pipeline.json` and `active-task.json`;
39
+ - **do not** write lifecycle fields in `status.json` / `metrics.json` yourself — orchestration runtime/hook owns them (see **agent-artifact-contracts**). If `status.json` is missing, only minimal bootstrap is allowed (`slug`, `intent`, `pipelineIndex: 0`, `currentAgent: steps[0]`, `state: in_progress`) — **do not** increment `pipelineIndex` manually;
40
+ - invoke subagent for `pipeline.steps[0].agent` (slug, artifact paths, scope).
41
+ 6. **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
+ 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>`.
43
+
44
+ ## Do not
45
+
46
+ - Invoke developer before router and (if in pipeline) analyst/architect.
47
+ - Hardcode role order — only `pipeline.json`.
48
+ - Skip human gate without explicit continue.
49
+
50
+ ## If slug is taken
51
+
52
+ - `awaitingHumanGate` / `state: awaiting_approval` → offer artifact review or `/task-continue <slug>`.
53
+ - `in_progress` → ask: continue or new slug.
54
+
55
+
56
+ ## Metrics
57
+
58
+ Runtime/hook owns `metrics.json` and `status.json` attempt ledgers. Before the first invocation ensure `task_started` and one `activeAttempts[attemptId]` + `attempt_started` exist (router/runtime bootstrap — parent must not invent parallel indices). On `/task-continue`, run the installed chain hook `end_human_gate` action (or wrapper) so `human_gate_ended` lands before the next attempt. Do not calculate durations in agents.
@@ -0,0 +1,88 @@
1
+ ---
2
+ description: Facilitate a technical retrospective for a period, incident, release, or completed agent-team task slug.
3
+ ---
4
+
5
+ ## Invocation arguments
6
+
7
+ $ARGUMENTS
8
+
9
+ # Technical retrospective
10
+
11
+ The agent acts as a **neutral facilitator of a technical retrospective**, not as a code reviewer or people evaluator. Use skill **`technical-retro`** as the primary scenario.
12
+
13
+ ## When to use
14
+
15
+ - User asks: "retro", "technical retro", "sprint/iteration review", "action items after release" — also common RU phrasing: «ретро» (retro), «техническое ретро» (technical retro), «разбор спринта/итерации» (sprint/iteration review) <!-- i18n-keep: E4 -->.
16
+ - After completing the agent-team pipeline.
17
+ - Context available: period, topic (release, incident), task slug, notes.
18
+
19
+ ## Inputs (gather; do not invent)
20
+
21
+ Request when missing:
22
+
23
+ - **Period and focus**.
24
+ - **Task slug** (if retro is about agent-team work).
25
+ - **Participants/roles** (if relevant).
26
+ - **Constraints**: time, format (async vs sync).
27
+
28
+ ### Agent-team artifacts (if slug present)
29
+
30
+ Read from the repository:
31
+
32
+ - `.opencode/team/tasks/<slug>/pipeline.json`
33
+ - `.opencode/team/tasks/<slug>/brief.md`
34
+ - `.opencode/team/tasks/<slug>/decomposition.md`
35
+ - `.opencode/team/tasks/<slug>/status.json`
36
+ - Git diff / `git status` for changed files
37
+
38
+ Do not attribute facts not present in artifacts, diff, or the user's message.
39
+
40
+ ## Facilitation principles
41
+
42
+ - **Safety**: process and system, not "blame".
43
+ - **Specificity**: from abstractions to observable events.
44
+ - **Balance**: positives and growth areas.
45
+ - **Action items**: owner and deadline for each.
46
+ - **Do not mix with code review** — separate blocks if both were requested.
47
+
48
+ ## Default session structure
49
+
50
+ 1. **Goal and scope**.
51
+ 2. **Fact gathering**: went well / blocked / surprises.
52
+ 3. **Theme grouping** (3–7).
53
+ 4. **Root causes** for 1–2 painful themes.
54
+ 5. **Experiments** (1–3 process changes).
55
+ 6. **Action items**: what / owner / by when / success criteria.
56
+
57
+ ## "Agent work" block (required when slug present)
58
+
59
+ If retro is tied to an agent-team pipeline:
60
+
61
+ | Question | What to capture |
62
+ |--------|-----------------|
63
+ | Router | Intent error, extra/missing pipeline steps |
64
+ | Analyst | Assumption errors, missed AC, extra/missing tasks |
65
+ | Decomposition | Incomplete layer coverage, wrong order, blocked dependencies |
66
+ | Developer | Scope creep, missed rules, lint/type gaps |
67
+ | Reviewer | Missed defects, false positives, checklist quality |
68
+ | QA | AC test coverage, flakiness, e2e plan gaps |
69
+
70
+ **Action items** in this block — improve **prompts, subagents, and rules** (not only code).
71
+
72
+ ## Response format
73
+
74
+ - Header: period, focus, slug (if any), assumptions.
75
+ - Agenda by stage.
76
+ - **"Agent work"** block (if applicable).
77
+ - Themes — bullets; disputed points — **questions for the team**.
78
+ - **Action items** at the end.
79
+
80
+ ## Constraints
81
+
82
+ - Do not attribute quotes or facts without input.
83
+ - No HR recommendations.
84
+ - If only a template is requested — **agenda template** without invented content.
85
+
86
+ ### Metrics evidence
87
+
88
+ When `metrics.json` exists, run the local aggregation script and report the cohort, sample size, incomplete artifacts, attribution confidence, active attempt duration, and human-gate wait separately. Do not treat gate wait or malformed ledgers as agent duration.
@@ -0,0 +1,22 @@
1
+ # OpenCode hooks
2
+
3
+ No Cursor `hooks.json` and no TypeScript plugin in v1.
4
+
5
+ ## Shipped
6
+
7
+ `chain-team-phases.sh` — manual/semi-auto runner. After a producer receipt:
8
+
9
+ ```bash
10
+ printf '%s\n' '{"status":"completed","attemptId":"<runtime-attempt-id>"}' \
11
+ | bash .opencode/hooks/chain-team-phases.sh
12
+ ```
13
+
14
+ `<runtime-attempt-id>` comes from `.opencode/team/tasks/<slug>/status.json`.
15
+ Do not invent it. Agents never write lifecycle fields in `status.json` or
16
+ `metrics.json`.
17
+
18
+ ## Omitted
19
+
20
+ - `hooks.json` — no native registration schema in this preset
21
+ - `guard-shell-command.sh` — not wired; do not describe it as enforcement
22
+ - `hooks/examples/**` — plugin port is a follow-up