| name | claude-spend-friend |
| description | Model auto-router and spend optimizer for Claude. Use before starting any non-trivial task, when the user asks "which model should do this", "how much will this cost/use", complains about burning usage, or wants a task routed to Haiku/Sonnet/Opus/Fable. Classifies the task by decision density, picks the cheapest model that won't thrash, estimates the token budget, and states both before work begins. |
claude-spend-friend
You are the user's spend-conscious routing layer. Your job: the cheapest
model that won't thrash — never the cheapest model, never the biggest by
default. Over-engineering wastes money; under-powering wastes money twice
(the failed cheap attempt + the escalation).
Step 1 — Classify the task by decision density
Decision density = how many judgment calls per hundred lines of output, and
how expensive a wrong call is. Size is NOT the signal — a 2,000-line rename is
Haiku work; a 10-line crypto-KDF change is Fable work.
| Tier | Signals | Route to |
|---|
| T4 — Irreversible / adversarial | Security design, money-moving code, crypto, threat models, invariant proofs, "review this like an attacker", architecture that everything else builds on | Fable 5 (or org's top tier) |
| T3 — Novel & entangled | First-of-its-kind feature across many files, gnarly async/concurrency, debugging with unknown root cause, performance work, API design others will depend on | Opus 5 |
| T2 — Second-of-a-kind | A template exists in-repo (next adapter, next screen, next CRUD endpoint), tests from existing patterns, well-specified refactors, most UI work, docs with substance | Sonnet 5 |
| T1 — Mechanical | Renames, formatting, config churn, lockfile/CI tweaks, fixture generation, doc reformatting, changelog entries | Haiku 4.5 |
Tie-break upward when: the task touches money/keys/user trust, the repo has no
tests to catch a bad output, or the user says "one shot this".
Tie-break downward when: output is easy to verify at a glance, mistakes are
cheap to redo, or a strong in-repo example exists to imitate.
Step 2 — Estimate the budget before starting
Relative cost weights (input, per token): Haiku 1× · Sonnet 3× · Opus 5× ·
Fable 10× — output scales the same ($5 / $15 / $25 / $50 per MTok as of
mid-2026; verify against current pricing via the claude-api skill or
platform.claude.com/docs/en/pricing when precision matters).
Rough per-task output-token estimates (double them if the repo is unfamiliar):
| Task | Output tokens |
|---|
| Answer/explain from code already in context | 1k–5k |
| Single-file feature or fix + verification | 5k–20k |
| Multi-file feature (3–8 files) | 20k–60k |
| Phase-sized build (new subsystem, many files, docs) | 100k–300k |
| Deep debugging session (unknown cause) | 30k–150k, high variance |
Say the plan out loud before working: "Routing this to Sonnet (T2 —
adapter #2 follows the adapter #1 template), expect ~30k output tokens." The
user can veto in one line; silent routing is how trust dies.
Step 3 — Escalation and downgrade rules
- Two-strike escalation. If the routed model fails the same task twice,
the third try on that model is nearly always wasted spend. Go up one tier
and hand it the failure context.
- One-shot breadth favors the big model. One clean top-tier session beats
five mid-tier sessions that thrash. Downgrade narrow tasks, not
important ones.
- Split mixed tasks. "Build the risk engine and update the docs" is a
T3 + T1 pair — don't pay T3 rates for the docs half. Route the pieces.
- Subagents route independently. A Fable/Opus main loop should fan
exploration and mechanical subtasks out to cheaper subagents (in Claude
Code: the Agent tool's
model parameter; in workflows: per-agent model
and effort: "low" for mechanical stages).
- Effort is a second dial. On models that support
effort, dropping
high→medium on routine work often saves more than a model downgrade, with
less quality risk. Try effort first, model second.
- Never downgrade mid-conversation to "save" a long session — a model
switch invalidates the prompt cache and can cost more than it saves.
Finish the session where it is; route the next session cheaper.
Step 4 — Cheap-context hygiene (works at every tier)
- Reuse sessions on the same codebase while context is warm; don't re-explore.
- Point at exact files/lines instead of letting the model re-search.
- Front-load the full task spec in one message — drip-fed requirements burn
tokens on re-planning at every drip.
- Let verification be cheap: run tests/typecheck yourself when trivial rather
than asking the model to narrate it.
Worked examples
- "Add LTC to the watchlist" → T1/T2, Sonnet, ~5k. (A symbol table exists.)
- "Build the Argon2 vault unlock over Tauri IPC" → T4 design + T3 build:
Fable for the design/threat-model pass (~20k), Opus to implement (~60k).
- "Why does the WebSocket reconnect loop double-fire?" → T3 debugging, Opus.
If it were "rename reconnect → resubscribe everywhere" → T1, Haiku.
- "Write marketing copy both audiences will read" → T2, Sonnet — unless it
makes claims lawyers care about; claims review is T4 thinking.
References
references/pricing.md — pricing table, cache economics, when to re-verify
references/worksheet.md — copy-paste routing worksheet for planning a phase