opencode-swarm-plugin 0.32.0 → 0.33.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/.turbo/turbo-build.log +9 -10
- package/.turbo/turbo-test.log +347 -341
- package/CHANGELOG.md +260 -0
- package/README.md +127 -182
- package/bin/swarm.test.ts +31 -0
- package/bin/swarm.ts +247 -12
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +530 -5
- package/dist/observability-tools.d.ts +116 -0
- package/dist/observability-tools.d.ts.map +1 -0
- package/dist/plugin.js +530 -5
- package/dist/skills.d.ts.map +1 -1
- package/dist/swarm-prompts.d.ts +59 -0
- package/dist/swarm-prompts.d.ts.map +1 -1
- package/dist/swarm.d.ts +17 -0
- package/dist/swarm.d.ts.map +1 -1
- package/examples/plugin-wrapper-template.ts +297 -8
- package/package.json +3 -2
- package/src/index.ts +25 -1
- package/src/observability-tools.test.ts +346 -0
- package/src/observability-tools.ts +594 -0
- package/src/skills.integration.test.ts +137 -1
- package/src/skills.test.ts +42 -1
- package/src/skills.ts +8 -4
- package/src/swarm-orchestrate.test.ts +123 -0
- package/src/swarm-orchestrate.ts +183 -0
- package/src/swarm-prompts.test.ts +389 -0
- package/src/swarm-prompts.ts +228 -0
- package/src/swarm-research.integration.test.ts +544 -0
- package/src/swarm-research.test.ts +698 -0
- package/src/swarm-research.ts +472 -0
- package/src/swarm.ts +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,265 @@
|
|
|
1
1
|
# opencode-swarm-plugin
|
|
2
2
|
|
|
3
|
+
## 0.33.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c41abcf`](https://github.com/joelhooks/swarm-tools/commit/c41abcfa37292b72fe41e0cf9d25c6612ae75fa2) Thanks [@joelhooks](https://github.com/joelhooks)! - ## 🎓 Skills Grow Up: Discovery Moves to OpenCode
|
|
8
|
+
|
|
9
|
+
> _"The best code is no code at all. Every new line of code you willingly bring into the world is code that has to be debugged, code that has to be read and understood, code that has to be supported."_
|
|
10
|
+
> — Jeff Atwood
|
|
11
|
+
|
|
12
|
+
Skills outgrew the nest. OpenCode is shipping native skills support following the [Agent Skills spec](https://spec.agentskills.com/), and our discovery tools are now redundant. Time to deprecate the scaffolding and let the platform handle what it does best.
|
|
13
|
+
|
|
14
|
+
### What Changed
|
|
15
|
+
|
|
16
|
+
**Deprecated Tools** (soft deprecation with console warnings):
|
|
17
|
+
|
|
18
|
+
- `skills_list` - OpenCode will handle discovery natively
|
|
19
|
+
- `skills_use` - OpenCode will handle loading via `use skill <name>` syntax
|
|
20
|
+
- `skills_read` - OpenCode will handle resource access transparently
|
|
21
|
+
- `skills_execute` - OpenCode will handle script execution in skill context
|
|
22
|
+
|
|
23
|
+
**Authoring Tools Kept** (fully functional, no changes):
|
|
24
|
+
|
|
25
|
+
- `skills_create` - Create new skills with SKILL.md template
|
|
26
|
+
- `skills_update` - Update existing skill content
|
|
27
|
+
- `skills_init` - Initialize skills directory in projects
|
|
28
|
+
- `skills_add_script` - Add executable scripts to skills
|
|
29
|
+
- `skills_delete` - Remove project skills
|
|
30
|
+
|
|
31
|
+
**Bundled Skills** - All 6 global skills remain intact and spec-compliant:
|
|
32
|
+
|
|
33
|
+
- `testing-patterns` - Feathers seams + Beck's 4 rules
|
|
34
|
+
- `swarm-coordination` - Multi-agent task orchestration
|
|
35
|
+
- `cli-builder` - Command-line interface patterns
|
|
36
|
+
- `learning-systems` - Confidence decay, pattern maturity
|
|
37
|
+
- `skill-creator` - Meta-skill for authoring new skills
|
|
38
|
+
- `system-design` - Architecture decision frameworks
|
|
39
|
+
|
|
40
|
+
### Why It Matters
|
|
41
|
+
|
|
42
|
+
**Before:** Two overlapping skill systems causing confusion. Agents could use plugin tools OR OpenCode's native syntax, with different behavior and semantics.
|
|
43
|
+
|
|
44
|
+
**After:** One canonical path. OpenCode owns discovery and loading. Plugin owns authoring and validation. Clean separation of concerns.
|
|
45
|
+
|
|
46
|
+
**Benefits:**
|
|
47
|
+
|
|
48
|
+
- No tool conflicts between plugin and platform
|
|
49
|
+
- Native OpenCode syntax (`use skill testing-patterns`) works seamlessly
|
|
50
|
+
- Simpler mental model for users
|
|
51
|
+
- Authoring tools remain for creating spec-compliant skills
|
|
52
|
+
|
|
53
|
+
### Migration Path
|
|
54
|
+
|
|
55
|
+
**For Discovery/Loading:**
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
// OLD (deprecated, still works but warns)
|
|
59
|
+
skills_list()
|
|
60
|
+
skills_use(name="testing-patterns")
|
|
61
|
+
|
|
62
|
+
// NEW (OpenCode native syntax)
|
|
63
|
+
use skill testing-patterns
|
|
64
|
+
use skill cli-builder with "building argument parser"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**For Authoring (no change needed):**
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
// Still fully supported
|
|
71
|
+
skills_create((name = "my-skill"), (description = "Domain expertise"));
|
|
72
|
+
skills_update((name = "my-skill"), (content = "Updated SKILL.md"));
|
|
73
|
+
skills_add_script(
|
|
74
|
+
(skill_name = "my-skill"),
|
|
75
|
+
(script_name = "validate.ts"),
|
|
76
|
+
(content = "...")
|
|
77
|
+
);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Backward Compatibility
|
|
81
|
+
|
|
82
|
+
**Yes, with warnings.** Deprecated tools continue to function but emit console warnings directing users to OpenCode's native syntax. No breaking changes in this release.
|
|
83
|
+
|
|
84
|
+
Future major version (v1.0) will remove deprecated discovery tools entirely. Authoring tools remain permanent.
|
|
85
|
+
|
|
86
|
+
### What This Means for Bundled Skills
|
|
87
|
+
|
|
88
|
+
Nothing changes. All 6 global skills ship with the plugin and are accessible via OpenCode's native `use skill <name>` syntax. They follow the Agent Skills spec and work identically whether loaded via deprecated plugin tools or native OpenCode.
|
|
89
|
+
|
|
90
|
+
The `global-skills/` directory remains the canonical source for our curated skill library.
|
|
91
|
+
|
|
92
|
+
- [`4feebaf`](https://github.com/joelhooks/swarm-tools/commit/4feebafed61caa8e2e8729b44bd415d71afd6834) Thanks [@joelhooks](https://github.com/joelhooks)! - ## 🐝 LLM-Powered Compaction: The Swarm Remembers
|
|
93
|
+
|
|
94
|
+
> "The best way to predict the future is to invent it." — Alan Kay
|
|
95
|
+
|
|
96
|
+
Compaction just got smarter. Instead of static "here's what to preserve" instructions, the swarm now **generates dynamic continuation prompts** with actual state data.
|
|
97
|
+
|
|
98
|
+
**What changed:**
|
|
99
|
+
|
|
100
|
+
The `experimental.session.compacting` hook now uses a three-level fallback chain:
|
|
101
|
+
|
|
102
|
+
1. **LLM-Generated Prompt** (NEW) - Queries actual swarm state (cells, epics, subtasks), shells out to `opencode run -m <liteModel>` to generate a structured continuation prompt with real IDs, real status, real next actions
|
|
103
|
+
2. **Static Context** - Falls back to `SWARM_COMPACTION_CONTEXT` if LLM fails
|
|
104
|
+
3. **Detection Fallback** - For low-confidence swarm detection, injects `SWARM_DETECTION_FALLBACK`
|
|
105
|
+
4. **None** - No injection if no swarm evidence
|
|
106
|
+
|
|
107
|
+
**Progressive Enhancement:**
|
|
108
|
+
|
|
109
|
+
Uses OpenCode PR #5907's new `output.prompt` API when available:
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
if ("prompt" in output) {
|
|
113
|
+
output.prompt = llmGeneratedPrompt; // Replaces entire compaction prompt
|
|
114
|
+
} else {
|
|
115
|
+
output.context.push(llmGeneratedPrompt); // Old API fallback
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**New interfaces:**
|
|
120
|
+
|
|
121
|
+
- `SwarmStateSnapshot` - Structured state for LLM input
|
|
122
|
+
- `querySwarmState()` - Queries cells via swarm CLI
|
|
123
|
+
- `generateCompactionPrompt()` - Shells out to lite model (30s timeout)
|
|
124
|
+
|
|
125
|
+
**Why it matters:**
|
|
126
|
+
|
|
127
|
+
Before: "Hey, you should preserve swarm state" (agent has to figure out what that means)
|
|
128
|
+
After: "Here's epic bd-xyz with 3/5 subtasks done, bd-xyz.2 is blocked on auth, spawn bd-xyz.4 next"
|
|
129
|
+
|
|
130
|
+
The coordinator wakes up from compaction with **concrete data**, not instructions to go find data.
|
|
131
|
+
|
|
132
|
+
**Backward compatible:** Falls back gracefully on older OpenCode versions or LLM failures.
|
|
133
|
+
|
|
134
|
+
- [`652fd16`](https://github.com/joelhooks/swarm-tools/commit/652fd16ff424eff92ebb3f5da0599caf676de2ce) Thanks [@joelhooks](https://github.com/joelhooks)! - ## 🔭 Observability Stack MVP: See What Your Swarm Is Doing
|
|
135
|
+
|
|
136
|
+
> "You can't improve what you can't measure." — Peter Drucker
|
|
137
|
+
|
|
138
|
+
The swarm just got eyes. This release adds comprehensive observability for multi-agent coordination, answering the eternal question: "Why did my epic fail?"
|
|
139
|
+
|
|
140
|
+
### What's New
|
|
141
|
+
|
|
142
|
+
**Structured Error Classes** (swarm-mail)
|
|
143
|
+
|
|
144
|
+
- `BaseSwarmError` with rich context: agent, bead_id, epic_id, timestamp, recent events
|
|
145
|
+
- Specialized errors: `ReservationError`, `CheckpointError`, `ValidationError`, `DecompositionError`
|
|
146
|
+
- Every error includes actionable suggestions for resolution
|
|
147
|
+
- Full `toJSON()` serialization for logging and debugging
|
|
148
|
+
|
|
149
|
+
**DEBUG Logging** (swarm-mail)
|
|
150
|
+
|
|
151
|
+
- `DEBUG=swarm:*` environment variable filtering
|
|
152
|
+
- 4 subsystems: `swarm:events`, `swarm:reservations`, `swarm:messages`, `swarm:checkpoints`
|
|
153
|
+
- Zero overhead when disabled
|
|
154
|
+
|
|
155
|
+
**swarm-db CLI** (swarm-mail)
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Raw SQL queries (SELECT only, max 1000 rows)
|
|
159
|
+
swarm-db query "SELECT type, COUNT(*) FROM events GROUP BY type"
|
|
160
|
+
|
|
161
|
+
# Pre-built analytics
|
|
162
|
+
swarm-db analytics failed-decompositions --since 7d --format json
|
|
163
|
+
|
|
164
|
+
# List available analytics
|
|
165
|
+
swarm-db list
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**10 Pre-built Analytics Queries** (Four Golden Signals mapped)
|
|
169
|
+
| Query | What It Answers |
|
|
170
|
+
|-------|-----------------|
|
|
171
|
+
| `failed-decompositions` | Which strategies are failing? |
|
|
172
|
+
| `strategy-success-rates` | What's working? |
|
|
173
|
+
| `lock-contention` | Where are agents fighting over files? |
|
|
174
|
+
| `agent-activity` | Who's doing what? |
|
|
175
|
+
| `message-latency` | How fast is coordination? |
|
|
176
|
+
| `scope-violations` | Who's touching files they shouldn't? |
|
|
177
|
+
| `task-duration` | How long do tasks take? |
|
|
178
|
+
| `checkpoint-frequency` | Are agents checkpointing enough? |
|
|
179
|
+
| `recovery-success` | Do checkpoints actually help? |
|
|
180
|
+
| `human-feedback` | What are reviewers rejecting? |
|
|
181
|
+
|
|
182
|
+
**Agent-Facing Tools** (opencode-swarm-plugin)
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
// Query analytics programmatically
|
|
186
|
+
swarm_analytics({
|
|
187
|
+
query: "failed-decompositions",
|
|
188
|
+
since: "7d",
|
|
189
|
+
format: "summary",
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// Raw SQL for power users (max 50 rows, context-safe)
|
|
193
|
+
swarm_query({ sql: "SELECT * FROM events WHERE type = 'task_blocked'" });
|
|
194
|
+
|
|
195
|
+
// Auto-diagnosis for debugging
|
|
196
|
+
swarm_diagnose({
|
|
197
|
+
epic_id: "bd-123",
|
|
198
|
+
include: ["blockers", "errors", "timeline"],
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
// Learning insights for feedback loops
|
|
202
|
+
swarm_insights({ scope: "epic", metrics: ["success_rate", "avg_duration"] });
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Why This Matters
|
|
206
|
+
|
|
207
|
+
Before: "The swarm failed. No idea why."
|
|
208
|
+
After: "Strategy X failed 80% of the time due to file conflicts. Switching to Y."
|
|
209
|
+
|
|
210
|
+
Event sourcing was already 80% of the solution. This release adds the diagnostic views to make that data actionable.
|
|
211
|
+
|
|
212
|
+
### Test Coverage
|
|
213
|
+
|
|
214
|
+
- 588 tests passing
|
|
215
|
+
- 1214 assertions
|
|
216
|
+
- Full TDD: every feature started with a failing test
|
|
217
|
+
|
|
218
|
+
- [`ca9936d`](https://github.com/joelhooks/swarm-tools/commit/ca9936d09b749449ef3c88fd3ec8b937f6ed7c29) Thanks [@joelhooks](https://github.com/joelhooks)! - ## 🔬 Research Phase: Docs Before Decomposition
|
|
219
|
+
|
|
220
|
+
Swarm coordinators now gather documentation BEFORE breaking down tasks. No more workers fumbling through outdated API assumptions.
|
|
221
|
+
|
|
222
|
+
**What's New:**
|
|
223
|
+
|
|
224
|
+
- **swarm/researcher agent** - READ-ONLY doc gatherer that discovers tools, reads lockfiles, fetches version-specific docs, and stores findings in semantic-memory
|
|
225
|
+
- **Pre-decomposition research** - Coordinator analyzes task → identifies tech stack → spawns researchers → injects findings into shared_context
|
|
226
|
+
- **On-demand research for workers** - Workers can spawn researchers when hitting unknowns mid-task
|
|
227
|
+
- **`--check-upgrades` flag** - Compare installed vs latest versions from npm registry
|
|
228
|
+
|
|
229
|
+
**New Tools:**
|
|
230
|
+
|
|
231
|
+
| Tool | Purpose |
|
|
232
|
+
| ------------------------ | ----------------------------------------------------------- |
|
|
233
|
+
| `swarm_discover_tools` | Runtime discovery of available doc tools (MCP, CLI, skills) |
|
|
234
|
+
| `swarm_get_versions` | Parse lockfiles (npm/pnpm/yarn/bun) for installed versions |
|
|
235
|
+
| `swarm_spawn_researcher` | Generate researcher prompt for Task tool |
|
|
236
|
+
| `swarm_research_phase` | Manual trigger for research orchestration |
|
|
237
|
+
|
|
238
|
+
**Architecture:**
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
Coordinator receives task
|
|
242
|
+
↓
|
|
243
|
+
runResearchPhase(task, projectPath)
|
|
244
|
+
↓
|
|
245
|
+
extractTechStack() → identify technologies
|
|
246
|
+
discoverDocTools() → find available tools
|
|
247
|
+
getInstalledVersions() → read lockfiles
|
|
248
|
+
Spawn researchers (parallel)
|
|
249
|
+
Collect summaries → shared_context
|
|
250
|
+
↓
|
|
251
|
+
Normal decomposition with enriched context
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
**Why This Matters:**
|
|
255
|
+
|
|
256
|
+
Workers now start with version-specific documentation instead of hallucinating APIs. Researchers store detailed findings in semantic-memory, so future agents don't repeat the research.
|
|
257
|
+
|
|
258
|
+
### Patch Changes
|
|
259
|
+
|
|
260
|
+
- Updated dependencies [[`652fd16`](https://github.com/joelhooks/swarm-tools/commit/652fd16ff424eff92ebb3f5da0599caf676de2ce)]:
|
|
261
|
+
- swarm-mail@1.4.0
|
|
262
|
+
|
|
3
263
|
## 0.32.0
|
|
4
264
|
|
|
5
265
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# opencode-swarm-plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Multi-agent swarm coordination for OpenCode - break tasks into parallel subtasks, spawn worker agents, learn from outcomes.**
|
|
4
4
|
|
|
5
5
|
**🌐 Website:** [swarmtools.ai](https://swarmtools.ai)
|
|
6
6
|
**📚 Full Documentation:** [swarmtools.ai/docs](https://swarmtools.ai/docs)
|
|
@@ -14,38 +14,109 @@ OpenCode plugin for multi-agent swarm coordination with learning capabilities.
|
|
|
14
14
|
╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Quickstart (<2 minutes)
|
|
18
|
+
|
|
19
|
+
### 1. Install
|
|
18
20
|
|
|
19
21
|
```bash
|
|
20
|
-
# Install
|
|
21
22
|
npm install -g opencode-swarm-plugin@latest
|
|
22
23
|
swarm setup
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 2. Initialize in Your Project
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cd your-project
|
|
30
|
+
swarm init
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 3. Run Your First Swarm
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Inside OpenCode
|
|
37
|
+
/swarm "Add user authentication with OAuth"
|
|
38
|
+
```
|
|
23
39
|
|
|
24
|
-
|
|
40
|
+
**What happens:**
|
|
41
|
+
- Task decomposed into parallel subtasks (coordinator queries past similar tasks)
|
|
42
|
+
- Worker agents spawn with file reservations
|
|
43
|
+
- Progress tracked with auto-checkpoints at 25/50/75%
|
|
44
|
+
- Completion runs bug scans, releases file locks, records learnings
|
|
45
|
+
|
|
46
|
+
Done. You're swarming.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Optional But Recommended
|
|
51
|
+
|
|
52
|
+
### Semantic Memory (for pattern learning)
|
|
53
|
+
|
|
54
|
+
```bash
|
|
25
55
|
brew install ollama
|
|
26
56
|
ollama serve &
|
|
27
57
|
ollama pull mxbai-embed-large
|
|
28
58
|
```
|
|
29
59
|
|
|
30
|
-
|
|
31
|
-
> — 4C/ID Instructional Design Model
|
|
60
|
+
Without Ollama, memory falls back to full-text search (still works, just less semantic).
|
|
32
61
|
|
|
33
|
-
|
|
62
|
+
### Historical Context (CASS)
|
|
34
63
|
|
|
35
|
-
|
|
36
|
-
- **Hive Integration** - Git-backed work item tracking with atomic epic creation
|
|
37
|
-
- **Agent Mail** - Inter-agent messaging with file reservations
|
|
38
|
-
- **Learning System** - Pattern maturity, anti-pattern detection, confidence decay
|
|
39
|
-
- **Skills System** - Knowledge injection with bundled and custom skills
|
|
40
|
-
- **Checkpoint & Recovery** - Auto-checkpoint at 25/50/75%, survive context death (9 integration tests ✅)
|
|
64
|
+
Queries past AI sessions for similar decompositions:
|
|
41
65
|
|
|
42
|
-
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/Dicklesworthstone/coding_agent_session_search
|
|
68
|
+
cd coding_agent_session_search
|
|
69
|
+
pip install -e .
|
|
70
|
+
cass index # Run periodically to index new sessions
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Bug Scanning (UBS)
|
|
74
|
+
|
|
75
|
+
Auto-runs on subtask completion:
|
|
43
76
|
|
|
44
77
|
```bash
|
|
45
|
-
|
|
78
|
+
git clone https://github.com/Dicklesworthstone/ultimate_bug_scanner
|
|
79
|
+
cd ultimate_bug_scanner
|
|
80
|
+
pip install -e .
|
|
46
81
|
```
|
|
47
82
|
|
|
48
|
-
|
|
83
|
+
Check status: `swarm doctor`
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Core Concepts
|
|
88
|
+
|
|
89
|
+
### The Hive 🐝
|
|
90
|
+
|
|
91
|
+
Work items (cells) stored in `.hive/` and synced to git. Each cell is a unit of work - think GitHub issue but local-first.
|
|
92
|
+
|
|
93
|
+
**Cell IDs:** Project-prefixed for clarity (e.g., `swarm-mail-lf2p4u-abc123` not generic `bd-xxx`)
|
|
94
|
+
|
|
95
|
+
### The Swarm
|
|
96
|
+
|
|
97
|
+
Parallel agents coordinated via **Swarm Mail** (message passing + file reservations). Coordinator spawns workers → workers reserve files → do work → report progress → complete with verification.
|
|
98
|
+
|
|
99
|
+
### Learning
|
|
100
|
+
|
|
101
|
+
- **Pattern maturity** tracks what decomposition strategies work
|
|
102
|
+
- **Confidence decay** fades unreliable patterns (90-day half-life)
|
|
103
|
+
- **Anti-pattern inversion** auto-marks failing approaches to avoid
|
|
104
|
+
- **Outcome tracking** learns from speed, errors, retries
|
|
105
|
+
|
|
106
|
+
### Checkpoint & Recovery
|
|
107
|
+
|
|
108
|
+
Auto-saves progress at milestones. Survives context death or crashes. Data stored in embedded libSQL (no external DB needed).
|
|
109
|
+
|
|
110
|
+
**When checkpoints happen:**
|
|
111
|
+
- Auto at 25%, 50%, 75% progress
|
|
112
|
+
- Before risky operations (via `swarm_checkpoint`)
|
|
113
|
+
- On errors (captures error context for recovery)
|
|
114
|
+
|
|
115
|
+
**Recovery:** `swarm_recover(project_key, epic_id)` returns full context to resume work.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Tools Reference
|
|
49
120
|
|
|
50
121
|
### Hive (Work Item Tracking)
|
|
51
122
|
|
|
@@ -73,31 +144,21 @@ ollama pull mxbai-embed-large
|
|
|
73
144
|
| `swarmmail_reserve` | Reserve files for exclusive edit |
|
|
74
145
|
| `swarmmail_release` | Release reservations |
|
|
75
146
|
|
|
76
|
-
### Swarm
|
|
147
|
+
### Swarm Orchestration
|
|
77
148
|
|
|
78
149
|
| Tool | Purpose |
|
|
79
150
|
| ------------------------------ | ----------------------------------------------- |
|
|
80
151
|
| `swarm_select_strategy` | Analyze task, recommend strategy |
|
|
81
152
|
| `swarm_decompose` | Generate decomposition prompt (queries CASS) |
|
|
82
|
-
| `swarm_delegate_planning` | Delegate planning to planner subagent |
|
|
83
153
|
| `swarm_validate_decomposition` | Validate response, detect conflicts |
|
|
84
|
-
| `swarm_plan_prompt` | Generate strategy-specific decomposition prompt |
|
|
85
154
|
| `swarm_subtask_prompt` | Generate worker agent prompt |
|
|
86
|
-
| `swarm_spawn_subtask` | Prepare subtask for Task tool spawning |
|
|
87
|
-
| `swarm_evaluation_prompt` | Generate self-evaluation prompt |
|
|
88
|
-
| `swarm_init` | Initialize swarm session |
|
|
89
155
|
| `swarm_status` | Get swarm progress by epic ID |
|
|
90
|
-
| `swarm_progress` | Report subtask progress
|
|
156
|
+
| `swarm_progress` | Report subtask progress |
|
|
91
157
|
| `swarm_complete` | Complete subtask (releases reservations) |
|
|
92
|
-
| `swarm_record_outcome` | Record outcome for learning |
|
|
93
158
|
| `swarm_checkpoint` | Save progress snapshot (auto at 25/50/75%) |
|
|
94
|
-
| `swarm_recover` | Resume from checkpoint
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `swarm_accumulate_error` | Track recurring errors (3-strike system) |
|
|
98
|
-
| `swarm_check_strikes` | Check if error threshold reached |
|
|
99
|
-
| `swarm_get_error_context` | Get context for error pattern |
|
|
100
|
-
| `swarm_resolve_error` | Mark error pattern as resolved |
|
|
159
|
+
| `swarm_recover` | Resume from checkpoint |
|
|
160
|
+
| `swarm_review` | Generate review prompt for coordinator |
|
|
161
|
+
| `swarm_review_feedback` | Send approval/rejection to worker (3-strike) |
|
|
101
162
|
|
|
102
163
|
### Skills (Knowledge Injection)
|
|
103
164
|
|
|
@@ -108,73 +169,7 @@ ollama pull mxbai-embed-large
|
|
|
108
169
|
| `skills_read` | Read skill content |
|
|
109
170
|
| `skills_create` | Create new skill |
|
|
110
171
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
Ensures work survives context compaction or crashes. Proven by 9 integration tests.
|
|
114
|
-
|
|
115
|
-
### Auto-Checkpoint Milestones
|
|
116
|
-
|
|
117
|
-
When `swarm_progress` reports 25%, 50%, or 75% completion, a checkpoint is automatically saved to libSQL:
|
|
118
|
-
|
|
119
|
-
```typescript
|
|
120
|
-
// Stored in system temp directory (no external database needed)
|
|
121
|
-
{
|
|
122
|
-
epic_id: "hv-123",
|
|
123
|
-
cell_id: "hv-123.1",
|
|
124
|
-
strategy: "file-based",
|
|
125
|
-
files: ["src/auth.ts", "src/middleware.ts"],
|
|
126
|
-
progress_percent: 50,
|
|
127
|
-
directives: {
|
|
128
|
-
shared_context: "OAuth implementation notes",
|
|
129
|
-
skills_to_load: ["testing-patterns"],
|
|
130
|
-
coordinator_notes: "Watch for race conditions"
|
|
131
|
-
},
|
|
132
|
-
recovery: {
|
|
133
|
-
last_checkpoint: 1234567890,
|
|
134
|
-
files_modified: ["src/auth.ts"],
|
|
135
|
-
error_context: "Optional: error details if checkpoint during error"
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Tools
|
|
141
|
-
|
|
142
|
-
**swarm_checkpoint** - Manually save a checkpoint:
|
|
143
|
-
```typescript
|
|
144
|
-
swarm_checkpoint({
|
|
145
|
-
project_key: "/abs/path",
|
|
146
|
-
agent_name: "WorkerA",
|
|
147
|
-
cell_id: "hv-123.1",
|
|
148
|
-
epic_id: "hv-123",
|
|
149
|
-
files_modified: ["src/auth.ts"],
|
|
150
|
-
progress_percent: 30,
|
|
151
|
-
directives: { shared_context: "..." },
|
|
152
|
-
error_context: "Optional"
|
|
153
|
-
})
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
**swarm_recover** - Resume from last checkpoint:
|
|
157
|
-
```typescript
|
|
158
|
-
swarm_recover({
|
|
159
|
-
project_key: "/abs/path",
|
|
160
|
-
epic_id: "hv-123"
|
|
161
|
-
})
|
|
162
|
-
// Returns:
|
|
163
|
-
// {
|
|
164
|
-
// found: true,
|
|
165
|
-
// context: { epic_id, cell_id, files, strategy, directives, recovery },
|
|
166
|
-
// age_seconds: 120
|
|
167
|
-
// }
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Failure Handling
|
|
171
|
-
|
|
172
|
-
Checkpoint failures are **non-fatal**—work continues even if checkpointing fails. Prevents infrastructure from blocking actual work.
|
|
173
|
-
|
|
174
|
-
## Bundled Skills
|
|
175
|
-
|
|
176
|
-
Located in `global-skills/`:
|
|
177
|
-
|
|
172
|
+
**Bundled skills:**
|
|
178
173
|
- **testing-patterns** - 25 dependency-breaking techniques, characterization tests
|
|
179
174
|
- **swarm-coordination** - Multi-agent decomposition, file reservations
|
|
180
175
|
- **cli-builder** - Argument parsing, help text, subcommands
|
|
@@ -182,85 +177,38 @@ Located in `global-skills/`:
|
|
|
182
177
|
- **learning-systems** - Confidence decay, pattern maturity
|
|
183
178
|
- **skill-creator** - Meta-skill for creating new skills
|
|
184
179
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
```
|
|
188
|
-
src/
|
|
189
|
-
├── hive.ts # Hive integration (work item tracking)
|
|
190
|
-
├── agent-mail.ts # Agent Mail tools (legacy MCP wrapper)
|
|
191
|
-
├── swarm-mail.ts # Swarm Mail tools (new, uses swarm-mail package)
|
|
192
|
-
├── swarm.ts # Swarm orchestration tools
|
|
193
|
-
├── swarm-orchestrate.ts # Coordinator logic
|
|
194
|
-
├── swarm-decompose.ts # Decomposition strategies
|
|
195
|
-
├── swarm-strategies.ts # Strategy selection
|
|
196
|
-
├── skills.ts # Skills system
|
|
197
|
-
├── learning.ts # Pattern maturity, outcomes
|
|
198
|
-
├── anti-patterns.ts # Anti-pattern detection
|
|
199
|
-
├── structured.ts # JSON parsing utilities
|
|
200
|
-
├── mandates.ts # Mandate system
|
|
201
|
-
└── schemas/ # Zod schemas
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
## Dependencies
|
|
205
|
-
|
|
206
|
-
### Required
|
|
207
|
-
|
|
208
|
-
| Dependency | Purpose |
|
|
209
|
-
|------------|---------|
|
|
210
|
-
| [OpenCode](https://opencode.ai) | AI coding agent (the plugin runs inside OpenCode) |
|
|
211
|
-
|
|
212
|
-
### Required for Semantic Memory
|
|
213
|
-
|
|
214
|
-
| Dependency | Purpose | Install |
|
|
215
|
-
|------------|---------|---------|
|
|
216
|
-
| [Ollama](https://ollama.ai) | Embedding model for semantic memory | `brew install ollama && ollama serve & && ollama pull mxbai-embed-large` |
|
|
180
|
+
---
|
|
217
181
|
|
|
218
|
-
|
|
182
|
+
## What's New in v0.32
|
|
219
183
|
|
|
220
|
-
|
|
184
|
+
- **libSQL storage** (embedded SQLite) replaced PGLite - no external DB needed
|
|
185
|
+
- **95% integration test coverage** - checkpoint/recovery proven with 9 tests
|
|
186
|
+
- **Coordinator review gate** - `swarm_review` + `swarm_review_feedback` with 3-strike rule
|
|
187
|
+
- **Smart ID resolution** - partial hashes work like git (`mjhgw0g` matches `opencode-swarm-monorepo-lf2p4u-mjhgw0ggt00`)
|
|
188
|
+
- **Auto-sync at key events** - no more forgotten `hive_sync` calls
|
|
189
|
+
- **Project-prefixed cell IDs** - `swarm-mail-xxx` instead of generic `bd-xxx`
|
|
221
190
|
|
|
222
|
-
|
|
223
|
-
|------|---------|---------|
|
|
224
|
-
| [CASS](https://github.com/Dicklesworthstone/coding_agent_session_search) | Historical context - queries past sessions for similar decompositions | See below |
|
|
225
|
-
| [UBS](https://github.com/Dicklesworthstone/ultimate_bug_scanner) | Bug scanning - runs on subtask completion to catch issues | See below |
|
|
191
|
+
---
|
|
226
192
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
#### Installing CASS
|
|
193
|
+
## Architecture
|
|
230
194
|
|
|
231
|
-
|
|
232
|
-
# Clone and install
|
|
233
|
-
git clone https://github.com/Dicklesworthstone/coding_agent_session_search
|
|
234
|
-
cd coding_agent_session_search
|
|
235
|
-
pip install -e .
|
|
195
|
+
Built on [swarm-mail](../swarm-mail) event sourcing primitives. Data stored in libSQL (embedded SQLite).
|
|
236
196
|
|
|
237
|
-
# Build the index (run periodically to index new sessions)
|
|
238
|
-
cass index
|
|
239
197
|
```
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
#
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
198
|
+
src/
|
|
199
|
+
├── hive.ts # Work item tracking integration
|
|
200
|
+
├── swarm-mail.ts # Agent coordination tools
|
|
201
|
+
├── swarm-orchestrate.ts # Coordinator logic (spawns workers)
|
|
202
|
+
├── swarm-decompose.ts # Task decomposition strategies
|
|
203
|
+
├── swarm-review.ts # Review gate for completed work
|
|
204
|
+
├── skills.ts # Knowledge injection system
|
|
205
|
+
├── learning.ts # Pattern maturity, outcomes
|
|
206
|
+
├── anti-patterns.ts # Anti-pattern detection
|
|
207
|
+
├── structured.ts # JSON parsing utilities
|
|
208
|
+
└── schemas/ # Zod validation schemas
|
|
248
209
|
```
|
|
249
210
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
- **CASS** - When you run `/swarm "Add OAuth"`, the coordinator queries CASS for similar past tasks. Without it, decomposition is based only on the current task description.
|
|
253
|
-
- **UBS** - Run manually on code to catch bugs before commit. Not integrated into swarm workflow but recommended for pre-commit validation.
|
|
254
|
-
- **Ollama** - Enables vector similarity search for semantic memory. Without it, memory falls back to full-text search (still functional, less semantic).
|
|
255
|
-
|
|
256
|
-
Run `swarm doctor` to check which dependencies are installed.
|
|
257
|
-
|
|
258
|
-
### npm Dependencies
|
|
259
|
-
|
|
260
|
-
- [swarm-mail](../swarm-mail) - Event sourcing primitives (workspace dependency)
|
|
261
|
-
- [@opencode-ai/plugin](https://www.npmjs.com/package/@opencode-ai/plugin) - OpenCode plugin API
|
|
262
|
-
- [effect](https://effect.website) - Effect-TS for type-safe composition
|
|
263
|
-
- [zod](https://zod.dev) - Schema validation
|
|
211
|
+
---
|
|
264
212
|
|
|
265
213
|
## Development
|
|
266
214
|
|
|
@@ -276,32 +224,29 @@ bun test
|
|
|
276
224
|
bun run typecheck
|
|
277
225
|
```
|
|
278
226
|
|
|
227
|
+
---
|
|
228
|
+
|
|
279
229
|
## CLI
|
|
280
230
|
|
|
281
231
|
```bash
|
|
282
232
|
swarm setup # Install and configure
|
|
283
|
-
swarm doctor # Check dependencies
|
|
233
|
+
swarm doctor # Check dependencies (CASS, UBS, Ollama)
|
|
284
234
|
swarm init # Initialize hive in project
|
|
285
235
|
swarm config # Show config file paths
|
|
286
236
|
```
|
|
287
237
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
### Planned Features
|
|
238
|
+
---
|
|
291
239
|
|
|
292
|
-
|
|
293
|
-
- **Swarm Observability** - Real-time visualization of agent coordination
|
|
294
|
-
- **Advanced Strategies** - Risk-based decomposition, critical path optimization
|
|
295
|
-
- **Multi-Project Coordination** - Cross-repo dependencies and shared context
|
|
296
|
-
- **Learning Export/Import** - Share pattern maturity across teams
|
|
240
|
+
## Further Reading
|
|
297
241
|
|
|
298
|
-
|
|
242
|
+
- **[Full Docs](https://swarmtools.ai/docs)** - Deep dives, patterns, best practices
|
|
243
|
+
- **[swarm-mail Package](../swarm-mail)** - Event sourcing primitives, database layer
|
|
244
|
+
- **[AGENTS.md](../../AGENTS.md)** - Monorepo guide, testing strategy, TDD workflow
|
|
299
245
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
- **Prevention Pipeline Integration** - Auto-generate prevention patterns from debug sessions
|
|
246
|
+
> *"High-variability sequencing of whole-task problems."*
|
|
247
|
+
> — 4C/ID Instructional Design Model
|
|
303
248
|
|
|
304
|
-
|
|
249
|
+
---
|
|
305
250
|
|
|
306
251
|
## License
|
|
307
252
|
|