opencode-swarm 6.10.0 → 6.12.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 CHANGED
@@ -1,198 +1,200 @@
1
- <p align="center">
2
- <img src="https://img.shields.io/badge/version-6.10.0-blue" alt="Version">
3
- <img src="https://img.shields.io/badge/license-MIT-green" alt="License">
4
- <img src="https://img.shields.io/badge/opencode-plugin-purple" alt="OpenCode Plugin">
5
- <img src="https://img.shields.io/badge/agents-9-orange" alt="Agents">
6
- <img src="https://img.shields.io/badge/tests-6000+-brightgreen" alt="Tests">
7
- </p>
8
-
9
- <h1 align="center">🐝 OpenCode Swarm</h1>
10
-
11
- <p align="center">
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
- ## The Problem
15
+ ## What Actually Happens
30
16
 
31
- Every multi-agent AI coding tool on the market has the same failure mode: they are vibes-driven. You describe a feature. Agents spawn. They race each other to write conflicting code, lose context after 20 messages, hit token limits mid-task, and produce something that sort-of-works until it doesn't. There's no plan. There's no memory. There's no gatekeeper. There's no test that was actually run.
17
+ You say: *"Build me a JWT auth system."*
32
18
 
33
- **oh-my-opencode** is a prompt collection. **get-shit-done** is a workflow macro. Neither is a framework with memory, QA enforcement, or the ability to resume a project a week later exactly where you left off.
19
+ Here's what Swarm does behind the scenes:
34
20
 
35
- OpenCode Swarm is built differently.
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
+
35
+ All of this state lives in a `.swarm/` folder in your project:
36
36
 
37
37
  ```
38
- Every other framework:
39
- ├── Agent 1 starts the auth module...
40
- ├── Agent 2 starts the user model... (conflicts with Agent 1)
41
- ├── Agent 3 writes tests... (for code that doesn't exist yet)
42
- ├── Context window fills up and the whole thing drifts
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
- ## How It Works
49
+ ## Why This Exists
60
50
 
61
- ### The Execution Pipeline
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
- │ Phase 0: Resume Check │
66
- │ .swarm/plan.md exists? Resume mid-task. New project? Continue. │
67
- └──────────────────────────────────────────────────────────────────────────┘
68
-
69
-
70
- ┌──────────────────────────────────────────────────────────────────────────┐
71
- │ Phase 1: Clarify │
72
- │ Ask only what the Architect cannot infer. Then stop. │
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 tool → imports tool → lint fix → lint check → secretscan │
112
- │ (contract change detection) (AST-based) (auto-fix) (entropy scan) │
113
- │ ↓ │
114
- │ @reviewer (correctness pass) │
115
- │ ↓ APPROVED │
116
- │ @reviewer (security-only pass, if file matches security globs) │
117
- │ ↓ APPROVED │
118
- │ @test_engineer (verification tests + coverage gate ≥70%) │
119
- │ ↓ PASS │
120
- │ @test_engineer (adversarial tests — boundary violations, injections) │
121
- │ ↓ PASS │
122
- │ plan.md → [x] Task complete │
123
- │ │
124
- │ Any gate fails → back to @coder with structured rejection reason │
125
- └──────────────────────────────────────────────────────────────────────────┘
126
-
127
-
128
- ┌──────────────────────────────────────────────────────────────────────────┐
129
- │ Phase 6: Phase Complete │
130
- │ @explorer rescans. @docs updates documentation. Retrospective written. │
131
- │ Learnings injected as [SWARM RETROSPECTIVE] into next phase. │
132
- │ "Phase 1 complete (4 tasks, 0 rejections). Ready for Phase 2?" │
133
- └──────────────────────────────────────────────────────────────────────────┘
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
134
65
  ```
135
66
 
136
- ### Why Serial Execution Matters
67
+ ### Verify
137
68
 
138
- Multi-agent parallelism sounds fast. In practice, it is a race to produce conflicting, unreviewed code that requires a human to untangle. OpenCode Swarm runs one task at a time through a deterministic pipeline. Every task is reviewed. Every test is run. Every failure is documented and fed back to the coder with structured context. The tradeoff in raw speed is paid back in not redoing work.
69
+ Open a project with `opencode` and run:
139
70
 
140
- ---
71
+ ```
72
+ /swarm diagnose
73
+ ```
141
74
 
142
- ## Agents
75
+ This checks that everything is wired up correctly.
143
76
 
144
- ### 🎯 Orchestrator
77
+ ### Configure Models (Optional)
145
78
 
146
- **`architect`** The central coordinator. Owns the plan, delegates all work, enforces every QA gate, maintains project memory, and resumes projects across sessions. Every other agent works for the Architect.
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:
147
80
 
