What problem it solves
“Memory” in AI chats looks contradictory from the outside: the chat remembers what language you write and what answer format you prefer, yet forty minutes later it forgets an agreement from the start of the same thread or misses a decision made yesterday.
The reason is that the neural network remembers nothing between requests — its weights are frozen after training. All “memory” is text that the client program gathers from several sources and packs into the next request before the model starts answering. Once you tell those four sources apart, chat behavior becomes predictable.
How “memory” gets assembled into one request
On every turn, the app stitches context from several layers and sends it to the model as a single payload:
new question in chat or an agent
- System instructions
system · AGENTS.mdStanding app rules, project instructions, and the repository entry file (Instructions for an AI agent). - Facts notepad
Saved Memories · MEMORY.mdA short list of text notes about the user or project. Injected in full at the start of every new chat. - History search
RAG over past chatsWhen past-chat reference is enabled, the app searches your conversation archive for similar passages and appends a few matches. - Current conversation
messagesAll messages and replies in this thread. Near the window limit, older turns get compressed into a summary (Long conversations). - Model
single stateless passThe model sees the stitched text as one input and writes the continuation. Right after replying, it retains nothing until the next request.
model reply
Four types of memory
Context window
messagesThe entire current conversation, attached files, and tool outputs. Accurate while history stays short; over dozens of turns attention blurs, and once full, older turns get replaced by a compressed summary.
Facts notepad
Saved Memories · MEMORY.mdA compact list of short lines (“writes TypeScript”, “short answers without intros”) stored separately and prepended to the system context of every new chat. Size is capped — usually around 1,000–1,500 words.
Past-chat search
RAG over historyYour archive of older threads sits in an external database and never enters every request in full. When a question touches past discussions, search pulls in a few matching snippets (Your own data in a model).
Project files
Projects · AGENTS.mdInstructions and documents you put there yourself: files in Claude Projects, an AGENTS.md entry file, and
repository rules. Background algorithms don’t rewrite them, and chat compaction doesn’t drop them.
Why a model remembers one thing and forgets another
| Memory type | Who writes it | When it enters the request | Where it breaks |
|---|---|---|---|
Project files (Projects, AGENTS.md) |
a human | every chat in the project, in full or by rule | goes stale if you forget to update it after changes |
Context window (messages) |
the current thread | every turn until the chat ends | gets summarized away in long conversations |
Facts notepad (Saved Memories, MEMORY.md) |
the app automatically or on request | in full in every new chat | fills up with one-off details that pollute new tasks |
| Past-chat search | index of old threads | only when search finds a match | misses the right chat when you phrase the question differently |
Every common paradox follows from that table:
- Remembers your stack and tone, yet forgot an agreement from this chat. The stack lives in the notepad at the top of the system prompt, while the agreement sat at the start of a long thread and vanished during history compaction.
- Doesn’t remember yesterday’s decision. It never made it into the notepad, and history search didn’t match today’s wording against yesterday’s thread.
- Keeps pushing an old tool. A six-month-old note is still sitting in the notepad, so the app keeps injecting it into every new chat.
What goes into which layer
| If the model needs to remember… | Put it in |
|---|---|
| general preferences — language, answer format, explanation style | the memory notepad or global account settings |
| rules, stack, and constraints of a specific project | project files (Projects) or AGENTS.md in the repository (Instructions for an AI agent) |
| the outcome of a long session to pick up tomorrow | a decision summary carried into a new chat (Long conversations) |
| dozens of documents, notes, or a ticket archive | RAG or agent file search (Your own data in a model) |
| a one-off task free from prior context | a new chat (New task, new chat) or temporary mode without memory |
Where built-in memory gets in the way
Automatic memory in web chats and agent auto memory record facts in the background. Alongside useful habits, they pick up temporary details: debugging someone else’s repo once, an old server, or a discarded architecture draft. A month later that line still lands in the system prompt and quietly skews answers on unrelated work.
What you get and what it costs
What you get
- Less repetition day to day. No need to restate your language, role, and preferred answer format in every chat.
- Fast context carryover in agents. Auto memory (
MEMORY.md) keeps environment quirks across sessions without manual config edits. - Project isolation. Project files and
AGENTS.mdkeep each project’s rules separate instead of mixing them together.
What it costs
- Silent context clutter. Stale notepad entries keep steering replies until you open the list and remove them by hand.
- Unpredictable history search. You can’t count on the chat finding yesterday’s detail — and you can’t always see which old excerpt it pulled in.
- Cross-project bleed. Account-wide memory leaks facts from one task into another unless projects live in separate spaces.
Where to start
- Open saved memories in your chat settings (or
MEMORY.mdin your agent) and delete one-off and outdated notes — keep only stable preferences. - Move anything tied to a specific work project out of global account memory into project files or a git-tracked
AGENTS.md(Instructions for an AI agent). - Don’t count on past-chat search for important decisions: at the end of a long session, write a brief summary and pass it along explicitly (Long conversations).
- Review finished work in a clean chat with memory off so the model doesn’t play along with earlier reasoning (Review in a new chat).
If it doesn’t work
The model keeps recommending an old library or framework you never mentioned in this chat
- Cause
- A note from a past project remained in chat memory (
Saved Memories) or agent auto memory (MEMORY.md), and the app injects it into every new request. - Fix
- Open your saved memory list or
MEMORY.mdand delete the outdated entry.
The chat doesn’t remember a decision from yesterday’s thread even though chat history search is on
- Cause
- Past-chat search works like RAG: if today’s wording doesn’t match the words in the old thread, the relevant excerpt isn’t pulled into context.
- Fix
- Don’t rely on automatic search for key decisions — save a short summary in project files or paste it at the start of the new chat.
Halfway through a long conversation, the model forgot a rule from the first message
- Cause
- The context window filled up and the app compacted earlier history into a summary, dropping the detail from the first message.
- Fix
- Move standing rules into project instructions or
AGENTS.md, and carry a long task over to a fresh chat with a summary (Long conversations).
In a new project, the model mixes in details from another project
- Cause
- Account-wide memory is injected into every chat with no separation by project.
- Fix
- Remove project-specific details from global memory and separate work into distinct Projects or repositories with their own
AGENTS.md.
In your own API script, the model doesn’t remember the previous message
- Cause
- Standard APIs are stateless between calls: each HTTP request is processed on its own.
- Fix
- Store the conversation history on your side and send it in the
messagesarray with every new request (A model request, block by block).