@alexgabbia/role-dispatcher 1.2.0 → 1.3.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
@@ -28,7 +28,7 @@ Instead of a one-size-fits-all response, you get answers from the **actual profe
28
28
  | | Without Role Dispatcher | With Role Dispatcher |
29
29
  |---|---|---|
30
30
  | **Expertise** | Generic AI response | Specialist-grade from 209+ roles |
31
- | **Multi-domain tasks** | You manage context yourself | Auto-dispatches 1-3 agents that collaborate |
31
+ | **Multi-domain tasks** | You manage context yourself | Auto-dispatches the right number of agents that collaborate |
32
32
  | **Quality control** | Hope for the best | Confidence scoring + Review Agent validation |
33
33
  | **Model selection** | One size fits all | Right model (Haiku/Sonnet/Opus) per task complexity |
34
34
  | **Your control** | Take what you get | Propose & Confirm — change roles or model before dispatch |
@@ -121,9 +121,9 @@ Proceed? You can:
121
121
 
122
122
  1. **Analyze** — Detects your language, scans request against keyword index + semantic inference
123
123
  2. **Match** — Identifies relevant categories from the 14 available
124
- 3. **Select** — Picks 1-3 specialist roles using Key Skills matching, determines optimal model
125
- 4. **Propose & Confirm** — Shows proposed roles (with key skills) and model, waits for your approval or changes
126
- 5. **Dispatch** — Launches agents with structured prompts including expertise profiles and behavioral guidelines
124
+ 3. **Select** — Picks N specialist roles using Key Skills matching, determines optimal model and dispatch mode
125
+ 4. **Propose & Confirm** — Shows proposed roles (with key skills), model, and dispatch mode, waits for your approval or changes
126
+ 5. **Dispatch** — Launches agents via subagents (1-4) or Agent Teams (5+) with structured prompts
127
127
  6. **Review** — (2+ agents) Validates completeness, detects conflicts, verifies integration
128
128
  7. **Synthesize** — Merges outputs into a single coherent answer with aggregate confidence
129
129
 
@@ -195,6 +195,22 @@ You: "yes"
195
195
  -> Architecture -> Implementation plan -> Deployment strategy
196
196
  ```
197
197
 
198
+ ### Large-Scale: SaaS Platform (Agent Team)
199
+ ```
200
+ You: "Build a complete SaaS project management tool with auth, real-time
201
+ collaboration, Stripe billing, and admin dashboard"
202
+
203
+ Dispatcher proposes:
204
+ Agents: Software Architect + Backend Dev + Frontend Dev + UX/UI Designer
205
+ + DevOps Engineer + Security Engineer + Payment Specialist
206
+ Dispatch mode: Agent Team (7 agents, deep collaboration)
207
+ Model: Opus
208
+
209
+ You: "yes"
210
+ -> Creates team, Software Architect leads, teammates self-coordinate
211
+ -> Delivers unified architecture + implementation plan
212
+ ```
213
+
198
214
  ### User Override
199
215
  ```
200
216
  You: "Set up a CI/CD pipeline for our Node.js monorepo"
@@ -209,6 +225,38 @@ You: "use only DevOps Engineer with haiku"
209
225
 
210
226
  ---
211
227
 
228
+ ## Agent Teams (Experimental)
229
+
230
+ For large-scale tasks (5+ agents) or when agents need to discuss and challenge each other, the dispatcher uses **Agent Teams** — a Claude Code experimental feature that enables real inter-agent collaboration.
231
+
232
+ ### How it differs from subagents
233
+
234
+ | | Subagents | Agent Teams |
235
+ |---|---|---|
236
+ | **Communication** | Through dispatcher only | Direct messaging between teammates |
237
+ | **Coordination** | Dispatcher orchestrates | Team self-coordinates via shared task list |
238
+ | **Best for** | 1-4 focused, independent agents | 5+ agents or deep collaboration needs |
239
+ | **Overhead** | Low | Higher, but enables richer collaboration |
240
+
241
+ ### Enable Agent Teams
242
+
243
+ Add to your `.claude/settings.json`:
244
+ ```json
245
+ {
246
+ "env": {
247
+ "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
248
+ }
249
+ }
250
+ ```
251
+
252
+ ### Override dispatch mode
253
+
254
+ During the Propose & Confirm step, you can force a specific mode:
255
+ - **"use team"** — Forces Agent Team mode even for 2-4 agents
256
+ - **"use subagents"** — Forces subagent mode even for 5+ agents
257
+
258
+ ---
259
+
212
260
  ## File Structure
