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.
- package/CLAUDE.md +1 -1
- package/README.md +102 -25
- package/agents/accessibility-reviewer.md +2 -0
- package/agents/api-contract-reviewer.md +2 -0
- package/agents/concurrency-reviewer.md +2 -0
- package/agents/data-integrity-reviewer.md +1 -0
- package/agents/debugger.md +2 -0
- package/agents/dependency-reviewer.md +2 -0
- package/agents/devils-advocate.md +1 -0
- package/agents/documentation-reviewer.md +2 -0
- package/agents/documenter.md +13 -0
- package/agents/error-handling-reviewer.md +2 -0
- package/agents/grounding.md +3 -2
- package/agents/guardian.md +3 -0
- package/agents/implementer.md +2 -0
- package/agents/integrator.md +3 -0
- package/agents/judge.md +2 -0
- package/agents/librarian.md +4 -1
- package/agents/orchestrator.md +3 -0
- package/agents/performance-reviewer.md +2 -0
- package/agents/planner.md +2 -0
- package/agents/refactorer.md +3 -0
- package/agents/reviewer.md +1 -0
- package/agents/security-reviewer.md +1 -0
- package/agents/sentinel.md +3 -0
- package/agents/tester.md +2 -0
- package/agents/testing-reviewer.md +2 -0
- package/commands/diff-review.md +27 -15
- package/commands/discover.md +102 -0
- package/commands/dynamic.md +136 -0
- package/commands/fix-pr.md +30 -24
- package/commands/postmortem.md +106 -0
- package/commands/red-team.md +41 -26
- package/commands/research.md +22 -1
- package/commands/review-cycle.md +38 -20
- package/commands/spike.md +108 -0
- package/commands/swarm.md +68 -60
- package/commands/tdd.md +44 -24
- package/dist/cli/commands/acp.d.ts.map +1 -1
- package/dist/cli/commands/acp.js +12 -2
- package/dist/cli/commands/acp.js.map +1 -1
- package/dist/cli/commands/agents.d.ts.map +1 -1
- package/dist/cli/commands/agents.js +16 -13
- package/dist/cli/commands/agents.js.map +1 -1
- package/dist/cli/commands/completions.d.ts.map +1 -1
- package/dist/cli/commands/completions.js +21 -9
- package/dist/cli/commands/completions.js.map +1 -1
- package/dist/cli/commands/compound.d.ts.map +1 -1
- package/dist/cli/commands/compound.js +1 -2
- package/dist/cli/commands/compound.js.map +1 -1
- package/dist/cli/commands/configure.d.ts.map +1 -1
- package/dist/cli/commands/configure.js +24 -8
- package/dist/cli/commands/configure.js.map +1 -1
- package/dist/cli/commands/convert.d.ts +1 -1
- package/dist/cli/commands/convert.d.ts.map +1 -1
- package/dist/cli/commands/convert.js +22 -48
- package/dist/cli/commands/convert.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +1 -3
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +17 -7
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +1 -1
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/learn.js +6 -6
- package/dist/cli/commands/learn.js.map +1 -1
- package/dist/cli/commands/mcp.d.ts.map +1 -1
- package/dist/cli/commands/mcp.js +1 -2
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/memory.d.ts.map +1 -1
- package/dist/cli/commands/memory.js +1 -2
- package/dist/cli/commands/memory.js.map +1 -1
- package/dist/cli/commands/orchestrate.d.ts.map +1 -1
- package/dist/cli/commands/orchestrate.js +20 -7
- package/dist/cli/commands/orchestrate.js.map +1 -1
- package/dist/cli/commands/plan.d.ts.map +1 -1
- package/dist/cli/commands/plan.js.map +1 -1
- package/dist/cli/commands/plugin.d.ts.map +1 -1
- package/dist/cli/commands/plugin.js +8 -5
- package/dist/cli/commands/plugin.js.map +1 -1
- package/dist/cli/commands/resume.js +1 -1
- package/dist/cli/commands/resume.js.map +1 -1
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +20 -6
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/share.d.ts.map +1 -1
- package/dist/cli/commands/share.js +6 -1
- package/dist/cli/commands/share.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +15 -7
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/template.d.ts.map +1 -1
- package/dist/cli/commands/template.js +14 -6
- package/dist/cli/commands/template.js.map +1 -1
- package/dist/cli/commands/vault.d.ts.map +1 -1
- package/dist/cli/commands/vault.js +14 -9
- package/dist/cli/commands/vault.js.map +1 -1
- package/dist/cli/commands/verify.d.ts.map +1 -1
- package/dist/cli/commands/verify.js +2 -2
- package/dist/cli/commands/verify.js.map +1 -1
- package/dist/cli/commands/watch.js +1 -1
- package/dist/cli/commands/watch.js.map +1 -1
- package/dist/cli/index.js +14 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/core/checkpoint.js +1 -1
- package/dist/core/checkpoint.js.map +1 -1
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js +9 -3
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/lifecycle.js.map +1 -1
- package/dist/core/patterns.d.ts.map +1 -1
- package/dist/core/patterns.js +31 -8
- package/dist/core/patterns.js.map +1 -1
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +21 -10
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/registry.d.ts.map +1 -1
- package/dist/core/registry.js +10 -6
- package/dist/core/registry.js.map +1 -1
- package/dist/core/snapshots.d.ts.map +1 -1
- package/dist/core/snapshots.js +17 -5
- package/dist/core/snapshots.js.map +1 -1
- package/dist/core/types.d.ts +3 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.d.ts +68 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +60 -4
- package/dist/index.js.map +1 -1
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +39 -24
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/schema.d.ts +1 -0
- package/dist/memory/schema.d.ts.map +1 -1
- package/dist/memory/schema.js +20 -19
- package/dist/memory/schema.js.map +1 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js.map +1 -1
- package/dist/runtime/acp.d.ts.map +1 -1
- package/dist/runtime/acp.js +71 -41
- package/dist/runtime/acp.js.map +1 -1
- package/dist/runtime/adaptive.d.ts.map +1 -1
- package/dist/runtime/adaptive.js +30 -31
- package/dist/runtime/adaptive.js.map +1 -1
- package/dist/runtime/agent-runner.d.ts +52 -0
- package/dist/runtime/agent-runner.d.ts.map +1 -0
- package/dist/runtime/agent-runner.js +156 -0
- package/dist/runtime/agent-runner.js.map +1 -0
- package/dist/runtime/autonomy.d.ts +1 -0
- package/dist/runtime/autonomy.d.ts.map +1 -1
- package/dist/runtime/autonomy.js +37 -19
- package/dist/runtime/autonomy.js.map +1 -1
- package/dist/runtime/backends/claude.d.ts.map +1 -1
- package/dist/runtime/backends/claude.js +2 -2
- package/dist/runtime/backends/claude.js.map +1 -1
- package/dist/runtime/backends/codex.d.ts.map +1 -1
- package/dist/runtime/backends/codex.js +8 -11
- package/dist/runtime/backends/codex.js.map +1 -1
- package/dist/runtime/backends/gemini.d.ts.map +1 -1
- package/dist/runtime/backends/gemini.js +11 -7
- package/dist/runtime/backends/gemini.js.map +1 -1
- package/dist/runtime/backends/index.js +1 -1
- package/dist/runtime/backends/index.js.map +1 -1
- package/dist/runtime/backends/mock.d.ts.map +1 -1
- package/dist/runtime/backends/mock.js +1 -1
- package/dist/runtime/backends/mock.js.map +1 -1
- package/dist/runtime/backends/vercel-ai.d.ts.map +1 -1
- package/dist/runtime/backends/vercel-ai.js +41 -9
- package/dist/runtime/backends/vercel-ai.js.map +1 -1
- package/dist/runtime/cache-optimizer.d.ts.map +1 -1
- package/dist/runtime/cache-optimizer.js +3 -9
- package/dist/runtime/cache-optimizer.js.map +1 -1
- package/dist/runtime/cascade.d.ts.map +1 -1
- package/dist/runtime/cascade.js +34 -7
- package/dist/runtime/cascade.js.map +1 -1
- package/dist/runtime/chunker.d.ts.map +1 -1
- package/dist/runtime/chunker.js +12 -6
- package/dist/runtime/chunker.js.map +1 -1
- package/dist/runtime/compounder.d.ts +1 -1
- package/dist/runtime/compounder.d.ts.map +1 -1
- package/dist/runtime/compounder.js +30 -11
- package/dist/runtime/compounder.js.map +1 -1
- package/dist/runtime/cost-model.d.ts.map +1 -1
- package/dist/runtime/cost-model.js +1 -1
- package/dist/runtime/cost-model.js.map +1 -1
- package/dist/runtime/database.d.ts +16 -0
- package/dist/runtime/database.d.ts.map +1 -0
- package/dist/runtime/database.js +39 -0
- package/dist/runtime/database.js.map +1 -0
- package/dist/runtime/distiller.d.ts.map +1 -1
- package/dist/runtime/distiller.js +6 -3
- package/dist/runtime/distiller.js.map +1 -1
- package/dist/runtime/engine.d.ts +7 -9
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +129 -394
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/executor.d.ts +1 -2
- package/dist/runtime/executor.d.ts.map +1 -1
- package/dist/runtime/executor.js +45 -14
- package/dist/runtime/executor.js.map +1 -1
- package/dist/runtime/heuristics.d.ts +1 -0
- package/dist/runtime/heuristics.d.ts.map +1 -1
- package/dist/runtime/heuristics.js +44 -22
- package/dist/runtime/heuristics.js.map +1 -1
- package/dist/runtime/learning-engine.d.ts +51 -0
- package/dist/runtime/learning-engine.d.ts.map +1 -0
- package/dist/runtime/learning-engine.js +209 -0
- package/dist/runtime/learning-engine.js.map +1 -0
- package/dist/runtime/living-spec.js +3 -3
- package/dist/runtime/living-spec.js.map +1 -1
- package/dist/runtime/lsp.d.ts.map +1 -1
- package/dist/runtime/lsp.js +41 -14
- package/dist/runtime/lsp.js.map +1 -1
- package/dist/runtime/mcp.d.ts.map +1 -1
- package/dist/runtime/mcp.js +56 -19
- package/dist/runtime/mcp.js.map +1 -1
- package/dist/runtime/model-router.d.ts +1 -0
- package/dist/runtime/model-router.d.ts.map +1 -1
- package/dist/runtime/model-router.js +37 -21
- package/dist/runtime/model-router.js.map +1 -1
- package/dist/runtime/panes.d.ts.map +1 -1
- package/dist/runtime/panes.js +50 -49
- package/dist/runtime/panes.js.map +1 -1
- package/dist/runtime/plan-search.js +2 -2
- package/dist/runtime/plan-search.js.map +1 -1
- package/dist/runtime/plugins.d.ts +1 -1
- package/dist/runtime/plugins.d.ts.map +1 -1
- package/dist/runtime/plugins.js +63 -47
- package/dist/runtime/plugins.js.map +1 -1
- package/dist/runtime/reflexion.d.ts.map +1 -1
- package/dist/runtime/reflexion.js +4 -8
- package/dist/runtime/reflexion.js.map +1 -1
- package/dist/runtime/review-schema.d.ts.map +1 -1
- package/dist/runtime/review-schema.js +12 -12
- package/dist/runtime/review-schema.js.map +1 -1
- package/dist/runtime/rewriter.d.ts.map +1 -1
- package/dist/runtime/rewriter.js +29 -9
- package/dist/runtime/rewriter.js.map +1 -1
- package/dist/runtime/sharing.d.ts +1 -1
- package/dist/runtime/sharing.d.ts.map +1 -1
- package/dist/runtime/sharing.js +55 -27
- package/dist/runtime/sharing.js.map +1 -1
- package/dist/runtime/stats.d.ts +1 -0
- package/dist/runtime/stats.d.ts.map +1 -1
- package/dist/runtime/stats.js +40 -24
- package/dist/runtime/stats.js.map +1 -1
- package/dist/runtime/templates.d.ts.map +1 -1
- package/dist/runtime/templates.js +2 -2
- package/dist/runtime/templates.js.map +1 -1
- package/dist/runtime/traces.d.ts +1 -0
- package/dist/runtime/traces.d.ts.map +1 -1
- package/dist/runtime/traces.js +50 -28
- package/dist/runtime/traces.js.map +1 -1
- package/dist/runtime/verifier.d.ts.map +1 -1
- package/dist/runtime/verifier.js +12 -6
- package/dist/runtime/verifier.js.map +1 -1
- package/dist/runtime/worktree.d.ts.map +1 -1
- package/dist/runtime/worktree.js +35 -18
- package/dist/runtime/worktree.js.map +1 -1
- package/dist/tui/dashboard.d.ts.map +1 -1
- package/dist/tui/dashboard.js +20 -16
- package/dist/tui/dashboard.js.map +1 -1
- package/dist/tui/progress.d.ts +2 -0
- package/dist/tui/progress.d.ts.map +1 -1
- package/dist/tui/progress.js +105 -33
- package/dist/tui/progress.js.map +1 -1
- package/dist/tui/renderer.d.ts.map +1 -1
- package/dist/tui/renderer.js.map +1 -1
- package/dist/utils/compact-format.js +1 -1
- package/dist/utils/compact-format.js.map +1 -1
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/env.js +19 -5
- package/dist/utils/env.js.map +1 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +3 -7
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/output.d.ts.map +1 -1
- package/dist/utils/output.js +6 -2
- package/dist/utils/output.js.map +1 -1
- package/dist/utils/project-config.d.ts +18 -0
- package/dist/utils/project-config.d.ts.map +1 -1
- package/dist/utils/project-config.js +14 -6
- package/dist/utils/project-config.js.map +1 -1
- package/dist/utils/schemas.d.ts.map +1 -1
- package/dist/utils/schemas.js +12 -12
- package/dist/utils/schemas.js.map +1 -1
- package/dist/utils/terminal.d.ts.map +1 -1
- package/dist/utils/terminal.js +18 -7
- package/dist/utils/terminal.js.map +1 -1
- package/dist/utils/tiers.d.ts.map +1 -1
- package/dist/utils/tiers.js +14 -6
- package/dist/utils/tiers.js.map +1 -1
- package/package.json +14 -3
- package/skills/swarm-output-style/SKILL.md +114 -46
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/ #
|
|
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,5 +1,10 @@
|
|
|
1
1
|
# Swarm Engine
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/swarm-engine)
|
|
4
|
+
[](https://nodejs.org)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[]()
|
|
7
|
+
|
|
3
8
|
**Your agents. Orchestrated.**
|
|
4
9
|
|
|
5
10
|
Coordinate multiple AI agents working on your code - researching, implementing, reviewing, testing - with an intelligent planner that learns from every run.
|
|
@@ -9,29 +14,46 @@ Works with Claude Code, OpenAI Codex, and Google Gemini CLI. Mix models across a
|
|
|
9
14
|
## What It Looks Like
|
|
10
15
|
|
|
11
16
|
```
|
|
12
|
-
Swarm Engine
|
|
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
|
|
22
|
+
|
|
23
|
+
Phase: implement ━━━━━━━━━━━━━━━━━━━ 1m 12s
|
|
24
|
+
● implementer opus-4-6 8.4K tok 1m 12s src/auth/rate-limit.ts
|
|
13
25
|
|
|
14
|
-
Phase
|
|
15
|
-
|
|
16
|
-
|
|
26
|
+
Phase: review ────────────────────── pending
|
|
27
|
+
○ reviewer-security opus-4-6
|
|
28
|
+
○ reviewer-perf sonnet-4-6
|
|
29
|
+
○ reviewer-convention sonnet-4-6
|
|
17
30
|
|
|
18
|
-
|
|
19
|
-
● implementer opus src/auth/rate-limit.ts...
|
|
31
|
+
Timeline: ━━──── (1/3 phases)
|
|
20
32
|
|
|
21
|
-
|
|
22
|
-
○
|
|
33
|
+
Recent findings:
|
|
34
|
+
○ researcher-code: express-rate-limit already in package.json
|
|
35
|
+
○ researcher-context: vault says rate limiter goes before auth middleware
|
|
23
36
|
|
|
24
|
-
|
|
37
|
+
12.8K tokens │ $0.24 │ 1m 36s ~2m remaining
|
|
25
38
|
```
|
|
26
39
|
|
|
27
40
|
```
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
70
|
-
|
|
91
|
+
In Claude Code:
|
|
92
|
+
```
|
|
71
93
|
/swarm "add rate limiting to the API"
|
|
94
|
+
```
|
|
72
95
|
|
|
73
|
-
|
|
74
|
-
swarm orchestrate "add rate limiting to the API"
|
|
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.
|
|
75
97
|
|
|
76
|
-
|
|
77
|
-
|
|
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:
|
|
109
|
+
|
|
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,13 +142,49 @@ 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)
|
|
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
|
+
|
|
179
|
+
See [src/index.ts](src/index.ts) for the full export surface.
|
|
180
|
+
|
|
106
181
|
## Why Swarm Engine
|
|
107
182
|
|
|
108
|
-
|
|
183
|
+
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
184
|
|
|
110
|
-
|
|
185
|
+
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
186
|
|
|
112
|
-
- **7 composable patterns** - hybrid, TDD, red-team, spike, discover, review-cycle, research. Compose them: `--pattern "
|
|
187
|
+
- **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
188
|
- **Intelligent planner** - cost-based optimization, adaptive execution, learns from every run
|
|
114
189
|
- **Mix any backend** - Claude for implementation, Codex for review, Gemini for research. Different model per agent.
|
|
115
190
|
- **Reusable templates** - save successful workflows, run them again with different parameters
|
|
@@ -171,6 +246,8 @@ swarm plan "add auth middleware" --pattern hybrid
|
|
|
171
246
|
| `/spike <problem>` | Two approaches compete, judge picks winner |
|
|
172
247
|
| `/red-team <task>` | Adversarial build and break |
|
|
173
248
|
| `/discover <problem>` | Hypothesize, experiment, implement winner |
|
|
249
|
+
| `/dynamic <task>` | Planner decomposes into custom agent workflow |
|
|
250
|
+
| `/postmortem <error>` | Root cause analysis, fix, and prevention |
|
|
174
251
|
| `/fix-pr <PR#>` | Fix PR review comments |
|
|
175
252
|
| `/resume` | Resume from checkpoint |
|
|
176
253
|
|
|
@@ -22,6 +22,7 @@ disallowedTools: Write, Edit, Bash
|
|
|
22
22
|
permissionProfile: safe
|
|
23
23
|
maxTurns: 30
|
|
24
24
|
tags: [review, accessibility, frontend]
|
|
25
|
+
outputFormat: structured
|
|
25
26
|
---
|
|
26
27
|
|
|
27
28
|
You are an Accessibility Review Agent. You analyze UI code for WCAG compliance, ARIA correctness, keyboard accessibility, and screen reader compatibility.
|
|
@@ -29,6 +30,7 @@ You are an Accessibility Review Agent. You analyze UI code for WCAG compliance,
|
|
|
29
30
|
## Process
|
|
30
31
|
|
|
31
32
|
1. **Identify interactive elements** — Buttons, links, forms, modals, dropdowns, tabs, custom widgets
|
|
33
|
+
1b. **Check vault** — `~/.claude/scripts/swarm-vault.sh repo "<repo-name>" conventions` and `~/.claude/scripts/swarm-vault.sh search "accessibility"`. Prior findings may reveal known issues.
|
|
32
34
|
2. **Check semantic HTML**:
|
|
33
35
|
- Using `<div>` or `<span>` where `<button>`, `<a>`, `<nav>`, `<main>`, `<section>` is appropriate
|
|
34
36
|
- Missing heading hierarchy (`<h1>` → `<h2>` → `<h3>`, not skipping levels)
|
|
@@ -22,6 +22,7 @@ disallowedTools: Write, Edit, Bash
|
|
|
22
22
|
permissionProfile: safe
|
|
23
23
|
maxTurns: 30
|
|
24
24
|
tags: [review, api]
|
|
25
|
+
outputFormat: structured
|
|
25
26
|
---
|
|
26
27
|
|
|
27
28
|
You are an API Contract Review Agent. You analyze API changes for backward compatibility, breaking changes, and contract consistency.
|
|
@@ -29,6 +30,7 @@ You are an API Contract Review Agent. You analyze API changes for backward compa
|
|
|
29
30
|
## Process
|
|
30
31
|
|
|
31
32
|
1. **Map the API surface** — Identify all public endpoints, exported functions, type definitions, CLI commands, and configuration formats
|
|
33
|
+
1b. **Check vault** — `~/.claude/scripts/swarm-vault.sh repo "<repo-name>" conventions` and `~/.claude/scripts/swarm-vault.sh search "API contracts"`. Prior findings may reveal known issues.
|
|
32
34
|
2. **Detect breaking changes**:
|
|
33
35
|
- Removed endpoints, functions, or type exports
|
|
34
36
|
- Renamed fields in request/response objects
|
|
@@ -22,6 +22,7 @@ disallowedTools: Write, Edit, Bash
|
|
|
22
22
|
permissionProfile: safe
|
|
23
23
|
maxTurns: 30
|
|
24
24
|
tags: [review, concurrency]
|
|
25
|
+
outputFormat: structured
|
|
25
26
|
---
|
|
26
27
|
|
|
27
28
|
You are a Concurrency Review Agent. You analyze code for race conditions, deadlocks, data races, and unsafe concurrent access patterns.
|
|
@@ -29,6 +30,7 @@ You are a Concurrency Review Agent. You analyze code for race conditions, deadlo
|
|
|
29
30
|
## Process
|
|
30
31
|
|
|
31
32
|
1. **Identify shared mutable state** — Global variables, class properties accessed from multiple async contexts, shared caches, singleton state
|
|
33
|
+
1b. **Check vault** — `~/.claude/scripts/swarm-vault.sh repo "<repo-name>" conventions` and `~/.claude/scripts/swarm-vault.sh search "concurrency"`. Prior findings may reveal known issues.
|
|
32
34
|
2. **Check for TOCTOU races**:
|
|
33
35
|
- File existence checks followed by file operations (`if (exists(f)) read(f)`)
|
|
34
36
|
- Database read-then-write without transactions
|
|
@@ -30,6 +30,7 @@ You are a Data Integrity Review Agent. You analyze database migrations, schema c
|
|
|
30
30
|
## Process
|
|
31
31
|
|
|
32
32
|
1. **Identify data operations** — Find all schema changes, migrations, CRUD operations, and data transformations
|
|
33
|
+
1b. **Check vault** — `~/.claude/scripts/swarm-vault.sh repo "<repo-name>" conventions` and `~/.claude/scripts/swarm-vault.sh search "data migration"`. Prior findings may reveal known issues.
|
|
33
34
|
2. **Check migration safety**:
|
|
34
35
|
- Is the migration reversible? Is there a down/rollback migration?
|
|
35
36
|
- Does it drop columns or tables? Is data backed up first?
|
package/agents/debugger.md
CHANGED
|
@@ -18,6 +18,8 @@ description: |
|
|
|
18
18
|
<commentary>Intermittent failure suggests timing/concurrency issue — needs careful analysis</commentary>
|
|
19
19
|
</example>
|
|
20
20
|
model: claude-opus-4-6
|
|
21
|
+
tools: Read, Glob, Grep, Bash, Write, Edit
|
|
22
|
+
disallowedTools: NotebookEdit
|
|
21
23
|
permissionProfile: standard
|
|
22
24
|
maxTurns: 50
|
|
23
25
|
---
|
|
@@ -22,6 +22,7 @@ disallowedTools: Write, Edit
|
|
|
22
22
|
permissionProfile: safe
|
|
23
23
|
maxTurns: 30
|
|
24
24
|
tags: [review, dependencies]
|
|
25
|
+
outputFormat: structured
|
|
25
26
|
---
|
|
26
27
|
|
|
27
28
|
You are a Dependency Review Agent. You analyze dependency changes for security vulnerabilities, license risks, compatibility issues, and unnecessary bloat.
|
|
@@ -29,6 +30,7 @@ You are a Dependency Review Agent. You analyze dependency changes for security v
|
|
|
29
30
|
## Process
|
|
30
31
|
|
|
31
32
|
1. **Identify dependency changes** — Diff package.json/package-lock.json (or equivalent) to find added, removed, and upgraded packages
|
|
33
|
+
1b. **Check vault** — `~/.claude/scripts/swarm-vault.sh repo "<repo-name>" conventions` and `~/.claude/scripts/swarm-vault.sh search "dependencies"`. Prior findings may reveal known issues.
|
|
32
34
|
2. **Check security**:
|
|
33
35
|
- Run `npm audit` or equivalent to find known CVEs
|
|
34
36
|
- Check if new deps have had recent security advisories
|
|
@@ -22,6 +22,7 @@ tools: Read, Glob, Grep, Bash
|
|
|
22
22
|
disallowedTools: Write, Edit, NotebookEdit
|
|
23
23
|
permissionProfile: safe
|
|
24
24
|
maxTurns: 20
|
|
25
|
+
outputFormat: structured
|
|
25
26
|
---
|
|
26
27
|
|
|
27
28
|
You are a Devil's Advocate Agent. Your job is to aggressively challenge code and design decisions to find weaknesses BEFORE review.
|
|
@@ -22,6 +22,7 @@ disallowedTools: Write, Edit, Bash
|
|
|
22
22
|
permissionProfile: safe
|
|
23
23
|
maxTurns: 30
|
|
24
24
|
tags: [review, documentation]
|
|
25
|
+
outputFormat: structured
|
|
25
26
|
---
|
|
26
27
|
|
|
27
28
|
You are a Documentation Review Agent. You analyze documentation for accuracy, completeness, and usefulness by comparing it against the actual code.
|
|
@@ -29,6 +30,7 @@ You are a Documentation Review Agent. You analyze documentation for accuracy, co
|
|
|
29
30
|
## Process
|
|
30
31
|
|
|
31
32
|
1. **Identify documentation scope** — README, API docs, inline JSDoc/TSDoc, CHANGELOG, configuration docs, architecture docs
|
|
33
|
+
1b. **Check vault** — `~/.claude/scripts/swarm-vault.sh repo "<repo-name>" conventions` and `~/.claude/scripts/swarm-vault.sh search "documentation"`. Prior findings may reveal known issues.
|
|
32
34
|
2. **Check accuracy against code**:
|
|
33
35
|
- Do documented function signatures match actual signatures?
|
|
34
36
|
- Do documented configuration options match what the code accepts?
|
package/agents/documenter.md
CHANGED
|
@@ -18,6 +18,9 @@ description: |
|
|
|
18
18
|
<commentary>Internal architecture documentation that requires deep code reading</commentary>
|
|
19
19
|
</example>
|
|
20
20
|
model: claude-haiku-4-5-20251001
|
|
21
|
+
tools: Read, Glob, Grep, Bash, Write, Edit
|
|
22
|
+
disallowedTools: NotebookEdit
|
|
23
|
+
permissionProfile: standard
|
|
21
24
|
maxTurns: 30
|
|
22
25
|
---
|
|
23
26
|
|
|
@@ -52,6 +55,16 @@ Before executing your process, reason through these questions internally (do not
|
|
|
52
55
|
- [What's documented and what's not]
|
|
53
56
|
```
|
|
54
57
|
|
|
58
|
+
## Documentation Types
|
|
59
|
+
Choose the right type based on the task:
|
|
60
|
+
- **Inline comments**: Only where logic is non-obvious. Code says WHAT; comments say WHY.
|
|
61
|
+
- **Function/class docstrings**: Parameters, return values, exceptions, one-line summary.
|
|
62
|
+
- **Module README**: Overview, usage examples, key design decisions.
|
|
63
|
+
- **Architecture docs**: Component relationships, data flow, key decisions and their rationale.
|
|
64
|
+
- **API docs**: Endpoints, request/response schemas, authentication, error codes.
|
|
65
|
+
|
|
66
|
+
Never restate what the code does. Document what it means, why it exists, and when NOT to use it.
|
|
67
|
+
|
|
55
68
|
## Rules
|
|
56
69
|
|
|
57
70
|
1. **Accuracy over completeness** — Never document behavior you haven't verified in code
|
|
@@ -22,6 +22,7 @@ disallowedTools: Write, Edit, Bash
|
|
|
22
22
|
permissionProfile: safe
|
|
23
23
|
maxTurns: 30
|
|
24
24
|
tags: [review, errors]
|
|
25
|
+
outputFormat: structured
|
|
25
26
|
---
|
|
26
27
|
|
|
27
28
|
You are an Error Handling Review Agent. You analyze code for error handling completeness, correctness, and resilience.
|
|
@@ -29,6 +30,7 @@ You are an Error Handling Review Agent. You analyze code for error handling comp
|
|
|
29
30
|
## Process
|
|
30
31
|
|
|
31
32
|
1. **Map error sources** — Identify all operations that can fail: I/O, network calls, parsing, type assertions, external APIs, database queries
|
|
33
|
+
1b. **Check vault** — `~/.claude/scripts/swarm-vault.sh repo "<repo-name>" conventions` and `~/.claude/scripts/swarm-vault.sh search "error handling"`. Prior findings may reveal known issues.
|
|
32
34
|
2. **Check catch coverage**:
|
|
33
35
|
- Unhandled promise rejections (missing `.catch()` or `try/catch` on `await`)
|
|
34
36
|
- Empty catch blocks that swallow errors silently
|
package/agents/grounding.md
CHANGED
|
@@ -22,6 +22,7 @@ tools: Read, Glob, Grep, Bash
|
|
|
22
22
|
disallowedTools: Write, Edit, NotebookEdit
|
|
23
23
|
permissionProfile: safe
|
|
24
24
|
maxTurns: 15
|
|
25
|
+
outputFormat: structured
|
|
25
26
|
---
|
|
26
27
|
|
|
27
28
|
You are a Grounding Agent — you keep the swarm connected to reality.
|
|
@@ -81,8 +82,8 @@ Before executing your process, reason through these questions internally (do not
|
|
|
81
82
|
3. **Less is more** — Building exactly what was asked is better than building more
|
|
82
83
|
4. **Be honest** — If the implementation drifted, say so. Don't rationalize.
|
|
83
84
|
5. **Abstention** — If you can't determine alignment (vague request, unclear implementation), say so
|
|
84
|
-
6. **Vault** — Check vault for the original task context
|
|
85
|
-
7. **Scratchpad** — If provided, append findings under `## Agent: grounding`
|
|
85
|
+
6. **Vault** — Check vault for the original task context: `~/.claude/scripts/swarm-vault.sh repo "<repo-name>" conventions` and `~/.claude/scripts/swarm-vault.sh search "<topic>"`. Don't re-research what's already known.
|
|
86
|
+
7. **Scratchpad** — If a scratchpad path is provided in your prompt, `Read` it before starting for context from sibling agents. Before completing, append your findings under a `## Agent: grounding` heading.
|
|
86
87
|
|
|
87
88
|
## Self-Check (internal — do not output)
|
|
88
89
|
Before finalizing your output:
|
package/agents/guardian.md
CHANGED
package/agents/implementer.md
CHANGED
|
@@ -18,6 +18,8 @@ description: |
|
|
|
18
18
|
<commentary>Scoped, well-defined change with clear success criteria</commentary>
|
|
19
19
|
</example>
|
|
20
20
|
model: claude-opus-4-6
|
|
21
|
+
tools: Read, Glob, Grep, Bash, Write, Edit
|
|
22
|
+
disallowedTools: NotebookEdit
|
|
21
23
|
permissionProfile: standard
|
|
22
24
|
maxTurns: 50
|
|
23
25
|
---
|
package/agents/integrator.md
CHANGED
|
@@ -18,6 +18,9 @@ description: |
|
|
|
18
18
|
<commentary>Cross-module verification where callers must match callees</commentary>
|
|
19
19
|
</example>
|
|
20
20
|
model: claude-opus-4-6
|
|
21
|
+
tools: Read, Glob, Grep, Bash, Write, Edit
|
|
22
|
+
disallowedTools: NotebookEdit
|
|
23
|
+
permissionProfile: standard
|
|
21
24
|
maxTurns: 50
|
|
22
25
|
---
|
|
23
26
|
|
package/agents/judge.md
CHANGED
|
@@ -19,6 +19,7 @@ description: |
|
|
|
19
19
|
model: claude-opus-4-6
|
|
20
20
|
tools: Read, Glob, Grep, Bash
|
|
21
21
|
disallowedTools: Write, Edit
|
|
22
|
+
permissionProfile: safe
|
|
22
23
|
maxTurns: 30
|
|
23
24
|
tags: [evaluation, decision]
|
|
24
25
|
outputFormat: structured
|
|
@@ -38,6 +39,7 @@ Before executing your process, reason through these questions internally (do not
|
|
|
38
39
|
## Process
|
|
39
40
|
|
|
40
41
|
1. Read BOTH implementations thoroughly — every file, every test
|
|
42
|
+
1b. **Check vault** — Read repo context: `~/.claude/scripts/swarm-vault.sh repo "<repo-name>" conventions` and `~/.claude/scripts/swarm-vault.sh search "<topic>"`. Don't re-research what's already known.
|
|
41
43
|
2. Read BOTH review assessments
|
|
42
44
|
3. Identify the evaluation criteria: correctness, maintainability, performance, test coverage, security
|
|
43
45
|
4. Consider second-order effects: which approach scales better? which is easier to extend?
|
package/agents/librarian.md
CHANGED
|
@@ -18,6 +18,9 @@ description: |
|
|
|
18
18
|
<commentary>Knowledge consistency checking</commentary>
|
|
19
19
|
</example>
|
|
20
20
|
model: claude-sonnet-4-6
|
|
21
|
+
tools: Read, Glob, Grep, Bash
|
|
22
|
+
disallowedTools: Write, Edit, NotebookEdit
|
|
23
|
+
permissionProfile: safe
|
|
21
24
|
maxTurns: 25
|
|
22
25
|
---
|
|
23
26
|
|
|
@@ -28,7 +31,7 @@ You are a Librarian Agent — you maintain the quality and coherence of the swar
|
|
|
28
31
|
1. **Inventory** — List all vault entries: `~/.claude/scripts/swarm-vault.sh list`
|
|
29
32
|
2. **Check freshness** — Read each entry's `updated` date. Flag entries older than 30 days as potentially stale.
|
|
30
33
|
3. **Detect contradictions** — Cross-reference decisions and patterns. If decision A says "use JWT" but decision B says "use sessions", flag the contradiction.
|
|
31
|
-
4. **Build connections** —
|
|
34
|
+
4. **Build connections** — **Recommend** `[[backlinks]]` between related entries (decisions that reference the same pattern, learnings from the same area).
|
|
32
35
|
5. **Prune** — Identify entries that are no longer relevant (superseded decisions, fixed bugs in learnings).
|
|
33
36
|
6. **Summarize** — Write a vault health report.
|
|
34
37
|
|
package/agents/orchestrator.md
CHANGED
|
@@ -26,6 +26,9 @@ description: |
|
|
|
26
26
|
<commentary>Many independent file transformations that can run in parallel</commentary>
|
|
27
27
|
</example>
|
|
28
28
|
model: claude-opus-4-6
|
|
29
|
+
tools: Read, Glob, Grep, Bash, Agent
|
|
30
|
+
disallowedTools: NotebookEdit
|
|
31
|
+
permissionProfile: standard
|
|
29
32
|
maxTurns: 50
|
|
30
33
|
---
|
|
31
34
|
|
|
@@ -22,6 +22,7 @@ disallowedTools: Write, Edit, Bash
|
|
|
22
22
|
permissionProfile: safe
|
|
23
23
|
maxTurns: 30
|
|
24
24
|
tags: [review, performance]
|
|
25
|
+
outputFormat: structured
|
|
25
26
|
---
|
|
26
27
|
|
|
27
28
|
You are a Performance Review Agent. You analyze code for performance problems: algorithmic complexity, memory issues, blocking operations, and resource waste.
|
|
@@ -29,6 +30,7 @@ You are a Performance Review Agent. You analyze code for performance problems: a
|
|
|
29
30
|
## Process
|
|
30
31
|
|
|
31
32
|
1. **Identify hot paths** — What code runs frequently or processes large data? Entry points, loops, event handlers, API endpoints
|
|
33
|
+
1b. **Check vault** — `~/.claude/scripts/swarm-vault.sh repo "<repo-name>" conventions` and `~/.claude/scripts/swarm-vault.sh search "performance"`. Prior findings may reveal known issues.
|
|
32
34
|
2. **Check algorithmic complexity** — Nested loops over collections, repeated linear searches, O(n²) or worse where O(n log n) or O(1) is possible
|
|
33
35
|
3. **Check memory patterns** — Unnecessary allocations in loops, unbounded caches/arrays, event listener accumulation, unclosed resources (streams, connections, file handles)
|
|
34
36
|
4. **Check I/O patterns** — Synchronous I/O blocking the event loop, N+1 database queries, missing connection pooling, sequential requests that could be parallel
|
package/agents/planner.md
CHANGED
package/agents/refactorer.md
CHANGED
|
@@ -18,6 +18,9 @@ description: |
|
|
|
18
18
|
<commentary>Cross-file rename that needs verification at each step to catch breakage early</commentary>
|
|
19
19
|
</example>
|
|
20
20
|
model: claude-opus-4-6
|
|
21
|
+
tools: Read, Glob, Grep, Bash, Write, Edit
|
|
22
|
+
disallowedTools: NotebookEdit
|
|
23
|
+
permissionProfile: standard
|
|
21
24
|
maxTurns: 50
|
|
22
25
|
---
|
|
23
26
|
|
package/agents/reviewer.md
CHANGED
|
@@ -30,6 +30,7 @@ You are a Security Review Agent. You analyze code exclusively for security vulne
|
|
|
30
30
|
## Process
|
|
31
31
|
|
|
32
32
|
1. **Identify attack surface** — Map all entry points: user input, API parameters, file uploads, URL parameters, headers, cookies, environment variables
|
|
33
|
+
1b. **Check vault** — `~/.claude/scripts/swarm-vault.sh repo "<repo-name>" conventions` and `~/.claude/scripts/swarm-vault.sh search "security"`. Prior findings may reveal known issues.
|
|
33
34
|
2. **Trace data flow** — Follow untrusted input from entry to sink. Check for sanitization/validation at each step
|
|
34
35
|
3. **Check each OWASP category**:
|
|
35
36
|
- **Injection** (SQLi, XSS, command injection, LDAP, template injection) — CWE-79, CWE-89, CWE-78
|
package/agents/sentinel.md
CHANGED
|
@@ -19,6 +19,9 @@ description: |
|
|
|
19
19
|
<commentary>Session-start briefing from ambient monitoring</commentary>
|
|
20
20
|
</example>
|
|
21
21
|
model: claude-sonnet-4-6
|
|
22
|
+
tools: Read, Glob, Grep, Bash
|
|
23
|
+
disallowedTools: Write, Edit, NotebookEdit
|
|
24
|
+
permissionProfile: safe
|
|
22
25
|
maxTurns: 20
|
|
23
26
|
---
|
|
24
27
|
|
package/agents/tester.md
CHANGED
|
@@ -22,6 +22,7 @@ disallowedTools: Write, Edit
|
|
|
22
22
|
permissionProfile: safe
|
|
23
23
|
maxTurns: 30
|
|
24
24
|
tags: [review, testing]
|
|
25
|
+
outputFormat: structured
|
|
25
26
|
---
|
|
26
27
|
|
|
27
28
|
You are a Testing Review Agent. You analyze test suites for coverage gaps, weak assertions, flakiness patterns, and testing strategy issues.
|
|
@@ -29,6 +30,7 @@ You are a Testing Review Agent. You analyze test suites for coverage gaps, weak
|
|
|
29
30
|
## Process
|
|
30
31
|
|
|
31
32
|
1. **Map test coverage** — For each changed/new source file, find corresponding test files. Identify untested code paths
|
|
33
|
+
1b. **Check vault** — `~/.claude/scripts/swarm-vault.sh repo "<repo-name>" conventions` and `~/.claude/scripts/swarm-vault.sh search "testing conventions"`. Prior findings may reveal known issues.
|
|
32
34
|
2. **Check assertion quality**:
|
|
33
35
|
- Weak assertions: `toBeTruthy()`, `toBeDefined()`, `.not.toThrow()` without checking the return value
|
|
34
36
|
- Missing assertions: test does setup but never asserts (effectively a smoke test)
|
package/commands/diff-review.md
CHANGED
|
@@ -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
|
|
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
|
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
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
|