opencode-swarm-plugin 0.44.0 → 0.44.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/bin/swarm.serve.test.ts +6 -4
  2. package/bin/swarm.ts +16 -10
  3. package/dist/compaction-prompt-scoring.js +139 -0
  4. package/dist/eval-capture.js +12811 -0
  5. package/dist/hive.d.ts.map +1 -1
  6. package/dist/index.js +7644 -62599
  7. package/dist/plugin.js +23766 -78721
  8. package/dist/swarm-orchestrate.d.ts.map +1 -1
  9. package/dist/swarm-prompts.d.ts.map +1 -1
  10. package/dist/swarm-review.d.ts.map +1 -1
  11. package/package.json +17 -5
  12. package/.changeset/swarm-insights-data-layer.md +0 -63
  13. package/.hive/analysis/eval-failure-analysis-2025-12-25.md +0 -331
  14. package/.hive/analysis/session-data-quality-audit.md +0 -320
  15. package/.hive/eval-results.json +0 -483
  16. package/.hive/issues.jsonl +0 -138
  17. package/.hive/memories.jsonl +0 -729
  18. package/.opencode/eval-history.jsonl +0 -327
  19. package/.turbo/turbo-build.log +0 -9
  20. package/CHANGELOG.md +0 -2286
  21. package/SCORER-ANALYSIS.md +0 -598
  22. package/docs/analysis/subagent-coordination-patterns.md +0 -902
  23. package/docs/analysis-socratic-planner-pattern.md +0 -504
  24. package/docs/planning/ADR-001-monorepo-structure.md +0 -171
  25. package/docs/planning/ADR-002-package-extraction.md +0 -393
  26. package/docs/planning/ADR-003-performance-improvements.md +0 -451
  27. package/docs/planning/ADR-004-message-queue-features.md +0 -187
  28. package/docs/planning/ADR-005-devtools-observability.md +0 -202
  29. package/docs/planning/ADR-007-swarm-enhancements-worktree-review.md +0 -168
  30. package/docs/planning/ADR-008-worker-handoff-protocol.md +0 -293
  31. package/docs/planning/ADR-009-oh-my-opencode-patterns.md +0 -353
  32. package/docs/planning/ADR-010-cass-inhousing.md +0 -1215
  33. package/docs/planning/ROADMAP.md +0 -368
  34. package/docs/semantic-memory-cli-syntax.md +0 -123
  35. package/docs/swarm-mail-architecture.md +0 -1147
  36. package/docs/testing/context-recovery-test.md +0 -470
  37. package/evals/ARCHITECTURE.md +0 -1189
  38. package/evals/README.md +0 -768
  39. package/evals/compaction-prompt.eval.ts +0 -149
  40. package/evals/compaction-resumption.eval.ts +0 -289
  41. package/evals/coordinator-behavior.eval.ts +0 -307
  42. package/evals/coordinator-session.eval.ts +0 -154
  43. package/evals/evalite.config.ts.bak +0 -15
  44. package/evals/example.eval.ts +0 -31
  45. package/evals/fixtures/cass-baseline.ts +0 -217
  46. package/evals/fixtures/compaction-cases.ts +0 -350
  47. package/evals/fixtures/compaction-prompt-cases.ts +0 -311
  48. package/evals/fixtures/coordinator-sessions.ts +0 -328
  49. package/evals/fixtures/decomposition-cases.ts +0 -105
  50. package/evals/lib/compaction-loader.test.ts +0 -248
  51. package/evals/lib/compaction-loader.ts +0 -320
  52. package/evals/lib/data-loader.evalite-test.ts +0 -289
  53. package/evals/lib/data-loader.test.ts +0 -345
  54. package/evals/lib/data-loader.ts +0 -281
  55. package/evals/lib/llm.ts +0 -115
  56. package/evals/scorers/compaction-prompt-scorers.ts +0 -145
  57. package/evals/scorers/compaction-scorers.ts +0 -305
  58. package/evals/scorers/coordinator-discipline.evalite-test.ts +0 -539
  59. package/evals/scorers/coordinator-discipline.ts +0 -325
  60. package/evals/scorers/index.test.ts +0 -146
  61. package/evals/scorers/index.ts +0 -328
  62. package/evals/scorers/outcome-scorers.evalite-test.ts +0 -27
  63. package/evals/scorers/outcome-scorers.ts +0 -349
  64. package/evals/swarm-decomposition.eval.ts +0 -121
  65. package/examples/commands/swarm.md +0 -745
  66. package/examples/plugin-wrapper-template.ts +0 -2515
  67. package/examples/skills/hive-workflow/SKILL.md +0 -212
  68. package/examples/skills/skill-creator/SKILL.md +0 -223
  69. package/examples/skills/swarm-coordination/SKILL.md +0 -292
  70. package/global-skills/cli-builder/SKILL.md +0 -344
  71. package/global-skills/cli-builder/references/advanced-patterns.md +0 -244
  72. package/global-skills/learning-systems/SKILL.md +0 -644
  73. package/global-skills/skill-creator/LICENSE.txt +0 -202
  74. package/global-skills/skill-creator/SKILL.md +0 -352
  75. package/global-skills/skill-creator/references/output-patterns.md +0 -82
  76. package/global-skills/skill-creator/references/workflows.md +0 -28
  77. package/global-skills/swarm-coordination/SKILL.md +0 -995
  78. package/global-skills/swarm-coordination/references/coordinator-patterns.md +0 -235
  79. package/global-skills/swarm-coordination/references/strategies.md +0 -138
  80. package/global-skills/system-design/SKILL.md +0 -213
  81. package/global-skills/testing-patterns/SKILL.md +0 -430
  82. package/global-skills/testing-patterns/references/dependency-breaking-catalog.md +0 -586
  83. package/opencode-swarm-plugin-0.30.7.tgz +0 -0
  84. package/opencode-swarm-plugin-0.31.0.tgz +0 -0
  85. package/scripts/cleanup-test-memories.ts +0 -346
  86. package/scripts/init-skill.ts +0 -222
  87. package/scripts/migrate-unknown-sessions.ts +0 -349
  88. package/scripts/validate-skill.ts +0 -204
  89. package/src/agent-mail.ts +0 -1724
  90. package/src/anti-patterns.test.ts +0 -1167
  91. package/src/anti-patterns.ts +0 -448
  92. package/src/compaction-capture.integration.test.ts +0 -257
  93. package/src/compaction-hook.test.ts +0 -838
  94. package/src/compaction-hook.ts +0 -1204
  95. package/src/compaction-observability.integration.test.ts +0 -139
  96. package/src/compaction-observability.test.ts +0 -187
  97. package/src/compaction-observability.ts +0 -324
  98. package/src/compaction-prompt-scorers.test.ts +0 -475
  99. package/src/compaction-prompt-scoring.ts +0 -300
  100. package/src/contributor-tools.test.ts +0 -133
  101. package/src/contributor-tools.ts +0 -201
  102. package/src/dashboard.test.ts +0 -611
  103. package/src/dashboard.ts +0 -462
  104. package/src/error-enrichment.test.ts +0 -403
  105. package/src/error-enrichment.ts +0 -219
  106. package/src/eval-capture.test.ts +0 -1015
  107. package/src/eval-capture.ts +0 -929
  108. package/src/eval-gates.test.ts +0 -306
  109. package/src/eval-gates.ts +0 -218
  110. package/src/eval-history.test.ts +0 -508
  111. package/src/eval-history.ts +0 -214
  112. package/src/eval-learning.test.ts +0 -378
  113. package/src/eval-learning.ts +0 -360
  114. package/src/eval-runner.test.ts +0 -223
  115. package/src/eval-runner.ts +0 -402
  116. package/src/export-tools.test.ts +0 -476
  117. package/src/export-tools.ts +0 -257
  118. package/src/hive.integration.test.ts +0 -2241
  119. package/src/hive.ts +0 -1628
  120. package/src/index.ts +0 -940
  121. package/src/learning.integration.test.ts +0 -1815
  122. package/src/learning.ts +0 -1079
  123. package/src/logger.test.ts +0 -189
  124. package/src/logger.ts +0 -135
  125. package/src/mandate-promotion.test.ts +0 -473
  126. package/src/mandate-promotion.ts +0 -239
  127. package/src/mandate-storage.integration.test.ts +0 -601
  128. package/src/mandate-storage.test.ts +0 -578
  129. package/src/mandate-storage.ts +0 -794
  130. package/src/mandates.ts +0 -540
  131. package/src/memory-tools.test.ts +0 -195
  132. package/src/memory-tools.ts +0 -344
  133. package/src/memory.integration.test.ts +0 -334
  134. package/src/memory.test.ts +0 -158
  135. package/src/memory.ts +0 -527
  136. package/src/model-selection.test.ts +0 -188
  137. package/src/model-selection.ts +0 -68
  138. package/src/observability-tools.test.ts +0 -359
  139. package/src/observability-tools.ts +0 -871
  140. package/src/output-guardrails.test.ts +0 -438
  141. package/src/output-guardrails.ts +0 -381
  142. package/src/pattern-maturity.test.ts +0 -1160
  143. package/src/pattern-maturity.ts +0 -525
  144. package/src/planning-guardrails.test.ts +0 -491
  145. package/src/planning-guardrails.ts +0 -438
  146. package/src/plugin.ts +0 -23
  147. package/src/post-compaction-tracker.test.ts +0 -251
  148. package/src/post-compaction-tracker.ts +0 -237
  149. package/src/query-tools.test.ts +0 -636
  150. package/src/query-tools.ts +0 -324
  151. package/src/rate-limiter.integration.test.ts +0 -466
  152. package/src/rate-limiter.ts +0 -774
  153. package/src/replay-tools.test.ts +0 -496
  154. package/src/replay-tools.ts +0 -240
  155. package/src/repo-crawl.integration.test.ts +0 -441
  156. package/src/repo-crawl.ts +0 -610
  157. package/src/schemas/cell-events.test.ts +0 -347
  158. package/src/schemas/cell-events.ts +0 -807
  159. package/src/schemas/cell.ts +0 -257
  160. package/src/schemas/evaluation.ts +0 -166
  161. package/src/schemas/index.test.ts +0 -199
  162. package/src/schemas/index.ts +0 -286
  163. package/src/schemas/mandate.ts +0 -232
  164. package/src/schemas/swarm-context.ts +0 -115
  165. package/src/schemas/task.ts +0 -161
  166. package/src/schemas/worker-handoff.test.ts +0 -302
  167. package/src/schemas/worker-handoff.ts +0 -131
  168. package/src/sessions/agent-discovery.test.ts +0 -137
  169. package/src/sessions/agent-discovery.ts +0 -112
  170. package/src/sessions/index.ts +0 -15
  171. package/src/skills.integration.test.ts +0 -1192
  172. package/src/skills.test.ts +0 -643
  173. package/src/skills.ts +0 -1549
  174. package/src/storage.integration.test.ts +0 -341
  175. package/src/storage.ts +0 -884
  176. package/src/structured.integration.test.ts +0 -817
  177. package/src/structured.test.ts +0 -1046
  178. package/src/structured.ts +0 -762
  179. package/src/swarm-decompose.test.ts +0 -188
  180. package/src/swarm-decompose.ts +0 -1302
  181. package/src/swarm-deferred.integration.test.ts +0 -157
  182. package/src/swarm-deferred.test.ts +0 -38
  183. package/src/swarm-insights.test.ts +0 -214
  184. package/src/swarm-insights.ts +0 -459
  185. package/src/swarm-mail.integration.test.ts +0 -970
  186. package/src/swarm-mail.ts +0 -739
  187. package/src/swarm-orchestrate.integration.test.ts +0 -282
  188. package/src/swarm-orchestrate.test.ts +0 -548
  189. package/src/swarm-orchestrate.ts +0 -3084
  190. package/src/swarm-prompts.test.ts +0 -1270
  191. package/src/swarm-prompts.ts +0 -2077
  192. package/src/swarm-research.integration.test.ts +0 -701
  193. package/src/swarm-research.test.ts +0 -698
  194. package/src/swarm-research.ts +0 -472
  195. package/src/swarm-review.integration.test.ts +0 -285
  196. package/src/swarm-review.test.ts +0 -879
  197. package/src/swarm-review.ts +0 -709
  198. package/src/swarm-strategies.ts +0 -407
  199. package/src/swarm-worktree.test.ts +0 -501
  200. package/src/swarm-worktree.ts +0 -575
  201. package/src/swarm.integration.test.ts +0 -2377
  202. package/src/swarm.ts +0 -38
  203. package/src/tool-adapter.integration.test.ts +0 -1221
  204. package/src/tool-availability.ts +0 -461
  205. package/tsconfig.json +0 -28