213
261
 
214
262
  ```
@@ -219,7 +267,7 @@ skill/role-dispatcher/
219
267
  prompt-templates.md # Structured agent prompt templates
220
268
  collaboration-protocol.md # Multi-agent coordination protocol
221
269
  model-selection-guide.md # Model selection decision matrix
222
- examples.md # 4 complete dispatching scenarios
270
+ examples.md # 6 complete dispatching scenarios
223
271
  assets/roles/
224
272
  01-software-development.md # 13 roles
225
273
  02-design-ux.md # 11 roles
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexgabbia/role-dispatcher",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Turn your AI coding tool into a team of 209+ IT specialists. Skill for Claude Code, Codex CLI, and OpenCode.",
5
5
  "bin": {
6
6
  "role-dispatcher": "bin/install.js"
@@ -48,21 +48,37 @@ Within the matched category files, select the best role(s) by comparing the requ
48
48
  | Complexity | Agents | Review Agent | Signal |
49
49
  |------------|--------|-------------|--------|
50
50
  | Single domain, clear deliverable | 1 | No | "Write a React component", "Optimize this query" |
51
- | Two domains with integration points | 2 | Yes | "Build API + frontend", "Design and deploy" |
52
- | Multi-domain, architectural scope | 3 | Yes | "Design a secure e-commerce platform" |
51
+ | Two domains with integration points | 2-3 | Yes | "Build API + frontend", "Design and deploy" |
52
+ | Multi-domain, architectural scope | 3-5 | Yes | "Design a secure e-commerce platform" |
53
+ | Large-scale project, cross-layer work | 5-10+ | Yes (or Team Lead) | "Build a complete SaaS platform", "Full security audit of microservices" |
53
54
 
54
- **Max 3 agents.** If more domains are involved, group related competencies into a composite role (e.g., "Full-Stack Developer" covers both frontend and backend rather than dispatching two separate agents).
55
+ **Scale agents to actual complexity.** Match the number of agents to the number of genuinely distinct roles needed. Don't inflate for the sake of it, don't compress when more specialists would help. If a single "Full-Stack Developer" genuinely covers the request, use one agent. If a project spans frontend, backend, database, security, DevOps, and design — use six.
55
56
 
56
57
  **Role selection heuristic**: Pick the most specialized role that covers the request. "Set up Kubernetes cluster" should match Kubernetes Administrator (specific) over Cloud Engineer (broad). Use the Key Skills column to break ties between similar roles.
57
58
 
58
- ## Step 4: Classify Dependencies
59
+ ## Step 4: Classify Dependencies & Select Dispatch Mode
59
60
 
60
- Read `references/collaboration-protocol.md` for the full protocol. Quick reference:
61
+ Read `references/collaboration-protocol.md` for the full protocol.
62
+
63
+ ### Dependency Classification
61
64
 
62
65
  - **INDEPENDENT**: No data flow between agents -> run in **parallel**
63
66
  - **DEPENDENT**: Output of one feeds another -> run **sequentially**, pass handoff notes
64
67
  - **MIXED**: Parallel first, then sequential for dependent parts
65
68
 
69
+ ### Dispatch Mode Selection
70
+
71
+ | Agents | Collaboration needed? | Mode | Why |
72
+ |--------|----------------------|------|-----|
73
+ | 1 | N/A | **Single subagent** | Simple, focused task |
74
+ | 2-4, independent | No | **Parallel subagents** | Fast, low overhead |
75
+ | 2-4, dependent | Minimal (handoff notes) | **Sequential subagents** | One feeds the next, dispatcher coordinates |
76
+ | 5+ OR agents need to discuss/challenge each other | Yes | **Agent Team** (TeamCreate) | Shared tasks, direct messaging, self-coordination |
77
+
78
+ **User override**: "use a team" forces Agent Team mode even for 2 agents. "use subagents" forces subagent mode even for 5+.
79
+
80
+ **Note**: Agent Teams require the experimental flag `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in `.claude/settings.json`.
81
+
66
82
  ## Step 5: Select Model
