Claude Code Subagents: Isolate Context and Run Work in Parallel
Engineering
Claude Code Subagents: Isolate Context and Run Work in Parallel
One of the most useful — and most underused — features in Claude Code is the subagent: a scoped task that runs in its own separate context window and reports back only a summary. Used well, subagents keep your main session lean and let independent work run in parallel. Here's what they are and when to reach for them.
What a subagent is
When Claude Code delegates a task to a subagent, that subagent gets its own context window — a clean slate with just the task, not your whole conversation. It does the work (reading files, running commands, searching), and returns only its final answer to the main session. The pile of intermediate steps — the twenty files it read, the searches it ran — never touches your main context.
That's the whole point: isolation. The main session stays focused on the thread that matters, while the messy exploration happens somewhere else.
Why that matters
Two payoffs:
1. Your main context stays clean. Every file read and command output in your main session lives in the context window and gets re-sent on every turn — which is what makes long sessions slow, expensive, and prone to drift. A subagent does the noisy part ("search the codebase and find where auth is configured") and hands back a two-line answer. You get the conclusion without the twenty-file dump. (Why a bloated context costs you every turn →)
2. Independent work runs in parallel. Because each subagent is self-contained, several can run at once — one mapping the database layer, one auditing the API routes, one writing tests — and you get all the results together. It's the same idea as running multiple sessions, orchestrated from inside one.
When to reach for one
Use a subagent when the task is:
- Scoped and self-contained — "find X," "audit Y," "summarize Z." A clear input, a clear output.
- Noisy — it'll read a lot of files or produce a lot of output you don't want clogging the main context.
- Parallelizable — several independent sub-tasks that can run at once.
- Exploratory — you want a conclusion, not the search that produced it.
When not to: work that's tightly coupled to the main thread, or where you need to watch and steer every step.
The catch
A subagent only returns what it says at the end — so a vague task gets a vague summary, and you can't course-correct mid-run. Give it a sharp brief and ask for exactly the output you want. Garbage brief, garbage summary.
Seeing them run
Subagents (and the sessions that spawn them) are invisible until they report back — fine for one, but once you're orchestrating several you want to see the fleet. That's what Mwah does: every live Claude Code session floats on your desktop as a little robot showing what it's doing right now, ALIVE or STUCK — so a parallel run is a board you glance at, not a stack of terminals you alt-tab through. Feed the ones that nailed it; retire the stuck ones.
Related: Run multiple Claude Code sessions · Why Claude Code burns tokens
Keep reading
View all dispatches →Shopify AI Agent Tools: What Your Agents Can Actually Do in Your Store
Clearly now ships Shopify store tools your AI agents can call — browse the catalog, read orders, roll up revenue, edit products, and attach generated images — over MCP and the beehaven CLI, with a dry-run preview on every write. Here are the tools, with example commands.
How to Manage Your Shopify Store with AI Agents
AI agents can now do the work of running a Shopify store — writing descriptions, generating product images, answering customers, updating the catalog. Here's how agent-run commerce works, and how to set it up.
Claude Code for Shopify: Run Your Store from Your Terminal
If you already run your codebase with Claude Code, the same agents can run your Shopify store — edit the catalog, generate product images, answer customers — with a connector and the right guardrails. Here's the setup.