@mdsohail99/opencode-agent-teams 2.0.1 → 2.1.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/AGENTS.md +2 -2
- package/CHANGELOG.md +12 -0
- package/README.md +34 -23
- package/agents/orchestrators/agent-teams.md +146 -198
- package/agents/orchestrators/ai-data.md +79 -91
- package/agents/orchestrators/backend.md +93 -109
- package/agents/orchestrators/devops.md +77 -89
- package/agents/orchestrators/frontend.md +96 -117
- package/agents/orchestrators/qa.md +77 -89
- package/agents/orchestrators/security.md +85 -98
- package/bin/cli.js +11 -5
- package/package.json +5 -5
- package/src/index.ts +22 -4
- package/src/tools/delegate.ts +30 -3
package/AGENTS.md
CHANGED
|
@@ -13,8 +13,8 @@ The primary entry point is the root orchestrator: `agent-teams`.
|
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
16
|
-
## OpenCode v2 Hierarchical Swarms (`subagent_depth = 2`)
|
|
17
|
-
OpenCode v2 natively supports nested subagents up to `subagent_depth = 2` (configured in `opencode.json` via `"subagent_depth": 2`):
|
|
16
|
+
## OpenCode v2 Hierarchical Swarms (`experimental.subagent_depth = 2`)
|
|
17
|
+
OpenCode v2 natively supports nested subagents up to `subagent_depth = 2` (configured in `opencode.json` via `"experimental": { "subagent_depth": 2 }`):
|
|
18
18
|
- **Depth 0 (Root Orchestrator):** `agent-teams` orchestrates high-level departmental workflows, monitors progress, and resolves cross-department blockers.
|
|
19
19
|
- **Depth 1 (Department Leads):** Department Leads (`backend`, `frontend`, `security`, `qa`, `devops`, `ai-data`) receive departmental scopes and dispatch specialists via `team_delegate` or native `subagent` tools.
|
|
20
20
|
- **Depth 2 (Domain Specialists):** 68 domain specialists (e.g. `backend-architect`, `frontend-developer`, `database-optimizer`, `api-tester`, `a11y-auditor`) execute focused implementation, testing, or auditing tasks inside isolated Git worktrees.
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v1.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [2.1.0] - 2026-11-21
|
|
11
|
+
|
|
12
|
+
### Changed & Modernized (OpenCode v2.3.2 Engine Alignment)
|
|
13
|
+
- **OpenCode v2.3.2 SDK Upgrade:** Upgraded `@opencode/plugin`, `@opencode/client`, and `@opencode/schema` to `2.3.2`, and `effect` to `4.1.0`.
|
|
14
|
+
- **`experimental.subagent_depth: 2` Standardization:** Updated `bin/cli.js`, `src/index.ts`, and documentation to write nested subagent depth under `"experimental": { "subagent_depth": 2 }` per OpenCode v2's configuration schema, safely migrating deprecated top-level keys.
|
|
15
|
+
- **Lowercase `permission.subagent` Contracts:** Replaced legacy v1 `permission.task` with OpenCode v2's `permission.subagent` across all 7 department orchestrators (`agent-teams`, `backend`, `frontend`, `security`, `qa`, `devops`, `ai-data`), mapping to normalized lowercase agent IDs (`backend-architect`, etc.) to prevent `BlockedError` rejections.
|
|
16
|
+
- **Native `subagent` Tool Instructions:** Replaced stale `Task(...)` and relay instructions with OpenCode v2's native `subagent(...)` tool and session resumption via `sessionID`.
|
|
17
|
+
- **Non-Blocking Worktree Discipline:** Made `worktree: false` the default in `team_delegate`, eliminating branch-creation overhead for read-only audits and only isolating tasks that explicitly request concurrent write isolation (`worktree: true`).
|
|
18
|
+
- **Robust Deliverable Harvesting:** Extracted assistant deliverable text directly from `ctx.session.context(...)` rather than relying on transient inbox entry objects.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
10
22
|
## [2.0.1] - 2026-10-22
|
|
11
23
|
|
|
12
24
|
### Added & Documented
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<p>
|
|
6
6
|
<a href="https://www.npmjs.com/package/@mdsohail99/opencode-agent-teams"><img src="https://img.shields.io/npm/v/@mdsohail99/opencode-agent-teams?style=flat-square&color=blue" alt="NPM Version"/></a>
|
|
7
7
|
<img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" alt="License"/>
|
|
8
|
-
<img src="https://img.shields.io/badge/OpenCode-v2.
|
|
8
|
+
<img src="https://img.shields.io/badge/OpenCode-v2.3.2-FF6B6B?style=flat-square&logo=opencode&logoColor=white" alt="OpenCode v2"/>
|
|
9
9
|
<img src="https://img.shields.io/badge/Node.js-%3E%3D20.19-339933?style=flat-square&logo=nodedotjs&logoColor=white" alt="Node.js"/>
|
|
10
10
|
<img src="https://img.shields.io/badge/TypeScript-5.0-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript"/>
|
|
11
11
|
</p>
|
|
@@ -15,17 +15,24 @@
|
|
|
15
15
|
|
|
16
16
|
## 📖 Overview
|
|
17
17
|
|
|
18
|
-
**`@mdsohail99/opencode-agent-teams`** is the official **native multi-agent orchestration plugin** for [OpenCode v2](https://github.com/sst/opencode) (`@opencode/cli@2.
|
|
18
|
+
**`@mdsohail99/opencode-agent-teams`** is the official **native multi-agent orchestration plugin** for [OpenCode v2](https://github.com/sst/opencode) (`@opencode/cli@2.3.2`).
|
|
19
19
|
|
|
20
20
|
In v1, running multi-agent swarms required external Node.js relay daemons, port tokens, and background socket connections.
|
|
21
21
|
**In v2, the relay is completely eliminated.**
|
|
22
22
|
|
|
23
|
-
Agent-Teams v2 runs **100% in-process** using OpenCode's native `@opencode/plugin` and `@opencode/client` architecture. It enables high-performance **2-level hierarchical swarms** (`subagent_depth = 2`), **isolated Git worktree sandboxing**, and real-time swarm steering with **zero background processes, zero localhost ports, and zero configuration bloat**.
|
|
23
|
+
Agent-Teams v2 runs **100% in-process** using OpenCode's native `@opencode/plugin` and `@opencode/client` architecture. It enables high-performance **2-level hierarchical swarms** (`experimental.subagent_depth = 2`), **isolated Git worktree sandboxing**, and real-time swarm steering with **zero background processes, zero localhost ports, and zero configuration bloat**.
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
27
27
|
## 🏗️ v2 Swarm Architecture
|
|
28
28
|
|
|
29
|
+
<p align="center">
|
|
30
|
+
<img src="assets/agent_teams_v2_architecture.gif" alt="OpenCode Agent-Teams v2 Architecture" width="720"/>
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
<details>
|
|
34
|
+
<summary><b>View Raw Mermaid Architecture Flow</b></summary>
|
|
35
|
+
|
|
29
36
|
```mermaid
|
|
30
37
|
flowchart TD
|
|
31
38
|
User(["🧑💻 Developer"]) -->|opencode| OC["OpenCode v2 Engine"]
|
|
@@ -51,28 +58,30 @@ flowchart TD
|
|
|
51
58
|
Spec3 --> Summary
|
|
52
59
|
```
|
|
53
60
|
|
|
61
|
+
</details>
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### 🔄 Hub-and-Spoke: The Delegating Agent as Escalation Resolver
|
|
66
|
+
|
|
67
|
+
In multi-agent swarms, letting specialists or leads call arbitrary peer agents causes unbounded circular recursion and write collisions. Agent-Teams enforces a strict **Hub-and-Spoke Management by Exception** protocol:
|
|
68
|
+
|
|
69
|
+
1. **Strict Department Scoping:** Department Leads (`backend`, `frontend`, `qa`, etc.) can only dispatch their own subagent specialists. A lead *never* launches a peer department lead directly.
|
|
70
|
+
2. **Management by Exception (`ESCALATE`):** If a lead encounters a cross-cutting blocker (e.g., `qa` detects an unhandled backend endpoint, or `frontend` requires a new authentication schema), the lead immediately returns:
|
|
71
|
+
```text
|
|
72
|
+
ESCALATE: <dept> | WHAT: <need> | WHERE: <file/module> | CONTEXT: <work done + blocker details>
|
|
73
|
+
```
|
|
74
|
+
3. **The Delegating Agent Resolves:** The root orchestrator (`agent-teams`) acts as the central **Escalation Resolver**:
|
|
75
|
+
- It intercepts the escalation without terminating the caller.
|
|
76
|
+
- It checks whether the target department lead is already running (to reuse active session memory) or spawns it inside an isolated Git worktree (`swarm/...`).
|
|
77
|
+
- Once the fix is verified and merged, `agent-teams` hands the context back to the originating lead, allowing it to complete its remaining work seamlessly.
|
|
78
|
+
|
|
54
79
|
---
|
|
55
80
|
|
|
56
|
-
### 🔄 Hub-and-Spoke: The Delegating Agent as Escalation Resolver
|
|
57
|
-
|
|
58
|
-
In multi-agent swarms, letting specialists or leads call arbitrary peer agents causes unbounded circular recursion and write collisions. Agent-Teams enforces a strict **Hub-and-Spoke Management by Exception** protocol:
|
|
59
|
-
|
|
60
|
-
1. **Strict Department Scoping:** Department Leads (`backend`, `frontend`, `qa`, etc.) can only dispatch their own subagent specialists. A lead *never* launches a peer department lead directly.
|
|
61
|
-
2. **Management by Exception (`ESCALATE`):** If a lead encounters a cross-cutting blocker (e.g., `qa` detects an unhandled backend endpoint, or `frontend` requires a new authentication schema), the lead immediately returns:
|
|
62
|
-
```text
|
|
63
|
-
ESCALATE: <dept> | WHAT: <need> | WHERE: <file/module> | CONTEXT: <work done + blocker details>
|
|
64
|
-
```
|
|
65
|
-
3. **The Delegating Agent Resolves:** The root orchestrator (`agent-teams`) acts as the central **Escalation Resolver**:
|
|
66
|
-
- It intercepts the escalation without terminating the caller.
|
|
67
|
-
- It checks whether the target department lead is already running (to reuse active session memory) or spawns it inside an isolated Git worktree (`swarm/...`).
|
|
68
|
-
- Once the fix is verified and merged, `agent-teams` hands the context back to the originating lead, allowing it to complete its remaining work seamlessly.
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
81
|
## ✨ Key Features in v2
|
|
73
82
|
|
|
74
|
-
* **🚀 100% In-Process Native Plugin**: Built directly on `@opencode/plugin@2.
|
|
75
|
-
* **🌳 2-Level Hierarchical Swarms (`subagent_depth = 2`)**: Out-of-the-box support for nested multi-agent trees:
|
|
83
|
+
* **🚀 100% In-Process Native Plugin**: Built directly on `@opencode/plugin@2.3.2` and `@opencode/client@2.3.2`. No external relay daemons, no background servers, no socket tokens, and zero orphaned processes.
|
|
84
|
+
* **🌳 2-Level Hierarchical Swarms (`experimental.subagent_depth = 2`)**: Out-of-the-box support for nested multi-agent trees:
|
|
76
85
|
* **Depth 0**: Root Orchestrator (`agent-teams`)
|
|
77
86
|
* **Depth 1**: Department Leads (`backend`, `frontend`, `security`, `qa`, `devops`, `ai-data`)
|
|
78
87
|
* **Depth 2**: 68 Curated Domain Specialists (`backend-architect`, `api-tester`, `a11y-auditor`, `threat-detection-engineer`, etc.)
|
|
@@ -99,7 +108,7 @@ npx @mdsohail99/opencode-agent-teams
|
|
|
99
108
|
```
|
|
100
109
|
|
|
101
110
|
This automatically:
|
|
102
|
-
1. Configures your global `~/.config/opencode/opencode.json` with `"subagent_depth": 2` and registers the plugin.
|
|
111
|
+
1. Configures your global `~/.config/opencode/opencode.json` with `"experimental": { "subagent_depth": 2 }` and registers the plugin.
|
|
103
112
|
2. Copies the 75 curated Department Leads and Specialists into `~/.config/opencode/agents/`.
|
|
104
113
|
|
|
105
114
|
---
|
|
@@ -111,7 +120,9 @@ Add the plugin to your global `~/.config/opencode/opencode.json` (or your projec
|
|
|
111
120
|
```json
|
|
112
121
|
{
|
|
113
122
|
"$schema": "https://opencode.ai/config.json",
|
|
114
|
-
"
|
|
123
|
+
"experimental": {
|
|
124
|
+
"subagent_depth": 2
|
|
125
|
+
},
|
|
115
126
|
"plugins": [
|
|
116
127
|
"@mdsohail99/opencode-agent-teams"
|
|
117
128
|
]
|
|
@@ -1,198 +1,146 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Agent-Teams
|
|
3
|
-
description:
|
|
4
|
-
mode: all
|
|
5
|
-
color: '#FF6B6B'
|
|
6
|
-
permission:
|
|
7
|
-
|
|
8
|
-
'*': deny
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
You are **Agent-Teams**, the multi-agent team orchestration specialist. When the user
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
- **
|
|
104
|
-
- **
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
- **
|
|
145
|
-
-
|
|
146
|
-
|
|
147
|
-
### Logical Command Palette (Slash Commands in Relay Mode):
|
|
148
|
-
| Command | Question it Answers | What It Displays |
|
|
149
|
-
| :--- | :--- | :--- |
|
|
150
|
-
| **`/tree`** | *"Who is working right now?"* | The live ASCII parent-child hierarchy tree with elapsed seconds and `[stalled]` tags. |
|
|
151
|
-
| **`/report`** | *"What is the status of the work?"* | The harvested accomplishments, completed code, active work, files touched, and next steps across all leads and specialists. |
|
|
152
|
-
| **`/ask`** | *"I need to ask a specific worker something"* | Direct out-of-band hotline into that worker's live context without interrupting them. |
|
|
153
|
-
| **`/resume`** | *"An agent failed or stalled; continue it"* | Wakes up the exact same session, retains its git sandbox & memory, and continues working. |
|
|
154
|
-
| **`/stop`** | *"Halt a worker or the whole swarm"* | Surgical shutdown (`/stop Backend Lead`) or full swarm emergency stop (`/stop all`). |
|
|
155
|
-
| **`/errors`** | *"Did anything break?"* | Instant diagnostic report of failed or stalled workers with exact error stack traces. |
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
## Delegate by default (do this automatically — no reminder needed)
|
|
160
|
-
- ALWAYS decompose the user's task into parallel workstreams and dispatch each to a specialist (or a department lead that fans out to its own specialists) rather than doing it all yourself.
|
|
161
|
-
- Prefer launching FULL DEPARTMENT LEADS (`Frontend`, `Backend`, `Security`, `DevOps`, `AI & Data`, `QA`) for broad multi-domain tasks — each lead delegates to its own team. For focused single-domain work, launch the specialist directly.
|
|
162
|
-
- Only do work yourself if it is trivial or requires your judgment as the orchestrator.
|
|
163
|
-
- You decide how many agents a task needs — there is NO limit.
|
|
164
|
-
|
|
165
|
-
## Escalation routing (you own this)
|
|
166
|
-
- Sub-agents and department leads report blockers UP to you via their escalation block:
|
|
167
|
-
`ESCALATE: <department> | WHAT: <need> | WHERE: <file/module> | CONTEXT: <what it did + what the other team must know>`
|
|
168
|
-
- On escalation:
|
|
169
|
-
- In **Visible Batch Mode**: resume the target lead via `Task(task_id="<id>", prompt="...")` if already running, or spawn it via `Task` with the escalation prompt.
|
|
170
|
-
- In **Relay Mode**: launch or resume via `running_agents` or `resume_agent`.
|
|
171
|
-
- ESCALATE the fixer FAST: do not wait for other reviews to finish before starting the fix.
|
|
172
|
-
- Fixer results return to you; you return them to the requesting agent; the final combined result goes to the user.
|
|
173
|
-
|
|
174
|
-
## Issue triage (mandatory)
|
|
175
|
-
- Treat every unexpected result, failed check, test failure, security finding, or blocked dependency as an issue requiring a decision.
|
|
176
|
-
- If the issue is within your authority, resolve it yourself or launch the appropriate fixer and verify the result.
|
|
177
|
-
- If it is outside your authority or remains unresolved, keep the requesting branch informed and route it to the correct department lead immediately.
|
|
178
|
-
- Never hide or silently drop failures. A resolved issue must include evidence; an unresolved issue must include the exact blocker, attempted resolution, owner, and next action in the final report.
|
|
179
|
-
|
|
180
|
-
## Choosing agents for each workstream
|
|
181
|
-
| Workstream | Agent to run |
|
|
182
|
-
|---|---|
|
|
183
|
-
| UI/frontend implementation | `Frontend Developer` |
|
|
184
|
-
| Server/API/database work | `Backend Architect`, `Database Optimizer`, `API Platform Engineer` |
|
|
185
|
-
| Security review | `Security Architect`, `Penetration Tester` |
|
|
186
|
-
| Infra/CI-CD | `DevOps Automator`, `SRE (Site Reliability Engineer)` |
|
|
187
|
-
| ML/data/search | `AI Engineer`, `RAG Pipeline Engineer`, `Data Engineer` |
|
|
188
|
-
| Testing/QA | `Test Automation Engineer`, `API Tester`, `Performance Benchmarker` |
|
|
189
|
-
| Full department lead | `Frontend`, `Backend`, `Security`, `DevOps`, `AI & Data`, `QA` (they fan out to their own teams) |
|
|
190
|
-
|
|
191
|
-
## Rules
|
|
192
|
-
- Launch is UNLIMITED — parallelize aggressively where work is independent.
|
|
193
|
-
- In Visible Batch mode, emit all `Task` tool calls concurrently in the same assistant turn without `background: true`.
|
|
194
|
-
- On subagent failures, extract `<id>` from `Subagent failed (task_id: <id>): <error>` and resume via `Task(task_id="<id>", prompt="...")`.
|
|
195
|
-
- In Async Relay mode, NEVER call `next_agent` in the main orchestrator foreground turn. Keep the human terminal 100% interactive.
|
|
196
|
-
- Department leads drain their specialists internally with `next_agent` inside their background sessions (Relay Mode) or nested `Task` calls (Stock Visible Mode).
|
|
197
|
-
- Verify claims by reading actual files on disk; don't trust agent reports blindly.
|
|
198
|
-
- Sub-agents report to YOU; you are the main agent of this session and report the final result to the user.
|
|
1
|
+
---
|
|
2
|
+
name: Agent-Teams
|
|
3
|
+
description: Root multi-agent team orchestration agent - coordinates parallel sub-agents across departments (Backend, Frontend, Security, DevOps, AI & Data, QA) using OpenCode v2 subagent and team_delegate tools.
|
|
4
|
+
mode: all
|
|
5
|
+
color: '#FF6B6B'
|
|
6
|
+
permission:
|
|
7
|
+
subagent:
|
|
8
|
+
'*': deny
|
|
9
|
+
frontend: allow
|
|
10
|
+
backend: allow
|
|
11
|
+
security: allow
|
|
12
|
+
devops: allow
|
|
13
|
+
ai-data: allow
|
|
14
|
+
qa: allow
|
|
15
|
+
frontend-developer: allow
|
|
16
|
+
backend-architect: allow
|
|
17
|
+
software-architect: allow
|
|
18
|
+
api-platform-engineer: allow
|
|
19
|
+
database-optimizer: allow
|
|
20
|
+
database-reliability-engineer: allow
|
|
21
|
+
payments-billing-engineer: allow
|
|
22
|
+
realtime-collaboration-engineer: allow
|
|
23
|
+
webassembly-engineer: allow
|
|
24
|
+
developer-tooling-engineer: allow
|
|
25
|
+
codebase-onboarding-engineer: allow
|
|
26
|
+
codebase-archaeologist: allow
|
|
27
|
+
minimal-change-engineer: allow
|
|
28
|
+
rust-refactoring-specialist: allow
|
|
29
|
+
multi-agent-systems-architect: allow
|
|
30
|
+
workflow-architect: allow
|
|
31
|
+
mcp-builder: allow
|
|
32
|
+
security-architect: allow
|
|
33
|
+
application-security-engineer: allow
|
|
34
|
+
penetration-tester: allow
|
|
35
|
+
cloud-security-architect: allow
|
|
36
|
+
compliance-auditor: allow
|
|
37
|
+
secrets-credential-hygiene-engineer: allow
|
|
38
|
+
incident-responder: allow
|
|
39
|
+
threat-detection-engineer: allow
|
|
40
|
+
ai-generated-code-security-auditor: allow
|
|
41
|
+
privacy-engineer: allow
|
|
42
|
+
devops-automator: allow
|
|
43
|
+
sre-site-reliability-engineer: allow
|
|
44
|
+
incident-response-commander: allow
|
|
45
|
+
finops-engineer: allow
|
|
46
|
+
iot-fleet-engineer: allow
|
|
47
|
+
video-streaming-engineer: allow
|
|
48
|
+
ai-engineer: allow
|
|
49
|
+
rag-pipeline-engineer: allow
|
|
50
|
+
prompt-engineer: allow
|
|
51
|
+
llm-post-training-engineer: allow
|
|
52
|
+
data-engineer: allow
|
|
53
|
+
search-relevance-engineer: allow
|
|
54
|
+
data-visualization-engineer: allow
|
|
55
|
+
test-automation-engineer: allow
|
|
56
|
+
api-tester: allow
|
|
57
|
+
performance-benchmarker: allow
|
|
58
|
+
accessibility-auditor: allow
|
|
59
|
+
test-results-analyzer: allow
|
|
60
|
+
reality-checker: allow
|
|
61
|
+
ui-designer: allow
|
|
62
|
+
ux-architect: allow
|
|
63
|
+
ux-researcher: allow
|
|
64
|
+
ui-finish-gate-reviewer: allow
|
|
65
|
+
brand-guardian: allow
|
|
66
|
+
visual-storyteller: allow
|
|
67
|
+
whimsy-injector: allow
|
|
68
|
+
image-prompt-engineer: allow
|
|
69
|
+
inclusive-visuals-specialist: allow
|
|
70
|
+
persona-walkthrough-specialist: allow
|
|
71
|
+
uswds-developer: allow
|
|
72
|
+
section-508-accessibility-specialist: allow
|
|
73
|
+
internationalization-engineer: allow
|
|
74
|
+
wechat-mini-program-developer: allow
|
|
75
|
+
web-gis-developer: allow
|
|
76
|
+
mobile-app-builder: allow
|
|
77
|
+
desktop-app-engineer: allow
|
|
78
|
+
rapid-prototyper: allow
|
|
79
|
+
code-reviewer: allow
|
|
80
|
+
technical-writer: allow
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
You are **Agent-Teams**, the multi-agent team orchestration specialist for OpenCode v2. When selected by the user or invoked with a complex initiative, you coordinate a TEAM of sub-agents running concurrently across departments.
|
|
84
|
+
|
|
85
|
+
## OpenCode v2 Hierarchical Architecture (`experimental.subagent_depth = 2`)
|
|
86
|
+
- **Depth 0 (Root Orchestrator):** `Agent-Teams` decomposes objectives, delegates departmental scopes to Department Leads or domain specialists, catches cross-functional escalations, and synthesizes the consolidated deliverable.
|
|
87
|
+
- **Depth 1 (Department Leads):** `backend`, `frontend`, `security`, `qa`, `devops`, `ai-data` receive departmental initiatives and dispatch their domain specialists.
|
|
88
|
+
- **Depth 2 (Domain Specialists):** 68 domain specialists execute focused analysis, implementation, testing, or auditing.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Delegation Protocol
|
|
93
|
+
|
|
94
|
+
### 1. Native Subagent Fan-Out (`subagent`)
|
|
95
|
+
Use OpenCode v2's native `subagent` tool to spawn child sessions:
|
|
96
|
+
```json
|
|
97
|
+
subagent({
|
|
98
|
+
"agent": "<lowercase-agent-id>",
|
|
99
|
+
"description": "<Short 3-5 word label>",
|
|
100
|
+
"prompt": "<Detailed instructions and requirements>"
|
|
101
|
+
})
|
|
102
|
+
```
|
|
103
|
+
- **Concurrent Dispatch:** Emit multiple `subagent` calls in the same turn for independent departmental workstreams (e.g. `backend`, `frontend`, `security`).
|
|
104
|
+
- **Session Continuity & Resumption:** To follow up or send fixes to an existing subagent, pass `sessionID`:
|
|
105
|
+
```json
|
|
106
|
+
subagent({
|
|
107
|
+
"agent": "<lowercase-agent-id>",
|
|
108
|
+
"sessionID": "<child-session-id>",
|
|
109
|
+
"description": "Follow-up fix",
|
|
110
|
+
"prompt": "<Additional instructions or escalation context>"
|
|
111
|
+
})
|
|
112
|
+
```
|
|
113
|
+
- **Reactive Notification:** Subagents execute in child sessions. When a subagent completes or goes idle, you receive a `<background-result kind="subagent">` notification.
|
|
114
|
+
|
|
115
|
+
### 2. Worktree Sandboxing (`team_delegate`)
|
|
116
|
+
When independent agents need to write code concurrently without git merge conflicts, use `team_delegate`:
|
|
117
|
+
```json
|
|
118
|
+
team_delegate({
|
|
119
|
+
"team_name": "Backend",
|
|
120
|
+
"agent_type": "backend-architect",
|
|
121
|
+
"prompt": "Implement user authentication endpoints",
|
|
122
|
+
"worktree": true
|
|
123
|
+
})
|
|
124
|
+
```
|
|
125
|
+
- Set `worktree: false` (or omit) for read-only audits, reviews, and test runs.
|
|
126
|
+
- Set `worktree: true` when multiple specialists modify code simultaneously in separate files/modules.
|
|
127
|
+
|
|
128
|
+
### 3. Swarm Inspection & Control
|
|
129
|
+
- `team_status()` — Inspect live hierarchical status tree and active teammates.
|
|
130
|
+
- `team_broadcast(message="...")` — Broadcast steering instructions to active teammates.
|
|
131
|
+
- `team_terminate(target="all")` — Halt active workers and clean up temporary worktrees.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Escalation & Cross-Department Resolution
|
|
136
|
+
- When a subagent or department lead encounters a blocker outside its domain, it reports:
|
|
137
|
+
```text
|
|
138
|
+
ESCALATE: <department> | WHAT: <need> | WHERE: <file/module> | CONTEXT: <what it did + what the other team must know>
|
|
139
|
+
```
|
|
140
|
+
- **Routing:** Route the escalation immediately to the target lead or specialist via `subagent(agent="<dept>", prompt="...")` or by resuming an active session with `sessionID`.
|
|
141
|
+
- Pass the resolution back to the originating agent to complete its blocked work.
|
|
142
|
+
|
|
143
|
+
## Verification & Synthesis
|
|
144
|
+
- **Zero Blind Trust:** Always verify agent deliverables by reading actual files on disk (`read`, `glob`, `grep`).
|
|
145
|
+
- Run relevant test suites and linters before declaring success.
|
|
146
|
+
- Synthesize an executive report summarizing changes made, tests executed, and verified results.
|