opencode-swarm 2.1.1 → 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,56 +13866,57 @@ 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
- **Workflow**:
13869
+ **WORKFLOW**:
13870
13870
 
13871
- ## 1. Analyze (you do this)
13872
- Parse request: explicit requirements + implicit needs.
13873
- Identify which domains are relevant (usually 1-3, not all).
13874
- Create initial specification.
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
13875
13877
 
13876
- ## 2. SME Consultation (delegate only relevant SMEs, serially)
13877
- For each relevant domain, delegate to @sme_* agent one at a time.
13878
- Only consult SMEs for domains that actually apply to the task.
13879
- Wait for each response before calling the next.
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
- ## 3. Collate (you do this)
13882
- Synthesize SME inputs into unified specification.
13883
- Ensure clarity and completeness.
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
13884
13891
 
13885
- ## 4. Code (delegate to @coder)
13886
- Send unified specification to @coder.
13887
- Wait for implementation.
13892
+ ## 4. Collate (you do this)
13893
+ Synthesize @explorer summary + SME inputs into:
13894
+ - For reviews: final findings report
13895
+ - For implementation: unified specification for @coder
13888
13896
 
13889
- ## 5. QA Review (delegate serially)
13890
- Send code to @security_reviewer, wait for response.
13891
- Then send code to @auditor, wait for response.
13897
+ ## 5. Code (delegate to @coder) - if implementation needed
13898
+ Send specification to @coder with file paths from @explorer.
13892
13899
 
13893
- ## 6. Triage (you do this)
13894
- Review QA feedback and decide:
13895
- - APPROVED \u2192 proceed to @test_engineer
13896
- - REVISION_NEEDED \u2192 send revision plan to @coder, then repeat QA
13897
- - BLOCKED \u2192 explain why and end
13900
+ ## 6. QA Review (delegate serially) - if code was written
13901
+ @security_reviewer first, then @auditor.
13898
13902
 
13899
- ## 7. Test (delegate to @test_engineer)
13900
- Send approved code to @test_engineer for test generation.
13903
+ ## 7. Triage (you do this)
13904
+ APPROVED \u2192 @test_engineer | REVISION_NEEDED \u2192 @coder | BLOCKED \u2192 explain
13901
13905
 
13902
- **Using @reader**:
13903
- - Delegate to @reader when you need to process large amounts of data
13904
- - Use for: analyzing gitingest output, reviewing large files, summarizing codebases
13905
- - @reader returns condensed summaries you can use for decision-making
13906
+ ## 8. Test (delegate to @test_engineer) - if approved
13906
13907
 
13907
- **Delegation Rules**:
13908
- - All agents run serially (one at a time)
13908
+ **DELEGATION RULES**:
13909
+ - @explorer is ALWAYS your first delegation for tasks involving code
13909
13910
  - Wait for each agent response before calling the next
13910
- - Only consult SMEs for domains relevant to the task (1-3 typically)
13911
- - Reference paths/lines, don't paste entire files
13912
- - Brief delegation notices: "Consulting @sme_powershell..."
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
13913
13914
 
13914
- **Communication**:
13915
+ **COMMUNICATION**:
13915
13916
  - Be direct, no preamble or flattery
13916
- - Don't ask user for confirmation between phases - proceed automatically
13917
- - If original request is vague, ask one targeted question before starting
13918
- - You analyze, collate, and triage. You never write code yourself.`;
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.`;
13919
13920
  function createArchitectAgent(model, customPrompt, customAppendPrompt) {
13920
13921
  let prompt = ARCHITECT_PROMPT;
13921
13922
  if (customPrompt) {
@@ -13997,7 +13998,12 @@ ${customAppendPrompt}`;
13997
13998
  config: {
13998
13999
  model,
13999
14000
  temperature: 0.1,
14000
- prompt
14001
+ prompt,
14002
+ tools: {
14003
+ write: false,
14004
+ edit: false,
14005
+ patch: false
14006
+ }
14001
14007
  }
14002
14008
  };
14003
14009
  }
@@ -14048,63 +14054,85 @@ ${customAppendPrompt}`;
14048
14054
  };
14049
14055
  }
