Idea 3 of 15 · Claude Code
Handing off to subagents
Send side jobs to a separate agent with a fresh context: the built-in ones, your own, and when it’s worth it.
Side jobs in their own context
Searching 2,000 files would fill the context window. So Claude hands jobs like that to a subagent: a separate agent that starts with a fresh context of its own, does the job and sends back only a short summary. Your session gets the answer, not the 2,000 files.
Built-in subagents
Claude Code comes with a few, and Claude picks one when a job fits. Explore searches the code and can only read. Plan does the same research while you’re in plan mode. General-purpose can also edit files and run commands, for side jobs with several steps. Several can run at once: “check the cart, payment and email code in parallel”.
Create your own subagent
A subagent is a Markdown file in .claude/agents/: a name, a description of when to use it, its allowed tools, then instructions. Easiest: ask Claude to write one, like “a read-only code reviewer”. Claude delegates when the description matches, or you say “use the code-reviewer subagent”. Details on the subagents page.
Limit its tools, pick its model
Left alone, a subagent gets almost all the tools your session has. List tools to allow only some: a reviewer that can only read won’t start “fixing” what it finds. disallowedTools takes a few away instead. model sets its model: haiku for quick, cheap searches, opus for harder problems; left out, it uses your session’s model.
Fresh eyes, and the cost
A subagent doesn’t see your chat, which makes it a good reviewer: it reads only the diff, not the reasoning that convinced you, and spots the discount applied twice. The cost: it starts from scratch, which takes time and tokens, and you see only its summary. For a quick edit, or work with lots of back-and-forth, stay in your session.