opencode-swarm 7.0.0-beta.1 → 7.0.0

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 (541) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1265 -40
  3. package/dist/__tests__/acknowledge-spec-drift.test.d.ts +1 -0
  4. package/dist/__tests__/cli-version.adversarial.test.d.ts +1 -0
  5. package/dist/__tests__/cli-version.test.d.ts +1 -0
  6. package/dist/__tests__/conflict-resolution.test.d.ts +1 -0
  7. package/dist/__tests__/convene-general-council.test.d.ts +10 -0
  8. package/dist/__tests__/critic_drift_verifier-whitelist.test.d.ts +1 -0
  9. package/dist/__tests__/critic_hallucination_verifier-whitelist.test.d.ts +1 -0
  10. package/dist/__tests__/disagreement-detector.test.d.ts +7 -0
  11. package/dist/__tests__/evidence-lock.adversarial.test.d.ts +8 -0
  12. package/dist/__tests__/evidence-lock.test.d.ts +6 -0
  13. package/dist/__tests__/gate-evidence.adversarial.test.d.ts +7 -0
  14. package/dist/__tests__/general-council-service.test.d.ts +7 -0
  15. package/dist/__tests__/lint-spec.test.d.ts +1 -0
  16. package/dist/__tests__/preflight-phase.test.d.ts +1 -0
  17. package/dist/__tests__/qa-gate-hardening.test.d.ts +12 -0
  18. package/dist/__tests__/req-coverage.test.d.ts +1 -0
  19. package/dist/__tests__/security-adversarial.test.d.ts +1 -0
  20. package/dist/__tests__/sounding-board-parser.test.d.ts +1 -0
  21. package/dist/__tests__/spec-hash.test.d.ts +1 -0
  22. package/dist/__tests__/spec-schema.test.d.ts +1 -0
  23. package/dist/__tests__/web-search-provider.test.d.ts +6 -0
  24. package/dist/__tests__/write-drift-evidence-requirement-coverage.test.d.ts +4 -0
  25. package/dist/adversarial-tests.test.d.ts +1 -0
  26. package/dist/agents/architect-permission.adversarial.test.d.ts +5 -0
  27. package/dist/agents/architect.commands-list.adversarial.test.d.ts +1 -0
  28. package/dist/agents/architect.commands-list.test.d.ts +1 -0
  29. package/dist/agents/architect.d.ts +57 -0
  30. package/dist/agents/architect.dark-matter.test.d.ts +1 -0
  31. package/dist/agents/architect.designer-gate.test.d.ts +1 -0
  32. package/dist/agents/coder.d.ts +2 -0
  33. package/dist/agents/council-member.d.ts +30 -0
  34. package/dist/agents/council-member.test.d.ts +8 -0
  35. package/dist/agents/council-moderator.d.ts +20 -0
  36. package/dist/agents/critic.d.ts +34 -0
  37. package/dist/agents/curator-agent.d.ts +14 -0
  38. package/dist/agents/designer.d.ts +2 -0
  39. package/dist/agents/docs.d.ts +2 -0
  40. package/dist/agents/explorer-consumer-contract.test.d.ts +1 -0
  41. package/dist/agents/explorer-role-boundary.test.d.ts +1 -0
  42. package/dist/agents/explorer.d.ts +5 -0
  43. package/dist/agents/index.d.ts +52 -0
  44. package/dist/agents/reviewer.d.ts +5 -0
  45. package/dist/agents/sme.d.ts +2 -0
  46. package/dist/agents/test-engineer.adversarial.test.d.ts +5 -0
  47. package/dist/agents/test-engineer.d.ts +2 -0
  48. package/dist/agents/test-engineer.security.test.d.ts +1 -0
  49. package/dist/background/circuit-breaker.d.ts +149 -0
  50. package/dist/background/event-bus.d.ts +60 -0
  51. package/dist/background/evidence-summary-integration.d.ts +73 -0
  52. package/dist/background/index.d.ts +22 -0
  53. package/dist/background/manager.d.ts +122 -0
  54. package/dist/background/plan-sync-worker.d.ts +122 -0
  55. package/dist/background/queue.d.ts +117 -0
  56. package/dist/background/status-artifact.d.ts +115 -0
  57. package/dist/background/trigger.d.ts +179 -0
  58. package/dist/background/trigger.vulnerability.test.d.ts +1 -0
  59. package/dist/background/worker.d.ts +92 -0
  60. package/dist/cli/index.d.ts +7 -0
  61. package/dist/cli/index.js +31227 -11423
  62. package/dist/commands/acknowledge-spec-drift.d.ts +5 -0
  63. package/dist/commands/brainstorm.d.ts +13 -0
  64. package/dist/commands/brainstorm.test.d.ts +1 -0
  65. package/dist/commands/checkpoint.d.ts +5 -0
  66. package/dist/commands/close.d.ts +11 -0
  67. package/dist/commands/command-adapters.security.test.d.ts +14 -0
  68. package/dist/commands/commands.test.d.ts +1 -0
  69. package/dist/commands/config.d.ts +5 -0
  70. package/dist/commands/council.d.ts +17 -0
  71. package/dist/commands/council.test.d.ts +4 -0
  72. package/dist/commands/curate.test.d.ts +1 -0
  73. package/dist/commands/doctor.d.ts +17 -0
  74. package/dist/commands/full-auto-config-guard.test.d.ts +7 -0
  75. package/dist/commands/full-auto-discoverability.test.d.ts +8 -0
  76. package/dist/commands/full-auto-registration.test.d.ts +5 -0
  77. package/dist/commands/full-auto-sessionid.test.d.ts +5 -0
  78. package/dist/commands/full-auto.d.ts +10 -0
  79. package/dist/commands/full-auto.regression.test.d.ts +10 -0
  80. package/dist/commands/full-auto.test.d.ts +6 -0
  81. package/dist/commands/index.d.ts +50 -0
  82. package/dist/commands/index.help-text.test.d.ts +1 -0
  83. package/dist/commands/issue.d.ts +13 -0
  84. package/dist/{knowledge.d.ts → commands/knowledge.d.ts} +2 -0
  85. package/dist/commands/pr-review.d.ts +11 -0
  86. package/dist/commands/qa-gates.d.ts +15 -0
  87. package/dist/commands/qa-gates.test.d.ts +1 -0
  88. package/dist/commands/registry-documentation.test.d.ts +1 -0
  89. package/dist/commands/registry-type.test.d.ts +1 -0
  90. package/dist/commands/registry.d.ts +282 -0
  91. package/dist/commands/reset-session.d.ts +7 -0
  92. package/dist/commands/shortcut-routing.test.d.ts +11 -0
  93. package/dist/{sync-plan.d.ts → commands/sync-plan.d.ts} +3 -1
  94. package/dist/commands/turbo-registration.test.d.ts +5 -0
  95. package/dist/commands/turbo-sessionid.test.d.ts +5 -0
  96. package/dist/commands/turbo.regression.test.d.ts +11 -0
  97. package/dist/commands/turbo.test.d.ts +5 -0
  98. package/dist/config/agent-categories.d.ts +12 -0
  99. package/dist/config/cache-paths.d.ts +11 -0
  100. package/dist/config/constants.architect-whitelist.test.d.ts +1 -0
  101. package/dist/config/constants.d.ts +72 -0
  102. package/dist/config/evidence-schema.d.ts +1352 -0
  103. package/dist/config/index.d.ts +11 -0
  104. package/dist/{config.d.ts → config/loader.d.ts} +11 -6
  105. package/dist/config/plan-schema.d.ts +191 -0
  106. package/dist/config/schema.d.ts +1078 -0
  107. package/dist/config/spec-schema.d.ts +113 -0
  108. package/dist/context/role-filter.d.ts +27 -0
  109. package/dist/context/zone-classifier.d.ts +17 -0
  110. package/dist/council/__tests__/council-evidence-writer.adversarial.test.d.ts +6 -0
  111. package/dist/council/council-advisory.d.ts +46 -0
  112. package/dist/council/council-evidence-writer.d.ts +18 -0
  113. package/dist/council/council-service.d.ts +21 -0
  114. package/dist/council/criteria-store.d.ts +9 -0
  115. package/dist/council/disagreement-detector.d.ts +24 -0
  116. package/dist/council/general-council-advisory.d.ts +29 -0
  117. package/dist/council/general-council-service.d.ts +22 -0
  118. package/dist/council/general-council-types.d.ts +98 -0
  119. package/dist/council/types.d.ts +126 -0
  120. package/dist/council/web-search-provider.d.ts +35 -0
  121. package/dist/db/global-db.d.ts +22 -0
  122. package/dist/db/global-db.test.d.ts +7 -0
  123. package/dist/db/index.d.ts +13 -0
  124. package/dist/db/project-db.d.ts +40 -0
  125. package/dist/db/project-db.test.d.ts +4 -0
  126. package/dist/db/qa-gate-profile.d.ts +107 -0
  127. package/dist/db/qa-gate-profile.test.d.ts +4 -0
  128. package/dist/diff/__tests__/semantic-classifier.test.d.ts +1 -0
  129. package/dist/diff/__tests__/summary-generator.test.d.ts +1 -0
  130. package/dist/diff/ast-diff.d.ts +21 -0
  131. package/dist/diff/semantic-classifier.d.ts +59 -0
  132. package/dist/diff/summary-generator.d.ts +33 -0
  133. package/dist/environment/index.d.ts +3 -0
  134. package/dist/environment/profile.d.ts +50 -0
  135. package/dist/environment/prompt-renderer.d.ts +6 -0
  136. package/dist/evidence/index.d.ts +2 -0
  137. package/dist/evidence/lock.d.ts +36 -0
  138. package/dist/evidence/manager.d.ts +78 -0
  139. package/dist/gate-evidence.d.ts +69 -0
  140. package/dist/gate-evidence.test.d.ts +1 -0
  141. package/dist/git/branch.d.ts +70 -0
  142. package/dist/git/index.d.ts +22 -0
  143. package/dist/git/pr.d.ts +28 -0
  144. package/dist/graph/graph-builder.d.ts +39 -0
  145. package/dist/graph/graph-query.d.ts +42 -0
  146. package/dist/graph/graph-store.d.ts +27 -0
  147. package/dist/graph/import-extractor.d.ts +44 -0
  148. package/dist/graph/index.d.ts +16 -0
  149. package/dist/graph/symbol-extractor.d.ts +17 -0
  150. package/dist/graph/types.d.ts +84 -0
  151. package/dist/hooks/__tests__/semantic-diff-injection.test.d.ts +1 -0
  152. package/dist/hooks/adversarial-detector.d.ts +50 -0
  153. package/dist/hooks/agent-activity.d.ts +38 -0
  154. package/dist/hooks/co-change-suggester.d.ts +51 -0
  155. package/dist/hooks/compaction-customizer.d.ts +11 -0
  156. package/dist/hooks/conflict-resolution.d.ts +12 -0
  157. package/dist/hooks/context-budget.d.ts +34 -0
  158. package/dist/hooks/context-scoring.d.ts +70 -0
  159. package/dist/hooks/curator-drift-advisory.test.d.ts +1 -0
  160. package/dist/hooks/curator-drift.d.ts +30 -0
  161. package/dist/hooks/curator-llm-factory.d.ts +20 -0
  162. package/dist/hooks/curator-types.d.ts +103 -0
  163. package/dist/hooks/curator.d.ts +108 -0
  164. package/dist/hooks/dark-matter-detector.d.ts +38 -0
  165. package/dist/hooks/delegation-gate.d.ts +78 -0
  166. package/dist/hooks/delegation-gate.evidence.test.d.ts +4 -0
  167. package/dist/hooks/delegation-gate.getEvidenceTaskId.test.d.ts +20 -0
  168. package/dist/hooks/delegation-gate.plan-fallback-security.test.d.ts +13 -0
  169. package/dist/hooks/delegation-gate.plan-fallback.test.d.ts +5 -0
  170. package/dist/hooks/delegation-gate.seed-state.test.d.ts +1 -0
  171. package/dist/hooks/delegation-gate.turbo-evidence.test.d.ts +8 -0
  172. package/dist/hooks/delegation-gate.verify.test.d.ts +11 -0
  173. package/dist/hooks/delegation-ledger.d.ts +37 -0
  174. package/dist/hooks/delegation-ledger.test.d.ts +11 -0
  175. package/dist/hooks/delegation-sanitizer.d.ts +24 -0
  176. package/dist/hooks/delegation-tracker.d.ts +15 -0
  177. package/dist/hooks/diff-scope.d.ts +12 -0
  178. package/dist/hooks/diff-scope.test.d.ts +1 -0
  179. package/dist/hooks/extractors.d.ts +53 -0
  180. package/dist/hooks/full-auto-intercept.d.ts +77 -0
  181. package/dist/hooks/guardrails.d.ts +174 -0
  182. package/dist/hooks/hive-promoter.d.ts +40 -0
  183. package/dist/hooks/incremental-verify.d.ts +34 -0
  184. package/dist/hooks/incremental-verify.test.d.ts +1 -0
  185. package/dist/hooks/index.d.ts +20 -0
  186. package/dist/hooks/knowledge-curator.d.ts +27 -0
  187. package/dist/hooks/knowledge-injector.d.ts +20 -0
  188. package/dist/hooks/knowledge-migrator.d.ts +11 -0
  189. package/dist/hooks/knowledge-reader.d.ts +22 -0
  190. package/dist/hooks/knowledge-store.d.ts +30 -0
  191. package/dist/hooks/knowledge-types.d.ts +131 -0
  192. package/dist/hooks/knowledge-validator.d.ts +29 -0
  193. package/dist/hooks/loop-detector.d.ts +17 -0
  194. package/dist/hooks/loop-detector.test.d.ts +1 -0
  195. package/dist/hooks/message-priority.d.ts +105 -0
  196. package/dist/hooks/messages-transform.d.ts +13 -0
  197. package/dist/hooks/model-limits.d.ts +96 -0
  198. package/dist/hooks/normalize-tool-name.d.ts +25 -0
  199. package/dist/hooks/phase-monitor.d.ts +29 -0
  200. package/dist/hooks/pipeline-tracker.d.ts +41 -0
  201. package/dist/hooks/repo-graph-builder.d.ts +32 -0
  202. package/dist/hooks/repo-graph-injection.d.ts +45 -0
  203. package/dist/hooks/review-receipt.d.ts +189 -0
  204. package/dist/hooks/scope-guard-throw-behavior.test.d.ts +15 -0
  205. package/dist/hooks/scope-guard.adversarial.test.d.ts +1 -0
  206. package/dist/hooks/scope-guard.d.ts +43 -0
  207. package/dist/hooks/scope-guard.test.d.ts +14 -0
  208. package/dist/hooks/self-review.d.ts +14 -0
  209. package/dist/hooks/self-review.test.d.ts +14 -0
  210. package/dist/hooks/semantic-diff-injection.d.ts +24 -0
  211. package/dist/hooks/slop-detector.adversarial.test.d.ts +1 -0
  212. package/dist/hooks/slop-detector.d.ts +17 -0
  213. package/dist/hooks/slop-detector.test.d.ts +1 -0
  214. package/dist/hooks/spawn-helper.d.ts +5 -0
  215. package/dist/hooks/spawn-helper.test.d.ts +1 -0
  216. package/dist/hooks/steering-consumed.d.ts +30 -0
  217. package/dist/hooks/system-enhancer.d.ts +30 -0
  218. package/dist/hooks/tool-summarizer.d.ts +28 -0
  219. package/dist/hooks/trajectory-logger.d.ts +69 -0
  220. package/dist/hooks/utils.d.ts +20 -0
  221. package/dist/hooks/watchdog.integration.test.d.ts +9 -0
  222. package/dist/index.adversarial-bootstrap.test.d.ts +1 -0
  223. package/dist/index.bootstrap-adversarial.test.d.ts +1 -0
  224. package/dist/index.bootstrap-directory.test.d.ts +1 -0
  225. package/dist/index.d.ts +8 -1
  226. package/dist/index.js +74704 -47714
  227. package/dist/knowledge/identity.d.ts +25 -0
  228. package/dist/knowledge/index.d.ts +2 -0
  229. package/dist/lang/detector.d.ts +20 -0
  230. package/dist/lang/framework-detector.d.ts +98 -0
  231. package/dist/lang/grammars/tree-sitter-dart.wasm +0 -0
  232. package/dist/lang/grammars/tree-sitter-kotlin.wasm +0 -0
  233. package/dist/lang/grammars/tree-sitter-swift.wasm +0 -0
  234. package/dist/lang/grammars/tree-sitter.wasm +0 -0
  235. package/dist/lang/index.d.ts +4 -0
  236. package/dist/lang/profiles.d.ts +72 -0
  237. package/dist/lang/registry.d.ts +24 -0
  238. package/dist/lang/runtime.d.ts +35 -0
  239. package/dist/model-fallback.adversarial.test.d.ts +22 -0
  240. package/dist/model-fallback.test.d.ts +12 -0
  241. package/dist/mutation/__tests__/engine.adversarial.test.d.ts +1 -0
  242. package/dist/mutation/__tests__/engine.test.d.ts +1 -0
  243. package/dist/mutation/__tests__/equivalence.adversarial.test.d.ts +1 -0
  244. package/dist/mutation/__tests__/equivalence.test.d.ts +1 -0
  245. package/dist/mutation/__tests__/gate.adversarial.test.d.ts +1 -0
  246. package/dist/mutation/__tests__/gate.test.d.ts +1 -0
  247. package/dist/mutation/__tests__/generator.test.d.ts +1 -0
  248. package/dist/mutation/engine.d.ts +47 -0
  249. package/dist/mutation/equivalence.d.ts +35 -0
  250. package/dist/mutation/gate.d.ts +28 -0
  251. package/dist/mutation/generator.d.ts +16 -0
  252. package/dist/output/agent-writer.d.ts +27 -0
  253. package/dist/output/index.d.ts +1 -0
  254. package/dist/parallel/dependency-graph.d.ts +34 -0
  255. package/dist/parallel/dispatcher/index.d.ts +12 -0
  256. package/dist/parallel/dispatcher/noop-dispatcher.d.ts +18 -0
  257. package/dist/parallel/dispatcher/noop-dispatcher.test.d.ts +10 -0
  258. package/dist/parallel/dispatcher/parallel-dispatcher.d.ts +18 -0
  259. package/dist/parallel/dispatcher/types.d.ts +33 -0
  260. package/dist/parallel/file-locks.d.ts +40 -0
  261. package/dist/parallel/index.d.ts +5 -0
  262. package/dist/parallel/meta-indexer.d.ts +32 -0
  263. package/dist/parallel/review-router.d.ts +29 -0
  264. package/dist/plan/checkpoint.d.ts +25 -0
  265. package/dist/plan/checkpoint.test.d.ts +1 -0
  266. package/dist/plan/index.d.ts +1 -0
  267. package/dist/plan/ledger-integrity.test.d.ts +5 -0
  268. package/dist/plan/ledger-snapshot-adversarial.test.d.ts +1 -0
  269. package/dist/plan/ledger.d.ts +286 -0
  270. package/dist/plan/ledger.test.d.ts +1 -0
  271. package/dist/plan/manager.cas-backoff.test.d.ts +10 -0
  272. package/dist/plan/manager.d.ts +90 -0
  273. package/dist/plan/manager.ledger-aware.test.d.ts +1 -0
  274. package/dist/plan/manager.loadplan-validation-guard.test.d.ts +13 -0
  275. package/dist/plan/manager.update-task-status.test.d.ts +1 -0
  276. package/dist/plan/migration-revert.regression.test.d.ts +8 -0
  277. package/dist/prm/__tests__/course-correction.test.d.ts +1 -0
  278. package/dist/prm/__tests__/escalation-queue-drain.test.d.ts +1 -0
  279. package/dist/prm/__tests__/escalation.test.d.ts +1 -0
  280. package/dist/prm/__tests__/index.test.d.ts +1 -0
  281. package/dist/prm/__tests__/integration.test.d.ts +1 -0
  282. package/dist/prm/__tests__/pattern-detector.test.d.ts +5 -0
  283. package/dist/prm/__tests__/replay.test.d.ts +1 -0
  284. package/dist/prm/__tests__/trajectory-store.test.d.ts +7 -0
  285. package/dist/prm/course-correction.d.ts +20 -0
  286. package/dist/prm/escalation.d.ts +73 -0
  287. package/dist/prm/index.d.ts +58 -0
  288. package/dist/prm/pattern-detector.d.ts +71 -0
  289. package/dist/prm/replay.d.ts +44 -0
  290. package/dist/prm/trajectory-store.d.ts +66 -0
  291. package/dist/prm/types.d.ts +120 -0
  292. package/dist/quality/index.d.ts +1 -0
  293. package/dist/quality/metrics.d.ts +25 -0
  294. package/dist/sast/rules/c.d.ts +9 -0
  295. package/dist/sast/rules/csharp.d.ts +9 -0
  296. package/dist/sast/rules/go.d.ts +9 -0
  297. package/dist/sast/rules/index.d.ts +72 -0
  298. package/dist/sast/rules/java.d.ts +9 -0
  299. package/dist/sast/rules/javascript.d.ts +9 -0
  300. package/dist/sast/rules/php.d.ts +9 -0
  301. package/dist/sast/rules/python.d.ts +9 -0
  302. package/dist/sast/semgrep.d.ts +68 -0
  303. package/dist/sast/semgrep.test.d.ts +1 -0
  304. package/dist/sbom/cyclonedx.d.ts +101 -0
  305. package/dist/sbom/detectors/dart.d.ts +7 -0
  306. package/dist/sbom/detectors/dotnet.d.ts +7 -0
  307. package/dist/sbom/detectors/go.d.ts +7 -0
  308. package/dist/sbom/detectors/index.d.ts +53 -0
  309. package/dist/sbom/detectors/java.d.ts +7 -0
  310. package/dist/sbom/detectors/nodejs.d.ts +7 -0
  311. package/dist/sbom/detectors/python.d.ts +7 -0
  312. package/dist/sbom/detectors/rust.d.ts +7 -0
  313. package/dist/sbom/detectors/swift.d.ts +7 -0
  314. package/dist/scope/scope-persistence.d.ts +109 -0
  315. package/dist/scope/scope-persistence.test.d.ts +13 -0
  316. package/dist/services/compaction-service.d.ts +28 -0
  317. package/dist/services/compaction-service.test.d.ts +1 -0
  318. package/dist/services/config-doctor.d.ts +125 -0
  319. package/dist/services/config-doctor.security.test.d.ts +1 -0
  320. package/dist/services/config-doctor.test.d.ts +1 -0
  321. package/dist/services/context-budget-service.d.ts +101 -0
  322. package/dist/services/decision-drift-analyzer.d.ts +96 -0
  323. package/dist/services/diagnose-service.d.ts +41 -0
  324. package/dist/services/evidence-service.d.ts +65 -0
  325. package/dist/services/evidence-summary-service.d.ts +75 -0
  326. package/dist/services/export-service.d.ts +30 -0
  327. package/dist/services/handoff-service.d.ts +74 -0
  328. package/dist/services/history-service.d.ts +35 -0
  329. package/dist/services/index.d.ts +13 -0
  330. package/dist/services/plan-service.d.ts +25 -0
  331. package/dist/services/preflight-integration.d.ts +38 -0
  332. package/dist/services/preflight-service.d.ts +62 -0
  333. package/dist/services/run-memory.d.ts +66 -0
  334. package/dist/services/status-service.d.ts +35 -0
  335. package/dist/services/status-service.turbo-indicator.test.d.ts +5 -0
  336. package/dist/services/tool-doctor.d.ts +26 -0
  337. package/dist/services/tool-doctor.test.d.ts +1 -0
  338. package/dist/services/version-check.d.ts +28 -0
  339. package/dist/services/warning-buffer.d.ts +9 -0
  340. package/dist/session/snapshot-reader.d.ts +37 -0
  341. package/dist/session/snapshot-writer.d.ts +115 -0
  342. package/dist/skills/index.d.ts +30 -0
  343. package/dist/state/agent-run-context.d.ts +24 -0
  344. package/dist/state.agent-run-context.test.d.ts +10 -0
  345. package/dist/state.d.ts +501 -1
  346. package/dist/state.rehydrate.test.d.ts +1 -0
  347. package/dist/state.rehydration-adversarial.test.d.ts +1 -0
  348. package/dist/state.rehydration-integration.test.d.ts +1 -0
  349. package/dist/state.session-restart.test.d.ts +7 -0
  350. package/dist/summaries/index.d.ts +2 -0
  351. package/dist/summaries/manager.d.ts +29 -0
  352. package/dist/summaries/summarizer.d.ts +38 -0
  353. package/dist/telemetry.d.ts +59 -0
  354. package/dist/telemetry.test.d.ts +1 -0
  355. package/dist/test-impact/__tests__/analyzer-import-fix.adversarial.test.d.ts +1 -0
  356. package/dist/test-impact/__tests__/analyzer-import-fix.test.d.ts +1 -0
  357. package/dist/test-impact/__tests__/analyzer.adversarial.test.d.ts +1 -0
  358. package/dist/test-impact/__tests__/analyzer.test.d.ts +1 -0
  359. package/dist/test-impact/__tests__/council-fixes.test.d.ts +1 -0
  360. package/dist/test-impact/__tests__/failure-classifier.adversarial.test.d.ts +1 -0
  361. package/dist/test-impact/__tests__/failure-classifier.test.d.ts +1 -0
  362. package/dist/test-impact/__tests__/flaky-detector.adversarial.test.d.ts +1 -0
  363. package/dist/test-impact/__tests__/flaky-detector.test.d.ts +1 -0
  364. package/dist/test-impact/__tests__/history-store.adversarial.test.d.ts +1 -0
  365. package/dist/test-impact/__tests__/history-store.test.d.ts +1 -0
  366. package/dist/test-impact/__tests__/test-impact.adversarial.test.d.ts +1 -0
  367. package/dist/test-impact/__tests__/test-impact.test.d.ts +1 -0
  368. package/dist/test-impact/analyzer.d.ts +9 -0
  369. package/dist/test-impact/failure-classifier.d.ts +26 -0
  370. package/dist/test-impact/flaky-detector.d.ts +14 -0
  371. package/dist/test-impact/history-store.d.ts +15 -0
  372. package/dist/tools/__tests__/barrel-exports.test.d.ts +1 -0
  373. package/dist/tools/__tests__/diff-ast-fallback.test.d.ts +1 -0
  374. package/dist/tools/__tests__/diff-markdown-summary.test.d.ts +1 -0
  375. package/dist/tools/__tests__/diff-semantic.test.d.ts +1 -0
  376. package/dist/tools/__tests__/diff-summary.adversarial.test.d.ts +1 -0
  377. package/dist/tools/__tests__/diff-summary.test.d.ts +1 -0
  378. package/dist/tools/__tests__/mutation-test.adversarial.test.d.ts +1 -0
  379. package/dist/tools/__tests__/mutation-test.sourcefiles.test.d.ts +1 -0
  380. package/dist/tools/__tests__/mutation-test.test.d.ts +1 -0
  381. package/dist/tools/__tests__/test-runner-history.test.d.ts +1 -0
  382. package/dist/tools/__tests__/test-runner-impact.adversarial.test.d.ts +1 -0
  383. package/dist/tools/__tests__/test-runner-impact.test.d.ts +1 -0
  384. package/dist/tools/__tests__/test-runner-source-files.test.d.ts +1 -0
  385. package/dist/tools/barrel-export-check-gate-status.test.d.ts +6 -0
  386. package/dist/tools/batch-symbols.d.ts +24 -0
  387. package/dist/tools/batch-symbols.test.d.ts +1 -0
  388. package/dist/tools/build-check.d.ts +50 -0
  389. package/dist/tools/check-gate-status.adversarial.test.d.ts +1 -0
  390. package/dist/tools/check-gate-status.d.ts +7 -0
  391. package/dist/tools/check-gate-status.gates.test.d.ts +1 -0
  392. package/dist/tools/check-gate-status.plugin-registration.test.d.ts +1 -0
  393. package/dist/tools/checkpoint.d.ts +2 -0
  394. package/dist/tools/co-change-analyzer.d.ts +45 -0
  395. package/dist/tools/completion-verify.d.ts +25 -0
  396. package/dist/tools/complexity-hotspots.d.ts +2 -0
  397. package/dist/tools/convene-council.d.ts +53 -0
  398. package/dist/tools/convene-general-council.d.ts +25 -0
  399. package/dist/{create-tool.d.ts → tools/create-tool.d.ts} +13 -1
  400. package/dist/tools/curator-analyze.d.ts +7 -0
  401. package/dist/tools/curator-analyze.test.d.ts +1 -0
  402. package/dist/tools/declare-council-criteria.d.ts +14 -0
  403. package/dist/tools/declare-scope.d.ts +50 -0
  404. package/dist/tools/diff-summary.d.ts +12 -0
  405. package/dist/tools/diff.d.ts +24 -0
  406. package/dist/tools/doc-scan.d.ts +38 -0
  407. package/dist/tools/domain-detector.d.ts +6 -0
  408. package/dist/tools/evidence-check.d.ts +8 -0
  409. package/dist/tools/file-extractor.d.ts +9 -0
  410. package/dist/tools/generate-mutants.d.ts +15 -0
  411. package/dist/tools/get-approved-plan.d.ts +55 -0
  412. package/dist/tools/get-qa-gate-profile.d.ts +27 -0
  413. package/dist/tools/gitingest.d.ts +18 -0
  414. package/dist/tools/imports.d.ts +5 -0
  415. package/dist/tools/index.d.ts +66 -0
  416. package/dist/tools/knowledge-add.d.ts +2 -0
  417. package/dist/tools/knowledge-query.d.ts +5 -0
  418. package/dist/tools/knowledge-recall.d.ts +2 -0
  419. package/dist/tools/knowledge-remove.d.ts +2 -0
  420. package/dist/tools/knowledge-tools.integration.test.d.ts +1 -0
  421. package/dist/tools/lint-spec.d.ts +2 -0
  422. package/dist/tools/lint.d.ts +63 -0
  423. package/dist/tools/mutation-test.d.ts +2 -0
  424. package/dist/tools/mutation-test.security.test.d.ts +1 -0
  425. package/dist/tools/phase-complete.d.ts +25 -0
  426. package/dist/tools/pkg-audit.d.ts +2 -0
  427. package/dist/tools/placeholder-scan.d.ts +28 -0
  428. package/dist/tools/plugin-registration-adversarial.test.d.ts +1 -0
  429. package/dist/tools/pre-check-batch.d.ts +89 -0
  430. package/dist/tools/quality-budget.d.ts +26 -0
  431. package/dist/tools/repo-graph.d.ts +226 -0
  432. package/dist/tools/repo-map.d.ts +2 -0
  433. package/dist/tools/req-coverage.d.ts +47 -0
  434. package/dist/tools/resolve-working-directory.d.ts +35 -0
  435. package/dist/tools/resolve-working-directory.test.d.ts +1 -0
  436. package/dist/tools/retrieve-summary.d.ts +2 -0
  437. package/dist/tools/sast-baseline.d.ts +126 -0
  438. package/dist/tools/sast-scan.d.ts +87 -0
  439. package/dist/tools/save-plan.d.ts +95 -0
  440. package/dist/tools/save-plan.subdirectory-rejection.test.d.ts +1 -0
  441. package/dist/tools/sbom-generate.d.ts +26 -0
  442. package/dist/tools/schema-drift.d.ts +2 -0
  443. package/dist/tools/search.adversarial.test.d.ts +1 -0
  444. package/dist/tools/search.d.ts +29 -0
  445. package/dist/tools/search.test.d.ts +1 -0
  446. package/dist/tools/secretscan.d.ts +35 -0
  447. package/dist/tools/set-qa-gates.d.ts +40 -0
  448. package/dist/tools/suggest-patch.adversarial.test.d.ts +1 -0
  449. package/dist/tools/suggest-patch.d.ts +37 -0
  450. package/dist/tools/suggest-patch.test.d.ts +1 -0
  451. package/dist/tools/symbols.d.ts +21 -0
  452. package/dist/tools/syntax-check.d.ts +37 -0
  453. package/dist/tools/test-impact.d.ts +2 -0
  454. package/dist/tools/test-runner.d.ts +86 -0
  455. package/dist/tools/test-runner.security-adversarial.test.d.ts +5 -0
  456. package/dist/tools/todo-extract.d.ts +2 -0
  457. package/dist/tools/tool-names.d.ts +10 -0
  458. package/dist/tools/update-task-status.adversarial.test.d.ts +13 -0
  459. package/dist/tools/update-task-status.d.ts +114 -0
  460. package/dist/tools/update-task-status.gates.test.d.ts +1 -0
  461. package/dist/tools/update-task-status.test.d.ts +1 -0
  462. package/dist/tools/update-task-status.turbo-bypass.test.d.ts +1 -0
  463. package/dist/tools/verify-six-tools-registration.test.d.ts +9 -0
  464. package/dist/tools/web-search.d.ts +13 -0
  465. package/dist/tools/write-drift-evidence.d.ts +31 -0
  466. package/dist/tools/write-hallucination-evidence.d.ts +30 -0
  467. package/dist/tools/write-mutation-evidence.d.ts +34 -0
  468. package/dist/tools/write-mutation-evidence.test.d.ts +1 -0
  469. package/dist/tools/write-retro.d.ts +55 -0
  470. package/dist/transient-retry.test.d.ts +10 -0
  471. package/dist/types/delegation.d.ts +24 -0
  472. package/dist/types/events.d.ts +125 -0
  473. package/dist/utils/errors.d.ts +33 -0
  474. package/dist/utils/gitignore-warning.d.ts +17 -0
  475. package/dist/utils/index.d.ts +4 -0
  476. package/dist/utils/logger.d.ts +3 -0
  477. package/dist/utils/merge.d.ts +5 -0
  478. package/dist/utils/path-security.d.ts +36 -0
  479. package/dist/utils/regex.d.ts +30 -0
  480. package/dist/utils/spec-hash.d.ts +15 -0
  481. package/dist/utils/tool-output.d.ts +12 -0
  482. package/dist/validation/task-id.d.ts +43 -0
  483. package/package.json +21 -14
  484. package/dist/architect.d.ts +0 -7
  485. package/dist/checkpoint.d.ts +0 -7
  486. package/dist/co-change-analyzer.d.ts +0 -1
  487. package/dist/compat.d.ts +0 -12
  488. package/dist/config-doctor.d.ts +0 -1
  489. package/dist/detector.d.ts +0 -7
  490. package/dist/diagnose-service.d.ts +0 -1
  491. package/dist/doctor.d.ts +0 -5
  492. package/dist/evidence-schema.d.ts +0 -2
  493. package/dist/evidence-service.d.ts +0 -1
  494. package/dist/export-service.d.ts +0 -1
  495. package/dist/handoff-service.d.ts +0 -1
  496. package/dist/history-service.d.ts +0 -1
  497. package/dist/hive-promoter.d.ts +0 -2
  498. package/dist/knowledge-migrator.d.ts +0 -2
  499. package/dist/knowledge-store.d.ts +0 -1
  500. package/dist/knowledge-types.d.ts +0 -1
  501. package/dist/knowledge-validator.d.ts +0 -2
  502. package/dist/loader.d.ts +0 -1
  503. package/dist/manager.d.ts +0 -1
  504. package/dist/models.d.ts +0 -1
  505. package/dist/plan-service.d.ts +0 -1
  506. package/dist/preflight-service.d.ts +0 -1
  507. package/dist/profiles.d.ts +0 -7
  508. package/dist/register.d.ts +0 -36
  509. package/dist/schema.d.ts +0 -2
  510. package/dist/snapshot-writer.d.ts +0 -1
  511. package/dist/status-service.d.ts +0 -15
  512. package/dist/telemetry/src/events.d.ts +0 -308
  513. package/dist/telemetry/src/guards.d.ts +0 -14
  514. package/dist/telemetry/src/index.d.ts +0 -4
  515. package/dist/telemetry/src/version.d.ts +0 -1
  516. package/dist/utils.d.ts +0 -1
  517. package/dist/write-retro.d.ts +0 -1
  518. /package/dist/{discovery.d.ts → build/discovery.d.ts} +0 -0
  519. /package/dist/{agents.d.ts → commands/agents.d.ts} +0 -0
  520. /package/dist/{analyze.d.ts → commands/analyze.d.ts} +0 -0
  521. /package/dist/{archive.d.ts → commands/archive.d.ts} +0 -0
  522. /package/dist/{benchmark.d.ts → commands/benchmark.d.ts} +0 -0
  523. /package/dist/{clarify.d.ts → commands/clarify.d.ts} +0 -0
  524. /package/dist/{curate.d.ts → commands/curate.d.ts} +0 -0
  525. /package/dist/{dark-matter.d.ts → commands/dark-matter.d.ts} +0 -0
  526. /package/dist/{diagnose.d.ts → commands/diagnose.d.ts} +0 -0
  527. /package/dist/{evidence.d.ts → commands/evidence.d.ts} +0 -0
  528. /package/dist/{export.d.ts → commands/export.d.ts} +0 -0
  529. /package/dist/{handoff.d.ts → commands/handoff.d.ts} +0 -0
  530. /package/dist/{history.d.ts → commands/history.d.ts} +0 -0
  531. /package/dist/{plan.d.ts → commands/plan.d.ts} +0 -0
  532. /package/dist/{preflight.d.ts → commands/preflight.d.ts} +0 -0
  533. /package/dist/{promote.d.ts → commands/promote.d.ts} +0 -0
  534. /package/dist/{reset.d.ts → commands/reset.d.ts} +0 -0
  535. /package/dist/{retrieve.d.ts → commands/retrieve.d.ts} +0 -0
  536. /package/dist/{rollback.d.ts → commands/rollback.d.ts} +0 -0
  537. /package/dist/{simulate.d.ts → commands/simulate.d.ts} +0 -0
  538. /package/dist/{specify.d.ts → commands/specify.d.ts} +0 -0
  539. /package/dist/{status.d.ts → commands/status.d.ts} +0 -0
  540. /package/dist/{turbo.d.ts → commands/turbo.d.ts} +0 -0
  541. /package/dist/{write_retro.d.ts → commands/write-retro.d.ts} +0 -0