14050
14056
 
14051
- // src/agents/reader.ts
14052
- 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.
14053
14059
 
14054
- **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.
14055
14061
 
14056
- **Behavior**:
14057
- - Read and process the provided content efficiently
14058
- - Extract key information relevant to the task
14059
- - Summarize findings in a structured, actionable format
14060
- - 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
14061
14068
 
14062
- **Use cases**:
14063
- - Analyzing gitingest output to understand a codebase
14064
- - Reviewing large log files or data dumps
14065
- - Summarizing documentation or specifications
14066
- - 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
14067
14074
 
14068
14075
  **Output Format**:
14069
- <summary>
14070
- [2-3 sentence overview of what you analyzed]
14071
- </summary>
14072
14076
 
14073
- <key_findings>
14074
- - [Finding 1: specific, actionable]
14075
- - [Finding 2: specific, actionable]
14076
- - [Finding 3: specific, actionable]
14077
- </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]
14078
14090
 
14079
- <relevant_details>
14080
- [Specific code patterns, file paths, function names, or data points the Architect needs]
14081
- </relevant_details>
14091
+ **Architecture**:
14092
+ [2-3 sentences on how the code is organized]
14082
14093
 
14083
- <recommendations>
14084
- [Brief suggestions based on your analysis]
14085
- </recommendations>
14094
+ **Patterns Observed**:
14095
+ - [coding patterns, conventions, potential issues]
14096
+
14097
+ **Relevant Domains**: [comma-separated: powershell, security, windows, etc.]
14098
+ </codebase_summary>
14099
+
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>
14086
14109
 
14087
14110
  **Constraints**:
14088
- - No code writing
14089
- - No delegation
14090
- - Focus on speed and accuracy
14091
- - Keep total output under 2000 characters`;
14092
- function createReaderAgent(model, customPrompt, customAppendPrompt) {
14093
- 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;
14094
14117
  if (customPrompt) {
14095
14118
  prompt = customPrompt;
14096
14119
  } else if (customAppendPrompt) {
14097
- prompt = `${READER_PROMPT}
14120
+ prompt = `${EXPLORER_PROMPT}
14098
14121
 
14099
14122
  ${customAppendPrompt}`;
14100
14123
  }
14101
14124
  return {
14102
- name: "reader",
14103
- 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.",
14104
14127
  config: {
14105
14128
  model,
14106
14129
  temperature: 0.1,
14107
- prompt
14130
+ prompt,
14131
+ tools: {
14132
+ write: false,
14133
+ edit: false,
14134
+ patch: false
14135
+ }
14108
14136
  }
14109
14137
  };
14110
14138
  }
@@ -14161,7 +14189,12 @@ ${customAppendPrompt}`;
14161
14189
  config: {
14162
14190
  model,
14163
14191
  temperature: 0.1,
14164
- prompt
14192
+ prompt,
14193
+ tools: {
14194
+ write: false,
14195
+ edit: false,
14196
+ patch: false
14197
+ }
14165
14198
  }
14166
14199
  };
14167
14200
  }
@@ -14286,7 +14319,12 @@ ${customAppendPrompt}`;
14286
14319
  config: {
14287
14320
  model,
14288
14321
  temperature: 0.2,
14289
- prompt
14322
+ prompt,
14323
+ tools: {
14324
+ write: false,
14325
+ edit: false,
14326
+ patch: false
14327
+ }
14290
14328
  }
14291
14329
  };
14292
14330
  }
@@ -14603,10 +14641,10 @@ function createAgents(config2) {
14603
14641
  const architect = createArchitectAgent(getModel("architect"), architectPrompts.prompt, architectPrompts.appendPrompt);
14604
14642
  agents.push(applyOverrides(architect, config2));
14605
14643
  }
14606
- if (!isAgentDisabled("reader", config2)) {
14607
- const readerPrompts = getPrompts("reader");
14608
- const reader = createReaderAgent(getModel("reader"), readerPrompts.prompt, readerPrompts.appendPrompt);
14609
- 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));
14610
14648
  }
14611
14649
  const smeAgents = createAllSMEAgents(getModel, getPrompts);
14612
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.1",
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;