Agent Routing & Delegation
Agent Pipeline (ordered workflow)
- •
requirements-interviewer(Sonnet) — Gather and clarify requirements from the user - •
explorer(Sonnet) — Research libraries, APIs, prior art, technical approaches - •
architect(Sonnet) — Design module boundaries, data flow, type definitions - •
planner(Opus) — Write step-by-step implementation plan (ONLY agent that writes local plan files) - •
red-teamer(Opus) — Critique the plan, find bugs/edge cases/risks before implementation - •
junior-coder(Haiku) — Scaffolding, boilerplate, mechanical refactors from fully-specified plans - •
coder(Sonnet) — Standard implementation with TDD - •
senior-coder(Opus) — Complex/cross-cutting/performance-critical implementation - •
tech-lead(Sonnet) — Cross-cutting review AFTER each implementation step, BEFORE commit (see.claude/agents/tech-lead.md) - •
reviewer(Sonnet) — Code review after implementation (reads code, checks quality) - •
qa(Sonnet) — QA testing after implementation (runs things, verifies behavior, tests hooks/workflows) - •
documentation(Haiku) — Update README, doc comments, guides - •
explainer(Haiku) — Explain code at different expertise levels (junior → staff/architect) - •
optimizer(Haiku) — Meta-workflow audit (run after every major task completion)
When to Use junior-coder vs coder vs senior-coder
- •junior-coder (Haiku): Scaffolding new files from spec, struct/enum definitions, adding imports/mod declarations, moving functions between modules, writing boilerplate (constructors, getters, Display impls). Task MUST be fully specified with zero ambiguity.
- •coder (Sonnet): Single-module changes, straightforward features, bug fixes with clear cause, test writing, anything requiring logic or design decisions
- •senior-coder (Opus): Cross-module refactors, performance-critical paths, subtle/intermittent bugs, architecture-sensitive changes, tasks a coder failed at
Orchestrator Rules
- •The orchestrator (main session) MUST NOT write implementation code directly
- •The orchestrator coordinates: spawns agents, assigns tasks, reviews results
- •ALL code changes go through junior-coder, coder, or senior-coder agents
- •The orchestrator MAY edit non-code files: CLAUDE.md, agent specs, hook scripts, plans
- •Use the decision framework: subagent for independent tasks, team for peer communication
- •After each implementation step: spawn tech-lead (subagent or team member) to review before committing
- •The orchestrator commits ONLY after tech-lead approves (or for trivial/no-code changes)
Model Routing
- •Agent specs (
.claude/agents/*.md) define the authoritative model for each agent type - •Claude-Flow routing provides suggestions based on task complexity and past performance
- •In case of conflict: Agent spec always wins (manual configuration > automated suggestion)
- •Model tiers: Opus (3: planner, red-teamer, senior-coder), Sonnet (7: requirements-interviewer, explorer, architect, coder, tech-lead, reviewer, qa), Haiku (4: junior-coder, documentation, explainer, optimizer)
- •Example:
coderuses Sonnet (per spec), even if Claude-Flow suggests Opus for a task
Portability Notes
- •SKILL.md standard works across Claude Code, ChatGPT, Cursor, Copilot
- •Agent specs (.claude/agents/) are Claude Code-specific
- •Hooks (.claude/hooks/) are Claude Code-specific
- •Keep skills portable; keep enforcement tool-specific