opencode-swarm 3.4.0 → 4.0.1

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  <p align="center">
2
- <img src="https://img.shields.io/badge/version-3.0.0-blue" alt="Version">
2
+ <img src="https://img.shields.io/badge/version-4.0.0-blue" alt="Version">
3
3
  <img src="https://img.shields.io/badge/license-MIT-green" alt="License">
4
4
  <img src="https://img.shields.io/badge/opencode-plugin-purple" alt="OpenCode Plugin">
5
- <img src="https://img.shields.io/badge/agents-20+-orange" alt="Agents">
5
+ <img src="https://img.shields.io/badge/agents-7-orange" alt="Agents">
6
6
  </p>
7
7
 
8
8
  <h1 align="center">🐝 OpenCode Swarm</h1>
@@ -37,11 +37,11 @@ Other Frameworks:
37
37
  OpenCode Swarm:
38
38
  ├── Architect analyzes request
39
39
  ├── Explorer scans codebase
40
- ├── Security SME provides auth guidance
40
+ ├── @sme consulted on security domain
41
41
  ├── Architect creates phased plan with acceptance criteria
42
- ├── Phase 1: User model → QA → Tests → ✓
43
- ├── Phase 2: Auth logic → QA → Tests → ✓
44
- ├── Phase 3: Session management → QA → Tests → ✓
42
+ ├── Phase 1: User model → Review → Tests → ✓
43
+ ├── Phase 2: Auth logic → Review → Tests → ✓
44
+ ├── Phase 3: Session management → Review → Tests → ✓
45
45
  └── Result: Working code. Documented decisions. Resumable progress.
46
46
  ```
47
47
 
@@ -72,7 +72,7 @@ OpenCode Swarm:
72
72
  - **Heterogeneous models** - different perspectives catch errors
73
73
  - **Phased planning** - documented tasks with acceptance criteria
74
74
  - **Persistent memory** - `.swarm/` files survive sessions
75
- - **QA per task** - security + audit before anything ships
75
+ - **Review per task** - correctness + security review before anything ships
76
76
  - **One task at a time** - focused, quality code
77
77
  - **Resumable projects** - pick up exactly where you left off
78
78
 
@@ -110,8 +110,8 @@ OpenCode Swarm:
110
110
 
111
111
  ┌─────────────────────────────────────────────────────────────────────────┐
112
112
  │ PHASE 3: Consult SMEs (serial, cached) │
113
- │ @sme_security → auth best practices
114
- │ @sme_api → JWT patterns, refresh flow
113
+ │ @sme DOMAIN: security → auth best practices
114
+ │ @sme DOMAIN: api → JWT patterns, refresh flow
115
115
  │ Guidance saved to .swarm/context.md │
116
116
  └─────────────────────────────────────────────────────────────────────────┘
117
117
 
@@ -129,10 +129,10 @@ OpenCode Swarm:
129
129
  ┌─────────────────────────────────────────────────────────────────────────┐
130
130
  │ PHASE 5: Execute (per task) │
131
131
  │ │
132
- │ ┌─────────┐ ┌──────────┐ ┌─────────┐ ┌──────────┐
133
- │ │ @coder │ → │@security │@auditor │ → │ @test │
134
- │ │ 1 task │ │ review │ │ verify │ │ generate │
135
- │ └─────────┘ └──────────┘ └─────────┘ └──────────┘
132
+ │ ┌─────────┐ ┌────────────┐ ┌──────────┐
133
+ │ │ @coder │ → │ @reviewer │ → │ @test │
134
+ │ │ 1 task │ │ check all │ │ generate │
135
+ │ └─────────┘ └────────────┘ └──────────┘
136
136
  │ │ │ │
137
137
  │ └──── If rejected: retry with feedback ────────┘ │
138
138
  │ │
@@ -225,9 +225,9 @@ Swarm lets you mix models strategically:
225
225
  "architect": { "model": "anthropic/claude-sonnet-4-5" },
226
226
  "explorer": { "model": "google/gemini-2.0-flash" },
227
227
  "coder": { "model": "anthropic/claude-sonnet-4-5" },
228
- "_sme": { "model": "google/gemini-2.0-flash" },
229
- "security_reviewer": { "model": "openai/gpt-4o" },
230
- "auditor": { "model": "google/gemini-2.0-flash" }
228
+ "sme": { "model": "google/gemini-2.0-flash" },
229
+ "reviewer": { "model": "openai/gpt-4o" },
230
+ "test_engineer": { "model": "google/gemini-2.0-flash" }
231
231
  }
232
232
  }
233
233
  ```
