Context Summarization
Context summarization is a technique for optimizing token usage and information retrieval in Claude Code sub-agents by condensing input context to essential information relevant to specific tasks. Rather than passing complete conversation histories, full documents, or extensive background information to sub-agents, summarization reduces cognitive load and token consumption while maintaining task performance. This approach is particularly valuable when sub-agents operate within constrained context windows or when orchestrating multiple agent calls across a workflow.
The primary mechanism involves analyzing raw input data to extract key facts, decisions, and code states while discarding redundant or irrelevant details. By filtering out noise, the system ensures that the sub-agent receives a focused context window that aligns directly with its assigned objective. This selective transmission prevents the dilution of important signals that can occur when large volumes of historical data are included indiscriminately.
Implementing this technique often requires a two-step process where a primary agent or a dedicated summarization module processes the raw context before it is passed to the target sub-agent. The summarization step must preserve critical dependencies and state changes to ensure the sub-agent can execute its task accurately without access to the full original history. This separation of concerns allows for more modular and efficient agent architectures.
The benefits of context summarization extend beyond immediate token savings. By maintaining a cleaner context window, the system reduces the likelihood of hallucinations caused by conflicting or outdated information. It also improves response latency, as smaller context windows are processed more quickly by the underlying language model. Consequently, this technique supports more scalable and reliable multi-agent workflows in complex development environments.