Tell ChatGPT on Friday that you are vegetarian, then ask for a dinner idea on Monday. It may skip the steak without being reminded. Yet the model behind it did not keep anything from Friday. Software around the model saved the fact, found it again on Monday and slipped it into the new prompt.
That is how AI agents remember previous conversations. A language model is stateless, so it forgets everything once a reply ends. Memory lives outside it, in chat logs, summaries and long-term stores. Before each reply, the agent loads the useful parts back into the context window. Then the model reads them as if it had known them all along.
The Context Window Is the Only Thing the Model Reads
The context window is the text a model sees in one call. It holds the system prompt, any loaded memories, the chat so far and the new message. Nothing else reaches the model.
So a chat app resends the whole conversation on every turn. Your tenth message travels with the nine before it and every reply. That is why a long chat feels coherent. It is also why it gets slower and more costly as it grows.
Windows have limits, measured in tokens. Even big windows bring trouble, though. A full message history may not fit, and models do worse on very long inputs. As a result, agents trim old turns, compress them into summaries or move facts into a separate store. Deciding what earns a place in that window is its own craft, called context engineering.
What an AI Agent Remembers, and Where It Lives
Memory sits in layers. Each one has its own lifetime and its own writer. Read the table from top to bottom, like a stack. The top layer is closest to the model, and the bottom layer lasts the longest.
| Layer | What it holds | How long it lasts | Who writes it | Real example |
|---|---|---|---|---|
| Context window | Prompt, loaded memories, recent turns | One model call | The app, on every turn | Any chat reply |
| Session or thread | Every message and tool call in one chat | The life of that chat | The app, after each turn | OpenAI Agents SDK sessions, LangGraph threads |
| Summary | A short version of older turns | The life of that chat | The model, when a trigger fires | OpenAI Responses compaction |
| Long-term memory | Facts, past events and rules about the user | Until edited or deleted | The model during a chat, or a background job | ChatGPT saved memories, Claude memory topics, LangGraph store |
| Past-chat search | Old transcripts, searched when needed | As long as the chats are kept | A retrieval tool | Claude chat search, ChatGPT chat history reference, Gemini past chats |
The first three layers handle the current conversation. The last two handle previous conversations. So when people ask how an agent recalls last week, the answer is almost always the bottom two rows.
Semantic, Episodic and Procedural Memory in Plain Terms
Long-term memory comes in three kinds. The names come from human psychology, and agent frameworks such as LangGraph use them the same way.
Semantic memory holds facts. The user is vegetarian. The account is on the Pro plan. The user lives in Denver. This is what most people mean by AI memory.
Episodic memory holds past events. Last Tuesday, the agent rebooked a flight and the user liked the result. Agents often reuse these episodes as examples in the prompt, so the next similar task goes the same way.
Procedural memory holds rules for doing work. In practice, it is often the system prompt itself. An agent can rewrite its own instructions after feedback, such as always confirm the time zone before booking a call.
Semantic memory can take two shapes. A profile is one document per user that the agent keeps patching. It is easy to read, but each update must rewrite the whole thing. A collection is many small memory entries. Each one is easier to write and search, though the list gets harder to tidy over time.
Timing matters too. Some agents save memories in the hot path, during the chat, before they reply. ChatGPT works this way when it shows Memory updated. Others save in the background after the chat, which keeps replies fast but delays the update.

Read also: Best AI Agents for Document Processing: 5 Tools With Real Prices
How Retrieval Picks Which Memories Come Back
An agent with thousands of stored memories cannot load them all. So it picks a few.
Most systems use embedding search. The agent turns the new message into a vector and finds stored memories with close meaning. Then filters narrow the list to this user, and sometimes to a memory type or a date range. Finally, the top handful goes into the prompt. Our guide to vector databases for AI agent memory covers the stores that run this search.
Retrieval is a choice, too. ChatGPT searches for past context only when it is likely to improve an answer. Claude runs chat search as a visible tool call inside the current chat. In both cases, a weak match means the memory stays out.
This explains a common complaint. Users say the assistant forgot something they told it. Often the memory exists, but the search did not rank it high enough for that question.
What ChatGPT, Claude and Gemini Remember Between Chats
The three big assistants all mix saved facts with search over old chats. They differ in the details.
ChatGPT Saved Memories and Chat History
ChatGPT has two parts. Saved memories hold facts you told it to keep, plus details it chose to store. Reference chat history lets it draw on relevant past conversations. On top sits a memory summary, a short overview of the context it may draw on.
Saved memories live apart from chat history. So deleting a chat does not delete a memory made from it. Also, chat history has no separate storage limit. When personal context shapes a reply, a Sources panel may appear with it. A temporary chat leaves memory untouched.
Claude Memory Topics and Chat Search
Claude saves memory as separate topics during a chat, and you can also ask it to remember something. Memory is on by default for Free, Pro, Max and Ultra plans. Chat search is a second feature on paid plans. It uses retrieval-augmented generation to search past chats, and each search shows up as a tool call.
Projects are walled off in part. Each project has its own memory, plus your account memory from chats outside projects. However, it never reads another project’s memory. Incognito chats are not saved to history or memory, and chat search skips them.
Gemini Saved Info and Past Chats
Gemini keeps Saved info, which holds facts you asked it to remember, and memory of past chats. Past-chat memory needs a personal Google Account, an age of 18 or older and Keep activity turned on. It works in the Gemini app, on the web, in Gemini in Chrome and on smartwatches. It does not work in Gems or Live chats.

