plugins/ai-and-reasoning/skills/agent-routing/SKILL.md
Decide which model (Haiku/Sonnet/Opus) and effort level each subagent gets, when to cascade cheap-first behind a verifier, and how to run improvement loops safely (evaluator-as-selector, stop on regression). Covers the Managed Agents effort mechanics (per-agent effort levels, cost lever) and how to watch a subagent fan-out stream live so loop and escalation gates have something to observe. Use when spawning subagents via the Agent or Workflow tools, when fanning out more than a handful of agents, or when the user asks which model or effort a task should route to. Routing heuristics grounded in measured calibration data (references/calibration-2026-07-15.md), not vibes; the Managed Agents API specifics are operational, not calibrated.
npx skillsauth add oaustegard/claude-skills agent-routingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Before spawning any subagent, answer one question: is the task mechanically
checkable, or does it require judgment? Checkable → Haiku at effort: 'low'
behind a verifier. Judgment → up-tier. The routing table refines this split; the
rest of the skill governs cascades and loops.
Do not up-tier checkable work "to be safe." Measured Haiku 4.5 failure on
every checkable task family tested is ≈0, at effort: 'low', with
chain-of-thought suppressed (evidence: references/calibration-2026-07-15.md).
The burden of proof is on routing up: reflexive up-tiering costs 3–5× for
safety that the data says is imaginary. Spend effort, not tier, and only where
reasoning depth demonstrably falls short.
To turn a judgment-shaped task INTO a Haiku-executable one (explicit procedures,
n-shot examples), use the sibling down-skilling skill. This skill decides the
routing; that one engineers the prompt.
Subagents inherit nothing: not the conversation, not loaded skills, not the existence of artifacts already on disk. Every index, scan output, artifact path, or tool-invocation recipe the orchestrator relies on must be serialized into the subagent's prompt (or written to a file the prompt points at). Otherwise the agent falls back to blind rediscovery — and the tier premium is spent on crawling, not judgment. A Sonnet with no handoff wastes more than a Haiku with a good procedure.
This is the context-side twin of down-skilling: that skill engineers the
procedure into the prompt; this rule makes the artifacts and tools travel
with it. Checklist per spawn: (1) artifact paths + how to query them, (2) tool
commands verbatim (interpreter path included — subagents don't know your
venv), (3) explicit anti-patterns ("no ls/glob discovery"), (4) an output
spec. Skills that orchestrate fan-outs should embed this (see
exploring-codebases for the worked exploration case).
Evidence: 2026-07-16, four Sonnet Explore agents launched onto a 2,300-file
repo without the handoff opened with ls crawls despite a full tree-sitter
symbol index sitting on disk; relaunched with per-agent index slices + the
verbatim tool command + anti-crawl rules, discovery cost dropped to ~zero.
| Task shape | Model | Effort | Verify with |
|---|---|---|---|
| Extraction, classification, format transforms, schema-bound output | haiku | low | schema / spot-check |
| Closed-form computation, state tracking, multi-hop lookup | haiku | low | deterministic check |
| Constraint-bound generation (exact counts, required tokens, lipograms) | haiku | low | mechanical checker |
| Bulk scans/greps, per-file summaries, fan-out reads | haiku | low | sample audit |
| Code edits with tests available | haiku first | low–medium | run the tests |
| Judging / scoring another model's output | sonnet+ | medium | — (judge ≠ worker) |
| Ambiguity resolution, novel synthesis, architecture, taste | sonnet/opus | high | human or panel |
| Long-horizon multi-step agentic work, cross-file reasoning | sonnet/opus | high/xhigh | milestone checks |
Effort is set on the agent, not per session — an effort inside a
per-session model override is silently ignored. Levels are low, medium,
high, xhigh, max (bare string or {"type": "high"}); not every model
accepts every level, and an invalid pair is rejected at agent-create. The create
response echoes the resolved config — if effort comes back None, the org's
beta header (managed-agents-2026-04-01) doesn't carry the feature: the field
was dropped, not rejected, so check the echo before assuming a level took.
Effort is the per-role cost lever — higher levels let Claude spend more tokens
per inference call — so buy depth only for judgment-heavy roles and drop triage
or formatting roles to low without touching the expensive role's budget. This
is the same split the table encodes; effort tunes within a tier, tier is the
coarse knob. Calibration null result: effort had no measurable effect on Haiku's
checkable tasks (Exp. 2 — low and high both 20/20), which is why the rule is
spend effort only where reasoning depth demonstrably falls short, never
by default.
When a near-free verifier exists, compose instead of choosing a tier up front:
result = haiku(task, effort=low)
if verify(result) fails: result = sonnet(task) # escalate on evidence
if verify(result) fails: result = opus(task) # rare
Input-cost ratio is Haiku 1× · Sonnet 3× · Opus 5×. Expected cascade cost ≈
c_haiku + p_fail × c_sonnet, so the cascade beats Sonnet-direct while Haiku's
failure rate stays below ~2/3, and beats Opus-direct below ~4/5 (derivation in
the reference). Every checkable task measured has Haiku failure ≈0, so the
cascade is nearly pure savings.
No verifier ⇒ no cascade. Route by the table instead, because silent Haiku errors compound downstream with nothing to catch them.
Shared-prefix caching cuts the fan-out multiplier (unmeasured, conditional). When N subagents share a byte-stable prefix — the fixed part of the handoff (tool commands, procedure, anti-patterns), not the per-agent index slices, which by design differ — that prefix is reusable by prefix caching where the orchestration surface exposes it, pulling the shared portion's input cost toward a read-discount rate and strengthening the cheap-first / fan-out bias. Keep per-agent dynamic content at the tail so it doesn't invalidate the shared lead. This is prompt-construction economics, not from the calibration battery, and it assumes the surface caches subagent prefixes — verify that before relying on it (the effort/pricing numbers above are measured; this is not).
Never blind-loop. Re-applying the same prompt to a model's own output is the identity at best (an LLM call already unrolls its reasoning depth internally) and regression-then-freeze at worst — in calibration, a re-looped haiku broke its own middle line on iteration 2 and froze on the broken text for every iteration after. Loops only pay when an out-of-band evaluator scores each iteration.
final = argmax_r eval(answer_r). Never
ship iteration N just because it's newest.eval(r) < eval(r-1), stop — loops froze on
degraded output rather than recovering, so early-stop risk beats drift risk.Loop discipline (stop-on-regression, select-don't-trust-last) and the escalation triggers (verifier failed twice) all assume you can see a subagent's work while it runs. By default you can't: the session-level stream previews only the primary (coordinator) thread, and a subagent's output lands only after its whole turn buffers — a two-minute researcher shows nothing for two minutes.
Close the gap with one stream per thread. Read the session stream for the
coordinator; on every session.thread_created (it carries session_thread_id
and agent_name), attach a watcher to that child's stream
(GET /v1/sessions/{id}/threads/{thread_id}/stream, with event_deltas) in a
background thread. Four rules keep it honest:
agent.message arrives; the SDK's accumulate_managed_agents_event
folds start / delta / record into one snapshot. One accumulator per connection.thread_created or miss the child's first response.session.thread_created
(spawn), agent.thread_message_sent (handoff), agent.thread_message_received
(child reports back). Child tool calls cross-posted to the primary carry
session_thread_id; skip them, the child's own watcher shows them.session.thread_status_idle; the main
loop on session.status_idle — print the stop reason when it isn't end_turn,
and break on terminated-status events, so a session stuck on a tool
confirmation or out of retries ends the run instead of hanging it.Operational, not calibrated (multi-turn agentic tool use is on the "not
measured" list below). Source: Anthropic Managed Agents notebook
CMA_watch_subagents_live (beta managed-agents-2026-04-01); full streaming
contract in events and streaming.
development
Write effective instructions for Claude: project instructions, standalone prompts, and skill content. Use when users need help writing prompts, setting up project instructions, choosing between instruction formats, or improving how they communicate with Claude. Covers writing principles, model-aware calibration, and format selection. For building and testing complete skills, use skill-creator instead.
data-ai
Discover and load skills on demand from /mnt/skills/user/. Use when you need a capability but don't know which skill provides it, when the boot-emitted skill list is names-only and you need a full description, or when you want to list the catalog. Verbs are list (names only), search (rank by name/description match against a query), and show (emit the full SKILL.md for a named skill).
documentation
Reads the visual content of slides, pages, and images the way a human would, not just their embedded text. Use when a PPTX or PDF has image slides, screenshots, charts, scanned figures, or flattened-to-image layouts that the built-in pptx/pdf skills read as empty; when asked to transcribe, describe, OCR, or extract what is shown in an image, slide deck, or document page; or when embedded-text extraction returned little or nothing from a visually rich file. Triggers on 'read this deck', 'what's on these slides', 'transcribe', 'OCR', 'extract text from image', 'describe this chart/diagram', .pptx/.pdf/.png/.jpg with visual content.
development
Portrait Mode for SVGs — foveated vectorization with 4-zone selective detail. Combines vision annotations, MediaPipe segmentation/landmarks, and optional saliency. Like phone portrait mode, but vectorized. Use when vectorizing a portrait or photo where subject detail should outrank background detail.