Context Isolation via Subagents and Just-in-Time Retrieval
AdvancedApply context curation techniques: pruning, compaction, isolation, and retrieval · Difficulty 3/5
Explanation
Context Isolation
Delegate a heavy subtask to a Subagent with its own context window; it returns a condensed result so the main context stays clean. The verbose intermediate work of exploring, researching, or drafting happens inside the Subagent's window and never has to enter the main session's budget.
Just-in-Time Retrieval
Pull information into context when it's needed rather than front-loading everything up front. This controls what enters the window in the first place, complementing pruning and compaction, which manage what's already there.
Common exam traps
- Assuming isolation and retrieval are the same technique as pruning or compaction. Isolation moves work out of the main window entirely via a Subagent; just-in-time retrieval controls what enters the window before it ever becomes a pruning or compaction problem. All four techniques solve different parts of the curation problem and are typically combined.
Key Takeaways
- Context isolation delegates heavy subtasks to a subagent with its own window, keeping the main context clean
- Just-in-time retrieval pulls information in only when needed rather than front-loading everything
- Isolation, retrieval, pruning, and compaction are complementary, not interchangeable, curation techniques
- The main context should hold only the condensed result of a delegated subtask, not its full working state
Glossary Terms
An agent-environment interface design where a lean surface is exposed up front and the agent fetches additional detail on demand, rather than front-loading every tool, schema, and document into context (monolithic context). Progressive discovery is the scalable pattern for large integrations; monolithic context is acceptable only when the full set is small and stable.
A pattern that dynamically retrieves relevant information from an external knowledge base and injects it into the context window based on the current query. Allows Claude to reason over large document sets without fitting everything in context at once.
A Claude instance spawned by an orchestrator to handle one bounded subtask in complete context isolation. Each subagent starts with a fresh context window — the orchestrator's history is never inherited — and is invoked via the [Task tool](/glossary/task-tool). The subagent runs its own full [Agentic Loop](/glossary/agentic-loop), then returns a single structured result to the orchestrator.
Related Concepts