swarm-engine 1.1.0 → 1.3.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 (300) hide show
  1. package/CLAUDE.md +1 -1
  2. package/README.md +102 -25
  3. package/agents/accessibility-reviewer.md +2 -0
  4. package/agents/api-contract-reviewer.md +2 -0
  5. package/agents/concurrency-reviewer.md +2 -0
  6. package/agents/data-integrity-reviewer.md +1 -0
  7. package/agents/debugger.md +2 -0
  8. package/agents/dependency-reviewer.md +2 -0
  9. package/agents/devils-advocate.md +1 -0
  10. package/agents/documentation-reviewer.md +2 -0
  11. package/agents/documenter.md +13 -0
  12. package/agents/error-handling-reviewer.md +2 -0
  13. package/agents/grounding.md +3 -2
  14. package/agents/guardian.md +3 -0
  15. package/agents/implementer.md +2 -0
  16. package/agents/integrator.md +3 -0
  17. package/agents/judge.md +2 -0
  18. package/agents/librarian.md +4 -1
  19. package/agents/orchestrator.md +3 -0
  20. package/agents/performance-reviewer.md +2 -0
  21. package/agents/planner.md +2 -0
  22. package/agents/refactorer.md +3 -0
  23. package/agents/reviewer.md +1 -0
  24. package/agents/security-reviewer.md +1 -0
  25. package/agents/sentinel.md +3 -0
  26. package/agents/tester.md +2 -0
  27. package/agents/testing-reviewer.md +2 -0
  28. package/commands/diff-review.md +27 -15
  29. package/commands/discover.md +102 -0
  30. package/commands/dynamic.md +136 -0
  31. package/commands/fix-pr.md +30 -24
  32. package/commands/postmortem.md +106 -0
  33. package/commands/red-team.md +41 -26
  34. package/commands/research.md +22 -1
  35. package/commands/review-cycle.md +38 -20
  36. package/commands/spike.md +108 -0
  37. package/commands/swarm.md +68 -60
  38. package/commands/tdd.md +44 -24
  39. package/dist/cli/commands/acp.d.ts.map +1 -1
  40. package/dist/cli/commands/acp.js +12 -2
  41. package/dist/cli/commands/acp.js.map +1 -1
  42. package/dist/cli/commands/agents.d.ts.map +1 -1
  43. package/dist/cli/commands/agents.js +16 -13
  44. package/dist/cli/commands/agents.js.map +1 -1
  45. package/dist/cli/commands/completions.d.ts.map +1 -1
  46. package/dist/cli/commands/completions.js +21 -9
  47. package/dist/cli/commands/completions.js.map +1 -1
  48. package/dist/cli/commands/compound.d.ts.map +1 -1
  49. package/dist/cli/commands/compound.js +1 -2
  50. package/dist/cli/commands/compound.js.map +1 -1
  51. package/dist/cli/commands/configure.d.ts.map +1 -1
  52. package/dist/cli/commands/configure.js +24 -8
  53. package/dist/cli/commands/configure.js.map +1 -1
  54. package/dist/cli/commands/convert.d.ts +1 -1
  55. package/dist/cli/commands/convert.d.ts.map +1 -1
  56. package/dist/cli/commands/convert.js +22 -48
  57. package/dist/cli/commands/convert.js.map +1 -1
  58. package/dist/cli/commands/doctor.d.ts.map +1 -1
  59. package/dist/cli/commands/doctor.js +1 -3
  60. package/dist/cli/commands/doctor.js.map +1 -1
  61. package/dist/cli/commands/init.d.ts.map +1 -1
  62. package/dist/cli/commands/init.js +17 -7
  63. package/dist/cli/commands/init.js.map +1 -1
  64. package/dist/cli/commands/install.d.ts.map +1 -1
  65. package/dist/cli/commands/install.js +1 -1
  66. package/dist/cli/commands/install.js.map +1 -1
  67. package/dist/cli/commands/learn.js +6 -6
  68. package/dist/cli/commands/learn.js.map +1 -1
  69. package/dist/cli/commands/mcp.d.ts.map +1 -1
  70. package/dist/cli/commands/mcp.js +1 -2
  71. package/dist/cli/commands/mcp.js.map +1 -1
  72. package/dist/cli/commands/memory.d.ts.map +1 -1
  73. package/dist/cli/commands/memory.js +1 -2
  74. package/dist/cli/commands/memory.js.map +1 -1
  75. package/dist/cli/commands/orchestrate.d.ts.map +1 -1
  76. package/dist/cli/commands/orchestrate.js +20 -7
  77. package/dist/cli/commands/orchestrate.js.map +1 -1
  78. package/dist/cli/commands/plan.d.ts.map +1 -1
  79. package/dist/cli/commands/plan.js.map +1 -1
  80. package/dist/cli/commands/plugin.d.ts.map +1 -1
  81. package/dist/cli/commands/plugin.js +8 -5
  82. package/dist/cli/commands/plugin.js.map +1 -1
  83. package/dist/cli/commands/resume.js +1 -1
  84. package/dist/cli/commands/resume.js.map +1 -1
  85. package/dist/cli/commands/run.d.ts.map +1 -1
  86. package/dist/cli/commands/run.js +20 -6
  87. package/dist/cli/commands/run.js.map +1 -1
  88. package/dist/cli/commands/share.d.ts.map +1 -1
  89. package/dist/cli/commands/share.js +6 -1
  90. package/dist/cli/commands/share.js.map +1 -1
  91. package/dist/cli/commands/status.d.ts.map +1 -1
  92. package/dist/cli/commands/status.js +15 -7
  93. package/dist/cli/commands/status.js.map +1 -1
  94. package/dist/cli/commands/template.d.ts.map +1 -1
  95. package/dist/cli/commands/template.js +14 -6
  96. package/dist/cli/commands/template.js.map +1 -1
  97. package/dist/cli/commands/vault.d.ts.map +1 -1
  98. package/dist/cli/commands/vault.js +14 -9
  99. package/dist/cli/commands/vault.js.map +1 -1
  100. package/dist/cli/commands/verify.d.ts.map +1 -1
  101. package/dist/cli/commands/verify.js +2 -2
  102. package/dist/cli/commands/verify.js.map +1 -1
  103. package/dist/cli/commands/watch.js +1 -1
  104. package/dist/cli/commands/watch.js.map +1 -1
  105. package/dist/cli/index.js +14 -4
  106. package/dist/cli/index.js.map +1 -1
  107. package/dist/core/checkpoint.js +1 -1
  108. package/dist/core/checkpoint.js.map +1 -1
  109. package/dist/core/event-bus.d.ts.map +1 -1
  110. package/dist/core/event-bus.js +9 -3
  111. package/dist/core/event-bus.js.map +1 -1
  112. package/dist/core/lifecycle.js.map +1 -1
  113. package/dist/core/patterns.d.ts.map +1 -1
  114. package/dist/core/patterns.js +31 -8
  115. package/dist/core/patterns.js.map +1 -1
  116. package/dist/core/permissions.d.ts.map +1 -1
  117. package/dist/core/permissions.js +21 -10
  118. package/dist/core/permissions.js.map +1 -1
  119. package/dist/core/registry.d.ts.map +1 -1
  120. package/dist/core/registry.js +10 -6
  121. package/dist/core/registry.js.map +1 -1
  122. package/dist/core/snapshots.d.ts.map +1 -1
  123. package/dist/core/snapshots.js +17 -5
  124. package/dist/core/snapshots.js.map +1 -1
  125. package/dist/core/types.d.ts +3 -0
  126. package/dist/core/types.d.ts.map +1 -1
  127. package/dist/core/types.js.map +1 -1
  128. package/dist/hooks/index.js.map +1 -1
  129. package/dist/index.d.ts +68 -6
  130. package/dist/index.d.ts.map +1 -1
  131. package/dist/index.js +60 -4
  132. package/dist/index.js.map +1 -1
  133. package/dist/memory/index.d.ts +1 -0
  134. package/dist/memory/index.d.ts.map +1 -1
  135. package/dist/memory/index.js +39 -24
  136. package/dist/memory/index.js.map +1 -1
  137. package/dist/memory/schema.d.ts +1 -0
  138. package/dist/memory/schema.d.ts.map +1 -1
  139. package/dist/memory/schema.js +20 -19
  140. package/dist/memory/schema.js.map +1 -1
  141. package/dist/plugin/index.d.ts.map +1 -1
  142. package/dist/plugin/index.js.map +1 -1
  143. package/dist/runtime/acp.d.ts.map +1 -1
  144. package/dist/runtime/acp.js +71 -41
  145. package/dist/runtime/acp.js.map +1 -1
  146. package/dist/runtime/adaptive.d.ts.map +1 -1
  147. package/dist/runtime/adaptive.js +30 -31
  148. package/dist/runtime/adaptive.js.map +1 -1
  149. package/dist/runtime/agent-runner.d.ts +52 -0
  150. package/dist/runtime/agent-runner.d.ts.map +1 -0
  151. package/dist/runtime/agent-runner.js +156 -0
  152. package/dist/runtime/agent-runner.js.map +1 -0
  153. package/dist/runtime/autonomy.d.ts +1 -0
  154. package/dist/runtime/autonomy.d.ts.map +1 -1
  155. package/dist/runtime/autonomy.js +37 -19
  156. package/dist/runtime/autonomy.js.map +1 -1
  157. package/dist/runtime/backends/claude.d.ts.map +1 -1
  158. package/dist/runtime/backends/claude.js +2 -2
  159. package/dist/runtime/backends/claude.js.map +1 -1
  160. package/dist/runtime/backends/codex.d.ts.map +1 -1
  161. package/dist/runtime/backends/codex.js +8 -11
  162. package/dist/runtime/backends/codex.js.map +1 -1
  163. package/dist/runtime/backends/gemini.d.ts.map +1 -1
  164. package/dist/runtime/backends/gemini.js +11 -7
  165. package/dist/runtime/backends/gemini.js.map +1 -1
  166. package/dist/runtime/backends/index.js +1 -1
  167. package/dist/runtime/backends/index.js.map +1 -1
  168. package/dist/runtime/backends/mock.d.ts.map +1 -1
  169. package/dist/runtime/backends/mock.js +1 -1
  170. package/dist/runtime/backends/mock.js.map +1 -1
  171. package/dist/runtime/backends/vercel-ai.d.ts.map +1 -1
  172. package/dist/runtime/backends/vercel-ai.js +41 -9
  173. package/dist/runtime/backends/vercel-ai.js.map +1 -1
  174. package/dist/runtime/cache-optimizer.d.ts.map +1 -1
  175. package/dist/runtime/cache-optimizer.js +3 -9
  176. package/dist/runtime/cache-optimizer.js.map +1 -1
  177. package/dist/runtime/cascade.d.ts.map +1 -1
  178. package/dist/runtime/cascade.js +34 -7
  179. package/dist/runtime/cascade.js.map +1 -1
  180. package/dist/runtime/chunker.d.ts.map +1 -1
  181. package/dist/runtime/chunker.js +12 -6
  182. package/dist/runtime/chunker.js.map +1 -1
  183. package/dist/runtime/compounder.d.ts +1 -1
  184. package/dist/runtime/compounder.d.ts.map +1 -1
  185. package/dist/runtime/compounder.js +30 -11
  186. package/dist/runtime/compounder.js.map +1 -1
  187. package/dist/runtime/cost-model.d.ts.map +1 -1
  188. package/dist/runtime/cost-model.js +1 -1
  189. package/dist/runtime/cost-model.js.map +1 -1
  190. package/dist/runtime/database.d.ts +16 -0
  191. package/dist/runtime/database.d.ts.map +1 -0
  192. package/dist/runtime/database.js +39 -0
  193. package/dist/runtime/database.js.map +1 -0
  194. package/dist/runtime/distiller.d.ts.map +1 -1
  195. package/dist/runtime/distiller.js +6 -3
  196. package/dist/runtime/distiller.js.map +1 -1
  197. package/dist/runtime/engine.d.ts +7 -9
  198. package/dist/runtime/engine.d.ts.map +1 -1
  199. package/dist/runtime/engine.js +129 -394
  200. package/dist/runtime/engine.js.map +1 -1
  201. package/dist/runtime/executor.d.ts +1 -2
  202. package/dist/runtime/executor.d.ts.map +1 -1
  203. package/dist/runtime/executor.js +45 -14
  204. package/dist/runtime/executor.js.map +1 -1
  205. package/dist/runtime/heuristics.d.ts +1 -0
  206. package/dist/runtime/heuristics.d.ts.map +1 -1
  207. package/dist/runtime/heuristics.js +44 -22
  208. package/dist/runtime/heuristics.js.map +1 -1
  209. package/dist/runtime/learning-engine.d.ts +51 -0
  210. package/dist/runtime/learning-engine.d.ts.map +1 -0
  211. package/dist/runtime/learning-engine.js +209 -0
  212. package/dist/runtime/learning-engine.js.map +1 -0
  213. package/dist/runtime/living-spec.js +3 -3
  214. package/dist/runtime/living-spec.js.map +1 -1
  215. package/dist/runtime/lsp.d.ts.map +1 -1
  216. package/dist/runtime/lsp.js +41 -14
  217. package/dist/runtime/lsp.js.map +1 -1
  218. package/dist/runtime/mcp.d.ts.map +1 -1
  219. package/dist/runtime/mcp.js +56 -19
  220. package/dist/runtime/mcp.js.map +1 -1
  221. package/dist/runtime/model-router.d.ts +1 -0
  222. package/dist/runtime/model-router.d.ts.map +1 -1
  223. package/dist/runtime/model-router.js +37 -21
  224. package/dist/runtime/model-router.js.map +1 -1
  225. package/dist/runtime/panes.d.ts.map +1 -1
  226. package/dist/runtime/panes.js +50 -49
  227. package/dist/runtime/panes.js.map +1 -1
  228. package/dist/runtime/plan-search.js +2 -2
  229. package/dist/runtime/plan-search.js.map +1 -1
  230. package/dist/runtime/plugins.d.ts +1 -1
  231. package/dist/runtime/plugins.d.ts.map +1 -1
  232. package/dist/runtime/plugins.js +63 -47
  233. package/dist/runtime/plugins.js.map +1 -1
  234. package/dist/runtime/reflexion.d.ts.map +1 -1
  235. package/dist/runtime/reflexion.js +4 -8
  236. package/dist/runtime/reflexion.js.map +1 -1
  237. package/dist/runtime/review-schema.d.ts.map +1 -1
  238. package/dist/runtime/review-schema.js +12 -12
  239. package/dist/runtime/review-schema.js.map +1 -1
  240. package/dist/runtime/rewriter.d.ts.map +1 -1
  241. package/dist/runtime/rewriter.js +29 -9
  242. package/dist/runtime/rewriter.js.map +1 -1
  243. package/dist/runtime/sharing.d.ts +1 -1
  244. package/dist/runtime/sharing.d.ts.map +1 -1
  245. package/dist/runtime/sharing.js +55 -27
  246. package/dist/runtime/sharing.js.map +1 -1
  247. package/dist/runtime/stats.d.ts +1 -0
  248. package/dist/runtime/stats.d.ts.map +1 -1
  249. package/dist/runtime/stats.js +40 -24
  250. package/dist/runtime/stats.js.map +1 -1
  251. package/dist/runtime/templates.d.ts.map +1 -1
  252. package/dist/runtime/templates.js +2 -2
  253. package/dist/runtime/templates.js.map +1 -1
  254. package/dist/runtime/traces.d.ts +1 -0
  255. package/dist/runtime/traces.d.ts.map +1 -1
  256. package/dist/runtime/traces.js +50 -28
  257. package/dist/runtime/traces.js.map +1 -1
  258. package/dist/runtime/verifier.d.ts.map +1 -1
  259. package/dist/runtime/verifier.js +12 -6
  260. package/dist/runtime/verifier.js.map +1 -1
  261. package/dist/runtime/worktree.d.ts.map +1 -1
  262. package/dist/runtime/worktree.js +35 -18
  263. package/dist/runtime/worktree.js.map +1 -1
  264. package/dist/tui/dashboard.d.ts.map +1 -1
  265. package/dist/tui/dashboard.js +20 -16
  266. package/dist/tui/dashboard.js.map +1 -1
  267. package/dist/tui/progress.d.ts +2 -0
  268. package/dist/tui/progress.d.ts.map +1 -1
  269. package/dist/tui/progress.js +105 -33
  270. package/dist/tui/progress.js.map +1 -1
  271. package/dist/tui/renderer.d.ts.map +1 -1
  272. package/dist/tui/renderer.js.map +1 -1
  273. package/dist/utils/compact-format.js +1 -1
  274. package/dist/utils/compact-format.js.map +1 -1
  275. package/dist/utils/config.d.ts.map +1 -1
  276. package/dist/utils/config.js.map +1 -1
  277. package/dist/utils/env.d.ts.map +1 -1
  278. package/dist/utils/env.js +19 -5
  279. package/dist/utils/env.js.map +1 -1
  280. package/dist/utils/errors.d.ts.map +1 -1
  281. package/dist/utils/errors.js +3 -7
  282. package/dist/utils/errors.js.map +1 -1
  283. package/dist/utils/output.d.ts.map +1 -1
  284. package/dist/utils/output.js +6 -2
  285. package/dist/utils/output.js.map +1 -1
  286. package/dist/utils/project-config.d.ts +18 -0
  287. package/dist/utils/project-config.d.ts.map +1 -1
  288. package/dist/utils/project-config.js +14 -6
  289. package/dist/utils/project-config.js.map +1 -1
  290. package/dist/utils/schemas.d.ts.map +1 -1
  291. package/dist/utils/schemas.js +12 -12
  292. package/dist/utils/schemas.js.map +1 -1
  293. package/dist/utils/terminal.d.ts.map +1 -1
  294. package/dist/utils/terminal.js +18 -7
  295. package/dist/utils/terminal.js.map +1 -1
  296. package/dist/utils/tiers.d.ts.map +1 -1
  297. package/dist/utils/tiers.js +14 -6
  298. package/dist/utils/tiers.js.map +1 -1
  299. package/package.json +14 -3
  300. package/skills/swarm-output-style/SKILL.md +114 -46
