How parallel helpers can speed up your refactor â and drain your usage allowance twice as fast
âĻ Introduction
ClaudeâŊCode v1.0.60 introduced the new /agents command. With it you can spin up subâagents â lightweight Claude workers that run under one topâlevel session. Each gets its own context window, system prompt, and tool permissions. In other words, you now have a miniâfleet of AIs that can tackle parts of a job in parallel. (docs.anthropic.com)
Iâm kneeâdeep in a largeâscale refactor that touches a few hundred files, so it felt like the perfect testâdrive for subâagents. Hereâs what I learned.
ð§ SubâŊAgents at a Glance
- ðđ What they are â Preâconfigured AI personalities you delegate work to. Think of them as coding experts with a very focused remit. (docs.anthropic.com)
- ðđ Separate context history â Each subâagent maintains its own conversation history. That context history never pollutes the parent or its siblings.
- ðđ True concurrency â Claude may schedule subâagent jobs at once. If your prompts are I/Oâlight, they finish in parallel and feel much faster than sequential runs.
- ðđ Same token pool â All prompts and completions still count against your planâs 5âhour rolling limit. More speed therefore â more tokens burned per wallâclock minute.
ðŊ Why Use SubâŊAgents? Key Benefits
| ð Benefit | ðĄ Why it matters |
|---|---|
| Clean context separation | No accidental "crossâtalk" between tasks. Each agent sees only what it needs, so your refactor instructions donât collide with your testâgeneration instructions. |
| Longer effective history | Because contexts donât mingle, every agent can use the full 200kâtoken window (Claude 3.5) for its thread. |
| Caching between runs | The parent session can hold shared project docs (architecture.md, codingâstyle.md). Each subâagent can reference that shared memory without reâuploading every time. |
| Failure isolation | If one agent hits a hallucination or error, others keep going. You just retry the failed shard. |
ð ïļ RealâWorld Case â BatchâUpdating Hundreds of Files
For this large refactor, I loop through a list of more than 300 files. My prompt logic update a finished list, so when I reach the usage limit and the session breaks, I can rerun the same prompt file and it resumes with the first unfinished file. I now restart the refactor roughly every five hours, after the limit resets.
âģ Previous Attempt 1 â One Huge Session
- ð Looping through files in one conversation quickly ballooned the context. After ~40 files Claude hit the 200kâtoken window and terminated.
ð Previous Attempt 2 â Powershell Outer Loop
foreach ($file in $filesToProcess) {
# Replace the {file-name} placeholder with the actual file name
$customizedPrompt = $promptTemplate -replace '\{file-name\}', $file.FullName
# Call claude-code with the customized prompt and file content
claude -p $customizedPrompt --dangerously-skip-permissions
}
- âïļ Each invocation got a fresh context, so context history per call were minimal.
- â ïļ Downside: every call had to resend project structure, style guide, and helper functionsâzero cache, lots of latency.
⥠New Approach â One Parent, Many SubâAgents
- ð Create a single highâlevel session that loops over all files and delegates each one to a subâagent.
- ð Isolated histories: each file runs in its own subâagent session, so histories never mix.
- â Advantage: tasks stay isolated, sessions donât collide, and you avoid the contextâlength limit.
- ðĪŊ Unexpected discovery: without me asking, Claude Code spun up five subâagent sessions in parallel. That sped up processingâbut also burned tokens much faster.
- âąïļ On the Pro plan I hit the usage limit in about 15âŊminutes. Sequential processing took roughly 30âŊminutes.
- ðļ Even with the $100âŊMax plan (5Ã tokens), Iâd still exhaust the window in around 1âŊhourâŊ15âŊminutes.
ðļ Token Economics: Hidden Costs of Parallelism
- âïļ Parallelism â free â The perâfile token cost is unchanged, but you pay for each session simultaneously. Your quota drains proportionally to concurrency.
- ð Plan sizing â On the $100âŊMax plan (ââŊ5à Pro tokens) the same job would still exhaust the window in about 75âŊmin.
ð Conclusion
Subâagents are a genuine force multiplier. For largeâscale, sliceâable tasks they feel like hiring a small AI team for the price of one. Just remember: speed kills (your quota).
If youâre a heavy user, set up guardrails before unleashing a parallel swarm â or be ready to smash that Upgrade button.
Happy tokenâburning!ðĨðĨðĨðĨðĨðĨðĨðĨ


Top comments (0)