Tool result clearing
Replace old tool results in the history with a short placeholder once the agent has used them.
Also called Observation masking
Yang et al., Lindenbauer et al., Manus, LangChain, Anthropic
The problem
Old tool results, such as file contents or search results, keep filling the context after the agent has used them.
Older tool results (such as file contents or search results) are no longer needed once Claude has processed them.
Observations can be huge, especially when agents interact with unstructured data like web pages or PDFs.
Therefore
the structure and order of the agent’s interaction history is preserved, but the content of old observations are replaced with a one-line placeholder.
A natural baseline approach directly targets verbose environment observations through observation masking strategies that explicitly omit tool outputs.
In use
LangChain Deep Agents
As the session context crosses 85% of the model’s available window, Deep Agents will truncate older tool calls, replacing them with a pointer to the file on disk and reducing the size of the active context.
Manus
the content of a web page can be dropped from the context as long as the URL is preserved, and a document's contents can be omitted if its path remains available in the sandbox. This allows Manus to shrink context length without permanently losing information.
Where it breaks
Clearing breaks the prompt cache, and a fixed rule ignores which results the agent still needs.
Tool result clearing: Invalidates cached prompt prefixes when content is cleared.
Observation Masking employs a fixed-size rolling window that is agnostic to the relevance or staleness of past observations (e.g., retaining a file’s content after it was modified).
From a logical standpoint, any irreversible compression carries risk.
Sources
- SWE-agent: Agent-Computer Interfaces Enable Automated Software EngineeringYang et al.
- The Complexity Trap: Simple Observation Masking Is as Efficient as LLM Summarization for Agent Context ManagementLindenbauer et al.
- Context Engineering for AI Agents: Lessons from Building ManusYichao 'Peak' Ji, Manus
- Context Management for Deep AgentsLangChain, Jan 28, 2026
- Context editingAnthropic
Added Nov 14, 2026