Give Grunt Work Its Own Agent
The fastest way to poison your AI's answers? Cram every messy detail into one conversation. Search results, sprawling log dumps, the guts of forty files you skimmed once and never need again — all of it sits in your main context, diluting the signal the model needs to reason well. Claude Code's answer is subagents: helper agents that do the noisy work in their own context window and hand back only a clean summary.
The problem: context pollution
Every token in your conversation is something the model has to weigh when producing its next answer. When you ask your assistant to "find where auth is handled," a direct search can dump dozens of file paths, grep hits, and irrelevant snippets straight into the main thread. None of that debris gets removed later — it just sits there, competing for attention with the actual task, and pushing you closer to a context-window limit you'll eventually have to compact or reset.
The fix isn't "search less." It's separating exploration from reasoning. Exploration is allowed to be messy. The conversation you're actually having with your AI should not be.
How subagent isolation works
A subagent runs in its own context window, with its own system prompt and its own tool permissions. When Claude Code delegates a task to a subagent, that subagent reads whatever it needs — files, logs, search results — inside its private window. When it's done, only its final report crosses back into your main conversation. The forty files it opened, the failed greps, the log lines it scanned and discarded: none of that touches your thread.
This is the exact mechanic the reel points at: a subagent "has like a context window" of its own, and "only summary lands into the main context." It's not a metaphor — it's how the feature is built. Claude Code ships three built-in subagents you'll see used automatically:
- Explore — a fast, read-only agent for searching and analyzing a codebase. Write and Edit are denied, so it can't touch your files, only read them.
- Plan — a research agent used during plan mode to gather context before Claude presents a plan, keeping the main conversation read-only while exploration happens elsewhere.
- General-purpose — a capable agent with access to all tools, used for complex, multi-step tasks that need both exploration and action.
You can also define custom subagents as Markdown files with YAML frontmatter (name, description, tools, model) stored in .claude/agents/ for a project or ~/.claude/agents/ for yourself across every project. Claude reads each subagent's description to decide when a task matches it — write that description clearly, because it's the only signal Claude uses to route work there.
When to delegate
Reach for a subagent whenever a task is going to produce a pile of intermediate output you won't need to keep:
- Searching a codebase for where something is defined or used
- Reading giant logs to find the one error that matters
- Exploring a new repo to build a mental map before you start editing
In each case, the value is in the conclusion, not the process. You want "auth lives in middleware/auth.ts, it uses JWT with a 15-minute expiry" — not the twenty files Claude opened to figure that out.
One rule: don't parallel-edit
Subagents isolate reading, but they don't magically coordinate writing. If you spin up several helper agents and set them all editing the same project at once, their work won't mesh — each one works from its own snapshot of the world and has no visibility into what the others are doing simultaneously. Use subagents freely for parallel research; keep edits to one agent (or one file) at a time, or serialize the work so each edit lands before the next one starts.
A concrete example
Say you're debugging a flaky integration test. Instead of pasting the full CI log into your main chat, delegate: "use a subagent to read this 3,000-line log and tell me which assertion failed and why." The subagent ingests the whole log in its own window, and your main thread receives a two-sentence answer. You can now ask three follow-up questions without ever having paid the token cost of that log dump. Repeat this for exploring an unfamiliar repo before your first edit, or for grepping across a monorepo to confirm nothing else calls a function you're about to change.
Power tricks
- Write a clear
descriptionon every custom subagent. It's the only signal Claude uses to decide when to delegate — vague descriptions mean it either never fires or fires at the wrong moment. - Scope tools tightly. A research subagent doesn't need Write or Edit; restricting its tool list keeps it from accidentally touching files while it explores.
- Route cheap, repetitive lookups to a faster model. Custom subagents can pin a
modelfield (e.g. Haiku) so routine search doesn't burn your main model's budget.
Resources
Building an AI feature? Yeda AI designs, audits, and ships production LLM systems.