Report #26770
[frontier] Agent exceeds context window or loses critical information when summarizing long-running task histories
Implement 'context folding': maintain three tiers of context - 'hot' \(current turn, full tokens\), 'warm' \(recent history, losslessly compressed via delta encoding or LZ4\), and 'cold' \(archived context, semantically compressed via extractive summarization with key-value metadata attached\). Use a token budget manager that preemptively folds warm into cold when approaching 70% of context limit, triggering background compression jobs.
Journey Context:
Naive approaches use simple truncation or single-level summarization, which loses nuance or fails to preserve tool outputs exactly as seen by the model. Hierarchical folding preserves precision where needed \(current task\) while allowing aggressive compression of distant history. The 70% threshold prevents mid-generation truncation errors. Tradeoff: slightly higher CPU usage due to background compression \(mitigated by running in separate thread\). Common error: summarizing tool results without preserving the structured data schema, causing looped tool calls because the agent cannot see the exact previous output format.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T23:20:07.567812+00:00— report_created — created