swarm-engine 1.1.1 → 1.38.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 (339) hide show
  1. package/CLAUDE.md +1 -1
  2. package/README.md +145 -30
  3. package/commands/diff-review.md +27 -15
  4. package/commands/discover.md +102 -0
  5. package/commands/dynamic.md +136 -0
  6. package/commands/fix-pr.md +30 -24
  7. package/commands/postmortem.md +106 -0
  8. package/commands/red-team.md +41 -26
  9. package/commands/research.md +22 -1
  10. package/commands/review-cycle.md +38 -20
  11. package/commands/spike.md +108 -0
  12. package/commands/swarm.md +68 -60
  13. package/commands/tdd.md +44 -24
  14. package/dist/cli/commands/acp.d.ts.map +1 -1
  15. package/dist/cli/commands/acp.js +12 -2
  16. package/dist/cli/commands/acp.js.map +1 -1
  17. package/dist/cli/commands/agents.d.ts.map +1 -1
  18. package/dist/cli/commands/agents.js +16 -13
  19. package/dist/cli/commands/agents.js.map +1 -1
  20. package/dist/cli/commands/completions.d.ts.map +1 -1
  21. package/dist/cli/commands/completions.js +21 -9
  22. package/dist/cli/commands/completions.js.map +1 -1
  23. package/dist/cli/commands/compound.d.ts.map +1 -1
  24. package/dist/cli/commands/compound.js +1 -2
  25. package/dist/cli/commands/compound.js.map +1 -1
  26. package/dist/cli/commands/configure.d.ts.map +1 -1
  27. package/dist/cli/commands/configure.js +24 -8
  28. package/dist/cli/commands/configure.js.map +1 -1
  29. package/dist/cli/commands/convert.d.ts +1 -1
  30. package/dist/cli/commands/convert.d.ts.map +1 -1
  31. package/dist/cli/commands/convert.js +22 -48
  32. package/dist/cli/commands/convert.js.map +1 -1
  33. package/dist/cli/commands/doctor.d.ts.map +1 -1
  34. package/dist/cli/commands/doctor.js +1 -3
  35. package/dist/cli/commands/doctor.js.map +1 -1
  36. package/dist/cli/commands/init.d.ts.map +1 -1
  37. package/dist/cli/commands/init.js +17 -7
  38. package/dist/cli/commands/init.js.map +1 -1
  39. package/dist/cli/commands/install.d.ts.map +1 -1
  40. package/dist/cli/commands/install.js +1 -1
  41. package/dist/cli/commands/install.js.map +1 -1
  42. package/dist/cli/commands/learn.js +6 -6
  43. package/dist/cli/commands/learn.js.map +1 -1
  44. package/dist/cli/commands/mcp.d.ts.map +1 -1
  45. package/dist/cli/commands/mcp.js +1 -2
  46. package/dist/cli/commands/mcp.js.map +1 -1
  47. package/dist/cli/commands/memory.d.ts.map +1 -1
  48. package/dist/cli/commands/memory.js +118 -2
  49. package/dist/cli/commands/memory.js.map +1 -1
  50. package/dist/cli/commands/orchestrate.d.ts.map +1 -1
  51. package/dist/cli/commands/orchestrate.js +20 -7
  52. package/dist/cli/commands/orchestrate.js.map +1 -1
  53. package/dist/cli/commands/plan.d.ts.map +1 -1
  54. package/dist/cli/commands/plan.js.map +1 -1
  55. package/dist/cli/commands/plugin.d.ts.map +1 -1
  56. package/dist/cli/commands/plugin.js +8 -5
  57. package/dist/cli/commands/plugin.js.map +1 -1
  58. package/dist/cli/commands/resume.js +1 -1
  59. package/dist/cli/commands/resume.js.map +1 -1
  60. package/dist/cli/commands/run.d.ts.map +1 -1
  61. package/dist/cli/commands/run.js +20 -6
  62. package/dist/cli/commands/run.js.map +1 -1
  63. package/dist/cli/commands/share.d.ts.map +1 -1
  64. package/dist/cli/commands/share.js +6 -1
  65. package/dist/cli/commands/share.js.map +1 -1
  66. package/dist/cli/commands/status.d.ts.map +1 -1
  67. package/dist/cli/commands/status.js +15 -7
  68. package/dist/cli/commands/status.js.map +1 -1
  69. package/dist/cli/commands/template.d.ts.map +1 -1
  70. package/dist/cli/commands/template.js +14 -6
  71. package/dist/cli/commands/template.js.map +1 -1
  72. package/dist/cli/commands/vault.d.ts.map +1 -1
  73. package/dist/cli/commands/vault.js +14 -9
  74. package/dist/cli/commands/vault.js.map +1 -1
  75. package/dist/cli/commands/verify.d.ts.map +1 -1
  76. package/dist/cli/commands/verify.js +2 -2
  77. package/dist/cli/commands/verify.js.map +1 -1
  78. package/dist/cli/commands/watch.js +1 -1
  79. package/dist/cli/commands/watch.js.map +1 -1
  80. package/dist/cli/index.js +14 -4
  81. package/dist/cli/index.js.map +1 -1
  82. package/dist/core/checkpoint.js +1 -1
  83. package/dist/core/checkpoint.js.map +1 -1
  84. package/dist/core/event-bus.d.ts.map +1 -1
  85. package/dist/core/event-bus.js +9 -3
  86. package/dist/core/event-bus.js.map +1 -1
  87. package/dist/core/lifecycle.js.map +1 -1
  88. package/dist/core/patterns.d.ts.map +1 -1
  89. package/dist/core/patterns.js +31 -8
  90. package/dist/core/patterns.js.map +1 -1
  91. package/dist/core/permissions.d.ts.map +1 -1
  92. package/dist/core/permissions.js +21 -10
  93. package/dist/core/permissions.js.map +1 -1
  94. package/dist/core/registry.d.ts.map +1 -1
  95. package/dist/core/registry.js +10 -6
  96. package/dist/core/registry.js.map +1 -1
  97. package/dist/core/snapshots.d.ts.map +1 -1
  98. package/dist/core/snapshots.js +17 -5
  99. package/dist/core/snapshots.js.map +1 -1
  100. package/dist/core/types.d.ts +33 -0
  101. package/dist/core/types.d.ts.map +1 -1
  102. package/dist/core/types.js.map +1 -1
  103. package/dist/hooks/index.js.map +1 -1
  104. package/dist/index.d.ts +114 -6
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +92 -4
  107. package/dist/index.js.map +1 -1
  108. package/dist/memory/index.d.ts +38 -0
  109. package/dist/memory/index.d.ts.map +1 -1
  110. package/dist/memory/index.js +136 -24
  111. package/dist/memory/index.js.map +1 -1
  112. package/dist/memory/schema.d.ts +1 -0
  113. package/dist/memory/schema.d.ts.map +1 -1
  114. package/dist/memory/schema.js +20 -19
  115. package/dist/memory/schema.js.map +1 -1
  116. package/dist/plugin/index.d.ts.map +1 -1
  117. package/dist/plugin/index.js.map +1 -1
  118. package/dist/runtime/acp.d.ts.map +1 -1
  119. package/dist/runtime/acp.js +71 -41
  120. package/dist/runtime/acp.js.map +1 -1
  121. package/dist/runtime/adaptive.d.ts.map +1 -1
  122. package/dist/runtime/adaptive.js +30 -31
  123. package/dist/runtime/adaptive.js.map +1 -1
  124. package/dist/runtime/agent-runner.d.ts +62 -0
  125. package/dist/runtime/agent-runner.d.ts.map +1 -0
  126. package/dist/runtime/agent-runner.js +224 -0
  127. package/dist/runtime/agent-runner.js.map +1 -0
  128. package/dist/runtime/autonomy.d.ts +1 -0
  129. package/dist/runtime/autonomy.d.ts.map +1 -1
  130. package/dist/runtime/autonomy.js +37 -19
  131. package/dist/runtime/autonomy.js.map +1 -1
  132. package/dist/runtime/backends/claude.d.ts.map +1 -1
  133. package/dist/runtime/backends/claude.js +2 -2
  134. package/dist/runtime/backends/claude.js.map +1 -1
  135. package/dist/runtime/backends/codex.d.ts.map +1 -1
  136. package/dist/runtime/backends/codex.js +8 -11
  137. package/dist/runtime/backends/codex.js.map +1 -1
  138. package/dist/runtime/backends/gemini.d.ts.map +1 -1
  139. package/dist/runtime/backends/gemini.js +11 -7
  140. package/dist/runtime/backends/gemini.js.map +1 -1
  141. package/dist/runtime/backends/index.js +1 -1
  142. package/dist/runtime/backends/index.js.map +1 -1
  143. package/dist/runtime/backends/mock.d.ts.map +1 -1
  144. package/dist/runtime/backends/mock.js +1 -1
  145. package/dist/runtime/backends/mock.js.map +1 -1
  146. package/dist/runtime/backends/vercel-ai.d.ts.map +1 -1
  147. package/dist/runtime/backends/vercel-ai.js +41 -9
  148. package/dist/runtime/backends/vercel-ai.js.map +1 -1
  149. package/dist/runtime/cache-optimizer.d.ts.map +1 -1
  150. package/dist/runtime/cache-optimizer.js +3 -9
  151. package/dist/runtime/cache-optimizer.js.map +1 -1
  152. package/dist/runtime/cascade.d.ts.map +1 -1
  153. package/dist/runtime/cascade.js +34 -7
  154. package/dist/runtime/cascade.js.map +1 -1
  155. package/dist/runtime/chunker.d.ts.map +1 -1
  156. package/dist/runtime/chunker.js +12 -6
  157. package/dist/runtime/chunker.js.map +1 -1
  158. package/dist/runtime/compounder.d.ts +1 -1
  159. package/dist/runtime/compounder.d.ts.map +1 -1
  160. package/dist/runtime/compounder.js +30 -11
  161. package/dist/runtime/compounder.js.map +1 -1
  162. package/dist/runtime/cost-model.d.ts.map +1 -1
  163. package/dist/runtime/cost-model.js +1 -1
  164. package/dist/runtime/cost-model.js.map +1 -1
  165. package/dist/runtime/database.d.ts +16 -0
  166. package/dist/runtime/database.d.ts.map +1 -0
  167. package/dist/runtime/database.js +39 -0
  168. package/dist/runtime/database.js.map +1 -0
  169. package/dist/runtime/distiller.d.ts.map +1 -1
  170. package/dist/runtime/distiller.js +6 -3
  171. package/dist/runtime/distiller.js.map +1 -1
  172. package/dist/runtime/engine.d.ts +25 -9
  173. package/dist/runtime/engine.d.ts.map +1 -1
  174. package/dist/runtime/engine.js +417 -378
  175. package/dist/runtime/engine.js.map +1 -1
  176. package/dist/runtime/execution-graph.d.ts +86 -0
  177. package/dist/runtime/execution-graph.d.ts.map +1 -0
  178. package/dist/runtime/execution-graph.js +441 -0
  179. package/dist/runtime/execution-graph.js.map +1 -0
  180. package/dist/runtime/executor.d.ts +1 -2
  181. package/dist/runtime/executor.d.ts.map +1 -1
  182. package/dist/runtime/executor.js +45 -14
  183. package/dist/runtime/executor.js.map +1 -1
  184. package/dist/runtime/graph-adversarial.d.ts +88 -0
  185. package/dist/runtime/graph-adversarial.d.ts.map +1 -0
  186. package/dist/runtime/graph-adversarial.js +378 -0
  187. package/dist/runtime/graph-adversarial.js.map +1 -0
  188. package/dist/runtime/graph-analyzer.d.ts +106 -0
  189. package/dist/runtime/graph-analyzer.d.ts.map +1 -0
  190. package/dist/runtime/graph-analyzer.js +321 -0
  191. package/dist/runtime/graph-analyzer.js.map +1 -0
  192. package/dist/runtime/graph-causal.d.ts +91 -0
  193. package/dist/runtime/graph-causal.d.ts.map +1 -0
  194. package/dist/runtime/graph-causal.js +292 -0
  195. package/dist/runtime/graph-causal.js.map +1 -0
  196. package/dist/runtime/graph-context-router.d.ts +73 -0
  197. package/dist/runtime/graph-context-router.d.ts.map +1 -0
  198. package/dist/runtime/graph-context-router.js +162 -0
  199. package/dist/runtime/graph-context-router.js.map +1 -0
  200. package/dist/runtime/graph-discovery.d.ts +71 -0
  201. package/dist/runtime/graph-discovery.d.ts.map +1 -0
  202. package/dist/runtime/graph-discovery.js +367 -0
  203. package/dist/runtime/graph-discovery.js.map +1 -0
  204. package/dist/runtime/graph-dropout.d.ts +59 -0
  205. package/dist/runtime/graph-dropout.d.ts.map +1 -0
  206. package/dist/runtime/graph-dropout.js +196 -0
  207. package/dist/runtime/graph-dropout.js.map +1 -0
  208. package/dist/runtime/graph-embeddings.d.ts +58 -0
  209. package/dist/runtime/graph-embeddings.d.ts.map +1 -0
  210. package/dist/runtime/graph-embeddings.js +301 -0
  211. package/dist/runtime/graph-embeddings.js.map +1 -0
  212. package/dist/runtime/graph-feedback.d.ts +30 -0
  213. package/dist/runtime/graph-feedback.d.ts.map +1 -0
  214. package/dist/runtime/graph-feedback.js +82 -0
  215. package/dist/runtime/graph-feedback.js.map +1 -0
  216. package/dist/runtime/graph-gnn.d.ts +120 -0
  217. package/dist/runtime/graph-gnn.d.ts.map +1 -0
  218. package/dist/runtime/graph-gnn.js +524 -0
  219. package/dist/runtime/graph-gnn.js.map +1 -0
  220. package/dist/runtime/graph-learner.d.ts +70 -0
  221. package/dist/runtime/graph-learner.d.ts.map +1 -0
  222. package/dist/runtime/graph-learner.js +265 -0
  223. package/dist/runtime/graph-learner.js.map +1 -0
  224. package/dist/runtime/graph-meta-adversarial.d.ts +113 -0
  225. package/dist/runtime/graph-meta-adversarial.d.ts.map +1 -0
  226. package/dist/runtime/graph-meta-adversarial.js +366 -0
  227. package/dist/runtime/graph-meta-adversarial.js.map +1 -0
  228. package/dist/runtime/graph-meta.d.ts +115 -0
  229. package/dist/runtime/graph-meta.d.ts.map +1 -0
  230. package/dist/runtime/graph-meta.js +437 -0
  231. package/dist/runtime/graph-meta.js.map +1 -0
  232. package/dist/runtime/graph-self-evolve.d.ts +92 -0
  233. package/dist/runtime/graph-self-evolve.d.ts.map +1 -0
  234. package/dist/runtime/graph-self-evolve.js +422 -0
  235. package/dist/runtime/graph-self-evolve.js.map +1 -0
  236. package/dist/runtime/graph-synthesis.d.ts +47 -0
  237. package/dist/runtime/graph-synthesis.d.ts.map +1 -0
  238. package/dist/runtime/graph-synthesis.js +232 -0
  239. package/dist/runtime/graph-synthesis.js.map +1 -0
  240. package/dist/runtime/graph-trajectory.d.ts +88 -0
  241. package/dist/runtime/graph-trajectory.d.ts.map +1 -0
  242. package/dist/runtime/graph-trajectory.js +339 -0
  243. package/dist/runtime/graph-trajectory.js.map +1 -0
  244. package/dist/runtime/heuristics.d.ts +1 -0
  245. package/dist/runtime/heuristics.d.ts.map +1 -1
  246. package/dist/runtime/heuristics.js +44 -22
  247. package/dist/runtime/heuristics.js.map +1 -1
  248. package/dist/runtime/learning-engine.d.ts +63 -0
  249. package/dist/runtime/learning-engine.d.ts.map +1 -0
  250. package/dist/runtime/learning-engine.js +273 -0
  251. package/dist/runtime/learning-engine.js.map +1 -0
  252. package/dist/runtime/living-spec.js +3 -3
  253. package/dist/runtime/living-spec.js.map +1 -1
  254. package/dist/runtime/lsp.d.ts.map +1 -1
  255. package/dist/runtime/lsp.js +41 -14
  256. package/dist/runtime/lsp.js.map +1 -1
  257. package/dist/runtime/mcp.d.ts.map +1 -1
  258. package/dist/runtime/mcp.js +56 -19
  259. package/dist/runtime/mcp.js.map +1 -1
  260. package/dist/runtime/model-router.d.ts +1 -0
  261. package/dist/runtime/model-router.d.ts.map +1 -1
  262. package/dist/runtime/model-router.js +37 -21
  263. package/dist/runtime/model-router.js.map +1 -1
  264. package/dist/runtime/panes.d.ts.map +1 -1
  265. package/dist/runtime/panes.js +50 -49
  266. package/dist/runtime/panes.js.map +1 -1
  267. package/dist/runtime/plan-search.js +2 -2
  268. package/dist/runtime/plan-search.js.map +1 -1
  269. package/dist/runtime/plugins.d.ts +1 -1
  270. package/dist/runtime/plugins.d.ts.map +1 -1
  271. package/dist/runtime/plugins.js +63 -47
  272. package/dist/runtime/plugins.js.map +1 -1
  273. package/dist/runtime/reflexion.d.ts.map +1 -1
  274. package/dist/runtime/reflexion.js +4 -8
  275. package/dist/runtime/reflexion.js.map +1 -1
  276. package/dist/runtime/review-schema.d.ts.map +1 -1
  277. package/dist/runtime/review-schema.js +12 -12
  278. package/dist/runtime/review-schema.js.map +1 -1
  279. package/dist/runtime/rewriter.d.ts.map +1 -1
  280. package/dist/runtime/rewriter.js +29 -9
  281. package/dist/runtime/rewriter.js.map +1 -1
  282. package/dist/runtime/sharing.d.ts +1 -1
  283. package/dist/runtime/sharing.d.ts.map +1 -1
  284. package/dist/runtime/sharing.js +55 -27
  285. package/dist/runtime/sharing.js.map +1 -1
  286. package/dist/runtime/stats.d.ts +1 -0
  287. package/dist/runtime/stats.d.ts.map +1 -1
  288. package/dist/runtime/stats.js +40 -24
  289. package/dist/runtime/stats.js.map +1 -1
  290. package/dist/runtime/templates.d.ts.map +1 -1
  291. package/dist/runtime/templates.js +2 -2
  292. package/dist/runtime/templates.js.map +1 -1
  293. package/dist/runtime/traces.d.ts +1 -0
  294. package/dist/runtime/traces.d.ts.map +1 -1
  295. package/dist/runtime/traces.js +50 -28
  296. package/dist/runtime/traces.js.map +1 -1
  297. package/dist/runtime/verifier.d.ts.map +1 -1
  298. package/dist/runtime/verifier.js +12 -6
  299. package/dist/runtime/verifier.js.map +1 -1
  300. package/dist/runtime/worktree.d.ts.map +1 -1
  301. package/dist/runtime/worktree.js +35 -18
  302. package/dist/runtime/worktree.js.map +1 -1
  303. package/dist/tui/dashboard.d.ts.map +1 -1
  304. package/dist/tui/dashboard.js +20 -16
  305. package/dist/tui/dashboard.js.map +1 -1
  306. package/dist/tui/progress.d.ts +2 -0
  307. package/dist/tui/progress.d.ts.map +1 -1
  308. package/dist/tui/progress.js +105 -33
  309. package/dist/tui/progress.js.map +1 -1
  310. package/dist/tui/renderer.d.ts.map +1 -1
  311. package/dist/tui/renderer.js.map +1 -1
  312. package/dist/utils/compact-format.js +1 -1
  313. package/dist/utils/compact-format.js.map +1 -1
  314. package/dist/utils/config.d.ts.map +1 -1
  315. package/dist/utils/config.js.map +1 -1
  316. package/dist/utils/env.d.ts.map +1 -1
  317. package/dist/utils/env.js +19 -5
  318. package/dist/utils/env.js.map +1 -1
  319. package/dist/utils/errors.d.ts.map +1 -1
  320. package/dist/utils/errors.js +3 -7
  321. package/dist/utils/errors.js.map +1 -1
  322. package/dist/utils/output.d.ts.map +1 -1
  323. package/dist/utils/output.js +6 -2
  324. package/dist/utils/output.js.map +1 -1
  325. package/dist/utils/project-config.d.ts +18 -0
  326. package/dist/utils/project-config.d.ts.map +1 -1
  327. package/dist/utils/project-config.js +14 -6
  328. package/dist/utils/project-config.js.map +1 -1
  329. package/dist/utils/schemas.d.ts.map +1 -1
  330. package/dist/utils/schemas.js +12 -12
  331. package/dist/utils/schemas.js.map +1 -1
  332. package/dist/utils/terminal.d.ts.map +1 -1
  333. package/dist/utils/terminal.js +18 -7
  334. package/dist/utils/terminal.js.map +1 -1
  335. package/dist/utils/tiers.d.ts.map +1 -1
  336. package/dist/utils/tiers.js +14 -6
  337. package/dist/utils/tiers.js.map +1 -1
  338. package/package.json +15 -4
  339. package/skills/swarm-output-style/SKILL.md +154 -48
