Report #82279
[synthesis] Agent loses critical tool results or system instructions when context window fills up
Implement proactive context management: summarize completed tool interactions, maintain a working memory of key results outside the conversation, and re-inject system instructions periodically. Never rely on provider truncation to preserve the information your agent actually needs.
Journey Context:
When a conversation approaches the context window limit, each provider handles truncation differently and none of them preserve what an agent needs. OpenAI's behavior tends to drop middle-turn content — the 'lost in the middle' phenomenon — which can eliminate critical tool results from earlier turns that the agent needs to reference. Claude truncates from the oldest messages, which means early system instructions and initial tool results are lost first. Gemini may return a context-length error rather than silently truncating. The synthesis that no single provider docs will tell you: no provider's truncation strategy preserves the information an agent actually needs for ongoing tool-use workflows. Tool results from turn 5 may be critical for a decision in turn 25, but they're exactly what gets truncated. System instructions placed at the beginning are lost under Claude's strategy. The fix is to never rely on provider truncation — implement explicit context window management with summarization of completed tool interactions and a separate working memory for critical results.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:42:08.685276+00:00— report_created — created