@@ -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
@@ -0,0 +1,106 @@
1
+ ---
2
+ description: "Root cause analysis — trace an error or incident back to its origin and produce a fix"
3
+ argument-hint: "<error message, failing test, or incident description>"
4
+ ---
5
+
6
+ You are running a postmortem analysis: systematically trace an error back to its root cause, understand how it happened, fix it, and prevent it from happening again.
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 (Reproduce, Diagnose, Fix, Verify)
21
+ - Agents per phase with model and focus
22
+ - Estimated cost (~$0.12 reproduce, ~$0.15 diagnose, ~$0.19 fix, ~$0.23 verify/review)
23
+ - Estimated time (~15-25 min total)
24
+
25
+ Wait for user approval before proceeding.
26
+
27
+ ### Setup: Create Team
28
+ 1. Create a team with `TeamCreate` (name: `postmortem-<timestamp>`)
29
+ 2. Create tasks with `TaskCreate` for each work unit
30
+
31
+ ### Phase 1: Reproduce and Gather Evidence — parallel
32
+
33
+ Show the phase banner with running total (see swarm-output-style skill).
34
+
35
+ Spawn 3 researcher teammates (sonnet) simultaneously, each with `team_name`, `name`, and `run_in_background: true`:
36
+
37
+ - **`researcher-reproduce`**: Reproduce the error. Find the exact steps, inputs, or conditions that trigger it. If a test fails, run it and capture the full output. If it's a runtime error, trace the call stack.
38
+ - **`researcher-history`**: Check git history. When was this last working? What changed? Use `git log`, `git blame`, `git bisect` thinking to identify the commit or time window where the breakage was introduced.
39
+ - **`researcher-context`**: Check memory and vault for related past incidents. Search for similar errors, known fragile areas, or prior decisions that constrained the implementation. Run `~/.claude/scripts/swarm-vault.sh search "<error keywords>"`.
40
+
41
+ As each completes: show a one-line completion summary (see swarm-output-style skill), then send `shutdown_request` via `SendMessage`.
42
+
43
+ ### Phase 2: Diagnose — sequential
44
+
45
+ Show the phase banner with running total (see swarm-output-style skill).
46
+
47
+ Spawn a debugger teammate (opus) with `team_name`, `name` (`diagnostician`), and `run_in_background: true`.
48
+
49
+ Provide ALL evidence from Phase 1. The debugger should:
50
+ 1. Identify the root cause (not the symptom)
51
+ 2. Explain the chain of events: what triggered what
52
+ 3. Identify contributing factors (was there a missing test? a bad assumption? a race condition?)
53
+ 4. Classify the failure type: regression, design flaw, edge case, environment issue, dependency change
54
+ 5. Propose a fix
55
+
56
+ As the teammate completes: show a one-line completion summary (see swarm-output-style skill), then send `shutdown_request` via `SendMessage`.
57
+
58
+ Present the diagnosis to the user. Proceed after approval.
59
+
60
+ ### Phase 3: Fix — sequential
61
+
62
+ Show the phase banner with running total (see swarm-output-style skill).
63
+
64
+ Spawn an implementer teammate (opus) with `team_name`, `name` (`fixer`), and `run_in_background: true`:
65
+
66
+ - Fix the root cause, not just the symptom
67
+ - Add a regression test that would have caught this
68
+ - If the fix touches a fragile area, add defensive checks
69
+
70
+ As the teammate completes: show a one-line completion summary (see swarm-output-style skill), then send `shutdown_request` via `SendMessage`.
71
+
72
+ ### Phase 4: Verify — parallel
73
+
74
+ Show the phase banner with running total (see swarm-output-style skill).
75
+
76
+ Spawn 2 teammates simultaneously with `team_name`, `name`, and `run_in_background: true`:
77
+
78
+ - **`verifier`** (tester, sonnet): Run the full test suite. Confirm the regression test passes. Confirm no other tests broke.
79
+ - **`reviewer-fix`** (reviewer, opus): Review the fix for correctness. Check that it addresses the root cause, not a surface symptom. Look for similar patterns elsewhere in the codebase that might have the same vulnerability.
80
+
81
+ As each completes: show a one-line completion summary (see swarm-output-style skill), then send `shutdown_request` via `SendMessage`.
82
+
83
+ ### Phase 5: Report
84
+
85
+ Show the full post-completion summary (see swarm-output-style skill). Include:
86
+ - Status (PASS / NEEDS ATTENTION / FAILED)
87
+ - Metrics (phases, agents, duration, tokens, cost)
88
+ - Incident timeline (last working state → change introduced → discovered → fixed)
89
+ - Root cause and contributing factors
90
+ - Fix applied (files changed, regression test added)
91
+ - Prevention checklist (actionable, not generic)
92
+ - Verification results (test count, reviewer verdict)
93
+ - Next steps
94
+
95
+ ### Cleanup
96
+ 1. Send `shutdown_request` via `SendMessage` to any remaining active teammates
97
+ 2. Call `TeamDelete` to clean up the team
98
+
99
+ ## Rules
100
+ - All agents must be spawned as team members (TeamCreate → TaskCreate → Agent with team_name/name/run_in_background → SendMessage shutdown → TeamDelete)
101
+ - Always find the ROOT cause, not the surface symptom. "X was null" is a symptom. "Input validation was missing because the API contract changed in v2 but the handler wasn't updated" is a root cause.
102
+ - The regression test is mandatory. If the fix doesn't include a test that would have caught the original failure, the postmortem is incomplete.
103
+ - Check for similar patterns elsewhere. If a bug exists in one place, the same mistake may exist in similar code.
104
+ - The Prevention section should be actionable, not generic. "Write more tests" is useless. "Add null check tests for all handler parameters in src/api/handlers/" is actionable.
105
+ - Follow the swarm-output-style skill for ALL output formatting
106
+ - Show the plan first, spend tokens second
@@ -5,30 +5,53 @@ argument-hint: "<feature or implementation to red-team>"
5
5
 