package/CLAUDE.md CHANGED
@@ -54,7 +54,7 @@ src/
54
54
  ├── memory/ # SQLite + FTS5 + Obsidian vault sync
55
55
  ├── hooks/ # TypeScript hook handlers (universal ANSI)
56
56
  ├── plugin/ # Claude Code plugin generator
57
- ├── cli/ # 21 CLI commands (15 visible + 6 hidden)
57
+ ├── cli/ # 23 CLI commands (17 visible + 6 hidden)
58
58
  └── utils/ # Logger, config, terminal, paths, redact, tokens, errors, env
59
59
  ```
60
60
 
package/README.md CHANGED
@@ -1,37 +1,59 @@
1
1
  # Swarm Engine
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/swarm-engine)](https://www.npmjs.com/package/swarm-engine)
4
+ [![Node](https://img.shields.io/node/v/swarm-engine)](https://nodejs.org)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
+ [![Tests](https://img.shields.io/badge/tests-1278%20passing-brightgreen)]()
7
+
3
8
  **Your agents. Orchestrated.**
4
9
 
5
- Coordinate multiple AI agents working on your code - researching, implementing, reviewing, testing - with an intelligent planner that learns from every run.
10
+ The first self-aware AI orchestration engine. A 16-module ML pipeline -- built in pure TypeScript with zero external ML dependencies -- that predicts its own failures, explains them causally, and evolves its own rules. Underneath: 26 agents, 7 composable patterns, and a persistent knowledge graph that compounds intelligence across every run.
6
11
 
7
- Works with Claude Code, OpenAI Codex, and Google Gemini CLI. Mix models across agents in the same orchestration.
12
+ Works with Claude Code, OpenAI Codex, Google Gemini CLI, and Vercel AI SDK. Mix models across agents in the same orchestration.
8
13
 
9
14
  ## What It Looks Like
10
15
 
11
16
  ```
