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.
I wrote a deeper walkthrough on skills and agent architecture here: https://kjetilfuras.com/claude-code-agent-skills/
0
0 comments
Kjetil Furås
3
Claude Code Subagents — Delegate Work, Keep Context
Build & Automate
skool.com/build-automate
Build autonomous AI agents with Claude Code & OpenClaw. Real configs, build logs, and a practitioner community that actually ships.
Powered by