148
- ### 🔍 Discovery
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
+ }
89
+ ```
90
+
91
+ You only need to specify the agents you want to override. The rest use the default.
92
+
93
+ ### Start Building
149
94
 
150
- **`explorer`** Fast codebase scanner. Identifies structure, languages, frameworks, key files, and import patterns. Runs before planning and after every phase completes.
95
+ Just tell OpenCode what you want to build. Swarm handles the rest.
151
96
 
152
- ### 🧠 Domain Expert
97
+ ```
98
+ > Build a REST API with user registration, login, and JWT auth
99
+ ```
153
100
 
154
- **`sme`** Open-domain expert. The Architect specifies any domain per call: `security`, `python`, `rust`, `kubernetes`, `ios`, `ml`, `blockchain` — any domain the underlying model has knowledge of. No hardcoded list. Guidance is cached in `.swarm/context.md` so the same question is never asked twice.
101
+ Use `/swarm status` at any time to see where things stand.
155
102
 
156
- ### 🎨 Design
103
+ ---
157
104
 
158
- **`designer`** UI/UX specification agent. Opt-in via config. Generates component scaffolds and design tokens before the coder touches UI tasks, eliminating the most common source of front-end rework.
105
+ ## Useful Commands
159
106
 
160
- ### 💻 Implementation
107
+ | Command | What It Does |
108
+ |---------|-------------|
109
+ | `/swarm status` | Where am I? Current phase, task progress |
110
+ | `/swarm plan` | Show the full project plan |
111
+ | `/swarm diagnose` | Health check, is everything configured right? |
112
+ | `/swarm evidence 2.1` | Show review/test results for a specific task |
113
+ | `/swarm history` | What's been completed so far |
114
+ | `/swarm reset --confirm` | Start over (clears all swarm state) |
161
115
 
162
- **`coder`** — Implements exactly one task with full context. No multitasking. No context bleed from prior tasks. The coder receives: the task spec, acceptance criteria, SME guidance, and relevant context from `.swarm/context.md`. Nothing else.
116
+ ---
163
117
 
164
- **`test_engineer`** Generates tests, runs them, and returns structured `PASS/FAIL` verdicts with coverage percentages. Runs twice per task: once for verification, once for adversarial attack scenarios.
118
+ ## The Agents
165
119
 
166
- ### Quality Assurance
120
+ Swarm has nine agents. You don't interact with them directly. The architect orchestrates everything.
167
121
 
168
- **`reviewer`** Dual-pass review. First pass: correctness, logic, maintainability. Second pass: security-only, scoped to OWASP Top 10 categories, triggered automatically when the modified files match security-sensitive path patterns. Both passes produce structured verdicts with specific rejection reasons.
122
+ | Agent | Role | When It Runs |
123
+ |-------|------|-------------|
124
+ | **architect** | Plans the project, delegates tasks, enforces quality gates | Always (it's the coordinator) |
125
+ | **explorer** | Scans your codebase to understand what exists | Before planning, after each phase |
126
+ | **sme** | Domain expert (security, APIs, databases, whatever is needed) | During planning, guidance is cached |
127
+ | **critic** | Reviews the plan before any code is written | After planning, before execution |
128
+ | **coder** | Writes code, one task at a time | During execution |
129
+ | **reviewer** | Reviews code for correctness and security issues | After every task |
130
+ | **test_engineer** | Writes and runs tests, including adversarial edge cases | After every task |
131
+ | **designer** | Generates UI scaffolds and design tokens (opt-in) | Before UI tasks |
132
+ | **docs** | Updates documentation to match what was actually built | After each phase |
169
133
 
170
- **`critic`** — Plan review gate. Reviews the Architect's plan *before implementation begins*. Checks for completeness, feasibility, scope creep, missing dependencies, and AI-slop hallucinations. Plans do not proceed without Critic approval.
134
+ ---
171
135
 
172
- ### 📝 Documentation
136
+ ## How It Compares
173
137
 
174
- **`docs`** Documentation synthesizer. Runs in Phase 6 with a diff of changed files. Updates READMEs, API documentation, and guides to reflect what was actually built, not what was planned.
138
+ | | OpenCode Swarm | oh-my-opencode | get-shit-done |
139
+ |---|:-:|:-:|:-:|
140
+ | Multiple specialized agents | ✅ 9 agents | ❌ Prompt config | ❌ Single-agent macros |
141
+ | Plan reviewed before coding starts | ✅ | ❌ | ❌ |
142
+ | Every task reviewed + tested | ✅ | ❌ | ❌ |
143
+ | Different model for review vs. coding | ✅ | ❌ | ❌ |
144
+ | Saves state to disk, resumable | ✅ | ❌ | ❌ |
145
+ | Security scanning built in | ✅ | ❌ | ❌ |
146
+ | Learns from its own mistakes | ✅ (retrospectives) | ❌ | ❌ |
175
147
 
176
148
  ---
177
149
 
178
- ## Persistent Memory
150
+ <details>
151
+ <summary><strong>Full Execution Pipeline (Technical Detail)</strong></summary>
179
152
 
180
- Other frameworks lose everything when the session ends. Swarm stores project state on disk.
153
+ ### The Pipeline
154
+
155
+ Every task goes through this sequence. No exceptions, no overrides.
181
156
 
182
157
  ```