12
- Swarm Engine - hybrid pattern
17
+ Swarm Engine hybrid pattern
18
+
19
+ Phase: research ━━━━━━━━━━━━━━━━━━━━ done
20
+ ✓ researcher-code sonnet-4-6 3.2K tok 14s
21
+ ✓ researcher-context sonnet-4-6 1.8K tok 9s
13
22
 
14
- Phase 1: research ━━━━━━━━━━━━━━━━━━━━ 100% 42s
15
- researcher-code sonnet 3.2K tokens
16
- ✓ researcher-context sonnet 1.8K tokens
23
+ Phase: implement ━━━━━━━━━━━━━━━━━━━ 1m 12s
24
+ implementer opus-4-6 8.4K tok 1m 12s src/auth/rate-limit.ts
17
25
 
18
- Phase 2: implement ━━━━━━━━━━━━━━━━━━━ 55% 1m 12s
19
- implementer opus src/auth/rate-limit.ts...
26
+ Phase: review ────────────────────── pending
27
+ reviewer-security opus-4-6
28
+ ○ reviewer-perf sonnet-4-6
29
+ ○ reviewer-convention sonnet-4-6
20
30
 
21
- Phase 3: review pending
22
- ○ reviewer-correctness ○ reviewer-security ○ reviewer-convention
31
+ Timeline: ━━──── (1/3 phases)
23
32
 
