Agents
Back

How AI agents remember things between sessions

Memory,

AI models don't remember anything between sessions. Every new chat or coding session starts empty. What people call memory is text that got saved somewhere outside the model and put back into its context later. That's the whole trick.

So every memory feature you've heard of is a version of the same thing. Some text gets written down outside the model. Later it gets loaded back in, either when the session starts or when the model asks for it by calling a tool. Nothing about the model itself changes.

Does Claude remember between sessions?

Not on its own. The Claude Code docs say it pretty directly. "Each Claude Code session begins with a fresh context window." The context window is everything the model can see right now, your messages, the files it read, its own replies. When the session ends, that's gone.

What carries over is whatever got saved to a file and loaded into the next context window. A lot of people think the model learned something about them. It didn't. It's reading notes.

What is CLAUDE.md?

CLAUDE.md is an instruction file. Claude Code loads it at the start of every session. There's one for you at ~/.claude/CLAUDE.md that applies everywhere, and one per project that lives in the repo. You can pull other files into it with @path imports. The docs suggest keeping each one under 200 lines.

It's guidance, so the model can still ignore it. If something really has to be enforced, that goes in settings, which Claude Code actually checks.

How does Claude Code auto memory work?

Auto memory is notes Claude writes for itself. They go in ~/.claude/projects/<project>/memory/. A file called MEMORY.md is the index, and only its first 200 lines or 25KB get loaded when a session starts. The notes come in four types, user, feedback, project and reference.

It stays on your machine and it's per repo. You can turn it off with /memory or the autoMemoryEnabled setting.

What is the Claude API memory tool?

If you're building your own agent on the API, there's a memory tool with the type memory_20250818. It runs on your side. The model only asks for file operations inside /memories, like view, create, str_replace, insert, delete and rename, and your code does them.

So Anthropic isn't storing anything for you. Your app is. That also means your handler has to block path traversal, which is when a path like ../../etc climbs out of the memory folder into the rest of your files.

Do ChatGPT and Claude remember past chats?

ChatGPT has saved memories and can reference your chat history. The Claude apps have memory and past chat search on paid plans. The details change by plan, but underneath it's still saved text put back into the conversation.

Why does AI memory go wrong?

The first problem is stale facts. A note says to call a function that got renamed two weeks ago. The agent doesn't know that, so it follows the note confidently.

The second is that each tool keeps its own memory. Claude Code auto memory lives on one machine in one repo. Cursor has its own. Switch tools and you start from zero.

The third is trust. If an AI writes "the user said they prefer tabs," nobody actually checked that the user said it. Once it's saved, the next session treats it like a fact.

What is an AI memory MCP server?

MCP is the Model Context Protocol. It's a standard way for an AI app to call tools that a separate program provides. A memory MCP server is a program that gives every connected app the same tools for saving and looking up memories, so they can all share one store.

That's why I built Woolly. Every AI tool I used started from zero and had its own separate memory. I use it across my AI tools every day now.

How Woolly handles it

Woolly is local and open source, MIT licensed. Memories live in ~/.woolly and there are no servers, no accounts and no telemetry. Each memory is one Markdown file in ~/.woolly/memories with a few fields at the top, like id, key, source, status and created_at. Every connected app runs its own woolly mcp against those same files, so something saved in Claude shows up in Cursor about a second later.

For facts that change, a memory gets a stable key. A newer fact with the same key marks the old one as superseded and hides it from search. It isn't deleted. The Woolly docs show it with the key user.location. Saving "Moved to Denver" under that key gets this reply.

the example from the Woolly docs
Replaced older memory: Lives in Austin

Every memory records where it came from. The trust order is user, then import, then agent. When an AI says something came from the user, Woolly can't check that, so it saves it as an import tagged user-stated. If an AI fact contradicts something the user saved, it becomes a conflict and the user's version stays current.

Facts about you have no project, and facts about one codebase set one. Recall leaves out other projects' notes. Woolly also refuses to save passwords, API keys, private keys, card numbers and SSNs, and also text that reads like instructions to an AI. Recalled memories come back labeled as notes, so the model treats them as information and not as orders.

For stale facts there's woolly check. It reads CLAUDE.md, AGENTS.md, agent memory, rules, skills and subagents, and flags lines that name code a commit removed.

In Claude Code, woolly connect adds a hook. That's a script Claude Code runs on its own at set points. This one runs woolly context when a session starts, which loads your profile and the current project's memories. Another hook saves a handoff note on compaction, when the session ends, or on /clear, so the next session in any app can pick up where this one stopped.

The model still forgets everything when the session closes. The notes are what change.