@@ -237,9 +237,9 @@ Swarm lets you mix models strategically:
237
237
  | Architect | Deep reasoning | Needs to plan complex work |
238
238
  | Explorer | Fast scanning | Speed over depth |
239
239
  | Coder | Implementation | Best coding model you have |
240
- | SMEs | Domain knowledge | Fast recall, not deep reasoning |
241
- | Security Reviewer | Finding flaws | **Different vendor catches different bugs** |
242
- | Auditor | Verification | Independent perspective |
240
+ | SME | Domain knowledge | Fast recall, not deep reasoning |
241
+ | Reviewer | Finding flaws | **Different vendor catches different bugs** |
242
+ | Test Engineer | Test generation | Independent perspective on edge cases |
243
243
 
244
244
  **If Claude writes code and GPT reviews it, GPT catches Claude's blindspots.** This is why real teams have code review.
245
245
 
@@ -262,8 +262,8 @@ Run different model configurations simultaneously. Perfect for:
262
262
  "agents": {
263
263
  "architect": { "model": "anthropic/claude-sonnet-4-5" },
264
264
  "coder": { "model": "anthropic/claude-sonnet-4-5" },
265
- "_sme": { "model": "google/gemini-2.0-flash" },
266
- "_qa": { "model": "openai/gpt-4o" }
265
+ "sme": { "model": "google/gemini-2.0-flash" },
266
+ "reviewer": { "model": "openai/gpt-4o" }
267
267
  }
268
268
  },
269
269
  "local": {
@@ -271,8 +271,8 @@ Run different model configurations simultaneously. Perfect for:
271
271
  "agents": {
272
272
  "architect": { "model": "ollama/qwen2.5:32b" },
273
273
  "coder": { "model": "ollama/qwen2.5:32b" },
274
- "_sme": { "model": "ollama/qwen2.5:14b" },
275
- "_qa": { "model": "ollama/qwen2.5:14b" }
274
+ "sme": { "model": "ollama/qwen2.5:14b" },
275
+ "reviewer": { "model": "ollama/qwen2.5:14b" }
276
276
  }
277
277
  }
278
278
  }
@@ -283,8 +283,8 @@ Run different model configurations simultaneously. Perfect for:
283
283
 
284
284
  | Swarm | Agents |
285
285
  |-------|--------|
286
- | `cloud` (default) | `architect`, `explorer`, `coder`, `sme_*`, etc. |
287
- | `local` | `local_architect`, `local_explorer`, `local_coder`, `local_sme_*`, etc. |
286
+ | `cloud` (default) | `architect`, `explorer`, `coder`, `sme`, `reviewer`, `test_engineer` |
287
+ | `local` | `local_architect`, `local_explorer`, `local_coder`, `local_sme`, `local_reviewer`, `local_test_engineer` |
288
288
 
289
289
  The first swarm (or one named "default") creates unprefixed agents. Additional swarms prefix all agent names.
290
290
 
@@ -324,24 +324,10 @@ bunx opencode-swarm install
324
324
  |-------|------|
325
325
  | `explorer` | Fast codebase scanner. Identifies structure, languages, frameworks, key files. |
326
326
 
327
- ### 🧠 Domain Experts (15 SMEs)
328
- | Agent | Domain |
329
- |-------|--------|
330
- | `sme_web` | Flutter, React, Vue, Angular, JS/TS, HTML/CSS |
331
- | `sme_api` | REST, GraphQL, OAuth, JWT, webhooks |
332
- | `sme_database` | SQL Server, PostgreSQL, MySQL, MongoDB, Redis |
333
- | `sme_devops` | Docker, Kubernetes, CI/CD, Terraform |
334
- | `sme_security` | STIG, hardening, CVE, encryption, PKI |
335
- | `sme_python` | Python ecosystem, libraries, patterns |
336
- | `sme_powershell` | PowerShell scripting, modules, remoting |
337
- | `sme_windows` | Windows internals, registry, services, WMI |
338
- | `sme_linux` | Linux, systemd, package management |
339
- | `sme_network` | TCP/IP, firewalls, DNS, TLS |
340
- | `sme_azure` | Azure services, Entra ID, ARM/Bicep |
341
- | `sme_vmware` | vSphere, ESXi, PowerCLI |
342
- | `sme_oracle` | Oracle Database, SQL/PLSQL |
343
- | `sme_active_directory` | AD, LDAP, Group Policy, Kerberos |
344
- | `sme_ui_ux` | UI/UX design, accessibility |
327
+ ### 🧠 Domain Expert
328
+ | Agent | Role |
329
+ |-------|------|
330
+ | `sme` | Open-domain expert. The architect specifies any domain (security, python, ios, rust, kubernetes, etc.) per call. No hardcoded list — works with any domain the LLM has knowledge of. |
345
331
 
