What Is AI Memory?
< BlogFundamentals
Oct 17, 2025
Updated November 26, 2026
12 minutes read

What Is AI Memory?

A large language model keeps nothing between requests. Each call starts from the weights the model learned in training plus whatever text arrives in the prompt, and once a conversation ends, the model has no record of it. Ask an assistant without memory about a decision you made last week, and it has nothing to look up.

AI memory is the part of an AI system that stores information from past interactions and brings it back when it's needed. It lets an assistant keep your preferences, a support agent see a customer's history, and a coding agent follow the conventions of a repository it worked on last week.

This guide explains the difference between short-term and long-term memory in AI, the types of long-term memory, how memory systems work and how they're built, and where they tend to go wrong.

What Is AI Memory?

AI memory is an AI system's ability to store, retrieve, and update information across interactions. The term refers to two mechanisms: the context a model sees during a single request, and the external stores an application writes to and reads from between requests. Only the second one survives after a conversation ends.

Researchers often divide LLM memory into three kinds. Parametric memory is what a model learned during training, fixed in its weights. Contextual memory is the prompt: instructions, conversation history, and any retrieved documents. External memory is information stored outside the model and fetched when it's relevant. When people talk about giving an AI memory, they almost always mean the external kind, because an application can update it after deployment without retraining the model.

A memory-enabled assistant writes down what it learns: that you prefer short answers, that the project deadline moved to March, or that a customer's last ticket was about billing. When one of those facts becomes relevant again, the system retrieves it and adds it to the prompt. Agent memory applies the same mechanism to autonomous agents, which carry plans, tool results, and lessons from earlier tasks into later ones.

Short-Term vs Long-Term Memory in AI

Short-term memory in AI is the context window: the tokens a model processes in a single request. Everything the model can use at that moment has to be in that window, including system instructions, the conversation so far, and retrieved documents. When the session ends or the window fills up, older content drops out.

Context windows have grown much larger, and a bigger window still has limits. It resets between sessions, so nothing carries over unless the application saves it. Every token adds cost and latency to every request. Models also use long contexts unevenly: in the Lost in the Middle study, accuracy was often highest when the relevant information appeared at the start or end of the input and dropped significantly when it appeared in the middle.

Long-term memory is information stored outside the model that persists across sessions: user profiles, past conversations, documents, decisions, and learned procedures. The context window doesn't bound it, so it can keep growing, and retrieval selects the small part of it that enters the prompt for each request. Designing long-term memory for AI agents comes down to what to keep, how to find it again, and how to update it.

Here's how the two compare:

Short-term memoryLong-term memory
Where it's storedThe model's context windowExternal storage: vector indexes, knowledge graphs, databases
How long it lastsOne request or sessionAcross sessions, until it's updated or deleted
Size limitFixed by the model's context windowLimited only by available storage
How information gets inSent with each requestWritten by the application, then retrieved
Typical failureOlder context drops out or gets overlookedWrong, outdated, or missing records are retrieved

Types of Long-Term Memory in AI

The CoALA framework for language agents takes its memory categories from cognitive science. It pairs a working memory for the current task with three kinds of long-term memory:

  • Episodic memory records specific events: what a user asked yesterday, which tool call failed during the last run, how a support conversation ended.
  • Semantic memory holds facts and relationships that stay true beyond a single event, such as a customer's plan, the owner of a service, or which product versions support a feature.
  • Procedural memory stores how to do things: the instructions, workflows, and routines an agent follows. In coding agents, it often takes the form of instruction files like CLAUDE.md that load at the start of every session.

In practice, the types mix. A support agent answering one question might read a customer's plan (semantic), the history of their last three tickets (episodic), and the escalation procedure (procedural). Episodic records also turn into semantic ones over time: once a user has mentioned the same preference in several conversations, the system can store it once as a fact.

How AI Memory Works

Most AI memory systems run the same cycle, with different design choices at each step:

  1. Write. After an interaction, the system decides what to keep. Some systems save the raw transcript; others extract facts, entities, and summaries first, which makes retrieval more precise and keeps storage smaller.
  2. Store. Records go into one or more stores: a vector index for search by meaning, a knowledge graph for entities and their relationships, and often a relational database for metadata such as timestamps, owners, and permissions.
  3. Retrieve. Before the model answers, the system searches memory with the current request and adds the best matches to the prompt. Ranking decides what the model sees. In the Generative Agents paper, retrieval scored each memory on recency, importance, and relevance to the current situation.
  4. Maintain. When a user changes jobs or a policy is replaced, the old record has to be updated or marked as superseded; otherwise retrieval returns both versions and the model has to guess which one is current. Maintenance also includes forgetting: expiring low-value records, merging duplicates, and honoring deletion requests.

MemGPT described this cycle in operating-system terms: the context window works like main memory, external storage like disk, and the system moves information between the two tiers as a conversation needs it.

How AI Memory Is Implemented

Conversation history and summaries

The simplest form of memory resends recent messages with every request and summarizes older ones when the window fills up. It needs no extra infrastructure, and many chat interfaces handle a single long conversation this way. It doesn't carry anything across sessions, though, and each round of summarization loses detail.