6
6
  You are running an adversarial red-team cycle where a builder implements and a breaker tries to destroy.
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
+ - All phases (Research, Build, Break, Harden)
21
+ - Agents per phase with model and focus
22
+ - Estimated cost (~$0.08 research, ~$0.19 build, ~$0.45 break, ~$0.34 harden/verify)
23
+ - Estimated time (~15-30 min total)
24
+
25
+ Wait for user approval before proceeding.
26
+
13
27
  ### Setup: Create Team
14
28
  1. Create a team with `TeamCreate` (name: `red-team-<timestamp>`)
15
29
  2. Create tasks with `TaskCreate` for each work unit
16
30
  3. Create a scratchpad at `.claude/scratchpad/<team-name>.md` for cross-agent communication. Pass its path to all agent dispatches.
17
31
 
18
32
  ### Phase 1: Research (parallel)
33
+
34
+ Show the phase banner with running total (see swarm-output-style skill).
35
+
19
36
  Spawn 2 researcher teammates (sonnet) with `team_name`, `name`, and `run_in_background: true`:
20
37
  - `researcher-code`: Understand the codebase area being worked on
21
38
  - `researcher-attack`: Research common vulnerabilities and failure modes for this type of feature
22
39
 
23
- As each completes, send `shutdown_request`.
40
+ As each completes: show a one-line completion summary (see swarm-output-style skill), then send `shutdown_request`.
24
41
 
25
42
  ### Phase 2: Build (sequential)
43
+
44
+ Show the phase banner with running total (see swarm-output-style skill).
45
+
26
46
  Spawn an implementer teammate (opus) with `team_name`, `name` (`builder`), and `run_in_background: true`.
27
47
  Include research findings as context. Implement the feature.
28
48
 
29
- As the teammate completes, send `shutdown_request`.
49
+ As the teammate completes: show a one-line completion summary (see swarm-output-style skill), then send `shutdown_request`.
30
50
 
31
51
  ### Phase 3: Break (parallel)
52
+
53
+ Show the phase banner with running total (see swarm-output-style skill).
54
+
32
55
  Spawn 3 breaker teammates simultaneously with `team_name`, `name`, and `run_in_background: true`:
33
56
 
34
57
  1. **`breaker-edge-cases`** (devils-advocate, opus) — Probe null inputs, empty collections, boundary conditions, concurrent access, network failures, resource exhaustion
@@ -37,39 +60,29 @@ Spawn 3 breaker teammates simultaneously with `team_name`, `name`, and `run_in_b
37
60
 
38
61
  Each breaker gets the full implementation from Phase 2.
39
62
 
40
- As each completes, send `shutdown_request`.
63
+ As each completes: show a one-line completion summary (see swarm-output-style skill), then send `shutdown_request`.
41
64
 
42
65
  ### Phase 4: Harden (sequential)
66
+
67
+ Show the phase banner with running total (see swarm-output-style skill).
68
+
43
69
  If breakers found vulnerabilities:
44
70
  1. Aggregate all findings by severity
45
71
  2. Spawn an implementer teammate (opus) with `team_name`, `name` (`hardener`), and `run_in_background: true` to fix Critical and Important findings
46
- 3. As the hardener completes, send it a `shutdown_request`
72
+ 3. As the hardener completes: show a one-line completion summary (see swarm-output-style skill), then send it a `shutdown_request`
47
73
  4. Spawn a verifier teammate with `team_name`, `name` (e.g., `verifier-security`), and `run_in_background: true` to re-run the specific breaker's tests against the hardened code
48
- 5. As the verifier completes, send it a `shutdown_request`
74
+ 5. As the verifier completes: show a one-line completion summary (see swarm-output-style skill), then send it a `shutdown_request`
49
75
 
50
76
  ### Phase 5: Report
51
- ```markdown
52
- ## Red Team Report
53
-
54
- ### Built
55
- [What was implemented]
56
-
57
- ### Attacked
58
- - Edge cases probed: [count]
59
- - Security attacks attempted: [count]
60
- - Mutations tested: [count]
61
-
62
- ### Vulnerabilities Found
63
- | Severity | Finding | Status |
64
- |----------|---------|--------|
65
- | Critical | [finding] | Fixed / Open |
66
-
67
- ### Hardening Applied
68
- [What was fixed]
69
77
 
