r/claudeskills • u/rodrigues_92 • 4h ago
Skill Share My CLAUDE.md said "use Haiku for search subagents" and Claude ignored it. A PreToolUse hook can't be ignored, and search got ~9x cheaper
**The problem**
Under context pressure, Claude skips instructions. Mine said "Haiku for search, Sonnet for judgment, Opus only when stuck". In practice most subagents ran on the main model, and a stuck fix could loop forever on Opus.
So I moved the rule out of the prompt and into a PreToolUse hook on Agent/Task calls.
**How it routes**
Every general subagent prompt must declare its job on one line:
| The prompt says | It runs on |
|---|---|
| `JOB: search` | Haiku, whatever model was asked |
| `JOB: judgment - diagnose why the test fails` | the model you asked (Sonnet by default), medium effort |
| nothing | denied |
| `JOB: judgment - read the logs` | denied: reading is not judgment |
| `ATTEMPT: 2` | effort goes up to high |
| `ATTEMPT: 3` | Opus allowed |
| `ATTEMPT: 4` | denied: the chat stops and reports instead of looping |
The "reading is not judgment" check is the one that made the difference. If the reason starts with read, find, list, count or extract, it's a search, and it goes to Haiku. To use Sonnet you have to say what the helper must conclude.
Explore defaults to Haiku. Named agents keep their own model.
**What changed for me**
- Moving search subagents from Sonnet to Haiku cut search cost about 9x, with the same answers.
- An optional lean helper agent starts with ~30k tokens of context instead of ~50k.
- No more fourth retry on the same broken fix.
**Install**
```
npx skills add mestrecs/skills --skill claude-code-subagent-model-routing
```
Node scripts, zero dependencies, Windows/macOS/Linux. A short setup interview writes the config the first time.
Repo: https://github.com/mestrecs/skills
How do you keep subagent costs down? Do you route by model at all, or let everything run on the main one?
