opencode-swarm 2.1.2 → 2.2.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/README.md CHANGED
@@ -2,78 +2,308 @@
2
2
 
3
3
  ![License](https://img.shields.io/badge/license-MIT-blue)
4
4
  ![OpenCode Plugin](https://img.shields.io/badge/opencode-plugin-green)
5
- ![Agentic Architecture](https://img.shields.io/badge/architecture-architect--centric-purple)
5
+ ![Architecture](https://img.shields.io/badge/architecture-architect--centric-purple)
6
+ ![Version](https://img.shields.io/badge/version-2.2.1-orange)
6
7
 
7
- **Architect-driven, multi-agent development for OpenCode.**
8
- Design-first orchestration with domain-aware SMEs, heterogeneous model perspectives, production-grade code generation, and layered QA.
8
+ **Architect-driven, multi-agent development for OpenCode.**
9
9
 
10
- OpenCode Swarm is built for engineers who want **structured reasoning, controlled delegation, and predictable outcomes**—not parallel agent noise.
10
+ Design-first orchestration with codebase discovery, domain-aware SMEs, heterogeneous model perspectives, and layered QA review.
11
11
 
12
- ---
12
+ ```
13
+ ┌──────────────────────────────────────────────────────────────────────────┐
14
+ │ "Review this PowerShell application for security issues" │
15
+ └──────────────────────────────────────────────────────────────────────────┘
16
+
17
+
18
+ ┌──────────────────────────────────────────────────────────────────────────┐
19
+ │ ARCHITECT: Delegating to @explorer for codebase analysis... │
20
+ └──────────────────────────────────────────────────────────────────────────┘
21
+
22
+
23
+ ┌──────────────────────────────────────────────────────────────────────────┐
24
+ │ EXPLORER: PowerShell module, 12 files, domains: powershell, security │
25
+ │ → Flagged: auth.ps1, invoke-command.ps1 for SME review │
26
+ └──────────────────────────────────────────────────────────────────────────┘
27
+
28
+
29
+ ┌──────────────────────────────────────────────────────────────────────────┐
30
+ │ SME_POWERSHELL: Remoting patterns detected, needs constrained endpoints │
31
+ │ SME_SECURITY: Credential handling issues in auth.ps1:42-58 │
32
+ └──────────────────────────────────────────────────────────────────────────┘
33
+
34
+
35
+ ┌──────────────────────────────────────────────────────────────────────────┐
36
+ │ ARCHITECT: Collated review with 3 HIGH findings, 2 recommendations │
37
+ └──────────────────────────────────────────────────────────────────────────┘
38
+ ```
13
39
 
14
- ## Why OpenCode Swarm
40
+ ---
15
41
 
16
- Most agent frameworks parallelize everything and hope coherence emerges later.
17
- OpenCode Swarm enforces discipline:
42
+ ## Why OpenCode Swarm?
18
43
 
19
- - A single Architect owns analysis and decisions
20
- - Experts are consulted only when technically relevant
21
- - Agents execute serially for traceability
22
- - Security and correctness are validated before delivery
23
- - Different models can be assigned per role, introducing genuinely distinct perspectives
44
+ Most agent frameworks parallelize everything and hope coherence emerges.
45
+ **OpenCode Swarm enforces discipline:**
24
46
 
25
- This design improves **accuracy, efficiency, and failure detection**, especially on complex or high-stakes tasks.
47
+ | Problem | Our Solution |
48
+ |---------|--------------|
49
+ | Agents read the same files repeatedly | Explorer scans once, shares context |
50
+ | All 11 SMEs consulted for every task | Only relevant domains (1-3) based on Explorer findings |
51
+ | Single model = correlated failures | Different models per role = diverse perspectives |
52
+ | No visibility into agent decisions | Serial execution with clear delegation traces |
53
+ | Code ships without review | Mandatory Security → Audit → Test pipeline |
26
54
 
27
55
  ---
28
56
 
29
- ## Key Advantage: Heterogeneous Model Perspectives
30
-
31
- OpenCode Swarm allows **per-role model selection** so that each cognitive function is optimized independently:
57
+ ## Architecture
32
58
 
33
- - Architect → deep reasoning and synthesis
34
- - SMEs → domain recall and speed
35
- - Coder → implementation fidelity
36
- - QA → adversarial review and audit rigor
59
+ ```
60
+ User Request
61
+
62
+
63
+ ┌─────────────┐
64
+ │ ARCHITECT │ ◄── Orchestrates everything, owns all decisions
65
+ └─────────────┘
66
+
67
+
68
+ ┌─────────────┐
69
+ │ EXPLORER │ ◄── Fast codebase discovery (read-only)
70
+ └─────────────┘ Returns: structure, languages, domains, flagged files
71
+
72
+
73
+ ┌─────────────┐
74
+ │ SMEs │ ◄── Domain experts consulted serially (read-only)
75
+ └─────────────┘ Only domains identified by Explorer
76
+
77
+
78
+ ┌─────────────┐
79
+ │ CODER │ ◄── Implements unified specification
80
+ └─────────────┘
81
+
82
+
83
+ ┌─────────────┐ ┌─────────────┐
84
+ │ SECURITY │ ──► │ AUDITOR │ ◄── QA review (read-only)
85
+ └─────────────┘ └─────────────┘
86
+
87
+
88
+ ┌─────────────┐
89
+ │ TEST │ ◄── Generates tests for approved code
90
+ └─────────────┘
91
+ ```
37
92
 
38
- Using different models per role reduces correlated failure modes, increases early error detection, and mirrors how real engineering teams benefit from diverse expertise.
93
+ ### Agent Permissions
39
94
 
40
- See: [docs/design-rationale.md](docs/design-rationale.md)
95
+ | Agent | Read | Write | Role |
96
+ |-------|:----:|:-----:|------|
97
+ | Architect | ✅ | ✅ | Orchestrator - can fall back if delegation fails |
98
+ | Explorer | ✅ | ❌ | Discovery - scans, summarizes, identifies domains |
99
+ | SMEs (×11) | ✅ | ❌ | Advisory - domain expertise, never implements |
100
+ | Coder | ✅ | ✅ | Implementation - writes production code |
101
+ | Security Reviewer | ✅ | ❌ | Audit - vulnerability assessment |
102
+ | Auditor | ✅ | ❌ | Audit - correctness verification |
103
+ | Test Engineer | ✅ | ✅ | Testing - generates test cases |
41
104
 
42
105
  ---
43
106
 
44
- ## Architecture Overview
107
+ ## Heterogeneous Model Perspectives
45
108
 
46
- OpenCode Swarm implements a hub-and-spoke pipeline with a single controlling Architect.
109
+ OpenCode Swarm allows **different models per role**, reducing correlated failures:
47
110
 
48
- ```
49
- User → Architect (analysis)
50
- Reader (optional)
51
- Relevant SMEs (serial)
52
- Architect (spec synthesis)
53
- Coder
54
- Security Review Audit
55
- Architect (triage)
56
- Test Engineer
111
+ ```json
112
+ {
113
+ "agents": {
114
+ "architect": { "model": "anthropic/claude-sonnet-4-5" },
115
+ "explorer": { "model": "google/gemini-2.0-flash" },
116
+ "coder": { "model": "anthropic/claude-sonnet-4-5" },
117
+ "_sme": { "model": "google/gemini-2.0-flash" },
118
+ "_qa": { "model": "openai/gpt-4o" },
119
+ "test_engineer": { "model": "google/gemini-2.0-flash" }
120
+ }
121
+ }
57
122
  ```
58
123
 
59
- See: [docs/architecture.md](docs/architecture.md)
124
+ **Why this matters:**
125
+ - Reasoning-heavy model for Architect decisions
126
+ - Fast/cheap model for Explorer and SME consultation
127
+ - Different model family for QA catches errors the others miss
128
+ - Mix local (Ollama) and cloud models based on cost/capability
60
129
 
61
130
  ---
62
131
 
63
132
  ## Installation
64
133
 
134
+ Add to your `opencode.json`:
135
+
65
136
  ```json
66
137
  {
67
138
  "plugin": ["opencode-swarm"]
68
139
  }
69
140
  ```
70
141
 
142
+ Or install via CLI:
143
+
71
144
  ```bash
72
145
  bunx opencode-swarm install
73
146
  ```
74
147
 
75
148
  ---
76
149
 
150
+ ## Configuration
151
+
152
+ Create `~/.config/opencode/opencode-swarm.json`:
153
+
154
+ ```json
155
+ {
156
+ "agents": {
157
+ "architect": { "model": "anthropic/claude-sonnet-4-5" },
158
+ "explorer": { "model": "google/gemini-2.0-flash" },
159
+ "coder": { "model": "anthropic/claude-sonnet-4-5" },
160
+ "_sme": { "model": "google/gemini-2.0-flash" },
161
+ "_qa": { "model": "google/gemini-2.0-flash" },
162
+ "test_engineer": { "model": "google/gemini-2.0-flash" }
163
+ }
164
+ }
165
+ ```
166
+
167
+ ### Category Defaults
168
+
169
+ `_sme` and `_qa` set defaults for all agents in that category:
170
+
171
+ ```json
172
+ {
173
+ "agents": {
174
+ "_sme": { "model": "google/gemini-2.0-flash" },
175
+ "sme_oracle": { "model": "anthropic/claude-sonnet-4-5" }
176
+ }
177
+ }
178
+ ```
179
+
180
+ ### Disable Unused Domains
181
+
182
+ ```json
183
+ {
184
+ "agents": {
185
+ "sme_vmware": { "disabled": true },
186
+ "sme_azure": { "disabled": true }
187
+ }
188
+ }
189
+ ```
190
+
191
+ ### Custom Prompts
192
+
193
+ Place in `~/.config/opencode/opencode-swarm/`:
194
+ - `{agent}.md` - Replace default prompt
195
+ - `{agent}_append.md` - Append to default prompt
196
+
197
+ ---
198
+
199
+ ## Agents
200
+
201
+ ### Orchestrator
202
+ | Agent | Description |
203
+ |-------|-------------|
204
+ | `architect` | Central orchestrator. Analyzes requests, delegates to specialists, synthesizes outputs, triages QA feedback. |
205
+
206
+ ### Discovery
207
+ | Agent | Description |
208
+ |-------|-------------|
209
+ | `explorer` | Fast codebase scanner. Identifies structure, languages, frameworks, and flags files for SME review. |
210
+
211
+ ### Domain Experts (SMEs)
212
+ | Agent | Domain |
213
+ |-------|--------|
214
+ | `sme_windows` | Windows internals, registry, services, WMI/CIM |
215
+ | `sme_powershell` | PowerShell scripting, cmdlets, modules, remoting |
216
+ | `sme_python` | Python ecosystem, libraries, packaging |
217
+ | `sme_oracle` | Oracle Database, SQL/PLSQL, administration |
218
+ | `sme_network` | TCP/IP, firewalls, DNS, TLS, load balancing |
219
+ | `sme_security` | STIG compliance, hardening, CVEs, PKI |
220
+ | `sme_linux` | Linux administration, systemd, package management |
221
+ | `sme_vmware` | vSphere, ESXi, PowerCLI, virtualization |
222
+ | `sme_azure` | Azure services, Entra ID, ARM/Bicep |
223
+ | `sme_active_directory` | AD, LDAP, Group Policy, Kerberos |
224
+ | `sme_ui_ux` | UI/UX design, accessibility, interaction patterns |
225
+
226
+ ### Implementation
227
+ | Agent | Description |
228
+ |-------|-------------|
229
+ | `coder` | Writes production code from unified specifications |
230
+ | `test_engineer` | Generates test cases and validation scripts |
231
+
232
+ ### Quality Assurance
233
+ | Agent | Description |
234
+ |-------|-------------|
235
+ | `security_reviewer` | Vulnerability assessment, injection risks, data exposure |
236
+ | `auditor` | Correctness verification, logic errors, edge cases |
237
+
238
+ ---
239
+
240
+ ## Tools
241
+
242
+ | Tool | Description |
243
+ |------|-------------|
244
+ | `gitingest` | Fetch GitHub repository contents for analysis |
245
+ | `detect_domains` | Auto-detect relevant SME domains from text |
246
+ | `extract_code_blocks` | Extract code blocks to files |
247
+
248
+ ### gitingest Example
249
+
250
+ ```
251
+ "Analyze the architecture of https://github.com/user/repo"
252
+ "Use gitingest to fetch https://github.com/user/repo with pattern *.py include"
253
+ ```
254
+
255
+ ---
256
+
257
+ ## Workflow Examples
258
+
259
+ ### Code Review
260
+ ```
261
+ User: "Review this codebase for issues"
262
+ → Explorer scans, identifies: TypeScript, React, needs sme_security
263
+ → SME_Security reviews flagged files
264
+ → Architect collates findings into review report
265
+ ```
266
+
267
+ ### Implementation
268
+ ```
269
+ User: "Add authentication to this API"
270
+ → Explorer scans existing code
271
+ → SME_Security + SME_Network consulted
272
+ → Coder implements spec
273
+ → Security_Reviewer → Auditor validates
274
+ → Test_Engineer generates tests
275
+ ```
276
+
277
+ ### Bug Fix
278
+ ```
279
+ User: "Fix the null reference in user.ts:42"
280
+ → Explorer locates context
281
+ → Relevant SME consulted
282
+ → Coder implements fix
283
+ → QA validates
284
+ ```
285
+
286
+ ---
287
+
288
+ ## Design Philosophy
289
+
290
+ 1. **Single point of control** - Architect owns all decisions
291
+ 2. **Discovery before action** - Explorer maps the terrain first
292
+ 3. **Selective expertise** - Only relevant SMEs consulted
293
+ 4. **Serial execution** - Traceable, debuggable, predictable
294
+ 5. **Mandatory QA** - No code ships without security + audit review
295
+ 6. **Fail-safe orchestration** - Architect can handle tasks itself if agents fail
296
+
297
+ ---
298
+
299
+ ## Documentation
300
+
301
+ - [Architecture Details](docs/architecture.md)
302
+ - [Design Rationale](docs/design-rationale.md)
303
+ - [Installation Guide](docs/installation.md)
304
+
305
+ ---
306
+
77
307
  ## License
78
308
 
79
309
  MIT
@@ -0,0 +1,2 @@
1
+ import type { AgentDefinition } from './architect';
2
+ export declare function createExplorerAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
@@ -13,7 +13,7 @@ export declare function createAgents(config?: PluginConfig): AgentDefinition[];
13
13
  export declare function getAgentConfigs(config?: PluginConfig): Record<string, SDKAgentConfig>;
14
14
  export { createArchitectAgent } from './architect';
15
15
  export { createCoderAgent } from './coder';
16
- export { createReaderAgent } from './reader';
16
+ export { createExplorerAgent } from './explorer';
17
17
  export { createSecurityReviewerAgent } from './security-reviewer';
18
18
  export { createAuditorAgent } from './auditor';
19
19
  export { createTestEngineerAgent } from './test-engineer';
@@ -1,9 +1,9 @@
1
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"];
2
2
  export declare const QA_AGENTS: readonly ["security_reviewer", "auditor"];
3
- export declare const PIPELINE_AGENTS: readonly ["reader", "coder", "test_engineer"];
3
+ export declare const PIPELINE_AGENTS: readonly ["explorer", "coder", "test_engineer"];
4
4
  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", "security_reviewer", "auditor", "reader", "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", "security_reviewer", "auditor", "reader", "coder", "test_engineer"];
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", "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", "security_reviewer", "auditor", "explorer", "coder", "test_engineer"];
7
7
  export type SMEAgentName = (typeof SME_AGENTS)[number];
8
8
  export type QAAgentName = (typeof QA_AGENTS)[number];
9
9
  export type PipelineAgentName = (typeof PIPELINE_AGENTS)[number];
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ var SME_AGENTS = [
25
25
  "sme_ui_ux"
26
26
  ];
27
27
  var QA_AGENTS = ["security_reviewer", "auditor"];
28
- var PIPELINE_AGENTS = ["reader", "coder", "test_engineer"];
28
+ var PIPELINE_AGENTS = ["explorer", "coder", "test_engineer"];
29
29
  var ORCHESTRATOR_NAME = "architect";
30
30
  var ALL_SUBAGENT_NAMES = [
31
31
  ...SME_AGENTS,
@@ -42,7 +42,7 @@ var CATEGORY_PREFIXES = {
42
42
  };
43
43
  var DEFAULT_MODELS = {
44
44
  architect: "anthropic/claude-sonnet-4-5",
45
- reader: "google/gemini-2.0-flash",
45
+ explorer: "google/gemini-2.0-flash",
46
46
  coder: "anthropic/claude-sonnet-4-5",
47
47
  test_engineer: "google/gemini-2.0-flash",
48
48
  _sme: "google/gemini-2.0-flash",
@@ -13844,11 +13844,11 @@ function loadAgentPrompt(agentName) {
13844
13844
  // src/agents/architect.ts
13845
13845
  var ARCHITECT_PROMPT = `You are Architect - an AI coding orchestrator that coordinates specialists to deliver quality code.
13846
13846
 
13847
- **Role**: Analyze requests, consult domain SMEs, delegate implementation, and manage QA review.
13847
+ **Role**: Analyze requests, delegate discovery to Explorer, consult domain SMEs, delegate implementation, and manage QA review.
13848
13848
 
13849
13849
  **Agents**:
13850
13850
 
13851
- @reader - Fast data processing agent for analyzing large files, codebases, or outputs
13851
+ @explorer - Fast codebase discovery and summarization (ALWAYS FIRST for code tasks)
13852
13852
  @sme_windows - Windows OS internals, registry, services, WMI/CIM
13853
13853
  @sme_powershell - PowerShell scripting, cmdlets, modules, remoting
13854
13854
  @sme_python - Python ecosystem, libraries, best practices
@@ -13866,35 +13866,38 @@ var ARCHITECT_PROMPT = `You are Architect - an AI coding orchestrator that coord
13866
13866
  @auditor - Code quality review, correctness verification
13867
13867
  @test_engineer - Test case generation and validation scripts
13868
13868
 
13869
- **CRITICAL: @reader MUST be your FIRST delegation for code reviews**
13870
- When asked to review, analyze, or examine any codebase:
13871
- 1. IMMEDIATELY delegate to @reader - do not read the code yourself
13872
- 2. Wait for @reader's summary
13873
- 3. Use that summary to decide which SMEs to consult
13874
- 4. Never skip @reader for code review tasks
13869
+ **WORKFLOW**:
13875
13870
 
13876
- **Workflow**:
13871
+ ## 1. Parse Request (you do this briefly)
13872
+ Understand what the user wants. Determine task type:
13873
+ - Code review/analysis \u2192 Explorer + SMEs + Collate
13874
+ - New implementation \u2192 Explorer + SMEs + Coder + QA + Test
13875
+ - Bug fix \u2192 Explorer + SMEs + Coder + QA
13876
+ - Question about codebase \u2192 Explorer + answer
13877
13877
 
13878
- ## 1. Analyze Request (you do this briefly)
13879
- Parse what user wants. If it involves reviewing code \u2192 go directly to step 2.
13878
+ ## 2. Explorer FIRST (delegate immediately for any code task)
13879
+ "Delegating to @explorer for codebase analysis..."
13880
+ @explorer scans the codebase and returns:
13881
+ - Project summary (languages, frameworks, structure)
13882
+ - Key files identified
13883
+ - Relevant domains for SME consultation
13884
+ - Files flagged for deeper review
13880
13885
 
13881
- ## 2. Reader FIRST (for any code review/analysis)
13882
- "Delegating to @reader for codebase analysis..."
13883
- - Send the codebase/files to @reader
13884
- - Wait for summary response
13885
- - Use summary to identify domains and issues
13886
-
13887
- ## 3. SME Consultation (based on @reader's findings)
13888
- Consult only SMEs for domains identified from @reader's summary.
13889
- Usually 1-3 SMEs, not all 11. Wait for each response.
13886
+ ## 3. SME Consultation (based on @explorer findings)
13887
+ From @explorer's "Relevant Domains" list, delegate to appropriate SMEs:
13888
+ - Usually 1-3 SMEs, not all 11
13889
+ - Serial execution (one at a time)
13890
+ - SMEs review the files flagged by @explorer
13890
13891
 
13891
13892
  ## 4. Collate (you do this)
13892
- Combine @reader summary + SME inputs into final review or specification.
13893
+ Synthesize @explorer summary + SME inputs into:
13894
+ - For reviews: final findings report
13895
+ - For implementation: unified specification for @coder
13893
13896
 
13894
- ## 5. Code (delegate to @coder) - only if writing new code
13895
- Send specification to @coder. Wait for implementation.
13897
+ ## 5. Code (delegate to @coder) - if implementation needed
13898
+ Send specification to @coder with file paths from @explorer.
13896
13899
 
13897
- ## 6. QA Review (delegate serially) - only if code was written
13900
+ ## 6. QA Review (delegate serially) - if code was written
13898
13901
  @security_reviewer first, then @auditor.
13899
13902
 
13900
13903
  ## 7. Triage (you do this)
@@ -13902,22 +13905,18 @@ APPROVED \u2192 @test_engineer | REVISION_NEEDED \u2192 @coder | BLOCKED \u2192
13902
13905
 
13903
13906
  ## 8. Test (delegate to @test_engineer) - if approved
13904
13907
 
13905
- **Order of Operations for Code Review**:
13906
- 1. @reader (ALWAYS FIRST - analyzes codebase)
13907
- 2. @sme_* (only relevant domains based on @reader findings)
13908
- 3. Collate findings into review
13909
-
13910
- **Order of Operations for New Code**:
13911
- 1. @reader (if analyzing existing code first)
13912
- 2. @sme_* (relevant domains)
13913
- 3. @coder (implementation)
13914
- 4. @security_reviewer \u2192 @auditor (QA)
13915
- 5. @test_engineer (tests)
13908
+ **DELEGATION RULES**:
13909
+ - @explorer is ALWAYS your first delegation for tasks involving code
13910
+ - Wait for each agent response before calling the next
13911
+ - Only consult SMEs for domains identified by @explorer
13912
+ - Brief notices: "Delegating to @explorer..." not lengthy explanations
13913
+ - If an agent fails or gives poor output, you can handle it yourself
13916
13914
 
13917
- **Communication**:
13918
- - Be direct, no preamble
13919
- - Don't ask for confirmation between phases
13920
- - You analyze, collate, and triage. You never write code yourself.`;
13915
+ **COMMUNICATION**:
13916
+ - Be direct, no preamble or flattery
13917
+ - Don't ask for confirmation between phases - proceed automatically
13918
+ - If request is vague, ask ONE targeted question before starting
13919
+ - You orchestrate and synthesize. Prefer delegation over doing it yourself.`;
13921
13920
  function createArchitectAgent(model, customPrompt, customAppendPrompt) {
13922
13921
  let prompt = ARCHITECT_PROMPT;
13923
13922
  if (customPrompt) {
@@ -13999,7 +13998,12 @@ ${customAppendPrompt}`;
13999
13998
  config: {
14000
13999
  model,
14001
14000
  temperature: 0.1,
14002
- prompt
14001
+ prompt,
14002
+ tools: {
14003
+ write: false,
14004
+ edit: false,
14005
+ patch: false
14006
+ }
14003
14007
  }
14004
14008
  };
14005
14009
  }
@@ -14050,63 +14054,85 @@ ${customAppendPrompt}`;
14050
14054
  };
14051
14055
  }
14052
14056
 
14053
- // src/agents/reader.ts
14054
- var READER_PROMPT = `You are Reader - a fast data processing specialist.
14057
+ // src/agents/explorer.ts
14058
+ var EXPLORER_PROMPT = `You are Explorer - a fast codebase discovery and analysis specialist.
14055
14059
 
14056
- **Role**: Quickly analyze large datasets, codebases, or outputs and provide concise summaries for the Architect.
14060
+ **Role**: Quickly scan and summarize codebases so the Architect can make informed decisions. You are ALWAYS the first agent called for any task involving existing code.
14057
14061
 
14058
- **Behavior**:
14059
- - Read and process the provided content efficiently
14060
- - Extract key information relevant to the task
14061
- - Summarize findings in a structured, actionable format
14062
- - Focus on what matters for implementation decisions
14062
+ **Capabilities**:
14063
+ - Scan directory structure (glob, ls, tree)
14064
+ - Read and summarize key files (README, configs, entry points)
14065
+ - Identify languages, frameworks, patterns
14066
+ - Search for specific patterns (grep)
14067
+ - Provide file paths for deeper analysis
14063
14068
 
14064
- **Use cases**:
14065
- - Analyzing gitingest output to understand a codebase
14066
- - Reviewing large log files or data dumps
14067
- - Summarizing documentation or specifications
14068
- - Processing API responses or test results
14069
+ **Behavior**:
14070
+ - Be fast - scan broadly, read selectively
14071
+ - Focus on understanding structure before diving into details
14072
+ - Identify which technical domains are relevant (powershell, python, security, etc.)
14073
+ - Flag files that need deeper SME review
14069
14074
 
14070
14075
  **Output Format**:
14071
- <summary>
14072
- [2-3 sentence overview of what you analyzed]
14073
- </summary>
14074
14076
 
14075
- <key_findings>
14076
- - [Finding 1: specific, actionable]
14077
- - [Finding 2: specific, actionable]
14078
- - [Finding 3: specific, actionable]
14079
- </key_findings>
14077
+ <codebase_summary>
14078
+ **Project**: [name/type - e.g., "PowerShell module for AD management"]
14079
+ **Languages**: [primary languages detected]
14080
+ **Framework/Stack**: [if applicable]
14081
+
14082
+ **Structure**:
14083
+ \`\`\`
14084
+ [brief directory tree of key folders]
14085
+ \`\`\`
14086
+
14087
+ **Key Files**:
14088
+ - \`/path/to/entry.ps1\` - Main entry point, [brief description]
14089
+ - \`/path/to/config.json\` - Configuration, [what it configures]
14090
+
14091
+ **Architecture**:
14092
+ [2-3 sentences on how the code is organized]
14093
+
14094
+ **Patterns Observed**:
14095
+ - [coding patterns, conventions, potential issues]
14080
14096
 
14081
- <relevant_details>
14082
- [Specific code patterns, file paths, function names, or data points the Architect needs]
14083
- </relevant_details>
14097
+ **Relevant Domains**: [comma-separated: powershell, security, windows, etc.]
14098
+ </codebase_summary>
14084
14099
 
14085
- <recommendations>
14086
- [Brief suggestions based on your analysis]
14087
- </recommendations>
14100
+ <files_for_review>
14101
+ [List specific files that need deeper analysis, with brief reason]
14102
+ - \`/path/to/file1.ps1\` - Complex logic, needs @sme_powershell review
14103
+ - \`/path/to/auth.ps1\` - Security-sensitive, needs @sme_security review
14104
+ </files_for_review>
14105
+
14106
+ <initial_observations>
14107
+ [Any immediate concerns, questions, or notable findings]
14108
+ </initial_observations>
14088
14109
 
14089
14110
  **Constraints**:
14090
- - No code writing
14091
- - No delegation
14092
- - Focus on speed and accuracy
14093
- - Keep total output under 2000 characters`;
14094
- function createReaderAgent(model, customPrompt, customAppendPrompt) {
14095
- let prompt = READER_PROMPT;
14111
+ - Keep total output under 4000 characters
14112
+ - No code writing or modification
14113
+ - No delegation to other agents
14114
+ - Focus on discovery, not implementation`;
14115
+ function createExplorerAgent(model, customPrompt, customAppendPrompt) {
14116
+ let prompt = EXPLORER_PROMPT;
14096
14117
  if (customPrompt) {
14097
14118
  prompt = customPrompt;
14098
14119
  } else if (customAppendPrompt) {
14099
- prompt = `${READER_PROMPT}
14120
+ prompt = `${EXPLORER_PROMPT}
14100
14121
 
14101
14122
  ${customAppendPrompt}`;
14102
14123
  }
14103
14124
  return {
14104
- name: "reader",
14105
- description: "Fast data processing agent for analyzing large files, codebases, or outputs. Returns concise summaries.",
14125
+ name: "explorer",
14126
+ description: "Fast codebase discovery and analysis. Scans directory structure, identifies languages/frameworks, summarizes key files, and flags areas needing SME review.",
14106
14127
  config: {
14107
14128
  model,
14108
14129
  temperature: 0.1,
14109
- prompt
14130
+ prompt,
14131
+ tools: {
14132
+ write: false,
14133
+ edit: false,
14134
+ patch: false
14135
+ }
14110
14136
  }
14111
14137
  };
14112
14138
  }
@@ -14163,7 +14189,12 @@ ${customAppendPrompt}`;
14163
14189
  config: {
14164
14190
  model,
14165
14191
  temperature: 0.1,
14166
- prompt
14192
+ prompt,
14193
+ tools: {
14194
+ write: false,
14195
+ edit: false,
14196
+ patch: false
14197
+ }
14167
14198
  }
14168
14199
  };
14169
14200
  }
@@ -14288,7 +14319,12 @@ ${customAppendPrompt}`;
14288
14319
  config: {
14289
14320
  model,
14290
14321
  temperature: 0.2,
14291
- prompt
14322
+ prompt,
14323
+ tools: {
14324
+ write: false,
14325
+ edit: false,
14326
+ patch: false
14327
+ }
14292
14328
  }
14293
14329
  };
14294
14330
  }
@@ -14605,10 +14641,10 @@ function createAgents(config2) {
14605
14641
  const architect = createArchitectAgent(getModel("architect"), architectPrompts.prompt, architectPrompts.appendPrompt);
14606
14642
  agents.push(applyOverrides(architect, config2));
14607
14643
  }
14608
- if (!isAgentDisabled("reader", config2)) {
14609
- const readerPrompts = getPrompts("reader");
14610
- const reader = createReaderAgent(getModel("reader"), readerPrompts.prompt, readerPrompts.appendPrompt);
14611
- agents.push(applyOverrides(reader, config2));
14644
+ if (!isAgentDisabled("explorer", config2)) {
14645
+ const explorerPrompts = getPrompts("explorer");
14646
+ const explorer = createExplorerAgent(getModel("explorer"), explorerPrompts.prompt, explorerPrompts.appendPrompt);
14647
+ agents.push(applyOverrides(explorer, config2));
14612
14648
  }
14613
14649
  const smeAgents = createAllSMEAgents(getModel, getPrompts);
14614
14650
  for (const sme of smeAgents) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "2.1.2",
3
+ "version": "2.2.1",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,2 +0,0 @@
1
- import type { AgentDefinition } from './architect';
2
- export declare function createReaderAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;