70
- ### Surviving Weaknesses
71
- [What couldn't be fixed or needs human decision]
72
- ```
78
+ Show the full post-completion summary (see swarm-output-style skill). Include:
79
+ - Status (PASS / NEEDS ATTENTION / FAILED)
80
+ - Metrics (phases, agents, duration, tokens, cost)
81
+ - What was built and what was attacked
82
+ - Vulnerability table (severity, finding, status)
83
+ - Hardening applied
84
+ - Surviving weaknesses requiring human decision
85
+ - Next steps
73
86
 
74
87
  ### Cleanup
75
88
  1. Send `shutdown_request` to any remaining active teammates
@@ -80,3 +93,5 @@ If breakers found vulnerabilities:
80
93
  - Breakers should be genuinely adversarial — their goal is to BREAK the code
81
94
  - Only fix Critical and Important findings — Suggestions go in the report
82
95
  - If mutation tests reveal untested code paths, note them but don't block
96
+ - Follow the swarm-output-style skill for ALL output formatting
97
+ - Show the plan first, spend tokens second
@@ -5,11 +5,25 @@ argument-hint: "<research question>"
5
5
 
6
6
  You are conducting parallel research to answer a complex question using multiple researcher agents simultaneously.
7
7
 
8
+ Follow the `swarm-output-style` skill for ALL output formatting.
9
+
8
10
  ## Question
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
+ - The research question decomposed into 2-5 angles
21
+ - One researcher per angle with model and focus (haiku for broad search, sonnet for deep analysis)
22
+ - Estimated cost (~$0.04/researcher for haiku, ~$0.10/researcher for sonnet)
23
+ - Estimated time (~2-3 min per haiku agent, ~3-5 min per sonnet agent)
24
+
25
+ Wait for user approval before proceeding.
26
+
13
27
  ### Setup: Create Team
14
28
  1. Create a team with `TeamCreate` (name: `research-<timestamp>`, e.g., `research-1234`)
15
29
  2. Create tasks with `TaskCreate` for each research angle identified in the decomposition
@@ -21,12 +35,15 @@ Break the research question into 2-5 independent angles of investigation. Each a
21
35
  - Together provide a complete picture
22
36
 
23
37
  ### Step 2: Dispatch Researchers
38
+
39
+ Show the phase banner with running total (see swarm-output-style skill).
40
+
24
41
  Spawn one researcher teammate per angle, ALL in parallel, each with `team_name`, `name` (e.g., `researcher-angle-1`), and `run_in_background: true`. Use:
25
42
  - `subagent_type`: Use the "Explore" type for pure search, or spawn a "researcher" agent for deeper analysis
26
43
  - `model`: "haiku" for broad searches, "sonnet" for deep analysis
27
44
  - Include the specific angle and any known context in each prompt
28
45
 
29
- As each teammate completes, send it a `shutdown_request` via `SendMessage` to close its split pane.
46
+ As each completes: show a one-line completion summary (see swarm-output-style skill), then send `shutdown_request` via `SendMessage`.
30
47
 
31
48
  ### Step 3: Synthesize
32
49
  Once all researchers return:
@@ -48,6 +65,8 @@ Once all researchers return:
48
65
  [Suggested next steps based on findings]
49
66
  ```
50
67
 
68
+ Show the full post-completion summary (see swarm-output-style skill).
69
+
51
70
  ### Cleanup
52
71
  1. Send `shutdown_request` via `SendMessage` to any remaining active teammates
53
72
  2. Call `TeamDelete` to clean up the team
@@ -57,3 +76,5 @@ Once all researchers return:
57
76
  - Include full context in every researcher dispatch — they cannot ask follow-up questions
58
77
  - Use haiku for broad file search, sonnet for deep analysis
59
78
  - All findings must include file:line references
79
+ - Follow the swarm-output-style skill for ALL output formatting
80
+ - Show the plan first, spend tokens second