# The Real-Time Model Auto-Switcher

**Stop hand-picking a model for every task.** If your AI tool (Cursor, or any multi-model CLI/IDE) gives you several models, you're probably leaving quality *and* speed on the table by defaulting to one. This is a tiny router that reads each task and auto-selects the best-suited model in real time — fast agentic coder for build/workflow work, a max-effort coder for the gnarly stuff, a fast generalist for reasoning and writing. One config line turns it on.

---

## The idea

Different models are good at different things, and the gap is large:
- A **fast agentic coder** (built for tool-use loops) crushes multi-step builds, refactors-in-flow, and swarm/workflow work — and it's *fast*.
- A **max-effort reasoning coder** is worth the extra latency only on genuinely hard one-shot problems: concurrency, deadlocks, algorithms, big migrations.
- A **fast frontier generalist** (big context) wins on reasoning, writing, analysis, and planning — where a code model is overkill.

Static defaults pick one and eat the mismatch on every other task. The fix: **route per task.**

## The router (drop-in logic)

```
pickModel(task):
  text = lowercase(task)

  # unambiguous hard-engineering signals → max-effort coder
  if text matches /race condition|deadlock|concurren|thread|mutex|memory leak|algorithm|distributed|low-level|throughput/:
      return HARD_CODER          # e.g. the deepest reasoning code model you have

  # general code / build / agentic / multi-step / workflow → fast agentic coder
  if text matches /code|debug|refactor|implement|function|api|script|build a|fix the|agent|swarm|workflow|pipeline|multi-step|wire up/:
      return AGENTIC_CODER        # e.g. your tool's own fast coding model

  # everything else — reasoning, writing, analysis, planning → fast generalist
  return GENERALIST               # e.g. a fast frontier model with big context
```

Name your three models, and that's it. Examples (swap for whatever your tool exposes):
- `AGENTIC_CODER` → your IDE's native fast coder (the one built for its agent loop)
- `HARD_CODER` → the highest-effort code model available
- `GENERALIST` → a fast 1M-context frontier model

## Wiring it (any tool that takes a `--model` flag)

```
chosen = pickModel(task)
run:  your-cli -p "<task>" --model <chosen> --output-format text
# log `chosen` + why, so the choice is transparent and you can tune the rules
```

If your tool has its own "auto" model, this still beats it for one reason: **your** router knows your *other* tools and roster, so it can route to *complement* them (e.g. let one model own code-correctness and send the rest elsewhere) instead of optimizing in isolation.

## Tuning (make it yours)
- Start with the three rules above. Log every choice + the task.
- Once a week, scan the log for misroutes (a hard task that went to the generalist, a one-liner that burned the max-effort coder) and add a keyword.
- Add a 4th seat if you have a specialist (e.g. a vision model for screenshots) — same pattern, one more rule.
- Pin a model for a session by overriding the router with an explicit model when you want to.

## Why it pays
- **Speed**: trivial and agentic work stops going to slow max-effort models.
- **Quality**: hard problems stop going to fast models that cut corners.
- **Cost**: you only pay top-tier latency/effort where it actually changes the answer.
- **Transparency**: every choice is logged with a reason — no black box.

It's ~15 lines. The whole point is that the *router*, not you, adapts to each task — and it adjusts as your work changes.

---
*A free tool from the team that builds multi-model AI systems. More at yourwebsite.com.*