67
83
 
68
84
  Read `references/model-selection-guide.md` for the full matrix. Quick reference:
@@ -86,19 +102,25 @@ Present the dispatch plan and **wait for user confirmation** before proceeding.
86
102
 
87
103
  **Model:** {model} ({complexity} complexity)
88
104
  **Execution:** {INDEPENDENT | DEPENDENT | MIXED}
105
+ **Dispatch mode:** {Subagents | Agent Team} — {reason}
89
106
 
90
107
  Proceed? You can:
91
108
  - **yes** to proceed as proposed
92
109
  - **Change roles**: e.g. "use Security Engineer instead of Backend Developer"
93
110
  - **Change model**: e.g. "use opus" or "use haiku"
94
- - **Both**: e.g. "use only Frontend Developer with sonnet"
111
+ - **use team** / **use subagents**: override the dispatch mode
112
+ - **Combine**: e.g. "use only Frontend Developer with sonnet"
95
113
  ```
96
114
 
97
- If the user modifies roles or model, adjust and proceed. If they confirm, proceed with the original proposal.
115
+ If the user modifies roles, model, or dispatch mode, adjust and proceed. If they confirm, proceed with the original proposal.
98
116
 
99
117
  ## Step 7: Dispatch Agents
100
118
 
101
- Read `references/prompt-templates.md` for the full template. For each role, create an agent using the `Agent` tool with `subagent_type: "general-purpose"`.
119
+ Read `references/prompt-templates.md` for the full template.
120
+
121
+ ### Path A: Subagent Dispatch (default for 1-4 agents)
122
+
123
+ For each role, create an agent using the `Agent` tool with `subagent_type: "general-purpose"`.
102
124
 
103
125
  Each agent prompt MUST include:
104
126
  1. **Role identity**: Name, description, and key skills from the role file
@@ -110,28 +132,50 @@ Each agent prompt MUST include:
110
132
 
111
133
  **Parallel dispatch**: Launch all INDEPENDENT agents in a single message with multiple Agent tool calls. For DEPENDENT agents, wait for each to complete before dispatching the next with handoff notes.
112
134
 
135
+ ### Path B: Agent Team Dispatch (for 5+ agents or when deep collaboration is needed)
136
+
137
+ Use the `TeamCreate` tool to create a team, then spawn teammates via the `Agent` tool with `team_name`.
138
+
139
+ 1. **Create the team**: `TeamCreate` with a descriptive team name and the overall goal
140
+ 2. **Spawn teammates**: For each role, use `Agent` tool with `team_name` set to the created team. Use the **Teammate Template** from `references/prompt-templates.md`
141
+ 3. **Team Lead**: The first agent spawned acts as Team Lead. Use the **Team Lead Template**. The Team Lead:
142
+ - Creates shared tasks via the task list for the team to work on
143
+ - Coordinates work assignment among teammates
144
+ - Acts as the Review Agent (synthesizes final output)
145
+ - Sends direct messages to teammates when needed
146
+ 4. **Self-coordination**: Teammates claim tasks, communicate via messaging, and deliver their parts. The dispatcher does NOT need to manually orchestrate — the team self-coordinates
147
+ 5. **Completion**: The Team Lead synthesizes all contributions and delivers the final result
148
+
113
149
  ## Step 8: Review & Synthesize
114
150
 
115
151
  **Single agent**: Present the result directly. If confidence is LOW, flag it to the user.
116
152
 
117
- **Multi-agent**: Apply the Review Agent protocol from `references/collaboration-protocol.md`:
153
+ **Multi-agent (Subagent mode)**: Apply the Review Agent protocol from `references/collaboration-protocol.md`:
118
154
  1. Check completeness against the original request
119
155
  2. Detect conflicts between agent outputs
120
156
  3. Verify integration (pieces fit together)
121
157
  4. Compute aggregate confidence = minimum of individual confidences
122
158
  5. Decision: APPROVE / NEEDS_REVISION / ESCALATE
123
159
 
160
+ **Multi-agent (Agent Team mode)**: The Team Lead acts as Review Agent:
161
+ 1. Collects all teammate contributions via the shared task list
162
+ 2. Applies the same review protocol (completeness, conflicts, integration, confidence)
163
+ 3. Synthesizes the final response
164
+ 4. The dispatcher presents the Team Lead's synthesis to the user
165
+
124
166
  If **ESCALATE**: Present conflicting perspectives with pros/cons. Let the user decide.
125
167
  If **APPROVE**: Synthesize into a single coherent response in `{RESPONSE_LANGUAGE}`.
126
168
 
127
169
  ## Rules
128
170
 
129
171
  - Respond in the user's detected language
130
- - Max 3 agents per request
172
+ - Scale agent count to match task complexity — no artificial limit
131
173
  - All file paths are relative to this skill directory (use `assets/roles/` and `references/`)
132
174
  - For detailed examples, read `references/examples.md`
133
- - Use `Agent` tool with `subagent_type: "general-purpose"` for each agent
175
+ - **Subagent mode**: Use `Agent` tool with `subagent_type: "general-purpose"` for each agent
176
+ - **Agent Team mode**: Use `TeamCreate` then `Agent` with `team_name` — requires experimental flag `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`
134
177
  - Agents run in parallel when INDEPENDENT, sequentially when DEPENDENT
135
178
  - LOW confidence from any agent triggers automatic ESCALATE
136
179
  - Always wait for user confirmation in Step 6 before dispatching agents
137
180
  - Prefer the most specialized role over a generalist one when both could apply
181
+ - User can override dispatch mode with "use team" or "use subagents"
@@ -10,9 +10,63 @@ Before dispatching agents, classify the task:
10
10
  | **DEPENDENT** | One agent's output feeds into another's input | Sequential | "Design schema, then build API on it" |
11
11
  | **MIXED** | Some parts independent, some dependent | Parallel first, then sequential | "Research + design (parallel), then implement (sequential)" |
12
12
 
13
- ## 2. Review Agent Protocol
13
+ ## 2. Dispatch Mode Selection
14
14
 
15
- **When required**: Always when 2+ agents are dispatched.
15
+ Choose the dispatch mechanism based on agent count and collaboration needs:
16
+
17
+ | Agents | Collaboration needed? | Mode | Why |
18
+ |--------|----------------------|------|-----|
19
+ | 1 | N/A | **Single subagent** | Simple, focused task |
20
+ | 2-4, independent | No | **Parallel subagents** | Fast, low overhead, results return to dispatcher |
21
+ | 2-4, dependent | Minimal (handoff notes) | **Sequential subagents** | One feeds the next, dispatcher coordinates |
22
+ | 5+ OR agents need to discuss/challenge each other | Yes | **Agent Team** (TeamCreate) | Shared tasks, direct messaging, self-coordination |
23
+
24
+ **User overrides always take priority:**
25
+ - "use a team" → Agent Team mode, even for 2 agents
26
+ - "use subagents" → Subagent mode, even for 5+ agents
27
+
28
+ ### When to prefer Agent Teams even with fewer agents
29
+
30
+ - Agents need to **debate or challenge** each other's assumptions (e.g., competing architecture proposals)
31
+ - The task requires **iterative refinement** where agents build on each other's work in multiple rounds
32
+ - Cross-cutting concerns where every agent needs visibility into every other agent's output
33
+
34
+ ## 3. Agent Team Coordination
35
+
36
+ ### Team Creation
37
+
38
+ 1. Use `TeamCreate` with a descriptive name (e.g., "SaaS Platform Team") and the overall project goal
39
+ 2. Spawn the **Team Lead** first — this agent orchestrates the others
40
+ 3. Spawn remaining **teammates** with their role-specific prompts
41
+
42
+ ### Team Lead Responsibilities
43
+
44
+ - Creates tasks in the shared task list for each work area
45
+ - Assigns or lets teammates claim tasks based on their expertise
46
+ - Monitors progress and sends messages to unblock teammates
47
+ - Resolves conflicts between teammates
48
+ - Acts as the **Review Agent** — synthesizes the final deliverable
49
+ - Delivers the unified result back to the dispatcher
50
+
51
+ ### Teammate Coordination
52
+
53
+ - **Claim tasks** from the shared task list that match their expertise
54
+ - **Send messages** to other teammates when they need input or have dependencies
55
+ - **Broadcast** important decisions that affect multiple teammates
56
+ - **Mark tasks complete** with their deliverables attached
57
+ - Stay within their role's domain — flag cross-cutting concerns to the Team Lead
58
+
59
+ ### When to Message vs. Broadcast
60
+
61
+ | Action | Use |
62
+ |--------|-----|
63
+ | **Direct message** | One teammate needs specific info from another |
64
+ | **Broadcast** | A decision affects the whole team (e.g., "we're using PostgreSQL, not MongoDB") |
65
+ | **Task update** | Delivering a completed work item |
66
+
67
+ ## 4. Review Agent Protocol
68
+
69
+ **When required**: Always when 2+ agents are dispatched (subagent mode). In Agent Team mode, the Team Lead fulfills this role.
16
70
 
17
71
  The Review Agent activates AFTER all specialist agents complete. Its responsibilities:
18
72
 
@@ -29,7 +83,7 @@ The Review Agent activates AFTER all specialist agents complete. Its responsibil
29
83
  | **NEEDS_REVISION** | Minor gaps or inconsistencies | Request specific agent to revise |
30
84
  | **ESCALATE** | Critical conflicts or LOW confidence | Present both perspectives with pros/cons, let user decide |
31
85
 
32
- ## 3. Conflict Resolution
86
+ ## 5. Conflict Resolution
33
87
 
34
88
  When agents disagree:
35
89
 
@@ -52,7 +106,7 @@ The agents provided different recommendations on [topic]:
52
106
  Which approach do you prefer?
53
107
  ```
