What is long-term memory?

Long-term memory is selected and often summarised information, such as user preferences, past decisions and learned facts, that an AI assistant or agent keeps across sessions in an external store and brings back into context when needed.

Unlike conversation history, which carries one session's messages as they are, long-term memory persists after the session ends and keeps only information judged important. Model weights do not change; memory lives outside the model, often in a vector database or a structured store.

Topic
Prompts, context, reasoning and generation
Also known as
Persistent memory

How long-term memory works

  1. Information worth keeping is extracted from conversations or agent actions, summarised and stored with source and time.
  2. On a new request, relevant memories are retrieved by criteria such as semantic similarity, recency and importance.
  3. Retrieved memories are added to the request to fit the limited context window.
  4. Memory is regularly consolidated, updated and deleted where needed.

In more detail

Memory types: episodic, semantic and procedural

Modern agent frameworks (such as CoALA-inspired architectures) split long-term memory into three functional types: semantic memory (facts and user preferences), episodic memory (past interaction trajectories and outcomes) and procedural memory (learned workflows, tool-use rules and prompt refinements). Separating these stores improves retrieval precision and governance.

Temporal validity, conflict resolution and knowledge graphs

Flat vector similarity often struggles when preferences or facts change over time, returning outdated statements alongside current ones. Temporal knowledge graphs and explicit conflict-resolution pipelines track validity windows (valid_from / valid_to) and supersede contradicted memories rather than merely appending duplicates.

Memory poisoning and write-path validation

Persistent memory is vulnerable to memory poisoning: an attacker using indirect prompt injection in an email or web page can trick an agent into writing malicious instructions into long-term memory, causing recurring compromise in future sessions. Write-path validation, source provenance tagging and anomaly filtering are essential before committing memories.

Memory extraction cost and asynchronous processing

Automatic memory extraction on every turn adds extra LLM calls, latency and token cost, while overly aggressive retention bloats the store with low-value noise. Production systems run extraction asynchronously in the background and enforce confidence thresholds and decay policies.

Commonly confused terms

TermHow it differs
Corporate RAGEnterprise RAG indexes shared, authoritative organisational documents (policies, manuals, contracts) for knowledge grounding; agent long-term memory stores dynamic, user- or task-specific experiential state, preferences and interaction history that evolves over time.
Parametric memoryExternal (non-parametric) memory keeps facts in databases or knowledge graphs without touching model parameters; parametric memory embeds knowledge directly into the neural network's weights during pre-training or fine-tuning, making selective editing or deletion hard.

Why long-term memory matters for on-premises AI

It saves assistants from starting over each time. A study inspired by operating system memory tiers proposes moving data between fast and slow memory to support long document analysis and extended conversations beyond the context window; a study of simulated agents describes an architecture recording experiences in natural language, synthesising them into higher-level reflections and retrieving them when needed. For organisations the key question is data governance: memory holds personal data and must not leak between users.

ON-PREMISES EXAMPLE

A telecom operator's in-house support assistant keeps each employee's frequently used systems and preferred answer style in a personal memory store; employees can view and delete it and memories are separated by user identity.

Common questions

Does long-term memory change the model?

No. Information is kept in an external store and added to context when needed; model weights stay the same.

What are the risks of long-term memory?

Keeping personal data too long, wrong information becoming persistent and one user's memory leaking into other sessions.

Sources

In the glossary: Glossary, E to L

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.