AI architecture · Agents

AI agent memory: what to remember, how to retrieve it, and when to forget

An assistant that forgets everything between sessions feels shallow. One that remembers everything becomes slow, confused and a privacy liability. Designing memory is about choosing what deserves to persist, and research gives useful guidance.

ExplainerSumanta Mukhopadhyay9 min read4 sources
#ai#agents#llm#governance
EXPLAINER · AI ARCHITECTURE · AGENTS25 Oct 2026 · 00:15 GST

The most common complaint about AI assistants in the workplace is that they don't remember. You explain your role, your project and your preferences, and the next day you explain them again. The obvious fix, keeping everything, creates different problems: slower and more expensive responses, answers based on stale information, and a growing store of personal data nobody designed for.

Memory is an architecture decision, not a feature toggle.

Why "keep everything in context" fails

Stuffing history into the prompt runs into the limits covered in long context or RAG: cost and latency grow with every token, and models use long inputs unevenly. Chroma's research found performance grows increasingly unreliable as input length grows, even on simple tasks4.

LongMemEval, a benchmark presented at ICLR 2025, tested exactly this for assistants. Its 500 questions probe five abilities: information extraction, multi-session reasoning, temporal reasoning, knowledge updates and abstention, embedded in long user-assistant histories. The authors reported that commercial chat assistants and long-context models showed about a 30% accuracy drop when recalling information across sustained interactions3.

Two of those abilities deserve attention. Knowledge updates: when a user changes their address or a project changes scope, memory must reflect the latest truth, not the first. Abstention: when the assistant doesn't know, it should say so rather than inventing a memory.

Ideas from research

Memory as an operating system. MemGPT proposed virtual context management, borrowing from operating system memory hierarchies: the model pages information between a small, fast working context and larger external storage, using function calls to read, write and manage its own context1. The authors showed it maintaining consistency over long conversations and analysing documents larger than the context window1.

Retrieval by relevance, recency and importance. The Generative Agents paper gave simulated characters a memory stream of experiences, retrieved by combining how relevant, how recent and how important each memory is, plus periodic reflection that synthesises memories into higher-level conclusions2.

Indexing, retrieval and reading. LongMemEval's authors framed memory design as stages of indexing, retrieval and reading, and proposed improvements such as splitting sessions into smaller units, expanding memory keys with extracted facts, and making queries time-aware3.

Good memory isn't storing more. It's storing the right things in the right shape, and retrieving them with time and relevance in mind.

The memory architecture I use

LayerContentsLifetime
Working contextThe current task, recent turns, retrieved itemsOne request or session
Session summariesWhat was discussed, decided and left openWeeks to months
Profile and factsStable facts and preferences, each with source and timestampUntil changed or deleted
Episodic storePast interactions, indexed for retrievalDefined retention period
Organisational knowledgeDocuments and data the user may access, via RAGGoverned by the source system

Practical rules that make it work:

  1. Extract facts deliberately, as structured records with a source and timestamp, using structured outputs, rather than keeping raw transcripts as the only memory.
  2. Resolve conflicts by time. Newer facts supersede older ones; keep history but retrieve the current value.
  3. Retrieve with time awareness, so "last week's decision" finds last week's session.
  4. Let the model abstain. If retrieval finds nothing reliable, the answer is "I don't have that", not a guess.
  5. Evaluate memory specifically, with test cases for recall, updates and abstention, added to your agent evaluation suite.

Memory is personal data

A memory store is a profile of a person. Treat it accordingly:

  • Visibility and control. Users can see what is remembered, correct it and delete it.
  • Scope. Memory is partitioned per user and per tenant, with the same isolation tests as any multi-tenant store, as in multi-tenant SaaS patterns.
  • Sensitive categories. Don't store health, financial or other sensitive details without a clear basis and purpose, especially under regimes such as the UAE PDPL.
  • Retention. Define how long each layer is kept and enforce it automatically.
  • Injection risk. Content written into memory from untrusted sources can carry instructions into future sessions. Treat remembered content as data, with the controls in prompt injection defence.

Start small

Most products don't need the full stack on day one. A useful first version is session summaries plus a small, user-visible set of facts. Add episodic retrieval when evaluation shows users need it, and measure whether each layer improves outcomes enough to justify its cost and risk.

How I can help

I design agent architectures, including memory, retrieval and the governance around them, so assistants become more useful without becoming a liability. See my AI architecture work, or analyse your challenge and bring the result to a call.

References
  1. 1
    MemGPT: Towards LLMs as Operating SystemsPacker et al. (arXiv) · 2023
  2. 2
  3. 3
  4. 4
    Context Rot: How Increasing Input Tokens Impacts LLM PerformanceHong, Troynikov and Huber, Chroma · 14 Jul 2025
FAQ

Common questions

Why not just keep the whole conversation history in the context window?

Because cost and latency grow with every token, and research shows model performance degrades as inputs grow. Benchmarks of long-term memory found that commercial assistants and long-context models lost substantial accuracy when recalling information across long interactions.

What are the main memory designs for agents?

Common patterns include a short working context, summaries of past sessions, a store of extracted facts about the user or task, and retrieval over past interactions. Research systems such as MemGPT manage memory tiers like an operating system, and Generative Agents retrieve memories by relevance, recency and importance.

What governance does agent memory need?

Users should be able to see, correct and delete what is remembered; sensitive categories should not be stored without a clear basis; memories should be scoped per user and tenant; and retention periods should be defined.

Keep reading

Related

Open to advisory, fractional CTO & select builds

Let's talk about what you're building.

The fastest route is a free 30-minute call. Prefer to write? Send a message and I'll reply personally within two business days.

Start a conversation

How would you like to reach me?

Book a 30-min callFastest. Pick any open slot on my calendar.→ Write in GmailOpens a pre-filled draft in your browser.→ Use my email appOutlook, Apple Mail or your default client.→

I reply personally within two business days. Time zones from the Americas and Europe to the Middle East and Asia-Pacific.