How to Set Which Model Claude Code Subagents Use
In Claude Code, a subagent is a separate agent that handles a task, such as reviewing code or exploring a codebase. Its…
When you ask Claude Code to edit or investigate a repository, it sends more than your latest instruction with each request. Claude Code also sends relevant conversation history, file contents, and tool results. Models measure this text in tokens, the units they process. As the session grows, later requests carry more context and use more tokens.
Match the model and reasoning effort to the task. Clear unrelated history or compact useful history, and limit the instructions and tool output Claude Code receives to reduce token use. These changes reduce unnecessary input while keeping the details needed to finish the work.
Use a lower-cost model for routine coding and a more capable model when the task requires difficult reasoning. Anthropic’s Claude Code cost guidance recommends Sonnet for most coding work. It recommends Opus for complex decisions or multi-step reasoning, and Haiku for simple delegated tasks.
| Work | Starting point |
|---|---|
| A small, well-scoped edit or ordinary debugging | Sonnet |
| A simple, bounded subtask | Haiku, where available |
| Difficult debugging, architecture choices, or multi-step reasoning | Opus |
These names are model aliases: Claude Code uses your provider and account to choose the specific model each name refers to. Check the model configuration documentation to confirm what an alias selects in your setup.
Set the reasoning effort, or how much work the model spends thinking, to match the risk and complexity of the task. Low effort suits small changes that you will review and steer. Medium effort fits routine engineering. Higher effort spends more tokens on deeper reasoning and verification, which helps when edge cases matter. Anthropic reports that higher effort led to more edge-case testing in specific model tests, but the documentation does not give a universal savings rate or token multiplier. Start with less effort for reviewable changes and raise it when the task warrants more verification.
Each model has a separate prompt cache. When you switch models, the new model’s first request can reread the conversation without using its existing cache. Choose a different model when its capabilities justify the switch, rather than switching repeatedly by default. The Claude Code settings documentation describes this cache behavior.
Use /clear when you move to a separate task. Claude Code starts the new task without carrying the previous conversation into its requests. You can rename a session before clearing it and resume it later. Anthropic says /clear costs nothing; its cost guidance recommends clearing between unrelated tasks.
Use /compact to continue the same task when the conversation still contains useful decisions, constraints, or findings. Compaction summarizes the conversation, so Claude Code can continue with less context. Add a focus instruction when you run it, such as asking Claude to preserve the relevant API changes, decisions, and test commands.
Compaction has an upfront cost because Claude Code must read and summarize the conversation. In a long session, the conversation can take many tokens to read and summarize, especially after the prompt cache expires. Compact when the summary will support enough future work to justify that cost. For unrelated work, clear the session instead. Keep exact requirements and important commands in project documentation or another durable note, since a summary may not preserve every detail.
Claude Code also compacts automatically near a configured context threshold. The threshold depends on the model and configuration, so do not assume a single limit applies to every setup. A larger context window holds more material, but Claude Code still uses tokens to send it.
Claude Code loads CLAUDE.md project instructions into sessions. Keep that file focused on details that matter across tasks, such as test commands for the repository, coding conventions, and known pitfalls. Anthropic recommends aiming for fewer than 200 lines; treat that as a practical guideline, not a token limit. The memory documentation explains how Claude Code loads project instructions and supports path-specific rules.
Move specialized procedures, such as a release checklist or migration steps, into skills that load when relevant. Use path-scoped rules for instructions that apply only to particular files or directories. Splitting instructions into imported files improves organization, but it does not save context if Claude Code still loads those files at startup.
Give Claude Code a specific task and point it to the files or function involved. When you ask Claude Code to investigate one failing function, it searches a narrower area than when you ask it to improve the entire codebase. You can also reduce tool output: filter a large log for relevant errors before adding it to the conversation. Anthropic gives an example of reducing a 10,000-line log to the matching error lines, cutting the context from tens of thousands of tokens to hundreds. Filtering can save tokens, but the amount depends on the log and the task.
Ask a subagent to handle verbose work, such as processing logs or investigating tests, when you only need a summary in the main conversation. Delegating verbose work this way can keep that conversation shorter. The subagent still uses tokens, so delegation shifts where work happens rather than making it free. Disable MCP servers, which expose external tools and their descriptions to Claude Code, when you do not need them; use precise code navigation instead of asking Claude to read several possible files.
Prompt caching also affects cost. It discounts repeated input while a cache is available, but the conversation still occupies context and the cache can expire. A long session can therefore remain costly even when some repeated content receives a cache discount.
Run /usage to review usage information and /context to see what occupies the context window. Use these commands to see whether a large conversation, oversized file or tool output, persistent instructions, or a model and effort choice that exceeds the task’s needs is using the context. The usage details differ between subscriptions and API billing, so do not treat token counts as a universal estimate of dollars or plan quota.
Change one factor at a time and compare similar tasks. For example, inspect context before and after filtering test output. You can also compare routine edits under different effort settings. Anthropic’s recommendations do not give a fixed percentage saved by switching models or clearing history. The same applies to compacting history and shortening instructions. Measure the effect in your own work.
Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.
Take a look at vroni.com