Report #68113
[frontier] Agent context window fills up during long-running tasks causing degradation and truncation
Implement periodic context compaction: extract structured state \(JSON conforming to a predefined schema\) from the conversation, then restart the agent with that compacted state as system context. Do not use naive text summarization — use a schema-defined state object that preserves precise values, IDs, and decisions.
Journey Context:
The common approaches to context overflow are truncation \(loses critical information\) or summarization \(loses precision — summaries of summaries degrade rapidly, and specific values like IDs, timestamps, and numerical data get rounded or dropped\). The emerging pattern is structured state extraction: define a JSON schema representing the agent's working state \(task progress, decisions made, data collected, files modified, next steps\), have the agent populate it from the current context, then start a fresh context window with that structured state injected. This preserves precision \(exact values, not paraphrased approximations\) while dramatically reducing token count — often 50K\+ tokens of conversation compress to 2-3K tokens of structured state. The tradeoff is that you must define the state schema upfront and it may not capture implicit context or conversational nuance. LangGraph's StateGraph pattern codifies this by making the state object the primary data flow artifact.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T20:48:31.342614+00:00— report_created — created