54
108
 
55
- ## 4. Confidence Scoring
109
+ ## 6. Confidence Scoring
56
110
 
57
111
  ### Individual Agent Confidence
58
112
 
@@ -69,7 +123,7 @@ Which approach do you prefer?
69
123
  - If all HIGH -> high confidence in the synthesized answer
70
124
  - Mixed HIGH/MEDIUM -> proceed with medium confidence, note limitations
71
125
 
72
- ## 5. Handoff Protocol
126
+ ## 7. Handoff Protocol (Subagent Mode)
73
127
 
74
128
  When agents need to pass information:
75
129
 
@@ -86,7 +140,7 @@ When agents need to pass information:
86
140
  Consider these inputs when working on your task.
87
141
  ```
88
142
 
89
- ## 6. Escalation Triggers
143
+ ## 8. Escalation Triggers
90
144
 
91
145
  Automatically escalate to user when:
92
146
  - Any agent reports LOW confidence
@@ -144,3 +144,108 @@ Proceed? You can:
144
144
  **User**: "use only DevOps Engineer with haiku"
145
145
 
146
146
  -> Dispatcher adjusts: 1 agent (DevOps Engineer), model changed to Haiku, no review agent needed.
147
+
148
+ ---
149
+
150
+ ## Example 5: Large-Scale Project (Agent Team)
151
+
152
+ **User request**: "Build a complete SaaS project management tool with user auth, team workspaces, real-time collaboration, Stripe billing, email notifications, and an admin dashboard"
153
+
154
+ ### Dispatch Decision
155
+ - **Categories**: Software Development + Design & UX + Infrastructure & Ops + Cybersecurity + E-commerce
156
+ - **Roles**: Software Architect, Backend Developer, Frontend Developer, UX/UI Designer, DevOps Engineer, Security Engineer, Payment Integration Specialist
157
+ - **Independence**: Highly interdependent — architecture drives all layers, security cross-cuts everything
158
+ - **Agents**: 7 (Agent Team mode — too many agents for subagent coordination, deep collaboration needed)
159
+ - **Model**: Opus (large-scale architecture + multi-agent coordination)
160
+
161
+ ### Propose & Confirm
162
+
163
+ ```
164
+ **Proposed dispatch:**
165
+ - Software Architect: system architecture, service boundaries, data models
166
+ Key skills: system design, microservices, event-driven architecture
167
+ - Backend Developer: API design, auth, real-time WebSocket layer
168
+ Key skills: Node.js, Python, REST, GraphQL, WebSockets
169
+ - Frontend Developer: React app, real-time UI, responsive design
170
+ Key skills: React, TypeScript, state management, WebSocket clients
171
+ - UX/UI Designer: user flows, wireframes, design system
172
+ Key skills: Figma, design systems, user research, accessibility
173
+ - DevOps Engineer: CI/CD, cloud infrastructure, monitoring
174
+ Key skills: Docker, Kubernetes, Terraform, GitHub Actions
175
+ - Security Engineer: auth architecture, data protection, compliance
176
+ Key skills: OAuth, RBAC, encryption, OWASP, GDPR
177
+ - Payment Integration Specialist: Stripe billing, subscription management
178
+ Key skills: Stripe API, recurring billing, webhook handling
179
+
180
+ **Model:** claude-opus-4-6 (high complexity)
181
+ **Execution:** MIXED (architecture first, then parallel implementation)
182
+ **Dispatch mode:** Agent Team — 7 agents with cross-cutting dependencies need shared coordination
183
+
184
+ Proceed? You can:
185
+ - **yes** to proceed as proposed
186
+ - **Change roles**: e.g. "remove UX/UI Designer"
187
+ - **Change model**: e.g. "use sonnet"
188
+ - **use subagents**: force subagent mode instead of team
189
+ - **Combine**: e.g. "remove Payment Specialist, use sonnet"
190
+ ```
191
+
192
+ **User**: "yes"
193
+ -> Dispatcher creates team via TeamCreate, spawns Software Architect as Team Lead, then 6 teammates.
194
+
195
+ ### Team Execution
196
+ 1. **Team Lead (Software Architect)** creates tasks: "Define service boundaries", "Design data models", "API contract spec", "Auth architecture", "Deployment strategy", "UI component inventory", "Billing integration spec"
197
+ 2. Teammates claim tasks matching their expertise
198
+ 3. Security Engineer broadcasts: "All services must use JWT with refresh tokens, RBAC on every endpoint"
199
+ 4. Frontend Developer messages Backend Developer: "Need WebSocket event schema for real-time updates"
200
+ 5. Team Lead monitors progress, resolves conflicts (e.g., REST vs GraphQL debate)
201
+ 6. Team Lead synthesizes all deliverables into a unified architecture document
202
+
203
+ ---
204
+
205
+ ## Example 6: Competing Hypotheses / Debugging (Agent Team)
206
+
207
+ **User request**: "Our API response times jumped from 50ms to 2s after yesterday's deploy. We changed the ORM, added a new caching layer, and updated the load balancer config. Need to find the root cause."
208
+
209
+ ### Dispatch Decision
210
+ - **Categories**: Infrastructure & Ops + Software Development + QA & Testing
211
+ - **Roles**: Database Administrator, Backend Developer, Performance Tester, SRE, DevOps Engineer
212
+ - **Independence**: INDEPENDENT investigation, but agents need to **challenge each other's hypotheses**
213
+ - **Agents**: 5 (Agent Team mode — competing hypotheses require discussion between agents)
214
+ - **Model**: Opus (complex debugging + multi-agent debate)
215
+
216
+ ### Propose & Confirm
217
+
218
+ ```
219
+ **Proposed dispatch:**
220
+ - Database Administrator: ORM migration analysis, query plan regression
221
+ Key skills: query optimization, ORM tuning, execution plans
222
+ - Backend Developer: ORM code review, N+1 queries, connection pooling
223
+ Key skills: ORM patterns, connection management, profiling
224
+ - Performance Tester: load testing, response time profiling, bottleneck isolation
225
+ Key skills: JMeter, profiling, latency analysis, benchmarking
226
+ - Site Reliability Engineer: load balancer config review, traffic patterns
227
+ Key skills: load balancing, traffic analysis, monitoring, alerting
228
+ - DevOps Engineer: deployment diff analysis, infrastructure changes
229
+ Key skills: deploy pipelines, config management, rollback procedures
230
+
231
+ **Model:** claude-opus-4-6 (high complexity)
232
+ **Execution:** INDEPENDENT (parallel investigation)
233
+ **Dispatch mode:** Agent Team — competing hypotheses need cross-agent discussion
234
+
235
+ Proceed? You can:
236
+ - **yes** to proceed as proposed
237
+ - **Change roles**: e.g. "add Security Engineer"
238
+ - **Change model**: e.g. "use sonnet"
239
+ - **use subagents**: force subagent mode instead of team
240
+ ```
241
+
242
+ **User**: "yes"
243
+ -> Dispatcher creates team, spawns DBA as Team Lead (database is primary suspect), then 4 teammates.
244
+
245
+ ### Team Execution
246
+ 1. Each agent investigates their hypothesis in parallel
247
+ 2. DBA broadcasts: "ORM is generating 3 extra JOINs per query — likely culprit"
248
+ 3. Backend Developer responds: "Confirmed N+1 pattern in the new ORM mapping, but connection pool is also misconfigured"
249
+ 4. SRE messages: "Load balancer change is clean — no impact on latency"
250
+ 5. Performance Tester: "Profiling confirms 80% of latency is in DB layer, 20% in connection pool exhaustion"
251
+ 6. Team Lead synthesizes: root cause is ORM migration (N+1 + extra JOINs) compounded by connection pool misconfiguration. Proposes fix with rollback strategy.
@@ -10,7 +10,8 @@
10
10
  | Multi-file feature | 2 | Yes | `claude-sonnet-4-6` | Multiple concerns, needs coordination |
11
11
  | Architecture / system design | 2-3 | Yes | `claude-opus-4-6` | Deep reasoning, complex trade-offs |
12
12
  | Security audit / review | 1-2 | Yes | `claude-opus-4-6` | Critical accuracy, no room for error |
13
- | Multi-agent coordination | 3 | Yes | `claude-opus-4-6` | Complex orchestration, synthesis |
13
+ | Multi-agent coordination (subagents) | 3-4 | Yes | `claude-opus-4-6` | Complex orchestration, synthesis |
14
+ | Agent Team coordination | 5+ | Yes (Team Lead) | `claude-opus-4-6` | Large-scale orchestration, team self-coordination |
14
15
 
15
16
  ## Quick Decision Flow
16
17
 
@@ -19,7 +20,7 @@ Is it a simple question or small edit?
19
20
  YES -> Haiku
20
21
  NO -> Does it require multi-file changes or 2+ agents?
21
22
  NO -> Sonnet
22
- YES -> Is it architecture, security, or 3-agent coordination?
23
+ YES -> Is it architecture, security, 3+ agent coordination, or Agent Team?
23
24
  NO -> Sonnet
24
25
  YES -> Opus
25
26
  ```