346
332
  ### 💻 Implementation
347
333
  | Agent | Role |
@@ -352,8 +338,7 @@ bunx opencode-swarm install
352
338
  ### ✅ Quality Assurance
353
339
  | Agent | Role |
354
340
  |-------|------|
355
- | `security_reviewer` | Vulnerability assessment per task |
356
- | `auditor` | Correctness verification per task |
341
+ | `reviewer` | Combined correctness + security review. The architect specifies CHECK dimensions (security, correctness, edge-cases, performance, etc.) per call. |
357
342
 
358
343
  ---
359
344
 
@@ -367,31 +352,18 @@ Create `~/.config/opencode/opencode-swarm.json`:
367
352
  "architect": { "model": "anthropic/claude-sonnet-4-5" },
368
353
  "explorer": { "model": "google/gemini-2.0-flash" },
369
354
  "coder": { "model": "anthropic/claude-sonnet-4-5" },
370
- "_sme": { "model": "google/gemini-2.0-flash" },
371
- "_qa": { "model": "google/gemini-2.0-flash" },
355
+ "sme": { "model": "google/gemini-2.0-flash" },
356
+ "reviewer": { "model": "openai/gpt-4o" },
372
357
  "test_engineer": { "model": "google/gemini-2.0-flash" }
373
358
  }
374
359
  }
375
360
  ```
376
361
 
377
- ### Category Defaults
378
-
379
- - `_sme` → All 15 SME agents
380
- - `_qa` → security_reviewer + auditor
381
-
382
- Override specific agents:
383
- ```json
384
- {
385
- "_sme": { "model": "google/gemini-2.0-flash" },
386
- "sme_security": { "model": "anthropic/claude-sonnet-4-5" }
387
- }
388
- ```
389
-
390
- ### Disable Unused Domains
362
+ ### Disable Agents
391
363
  ```json
392
364
  {
393
- "sme_vmware": { "disabled": true },
394
- "sme_oracle": { "disabled": true }
365
+ "sme": { "disabled": true },
366
+ "test_engineer": { "disabled": true }
395
367
  }
396
368
  ```
397
369
 
@@ -404,10 +376,10 @@ Override specific agents:
404
376
  | Execution | Serial (predictable) | Parallel (chaotic) | Parallel | Configurable |
405
377
  | Planning | Phased with acceptance criteria | Ad-hoc | Role-based | Graph-based |
406
378
  | Memory | Persistent `.swarm/` files | Session only | Session only | Checkpoints |
407
- | QA | Per-task (security + audit) | Optional | Optional | Manual |
379
+ | QA | Per-task (unified review) | Optional | Optional | Manual |
408
380
  | Model mixing | Per-agent configuration | Limited | Limited | Manual |
409
381
  | Resume projects | ✅ Native | ❌ | ❌ | Partial |
410
- | SME domains | 15 specialized | Generic | Generic | Generic |
382
+ | SME domains | Open-domain (any) | Generic | Generic | Generic |
411
383
  | Task granularity | One at a time | Batched | Batched | Varies |
412
384
 
413
385
  ---
@@ -416,13 +388,13 @@ Override specific agents:
416
388
 
417
389
  1. **Plan before code** - Documented phases with acceptance criteria
418
390
  2. **One task at a time** - Focused work, quality output
419
- 3. **QA everything immediately** - Security + audit per task, not per project
391
+ 3. **Review everything immediately** - Correctness + security review per task, not per project
420
392
  4. **Cache SME knowledge** - Don't re-ask answered questions
421
393
  5. **Persistent memory** - `.swarm/` files survive sessions
422
394
  6. **Serial execution** - Predictable, debuggable, no race conditions
423
395
  7. **Heterogeneous models** - Different perspectives catch different bugs
424
396
  8. **User checkpoints** - Confirm before proceeding to next phase
425
- 9. **Failure tracking** - Document rejections, escalate after 3 attempts
397
+ 9. **Failure tracking** - Document rejections, escalate after 5 attempts
426
398
  10. **Resumable by design** - Any Architect can pick up any project
427
399
 
428
400
  ---
@@ -13,7 +13,6 @@ export declare function getAgentConfigs(config?: PluginConfig): Record<string, S
13
13
  export { createArchitectAgent } from './architect';
14
14
  export { createCoderAgent } from './coder';
15
15
  export { createExplorerAgent } from './explorer';
16
- export { createSecurityReviewerAgent } from './security-reviewer';
17
- export { createAuditorAgent } from './auditor';
16
+ export { createReviewerAgent } from './reviewer';
18
17
  export { createTestEngineerAgent } from './test-engineer';
19
- export { createAllSMEAgents, createSMEAgent, listDomains } from './sme';
18
+ export { createSMEAgent } from './sme';
@@ -0,0 +1,2 @@
1
+ import type { AgentDefinition } from './architect';
2
+ export declare function createReviewerAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
@@ -0,0 +1,2 @@
1
+ import type { AgentDefinition } from './architect';
2
+ export declare function createSMEAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
package/dist/cli/index.js CHANGED
@@ -24,7 +24,7 @@ function loadJson(filepath) {
24
24
  }
25
25
  }
26
26
  function saveJson(filepath, data) {
27
- fs.writeFileSync(filepath, JSON.stringify(data, null, 2) + `
27
+ fs.writeFileSync(filepath, `${JSON.stringify(data, null, 2)}
28
28
  `, "utf-8");
