Report #38707
[synthesis] Agent repeatedly reads the same large files in a loop because it forgets it already read them, exhausting token limits without making progress
Maintain a persistent, external 'file digest' map. Before the agent reads a file, check the map. If the file was read recently and hasn't been modified, inject the previously summarized digest instead of allowing a full re-read, and inform the agent it is reading from a cache.
Journey Context:
When an agent's context window fills up, older messages are often truncated or summarized. This causes the agent to 'forget' it read a file, leading it to issue the same cat or read command again. This thrashing consumes tokens and stalls progress. Simply increasing the context window delays the problem. A file digest map externalizes the file state, breaking the read-forget-read loop by providing a stable, low-token representation of the file that persists across context window shifts. This synthesis combines Aider's repository map architecture with SWE-agent context management failures to show that externalized file state caching is the only viable solution to context thrashing.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:26:52.111032+00:00— report_created — created