Original caption
Ever asked Claude Code to explore your codebase, only for it to read 40 files and fill your session with noise? Subagents are the solution! They perform tasks in their own isolated context, returning only essential information to your main session. This keeps your context clean and usable. Here's how to set one up quickly: Create `.claude/agents/explore.md` with the following content: ``` --- name: explore description: read-only codebase research model: haiku tools: Read, Grep, Glob --- You are a fast, read-only research agent. Return only findings. No raw file dumps. ``` Claude will automatically route codebase exploration here when the description matches. The key is to explicitly constrain the return. Instead of: "audit all API endpoints for missing validation" Use this: "spawn a subagent to audit all API endpoints in /src/routes/ for missing input validation. return only: affected files + one-line description. do not return raw code." Even if the subagent uses 4k tokens, you'll get 20 clean lines back, keeping your main context healthy. Pro-tip for cost saving: File search doesn't need Opus. Set Haiku as the default for subagents: `export CLAUDE_CODE_SUBAGENT_MODEL=claude-haiku-4-5-20251001` Use Haiku for search and lookups, Sonnet for implementation, and Opus for architecture. Haiku is 15x cheaper with negligible quality difference for file search. What side tasks are currently flooding your context? Share below 👇 Follow @aiexplanations for more solo builder setups that help you ship. #claudecode #indiehacker #buildinpublic #devtools #solopreneur