@@ -34,8 +35,9 @@ Is it a simple question or small edit?
34
35
 
35
36
  ## Override Rules
36
37
 
37
- - **Always use Opus** for: security-sensitive tasks, system architecture, tasks touching production infrastructure
38
- - **Never use Haiku** for: multi-file code changes, security analysis, architecture decisions
38
+ - **Always use Opus** for: security-sensitive tasks, system architecture, tasks touching production infrastructure, Agent Team coordination
39
+ - **Never use Haiku** for: multi-file code changes, security analysis, architecture decisions, Agent Team mode
40
+ - **Agent Teams note**: The Team Lead should always use Opus. Individual teammates can use Sonnet for focused implementation tasks if the user requests a lighter model — the Team Lead still coordinates on Opus
39
41
  - **User override**: If the user explicitly requests a model, respect their choice regardless of this guide
40
42
 
41
43
  ## User Override Protocol
@@ -83,11 +83,92 @@ You are reviewing the outputs of {N} specialist agents who worked on the same us
83
83
  Provide a synthesized, coherent response that integrates all agents' contributions into a single actionable answer.
84
84
  ```
85
85
 
86
+ ## Team Lead Template
87
+
88
+ Used when dispatching via Agent Team mode. The Team Lead orchestrates the team and acts as the Review Agent.
89
+
90
+ ```
91
+ ## Your Role: Team Lead — {ROLE_NAME}
92
+
93
+ ### Expertise Profile
94
+ - **Domain**: {CATEGORY_NAME}
95
+ - **Core competencies**: {ROLE_DESCRIPTION}
96
+ - **Key skills**: {KEY_SKILLS}
97
+ - **Perspective**: You approach problems as a {ROLE_NAME} with deep expertise in {KEY_SKILLS}
98
+
99
+ ### Team Lead Responsibilities
100
+ You are the **Team Lead** for this project. In addition to your specialist role, you:
101
+
102
+ 1. **Create tasks** in the shared task list — one per work area, clearly scoped
103
+ 2. **Coordinate** — assign or let teammates claim tasks, unblock dependencies
104
+ 3. **Monitor** — check task progress, send messages to teammates who are stuck
105
+ 4. **Resolve conflicts** — when teammates disagree, evaluate trade-offs and decide (or escalate to the user)
106
+ 5. **Synthesize** — once all tasks are complete, review all contributions and deliver a unified result
107
+
108
+ ### Project Goal
109
+ {USER_REQUEST}
110
+
111
+ ### Your Team
112
+ {TEAMMATE_LIST}
113
+
114
+ ### Language
115
+ Respond in {RESPONSE_LANGUAGE}
116
+
117
+ ### Output
118
+ When all teammates have delivered, synthesize their work:
119
+ 1. **Completeness check**: Every part of the user's request is addressed
120
+ 2. **Conflict detection**: Resolve contradictions between teammates
121
+ 3. **Integration**: Ensure all pieces fit together
122
+ 4. **Confidence**: Aggregate confidence = minimum of individual confidences
123
+ 5. **Final deliverable**: One coherent, actionable response
124
+ ```
125
+
126
+ ## Teammate Template
127
+
128
+ Used for non-lead agents in Agent Team mode.
129
+
130
+ ```
131
+ ## Your Role: {ROLE_NAME}
132
+
133
+ ### Expertise Profile
134
+ - **Domain**: {CATEGORY_NAME}
135
+ - **Core competencies**: {ROLE_DESCRIPTION}
136
+ - **Key skills**: {KEY_SKILLS}
137
+ - **Perspective**: You approach problems as a {ROLE_NAME} with deep expertise in {KEY_SKILLS}
138
+
139
+ ### Behavioral Guidelines
140
+ - **Communication level**: Adapt to the user's technical level. Default: clear, practical, actionable
141
+ - **Language**: Respond in {RESPONSE_LANGUAGE}
142
+ - **Actionability**: Every recommendation must be concrete and implementable
143
+ - **Scope discipline**: Stay within your role's expertise. Flag anything outside it
144
+
145
+ ### Team Coordination
146
+ - **Claim tasks** from the shared task list that match your expertise
147
+ - **Message teammates** when you need input from them or have a dependency
148
+ - **Broadcast** decisions that affect the whole team
149
+ - **Mark tasks complete** with your deliverables
150
+ - Stay within your domain — flag cross-cutting concerns to the Team Lead
151
+
152
+ ### Project Goal
153
+ {USER_REQUEST}
154
+
155
+ ### Your Focus Area
156
+ {FOCUS_AREA}
157
+
158
+ ### Output Format
159
+ 1. **Analysis**: Your assessment from your role's perspective
160
+ 2. **Deliverable**: Concrete, actionable output for your focus area
161
+ 3. **Confidence**: HIGH / MEDIUM / LOW with brief justification
162
+ 4. **Dependencies**: What you need from or provide to other teammates
163
+ ```
164
+
86
165
  ## Quick Reference: Template Selection
87
166
 
88
167
  | Scenario | Template | Notes |
89
168
  |----------|----------|-------|
90
169
  | 1 agent | Standard | No multi-agent section |
91
- | 2 agents, independent | Standard + Multi-Agent | Run in parallel |
92
- | 2-3 agents, dependent | Standard + Multi-Agent | Run sequentially, pass handoff notes |
93
- | Any multi-agent | Standard + Review Agent | Review agent runs after all others |
170
+ | 2-4 agents, independent (subagents) | Standard + Multi-Agent | Run in parallel |
171
+ | 2-4 agents, dependent (subagents) | Standard + Multi-Agent | Run sequentially, pass handoff notes |
172
+ | Any multi-agent (subagents) | Standard + Review Agent | Review agent runs after all others |
173
+ | 5+ agents or deep collaboration | Team Lead + Teammate | Agent Team mode via TeamCreate |
174
+ | User requests "use team" | Team Lead + Teammate | Agent Team mode regardless of count |