@hueyexe/opencode-ensemble 0.7.1 → 0.9.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/README.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # OpenCode Ensemble
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@hueyexe/opencode-ensemble.svg)](https://www.npmjs.com/package/@hueyexe/opencode-ensemble)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@hueyexe/opencode-ensemble.svg)](https://www.npmjs.com/package/@hueyexe/opencode-ensemble)
5
+ [![tests](https://img.shields.io/badge/tests-432%20passing-brightgreen.svg)]()
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-strict-blue.svg)]()
7
+ [![OpenCode SDK](https://img.shields.io/badge/deps-OpenCode%20SDK%20only-blue.svg)]()
8
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
9
+
3
10
  Run parallel AI agents in OpenCode. Each agent gets its own session, context window, and task. They coordinate through messaging and a shared task board.
4
11
 
5
12
  Plugin built on the public OpenCode SDK. No internal dependencies.
@@ -50,9 +57,10 @@ You: "How's the team doing?"
50
57
  Lead calls team_status:
51
58
  Team: validation (you are the lead)
52
59
  Members:
53
- alice [idle] agent: build session: ses_abc
54
- bob [idle] agent: build session: ses_def
55
- carol [working] agent: build session: ses_ghi
60
+ alice [idle 2m, last msg: 1m ago] agent: build branch: ensemble-validation-alice
61
+ bob [idle 1m, last msg: 30s ago] agent: build branch: ensemble-validation-bob
62
+ carol [working 5m, last msg: 3m ago] agent: build branch: ensemble-validation-carol
63
+ task: Write integration tests for validated endpoints
56
64
  Tasks: 5 total (3 completed, 1 in_progress, 1 pending)
57
65
  ```
58
66
 
@@ -66,7 +74,7 @@ Lead calls team_view({ member: "carol" })
66
74
  -> Use the session picker (ctrl+p) to go back to the lead
67
75
  ```
68
76
 
69
- When everything is done, the lead shuts down teammates and cleans up:
77
+ When everything is done, the lead shuts down teammates and cleans up. Worktree branches are automatically merged into your working directory as unstaged changes for review:
70
78
 
71
79
  ```
72
80
  [toast] alice shut down
@@ -74,22 +82,26 @@ When everything is done, the lead shuts down teammates and cleans up:
74
82
  [toast] carol shut down
75
83
 
76
84
  Lead: "All validation and tests are complete. 5 endpoints validated,
77
- 12 test cases added. Team cleaned up."
85
+ 12 test cases added. Team cleaned up.
86
+ Merged 3 branch(es) into working directory (unstaged).
87
+ Review changes with: git diff"
78
88
  ```
79
89
 
90
+ All teammate changes are now in your working directory, unstaged, ready for you to review file-by-file with `git diff`.
91
+
80
92
  ## Install
81
93
 
82
94
  Two steps: add the plugin, then allowlist worktree paths.
83
95
 
84
96
  ### 1. Add the plugin
85
97
 
86
- Add to your OpenCode config. Project-level or global.
98
+ Add to your OpenCode config with a pinned version. Project-level or global.
87
99
 
88
100
  **Project-level** (`opencode.json` in your project root):
89
101
 
90
102
  ```json
91
103
  {
92
- "plugin": ["@hueyexe/opencode-ensemble"]
104
+ "plugin": ["@hueyexe/opencode-ensemble@0.9.0"]
93
105
  }
94
106
  ```
95
107
 
@@ -97,11 +109,21 @@ Add to your OpenCode config. Project-level or global.
97
109
 
98
110
  ```json
99
111
  {
100
- "plugin": ["@hueyexe/opencode-ensemble"]
112
+ "plugin": ["@hueyexe/opencode-ensemble@0.9.0"]
101
113
  }
102
114
  ```
103
115
 
104
- OpenCode auto-installs npm plugins at startup (cached in `~/.cache/opencode/node_modules/`). No `npm install` needed.
116
+ OpenCode auto-installs npm plugins at startup. To update, bump the version number in your config and restart OpenCode.
117
+
118
+ **Why pin versions?** OpenCode has a [known bug](https://github.com/anomalyco/opencode/issues/6774) where unpinned plugins (e.g., `"@hueyexe/opencode-ensemble"`) get cached on first install and never auto-update, even after restarting. Pinning to a specific version avoids this — when you change the version string, OpenCode sees a new package spec and installs it fresh.
119
+
120
+ If you're stuck on an old version, clear the cache manually:
121
+
122
+ ```bash
123
+ rm -rf ~/.cache/opencode/packages/@hueyexe
124
+ ```
125
+
126
+ Then restart OpenCode.
105
127
 
106
128
  ### 2. Allow worktree directory access
107
129
 
@@ -193,23 +215,66 @@ Teammate messages arrive in the lead's session as `[Team message from alice]: ..
193
215
  - **Crash recovery**: stale busy members marked as errored on restart, orphaned sessions aborted, orphaned worktrees cleaned up, undelivered messages redelivered
194
216
  - **Spawn rollback**: if the initial prompt fails, the member, session, and worktree are all cleaned up
195
217
  - **Timeout watchdog**: teammates stuck busy beyond the TTL are automatically timed out and aborted
218
+ - **Stall detection**: detects teammates making no progress (low output tokens or no communication) and escalates to the lead
219
+ - **Auto-merge on cleanup**: worktree branches are squash-merged into your working directory as unstaged changes for review
220
+ - **Spawn circuit breaker**: stops retrying after 3 consecutive spawn failures
196
221
  - **Graceful shutdown**: busy teammates receive a shutdown message and finish their current work. Use `force: true` to abort immediately.
197
- - **Rate limiting**: token bucket (configurable via `OPENCODE_ENSEMBLE_RATE_LIMIT`, default 10 tokens/sec)
222
+ - **Rate limiting**: token bucket (configurable via config file or `OPENCODE_ENSEMBLE_RATE_LIMIT`, default 10 tokens/sec)
198
223
 
199
224
  ## Configuration
200
225
 
226
+ Configure via JSON files, environment variables, or both. Project config overrides global config. Env vars override everything.
227
+
228
+ ### Config file
229
+
230
+ **Global** (`~/.config/opencode/ensemble.json`):
231
+
232
+ ```json
233
+ {
234
+ "mergeOnCleanup": true,
235
+ "stallThresholdMs": 180000,
236
+ "stallMinSteps": 3,
237
+ "stallTokenThreshold": 500,
238
+ "timeoutMs": 1800000,
239
+ "rateLimitCapacity": 10
240
+ }
241
+ ```
242
+
243
+ **Project** (`.opencode/ensemble.json` in your project root) — same shape, overrides global per-key.
244
+
245
+ All fields are optional. Missing fields use defaults.
246
+
247
+ | Key | Default | Description |
248
+ |-----|---------|-------------|
249
+ | `mergeOnCleanup` | `true` | Auto-merge worktree branches on cleanup (squash + unstage) |
250
+ | `stallThresholdMs` | `180000` (3 min) | Time without communication before stall escalation. `0` disables. |
251
+ | `stallMinSteps` | `3` | Min model steps before token-based stall check kicks in |
252
+ | `stallTokenThreshold` | `500` | Output tokens per step below which the agent is considered stalled |
253
+ | `timeoutMs` | `1800000` (30 min) | Hard timeout for busy teammates. `0` disables. |
254
+ | `rateLimitCapacity` | `10` | Token bucket capacity for team tool calls. `0` disables. |
255
+
256
+ ### Environment variables
257
+
258
+ Env vars override config file values. Useful for CI or one-off overrides.
259
+
201
260
  ```bash
261
+ # Adjust teammate timeout (default: 1800000ms = 30 minutes)
262
+ OPENCODE_ENSEMBLE_TIMEOUT=3600000
263
+
264
+ # Disable timeout watchdog
265
+ OPENCODE_ENSEMBLE_TIMEOUT=0
266
+
202
267
  # Adjust rate limit (default: 10 tokens, refills 2/sec)
203
268
  OPENCODE_ENSEMBLE_RATE_LIMIT=20
204
269
 
205
270
  # Disable rate limiting
206
271
  OPENCODE_ENSEMBLE_RATE_LIMIT=0
207
272
 
208
- # Adjust teammate timeout (default: 1800000ms = 30 minutes)
209
- OPENCODE_ENSEMBLE_TIMEOUT=3600000
273
+ # Adjust stall detection threshold (default: 180000ms = 3 minutes)
274
+ STALL_THRESHOLD_MS=300000
210
275
 
211
- # Disable timeout watchdog
212
- OPENCODE_ENSEMBLE_TIMEOUT=0
276
+ # Disable stall detection
277
+ STALL_THRESHOLD_MS=0
213
278
  ```
214
279
 
215
280
  ## Best practices
@@ -243,7 +308,7 @@ Same coordination model (shared tasks, peer messaging, lead coordination) with s
243
308
  ```bash
244
309
  bun install
245
310
  bun run typecheck
246
- bun test # 377 tests
311
+ bun test # 432 tests
247
312
  bun run build
248
313
  ```
249
314