Skip to content

AI agent memory design starts with what the agent must forget

AI · November 27, 2026 · 8 min read

The memory page of a travel assistant, Halvard: eight things it remembers about one traveller, each with its source and review date, a new memory waiting for Keep or Discard, and the passport, card, clinic visit, a colleague's dates and a supplier's instruction it did not keep.

AI agent memory design is the set of rules that decides what an agent writes down about a person between sessions, which source each item came from, where it may be used, and when it is deleted.

Any team shipping an assistant that books, buys, files or answers for someone meets the question the week the first "remember this" ships. The answer is mostly a list of what the agent is not allowed to keep. The useful memories are few and dull: a seat preference, an approver, a cost centre. The dangerous ones arrive on their own, from a document the agent read, a one-off visit to a clinic, a card number typed once.

The 30-second version

  • Keep what the person told you, would tell you again, and what changes an action the agent takes.
  • Don't keep secrets, health and other special data, facts about other people, guesses, or anything that came from content the person didn't write.
  • Give every memory a source, a scope and a review date.
  • Show each new memory when it's saved, and make forgetting reach every copy, not only the row on the settings page.

What does an AI agent's memory hold?

Researchers at Princeton split an agent's memory into four parts in the CoALA framework: working memory for the task in hand, and three long-term stores. Episodic memory holds past events, semantic memory holds facts about the world and the user, procedural memory holds the rules the agent follows. LangGraph's memory docs use the same three words and store each memory as a JSON document under a namespace, which works like a folder.

In a product the three map onto things a person recognises. A semantic memory is "Marta flies aisle seats". An episodic memory is "the Lisbon booking on 3 November was changed twice". A procedural memory is "trips over 800 euros go to Daniel before payment". The product question is the same for all three: which of them should outlive the conversation that produced it.

What should an agent remember about a user?

We use three tests, and a memory has to pass all of them.

  1. The person said it, or confirmed it. A fact the agent inferred ("seems to prefer morning flights") is a guess. It can shape a suggestion in the moment. It doesn't go into storage until the person says yes.
  2. It will still be true next month. A home airport, a dietary rule, an approval limit. A one-off ("this time, put me near the venue") stays in the conversation.
  3. It changes what the agent does. If no action reads the memory, the memory is data you hold about a person with nothing to show for it.

Teams skip the third test most often. A memory that changes nothing still has to be secured, exported on request and deleted on request. Under the GDPR, Article 5 asks that personal data be limited to what is necessary (data minimisation) and kept no longer than the purpose needs (storage limitation). A memory store with no rule for what goes in fails both from the first write.

What must an agent never write down?

Five kinds of information stay out of long-term memory, whatever the model proposes.

  • Secrets. Card numbers, one-time codes, passwords, passport numbers. The agent reads them at the step that needs them, and the step forgets them. If a vault holds them, the memory holds a pointer to the vault, never the value.
  • Special categories. Health, religion, sexual orientation, union membership and the rest of GDPR Article 9 need a specific legal basis before anyone processes them. A booking at a clinic says something about health. The booking can sit in the trip history; "sees a cardiologist" never becomes a memory.
  • Other people. "My manager is going through a divorce" was said about someone who never agreed to be remembered.
  • Anything from content the person didn't write. A PDF from a supplier, a web page, an email. This is how memory gets poisoned (next section).
  • One-offs. If it won't be true next month, the conversation holds it, and the conversation ends.

For regulated data this list is a legal question as well as a product one. We write it with the team and their counsel before the first memory is stored, then enforce it in code at the write step, where the agent asks to save something. The model proposes. A filter that doesn't depend on the model decides.

Why is agent memory an attack surface?

A prompt injection that lands in one answer does its damage once. One that lands in memory comes back every session. In 2024 the security researcher Johann Rehberger showed that a web page could plant false memories in ChatGPT, including an instruction that kept sending later conversations to his server. In February 2025 he did the same to Gemini's long-term memory, with a document that told the model to save a memory if the user later typed "yes". The first fix he proposes is a product decision: ask the user to confirm before a new memory is saved.

OWASP now lists the risk as ASI06, memory and context poisoning, in its Top 10 for Agentic Applications. The entry's co-lead described a case from Cisco's research where a cloned repository reached a coding agent's persistent memory, and Anthropic's fix in Claude Code v2.1.50, which removed user memories from the system prompt (OWASP, May 2026). The rule we take from it is short. A memory carries the trust of its source, and a memory written while the agent was reading untrusted content starts untrusted. The wider defence is in our piece on prompt injection defense.

Why does deleting a memory not make the agent forget?

Because a memory is rarely stored once. OpenAI's help page says so for ChatGPT: deleting a chat does not necessarily delete a separate saved memory created from that chat, and removing something fully means deleting every source where it appears. The same page says logs of deleted saved memories may be kept for up to 30 days for safety and debugging.

Your product will have the same shape. One fact can live in the memory row, in its embedding in a vector index, in a summary the agent rewrote, in a cache, in the run logs and in the conversation that produced it. A forget button that deletes the row and leaves the embedding still lets search bring the fact back. So we design forgetting as a job with a list:

  1. Every memory stores the id of its source: a message, a document, a run.
  2. Every derived copy (embedding, summary, cache entry) stores the id of the memory it came from.
  3. Forget deletes by that id across all of them, and rebuilds the summaries that used it.
  4. Logs have a fixed retention, written on the memory page, so "forgotten" has a date.

The right to erasure in GDPR Article 17 asks for this anyway. Built on day one it costs a foreign key. Added later, it means searching every place a fact can hide.

Which screens does agent memory need?

The rules only hold if the person can see them. Four screens do most of the work:

  • A memory page listing every item with its source, its date and its scope. Anthropic's memory for Claude lets people view and edit a memory summary, and keeps a separate memory for each project.
  • A notice at write time. "Saved: aisle seat on flights over three hours", with Keep and Undo, at the moment it happens. A memory the person discovers a month later is one they won't trust.
  • A mode with no memory. Claude calls it incognito, ChatGPT temporary chat: a conversation that neither reads nor writes memory.
  • A list of what wasn't kept. The passport number read at check-in and dropped, the instruction in a supplier's PDF that was refused. Showing them tells the person the rules run.

The write notice is only honest if its Undo reverses everything the save did, the same condition we set for optimistic UI for AI agents.

When should an agent have no memory at all?

Some agents are better without it. An agent that does one task per session, such as a support bot answering a public question, gains little from remembering the visitor and takes on a store to secure. Regulated work is the other case: OpenAI ships ChatGPT for Healthcare with improved memory off by default. We start with memory off, add the three or four items that change an action, and let the list grow when a person asks the agent to remember the same thing twice.

Sources

Frequently asked questions

Rather have it done for you?

We design and build this kind of work for clients. Tell us what you need.