@@ -1,212 +0,0 @@
1
- ---
2
- name: hive-workflow
3
- description: Issue tracking and task management using the hive system. Use when creating, updating, or managing work items. Use when you need to track bugs, features, tasks, or epics. Do NOT use for simple one-off questions or explorations.
4
- tags:
5
- - hive
6
- - issues
7
- - tracking
8
- - workflow
9
- tools:
10
- - hive_create
11
- - hive_query
12
- - hive_update
13
- - hive_close
14
- - hive_create_epic
15
- - hive_sync
16
- related_skills:
17
- - swarm-coordination
18
- ---
19
-
20
- # Hive Workflow Skill
21
-
22
- Hive is a local-first issue tracking system designed for AI agents. This skill provides best practices for effective cell management.
23
-
24
- **NOTE:** For swarm workflows, combine this skill with `swarm-coordination` from global-skills/.
25
-
26
- ## Cell Types
27
-
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 |
35
-
36
- ## Creating Effective Cells
37
-
38
- ### Good Cell Titles
39
-
40
- ```text
41
- - "Fix null pointer exception in UserService.getProfile()"
42
- - "Add dark mode toggle to settings page"
43
- - "Migrate auth tokens from localStorage to httpOnly cookies"
44
- ```
45
-
46
- ### Bad Cell Titles
47
-
48
- ```text
49
- - "Fix bug" (too vague)
50
- - "Make it better" (not actionable)
51
- - "stuff" (meaningless)
52
- ```
53
-
54
- ### Cell Body Structure
55
-
56
- ```markdown
57
- ## Problem
58
-
59
- [Clear description of the issue or need]
60
-
61
- ## Expected Behavior
62
-
63
- [What should happen]
64
-
65
- ## Current Behavior
66
-
67
- [What currently happens, for bugs]
68
-
69
- ## Proposed Solution
70
-
71
- [How to fix/implement, if known]
72
-
73
- ## Acceptance Criteria
74
-
75
- - [ ] Criterion 1
76
- - [ ] Criterion 2
77
-
78
- ## Notes
79
-
80
- [Any additional context, links, or constraints]
81
- ```
82
-
83
- ## Workflow States
84
-
85
- ```text
86
- open → in_progress → closed
87
-
88
- blocked (optional)
89
- ```
90
-
91
- ### State Transitions
92
-
93
- ### Open → In Progress
94
-
95
- ```typescript
96
- hive_update(id: "hv-abc123", state: "in_progress")
97
- ```
98
-
99
- Use when you start working on a cell.
100
-
101
- ### In Progress → Closed
102
-
103
- ```typescript
104
- hive_close(id: "hv-abc123", resolution: "Fixed in commit abc1234")
105
- ```
106
-
107
- Use when work is complete.
108
-
109
- ### In Progress → Blocked
110
-
111
- ```typescript
112
- hive_update(id: "hv-abc123", state: "blocked", body: "Blocked by #hv-xyz789")
113
- ```
114
-
115
- Use when you can't proceed due to a dependency.
116
-
117
- ## Querying Cells
118
-
119
- ### Find Open Work
120
-
121
- ```typescript
122
- hive_query(state: "open", type: "bug")
123
- ```
124
-
125
- ### Search by Keywords
126
-
127
- ```typescript
128
- hive_query(search: "authentication")
129
- ```
130
-
131
- ### List Recent Activity
132
-
133
- ```typescript
134
- hive_query(limit: 10, sort: "updated")
135
- ```
136
-
137
- ## Epic Management
138
-
139
- Epics are containers for related work:
140
-
141
- ```markdown
142
- ---
143
- type: epic
144
- title: User Authentication Overhaul
145
- ---
146
-
147
- ## Objective
148
-
149
- Modernize the authentication system
150
-
151
- ## Subtasks
152
-
153
- - [ ] #hv-001: Implement OAuth2 provider
154
- - [ ] #hv-002: Add MFA support
155
- - [ ] #hv-003: Migrate session storage
156
- - [ ] #hv-004: Update login UI
157
- ```
158
-
159
- ### Creating an Epic with Subtasks
160
-
161
- 1. Create the epic first:
162
-
163
- ```typescript
164
- hive_create(type: "epic", title: "User Auth Overhaul", body: "...")
165
- ```
166
-
167
- 2. Create subtasks linked to the epic:
168
-
169
- ```typescript
170
- hive_create(type: "task", title: "Implement OAuth2", parent: "epic-id")
171
- ```
172
-
173
- ## Best Practices
174
-
175
- ```text
176
- 1. **One cell per logical unit of work** - Don't combine unrelated fixes
177
- 2. **Update state promptly** - Keep cells reflecting reality
178
- 3. **Add context in body** - Future you will thank present you
179
- 4. **Link related cells** - Use `#hv-id` references
180
- 5. **Close with resolution** - Explain how it was resolved
181
- 6. **Use labels** - `priority:high`, `area:frontend`, etc.
182
- ```
183
-
184
- ## Sync and Collaboration
185
-
186
- Cells sync with git:
187
-
188
- - Changes tracked locally
189
- - Use `hive_sync()` to commit and push to remote
190
-
191
- ## Integration with Swarm
192
-
193
- When working in a swarm:
194
-
195
- ```text
196
- 1. Load `swarm-coordination` skill with `skills_use(name="swarm-coordination")`
197
- 2. Create epic with `hive_create_epic()` (atomic operation)
198
- 3. Coordinator assigns cells to worker agents
199
- 4. Workers load relevant skills based on subtask type
200
- 5. Close cells as subtasks complete
201
- 6. Close epic when all subtasks done
202
- 7. Sync with `hive_sync()` (MANDATORY at session end)
203
- ```
204
-
205
- ### Skill Recommendations for Common Cell 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
- ```
@@ -1,223 +0,0 @@
1
- ---
2
- name: skill-creator
3
- description: Guide for creating effective agent skills. Use when you want to create a new skill, improve an existing skill, or learn best practices for skill development. Helps codify learned patterns into reusable, discoverable skills.
4
- tags:
5
- - meta
6
- - skills
7
- - learning
8
- - documentation
9
- tools:
10
- - skills_init
11
- - skills_create
12
- - skills_update
13
- - skills_read
14
- ---
15
-
16
- # Skill Creator
17
-
18
- This skill provides guidance for creating effective skills that extend agent capabilities with specialized knowledge, workflows, and tools.
19
-
20
- ## What Are Skills?
21
-
22
- Skills are modular, self-contained packages that extend agent capabilities by providing:
23
-
24
- 1. **Specialized workflows** - Multi-step procedures for specific domains
25
- 2. **Tool integrations** - Instructions for working with specific file formats or APIs
26
- 3. **Domain expertise** - Project-specific knowledge, schemas, business logic
27
- 4. **Bundled resources** - Scripts, references, and assets for complex tasks
28
-
29
- Think of skills as "onboarding guides" that transform a general-purpose agent into a specialized one equipped with procedural knowledge.
30
-
31
- ## Skill Anatomy
32
-
33
- Every skill consists of a required SKILL.md file and optional bundled resources:
34
-
35
- ```
36
- skill-name/
37
- ├── SKILL.md (required)
38
- │ ├── YAML frontmatter (name, description, tags, tools)
39
- │ └── Markdown instructions
40
- └── Bundled Resources (optional)
41
- ├── scripts/ - Executable code (run with skills_execute)
42
- └── references/ - Documentation (load with skills_read)
43
- ```
44
-
45
- ### Progressive Disclosure
46
-
47
- Skills use a three-level loading system:
48
-
49
- 1. **Metadata** (name + description) - Always in context (~100 words)
50
- 2. **SKILL.md body** - When skill triggers (<5k words)
51
- 3. **Bundled resources** - On-demand as needed
52
-
53
- Keep SKILL.md lean. Move detailed content to references/.
54
-
55
- ## Creating a Skill
56
-
57
- ### Step 1: Understand the Use Cases
58
-
59
- Before creating, understand concrete examples:
60
- - What triggers should activate this skill?
61
- - What user requests would benefit from it?
62
- - What workflows does it enable?
63
-
64
- **Ask clarifying questions** if scope is unclear.
65
-
66
- ### Step 2: Initialize the Skill
67
-
68
- Use `skills_init` to create the full template structure:
69
-
70
- ```
71
- skills_init(
72
- name: "my-skill",
73
- description: "Initial description",
74
- directory: ".opencode/skills"
75
- )
76
- ```
77
-
78
- This creates:
79
- - SKILL.md with TODO placeholders
80
- - scripts/ with example script
81
- - references/ with example doc
82
-
83
- ### Step 3: Complete the SKILL.md
84
-
85
- Fill in the TODO placeholders. Key sections:
86
-
87
- **Frontmatter** - Critical for discoverability:
88
- ```yaml
89
- ---
90
- name: my-skill
91
- description: What it does and WHEN to use it. Be specific about triggering scenarios.
92
- tags:
93
- - category
94
- - domain
95
- tools:
96
- - tool_names_used
97
- ---
98
- ```
99
-
100
- **When to Use** - Specific triggering scenarios:
101
- ```markdown
102
- ## When to Use This Skill
103
-
104
- - When working on X type of task
105
- - When files matching Y pattern are involved
106
- - When the user asks about Z topic
107
- ```
108
-
109
- **Instructions** - Actionable, imperative form:
110
- ```markdown
111
- ## Instructions
112
-
113
- 1. Read the configuration file first
114
- 2. Check for existing patterns before creating
115
- 3. Always validate output before completing
116
- ```
117
-
118
- **Examples** - Realistic user requests:
119
- ```markdown
120
- ## Examples
121
-
122
- ### Example: Realistic Scenario
123
-
124
- **User**: "Help me do X"
125
-
126
- **Process**:
127
- 1. First step
128
- 2. Second step
129
- 3. Final step
130
- ```
131
-
132
- ### Step 4: Add Bundled Resources (Optional)
133
-
134
- **scripts/** - Executable helpers:
135
- - Use for repeated automation
136
- - Token-efficient (run without reading)
137
- - Run via `skills_execute`
138
-
139
- **references/** - On-demand documentation:
140
- - Detailed guides too long for SKILL.md
141
- - API documentation
142
- - Complex workflows
143
- - Load via `skills_read`
144
-
145
- ### Step 5: Test and Iterate
146
-
147
- 1. Use `skills_use` to load the skill
148
- 2. Try it on real tasks
149
- 3. Notice struggles or inefficiencies
150
- 4. Update SKILL.md based on experience
151
- 5. Test again
152
-
153
- ## Best Practices
154
-
155
- ### Metadata Quality
156
-
157
- The `name` and `description` determine when the skill triggers:
158
-
159
- **Good descriptions**:
160
- - "Guide for creating MCP servers. Use when building tools that connect LLMs to external APIs."
161
- - "File organization helper. Use when Downloads folder is messy or files need restructuring."
162
-
163
- **Bad descriptions**:
164
- - "A useful skill" (too vague)
165
- - "Does stuff with files" (not actionable)
166
-
167
- ### Writing Style
168
-
169
- Use **imperative/infinitive form** throughout:
170
- - "Read the file first" (not "You should read the file")
171
- - "Check for patterns" (not "Consider checking patterns")
172
-
173
- ### Keep SKILL.md Lean
174
-
175
- - Core instructions only (<5k words)
176
- - Move details to references/
177
- - Use examples sparingly
178
- - Delete placeholder sections
179
-
180
- ### Design for Discoverability
181
-
182
- - Tags help agents find skills by category
183
- - "When to Use" sections enable proper triggering
184
- - Tools list shows what capabilities the skill uses
185
-
186
- ## Quick Reference
187
-
188
- ### Creating Skills
189
-
190
- | Tool | Use When |
191
- |------|----------|
192
- | `skills_init` | Want full template structure with TODOs |
193
- | `skills_create` | Have complete content ready to write |
194
- | `swarm_learn` | Converting learned patterns to skills |
195
-
196
- ### Managing Skills
197
-
198
- | Tool | Use For |
199
- |------|---------|
200
- | `skills_list` | Discover available skills |
201
- | `skills_use` | Activate a skill by loading its content |
202
- | `skills_read` | Load a reference file from a skill |
203
- | `skills_update` | Modify an existing skill |
204
- | `skills_delete` | Remove an obsolete skill |
205
-
206
- ### Execution
207
-
208
- | Tool | Use For |
209
- |------|---------|
210
- | `skills_execute` | Run a script from a skill |
211
- | `skills_add_script` | Add a new script to a skill |
212
-
213
- ## From Learned Patterns to Skills
214
-
215
- When you discover something reusable during work:
216
-
217
- 1. **Identify the pattern** - What worked well?
218
- 2. **Consider scope** - Is it project-specific or universal?
219
- 3. **Use `swarm_learn`** - Document the learning
220
- 4. **Create the skill** - Use `create_skill=true` or `skills_init`
221
- 5. **Test and refine** - Iterate based on usage
222
-
223
- Skills make swarms smarter over time by preserving learned knowledge for future agents.
@@ -1,292 +0,0 @@
1
- ---
2
- name: swarm-coordination
3
- description: Multi-agent coordination patterns for OpenCode swarm workflows. Use when working on complex tasks that benefit from parallelization, when coordinating multiple agents, or when managing task decomposition. Do NOT use for simple single-agent tasks.
4
- tags:
5
- - swarm
6
- - multi-agent
7
- - coordination
8
- tools:
9
- - swarm_decompose
10
- - swarm_complete
11
- - swarmmail_init
12
- - swarmmail_send
13
- - swarmmail_inbox
14
- - swarmmail_read_message
15
- - swarmmail_reserve
16
- - swarmmail_release
17
- - skills_use
18
- - skills_list
19
- related_skills:
20
- - testing-patterns
21
- - system-design
22
- - cli-builder
23
- ---
24
-
25
- # Swarm Coordination Skill
26
-
27
- This skill provides guidance for effective multi-agent coordination in OpenCode swarm workflows.
28
-
29
- **IMPORTANT:** This skill references global skills in `global-skills/`. Workers should load domain-specific skills based on their subtask type.
30
-
31
- ## MANDATORY: Swarm Mail
32
-
33
- **ALL coordination MUST use `swarmmail_*` tools.** This is non-negotiable.
34
-
35
- Swarm Mail is embedded (no external server needed) and provides:
36
-
37
- - File reservations to prevent conflicts
38
- - Message passing between agents
39
- - Thread-based coordination tied to cells
40
-
41
- ## When to Use Swarm Coordination
42
-
43
- Use swarm coordination when:
44
-
45
- - A task has multiple independent subtasks that can run in parallel
46
- - The task requires different specializations (e.g., frontend + backend + tests)
47
- - Work can be divided by file/module boundaries
48
- - Time-to-completion matters and parallelization helps
49
-
50
- Do NOT use swarm coordination when:
51
-
52
- - The task is simple and can be done by one agent
53
- - Subtasks have heavy dependencies on each other
54
- - The overhead of coordination exceeds the benefit
55
-
56
- ## Task Decomposition Strategy
57
-
58
- ### 1. Analyze the Task
59
-
60
- Before decomposing, understand:
61
-
62
- - What are the distinct units of work?
63
- - Which parts can run in parallel vs sequentially?
64
- - What are the file/module boundaries?
65
- - Are there shared resources that need coordination?
66
-
67
- ### 2. Choose a Decomposition Strategy
68
-
69
- **Parallel Strategy** - For independent subtasks:
70
-
71
- ```text
72
- Parent Task: "Add user authentication"
73
- ├── Subtask 1: "Create auth API endpoints" (backend)
74
- ├── Subtask 2: "Build login/signup forms" (frontend)
75
- ├── Subtask 3: "Write auth integration tests" (testing)
76
- └── Subtask 4: "Add auth documentation" (docs)
77
- ```
78
-
79
- **Sequential Strategy** - When order matters:
80
-
81
- ```text
82
- Parent Task: "Migrate database schema"
83
- ├── Step 1: "Create migration files"
84
- ├── Step 2: "Update model definitions"
85
- ├── Step 3: "Run migrations"
86
- └── Step 4: "Verify data integrity"
87
- ```
88
-
89
- **Hybrid Strategy** - Mixed dependencies:
90
-
91
- ```text
92
- Parent Task: "Add feature X"
93
- ├── Phase 1 (parallel):
94
- │ ├── Subtask A: "Design API"
95
- │ └── Subtask B: "Design UI mockups"
96
- ├── Phase 2 (sequential, after Phase 1):
97
- │ └── Subtask C: "Implement based on designs"
98
- └── Phase 3 (parallel):
99
- ├── Subtask D: "Write tests"
100
- └── Subtask E: "Update docs"
101
- ```
102
-
103
- ## File Reservation Protocol
104
-
105
- When multiple agents work on the same codebase:
106
-
107
- 1. **Initialize Swarm Mail first** - Use `swarmmail_init` before any work
108
- 2. **Reserve files before editing** - Use `swarmmail_reserve` to claim files
109
- 3. **Respect reservations** - Don't edit files reserved by other agents
110
- 4. **Release when done** - Use `swarmmail_release` or let `swarm_complete` handle it
111
- 5. **Coordinate on shared files** - If you must edit a reserved file, send a message to the owning agent
112
-
113
- ```typescript
114
- // Initialize first
115
- await swarmmail_init({
116
- project_path: "$PWD",
117
- task_description: "Working on auth feature",
118
- });
119
-
120
- // Reserve files
121
- await swarmmail_reserve({
122
- paths: ["src/auth/**"],
123
- reason: "bd-123: Auth implementation",
124
- ttl_seconds: 3600,
125
- });
126
-
127
- // Work...
128
-
129
- // Release when done
130
- await swarmmail_release();
131
- ```
132
-
133
- ## Communication Patterns
134
-
135
- ### Broadcasting Updates
136
-
137
- ```typescript
138
- swarmmail_send({
139
- to: ["*"],
140
- subject: "API Complete",
141
- body: "Completed API endpoints, ready for frontend integration",
142
- thread_id: epic_id,
143
- });
144
- ```
145
-
146
- ### Direct Coordination
147
-
148
- ```typescript
149
- swarmmail_send({
150
- to: ["frontend-agent"],
151
- subject: "Auth API Spec",
152
- body: "Auth API is at /api/auth/*, here's the spec...",
153
- thread_id: epic_id,
154
- });
155
- ```
156
-
157
- ### Checking for Messages
158
-
159
- ```typescript
160
- // Check inbox (max 5, no bodies for context safety)
161
- const inbox = await swarmmail_inbox();
162
-
163
- // Read specific message body
164
- const message = await swarmmail_read_message({ message_id: N });
165
- ```
166
-
167
- ### Reporting Blockers
168
-
169
- ```typescript
170
- swarmmail_send({
171
- to: ["coordinator"],
172
- subject: "BLOCKED: Need DB schema",
173
- body: "Can't proceed without users table",
174
- thread_id: epic_id,
175
- importance: "urgent",
176
- });
177
- ```
178
-
179
- ## Best Practices
180
-
181
- 1. **Initialize Swarm Mail first** - Always call `swarmmail_init` before any work
182
- 2. **Small, focused subtasks** - Each subtask should be completable in one agent session
183
- 3. **Clear boundaries** - Define exactly what files/modules each subtask touches
184
- 4. **Explicit handoffs** - When one task enables another, communicate clearly
185
- 5. **Graceful failures** - If a subtask fails, don't block the whole swarm
186
- 6. **Progress updates** - Use beads to track subtask status
187
- 7. **Load relevant skills** - Workers should call `skills_use()` based on their task type:
188
- - Testing work → `skills_use(name="testing-patterns")`
189
- - Architecture decisions → `skills_use(name="system-design")`
190
- - CLI development → `skills_use(name="cli-builder")`
191
- - Multi-agent coordination → `skills_use(name="swarm-coordination")`
192
-
193
- ## Common Patterns
194
-
195
- ### Feature Development
196
-
197
- ```yaml
198
- decomposition:
199
- strategy: hybrid
200
- skills: [system-design, swarm-coordination]
201
- phases:
202
- - name: design
203
- parallel: true
204
- subtasks: [api-design, ui-design]
205
- recommended_skills: [system-design]
206
- - name: implement
207
- parallel: true
208
- subtasks: [backend, frontend]
209
- recommended_skills: [system-design]
210
- - name: validate
211
- parallel: true
212
- subtasks: [tests, docs, review]
213
- recommended_skills: [testing-patterns]
214
- ```
215
-
216
- ### Bug Fix Swarm
217
-
218
- ```yaml
219
- decomposition:
220
- strategy: sequential
221
- skills: [testing-patterns]
222
- subtasks:
223
- - reproduce-bug
224
- - identify-root-cause
225
- - implement-fix
226
- - add-regression-test
227
- recommended_skills: [testing-patterns]
228
- ```
229
-
230
- ### Refactoring
231
-
232
- ```yaml
233
- decomposition:
234
- strategy: parallel
235
- skills: [testing-patterns, system-design]
236
- subtasks:
237
- - refactor-module-a
238
- - refactor-module-b
239
- - update-imports
240
- - run-full-test-suite
241
- recommended_skills: [testing-patterns, system-design]
242
- ```
243
-
244
- ## Skill Integration Workflow
245
-
246
- **For Coordinators:**
247
-
248
- 1. Initialize Swarm Mail with `swarmmail_init`
249
- 2. Load `swarm-coordination` skill
250
- 3. Analyze task type
251
- 4. Load additional skills based on domain (testing, design, CLI)
252
- 5. Include skill recommendations in `shared_context` for workers
253
-
254
- **For Workers:**
255
-
256
- 1. Initialize Swarm Mail with `swarmmail_init`
257
- 2. Read `shared_context` from coordinator
258
- 3. Load recommended skills with `skills_use(name="skill-name")`
259
- 4. Apply skill knowledge to subtask
260
- 5. Report progress via `swarmmail_send`
261
- 6. Complete with `swarm_complete`
262
-
263
- **Example shared_context:**
264
-
265
- ```markdown
266
- ## Context from Coordinator
267
-
268
- Past similar tasks: [CASS results]
269
- Project learnings: [semantic-memory results]
270
-
271
- ## Recommended Skills
272
-
273
- - skills_use(name="testing-patterns") - for test creation
274
- - skills_use(name="system-design") - for module boundaries
275
-
276
- ## Task-Specific Notes
277
-
278
- [Domain knowledge from coordinator]
279
- ```
280
-
281
- ## Swarm Mail Quick Reference
282
-
283
- | Tool | Purpose |
284
- | ------------------------ | ----------------------------------- |
285
- | `swarmmail_init` | Initialize session (REQUIRED FIRST) |
286
- | `swarmmail_send` | Send message to agents |
287
- | `swarmmail_inbox` | Check inbox (max 5, no bodies) |
288
- | `swarmmail_read_message` | Read specific message body |
289
- | `swarmmail_reserve` | Reserve files for exclusive editing |
290
- | `swarmmail_release` | Release file reservations |
291
- | `swarmmail_ack` | Acknowledge message |
292
- | `swarmmail_health` | Check database health |