183
- .swarm/
184
- ├── plan.md # Living roadmap: phases, tasks, status, rejections, blockers
185
- ├── plan.json # Machine-readable plan for tooling
186
- ├── context.md # Institutional knowledge: decisions, SME guidance, patterns
187
- ├── evidence/ # Per-task execution evidence bundles
188
- ├── 1.1/ # review verdict, test results, diff summary for task 1.1
189
- │ └── 2.3/
190
- └── history/
191
- ├── phase-1.md # What was built, what was learned, retrospective metrics
192
- └── phase-2.md
158
+ MODE: EXECUTE (per task)
159
+
160
+ ├── 5a. @coder implements (ONE task only)
161
+ ├── 5b. diff + imports (contract + dependency analysis)
162
+ ├── 5c. syntax_check (parse validation)
163
+ ├── 5d. placeholder_scan (catches TODOs, stubs, incomplete code)
164
+ ├── 5e. lint fix → lint check
165
+ ├── 5f. build_check (does it compile?)
166
+ ├── 5g. pre_check_batch (4 parallel: lint, secretscan, SAST, quality budget)
167
+ ├── 5h. @reviewer (correctness pass)
168
+ ├── 5i. @reviewer (security pass, if security-sensitive files changed)
169
+ ├── 5j. @test_engineer (verification tests + coverage ≥70%)
170
+ ├── 5k. @test_engineer (adversarial tests)
171
+ ├── 5l. ⛔ Pre-commit checklist (all 4 items required, no override)
172
+ └── 5m. Task marked complete, evidence written
193
173
  ```
194
174
 
195
- ### plan.md Living Roadmap
175
+ If any step fails, the coder gets structured feedback and retries. After 5 failures on the same task, it escalates to you.
176
+
177
+ ### Architect Workflow Modes
178
+
179
+ The architect moves through these modes automatically:
180
+
181
+ | Mode | What Happens |
182
+ |------|-------------|
183
+ | `RESUME` | Checks if `.swarm/plan.md` exists, picks up where it left off |
184
+ | `CLARIFY` | Asks you questions (only what it can't infer) |
185
+ | `DISCOVER` | Explorer scans the codebase |
186
+ | `CONSULT` | SME agents provide domain guidance |
187
+ | `PLAN` | Architect writes the phased plan |
188
+ | `CRITIC-GATE` | Critic reviews the plan (max 2 revision cycles) |
189
+ | `EXECUTE` | Tasks are implemented one at a time through the QA pipeline |
190
+ | `PHASE-WRAP` | Phase completes, docs update, retrospective written |
191
+
192
+ </details>
193
+
194
+ <details>
195
+ <summary><strong>Persistent Memory (What's in .swarm/)</strong></summary>
196
+
197
+ ### plan.md: Your Project Roadmap
196
198
 
197
199
  ```markdown
198
200
  # Project: Auth System
@@ -209,156 +211,108 @@ Current Phase: 2
209
211
  - Acceptance: Returns valid JWT with user claims, 15-minute expiry
210
212
  - Attempt 1: REJECTED — missing expiration claim
211
213
  - [ ] Task 2.3: Token validation middleware [MEDIUM]
212
- - [BLOCKED] Task 2.4: Refresh token rotation
213
- - Reason: Awaiting decision on rotation strategy
214
214
  ```
215
215
 
216
- ### context.md Institutional Knowledge
216
+ ### context.md: What's Been Decided
217
217
 
218
218
  ```markdown
219
- # Project Context: Auth System
220
-
221
219
  ## Technical Decisions
222
220
  - bcrypt cost factor: 12
223
221
  - JWT TTL: 15 minutes; refresh TTL: 7 days
224
- - Refresh token store: Redis with key prefix auth:refresh:
225
222
 
226
- ## SME Guidance Cache
223
+ ## SME Guidance (cached, never re-asked)
227
224
  ### security (Phase 1)
228
- - Never log tokens or passwords in any context
229
- - Use constant-time comparison for all token equality checks
230
- - Rate-limit login endpoint: 5 attempts / 15 minutes per IP
225
+ - Never log tokens or passwords
226
+ - Rate-limit login: 5 attempts / 15 min per IP
231
227
 
232
228
  ### api (Phase 1)
