opencode-swarm 6.11.0 β 6.13.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/README.md +427 -520
- package/dist/background/trigger.d.ts +4 -0
- package/dist/config/constants.d.ts +2 -0
- package/dist/config/evidence-schema.d.ts +4 -4
- package/dist/config/plan-schema.d.ts +28 -1
- package/dist/config/schema.d.ts +53 -22
- package/dist/hooks/extractors.d.ts +14 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/messages-transform.d.ts +13 -0
- package/dist/hooks/pipeline-tracker.d.ts +5 -0
- package/dist/hooks/system-enhancer.d.ts +11 -0
- package/dist/index.js +1414 -417
- package/dist/sast/rules/index.d.ts +2 -2
- package/dist/state.d.ts +20 -0
- package/dist/tools/test-runner.d.ts +2 -2
- package/dist/tools/tool-names.d.ts +10 -0
- package/dist/utils/tool-output.d.ts +10 -0
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -1,204 +1,225 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<strong>A structured multi-agent coding framework for OpenCode.</strong><br>
|
|
13
|
-
Nine specialized agents. Persistent memory. A QA gate on every task. Code that ships.
|
|
14
|
-
</p>
|
|
15
|
-
|
|
16
|
-
<p align="center">
|
|
17
|
-
<a href="#the-problem">The Problem</a> β’
|
|
18
|
-
<a href="#how-it-works">How It Works</a> β’
|
|
19
|
-
<a href="#agents">Agents</a> β’
|
|
20
|
-
<a href="#persistent-memory">Memory</a> β’
|
|
21
|
-
<a href="#guardrails">Guardrails</a> β’
|
|
22
|
-
<a href="#comparison">Comparison</a> β’
|
|
23
|
-
<a href="#installation">Installation</a> β’
|
|
24
|
-
<a href="#roadmap">Roadmap</a>
|
|
25
|
-
</p>
|
|
1
|
+
# π OpenCode Swarm
|
|
2
|
+
|
|
3
|
+
**Your AI writes the code. Swarm makes sure it actually works.**
|
|
4
|
+
|
|
5
|
+
OpenCode Swarm is a plugin for [OpenCode](https://opencode.ai) that turns a single AI coding agent into a team of nine. One agent writes the code. A different agent reviews it. Another writes and runs tests. Another catches security issues. Nothing ships until every check passes. Your project state is saved to disk, so you can close your laptop, come back tomorrow, and pick up exactly where you left off.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g opencode-swarm
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
That's it. Open your project with `opencode` and start building. Swarm activates automatically.
|
|
26
12
|
|
|
27
13
|
---
|
|
28
14
|
|
|
29
|
-
##
|
|
15
|
+
## What Actually Happens
|
|
16
|
+
|
|
17
|
+
You say: *"Build me a JWT auth system."*
|
|
30
18
|
|
|
31
|
-
|
|
19
|
+
Here's what Swarm does behind the scenes:
|
|
32
20
|
|
|
33
|
-
|
|
21
|
+
1. **Asks you clarifying questions** (only the ones it can't figure out itself)
|
|
22
|
+
2. **Scans your codebase** to understand what already exists
|
|
23
|
+
3. **Consults domain experts** (security, API design, whatever your project needs) and caches the guidance so it never re-asks
|
|
24
|
+
4. **Writes a phased plan** with concrete tasks, acceptance criteria, and dependencies
|
|
25
|
+
5. **A separate critic agent reviews the plan** before any code is written
|
|
26
|
+
6. **Implements one task at a time.** For each task:
|
|
27
|
+
- A coder agent writes the code
|
|
28
|
+
- 7 automated checks run (syntax, imports, linting, secrets, security, build, quality)
|
|
29
|
+
- A reviewer agent (running on a *different* AI model) checks for correctness
|
|
30
|
+
- A test engineer agent writes tests, runs them, and checks coverage
|
|
31
|
+
- If anything fails, it goes back to the coder with specific feedback
|
|
32
|
+
- If it passes everything, the task is marked done and the next one starts
|
|
33
|
+
7. **After each phase completes**, documentation updates automatically, and a retrospective captures what worked and what didn't. Those learnings carry into the next phase.
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
All of this state lives in a `.swarm/` folder in your project:
|
|
36
36
|
|
|
37
37
|
```
|
|
38
|
-
|
|
39
|
-
βββ
|
|
40
|
-
βββ
|
|
41
|
-
βββ
|
|
42
|
-
|
|
43
|
-
βββ Result: chaos. Rework. Start over.
|
|
44
|
-
|
|
45
|
-
OpenCode Swarm:
|
|
46
|
-
βββ Architect reads .swarm/plan.md β project already in progress, resumes Phase 2
|
|
47
|
-
βββ @explorer scans the codebase for current state
|
|
48
|
-
βββ @sme DOMAIN: security β consults on auth patterns, guidance cached
|
|
49
|
-
βββ Architect writes .swarm/plan.md: 3 phases, 9 tasks, acceptance criteria per task
|
|
50
|
-
βββ @critic reviews the plan β APPROVED
|
|
51
|
-
βββ @coder implements Task 2.2 (one task, full context, nothing else)
|
|
52
|
-
βββ diff tool β imports tool β lint fix β lint check β secretscan β @reviewer β @test_engineer
|
|
53
|
-
βββ All gates pass β plan.md updated β Task 2.2: [x]
|
|
54
|
-
βββ Result: working code, documented decisions, resumable project, evidence trail
|
|
38
|
+
.swarm/
|
|
39
|
+
βββ plan.md # Your project roadmap (tasks, status, what's done, what's next)
|
|
40
|
+
βββ context.md # Decisions made, expert guidance, established patterns
|
|
41
|
+
βββ evidence/ # Review verdicts, test results, diffs for every completed task
|
|
42
|
+
βββ history/ # Phase retrospectives and metrics
|
|
55
43
|
```
|
|
56
44
|
|
|
45
|
+
Close your terminal. Come back next week. Swarm reads these files and picks up exactly where it stopped.
|
|
46
|
+
|
|
57
47
|
---
|
|
58
48
|
|
|
59
|
-
##
|
|
49
|
+
## Why This Exists
|
|
60
50
|
|
|
61
|
-
|
|
51
|
+
Most AI coding tools let one model write code and then ask *that same model* if the code is good. That's like asking someone to proofread their own essay. They'll miss the same things they missed while writing it.
|
|
62
52
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
βΌ
|
|
76
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
77
|
-
β Phase 2: Discover β
|
|
78
|
-
β @explorer scans codebase β structure, languages, frameworks, key files β
|
|
79
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
80
|
-
β
|
|
81
|
-
βΌ
|
|
82
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
83
|
-
β Phase 3: SME Consult (serial, cached) β
|
|
84
|
-
β @sme DOMAIN: security, @sme DOMAIN: api, ... β
|
|
85
|
-
β Guidance written to .swarm/context.md β never re-asked in future phases β
|
|
86
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
87
|
-
β
|
|
88
|
-
βΌ
|
|
89
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
90
|
-
β Phase 4: Plan β
|
|
91
|
-
β Architect writes .swarm/plan.md β
|
|
92
|
-
β Structured phases, tasks with SMALL/MEDIUM/LARGE sizing, acceptance β
|
|
93
|
-
β criteria per task, explicit dependency graph β
|
|
94
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
95
|
-
β
|
|
96
|
-
βΌ
|
|
97
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
98
|
-
β Phase 4.5: Critic Gate β
|
|
99
|
-
β @critic reviews plan β APPROVED / NEEDS_REVISION / REJECTED β
|
|
100
|
-
β Max 2 revision cycles. Escalates to user if unresolved. β
|
|
101
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
102
|
-
β
|
|
103
|
-
βΌ
|
|
104
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
105
|
-
β Phase 5: Execute (per task) β
|
|
106
|
-
β β
|
|
107
|
-
β [UI task?] β @designer scaffold first β
|
|
108
|
-
β β
|
|
109
|
-
β @coder (one task, full context) β
|
|
110
|
-
β β β
|
|
111
|
-
β diff β syntax_check β placeholder_scan β imports β lint fix β
|
|
112
|
-
β (contract detection) (parse validation) (anti-slop) (AST-based) β
|
|
113
|
-
β β β
|
|
114
|
-
β build_check β pre_check_batch (4 parallel: lint:check, secretscan, β
|
|
115
|
-
β (compile verify) sast_scan, quality_budget) β
|
|
116
|
-
β β β
|
|
117
|
-
β @reviewer (correctness pass) β
|
|
118
|
-
β β APPROVED β
|
|
119
|
-
β @reviewer (security-only pass, if file matches security globs) β
|
|
120
|
-
β β APPROVED β
|
|
121
|
-
β @test_engineer (verification tests + coverage gate β₯70%) β
|
|
122
|
-
β β PASS β
|
|
123
|
-
β @test_engineer (adversarial tests β boundary violations, injections) β
|
|
124
|
-
β β PASS β
|
|
125
|
-
β β HARD STOP: Pre-commit checklist (4 items required, no override) β
|
|
126
|
-
β β COMPLETE β
|
|
127
|
-
β plan.md β [x] Task complete β
|
|
128
|
-
β β
|
|
129
|
-
β Any gate fails β retry with failure count + structured rejection β
|
|
130
|
-
β Max 5 retries β escalate to user β
|
|
131
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
132
|
-
β
|
|
133
|
-
βΌ
|
|
134
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
135
|
-
β Phase 6: Phase Complete β
|
|
136
|
-
β @explorer rescans. @docs updates documentation. Retrospective written. β
|
|
137
|
-
β Learnings injected as [SWARM RETROSPECTIVE] into next phase. β
|
|
138
|
-
β "Phase 1 complete (4 tasks, 0 rejections). Ready for Phase 2?" β
|
|
139
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
53
|
+
Swarm fixes this by splitting the work across specialized agents and requiring that different models handle writing vs. reviewing. The coder writes. A different model reviews. Another model tests. Different training data, different blind spots, different failure modes.
|
|
54
|
+
|
|
55
|
+
The other thing most tools get wrong: they try to do everything in parallel. That sounds fast, but in practice you get three agents writing conflicting code at the same time with no coordination. Swarm runs one task at a time through a fixed pipeline. Slower per-task, but you don't redo work.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Quick Start
|
|
60
|
+
|
|
61
|
+
### Install
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm install -g opencode-swarm
|
|
140
65
|
```
|
|
141
66
|
|
|
142
|
-
###
|
|
67
|
+
### Verify
|
|
143
68
|
|
|
144
|
-
|
|
69
|
+
Open a project with `opencode` and run:
|
|
145
70
|
|
|
146
|
-
|
|
71
|
+
```
|
|
72
|
+
/swarm diagnose
|
|
73
|
+
```
|
|
147
74
|
|
|
148
|
-
|
|
75
|
+
This checks that everything is wired up correctly.
|
|
149
76
|
|
|
150
|
-
###
|
|
77
|
+
### Configure Models (Optional)
|
|
151
78
|
|
|
152
|
-
|
|
79
|
+
By default, Swarm uses whatever model OpenCode is configured with. To route different agents to different models (recommended), create `.opencode/swarm.json` in your project:
|
|
153
80
|
|
|
154
|
-
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"agents": {
|
|
84
|
+
"architect": { "model": "anthropic/claude-opus-4-6" },
|
|
85
|
+
"coder": { "model": "minimax-coding-plan/MiniMax-M2.5" },
|
|
86
|
+
"reviewer": { "model": "zai-coding-plan/glm-5" }
|
|
87
|
+
},
|
|
88
|
+
"guardrails": {
|
|
89
|
+
"max_tool_calls": 200,
|
|
90
|
+
"max_duration_minutes": 30,
|
|
91
|
+
"profiles": {
|
|
92
|
+
"coder": { "max_tool_calls": 500 }
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"tool_filter": {
|
|
96
|
+
"enabled": true,
|
|
97
|
+
"overrides": {}
|
|
98
|
+
},
|
|
99
|
+
"review_passes": {
|
|
100
|
+
"always_security_review": false,
|
|
101
|
+
"security_globs": ["**/*auth*", "**/*crypto*", "**/*session*"]
|
|
102
|
+
},
|
|
103
|
+
"automation": {
|
|
104
|
+
"mode": "manual",
|
|
105
|
+
"capabilities": {
|
|
106
|
+
"plan_sync": false,
|
|
107
|
+
"phase_preflight": false,
|
|
108
|
+
"config_doctor_on_startup": false,
|
|
109
|
+
"evidence_auto_summaries": false,
|
|
110
|
+
"decision_drift_detection": false
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
You only need to specify the agents you want to override. The rest use the default.
|
|
117
|
+
|
|
118
|
+
### Start Building
|
|
155
119
|
|
|
156
|
-
|
|
120
|
+
Just tell OpenCode what you want to build. Swarm handles the rest.
|
|
157
121
|
|
|
158
|
-
|
|
122
|
+
```
|
|
123
|
+
> Build a REST API with user registration, login, and JWT auth
|
|
124
|
+
```
|
|
159
125
|
|
|
160
|
-
|
|
126
|
+
Use `/swarm status` at any time to see where things stand.
|
|
161
127
|
|
|
162
|
-
|
|
128
|
+
---
|
|
163
129
|
|
|
164
|
-
|
|
130
|
+
## Useful Commands
|
|
165
131
|
|
|
166
|
-
|
|
132
|
+
| Command | What It Does |
|
|
133
|
+
|---------|-------------|
|
|
134
|
+
| `/swarm status` | Where am I? Current phase, task progress |
|
|
135
|
+
| `/swarm plan` | Show the full project plan |
|
|
136
|
+
| `/swarm diagnose` | Health check, is everything configured right? |
|
|
137
|
+
| `/swarm evidence 2.1` | Show review/test results for a specific task |
|
|
138
|
+
| `/swarm history` | What's been completed so far |
|
|
139
|
+
| `/swarm reset --confirm` | Start over (clears all swarm state) |
|
|
167
140
|
|
|
168
|
-
|
|
141
|
+
---
|
|
169
142
|
|
|
170
|
-
|
|
143
|
+
## The Agents
|
|
171
144
|
|
|
172
|
-
|
|
145
|
+
Swarm has nine agents. You don't interact with them directly. The architect orchestrates everything.
|
|
173
146
|
|
|
174
|
-
|
|
147
|
+
| Agent | Role | When It Runs |
|
|
148
|
+
|-------|------|-------------|
|
|
149
|
+
| **architect** | Plans the project, delegates tasks, enforces quality gates | Always (it's the coordinator) |
|
|
150
|
+
| **explorer** | Scans your codebase to understand what exists | Before planning, after each phase |
|
|
151
|
+
| **sme** | Domain expert (security, APIs, databases, whatever is needed) | During planning, guidance is cached |
|
|
152
|
+
| **critic** | Reviews the plan before any code is written | After planning, before execution |
|
|
153
|
+
| **coder** | Writes code, one task at a time | During execution |
|
|
154
|
+
| **reviewer** | Reviews code for correctness and security issues | After every task |
|
|
155
|
+
| **test_engineer** | Writes and runs tests, including adversarial edge cases | After every task |
|
|
156
|
+
| **designer** | Generates UI scaffolds and design tokens (opt-in) | Before UI tasks |
|
|
157
|
+
| **docs** | Updates documentation to match what was actually built | After each phase |
|
|
175
158
|
|
|
176
|
-
|
|
159
|
+
---
|
|
177
160
|
|
|
178
|
-
|
|
161
|
+
## How It Compares
|
|
179
162
|
|
|
180
|
-
|
|
163
|
+
| | OpenCode Swarm | oh-my-opencode | get-shit-done |
|
|
164
|
+
|---|:-:|:-:|:-:|
|
|
165
|
+
| Multiple specialized agents | β
9 agents | β Prompt config | β Single-agent macros |
|
|
166
|
+
| Plan reviewed before coding starts | β
| β | β |
|
|
167
|
+
| Every task reviewed + tested | β
| β | β |
|
|
168
|
+
| Different model for review vs. coding | β
| β | β |
|
|
169
|
+
| Saves state to disk, resumable | β
| β | β |
|
|
170
|
+
| Security scanning built in | β
| β | β |
|
|
171
|
+
| Learns from its own mistakes | β
(retrospectives) | β | β |
|
|
181
172
|
|
|
182
173
|
---
|
|
183
174
|
|
|
184
|
-
|
|
175
|
+
<details>
|
|
176
|
+
<summary><strong>Full Execution Pipeline (Technical Detail)</strong></summary>
|
|
177
|
+
|
|
178
|
+
### The Pipeline
|
|
185
179
|
|
|
186
|
-
|
|
180
|
+
Every task goes through this sequence. No exceptions, no overrides.
|
|
187
181
|
|
|
188
182
|
```
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
βββ
|
|
192
|
-
βββ
|
|
193
|
-
βββ
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
183
|
+
MODE: EXECUTE (per task)
|
|
184
|
+
β
|
|
185
|
+
βββ 5a. @coder implements (ONE task only)
|
|
186
|
+
βββ 5b. diff + imports (contract + dependency analysis)
|
|
187
|
+
βββ 5c. syntax_check (parse validation)
|
|
188
|
+
βββ 5d. placeholder_scan (catches TODOs, stubs, incomplete code)
|
|
189
|
+
βββ 5e. lint fix β lint check
|
|
190
|
+
βββ 5f. build_check (does it compile?)
|
|
191
|
+
βββ 5g. pre_check_batch (4 parallel: lint, secretscan, SAST, quality budget)
|
|
192
|
+
βββ 5h. @reviewer (correctness pass)
|
|
193
|
+
βββ 5i. @reviewer (security pass, if security-sensitive files changed)
|
|
194
|
+
βββ 5j. @test_engineer (verification tests + coverage β₯70%)
|
|
195
|
+
βββ 5k. @test_engineer (adversarial tests)
|
|
196
|
+
βββ 5l. β Pre-commit checklist (all 4 items required, no override)
|
|
197
|
+
βββ 5m. Task marked complete, evidence written
|
|
199
198
|
```
|
|
200
199
|
|
|
201
|
-
|
|
200
|
+
If any step fails, the coder gets structured feedback and retries. After 5 failures on the same task, it escalates to you.
|
|
201
|
+
|
|
202
|
+
### Architect Workflow Modes
|
|
203
|
+
|
|
204
|
+
The architect moves through these modes automatically:
|
|
205
|
+
|
|
206
|
+
| Mode | What Happens |
|
|
207
|
+
|------|-------------|
|
|
208
|
+
| `RESUME` | Checks if `.swarm/plan.md` exists, picks up where it left off |
|
|
209
|
+
| `CLARIFY` | Asks you questions (only what it can't infer) |
|
|
210
|
+
| `DISCOVER` | Explorer scans the codebase |
|
|
211
|
+
| `CONSULT` | SME agents provide domain guidance |
|
|
212
|
+
| `PLAN` | Architect writes the phased plan |
|
|
213
|
+
| `CRITIC-GATE` | Critic reviews the plan (max 2 revision cycles) |
|
|
214
|
+
| `EXECUTE` | Tasks are implemented one at a time through the QA pipeline |
|
|
215
|
+
| `PHASE-WRAP` | Phase completes, docs update, retrospective written |
|
|
216
|
+
|
|
217
|
+
</details>
|
|
218
|
+
|
|
219
|
+
<details>
|
|
220
|
+
<summary><strong>Persistent Memory (What's in .swarm/)</strong></summary>
|
|
221
|
+
|
|
222
|
+
### plan.md: Your Project Roadmap
|
|
202
223
|
|
|
203
224
|
```markdown
|
|
204
225
|
# Project: Auth System
|
|
@@ -215,156 +236,108 @@ Current Phase: 2
|
|
|
215
236
|
- Acceptance: Returns valid JWT with user claims, 15-minute expiry
|
|
216
237
|
- Attempt 1: REJECTED β missing expiration claim
|
|
217
238
|
- [ ] Task 2.3: Token validation middleware [MEDIUM]
|
|
218
|
-
- [BLOCKED] Task 2.4: Refresh token rotation
|
|
219
|
-
- Reason: Awaiting decision on rotation strategy
|
|
220
239
|
```
|
|
221
240
|
|
|
222
|
-
### context.md
|
|
241
|
+
### context.md: What's Been Decided
|
|
223
242
|
|
|
224
243
|
```markdown
|
|
225
|
-
# Project Context: Auth System
|
|
226
|
-
|
|
227
244
|
## Technical Decisions
|
|
228
245
|
- bcrypt cost factor: 12
|
|
229
246
|
- JWT TTL: 15 minutes; refresh TTL: 7 days
|
|
230
|
-
- Refresh token store: Redis with key prefix auth:refresh:
|
|
231
247
|
|
|
232
|
-
## SME Guidance
|
|
248
|
+
## SME Guidance (cached, never re-asked)
|
|
233
249
|
### security (Phase 1)
|
|
234
|
-
- Never log tokens or passwords
|
|
235
|
-
-
|
|
236
|
-
- Rate-limit login endpoint: 5 attempts / 15 minutes per IP
|
|
250
|
+
- Never log tokens or passwords
|
|
251
|
+
- Rate-limit login: 5 attempts / 15 min per IP
|
|
237
252
|
|
|
238
253
|
### api (Phase 1)
|
|
239
|
-
- Return
|
|
240
|
-
- Include token expiry timestamp in response body
|
|
241
|
-
|
|
242
|
-
## Patterns Established
|
|
243
|
-
- Error handling: custom ApiError class with HTTP status and error code
|
|
244
|
-
- Validation: Zod schemas in /validators/, applied at request boundary
|
|
254
|
+
- Return 401 for invalid credentials (not 404)
|
|
245
255
|
```
|
|
246
256
|
|
|
247
|
-
Start a new session tomorrow. The Architect reads these files and picks up exactly where you left off β no re-explaining, no rediscovery, no drift.
|
|
248
|
-
|
|
249
257
|
### Evidence Bundles
|
|
250
258
|
|
|
251
|
-
|
|
259
|
+
Every completed task writes structured evidence to `.swarm/evidence/`:
|
|
252
260
|
|
|
253
261
|
| Type | What It Captures |
|
|
254
|
-
|
|
255
|
-
|
|
|
256
|
-
|
|
|
257
|
-
|
|
|
258
|
-
|
|
|
259
|
-
| `retrospective` | Phase metrics: total tool calls, coder revisions, reviewer rejections, test failures, security findings, lessons learned |
|
|
262
|
+
|------|--------------------|
|
|
263
|
+
| review | Verdict, risk level, specific issues |
|
|
264
|
+
| test | Pass/fail counts, coverage %, failure messages |
|
|
265
|
+
| diff | Files changed, additions/deletions |
|
|
266
|
+
| retrospective | Phase metrics, lessons learned (injected into next phase) |
|
|
260
267
|
|
|
261
|
-
|
|
268
|
+
</details>
|
|
262
269
|
|
|
263
|
-
|
|
270
|
+
<details>
|
|
271
|
+
<summary><strong>Guardrails and Circuit Breakers</strong></summary>
|
|
264
272
|
|
|
265
|
-
|
|
273
|
+
Every agent runs inside a circuit breaker that kills runaway behavior before it burns your credits.
|
|
266
274
|
|
|
267
|
-
|
|
275
|
+
| Signal | Default Limit | What Happens |
|
|
276
|
+
|--------|:---:|-------------|
|
|
277
|
+
| Tool calls | 200 | Agent is stopped |
|
|
278
|
+
| Duration | 30 min | Agent is stopped |
|
|
279
|
+
| Same tool repeated | 10x | Agent is warned, then stopped |
|
|
280
|
+
| Consecutive errors | 5 | Agent is stopped |
|
|
281
|
+
|
|
282
|
+
Limits reset per task. A coder working on Task 2.3 is not penalized for tool calls made during Task 2.2.
|
|
283
|
+
|
|
284
|
+
Per-agent overrides:
|
|
268
285
|
|
|
269
286
|
```json
|
|
270
287
|
{
|
|
271
|
-
"
|
|
272
|
-
"
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
"critic": { "model": "zai-coding-plan/glm-5" },
|
|
277
|
-
"reviewer": { "model": "zai-coding-plan/glm-5" },
|
|
278
|
-
"test_engineer": { "model": "minimax-coding-plan/MiniMax-M2.5" },
|
|
279
|
-
"docs": { "model": "zai-coding-plan/glm-4.7-flash" },
|
|
280
|
-
"designer": { "model": "kimi-for-coding/k2p5" }
|
|
288
|
+
"guardrails": {
|
|
289
|
+
"profiles": {
|
|
290
|
+
"coder": { "max_tool_calls": 500, "max_duration_minutes": 60 },
|
|
291
|
+
"explorer": { "max_tool_calls": 50 }
|
|
292
|
+
}
|
|
281
293
|
}
|
|
282
294
|
}
|
|
283
295
|
```
|
|
284
296
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
---
|
|
297
|
+
</details>
|
|
288
298
|
|
|
289
|
-
|
|
299
|
+
<details>
|
|
300
|
+
<summary><strong>Quality Gates (Technical Detail)</strong></summary>
|
|
290
301
|
|
|
291
|
-
|
|
302
|
+
### Built-in Tools
|
|
292
303
|
|
|
293
|
-
|
|
|
294
|
-
|
|
295
|
-
|
|
|
296
|
-
|
|
|
304
|
+
| Tool | What It Does |
|
|
305
|
+
|------|-------------|
|
|
306
|
+
| syntax_check | Tree-sitter validation across 9+ languages |
|
|
307
|
+
| placeholder_scan | Catches TODOs, FIXMEs, stubs, placeholder text |
|
|
308
|
+
| sast_scan | Offline security analysis, 63+ rules, 9 languages |
|
|
309
|
+
| sbom_generate | CycloneDX dependency tracking, 8 ecosystems |
|
|
310
|
+
| build_check | Runs your project's native build/typecheck |
|
|
311
|
+
| quality_budget | Enforces complexity, duplication, and test ratio limits |
|
|
312
|
+
| pre_check_batch | Runs lint, secretscan, SAST, and quality budget in parallel (~15s vs ~60s sequential) |
|
|
297
313
|
|
|
298
|
-
|
|
299
|
-
|--------|---------|-------------|
|
|
300
|
-
| Tool calls | 200 | Per-invocation, not per-session |
|
|
301
|
-
| Duration | 30 min | Wall-clock time per delegation |
|
|
302
|
-
| Repetition | 10 | Same tool + args consecutively |
|
|
303
|
-
| Consecutive errors | 5 | Sequential null/undefined outputs |
|
|
314
|
+
All tools run locally. No Docker, no network calls, no external APIs.
|
|
304
315
|
|
|
305
|
-
|
|
316
|
+
Optional enhancement: Semgrep (if on PATH).
|
|
306
317
|
|
|
307
|
-
|
|
318
|
+
### Gate Configuration
|
|
308
319
|
|
|
309
|
-
```
|
|
320
|
+
```json
|
|
310
321
|
{
|
|
311
|
-
"
|
|
312
|
-
"
|
|
313
|
-
"
|
|
314
|
-
|
|
315
|
-
|
|
322
|
+
"gates": {
|
|
323
|
+
"syntax_check": { "enabled": true },
|
|
324
|
+
"placeholder_scan": { "enabled": true },
|
|
325
|
+
"sast_scan": { "enabled": true },
|
|
326
|
+
"quality_budget": {
|
|
327
|
+
"enabled": true,
|
|
328
|
+
"max_complexity_delta": 5,
|
|
329
|
+
"min_test_to_code_ratio": 0.3
|
|
316
330
|
}
|
|
317
331
|
}
|
|
318
332
|
}
|
|
319
333
|
```
|
|
320
334
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
## Comparison
|
|
324
|
-
|
|
325
|
-
| Feature | OpenCode Swarm | oh-my-opencode | get-shit-done | AutoGen | CrewAI |
|
|
326
|
-
|---------|:-:|:-:|:-:|:-:|:-:|
|
|
327
|
-
| Multi-agent orchestration | β
9 specialized agents | β Prompt config only | β Single-agent macros | β
| β
|
|
|
328
|
-
| Execution model | Serial (deterministic) | N/A | N/A | Parallel (chaotic) | Parallel |
|
|
329
|
-
| Phased planning with acceptance criteria | β
| β | β | β | β |
|
|
330
|
-
| Critic gate before implementation | β
| β | β | β | β |
|
|
331
|
-
| Per-task dual-pass review (correctness + security) | β
| β | β | Optional | Optional |
|
|
332
|
-
| Adversarial test pass per task | β
| β | β | β | β |
|
|
333
|
-
| Pre-reviewer pipeline (lint, secretscan, imports) | β
v6.3 | β | β | β | β |
|
|
334
|
-
| Persistent session memory | β
`.swarm/` files | β | β | Session only | Session only |
|
|
335
|
-
| Resume projects across sessions | β
Native | β | β | β | β |
|
|
336
|
-
| Evidence trail per task | β
Structured bundles | β | β | β | β |
|
|
337
|
-
| Heterogeneous model routing | β
Per-agent | β | β | Limited | Limited |
|
|
338
|
-
| Circuit breaker / guardrails | β
Per-invocation | β | β | β | β |
|
|
339
|
-
| Open-domain SME consultation | β
Any domain | β | β | β | β |
|
|
340
|
-
| Retrospective learning across phases | β
| β | β | β | β |
|
|
341
|
-
| Slash commands + diagnostics | β
12 commands | β | Limited | β | β |
|
|
342
|
-
|
|
343
|
-
---
|
|
344
|
-
|
|
345
|
-
## Slash Commands
|
|
346
|
-
|
|
347
|
-
| Command | Description |
|
|
348
|
-
|---------|-------------|
|
|
349
|
-
| `/swarm status` | Current phase, task progress, agent count |
|
|
350
|
-
| `/swarm plan [N]` | Full plan or filtered by phase |
|
|
351
|
-
| `/swarm agents` | All registered agents with models and permissions |
|
|
352
|
-
| `/swarm history` | Completed phases with status |
|
|
353
|
-
| `/swarm config` | Current resolved configuration |
|
|
354
|
-
| `/swarm diagnose` | Health check for `.swarm/` files and config |
|
|
355
|
-
| `/swarm export` | Export plan and context as portable JSON |
|
|
356
|
-
| `/swarm evidence [task]` | Evidence bundles for a task or all tasks |
|
|
357
|
-
| `/swarm archive [--dry-run]` | Archive old evidence with retention policy |
|
|
358
|
-
| `/swarm benchmark` | Performance benchmarks |
|
|
359
|
-
| `/swarm retrieve [id]` | Retrieve auto-summarized tool outputs |
|
|
360
|
-
| `/swarm reset --confirm` | Clear swarm state files |
|
|
361
|
-
| `/swarm preflight` | Run phase preflight checks (v6.7) |
|
|
362
|
-
| `/swarm config doctor [--fix] [--restore <id>]` | Config validation with optional auto-fix (v6.7) |
|
|
363
|
-
| `/swarm sync-plan` | Force plan.md regeneration from plan.json (v6.7) |
|
|
335
|
+
</details>
|
|
364
336
|
|
|
365
|
-
|
|
337
|
+
<details>
|
|
338
|
+
<summary><strong>Full Configuration Reference</strong></summary>
|
|
366
339
|
|
|
367
|
-
|
|
340
|
+
Config file location: `~/.config/opencode/opencode-swarm.json` (global) or `.opencode/swarm.json` (project). Project config merges over global.
|
|
368
341
|
|
|
369
342
|
```json
|
|
370
343
|
{
|
|
@@ -388,349 +361,286 @@ Per-agent profiles allow fine-grained overrides:
|
|
|
388
361
|
},
|
|
389
362
|
"review_passes": {
|
|
390
363
|
"always_security_review": false,
|
|
391
|
-
"security_globs": ["**/*auth*", "**/*crypto*", "**/*session*"
|
|
364
|
+
"security_globs": ["**/*auth*", "**/*crypto*", "**/*session*"]
|
|
392
365
|
},
|
|
393
366
|
"automation": {
|
|
394
367
|
"mode": "manual",
|
|
395
368
|
"capabilities": {
|
|
396
|
-
"plan_sync":
|
|
369
|
+
"plan_sync": true,
|
|
397
370
|
"phase_preflight": false,
|
|
398
371
|
"config_doctor_on_startup": false,
|
|
399
372
|
"config_doctor_autofix": false,
|
|
400
|
-
"evidence_auto_summaries":
|
|
401
|
-
"decision_drift_detection":
|
|
373
|
+
"evidence_auto_summaries": true,
|
|
374
|
+
"decision_drift_detection": true
|
|
402
375
|
}
|
|
403
376
|
}
|
|
404
377
|
}
|
|
405
378
|
```
|
|
406
379
|
|
|
407
|
-
|
|
380
|
+
### Automation
|
|
408
381
|
|
|
409
|
-
|
|
382
|
+
## Plan Cursor (v6.13)
|
|
410
383
|
|
|
411
|
-
|
|
384
|
+
The `plan_cursor` config compresses the plan that is injected into the LLM context.
|
|
412
385
|
|
|
413
386
|
```json
|
|
414
387
|
{
|
|
415
|
-
"
|
|
416
|
-
"
|
|
417
|
-
"
|
|
418
|
-
|
|
419
|
-
"config_doctor_on_startup": true,
|
|
420
|
-
"evidence_auto_summaries": true
|
|
421
|
-
}
|
|
388
|
+
"plan_cursor": {
|
|
389
|
+
"enabled": true,
|
|
390
|
+
"max_tokens": 1500,
|
|
391
|
+
"lookahead_tasks": 2
|
|
422
392
|
}
|
|
423
393
|
}
|
|
424
394
|
```
|
|
425
395
|
|
|
426
|
-
**
|
|
427
|
-
-
|
|
428
|
-
-
|
|
429
|
-
- `auto` - Full background automation (target state)
|
|
396
|
+
- **enabled** β When `true` (default) Swarm injects a compact plan cursor instead of the full `plan.md`.
|
|
397
|
+
- **max_tokens** β Upper bound on the number of tokens emitted for the cursor (defaultβ―1500). The cursor contains the current phase summary, the full current task, and up to `lookahead_tasks` upcoming tasks. Earlier phases are reduced to oneβline summaries.
|
|
398
|
+
- **lookahead_tasks** β Number of future tasks to include in full detail (defaultβ―2). Set to `0` to show only the current task.
|
|
430
399
|
|
|
431
|
-
|
|
432
|
-
- `plan_sync` - Auto-regenerate plan.md from plan.json when out of sync
|
|
433
|
-
- `phase_preflight` - Phase-boundary validation before agent execution
|
|
434
|
-
- `config_doctor_on_startup` - Config validation on plugin initialization
|
|
435
|
-
- `config_doctor_autofix` - Auto-fix mode for Config Doctor (requires explicit opt-in)
|
|
436
|
-
- `evidence_auto_summaries` - Auto-generate evidence summaries
|
|
437
|
-
- `decision_drift_detection` - Detect drift between planned and actual decisions
|
|
400
|
+
Disabling (`"enabled": false`) falls back to the preβv6.13 behavior of injecting the entire plan text.
|
|
438
401
|
|
|
439
|
-
|
|
402
|
+
## Tool Output Truncation (v6.13)
|
|
403
|
+
|
|
404
|
+
Control the size of tool outputs that are sent back to the LLM.
|
|
440
405
|
|
|
441
406
|
```json
|
|
442
407
|
{
|
|
443
|
-
"
|
|
444
|
-
|
|
445
|
-
|
|
408
|
+
"tool_output": {
|
|
409
|
+
"truncation_enabled": true,
|
|
410
|
+
"max_lines": 150,
|
|
411
|
+
"per_tool": {
|
|
412
|
+
"diff": 200,
|
|
413
|
+
"symbols": 100
|
|
414
|
+
}
|
|
415
|
+
}
|
|
446
416
|
}
|
|
447
417
|
```
|
|
448
418
|
|
|
449
|
-
|
|
419
|
+
- **truncation_enabled** β Global switch (defaultβ―true).
|
|
420
|
+
- **max_lines** β Default line limit for any tool output.
|
|
421
|
+
- **per_tool** β Overrides `max_lines` for specific tools. The `diff` and `symbols` tools are truncated by default because their outputs can be very large.
|
|
450
422
|
|
|
451
|
-
|
|
423
|
+
When truncation is active, a footer is appended:
|
|
452
424
|
|
|
453
|
-
```bash
|
|
454
|
-
# Install globally
|
|
455
|
-
npm install -g opencode-swarm
|
|
456
|
-
|
|
457
|
-
# Or use npx
|
|
458
|
-
npx opencode-swarm install
|
|
459
|
-
|
|
460
|
-
# Verify
|
|
461
|
-
opencode # then: /swarm diagnose
|
|
462
425
|
```
|
|
463
|
-
|
|
464
|
-
The installer auto-configures `opencode.json` to include the plugin. Manual configuration:
|
|
465
|
-
|
|
466
|
-
```json
|
|
467
|
-
{
|
|
468
|
-
"plugins": ["opencode-swarm"]
|
|
469
|
-
}
|
|
470
|
-
```
|
|
471
|
-
|
|
472
426
|
---
|
|
427
|
+
[output truncated to {maxLines} lines β use `tool_output.per_tool.<tool>` to adjust]
|
|
428
|
+
```
|
|
473
429
|
|
|
474
|
-
##
|
|
430
|
+
## Mode Detection (v6.13)
|
|
475
431
|
|
|
476
|
-
|
|
432
|
+
Swarm now explicitly distinguishes five architect modes:
|
|
477
433
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
434
|
+
| Mode | When Injected |
|
|
435
|
+
|------|----------------|
|
|
436
|
+
| `DISCOVER` | After the explorer finishes scanning the codebase. |
|
|
437
|
+
| `PLAN` | When the architect writes or updates the plan. |
|
|
438
|
+
| `EXECUTE` | During task implementation (the normal pipeline). |
|
|
439
|
+
| `PHASE-WRAP` | After all tasks in a phase are completed, before docs are updated. |
|
|
440
|
+
| `UNKNOWN` | Fallback when the current state does not match any known mode. |
|
|
481
441
|
|
|
482
|
-
|
|
442
|
+
Each mode determines which injection blocks are added to the LLM prompt (e.g., plan cursor is injected in `PLAN`, tool output truncation in `EXECUTE`, etc.).
|
|
483
443
|
|
|
484
|
-
|
|
444
|
+
Default mode: `manual`. No background automation β all actions require explicit slash commands.
|
|
485
445
|
|
|
486
|
-
|
|
446
|
+
Modes:
|
|
487
447
|
|
|
488
|
-
|
|
489
|
-
|
|
448
|
+
- `manual` β No background automation. All actions via slash commands (default).
|
|
449
|
+
- `hybrid` β Background automation for safe operations, manual for sensitive ones.
|
|
450
|
+
- `auto` β Full background automation.
|
|
490
451
|
|
|
491
|
-
|
|
492
|
-
Detects TODO/FIXME comments, placeholder text, and stub implementations. Prevents shipping incomplete code.
|
|
452
|
+
Capability defaults:
|
|
493
453
|
|
|
494
|
-
|
|
495
|
-
|
|
454
|
+
- `plan_sync`: `true` β Background plan synchronization using `fs.watch` with debounced writes (300ms) and 2-second polling fallback
|
|
455
|
+
- `phase_preflight`: `false` β Phase preflight checks before agent execution (opt-in)
|
|
456
|
+
- `config_doctor_on_startup`: `false` β Validate configuration on startup
|
|
457
|
+
- `config_doctor_autofix`: `false` β Auto-fix for config doctor (opt-in, security-sensitive)
|
|
458
|
+
- `evidence_auto_summaries`: `true` β Automatic summaries for evidence bundles
|
|
459
|
+
- `decision_drift_detection`: `true` β Detect drift between planned and actual decisions
|
|
496
460
|
|
|
497
|
-
|
|
498
|
-
Generates CycloneDX SBOMs from manifests/lock files. Tracks dependencies for 8 ecosystems.
|
|
461
|
+
---
|
|
499
462
|
|
|
500
|
-
###
|
|
501
|
-
Runs repo-native build/typecheck commands. Ensures code compiles before review.
|
|
463
|
+
### Disabling Agents
|
|
502
464
|
|
|
503
|
-
|
|
504
|
-
|
|
465
|
+
```json
|
|
466
|
+
{
|
|
467
|
+
"sme": { "disabled": true },
|
|
468
|
+
"designer": { "disabled": true },
|
|
469
|
+
"test_engineer": { "disabled": true }
|
|
470
|
+
}
|
|
471
|
+
```
|
|
505
472
|
|
|
506
|
-
|
|
473
|
+
</details>
|
|
507
474
|
|
|
508
|
-
|
|
475
|
+
<details>
|
|
476
|
+
<summary><strong>All Slash Commands</strong></summary>
|
|
509
477
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
478
|
+
| Command | Description |
|
|
479
|
+
|---------|-------------|
|
|
480
|
+
| `/swarm status` | Current phase, task progress, agent count |
|
|
481
|
+
| `/swarm plan [N]` | Full plan or filtered by phase |
|
|
482
|
+
| `/swarm agents` | Registered agents with models and permissions |
|
|
483
|
+
| `/swarm history` | Completed phases with status |
|
|
484
|
+
| `/swarm config` | Current resolved configuration |
|
|
485
|
+
| `/swarm diagnose` | Health check for `.swarm/` files and config |
|
|
486
|
+
| `/swarm export` | Export plan and context as portable JSON |
|
|
487
|
+
| `/swarm evidence [task]` | Evidence bundles for a task or all tasks |
|
|
488
|
+
| `/swarm archive [--dry-run]` | Archive old evidence with retention policy |
|
|
489
|
+
| `/swarm benchmark` | Performance benchmarks |
|
|
490
|
+
| `/swarm retrieve [id]` | Retrieve auto-summarized tool outputs |
|
|
491
|
+
| `/swarm reset --confirm` | Clear swarm state files |
|
|
492
|
+
| `/swarm preflight` | Run phase preflight checks |
|
|
493
|
+
| `/swarm config doctor [--fix]` | Config validation with optional auto-fix |
|
|
494
|
+
| `/swarm sync-plan` | Force plan.md regeneration from plan.json |
|
|
515
495
|
|
|
516
|
-
|
|
496
|
+
</details>
|
|
517
497
|
|
|
518
|
-
|
|
498
|
+
---
|
|
519
499
|
|
|
520
|
-
|
|
521
|
-
```typescript
|
|
522
|
-
const result = await pre_check_batch({
|
|
523
|
-
directory: ".",
|
|
524
|
-
files: ["src/auth.ts", "src/session.ts"],
|
|
525
|
-
sast_threshold: "medium"
|
|
526
|
-
});
|
|
500
|
+
## Role-Scoped Tool Filtering
|
|
527
501
|
|
|
528
|
-
|
|
529
|
-
// {
|
|
530
|
-
// gates_passed: boolean, // All hard gates passed
|
|
531
|
-
// lint: { ran, result, error, duration_ms },
|
|
532
|
-
// secretscan: { ran, result, error, duration_ms },
|
|
533
|
-
// sast_scan: { ran, result, error, duration_ms },
|
|
534
|
-
// quality_budget: { ran, result, error, duration_ms },
|
|
535
|
-
// total_duration_ms: number
|
|
536
|
-
// }
|
|
537
|
-
```
|
|
502
|
+
Swarm limits which tools each agent can access based on their role. This prevents agents from using tools that aren't appropriate for their responsibilities, reducing errors and keeping agents focused.
|
|
538
503
|
|
|
539
|
-
|
|
540
|
-
- Lint errors β Fix and retry
|
|
541
|
-
- Secrets found β Fix and retry
|
|
542
|
-
- SAST vulnerabilities at/above threshold β Fix and retry
|
|
543
|
-
- Quality budget violations β Refactor or adjust thresholds
|
|
504
|
+
### Default Tool Allocations
|
|
544
505
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
506
|
+
| Agent | Tools | Count | Rationale |
|
|
507
|
+
|-------|-------|:---:|-----------|
|
|
508
|
+
| **architect** | All 17 tools | 17 | Orchestrator needs full visibility |
|
|
509
|
+
| **reviewer** | diff, imports, lint, pkg_audit, pre_check_batch, secretscan, symbols, complexity_hotspots, retrieve_summary, extract_code_blocks, test_runner | 11 | Security-focused QA |
|
|
510
|
+
| **coder** | diff, imports, lint, symbols, extract_code_blocks, retrieve_summary | 6 | Write-focused, minimal read tools |
|
|
511
|
+
| **test_engineer** | test_runner, diff, symbols, extract_code_blocks, retrieve_summary, imports, complexity_hotspots, pkg_audit | 8 | Testing and verification |
|
|
512
|
+
| **explorer** | complexity_hotspots, detect_domains, extract_code_blocks, gitingest, imports, retrieve_summary, schema_drift, symbols, todo_extract | 9 | Discovery and analysis |
|
|
513
|
+
| **sme** | complexity_hotspots, detect_domains, extract_code_blocks, imports, retrieve_summary, schema_drift, symbols | 7 | Domain expertise research |
|
|
514
|
+
| **critic** | complexity_hotspots, detect_domains, imports, retrieve_summary, symbols | 5 | Plan review, minimal toolset |
|
|
515
|
+
| **docs** | detect_domains, extract_code_blocks, gitingest, imports, retrieve_summary, schema_drift, symbols, todo_extract | 8 | Documentation synthesis |
|
|
516
|
+
| **designer** | extract_code_blocks, retrieve_summary, symbols | 3 | UI-focused, minimal toolset |
|
|
550
517
|
|
|
551
518
|
### Configuration
|
|
552
519
|
|
|
553
|
-
|
|
520
|
+
Tool filtering is enabled by default. Customize it in your config:
|
|
554
521
|
|
|
555
522
|
```json
|
|
556
523
|
{
|
|
557
|
-
"
|
|
558
|
-
"
|
|
524
|
+
"tool_filter": {
|
|
525
|
+
"enabled": true,
|
|
526
|
+
"overrides": {
|
|
527
|
+
"coder": ["diff", "imports", "lint", "symbols", "test_runner"],
|
|
528
|
+
"reviewer": ["diff", "secretscan", "sast_scan", "symbols"]
|
|
529
|
+
}
|
|
559
530
|
}
|
|
560
531
|
}
|
|
561
532
|
```
|
|
562
533
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
Complete execution pipeline with MODE labels and observable outputs:
|
|
534
|
+
| Option | Type | Default | Description |
|
|
535
|
+
|--------|------|---------|-------------|
|
|
536
|
+
| `enabled` | boolean | `true` | Enable tool filtering globally |
|
|
537
|
+
| `overrides` | Record<string, string[]> | `{}` | Per-agent tool whitelist. Empty array denies all tools. |
|
|
568
538
|
|
|
569
|
-
|
|
570
|
-
MODE: EXECUTE (per task)
|
|
571
|
-
β
|
|
572
|
-
βββ 5a. @coder implements (ONE task only)
|
|
573
|
-
β βββ β REQUIRED: Print task start confirmation
|
|
574
|
-
β
|
|
575
|
-
βββ 5b. diff + imports tools (contract + dependency analysis)
|
|
576
|
-
β βββ β REQUIRED: Print change summary
|
|
577
|
-
β
|
|
578
|
-
βββ 5c. syntax_check (parse validation)
|
|
579
|
-
β βββ β REQUIRED: Print syntax status
|
|
580
|
-
β
|
|
581
|
-
βββ 5d. placeholder_scan (anti-slop detection)
|
|
582
|
-
β βββ β REQUIRED: Print placeholder scan results
|
|
583
|
-
β
|
|
584
|
-
βββ 5e. lint fix β 5f. lint:check (inside pre_check_batch)
|
|
585
|
-
β βββ β REQUIRED: Print lint status
|
|
586
|
-
β
|
|
587
|
-
βββ 5g. build_check (compilation verification)
|
|
588
|
-
β βββ β REQUIRED: Print build status
|
|
589
|
-
β
|
|
590
|
-
βββ 5h. pre_check_batch (4 parallel gates)
|
|
591
|
-
β βββ lint:check (hard gate)
|
|
592
|
-
β βββ secretscan (hard gate)
|
|
593
|
-
β βββ sast_scan (hard gate)
|
|
594
|
-
β βββ quality_budget (maintainability metrics)
|
|
595
|
-
β βββ β REQUIRED: Print gates_passed status
|
|
596
|
-
β
|
|
597
|
-
βββ 5i. @reviewer (correctness pass)
|
|
598
|
-
β βββ β REQUIRED: Print approval decision
|
|
599
|
-
β
|
|
600
|
-
βββ 5j. @reviewer security-only pass (if security file)
|
|
601
|
-
β βββ β REQUIRED: Print security approval
|
|
602
|
-
β
|
|
603
|
-
βββ 5k. @test_engineer (verification tests + coverage)
|
|
604
|
-
β βββ β REQUIRED: Print test results
|
|
605
|
-
β
|
|
606
|
-
βββ 5l. @test_engineer (adversarial tests)
|
|
607
|
-
β βββ β REQUIRED: Print adversarial test results
|
|
608
|
-
β
|
|
609
|
-
βββ 5m. β HARD STOP: Pre-commit checklist
|
|
610
|
-
β βββ [ ] All QA gates passed (no overrides)
|
|
611
|
-
β βββ [ ] Reviewer approval documented
|
|
612
|
-
β βββ [ ] Tests pass with evidence
|
|
613
|
-
β βββ [ ] No security findings
|
|
614
|
-
β βββ β REQUIRED: Print checklist completion
|
|
615
|
-
β
|
|
616
|
-
βββ 5n. TASK COMPLETION CHECKLIST (emit before marking complete)
|
|
617
|
-
βββ Evidence written to .swarm/evidence/{taskId}/
|
|
618
|
-
βββ plan.md updated with [x] task complete
|
|
619
|
-
βββ β REQUIRED: Print completion confirmation
|
|
620
|
-
```
|
|
539
|
+
### Troubleshooting: Agent Missing a Tool
|
|
621
540
|
|
|
622
|
-
|
|
623
|
-
- `MODE: RESUME` β Resume detection
|
|
624
|
-
- `MODE: CLARIFY` β Requirement clarification
|
|
625
|
-
- `MODE: DISCOVER` β Codebase exploration
|
|
626
|
-
- `MODE: CONSULT` β SME consultation
|
|
627
|
-
- `MODE: PLAN` β Plan creation
|
|
628
|
-
- `MODE: CRITIC-GATE` β Plan review checkpoint
|
|
629
|
-
- `MODE: EXECUTE` β Task implementation
|
|
630
|
-
- `MODE: PHASE-WRAP` β Phase completion
|
|
541
|
+
If an agent reports it doesn't have access to a tool it needs:
|
|
631
542
|
|
|
632
|
-
|
|
543
|
+
1. Check if the tool is in the agent's default allocation (see table above)
|
|
544
|
+
2. Add a custom override in your config:
|
|
633
545
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
546
|
+
```json
|
|
547
|
+
{
|
|
548
|
+
"tool_filter": {
|
|
549
|
+
"overrides": {
|
|
550
|
+
"coder": ["diff", "imports", "lint", "symbols", "extract_code_blocks", "retrieve_summary", "test_runner"]
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
641
554
|
```
|
|
642
555
|
|
|
643
|
-
|
|
644
|
-
- "It's a simple change"
|
|
645
|
-
- "Just updating docs"
|
|
646
|
-
- "Only a config tweak"
|
|
647
|
-
- "Hotfix, no time for QA"
|
|
648
|
-
- "The tests pass locally"
|
|
649
|
-
- "I'll clean it up later"
|
|
650
|
-
- "No logic changes"
|
|
651
|
-
- "Already reviewed the pattern"
|
|
652
|
-
|
|
653
|
-
**Pre-Commit Rule** (v6.11): All 4 checkboxes required before commit. No override. A commit without completed QA gate is a workflow violation.
|
|
654
|
-
|
|
655
|
-
### Rollback
|
|
656
|
-
|
|
657
|
-
If parallel execution causes issues, refer to `.swarm/ROLLBACK-pre-check-batch.md` for rollback instructions.
|
|
658
|
-
|
|
659
|
-
### Local-Only Guarantee
|
|
660
|
-
All v6.9.0 quality tools run locally without:
|
|
661
|
-
- Docker containers
|
|
662
|
-
- Network connections
|
|
663
|
-
- External APIs
|
|
664
|
-
- Cloud services
|
|
665
|
-
|
|
666
|
-
Optional enhancement: Semgrep (if already on PATH)
|
|
667
|
-
|
|
668
|
-
### Configuration
|
|
669
|
-
Configure gates in `.opencode/swarm.json`:
|
|
556
|
+
3. To completely disable filtering for all agents:
|
|
670
557
|
|
|
671
558
|
```json
|
|
672
559
|
{
|
|
673
|
-
"
|
|
674
|
-
"
|
|
675
|
-
"placeholder_scan": { "enabled": true },
|
|
676
|
-
"sast_scan": { "enabled": true },
|
|
677
|
-
"sbom_generate": { "enabled": true },
|
|
678
|
-
"build_check": { "enabled": true },
|
|
679
|
-
"quality_budget": {
|
|
680
|
-
"enabled": true,
|
|
681
|
-
"max_complexity_delta": 5,
|
|
682
|
-
"max_public_api_delta": 10,
|
|
683
|
-
"max_duplication_ratio": 0.05,
|
|
684
|
-
"min_test_to_code_ratio": 0.3
|
|
685
|
-
}
|
|
560
|
+
"tool_filter": {
|
|
561
|
+
"enabled": false
|
|
686
562
|
}
|
|
687
563
|
}
|
|
688
564
|
```
|
|
689
565
|
|
|
566
|
+
### Available Tools Reference
|
|
567
|
+
|
|
568
|
+
The following tools can be assigned to agents via overrides:
|
|
569
|
+
|
|
570
|
+
| Tool | Purpose |
|
|
571
|
+
|------|---------|
|
|
572
|
+
| `checkpoint` | Save/restore git checkpoints |
|
|
573
|
+
| `complexity_hotspots` | Identify high-risk code areas |
|
|
574
|
+
| `detect_domains` | Detect SME domains from text |
|
|
575
|
+
| `diff` | Analyze git diffs and changes |
|
|
576
|
+
| `evidence_check` | Verify task evidence |
|
|
577
|
+
| `extract_code_blocks` | Extract code from markdown |
|
|
578
|
+
| `gitingest` | Ingest external repositories |
|
|
579
|
+
| `imports` | Analyze import relationships |
|
|
580
|
+
| `lint` | Run project linters |
|
|
581
|
+
| `pkg_audit` | Security audit of dependencies |
|
|
582
|
+
| `pre_check_batch` | Parallel pre-checks (lint, secrets, SAST, quality) |
|
|
583
|
+
| `retrieve_summary` | Retrieve summarized tool outputs |
|
|
584
|
+
| `schema_drift` | Detect OpenAPI/schema drift |
|
|
585
|
+
| `secretscan` | Scan for secrets in code |
|
|
586
|
+
| `symbols` | Extract exported symbols |
|
|
587
|
+
| `test_runner` | Run project tests |
|
|
588
|
+
| `todo_extract` | Extract TODO/FIXME comments |
|
|
589
|
+
|
|
690
590
|
---
|
|
691
591
|
|
|
692
|
-
##
|
|
592
|
+
## Recent Changes
|
|
593
|
+
|
|
594
|
+
### v6.13.0 β Context Efficiency
|
|
693
595
|
|
|
694
|
-
|
|
596
|
+
This release focuses on reducing context usage and improving mode-conditional behavior:
|
|
695
597
|
|
|
696
|
-
|
|
598
|
+
- **Role-Scoped Tool Filtering**: Agent tools filtered via AGENT_TOOL_MAP
|
|
599
|
+
- **Plan Cursor**: Compressed plan summary under 1,500 tokens
|
|
600
|
+
- **Mode Detection**: DISCOVER/PLAN/EXECUTE/PHASE-WRAP/UNKNOWN modes
|
|
601
|
+
- **Tool Output Truncation**: diff/symbols outputs truncated with footer
|
|
602
|
+
- **ZodError Fixes**: Optional current_phase, 'completed' status support
|
|
697
603
|
|
|
698
|
-
|
|
699
|
-
- **`lint`** β Auto-detects project linter (Biome, ESLint, Ruff, Clippy, PSScriptAnalyzer). Runs in fix mode first, then check mode. Structured diagnostic output per file.
|
|
700
|
-
- **`secretscan`** β Entropy-based credential scanner. Detects API keys, tokens, connection strings, and private key headers in the diff before they reach the reviewer. Zero external dependencies.
|
|
604
|
+
### v6.12.0 β Anti-Process-Violation Hardening
|
|
701
605
|
|
|
702
|
-
|
|
606
|
+
This release adds runtime detection hooks to catch and warn about architect workflow violations:
|
|
703
607
|
|
|
704
|
-
|
|
608
|
+
- **Self-coding detection**: Warns when the architect writes code directly instead of delegating
|
|
609
|
+
- **Partial gate tracking**: Detects when QA gates are skipped
|
|
610
|
+
- **Self-fix detection**: Warns when an agent fixes its own gate failure (should delegate to fresh agent)
|
|
611
|
+
- **Batch detection**: Catches "implement X and add Y" batching in task requests
|
|
612
|
+
- **Zero-delegation detection**: Warns when tasks complete without any coder delegation
|
|
705
613
|
|
|
706
|
-
|
|
707
|
-
- **`symbols`** β Export inventory for a module: functions, classes, interfaces, types, enums. Gives the Architect instant visibility into a file's public API surface without reading the full source.
|
|
708
|
-
- **`checkpoint`** β Git-backed save points. Before any multi-file refactor (β₯3 files), Architect auto-creates a checkpoint commit. On critical integration failure, restores via soft reset instead of iterating into a hole.
|
|
614
|
+
These hooks are advisory (warnings only) and help maintain workflow discipline during long sessions.
|
|
709
615
|
|
|
710
|
-
|
|
616
|
+
---
|
|
711
617
|
|
|
712
|
-
|
|
618
|
+
## Testing
|
|
713
619
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
620
|
+
6,000+ tests. Unit, integration, adversarial, and smoke. Zero additional test dependencies.
|
|
621
|
+
|
|
622
|
+
```bash
|
|
623
|
+
bun test
|
|
624
|
+
```
|
|
719
625
|
|
|
720
626
|
---
|
|
721
627
|
|
|
722
628
|
## Design Principles
|
|
723
629
|
|
|
724
|
-
1. **Plan before code
|
|
725
|
-
2. **One task at a time
|
|
726
|
-
3. **Review everything immediately
|
|
727
|
-
4. **
|
|
728
|
-
5. **
|
|
729
|
-
6. **
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
630
|
+
1. **Plan before code.** The critic approves the plan before a single line is written.
|
|
631
|
+
2. **One task at a time.** The coder gets one task and full context. Nothing else.
|
|
632
|
+
3. **Review everything immediately.** Correctness, security, tests, adversarial tests. Every task.
|
|
633
|
+
4. **Different models catch different bugs.** The coder's blind spot is the reviewer's strength.
|
|
634
|
+
5. **Save everything to disk.** Any session, any model, any day, pick up where you left off.
|
|
635
|
+
6. **Document failures.** Rejections and retries are recorded. After 5 failures, it escalates to you.
|
|
636
|
+
|
|
637
|
+
---
|
|
638
|
+
|
|
639
|
+
## Roadmap
|
|
640
|
+
|
|
641
|
+
See [CHANGELOG.md](CHANGELOG.md) for shipped features.
|
|
642
|
+
|
|
643
|
+
Upcoming: v6.14 focuses on further context optimization and agent coordination improvements.
|
|
734
644
|
|
|
735
645
|
---
|
|
736
646
|
|
|
@@ -739,8 +649,7 @@ Five tools that improve planning quality and post-phase validation:
|
|
|
739
649
|
- [Architecture Deep Dive](docs/architecture.md)
|
|
740
650
|
- [Design Rationale](docs/design-rationale.md)
|
|
741
651
|
- [Installation Guide](docs/installation.md)
|
|
742
|
-
- [Linux +
|
|
743
|
-
- [LLM Operator Install Guide](docs/installation-llm-operator.md)
|
|
652
|
+
- [Linux + Docker Desktop Install Guide](docs/installation-linux-docker.md)
|
|
744
653
|
|
|
745
654
|
---
|
|
746
655
|
|
|
@@ -750,6 +659,4 @@ MIT
|
|
|
750
659
|
|
|
751
660
|
---
|
|
752
661
|
|
|
753
|
-
|
|
754
|
-
<strong>Stop hoping your agents figure it out. Start shipping code that actually works.</strong>
|
|
755
|
-
</p>
|
|
662
|
+
**Stop hoping your agents figure it out. Start shipping code that actually works.**
|