Report #5213
[architecture] Letting the agent's scratchpad \(chain-of-thought/tool outputs\) grow indefinitely within the context window
Implement a rolling context window with periodic summarization: once the scratchpad exceeds a token threshold, summarize the oldest N turns into a compressed 'episodic summary' and evict the raw text.
Journey Context:
Agents executing long tasks accumulate massive scratchpads. This increases latency, cost, and degrades instruction following as the model's attention is diluted. Simply truncating loses state. Summarization preserves the 'what was done' while evicting the 'how it was done step-by-step', keeping the context window focused on the immediate next steps while retaining historical continuity.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:50:39.508029+00:00— report_created — created