opencode-swarm-plugin 0.21.0 → 0.23.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.
Files changed (131) hide show
  1. package/.turbo/turbo-build.log +9 -0
  2. package/CHANGELOG.md +12 -0
  3. package/README.md +111 -166
  4. package/dist/agent-mail.d.ts +480 -0
  5. package/dist/agent-mail.d.ts.map +1 -0
  6. package/dist/anti-patterns.d.ts +257 -0
  7. package/dist/anti-patterns.d.ts.map +1 -0
  8. package/dist/beads.d.ts +377 -0
  9. package/dist/beads.d.ts.map +1 -0
  10. package/dist/eval-capture.d.ts +206 -0
  11. package/dist/eval-capture.d.ts.map +1 -0
  12. package/dist/index.d.ts +1299 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +776 -4387
  15. package/dist/learning.d.ts +670 -0
  16. package/dist/learning.d.ts.map +1 -0
  17. package/dist/mandate-promotion.d.ts +93 -0
  18. package/dist/mandate-promotion.d.ts.map +1 -0
  19. package/dist/mandate-storage.d.ts +209 -0
  20. package/dist/mandate-storage.d.ts.map +1 -0
  21. package/dist/mandates.d.ts +230 -0
  22. package/dist/mandates.d.ts.map +1 -0
  23. package/dist/output-guardrails.d.ts +125 -0
  24. package/dist/output-guardrails.d.ts.map +1 -0
  25. package/dist/pattern-maturity.d.ts +246 -0
  26. package/dist/pattern-maturity.d.ts.map +1 -0
  27. package/dist/plugin.d.ts +22 -0
  28. package/dist/plugin.d.ts.map +1 -0
  29. package/dist/plugin.js +755 -4375
  30. package/dist/rate-limiter.d.ts +218 -0
  31. package/dist/rate-limiter.d.ts.map +1 -0
  32. package/dist/repo-crawl.d.ts +146 -0
  33. package/dist/repo-crawl.d.ts.map +1 -0
  34. package/dist/schemas/bead.d.ts +255 -0
  35. package/dist/schemas/bead.d.ts.map +1 -0
  36. package/dist/schemas/evaluation.d.ts +161 -0
  37. package/dist/schemas/evaluation.d.ts.map +1 -0
  38. package/dist/schemas/index.d.ts +34 -0
  39. package/dist/schemas/index.d.ts.map +1 -0
  40. package/dist/schemas/mandate.d.ts +336 -0
  41. package/dist/schemas/mandate.d.ts.map +1 -0
  42. package/dist/schemas/swarm-context.d.ts +131 -0
  43. package/dist/schemas/swarm-context.d.ts.map +1 -0
  44. package/dist/schemas/task.d.ts +188 -0
  45. package/dist/schemas/task.d.ts.map +1 -0
  46. package/dist/skills.d.ts +471 -0
  47. package/dist/skills.d.ts.map +1 -0
  48. package/dist/storage.d.ts +260 -0
  49. package/dist/storage.d.ts.map +1 -0
  50. package/dist/structured.d.ts +196 -0
  51. package/dist/structured.d.ts.map +1 -0
  52. package/dist/swarm-decompose.d.ts +201 -0
  53. package/dist/swarm-decompose.d.ts.map +1 -0
  54. package/dist/swarm-mail.d.ts +240 -0
  55. package/dist/swarm-mail.d.ts.map +1 -0
  56. package/dist/swarm-orchestrate.d.ts +708 -0
  57. package/dist/swarm-orchestrate.d.ts.map +1 -0
  58. package/dist/swarm-prompts.d.ts +292 -0
  59. package/dist/swarm-prompts.d.ts.map +1 -0
  60. package/dist/swarm-strategies.d.ts +100 -0
  61. package/dist/swarm-strategies.d.ts.map +1 -0
  62. package/dist/swarm.d.ts +455 -0
  63. package/dist/swarm.d.ts.map +1 -0
  64. package/dist/tool-availability.d.ts +91 -0
  65. package/dist/tool-availability.d.ts.map +1 -0
  66. package/docs/planning/ADR-001-monorepo-structure.md +171 -0
  67. package/docs/planning/ADR-002-package-extraction.md +393 -0
  68. package/docs/planning/ADR-003-performance-improvements.md +451 -0
  69. package/docs/planning/ADR-004-message-queue-features.md +187 -0
  70. package/docs/planning/ADR-005-devtools-observability.md +202 -0
  71. package/docs/planning/ROADMAP.md +368 -0
  72. package/docs/semantic-memory-cli-syntax.md +123 -0
  73. package/docs/swarm-mail-architecture.md +1147 -0
  74. package/package.json +13 -24
  75. package/scripts/cleanup-test-memories.ts +346 -0
  76. package/src/agent-mail.ts +1 -1
  77. package/src/beads.ts +1 -2
  78. package/src/index.ts +2 -2
  79. package/src/learning.integration.test.ts +80 -10
  80. package/src/mandate-storage.test.ts +3 -3
  81. package/src/storage.ts +189 -9
  82. package/src/swarm-mail.ts +3 -3
  83. package/src/swarm-orchestrate.ts +399 -246
  84. package/src/swarm.integration.test.ts +124 -0
  85. package/src/tool-availability.ts +1 -1
  86. package/tsconfig.json +1 -1
  87. package/.beads/.local_version +0 -1
  88. package/.beads/README.md +0 -81
  89. package/.beads/analysis/skill-architecture-meta-skills.md +0 -1562
  90. package/.beads/config.yaml +0 -62
  91. package/.beads/issues.jsonl +0 -2186
  92. package/.beads/metadata.json +0 -4
  93. package/.gitattributes +0 -3
  94. package/.github/workflows/ci.yml +0 -30
  95. package/.github/workflows/opencode.yml +0 -31
  96. package/.opencode/skills/tdd/SKILL.md +0 -182
  97. package/INTEGRATION_EXAMPLE.md +0 -66
  98. package/VERIFICATION_QUALITY_PATTERNS.md +0 -565
  99. package/bun.lock +0 -286
  100. package/dist/pglite.data +0 -0
  101. package/dist/pglite.wasm +0 -0
  102. package/src/streams/agent-mail.test.ts +0 -777
  103. package/src/streams/agent-mail.ts +0 -535
  104. package/src/streams/debug.test.ts +0 -500
  105. package/src/streams/debug.ts +0 -727
  106. package/src/streams/effect/ask.integration.test.ts +0 -314
  107. package/src/streams/effect/ask.ts +0 -202
  108. package/src/streams/effect/cursor.integration.test.ts +0 -418
  109. package/src/streams/effect/cursor.ts +0 -288
  110. package/src/streams/effect/deferred.test.ts +0 -357
  111. package/src/streams/effect/deferred.ts +0 -445
  112. package/src/streams/effect/index.ts +0 -17
  113. package/src/streams/effect/layers.ts +0 -73
  114. package/src/streams/effect/lock.test.ts +0 -385
  115. package/src/streams/effect/lock.ts +0 -399
  116. package/src/streams/effect/mailbox.test.ts +0 -260
  117. package/src/streams/effect/mailbox.ts +0 -318
  118. package/src/streams/events.test.ts +0 -924
  119. package/src/streams/events.ts +0 -329
  120. package/src/streams/index.test.ts +0 -229
  121. package/src/streams/index.ts +0 -578
  122. package/src/streams/migrations.test.ts +0 -359
  123. package/src/streams/migrations.ts +0 -362
  124. package/src/streams/projections.test.ts +0 -611
  125. package/src/streams/projections.ts +0 -504
  126. package/src/streams/store.integration.test.ts +0 -658
  127. package/src/streams/store.ts +0 -1075
  128. package/src/streams/swarm-mail.ts +0 -552
  129. package/test-bug-fixes.ts +0 -86
  130. package/vitest.integration.config.ts +0 -13
  131. package/workflow-integration-analysis.md +0 -876
