agentleFS
papagrationbiz-sketchpapagrationbiz-sketch/token-scrooge/skills/model-routing/SKILL.md

model-routing

Skill0 starsChanged 4 months agoMITView on GitHub

When to load — deciding which model or agent should handle a task (main thread vs. subagent vs. external cheap CLI agent), whether a delegation is worth its round-trip cost (break-even rule), or what to do when the primary model is unavailable (fallback chain). Load before delegating any read, write, or research task.

30 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ecosystem-reference, fractal-delegation and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • naman10parikhSkill

    ecosystem-reference

    Quick-access directory of Claude Code ecosystem repos, skills, plugins, MCPs, and patterns. Use when improving the harness.

    Also in 5 projects that use this

  • naman10parikhSkill

    fractal-delegation

    Also in 5 projects that use this

  • KirchliveSkill

    skill-routing

    Decides which of the installed skills a task needs and loads them before the work starts. This skill should be used at the beginning of any multi-step task — build, fix, refactor, migrate, review, plan, release, research, write, design, video — and again at every phase change, after context compaction, and when work moves into a different part of the codebase. Use it for requests like "let's build X", "fix this bug", "refactor Y", "plan the migration", "review this", and also when the user asks which skill applies, why a skill did not fire, or asks to check what is available.

    Also in 5 projects that use this

  • sublimotionSkill

    agent-runtime

    Launch and manage detached agent runs on EKS via the agent-runner CLI. Use when the user says "launch an agent run", "agent runtime", "agent-runner", "run this spec on the cluster", "check run status", "agent run logs", or "stop a run". Do NOT use for writing the agent-runner code itself (edit the sibling ../agent-runner repo), Terraform of the foundation (use terraform-automation), or GPU serving deployments (use infra-deployer).

    Also in 5 projects that use this

  • GoZippySkill

    repo-scout

    Also in 5 projects that use this

  • BenjaminGSkill

    harness-review

    Turn one PR's review comments into harness fixes — classify each cause by the most solid place it can live (codebase, lint, rules, skill), then draft the fixes in a separate PR.

    Also in 5 projects that use this

  • +6 more from naman10parikh

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 7 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 29 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If no external cheap CLI agent is configured, skip that tier entirely — route reads to the mid-tier subagent and keep writes on the main …

    line 18
  2. Distinctive:

    Before delegating anything, ask in order:

    line 22
  3. Distinctive:

    If the external cheap CLI agent is down long-term: fall back to main-thread-direct implementation only with explicit user approval, …

    line 42
  4. Distinctive:

    Never read an entire repository.

    line 48
  5. Distinctive:

    Prefer compressed-output subagents (investigator- or Explore-style) for exploration.

    line 49
  6. Very specific:

    Never read or review build caches or generated directories (build output, node_modules/, dist/, derived-data folders, etc.).

    line 51
  7. Distinctive:

    Do not re-read files you just edited, and do not re-explain information already established in the conversation.

    line 52
  8. Distinctive:

    If your environment has an optional CLI output filter for shell/tool output, let it run — it typically cuts noise substantially with no …

    line 54

“Common” is measured: kept by at least 6 in 10 of the 29 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Model Routing

The user converses with the main thread only. Every other model or agent works behind it; the main thread relays results and owns the final judgment call.

Model roles

  • Main thread (expensive, judgment) — think / decide / own correctness: requirements, architecture, final plans, root-cause analysis, reviewing and accepting delegated output, running builds/tests itself, 1-2 file surgical edits, docs, reporting to the user. Never delegate this role away.
  • Mid-tier subagent, e.g. Sonnet (read / summarize / draft) — repo reads of roughly 3-50 files returning a digest (an Explore-type or general-purpose subagent), plan drafts (a Plan-type subagent). Also the fallback read path when an external cheap agent is unavailable.
  • Cheap subagent, e.g. Haiku (locate / count) — "where is X", enumerating callers, log filtering. Use the cheapest agent capable of a pure lookup.
  • External cheap CLI agent (implementation, optional) — if the user's setup includes an external low-cost coding agent (for example, the Antigravity CLI driving Gemini — see the agy-delegation skill for the concrete protocol), route to it: application code of any size when the project explicitly designates it as the implementer (requires explicit user GO — see go-ceremony), bulk test generation, scaffolding, mechanical migrations.
  • External cheap CLI agent (bulk read / web, optional) — same external agent, cheaper tier: whole-repo or huge-log digests, fan-out web research. Only applicable if such a tool is configured; otherwise fall back to the mid-tier subagent.