233
- - Return HTTP 401 for invalid credentials (not 404)
234
- - Include token expiry timestamp in response body
235
-
236
- ## Patterns Established
237
- - Error handling: custom ApiError class with HTTP status and error code
238
- - Validation: Zod schemas in /validators/, applied at request boundary
229
+ - Return 401 for invalid credentials (not 404)
239
230
  ```
240
231
 
241
- 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.
242
-
243
232
  ### Evidence Bundles
244
233
 
245
- Each completed task writes structured evidence to `.swarm/evidence/`:
234
+ Every completed task writes structured evidence to `.swarm/evidence/`:
246
235
 
247
236
  | Type | What It Captures |
248
- |------|-----------------|
249
- | `review` | Verdict (APPROVED/REJECTED), risk level, specific issues |
250
- | `test` | Pass/fail counts, coverage percentage, failure messages |
251
- | `diff` | Files changed, additions/deletions, contract change flags |
252
- | `approval` | Stakeholder sign-off with notes |
253
- | `retrospective` | Phase metrics: total tool calls, coder revisions, reviewer rejections, test failures, security findings, lessons learned |
237
+ |------|--------------------|
238
+ | review | Verdict, risk level, specific issues |
239
+ | test | Pass/fail counts, coverage %, failure messages |
240
+ | diff | Files changed, additions/deletions |
241
+ | retrospective | Phase metrics, lessons learned (injected into next phase) |
254
242
 
255
- Retrospectives from completed phases are injected as `[SWARM RETROSPECTIVE]` hints at the start of subsequent phases. The framework learns from its own history within a project.
243
+ </details>
256
244
 
257
- ---
245
+ <details>
246
+ <summary><strong>Guardrails and Circuit Breakers</strong></summary>
258
247
 
259
- ## Heterogeneous Models
248
+ Every agent runs inside a circuit breaker that kills runaway behavior before it burns your credits.
260
249
 
261
- Single-model frameworks have correlated failure modes. The same model that writes the bug reviews it and misses it. Swarm lets you route each agent to the model it is best suited for:
250
+ | Signal | Default Limit | What Happens |
251
+ |--------|:---:|-------------|
252
+ | Tool calls | 200 | Agent is stopped |
253
+ | Duration | 30 min | Agent is stopped |
254
+ | Same tool repeated | 10x | Agent is warned, then stopped |
255
+ | Consecutive errors | 5 | Agent is stopped |
256
+
257
+ Limits reset per task. A coder working on Task 2.3 is not penalized for tool calls made during Task 2.2.
258
+
259
+ Per-agent overrides:
262
260
 
263
261
  ```json
