1---2name: agent-routing3description: Agent pipeline, model routing, and delegation framework for git-review. Defines which agent handles which task, model tiers (Opus/Sonnet/Haiku), and when to use junior-coder vs coder vs senior-coder. Use when spawning agents or deciding task assignment.4---5
6# Agent Routing & Delegation
7
8## Agent Pipeline (ordered workflow)
9
101. `requirements-interviewer` (Sonnet) — Gather and clarify requirements from the user
112. `explorer` (Sonnet) — Research libraries, APIs, prior art, technical approaches
123. `architect` (Sonnet) — Design module boundaries, data flow, type definitions
134. `planner` (Opus) — Write step-by-step implementation plan (ONLY agent that writes local plan files)
145. `red-teamer` (Opus) — Critique the plan, find bugs/edge cases/risks before implementation
156. `junior-coder` (Haiku) — Scaffolding, boilerplate, mechanical refactors from fully-specified plans
167. `coder` (Sonnet) — Standard implementation with TDD
178. `senior-coder` (Opus) — Complex/cross-cutting/performance-critical implementation
189. **`tech-lead` (Sonnet) — Cross-cutting review AFTER each implementation step, BEFORE commit** (see `.claude/agents/tech-lead.md`)
1910. `reviewer` (Sonnet) — Code review after implementation (reads code, checks quality)
2011. `qa` (Sonnet) — QA testing after implementation (runs things, verifies behavior, tests hooks/workflows)
2112. `documentation` (Haiku) — Update README, doc comments, guides
2213. `explainer` (Haiku) — Explain code at different expertise levels (junior → staff/architect)
2314. `optimizer` (Haiku) — Meta-workflow audit (run after every major task completion)
24
25## When to Use junior-coder vs coder vs senior-coder
26
27- **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.
28- **coder (Sonnet):** Single-module changes, straightforward features, bug fixes with clear cause, test writing, anything requiring logic or design decisions
29- **senior-coder (Opus):** Cross-module refactors, performance-critical paths, subtle/intermittent bugs, architecture-sensitive changes, tasks a coder failed at
30
31## Orchestrator Rules
32
33- The orchestrator (main session) MUST NOT write implementation code directly
34- The orchestrator coordinates: spawns agents, assigns tasks, reviews results
35- ALL code changes go through junior-coder, coder, or senior-coder agents
36- The orchestrator MAY edit non-code files: CLAUDE.md, agent specs, hook scripts, plans
37- **Use the decision framework**: subagent for independent tasks, team for peer communication
38- **After each implementation step**: spawn tech-lead (subagent or team member) to review before committing
39- The orchestrator commits ONLY after tech-lead approves (or for trivial/no-code changes)
40
41## Model Routing
42
43- **Agent specs** (`.claude/agents/*.md`) define the authoritative model for each agent type
44- **Claude-Flow routing** provides suggestions based on task complexity and past performance
45- **In case of conflict:** Agent spec always wins (manual configuration > automated suggestion)
46- **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)
47- **Example:** `coder` uses Sonnet (per spec), even if Claude-Flow suggests Opus for a task
48
49## Portability Notes
50
51- SKILL.md standard works across Claude Code, ChatGPT, Cursor, Copilot
52- Agent specs (.claude/agents/) are Claude Code-specific
53- Hooks (.claude/hooks/) are Claude Code-specific
54- Keep skills portable; keep enforcement tool-specific