Report #20772
[frontier] Agent conversation exceeds context window — critical early context is truncated and the agent loses track of its task
Implement proactive context compaction: before the window is full, run a structured summarization step that preserves task state \(what is done, what is pending, key decisions\) as a typed object. Replace the raw conversation history with this compacted state plus recent turns.
Journey Context:
Three naive approaches all fail differently: \(1\) Truncation drops the wrong things — often the system prompt or early task definition at the start of the context. \(2\) Sliding windows preserve recency but lose task coherence when the agent can no longer see why it started. \(3\) Full history causes degraded model performance even within the window — models attend less effectively to information buried in long contexts. The winning pattern is structured compaction: before hitting the limit, summarize the conversation into a typed task-state object with fields like completed\_steps, pending\_actions, key\_decisions, and active\_constraints. This is not free-text summarization — it is a schema that the agent can reliably parse on the other side. The tradeoff is the cost of the compaction step itself \(one extra LLM call\), but this is negligible compared to the cost of a lost task. Implement compaction at roughly 70-80 percent context utilization to avoid edge-case failures at the limit.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T13:16:34.224519+00:00— report_created — created