agentleFS
frankxaifrankxai/skills/skills/models/model-routing/SKILL.md

model-routing

Skill1 starsChanged 2 months agoMITView on GitHub

Intelligent model selection - routes tasks to Haiku (fast/cheap), Sonnet (balanced), or Opus (complex/strategic) based on task complexity analysis

15 other projects use a version of this.

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, 4 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 14 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When processing a request, apply these rules:

    line 63
  2. Distinctive:

    When using the Task tool, specify model based on routing:

    line 96
  3. Distinctive:

    If a haiku-routed task fails or produces poor results:

    line 142
  4. Distinctive:

    If still failing, escalate to opus

    line 144

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

You have access to intelligent model routing. Before executing any task, analyze complexity and route to the appropriate model tier.

Routing Decision Matrix

TASK COMPLEXITY ANALYSIS
────────────────────────────────────────────────────────────────

HAIKU (Fast, Cheap) - Use for:
├── Simple file operations (read, list, navigate)
├── Scaffolding and boilerplate generation
├── Deterministic transformations (format, lint, compile)
├── Status checks and health monitoring
├── SEO metadata generation
├── Deployment commands (after code is written)
├── Documentation formatting
├── Simple search and replace
│
│   Token cost: ~$0.25/1M input, $1.25/1M output
│   Latency: Fastest
│   Use when: Task has clear, unambiguous steps

SONNET (Balanced) - Use for:
├── Feature implementation (standard complexity)
├── Bug fixes requiring analysis
├── Content writing (articles, social posts)
├── Code review and quality checks
├── Test generation
├── Refactoring with clear patterns
├── API integration work
├── Database schema design
│
│   Token cost: ~$3/1M input, $15/1M output
│   Latency: Medium
│   Use when: Task requires reasoning but not deep strategy

OPUS (Strategic, Complex) - Use for:
├── Architecture decisions (system design)
├── Multi-agent coordination (council, swarm)
├── Strategic planning (business, product)
├── Complex debugging (multi-file, subtle bugs)
├── Security audits and vulnerability analysis
├── Enterprise AI system design
├── Book writing (narrative, character development)
├── Research synthesis (multiple sources)
├── Ambiguous requirements interpretation
│
│   Token cost: ~$15/1M input, $75/1M output
│   Latency: Slowest but most capable
│   Use when: Task requires deep reasoning, creativity, or strategy

Automatic Routing Rules

When processing a request, apply these rules:

Route to HAIKU when:

  • User says: "deploy", "format", "lint", "check status", "list", "scaffold"
  • File patterns: *.config.*, package.json, tsconfig.json
  • Commands: /mcp-status, /inventory-status, /nextjs-deploy (execution phase)

Route to SONNET when:

  • User says: "write", "implement", "fix", "create", "build", "test"
  • File patterns: *.ts, *.tsx, *.py, *.md (content files)
  • Commands: /article-creator, /create-music, /spec, /generate-social

Route to OPUS when:

  • User says: "design", "architect", "strategy", "council", "analyze", "research"
  • Keywords: "enterprise", "system", "multi-agent", "complex", "strategic"
  • Commands: /architect, /council, /writing-team, /research

Cost Optimization

BEFORE (No routing):
  All tasks → Opus → $75/1M output tokens

AFTER (With routing):
  Simple tasks (40%) → Haiku  → $1.25/1M  = $0.50
  Medium tasks (45%) → Sonnet → $15/1M   = $6.75
  Complex tasks (15%) → Opus  → $75/1M   = $11.25
  ──────────────────────────────────────────────
  TOTAL: $18.50 vs $75 = 75% cost reduction

Implementation in Task Tool

When using the Task tool, specify model based on routing:

// Simple task - use haiku
Task({
  subagent_type: "Explore",
  model: "haiku",
  prompt: "List all files in src/"
})

// Medium task - use sonnet (default)
Task({
  subagent_type: "code-reviewer",
  model: "sonnet",
  prompt: "Review this PR for issues"
})

// Complex task - use opus
Task({
  subagent_type: "Plan",
  model: "opus",
  prompt: "Design the architecture for a multi-tenant SaaS platform"
})

Command-Level Routing

CommandDefault ModelRationale
/orchestratesonnetRouter needs reasoning
/article-creatorsonnetContent creation
/create-musicsonnetCreative work
/deep-researchsonnetResearch + creation
/architectopusStrategic design
/councilopusMulti-perspective
/researchsonnetInformation synthesis
/specsonnetFeature planning
/nextjs-deployhaikuExecution
/mcp-statushaikuStatus check
/inventory-statushaikuStatus check
/publishhaikuExecution
/polish-contentsonnetEditing
/review-contentsonnetQuality check

Escalation Pattern

If a haiku-routed task fails or produces poor results:

  1. Automatically escalate to sonnet
  2. If still failing, escalate to opus
  3. Log escalation for learning
haiku (attempt) → fail → sonnet (retry) → fail → opus (final)

Model Routing v1.0 - Implementing claude-flow's intelligent routing pattern

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.