SUBAGENTS: SCALING CODING AGENTS BEYOND CONTEXT LIMITS
A new guide explains the subagents pattern for coding agents, using Claude Code’s Explore subagent to work around LLM context limits. [Simon Willison’s guide](...
A new guide explains the subagents pattern for coding agents, using Claude Code’s Explore subagent to work around LLM context limits.
Simon Willison’s guide breaks down how “subagents” split big problems into smaller goals with fresh prompts and clean contexts. Context windows may reach about a million tokens, but quality often drops beyond roughly 200k, so keeping the top-level context tight matters.
The example shows Claude Code launching an Explore subagent to scan a repo for relevant templates, Python, JS, and CSS before making changes. Treat each subtask as a fresh agent call with its own prompt, budget, and return contract, then stitch results together at the parent level.
Subagents keep the parent prompt small, improving output quality and reducing token waste when models struggle at large contexts.
Clear task boundaries make agent runs easier to parallelize, observe, and debug.
-
terminal
Prototype an "Explore" subagent that summarizes a repo or dataset schema; compare token usage, latency, and accuracy against a single monolithic agent.
-
terminal
Add per-subagent budgets and depth limits; chart quality versus cost to find practical defaults.
Legacy codebase integration strategies...
- 01.
Refactor existing agent workflows into Explore/Plan/Act/Verify subagents and add logging for prompts, outputs, and token spend per step.
- 02.
Enforce auth scopes and redaction when subagents crawl repos or data sources to avoid leaking secrets in prompts or outputs.
Fresh architecture paradigms...
- 01.
Design an orchestrator that spawns subagents with scoped prompts, termination criteria, and strict output schemas for hand-offs.
- 02.
Define small reusable task types (e.g., Explore, Plan, Implement, Verify) to enable parallelism and predictable costs.