Ghost Hat Studio
Blog
November 13, 2026

Your Agent Remembers Everything. That's the Problem.

4 min read
Special report on agent memory, part 1. The first in a series investigating how memory works in AI agents.

A smiling person in a bright home office reaching for one of the blank sticky notes on a whiteboard, sunlight through a big window, plants on the shelves.

Ask a long-running AI agent where a user lives, and it might give you three cities. The user moved twice this year. The agent saved each new address and never retired the old ones, so now it believes all three.

That's the trap in append-only memory, where every new fact gets added and nothing is ever removed. A recent essay on DEV put it in one line: append-only agent memory doesn't just get big, it gets wrong.

Most people get agent memory wrong, even the frontier labs. Badly designed memory doesn't just hand back stale answers. It fills the prompt with contradictions the model has to untangle, and that can wreck its reasoning.

Why old facts win

The commonly accepted practice is for agents to keep memories in a vector store, a database that files text by meaning so the agent can find related notes later. If you ask "where does the user live?" it extracts only the notes that sound most like the question. "Lives in Chicago" seems as relevant as "lives in Denver." Both could appear in the prompt, and the model has a 50/50 chance of choosing the wrong answer.

Even a right guess has a cost. In a July 2025 study, Chroma found that "even a single distractor reduces performance": hand a model one passage that looks relevant but doesn't answer the question, and it does worse. A stale memory is exactly that kind of distractor.

The same goes for preferences, project status and decisions that got reversed. Every week the pile grows, and less of it is true.

Garbage collection, the routine cleanup that databases, caches and code history tools use to keep old data from piling up, is a good place to start. Here are five ways to borrow from it. None of them is a cure-all, but each keeps stale facts out of the prompt, and a cleaner prompt leaves the model more room to reason.

1. Retire the old fact when you write the new one

Before saving a fact, look for one it contradicts. If the agent is about to save "lives in Denver," it should find "lives in Chicago," mark it as replaced and link the new note to it. Searches skip replaced notes unless someone asks for history.

Some memory builders already work this way. In a January 2025 paper on the memory graph behind their agent product, the team at Zep wrote that "the introduction of new edges can invalidate existing edges in the database," and that their system "consistently prioritizes new information" when it decides which facts to retire.

2. Let old memories fade

Give each memory a weight that drops with age, so a recent note beats an old one when they match a question equally well. The old note isn't gone. It just stops winning ties. A user who switched from dark mode to light mode last spring gets light mode, without anyone writing a rule for it.

3. Merge the repeats

Agents pile up near-duplicates, like dozens of notes that say the user asked about pricing again. Every so often, gather each cluster of similar notes, have a small model write one summary, and use the summary in place of the cluster. It's similar to compaction in databases.

4. Delete on a schedule

Filtering a note out of search results isn't the same as deleting it. Give each kind of memory a retention period, a time to live in cache terms, and remove it from the index when that runs out. A one-week trip itinerary doesn't need to come up next spring.

One rule comes before any of this. Passwords, keys and other secrets don't belong in agent memory at all, so there's nothing to clean up.

5. Keep two layers

Keep a permanent log of every memory ever written, with when and where it came from. Then build a cleaned-up working memory from that log, applying the four steps above. Only the working memory goes into the agent's prompt. It's the same split git makes between a project's full history and the files you have open today.

A sunlit office with a wall of shelves full of plain white archive boxes behind a desk holding one open blank notebook: the permanent log in the back, the working memory in front.

When someone asks why the agent said Denver last Tuesday, the log shows the Chicago note, the replacement and the date. The working memory gave the answer. The log explains it.

A cleanup job you can add this week

You don't need a new system. A scheduled job that runs once a week can do it.

  1. Mark every note that a newer note replaced.
  2. Recalculate the age weights.
  3. Merge clusters of near-identical notes from the past month into summaries.
  4. Delete working-memory notes whose retention period has run out, and leave the permanent log alone.

Make each step safe to run twice, and have it log how many notes it touched. Start with step one. It goes a long way on the three-cities problem, and you'll likely see sharper answers as the contradictions drop out.

OpenAI, Anthropic and Cognition all spent 2026 teaching their agents to clean up their own memory. Next in this special report, we'll look at how they did it, and why they don't agree.

Want agents you actually own?
Thirty minutes. We listen, we ask questions, we find out whether there’s a fit.
Book a call
More from the blog →