If you build AI agents, you have met this bug. A user spends an hour with your agent, and somewhere past message 30 it asks them for something they already said. We wrote a white paper on a fix borrowed from how human memory works. This is the short version.
The problem every long-running agent has
An agent can’t send its model the whole conversation forever. So it sends a slice, usually the newest messages, and everything older falls off.
If your agent keeps long-term memory, the facts from that older stretch were probably saved. That’s the frustrating part. The fact exists. But nothing in the model’s view says the conversation ever covered it, so the model doesn’t know to go looking.
The common fixes each cost something:
- Raise the window. You pay for those tokens on every turn. And a 2023 study, “Lost in the Middle”, found models use information at the start and end of a long input best, and the middle worst. A bigger window gives the model a bigger middle.
- Summarize the middle. Hermes Agent and MemGPT both do a version of this. It costs a model call, and the summary becomes a second copy of what your memory already holds. The copies drift.
- Give the model a search tool. It only helps when the model already suspects something is there to find.
What memory research says, in four findings
Human working memory has the same limit as your agent’s window, and psychology has studied it for decades. Four findings matter here.
It’s small, and practice doesn’t grow it. The current estimate is about four chunks at once. People who train on working memory games improve at the game and little else. That’s the human version of raising the context window.
What grows is the chunk. In a 1980 study in Science, a runner known as SF took his digit span from 7 to almost 80 over about 20 months. His span for letters stayed ordinary. He hadn’t grown his memory; he’d learned to group digits into running times he already knew. Each chunk pointed at something in long-term memory, so each one carried more.
First and last win. People recall the start and end of a list best and lose the middle. Language models show the same curve.
Something does the binding. In 2000, Alan Baddeley added a part to his model of working memory called the episodic buffer: a small store that ties what you’re holding now to what you already know, as one episode.
Taken together, that’s a design brief. Don’t grow the window. Make each chunk point into long-term memory. Protect the first and the last.
The episodic buffer: an index, not a summary
Here is the design the white paper proposes. Each time your agent files a stretch of conversation into long-term memory, it also writes one line about that stretch: what it was about, how it ended, and which memory records it was filed into.
When the conversation outgrows the window, those lines go where the old messages were. The agent always sees the line for how the conversation started, then the lines for the stretches just before its window, capped at about a dozen.
The difference from a summary is the pointer. A summary tries to hold the content. A buffer line holds the address. The detail stays in memory, where it already was, so there’s one copy of each fact, and the line can’t drift from it. The model reads the index and decides for itself what to open.
That is exactly what SF did with his race times. He didn’t hold the digits. He held where they lived.
Adding it to your own agent, in five steps
You need one thing first: a step that saves memory after replies. If your agent doesn’t have one, build that. A buffer pointing at nothing is worse than no buffer.
- Add one output field to your memory step. Ask for
episode: one line, under 25 words, on what this stretch was about and where it ended up. It rides the call you already make, so it costs no extra model call. - Save a small record per stretch. Thread ID, start and end time, date, the line, and the IDs of the memory records the step actually wrote. Key it by thread and end time so retries overwrite instead of duplicate.
- Read it only when the window is full. If your history read came back short, the whole conversation is already in view. Do nothing.
- Show the first stretch and the latest ones. Put the block where the evicted messages were, ahead of the oldest message you replay. Mark a gap only when you can prove a stretch was skipped.
- Treat the lines as notes. Scan them for injected instructions, tell the model they aren’t the user’s words, and never let one count as evidence for a number.
The white paper has the record layout, pseudocode for the read path, and a way to test it: plant a fact early in a thread, bury it past the window, ask for it, and compare recall with and without the buffer on the same threads.
What we don’t know yet
We built this into Bizer’s own agent, Miles, in October 2026. It’s tested in code. It has not been measured on live conversations yet, and nobody else has published a measurement of it either. Treat the recall gain as a hypothesis worth testing, not a result.
Two more honest limits. The far middle of a very long thread isn’t listed, so the agent has to choose to search for it. And the lines are written by a model, so they can be vague or wrong; keeping them short and marked as notes limits the damage.
We also haven’t found another agent design that makes its compressed history a set of pointers into its own memory, written by the same step that stores it. We haven’t checked every system. If you know of one, we want to hear about it.
Read the white paper: The Episodic Buffer for AI Agents. It covers the research with sources, the reference design, use cases from support to coding agents, an evaluation method, and Bizer’s implementation as a case study. A PDF version is available too.
