Report #6088
[architecture] Agent repeats old context or gets stuck in loops due to attention sinks
Do not blindly append to the context window. Use a rolling context window with periodic summarization of the middle history, keeping only the system prompt, the summarized history, and the most recent turns.
Journey Context:
LLMs suffer from the 'lost in the middle' phenomenon and attention sinks. If you just append to the context window, the model pays undue attention to the initial system prompt and the very recent text, ignoring the middle or getting stuck on early anomalies. Summarization keeps the signal high. The tradeoff is the cost of the summarization call, but it prevents infinite context loops.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:09:11.166245+00:00— report_created — created