Multi-agent orchestrator. Analyze task, build team with DAG, maximize parallelism.
Task: $ARGUMENTS
Execution model
Two execution paths based on task type:
| Needs Claude intelligence? | Execution | Tool |
|---|---|---|
| No (CLI tool call) | Background Bash | Bash(run_in_background: true) |
| Yes (design, synthesis, complex edits) | Native teammate | Task(team_name, name) |
Always: Track ALL tasks with TaskCreate/TaskUpdate DAG, regardless of execution path.
Step-by-step
- •Check tools:
which codex && which gemini && which agent-teamsvia Bash - •Scan project briefly (Glob, 1-2 files max)
- •Classify sub-tasks → pick execution path (see table above)
- •Design DAG: maximize parallel tasks, minimize sequential deps
- •
TeamCreatewith descriptive name - •
TaskCreateall tasks,TaskUpdateaddBlockedBy for deps - •DAG analysis (if
agent-teamsavailable):- •
Bash("agent-teams dag validate --team <name>")— catch cycles - •
Bash("agent-teams dag show --team <name>")— show DAG to user
- •
- •Execute phase by phase:
- •Parallel CLI tasks: multiple
Bash(run_in_background)in ONE message - •Parallel Claude tasks: multiple
Task(team_name, name)in ONE message - •Mixed: fire both Bash + Task calls in ONE message
- •Parallel CLI tasks: multiple
- •Poll
TaskOutputfor background tasks, mark completed - •Receive
SendMessagefrom teammates, mark completed - •Spawn next phase when deps resolve (use
agent-teams dag nextto check) - •Report summary to user
- •Shutdown teammates, TeamDelete
Agent selection
| Task | Execution | Command |
|---|---|---|
| Code generation | Bash background | codex exec "PROMPT" |
| Code review (git) | Bash background | codex review "PROMPT" |
| Analysis / review | Bash background | gemini -m gemini-2.5-pro -y <<'EOF' |
| Design / planning | Native teammate | Task(team_name, name: "claude-architect") |
| Synthesis / merge | Native teammate | Task(team_name, name: "claude-synthesizer") |
| Complex multi-step | Native teammate | Task(team_name, name: "claude-worker") |
DAG design rules
- •Independent tasks → NO deps → fire all in parallel
- •Tasks needing previous output → blockedBy
- •Always end with a synthesis/report task
- •Aim for widest possible parallel phases (4+ tasks)
- •Split large tasks into parallelizable chunks when possible
Teammate prompt template
code
You are @<NAME> on team "<TEAM>". Task: <DESCRIPTION> Files to read: <PATHS> <INSTRUCTIONS> TaskUpdate completed. SendMessage results to team lead, summary: "<SHORT>"