24
- $0.24 spent | 12.8K tokens | ~2m remaining
33
+ Recent findings:
34
+ ○ researcher-code: express-rate-limit already in package.json
35
+ ○ researcher-context: vault says rate limiter goes before auth middleware
36
+
37
+ 12.8K tokens │ $0.24 │ 1m 36s ~2m remaining
25
38
  ```
26
39
 
27
40
  ```
28
- ┌─────────────────────────────────────────────────┐
29
- │ ✓ Orchestration complete │
30
- Pattern: hybrid (3 phases, 6 agents) │
31
- │ Duration: 3m 42s | Tokens: 47K | Cost: $0.38 │
32
- │ │
33
- Save as template? deploy-lambda │
34
- └─────────────────────────────────────────────────┘
41
+ +---------------------------------------------------------+
42
+ | |
43
+ | Orchestration complete |
44
+ | |
45
+ | Pattern: hybrid (3 phases, 6 agents) |
46
+ | Duration: 3m 42s |
47
+ | Tokens: 47.2K |
48
+ | Cost: $0.3814 |
49
+ | Tools: 142 calls |
50
+ | |
51
+ | Changes: |
52
+ | src/middleware/rate-limit.ts 48 +++ |
53
+ | src/routes/users.ts 3 +- |
54
+ | tests/middleware/rate-limit.test.ts 62 +++ |
55
+ | |
56
+ +---------------------------------------------------------+
35
57
  ```
36
58
 
37
59
  ## Install
@@ -66,17 +88,34 @@ Requires Node.js 20+, jq, and at least one of Claude Code, Codex, or Gemini CLI.
66
88
 
67
89
  ## Quick Start
68
90
 
69
- ```bash
70
- # From Claude Code (agents run in split panes)
91
+ In Claude Code:
92
+ ```
71
93
  /swarm "add rate limiting to the API"
94
+ ```
95
+
96
+ That's it. Agents spawn as teammates, research the codebase, implement the changes, and review the result. You see their work in split panes and get a summary when they're done.
72
97
 
73
- # From any terminal
74
- swarm orchestrate "add rate limiting to the API"
98
+ Other slash commands for specific patterns:
99
+ ```
100
+ /research "how does the auth system work?"
101
+ /tdd "add input validation to user endpoints"
102
+ /red-team "harden the payment flow"
103
+ /review-cycle "refactor the database layer"
104
+ ```
105
+
106
+ ### Standalone CLI
107
+
108
+ You can also run orchestrations directly from any terminal, outside of Claude Code:
75
109
 
76
- # Preview what will happen before running
77
- swarm plan "add rate limiting" --dry-run
110
+ ```bash
111
+ swarm orchestrate "add rate limiting" # inline progress
112
+ swarm orchestrate "add rate limiting" --panes # tmux split panes
113
+ swarm orchestrate "add rate limiting" --tui # full-screen dashboard
114
+ swarm plan "add rate limiting" # preview plan (free)
78
115
  ```
79
116
 
117
+ The `--panes` flag uses tmux to show each agent in its own split pane. Install with `brew install tmux` (macOS) or `sudo apt install tmux` (Linux).
118
+
80
119
  ## VS Code and Cursor
81
120
 
