All articles

Let Subagents Do the Investigating

When a question requires reading through a lot of files, doing that work in your main session fills it with search results and file dumps you do not need to keep. Subagents solve this. A subagent runs in its own separate context window, does the digging, and reports back only the conclusion.

The payoff is a clean main session. Instead of a hundred lines of grep output and file contents crowding your history, you get a tidy summary and keep working.

Claude Code ships with built-in agents:

  • Explore — read-only search, good for "where does X happen?" questions.
  • Plan — research and architecture, for thinking through an approach.
  • general-purpose — the full toolset, for open-ended multi-step tasks.

You can invoke one explicitly:

Use the Explore subagent to find every place we validate a JWT,
and tell me which files and functions are involved.

Claude also delegates on its own when a task matches an agent's description, so often this just happens for you.

Two more strengths worth knowing:

  • Parallel investigation. You can send several subagents off at once to look into different questions, and they work independently. That is far faster than doing each search in sequence in one thread.
  • A clean report. Because the agent hands back a summary rather than its whole scratch work, you get the signal without the noise.

You can also define your own agents in .claude/agents/ with a name, a description of when to use them, and a tool allowlist. Some setups even isolate an agent in its own git worktree so its work stays separate.

The rule of thumb: if answering a question means reading across many files, and you only care about the conclusion, send a subagent to find it. Your main session stays focused on the actual task.

Comments

Be the first to comment.