29
29
  }
30
30
  async function install() {
@@ -57,21 +57,20 @@ async function install() {
57
57
  remote: {
58
58
  architect: { model: "anthropic/claude-sonnet-4.5" },
59
59
  coder: { model: "openai/gpt-5.2-codex" },
60
- _sme: { model: "google/gemini-3-flash" },
61
- _qa: { model: "google/gemini-3-flash" },
60
+ sme: { model: "google/gemini-3-flash" },
61
+ reviewer: { model: "google/gemini-3-flash" },
62
62
  test_engineer: { model: "google/gemini-3-flash" }
63
63
  },
64
64
  hybrid: {
65
65
  architect: { model: "anthropic/claude-sonnet-4.5" },
66
66
  coder: { model: "ollama/qwen3:72b" },
67
- _sme: { model: "npu/qwen3:14b" },
68
- _qa: { model: "npu/qwen3:14b" },
67
+ sme: { model: "npu/qwen3:14b" },
68
+ reviewer: { model: "npu/qwen3:14b" },
69
69
  test_engineer: { model: "npu/qwen3:14b" }
70
70
  }
71
71
  },
72
72
  swarm_mode: "remote",
73
73
  max_iterations: 5,
74
- auto_detect_domains: true,
75
74
  inject_phase_reminders: true
76
75
  };
77
76
  saveJson(PLUGIN_CONFIG_PATH, defaultConfig);
@@ -92,9 +91,9 @@ Next steps:`);
92
91
  console.log('2. Run "opencode" to start using the swarm');
93
92
  console.log("3. The Architect agent will orchestrate your requests");
94
93
  console.log(`
95
- \uD83D\uDCD6 Available SME domains:`);
96
- console.log(` windows, powershell, python, oracle, network, security,
97
- ` + " linux, vmware, azure, active_directory, ui_ux");
94
+ \uD83D\uDCD6 SME agent:`);
95
+ console.log(" The SME agent supports any domain \u2014 the Architect determines");
96
+ console.log(" what expertise is needed and requests it dynamically.");
98
97
  return 0;
99
98
  }
