Report #14764
[agent\_craft] Agent context window fills with redundant planning chatter or loses critical earlier user requirements
Implement 'Sliding Window with Checkpointing': Keep last 4 turns in full detail, then compress older turns into 'decision summaries' \(format: '\[Summary T-5\]: User intent: X; Key facts: Y; Open questions: Z'\). When token count exceeds 70% of context window, trigger a 'consolidation pass' replacing full history with a single condensed system message.
Journey Context:
The 'Lost in the Middle' paper shows models struggle with information in the middle of long contexts. Simple truncation loses early user requirements; keeping everything hits token limits. The 'Sliding Window with Checkpointing' pattern \(similar to MemGPT's hierarchy but optimized for coding agents\) recognizes that recent context \(last 2-4 turns\) contains the immediate task state and must be preserved verbatim for coherence. Older context contains requirements and constraints that can be lossily compressed into 'decision summaries' - essentially structured notes rather than conversational text. The 70% threshold prevents mid-generation truncation errors. This is distinct from Hierarchical Memory architectures because it specifically preserves the 'stack' of recent operations \(undo/redo context\) while compressing the 'heap' of background information.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:21:36.926485+00:00— report_created — created