package/README.md CHANGED
@@ -1,71 +1,1296 @@
1
- # opencode-swarm
1
+ # OpenCode Swarm
2
2
 
3
- > OpenCode plugin for architect-centric agentic swarm orchestration
3
+ <div align="center">
4
4
 
5
- ## ⚠️ Deprecation Notice
5
+ **Your AI writes the code. Swarm makes sure it actually works.**
6
6
 
7
- **This package is deprecated.**
7
+ [![npm version](https://img.shields.io/npm/v/opencode-swarm?color=brightgreen&label=npm)](https://www.npmjs.com/package/opencode-swarm)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
9
+ [![Tests](https://img.shields.io/badge/tests-6000%2B-success)](https://github.com/zaxbysauce/opencode-swarm)
8
10
 
9
- For new projects, please use [`@opencode-swarm/core`](https://www.npmjs.com/package/@opencode-swarm/core) directly:
11
+ [Website](https://swarmai.site/) · [Getting Started](docs/getting-started.md) · [Configuration](docs/configuration.md) · [Architecture](docs/architecture.md)
10
12
 
11
- ```typescript
12
- // New way (recommended)
13
- import { createCoderAgent } from '@opencode-swarm/core';
13
+ </div>
14
+
15
+ ---
16
+
17
+ OpenCode Swarm is a plugin for [OpenCode](https://opencode.ai) that turns a single AI coding session into an **architect-led team of 17 specialized agents**. One agent writes the code. A different agent reviews it. Another writes and runs tests. Another checks security. **Nothing ships until every required gate passes.**
18
+
19
+ ```bash
20
+ bunx opencode-swarm install
21
+ ```
22
+
23
+ > This single command installs the package, registers it as an OpenCode plugin, disables conflicting default agents, and creates a ready-to-edit config at `~/.config/opencode/opencode-swarm.json`. Requires [Bun](https://bun.sh) (`bun --version` to check). If you must use npm: `npm install -g opencode-swarm && opencode-swarm install`.
24
+
25
+ ### Why Swarm?
26
+
27
+ Most AI coding tools let one model write code and ask that same model whether the code is good. That misses too much. Swarm separates planning, implementation, review, testing, and documentation into specialized internal roles — and enforces gated execution so agents never mutate the codebase in parallel.
28
+
29
+ ### Key Features
30
+
31
+ - 🏗️ **17 specialized agents (9 core + 5 optional + 3 conditional)** — architect, coder, reviewer, test_engineer, critic, explorer, sme, docs, designer, critic_oversight, critic_sounding_board, critic_drift_verifier, critic_hallucination_verifier, curator_init, curator_phase, council_member, council_moderator
32
+ - 🔒 **Gated pipeline** — code never ships without reviewer + test engineer approval
33
+ - 🔄 **Phase completion gates** — completion-verify and drift verifier gates enforced before phase completion
34
+ - 🔁 **Resumable sessions** — all state saved to `.swarm/`; pick up any project any day
35
+ - 🌐 **20 languages** — TypeScript, Python, Go, Rust, Java, Kotlin, C/C++, C#, Ruby, Swift, Dart, PHP, JavaScript, CSS, Bash, PowerShell, INI, Regex
36
+ - 🛡️ **Built-in security** — SAST, secrets scanning, dependency audit per task
37
+ - 🆓 **Free tier** — works with OpenCode Zen's free model roster
38
+ - ⚙️ **Fully configurable** — override any agent's model, disable agents, tune guardrails
39
+
40
+ > **You select a Swarm architect once in the OpenCode GUI.** The architect coordinates all other agents automatically — you never manually switch between internal roles. If you use the default OpenCode `Build` / `Plan` modes, the plugin is bypassed entirely.
41
+
42
+ ---
43
+
44
+ ## What Actually Happens
45
+
46
+ You say:
47
+
48
+ ```text
49
+ Build me a JWT auth system.
50
+ ```
51
+
52
+ Swarm then:
53
+
54
+ 1. Clarifies only what it cannot infer.
55
+ 2. Scans the codebase to understand what already exists.
56
+ 3. Consults domain experts when needed and caches the guidance.
57
+ 4. Writes a phased implementation plan.
58
+ 5. Sends that plan through a critic gate before coding starts.
59
+ 6. Executes one task at a time through the QA pipeline:
60
+
61
+ * coder writes code
62
+ * automated checks run
63
+ * reviewer checks correctness
64
+ * test engineer writes and runs tests
65
+ * architect runs regression sweep
66
+ * failures loop back with structured feedback
67
+
68
+ 7. After each phase, docs and retrospectives are updated.
69
+
70
+ All project state lives in `.swarm/` — plans, evidence, context, knowledge, and telemetry. Resumable by design. If `.swarm/` already exists, the architect goes straight into **RESUME** → **EXECUTE** instead of repeating discovery.
71
+
72
+ ---
73
+
74
+ ## Execution Modes
75
+
76
+ Swarm has two independent mode systems:
77
+
78
+ **Session modes** — toggle per session with a slash command:
79
+
80
+ | Mode | Safety | Speed | When to Use |
81
+ |------|--------|-------|------------|
82
+ | **Balanced** (default) | High | Medium | Everyday development |
83
+ | **Turbo** | Medium | Fast | Rapid iteration; skips Stage B gates for non-Tier-3 files |
84
+ | **Full-Auto** | Depends on critic | Fast | Unattended multi-interaction runs |
85
+
86
+ **Project mode** — persistent via `execution_mode` config key:
87
+
88
+ | Value | Effect |
89
+ |-------|--------|
90
+ | `strict` | Maximum safety — adds slop-detector and incremental-verify hooks |
91
+ | `balanced` (default) | Standard hooks |
92
+ | `fast` | Skips compaction service — for short sessions under context pressure |
93
+
94
+ Switch session modes with `/swarm turbo [on|off]` or `/swarm full-auto [on|off]`. Set project mode in config. The two systems compose independently — see [docs/modes.md](docs/modes.md).
95
+
96
+ ---
97
+
98
+ ## Quick Start
99
+
100
+ **→ For a complete first-run walkthrough, see [Getting Started](docs/getting-started.md).**
101
+
102
+ The 15-minute guide covers:
103
+ - Installation (`bunx opencode-swarm install`)
104
+ - Selecting the architect in OpenCode
105
+ - Running your first task
106
+ - Troubleshooting common issues
107
+
108
+ ---
109
+
110
+ ## Upgrading
111
+
112
+ **OpenCode caches plugins indefinitely.** A normal OpenCode restart does **not**
113
+ pull newer versions from npm — once a plugin is cached, OpenCode keeps using
114
+ that exact copy on every subsequent launch (issue #675). The cache lives in
115
+ one of two places depending on your platform:
116
+
117
+ - Linux / devcontainers / GitHub Codespaces:
118
+ `~/.config/opencode/node_modules/opencode-swarm/`
119
+ - Some macOS / Windows installs:
120
+ `~/.cache/opencode/packages/opencode-swarm@latest/`
121
+
122
+ To upgrade to the latest published version (clears both layouts automatically):
123
+
124
+ ```bash
125
+ bunx opencode-swarm update # cache-only refresh, then restart opencode
126
+ # or
127
+ bunx opencode-swarm install # full reinstall (re-asserts config), then restart opencode
14
128
  ```
15
129
 
16
- This package (`opencode-swarm`) is maintained for backward compatibility only.
130
+ `/swarm diagnose` shows the running version and, when available, the latest
131
+ version on npm so you can tell at a glance whether your cache is stale.
132
+
133
+ To disable the background staleness check entirely, set `version_check: false`
134
+ in your `opencode-swarm.json`.
135
+
136
+ ---
137
+
138
+ ## Commands
17
139
 
18
- ## Installation
140
+ All 41 subcommands at a glance:
19
141
 
20
142
  ```bash
21
- # Install the package
22
- npm install opencode-swarm
143
+ /swarm status # Current phase and task
144
+ /swarm plan [N] # Full plan or filtered by phase
145
+ /swarm agents # Registered agents and models
146
+ /swarm diagnose # Health check
147
+ /swarm evidence [task] # Test and review results
148
+ /swarm reset --confirm # Clear swarm state
149
+ ```
150
+
151
+ See [docs/commands.md](docs/commands.md) for the full reference (41 commands).
152
+
153
+ ---
154
+
155
+ ## The Agents
156
+
157
+ Swarm has 17 specialized agents (9 core + 5 optional + 3 conditional). You don't manually switch between them — the architect coordinates automatically.
23
158
 
24
- # Or with yarn
25
- yarn add opencode-swarm
159
+ | Agent | Role | Badge |
160
+ |---|---|---|
161
+ | **architect** | Orchestrates workflow, writes plans, enforces gates | Core |
162
+ | **explorer** | Scans codebase, gathers context, maps facts | Core |
163
+ | **coder** | Implements one task at a time | Core |
164
+ | **reviewer** | Checks correctness and security | Core |
165
+ | **test_engineer** | Writes and runs tests, adversarial testing | Core |
166
+ | **critic** | Reviews plans before implementation begins | Core |
167
+ | **critic_oversight** | Sole quality gate in full-auto autonomous mode | Core |
168
+ | **sme** | Provides domain expertise guidance | Core |
169
+ | **docs** | Updates documentation to match implementation | Core |
170
+ | **designer** | Generates UI scaffolds and design tokens | Conditional |
171
+ | **critic_sounding_board** | Pre-escalation pushback to the architect | Optional |
172
+ | **critic_drift_verifier** | Verifies implementation matches spec | Optional |
173
+ | **critic_hallucination_verifier** | Verifies APIs and citations against real sources | Optional |
174
+ | **curator_init** | Consolidates prior knowledge at session start | Optional |
175
+ | **curator_phase** | Consolidates phase outcomes, detects workflow drift | Optional |
176
+ | **council_member** | Web-searches and deliberates in General Council | Conditional |
177
+ | **council_moderator** | Synthesizes council deliberation into final answer | Conditional |
26
178
 
27
- # Or with pnpm
28
- pnpm add opencode-swarm
179
+ Legend: Core = always available, Optional = available by default (can be disabled), Conditional = requires specific feature config (ui_review or council)
180
+
181
+ Run `/swarm status` and `/swarm agents` to see what's active.
182
+
183
+ ```mermaid
184
+ graph TB
185
+ subgraph Orchestration
186
+ A[Architect]
187
+ end
188
+
189
+ subgraph Discovery
190
+ E[Explorer]
191
+ end
192
+
193
+ subgraph Execution
194
+ C[Coder]
195
+ T[Test Engineer]
196
+ D[Designer]
197
+ end
198
+
199
+ subgraph Quality
200
+ R[Reviewer]
201
+ CR[Critic]
202
+ CO[Critic Oversight]
203
+ CSB[Critic Sounding Board]
204
+ CDV[Critic Drift Verifier]
205
+ CHV[Critic Hallucination Verifier]
206
+ end
207
+
208
+ subgraph Support
209
+ S[SME]
210
+ DOC[Docs]
211
+ CI[Curator Init]
212
+ CP[Curator Phase]
213
+ end
214
+
215
+ subgraph Council
216
+ CM[Council Member]
217
+ CMO[Council Moderator]
218
+ end
219
+
220
+ A -->|Discover| E
221
+ E -->|Context| A
222
+ A -->|Consult| S
223
+ S -->|Guidance| A
224
+ A -->|Design| D
225
+ D -->|Scaffold| C
226
+ A -->|Implement| C
227
+ C -->|Review| R
228
+ R -->|Verify| A
229
+ C -->|Test| T
230
+ T -->|Results| A
231
+ A -->|Deliberate| CM
232
+ CM -->|Verdict| A
29
233
  ```
30
234
 
31
- ## Migration Guide
235
+ ---
32
236
 
33
- If you're currently using deep imports from `opencode-swarm`, here's how to migrate:
237
+ ## How It Compares
34
238
 
35
- ### Before (deprecated)
36
- ```typescript
37
- // Old way - still works but not recommended
38
- import { createCoderAgent } from 'opencode-swarm';
39
- // or
40
- import { createCoderAgent } from 'opencode-swarm/src/agents';
239
+ | Feature | Swarm | oh-my-opencode | get-shit-done |
240
+ |---|:-:|:-:|:-:|
241
+ | Multiple specialized agents | 17 agents | ❌ | ❌ |
242
+ | Plan reviewed before coding | ✅ | ❌ | ❌ |
243
+ | Every task reviewed + tested | ✅ | ❌ | ❌ |
244
+ | Different model for review vs. code | ✅ | ❌ | ❌ |
245
+ | Resumable sessions | ✅ | ❌ | ❌ |
246
+ | Built-in security scanning | ✅ | ❌ | ❌ |
247
+ | Learns from mistakes | ✅ | ❌ | ❌ |
248
+
249
+ ---
250
+
251
+ ## LLM Provider Guide
252
+
253
+ Swarm works with any provider supported by OpenCode.
254
+
255
+ ### Free Tier (OpenCode Zen)
256
+
257
+ No API key required. Excellent starting point:
258
+
259
+ ```json
260
+ {
261
+ "agents": {
262
+ "coder": { "model": "opencode/minimax-m2.5-free" },
263
+ "reviewer": { "model": "opencode/big-pickle" },
264
+ "explorer": { "model": "opencode/big-pickle" }
265
+ }
266
+ }
41
267
  ```
42
268
 
43
- ### After (recommended)
269
+ ### Paid Providers
270
+
271
+ For production, mix providers by role:
272
+
273
+ | Agent | Recommended | Why |
274
+ |---|---|---|
275
+ | architect | OpenCode UI selection | Needs strongest reasoning |
276
+ | coder | minimax-coding-plan/MiniMax-M2.5 | Fast, accurate code generation |
277
+ | reviewer | zai-coding-plan/glm-5 | Different training from coder |
278
+ | test_engineer | minimax-coding-plan/MiniMax-M2.5 | Same strengths as coder |
279
+ | explorer | google/gemini-2.5-flash | Fast read-heavy analysis |
280
+ | sme | kimi-for-coding/k2p5 | Strong domain expertise |
281
+
282
+ ### Provider Formats
283
+
284
+ | Provider | Format | Example |
285
+ |---|---|---|
286
+ | OpenCode Zen | `opencode/<model>` | `opencode/big-pickle` |
287
+ | Anthropic | `anthropic/<model>` | `anthropic/claude-sonnet-4-20250514` |
288
+ | Google | `google/<model>` | `google/gemini-2.5-flash` |
289
+ | Z.ai | `zai-coding-plan/<model>` | `zai-coding-plan/glm-5` |
290
+ | MiniMax | `minimax-coding-plan/<model>` | `minimax-coding-plan/MiniMax-M2.5` |
291
+ | Kimi | `kimi-for-coding/<model>` | `kimi-for-coding/k2p5` |
292
+
293
+ ### Model Fallback
294
+
295
+ Automatic fallback to a secondary model on transient errors:
296
+
297
+ ```json
298
+ {
299
+ "agents": {
300
+ "coder": {
301
+ "model": "anthropic/claude-sonnet-4-20250514",
302
+ "fallback_models": ["opencode/gpt-5-nano"]
303
+ }
304
+ }
305
+ }
306
+ ```
307
+
308
+ See [docs/configuration.md](docs/configuration.md) for full configuration reference.
309
+
310
+ ---
311
+
312
+ <details>
313
+ <summary><strong>Advanced Topics (Technical Detail)</strong></summary>
314
+
315
+ ### Process Remediation Model (PRM)
316
+
317
+ Swarm monitors agent trajectories and injects course-correction guidance before loops form. Detects five failure patterns:
318
+
319
+ 1. **Repetition Loop** — Same agent performs the same action repeatedly
320
+ 2. **Ping-Pong** — Agents hand off back and forth without progress
321
+ 3. **Expansion Drift** — Plan scope grows beyond original task
322
+ 4. **Stuck-on-Test** — Coder and tests fail in a loop
323
+ 5. **Context Thrashing** — Agent requests increasingly large file sets
324
+
325
+ When detected, escalation levels trigger:
326
+ - Level 1: Advisory guidance injected
327
+ - Level 2: Architect alert sent
328
+ - Level 3: Hard stop directive
329
+
330
+ Configure via:
331
+
332
+ ```json
333
+ {
334
+ "prm": {
335
+ "enabled": true,
336
+ "pattern_thresholds": {
337
+ "repetition_loop": 2,
338
+ "ping_pong": 4,
339
+ "expansion_drift": 3,
340
+ "stuck_on_test": 3,
341
+ "context_thrash": 5
342
+ }
343
+ }
344
+ }
345
+ ```
346
+
347
+ > **Note:** Some configuration fields (`max_trajectory_lines`, `escalation_enabled`) are defined in schema but not yet enforced at runtime.
348
+
349
+ ### Persistent Memory
350
+
351
+ **`.swarm/plan-ledger.jsonl`** — authoritative source of truth (v6.44 durability model)
352
+
353
+ **`.swarm/context.md`** — technical decisions and cached SME guidance
354
+
355
+ **`.swarm/evidence/`** — review/test results per task
356
+
357
+ **`.swarm/telemetry.jsonl`** — session observability events (fire-and-forget, never blocks execution)
358
+
359
+ **`.swarm/curator-summary.json`** — phase-level intelligence and drift reports
360
+
361
+ ### Guardrails & Circuit Breakers
362
+
363
+ Every agent runs inside a circuit breaker that prevents runaway behavior:
364
+
365
+ | Signal | Default Limit |
366
+ |--------|:---:|
367
+ | Tool calls | 200 |
368
+ | Duration | 30 min |
369
+ | Same tool repeated | 10x |
370
+ | Consecutive errors | 5 |
371
+
372
+ Limits reset per task. Per-agent overrides available in config.
373
+
374
+ ### File Authority (Per-Agent Write Permissions)
375
+
376
+ Each agent can only write to specific paths:
377
+
378
+ - **architect** — Everything (except `.swarm/plan.md`, `.swarm/plan.json`)
379
+ - **coder** — `src/`, `tests/`, `docs/`, `scripts/`
380
+ - **reviewer** — `.swarm/evidence/`
381
+ - **test_engineer** — `tests/`, `.swarm/evidence/`
382
+ - **explorer, sme** — Read-only
383
+
384
+ Override via `authority.rules` in config.
385
+
386
+ ### Quality Gates
387
+
388
+ Built-in tools verify every task before it ships:
389
+
390
+ - **syntax_check** — Tree-sitter validation (12 languages)
391
+ - **placeholder_scan** — Catches TODOs, stubs, incomplete code
392
+ - **sast_scan** — 63+ security rules, 9 languages (offline)
393
+ - **sbom_generate** — Dependency tracking (CycloneDX)
394
+ - **quality_budget** — Complexity, duplication, test ratio limits
395
+
396
+ All tools run locally. No Docker, no network calls.
397
+
398
+ ### Context Budget Guard
399
+
400
+ Monitors how much context Swarm injects to prevent overflow:
401
+
402
+ - **Warning threshold (70%)** — Advisory when context reaches ~2800 tokens
403
+ - **Critical threshold (90%)** — Alert at ~3600 tokens with `/swarm handoff` recommendation
404
+ - **Non-nagging** — One-time alerts per session
405
+
406
+ Disable entirely with `context_budget.enabled: false`.
407
+
408
+ ### File Locking for Concurrent Safety
409
+
410
+ Hard lock on `plan.json` (serialized writes), advisory lock on `events.jsonl` (append-only log). Stale locks auto-expire via `proper-lockfile`.
411
+
412
+ ### Agent Categories
413
+
414
+ Agents are classified into four categories for the monitor server `/metadata` endpoint:
415
+
416
+ | Category | Agents |
417
+ |----------|--------|
418
+ | `orchestrator` | architect |
419
+ | `pipeline` | explorer, coder, test_engineer |
420
+ | `qa` | reviewer, critic, critic_sounding_board, critic_drift_verifier |
421
+ | `support` | sme, docs, designer |
422
+
423
+ Use `getAgentCategory(agentName)` from `src/config/agent-categories.ts` to resolve an agent's category at runtime.
424
+
425
+ ---
426
+
427
+ <details>
428
+ <summary><strong>Full Execution Pipeline (Technical Detail)</strong></summary>
429
+
430
+ ### The Pipeline
431
+
432
+ Every task goes through this sequence. No exceptions, no overrides.
433
+
434
+ ```
435
+ MODE: EXECUTE (per task)
436
+
437
+ ├── 5a. @coder implements (ONE task only)
438
+ ├── 5b. diff + imports (contract + dependency analysis + semantic diff context)
439
+ │ └── @system-enhancer injects AST-based semantic diff summary with blast radius
440
+ │ into @reviewer context (up to 10 files, conditional on declared scope)
441
+ ├── 5c. syntax_check (parse validation)
442
+ ├── 5d. placeholder_scan (catches TODOs, stubs, incomplete code)
443
+ ├── 5e. lint fix → lint check
444
+ ├── 5f. build_check (does it compile?)
445
+ ├── 5g. pre_check_batch (4 parallel: lint, secretscan, SAST, quality budget)
446
+ ├── 5h. @reviewer (correctness pass)
447
+ ├── 5i. @reviewer (security pass, if security-sensitive files changed)
448
+ ├── 5j. @test_engineer (verification tests + coverage ≥70%)
449
+ ├── 5k. @test_engineer (adversarial tests)
450
+ ├── 5l. architect regression sweep (scope:"graph" to find cross-task test regressions)
451
+ ├── 5l-ter. test drift detection (conditional — fires when changes involve command behaviour,
452
+ │ parsing/routing logic, user-visible output, public contracts, assertion-heavy areas,
453
+ │ or helper lifecycle changes; validates tests still align with current behaviour)
454
+ ├── 5m. ⛔ Pre-commit checklist (all 4 items required, no override)
455
+ └── 5n. Task marked complete, evidence written
456
+ ```
457
+
458
+ If any step fails, the coder gets structured feedback and retries. After 5 failures on the same task, it escalates to you.
459
+
460
+ ### Architect Workflow Modes
461
+
462
+ The architect moves through these modes automatically:
463
+
464
+ | Mode | What It Means |
465
+ |---|---|
466
+ | `RESUME` | Existing `.swarm/` state was found, so Swarm continues where it left off |
467
+ | `CLARIFY` | Swarm asks for missing information it cannot infer |
468
+ | `DISCOVER` | Explorer scans the codebase; co-change dark matter analysis runs automatically to detect hidden file couplings (v6.41) |
469
+ | `CONSULT` | SME agents provide domain guidance |
470
+ | `PLAN` | Architect writes or updates the phased plan (includes CODEBASE REALITY CHECK on brownfield projects) |
471
+ | `CRITIC-GATE` | Critic reviews the plan before execution |
472
+ | `EXECUTE` | Tasks are implemented one at a time through the QA pipeline |
473
+ | `PHASE-WRAP` | A phase closes out, including: explorer rescan, docs update, `context.md` update, `write_retro`, evidence check, `sbom_generate`, **`@critic_drift_verifier` delegation** (drift check — blocking gate), `write_drift_evidence` call with verdict, mandatory gate evidence verification (`completion-verify.json` + `drift-verifier.json` both required), then `phase_complete` |
474
+
475
+ > **CODEBASE REALITY CHECK (v6.29.2):** Before any planning, the Architect dispatches Explorer to verify the current state of every referenced item. Produces a CODEBASE REALITY REPORT with statuses: NOT STARTED, PARTIALLY DONE, ALREADY COMPLETE, or ASSUMPTION INCORRECT. This prevents planning against stale assumptions. Skipped for greenfield projects with no existing codebase references.
476
+
477
+ > **Phase Completion Gates (v6.33.4):** Before a phase can be marked complete, two mandatory gates are enforced: (1) completion-verify — deterministic check that plan task identifiers exist in source files, and (2) critic_drift_verifier evidence — verification that the drift verifier approved the implementation. Both gates are automatically bypassed when turbo mode is active.
478
+
479
+ ### Important
480
+
481
+ A second or later run does **not** necessarily look like a first run.
482
+
483
+ If `.swarm/plan.md` already exists, the architect may enter `RESUME` and then go directly into `EXECUTE`. That is expected and does **not** mean Swarm stopped using agents.
484
+
485
+ Use `/swarm status` if you are unsure what Swarm is doing.
486
+
487
+ Release automation uses release-please and requires conventional commit prefixes such as `fix:` or `feat:` on changes merged to `main`.
488
+
489
+ </details>
490
+
491
+ <details>
492
+ <summary><strong>Persistent Memory (What's in .swarm/)</strong></summary>
493
+
494
+ ### plan.md: Your Project Roadmap
495
+
496
+ ```markdown
497
+ # Project: Auth System
498
+ Current Phase: 2
499
+
500
+ ## Phase 1: Foundation [COMPLETE]
501
+ - [x] Task 1.1: Create user model [SMALL]
502
+ - [x] Task 1.2: Add password hashing [SMALL]
503
+ - [x] Task 1.3: Database migrations [MEDIUM]
504
+
505
+ ## Phase 2: Core Auth [IN PROGRESS]
506
+ - [x] Task 2.1: Login endpoint [MEDIUM]
507
+ - [ ] Task 2.2: JWT generation [MEDIUM] (depends: 2.1) ← CURRENT
508
+ - Acceptance: Returns valid JWT with user claims, 15-minute expiry
509
+ - Attempt 1: REJECTED — missing expiration claim
510
+ - [ ] Task 2.3: Token validation middleware [MEDIUM]
511
+ ```
512
+
513
+ ### context.md: What's Been Decided
514
+
515
+ ```markdown
516
+ ## Technical Decisions
517
+ - bcrypt cost factor: 12
518
+ - JWT TTL: 15 minutes; refresh TTL: 7 days
519
+
520
+ ## SME Guidance (cached, never re-asked)
521
+ ### security (Phase 1)
522
+ - Never log tokens or passwords
523
+ - Rate-limit login: 5 attempts / 15 min per IP
524
+
525
+ ### api (Phase 1)
526
+ - Return 401 for invalid credentials (not 404)
527
+ ```
528
+
529
+ ### Evidence Bundles
530
+
531
+ Every completed task writes structured evidence to `.swarm/evidence/`:
532
+
533
+ | Type | What It Captures |
534
+ |------|--------------------|
535
+ | review | Verdict, risk level, specific issues |
536
+ | test | Pass/fail counts, coverage %, failure messages |
537
+ | diff | Files changed, additions/deletions |
538
+ | retrospective | Phase metrics, lessons learned, error taxonomy classification (injected into next phase) |
539
+ | secretscan | Secret scan results: findings count, files scanned, skipped files (v6.33) |
540
+ | completion-verify | Deterministic gate: verifies plan task identifiers exist in source files (written automatically by `completion-verify` tool; required before `phase_complete`) |
541
+ | drift-verifier | Phase-close drift gate: `critic_drift_verifier` verdict (APPROVED/NEEDS_REVISION) and summary (written by architect via `write_drift_evidence`; required before `phase_complete`) |
542
+
543
+ ### telemetry.jsonl: Session Observability
544
+
545
+ Swarm emits structured JSONL events to `.swarm/telemetry.jsonl` for observability tooling (dashboards, alerting, audit logs). Events are fire-and-forget — failures never affect execution.
546
+
547
+ ```json
548
+ {"timestamp":"2026-03-25T14:30:00.000Z","event":"session_started","sessionId":"abc123","agentName":"architect"}
549
+ {"timestamp":"2026-03-25T14:30:05.000Z","event":"delegation_begin","sessionId":"abc123","agentName":"coder","taskId":"1.1"}
550
+ {"timestamp":"2026-03-25T14:31:00.000Z","event":"delegation_end","sessionId":"abc123","agentName":"coder","taskId":"1.1","result":"success"}
551
+ {"timestamp":"2026-03-25T14:31:10.000Z","event":"gate_passed","sessionId":"abc123","gate":"reviewer","taskId":"1.1"}
552
+ {"timestamp":"2026-03-25T14:32:00.000Z","event":"phase_changed","sessionId":"abc123","oldPhase":1,"newPhase":2}
553
+ ```
554
+
555
+ | Event | When Emitted |
556
+ |-------|-------------|
557
+ | `session_started` | New agent session created |
558
+ | `session_ended` | Session ends (reason: normal, timeout, error) |
559
+ | `agent_activated` | Agent identity confirmed via chat.message |
560
+ | `delegation_begin` | Task dispatched to a sub-agent |
561
+ | `delegation_end` | Sub-agent returns (success, rejected, error) |
562
+ | `task_state_changed` | Task workflow state transitions |
563
+ | `gate_passed` | Evidence written to `.swarm/evidence/{taskId}.json` |
564
+ | `gate_failed` | Gate check blocked task completion |
565
+ | `phase_changed` | Phase completed and new phase started |
566
+ | `budget_updated` | Context budget crossed warning/critical threshold |
567
+ | `hard_limit_hit` | Tool call/duration/repetition limit reached |
568
+ | `revision_limit_hit` | Coder revision limit exceeded |
569
+ | `loop_detected` | Repetitive tool call pattern detected |
570
+ | `scope_violation` | Architect wrote outside declared scope |
571
+ | `qa_skip_violation` | QA gate skipped without valid reason |
572
+ | `model_fallback` | Transient error triggered model fallback |
573
+ | `heartbeat` | 30-second throttled keep-alive signal |
574
+
575
+ File rotates automatically at 10MB to `.swarm/telemetry.jsonl.1`.
576
+
577
+ </details>
578
+
579
+ <details>
580
+ <summary><strong>Save Plan Tool: Target Workspace Requirement</strong></summary>
581
+
582
+ The `save_plan` tool requires an explicit target workspace path. It does **not** fall back to `process.cwd()`.
583
+
584
+ ### Explicit Workspace Requirement
585
+
586
+ - The `working_directory` parameter must be provided
587
+ - Providing no value or relying on implicit directory resolution will result in deterministic failure
588
+
589
+ ### Failure Conditions
590
+
591
+ | Condition | Behavior |
592
+ |-----------|----------|
593
+ | Missing (`undefined` / `null`) | Fails with: "Target workspace is required" |
594
+ | Empty or whitespace-only | Fails with: "Target workspace cannot be empty or whitespace" |
595
+ | Path traversal (`..`) | Fails with: "Target workspace cannot contain path traversal" |
596
+
597
+ ### Usage Contract
598
+
599
+ When using `save_plan`, always pass a valid `working_directory`:
600
+
44
601
  ```typescript
45
- // New way
46
- import { createCoderAgent } from '@opencode-swarm/core';
602
+ save_plan({
603
+ title: "My Project",
604
+ swarm_id: "mega",
605
+ phases: [{ id: 1, name: "Setup", tasks: [{ id: "1.1", description: "Initialize project" }] }],
606
+ working_directory: "/path/to/project" // Required - no fallback
607
+ })
608
+ ```
609
+
610
+ </details>
611
+
612
+ <details>
613
+ <summary><strong>Guardrails and Circuit Breakers</strong></summary>
614
+
615
+ Every agent runs inside a circuit breaker that kills runaway behavior before it burns your credits.
616
+
617
+ | Signal | Default Limit | What Happens |
618
+ |--------|:---:|-------------|
619
+ | Tool calls | 200 | Agent is stopped |
620
+ | Duration | 30 min | Agent is stopped |
621
+ | Same tool repeated | 10x | Agent is warned, then stopped |
622
+ | Consecutive errors | 5 | Agent is stopped |
623
+
624
+ Limits reset per task. A coder working on Task 2.3 is not penalized for tool calls made during Task 2.2.
625
+
626
+ #### Architect Self-Coding Block
627
+
628
+ If the architect writes files directly instead of delegating to the coder, a hard block fires:
629
+
630
+ | Write count | Behavior |
631
+ |:-----------:|----------|
632
+ | 1–2 | Warning injected into next architect message |
633
+ | ≥ 3 | `Error` thrown with `SELF_CODING_BLOCK` — identifies file paths written and count |
634
+
635
+ The counter resets only when a coder delegation is dispatched. This is a hard enforcement — not advisory.
636
+
637
+ Per-agent overrides:
638
+
639
+ ```json
640
+ {
641
+ "guardrails": {
642
+ "profiles": {
643
+ "coder": { "max_tool_calls": 500, "max_duration_minutes": 60 },
644
+ "explorer": { "max_tool_calls": 50 }
645
+ }
646
+ }
647
+ }
648
+ ```
649
+
650
+ </details>
651
+
652
+ <details>
653
+ <summary><strong>File Authority (Per-Agent Write Permissions)</strong></summary>
654
+
655
+ Swarm enforces per-agent file write authority — each agent can only write to specific paths. By default, these rules are hardcoded, but you can override them via config.
656
+
657
+ ### Default Rules
658
+
659
+ | Agent | Can Write | Blocked | Zones |
660
+ |-------|-----------|---------|-------|
661
+ | `architect` | Everything (except plan files) | `.swarm/plan.md`, `.swarm/plan.json` | `generated` |
662
+ | `coder` | `src/`, `tests/`, `docs/`, `scripts/` | `.swarm/` (entire directory) | `generated`, `config` |
663
+ | `reviewer` | `.swarm/evidence/`, `.swarm/outputs/` | `src/`, `.swarm/plan.md`, `.swarm/plan.json` | `generated` |
664
+ | `test_engineer` | `tests/`, `.swarm/evidence/` | `src/`, `.swarm/plan.md`, `.swarm/plan.json` | `generated` |
665
+ | `explorer` | Read-only | Everything | — |
666
+ | `sme` | Read-only | Everything | — |
667
+ | `docs` | `docs/`, `.swarm/outputs/` | — | `generated` |
668
+ | `designer` | `docs/`, `.swarm/outputs/` | — | `generated` |
669
+ | `critic` | `.swarm/evidence/` | — | `generated` |
670
+
671
+ ### Prefixed Agents
672
+
673
+ Prefixed agents (e.g., `paid_coder`, `mega_reviewer`, `local_architect`) inherit defaults from their canonical base agent via `stripKnownSwarmPrefix`. The lookup order is:
674
+
675
+ 1. Exact match for the prefixed name (if explicitly defined in user config)
676
+ 2. Fall back to the canonical agent's defaults (e.g., `paid_coder` → `coder`)
677
+
678
+ ```json
679
+ {
680
+ "authority": {
681
+ "rules": {
682
+ "coder": { "allowedPrefix": ["src/", "lib/"] },
683
+ "paid_coder": { "allowedPrefix": ["vendor/", "plugins/"] }
684
+ }
685
+ }
686
+ }
687
+ ```
688
+
689
+ In this example, `paid_coder` gets its own explicit rule, while other prefixed coders (e.g., `mega_coder`) fall back to `coder`.
690
+
691
+ ### Runtime Enforcement
692
+
693
+ Architect direct writes are enforced at runtime via `toolBefore` hook. This tracks writes to source code paths outside `.swarm/` and protects `.swarm/plan.md` and `.swarm/plan.json` from direct modification.
694
+
695
+ ### Configuration
696
+
697
+ Override default rules in `.opencode/opencode-swarm.json`:
698
+
699
+ ```json
700
+ {
701
+ "authority": {
702
+ "enabled": true,
703
+ "rules": {
704
+ "coder": {
705
+ "allowedPrefix": ["src/", "lib/", "scripts/"],
706
+ "blockedPrefix": [".swarm/"],
707
+ "blockedZones": ["generated"]
708
+ },
709
+ "explorer": {
710
+ "readOnly": false,
711
+ "allowedPrefix": ["notes/", "scratch/"]
712
+ }
713
+ }
714
+ }
715
+ }
716
+ ```
717
+
718
+ ### Rule Fields
719
+
720
+ | Field | Type | Description |
721
+ |-------|------|-------------|
722
+ | `readOnly` | boolean | If `true`, agent cannot write anywhere |
723
+ | `blockedExact` | string[] | Exact file paths that are blocked |
724
+ | `allowedExact` | string[] | Exact file paths that are allowed (overrides prefix/glob restrictions) |
725
+ | `blockedPrefix` | string[] | Path prefixes that are blocked (e.g., `.swarm/`) |
726
+ | `allowedPrefix` | string[] | Only these path prefixes are allowed. Omit to remove restriction; set `[]` to deny all |
727
+ | `blockedGlobs` | string[] | Glob patterns that are blocked (uses picomatch: `**`, `*`, `?`) |
728
+ | `allowedGlobs` | string[] | Glob patterns that are allowed (uses picomatch: `**`, `*`, `?`) |
729
+ | `blockedZones` | string[] | File zones to block: `production`, `test`, `config`, `generated`, `docs`, `build` |
730
+
731
+ ### Merge Behavior
732
+
733
+ - User rules **override** hardcoded defaults for the specified agent
734
+ - Scalar fields (`readOnly`) — user value replaces default
735
+ - Array fields (`blockedPrefix`, `allowedPrefix`, etc.) — user array **replaces** entirely (not merged)
736
+ - If a field is omitted in the user rule for a **known agent** (one with hardcoded defaults), the default value for that field is preserved
737
+ - If a field is omitted in the user rule for a **custom agent** (not in the defaults list), that field is `undefined` — there are no defaults to inherit
738
+ - `allowedPrefix: []` explicitly denies all writes; omitting `allowedPrefix` entirely means no allowlist restriction is applied (all paths are evaluated against blocklist rules only)
739
+ - Setting `enabled: false` ignores all custom rules and uses hardcoded defaults
740
+
741
+ ### Custom Agents
742
+
743
+ Custom agents (not in the defaults list) start with no rules. Their write authority depends entirely on what you configure:
744
+
745
+ - **Not in config at all** — agent is denied with `Unknown agent` (no rule exists; this is not the same as "blocked from all writes")
746
+ - **In config without `allowedPrefix`** — no allowlist restriction applies; only any `blockedPrefix`, `blockedZones`, or `readOnly` rules you explicitly set will enforce limits
747
+ - **In config with `allowedPrefix: []`** — all writes are denied
748
+
749
+ To safely restrict a custom agent, always set `allowedPrefix` explicitly:
750
+
751
+ ```json
752
+ {
753
+ "authority": {
754
+ "rules": {
755
+ "my_custom_agent": {
756
+ "allowedPrefix": ["plugins/", "extensions/"],
757
+ "blockedZones": ["generated"]
758
+ }
759
+ }
760
+ }
761
+ }
762
+ ```
763
+
764
+ ### Advanced Examples
765
+
766
+ #### Glob Pattern Support
767
+
768
+ Use glob patterns for complex path matching:
769
+
770
+ ```json
771
+ {
772
+ "authority": {
773
+ "rules": {
774
+ "coder": {
775
+ "allowedGlobs": ["src/**/*.ts", "tests/**/*.test.ts"],
776
+ "blockedGlobs": ["src/**/*.generated.ts", "**/*.d.ts"],
777
+ "allowedExact": ["src/index.ts", "package.json"]
778
+ },
779
+ "docs_agent": {
780
+ "allowedGlobs": ["docs/**/*.md", "*.md"],
781
+ "blockedExact": [".swarm/plan.md"]
782
+ }
783
+ }
784
+ }
785
+ }
786
+ ```
787
+
788
+ **Glob Pattern Features:**
789
+ - `**` — Match any number of directories: `src/**/*.ts` matches all TypeScript files in src/ and subdirectories
790
+ - `*` — Match any characters except path separators: `*.md` matches all Markdown files in current directory
791
+ - `?` — Match single character: `test?.js` matches `test1.js`, `testa.js`
792
+ - Uses [picomatch](https://github.com/micromatch/picomatch) for cross-platform compatibility
793
+
794
+ **Path Normalization and Symlinks:**
795
+ Paths are resolved via `realpathSync` before matching, which resolves symlinks and prevents path-traversal escapes. However, if a symlink's target does not exist, `realpathSync` throws and the fallback returns the symlink's own path (unresolved). A dangling symlink inside an `allowedPrefix` directory will therefore pass prefix-based checks even if its intended target is outside the project. Use `blockedExact` or `blockedGlobs` to deny known dangling-symlink paths explicitly.
796
+
797
+ **Evaluation Order:**
798
+ 1. `readOnly` check (if true, deny all writes)
799
+ 2. `blockedExact` (exact path matches, highest priority)
800
+ 3. `blockedGlobs` (glob pattern matches)
801
+ 4. `allowedExact` (exact path matches, overrides prefix/glob restrictions)
802
+ 5. `allowedGlobs` (glob pattern matches)
803
+ 6. `blockedPrefix` (prefix matches)
804
+ 7. `allowedPrefix` (prefix matches)
805
+ 8. `blockedZones` (zone classification)
806
+
807
+ </details>
808
+
809
+ <details>
810
+ <summary><strong>Context Budget Guard</strong></summary>
811
+
812
+ The Context Budget Guard monitors how much context Swarm is injecting into the conversation. It helps prevent context overflow before it becomes a problem.
813
+
814
+ ### Default Behavior
815
+
816
+ - **Enabled automatically** — No setup required. Swarm starts tracking context usage right away.
817
+ - **What it measures** — Only the context that Swarm injects (plan, context, evidence, retrospectives). It does **not** count your chat history or the model's responses.
818
+ - **Warning threshold (0.7 ratio)** — When swarm-injected context reaches ~2800 tokens (70% of 4000), the architect receives a one-time advisory warning. This is informational — execution continues normally.
819
+ - **Critical threshold (0.9 ratio)** — When context reaches ~3600 tokens (90% of 4000), the architect receives a critical alert with a recommendation to run `/swarm handoff`. This is also one-time only.
820
+ - **Non-nagging** — Alerts fire once per session, not repeatedly. You won't be pestered every turn.
821
+ - **Who sees warnings** — Only the architect receives these warnings. Other agents are unaware of the budget.
822
+
823
+ To disable entirely, set `context_budget.enabled: false` in your swarm config.
824
+
825
+ ### Configuration Reference
826
+
827
+ | Key | Type | Default | Description |
828
+ |-----|------|---------|-------------|
829
+ | `context_budget.enabled` | boolean | `true` | Enable or disable the context budget guard entirely |
830
+ | `context_budget.max_injection_tokens` | number | `4000` | Token budget for swarm-injected context per turn. This is NOT the model's context window — it's the swarm plugin's own contribution |
831
+ | `context_budget.warn_threshold` | number | `0.7` | Ratio (0.0-1.0) of `max_injection_tokens` that triggers a warning advisory |
832
+ | `context_budget.critical_threshold` | number | `0.9` | Ratio (0.0-1.0) of `max_injection_tokens` that triggers a critical alert with handoff recommendation |
833
+ | `context_budget.enforce` | boolean | `true` | When true, enforces budget limits and may trigger handoffs |
834
+ | `context_budget.prune_target` | number | `0.7` | Ratio (0.0-1.0) of context to preserve when pruning occurs |
835
+ | `context_budget.preserve_last_n_turns` | number | `4` | Number of recent turns to preserve when pruning |
836
+ | `context_budget.recent_window` | number | `10` | Number of turns to consider as "recent" for scoring |
837
+ | `context_budget.tracked_agents` | string[] | `['architect']` | Agents to track for context budget warnings |
838
+ | `context_budget.enforce_on_agent_switch` | boolean | `true` | Enforce budget limits when switching agents |
839
+ | `context_budget.model_limits` | record | `{ default: 128000 }` | Per-model token limits (model name -> max tokens) |
840
+ | `context_budget.tool_output_mask_threshold` | number | `2000` | Threshold for masking tool outputs (chars) |
841
+ | `context_budget.scoring.enabled` | boolean | `false` | Enable context scoring/ranking |
842
+ | `context_budget.scoring.max_candidates` | number | `100` | Maximum items to score (10-500) |
843
+ | `context_budget.scoring.weights` | object | `{ recency: 0.3, ... }` | Scoring weights for priority |
844
+ | `context_budget.scoring.decision_decay` | object | `{ mode: 'exponential', half_life_hours: 24 }` | Decision relevance decay |
845
+ | `context_budget.scoring.token_ratios` | object | `{ prose: 0.25, code: 0.4, ... }` | Token cost multipliers |
846
+
847
+ ### Example Configurations
848
+
849
+ **Minimal (disable):**
850
+ ```json
851
+ {
852
+ "context_budget": {
853
+ "enabled": false
854
+ }
855
+ }
856
+ ```
857
+
858
+ **Default (reference):**
859
+ ```json
860
+ {
861
+ "context_budget": {
862
+ "enabled": true,
863
+ "max_injection_tokens": 4000,
864
+ "warn_threshold": 0.7,
865
+ "critical_threshold": 0.9,
866
+ "enforce": true,
867
+ "prune_target": 0.7,
868
+ "preserve_last_n_turns": 4,
869
+ "recent_window": 10,
870
+ "tracked_agents": ["architect"],
871
+ "enforce_on_agent_switch": true,
872
+ "model_limits": { "default": 128000 },
873
+ "tool_output_mask_threshold": 2000,
874
+ "scoring": {
875
+ "enabled": false,
876
+ "max_candidates": 100,
877
+ "weights": { "recency": 0.3, "relevance": 0.4, "importance": 0.3 },
878
+ "decision_decay": { "mode": "exponential", "half_life_hours": 24 },
879
+ "token_ratios": { "prose": 0.25, "code": 0.4, "json": 0.6, "logs": 0.1 }
880
+ }
881
+ }
882
+ }
883
+ ```
884
+
885
+ **Aggressive (for long-running sessions):**
886
+ ```json
887
+ {
888
+ "context_budget": {
889
+ "enabled": true,
890
+ "max_injection_tokens": 2000,
891
+ "warn_threshold": 0.5,
892
+ "critical_threshold": 0.75,
893
+ "enforce": true,
894
+ "prune_target": 0.6,
895
+ "preserve_last_n_turns": 2,
896
+ "recent_window": 5,
897
+ "tracked_agents": ["architect"],
898
+ "enforce_on_agent_switch": true,
899
+ "model_limits": { "default": 128000 },
900
+ "tool_output_mask_threshold": 1500,
901
+ "scoring": {
902
+ "enabled": true,
903
+ "max_candidates": 50,
904
+ "weights": { "recency": 0.5, "relevance": 0.3, "importance": 0.2 },
905
+ "decision_decay": { "mode": "linear", "half_life_hours": 12 },
906
+ "token_ratios": { "prose": 0.2, "code": 0.35, "json": 0.5, "logs": 0.05 }
907
+ }
908
+ }
909
+ }
910
+ ```
911
+
912
+ ### What This Does NOT Do
913
+
914
+ - **Does NOT prune chat history** — Your conversation with the model is untouched
915
+ - **Does NOT modify tool outputs** — What tools return is unchanged
916
+ - **Does NOT block execution** — The guard is advisory only; it warns but never stops the pipeline
917
+ - **Does NOT interact with compaction.auto** — Separate feature with separate configuration
918
+ - **Only measures swarm's injected context** — Not the full context window, just what Swarm adds
919
+
920
+ </details>
921
+
922
+ <details>
923
+ <summary><strong>Quality Gates (Technical Detail)</strong></summary>
924
+
925
+ ### Built-in Tools
926
+
927
+ | Tool | What It Does |
928
+ |------|-------------|
929
+ | syntax_check | Tree-sitter validation across 12 languages |
930
+ | placeholder_scan | Catches TODOs, FIXMEs, stubs, placeholder text |
931
+ | sast_scan | Offline security analysis, 63+ rules, 9 languages |
932
+ | sbom_generate | CycloneDX dependency tracking, 8 ecosystems |
933
+ | build_check | Runs your project's native build/typecheck |
934
+ | incremental_verify | Post-coder typecheck for TS/JS, Go, Rust, C# (v6.29.2) |
935
+ | quality_budget | Enforces complexity, duplication, and test ratio limits |
936
+ | pre_check_batch | Runs lint, secretscan, SAST, and quality budget in parallel (~15s vs ~60s sequential) |
937
+ | phase_complete | Enforces phase completion, verifies required agents, requires a valid retrospective evidence bundle, logs events, and resets state; appends to `events.jsonl` with file locking |
938
+ | mutation_test | Applies LLM-generated mutation patches to source files and runs tests to measure kill rate; verdict is pass/warn/fail based on configurable thresholds; used by the mutation_test gate (opt-in, off by default) |
939
+ | generate_mutants | Architect-only: generates LLM-based mutation patches (5–10 per function across 6 types: off-by-one, null substitution, operator swap, guard removal, branch swap, side-effect deletion) for direct consumption by the mutation_test tool; returns SKIP verdict on LLM failure rather than throwing |
940
+ | write_mutation_evidence | Architect-only: writes mutation gate results atomically to `.swarm/evidence/{phase}/mutation-gate.json`; accepts verdict (PASS/WARN/FAIL/SKIP), kill rate metrics, and optional survived mutant details; normalizes uppercase-to-lowercase before persisting |
941
+
942
+
943
+ All tools run locally. No Docker, no network calls, no external APIs.
944
+
945
+ Optional enhancement: Semgrep (if on PATH).
946
+
947
+ ### Gate Configuration
948
+
949
+ ```json
950
+ {
951
+ "gates": {
952
+ "syntax_check": { "enabled": true },
953
+ "placeholder_scan": { "enabled": true },
954
+ "sast_scan": { "enabled": true },
955
+ "quality_budget": {
956
+ "enabled": true,
957
+ "max_complexity_delta": 5,
958
+ "min_test_to_code_ratio": 0.3
959
+ }
960
+ }
961
+ }
962
+ ```
963
+
964
+ </details>
965
+
966
+ <details>
967
+ <summary><strong>File Locking for Concurrent Write Safety</strong></summary>
968
+
969
+ Swarm uses file locking to protect shared state files from concurrent write corruption. The locking strategy differs by file: `plan.json` uses hard locking (write blocked on contention), while `events.jsonl` uses advisory locking (write proceeds with a warning on contention).
970
+
971
+ ### Locking Implementation
972
+
973
+ - **Library**: `proper-lockfile` with `retries: 0` (fail-fast — no polling retries)
974
+ - **Scope**: Each tool acquires an exclusive lock on the target file before writing
975
+ - **Agents**: Lock is tagged with the current agent name and task context for diagnostics
976
+
977
+ ### Protected Files
978
+
979
+ | File | Tool | Lock Key |
980
+ |------|------|----------|
981
+ | `.swarm/plan.json` | `update_task_status` | `plan.json` |
982
+ | `.swarm/events.jsonl` | `phase_complete` | `events.jsonl` |
983
+
984
+ ### Lock Semantics
985
+
986
+ The two protected tools use different strategies:
987
+
988
+ **`update_task_status` — Hard lock on `plan.json`**
989
+
990
+ When two calls contend for `plan.json`:
991
+ 1. **Exactly one call wins** — only the first to acquire the lock proceeds
992
+ 2. **Winner writes** — the lock holder writes to the file, then releases the lock
993
+ 3. **Losers receive `success: false`** — with `recovery_guidance: "retry"` and an error message identifying the lock holder
994
+
995
+ ```json
996
+ {
997
+ "success": false,
998
+ "message": "Task status write blocked: plan.json is locked by architect (task: update-task-status-1.1-1234567890)",
999
+ "errors": ["Concurrent plan write detected — retry after the current write completes"],
1000
+ "recovery_guidance": "Wait a moment and retry update_task_status. The lock will expire automatically if the holding agent fails."
1001
+ }
47
1002
  ```
48
1003
 
49
- ### Import Mapping
1004
+ **What the caller should do**: Retry `update_task_status` after a short delay.
1005
+
1006
+ **`phase_complete` — Advisory lock on `events.jsonl`**
1007
+
1008
+ When two calls contend for `events.jsonl`:
1009
+ 1. **Lock is attempted** — if acquired, write is serialized
1010
+ 2. **If lock unavailable** — a warning is added to the result and the write proceeds anyway
1011
+ 3. **Both callers return `success: true`** — duplicate concurrent appends are possible but `events.jsonl` is an append-only log and duplicate phase entries do not corrupt state
1012
+
1013
+ This asymmetry is intentional: `plan.json` stores mutable structured JSON where concurrent overwrites produce malformed files; `events.jsonl` is an append-only log where a duplicate entry is a recoverable nuisance.
1014
+
1015
+ ### Lock Recovery
1016
+
1017
+ If a lock-holding agent crashes or hangs, the lock file will eventually expire (handled by `proper-lockfile` stale-lock cleanup). On the next retry, the call will succeed. Swarm does not auto-retry on lock contention — the architect receives the error and decides when to retry.
1018
+
1019
+ </details>
1020
+
1021
+ <details>
1022
+ <summary id="configuration-reference"><strong>Full Configuration Reference</strong></summary>
1023
+
1024
+ Config file location: `~/.config/opencode/opencode-swarm.json` (global) or `.opencode/opencode-swarm.json` (project). Project config merges over global.
1025
+
1026
+ ```json
1027
+ {
1028
+ "agents": {
1029
+ "architect": { "model": "anthropic/claude-opus-4-6" },
1030
+ "coder": { "model": "minimax-coding-plan/MiniMax-M2.5", "fallback_models": ["minimax-coding-plan/MiniMax-M2.1"] },
1031
+ "explorer": { "model": "minimax-coding-plan/MiniMax-M2.1" },
1032
+ "sme": { "model": "kimi-for-coding/k2p5" },
1033
+ "critic": { "model": "zai-coding-plan/glm-5" },
1034
+ "reviewer": { "model": "zai-coding-plan/glm-5", "fallback_models": ["opencode/big-pickle"] },
1035
+ "test_engineer": { "model": "minimax-coding-plan/MiniMax-M2.5" },
1036
+ "docs": { "model": "zai-coding-plan/glm-4.7-flash" },
1037
+ "designer": { "model": "kimi-for-coding/k2p5" }
1038
+ },
1039
+ "guardrails": {
1040
+ "max_tool_calls": 200,
1041
+ "max_duration_minutes": 30,
1042
+ "profiles": {
1043
+ "coder": { "max_tool_calls": 500 }
1044
+ }
1045
+ },
1046
+ "authority": {
1047
+ "enabled": true,
1048
+ "rules": {
1049
+ "coder": {
1050
+ "allowedPrefix": ["src/", "lib/"],
1051
+ "blockedPrefix": [".swarm/"],
1052
+ "blockedZones": ["generated"]
1053
+ }
1054
+ }
1055
+ },
1056
+ "review_passes": {
1057
+ "always_security_review": false,
1058
+ "security_globs": ["**/*auth*", "**/*crypto*", "**/*session*"]
1059
+ },
1060
+ "automation": {
1061
+ "mode": "manual",
1062
+ "capabilities": {
1063
+ "plan_sync": true,
1064
+ "phase_preflight": false,
1065
+ "config_doctor_on_startup": false,
1066
+ "config_doctor_autofix": false,
1067
+ "evidence_auto_summaries": true,
1068
+ "decision_drift_detection": true
1069
+ }
1070
+ },
1071
+ "knowledge": {
1072
+ "enabled": true,
1073
+ "swarm_max_entries": 100,
1074
+ "hive_max_entries": 1000,
1075
+ "auto_promote_days": 30,
1076
+ "max_inject_count": 5,
1077
+ "dedup_threshold": 0.6,
1078
+ "scope_filter": ["global"],
1079
+ "hive_enabled": true,
1080
+ "rejected_max_entries": 200,
1081
+ "validation_enabled": true,
1082
+ "evergreen_confidence": 0.8,
1083
+ "evergreen_utility": 0.5,
1084
+ "low_utility_threshold": 0.2,
1085
+ "min_retrievals_for_utility": 3,
1086
+ "schema_version": "v6.17"
1087
+ }
1088
+ }
1089
+ ```
1090
+
1091
+ ### Automation
1092
+
1093
+ ## Mode Detection (v6.13)
1094
+
1095
+ Swarm now explicitly distinguishes five architect modes:
1096
+
1097
+ - **`DISCOVER`** — After the explorer finishes scanning the codebase.
1098
+ - **`PLAN`** — When the architect writes or updates the plan.
1099
+ - **`EXECUTE`** — During task implementation (the normal pipeline).
1100
+ - **`PHASE-WRAP`** — After all tasks in a phase are completed, before docs are updated.
1101
+ - **`UNKNOWN`** — Fallback when the current state does not match any known mode.
1102
+
1103
+ Each mode determines which injection blocks are added to the LLM prompt (e.g., plan cursor is injected in `PLAN`, tool output truncation in `EXECUTE`, etc.).
1104
+
1105
+ Default mode: `manual`. No background automation — all actions require explicit slash commands.
1106
+
1107
+ Modes:
1108
+
1109
+ - `manual` — No background automation. All actions via slash commands (default).
1110
+ - `hybrid` — Background automation for safe operations, manual for sensitive ones.
1111
+ - `auto` — Full background automation.
1112
+
1113
+ Capability defaults:
1114
+
1115
+ - `plan_sync`: `true` — Background plan synchronization using `fs.watch` with debounced writes (300ms) and 2-second polling fallback
1116
+ - `phase_preflight`: `false` — Phase preflight checks before agent execution (opt-in)
1117
+ - `config_doctor_on_startup`: `false` — Validate configuration on startup
1118
+ - `config_doctor_autofix`: `false` — Auto-fix for config doctor (opt-in, security-sensitive)
1119
+ - `evidence_auto_summaries`: `true` — Automatic summaries for evidence bundles
1120
+ - `decision_drift_detection`: `true` — Detect drift between planned and actual decisions
1121
+
1122
+ ## Plan Cursor (v6.13)
1123
+
1124
+ The `plan_cursor` config compresses the plan that is injected into the LLM context.
1125
+
1126
+ ```json
1127
+ {
1128
+ "plan_cursor": {
1129
+ "enabled": true,
1130
+ "max_tokens": 1500,
1131
+ "lookahead_tasks": 2
1132
+ }
1133
+ }
1134
+ ```
50
1135
 
51
- | Old Import | New Import |
52
- |------------|------------|
53
- | `import { createCoderAgent } from 'opencode-swarm'` | `import { createCoderAgent } from '@opencode-swarm/core'` |
54
- | `import { createCoderAgent } from 'opencode-swarm/src/agents'` | `import { createCoderAgent } from '@opencode-swarm/core'` |
55
- | `import { SwarmConfig } from 'opencode-swarm/src/config'` | `import { SwarmConfig } from '@opencode-swarm/core'` |
56
- | `import { createAgentState } from 'opencode-swarm/src/state'` | `import { createAgentState } from '@opencode-swarm/core'` |
1136
+ - **enabled** When `true` (default) Swarm injects a compact plan cursor instead of the full `plan.md`.
1137
+ - **max_tokens** – Upper bound on the number of tokens emitted for the cursor (default 1500). The cursor contains the current phase summary, the full current task, and up to `lookahead_tasks` upcoming tasks. Earlier phases are reduced to one‑line summaries.
1138
+ - **lookahead_tasks** Number of future tasks to include in full detail (default 2). Set to `0` to show only the current task.
57
1139
 
58
- ## CLI Usage
1140
+ Disabling (`"enabled": false`) falls back to the pre‑v6.13 behavior of injecting the entire plan text.
59
1141
 
60
- The `opencode-swarm` CLI provides swarm orchestration commands:
1142
+ ## Tool Output Truncation (v6.13)
1143
+
1144
+ Control the size of tool outputs that are sent back to the LLM.
1145
+
1146
+ ```json
1147
+ {
1148
+ "tool_output": {
1149
+ "truncation_enabled": true,
1150
+ "max_lines": 150,
1151
+ "per_tool": {
1152
+ "diff": 200,
1153
+ "symbols": 100
1154
+ }
1155
+ }
1156
+ }
1157
+ ```
1158
+
1159
+ - **truncation_enabled** – Global switch (default true).
1160
+ - **max_lines** – Default line limit for any tool output.
1161
+ - **per_tool** – Overrides `max_lines` for specific tools. The `diff` and `symbols` tools are truncated by default because their outputs can be very large.
1162
+
1163
+ When truncation is active, a footer is appended:
1164
+
1165
+ ```
1166
+ ---
1167
+ [output truncated to {maxLines} lines – use `tool_output.per_tool.<tool>` to adjust]
1168
+ ```
1169
+
1170
+ ## Summarization Settings
1171
+
1172
+ Control how tool outputs are summarized for LLM context.
1173
+
1174
+ ```json
1175
+ {
1176
+ "summaries": {
1177
+ "threshold_bytes": 102400,
1178
+ "exempt_tools": ["retrieve_summary", "task", "read"]
1179
+ }
1180
+ }
1181
+ ```
1182
+
1183
+ - **threshold_bytes** – Output size threshold in bytes before summarization is triggered (default 102400 = 100KB).
1184
+ - **exempt_tools** – Tools whose outputs are never summarized. Defaults to `["retrieve_summary", "task", "read"]` to prevent re-summarization loops.
1185
+
1186
+ > **Note:** The `retrieve_summary` tool supports paginated retrieval via `offset` and `limit` parameters to fetch large summarized outputs in chunks.
1187
+
1188
+ ---
1189
+
1190
+ ### Disabling Agents
1191
+
1192
+ ```json
1193
+ {
1194
+ "sme": { "disabled": true },
1195
+ "designer": { "disabled": true },
1196
+ "test_engineer": { "disabled": true }
1197
+ }
1198
+ ```
1199
+
1200
+ </details>
1201
+
1202
+ <details>
1203
+ <summary><strong>All Slash Commands</strong></summary>
1204
+
1205
+ | Command | Description |
1206
+ |---------|-------------|
1207
+ | `/swarm status` | Current phase, task progress, agent count |
1208
+ | `/swarm plan [N]` | Full plan or filtered by phase |
1209
+ | `/swarm agents` | Registered agents with models and permissions |
1210
+ | `/swarm history` | Completed phases with status |
1211
+ | `/swarm config` | Current resolved configuration |
1212
+ | `/swarm diagnose` | Health check for `.swarm/` files and config |
1213
+ | `/swarm export` | Export plan and context as portable JSON |
1214
+ | `/swarm evidence [task]` | Evidence bundles for a task or all tasks |
1215
+ | `/swarm archive [--dry-run]` | Archive old evidence with retention policy |
1216
+ | `/swarm benchmark` | Performance benchmarks |
1217
+ | `/swarm retrieve [id]` | Retrieve auto-summarized tool outputs (supports offset/limit pagination) |
1218
+ | `/swarm reset --confirm` | Clear swarm state files |
1219
+ | `/swarm reset-session` | Clear session state files in `.swarm/session/` (preserves plan and context) |
1220
+ | `/swarm preflight` | Run phase preflight checks |
1221
+ | `/swarm config doctor [--fix]` | Config validation with optional auto-fix |
1222
+ | `/swarm doctor tools` | Tool registration coherence and binary readiness check |
1223
+ | `/swarm sync-plan` | Force plan.md regeneration from plan.json |
1224
+ | `/swarm specify [description]` | Generate or import a feature specification |
1225
+ | `/swarm clarify [topic]` | Clarify and refine an existing feature specification |
1226
+ | `/swarm analyze` | Analyze spec.md vs plan.md for requirement coverage gaps |
1227
+ | `/swarm close [--prune-branches]` | Idempotent session close-out: retrospectives, lesson curation, evidence archive, context.md reset, config-backup cleanup, optional branch pruning |
1228
+ | `/swarm write-retro` | Write a phase retrospective manually |
1229
+ | `/swarm handoff` | Generate a handoff summary for context-budget-critical sessions |
1230
+ | `/swarm simulate` | Simulate plan execution without writing code |
1231
+ | `/swarm promote` | Promote swarm-scoped knowledge to hive (global) knowledge |
1232
+ | `/swarm evidence summary` | Generate a summary across all evidence bundles with completion ratio and blockers |
1233
+ | `/swarm knowledge` | List knowledge entries |
1234
+ | `/swarm knowledge migrate` | Migrate knowledge entries to the current format |
1235
+ | `/swarm knowledge quarantine [id]` | Move a knowledge entry to quarantine |
1236
+ | `/swarm knowledge restore [id]` | Restore a quarantined knowledge entry |
1237
+ | `/swarm turbo` | Enable turbo mode for the current session (bypasses QA gates) |
1238
+ | `/swarm full-auto` | Toggle Full-Auto Mode for the current session [on|off] |
1239
+ | `/swarm checkpoint` | Save a git checkpoint for the current state |
1240
+
1241
+ </details>
1242
+
1243
+ ---
1244
+
1245
+ ## Supported Languages
1246
+
1247
+ Full Tier-1 support: TypeScript, JavaScript, Python, Go, Rust
1248
+ Tier-2 support: Java, Kotlin, C#, C/C++, Swift
1249
+ Tier-3 support: Dart, Ruby, PHP/Laravel
1250
+
1251
+ All binaries optional. Missing tools produce soft warnings, never hard-fail.
1252
+
1253
+ ---
1254
+
1255
+ ## Testing
1256
+
1257
+ 6,000+ tests. Unit, integration, adversarial, and smoke. Run with:
61
1258
 
62
1259
  ```bash
63
- # Run swarm commands
64
- opencode-swarm status
65
- opencode-swarm plan
66
- opencode-swarm checkpoint
1260
+ bun test
67
1261
  ```
68
1262
 
1263
+ ---
1264
+
1265
+ ## Design Principles
1266
+
1267
+ 1. **Plan before code.** Critic approves the plan before a single line is written.
1268
+ 2. **One task at a time.** Coder gets one task and full context. Nothing else.
1269
+ 3. **Review everything immediately.** Correctness, security, tests, adversarial tests. Every task.
1270
+ 4. **Different models catch different bugs.** Blind spots of the coder are the reviewer's strength.
1271
+ 5. **Save everything to disk.** Resume any project any day from `.swarm/` state.
1272
+ 6. **Document failures.** Rejections and retries recorded. After 5 failures, escalate to you.
1273
+
1274
+ ---
1275
+
1276
+ ## Documentation
1277
+
1278
+ - [Getting Started](docs/getting-started.md) — 15-minute first-run guide
1279
+ - [Documentation Index](docs/index.md) — navigate all docs
1280
+ - [Installation Guide](docs/installation.md) — comprehensive reference
1281
+ - [Architecture Deep Dive](docs/architecture.md) — control model, pipeline, tools
1282
+ - [Design Rationale](docs/design-rationale.md) — why every major decision
1283
+ - [Commands Reference](docs/commands.md) — all 41 `/swarm` subcommands
1284
+ - [Modes Guide](docs/modes.md) — session modes (Turbo, Full-Auto) and project modes (strict/balanced/fast)
1285
+ - [Configuration](docs/configuration.md) — all config keys and examples
1286
+ - [Planning Guide](docs/planning.md) — task format, phase structure, sizing
1287
+
1288
+ ---
1289
+
69
1290
  ## License
70
1291
 
71
1292
  MIT
1293
+
1294
+ ---
1295
+
1296
+ **Stop hoping your agents figure it out. Start shipping code that actually works.**