Vector databases

A vector database stores embeddings of past messages or documents and returns the entries closest in meaning to the current query. It's the mechanism behind retrieval-augmented generation, applied to a system's own history. Similarity search finds related text quickly, but it doesn't record how facts relate to each other, so a question that depends on several connected facts can return passages that each look relevant without answering it.

Knowledge graphs

A knowledge graph stores entities as nodes and their relationships as edges, so the system can follow connections: this customer uses this product, which depends on this service, which had an outage on Tuesday. Graphs suit semantic memory and multi-hop questions, and they can attach a timestamp and a source to every fact.

Hybrid graph and vector memory

Hybrid memory systems combine the two. Vector search finds the right starting points by meaning, and graph traversal follows the relationships around them, so retrieval returns both the relevant passages and how they connect. Several dedicated AI memory layers, cognee among them, are built this way.

AI Memory in Real Products

Most major AI assistants now ship some form of memory, each built differently:

  • ChatGPT memory has two parts: saved memories, which are explicit facts it keeps about you, and chat history reference, which lets it use past conversations. Both can be turned off in Settings, and neither is available through the API.
  • Claude Code loads instruction files such as CLAUDE.md plus its own Auto Memory notes at the start of each session. Both are scoped to a single repository.
  • Cursor relies on Rules files injected into the prompt. Its automatically generated Memories feature was removed in version 2.1 in November 2025, so a new Agent chat starts with no record of the previous one.
  • Memory layers and agent frameworks such as cognee, Mem0, Zep, and Letta give developers the same capability inside their own applications. The AI memory tools developers use in production differ mainly in how they store, retrieve, and update memory.

What Makes AI Memory Hard

Deciding what to keep. Saving every message buries the important facts in noise, and saving too little loses context that users expect the system to keep. Most systems handle this with extraction rules or with a model that decides what to store.

Keeping memory current. Facts change, and without timestamps and a way to supersede old records, a memory system can return outdated information as confidently as current information. Temporal knowledge graphs record when each fact was true, so retrieval can prefer the current version.

Scope and privacy. Every memory has an owner: a user, an agent, a workspace, or a whole organization. Records written for one user shouldn't be retrieved for another, which is why memory systems separate organization, agent, and user memory. Users also need a way to see and delete what's stored about them.

Measuring whether it helps. A memory system can retrieve something on every request and still make answers worse. AI memory benchmarks such as LoCoMo and LongMemEval test recall across long conversations, and running the system on tasks from your own workload shows whether memory improves the results you need.

Adding Memory to Your AI Application

The right setup depends on what the system has to remember. Within one long conversation, summarizing older turns is often enough. Remembering a user from one week to the next takes long-term memory: an external store, a step that writes to it after each session, and retrieval before each answer. When answers depend on how facts relate, such as which customers a product change affects, a knowledge graph adds the connections that similarity search alone misses.

cognee is an open-source memory engine that combines graph and vector memory. The cognee SDK adds it to Python agents and apps, cognee Cloud runs the same memory as managed infrastructure, and cognee's plans include a free open-source tier and enterprise options. Writing and retrieving memory takes two calls:

FAQ

Answers to the most common questions from this guide.

Is AI memory the same as RAG?

Not quite. Retrieval-augmented generation searches a corpus that people write and maintain, such as documentation or a knowledge base, and adds the results to the prompt. AI memory uses the same retrieval step but also writes: it records new information from interactions and updates or removes it as things change. Many systems use both, with RAG for reference material and memory for what the system has learned about its users and tasks.

Can you delete what an AI remembers?

In consumer assistants, usually yes. ChatGPT, for example, lists saved memories in Settings, where you can delete them one by one or clear them all. In a custom system, deletion has to reach every place the information went, including vector embeddings, graph nodes, and summaries built from it. cognee's forget operation removes a single document, a whole dataset, or everything a user can delete, along with the graph, vector, and relational data built from it.

Is "AI memory" the same as the memory chips used for AI?

No. In hardware, AI memory usually means high-bandwidth memory (HBM) and other DRAM that feeds data to GPUs and AI accelerators during training and inference. This guide is about AI memory in the software sense: the information an AI system stores and recalls across interactions.

What is the difference between AI memory and agent memory?

AI memory is the general term for any AI system that keeps information between interactions, including chat assistants. Agent memory is the version built for autonomous agents, which also need to track task state, plans, tool results, and what worked in earlier runs, often shared across several agents.

Related reading

AI Agent Memory Architecture: Components, Diagram and Design Choices
ChatGPT Memory: How It Works, What It Can't Do, and How to Build Your Own
Temporal Knowledge Graphs: What They Are and Why AI Memory Needs Them
Get started

Cognee is the fastest way to start building reliable Al agent memory.

Latest
10 Open Source AI Agent Frameworks: Which One Would You Build With?
What Are 500+ Companies Actually Building with AI Memory?
Meet the new cognee: smarter memory, lower costs, and control for your team