agnostic-skills

model-routing

model-routing

Picks the right model for every subagent spawn that has no pinned profile, so a missed model never runs on a frontier driver's rate.

Installed together with tiered-delegation, which decides whether to delegate and defines the lean profiles. This skill decides which model runs the rest.

Quick start

  1. Copy the folder (and tiered-delegation beside it): install a skill.

  2. Set the harness default. On Claude Code, add this to ~/.claude/settings.json, then start a new session:

    "env": {"CLAUDE_CODE_SUBAGENT_MODEL": "sonnet"}
  3. Try the picker:

    python3 <skill>/scripts/pick_model.py --task "grep every caller of Foo and count them"

What's inside

Script / fileWhat it does
SKILL.mdWhen to pick, the tiers, harness wiring per harness, what not to set
references/context-claude-code-subagent-model.mdHow Claude Code resolves a subagent's model, and how to re-verify after an upgrade
scripts/pick_model.pyClassifies a brief as sprinter / workhorse / architect and prints the model alias (or role with --harness any)
scripts/pick_agent.pyThe leanest profile for a kind of work; extra tools register in a profiles file (--help)
scripts/test_pick_model.pyThe classifier's regression briefs

How it works

The picker reads the brief you are about to send and looks at its verbs. One judgment verb keeps it at workhorse. No signal means workhorse.

It prints MODEL: <alias> tier=<tier> does=<kind> agent=<profile>. Spawn that profile when it exists, otherwise pass model=<alias>.

Harness wiring
HarnessDefault subagent model
Claude Code"env": {"CLAUDE_CODE_SUBAGENT_MODEL": "sonnet"} in user settings.json
opencodeagent.general.model in opencode.json, set to the provider's mid "latest" model
Codex / Cursor / IDE agentsthe tool's subagent or background-agent model setting, set to its mid model
Own loop / raw APIthe spawn tool's model argument defaults to the mid alias

Env changes and new agent files load at session start.

Claude Code precedence

Verified against v2.1.314:

  1. A model on the call.

  2. The agent's frontmatter model.

  3. CLAUDE_CODE_SUBAGENT_MODEL.

  4. The parent's model.

The default changes only un-modelled spawns. Pinned profiles and explicit opus calls keep their model.

What not to set
  • CLAUDE_CODE_SUBAGENT_MODEL_FORCE: it also overrides explicit picks, so an architect call would silently run on the default.

  • CLAUDE_CODE_WORKFLOW_SUBAGENT_MODEL: it overrides every workflow agent() model.

  • A hook that rewrites or denies the spawn's model: some session modes refuse a call a hook changed, and a denial makes the driver rewrite the whole brief.

Tool agents in pairs

An agent that drives one tool (an engine Editor, a device, a browser) works best split in two:

  • runner (sprinter): runs the exact commands the brief gives and returns the output. Failures that need judgment come back BLOCKED.

  • operator (workhorse): diagnosis, new probes, deciding what to run next.

Register both with pick_agent.py so --needs <tool> routes by kind.

Requirements and limits
  • Stdlib python3 (3.9+), read-only, no network. Each script takes --help and --json.

  • --harness any prints a role (small / mid / strongest) for a non-Claude harness to map.

  • Architect is never a default. It is picked per spawn.

Files

Part of agnostic-skills · MIT