If no external cheap CLI agent is configured, skip that tier entirely — route reads to the mid-tier subagent and keep writes on the main thread (with explicit GO where app code is involved).

The 3-question delegation flow

Before delegating anything, ask in order:

  1. Am I writing application code? → external cheap agent if the project designates it as implementer (GO required); otherwise the main thread does it directly. Never a mid-tier or cheap subagent — they should not own application-code correctness.
  2. How much reading is involved? → 1-2 files: main thread reads them directly. 3-50 files: mid-tier subagent (Explore-style), returning a digest. Larger, or external web: external cheap CLI agent if available.
  3. Is this judgment, review, or verification? → always the main thread. Never delegated, regardless of size.

Break-even rule

Delegation has a fixed round-trip cost: writing the spec, waiting for the response, and verifying it. If that overhead exceeds the tokens a delegate would save, skip delegation and do the work directly on the main thread. A single-file grep or a two-line edit is never worth delegating.

Digest-only rule

Delegated results return as a digest only — a summary, not raw output. Never paste raw delegate output back into the main thread's context, and never re-read files a delegate has already digested for you. If a delegate's wrapper warns that it dumped raw output instead of a digest, discard the response and re-run asking explicitly for a digest.

Fallback chain

Preferred order when the primary main-thread model is unavailable: primary → next-strongest available model → mid-tier model (last resort). Switch models via whatever mechanism your Claude Code setup provides (e.g. /model).

  • Next-strongest fallback: same duties as primary, no workflow change.
  • Mid-tier as main thread (last resort): the quality-gate skill's cross-model review requirement activates — an independent review (e.g. via an external agent, or a second model) is required per implementation; do not declare "done" until Must-fix items from that review are resolved. Do not finalize architecture or data-model decisions alone at this tier — present options plus a recommendation to the user, or defer the decision. Downgrade read-delegation one tier further (e.g. from mid-tier to cheap-tier subagents).
  • If the external cheap CLI agent is down long-term: fall back to main-thread-direct implementation only with explicit user approval, recorded as a governance exception. Reads fall back to the mid-tier subagent.

Invariant regardless of model in the main-thread seat: the explicit-GO ceremony still applies to app code, the verification gate still requires running and quoting results yourself, no direct commits to the trunk branch, and destructive actions still require confirmation.

Token rules

  • Never read an entire repository; read only the needed ranges of the needed files.
  • Prefer compressed-output subagents (investigator- or Explore-style) for exploration; receive conclusions only, not raw transcripts.
  • Quote only the Error/Warning context from build and test logs — never paste full logs.
  • Never read or review build caches or generated directories (build output, node_modules/, dist/, derived-data folders, etc.).
  • Do not re-read files you just edited, and do not re-explain information already established in the conversation.
  • Batch independent tool calls into a single response instead of issuing them one at a time.
  • If your environment has an optional CLI output filter for shell/tool output, let it run — it typically cuts noise substantially with no loss of signal. This is optional tooling, not a requirement.
  • Delegation prompts should state "what to decide" and "what format to return" explicitly, so a single round-trip suffices. Prefer writing delegation prompts and other model-facing text in English when your user-facing language is not English — machine-to-machine text is typically cheaper in English; keep user-facing output in the user's language.
  • For the concrete commands, tiers, and pitfalls of any specific external cheap CLI agent, load that agent's own delegation skill on demand (see agy-delegation for a worked example).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.