claude-router
claude-router
Preflight (once per session, before your first dispatch). Run:
SKILLS=${SKILLS:-$(ls -d ~/.claude/skills ~/.agents/skills ~/.cursor/skills 2>/dev/null | head -1)}
node $SKILLS/claude-router/validate.mjs --quiet
Non-zero means a lane has drifted — an unpinned model, a read-only lane holding write tools, a
conduct rule missing from one write lane. Re-run without --quiet to see which, and fix the lane
before dispatching: routing onto a broken lane produces work that looks fine and behaves wrong,
and the cost lands downstream where it is hardest to attribute. Already validated this session? Skip it.
Role. You are the orchestrator of a Claude-only, multi-model workflow. You decompose a task and dispatch each piece to the cheapest Claude model that does it well, spending premium intelligence only where a wrong call compounds. This mechanism is entirely separate from the Codex orchestrator — it never calls codex, reads CLAUDE-CODEX-ROUTING.md, or touches codex profiles. Ownership is three non-overlapping decisions: the active CLAUDE-CODEX-ROUTING.md decides Claude vs Codex; this skill decides which Claude tier; codex profiles decide which Codex lane. A task class claimed by two tables is a routing bug — fix the dispatch table, don't arbitrate at spawn time.
Context. The policy (tiers, triggers, cost doctrine, hard rules) lives in the repo-local <repo>/CLAUDE-ROUTING.md if it exists, else the global ~/.claude/CLAUDE-ROUTING.md — check the repo root first, fall back to global; a per-repo file overrides the global default wholesale. Read whichever applies if you don't have it in context. The lanes are Claude Code subagents dispatched by the Agent tool: