Agents do not have memory in any single sense. They have a working context, possibly a summary of it, and possibly external storage, and these behave quite differently.
What are the layers?
- Working context. The current conversation, complete.
- Summarised history. Compressed earlier steps.
- External storage. Files or a database it writes to.
- Persistent memory. Carried between separate runs.
Why does an agent forget mid-task?
Because the context filled and older material was summarised or dropped. Something established early can vanish, which produces the confusing experience of an agent repeating work it already did.
What is the practical fix?
Writing things down. An agent that records findings to a file, and reads that file, has memory independent of its context, which is the technique well-built systems rely on.
Why is that better than a larger context?
Because attention is uneven. Material buried in an enormous history is attended to less reliably than a short file the agent deliberately reads, and the second is also cheaper.
What should be written down?
Decisions, findings and what has been tried. That last one prevents the most common loop, where an agent repeats an approach that already failed because the failure was summarised away.
What about memory across users?
A design question with a privacy dimension. An agent serving several people must keep their contexts separate, and shared memory that leaks between them is a serious failure rather than an inconvenience.
It is worth confirming explicitly in anything multi-user. The failure mode is quiet, since nothing indicates that a response was shaped by somebody else's session, and it is discovered when a user sees something they should not.
What about memory between runs?
Available in some systems and worth treating carefully. An agent that remembers previous sessions accumulates assumptions, and a wrong one persists until somebody notices.
How does summarisation lose things?
Selectively and invisibly. A summary keeps what seemed important at the time, and the detail that mattered is gone with no indication that it was ever there.
What does this mean for long tasks?
That they degrade. An agent forty steps in is working from a compressed account of the first thirty, and reliability drops accordingly, which is an argument for shorter runs.
What should be written rather than remembered?
Findings, decisions and failed approaches. Those three are what an agent most needs later and what summarisation most reliably discards.
Instructing an agent to maintain a working file, and to read it before deciding, costs a little context on each cycle and prevents the repetition that otherwise consumes long runs. It also gives you something readable afterwards.
What about shared memory between runs?
Useful for genuinely continuing work and a source of quiet errors. An agent carrying conclusions from a previous session inherits whatever was wrong in them, with no indication of where they came from.
Keeping that state in files you can read is the safer arrangement. Anything an agent remembers should be inspectable, because the alternative is a system whose behaviour depends on accumulated assumptions nobody can examine.
How should you structure work around this?
In stages with checkpoints. Several bounded runs, each starting from written state, is more reliable than one long run, and it gives you review points.
What is the useful mental model?
An agent is somebody with excellent short-term recall and no long-term memory, working from notes. Everything about how to work with one follows from that.