Agent Teams - CK-Native Orchestration Engine
Coordinate multiple independent Claude Code sessions. Each teammate has own context window, loads project context (CLAUDE.md, skills, agents), communicates via shared task list and messaging.
Requires: Agent Teams enabled. Set CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in settings.json env.
Requires: CLI terminal — TaskCreate/TaskUpdate/TaskGet/TaskList and TeamCreate/TeamDelete are disabled in VSCode extension (isTTY check). Agent Teams CANNOT run in VSCode.
Model requirement: All teammates must run Opus 4.6 (Agent Teams constraint).
Usage
/ck:team <template> <context> [flags]
Templates: ck:research, ck:cook, ck:code-review, ck:debug
Flags:
--devs N | --researchers N | --reviewers N | --debuggers N -- team size
--plan-approval / --no-plan-approval -- plan gate (default: on for cook)
--delegate -- lead only coordinates, never touches code
--worktree -- use git worktrees for implementation isolation (default: on for cook)
Execution Protocol
Pre-flight (MANDATORY -- merged into step 2 of every template):
- Step 2 of every template calls
TeamCreate(team_name: "...", ...). Do NOT check whether the tool exists first -- just call it.
- If the call SUCCEEDS: continue with the template.
- If the call returns an ERROR or is unrecognized: STOP. Tell user: "Agent Teams requires
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in settings.json. Team mode is not available."
- Do NOT fall back to subagents.
/ck:team MUST use Agent Teams or abort.
- Ensure
TeamCreate was called before spawning teammates -- team association happens via session context.
When activated, IMMEDIATELY execute the matching template sequence below.
Do NOT ask for confirmation. Do NOT explain what you're about to do.
Execute the tool calls in order. Report progress after each major step.
--delegate Mode
When --delegate flag is passed:
- Lead enters delegate mode (
Shift+Tab after TeamCreate)
- Lead ONLY: spawns teammates, manages tasks, sends messages, synthesizes reports
- Lead NEVER: edits files, runs tests, executes git commands directly
- For cook Step 6 MERGE: spawn a dedicated merge teammate instead of lead doing it
- For all templates: lead coordinates and reports, delegates ALL implementation work
Tool Reference (Quick)
Agent Tool (spawn teammates)
Agent(
subagent_type: "researcher" | "fullstack-developer" | "code-reviewer" | "debugger" | "tester" | ...,
description: "short task summary",
prompt: "full instructions + CK Context Block",
model: "opus", # Required for Agent Teams teammates
run_in_background: true, # Non-blocking spawn
isolation: "worktree" # Git worktree isolation (cook devs)
)
Note: Task was renamed to Agent in v2.1.63. Both names work; prefer Agent for new code.
Team Management Tools
| Tool |
Purpose |
Params |
TeamCreate |
Create team + task list |
team_name, description |
TeamDelete |
Remove team resources |
none -- just call it |
TaskCreate |
Create work item |
subject, description, priority, addBlockedBy, addBlocks |
TaskUpdate |
Claim/complete task |
taskId, status, owner, metadata |
TaskGet |
Full task details |
taskId |
TaskList |
All tasks (minimal fields) |
none |
SendMessage |
Inter-agent messaging |
type, to/recipient, message |
SendMessage Types
| Type |
Purpose |
message |
DM to one teammate (requires recipient) |
broadcast |
Send to ALL teammates (use sparingly) |
shutdown_request |
Ask teammate to gracefully exit |
shutdown_response |
Teammate approves/rejects shutdown (requires request_id) |
plan_approval_response |
Lead approves/rejects teammate plan (requires request_id) |
CK Context Block
Every teammate spawn prompt MUST include this context at the end:
CK Context:
- Work dir: {CK_PROJECT_ROOT or CWD}
- Reports: {CK_REPORTS_PATH or "plans/reports/"}
- Plans: {CK_PLANS_PATH or "plans/"}
- Branch: {CK_GIT_BRANCH or current branch}
- Naming: {CK_NAME_PATTERN or "YYMMDD-HHMM"}
- Active plan: {CK_ACTIVE_PLAN or "none"}
- Commits: conventional (feat:, fix:, docs:, refactor:, test:, chore:)
- Refer to teammates by NAME, not agent ID
ON /ck:team research <topic> [--researchers N]:
Wraps /ck:research skill -- scope, gather, analyze, report.
IMMEDIATELY execute in order:
Derive N angles from <topic> (default N=3):
- Angle 1: Architecture, patterns, proven approaches
- Angle 2: Alternatives, competing solutions, trade-offs
- Angle 3: Risks, edge cases, failure modes, security
- (If N>3, derive additional angles from topic context)
CALL TeamCreate(team_name: "<topic-slug>")
CALL TaskCreate x N -- one per angle:
- Subject:
Research: <angle-title>
- Description:
Investigate <angle> for topic: <topic>. Save report to: {CK_REPORTS_PATH}/researcher-{N}-{CK_NAME_PATTERN}-{topic-slug}.md. Format: Executive summary, key findings, evidence, recommendations. Mark task completed when done. Send findings summary to lead.
SPAWN teammates x N via Agent tool:
subagent_type: "researcher", model: "opus"
run_in_background: true (non-blocking -- spawn all N concurrently)
name: "researcher-{N}"
- Prompt: task description + CK Context Block
MONITOR via TaskCompleted hook events + TaskList fallback:
- TaskCompleted events auto-notify when researchers finish
- Fallback: Check TaskList if no event received in 60s
- If stuck >5 min, message teammate directly
READ all researcher reports from {CK_REPORTS_PATH}/
SYNTHESIZE into: {CK_REPORTS_PATH}/research-summary-{CK_NAME_PATTERN}-{topic-slug}.md
Format: exec summary, key findings, comparative analysis, recommendations, unresolved questions.
SHUTDOWN: SendMessage(type: "shutdown_request") to each teammate
CLEANUP: TeamDelete (no parameters -- just call it)
REPORT: Tell user Research complete. Summary: {path}. N reports generated.
JOURNAL: Run /ck:journal to write a concise technical journal entry upon completion
ON /ck:team cook <plan-path-or-description> [--devs N]:
Wraps /ck:cook skill -- plan, code, test, review, finalize.
IMMEDIATELY execute in order:
READ plan (if path provided) OR create via planner teammate:
- If description only: spawn
Agent(subagent_type: "planner") to create plan first
- Parse plan into N independent task groups with file ownership boundaries
CALL TeamCreate(team_name: "<feature-slug>")
CALL TaskCreate x (N + 1) -- N dev tasks + 1 tester task:
- Dev tasks: include
File ownership: <glob patterns> -- NO overlap between devs
- Tester task:
addBlockedBy all dev task IDs
- Each task description includes: implementation scope, file ownership, acceptance criteria
SPAWN developer teammates x N via Agent tool:
subagent_type: "fullstack-developer", model: "opus"
isolation: "worktree" -- each dev gets isolated git worktree (no file conflicts)
run_in_background: true
name: "dev-{N}"
- Prompt: task description + plan context + CK Context Block
- If
--plan-approval: include instruction to plan first, await approval
- REVIEW and APPROVE each developer's plan via
plan_approval_response
MONITOR dev completion via TaskCompleted events:
- TaskCompleted hook notifies when each dev task finishes
- When all N dev tasks show completed, spawn tester immediately
- TeammateIdle events confirm devs are available for shutdown
- Fallback: Check TaskList if no events received in 60s
- Spawn tester:
Agent(subagent_type: "tester", model: "opus", name: "tester")
- Tester runs full test suite, reports pass/fail
MERGE worktree branches (if isolation: "worktree" was used):
- Discover branches: check Agent result for branch names, or
git worktree list
- For each dev branch:
git merge <dev-branch> --no-ff
- If conflict: resolve manually (lead owns shared files), then
git add . && git merge --continue
- Cleanup:
git worktree remove <path> for each worktree
- Verify:
git log --oneline --graph to confirm merge topology
DOCS SYNC EVAL (MANDATORY for cook -- from /ck:cook finalize):
Docs impact: [none|minor|major]
Action: [no update needed -- <reason>] | [updated <page>] | [needs separate PR]
SHUTDOWN all teammates via SendMessage(type: "shutdown_request")
CLEANUP: TeamDelete (no parameters -- just call it)
REPORT: Tell user what was cooked, test results, docs impact.
JOURNAL: Run /ck:journal to write a concise technical journal entry upon completion
ON /ck:team review <scope> [--reviewers N]:
Wraps /ck:code-review skill -- scout, review, synthesize with evidence gates.
IMMEDIATELY execute in order:
DERIVE N review focuses from <scope> (default N=3):
- Focus 1: Security -- vulnerabilities, auth, input validation, OWASP
- Focus 2: Performance -- bottlenecks, memory, complexity, scaling
- Focus 3: Test coverage -- gaps, edge cases, error paths
- (If N>3, derive from scope: architecture, DX, accessibility, etc.)
CALL TeamCreate(team_name: "review-<scope-slug>")
CALL TaskCreate x N -- one per focus:
- Subject:
Review: <focus-title>
- Description:
Review <scope> for <focus>. Output severity-rated findings only. Format: [CRITICAL|IMPORTANT|MODERATE] <finding> -- <evidence> -- <recommendation>. No "seems" or "probably" -- concrete evidence only. Save to: {CK_REPORTS_PATH}/reviewer-{N}-{CK_NAME_PATTERN}-{scope-slug}.md. Mark task completed when done.
SPAWN reviewers x N via Agent tool:
subagent_type: "code-reviewer", model: "opus"
run_in_background: true
name: "reviewer-{N}"
- Prompt: task description + CK Context Block
MONITOR via TaskCompleted hook events + TaskList fallback:
- TaskCompleted events auto-notify when reviewers finish
- Fallback: Check TaskList if no event received in 60s
SYNTHESIZE into: {CK_REPORTS_PATH}/review-{scope-slug}.md
- Deduplicate findings across reviewers
- Prioritize by severity: CRITICAL > IMPORTANT > MODERATE
- Create action items list with owners
SHUTDOWN all teammates via SendMessage(type: "shutdown_request")
CLEANUP: TeamDelete (no parameters -- just call it)
REPORT: Tell user Review complete. {X} findings ({Y} critical). Report: {path}.
JOURNAL: Run /ck:journal to write a concise technical journal entry upon completion
ON /ck:team debug <issue> [--debuggers N]:
Wraps /ck:fix skill -- root-cause-first, adversarial hypotheses, disprove to converge.
IMMEDIATELY execute in order:
GENERATE N competing hypotheses from <issue> (default N=3):
- Each hypothesis must be independently testable
- Each must predict different observable symptoms
- Frame as: "If , then we should see "
CALL TeamCreate(team_name: "debug-<issue-slug>")
CALL TaskCreate x N -- one per hypothesis:
- Subject:
Debug: Test hypothesis -- <theory>
- Description:
Investigate hypothesis: <theory>. For issue: <issue>. ADVERSARIAL: actively try to disprove other theories. Message other debuggers to challenge findings. Report evidence FOR and AGAINST your theory. Save findings to: {CK_REPORTS_PATH}/debugger-{N}-{CK_NAME_PATTERN}-{issue-slug}.md. Mark task completed when done.
SPAWN debugger teammates x N via Agent tool:
subagent_type: "debugger", model: "opus"
run_in_background: true
name: "debugger-{N}"
- Prompt: task description + CK Context Block
MONITOR via TaskCompleted events. Debuggers should message each other -- let them converge.
- TaskCompleted events notify as each hypothesis is tested
- TeammateIdle events indicate debugger awaiting peer input
- Fallback: Check TaskList if no events in 60s
READ all debugger reports. Identify surviving theory as root cause.
WRITE root cause report: {CK_REPORTS_PATH}/debug-{issue-slug}.md
Format: Root cause, evidence chain, disproven hypotheses, recommended fix.
SHUTDOWN all teammates via SendMessage(type: "shutdown_request")
CLEANUP: TeamDelete (no parameters -- just call it)
REPORT: Tell user Debug complete. Root cause: <summary>. Report: {path}.
JOURNAL: Run /ck:journal to write a concise technical journal entry upon completion
When to Use Agent Teams vs Subagents
| Scenario |
Subagents (Agent tool) |
Agent Teams |
| Focused task (test, lint, single review) |
Yes |
Overkill |
| Sequential chain (plan -> code -> test) |
Yes |
No |
| 3+ independent parallel workstreams |
Maybe |
Yes |
| Competing debug hypotheses |
No |
Yes |
| Cross-layer work (FE + BE + tests) |
Maybe |
Yes |
| Workers need to discuss/challenge findings |
No |
Yes |
| Token budget is tight |
Yes |
No (high cost) |
Token Budget
| Template |
Estimated Tokens |
Notes |
| Research (3) |
~150K-300K |
Read-only, moderate cost |
| Cook (4) |
~400K-800K |
Highest cost -- code generation |
| Review (3) |
~100K-200K |
Read-only, moderate cost |
| Debug (3) |
~200K-400K |
Mixed read/execute |
Agent Memory
Teammates with memory: project in their agent definition retain learnings across team sessions. Memory persists in .opencode/agent-memory/<name>/ (gitignored). Useful for:
- Code reviewer remembering project conventions
- Debugger recalling past failure patterns
- Tester tracking flaky tests and coverage gaps
- Researcher accumulating domain knowledge
Memory persists after team cleanup -- it's in .opencode/agent-memory/, not ~/.opencode/teams/.
Worktree Isolation (Cook Template)
For implementation teams, isolation: "worktree" on the Agent tool gives each dev:
- Own git worktree -- isolated working directory, staging area, HEAD
- Own branch -- auto-created, returned in agent result
- No file conflicts -- devs can edit same files independently
- Safe parallel editing --
.git dir shared, everything else isolated
After all devs complete, lead merges branches sequentially. This is the safest pattern for parallel code changes.
Error Recovery
- Check status:
Shift+Up/Down (in-process) or click pane (split)
- Redirect: Send direct message with corrective instructions
- Replace: Shut down failed teammate, spawn replacement for same task
- Reassign:
TaskUpdate stuck task to unblock dependents
Abort Team
Shut down all teammates. Then call TeamDelete (no parameters).
If unresponsive: close terminal or kill session. Clean orphaned configs at ~/.opencode/teams/ manually.
Display Modes
- auto (default): split panes if in tmux, otherwise in-process
- in-process: all in one terminal.
Shift+Up/Down navigate. Ctrl+T task list.
- tmux/split: each teammate own pane. Requires tmux or iTerm2.
Rules Reference
See .opencode/rules/team-coordination-rules.md for teammate behavior rules.
v3.0.0: Agent tool migration, worktree isolation for cook devs, run_in_background spawning, updated model requirements.
1---2name: ck-team3description: Orchestrate Agent Teams for parallel multi-session collaboration. Use for research, implementation, review, and debug workflows requiring independent teammates.4---56# Agent Teams - CK-Native Orchestration Engine78Coordinate multiple independent Claude Code sessions. Each teammate has own context window, loads project context (CLAUDE.md, skills, agents), communicates via shared task list and messaging.910**Requires:** Agent Teams enabled. Set `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in settings.json env.11**Requires:** CLI terminal — `TaskCreate`/`TaskUpdate`/`TaskGet`/`TaskList` and `TeamCreate`/`TeamDelete` are **disabled in VSCode extension** (`isTTY` check). Agent Teams CANNOT run in VSCode.12**Model requirement:** All teammates must run Opus 4.6 (Agent Teams constraint).1314## Usage1516```17/ck:team <template> <context> [flags]18```1920**Templates:** `ck:research`, `ck:cook`, `ck:code-review`, `ck:debug`2122**Flags:**23- `--devs N` | `--researchers N` | `--reviewers N` | `--debuggers N` -- team size24- `--plan-approval` / `--no-plan-approval` -- plan gate (default: on for cook)25- `--delegate` -- lead only coordinates, never touches code26- `--worktree` -- use git worktrees for implementation isolation (default: on for cook)2728## Execution Protocol2930**Pre-flight (MANDATORY -- merged into step 2 of every template):**311. Step 2 of every template calls `TeamCreate(team_name: "...", ...)`. Do NOT check whether the tool exists first -- just call it.322. If the call SUCCEEDS: continue with the template.333. If the call returns an ERROR or is unrecognized: **STOP. Tell user:** "Agent Teams requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in settings.json. Team mode is not available."344. Do NOT fall back to subagents. `/ck:team` MUST use Agent Teams or abort.355. Ensure `TeamCreate` was called before spawning teammates -- team association happens via session context.3637When activated, IMMEDIATELY execute the matching template sequence below.38Do NOT ask for confirmation. Do NOT explain what you're about to do.39Execute the tool calls in order. Report progress after each major step.4041### --delegate Mode4243When `--delegate` flag is passed:44- Lead enters delegate mode (`Shift+Tab` after TeamCreate)45- Lead ONLY: spawns teammates, manages tasks, sends messages, synthesizes reports46- Lead NEVER: edits files, runs tests, executes git commands directly47- For cook Step 6 MERGE: spawn a dedicated merge teammate instead of lead doing it48- For all templates: lead coordinates and reports, delegates ALL implementation work4950---5152## Tool Reference (Quick)5354### Agent Tool (spawn teammates)5556```57Agent(58 subagent_type: "researcher" | "fullstack-developer" | "code-reviewer" | "debugger" | "tester" | ...,59 description: "short task summary",60 prompt: "full instructions + CK Context Block",61 model: "opus", # Required for Agent Teams teammates62 run_in_background: true, # Non-blocking spawn63 isolation: "worktree" # Git worktree isolation (cook devs)64)65```6667**Note:** `Task` was renamed to `Agent` in v2.1.63. Both names work; prefer `Agent` for new code.6869### Team Management Tools7071| Tool | Purpose | Params |72|------|---------|--------|73| `TeamCreate` | Create team + task list | `team_name`, `description` |74| `TeamDelete` | Remove team resources | *none* -- just call it |75| `TaskCreate` | Create work item | `subject`, `description`, `priority`, `addBlockedBy`, `addBlocks` |76| `TaskUpdate` | Claim/complete task | `taskId`, `status`, `owner`, `metadata` |77| `TaskGet` | Full task details | `taskId` |78| `TaskList` | All tasks (minimal fields) | *none* |79| `SendMessage` | Inter-agent messaging | `type`, `to`/`recipient`, `message` |8081### SendMessage Types8283| Type | Purpose |84|------|---------|85| `message` | DM to one teammate (requires `recipient`) |86| `broadcast` | Send to ALL teammates (use sparingly) |87| `shutdown_request` | Ask teammate to gracefully exit |88| `shutdown_response` | Teammate approves/rejects shutdown (requires `request_id`) |89| `plan_approval_response` | Lead approves/rejects teammate plan (requires `request_id`) |9091---9293## CK Context Block9495Every teammate spawn prompt MUST include this context at the end:9697```98CK Context:99- Work dir: {CK_PROJECT_ROOT or CWD}100- Reports: {CK_REPORTS_PATH or "plans/reports/"}101- Plans: {CK_PLANS_PATH or "plans/"}102- Branch: {CK_GIT_BRANCH or current branch}103- Naming: {CK_NAME_PATTERN or "YYMMDD-HHMM"}104- Active plan: {CK_ACTIVE_PLAN or "none"}105- Commits: conventional (feat:, fix:, docs:, refactor:, test:, chore:)106- Refer to teammates by NAME, not agent ID107```108109---110111## ON `/ck:team research <topic>` [--researchers N]:112113*Wraps /ck:research skill -- scope, gather, analyze, report.*114115IMMEDIATELY execute in order:1161171. **Derive N angles** from `<topic>` (default N=3):118 - Angle 1: Architecture, patterns, proven approaches119 - Angle 2: Alternatives, competing solutions, trade-offs120 - Angle 3: Risks, edge cases, failure modes, security121 - (If N>3, derive additional angles from topic context)1221232. **CALL** `TeamCreate(team_name: "<topic-slug>")`1241253. **CALL** `TaskCreate` x N -- one per angle:126 - Subject: `Research: <angle-title>`127 - Description: `Investigate <angle> for topic: <topic>. Save report to: {CK_REPORTS_PATH}/researcher-{N}-{CK_NAME_PATTERN}-{topic-slug}.md. Format: Executive summary, key findings, evidence, recommendations. Mark task completed when done. Send findings summary to lead.`1281294. **SPAWN** teammates x N via `Agent` tool:130 - `subagent_type: "researcher"`, `model: "opus"`131 - `run_in_background: true` (non-blocking -- spawn all N concurrently)132 - `name: "researcher-{N}"`133 - Prompt: task description + CK Context Block1341355. **MONITOR** via TaskCompleted hook events + TaskList fallback:136 - TaskCompleted events auto-notify when researchers finish137 - Fallback: Check TaskList if no event received in 60s138 - If stuck >5 min, message teammate directly1391406. **READ** all researcher reports from `{CK_REPORTS_PATH}/`1411427. **SYNTHESIZE** into: `{CK_REPORTS_PATH}/research-summary-{CK_NAME_PATTERN}-{topic-slug}.md`143 Format: exec summary, key findings, comparative analysis, recommendations, unresolved questions.1441458. **SHUTDOWN**: `SendMessage(type: "shutdown_request")` to each teammate1461479. **CLEANUP**: `TeamDelete` (no parameters -- just call it)14814910. **REPORT**: Tell user `Research complete. Summary: {path}. N reports generated.`15011. **JOURNAL**: Run `/ck:journal` to write a concise technical journal entry upon completion151152---153154## ON `/ck:team cook <plan-path-or-description>` [--devs N]:155156*Wraps /ck:cook skill -- plan, code, test, review, finalize.*157158IMMEDIATELY execute in order:1591601. **READ** plan (if path provided) OR create via planner teammate:161 - If description only: spawn `Agent(subagent_type: "planner")` to create plan first162 - Parse plan into N independent task groups with file ownership boundaries1631642. **CALL** `TeamCreate(team_name: "<feature-slug>")`1651663. **CALL** `TaskCreate` x (N + 1) -- N dev tasks + 1 tester task:167 - Dev tasks: include `File ownership: <glob patterns>` -- NO overlap between devs168 - Tester task: `addBlockedBy` all dev task IDs169 - Each task description includes: implementation scope, file ownership, acceptance criteria1701714. **SPAWN** developer teammates x N via `Agent` tool:172 - `subagent_type: "fullstack-developer"`, `model: "opus"`173 - `isolation: "worktree"` -- each dev gets isolated git worktree (no file conflicts)174 - `run_in_background: true`175 - `name: "dev-{N}"`176 - Prompt: task description + plan context + CK Context Block177 - If `--plan-approval`: include instruction to plan first, await approval178 - REVIEW and APPROVE each developer's plan via `plan_approval_response`1791805. **MONITOR** dev completion via TaskCompleted events:181 - TaskCompleted hook notifies when each dev task finishes182 - When all N dev tasks show completed, spawn tester immediately183 - TeammateIdle events confirm devs are available for shutdown184 - Fallback: Check TaskList if no events received in 60s185 - Spawn tester: `Agent(subagent_type: "tester", model: "opus", name: "tester")`186 - Tester runs full test suite, reports pass/fail1871886. **MERGE** worktree branches (if `isolation: "worktree"` was used):189 - Discover branches: check Agent result for branch names, or `git worktree list`190 - For each dev branch: `git merge <dev-branch> --no-ff`191 - If conflict: resolve manually (lead owns shared files), then `git add . && git merge --continue`192 - Cleanup: `git worktree remove <path>` for each worktree193 - Verify: `git log --oneline --graph` to confirm merge topology1941957. **DOCS SYNC EVAL** (MANDATORY for cook -- from /ck:cook finalize):196 ```197 Docs impact: [none|minor|major]198 Action: [no update needed -- <reason>] | [updated <page>] | [needs separate PR]199 ```2002018. **SHUTDOWN** all teammates via `SendMessage(type: "shutdown_request")`2029. **CLEANUP**: `TeamDelete` (no parameters -- just call it)20320410. **REPORT**: Tell user what was cooked, test results, docs impact.20511. **JOURNAL**: Run `/ck:journal` to write a concise technical journal entry upon completion206207---208209## ON `/ck:team review <scope>` [--reviewers N]:210211*Wraps /ck:code-review skill -- scout, review, synthesize with evidence gates.*212213IMMEDIATELY execute in order:2142151. **DERIVE** N review focuses from `<scope>` (default N=3):216 - Focus 1: Security -- vulnerabilities, auth, input validation, OWASP217 - Focus 2: Performance -- bottlenecks, memory, complexity, scaling218 - Focus 3: Test coverage -- gaps, edge cases, error paths219 - (If N>3, derive from scope: architecture, DX, accessibility, etc.)2202212. **CALL** `TeamCreate(team_name: "review-<scope-slug>")`2222233. **CALL** `TaskCreate` x N -- one per focus:224 - Subject: `Review: <focus-title>`225 - Description: `Review <scope> for <focus>. Output severity-rated findings only. Format: [CRITICAL|IMPORTANT|MODERATE] <finding> -- <evidence> -- <recommendation>. No "seems" or "probably" -- concrete evidence only. Save to: {CK_REPORTS_PATH}/reviewer-{N}-{CK_NAME_PATTERN}-{scope-slug}.md. Mark task completed when done.`2262274. **SPAWN** reviewers x N via `Agent` tool:228 - `subagent_type: "code-reviewer"`, `model: "opus"`229 - `run_in_background: true`230 - `name: "reviewer-{N}"`231 - Prompt: task description + CK Context Block2322335. **MONITOR** via TaskCompleted hook events + TaskList fallback:234 - TaskCompleted events auto-notify when reviewers finish235 - Fallback: Check TaskList if no event received in 60s2362376. **SYNTHESIZE** into: `{CK_REPORTS_PATH}/review-{scope-slug}.md`238 - Deduplicate findings across reviewers239 - Prioritize by severity: CRITICAL > IMPORTANT > MODERATE240 - Create action items list with owners2412427. **SHUTDOWN** all teammates via `SendMessage(type: "shutdown_request")`2438. **CLEANUP**: `TeamDelete` (no parameters -- just call it)2442459. **REPORT**: Tell user `Review complete. {X} findings ({Y} critical). Report: {path}.`24610. **JOURNAL**: Run `/ck:journal` to write a concise technical journal entry upon completion247248---249250## ON `/ck:team debug <issue>` [--debuggers N]:251252*Wraps /ck:fix skill -- root-cause-first, adversarial hypotheses, disprove to converge.*253254IMMEDIATELY execute in order:2552561. **GENERATE** N competing hypotheses from `<issue>` (default N=3):257 - Each hypothesis must be independently testable258 - Each must predict different observable symptoms259 - Frame as: "If <cause>, then we should see <evidence>"2602612. **CALL** `TeamCreate(team_name: "debug-<issue-slug>")`2622633. **CALL** `TaskCreate` x N -- one per hypothesis:264 - Subject: `Debug: Test hypothesis -- <theory>`265 - Description: `Investigate hypothesis: <theory>. For issue: <issue>. ADVERSARIAL: actively try to disprove other theories. Message other debuggers to challenge findings. Report evidence FOR and AGAINST your theory. Save findings to: {CK_REPORTS_PATH}/debugger-{N}-{CK_NAME_PATTERN}-{issue-slug}.md. Mark task completed when done.`2662674. **SPAWN** debugger teammates x N via `Agent` tool:268 - `subagent_type: "debugger"`, `model: "opus"`269 - `run_in_background: true`270 - `name: "debugger-{N}"`271 - Prompt: task description + CK Context Block2722735. **MONITOR** via TaskCompleted events. Debuggers should message each other -- let them converge.274 - TaskCompleted events notify as each hypothesis is tested275 - TeammateIdle events indicate debugger awaiting peer input276 - Fallback: Check TaskList if no events in 60s2772786. **READ** all debugger reports. Identify surviving theory as root cause.2792807. **WRITE** root cause report: `{CK_REPORTS_PATH}/debug-{issue-slug}.md`281 Format: Root cause, evidence chain, disproven hypotheses, recommended fix.2822838. **SHUTDOWN** all teammates via `SendMessage(type: "shutdown_request")`2849. **CLEANUP**: `TeamDelete` (no parameters -- just call it)28528610. **REPORT**: Tell user `Debug complete. Root cause: <summary>. Report: {path}.`28711. **JOURNAL**: Run `/ck:journal` to write a concise technical journal entry upon completion288289---290291## When to Use Agent Teams vs Subagents292293| Scenario | Subagents (Agent tool) | Agent Teams |294|----------|----------------------|-------------|295| Focused task (test, lint, single review) | **Yes** | Overkill |296| Sequential chain (plan -> code -> test) | **Yes** | No |297| 3+ independent parallel workstreams | Maybe | **Yes** |298| Competing debug hypotheses | No | **Yes** |299| Cross-layer work (FE + BE + tests) | Maybe | **Yes** |300| Workers need to discuss/challenge findings | No | **Yes** |301| Token budget is tight | **Yes** | No (high cost) |302303## Token Budget304305| Template | Estimated Tokens | Notes |306|----------|-----------------|-------|307| Research (3) | ~150K-300K | Read-only, moderate cost |308| Cook (4) | ~400K-800K | Highest cost -- code generation |309| Review (3) | ~100K-200K | Read-only, moderate cost |310| Debug (3) | ~200K-400K | Mixed read/execute |311312## Agent Memory313314Teammates with `memory: project` in their agent definition retain learnings across team sessions. Memory persists in `.opencode/agent-memory/<name>/` (gitignored). Useful for:315- Code reviewer remembering project conventions316- Debugger recalling past failure patterns317- Tester tracking flaky tests and coverage gaps318- Researcher accumulating domain knowledge319320Memory persists after team cleanup -- it's in `.opencode/agent-memory/`, not `~/.opencode/teams/`.321322## Worktree Isolation (Cook Template)323324For implementation teams, `isolation: "worktree"` on the Agent tool gives each dev:325- **Own git worktree** -- isolated working directory, staging area, HEAD326- **Own branch** -- auto-created, returned in agent result327- **No file conflicts** -- devs can edit same files independently328- **Safe parallel editing** -- `.git` dir shared, everything else isolated329330After all devs complete, lead merges branches sequentially. This is the safest pattern for parallel code changes.331332## Error Recovery3333341. **Check status**: `Shift+Up/Down` (in-process) or click pane (split)3352. **Redirect**: Send direct message with corrective instructions3363. **Replace**: Shut down failed teammate, spawn replacement for same task3374. **Reassign**: `TaskUpdate` stuck task to unblock dependents338339## Abort Team340341```342Shut down all teammates. Then call TeamDelete (no parameters).343```344345If unresponsive: close terminal or kill session. Clean orphaned configs at `~/.opencode/teams/` manually.346347## Display Modes348349- **auto** (default): split panes if in tmux, otherwise in-process350- **in-process**: all in one terminal. `Shift+Up/Down` navigate. `Ctrl+T` task list.351- **tmux/split**: each teammate own pane. Requires tmux or iTerm2.352353## Rules Reference354355See `.opencode/rules/team-coordination-rules.md` for teammate behavior rules.356357> v3.0.0: Agent tool migration, worktree isolation for cook devs, run_in_background spawning, updated model requirements.