@te-river/opencode-team-mode 1.4.5 → 1.4.6

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,474 +1,500 @@
1
- # OpenCode TeamMode
2
-
3
- **[English](./README.md)** | **[中文](./README.zh-CN.md)**
4
-
5
- [![npm version](https://img.shields.io/npm/v/@te-river/opencode-team-mode.svg)](https://www.npmjs.com/package/@te-river/opencode-team-mode)
6
- [![npm downloads](https://img.shields.io/npm/dm/@te-river/opencode-team-mode.svg)](https://www.npmjs.com/package/@te-river/opencode-team-mode)
7
- [![license](https://img.shields.io/npm/l/@te-river/opencode-team-mode.svg)](./LICENSE)
8
-
9
- > 🤝 **Multi-agent team collaboration plugin for [OpenCode Desktop](https://opencode.ai)**
10
- >
11
- > Adds a complete team of specialized AI agents — Architect, Implementer, Reviewer, Tester, Researcher — orchestrated by a Team Lead, all accessible via simple slash commands.
12
-
13
- ---
14
-
15
- ## ✨ What is TeamMode?
16
-
17
- TeamMode transforms OpenCode Desktop from a single-agent coding assistant into a **full development team**. Each agent has a distinct role, expertise, and personality — just like a real engineering team.
18
-
19
- Instead of one agent trying to do everything, you get:
20
-
21
- | Agent | Role | When to use |
22
- |---|---|---|
23
- | 🎯 **Team Lead** | Orchestrator | Complex tasks that need planning + multi-step execution |
24
- | 🏗️ **Architect** | System designer | Design docs, module structure, API contracts |
25
- | 💻 **Implementer** | Code writer | Building features, writing production code |
26
- | 🔍 **Reviewer** | Code auditor | Bug hunting, security review, quality checks |
27
- | 🧪 **Tester** | Test engineer | Unit tests, integration tests, edge-case coverage |
28
- | 🔎 **Researcher** | Knowledge finder | Library evaluation, API docs, best practices |
29
-
30
- ---
31
-
32
- ## 🚀 Quick Start
33
-
34
- ### Prerequisites
35
-
36
- 1. **Install OpenCode Desktop** (if you haven't already):
37
-
38
- | Platform | Install command |
39
- |---|---|
40
- | macOS (Apple Silicon) | `brew install --cask opencode-desktop` |
41
- | macOS (Intel) | `brew install --cask opencode-desktop` |
42
- | Windows | `scoop bucket add extras && scoop install extras/opencode-desktop` |
43
- | Linux | Download from [opencode.ai/download](https://opencode.ai/download) |
44
-
45
- Or install the **CLI/TUI** version:
46
- ```bash
47
- # one-line script (all platforms)
48
- curl -fsSL https://opencode.ai/install | bash
49
-
50
- # or via npm
51
- npm install -g opencode-ai
52
- ```
53
-
54
- 2. **Node.js ≥ 18** (for npm)
55
-
56
- ### Install TeamMode
57
-
58
- **Option A — One-line installer (recommended):**
59
-
60
- macOS / Linux (bash):
61
- ```bash
62
- curl -fsSL https://raw.githubusercontent.com/Te-River/Opencode-TeamMode/main/scripts/install.sh | bash
63
- ```
64
-
65
- Windows (PowerShell):
66
- ```powershell
67
- irm https://raw.githubusercontent.com/Te-River/Opencode-TeamMode/main/scripts/install.ps1 | iex
68
- ```
69
-
70
- These scripts install the npm package and automatically register the plugin in your `opencode.jsonc`.
71
-
72
- **Option B — Manual npm install:**
73
-
74
- ```bash
75
- # 1. Install the plugin package
76
- npm install -g @te-river/opencode-team-mode
77
-
78
- # 2. Add the plugin to your opencode.jsonc
79
- # (see "Configuration" below)
80
- ```
81
-
82
- **Option C — Local dev install (from this repo):**
83
-
84
- ```bash
85
- git clone https://github.com/Te-River/Opencode-TeamMode.git
86
- cd Opencode-TeamMode
87
- npm install
88
- npm run build
89
- npm link
90
- ```
91
-
92
- ---
93
-
94
- ## ⚙️ Configuration
95
-
96
- After installing, add the plugin to your `opencode.jsonc`:
97
-
98
- ```jsonc
99
- {
100
- "$schema": "https://opencode.ai/config.json",
101
- "plugin": [
102
- "@te-river/opencode-team-mode@latest"
103
- ]
104
- }
105
- ```
106
-
107
- That's it. The plugin automatically injects all team agents and commands when OpenCode starts. **No need to manually copy agent files or command definitions.**
108
-
109
- > 💡 **Tip:** After modifying `opencode.json`, **restart OpenCode Desktop** for changes to take effect.
110
-
111
- > ⚠️ **Model choice matters.** Every judgment in the workflow — triage,
112
- > decomposition, dispatch briefs, synthesis, review-loop verdicts — flows
113
- > through the **Team Lead**. A weak model in that seat degrades the whole
114
- > pipeline no matter how strong the specialists are. Pin your best
115
- > reasoning model to the `team` agent (recipe in
116
- > [Customization](#customization) below).
117
-
118
- ### Global install (all projects)
119
-
120
- To enable TeamMode in every project, add the plugin to your global config:
121
-
122
- ```jsonc
123
- // ~/.config/opencode/opencode.jsonc
124
- {
125
- "$schema": "https://opencode.ai/config.json",
126
- "plugin": [
127
- "@te-river/opencode-team-mode@latest"
128
- ]
129
- }
130
- ```
131
-
132
- ---
133
-
134
- ## 📖 Usage
135
-
136
- ### Slash Commands
137
-
138
- TeamMode adds six slash commands to OpenCode. Type them in the chat input:
139
-
140
- | Command | Agent | Description |
141
- |---|---|---|
142
- | `/team-plan <task>` | Architect | Create a detailed implementation plan with architecture, file manifest, and task breakdown |
143
- | `/team-implement <task>` | Implementer | Write production code for a feature or task |
144
- | `/team-review [scope]` | Reviewer | Audit code for bugs, security issues, and quality problems |
145
- | `/team-test [scope]` | Tester | Generate comprehensive tests with edge-case coverage |
146
- | `/team-research <topic>` | Researcher | Investigate libraries, APIs, or best practices |
147
- | `/team-run <task>` | Team Lead | **Full workflow** — orchestrates all agents end-to-end |
148
-
149
- #### Example workflow
150
-
151
- ```
152
- # 1. Plan the feature
153
- /team-plan Add user authentication with OAuth2 and JWT tokens
154
-
155
- # 2. Review the plan, then implement
156
- /team-implement Implement the auth module as planned
157
-
158
- # 3. Review the code
159
- /team-review src/auth/
160
-
161
- # 4. Write tests
162
- /team-test src/auth/
163
-
164
- # Or let the team lead handle everything:
165
- /team-run Add user authentication with OAuth2 and JWT tokens
166
- ```
167
-
168
- ### Agent Picker
169
-
170
- You can also invoke agents directly using the `@` mention in OpenCode Desktop:
171
-
172
- - `@team` — Orchestrate a complex task
173
- - `@architect` — Design a system or module
174
- - `@implementer` — Write code
175
- - `@reviewer` — Review code quality
176
- - `@tester` — Write tests
177
- - `@researcher` — Research a topic
178
-
179
- ### Demo
180
-
181
- A session transcript, recreated from how the flow actually looks. Team is the
182
- default agent out of the box (see Configuration to opt out), so the user just
183
- types into a fresh chat:
184
-
185
- > **User:** Add token-bucket rate limiting to our Express API — 100 requests
186
- > per minute per user, return 429 when exceeded. Don't touch anything under
187
- > `src/legacy/`.
188
-
189
- ```text
190
- team Breaking this down: design → implement → review → test.
191
- Task board: .git/opencode-team/20260831-143012/rate-limiter/ (session folder + board inside .git/, auto-swept after idle TTL)
192
-
193
- ▸ @architect — designing (writes 01-architect-design.md)
194
- ✓ in-memory token bucket, per-user key, 429 + Retry-After
195
- summary above, full design on the board
196
-
197
- ▸ @implementer — building (Reads: 01; writes 02-implementer-middleware.md)
198
- ✓ src/middleware/rateLimit.ts (new), wired into src/app.ts (+3 lines)
199
-
200
- ▸ @reviewer — auditing the diff (Reads: 01, 02; writes 03-reviewer-findings-r1.md)
201
- ⚠ 1 MAJOR — bucket refill does read-modify-write in two steps;
202
- races under concurrent requests
203
- → converted to a fix task; dispatched to @implementer with the
204
- finding text (the user was not asked to approve this step)
205
-
206
- ▸ @implementer r2 — fixing the race (Reads: 03-r1 §MAJOR; writes 04-implementer-r2.md)
207
- ✓ refill restructured to single atomic update
208
-
209
- ▸ @reviewer r2 — re-review of fixed scope only
210
- ✓ clean — r1 finding resolved, no regressions
211
-
212
- ▸ @tester — covering limiter + boundaries (writes 05-tester-report.md)
213
- ✓ 14/14 pass — burst edge, window expiry, concurrent refill,
214
- src/legacy/** byte-identical (user boundary verified in tests)
215
-
216
- team Done.
217
- rate limiter shipped: rateLimit.ts (new) · app.ts (+3) · 14 tests green
218
- review loop: 1 major found → fixed → clean
219
- assumption: in-memory only — say the word if you want Redis
220
- src/legacy/ untouched
221
- task board left in place — TTL sweep will reclaim it
222
- ```
223
-
224
- The only message the user typed was the first one. The reviewer's finding
225
- became the implementer's work order without a prompt; every artifact stayed
226
- out of chat and on the board, read only by the dispatch that needed it.
227
-
228
- ### Desktop-specific features
229
-
230
- In **OpenCode Desktop**, you get additional UX benefits:
231
-
232
- - 🎨 **Color-coded agents** — Each agent has a distinct color in the chat UI for easy identification.
233
- - 📋 **Agent picker** — Click the agent dropdown to switch between team agents visually.
234
- - 🔀 **Parallel sub-tasks** — The Team Lead can dispatch multiple sub-agents simultaneously, with results shown in parallel panels.
235
- - 📊 **Session history** — All team interactions are saved and searchable in the Desktop session sidebar.
236
-
237
- ---
238
-
239
- ## 🏗️ Architecture
240
-
241
- ```
242
- opencode-team-mode/
243
- ├── package.json ← npm package definition
244
- ├── tsconfig.json ← TypeScript config
245
- ├── src/
246
- │ ├── index.ts ← Plugin entry (server() + config hook, id: "team-mode")
247
- │ ├── agents.ts ← Agent definitions (prompts, modes, colors)
248
- │ ├── commands.ts ← Command definitions (templates, agent bindings)
249
- │ ├── blackboard.ts ← Shared blackboard + TTL auto-cleanup sweeper
250
- │ └── types.ts ← Loader-contract type definitions (1.18.x)
251
- ├── scripts/
252
- │ ├── install.sh ← One-click installer (bash)
253
- │ └── install.ps1 ← One-click installer (PowerShell)
254
- ├── LICENSE ← Apache 2.0
255
- ├── README.md ← English documentation
256
- └── README.zh-CN.md ← Chinese documentation
257
- ```
258
-
259
- ### How it works
260
-
261
- 1. OpenCode Desktop starts and loads `opencode.json(c)`.
262
- 2. It sees `"@te-river/opencode-team-mode@latest"` in the `plugin` array and loads the npm package.
263
- 3. The loader calls the plugin's `server(input, options)`, which registers a `config` hook; the hook injects 6 agents and 6 commands into the merged config.
264
- 4. The plugin's `id: "team-mode"` is displayed as the plugin name in the Desktop UI.
265
- 5. Agents and commands are immediately available in the Desktop UI — no file copying needed. User-defined agents with the same name always win (the plugin never clobbers them).
266
-
267
- ---
268
-
269
- ## 🗂️ Shared Blackboard (with automatic cleanup)
270
-
271
- Sub-agents cannot message each other live (platform limitation), so TeamMode coordinates them through a **file blackboard** with strict ownership:
272
-
273
- - **Session isolation:** every conversation owns ONE timestamped session
274
- folder, and each multi-agent task gets its own directory inside it:
275
- `<repo>/.git/opencode-team/<session-key>/<task-slug>/` — inside `.git/`,
276
- so your working tree and commits are **never polluted**. (Non-git
277
- workspaces fall back to the OS temp dir.) Since boards now linger until
278
- the TTL sweep, the session layer keeps a fresh conversation from bumping
279
- into — or reading stale artifacts from — a not-yet-swept board (timestamps
280
- are second-granular, so overlap needs two conversations starting in the
281
- same second).
282
- - **File ownership:** every artifact is one topic-sized file written by
283
- exactly one agent (`01-architect-auth-design.md`, `03-reviewer-auth-r1.md`).
284
- ~100 lines max per file — split topics instead of letting files balloon.
285
- - **Writes are frozen:** a revision is a new round-suffixed file
286
- (`…-r2.md`); nothing is ever appended to or later agents reading stale rounds.
287
- - **The Team Lead is the router:** every dispatch carries a manifest —
288
- `Task:` (self-contained brief), `Reads:` (only the files that work package
289
- needs), `Write to:` (the one file the agent owns). Specialists read nothing
290
- that isn't listed, so long tasks never drown sub-agents in unnecessary context.
291
- - **`MANIFEST.md` is the lead's state board:** a file index plus a ≤50-line
292
- `## Current state` section (phase, decisions still valid, next steps),
293
- updated every converged round — the lead's compressed memory across long tasks.
294
- - The Team Lead also enforces a review/test **feedback loop**: Critical/Major
295
- findings and product bugs automatically become tracked fix tasks until the
296
- deliverable converges.
297
-
298
- ### Triage — questions don't become code edits
299
-
300
- The Team Lead classifies every incoming message before acting: a question or
301
- consult gets an answer (zero file changes, fixes merely proposed and awaiting
302
- your go-ahead); only explicit action requests enter the workflow. And whenever
303
- you spell out what may or may not be touched, **those boundaries outrank
304
- everything else** — the lead restates them in every single dispatch.
305
-
306
- ### Cleanup — the TTL sweeper is the only path
307
-
308
- | Who | When |
309
- |---|---|
310
- | Plugin code (in-process sweeper) | At startup + every hour: removes task directories idle **beyond the TTL** |
311
-
312
- The Team Lead never deletes task directories — finished boards stay
313
- readable so you can audit how a run went, and reclamation is pure code
314
- that never relies on the model remembering to do anything (crashes and
315
- force-kills leave nothing behind either). The sweeper prunes stale task
316
- dirs individually under a still-live session, and reclaims an entirely
317
- idle session folder in one pass. Set `ttlDays` to taste.
318
-
319
- ### Configure the TTL
320
-
321
- Default is **5 days**. To choose your own, use the tuple plugin form in
322
- `opencode.jsonc`:
323
-
324
- ```jsonc
325
- {
326
- "$schema": "https://opencode.ai/config.json",
327
- "plugin": [
328
- ["@te-river/opencode-team-mode@latest", { "ttlDays": 7 }]
329
- ]
330
- }
331
- ```
332
-
333
- `ttlDays` accepts any number of days in `(0, 365]`; invalid values silently
334
- fall back to 5.
335
-
336
- ### Default agent
337
-
338
- By default TeamMode **makes Team your default agent** — new chats open
339
- directly in the team orchestrator. One side effect comes with the default
340
- slot: the switcher pins the default agent to the **first position** and
341
- sorts everything else alphabetically, so the picker order is
342
- **team, build, plan**. (Want Team below Plan instead? That requires
343
- giving up the default slot — see the opt-out below; the two are
344
- mutually exclusive by the server's sort.)
345
-
346
- To opt out (`build` stays the default, picker order **build, plan,
347
- team**):
348
-
349
- ```jsonc
350
- {
351
- "plugin": [
352
- ["@te-river/opencode-team-mode@latest", { "defaultAgent": false }]
353
- ]
354
- }
355
- ```
356
-
357
- An explicitly configured non-`build` `default_agent` in your own config is
358
- always respected untouched — the plugin never clobbers it.
359
-
360
- **Upgrade note:** v1.4.4 briefly made this promotion opt-in; v1.4.5 restores
361
- Team-as-default as the shipped behavior. If you pinned `{ "defaultAgent":
362
- true }` during v1.4.4, you can drop that option (or switch it to `false` to
363
- opt out).
364
-
365
- ---
366
-
367
- ## 🔧 Customization
368
-
369
- ### The Team Lead's model matters most
370
-
371
- The Lead is the orchestrating brain: it classifies every message, cuts the
372
- work into packages, writes each dispatch manifest, judges reviewer/tester
373
- findings, and synthesizes the final deliverable. Quality failures there
374
- **multiply down the pipeline** — a mediocre Lead mis-decomposes, briefs the
375
- experts vaguely, and waves weak work through; no specialist can rescue an
376
- assignment it was never correctly given.
377
-
378
- So run the strongest model you can afford **in the Lead seat**. The other
379
- roles tolerate cheaper models — they work from tight briefs with scoped
380
- reading. Pin models per agent:
381
-
382
- ```jsonc
383
- {
384
- "agent": {
385
- // Team Lead — orchestration earns your best model
386
- "team": { "model": "anthropic/claude-opus-4-5" },
387
- // specialists — cheaper models are usually fine
388
- "implementer": { "model": "anthropic/claude-sonnet-4-6" }
389
- }
390
- }
391
- ```
392
-
393
- (Model IDs above are placeholders — use whatever your provider exposes.
394
- Your own `agent.team` definition always takes precedence over the plugin's.)
395
-
396
- ### Override an agent
397
-
398
- Add an agent with the same name in your `opencode.json` — your definition takes precedence:
399
-
400
- ```jsonc
401
- {
402
- "agent": {
403
- "reviewer": {
404
- "model": "anthropic/claude-sonnet-4-6",
405
- "prompt": "You are an extremely strict reviewer. Reject anything with a lint warning."
406
- }
407
- }
408
- }
409
- ```
410
-
411
- ### Add your own agents
412
-
413
- TeamMode does not prevent you from adding more agents. Define them alongside the team:
414
-
415
- ```jsonc
416
- {
417
- "agent": {
418
- "devops": {
419
- "mode": "subagent",
420
- "description": "Handles CI/CD, Docker, and deployment tasks.",
421
- "prompt": "You are the DevOps engineer..."
422
- }
423
- }
424
- }
425
- ```
426
-
427
- ### Disable an agent
428
-
429
- ```jsonc
430
- {
431
- "agent": {
432
- "researcher": { "disable": true }
433
- }
434
- }
435
- ```
436
-
437
- ---
438
-
439
- ## 📦 Publishing to npm
440
-
441
- If you want to publish your own fork:
442
-
443
- ```bash
444
- npm run build # compile TypeScript → dist/
445
- npm version patch # bump version
446
- npm publish # publish to npm registry
447
- ```
448
-
449
- ---
450
-
451
- ## 🤝 Contributing
452
-
453
- Contributions are welcome! Areas where we need help:
454
-
455
- - 🌐 **Localization** — Translate agent prompts to other languages
456
- - 🎨 **More agent roles** — DevOps, DBA, Security Specialist, UX Designer
457
- - 🔧 **Additional commands** — `/team-deploy`, `/team-docs`, `/team-refactor`
458
- - 📝 **Better prompts** — Improve agent behavior through prompt engineering
459
-
460
- ---
461
-
462
- ## 📄 License
463
-
464
- [Apache License 2.0](./LICENSE)
465
-
466
- ---
467
-
468
- ## 🔗 Links
469
-
470
- - [npm Package](https://www.npmjs.com/package/@te-river/opencode-team-mode) — `@te-river/opencode-team-mode` on npm
471
- - [OpenCode Desktop](https://opencode.ai) — Official website & download
472
- - [OpenCode Docs](https://opencode.ai/docs) — Configuration & plugin documentation
473
- - [OpenCode Plugin API](https://opencode.ai/docs/plugins) — Build your own plugins
474
- - [OpenCode GitHub](https://github.com/anomalyco/opencode) — Source code for OpenCode itself
1
+ # OpenCode TeamMode
2
+
3
+ **[English](./README.md)** | **[中文](./README.zh-CN.md)**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@te-river/opencode-team-mode.svg)](https://www.npmjs.com/package/@te-river/opencode-team-mode)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@te-river/opencode-team-mode.svg)](https://www.npmjs.com/package/@te-river/opencode-team-mode)
7
+ [![license](https://img.shields.io/npm/l/@te-river/opencode-team-mode.svg)](./LICENSE)
8
+
9
+ > 🤝 **Multi-agent team collaboration plugin for [OpenCode Desktop](https://opencode.ai)**
10
+ >
11
+ > Adds a complete team of specialized AI agents — Architect, Implementer, Reviewer, Tester, Researcher — orchestrated by a Team Lead, all accessible via simple slash commands.
12
+
13
+ ---
14
+
15
+ ## ✨ What is TeamMode?
16
+
17
+ TeamMode transforms OpenCode Desktop from a single-agent coding assistant into a **full development team**. Each agent has a distinct role, expertise, and personality — just like a real engineering team.
18
+
19
+ Instead of one agent trying to do everything, you get:
20
+
21
+ | Agent | Role | When to use |
22
+ |---|---|---|
23
+ | 🎯 **Team Lead** | Orchestrator | Complex tasks that need planning + multi-step execution |
24
+ | 🏗️ **Architect** | System designer | Design docs, module structure, API contracts |
25
+ | 💻 **Implementer** | Code writer | Building features, writing production code |
26
+ | 🔍 **Reviewer** | Dimension-focused auditor | Single-dimension review (completeness / correctness / impact) — the lead runs 3 in parallel |
27
+ | 🧪 **Tester** | Test engineer | Unit tests, integration tests, edge-case coverage, UI verification |
28
+ | 🔎 **Researcher** | Knowledge finder | Library evaluation, API docs, best practices |
29
+
30
+ ---
31
+
32
+ ## 🚀 Quick Start
33
+
34
+ ### Prerequisites
35
+
36
+ 1. **Install OpenCode Desktop** (if you haven't already):
37
+
38
+ | Platform | Install command |
39
+ |---|---|
40
+ | macOS (Apple Silicon) | `brew install --cask opencode-desktop` |
41
+ | macOS (Intel) | `brew install --cask opencode-desktop` |
42
+ | Windows | `scoop bucket add extras && scoop install extras/opencode-desktop` |
43
+ | Linux | Download from [opencode.ai/download](https://opencode.ai/download) |
44
+
45
+ Or install the **CLI/TUI** version:
46
+ ```bash
47
+ # one-line script (all platforms)
48
+ curl -fsSL https://opencode.ai/install | bash
49
+
50
+ # or via npm
51
+ npm install -g opencode-ai
52
+ ```
53
+
54
+ 2. **Node.js ≥ 18** (for npm)
55
+
56
+ ### Install TeamMode
57
+
58
+ **Option A — One-line installer (recommended):**
59
+
60
+ macOS / Linux (bash):
61
+ ```bash
62
+ curl -fsSL https://raw.githubusercontent.com/Te-River/Opencode-TeamMode/main/scripts/install.sh | bash
63
+ ```
64
+
65
+ Windows (PowerShell):
66
+ ```powershell
67
+ irm https://raw.githubusercontent.com/Te-River/Opencode-TeamMode/main/scripts/install.ps1 | iex
68
+ ```
69
+
70
+ These scripts install the npm package and automatically register the plugin in your `opencode.jsonc`.
71
+
72
+ **Option B — Manual npm install:**
73
+
74
+ ```bash
75
+ # 1. Install the plugin package
76
+ npm install -g @te-river/opencode-team-mode
77
+
78
+ # 2. Add the plugin to your opencode.jsonc
79
+ # (see "Configuration" below)
80
+ ```
81
+
82
+ **Option C — Local dev install (from this repo):**
83
+
84
+ ```bash
85
+ git clone https://github.com/Te-River/Opencode-TeamMode.git
86
+ cd Opencode-TeamMode
87
+ npm install
88
+ npm run build
89
+ npm link
90
+ ```
91
+
92
+ ---
93
+
94
+ ## ⚙️ Configuration
95
+
96
+ After installing, add the plugin to your `opencode.jsonc`:
97
+
98
+ ```jsonc
99
+ {
100
+ "$schema": "https://opencode.ai/config.json",
101
+ "plugin": [
102
+ "@te-river/opencode-team-mode@latest"
103
+ ]
104
+ }
105
+ ```
106
+
107
+ That's it. The plugin automatically injects all team agents and commands when OpenCode starts. **No need to manually copy agent files or command definitions.**
108
+
109
+ > 💡 **Tip:** After modifying `opencode.json`, **restart OpenCode Desktop** for changes to take effect.
110
+
111
+ > ⚠️ **Model choice matters.** Every judgment in the workflow — triage,
112
+ > decomposition, dispatch briefs, synthesis, review-loop verdicts — flows
113
+ > through the **Team Lead**. A weak model in that seat degrades the whole
114
+ > pipeline no matter how strong the specialists are. Pin your best
115
+ > reasoning model to the `team` agent (recipe in
116
+ > [Customization](#customization) below).
117
+
118
+ ### Global install (all projects)
119
+
120
+ To enable TeamMode in every project, add the plugin to your global config:
121
+
122
+ ```jsonc
123
+ // ~/.config/opencode/opencode.jsonc
124
+ {
125
+ "$schema": "https://opencode.ai/config.json",
126
+ "plugin": [
127
+ "@te-river/opencode-team-mode@latest"
128
+ ]
129
+ }
130
+ ```
131
+
132
+ ---
133
+
134
+ ## 📖 Usage
135
+
136
+ ### Slash Commands
137
+
138
+ TeamMode adds six slash commands to OpenCode. Type them in the chat input:
139
+
140
+ | Command | Agent | Description |
141
+ |---|---|---|
142
+ | `/team-plan <task>` | Architect | Create a detailed implementation plan with architecture, file manifest, and task breakdown |
143
+ | `/team-implement <task>` | Implementer | Write production code for a feature or task |
144
+ | `/team-review [scope]` | Reviewer | Audit code for bugs, security issues, and quality problems |
145
+ | `/team-test [scope]` | Tester | Generate comprehensive tests with edge-case coverage |
146
+ | `/team-research <topic>` | Researcher | Investigate libraries, APIs, or best practices |
147
+ | `/team-run <task>` | Team Lead | **Full workflow** — orchestrates all agents end-to-end |
148
+
149
+ #### Example workflow
150
+
151
+ ```
152
+ # 1. Plan the feature
153
+ /team-plan Add user authentication with OAuth2 and JWT tokens
154
+
155
+ # 2. Review the plan, then implement
156
+ /team-implement Implement the auth module as planned
157
+
158
+ # 3. Review the code
159
+ /team-review src/auth/
160
+
161
+ # 4. Write tests
162
+ /team-test src/auth/
163
+
164
+ # Or let the team lead handle everything:
165
+ /team-run Add user authentication with OAuth2 and JWT tokens
166
+ ```
167
+
168
+ ### Agent Picker
169
+
170
+ You can also invoke agents directly using the `@` mention in OpenCode Desktop:
171
+
172
+ - `@team` — Orchestrate a complex task
173
+ - `@architect` — Design a system or module
174
+ - `@implementer` — Write code
175
+ - `@reviewer` — Review code quality
176
+ - `@tester` — Write tests
177
+ - `@researcher` — Research a topic
178
+
179
+ ### Demo
180
+
181
+ A session transcript, recreated from how the flow actually looks. Team is the
182
+ default agent out of the box (see Configuration to opt out), so the user just
183
+ types into a fresh chat:
184
+
185
+ > **User:** Add token-bucket rate limiting to our Express API — 100 requests
186
+ > per minute per user, return 429 when exceeded. Don't touch anything under
187
+ > `src/legacy/`.
188
+
189
+ ```text
190
+ team Breaking this down: design → implement → review → test.
191
+ Task board: .git/opencode-team/20260831-143012/rate-limiter/ (session folder + board inside .git/, auto-swept after idle TTL)
192
+
193
+ ▸ @architect — designing (writes 01-architect-design.md)
194
+ ✓ in-memory token bucket, per-user key, 429 + Retry-After
195
+ summary above, full design on the board
196
+
197
+ ▸ @implementer — building (Reads: 01; writes 02-implementer-middleware.md)
198
+ ✓ src/middleware/rateLimit.ts (new), wired into src/app.ts (+3 lines)
199
+
200
+ ▸ @reviewer — auditing the diff (Reads: 01, 02; writes 03-reviewer-findings-r1.md)
201
+ ⚠ 1 MAJOR — bucket refill does read-modify-write in two steps;
202
+ races under concurrent requests
203
+ → converted to a fix task; dispatched to @implementer with the
204
+ finding text (the user was not asked to approve this step)
205
+
206
+ ▸ @implementer r2 — fixing the race (Reads: 03-r1 §MAJOR; writes 04-implementer-r2.md)
207
+ ✓ refill restructured to single atomic update
208
+
209
+ ▸ @reviewer r2 — re-review of fixed scope only
210
+ ✓ clean — r1 finding resolved, no regressions
211
+
212
+ ▸ @tester — covering limiter + boundaries (writes 05-tester-report.md)
213
+ ✓ 14/14 pass — burst edge, window expiry, concurrent refill,
214
+ src/legacy/** byte-identical (user boundary verified in tests)
215
+
216
+ team Done.
217
+ rate limiter shipped: rateLimit.ts (new) · app.ts (+3) · 14 tests green
218
+ review loop: 1 major found → fixed → clean
219
+ assumption: in-memory only — say the word if you want Redis
220
+ src/legacy/ untouched
221
+ task board left in place — TTL sweep will reclaim it
222
+ ```
223
+
224
+ The only message the user typed was the first one. The reviewer's finding
225
+ became the implementer's work order without a prompt; every artifact stayed
226
+ out of chat and on the board, read only by the dispatch that needed it.
227
+
228
+ ### Desktop-specific features
229
+
230
+ In **OpenCode Desktop**, you get additional UX benefits:
231
+
232
+ - 🎨 **Color-coded agents** — Each agent has a distinct color in the chat UI for easy identification.
233
+ - 📋 **Agent picker** — Click the agent dropdown to switch between team agents visually.
234
+ - 🔀 **Parallel sub-tasks** — The Team Lead can dispatch multiple sub-agents simultaneously, with results shown in parallel panels.
235
+ - 📊 **Session history** — All team interactions are saved and searchable in the Desktop session sidebar.
236
+
237
+ ---
238
+
239
+ ## 🏗️ Architecture
240
+
241
+ ```
242
+ opencode-team-mode/
243
+ ├── package.json ← npm package definition
244
+ ├── tsconfig.json ← TypeScript config
245
+ ├── src/
246
+ │ ├── index.ts ← Plugin entry (server() + config hook, id: "team-mode")
247
+ │ ├── agents.ts ← Agent definitions (prompts, modes, colors)
248
+ │ ├── commands.ts ← Command definitions (templates, agent bindings)
249
+ │ ├── blackboard.ts ← Shared blackboard + TTL auto-cleanup sweeper
250
+ │ └── types.ts ← Loader-contract type definitions (1.18.x)
251
+ ├── scripts/
252
+ │ ├── install.sh ← One-click installer (bash)
253
+ │ └── install.ps1 ← One-click installer (PowerShell)
254
+ ├── LICENSE ← Apache 2.0
255
+ ├── README.md ← English documentation
256
+ └── README.zh-CN.md ← Chinese documentation
257
+ ```
258
+
259
+ ### How it works
260
+
261
+ 1. OpenCode Desktop starts and loads `opencode.json(c)`.
262
+ 2. It sees `"@te-river/opencode-team-mode@latest"` in the `plugin` array and loads the npm package.
263
+ 3. The loader calls the plugin's `server(input, options)`, which registers a `config` hook; the hook injects 6 agents and 6 commands into the merged config.
264
+ 4. The plugin's `id: "team-mode"` is displayed as the plugin name in the Desktop UI.
265
+ 5. Agents and commands are immediately available in the Desktop UI — no file copying needed. User-defined agents with the same name always win (the plugin never clobbers them).
266
+
267
+ ---
268
+
269
+ ## 🗂️ Shared Blackboard (with automatic cleanup)
270
+
271
+ Sub-agents cannot message each other live (platform limitation), so TeamMode coordinates them through a **file blackboard** with strict ownership:
272
+
273
+ - **Session isolation:** every conversation owns ONE timestamped session
274
+ folder, and each multi-agent task gets its own directory inside it:
275
+ `<repo>/.git/opencode-team/<session-key>/<task-slug>/` — inside `.git/`,
276
+ so your working tree and commits are **never polluted**. (Non-git
277
+ workspaces fall back to the OS temp dir.) Since boards now linger until
278
+ the TTL sweep, the session layer keeps a fresh conversation from bumping
279
+ into — or reading stale artifacts from — a not-yet-swept board (timestamps
280
+ are second-granular, so overlap needs two conversations starting in the
281
+ same second).
282
+ - **File ownership:** every artifact is one topic-sized file written by
283
+ exactly one agent (`01-architect-auth-design.md`, `03-reviewer-auth-r1.md`).
284
+ ~100 lines max per file — split topics instead of letting files balloon.
285
+ - **Writes are frozen:** a revision is a new round-suffixed file
286
+ (`…-r2.md`); nothing is ever appended to or later agents reading stale rounds.
287
+ - **The Team Lead is the router:** every dispatch carries a manifest —
288
+ `Task:` (self-contained brief), `Reads:` (only the files that work package
289
+ needs), `Write to:` (the one file the agent owns). Specialists read nothing
290
+ that isn't listed, so long tasks never drown sub-agents in unnecessary context.
291
+ - **`MANIFEST.md` is the lead's state board:** a file index plus a ≤50-line
292
+ `## Current state` section (phase, decisions still valid, next steps),
293
+ updated every converged round — the lead's compressed memory across long tasks.
294
+ - The Team Lead also enforces a review/test **feedback loop**: Critical/Major
295
+ findings and product bugs automatically become tracked fix tasks until the
296
+ deliverable converges.
297
+
298
+ ### Ultra Review, pipeline gates & evidence (v1.4.6)
299
+
300
+ - **Ultra Review:** every non-trivial change is reviewed by three parallel
301
+ Reviewer dispatches, one dimension each — completeness (requirements
302
+ coverage), correctness (logic & security), impact (regressions & blast
303
+ radius) — each told to ignore the other two. The lead merges the three
304
+ reports into one severity-grouped list before the fix loop starts.
305
+ Trivial changes may skip review with a one-line reason.
306
+ - **Pipeline gates:** research completes before planning; design before
307
+ code; code before verify; verify before review; user-visible frontend
308
+ changes get UI verification before "done"; the final report waits for
309
+ every agent and a truthful todo board. Skipping a phase on a trivial task
310
+ costs one line of rationale.
311
+ - **Evidence standard:** "done / fixed / passed" claims need verifiable
312
+ evidence — command output, logs, diffs, screenshots. Narratives are
313
+ progress notes, not proof (enforced on specialists and the lead alike).
314
+ - **README-first:** the lead reads the project's README (plus AGENTS.md /
315
+ CLAUDE.md) before planning, and restates binding conventions in every
316
+ dispatch; specialists treat listed project conventions as binding.
317
+ - **Verbatim contracts:** parallel implementers that must interoperate get
318
+ the exact data contract (endpoints, field names, types) pasted verbatim
319
+ into every affected dispatch — mismatches are the #1 source of
320
+ integration bugs.
321
+ - **CHANGELOG care:** delivered changes append an entry to the project's
322
+ CHANGELOG.md (Keep a Changelog style) when one exists.
323
+
324
+ ### Triage — questions don't become code edits
325
+
326
+ The Team Lead classifies every incoming message before acting: a question or
327
+ consult gets an answer (zero file changes, fixes merely proposed and awaiting
328
+ your go-ahead); only explicit action requests enter the workflow. And whenever
329
+ you spell out what may or may not be touched, **those boundaries outrank
330
+ everything else** — the lead restates them in every single dispatch.
331
+
332
+ ### Cleanup — the TTL sweeper is the only path
333
+
334
+ | Who | When |
335
+ |---|---|
336
+ | Plugin code (in-process sweeper) | At startup + every hour: removes task directories idle **beyond the TTL** |
337
+
338
+ The Team Lead never deletes task directories — finished boards stay
339
+ readable so you can audit how a run went, and reclamation is pure code
340
+ that never relies on the model remembering to do anything (crashes and
341
+ force-kills leave nothing behind either). The sweeper prunes stale task
342
+ dirs individually under a still-live session, and reclaims an entirely
343
+ idle session folder in one pass. Set `ttlDays` to taste.
344
+
345
+ ### Configure the TTL
346
+
347
+ Default is **5 days**. To choose your own, use the tuple plugin form in
348
+ `opencode.jsonc`:
349
+
350
+ ```jsonc
351
+ {
352
+ "$schema": "https://opencode.ai/config.json",
353
+ "plugin": [
354
+ ["@te-river/opencode-team-mode@latest", { "ttlDays": 7 }]
355
+ ]
356
+ }
357
+ ```
358
+
359
+ `ttlDays` accepts any number of days in `(0, 365]`; invalid values silently
360
+ fall back to 5.
361
+
362
+ ### Default agent
363
+
364
+ By default TeamMode **makes Team your default agent** — new chats open
365
+ directly in the team orchestrator. One side effect comes with the default
366
+ slot: the switcher pins the default agent to the **first position** and
367
+ sorts everything else alphabetically, so the picker order is
368
+ **team, build, plan**. (Want Team below Plan instead? That requires
369
+ giving up the default slot — see the opt-out below; the two are
370
+ mutually exclusive by the server's sort.)
371
+
372
+ To opt out (`build` stays the default, picker order **build, plan,
373
+ team**):
374
+
375
+ ```jsonc
376
+ {
377
+ "plugin": [
378
+ ["@te-river/opencode-team-mode@latest", { "defaultAgent": false }]
379
+ ]
380
+ }
381
+ ```
382
+
383
+ An explicitly configured non-`build` `default_agent` in your own config is
384
+ always respected untouched — the plugin never clobbers it.
385
+
386
+ **Upgrade note:** v1.4.4 briefly made this promotion opt-in; v1.4.5 restores
387
+ Team-as-default as the shipped behavior. If you pinned `{ "defaultAgent":
388
+ true }` during v1.4.4, you can drop that option (or switch it to `false` to
389
+ opt out).
390
+
391
+ ---
392
+
393
+ ## 🔧 Customization
394
+
395
+ ### The Team Lead's model matters most
396
+
397
+ The Lead is the orchestrating brain: it classifies every message, cuts the
398
+ work into packages, writes each dispatch manifest, judges reviewer/tester
399
+ findings, and synthesizes the final deliverable. Quality failures there
400
+ **multiply down the pipeline** — a mediocre Lead mis-decomposes, briefs the
401
+ experts vaguely, and waves weak work through; no specialist can rescue an
402
+ assignment it was never correctly given.
403
+
404
+ So run the strongest model you can afford **in the Lead seat**. The other
405
+ roles tolerate cheaper models — they work from tight briefs with scoped
406
+ reading. Pin models per agent:
407
+
408
+ ```jsonc
409
+ {
410
+ "agent": {
411
+ // Team Lead — orchestration earns your best model
412
+ "team": { "model": "anthropic/claude-opus-4-5" },
413
+ // specialists — cheaper models are usually fine
414
+ "implementer": { "model": "anthropic/claude-sonnet-4-6" }
415
+ }
416
+ }
417
+ ```
418
+
419
+ (Model IDs above are placeholders — use whatever your provider exposes.
420
+ Your own `agent.team` definition always takes precedence over the plugin's.)
421
+
422
+ ### Override an agent
423
+
424
+ Add an agent with the same name in your `opencode.json` — your definition takes precedence:
425
+
426
+ ```jsonc
427
+ {
428
+ "agent": {
429
+ "reviewer": {
430
+ "model": "anthropic/claude-sonnet-4-6",
431
+ "prompt": "You are an extremely strict reviewer. Reject anything with a lint warning."
432
+ }
433
+ }
434
+ }
435
+ ```
436
+
437
+ ### Add your own agents
438
+
439
+ TeamMode does not prevent you from adding more agents. Define them alongside the team:
440
+
441
+ ```jsonc
442
+ {
443
+ "agent": {
444
+ "devops": {
445
+ "mode": "subagent",
446
+ "description": "Handles CI/CD, Docker, and deployment tasks.",
447
+ "prompt": "You are the DevOps engineer..."
448
+ }
449
+ }
450
+ }
451
+ ```
452
+
453
+ ### Disable an agent
454
+
455
+ ```jsonc
456
+ {
457
+ "agent": {
458
+ "researcher": { "disable": true }
459
+ }
460
+ }
461
+ ```
462
+
463
+ ---
464
+
465
+ ## 📦 Publishing to npm
466
+
467
+ If you want to publish your own fork:
468
+
469
+ ```bash
470
+ npm run build # compile TypeScript → dist/
471
+ npm version patch # bump version
472
+ npm publish # publish to npm registry
473
+ ```
474
+
475
+ ---
476
+
477
+ ## 🤝 Contributing
478
+
479
+ Contributions are welcome! Areas where we need help:
480
+
481
+ - 🌐 **Localization** — Translate agent prompts to other languages
482
+ - 🎨 **More agent roles** — DevOps, DBA, Security Specialist, UX Designer
483
+ - 🔧 **Additional commands** — `/team-deploy`, `/team-docs`, `/team-refactor`
484
+ - 📝 **Better prompts** — Improve agent behavior through prompt engineering
485
+
486
+ ---
487
+
488
+ ## 📄 License
489
+
490
+ [Apache License 2.0](./LICENSE)
491
+
492
+ ---
493
+
494
+ ## 🔗 Links
495
+
496
+ - [npm Package](https://www.npmjs.com/package/@te-river/opencode-team-mode) — `@te-river/opencode-team-mode` on npm
497
+ - [OpenCode Desktop](https://opencode.ai) — Official website & download
498
+ - [OpenCode Docs](https://opencode.ai/docs) — Configuration & plugin documentation
499
+ - [OpenCode Plugin API](https://opencode.ai/docs/plugins) — Build your own plugins
500
+ - [OpenCode GitHub](https://github.com/anomalyco/opencode) — Source code for OpenCode itself