82
121
  Swarm Engine ships with a VS Code extension that works in both VS Code and Cursor.
@@ -103,18 +142,84 @@ Then: `Cmd+Shift+P` > "Extensions: Install from VSIX" > select the `.vsix` file.
103
142
  @swarm status
104
143
  ```
105
144
 
145
+ ## Use as a Library
146
+
147
+ Swarm Engine can be imported directly into Node.js applications:
148
+
149
+ ```bash
150
+ npm install swarm-engine
151
+ ```
152
+
153
+ ```ts
154
+ import { SwarmEngine } from 'swarm-engine';
155
+
156
+ const engine = new SwarmEngine({ mock: true });
157
+ const result = await engine.orchestrate({
158
+ task: 'Build a REST API',
159
+ pattern: 'hybrid',
160
+ });
161
+ console.log(result.status);
162
+ ```
163
+
164
+ Key exports:
165
+
166
+ ```ts
167
+ import {
168
+ SwarmEngine, // Main orchestration engine
169
+ AgentRegistry, // Load and manage agent definitions
170
+ EventBus, // Typed event system for monitoring
171
+ PatternRegistry, // Composable orchestration patterns
172
+ BackendRegistry, // Multi-backend (Claude, Codex, Gemini, Vercel AI)
173
+ CostModel, // Estimate token costs before running
174
+ ModelRouter, // UCB1-based model selection
175
+ TemplateRegistry, // Save and replay successful workflows
176
+ } from 'swarm-engine';
177
+
178
+ // Tier 1: Core Graph
179
+ import {
180
+ ExecutionGraph, // Persistent execution knowledge graph
181
+ GraphLearner, // Cross-run pattern learning
182
+ GraphContextRouter, // Relevance-scored context assembly
183
+ GraphAnalyzer, // Topology analysis and failure prediction
184
+ ReviewFeedbackRecorder, // Review findings into graph
185
+ } from 'swarm-engine';
186
+
187
+ // Tier 2: Advanced ML
188
+ import {
189
+ CausalGraphEngine, // Do-calculus causal inference
190
+ FailurePropagationPredictor, // 3-layer GNN failure prediction
191
+ AdversarialEvolver, // Thompson sampling red-team
192
+ MetaPatternSelector, // TF-IDF + logistic pattern recommendation
193
+ PredictiveDropout, // Active learning agent dropout
194
+ } from 'swarm-engine';
195
+
196
+ // Tier 3: Self-Aware Engine
197
+ import {
198
+ PatternSynthesizer, // Topology diff → novel patterns
199
+ TrajectoryPredictor, // Mid-run success prediction
200
+ MetaAdversarialTester, // Red-teams the engine's own ML
201
+ RuleEvolver, // Self-evolving replanning rules
202
+ TaskDiscovery, // Mines failure patterns for tasks
203
+ OrchestrationEmbedder, // Topology embeddings for transfer learning
204
+ } from 'swarm-engine';
205
+ ```
206
+
207
+ See [src/index.ts](src/index.ts) for the full export surface.
208
+
106
209
  ## Why Swarm Engine
107
210
 
108
- AI coding agents work alone. You get one agent, one model, one approach. For complex tasks, that's not enough.
211
+ Tools like Claude Code already let you spawn parallel agents with teams. That's powerful infrastructure. Swarm Engine builds on top of it with the parts you'd otherwise have to figure out yourself: which agents to run, in what order, with what prompts, on which models, and how to learn from the results.
109
212
 
110
- Swarm Engine orchestrates multiple agents in parallel. Each has a specialized role, the right model for the job, and shared knowledge from past runs.
213
+ It gives you composable patterns, cost-aware planning, specialized agent definitions, and a memory system that improves with every run. Think of it as the orchestration layer that turns ad-hoc multi-agent work into repeatable workflows.
111
214
 
112
- - **7 composable patterns** - hybrid, TDD, red-team, spike, discover, review-cycle, research. Compose them: `--pattern "research | tdd | red-team"`
215
+ - **Self-aware ML pipeline** - the engine predicts its own failures (GNN), explains them causally (do-calculus), and evolves its own replanning rules. All in pure TypeScript, zero external ML dependencies.
216
+ - **16 graph modules across 3 tiers** - persistent knowledge graph, causal inference, GNN failure propagation, trajectory prediction, orchestration embeddings, and self-evolving rules.
217
+ - **7 composable patterns** - hybrid, TDD, red-team, spike, discover, review-cycle, research. Compose them: `--pattern "tdd | red-team"`. Plus 12 slash commands including postmortem, diff-review, and fix-pr.
113
218
  - **Intelligent planner** - cost-based optimization, adaptive execution, learns from every run
114
219
  - **Mix any backend** - Claude for implementation, Codex for review, Gemini for research. Different model per agent.
115
220
  - **Reusable templates** - save successful workflows, run them again with different parameters
116
221
  - **26 specialized agents** - 16 core roles plus 10 focused reviewers (security, performance, data integrity, API contracts, testing, accessibility, dependencies, error handling, concurrency, documentation)
117
- - **871 tests** - 4 rounds of security review, clean on all adversarial attack vectors
222
+ - **1,278 tests across 76 files** - 4 rounds of security review, clean on all adversarial attack vectors
118
223
 
119
224
  ## Templates
120
225
 
@@ -171,6 +276,8 @@ swarm plan "add auth middleware" --pattern hybrid
171
276
  | `/spike <problem>` | Two approaches compete, judge picks winner |
172
277
  | `/red-team <task>` | Adversarial build and break |
173
278
  | `/discover <problem>` | Hypothesize, experiment, implement winner |
279
+ | `/dynamic <task>` | Planner decomposes into custom agent workflow |
280
+ | `/postmortem <error>` | Root cause analysis, fix, and prevention |
174
281
  | `/fix-pr <PR#>` | Fix PR review comments |
175
282
  | `/resume` | Resume from checkpoint |
176
283
 
@@ -228,9 +335,17 @@ swarm convert --to opencode # OpenCode agents
228
335
  swarm convert --to windsurf # Windsurf skills
229
336
  ```
230
337
 
231
- ## Memory
338
+ ## Memory and Knowledge Graph Intelligence
339
+
340
+ SQLite-backed knowledge base with full-text search, plus a 3-tier Execution Knowledge Graph that records every orchestration as a persistent, queryable topology. Syncs to Obsidian vault for cross-machine access.
341
+
342
+ **Tier 1 -- Core Graph.** ExecutionGraph records orchestration topology. GraphLearner extracts cross-run patterns. GraphContextRouter replaces dump-everything context with relevance-scored assembly. GraphAnalyzer detects god nodes, bottlenecks, and topology risks.
343
+
344
+ **Tier 2 -- Advanced ML.** CausalGraphEngine applies do-calculus to estimate treatment effects and suggest interventions. FailurePropagationPredictor uses a 3-layer GNN to predict which nodes are at risk before execution starts. MetaPatternSelector recommends orchestration patterns via TF-IDF + logistic regression. PredictiveDropout uses active learning to skip redundant agents.
345
+
346
+ **Tier 3 -- Self-Aware Engine.** PatternSynthesizer generates novel orchestration patterns from topology diffs. TrajectoryPredictor forecasts orchestration success mid-run. RuleEvolver proposes and backtests its own replanning rules from historical failures. TaskDiscovery mines the graph for actionable tasks. OrchestrationEmbedder produces topology-based embeddings for similarity search and transfer learning. MetaAdversarialTester red-teams the engine's own ML subsystems.
232
347
 
233
- SQLite-backed knowledge base with full-text search. Syncs to Obsidian vault for cross-machine access. The engine learns from every run and compounds knowledge over time.
348
+ All ML is implemented in pure TypeScript with zero external ML dependencies.
234
349
 
235
350
  ```bash
