agentleFS
naman10parikhnaman10parikh/pixel/.claude/skills/model-routing/SKILL.md

model-routing

Skill0 starsChanged 27 days agoMITView on GitHub

Adaptive budget-aware model routing. Manages 4-tier system to maximize $200/mo Max plan usage across full weekly cycle. Run when starting sessions, hitting usage warnings, or optimizing sub-agent costs.

30 other projects use a version of this, 2 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 27 edited versions we read keep these.

  • 3

    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:

    When Claude flags usage at 75%, 90%, or 95%

    line 9
  2. Distinctive:

    When starting overnight/long-running autonomous sessions

    line 11
  3. Distinctive:

    When you want to check or change the current budget tier

    line 12
  4. Very specific:

    Use /effort in-session or CLAUDE_CODE_EFFORT_LEVEL env var.

    line 84

“Common” is measured: kept by at least 6 in 10 of the 27 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

When to Use

  • Session start (automatically via hook)
  • When Claude flags usage at 75%, 90%, or 95%
  • Breaking large tasks into sub-tasks with different complexity levels
  • When starting overnight/long-running autonomous sessions
  • When you want to check or change the current budget tier

Adaptive Budget System (Chairman Directive — April 10, 2026)

The $200/mo Max plan has a weekly rolling limit. Opus burns ~5x faster than Sonnet. Without management, budget exhausts in 3 days.

4-Tier System

TierNameModelEffortSubagentsCost vs Opus
1FULL POWERopusmaxinherit1x (baseline)
2BALANCEDopusplanhighsonnet~0.3-0.4x
3CONSERVEsonnethighhaiku~0.15x
4EMERGENCYsonnetmediumhaiku~0.1x

Quick Commands

# Check current tier
scripts/budget-manager.sh status

# Record a usage warning (when Claude flags it)
scripts/budget-manager.sh warn 75
scripts/budget-manager.sh warn 90

# Force full power for a critical session
scripts/budget-manager.sh set 1

# Return to adaptive after override
scripts/budget-manager.sh auto

# New weekly cycle started
scripts/budget-manager.sh reset

# Apply current tier to settings (auto-runs on session start)
scripts/budget-manager.sh apply

How opusplan Works

The opusplan model alias (Tier 2) is the efficiency sweet spot:

  • Plan mode (Shift+Tab): Uses Opus for deep reasoning, architecture, trade-offs
  • Execution mode: Switches to Sonnet for code generation, edits, tool calls
  • Result: Opus-quality planning at ~30-40% of full Opus cost

Sub-Agent Routing

CLAUDE_CODE_SUBAGENT_MODEL env var controls what model sub-agents use:

  • Tier 1: Subagents inherit Opus (no env var set)
  • Tier 2: CLAUDE_CODE_SUBAGENT_MODEL=sonnet
  • Tier 3-4: CLAUDE_CODE_SUBAGENT_MODEL=haiku

Override per-agent via frontmatter in agent .md files:

---
model: opus
effort: max
---

Effort Levels

LevelThinking BudgetWhen
maxUnconstrainedDeep architecture, security review
highLarge budgetStandard development, debugging
mediumModerateSimple tasks, file edits
lowMinimalQuick lookups, formatting

Use /effort in-session or CLAUDE_CODE_EFFORT_LEVEL env var.

Model Tier Recommendations (When Manually Routing)

Tier 0 — No Model Needed

Pure code operations: formatting, linting, file copying, git operations, running tests.

Tier 1 — Haiku (fast, cheapest)

  • Simple text transformations and formatting
  • Straightforward search and replace
  • Generating boilerplate code from clear templates
  • Summarizing short documents

Tier 2 — Sonnet (default, balanced)

  • Standard coding tasks (implement a function, fix a bug, write tests)
  • Multi-file refactoring with clear scope
  • Processing articles and extracting insights
  • Most development work falls here

Tier 3 — Opus (deep thinking, expensive)

  • Architecture decisions with trade-offs
  • Security reviews and vulnerability analysis
  • Complex multi-system design
  • Resolving contradictory requirements
  • Writing or revising vision documents

Cost Reference

ModelInput/MTokOutput/MTokRelative Cost
Haiku 4.5$0.80$4.001x
Sonnet 4.6$3.00$15.00~4x
Opus 4.6$15.00$75.00~19x

Additional Token Savings

  1. Use /clear between unrelated tasks — stale context wastes tokens every message
  2. Delegate verbose operations to subagents — logs, tests, docs stay in subagent context
  3. CLAUDE.md under 200 lines — move specialized instructions to skills (on-demand loading)
  4. Use skills over MCP when possible — skills = ~70 tokens, MCP tool definitions = ~4,200 tokens
  5. Specific prompts — "add validation to auth.ts" not "improve the codebase"
  6. Plan mode for complex tasks — Shift+Tab before implementation prevents expensive re-work

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.