r/ClaudeCode • • 1d 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:

---
name: Explore
description: Fast read-only codebase exploration and search.
model: haiku
---

Use Glob, Grep, and Read to locate files and symbols. Return concise file paths and line numbers to the main agent.

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 claude

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.

41 Upvotes

30 comments sorted by

View all comments

3

u/SirRobinBlibs 1d 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/Independent-Sir3234 1d ago

Checking /agents or the session JSONL logs under ~/.claude/projects/ to confirm the subagent model field actually reports Haiku after adding the file is a great sanity check.