Skip to main content

The question

Why not just tell the agent in the system prompt to use the cheaper model?

The answer

A prompt-based instruction is a suggestion. A hook enforces it in code. A system-prompt instruction is a suggestion the model can drift from under a long, noisy context — and there’s no way to verify it was followed. A PreToolUse hook runs synchronously in the execution path itself, before the tool call fires, so it can inspect the call and block, modify, or reroute it — compliance isn’t optional.
  • 90% — fewer tokens when a large file read is delegated instead of handled by the frontier model itself
  • 350 lines — a read request above this size is what automatically triggers the reroute
  • 10–30s — added latency per delegated call
  • Targeted read (offset/limit) → frontier model
Claude already knows what it needs — reading it directly is correct and cheap.
  • Untargeted, >350 lines → cheap worker
Volume is the cost, not judgment — the hook blocks this automatically.
  • Edit / debug / architecture → frontier model
Excluded by design, not detected per-call — the worker missed a bug the frontier caught in seconds.
Not built into Claude Code. The hook mechanism is native; this specific router (Spotify’s shunt plugin) is a third-party layer on top of it, tuned to one Java monorepo — treat the 90% as that team’s result, not a universal one.

Source

Spotify Engineering — Portal / shunt, Sept 2026 — Gemini 2.5 Flash worker model · self-reported, four-scenario benchmark.

Continue the walkthrough

Conditional planning

Continue to topic 8 of 14.