How Claude Code Really Remembers Your Work

Understanding the difference between saved sessions, persistent memory, and active context in Claude Code, and why deleting old chats doesn’t erase what Claude knows.

4 min read

How Claude Code Really Remembers Your Work cover

I once deleted over a hundred old Claude Code sessions, freeing up hundreds of megabytes. A few days later, a brand-new chat referenced a bug ID from one of those deleted conversations. That moment made me question how Claude actually remembers things. The answer turned out to be simpler than I expected, but it required rethinking how sessions, memory, and context work together.

Saved sessions are just files on disk

Every conversation in Claude Code gets stored as a JSON Lines file, with each line representing a message, response, or tool call. These files live in a project directory, organized by UUID. When you have 111 saved sessions, you’re looking at 111 of these files, plus any associated data like attachments or tool artifacts.

These files exist so you can resume old conversations later. The /resume command lists them, and selecting one reconstructs the chat from the saved transcript. But here’s the key detail: starting a new session doesn’t automatically load all those old files. They’re more like folders in a filing cabinet, available if you need them, but not dumped onto your desk by default.

Memory and context are not the same as sessions

When I deleted those 111 sessions, I removed the transcripts but not the distilled knowledge Claude had extracted from them. That knowledge lives in memory files like MEMORY.md, which store key facts, decisions, and preferences from past work. A 40,000-word conversation about a production outage might be compressed into a single line: "Authentication failure caused by missing database migration."

This explains why a new session could still reference DEF-2210. The bug ID wasn’t pulled from an old transcript, it was already saved in memory. Deleting transcripts and deleting memory are two separate operations. I chose to keep the memory, which is why the knowledge persisted.

Project files and hooks add more persistent knowledge

Memory files aren’t the only source of persistent knowledge. Claude Code also reads project files like CLAUDE.md, which act like an instruction manual for the AI. These files can define rules, preferences, or context that apply to every session, regardless of whether old transcripts exist. Deleting all past conversations won’t remove these instructions, they’re part of the project setup.

Hooks add another layer. A SessionStart hook runs automatically when a new session begins, injecting additional context or instructions. This means even a fresh conversation can start with a preloaded set of facts or guidelines, all without referencing old transcripts.

What actually gets loaded in a new session

The active context is the information Claude uses to generate responses in the moment. It’s a bundle of the current conversation, memory files, project instructions, and any data injected by hooks. This context is rebuilt every time you start a new session, but it doesn’t include old transcripts unless you explicitly resume them.

  • Old session transcripts remain on disk but aren’t loaded by default.

  • Memory files store distilled knowledge from past work.

  • Project files like CLAUDE.md provide persistent instructions.

  • Hooks can inject additional context at session start.

  • The active context combines all these elements for the current conversation.

How to manage session history without losing knowledge

My cleanup deleted the old transcripts but preserved the memory directory. This was intentional, I wanted to free up space without erasing the project’s knowledge. A careless deletion could have removed both, which is why it’s important to understand what each operation affects.

To prevent future buildup, I set a retention policy that automatically prunes sessions older than seven days. This keeps the /resume list manageable without touching memory files or project instructions. The policy only affects saved transcripts, not the persistent knowledge that makes Claude useful across sessions.

The three-layer model to remember

The simplest way to think about Claude Code’s memory system is in three layers. The bottom layer is saved session transcripts, the files you can resume later. The middle layer is persistent knowledge, including memory files, project instructions, and hooks. The top layer is the active context, which is rebuilt for each new session based on the middle layer.

When you delete old sessions, you’re only cleaning up the bottom layer. The middle layer remains intact, which is why Claude can still reference past work in new conversations. Understanding this distinction helps you manage your project’s history without accidentally losing what makes the AI effective.

Next time you see Claude reference something from an old conversation, remember: it’s not reading your deleted transcripts. It’s pulling from the persistent knowledge you chose to keep.

Building something with AI? Let's talk.

I design and ship production AI and full-stack products for US teams. See how I can help.

View all services

Join the newsletter

Be the first to read our articles.