For other assistants that keep personal context, browse our AI personal assistant agents.
How Developers Give Agents Conversation Memory
Builders wire up the same layers by hand. Three patterns cover most agents. Full setup code for each one is in how AI agents keep state across sessions.
How Agents SDK Sessions Carry a Chat Forward
A session stores one conversation under an ID. Before each run, the runner loads the stored items and puts them ahead of the new input. After the run, it saves every new item, including tool calls. The next run with the same ID sees the full history.
The SDK ships many session types. SQLiteSession is the default, and Redis, SQLAlchemy, MongoDB and Dapr versions run in production. OpenAIConversationsSession keeps history on OpenAI servers. SessionSettings(limit=N) loads only the last N items. For long chats, OpenAIResponsesCompactionSession wraps a session and compacts history after a turn when a trigger fires. Tools, handoffs and guardrails are on our OpenAI Agents SDK profile.
LangGraph Checkpointers and Stores
LangGraph splits memory in two. Short-term memory is the graph state for one thread, saved by a checkpointer after each step. You pass a thread_id, and the agent picks up where that thread left off.
Long-term memory goes in a store. It holds JSON documents under a namespace, such as a user ID plus memories. Any thread can read it, so facts from Monday’s thread reach Friday’s. See our LangGraph profile for more.
Letta and the MemGPT Idea
Letta grew out of MemGPT, a 2023 research paper from UC Berkeley. The paper treated the context window like computer RAM and outside storage like a disk. The agent moved data between the two tiers itself, so it could hold long, multi-session chats.
Letta keeps that idea. Memory blocks stay pinned in the prompt, and the agent can edit them with tools. All state, from messages to tool calls, persists in a database. In its newer setup, memory lives in MemFS, a git-backed file system the agent can read and edit. A dreaming feature runs background subagents that review recent chats and fold lessons into memory. Cloud memory caps at 5 MiB per repository on the Free plan and 50 MiB on Pro.

One User, Three Chats, Every Layer
A worked trace makes the layers easier to see. Picture a travel agent built on LangGraph with a long-term store.
Chat one, Monday. The user tells the agent she flies from Denver, eats vegetarian and wants trips under $1,500. Each turn goes into the thread, and the checkpointer saves it. At the end, a background job pulls out three facts and writes them to the store under her user ID. The thread then closes.
Chat two, Wednesday. She opens a new thread and asks for a weekend in Austin. The new thread is empty, so short-term memory has nothing. But the agent searches the store with her question. Denver and the budget come back, so the agent prices flights from DEN under $1,500. The vegetarian fact ranks lower, and it stays out of this prompt.
Chat three, next month. She asks for restaurant ideas in Austin. This time, the search ranks the vegetarian fact first, and the list skips steakhouses. Meanwhile, the Wednesday thread has grown long, so a summary replaces its oldest turns if she reopens it.
Notice what never happened. The model never learned her diet. The store held it, and retrieval decided when it mattered.
Privacy and Deletion Basics for Remembered Chats
Memory sits in more than one place, so a single delete rarely clears everything. In ChatGPT and in Claude’s current memory, a saved memory outlives the chat it came from. Gemini can take a short time to stop using a deleted chat.
Retention runs on its own clock. OpenAI may keep logs of deleted saved memories for up to 30 days for safety and debugging. When you turn off chat history reference, what ChatGPT drew from past chats is set for deletion within 30 days. On Claude Team and Enterprise, incognito chats follow the org’s retention policy, with a 30-day minimum.
Some data never enters memory. Claude leaves out health, politics, religion and similar topics unless you opt in. It never saves government ID numbers, criminal history, financial account numbers or immigration status. ChatGPT for Healthcare turns improved memory off by default.
For developers, the same rules apply in code. Tag every memory with a user ID, add an expiry where facts go stale, and give users a real delete path. The exact settings and API calls are in our walkthrough on how to update and delete AI agent memories.
Short Answers on AI Conversation Memory
Does the AI Model Itself Learn From My Chats?
Not during the chat. Memory features store text outside the model and paste it back in. Separately, personal ChatGPT chats may help train future models if Improve the model for everyone is on.
Why Does an Agent Forget Something It Knew Yesterday?
Usually because retrieval missed it. The memory may exist, but the search ranked other memories higher. A new thread also starts with empty short-term memory.
Is a Bigger Context Window the Same as Memory?
No. A bigger window holds more of one conversation. It still empties when the chat ends, so memory across chats needs a store outside the model.
Can a Team of Agents Read the Same Memories?
Yes, if both read the same store. LangGraph stores work across threads, and Letta memory blocks can attach to more than one agent.
Related AI Agents
Read also: Best AI Agents for Gastroenterology Clinics: 5 HIPAA-Ready Picks
Explore Agent Categories
Related Articles
GuidesSynthesia AI Video Usage Among Corporate Training Teams
GuidesBest CAMEL AI Alternatives and What They Cost
Guides100 AI Agent Statistics for Retail Companies
GuidesLLM or AI Agent? AI Search Engines and What They Actually Are
GuidesCan You Trust an AI Agent?
GuidesAre AI Agents the Future of IT Jobs?





