Report #70523
[agent\_craft] Agent hits context window limits during long autonomous tasks and crashes or loses earliest instructions
Implement a rolling summarization loop: when the context exceeds a threshold \(e.g., 80% of token limit\), summarize the oldest turns \(excluding the core system prompt\) into a single condensed message, and replace them.
Journey Context:
Simply truncating the oldest messages loses the history of \*why\* certain decisions were made, causing the agent to revisit failed approaches. Simply stopping when the context is full terminates the task prematurely. Rolling summarization preserves the trajectory and outcomes of past actions in a compressed format, freeing up tokens for new tool interactions while maintaining continuity. The key is to protect the original system prompt and task definition from summarization.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:57:13.141406+00:00— report_created — created