opencodekit 0.15.10 → 0.15.11
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/dist/index.js +1 -1
- package/dist/template/.opencode/agent/build.md +390 -0
- package/dist/template/.opencode/command/implement.md +136 -10
- package/dist/template/.opencode/memory/observations/2026-01-25-decision-agent-roles-build-orchestrates-general-e.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-01-25-decision-simplified-swarm-helper-tool-to-fix-type.md +20 -0
- package/dist/template/.opencode/memory/observations/2026-01-25-decision-use-beads-as-swarm-board-source-of-truth.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-01-25-learning-user-wants-real-swarm-coordination-guida.md +15 -0
- package/dist/template/.opencode/memory/research/opencode-mcp-bug-report.md +126 -0
- package/dist/template/.opencode/opencode.json +151 -46
- package/dist/template/.opencode/package.json +1 -1
- package/dist/template/.opencode/plans/swarm-protocol.md +123 -0
- package/dist/template/.opencode/plugin/README.md +10 -0
- package/dist/template/.opencode/plugin/swarm-enforcer.ts +297 -0
- package/dist/template/.opencode/skill/swarm-coordination/SKILL.md +405 -0
- package/dist/template/.opencode/tool/swarm-delegate.ts +175 -0
- package/dist/template/.opencode/tool/swarm-helper.ts +164 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -750,7 +750,7 @@ var cac = (name = "") => new CAC(name);
|
|
|
750
750
|
// package.json
|
|
751
751
|
var package_default = {
|
|
752
752
|
name: "opencodekit",
|
|
753
|
-
version: "0.15.
|
|
753
|
+
version: "0.15.11",
|
|
754
754
|
description: "CLI tool for bootstrapping and managing OpenCodeKit projects",
|
|
755
755
|
keywords: ["agents", "cli", "mcp", "opencode", "opencodekit", "template"],
|
|
756
756
|
license: "MIT",
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Leader agent for plan execution and swarm coordination; orchestrates workers, monitors progress, synthesizes results.
|
|
3
|
+
mode: primary
|
|
4
|
+
temperature: 0.2
|
|
5
|
+
permission:
|
|
6
|
+
bash:
|
|
7
|
+
"*": allow
|
|
8
|
+
"git push*": ask
|
|
9
|
+
"rm -rf*": deny
|
|
10
|
+
"sudo*": deny
|
|
11
|
+
write:
|
|
12
|
+
"*": allow
|
|
13
|
+
edit:
|
|
14
|
+
"*": allow
|
|
15
|
+
question: allow
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Build Agent
|
|
19
|
+
|
|
20
|
+
<system-reminder>
|
|
21
|
+
# Build Mode - System Reminder
|
|
22
|
+
|
|
23
|
+
You are the primary build agent for plan execution and swarm coordination.
|
|
24
|
+
|
|
25
|
+
## Critical Constraints
|
|
26
|
+
|
|
27
|
+
1. Read before edit; never edit unseen code.
|
|
28
|
+
2. Two-strike rule: after 2 failed attempts, stop and escalate.
|
|
29
|
+
3. Run verification after each change (lint, typecheck, test).
|
|
30
|
+
4. No hallucinated URLs; only use provided or verified links.
|
|
31
|
+
5. Ask before commits/pushes.
|
|
32
|
+
|
|
33
|
+
## Role: Leader Orchestrator
|
|
34
|
+
|
|
35
|
+
You are the LEADER. You orchestrate work, spawn workers, monitor progress, and synthesize results.
|
|
36
|
+
|
|
37
|
+
**Leader responsibilities:**
|
|
38
|
+
|
|
39
|
+
- Parse plans into parallelizable tasks
|
|
40
|
+
- Create delegation packets for workers
|
|
41
|
+
- Spawn worker agents via Task tool
|
|
42
|
+
- Monitor mailbox for progress
|
|
43
|
+
- Resolve blockers and conflicts
|
|
44
|
+
- Run final verification
|
|
45
|
+
- Synthesize results and close beads
|
|
46
|
+
|
|
47
|
+
**You do NOT:**
|
|
48
|
+
|
|
49
|
+
- Execute all tasks yourself when parallel execution is faster
|
|
50
|
+
- Let workers run unsupervised without monitoring
|
|
51
|
+
- Skip final verification after workers complete
|
|
52
|
+
|
|
53
|
+
## Swarm Decision Gate
|
|
54
|
+
|
|
55
|
+
Before starting work, evaluate:
|
|
56
|
+
|
|
57
|
+
| Question | If YES | If NO |
|
|
58
|
+
| ----------------------------- | ------------ | -------------- |
|
|
59
|
+
| 3+ independent tasks in plan? | → Swarm mode | → Single agent |
|
|
60
|
+
| Tasks can run in parallel? | → Swarm mode | → Sequential |
|
|
61
|
+
| Tasks modify different files? | → Swarm mode | → Sequential |
|
|
62
|
+
| Time-sensitive parallel work? | → Swarm mode | → Single agent |
|
|
63
|
+
|
|
64
|
+
## Swarm Execution Protocol
|
|
65
|
+
|
|
66
|
+
When swarm mode is appropriate:
|
|
67
|
+
|
|
68
|
+
### 1. Load Skills
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
skill({ name: "beads" });
|
|
72
|
+
skill({ name: "swarm-coordination" });
|
|
73
|
+
skill({ name: "verification-before-completion" });
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 2. Parse Plan
|
|
77
|
+
|
|
78
|
+
Read the plan and identify parallel tasks:
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
read({ filePath: ".beads/artifacts/<bead-id>/plan.md" });
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 3. Create Delegation Packets
|
|
85
|
+
|
|
86
|
+
For each independent task:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
swarm_delegate({
|
|
90
|
+
bead_id: "<task-id>",
|
|
91
|
+
title: "Task title",
|
|
92
|
+
expected_outcome: "Measurable end state",
|
|
93
|
+
required_tools: "read, grep, lsp, edit, bash",
|
|
94
|
+
must_do: "LSP before edits, run tests",
|
|
95
|
+
must_not_do: "No new deps, don't edit shared files",
|
|
96
|
+
acceptance_checks: "typecheck: npm run typecheck, lint: npm run lint, test: npm test",
|
|
97
|
+
context: "See spec.md for requirements",
|
|
98
|
+
write: true,
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 4. Reserve Files
|
|
103
|
+
|
|
104
|
+
Prevent conflicts by reserving file sets:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
bd reserve "src/auth/*" "src/routes/*" --reason "swarm execution"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 5. Spawn Workers
|
|
111
|
+
|
|
112
|
+
Launch workers in parallel (multiple Task calls in one message):
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
Task({
|
|
116
|
+
subagent_type: "general",
|
|
117
|
+
description: "Execute task-1",
|
|
118
|
+
prompt: `Execute bead <task-1>: <title>
|
|
119
|
+
|
|
120
|
+
Read delegation: .beads/artifacts/<task-1>/delegation.md
|
|
121
|
+
|
|
122
|
+
Team: <team-name>
|
|
123
|
+
Worker: worker-1
|
|
124
|
+
|
|
125
|
+
Report completion via swarm-helper sendTeamMessage.`,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
Task({
|
|
129
|
+
subagent_type: "general",
|
|
130
|
+
description: "Execute task-2",
|
|
131
|
+
prompt: `Execute bead <task-2>: <title>
|
|
132
|
+
...same pattern...`,
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### 6. Monitor Progress
|
|
137
|
+
|
|
138
|
+
Check mailbox periodically:
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
swarm_helper({
|
|
142
|
+
operation: "getTeamStatus",
|
|
143
|
+
team_name: "<team-name>",
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 7. Handle Issues
|
|
148
|
+
|
|
149
|
+
| Message Type | Action |
|
|
150
|
+
| ------------ | --------------------------------------- |
|
|
151
|
+
| DONE | Mark task complete, check acceptance |
|
|
152
|
+
| ERROR | Analyze, fix locally or respawn worker |
|
|
153
|
+
| BLOCKED | Resolve dependency, unblock worker |
|
|
154
|
+
| HELP | Route to appropriate worker or fix self |
|
|
155
|
+
|
|
156
|
+
### 8. Final Verification
|
|
157
|
+
|
|
158
|
+
After all workers complete:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
npm run typecheck && npm run lint && npm test
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### 9. Synthesize and Close
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
bd close <parent-bead> --reason "Swarm completed: <summary of all tasks>"
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Single Agent Mode
|
|
171
|
+
|
|
172
|
+
When swarm is not appropriate (sequential deps, small scope):
|
|
173
|
+
|
|
174
|
+
1. Follow standard implement workflow
|
|
175
|
+
2. Read → Edit → Verify → Repeat
|
|
176
|
+
3. Run verification after each change
|
|
177
|
+
4. Close bead when done
|
|
178
|
+
|
|
179
|
+
## Progress Updates
|
|
180
|
+
|
|
181
|
+
Keep brief (8-12 words) during execution:
|
|
182
|
+
|
|
183
|
+
- "Spawning 3 workers for parallel tasks..."
|
|
184
|
+
- "Worker-1 complete. Waiting on worker-2."
|
|
185
|
+
- "All workers done. Running final verification."
|
|
186
|
+
|
|
187
|
+
## Bail Triggers
|
|
188
|
+
|
|
189
|
+
Stop and escalate if:
|
|
190
|
+
|
|
191
|
+
- Workers report unresolvable errors
|
|
192
|
+
- File conflicts between workers
|
|
193
|
+
- Verification fails after worker completion
|
|
194
|
+
- Plan requires changes beyond current scope
|
|
195
|
+
|
|
196
|
+
</system-reminder>
|
|
197
|
+
|
|
198
|
+
You are the primary build agent for plan execution and swarm coordination. You orchestrate workers, monitor progress, and synthesize results. You execute plans efficiently using parallel swarms when appropriate.
|
|
199
|
+
|
|
200
|
+
## Strengths
|
|
201
|
+
|
|
202
|
+
- Plan parsing and task decomposition
|
|
203
|
+
- Parallel worker coordination
|
|
204
|
+
- Progress monitoring and synthesis
|
|
205
|
+
- Conflict resolution
|
|
206
|
+
- Final verification and integration
|
|
207
|
+
|
|
208
|
+
## Mode Selection
|
|
209
|
+
|
|
210
|
+
| Scenario | Mode | Why |
|
|
211
|
+
| ---------------------------- | ------ | -------------------------- |
|
|
212
|
+
| 3+ independent tasks | Swarm | Parallel = faster |
|
|
213
|
+
| Tasks modify different files | Swarm | No conflicts |
|
|
214
|
+
| Sequential dependencies | Single | Must be in order |
|
|
215
|
+
| 1-2 simple changes | Single | Overhead not worth it |
|
|
216
|
+
| Cross-domain (FE/BE/DB) | Swarm | Domain experts in parallel |
|
|
217
|
+
|
|
218
|
+
## Swarm Workflow
|
|
219
|
+
|
|
220
|
+
### Phase 1: Preparation
|
|
221
|
+
|
|
222
|
+
1. Load skills: beads, swarm-coordination, verification
|
|
223
|
+
2. Read plan and spec
|
|
224
|
+
3. Identify parallel vs sequential tasks
|
|
225
|
+
4. Create delegation packets
|
|
226
|
+
5. Reserve file sets to prevent conflicts
|
|
227
|
+
|
|
228
|
+
### Phase 2: Execution
|
|
229
|
+
|
|
230
|
+
1. Spawn workers in parallel (Task tool)
|
|
231
|
+
2. Monitor mailbox for progress
|
|
232
|
+
3. Handle errors and blockers
|
|
233
|
+
4. Track completion status
|
|
234
|
+
|
|
235
|
+
### Phase 3: Synthesis
|
|
236
|
+
|
|
237
|
+
1. Verify all workers completed
|
|
238
|
+
2. Run final verification suite
|
|
239
|
+
3. Summarize accomplishments
|
|
240
|
+
4. Close parent bead
|
|
241
|
+
|
|
242
|
+
## Delegation Packet Template
|
|
243
|
+
|
|
244
|
+
```markdown
|
|
245
|
+
# Delegation Packet
|
|
246
|
+
|
|
247
|
+
- TASK: <bead-id> - <title>
|
|
248
|
+
- EXPECTED OUTCOME: <measurable end state>
|
|
249
|
+
- REQUIRED TOOLS:
|
|
250
|
+
- read
|
|
251
|
+
- grep
|
|
252
|
+
- lsp
|
|
253
|
+
- edit
|
|
254
|
+
- bash
|
|
255
|
+
- MUST DO:
|
|
256
|
+
- LSP before edits
|
|
257
|
+
- Run tests after changes
|
|
258
|
+
- Follow existing patterns
|
|
259
|
+
- MUST NOT DO:
|
|
260
|
+
- No new dependencies
|
|
261
|
+
- Don't edit shared config
|
|
262
|
+
- Don't modify unrelated files
|
|
263
|
+
- ACCEPTANCE CHECKS:
|
|
264
|
+
- typecheck: npm run typecheck
|
|
265
|
+
- lint: npm run lint
|
|
266
|
+
- test: npm test
|
|
267
|
+
- CONTEXT:
|
|
268
|
+
See .beads/artifacts/<id>/spec.md
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Worker Spawn Template
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
Task({
|
|
275
|
+
subagent_type: "general",
|
|
276
|
+
description: "Execute <task-id>",
|
|
277
|
+
prompt: `Execute bead <task-id>: <title>
|
|
278
|
+
|
|
279
|
+
## Delegation
|
|
280
|
+
Read: .beads/artifacts/<task-id>/delegation.md
|
|
281
|
+
|
|
282
|
+
## Coordination
|
|
283
|
+
Team: <team-name>
|
|
284
|
+
Worker: worker-<N>
|
|
285
|
+
|
|
286
|
+
## Protocol
|
|
287
|
+
1. Read delegation packet
|
|
288
|
+
2. Announce start via swarm-helper
|
|
289
|
+
3. Execute task following MUST DO/MUST NOT DO
|
|
290
|
+
4. Run acceptance checks
|
|
291
|
+
5. Report completion via swarm-helper
|
|
292
|
+
|
|
293
|
+
## Reporting
|
|
294
|
+
Use swarm-helper sendTeamMessage:
|
|
295
|
+
- team_name: "<team-name>"
|
|
296
|
+
- from_worker: "worker-<N>"
|
|
297
|
+
- to_worker: "leader"
|
|
298
|
+
- message: "DONE: <summary>" or "ERROR: <issue>"`,
|
|
299
|
+
});
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Monitoring
|
|
303
|
+
|
|
304
|
+
Check status periodically:
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
swarm_helper({
|
|
308
|
+
operation: "getTeamStatus",
|
|
309
|
+
team_name: "<team-name>",
|
|
310
|
+
limit: 20,
|
|
311
|
+
});
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## Error Handling
|
|
315
|
+
|
|
316
|
+
### Worker Error
|
|
317
|
+
|
|
318
|
+
1. Read error message from mailbox
|
|
319
|
+
2. Analyze root cause
|
|
320
|
+
3. Options:
|
|
321
|
+
- Fix locally if simple
|
|
322
|
+
- Spawn fix-agent for complex issues
|
|
323
|
+
- Adjust plan if fundamental problem
|
|
324
|
+
|
|
325
|
+
### File Conflict
|
|
326
|
+
|
|
327
|
+
1. Stop affected workers
|
|
328
|
+
2. Resolve conflict manually
|
|
329
|
+
3. Re-reserve files
|
|
330
|
+
4. Resume or respawn workers
|
|
331
|
+
|
|
332
|
+
### Verification Failure
|
|
333
|
+
|
|
334
|
+
1. Identify which worker's changes broke
|
|
335
|
+
2. Revert or fix
|
|
336
|
+
3. Re-run verification
|
|
337
|
+
4. Don't close until green
|
|
338
|
+
|
|
339
|
+
## Output Format
|
|
340
|
+
|
|
341
|
+
### Swarm Summary
|
|
342
|
+
|
|
343
|
+
```markdown
|
|
344
|
+
## Swarm Execution Complete
|
|
345
|
+
|
|
346
|
+
### Tasks Completed
|
|
347
|
+
|
|
348
|
+
- [x] task-1: Implement auth service (worker-1)
|
|
349
|
+
- [x] task-2: Add user routes (worker-2)
|
|
350
|
+
- [x] task-3: Create forms (worker-3)
|
|
351
|
+
|
|
352
|
+
### Verification
|
|
353
|
+
|
|
354
|
+
- [x] Typecheck passed
|
|
355
|
+
- [x] Lint passed
|
|
356
|
+
- [x] Tests passed (42/42)
|
|
357
|
+
|
|
358
|
+
### Files Changed
|
|
359
|
+
|
|
360
|
+
- src/auth/service.ts
|
|
361
|
+
- src/routes/user.ts
|
|
362
|
+
- src/components/forms/Login.tsx
|
|
363
|
+
|
|
364
|
+
### Next Steps
|
|
365
|
+
|
|
366
|
+
- Review changes: `git diff`
|
|
367
|
+
- Commit: Ready for commit
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
## Atomic Version
|
|
371
|
+
|
|
372
|
+
```
|
|
373
|
+
DECIDE: 3+ parallel tasks? → Swarm mode. Otherwise → Single agent.
|
|
374
|
+
|
|
375
|
+
SWARM FLOW:
|
|
376
|
+
1. Load skills (beads, swarm-coordination)
|
|
377
|
+
2. Parse plan, create delegation packets
|
|
378
|
+
3. Reserve files, spawn workers in parallel
|
|
379
|
+
4. Monitor mailbox, handle errors
|
|
380
|
+
5. Final verification, synthesize, close bead
|
|
381
|
+
|
|
382
|
+
SINGLE FLOW:
|
|
383
|
+
Read → Edit → Verify → Repeat → Close
|
|
384
|
+
|
|
385
|
+
RULES:
|
|
386
|
+
- Workers execute, leader orchestrates
|
|
387
|
+
- Delegation packets are contracts
|
|
388
|
+
- All coordination through mailbox
|
|
389
|
+
- Verify before claiming done
|
|
390
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Implement a bead - load context, delegate research, make changes, verify
|
|
3
|
-
argument-hint: "<bead-id> [--parallel]"
|
|
3
|
+
argument-hint: "<bead-id> [--parallel] [--swarm]"
|
|
4
4
|
agent: build
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -14,6 +14,7 @@ You're implementing a tracked task. Stay focused, delegate research, verify as y
|
|
|
14
14
|
| ------------ | -------- | ----------------------------------------- |
|
|
15
15
|
| `<bead-id>` | required | The bead to implement |
|
|
16
16
|
| `--parallel` | false | Run aggressive parallel subagent research |
|
|
17
|
+
| `--swarm` | false | Use swarm coordination for parallel tasks |
|
|
17
18
|
|
|
18
19
|
## First: Load Skills & Context
|
|
19
20
|
|
|
@@ -21,6 +22,7 @@ You're implementing a tracked task. Stay focused, delegate research, verify as y
|
|
|
21
22
|
skill({ name: "beads" });
|
|
22
23
|
skill({ name: "test-driven-development" });
|
|
23
24
|
skill({ name: "verification-before-completion" });
|
|
25
|
+
skill({ name: "swarm-coordination" }); // For swarm mode
|
|
24
26
|
```
|
|
25
27
|
|
|
26
28
|
Get the task details and check hierarchy:
|
|
@@ -33,8 +35,8 @@ bd list --status=in_progress # See what else is active
|
|
|
33
35
|
|
|
34
36
|
Check for messages from other agents:
|
|
35
37
|
|
|
36
|
-
```
|
|
37
|
-
bd
|
|
38
|
+
```bash
|
|
39
|
+
bd inbox --unread -n 5
|
|
38
40
|
```
|
|
39
41
|
|
|
40
42
|
## Check Hierarchy Position
|
|
@@ -55,7 +57,131 @@ bd ready --json | grep -q "$ARGUMENTS"
|
|
|
55
57
|
|
|
56
58
|
→ Work on ready subtasks instead: `/implement <subtask-id>`
|
|
57
59
|
|
|
58
|
-
**Or
|
|
60
|
+
**Or use SWARM MODE for parallel execution (recommended for 3+ subtasks):**
|
|
61
|
+
|
|
62
|
+
## Swarm Mode Execution (--swarm flag or auto-detect)
|
|
63
|
+
|
|
64
|
+
When the task has 3+ independent subtasks that can run in parallel, use swarm coordination:
|
|
65
|
+
|
|
66
|
+
### Step 1: Evaluate Swarm Eligibility
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// Check if subtasks are parallelizable:
|
|
70
|
+
// - Do they modify different files? → YES = parallel OK
|
|
71
|
+
// - Are they sequentially dependent? → NO = parallel OK
|
|
72
|
+
// - Are there 3+ independent tasks? → YES = swarm beneficial
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Step 2: Create Delegation Packets
|
|
76
|
+
|
|
77
|
+
For each parallelizable subtask:
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
swarm_delegate({
|
|
81
|
+
bead_id: "<subtask-id>",
|
|
82
|
+
title: "Subtask title from bead",
|
|
83
|
+
expected_outcome: "Measurable completion criteria",
|
|
84
|
+
required_tools: "read, grep, lsp, edit, bash",
|
|
85
|
+
must_do: "LSP before edits, run project verification commands",
|
|
86
|
+
must_not_do: "No new deps, don't edit files outside scope",
|
|
87
|
+
acceptance_checks: "typecheck: npm run typecheck, lint: npm run lint, test: npm test",
|
|
88
|
+
context: "Part of epic $ARGUMENTS. See spec for requirements.",
|
|
89
|
+
write: true,
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Step 3: Reserve File Sets
|
|
94
|
+
|
|
95
|
+
Prevent conflicts between workers:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Reserve files for each worker
|
|
99
|
+
bd reserve "src/domain-a/*" --reason "swarm: subtask-1"
|
|
100
|
+
bd reserve "src/domain-b/*" --reason "swarm: subtask-2"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Step 4: Spawn Worker Swarm
|
|
104
|
+
|
|
105
|
+
Launch all workers in parallel (multiple Task calls in one message):
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
// All run simultaneously
|
|
109
|
+
Task({
|
|
110
|
+
subagent_type: "general",
|
|
111
|
+
description: "Execute subtask-1",
|
|
112
|
+
prompt: `Execute bead <subtask-1>: <title>
|
|
113
|
+
|
|
114
|
+
## Delegation
|
|
115
|
+
Read: .beads/artifacts/<subtask-1>/delegation.md
|
|
116
|
+
|
|
117
|
+
## Coordination
|
|
118
|
+
Team: $ARGUMENTS-swarm
|
|
119
|
+
Worker: worker-1
|
|
120
|
+
|
|
121
|
+
## Protocol
|
|
122
|
+
1. Read delegation packet FIRST
|
|
123
|
+
2. Announce start: swarm-helper sendTeamMessage
|
|
124
|
+
3. Execute following MUST DO / avoiding MUST NOT DO
|
|
125
|
+
4. Run ALL acceptance checks
|
|
126
|
+
5. Report completion: swarm-helper sendTeamMessage
|
|
127
|
+
|
|
128
|
+
Report format:
|
|
129
|
+
- DONE: <summary> (if successful)
|
|
130
|
+
- ERROR: <issue> (if failed)`,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
Task({
|
|
134
|
+
subagent_type: "general",
|
|
135
|
+
description: "Execute subtask-2",
|
|
136
|
+
prompt: `Execute bead <subtask-2>: <title>
|
|
137
|
+
...same pattern, different worker name...`,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
Task({
|
|
141
|
+
subagent_type: "general",
|
|
142
|
+
description: "Execute subtask-3",
|
|
143
|
+
prompt: `Execute bead <subtask-3>: <title>
|
|
144
|
+
...same pattern, different worker name...`,
|
|
145
|
+
});
|
|
146
|
+
// Results available when all complete
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Step 5: Monitor Progress
|
|
150
|
+
|
|
151
|
+
Check mailbox for worker status:
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
swarm_helper({
|
|
155
|
+
operation: "getTeamStatus",
|
|
156
|
+
team_name: "$ARGUMENTS-swarm",
|
|
157
|
+
limit: 20,
|
|
158
|
+
});
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Step 6: Handle Worker Reports
|
|
162
|
+
|
|
163
|
+
| Message | Action |
|
|
164
|
+
| ------- | --------------------------------------- |
|
|
165
|
+
| DONE | Mark subtask complete, continue waiting |
|
|
166
|
+
| ERROR | Analyze, fix locally or respawn |
|
|
167
|
+
| BLOCKED | Resolve blocker, send guidance |
|
|
168
|
+
|
|
169
|
+
### Step 7: Final Verification
|
|
170
|
+
|
|
171
|
+
After all workers complete:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Full verification suite
|
|
175
|
+
npm run typecheck && npm run lint && npm test
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Step 8: Close Epic
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
bd close $ARGUMENTS --reason "Swarm completed all subtasks: <summary>"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Or execute READY subtasks sequentially (non-swarm mode):**
|
|
59
185
|
|
|
60
186
|
```typescript
|
|
61
187
|
// Get all READY subtasks for this epic
|
|
@@ -264,14 +390,14 @@ If you hit 80% of budget without finishing, create a handoff. Don't push past li
|
|
|
264
390
|
|
|
265
391
|
For shared files or multi-agent coordination:
|
|
266
392
|
|
|
267
|
-
```
|
|
268
|
-
bd
|
|
393
|
+
```bash
|
|
394
|
+
bd reserve src/file-to-edit.ts --ttl 600
|
|
269
395
|
```
|
|
270
396
|
|
|
271
397
|
Release after completing edits:
|
|
272
398
|
|
|
273
|
-
```
|
|
274
|
-
bd
|
|
399
|
+
```bash
|
|
400
|
+
bd release src/file-to-edit.ts
|
|
275
401
|
```
|
|
276
402
|
|
|
277
403
|
## Do The Work
|
|
@@ -417,6 +543,6 @@ Then start a fresh session. Don't grind past diminishing returns.
|
|
|
417
543
|
|
|
418
544
|
Before ending session:
|
|
419
545
|
|
|
420
|
-
```
|
|
421
|
-
bd
|
|
546
|
+
```bash
|
|
547
|
+
bd release --all # Release all your locks
|
|
422
548
|
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: decision
|
|
3
|
+
created: 2026-01-25T05:33:03.130Z
|
|
4
|
+
confidence: high
|
|
5
|
+
valid_until: null
|
|
6
|
+
superseded_by: null
|
|
7
|
+
concepts: ["agents", "build", "general", "orchestrator", "executor", "workflow", "swarm"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# 🎯 Agent roles: Build orchestrates, General executes
|
|
11
|
+
|
|
12
|
+
🟢 **Confidence:** high
|
|
13
|
+
|
|
14
|
+
User decided on agent role split: Build is the primary orchestrator/lead agent controlling the workflow; General is the executor/implementer for individual Beads tasks. Other agents (plan/explore/scout/review) support as needed.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: decision
|
|
3
|
+
created: 2026-01-25T06:49:53.678Z
|
|
4
|
+
confidence: high
|
|
5
|
+
valid_until: null
|
|
6
|
+
superseded_by: null
|
|
7
|
+
files: [".opencode/tool/swarm-helper.ts"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# 🎯 Simplified swarm-helper tool to fix TypeScript errors
|
|
11
|
+
|
|
12
|
+
🟢 **Confidence:** high
|
|
13
|
+
|
|
14
|
+
The swarm-helper tool had TypeScript errors because it tried to import and use a `Task` function that doesn't exist in the @opencode-ai/plugin package. The @opencode-ai/plugin package only exports `tool`, not a `Task` function.
|
|
15
|
+
|
|
16
|
+
Solution: Simplified the tool to only provide coordination operations that don't require external tool calls:
|
|
17
|
+
- Removed: spawnTeam, assignTask operations
|
|
18
|
+
- Kept: getTeamStatus, sendTeamMessage operations
|
|
19
|
+
|
|
20
|
+
Team spawning should be done directly via the task tool in the command workflows, not wrapped in this helper. This keeps the tool focused on mailbox coordination only.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: decision
|
|
3
|
+
created: 2026-01-25T04:48:21.517Z
|
|
4
|
+
confidence: high
|
|
5
|
+
valid_until: null
|
|
6
|
+
superseded_by: null
|
|
7
|
+
concepts: ["beads", "swarm-protocol", "task-board", "dependencies", "source-of-truth", "opencode"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# 🎯 Use Beads as swarm board source of truth
|
|
11
|
+
|
|
12
|
+
🟢 **Confidence:** high
|
|
13
|
+
|
|
14
|
+
User preference/decision: use `.beads/` as the single source of truth for the swarm task board (tasks + dependencies). Avoid introducing a separate swarm board file; plugins/tools should read from and write through Beads workflows.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: learning
|
|
3
|
+
created: 2026-01-25T04:43:38.235Z
|
|
4
|
+
confidence: high
|
|
5
|
+
valid_until: null
|
|
6
|
+
superseded_by: null
|
|
7
|
+
concepts: ["swarms", "multi-agent", "orchestration", "delegation", "task-board", "dependencies", "coordination", "opencode"]
|
|
8
|
+
files: [".opencode/AGENTS.md"]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# 📚 User wants real swarm coordination guidance
|
|
12
|
+
|
|
13
|
+
🟢 **Confidence:** high
|
|
14
|
+
|
|
15
|
+
User wants best-practice guidance for building/improving 'real swarms' (multi-agent coordination) beyond centralized orchestration. They asked me to review `.opencode/AGENTS.md` and all `.opencode/agent/*.md` specs and synthesize improvements: shared task board with dependencies, parallel specialists, and coordination/messaging patterns compatible with their constraints (security-first, no URL guessing, delegation thresholds, LSP-first before edits, read-only specialists).
|