opencode-swarm 2.3.3 → 3.0.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 +288 -208
- package/dist/index.js +347 -156
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,112 +1,223 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://img.shields.io/badge/version-3.0.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-20+-orange" alt="Agents">
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<h1 align="center">🐝 OpenCode Swarm</h1>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<strong>The only multi-agent framework that actually works.</strong><br>
|
|
12
|
+
Structured phases. Persistent memory. One task at a time. QA on everything.
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="#why-swarm">Why Swarm?</a> •
|
|
17
|
+
<a href="#how-it-works">How It Works</a> •
|
|
18
|
+
<a href="#installation">Installation</a> •
|
|
19
|
+
<a href="#agents">Agents</a> •
|
|
20
|
+
<a href="#configuration">Configuration</a>
|
|
21
|
+
</p>
|
|
2
22
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## The Problem with Every Other Multi-Agent System
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
You: "Build me an authentication system"
|
|
29
|
+
|
|
30
|
+
Other Frameworks:
|
|
31
|
+
├── Agent 1 starts auth module...
|
|
32
|
+
├── Agent 2 starts user model... (conflicts with Agent 1)
|
|
33
|
+
├── Agent 3 starts database... (wrong schema)
|
|
34
|
+
├── Agent 4 starts tests... (for code that doesn't exist yet)
|
|
35
|
+
└── Result: Chaos. Conflicts. Context lost. Start over.
|
|
36
|
+
|
|
37
|
+
OpenCode Swarm:
|
|
38
|
+
├── Architect analyzes request
|
|
39
|
+
├── Explorer scans codebase
|
|
40
|
+
├── Security SME provides auth guidance
|
|
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 → ✓
|
|
45
|
+
└── Result: Working code. Documented decisions. Resumable progress.
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Why Swarm?
|
|
51
|
+
|
|
52
|
+
<table>
|
|
53
|
+
<tr>
|
|
54
|
+
<td width="50%">
|
|
55
|
+
|
|
56
|
+
### ❌ Other Frameworks
|
|
57
|
+
|
|
58
|
+
- Parallel chaos, hope it converges
|
|
59
|
+
- Single model = correlated failures
|
|
60
|
+
- No planning, just vibes
|
|
61
|
+
- Context lost between sessions
|
|
62
|
+
- QA as afterthought (if at all)
|
|
63
|
+
- Entire codebase in one prompt
|
|
64
|
+
- No way to resume projects
|
|
65
|
+
|
|
66
|
+
</td>
|
|
67
|
+
<td width="50%">
|
|
68
|
+
|
|
69
|
+
### ✅ OpenCode Swarm
|
|
7
70
|
|
|
8
|
-
|
|
71
|
+
- **Serial execution** - predictable, traceable
|
|
72
|
+
- **Heterogeneous models** - different perspectives catch errors
|
|
73
|
+
- **Phased planning** - documented tasks with acceptance criteria
|
|
74
|
+
- **Persistent memory** - `.swarm/` files survive sessions
|
|
75
|
+
- **QA per task** - security + audit before anything ships
|
|
76
|
+
- **One task at a time** - focused, quality code
|
|
77
|
+
- **Resumable projects** - pick up exactly where you left off
|
|
9
78
|
|
|
10
|
-
|
|
79
|
+
</td>
|
|
80
|
+
</tr>
|
|
81
|
+
</table>
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## How It Works
|
|
11
86
|
|
|
12
87
|
```
|
|
13
|
-
|
|
14
|
-
│ "
|
|
15
|
-
|
|
88
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
89
|
+
│ USER: "Add user authentication with JWT" │
|
|
90
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
91
|
+
│
|
|
92
|
+
▼
|
|
93
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
94
|
+
│ PHASE 0: Check for .swarm/plan.md │
|
|
95
|
+
│ Exists? Resume. New? Continue. │
|
|
96
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
97
|
+
│
|
|
98
|
+
▼
|
|
99
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
100
|
+
│ PHASE 1: Clarify (if needed) │
|
|
101
|
+
│ "Do you need refresh tokens? What's the session duration?" │
|
|
102
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
103
|
+
│
|
|
104
|
+
▼
|
|
105
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
106
|
+
│ PHASE 2: Discover │
|
|
107
|
+
│ @explorer scans codebase → structure, languages, patterns │
|
|
108
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
16
109
|
│
|
|
17
110
|
▼
|
|
18
|
-
|
|
19
|
-
│
|
|
20
|
-
|
|
111
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
112
|
+
│ PHASE 3: Consult SMEs (serial, cached) │
|
|
113
|
+
│ @sme_security → auth best practices │
|
|
114
|
+
│ @sme_api → JWT patterns, refresh flow │
|
|
115
|
+
│ Guidance saved to .swarm/context.md │
|
|
116
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
21
117
|
│
|
|
22
118
|
▼
|
|
23
|
-
|
|
24
|
-
│
|
|
25
|
-
│
|
|
26
|
-
|
|
119
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
120
|
+
│ PHASE 4: Plan │
|
|
121
|
+
│ Creates .swarm/plan.md with phases, tasks, acceptance criteria│
|
|
122
|
+
│ │
|
|
123
|
+
│ Phase 1: Foundation [3 tasks] │
|
|
124
|
+
│ Phase 2: Core Auth [4 tasks] │
|
|
125
|
+
│ Phase 3: Session Management [3 tasks] │
|
|
126
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
27
127
|
│
|
|
28
128
|
▼
|
|
29
|
-
|
|
30
|
-
│
|
|
31
|
-
│
|
|
32
|
-
|
|
129
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
130
|
+
│ PHASE 5: Execute (per task) │
|
|
131
|
+
│ │
|
|
132
|
+
│ ┌─────────┐ ┌──────────┐ ┌─────────┐ ┌──────────┐ │
|
|
133
|
+
│ │ @coder │ → │@security │ → │@auditor │ → │ @test │ │
|
|
134
|
+
│ │ 1 task │ │ review │ │ verify │ │ generate │ │
|
|
135
|
+
│ └─────────┘ └──────────┘ └─────────┘ └──────────┘ │
|
|
136
|
+
│ │ │ │
|
|
137
|
+
│ └──── If rejected: retry with feedback ────────┘ │
|
|
138
|
+
│ │
|
|
139
|
+
│ Update plan.md: [x] Task complete │
|
|
140
|
+
│ Next task... │
|
|
141
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
33
142
|
│
|
|
34
143
|
▼
|
|
35
|
-
|
|
36
|
-
│
|
|
37
|
-
|
|
144
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
145
|
+
│ PHASE 6: Phase Complete │
|
|
146
|
+
│ Re-scan with @explorer │
|
|
147
|
+
│ Update context.md with learnings │
|
|
148
|
+
│ Archive to .swarm/history/ │
|
|
149
|
+
│ "Phase 1 complete. Ready for Phase 2?" │
|
|
150
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
38
151
|
```
|
|
39
152
|
|
|
40
153
|
---
|
|
41
154
|
|
|
42
|
-
##
|
|
155
|
+
## Persistent Project Memory
|
|
43
156
|
|
|
44
|
-
|
|
45
|
-
**OpenCode Swarm enforces discipline:**
|
|
157
|
+
Other frameworks lose everything when the session ends. Swarm doesn't.
|
|
46
158
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
159
|
+
```
|
|
160
|
+
.swarm/
|
|
161
|
+
├── plan.md # Your project roadmap
|
|
162
|
+
├── context.md # Everything a new Architect needs
|
|
163
|
+
└── history/
|
|
164
|
+
├── phase-1.md # What was done, what was learned
|
|
165
|
+
└── phase-2.md
|
|
166
|
+
```
|
|
54
167
|
|
|
55
|
-
|
|
168
|
+
### plan.md - Living Roadmap
|
|
169
|
+
```markdown
|
|
170
|
+
# Project: Auth System
|
|
171
|
+
Current Phase: 2
|
|
172
|
+
|
|
173
|
+
## Phase 1: Foundation [COMPLETE]
|
|
174
|
+
- [x] Task 1.1: Create user model [SMALL]
|
|
175
|
+
- [x] Task 1.2: Add password hashing [SMALL]
|
|
176
|
+
- [x] Task 1.3: Database migrations [MEDIUM]
|
|
177
|
+
|
|
178
|
+
## Phase 2: Core Auth [IN PROGRESS]
|
|
179
|
+
- [x] Task 2.1: Login endpoint [MEDIUM]
|
|
180
|
+
- [ ] Task 2.2: JWT generation [MEDIUM] (depends: 2.1) ← CURRENT
|
|
181
|
+
- Acceptance: Returns valid JWT with user claims
|
|
182
|
+
- Attempt 1: REJECTED - Missing expiration
|
|
183
|
+
- [ ] Task 2.3: Token validation middleware [MEDIUM]
|
|
184
|
+
- [BLOCKED] Task 2.4: Refresh tokens
|
|
185
|
+
- Reason: Waiting for decision on rotation strategy
|
|
186
|
+
```
|
|
56
187
|
|
|
57
|
-
|
|
188
|
+
### context.md - Institutional Knowledge
|
|
189
|
+
```markdown
|
|
190
|
+
# Project Context: Auth System
|
|
58
191
|
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
```
|
|
192
|
+
## Technical Decisions
|
|
193
|
+
- Using bcrypt (cost 12) for password hashing
|
|
194
|
+
- JWT expires in 15 minutes, refresh in 7 days
|
|
195
|
+
- Storing refresh tokens in Redis
|
|
92
196
|
|
|
93
|
-
|
|
197
|
+
## SME Guidance Cache
|
|
198
|
+
### Security (Phase 1)
|
|
199
|
+
- Never log tokens or passwords
|
|
200
|
+
- Use constant-time comparison for tokens
|
|
201
|
+
- Implement rate limiting on login
|
|
94
202
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
203
|
+
### API (Phase 1)
|
|
204
|
+
- Return 401 for invalid credentials (not 404)
|
|
205
|
+
- Include token expiry in response body
|
|
206
|
+
|
|
207
|
+
## Patterns Established
|
|
208
|
+
- Error handling: Custom ApiError class with status codes
|
|
209
|
+
- Validation: Zod schemas in /validators/
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Start a new session tomorrow?** The Architect reads these files and picks up exactly where you left off.
|
|
104
213
|
|
|
105
214
|
---
|
|
106
215
|
|
|
107
|
-
## Heterogeneous
|
|
216
|
+
## Heterogeneous Models = Better Code
|
|
217
|
+
|
|
218
|
+
Most frameworks use one model for everything. Same blindspots everywhere.
|
|
108
219
|
|
|
109
|
-
|
|
220
|
+
Swarm lets you mix models strategically:
|
|
110
221
|
|
|
111
222
|
```json
|
|
112
223
|
{
|
|
@@ -115,38 +226,84 @@ OpenCode Swarm allows **different models per role**, reducing correlated failure
|
|
|
115
226
|
"explorer": { "model": "google/gemini-2.0-flash" },
|
|
116
227
|
"coder": { "model": "anthropic/claude-sonnet-4-5" },
|
|
117
228
|
"_sme": { "model": "google/gemini-2.0-flash" },
|
|
118
|
-
"
|
|
119
|
-
"
|
|
229
|
+
"security_reviewer": { "model": "openai/gpt-4o" },
|
|
230
|
+
"auditor": { "model": "google/gemini-2.0-flash" }
|
|
120
231
|
}
|
|
121
232
|
}
|
|
122
233
|
```
|
|
123
234
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
235
|
+
| Role | Optimized For | Why Different Models? |
|
|
236
|
+
|------|---------------|----------------------|
|
|
237
|
+
| Architect | Deep reasoning | Needs to plan complex work |
|
|
238
|
+
| Explorer | Fast scanning | Speed over depth |
|
|
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 |
|
|
243
|
+
|
|
244
|
+
**If Claude writes code and GPT reviews it, GPT catches Claude's blindspots.** This is why real teams have code review.
|
|
129
245
|
|
|
130
246
|
---
|
|
131
247
|
|
|
132
248
|
## Installation
|
|
133
249
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
```json
|
|
250
|
+
```bash
|
|
251
|
+
# Add to opencode.json
|
|
137
252
|
{
|
|
138
253
|
"plugin": ["opencode-swarm"]
|
|
139
254
|
}
|
|
140
|
-
```
|
|
141
255
|
|
|
142
|
-
Or install via CLI
|
|
143
|
-
|
|
144
|
-
```bash
|
|
256
|
+
# Or install via CLI
|
|
145
257
|
bunx opencode-swarm install
|
|
146
258
|
```
|
|
147
259
|
|
|
148
260
|
---
|
|
149
261
|
|
|
262
|
+
## Agents
|
|
263
|
+
|
|
264
|
+
### 🎯 Orchestrator
|
|
265
|
+
| Agent | Role |
|
|
266
|
+
|-------|------|
|
|
267
|
+
| `architect` | Central coordinator. Plans phases, delegates tasks, manages QA, maintains project memory. |
|
|
268
|
+
|
|
269
|
+
### 🔍 Discovery
|
|
270
|
+
| Agent | Role |
|
|
271
|
+
|-------|------|
|
|
272
|
+
| `explorer` | Fast codebase scanner. Identifies structure, languages, frameworks, key files. |
|
|
273
|
+
|
|
274
|
+
### 🧠 Domain Experts (15 SMEs)
|
|
275
|
+
| Agent | Domain |
|
|
276
|
+
|-------|--------|
|
|
277
|
+
| `sme_web` | Flutter, React, Vue, Angular, JS/TS, HTML/CSS |
|
|
278
|
+
| `sme_api` | REST, GraphQL, OAuth, JWT, webhooks |
|
|
279
|
+
| `sme_database` | SQL Server, PostgreSQL, MySQL, MongoDB, Redis |
|
|
280
|
+
| `sme_devops` | Docker, Kubernetes, CI/CD, Terraform |
|
|
281
|
+
| `sme_security` | STIG, hardening, CVE, encryption, PKI |
|
|
282
|
+
| `sme_python` | Python ecosystem, libraries, patterns |
|
|
283
|
+
| `sme_powershell` | PowerShell scripting, modules, remoting |
|
|
284
|
+
| `sme_windows` | Windows internals, registry, services, WMI |
|
|
285
|
+
| `sme_linux` | Linux, systemd, package management |
|
|
286
|
+
| `sme_network` | TCP/IP, firewalls, DNS, TLS |
|
|
287
|
+
| `sme_azure` | Azure services, Entra ID, ARM/Bicep |
|
|
288
|
+
| `sme_vmware` | vSphere, ESXi, PowerCLI |
|
|
289
|
+
| `sme_oracle` | Oracle Database, SQL/PLSQL |
|
|
290
|
+
| `sme_active_directory` | AD, LDAP, Group Policy, Kerberos |
|
|
291
|
+
| `sme_ui_ux` | UI/UX design, accessibility |
|
|
292
|
+
|
|
293
|
+
### 💻 Implementation
|
|
294
|
+
| Agent | Role |
|
|
295
|
+
|-------|------|
|
|
296
|
+
| `coder` | Implements ONE task at a time with full context |
|
|
297
|
+
| `test_engineer` | Generates tests for each completed task |
|
|
298
|
+
|
|
299
|
+
### ✅ Quality Assurance
|
|
300
|
+
| Agent | Role |
|
|
301
|
+
|-------|------|
|
|
302
|
+
| `security_reviewer` | Vulnerability assessment per task |
|
|
303
|
+
| `auditor` | Correctness verification per task |
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
150
307
|
## Configuration
|
|
151
308
|
|
|
152
309
|
Create `~/.config/opencode/opencode-swarm.json`:
|
|
@@ -166,143 +323,60 @@ Create `~/.config/opencode/opencode-swarm.json`:
|
|
|
166
323
|
|
|
167
324
|
### Category Defaults
|
|
168
325
|
|
|
169
|
-
`_sme`
|
|
326
|
+
- `_sme` → All 15 SME agents
|
|
327
|
+
- `_qa` → security_reviewer + auditor
|
|
170
328
|
|
|
329
|
+
Override specific agents:
|
|
171
330
|
```json
|
|
172
331
|
{
|
|
173
|
-
"
|
|
174
|
-
|
|
175
|
-
"sme_oracle": { "model": "anthropic/claude-sonnet-4-5" }
|
|
176
|
-
}
|
|
332
|
+
"_sme": { "model": "google/gemini-2.0-flash" },
|
|
333
|
+
"sme_security": { "model": "anthropic/claude-sonnet-4-5" }
|
|
177
334
|
}
|
|
178
335
|
```
|
|
179
336
|
|
|
180
337
|
### Disable Unused Domains
|
|
181
|
-
|
|
182
338
|
```json
|
|
183
339
|
{
|
|
184
|
-
"
|
|
185
|
-
|
|
186
|
-
"sme_azure": { "disabled": true }
|
|
187
|
-
}
|
|
340
|
+
"sme_vmware": { "disabled": true },
|
|
341
|
+
"sme_oracle": { "disabled": true }
|
|
188
342
|
}
|
|
189
343
|
```
|
|
190
344
|
|
|
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
345
|
---
|
|
198
346
|
|
|
199
|
-
##
|
|
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
|
-
| `sme_web` | Flutter, React, Vue, Angular, JS/TS, HTML/CSS |
|
|
226
|
-
| `sme_database` | SQL Server, PostgreSQL, MySQL, MongoDB, Redis |
|
|
227
|
-
| `sme_devops` | Docker, Kubernetes, CI/CD, Terraform, GitHub Actions |
|
|
228
|
-
| `sme_api` | REST, GraphQL, OAuth, JWT, webhooks |
|
|
347
|
+
## Comparison
|
|
229
348
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
|
234
|
-
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
|
238
|
-
|
|
239
|
-
|
|
|
240
|
-
| `auditor` | Correctness verification, logic errors, edge cases |
|
|
241
|
-
|
|
242
|
-
---
|
|
243
|
-
|
|
244
|
-
## Tools
|
|
245
|
-
|
|
246
|
-
| Tool | Description |
|
|
247
|
-
|------|-------------|
|
|
248
|
-
| `gitingest` | Fetch GitHub repository contents for analysis |
|
|
249
|
-
| `detect_domains` | Auto-detect relevant SME domains from text |
|
|
250
|
-
| `extract_code_blocks` | Extract code blocks to files |
|
|
251
|
-
|
|
252
|
-
### gitingest Example
|
|
253
|
-
|
|
254
|
-
```
|
|
255
|
-
"Analyze the architecture of https://github.com/user/repo"
|
|
256
|
-
"Use gitingest to fetch https://github.com/user/repo with pattern *.py include"
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
---
|
|
260
|
-
|
|
261
|
-
## Workflow Examples
|
|
262
|
-
|
|
263
|
-
### Code Review
|
|
264
|
-
```
|
|
265
|
-
User: "Review this codebase for issues"
|
|
266
|
-
→ Explorer scans, identifies: TypeScript, React, needs sme_security
|
|
267
|
-
→ SME_Security reviews flagged files
|
|
268
|
-
→ Architect collates findings into review report
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
### Implementation
|
|
272
|
-
```
|
|
273
|
-
User: "Add authentication to this API"
|
|
274
|
-
→ Explorer scans existing code
|
|
275
|
-
→ SME_Security + SME_Network consulted
|
|
276
|
-
→ Coder implements spec
|
|
277
|
-
→ Security_Reviewer → Auditor validates
|
|
278
|
-
→ Test_Engineer generates tests
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
### Bug Fix
|
|
282
|
-
```
|
|
283
|
-
User: "Fix the null reference in user.ts:42"
|
|
284
|
-
→ Explorer locates context
|
|
285
|
-
→ Relevant SME consulted
|
|
286
|
-
→ Coder implements fix
|
|
287
|
-
→ QA validates
|
|
288
|
-
```
|
|
349
|
+
| Feature | OpenCode Swarm | AutoGen | CrewAI | LangGraph |
|
|
350
|
+
|---------|---------------|---------|--------|-----------|
|
|
351
|
+
| Execution | Serial (predictable) | Parallel (chaotic) | Parallel | Configurable |
|
|
352
|
+
| Planning | Phased with acceptance criteria | Ad-hoc | Role-based | Graph-based |
|
|
353
|
+
| Memory | Persistent `.swarm/` files | Session only | Session only | Checkpoints |
|
|
354
|
+
| QA | Per-task (security + audit) | Optional | Optional | Manual |
|
|
355
|
+
| Model mixing | Per-agent configuration | Limited | Limited | Manual |
|
|
356
|
+
| Resume projects | ✅ Native | ❌ | ❌ | Partial |
|
|
357
|
+
| SME domains | 15 specialized | Generic | Generic | Generic |
|
|
358
|
+
| Task granularity | One at a time | Batched | Batched | Varies |
|
|
289
359
|
|
|
290
360
|
---
|
|
291
361
|
|
|
292
|
-
## Design
|
|
362
|
+
## Design Principles
|
|
293
363
|
|
|
294
|
-
1. **
|
|
295
|
-
2. **
|
|
296
|
-
3. **
|
|
297
|
-
4. **
|
|
298
|
-
5. **
|
|
299
|
-
6. **
|
|
364
|
+
1. **Plan before code** - Documented phases with acceptance criteria
|
|
365
|
+
2. **One task at a time** - Focused work, quality output
|
|
366
|
+
3. **QA everything immediately** - Security + audit per task, not per project
|
|
367
|
+
4. **Cache SME knowledge** - Don't re-ask answered questions
|
|
368
|
+
5. **Persistent memory** - `.swarm/` files survive sessions
|
|
369
|
+
6. **Serial execution** - Predictable, debuggable, no race conditions
|
|
370
|
+
7. **Heterogeneous models** - Different perspectives catch different bugs
|
|
371
|
+
8. **User checkpoints** - Confirm before proceeding to next phase
|
|
372
|
+
9. **Failure tracking** - Document rejections, escalate after 3 attempts
|
|
373
|
+
10. **Resumable by design** - Any Architect can pick up any project
|
|
300
374
|
|
|
301
375
|
---
|
|
302
376
|
|
|
303
377
|
## Documentation
|
|
304
378
|
|
|
305
|
-
- [Architecture
|
|
379
|
+
- [Architecture Deep Dive](docs/architecture.md)
|
|
306
380
|
- [Design Rationale](docs/design-rationale.md)
|
|
307
381
|
- [Installation Guide](docs/installation.md)
|
|
308
382
|
|
|
@@ -311,3 +385,9 @@ User: "Fix the null reference in user.ts:42"
|
|
|
311
385
|
## License
|
|
312
386
|
|
|
313
387
|
MIT
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
<p align="center">
|
|
392
|
+
<strong>Stop hoping your agents figure it out. Start shipping code that works.</strong>
|
|
393
|
+
</p>
|
package/dist/index.js
CHANGED
|
@@ -13846,197 +13846,388 @@ function loadAgentPrompt(agentName) {
|
|
|
13846
13846
|
return result;
|
|
13847
13847
|
}
|
|
13848
13848
|
// src/agents/architect.ts
|
|
13849
|
-
var ARCHITECT_PROMPT = `You are Architect - an AI
|
|
13850
|
-
|
|
13851
|
-
**Role**: Analyze requests, delegate to specialist agents with clear instructions, synthesize their outputs, and manage the pipeline.
|
|
13849
|
+
var ARCHITECT_PROMPT = `You are Architect - an AI orchestrator that coordinates specialist LLM agents to deliver production-quality code through structured, phased execution.
|
|
13852
13850
|
|
|
13853
13851
|
**CRITICAL: YOU ARE ORCHESTRATING OTHER LLMs**
|
|
13854
|
-
The agents you delegate to are separate LLM instances, typically smaller/faster models
|
|
13852
|
+
The agents you delegate to are separate LLM instances, typically smaller/faster models. They cannot read your mind or infer context. Your delegations must be:
|
|
13855
13853
|
- **Explicit**: State exactly what you want, not what you assume they know
|
|
13856
13854
|
- **Structured**: Use clear sections, numbered steps, specific file paths
|
|
13857
|
-
- **Constrained**: Tell them what NOT to do
|
|
13855
|
+
- **Constrained**: Tell them what NOT to do to prevent scope creep
|
|
13858
13856
|
- **Self-contained**: Include all context they need in the delegation message
|
|
13859
13857
|
|
|
13860
|
-
**CRITICAL
|
|
13858
|
+
**CRITICAL: SERIAL EXECUTION ONLY**
|
|
13861
13859
|
You MUST call agents ONE AT A TIME. After each delegation:
|
|
13862
13860
|
1. Send to ONE agent
|
|
13863
13861
|
2. STOP and wait for response
|
|
13864
13862
|
3. Only then proceed to next agent
|
|
13865
|
-
NEVER delegate to multiple agents in the same message.
|
|
13863
|
+
NEVER delegate to multiple agents in the same message.
|
|
13864
|
+
|
|
13865
|
+
---
|
|
13866
|
+
|
|
13867
|
+
## AGENTS
|
|
13868
|
+
|
|
13869
|
+
@explorer - Fast codebase discovery and summarization
|
|
13870
|
+
@sme_windows - Windows OS, registry, services, WMI/CIM
|
|
13871
|
+
@sme_powershell - PowerShell scripting, cmdlets, modules
|
|
13872
|
+
@sme_python - Python ecosystem, libraries, patterns
|
|
13873
|
+
@sme_oracle - Oracle Database, SQL/PLSQL
|
|
13874
|
+
@sme_network - TCP/IP, firewalls, DNS, TLS
|
|
13875
|
+
@sme_security - STIG, hardening, CVE, PKI
|
|
13876
|
+
@sme_linux - Linux, systemd, package management
|
|
13877
|
+
@sme_vmware - vSphere, ESXi, PowerCLI
|
|
13878
|
+
@sme_azure - Azure, Entra ID, ARM/Bicep
|
|
13879
|
+
@sme_active_directory - AD, LDAP, Group Policy, Kerberos
|
|
13880
|
+
@sme_ui_ux - UI/UX design, accessibility
|
|
13881
|
+
@sme_web - Flutter, React, Vue, Angular, JS/TS, HTML/CSS
|
|
13882
|
+
@sme_database - SQL Server, PostgreSQL, MySQL, MongoDB, Redis
|
|
13883
|
+
@sme_devops - Docker, Kubernetes, CI/CD, Terraform
|
|
13884
|
+
@sme_api - REST, GraphQL, OAuth, JWT
|
|
13885
|
+
|
|
13886
|
+
@coder - Implementation specialist
|
|
13887
|
+
@security_reviewer - Security vulnerability assessment
|
|
13888
|
+
@auditor - Code correctness verification
|
|
13889
|
+
@test_engineer - Test case generation
|
|
13890
|
+
|
|
13891
|
+
---
|
|
13892
|
+
|
|
13893
|
+
## WORKFLOW
|
|
13894
|
+
|
|
13895
|
+
### Phase 0: Initialize or Resume
|
|
13896
|
+
|
|
13897
|
+
**FIRST ACTION**: Check if \`.swarm/plan.md\` exists.
|
|
13898
|
+
|
|
13899
|
+
If EXISTS \u2192 Read plan.md and context.md, resume from current phase/task
|
|
13900
|
+
If NOT EXISTS \u2192 This is a new project, proceed to Phase 1
|
|
13901
|
+
|
|
13902
|
+
### Phase 1: Clarify (if needed)
|
|
13903
|
+
|
|
13904
|
+
If the user request is ambiguous or missing critical details:
|
|
13905
|
+
- Ask up to 3 targeted clarifying questions
|
|
13906
|
+
- Wait for answers before proceeding
|
|
13907
|
+
- Do NOT guess at requirements
|
|
13908
|
+
|
|
13909
|
+
If the request is clear \u2192 Proceed to Phase 2
|
|
13910
|
+
|
|
13911
|
+
### Phase 2: Discover
|
|
13912
|
+
|
|
13913
|
+
Delegate to @explorer:
|
|
13914
|
+
"Analyze this codebase for [task type].
|
|
13915
|
+
Focus on: [relevant areas based on user request]
|
|
13916
|
+
Return: project summary, key files, directory structure, relevant domains for SME consultation"
|
|
13917
|
+
|
|
13918
|
+
STOP. Wait for @explorer response.
|
|
13919
|
+
|
|
13920
|
+
### Phase 3: Consult SMEs (serial, check cache first)
|
|
13921
|
+
|
|
13922
|
+
Before calling an SME, check \`.swarm/context.md\` for cached guidance.
|
|
13923
|
+
Only call SMEs for NEW questions not already answered.
|
|
13924
|
+
|
|
13925
|
+
For each relevant domain (usually 1-3, NEVER parallel):
|
|
13926
|
+
"Review for [domain] considerations:
|
|
13927
|
+
Files: [specific paths from explorer]
|
|
13928
|
+
Context: [what we're building]
|
|
13929
|
+
Provide: [specific guidance needed]
|
|
13930
|
+
Constraints: Focus only on [domain]"
|
|
13931
|
+
|
|
13932
|
+
STOP after each. Wait for response. Then next SME.
|
|
13933
|
+
|
|
13934
|
+
Capture ALL SME guidance in context.md for future reference.
|
|
13935
|
+
|
|
13936
|
+
### Phase 4: Plan
|
|
13937
|
+
|
|
13938
|
+
Create or update \`.swarm/plan.md\` with:
|
|
13939
|
+
- Project overview
|
|
13940
|
+
- Phases broken into discrete tasks
|
|
13941
|
+
- Task dependencies (which tasks require others)
|
|
13942
|
+
- Acceptance criteria for each task
|
|
13943
|
+
- Complexity estimates [SMALL/MEDIUM/LARGE]
|
|
13944
|
+
|
|
13945
|
+
Create or update \`.swarm/context.md\` with:
|
|
13946
|
+
- Technical decisions made
|
|
13947
|
+
- Architecture patterns
|
|
13948
|
+
- SME guidance (cached for future phases)
|
|
13949
|
+
- File map
|
|
13950
|
+
|
|
13951
|
+
**PLANNING RULES**:
|
|
13952
|
+
- Each task should be ONE focused unit of work (single file or single feature)
|
|
13953
|
+
- Tasks must have clear acceptance criteria
|
|
13954
|
+
- Mark dependencies explicitly
|
|
13955
|
+
- Estimate complexity to set expectations
|
|
13956
|
+
|
|
13957
|
+
### Phase 5: Execute Current Phase
|
|
13958
|
+
|
|
13959
|
+
For EACH task in the current phase (respecting dependencies):
|
|
13960
|
+
|
|
13961
|
+
**Step 5a: Delegate to @coder (ONE TASK ONLY)**
|
|
13962
|
+
"Implement the following:
|
|
13963
|
+
|
|
13964
|
+
TASK: [specific single task]
|
|
13965
|
+
FILE: [single file path]
|
|
13966
|
+
|
|
13967
|
+
REQUIREMENTS:
|
|
13968
|
+
1. [requirement with acceptance criteria]
|
|
13969
|
+
2. [requirement with acceptance criteria]
|
|
13970
|
+
|
|
13971
|
+
CONTEXT:
|
|
13972
|
+
- [relevant SME guidance from context.md]
|
|
13973
|
+
- [patterns from existing code]
|
|
13974
|
+
|
|
13975
|
+
DO NOT:
|
|
13976
|
+
- Modify other files
|
|
13977
|
+
- Add features not specified
|
|
13978
|
+
- Refactor unrelated code
|
|
13979
|
+
|
|
13980
|
+
ACCEPTANCE CRITERIA:
|
|
13981
|
+
- [specific testable criterion]
|
|
13982
|
+
- [specific testable criterion]"
|
|
13983
|
+
|
|
13984
|
+
STOP. Wait for @coder response.
|
|
13985
|
+
|
|
13986
|
+
**Step 5b: Security Review**
|
|
13987
|
+
"Security review this code:
|
|
13988
|
+
|
|
13989
|
+
FILE: [path]
|
|
13990
|
+
PURPOSE: [what it does]
|
|
13991
|
+
|
|
13992
|
+
CHECK FOR:
|
|
13993
|
+
- Injection vulnerabilities
|
|
13994
|
+
- Data exposure
|
|
13995
|
+
- Privilege escalation
|
|
13996
|
+
- Input validation gaps
|
|
13997
|
+
|
|
13998
|
+
RETURN: Risk level (LOW/MEDIUM/HIGH/CRITICAL) with specific findings and line numbers"
|
|
13999
|
+
|
|
14000
|
+
STOP. Wait for response.
|
|
13866
14001
|
|
|
13867
|
-
**
|
|
14002
|
+
**Step 5c: Audit**
|
|
14003
|
+
"Verify this implementation:
|
|
13868
14004
|
|
|
13869
|
-
|
|
13870
|
-
|
|
13871
|
-
@sme_powershell - PowerShell scripting, cmdlets, modules, remoting
|
|
13872
|
-
@sme_python - Python ecosystem, libraries, best practices
|
|
13873
|
-
@sme_oracle - Oracle Database, SQL/PLSQL, administration
|
|
13874
|
-
@sme_network - Networking, firewalls, DNS, TLS/SSL, load balancing
|
|
13875
|
-
@sme_security - STIG compliance, hardening, CVE, encryption, PKI
|
|
13876
|
-
@sme_linux - Linux administration, systemd, package management
|
|
13877
|
-
@sme_vmware - VMware vSphere, ESXi, PowerCLI, virtualization
|
|
13878
|
-
@sme_azure - Azure cloud services, Entra ID, ARM/Bicep
|
|
13879
|
-
@sme_active_directory - Active Directory, LDAP, Group Policy, Kerberos
|
|
13880
|
-
@sme_ui_ux - UI/UX design, interaction patterns, accessibility
|
|
13881
|
-
@sme_web - Web/frontend (Flutter, React, Vue, Angular, JS/TS, HTML/CSS)
|
|
13882
|
-
@sme_database - Databases (SQL Server, PostgreSQL, MySQL, MongoDB, Redis)
|
|
13883
|
-
@sme_devops - DevOps, CI/CD, Docker, Kubernetes, Terraform, GitHub Actions
|
|
13884
|
-
@sme_api - API design, REST, GraphQL, OAuth, JWT, webhooks
|
|
14005
|
+
FILE: [path]
|
|
14006
|
+
SPECIFICATION: [from task requirements]
|
|
13885
14007
|
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
|
|
14008
|
+
CHECK:
|
|
14009
|
+
- Logic correctness
|
|
14010
|
+
- Edge cases
|
|
14011
|
+
- Error handling
|
|
14012
|
+
- Meets acceptance criteria
|
|
13890
14013
|
|
|
13891
|
-
|
|
14014
|
+
RETURN: APPROVED or REJECTED with specific issues"
|
|
13892
14015
|
|
|
13893
|
-
|
|
13894
|
-
Provide: The task context and what you need to understand
|
|
13895
|
-
Format:
|
|
13896
|
-
"Analyze this codebase for [task type].
|
|
13897
|
-
Focus on: [specific areas]
|
|
13898
|
-
Return: project summary, key files, relevant domains for SME consultation"
|
|
14016
|
+
STOP. Wait for response.
|
|
13899
14017
|
|
|
13900
|
-
|
|
13901
|
-
Provide: Specific files/code to review, what expertise you need
|
|
13902
|
-
Format:
|
|
13903
|
-
"Review the following for [domain] considerations:
|
|
13904
|
-
Files: [list specific paths]
|
|
13905
|
-
Context: [what the code does]
|
|
13906
|
-
Provide: [specific guidance needed]
|
|
13907
|
-
Constraints: Focus only on [domain], do not suggest unrelated changes"
|
|
14018
|
+
**Step 5d: Handle QA Result**
|
|
13908
14019
|
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
Wait for @coder to complete each task before sending the next.
|
|
14020
|
+
If APPROVED:
|
|
14021
|
+
\u2192 Delegate to @test_engineer for this task
|
|
14022
|
+
\u2192 Update plan.md: mark task [x] complete
|
|
14023
|
+
\u2192 Proceed to next task
|
|
13914
14024
|
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
TASK: [one specific task - single file or single feature]
|
|
13920
|
-
|
|
13921
|
-
FILE: [single path to create/modify]
|
|
13922
|
-
|
|
13923
|
-
REQUIREMENTS:
|
|
13924
|
-
1. [specific requirement]
|
|
13925
|
-
2. [specific requirement]
|
|
13926
|
-
|
|
13927
|
-
CONTEXT:
|
|
13928
|
-
- [relevant info from explorer/SMEs]
|
|
13929
|
-
- [patterns from existing code]
|
|
13930
|
-
|
|
13931
|
-
DO NOT:
|
|
13932
|
-
- Modify other files
|
|
13933
|
-
- Add features not specified
|
|
13934
|
-
- Refactor unrelated code
|
|
13935
|
-
|
|
13936
|
-
OUTPUT: [single deliverable]"
|
|
14025
|
+
If REJECTED (Attempt 1-2):
|
|
14026
|
+
\u2192 Send specific feedback to @coder
|
|
14027
|
+
\u2192 Re-run QA cycle
|
|
14028
|
+
\u2192 Track attempt in plan.md
|
|
13937
14029
|
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
Turn 3: "Implement the main entry point" \u2192 @coder \u2192 wait for completion
|
|
14030
|
+
If REJECTED (Attempt 3):
|
|
14031
|
+
\u2192 ESCALATE: Handle directly or re-scope task
|
|
14032
|
+
\u2192 Document in plan.md why it was escalated
|
|
13942
14033
|
|
|
13943
|
-
|
|
13944
|
-
|
|
14034
|
+
**Step 5e: Test**
|
|
14035
|
+
"Generate tests for:
|
|
13945
14036
|
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
Format:
|
|
13949
|
-
"Security review the following code:
|
|
13950
|
-
|
|
13951
|
-
FILES: [paths]
|
|
13952
|
-
PURPOSE: [what the code does]
|
|
13953
|
-
|
|
13954
|
-
CHECK FOR:
|
|
13955
|
-
- Injection vulnerabilities
|
|
13956
|
-
- Data exposure
|
|
13957
|
-
- Privilege issues
|
|
13958
|
-
- Input validation
|
|
13959
|
-
|
|
13960
|
-
RETURN: Risk level (LOW/MEDIUM/HIGH/CRITICAL) and specific findings with line numbers"
|
|
14037
|
+
FILE: [path]
|
|
14038
|
+
FUNCTION: [specific function]
|
|
13961
14039
|
|
|
13962
|
-
|
|
13963
|
-
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
|
|
13967
|
-
FILES: [paths]
|
|
13968
|
-
SPECIFICATION: [what it should do]
|
|
13969
|
-
|
|
13970
|
-
CHECK:
|
|
13971
|
-
- Logic correctness
|
|
13972
|
-
- Edge cases handled
|
|
13973
|
-
- Error handling
|
|
13974
|
-
- Specification compliance
|
|
13975
|
-
|
|
13976
|
-
RETURN: APPROVED or REJECTED with specific issues"
|
|
14040
|
+
TEST CASES:
|
|
14041
|
+
- Happy path: [expected behavior]
|
|
14042
|
+
- Edge cases: [specific cases to cover]
|
|
14043
|
+
- Error conditions: [what should fail gracefully]
|
|
13977
14044
|
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
Format:
|
|
13981
|
-
"Generate tests for:
|
|
13982
|
-
|
|
13983
|
-
FILES: [paths]
|
|
13984
|
-
FUNCTIONS TO TEST: [list]
|
|
13985
|
-
|
|
13986
|
-
COVERAGE:
|
|
13987
|
-
- Happy path
|
|
13988
|
-
- Edge cases: [specific cases]
|
|
13989
|
-
- Error conditions
|
|
13990
|
-
|
|
13991
|
-
FRAMEWORK: [test framework to use]
|
|
13992
|
-
OUTPUT: Test file(s) at [paths]"
|
|
14045
|
+
ACCEPTANCE: [from task criteria]
|
|
14046
|
+
OUTPUT: Test file at [path]"
|
|
13993
14047
|
|
|
13994
|
-
|
|
14048
|
+
STOP. Wait for response.
|
|
13995
14049
|
|
|
13996
|
-
|
|
13997
|
-
|
|
14050
|
+
**Step 5f: Mark Complete**
|
|
14051
|
+
Update plan.md:
|
|
14052
|
+
- Mark task [x] complete
|
|
14053
|
+
- Add any notes or learnings to context.md
|
|
13998
14054
|
|
|
13999
|
-
|
|
14000
|
-
Delegate to @explorer with clear instructions. STOP and wait.
|
|
14055
|
+
Proceed to next task in phase.
|
|
14001
14056
|
|
|
14002
|
-
|
|
14003
|
-
Based on @explorer's domains, delegate to each SME serially.
|
|
14004
|
-
Each SME delegation must be self-contained with file paths and context.
|
|
14057
|
+
### Phase 6: Phase Complete
|
|
14005
14058
|
|
|
14006
|
-
|
|
14007
|
-
Synthesize all inputs into a clear specification or report.
|
|
14059
|
+
When all tasks in a phase are complete:
|
|
14008
14060
|
|
|
14009
|
-
|
|
14010
|
-
|
|
14011
|
-
-
|
|
14012
|
-
-
|
|
14013
|
-
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14061
|
+
1. Re-run @explorer to capture codebase changes
|
|
14062
|
+
2. Update context.md with:
|
|
14063
|
+
- New patterns established
|
|
14064
|
+
- Lessons learned
|
|
14065
|
+
- Updated file map
|
|
14066
|
+
3. Archive phase summary to .swarm/history/
|
|
14067
|
+
4. Summarize to user what was accomplished
|
|
14068
|
+
5. ASK user: "Ready to proceed to Phase [N+1]?"
|
|
14069
|
+
- Do NOT auto-proceed to next phase
|
|
14070
|
+
- Wait for user confirmation
|
|
14016
14071
|
|
|
14017
|
-
|
|
14018
|
-
Send completed code with context. Tell them exactly what to check.
|
|
14072
|
+
### Handling Blockers
|
|
14019
14073
|
|
|
14020
|
-
|
|
14021
|
-
|
|
14074
|
+
If a task cannot proceed (external dependency, missing info):
|
|
14075
|
+
- Mark as [BLOCKED] in plan.md with reason
|
|
14076
|
+
- Skip to next unblocked task
|
|
14077
|
+
- Inform user of blocker
|
|
14022
14078
|
|
|
14023
|
-
|
|
14024
|
-
|
|
14079
|
+
---
|
|
14080
|
+
|
|
14081
|
+
## DELEGATION TEMPLATES
|
|
14082
|
+
|
|
14083
|
+
### @explorer
|
|
14084
|
+
"Analyze this codebase for [purpose].
|
|
14085
|
+
Focus on: [specific areas]
|
|
14086
|
+
Return: project summary, structure, languages, frameworks, key files, relevant SME domains"
|
|
14087
|
+
|
|
14088
|
+
### @sme_*
|
|
14089
|
+
"Review for [domain] considerations:
|
|
14090
|
+
Files: [paths]
|
|
14091
|
+
Context: [what we're building]
|
|
14092
|
+
Questions:
|
|
14093
|
+
1. [specific question]
|
|
14094
|
+
2. [specific question]
|
|
14095
|
+
Constraints: Focus only on [domain], do not suggest unrelated changes"
|
|
14096
|
+
|
|
14097
|
+
### @coder
|
|
14098
|
+
"Implement ONE task:
|
|
14099
|
+
|
|
14100
|
+
TASK: [single focused task]
|
|
14101
|
+
FILE: [single path]
|
|
14102
|
+
|
|
14103
|
+
REQUIREMENTS:
|
|
14104
|
+
1. [specific requirement]
|
|
14105
|
+
|
|
14106
|
+
CONTEXT:
|
|
14107
|
+
- [from SMEs]
|
|
14108
|
+
- [from existing code]
|
|
14109
|
+
|
|
14110
|
+
DO NOT:
|
|
14111
|
+
- [constraint]
|
|
14112
|
+
|
|
14113
|
+
ACCEPTANCE CRITERIA:
|
|
14114
|
+
- [testable criterion]"
|
|
14115
|
+
|
|
14116
|
+
### @security_reviewer
|
|
14117
|
+
"Security review:
|
|
14118
|
+
FILE: [path]
|
|
14119
|
+
PURPOSE: [description]
|
|
14120
|
+
CHECK FOR: injection, data exposure, privilege issues, input validation
|
|
14121
|
+
RETURN: Risk level + specific findings with line numbers"
|
|
14122
|
+
|
|
14123
|
+
### @auditor
|
|
14124
|
+
"Verify implementation:
|
|
14125
|
+
FILE: [path]
|
|
14126
|
+
SPECIFICATION: [requirements]
|
|
14127
|
+
CHECK: correctness, edge cases, error handling, acceptance criteria
|
|
14128
|
+
RETURN: APPROVED or REJECTED with specifics"
|
|
14129
|
+
|
|
14130
|
+
### @test_engineer
|
|
14131
|
+
"Generate tests:
|
|
14132
|
+
FILE: [path]
|
|
14133
|
+
FUNCTION: [name]
|
|
14134
|
+
CASES: happy path, edge cases, error conditions
|
|
14135
|
+
OUTPUT: [test file path]"
|
|
14136
|
+
|
|
14137
|
+
---
|
|
14138
|
+
|
|
14139
|
+
## FILE STRUCTURE
|
|
14140
|
+
|
|
14141
|
+
Always maintain:
|
|
14142
|
+
\`\`\`
|
|
14143
|
+
.swarm/
|
|
14144
|
+
\u251C\u2500\u2500 plan.md # Phased tasks with status, dependencies, acceptance criteria
|
|
14145
|
+
\u251C\u2500\u2500 context.md # Project knowledge, SME cache, patterns, decisions
|
|
14146
|
+
\u2514\u2500\u2500 history/ # Archived phase summaries
|
|
14147
|
+
\u251C\u2500\u2500 phase-1.md
|
|
14148
|
+
\u2514\u2500\u2500 phase-2.md
|
|
14149
|
+
\`\`\`
|
|
14150
|
+
|
|
14151
|
+
### plan.md Format
|
|
14152
|
+
\`\`\`markdown
|
|
14153
|
+
# Project: [Name]
|
|
14154
|
+
Created: [date]
|
|
14155
|
+
Last Updated: [date]
|
|
14156
|
+
Current Phase: [N]
|
|
14157
|
+
|
|
14158
|
+
## Overview
|
|
14159
|
+
[Project summary and goals]
|
|
14160
|
+
|
|
14161
|
+
## Phase 1: [Name] [COMPLETE]
|
|
14162
|
+
- [x] Task 1.1: [description] [SMALL]
|
|
14163
|
+
- Acceptance: [criteria]
|
|
14164
|
+
|
|
14165
|
+
## Phase 2: [Name] [IN PROGRESS]
|
|
14166
|
+
- [x] Task 2.1: [description] [MEDIUM]
|
|
14167
|
+
- [ ] Task 2.2: [description] [MEDIUM] (depends: 2.1) \u2190 CURRENT
|
|
14168
|
+
- Acceptance: [criteria]
|
|
14169
|
+
- Attempt 1: REJECTED - [reason]
|
|
14170
|
+
- [ ] Task 2.3: [description] [SMALL] (depends: 2.1, 2.2)
|
|
14171
|
+
- [BLOCKED] Task 2.4: [description]
|
|
14172
|
+
- Reason: [why blocked]
|
|
14173
|
+
|
|
14174
|
+
## Phase 3: [Name] [PENDING]
|
|
14175
|
+
Estimated: [complexity]
|
|
14176
|
+
- [ ] Task 3.1: [description]
|
|
14177
|
+
\`\`\`
|
|
14178
|
+
|
|
14179
|
+
### context.md Format
|
|
14180
|
+
\`\`\`markdown
|
|
14181
|
+
# Project Context: [Name]
|
|
14182
|
+
|
|
14183
|
+
## Summary
|
|
14184
|
+
[What, who, why]
|
|
14185
|
+
|
|
14186
|
+
## Technical Decisions
|
|
14187
|
+
- Decision: [rationale]
|
|
14188
|
+
|
|
14189
|
+
## Architecture
|
|
14190
|
+
[Key patterns, organization]
|
|
14191
|
+
|
|
14192
|
+
## SME Guidance Cache
|
|
14193
|
+
### [Domain] (Phase [N])
|
|
14194
|
+
- [Guidance point]
|
|
14195
|
+
- [Guidance point]
|
|
14196
|
+
|
|
14197
|
+
## Patterns Established
|
|
14198
|
+
- [Pattern]: [where used]
|
|
14199
|
+
|
|
14200
|
+
## Known Issues / Tech Debt
|
|
14201
|
+
- [ ] [Issue]
|
|
14202
|
+
|
|
14203
|
+
## File Map
|
|
14204
|
+
- [path]: [purpose]
|
|
14205
|
+
\`\`\`
|
|
14206
|
+
|
|
14207
|
+
---
|
|
14208
|
+
|
|
14209
|
+
## RULES
|
|
14210
|
+
|
|
14211
|
+
1. **Check for .swarm/plan.md first** - Resume if exists
|
|
14212
|
+
2. **Clarify before planning** - Don't guess at ambiguous requirements
|
|
14213
|
+
3. **Plan before coding** - Never code without documented plan
|
|
14214
|
+
4. **One task at a time to @coder** - Never batch
|
|
14215
|
+
5. **QA every task immediately** - Don't accumulate issues
|
|
14216
|
+
6. **Cache SME guidance** - Check context.md before calling SMEs
|
|
14217
|
+
7. **Re-run Explorer at phase boundaries** - Codebase changes
|
|
14218
|
+
8. **Track failures** - Document rejected attempts
|
|
14219
|
+
9. **Respect dependencies** - Don't start tasks with incomplete dependencies
|
|
14220
|
+
10. **User confirms phase transitions** - Don't auto-proceed
|
|
14221
|
+
|
|
14222
|
+
---
|
|
14025
14223
|
|
|
14026
|
-
|
|
14027
|
-
- ONE agent per turn. Wait for response. Then next agent.
|
|
14028
|
-
- ONE coding task per @coder delegation. Break multi-file work into separate calls.
|
|
14029
|
-
- Every delegation must be self-contained (agent has no memory of prior context)
|
|
14030
|
-
- Include file paths, not just descriptions
|
|
14031
|
-
- Tell agents what NOT to do to prevent scope creep
|
|
14032
|
-
- Use structured formats (numbered lists, sections) not prose
|
|
14033
|
-
- If an agent's output is poor, provide clearer instructions or handle yourself
|
|
14224
|
+
## COMMUNICATION
|
|
14034
14225
|
|
|
14035
|
-
**COMMUNICATION**:
|
|
14036
14226
|
- Be direct with the user, no preamble or flattery
|
|
14037
|
-
-
|
|
14038
|
-
-
|
|
14039
|
-
-
|
|
14227
|
+
- Brief delegation notices: "Delegating to @explorer..." not lengthy explanations
|
|
14228
|
+
- Summarize phase completions clearly
|
|
14229
|
+
- Ask for confirmation at phase boundaries
|
|
14230
|
+
- If blocked, explain why and what's needed`;
|
|
14040
14231
|
function createArchitectAgent(model, customPrompt, customAppendPrompt) {
|
|
14041
14232
|
let prompt = ARCHITECT_PROMPT;
|
|
14042
14233
|
if (customPrompt) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
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",
|