236
351
  swarm memory search "authentication"
@@ -5,11 +5,25 @@ argument-hint: "[base-branch] (default: main)"
5
5
 
6
6
  You are reviewing the current branch's diff with parallel reviewers before creating a PR.
7
7
 
8
+ Follow the `swarm-output-style` skill for ALL output formatting.
9
+
8
10
  ## Task
9
11
  $ARGUMENTS
10
12
 
11
13
  ## Workflow
12
14
 
15
+ ### Step 0: Show Pre-flight Plan
16
+
17
+ Before creating any team or spawning any agent, show the plan:
18
+
19
+ Show the pre-flight plan (see swarm-output-style skill). Include:
20
+ - Base branch and diff summary (file count, approximate line count)
21
+ - The 3 reviewers with model and focus area
22
+ - Estimated cost (~$0.10 correctness, ~$0.10 security, ~$0.04 convention = ~$0.24 total)
23
+ - Estimated time (~5-10 min)
24
+
25
+ Wait for user approval before proceeding.
26
+
13
27
  ### Setup: Create Team
14
28
  1. Create a team with `TeamCreate` (name: `diff-review-<timestamp>`, e.g., `diff-review-1234`)
15
29
  2. Create tasks with `TaskCreate` for each reviewer focus area
@@ -21,13 +35,16 @@ Determine the base branch (default: `main` if no argument provided). Run:
21
35
  - Identify all changed files
22
36
 
23
37
  ### Step 2: Dispatch Reviewers (parallel)
38
+
39
+ Show the phase banner with running total (see swarm-output-style skill).
40
+
24
41
  Spawn 3 reviewer teammates simultaneously, each with `team_name`, `name` (e.g., `reviewer-correctness`, `reviewer-security`, `reviewer-convention`), and `run_in_background: true`, each with the full diff, commit history, and project CLAUDE.md:
25
42
 
26
43
  1. **Correctness reviewer** (opus) — Logic errors, edge cases, off-by-ones, error handling, race conditions, resource leaks
27
44
  2. **Security reviewer** (opus) — OWASP top 10, auth issues, injection, data exposure, secrets in code
28
45
  3. **Convention reviewer** (sonnet) — Project patterns, naming, structure, CLAUDE.md compliance, test coverage
29
46
 
30
- As each reviewer teammate completes, send it a `shutdown_request` via `SendMessage` to close its split pane.
47
+ As each completes: show a one-line verdict (PASS/FAIL + finding count) (see swarm-output-style skill), then send `shutdown_request` via `SendMessage`.
31
48
 
32
49
  ### Step 3: Aggregate
33
50
  Merge all findings and categorize by priority:
@@ -36,21 +53,14 @@ Merge all findings and categorize by priority:
36
53
  - **Suggestion** — note in PR description (style, optional improvements)
37
54
 
38
55
  ### Step 4: Recommend
39
- Based on findings, give one recommendation:
40
-
41
- ```
42
- ## Diff Review Results
43
-
44
- ### Findings
45
- | Priority | File | Line | Finding | Reviewer |
46
- |----------|------|------|---------|----------|
47
- | Critical | ... | ... | ... | ... |
48
56
 
49
- ### Verdict
50
- - **Critical issues found** "Fix these before creating a PR"
51
- - **Only Important/Suggestions** "Ready for PR — consider addressing these"
52
- - **Clean** "LGTM ready for PR"
53
- ```
57
+ Show the full post-completion summary (see swarm-output-style skill). Include:
58
+ - Status (PASS / NEEDS ATTENTION / FAILED)
59
+ - Metrics (agents, duration, tokens, cost)
60
+ - Review gate result with per-reviewer table (findings by severity)
61
+ - Consolidated findings table (Priority | File | Line | Finding | Reviewer)
62
+ - Verdict: "Fix these before creating a PR" / "Ready for PR — consider addressing these" / "LGTM — ready for PR"
63
+ - Next steps (git push, gh pr create, or fix commands)
54
64
 
55
65
  ### Cleanup
56
66
  1. Send `shutdown_request` via `SendMessage` to any remaining active teammates
@@ -62,3 +72,5 @@ Based on findings, give one recommendation:
62
72
  - Include full diff context for each reviewer — they cannot access git
63
73
  - This workflow is read-only — report findings, never fix anything
64
74
  - Include file:line references for every finding