264
262
  {
265
- "agents": {
266
- "architect": { "model": "anthropic/claude-opus-4-6" },
267
- "coder": { "model": "minimax-coding-plan/MiniMax-M2.5" },
268
- "explorer": { "model": "minimax-coding-plan/MiniMax-M2.1" },
269
- "sme": { "model": "kimi-for-coding/k2p5" },
270
- "critic": { "model": "zai-coding-plan/glm-5" },
271
- "reviewer": { "model": "zai-coding-plan/glm-5" },
272
- "test_engineer": { "model": "minimax-coding-plan/MiniMax-M2.5" },
273
- "docs": { "model": "zai-coding-plan/glm-4.7-flash" },
274
- "designer": { "model": "kimi-for-coding/k2p5" }
263
+ "guardrails": {
264
+ "profiles": {
265
+ "coder": { "max_tool_calls": 500, "max_duration_minutes": 60 },
266
+ "explorer": { "max_tool_calls": 50 }
267
+ }
275
268
  }
276
269
  }
277
270
  ```
278
271
 
279
- Reviewer uses a different model than Coder by design. Different training, different priors, different blind spots. This is the cheapest bug-catcher you will ever deploy.
272
+ </details>
280
273
 
281
- ---
282
-
283
- ## Guardrails
274
+ <details>
275
+ <summary><strong>Quality Gates (Technical Detail)</strong></summary>
284
276
 
285
- Every subagent runs inside a circuit breaker that kills runaway behavior before it burns credits on a stuck loop.
277
+ ### Built-in Tools
286
278
 
287
- | Layer | Trigger | Action |
288
- |-------|---------|--------|
289
- | ⚠️ Soft Warning | 50% of any limit reached | Warning injected into agent stream |
290
- | 🛑 Hard Block | 100% of any limit reached | All further tool calls blocked |
279
+ | Tool | What It Does |
280
+ |------|-------------|
281
+ | syntax_check | Tree-sitter validation across 9+ languages |
282
+ | placeholder_scan | Catches TODOs, FIXMEs, stubs, placeholder text |
283
+ | sast_scan | Offline security analysis, 63+ rules, 9 languages |
284
+ | sbom_generate | CycloneDX dependency tracking, 8 ecosystems |
285
+ | build_check | Runs your project's native build/typecheck |
286
+ | quality_budget | Enforces complexity, duplication, and test ratio limits |
287
+ | pre_check_batch | Runs lint, secretscan, SAST, and quality budget in parallel (~15s vs ~60s sequential) |
291
288
 
292
- | Signal | Default | Description |
293
- |--------|---------|-------------|
294
- | Tool calls | 200 | Per-invocation, not per-session |
295
- | Duration | 30 min | Wall-clock time per delegation |
296
- | Repetition | 10 | Same tool + args consecutively |
297
- | Consecutive errors | 5 | Sequential null/undefined outputs |
289
+ All tools run locally. No Docker, no network calls, no external APIs.
298
290
 
299
- Limits are enforced **per-invocation**. Each delegation to a subagent starts a fresh budget. A coder fixing a second task is not penalized for the first task's tool calls. The Architect is exempt from all limits by default.
291
+ Optional enhancement: Semgrep (if on PATH).
300
292
 
301
- Per-agent profiles allow fine-grained overrides:
293
+ ### Gate Configuration
302
294
 
303
- ```jsonc
295
+ ```json
304
296
  {
305
- "guardrails": {
306
- "max_tool_calls": 200,
307
- "profiles": {
308
- "coder": { "max_tool_calls": 500, "max_duration_minutes": 60 },
309
- "explorer": { "max_tool_calls": 50 }
297
+ "gates": {
298
+ "syntax_check": { "enabled": true },
299
+ "placeholder_scan": { "enabled": true },
300
+ "sast_scan": { "enabled": true },
301
+ "quality_budget": {
302
+ "enabled": true,
303
+ "max_complexity_delta": 5,
304
+ "min_test_to_code_ratio": 0.3
310
305
  }
311
306
  }
312
307
  }
313
308
  ```
314
309
 
315
- ---
316
-
317
- ## Comparison
318
-
319
- | Feature | OpenCode Swarm | oh-my-opencode | get-shit-done | AutoGen | CrewAI |
320
- |---------|:-:|:-:|:-:|:-:|:-:|
321
- | Multi-agent orchestration | ✅ 9 specialized agents | ❌ Prompt config only | ❌ Single-agent macros | ✅ | ✅ |
322
- | Execution model | Serial (deterministic) | N/A | N/A | Parallel (chaotic) | Parallel |
323
- | Phased planning with acceptance criteria | ✅ | ❌ | ❌ | ❌ | ❌ |
324
- | Critic gate before implementation | ✅ | ❌ | ❌ | ❌ | ❌ |
325
- | Per-task dual-pass review (correctness + security) | ✅ | ❌ | ❌ | Optional | Optional |
326
- | Adversarial test pass per task | ✅ | ❌ | ❌ | ❌ | ❌ |
327
- | Pre-reviewer pipeline (lint, secretscan, imports) | ✅ v6.3 | ❌ | ❌ | ❌ | ❌ |
328
- | Persistent session memory | ✅ `.swarm/` files | ❌ | ❌ | Session only | Session only |
329
- | Resume projects across sessions | ✅ Native | ❌ | ❌ | ❌ | ❌ |
330
- | Evidence trail per task | ✅ Structured bundles | ❌ | ❌ | ❌ | ❌ |
331
- | Heterogeneous model routing | ✅ Per-agent | ❌ | ❌ | Limited | Limited |
332
- | Circuit breaker / guardrails | ✅ Per-invocation | ❌ | ❌ | ❌ | ❌ |
333
- | Open-domain SME consultation | ✅ Any domain | ❌ | ❌ | ❌ | ❌ |
334
- | Retrospective learning across phases | ✅ | ❌ | ❌ | ❌ | ❌ |
335
- | Slash commands + diagnostics | ✅ 12 commands | ❌ | Limited | ❌ | ❌ |
336
-
337
- ---
310
+ </details>
338
311
 
339
- ## Slash Commands
312
+ <details>
313
+ <summary><strong>Full Configuration Reference</strong></summary>
340
314
 
341
- | Command | Description |
342
- |---------|-------------|
343
- | `/swarm status` | Current phase, task progress, agent count |
344
- | `/swarm plan [N]` | Full plan or filtered by phase |
345
- | `/swarm agents` | All registered agents with models and permissions |
346
- | `/swarm history` | Completed phases with status |
347
- | `/swarm config` | Current resolved configuration |
348
- | `/swarm diagnose` | Health check for `.swarm/` files and config |
349
- | `/swarm export` | Export plan and context as portable JSON |
350
- | `/swarm evidence [task]` | Evidence bundles for a task or all tasks |
351
- | `/swarm archive [--dry-run]` | Archive old evidence with retention policy |
352
- | `/swarm benchmark` | Performance benchmarks |
353
- | `/swarm retrieve [id]` | Retrieve auto-summarized tool outputs |
354
- | `/swarm reset --confirm` | Clear swarm state files |
355
- | `/swarm preflight` | Run phase preflight checks (v6.7) |
356
- | `/swarm config doctor [--fix] [--restore <id>]` | Config validation with optional auto-fix (v6.7) |
357
- | `/swarm sync-plan` | Force plan.md regeneration from plan.json (v6.7) |
358
-
359
- ---
360
-
361
- ## Configuration
315
+ Config file location: `~/.config/opencode/opencode-swarm.json` (global) or `.opencode/swarm.json` (project). Project config merges over global.
362
316
 
363
317
  ```json
364
318
  {
@@ -382,7 +336,7 @@ Per-agent profiles allow fine-grained overrides:
382
336
  },
383
337
  "review_passes": {
384
338
  "always_security_review": false,
385
- "security_globs": ["**/*auth*", "**/*crypto*", "**/*session*", "**/*token*"]
339
+ "security_globs": ["**/*auth*", "**/*crypto*", "**/*session*"]
386
340
  },
387
341
  "automation": {
388
342
  "mode": "manual",
@@ -390,7 +344,6 @@ Per-agent profiles allow fine-grained overrides:
390
344
  "plan_sync": false,
391
345
  "phase_preflight": false,
392
346
  "config_doctor_on_startup": false,
393
- "config_doctor_autofix": false,
394
347
  "evidence_auto_summaries": false,
395
348
  "decision_drift_detection": false
396
349
  }
@@ -398,251 +351,93 @@ Per-agent profiles allow fine-grained overrides:
398
351
  }
399
352
  ```
400
353
 
401
- Save to `~/.config/opencode/opencode-swarm.json` or `.opencode/swarm.json` in your project root. Project config merges over global config via deep merge — partial overrides do not clobber unspecified fields.
354
+ ### Automation Modes
402
355
 
403
- ### Automation (v6.7)
356
+ | Mode | Behavior |
357
+ |------|----------|
358
+ | `manual` | No background automation (default) |
359
+ | `hybrid` | Background automation for safe ops, manual for sensitive ones |
360
+ | `auto` | Full background automation |
404
361
 
405
- **Default mode: `manual`** (no background automation). Enable automation features via `automation` config:
362
+ ### Disabling Agents
406
363
 
407
364
  ```json
408
365
  {
409
- "automation": {
410
- "mode": "hybrid",
411
- "capabilities": {
412
- "plan_sync": true,
413
- "config_doctor_on_startup": true,
414
- "evidence_auto_summaries": true
415
- }
416
- }
366
+ "sme": { "disabled": true },
367
+ "designer": { "disabled": true },
368
+ "test_engineer": { "disabled": true }
417
369
  }
418
370
  ```
419
371
 
420
- **Automation modes:**
421
- - `manual` - No background automation (default)
422
- - `hybrid` - Background automation for safe ops, manual for sensitive ones
423
- - `auto` - Full background automation (target state)
372
+ </details>
424
373
 
425
- **Per-feature flags (all default `false`):**
426
- - `plan_sync` - Auto-regenerate plan.md from plan.json when out of sync
427
- - `phase_preflight` - Phase-boundary validation before agent execution
428
- - `config_doctor_on_startup` - Config validation on plugin initialization
429
- - `config_doctor_autofix` - Auto-fix mode for Config Doctor (requires explicit opt-in)
430
- - `evidence_auto_summaries` - Auto-generate evidence summaries
431
- - `decision_drift_detection` - Detect drift between planned and actual decisions
374
+ <details>
375
+ <summary><strong>All Slash Commands</strong></summary>
432
376
 
433
- ### Disabling Agents
377
+ | Command | Description |
378
+ |---------|-------------|
379
+ | `/swarm status` | Current phase, task progress, agent count |
380
+ | `/swarm plan [N]` | Full plan or filtered by phase |
381
+ | `/swarm agents` | Registered agents with models and permissions |
382
+ | `/swarm history` | Completed phases with status |
383
+ | `/swarm config` | Current resolved configuration |
384
+ | `/swarm diagnose` | Health check for `.swarm/` files and config |
385
+ | `/swarm export` | Export plan and context as portable JSON |
386
+ | `/swarm evidence [task]` | Evidence bundles for a task or all tasks |
387
+ | `/swarm archive [--dry-run]` | Archive old evidence with retention policy |
388
+ | `/swarm benchmark` | Performance benchmarks |
389
+ | `/swarm retrieve [id]` | Retrieve auto-summarized tool outputs |
390
+ | `/swarm reset --confirm` | Clear swarm state files |
391
+ | `/swarm preflight` | Run phase preflight checks |
392
+ | `/swarm config doctor [--fix]` | Config validation with optional auto-fix |
393
+ | `/swarm sync-plan` | Force plan.md regeneration from plan.json |
434
394
 
435
- ```json
436
- {
437
- "sme": { "disabled": true },
438
- "designer": { "disabled": true },
439
- "test_engineer": { "disabled": true }
440
- }
441
- ```
395
+ </details>
442
396
 
443
397
  ---
444
398
 
445
- ## Installation
446
-
447
- ```bash
448
- # Install globally
449
- npm install -g opencode-swarm
399
+ ## Recent Changes
450
400
 
451
- # Or use npx
452
- npx opencode-swarm install
401
+ ### v6.12.0 Anti-Process-Violation Hardening
453
402
 
454
- # Verify
455
- opencode # then: /swarm diagnose
456
- ```
403
+ This release adds runtime detection hooks to catch and warn about architect workflow violations:
457
404
 
458
- The installer auto-configures `opencode.json` to include the plugin. Manual configuration:
405
+ - **Self-coding detection**: Warns when the architect writes code directly instead of delegating
406
+ - **Partial gate tracking**: Detects when QA gates are skipped
407
+ - **Self-fix detection**: Warns when an agent fixes its own gate failure (should delegate to fresh agent)
408
+ - **Batch detection**: Catches "implement X and add Y" batching in task requests
409
+ - **Zero-delegation detection**: Warns when tasks complete without any coder delegation
459
410
 
460
- ```json
461
- {
462
- "plugins": ["opencode-swarm"]
463
- }
464
- ```
411
+ These hooks are advisory (warnings only) and help maintain workflow discipline during long sessions.
465
412
 
466
413
  ---
467
414
 
468
415
  ## Testing
469
416
 
470
- 4008 tests across 136 files. Unit, integration, adversarial, and smoke. Covers config schemas, all agent prompts, all hooks, all tools, all commands, guardrail circuit breaker, race conditions, invocation window isolation, multi-invocation state, security category classification, evidence validation, background workers, phase-monitor hooks, and evidence-summary automation.
417
+ 6,000+ tests. Unit, integration, adversarial, and smoke. Zero additional test dependencies.
471
418
 
472
419
  ```bash
473
420
  bun test
474
421
  ```
475
422
 
476
- Zero additional test dependencies. Uses Bun's built-in test runner.
477
-
478
423
  ---
479
424
 
480
- ## Quality Gates (v6.9.0)
481
-
482
- ### syntax_check - Tree-sitter Parse Validation
483
- Validates syntax across 9+ languages using Tree-sitter parsers. Catches syntax errors before review.
484
-
485
- ### placeholder_scan - Anti-Slop Detection
486
- Detects TODO/FIXME comments, placeholder text, and stub implementations. Prevents shipping incomplete code.
487
-
488
- ### sast_scan - Static Security Analysis
489
- Offline SAST with 63+ security rules across 9 languages. Optional Semgrep Tier B enhancement if available on PATH.
490
-
491
- ### sbom_generate - Dependency Tracking
492
- Generates CycloneDX SBOMs from manifests/lock files. Tracks dependencies for 8 ecosystems.
493
-
494
- ### build_check - Build Verification
495
- Runs repo-native build/typecheck commands. Ensures code compiles before review.
496
-
497
- ### quality_budget - Maintainability Enforcement
498
- Enforces complexity, API, duplication, and test-to-code ratio budgets. Configurable thresholds.
499
-
500
- ## Parallel Pre-Check Batch (v6.10.0)
501
-
502
- ### pre_check_batch - Parallel Verification
503
-
504
- Runs four verification tools in parallel for faster QA gate execution:
505
- - **lint:check** - Code quality verification (hard gate)
506
- - **secretscan** - Secret detection (hard gate)
507
- - **sast_scan** - Static security analysis (hard gate)
508
- - **quality_budget** - Maintainability metrics
509
-
510
- **Purpose**: Reduces total gate execution time from ~60s (sequential) to ~15s (parallel) by running independent checks concurrently.
511
-
512
- **When to use**: After `build_check` passes and before `@reviewer` — all 4 gates must pass for `gates_passed: true`.
513
-
514
- **Usage**:
515
- ```typescript
516
- const result = await pre_check_batch({
517
- directory: ".",
518
- files: ["src/auth.ts", "src/session.ts"],
519
- sast_threshold: "medium"
520
- });
521
-
522
- // Returns:
523
- // {
524
- // gates_passed: boolean, // All hard gates passed
525
- // lint: { ran, result, error, duration_ms },
526
- // secretscan: { ran, result, error, duration_ms },
527
- // sast_scan: { ran, result, error, duration_ms },
528
- // quality_budget: { ran, result, error, duration_ms },
529
- // total_duration_ms: number
530
- // }
531
- ```
532
-
533
- **Hard Gates** (must pass for gates_passed=true):
534
- - Lint errors → Fix and retry
535
- - Secrets found → Fix and retry
536
- - SAST vulnerabilities at/above threshold → Fix and retry
537
- - Quality budget violations → Refactor or adjust thresholds
538
-
539
- **Parallel Execution Safety**:
540
- - Max 4 concurrent operations via `p-limit`
541
- - 60-second timeout per tool
542
- - 500KB output size limit
543
- - Individual tool failures don't cascade to others
544
-
545
- ### Configuration
546
-
547
- Enable/disable parallel pre-check via `.opencode/swarm.json`:
548
-
549
- ```json
550
- {
551
- "pipeline": {
552
- "parallel_precheck": true // default: true
553
- }
554
- }
555
- ```
556
-
557
- Set to `false` to run gates sequentially (useful for debugging or resource-constrained environments).
558
-
559
- ### Updated Phase 5 QA Sequence (v6.10.0)
560
-
561
- ```
562
- coder → diff → syntax_check → placeholder_scan → imports →
563
- lint fix → build_check → pre_check_batch (parallel) →
564
- reviewer → security reviewer → test_engineer → coverage check
565
- ```
566
-
567
- ### Rollback
568
-
569
- If parallel execution causes issues, refer to `.swarm/ROLLBACK-pre-check-batch.md` for rollback instructions.
570
-
571
- ### Local-Only Guarantee
572
- All v6.9.0 quality tools run locally without:
573
- - Docker containers
574
- - Network connections
575
- - External APIs
576
- - Cloud services
577
-
578
- Optional enhancement: Semgrep (if already on PATH)
579
-
580
- ### Configuration
581
- Configure gates in `.opencode/swarm.json`:
425
+ ## Design Principles
582
426
 
583
- ```json
584
- {
585
- "gates": {
586
- "syntax_check": { "enabled": true },
587
- "placeholder_scan": { "enabled": true },
588
- "sast_scan": { "enabled": true },
589
- "sbom_generate": { "enabled": true },
590
- "build_check": { "enabled": true },
591
- "quality_budget": {
592
- "enabled": true,
593
- "max_complexity_delta": 5,
594
- "max_public_api_delta": 10,
595
- "max_duplication_ratio": 0.05,
596
- "min_test_to_code_ratio": 0.3
597
- }
598
- }
599
- }
600
- ```
427
+ 1. **Plan before code.** The critic approves the plan before a single line is written.
428
+ 2. **One task at a time.** The coder gets one task and full context. Nothing else.
429
+ 3. **Review everything immediately.** Correctness, security, tests, adversarial tests. Every task.
430
+ 4. **Different models catch different bugs.** The coder's blind spot is the reviewer's strength.
431
+ 5. **Save everything to disk.** Any session, any model, any day, pick up where you left off.
432
+ 6. **Document failures.** Rejections and retries are recorded. After 5 failures, it escalates to you.
601
433
 
602
434
  ---
603
435
 
604
436
  ## Roadmap
605
437
 
606
- ### v6.3 Pre-Reviewer Pipeline
607
-
608
- Three new tools complete the pre-reviewer gauntlet. Code reaching the Reviewer is already clean.
609
-
610
- - **`imports`** — AST-based import graph. For each file changed by the coder, returns every consumer file, which exports each consumer uses, and the line numbers. Replaces fragile grep-based integration analysis with deterministic graph traversal.
611
- - **`lint`** — Auto-detects project linter (Biome, ESLint, Ruff, Clippy, PSScriptAnalyzer). Runs in fix mode first, then check mode. Structured diagnostic output per file.
612
- - **`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.
613
-
614
- Phase 5 execute loop becomes: `coder → diff → imports → lint fix → lint check → secretscan → reviewer → security reviewer → test_engineer → adversarial test_engineer`.
615
-
616
- ### v6.4 — Execution and Planning Tools
617
-
618
- - **`test_runner`** — Unified test execution across Bun, Vitest, Jest, Mocha, pytest, cargo test, and Pester. Auto-detects framework, returns normalized JSON with pass/fail/skip counts and coverage. Three scope modes: `all`, `convention` (naming-based), `graph` (import-graph-based). Eliminates the test_engineer's most common failure mode.
619
- - **`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.
620
- - **`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.
621
-
622
- ### v6.5 — Intelligence and Audit Tools
623
-
624
- Five tools that improve planning quality and post-phase validation:
625
-
626
- - **`pkg_audit`** — Wraps `npm audit`, `pip-audit`, `cargo audit`. Structured CVE output with severity, patched versions, and advisory URLs. Fed to the security reviewer for concrete vulnerability context.
627
- - **`complexity_hotspots`** — Git churn × cyclomatic complexity risk map. Run in Phase 0/2 to identify modules that need stricter QA gates before implementation begins.
628
- - **`schema_drift`** — Compares OpenAPI spec against actual route implementations. Surfaces undocumented routes and phantom spec paths. Run in Phase 6 when API routes were modified.
629
- - **`todo_extract`** — Structured extraction of `TODO`, `FIXME`, and `HACK` annotations across the codebase. High-priority items fed directly into plan task candidates.
630
- - **`evidence_check`** — Audits completed tasks against required evidence types. Run in Phase 6 to verify every task has review and test evidence before the phase is marked complete.
631
-
632
- ---
633
-
634
- ## Design Principles
438
+ See [CHANGELOG.md](CHANGELOG.md) for shipped features.
635
439
 
636
- 1. **Plan before code** Documented phases with acceptance criteria. The Critic approves the plan before a single line is written.
637
- 2. **One task at a time** — The Coder gets one task and full context. Nothing else.
638
- 3. **Review everything immediately** — Every task goes through correctness review, security review, verification tests, and adversarial tests. No task ships without passing all four.
639
- 4. **Cache SME knowledge** — Guidance is written to `context.md`. The same domain question is never asked twice in a project.
640
- 5. **Persistent memory** — `.swarm/` files are the ground truth. Any session, any model, any day.
641
- 6. **Serial execution** — Predictable, debuggable, no race conditions, no conflicting writes.
642
- 7. **Heterogeneous models** — Different models, different blind spots. The coder's bug is the reviewer's catch.
643
- 8. **User checkpoints** — Phase transitions require user confirmation. No unsupervised multi-phase runs.
644
- 9. **Document failures** — Rejections and retries are recorded in plan.md. After 5 failed attempts, the task escalates to the user.
645
- 10. **Resumable by design** — A cold-start Architect can read `.swarm/` and continue any project as if it had been there from the beginning.
440
+ Upcoming: v6.12 targets process violation hardening based on field testing with models that attempt to bypass QA gates.
646
441
 
647
442
  ---
648
443
 
@@ -651,8 +446,7 @@ Five tools that improve planning quality and post-phase validation:
651
446
  - [Architecture Deep Dive](docs/architecture.md)
652
447
  - [Design Rationale](docs/design-rationale.md)
653
448
  - [Installation Guide](docs/installation.md)
654
- - [Linux + Native Windows + Docker Desktop Install Guide](docs/installation-linux-docker.md)
655
- - [LLM Operator Install Guide](docs/installation-llm-operator.md)
449
+ - [Linux + Docker Desktop Install Guide](docs/installation-linux-docker.md)
656
450
 
657
451
  ---
658
452
 
@@ -662,6 +456,4 @@ MIT
662
456
 
663
457
  ---
664
458
 
665
- <p align="center">
666
- <strong>Stop hoping your agents figure it out. Start shipping code that actually works.</strong>
667
- </p>
459
+ **Stop hoping your agents figure it out. Start shipping code that actually works.**