100
99
  function printHelp() {
@@ -1,20 +1,11 @@
1
- export declare const SME_AGENTS: readonly ["sme_windows", "sme_powershell", "sme_python", "sme_oracle", "sme_network", "sme_security", "sme_linux", "sme_vmware", "sme_azure", "sme_active_directory", "sme_ui_ux", "sme_web", "sme_database", "sme_devops", "sme_api", "sme_ai"];
2
- export declare const QA_AGENTS: readonly ["security_reviewer", "auditor"];
1
+ export declare const QA_AGENTS: readonly ["reviewer"];
3
2
  export declare const PIPELINE_AGENTS: readonly ["explorer", "coder", "test_engineer"];
4
3
  export declare const ORCHESTRATOR_NAME: "architect";
5
- export declare const ALL_SUBAGENT_NAMES: readonly ["sme_windows", "sme_powershell", "sme_python", "sme_oracle", "sme_network", "sme_security", "sme_linux", "sme_vmware", "sme_azure", "sme_active_directory", "sme_ui_ux", "sme_web", "sme_database", "sme_devops", "sme_api", "sme_ai", "security_reviewer", "auditor", "explorer", "coder", "test_engineer"];
6
- export declare const ALL_AGENT_NAMES: readonly ["architect", "sme_windows", "sme_powershell", "sme_python", "sme_oracle", "sme_network", "sme_security", "sme_linux", "sme_vmware", "sme_azure", "sme_active_directory", "sme_ui_ux", "sme_web", "sme_database", "sme_devops", "sme_api", "sme_ai", "security_reviewer", "auditor", "explorer", "coder", "test_engineer"];
7
- export type SMEAgentName = (typeof SME_AGENTS)[number];
4
+ export declare const ALL_SUBAGENT_NAMES: readonly ["sme", "reviewer", "explorer", "coder", "test_engineer"];
5
+ export declare const ALL_AGENT_NAMES: readonly ["architect", "sme", "reviewer", "explorer", "coder", "test_engineer"];
8
6
  export type QAAgentName = (typeof QA_AGENTS)[number];
9
7
  export type PipelineAgentName = (typeof PIPELINE_AGENTS)[number];
10
8
  export type AgentName = (typeof ALL_AGENT_NAMES)[number];
11
- export declare const CATEGORY_PREFIXES: {
12
- readonly sme: "_sme";
13
- readonly qa: "_qa";
14
- };
15
9
  export declare const DEFAULT_MODELS: Record<string, string>;
16
- export declare const DOMAIN_PATTERNS: Record<string, RegExp[]>;
17
- export declare function domainToAgentName(domain: string): SMEAgentName;
18
- export declare function isSMEAgent(name: string): name is SMEAgentName;
19
10
  export declare function isQAAgent(name: string): name is QAAgentName;
20
11
  export declare function isSubagent(name: string): boolean;
@@ -1,5 +1,5 @@
1
- export { ALL_AGENT_NAMES, ALL_SUBAGENT_NAMES, CATEGORY_PREFIXES, DEFAULT_MODELS, DOMAIN_PATTERNS, ORCHESTRATOR_NAME, PIPELINE_AGENTS, QA_AGENTS, SME_AGENTS, domainToAgentName, isQAAgent, isSMEAgent, isSubagent, } from './constants';
2
- export type { AgentName, PipelineAgentName, QAAgentName, SMEAgentName, } from './constants';
1
+ export { ALL_AGENT_NAMES, ALL_SUBAGENT_NAMES, DEFAULT_MODELS, ORCHESTRATOR_NAME, PIPELINE_AGENTS, QA_AGENTS, isQAAgent, isSubagent, } from './constants';
2
+ export type { AgentName, PipelineAgentName, QAAgentName, } from './constants';
3
3
  export { AgentOverrideConfigSchema, PluginConfigSchema, SwarmConfigSchema, } from './schema';
4
4
  export type { AgentOverrideConfig, PluginConfig, SwarmConfig, } from './schema';
5
5
  export { loadAgentPrompt, loadPluginConfig, } from './loader';
@@ -30,9 +30,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
30
30
  }, z.core.$strip>>>;
31
31
  max_iterations: z.ZodDefault<z.ZodNumber>;
32
32
  qa_retry_limit: z.ZodDefault<z.ZodNumber>;
33
- multi_domain_sme: z.ZodDefault<z.ZodBoolean>;
34
- auto_detect_domains: z.ZodDefault<z.ZodBoolean>;
35
33
  inject_phase_reminders: z.ZodDefault<z.ZodBoolean>;
36
34
  }, z.core.$strip>;
37
35
  export type PluginConfig = z.infer<typeof PluginConfigSchema>;
38
- export type { AgentName, SMEAgentName, QAAgentName, PipelineAgentName, } from './constants';
36
+ export type { AgentName, QAAgentName, PipelineAgentName, } from './constants';
package/dist/index.d.ts CHANGED
@@ -11,5 +11,5 @@ import type { Plugin } from '@opencode-ai/plugin';
11
11
  */
12
12
  declare const OpenCodeSwarm: Plugin;
13
13
  export default OpenCodeSwarm;
14
- export type { AgentName, PluginConfig, SMEAgentName, QAAgentName, PipelineAgentName, } from './config';
14
+ export type { AgentName, PluginConfig, QAAgentName, PipelineAgentName, } from './config';
15
15
  export type { AgentDefinition } from './agents';