75
+ - Follow the swarm-output-style skill for ALL output formatting
76
+ - Show the plan first, spend tokens second
@@ -0,0 +1,102 @@
1
+ ---
2
+ description: "Hypothesis-driven development — form theories, test cheaply, build the winner"
3
+ argument-hint: "<complex problem where the right approach is unclear>"
4
+ ---
5
+
6
+ You are running a discovery cycle: form hypotheses, test them cheaply, then implement the winner.
7
+
8
+ Follow the `swarm-output-style` skill for ALL output formatting.
9
+
10
+ ## Task
11
+ $ARGUMENTS
12
+
13
+ ## Workflow
14
+
15
+ ### Step 0: Show Pre-flight Plan
16
+
17
+ Before creating any team or spawning any agent, show the plan:
18
+
19
+ Show the pre-flight plan (see swarm-output-style skill). Include:
20
+ - All phases (Hypothesize, Experiment, Implement, Review)
21
+ - Agents per phase with model and focus
22
+ - Estimated cost (~$0.12 hypothesize, ~$0.12 experiment at sonnet rates, ~$0.19 implement, ~$0.20 review)
23
+ - Estimated time (~20-40 min total)
24
+
25
+ Wait for user approval before proceeding.
26
+
27
+ ### Setup: Create Team
28
+ 1. Create a team with `TeamCreate` (name: `discover-<timestamp>`)
29
+ 2. Create tasks with `TaskCreate` for each work unit
30
+
31
+ ### Phase 1: Hypothesize — parallel
32
+
33
+ Show the phase banner with running total (see swarm-output-style skill).
34
+
35
+ Spawn 2-3 researcher teammates (sonnet) simultaneously, each with `team_name`, `name`, and `run_in_background: true`:
36
+ - Each researcher explores a different angle of the problem
37
+ - Each proposes a hypothesis: "I think the best approach is X because Y"
38
+ - Each identifies what evidence would prove or disprove the hypothesis
39
+
40
+ As each completes: show a one-line completion summary (see swarm-output-style skill), then send `shutdown_request` via `SendMessage`.
41
+
42
+ Present the hypotheses to the user. Select 2-3 to test.
43
+
44
+ ### Phase 2: Experiment — parallel (cheap, fast)
45
+
46
+ Show the phase banner with running total (see swarm-output-style skill).
47
+
48
+ Spawn 2-3 implementer teammates (sonnet, not opus — keep it cheap) simultaneously, each with `team_name`, `name`, and `run_in_background: true`:
49
+ - Each builds a minimal proof-of-concept for one hypothesis
50
+ - NOT a full implementation — just enough to validate or invalidate
51
+ - Time-box: keep experiments under 5 minutes each
52
+ - Each reports: hypothesis confirmed or rejected, with evidence
53
+
54
+ As each completes: show a one-line completion summary (confirmed/rejected + key evidence) (see swarm-output-style skill), then send `shutdown_request` via `SendMessage`.
55
+
56
+ Present the experiment results. Identify the winning hypothesis.
57
+
58
+ ### Phase 3: Implement — sequential (depends on Phase 2)
59
+
60
+ Show the phase banner with running total (see swarm-output-style skill).
61
+
62
+ Spawn an implementer teammate (opus) with `team_name`, `name`, and `run_in_background: true`:
63
+ - Full implementation of the winning approach
64
+ - Informed by what was learned from ALL experiments (including failed ones)
65
+ - Include tests
66
+
67
+ As the teammate completes: show a one-line completion summary (see swarm-output-style skill), then send `shutdown_request` via `SendMessage`.
68
+
69
+ ### Phase 4: Review — parallel (depends on Phase 3)
70
+
71
+ Show the phase banner with running total (see swarm-output-style skill).
72
+
73
+ Spawn 2 reviewer teammates (opus) simultaneously with `team_name`, `name`, and `run_in_background: true`:
74
+ - **reviewer-correctness**: Logic, edge cases, error handling
75
+ - **reviewer-convention**: Project patterns, code style
76
+
77
+ As each completes: show a one-line verdict (PASS/FAIL + finding count) (see swarm-output-style skill), then send `shutdown_request` via `SendMessage`.
78
+
79
+ ### Phase 5: Report
80
+
81
+ Show the full post-completion summary (see swarm-output-style skill). Include:
82
+ - Status (PASS / NEEDS ATTENTION / FAILED)
83
+ - Metrics (phases, agents, duration, tokens, cost)
84
+ - Hypotheses tested (table with confirmed/rejected)
85
+ - Winner and rationale
86
+ - What was learned from rejected hypotheses
87
+ - What changed (files)
88
+ - Review gate result
89
+ - Next steps
90
+
91
+ ### Cleanup
92
+ 1. Send `shutdown_request` via `SendMessage` to any remaining active teammates
93
+ 2. Call `TeamDelete` to clean up the team
94
+
95
+ ## Rules
96
+ - All agents must be spawned as team members (TeamCreate → TaskCreate → Agent with team_name/name/run_in_background → SendMessage shutdown → TeamDelete)
97
+ - Experiments must be CHEAP — use sonnet, keep scope minimal, time-box to 5 minutes
98
+ - Failed experiments are valuable — include their learnings in the final implementation context
99
+ - The user approves the winning hypothesis before full implementation begins
100
+ - If no hypothesis is clearly better, recommend combining the best elements from multiple experiments
101
+ - Follow the swarm-output-style skill for ALL output formatting
102
+ - Show the plan first, spend tokens second
@@ -0,0 +1,136 @@
1
+ ---
2
+ description: "Let the planner decompose your task into a custom agent workflow -- no pattern selection needed"
3
+ argument-hint: "<any task -- the planner figures out the approach>"
4
+ ---
5
+
6
+ You are running a dynamic orchestration: instead of following a predefined pattern, the planner analyzes the task and builds a custom workflow.
7
+
8
+ Follow the `swarm-output-style` skill for ALL output formatting.
9
+
10
+ ## Task
11
+ $ARGUMENTS
12
+
13
+ ## Workflow
14
+
15
+ ### Step 0: Check Memory
16
+
17
+ Search for relevant context:
18
+ ```bash
19
+ cd ~/dev/swarm-engine && npx tsx src/cli/index.ts memory search "<relevant keywords>"
20
+ ```
21
+
22
+ ### Step 1: Analyze and Decompose
23
+
24
+ You ARE the planner. Analyze the task and decompose it into subtasks. For each subtask, decide:
25
+
26
+ 1. **What agent type** should handle it (researcher, implementer, reviewer, tester, debugger, refactorer, etc.)
27
+ 2. **What model** it needs (expensive tasks like security review get claude-opus-4-6, simple tasks like scanning get claude-sonnet-4-6)
28
+ 3. **What dependencies** it has (which subtasks must complete before this one can start)
29
+ 4. **What files** it will touch (no two agents should modify the same files)
30
+
31
+ Group subtasks into waves based on dependencies:
32
+ - **Wave 1**: Independent tasks that can run in parallel (typically research)
33
+ - **Wave 2**: Tasks that depend on Wave 1 results (typically implementation)
34
+ - **Wave 3**: Tasks that depend on Wave 2 (typically review, testing)
35
+ - Add more waves as needed
36
+
37
+ ### Step 2: Show Pre-flight Plan
38
+
39
+ Present the decomposition as a pre-flight plan:
40
+
41
+ ```
42
+ ## Dynamic Orchestration Plan
43
+
44
+ **Task**: [task description]
45
+ **Waves**: [N] | **Agents**: [N] | **Est. cost**: ~$[amount] | **Est. time**: ~[duration]
46
+
47
+ ### Wave 1 -- parallel (~[time], ~$[cost])
48
+ | Agent | Type | Model | Focus | Dependencies |
49
+ |-------|------|-------|-------|-------------|
50
+ | `name` | [type] | [model] | [what it does] | none |
51
+
52
+ ### Wave 2 -- parallel (~[time], ~$[cost])
53
+ | Agent | Type | Model | Focus | Dependencies |
54
+ |-------|------|-------|-------|-------------|
55
+ | `name` | [type] | [model] | [what it does] | Wave 1 |
56
+
57
+ [repeat for all waves]
58
+
59
+ **File ownership:**
60
+ | Agent | Files |
61
+ |-------|-------|
62
+ | `name` | [files this agent will touch] |
63
+
64
+ Proceed?
65
+ ```
66
+
67
+ Wait for user approval before proceeding.
68
+
69
+ ### Step 3: Create Team and Execute
70
+
71
+ 1. `TeamCreate` (name: `dynamic-<timestamp>`)
72
+ 2. `TaskCreate` for each wave
73
+
74
+ Execute each wave in order:
75
+
76
+ For each wave:
77
+ 1. Show the phase banner with running total
78
+ 2. Spawn all agents in this wave in parallel, each with `team_name`, `name`, and `run_in_background: true`
79
+ 3. Include context from all completed previous waves
80
+ 4. As each completes: show a one-line completion summary, then send `shutdown_request`
81
+ 5. After all agents in the wave complete: show wave summary
82
+
83
+ **Between waves**: If any agent failed or returned low confidence, show error recovery options before proceeding to the next wave.
84
+
85
+ ### Step 4: Quality Gate
86
+
87
+ After the final wave, assess the combined output:
88
+ - Did all agents succeed?
89
+ - Are there file conflicts or inconsistencies between agent outputs?
90
+ - Do the changes compile/pass linting?
91
+
92
+ If issues found, spawn a fixer agent to resolve them.
93
+
94
+ ### Step 5: Record and Report
95
+
96
+ Store results in engine memory:
97
+ ```bash
98
+ echo "<outcome summary>" | cd ~/dev/swarm-engine && npx tsx src/cli/index.ts memory store outcome "<title>" --repo "<repo>"
99
+ ```
100
+
101
+ Show the full post-completion summary (see swarm-output-style skill). Include:
102
+ - Status
103
+ - Wave breakdown (which agents ran in each wave)
104
+ - Metrics (waves, agents, duration, tokens, cost)
105
+ - What changed (files with git diff --stat)
106
+ - Quality gate result
107
+ - Next steps
108
+
109
+ ### Cleanup
110
+ 1. Send `shutdown_request` to any remaining active teammates
111
+ 2. Call `TeamDelete` to clean up the team
112
+
113
+ ## Decomposition Guidelines
114
+
115
+ When deciding how to break down a task:
116
+
117
+ **Research first**: Always start with at least one researcher to understand the codebase before modifying it.
118
+
119
+ **Parallelize aggressively**: If two subtasks touch different files and don't depend on each other, run them in parallel.
120
+
121
+ **Right-size agents**: Use the cheapest model that can handle the task. Research and scanning with sonnet. Implementation and review with opus.
122
+
123
+ **File ownership**: Each file should be owned by exactly one agent. If two agents need the same file, make one depend on the other.
124
+
125
+ **Review everything**: The final wave should always include at least one reviewer checking the combined output.
126
+
127
+ **Keep it simple**: Most tasks need 2-4 waves and 3-8 agents. Don't over-decompose a task that one agent could handle. If the task is simple, use 1 wave with 1-2 agents.
128
+
129
+ ## Rules
130
+ - Show the plan first, spend tokens second
131
+ - All agents must use team protocol (TeamCreate, Agent with team_name/name/run_in_background, SendMessage shutdown, TeamDelete)
132
+ - No two agents modify the same files in the same wave
133
+ - Every agent dispatch includes full context from previous waves
134
+ - Always include a review step in the final wave
135
+ - Follow the swarm-output-style skill for ALL output formatting
136
+ - Maximum 6 waves -- if you need more, the task should be split into separate orchestrations
@@ -5,6 +5,8 @@ argument-hint: "<PR number or URL>"
5
5
 
