Most of what Claude Code does in a session isn't hard thinking. It's searching for where something lives, reading a long file to find two facts, and running tests to see what failed. If all of that happens in your main conversation, on your top model, two things go wrong: you pay top-model prices for grunt work, and every file dump and test log stays in the context and gets paid for again on every later turn.
Subagents fix both, if you set them up for it. Here's how, with three agent files you can copy.
Why this matters more than it looks
In three months of my own logs (measured with Agent Wrapped), subagents were 60% of all usage, and almost all of them ran on the same top model as the main thread. Re-pricing that subagent work at a mid-tier model's rates would have cut it by about half. On top of that, 5,858 tool results over 4,000 tokens rode along in the main context after they arrived.
A subagent has its own context. Whatever it reads stays there. Only its answer comes back to your conversation. So a subagent on a smaller model that returns a short answer saves twice: cheaper tokens for the reading, and nothing bulky added to the main thread.
Where agent files go
Put Markdown files in .claude/agents/ in your project (or ~/.claude/agents/ for every project). The frontmatter sets the name, when to use it, which tools it may use and which model it runs on:
--- name: scout description: "Fast, cheap code search. Use for finding where something is defined, handled, configured or called." tools: Read, Grep, Glob model: haiku --- Instructions for the agent go here. model takes haiku, sonnet or opus (or inherit). Leave it out and the agent runs on the same model as your main conversation, which is the expensive default most setups never change.
Agent 1: scout (search on Haiku)
--- name: scout description: Fast, cheap code search. Use for finding where something is defined, handled, configured or called, and for "which files touch X" questions. Returns paths, line numbers and a one-line finding each, never whole files. tools: Read, Grep, Glob model: haiku --- You find things in the codebase for the main agent, cheaply. - Search with Grep and Glob first. Read only the lines around a match, never whole large files. - Answer with a short list: `path:line`: one-line finding. At most 15 items, most relevant first. - Do not paste code blocks longer than 10 lines. Do not edit anything. - If you can't find it, say what you searched for, so the main agent doesn't repeat it. The description matters: Claude picks a subagent by matching your request against it. "Use the scout agent to find where auth tokens are refreshed" works, and so will plain "find where auth tokens are refreshed" once the description clearly covers it.
Agent 2: summarizer (long documents on Haiku)
--- name: summarizer description: Reads long documents, PDFs, logs, specs or large files and returns only the parts the main agent asked about. Use instead of reading a big file into the main conversation. tools: Read, Grep, Glob model: haiku --- You read long material so the main conversation doesn't have to carry it. - Read in parts. Return only what the request asks for: facts, numbers, names, steps. - Keep your answer under 300 words unless asked for more, with `path` or page numbers next to each point. - If the material doesn't contain the answer, say so plainly. This is the one that saves most for me. A 50,000-token PDF read in the main thread is paid once on arrival and again on every turn after it. Read by the summarizer, it's paid once at Haiku prices, and 300 words come back.
Agent 3: test-runner (noisy commands on Sonnet)
--- name: test-runner description: Runs the test suite, a single test, a linter or a build and reports only what failed. Use instead of running noisy commands in the main conversation. tools: Bash, Read, Grep model: sonnet --- You run checks and report results compactly. - Keep output short: pipe through `tail -60`, or use the tool's quiet or summary flags. - Report pass or fail, counts, then for each failure: test name, `path:line`, the error (at most 8 lines). - Never paste full logs. Never change code; the main agent decides fixes. Sonnet rather than Haiku here, because reading a stack trace well is worth the step up.
Keep the main thread for decisions
With these three in place, the pattern becomes: the main conversation, on your best model, plans and decides; the agents go and look. A few prompts that route work well:
- "Use the scout agent to list every place
createOrderis called." - "Have the summarizer pull the rate limits and error codes out of
docs/api-spec.pdf." - "Run the tests with the test-runner and tell me what failed."
Two more habits make the effect stick: /clear when you switch tasks, and /compact before you step away, so the cache doesn't have to rebuild a huge context when you come back.
Measure before and after
Run Agent Wrapped on your logs now (free, in the browser, nothing uploaded), then again after a week or two with the agents in place. Look at the model split and the oversized-context figure.
If you'd rather not assemble this yourself, the Limit Saver Kit ($9) has these three agents ready to drop in, plus /handoff and /slim commands, a lean CLAUDE.md template and the playbook. The agent files above are free to copy either way.
Independent tool, not made or endorsed by Anthropic.