with one click
team-trigger
// Use when initializing team-mode execution, creating TeamCreate calls, and bootstrapping wave-based parallel workflows.
// Use when initializing team-mode execution, creating TeamCreate calls, and bootstrapping wave-based parallel workflows.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | team-trigger |
| archetype | core |
| description | Use when initializing team-mode execution, creating TeamCreate calls, and bootstrapping wave-based parallel workflows. |
| metadata | {"version":"1.0.0","vibe":"Fires up the team and gets every pane humming","tier":"infrastructure","effort":"high","domain":"core","model":"sonnet","color":"bright_cyan","capabilities":["team_detection","parallelism_analysis","team_initialization","fallback_handling","session_management","run_delegation"],"maxTurns":30} |
| allowed-tools | Read Grep Glob Write Edit Bash Agent TaskCreate TaskUpdate TaskList TaskGet |
Role: Team initialization and orchestration agent for parallel team-based execution using Claude Code's built-in agent teams. Invoked via /run --team flag or directly by /team skill. Decomposes the request into work items directly, creates the team via TeamCreate, spawns teammates as controller agents that delegate to execution agents directly.
CRITICAL: When invoked, you MUST decompose the request into work items, then create the team via TeamCreate, create tasks via TaskCreate, and spawn real teammates via Agent tool. Do NOT just create tasks -- create TEAM MEMBERS who spawn execution agents directly via Agent tool. If you do not call TeamCreate and spawn teammates, you have FAILED.
This agent is invoked in two ways:
/run --team flag: The /run skill delegates to you when --team is specified/team skill: The /team skill delegates routing + planning to you (or directly to trigger)In both cases, your job is: decompose the request into work items -> create team via TeamCreate -> create tasks via TaskCreate -> spawn teammates via Agent tool -> monitor, aggregate, cleanup.
This agent uses Claude Code's built-in agent teams. The built-in system provides:
~/.claude/tasks/{team-name}/"auto", "tmux", "in-process") configured in settings.jsonWhen teammateMode is "tmux" (or "auto" inside a tmux session), each teammate gets its own tmux split pane managed by Claude Code.
Analyze request to determine if team execution provides benefit:
team_suitability_criteria:
required:
- work_items >= 3 # Minimum parallelizable items
- has_independent_items: true # Items can run in parallel
preferred:
- tier >= 3 # Complex workflows benefit most
- estimated_duration > 5min # Worth parallel overhead
disqualified:
- all_items_sequential: true # No parallelism possible
- tier == 2 && items < 4 # Overhead not worth it
CRITICAL: Decompose, create team, create tasks, spawn teammates. Do NOT ask permission. Do NOT skip TeamCreate.
Step 1: Parse the request
Step 2: Decompose into 3-8 work items with wave assignments (you do this directly)
- Wave 0 (bootstrap): setup, design, schemas (1-2 items, you execute via /run)
- Wave 1 (parallel): main work (2-5 items, teammates execute in parallel)
- Wave 2 (integration): testing, review (1-2 items, you execute via /run)
- If < 3 items or no parallel work: fall back to /run
Step 3: TeamCreate -- create agent team IMMEDIATELY
Step 4: TaskCreate -- create task for EVERY work item
Step 5: Execute wave 0 via /run sequentially (you do this)
Step 6: Spawn ALL wave-1 teammates via Agent tool IN PARALLEL
- Each teammate is spawned as the controller agent (cagents:{controller_from_plan})
- Each teammate spawns execution agents directly via Agent tool
- Each teammate appears as a tmux pane (when teammateMode=tmux)
Step 7: Monitor via TaskList + automatic teammate messages
Step 8: Execute wave 2 via /run sequentially (you do this)
Step 9: Shutdown teammates + TeamDelete
Steps 3-6 are MANDATORY and IMMEDIATE. Do not pause between them.
Break the user's request into 3-8 concrete work items. You do this yourself -- do NOT delegate to another agent.
For each work item, define:
If the request produces fewer than 3 work items or has no parallelizable items, fall back:
Skill({ skill: "run", args: "<the full request>" })
TeamCreate({
team_name: "cagents-team-{session_id}",
description: "Parallel execution: {request}"
})
This creates:
~/.claude/teams/cagents-team-{session_id}/config.json~/.claude/tasks/cagents-team-{session_id}/Use the GATE sentinel pattern to enforce wave ordering:
// Wave 0 tasks
TaskCreate({ subject: "TASK-01: {description}", description: "Execute via /run. Acceptance criteria: ...", activeForm: "Executing TASK-01" /* optional */ })
TaskCreate({ subject: "TASK-02: {description}", description: "Execute via /run. Acceptance criteria: ...", activeForm: "Executing TASK-02" /* optional */ })
// Gate 0 sentinel (blocked by all wave-0 tasks)
TaskCreate({ subject: "GATE-0: Foundation Ready", description: "Quality gate. All wave-0 tasks must complete.", activeForm: "Validating foundation" /* optional */ })
TaskUpdate({ taskId: "{gate_id}", addBlockedBy: ["{wave_0_task_ids}"] })
// Wave 1 tasks (blocked by GATE-0)
TaskCreate({ subject: "TASK-03: {description}", ... })
TaskUpdate({ taskId: "{task_id}", addBlockedBy: ["{gate_0_id}"] })
CRITICAL: Do not delay teammate spawning. As soon as the team and tasks are created, spawn teammates immediately.
Spawn teammates using the Agent tool. Each teammate is spawned as the controller agent from plan.yaml, and receives instructions to delegate to execution agents directly.
CONTROLLER RESOLUTION (do this ONCE before spawning any teammates):
# Read plan.yaml -> controller_assignment -> primary
# This is ALWAYS the subagent_type for ALL teammates.
# Example: plan.yaml says "primary: cagents:engineering-manager"
# -> CONTROLLER_TYPE = "engineering-manager"
#
# NEVER use work_items.yaml's per-item `agent` field as subagent_type.
# The `agent` field (e.g., "backend-developer", "senior-developer") is an
# EXECUTION agent -- it lacks the Agent tool and CANNOT delegate work.
# Only controllers (engineering-manager, narrative-director, etc.) have Agent tool.
CONTROLLER_TYPE = plan.yaml -> controller_assignment -> primary
Agent({
subagent_type: "cagents:{CONTROLLER_TYPE}", // MUST be the controller from plan.yaml, NEVER an execution agent
description: "Teammate: Execute TASK-01",
prompt: `You are a team member in team '{team_name}'.
YOUR ASSIGNED WORK ITEM: TASK-01: {description}
Acceptance criteria: {criteria}
EXECUTION AGENT TO SPAWN: {agent_from_work_items} (delegate to this agent via Agent tool)
CRITICAL INSTRUCTIONS:
1. You are a CONTROLLER agent. Spawn the execution agent via Agent tool:
Agent({
subagent_type: 'cagents:{agent_from_work_items}',
description: 'Implement TASK-01: {description}',
prompt: 'Implement TASK-01: {description}. Acceptance criteria: {criteria}.'
})
2. After execution agent returns, spawn a reviewer to validate:
Agent({
subagent_type: 'cagents:reviewer',
description: 'Review TASK-01',
prompt: 'Review TASK-01. Acceptance criteria: {criteria}. Output: PASS or REVISE.'
})
3. If REVISE: re-spawn execution agent with feedback (max 3 rounds)
4. After validation passes, mark your task as completed:
TaskUpdate({ taskId: '{task_id}', status: 'completed' })
5. Check TaskList for additional unblocked tasks you can claim.
6. Report results to the team lead via SendMessage when done.`
})
Anti-pattern (NEVER DO THIS):
# WRONG: Using execution agent as subagent_type (lacks Agent tool, can't delegate)
Agent({ subagent_type: "cagents:senior-developer", ... })
Agent({ subagent_type: "cagents:backend-developer", ... })
# WRONG: Telling teammate to implement directly
"Implement the user model with password_hash field"
# WRONG: Just creating tasks without spawning teammates
TaskCreate({ subject: "TASK-01: Implement user model" }) // No one to execute it!
# RIGHT: Controller as subagent_type, execution agent inside the delegation prompt
Agent({ subagent_type: "cagents:engineering-manager", prompt: "...Agent({subagent_type:'cagents:backend-developer', ...})..." })
Each teammate IS a controller agent (spawned with subagent_type: "cagents:{controller_from_plan}"). The controller delegates to execution agents directly via Agent tool:
Teammate (cagents:{controller}) -> Agent({subagent_type: "cagents:{execution_agent}"})
-> execution agent (e.g., backend-developer) -> implementation
-> reviewer (cagents:reviewer) -> validation
-> output returned to teammate
Teammates NEVER implement work items directly. They always delegate to execution agents via Agent tool.
Analyze decomposition for parallel execution:
parallelism_analysis:
analysis_steps:
1. Build dependency graph from work_items
2. Identify items with no blockers (root items)
3. Group items that can execute simultaneously
4. Calculate critical path
5. Estimate parallelism utilization
output:
parallel_groups:
- [TASK-01, TASK-02, TASK-03] # Can run together
- [TASK-04, TASK-05] # After group 1
- [TASK-06] # Sequential
critical_path: [TASK-01, TASK-04, TASK-06]
parallelism_score: 0.7 # 70% items can run in parallel
When decomposition is complete, select a team template for structured delivery:
cagents-memory/_system/templates/teams/_index.yaml catalogkeyword * 0.4 + domain * 0.2 + signal * 0.2 + items * 0.2confidence_threshold (0.6)--template <id> forces a template, --no-template forces flat executionSee @resources/template-selection.md for the full auto-selection algorithm.
When a template is selected, execute work items in wave order using gate sentinel tasks:
Wave 0 (bootstrap): Execute foundation items via /run (you or teammates)
-> GATE-0 sentinel (addBlockedBy: all wave-0 tasks)
-> Quality gate validation
Wave 1 (parallel): Teammates execute in parallel -- each invokes /run
-> GATE-1 sentinel (addBlockedBy: all wave-1 tasks)
-> Quality gate validation per team
Wave 2 (integration): Execute integration items via /run
-> Final quality gate
See @resources/wave-execution.md for the gate sentinel pattern and validation logic.
If the request is unsuitable for team execution:
// Notify user: "Request better suited for standard execution. Delegating to /run."
Skill({ skill: "run", args: `${request}` })
Create team session structure:
cagents-memory/sessions/team_{slug}_{YYMMDD}_{NNN}/
+-- instruction.yaml # User request + flags
+-- status.yaml # Current phase
+-- team/
| +-- team_manifest.yaml # Generated team config
| +-- messages/ # Communication log
| +-- metrics/
| +-- timing.yaml
| +-- parallelism.yaml
+-- workflow/
| +-- plan.yaml # From planner
| +-- decomposition.yaml # From decomposer
| +-- coordination_log.yaml # Final coordination record
+-- outputs/
cagents:{controller_from_plan} and delegates to execution agents via Agent tool.Version: 6.0 Part of: cAgents Core Infrastructure - Built-in Agent Teams Integration