@@ -0,0 +1,9 @@
1
+ $ bun build ./src/index.ts --outdir ./dist --target node --external @electric-sql/pglite --external swarm-mail && bun build ./src/plugin.ts --outfile ./dist/plugin.js --target node --external @electric-sql/pglite --external swarm-mail && tsc
2
+ Bundled 195 modules in 33ms
3
+
4
+ index.js 1.14 MB (entry point)
5
+
6
+ Bundled 196 modules in 32ms
7
+
8
+ plugin.js 1.12 MB (entry point)
9
+
package/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # opencode-swarm-plugin
2
+
3
+ ## 0.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b66d77e`](https://github.com/joelhooks/opencode-swarm-plugin/commit/b66d77e484e9b7021b3264d1a7e8f54a16ea5204) Thanks [@joelhooks](https://github.com/joelhooks)! - Add changesets workflow and semantic memory test isolation
8
+
9
+ - OIDC publish workflow with GitHub Actions
10
+ - Changesets for independent package versioning
11
+ - TEST_SEMANTIC_MEMORY_COLLECTION env var for test isolation
12
+ - Prevents test pollution of production semantic-memory
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # opencode-swarm-plugin
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/opencode-swarm-plugin.svg)](https://www.npmjs.com/package/opencode-swarm-plugin)
3
+ OpenCode plugin for multi-agent swarm coordination with learning capabilities.
4
4
 
5
5
  ```
6
6
  ███████╗██╗ ██╗ █████╗ ██████╗ ███╗ ███╗
@@ -9,42 +9,16 @@
9
9
  ╚════██║██║███╗██║██╔══██║██╔══██╗██║╚██╔╝██║
10
10
  ███████║╚███╔███╔╝██║ ██║██║ ██║██║ ╚═╝ ██║
11
11
  ╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝
12
-
13
- \ ` - ' /
14
- - .(o o). -
15
- ( >.< ) Break big tasks into small ones.
16
- /| |\ Spawn agents to work in parallel.
17
- (_| |_) Learn from what works.
18
- bzzzz...
19
12
  ```
20
13
 
21
- ## What is this?
22
-
23
- You give it a task. It breaks it into pieces. It spawns agents to work on each piece simultaneously. They coordinate so they don't step on each other. When they're done, you have working code.
24
-
25
- ```
26
- "Add OAuth"
27
-
28
-
29
- ┌────────────────────────┐
30
- │ COORDINATOR │
31
- │ picks strategy, splits│
32
- └────────────────────────┘
33
-
34
- ┌─────────────────────┼─────────────────────┐
35
- ▼ ▼ ▼
36
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
37
- │ Worker A │ │ Worker B │ │ Worker C │
38
- │ auth/oauth │ │ auth/session│ │ auth/tests │
39
- │ 🔒 files │ │ 🔒 files │ │ 🔒 files │
40
- └─────────────┘ └─────────────┘ └─────────────┘
41
- │ │ │
42
- └─────────────────────┼─────────────────────┘
43
-
44
- working code
45
- ```
14
+ ## Features
46
15
 
47
- The plugin learns from outcomes - what decomposition strategies work, which patterns fail, how long things take. Over time, it gets better at breaking down tasks.
16
+ - **Swarm Coordination** - Break tasks into parallel subtasks, spawn worker agents
17
+ - **Beads Integration** - Git-backed issue tracking with atomic epic creation
18
+ - **Agent Mail** - Inter-agent messaging with file reservations
19
+ - **Learning System** - Pattern maturity, anti-pattern detection, confidence decay
20
+ - **Skills System** - Knowledge injection with bundled and custom skills
21
+ - **Checkpointing** - Survive context compaction, resume from last checkpoint
48
22
 
49
23
  ## Install
50
24
 
@@ -55,160 +29,131 @@ swarm setup
55
29
 
56
30
  ## Usage
57
31
 
58
- ```
32
+ ```bash
59
33
  /swarm "Add user authentication with OAuth"
60
34
  ```
61
35
 
62
- ## How it decides to split work
63
-
64
- ```
65
- ┌─────────────────────────────────────────────────────────────────┐
66
- │ STRATEGY SELECTION │
67
- ├─────────────────────────────────────────────────────────────────┤
68
- │ │
69
- │ "refactor auth" ──────► FILE-BASED │
70
- │ "migrate to v2" Group by directory structure │
71
- │ "rename all X" Minimize cross-directory deps │
72
- │ │
73
- │ "add feature" ──────► FEATURE-BASED │
74
- │ "implement X" Vertical slices (data→logic→UI) │
75
- │ "build new" Keep related components together │
76
- │ │
77
- │ "fix bug" ──────► RISK-BASED │
78
- │ "security issue" Tests FIRST │
79
- │ "critical" Isolate risky changes │
80
- │ │
81
- └─────────────────────────────────────────────────────────────────┘
82
- ```
83
-
84
- ## What survives when context dies
85
-
86
- Swarms used to die when OpenCode compacted context. Not anymore.
36
+ ## Tools Provided
37
+
38
+ ### Beads (Issue Tracking)
39
+
40
+ | Tool | Purpose |
41
+ | ------------------- | ------------------------------------- |
42
+ | `beads_create` | Create bead with type-safe validation |
43
+ | `beads_create_epic` | Atomic epic + subtasks creation |
44
+ | `beads_query` | Query with filters |
45
+ | `beads_update` | Update status/description/priority |
46
+ | `beads_close` | Close with reason |
47
+ | `beads_start` | Mark in-progress |
48
+ | `beads_ready` | Get next unblocked bead |
49
+ | `beads_sync` | Sync to git |
50
+
51
+ ### Swarm Mail (Agent Coordination)
52
+
53
+ | Tool | Purpose |
54
+ | ------------------------ | -------------------------------- |
55
+ | `swarmmail_init` | Initialize session |
56
+ | `swarmmail_send` | Send message to agents |
57
+ | `swarmmail_inbox` | Fetch inbox (context-safe) |
58
+ | `swarmmail_read_message` | Fetch one message body |
59
+ | `swarmmail_reserve` | Reserve files for exclusive edit |
60
+ | `swarmmail_release` | Release reservations |
61
+
62
+ ### Swarm (Task Orchestration)
63
+
64
+ | Tool | Purpose |
65
+ | ------------------------------ | ----------------------------------------------- |
66
+ | `swarm_select_strategy` | Analyze task, recommend strategy |
67
+ | `swarm_decompose` | Generate decomposition prompt (queries CASS) |
68
+ | `swarm_delegate_planning` | Delegate planning to planner subagent |
69
+ | `swarm_validate_decomposition` | Validate response, detect conflicts |
70
+ | `swarm_plan_prompt` | Generate strategy-specific decomposition prompt |
71
+ | `swarm_subtask_prompt` | Generate worker agent prompt |
72
+ | `swarm_spawn_subtask` | Prepare subtask for Task tool spawning |
73
+ | `swarm_evaluation_prompt` | Generate self-evaluation prompt |
74
+ | `swarm_init` | Initialize swarm session |
75
+ | `swarm_status` | Get swarm progress by epic ID |
76
+ | `swarm_progress` | Report subtask progress to coordinator |
77
+ | `swarm_complete` | Complete subtask (runs UBS scan, releases) |
78
+ | `swarm_record_outcome` | Record outcome for learning |
79
+ | `swarm_checkpoint` | Save progress snapshot |
80
+ | `swarm_recover` | Resume from checkpoint |
81
+ | `swarm_learn` | Extract learnings from outcome |
82
+ | `swarm_broadcast` | Send message to all active agents |
83
+ | `swarm_accumulate_error` | Track recurring errors (3-strike system) |
84
+ | `swarm_check_strikes` | Check if error threshold reached |
85
+ | `swarm_get_error_context` | Get context for error pattern |
86
+ | `swarm_resolve_error` | Mark error pattern as resolved |
87
+
88
+ ### Skills (Knowledge Injection)
89
+
90
+ | Tool | Purpose |
91
+ | --------------- | ----------------------- |
92
+ | `skills_list` | List available skills |
93
+ | `skills_use` | Load skill into context |
94
+ | `skills_read` | Read skill content |
95
+ | `skills_create` | Create new skill |
96
+
97
+ ## Bundled Skills
98
+
99
+ Located in `global-skills/`:
100
+
101
+ - **testing-patterns** - 25 dependency-breaking techniques, characterization tests
102
+ - **swarm-coordination** - Multi-agent decomposition, file reservations
103
+ - **cli-builder** - Argument parsing, help text, subcommands
104
+ - **system-design** - Architecture decisions, module boundaries
105
+ - **learning-systems** - Confidence decay, pattern maturity
106
+ - **skill-creator** - Meta-skill for creating new skills
87
107
 
88
- ```
89
- Session 1 Context Session 2
90
- │ Compacts │
91
- ▼ 💥 ▼
92
- ┌─────────────────┐ ┌─────────────────┐
93
- │ swarm running │ │ swarm_recover() │
94
- │ ├─ 25% ✓ saved │ │ │ │
95
- │ ├─ 50% ✓ saved │ ─────────────────────────────────►│ ▼ │
96
- │ └─ 75% ✓ saved │ checkpoints survive │ resume at 75% │
97
- └─────────────────┘ └─────────────────┘
98
- ```
99
-
100
- The plugin checkpoints at 25%, 50%, and 75% progress. Files reserved, progress tracked, context preserved.
101
-
102
- ## Learning
103
-
104
- The plugin tracks outcomes and adjusts over time:
105
-
106
- ```
107
- ┌─────────────────────────────────┐
108
- │ LEARNING LOOP │
109
- └─────────────────────────────────┘
110
-
111
- ┌───────────────────────────┼───────────────────────────┐
112
- ▼ ▼ ▼
113
- ┌───────────────┐ ┌───────────────┐ ┌───────────────┐
114
- │ OUTCOMES │ │ PATTERNS │ │ ANTI-PATTERNS │
115
- │ │ │ │ │ │
116
- │ fast+success │ │ candidate │ │ >60% failure │
117
- │ = good signal │──────────►│ ↓ │──────────►│ = auto-invert │
118
- │ │ │ established │ │ │
119
- │ slow+errors │ │ ↓ │ │ "split by X" │
120
- │ = bad signal │ │ proven │ │ becomes │
121
- │ │ │ │ │ "DON'T split │
122
- └───────────────┘ └───────────────┘ │ by X" │
123
- └───────────────┘
124
-
125
- Confidence decays over 90 days
126
- unless patterns are revalidated
127
- ```
128
-
129
- ## Skills
130
-
131
- Skills are knowledge packages agents can load. Teach once, use everywhere.
108
+ ## Architecture
132
109
 
133
110
  ```
134
- skills_use(name="testing-patterns") # Load testing knowledge
135
- skills_use(name="swarm-coordination") # Load swarm workflow
111
+ src/
112
+ ├── beads.ts # Beads integration
113
+ ├── agent-mail.ts # Agent Mail tools (legacy MCP wrapper)
114
+ ├── swarm-mail.ts # Swarm Mail tools (new, uses swarm-mail package)
115
+ ├── swarm.ts # Swarm orchestration tools
116
+ ├── swarm-orchestrate.ts # Coordinator logic
117
+ ├── swarm-decompose.ts # Decomposition strategies
118
+ ├── swarm-strategies.ts # Strategy selection
119
+ ├── skills.ts # Skills system
120
+ ├── learning.ts # Pattern maturity, outcomes
121
+ ├── anti-patterns.ts # Anti-pattern detection
122
+ ├── structured.ts # JSON parsing utilities
123
+ ├── mandates.ts # Mandate system
124
+ └── schemas/ # Zod schemas
136
125
  ```
137
126
 
138
- Bundled: `cli-builder`, `learning-systems`, `swarm-coordination`, `system-design`, `testing-patterns`, `skill-creator`
127
+ ## Dependencies
139
128
 
140
- Create your own in `.opencode/skills/` or `~/.config/opencode/skills/`.
129
+ - [swarm-mail](../swarm-mail) - Event sourcing primitives (workspace dependency)
130
+ - [@opencode-ai/plugin](https://www.npmjs.com/package/@opencode-ai/plugin) - OpenCode plugin API
131
+ - [effect](https://effect.website) - Effect-TS for type-safe composition
132
+ - [zod](https://zod.dev) - Schema validation
141
133
 
142
- ## Architecture
134
+ ## Development
143
135
 
144
- Everything runs in-process. No external servers.
136
+ ```bash
137
+ # From monorepo root
138
+ bun turbo build --filter=opencode-swarm-plugin
139
+ bun turbo test --filter=opencode-swarm-plugin
140
+ bun turbo typecheck --filter=opencode-swarm-plugin
145
141
 
142
+ # Or from this directory
143
+ bun run build
144
+ bun test
145
+ bun run typecheck
146
146
  ```
147
- ┌─────────────────────────────────────────────────────────────────┐
148
- │ YOUR TASK │
149
- └─────────────────────────────────────────────────────────────────┘
150
-
151
-
152
- ┌─────────────────────────────────────────────────────────────────┐
153
- │ DECOMPOSITION strategy selection, subtask creation │
154
- └─────────────────────────────────────────────────────────────────┘
155
-
156
-
157
- ┌─────────────────────────────────────────────────────────────────┐
158
- │ BEADS git-backed issues for each subtask │
159
- └─────────────────────────────────────────────────────────────────┘
160
-
161
-
162
- ┌─────────────────────────────────────────────────────────────────┐
163
- │ SWARM MAIL agent coordination, file reservations │
164
- └─────────────────────────────────────────────────────────────────┘
165
-
166
-
167
- ┌─────────────────────────────────────────────────────────────────┐
168
- │ PGLITE embedded postgres, event-sourced state │
169
- └─────────────────────────────────────────────────────────────────┘
170
-
171
-
172
- ┌─────────────────────────────────────────────────────────────────┐
173
- │ LEARNING outcomes feed back into decomposition │
174
- └─────────────────────────────────────────────────────────────────┘
175
- ```
176
-
177
- ## Dependencies
178
-
179
- | Required | Optional |
180
- | -------------------------------------------- | --------------------------------------------------------------------------------------------- |
181
- | [OpenCode](https://opencode.ai) | [CASS](https://github.com/Dicklesworthstone/coding_agent_session_search) - historical context |
182
- | [Beads](https://github.com/steveyegge/beads) | [UBS](https://github.com/Dicklesworthstone/ultimate_bug_scanner) - bug scanning |
183
- | | [semantic-memory](https://github.com/joelhooks/semantic-memory) - learning persistence |
184
-
185
- Run `swarm doctor` to check status.
186
147
 
187
148
  ## CLI
188
149
 
189
- ```
150
+ ```bash
190
151
  swarm setup # Install and configure
191
152
  swarm doctor # Check dependencies
192
153
  swarm init # Initialize beads in project
193
154
  swarm config # Show config file paths
194
155
  ```
195
156
 
196
- ## Development
197
-
198
- ```bash
199
- bun install
200
- bun test
201
- bun run build
202
- ```
203
-
204
- ## Credits
205
-
206
- Built on ideas from:
207
-
208
- - [MCP Agent Mail](https://github.com/Dicklesworthstone/mcp_agent_mail) - multi-agent coordination patterns
209
- - [Superpowers](https://github.com/obra/superpowers) - verification patterns and skill architecture
210
- - [Electric SQL](https://electric-sql.com) - durable streams and event sourcing
211
-
212
157
  ## License
213
158
 
214
159
  MIT