6
6
  You are fixing PR review comments by dispatching parallel implementers grouped by file.
7
7
 
8
+ Follow the `swarm-output-style` skill for ALL output formatting.
9
+
8
10
  ## Task
9
11
  $ARGUMENTS
10
12
 
@@ -25,46 +27,48 @@ For each file group, classify every comment:
25
27
  - **Nit/style fix** → assign to implementer (sonnet)
26
28
  - **Question/discussion** → skip, include in report
27
29
 
28
- ### Step 3: Present Plan
29
- Show the user the dispatch plan:
30
+ ### Step 3: Show Pre-flight Plan
31
+
32
+ Show the pre-flight plan (see swarm-output-style skill). Use the dispatch plan format:
30
33
 
31
34
  ```
32
- ## Fix Plan
35
+ ## Orchestration Plan
36
+
37
+ **Task**: Fix [N] review comments across [M] file groups for PR #[number]
38
+ **Pattern**: parallel-fix | **Phases**: 1 | **Agents**: [N] | **Est. cost**: ~$[amount] | **Est. time**: ~[duration]
33
39
 
34
- | File Group | Comments | Agent | Model | Summary |
35
- |------------|----------|-------|-------|---------|
36
- | src/foo.py | 3 | implementer | opus | [what to fix] |
37
- | src/bar.py | 1 | implementer | sonnet | [style nit] |
38
- | src/baz.py | 2 | (skipped) | | [questions only] |
40
+ ### Phase 1: Fix -- parallel (~[time], ~$[cost])
41
+ | Agent | Model | Focus |
42
+ |-------|-------|-------|
43
+ | `fixer-foo` | opus | src/foo.py [what to fix] |
44
+ | `fixer-bar` | sonnet | src/bar.py — [style nit] |
45
+ | `fixer-baz` | — | src/baz.py — SKIPPED (questions only) |
46
+
47
+ Proceed?
39
48
  ```
40
49
 
41
- Ask the user to approve before proceeding.
50
+ Wait for user approval before proceeding.
42
51
 
43
52
  ### Step 4: Dispatch Implementers
53
+
54
+ Show the phase banner with running total (see swarm-output-style skill).
55
+
44
56
  Spawn one implementer teammate per file group, ALL in parallel, each with `team_name`, `name` (e.g., `fixer-foo`, `fixer-bar`), and `run_in_background: true`. Each dispatch includes:
45
57
  - The exact comment text for their file(s)
46
58
  - The full PR diff for context
47
59
  - The original PR description
48
60
  - Clear instructions on what to change
49
61
 
50
- As each teammate completes, send it a `shutdown_request` via `SendMessage` to close its split pane.
62
+ As each completes: show a one-line completion summary (see swarm-output-style skill), then send `shutdown_request` via `SendMessage`.
51
63
 
52
64
  ### Step 5: Report
53
- Once all implementers complete, produce a summary:
54
65
 
55
- ```
56
- ## PR Fix Report
57
-
58
- ### Comments Addressed
59
- - [file:line — what was fixed, which comment]
60
-
61
- ### Comments Skipped
62
- - [file:line — why (question/discussion)]
63
-
64
- ### Next Steps
65
- - Push changes: `git push`
66
- - Re-request review: `gh pr edit <the PR> --add-reviewer [reviewer]`
67
- ```
66
+ Show the full post-completion summary (see swarm-output-style skill). Include:
67
+ - Status (PASS / NEEDS ATTENTION)
68
+ - Metrics (agents, duration, tokens, cost)
69
+ - Comments addressed (file:line — what was fixed, which comment)
70
+ - Comments skipped (file:line — why)
71
+ - Next steps (git push, re-request review)
68
72
 
69
73
  ### Cleanup
70
74
  1. Send `shutdown_request` via `SendMessage` to any remaining active teammates
@@ -76,3 +80,5 @@ Once all implementers complete, produce a summary:
76
80
  - Group by file to avoid merge conflicts between parallel implementers
77
81
  - Include the exact comment text in each implementer dispatch
78
82
  - Use opus for logic/behavior changes, sonnet for style/nit fixes
83
+ - Follow the swarm-output-style skill for ALL output formatting
84
+ - Show the plan first, spend tokens second