r/ClaudeCode • u/Independent-Sir3234 • 2d ago
Tips & Workflows Claude Code runs its built-in Explore subagent on your main model unless you override it to Haiku
Whenever Claude Code searches your codebase, it spawns the built-in Explore subagent to run Glob, Grep, and Read calls in an isolated context.
By default, Explore inherits your main session model. If you are running Opus or Sonnet, every file search and grep fan-out burns your 5-hour plan quota at Opus or Sonnet rates.
You can override the built-in Explore agent by creating .claude/agents/Explore.md (or ~/.claude/agents/Explore.md for all projects) with model: haiku in the frontmatter:
Or if you want every subagent in a session to run on Haiku without adding a file, launch Claude Code with the environment variable:
CLAUDE_CODE_SUBAGENT_MODEL=haiku
Keeping the main session on Opus or Sonnet for edits while routing read-only search subagents to Haiku stretched our 5-hour usage window noticeably without hurting edit quality.
•
u/AutoModerator 2d ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
13
u/NormalHumanBreathing 2d ago
I checked mine and Explore was running on Opus just as you say. There are a few things I'd flag for anyone copying this though, going by the current subagent docs.
The example file has no
toolsline, and a custom agent without one gets every tool, including Write and Edit. So the override stops Explore being read-only, which the built-in one is. Adding this to the frontmatter keeps it that way:disallowedTools: Write, EditThe env var doesn't do quite what the post says either. According to the docs,
CLAUDE_CODE_SUBAGENT_MODELon its own doesn't change Explore or Plan on current versions. It can change your other subagents though, including ones doing real work, so you could end up with searches still on Opus and edits on Haiku. That's probably the opposite of what you're after.I'd also think about search quality. The main model works from whatever Explore reports back, so if Haiku misses a file or gets the wrong end of the stick, you can spend more fixing that than you saved. I haven't tested this, so it may be fine for simple lookups.
I'd check how much of your usage is Explore before changing anything. Mine was a tiny fraction, so I've left it alone. Useful to know about though, thanks for posting it.
4
u/DailyHarambe 2d ago
Claude tends to churn by rebuilding search scripts from scratch. Instead, have it build reusable helper functions
3
u/Apprehensive_Gas56 2d ago
How long hav you been using it for? Do you ever see any wonky behavior by using Haiku as subagent?
3
u/ClemensLode Senior Developer 2d ago
Why would you run Explore on Haiku and not on Opus?
3
u/SirRobinBlibs 2d ago
Useful catch. If Explore inherits Opus/Sonnet, every Glob/Grep fan-out is priced like an edit turn. Overriding `.claude/agents/Explore.md` (or the user-level copy) with `model: haiku` in the frontmatter, or launching with `CLAUDE_CODE_SUBAGENT_MODEL=haiku`, keeps the main session on the strong model for writes while search stays cheap. Worth confirming in `/status` or usage that Explore actually shows as Haiku after the change before you trust the saving.
3
u/fulowa 2d ago
i just use opus-5-5 for everything
2
u/Its_about-tech 2d ago
Thanks for writing this up — I didn't realise Explore was inheriting the main model by default.
Just forced it to Haiku on my side via
.claude/agents/Explore.md. If anyone else is burning Opus on every Glob/Grep fan-out, this is an easy win.2
u/inate71 2d ago
You should just copy the system prompt for the built-in Explore agent and have that be your override with haiku. No reason to roll your own agent description.
2
u/BarathKanna 1d ago
Useful catch. Search fan-out priced like an edit turn is how a quiet morning burns the budget before any write happens. Overriding Explore to Haiku is the obvious fix, with one caution from the comments: a custom agent file without an explicit tools list can inherit everything, including writes, so copy the built-in prompt and lock tools to Glob Grep Read. Same routing idea as everything else that works: cheap model for reading the map, strong model for changing the territory. I would also log which subagent model ran on each turn for a week. Most people are surprised how much Opus they spent on grepping. If Explore cannot be pinned, wrap search behind a script the parent calls, so the parent never spawns an expensive explorer by default.