Claude Code Subagents β Delegate Work, Keep Context
Every Claude Code session has a single context window. The longer you work, the more it fills with search results, file contents, and exploration noise. Subagents fix this. A subagent runs in its own context window. It does the work, returns a summary, and the exploration stays out of your main conversation. Think of it as handing a task to a colleague who reports back with the answer, not the journey. Claude Code ships with three built-in subagents: - Explore β runs on Haiku (fast, cheap), read-only. Use it for file discovery and codebase search without polluting your main context. - Plan β read-only research agent that gathers context before presenting a plan. Activates automatically in plan mode. - General-purpose β full tool access, inherits your model. For complex multi-step tasks that need both reading and writing. You can also define custom subagents. They're markdown files with YAML frontmatter β same format as skills. Drop one in ~/.claude/agents/ and it's available in every project. What makes custom subagents powerful: 1. You control which tools they can access (read-only reviewer, write-capable fixer, etc.) 2. You can route them to cheaper models β Haiku for exploration, Sonnet for analysis 3. Each gets a focused system prompt so it stays on task 4. They can't spawn other subagents, which prevents infinite nesting The mental model: delegate when the side work would flood your context with stuff you won't reference again. Research, verification, batch processing, code review β all good candidates. Keep implementation and decision-making in your main session. One detail worth knowing: subagents work within a single session. If you need multiple agents running in parallel and communicating with each other, that's agent teams β a different pattern entirely. Full docs: https://code.claude.com/docs/en/sub-agents I wrote a deeper walkthrough on skills and agent architecture here: https://kjetilfuras.com/claude-code-agent-skills/