opencode-swarm-plugin 0.12.30 → 0.13.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/.beads/issues.jsonl +204 -10
- package/.opencode/skills/tdd/SKILL.md +182 -0
- package/README.md +165 -17
- package/bin/swarm.ts +120 -31
- package/bun.lock +23 -0
- package/dist/index.js +4020 -438
- package/dist/pglite.data +0 -0
- package/dist/pglite.wasm +0 -0
- package/dist/plugin.js +4008 -514
- package/examples/commands/swarm.md +114 -19
- package/examples/skills/beads-workflow/SKILL.md +75 -28
- package/examples/skills/swarm-coordination/SKILL.md +92 -1
- package/global-skills/testing-patterns/SKILL.md +430 -0
- package/global-skills/testing-patterns/references/dependency-breaking-catalog.md +586 -0
- package/package.json +11 -5
- package/src/index.ts +44 -5
- package/src/streams/agent-mail.test.ts +777 -0
- package/src/streams/agent-mail.ts +535 -0
- package/src/streams/debug.test.ts +500 -0
- package/src/streams/debug.ts +629 -0
- package/src/streams/effect/ask.integration.test.ts +314 -0
- package/src/streams/effect/ask.ts +202 -0
- package/src/streams/effect/cursor.integration.test.ts +418 -0
- package/src/streams/effect/cursor.ts +288 -0
- package/src/streams/effect/deferred.test.ts +357 -0
- package/src/streams/effect/deferred.ts +445 -0
- package/src/streams/effect/index.ts +17 -0
- package/src/streams/effect/layers.ts +73 -0
- package/src/streams/effect/lock.test.ts +385 -0
- package/src/streams/effect/lock.ts +399 -0
- package/src/streams/effect/mailbox.test.ts +260 -0
- package/src/streams/effect/mailbox.ts +318 -0
- package/src/streams/events.test.ts +628 -0
- package/src/streams/events.ts +214 -0
- package/src/streams/index.test.ts +229 -0
- package/src/streams/index.ts +492 -0
- package/src/streams/migrations.test.ts +355 -0
- package/src/streams/migrations.ts +269 -0
- package/src/streams/projections.test.ts +611 -0
- package/src/streams/projections.ts +302 -0
- package/src/streams/store.integration.test.ts +548 -0
- package/src/streams/store.ts +546 -0
- package/src/streams/swarm-mail.ts +552 -0
- package/src/swarm-mail.integration.test.ts +970 -0
- package/src/swarm-mail.ts +739 -0
- package/src/swarm.ts +84 -59
- package/src/tool-availability.ts +35 -2
- package/global-skills/mcp-tool-authoring/SKILL.md +0 -695
|
@@ -23,20 +23,61 @@ $ARGUMENTS
|
|
|
23
23
|
agentmail_init(project_path="$PWD", task_description="Swarm: <task summary>")
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
### 2.
|
|
26
|
+
### 2. Knowledge Gathering (MANDATORY)
|
|
27
|
+
|
|
28
|
+
**Before decomposing, query ALL knowledge sources:**
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
# Past learnings from this project
|
|
32
|
+
semantic-memory_find(query="<task keywords>", limit=5)
|
|
33
|
+
|
|
34
|
+
# How similar tasks were solved before
|
|
35
|
+
cass_search(query="<task description>", limit=5)
|
|
36
|
+
|
|
37
|
+
# Design patterns and prior art
|
|
38
|
+
pdf-brain_search(query="<domain concepts>", limit=5)
|
|
39
|
+
|
|
40
|
+
# Available skills to inject into workers
|
|
41
|
+
skills_list()
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Load coordinator skills based on task type:**
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
# For swarm coordination (ALWAYS load this)
|
|
48
|
+
skills_use(name="swarm-coordination")
|
|
49
|
+
|
|
50
|
+
# For architectural decisions
|
|
51
|
+
skills_use(name="system-design")
|
|
52
|
+
|
|
53
|
+
# If task involves testing
|
|
54
|
+
skills_use(name="testing-patterns")
|
|
55
|
+
|
|
56
|
+
# If building CLI tools
|
|
57
|
+
skills_use(name="cli-builder")
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Synthesize findings into shared context for workers. Note:
|
|
61
|
+
|
|
62
|
+
- Relevant patterns from pdf-brain
|
|
63
|
+
- Similar past approaches from CASS
|
|
64
|
+
- Project-specific learnings from semantic-memory
|
|
65
|
+
- **Skills to recommend for each subtask** (critical for worker effectiveness)
|
|
66
|
+
|
|
67
|
+
### 3. Create Feature Branch (unless --to-main)
|
|
27
68
|
|
|
28
69
|
```bash
|
|
29
70
|
git checkout -b swarm/<short-task-name>
|
|
30
71
|
git push -u origin HEAD
|
|
31
72
|
```
|
|
32
73
|
|
|
33
|
-
###
|
|
74
|
+
### 4. Decompose Task
|
|
34
75
|
|
|
35
76
|
Use strategy selection and planning:
|
|
36
77
|
|
|
37
78
|
```
|
|
38
79
|
swarm_select_strategy(task="<the task>")
|
|
39
|
-
swarm_plan_prompt(task="<the task>", strategy="<auto or selected>")
|
|
80
|
+
swarm_plan_prompt(task="<the task>", strategy="<auto or selected>", context="<synthesized knowledge>")
|
|
40
81
|
```
|
|
41
82
|
|
|
42
83
|
Follow the prompt to create a BeadTree, then validate:
|
|
@@ -45,7 +86,7 @@ Follow the prompt to create a BeadTree, then validate:
|
|
|
45
86
|
swarm_validate_decomposition(response="<your BeadTree JSON>")
|
|
46
87
|
```
|
|
47
88
|
|
|
48
|
-
###
|
|
89
|
+
### 5. Create Beads
|
|
49
90
|
|
|
50
91
|
```
|
|
51
92
|
beads_create_epic(epic_title="<task>", subtasks=[{title, files, priority}...])
|
|
@@ -56,8 +97,9 @@ Rules:
|
|
|
56
97
|
- Each bead completable by one agent
|
|
57
98
|
- Independent where possible (parallelizable)
|
|
58
99
|
- 3-7 beads per swarm
|
|
100
|
+
- No file overlap between subtasks
|
|
59
101
|
|
|
60
|
-
###
|
|
102
|
+
### 6. Reserve Files
|
|
61
103
|
|
|
62
104
|
```
|
|
63
105
|
agentmail_reserve(paths=[<files>], reason="<bead-id>: <description>")
|
|
@@ -65,43 +107,71 @@ agentmail_reserve(paths=[<files>], reason="<bead-id>: <description>")
|
|
|
65
107
|
|
|
66
108
|
No two agents should edit the same file.
|
|
67
109
|
|
|
68
|
-
###
|
|
110
|
+
### 7. Spawn Agents
|
|
69
111
|
|
|
70
112
|
**CRITICAL: Spawn ALL in a SINGLE message with multiple Task calls.**
|
|
71
113
|
|
|
72
114
|
For each subtask:
|
|
73
115
|
|
|
74
116
|
```
|
|
75
|
-
swarm_spawn_subtask(
|
|
117
|
+
swarm_spawn_subtask(
|
|
118
|
+
bead_id="<id>",
|
|
119
|
+
epic_id="<epic>",
|
|
120
|
+
subtask_title="<title>",
|
|
121
|
+
files=[...],
|
|
122
|
+
shared_context="<synthesized knowledge from step 2>"
|
|
123
|
+
)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Include skill recommendations in shared_context:**
|
|
127
|
+
|
|
128
|
+
```markdown
|
|
129
|
+
## Recommended Skills
|
|
130
|
+
|
|
131
|
+
Load these skills before starting work:
|
|
132
|
+
|
|
133
|
+
- skills_use(name="testing-patterns") - if adding tests or breaking dependencies
|
|
134
|
+
- skills_use(name="swarm-coordination") - if coordinating with other agents
|
|
135
|
+
- skills_use(name="system-design") - if making architectural decisions
|
|
136
|
+
- skills_use(name="cli-builder") - if working on CLI components
|
|
137
|
+
|
|
138
|
+
See full skill list with skills_list().
|
|
76
139
|
```
|
|
77
140
|
|
|
78
141
|
Then spawn:
|
|
79
142
|
|
|
80
143
|
```
|
|
81
|
-
Task(subagent_type="swarm
|
|
144
|
+
Task(subagent_type="swarm/worker", description="<bead-title>", prompt="<from swarm_spawn_subtask>")
|
|
82
145
|
```
|
|
83
146
|
|
|
84
|
-
###
|
|
147
|
+
### 8. Monitor (unless --no-sync)
|
|
85
148
|
|
|
86
149
|
```
|
|
87
|
-
swarm_status(epic_id="<epic-id>")
|
|
150
|
+
swarm_status(epic_id="<epic-id>", project_key="$PWD")
|
|
88
151
|
agentmail_inbox()
|
|
89
152
|
```
|
|
90
153
|
|
|
154
|
+
**Intervention triggers:**
|
|
155
|
+
|
|
156
|
+
- Worker blocked >5 min → Check inbox, offer guidance
|
|
157
|
+
- File conflict → Mediate, reassign files
|
|
158
|
+
- Worker asking questions → Answer directly
|
|
159
|
+
- Scope creep → Redirect, create new bead for extras
|
|
160
|
+
|
|
91
161
|
If incompatibilities spotted, broadcast:
|
|
92
162
|
|
|
93
163
|
```
|
|
94
164
|
agentmail_send(to=["*"], subject="Coordinator Update", body="<guidance>", importance="high")
|
|
95
165
|
```
|
|
96
166
|
|
|
97
|
-
###
|
|
167
|
+
### 9. Complete
|
|
98
168
|
|
|
99
169
|
```
|
|
100
170
|
swarm_complete(project_key="$PWD", agent_name="<your-name>", bead_id="<epic-id>", summary="<done>", files_touched=[...])
|
|
101
171
|
beads_sync()
|
|
102
172
|
```
|
|
103
173
|
|
|
104
|
-
###
|
|
174
|
+
### 10. Create PR (unless --to-main)
|
|
105
175
|
|
|
106
176
|
```bash
|
|
107
177
|
gh pr create --title "feat: <epic title>" --body "## Summary\n<bullets>\n\n## Beads\n<list>"
|
|
@@ -109,10 +179,35 @@ gh pr create --title "feat: <epic title>" --body "## Summary\n<bullets>\n\n## Be
|
|
|
109
179
|
|
|
110
180
|
## Strategy Reference
|
|
111
181
|
|
|
112
|
-
| Strategy
|
|
113
|
-
|
|
|
114
|
-
| file-based
|
|
115
|
-
| feature-based
|
|
116
|
-
| risk-based
|
|
117
|
-
|
|
118
|
-
|
|
182
|
+
| Strategy | Best For | Keywords | Recommended Skills |
|
|
183
|
+
| -------------- | ------------------------ | ------------------------------------- | --------------------------------- |
|
|
184
|
+
| file-based | Refactoring, migrations | refactor, migrate, rename, update all | system-design, testing-patterns |
|
|
185
|
+
| feature-based | New features | add, implement, build, create, new | system-design, swarm-coordination |
|
|
186
|
+
| risk-based | Bug fixes, security | fix, bug, security, critical, urgent | testing-patterns |
|
|
187
|
+
| research-based | Investigation, discovery | research, investigate, explore, learn | system-design |
|
|
188
|
+
|
|
189
|
+
## Skill Triggers (Auto-load based on task type)
|
|
190
|
+
|
|
191
|
+
**Task Analysis** → Recommend these skills in shared_context:
|
|
192
|
+
|
|
193
|
+
| Task Pattern | Skills to Load |
|
|
194
|
+
| ---------------------- | ------------------------------------------------------- |
|
|
195
|
+
| Contains "test" | `skills_use(name="testing-patterns")` |
|
|
196
|
+
| Contains "refactor" | `skills_use(name="testing-patterns")` + `system-design` |
|
|
197
|
+
| Contains "CLI" | `skills_use(name="cli-builder")` |
|
|
198
|
+
| Multi-agent work | `skills_use(name="swarm-coordination")` |
|
|
199
|
+
| Architecture decisions | `skills_use(name="system-design")` |
|
|
200
|
+
| Breaking dependencies | `skills_use(name="testing-patterns")` |
|
|
201
|
+
|
|
202
|
+
## Quick Checklist
|
|
203
|
+
|
|
204
|
+
- [ ] Knowledge gathered (semantic-memory, CASS, pdf-brain, skills)
|
|
205
|
+
- [ ] Strategy selected
|
|
206
|
+
- [ ] BeadTree validated (no file conflicts)
|
|
207
|
+
- [ ] Epic + subtasks created
|
|
208
|
+
- [ ] Files reserved
|
|
209
|
+
- [ ] Workers spawned in parallel
|
|
210
|
+
- [ ] Progress monitored
|
|
211
|
+
- [ ] PR created (or pushed to main)
|
|
212
|
+
|
|
213
|
+
Begin with knowledge gathering now.
|
|
@@ -11,60 +11,78 @@ tools:
|
|
|
11
11
|
- beads_query
|
|
12
12
|
- beads_update
|
|
13
13
|
- beads_close
|
|
14
|
+
- beads_create_epic
|
|
15
|
+
- beads_sync
|
|
16
|
+
related_skills:
|
|
17
|
+
- swarm-coordination
|
|
14
18
|
---
|
|
15
19
|
|
|
16
20
|
# Beads Workflow Skill
|
|
17
21
|
|
|
18
22
|
Beads is a local-first issue tracking system designed for AI agents. This skill provides best practices for effective bead management.
|
|
19
23
|
|
|
24
|
+
**NOTE:** For swarm workflows, combine this skill with `swarm-coordination` from global-skills/.
|
|
25
|
+
|
|
20
26
|
## Bead Types
|
|
21
27
|
|
|
22
|
-
| Type
|
|
23
|
-
|
|
24
|
-
| `bug`
|
|
25
|
-
| `feature` | New functionality to add
|
|
26
|
-
| `task`
|
|
27
|
-
| `chore`
|
|
28
|
-
| `epic`
|
|
28
|
+
| Type | When to Use |
|
|
29
|
+
| --------- | --------------------------------------- |
|
|
30
|
+
| `bug` | Something is broken and needs fixing |
|
|
31
|
+
| `feature` | New functionality to add |
|
|
32
|
+
| `task` | General work item |
|
|
33
|
+
| `chore` | Maintenance, refactoring, dependencies |
|
|
34
|
+
| `epic` | Large initiative with multiple subtasks |
|
|
29
35
|
|
|
30
36
|
## Creating Effective Beads
|
|
31
37
|
|
|
32
38
|
### Good Bead Titles
|
|
39
|
+
|
|
40
|
+
```text
|
|
33
41
|
- "Fix null pointer exception in UserService.getProfile()"
|
|
34
42
|
- "Add dark mode toggle to settings page"
|
|
35
43
|
- "Migrate auth tokens from localStorage to httpOnly cookies"
|
|
44
|
+
```
|
|
36
45
|
|
|
37
46
|
### Bad Bead Titles
|
|
47
|
+
|
|
48
|
+
```text
|
|
38
49
|
- "Fix bug" (too vague)
|
|
39
50
|
- "Make it better" (not actionable)
|
|
40
51
|
- "stuff" (meaningless)
|
|
52
|
+
```
|
|
41
53
|
|
|
42
54
|
### Bead Body Structure
|
|
43
55
|
|
|
44
56
|
```markdown
|
|
45
57
|
## Problem
|
|
58
|
+
|
|
46
59
|
[Clear description of the issue or need]
|
|
47
60
|
|
|
48
61
|
## Expected Behavior
|
|
62
|
+
|
|
49
63
|
[What should happen]
|
|
50
64
|
|
|
51
65
|
## Current Behavior
|
|
66
|
+
|
|
52
67
|
[What currently happens, for bugs]
|
|
53
68
|
|
|
54
69
|
## Proposed Solution
|
|
70
|
+
|
|
55
71
|
[How to fix/implement, if known]
|
|
56
72
|
|
|
57
73
|
## Acceptance Criteria
|
|
74
|
+
|
|
58
75
|
- [ ] Criterion 1
|
|
59
76
|
- [ ] Criterion 2
|
|
60
77
|
|
|
61
78
|
## Notes
|
|
79
|
+
|
|
62
80
|
[Any additional context, links, or constraints]
|
|
63
81
|
```
|
|
64
82
|
|
|
65
83
|
## Workflow States
|
|
66
84
|
|
|
67
|
-
```
|
|
85
|
+
```text
|
|
68
86
|
open → in_progress → closed
|
|
69
87
|
↓
|
|
70
88
|
blocked (optional)
|
|
@@ -72,38 +90,47 @@ open → in_progress → closed
|
|
|
72
90
|
|
|
73
91
|
### State Transitions
|
|
74
92
|
|
|
75
|
-
|
|
76
|
-
|
|
93
|
+
### Open → In Progress
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
77
96
|
beads_update(id: "abc123", state: "in_progress")
|
|
78
97
|
```
|
|
98
|
+
|
|
79
99
|
Use when you start working on a bead.
|
|
80
100
|
|
|
81
|
-
|
|
82
|
-
|
|
101
|
+
### In Progress → Closed
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
83
104
|
beads_close(id: "abc123", resolution: "Fixed in commit abc1234")
|
|
84
105
|
```
|
|
106
|
+
|
|
85
107
|
Use when work is complete.
|
|
86
108
|
|
|
87
|
-
|
|
88
|
-
|
|
109
|
+
### In Progress → Blocked
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
89
112
|
beads_update(id: "abc123", state: "blocked", body: "Blocked by #xyz789")
|
|
90
113
|
```
|
|
114
|
+
|
|
91
115
|
Use when you can't proceed due to a dependency.
|
|
92
116
|
|
|
93
117
|
## Querying Beads
|
|
94
118
|
|
|
95
119
|
### Find Open Work
|
|
96
|
-
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
97
122
|
beads_query(state: "open", type: "bug")
|
|
98
123
|
```
|
|
99
124
|
|
|
100
125
|
### Search by Keywords
|
|
101
|
-
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
102
128
|
beads_query(search: "authentication")
|
|
103
129
|
```
|
|
104
130
|
|
|
105
131
|
### List Recent Activity
|
|
106
|
-
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
107
134
|
beads_query(limit: 10, sort: "updated")
|
|
108
135
|
```
|
|
109
136
|
|
|
@@ -118,9 +145,11 @@ title: User Authentication Overhaul
|
|
|
118
145
|
---
|
|
119
146
|
|
|
120
147
|
## Objective
|
|
148
|
+
|
|
121
149
|
Modernize the authentication system
|
|
122
150
|
|
|
123
151
|
## Subtasks
|
|
152
|
+
|
|
124
153
|
- [ ] #bead-001: Implement OAuth2 provider
|
|
125
154
|
- [ ] #bead-002: Add MFA support
|
|
126
155
|
- [ ] #bead-003: Migrate session storage
|
|
@@ -130,36 +159,54 @@ Modernize the authentication system
|
|
|
130
159
|
### Creating an Epic with Subtasks
|
|
131
160
|
|
|
132
161
|
1. Create the epic first:
|
|
133
|
-
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
134
164
|
beads_create(type: "epic", title: "User Auth Overhaul", body: "...")
|
|
135
165
|
```
|
|
136
166
|
|
|
137
167
|
2. Create subtasks linked to the epic:
|
|
138
|
-
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
139
170
|
beads_create(type: "task", title: "Implement OAuth2", parent: "epic-id")
|
|
140
171
|
```
|
|
141
172
|
|
|
142
173
|
## Best Practices
|
|
143
174
|
|
|
175
|
+
```text
|
|
144
176
|
1. **One bead per logical unit of work** - Don't combine unrelated fixes
|
|
145
177
|
2. **Update state promptly** - Keep beads reflecting reality
|
|
146
178
|
3. **Add context in body** - Future you will thank present you
|
|
147
179
|
4. **Link related beads** - Use `#bead-id` references
|
|
148
180
|
5. **Close with resolution** - Explain how it was resolved
|
|
149
181
|
6. **Use labels** - `priority:high`, `area:frontend`, etc.
|
|
182
|
+
```
|
|
150
183
|
|
|
151
184
|
## Sync and Collaboration
|
|
152
185
|
|
|
153
|
-
Beads sync
|
|
154
|
-
|
|
155
|
-
-
|
|
156
|
-
- Use `
|
|
186
|
+
Beads sync with git:
|
|
187
|
+
|
|
188
|
+
- Changes tracked locally
|
|
189
|
+
- Use `beads_sync()` to commit and push to remote
|
|
157
190
|
|
|
158
191
|
## Integration with Swarm
|
|
159
192
|
|
|
160
193
|
When working in a swarm:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
194
|
+
|
|
195
|
+
```text
|
|
196
|
+
1. Load `swarm-coordination` skill with `skills_use(name="swarm-coordination")`
|
|
197
|
+
2. Create epic with `beads_create_epic()` (atomic operation)
|
|
198
|
+
3. Coordinator assigns beads to worker agents
|
|
199
|
+
4. Workers load relevant skills based on subtask type
|
|
200
|
+
5. Close beads as subtasks complete
|
|
201
|
+
6. Close epic when all subtasks done
|
|
202
|
+
7. Sync with `beads_sync()` (MANDATORY at session end)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Skill Recommendations for Common Bead Types
|
|
206
|
+
|
|
207
|
+
```text
|
|
208
|
+
- `type: "bug"` → Load `testing-patterns` for regression tests
|
|
209
|
+
- `type: "feature"` → Load `system-design` for architecture
|
|
210
|
+
- `type: "chore"` → Load `testing-patterns` if refactoring
|
|
211
|
+
- `type: "epic"` → Load `swarm-coordination` for decomposition
|
|
212
|
+
```
|
|
@@ -10,21 +10,31 @@ tools:
|
|
|
10
10
|
- swarm_complete
|
|
11
11
|
- agentmail_init
|
|
12
12
|
- agentmail_send
|
|
13
|
+
- skills_use
|
|
14
|
+
- skills_list
|
|
15
|
+
related_skills:
|
|
16
|
+
- testing-patterns
|
|
17
|
+
- system-design
|
|
18
|
+
- cli-builder
|
|
13
19
|
---
|
|
14
20
|
|
|
15
21
|
# Swarm Coordination Skill
|
|
16
22
|
|
|
17
23
|
This skill provides guidance for effective multi-agent coordination in OpenCode swarm workflows.
|
|
18
24
|
|
|
25
|
+
**IMPORTANT:** This skill references global skills in `global-skills/`. Workers should load domain-specific skills based on their subtask type.
|
|
26
|
+
|
|
19
27
|
## When to Use Swarm Coordination
|
|
20
28
|
|
|
21
29
|
Use swarm coordination when:
|
|
30
|
+
|
|
22
31
|
- A task has multiple independent subtasks that can run in parallel
|
|
23
32
|
- The task requires different specializations (e.g., frontend + backend + tests)
|
|
24
33
|
- Work can be divided by file/module boundaries
|
|
25
34
|
- Time-to-completion matters and parallelization helps
|
|
26
35
|
|
|
27
36
|
Do NOT use swarm coordination when:
|
|
37
|
+
|
|
28
38
|
- The task is simple and can be done by one agent
|
|
29
39
|
- Subtasks have heavy dependencies on each other
|
|
30
40
|
- The overhead of coordination exceeds the benefit
|
|
@@ -34,6 +44,7 @@ Do NOT use swarm coordination when:
|
|
|
34
44
|
### 1. Analyze the Task
|
|
35
45
|
|
|
36
46
|
Before decomposing, understand:
|
|
47
|
+
|
|
37
48
|
- What are the distinct units of work?
|
|
38
49
|
- Which parts can run in parallel vs sequentially?
|
|
39
50
|
- What are the file/module boundaries?
|
|
@@ -42,6 +53,7 @@ Before decomposing, understand:
|
|
|
42
53
|
### 2. Choose a Decomposition Strategy
|
|
43
54
|
|
|
44
55
|
**Parallel Strategy** - For independent subtasks:
|
|
56
|
+
|
|
45
57
|
```
|
|
46
58
|
Parent Task: "Add user authentication"
|
|
47
59
|
├── Subtask 1: "Create auth API endpoints" (backend)
|
|
@@ -51,6 +63,7 @@ Parent Task: "Add user authentication"
|
|
|
51
63
|
```
|
|
52
64
|
|
|
53
65
|
**Sequential Strategy** - When order matters:
|
|
66
|
+
|
|
54
67
|
```
|
|
55
68
|
Parent Task: "Migrate database schema"
|
|
56
69
|
├── Step 1: "Create migration files"
|
|
@@ -60,6 +73,7 @@ Parent Task: "Migrate database schema"
|
|
|
60
73
|
```
|
|
61
74
|
|
|
62
75
|
**Hybrid Strategy** - Mixed dependencies:
|
|
76
|
+
|
|
63
77
|
```
|
|
64
78
|
Parent Task: "Add feature X"
|
|
65
79
|
├── Phase 1 (parallel):
|
|
@@ -84,16 +98,19 @@ When multiple agents work on the same codebase:
|
|
|
84
98
|
## Communication Patterns
|
|
85
99
|
|
|
86
100
|
### Broadcasting Updates
|
|
101
|
+
|
|
87
102
|
```
|
|
88
103
|
agentmail_send(recipients: ["all"], message: "Completed API endpoints, ready for frontend integration")
|
|
89
104
|
```
|
|
90
105
|
|
|
91
106
|
### Direct Coordination
|
|
107
|
+
|
|
92
108
|
```
|
|
93
109
|
agentmail_send(recipients: ["frontend-agent"], message: "Auth API is at /api/auth/*, here's the spec...")
|
|
94
110
|
```
|
|
95
111
|
|
|
96
112
|
### Blocking on Dependencies
|
|
113
|
+
|
|
97
114
|
```
|
|
98
115
|
# Wait for a dependency before proceeding
|
|
99
116
|
agentmail_receive(wait: true, filter: "api-complete")
|
|
@@ -104,28 +121,101 @@ agentmail_receive(wait: true, filter: "api-complete")
|
|
|
104
121
|
1. **Small, focused subtasks** - Each subtask should be completable in one agent session
|
|
105
122
|
2. **Clear boundaries** - Define exactly what files/modules each subtask touches
|
|
106
123
|
3. **Explicit handoffs** - When one task enables another, communicate clearly
|
|
107
|
-
4. **Graceful failures** - If a subtask
|
|
124
|
+
4. **Graceful failures** - If a subtask fail, don't block the whole swarm
|
|
108
125
|
5. **Progress updates** - Use beads to track subtask status
|
|
126
|
+
6. **Load relevant skills** - Workers should call `skills_use()` based on their task type:
|
|
127
|
+
- Testing work → `skills_use(name="testing-patterns")`
|
|
128
|
+
- Architecture decisions → `skills_use(name="system-design")`
|
|
129
|
+
- CLI development → `skills_use(name="cli-builder")`
|
|
130
|
+
- Multi-agent coordination → `skills_use(name="swarm-coordination")`
|
|
109
131
|
|
|
110
132
|
## Common Patterns
|
|
111
133
|
|
|
112
134
|
### Feature Development
|
|
135
|
+
|
|
113
136
|
```yaml
|
|
114
137
|
decomposition:
|
|
115
138
|
strategy: hybrid
|
|
139
|
+
skills: [system-design, swarm-coordination] # Load before decomposing
|
|
116
140
|
phases:
|
|
117
141
|
- name: design
|
|
118
142
|
parallel: true
|
|
119
143
|
subtasks: [api-design, ui-design]
|
|
144
|
+
recommended_skills: [system-design]
|
|
120
145
|
- name: implement
|
|
121
146
|
parallel: true
|
|
122
147
|
subtasks: [backend, frontend]
|
|
148
|
+
recommended_skills: [system-design]
|
|
123
149
|
- name: validate
|
|
124
150
|
parallel: true
|
|
125
151
|
subtasks: [tests, docs, review]
|
|
152
|
+
recommended_skills: [testing-patterns]
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Bug Fix Swarm
|
|
156
|
+
|
|
157
|
+
```yaml
|
|
158
|
+
decomposition:
|
|
159
|
+
strategy: sequential
|
|
160
|
+
skills: [testing-patterns] # Load before decomposing
|
|
161
|
+
subtasks:
|
|
162
|
+
- reproduce-bug
|
|
163
|
+
- identify-root-cause
|
|
164
|
+
- implement-fix
|
|
165
|
+
- add-regression-test
|
|
166
|
+
recommended_skills: [testing-patterns]
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Refactoring
|
|
170
|
+
|
|
171
|
+
```yaml
|
|
172
|
+
decomposition:
|
|
173
|
+
strategy: parallel
|
|
174
|
+
skills: [testing-patterns, system-design] # Load before decomposing
|
|
175
|
+
subtasks:
|
|
176
|
+
- refactor-module-a
|
|
177
|
+
- refactor-module-b
|
|
178
|
+
- update-imports
|
|
179
|
+
- run-full-test-suite
|
|
180
|
+
recommended_skills: [testing-patterns, system-design]
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Skill Integration Workflow
|
|
184
|
+
|
|
185
|
+
**For Coordinators:**
|
|
186
|
+
|
|
187
|
+
1. Load `swarm-coordination` skill first
|
|
188
|
+
2. Analyze task type
|
|
189
|
+
3. Load additional skills based on domain (testing, design, CLI)
|
|
190
|
+
4. Include skill recommendations in `shared_context` for workers
|
|
191
|
+
|
|
192
|
+
**For Workers:**
|
|
193
|
+
|
|
194
|
+
1. Read `shared_context` from coordinator
|
|
195
|
+
2. Load recommended skills with `skills_use(name="skill-name")`
|
|
196
|
+
3. Apply skill knowledge to subtask
|
|
197
|
+
4. Report completion
|
|
198
|
+
|
|
199
|
+
**Example shared_context:**
|
|
200
|
+
|
|
201
|
+
```markdown
|
|
202
|
+
## Context from Coordinator
|
|
203
|
+
|
|
204
|
+
Past similar tasks: [CASS results]
|
|
205
|
+
Project learnings: [semantic-memory results]
|
|
206
|
+
|
|
207
|
+
## Recommended Skills
|
|
208
|
+
|
|
209
|
+
- skills_use(name="testing-patterns") - for test creation
|
|
210
|
+
- skills_use(name="system-design") - for module boundaries
|
|
211
|
+
|
|
212
|
+
## Task-Specific Notes
|
|
213
|
+
|
|
214
|
+
[Domain knowledge from coordinator]
|
|
126
215
|
```
|
|
127
216
|
|
|
128
217
|
### Bug Fix Swarm
|
|
218
|
+
|
|
129
219
|
```yaml
|
|
130
220
|
decomposition:
|
|
131
221
|
strategy: sequential
|
|
@@ -137,6 +227,7 @@ decomposition:
|
|
|
137
227
|
```
|
|
138
228
|
|
|
139
229
|
### Refactoring
|
|
230
|
+
|
|
140
231
|
```yaml
|
|
141
232
|
decomposition:
|
|
142
233
|
strategy: parallel
|