Memory

Claude Code Memory: CLAUDE.md, Auto Memory and Notes

Valta · · 7 min read

Claude Code doesn’t remember past sessions on its own. What it does is read memory files when a session starts. Those are your CLAUDE.md files (one for you, one per project, one per subfolder) and the notes its auto memory saved for that project. Anything written there is loaded into the new session; anything that only lived in an old chat is gone unless you resume that chat. So “Claude Code memory” is a question of what you write down, and where.

This guide walks through the setup in five steps, from the first CLAUDE.md to a handoff habit. The last section covers how to share that context with Claude, ChatGPT and Cursor.

Does Claude Code remember previous conversations?

Not by default. Each new claude session starts with an empty conversation. Two things do carry over:

  • Files it reads at startup. Your CLAUDE.md files and the auto memory index are loaded into context before you type anything.
  • The session itself, if you go back to it. claude --continue reopens the most recent conversation in that folder, and claude --resume lets you pick an older one from a list.

Resuming brings back the whole transcript, which is useful for finishing yesterday’s task and wasteful for starting a new one. Memory files are the better tool for anything you want in every session.

Where does Claude Code store memory?

Claude Code reads memory from several places, from the broadest to the most specific. The Claude Code memory docs list the full set; these are the ones most people use:

Memory Location Shared with Best for
User memory ~/.claude/CLAUDE.md Only you, in every project Personal style, preferred tools, how you like answers
Project memory ./CLAUDE.md or ./.claude/CLAUDE.md Everyone who clones the repo Stack, commands, conventions, “never do X”
Subfolder memory CLAUDE.md inside a subfolder Everyone, when Claude works in that folder Rules for one area, like api/ or web/
Auto memory ~/.claude/projects/<project>/memory/ Only you, in that project Facts Claude saves as it works
Notes over MCP An external notes server Any AI connected to it Decisions and context that span tools

The project file is the one that matters most, because the whole team gets it through git.

Step 1: Create a project CLAUDE.md

Run /init inside your repo. Claude Code reads the codebase and writes a starting CLAUDE.md with the build commands, the layout and the conventions it can spot. Then edit it by hand, because the first draft is a guess.

A good project file is short and specific:

# Project notes for Claude
- Rails 8, Postgres, Hotwire. No React.
- Run bin/rspec before saying a task is done.
- Money is stored in cents; format only in views.
- Never edit db/schema.rb by hand; write a migration.
- Deploys happen on push to main. Don't push unless asked.

Every line is loaded into every session in that repo, so each one costs room in the context window (AI context window explained covers why that matters). Keep what you correct often. Cut what Claude would do right anyway.

Step 2: Add your user memory

Open ~/.claude/CLAUDE.md for the preferences that follow you into every project: the language you answer in, how terse you want replies, the package manager you always use, the commit message style. Keep project facts out of it. A rule like “use pnpm” in the user file will confuse a repo that uses npm.

To edit either file without hunting for it, type /memory in a session. It lists the memory files Claude Code loaded and opens the one you pick in your editor.

Step 3: Split big files with imports

When a CLAUDE.md grows past a screen or two, move sections into their own files and import them with @:

See @README.md for the overview.
Testing rules: @docs/testing.md
Release steps: @docs/release.md

Imported files are loaded along with the CLAUDE.md that names them, so this is about keeping files readable, not about saving context. For rules that only matter in one folder, a CLAUDE.md inside that folder is the better fit: Claude reads it when it works there.

Step 4: Let auto memory save what it learns

Recent versions of Claude Code also keep an auto memory, described in the same memory docs: a folder per project under ~/.claude/projects/ with one Markdown file per fact and a MEMORY.md index that is loaded at the start of each session. You can see it for yourself: after a few sessions, open that folder and read what Claude wrote. When you correct Claude, or tell it something about your setup that it will need again, it can write that down as a memory file.

Two habits keep it useful:

  • Read it now and then. Auto memory is plain Markdown on your disk. Delete facts that went stale, because a wrong memory is worse than none.
  • Say it when it matters. “Remember that staging uses port 5433” is clearer than hoping Claude decides to keep it.

Auto memory is local and per project. It doesn’t go into git, and your teammates don’t see it.

Step 5: Write a handoff note at the end of each session

CLAUDE.md holds what stays true. The part that changes daily (what you tried, what broke, what’s next) needs its own place. Before you close a session, ask Claude to write a short note:

## 2026-11-03: invoice export
Done: CSV export behind a flag, specs green.
Tried: streaming the response; broke on Safari, reverted.
Next: date filter, then remove the flag.
Decisions: amounts stay in cents until the view.

Open the next session with “read the latest handoff note for invoice export.” If the notes hold client details or research that don’t belong in git, keep them outside the repo. The same habit works in Cursor; see Cursor rules and memory between sessions.

What you have at the end

After these steps, a fresh claude session starts with your preferences, the project’s rules, the facts Claude saved last week and a pointer to where you left off. You stop re-explaining the stack, and decisions stop getting argued twice.

Can Claude Code share memory with Claude and ChatGPT?

CLAUDE.md and auto memory only exist inside Claude Code. If you plan in claude.ai, research in ChatGPT and build in Claude Code, each one starts blank about the others.

The bridge is MCP. Claude Code connects to MCP servers with claude mcp add, and so do Claude, ChatGPT and Cursor through their own settings. Connect them all to one notes server and a decision saved in one tool can be searched from the rest. The longer version is in how to give Claude long-term memory and how to share memory between Claude and ChatGPT.

Keep the split clean: code rules stay in the repo next to the code, and product decisions, client context and research go in the shared notes.

FAQ

What is CLAUDE.md?

A Markdown file Claude Code reads at the start of every session in that folder. It holds instructions and facts: commands, conventions, things to avoid. You write it; /init can draft the first version.

Should CLAUDE.md be committed to git?

The project file, yes: it’s how the whole team gets the same rules. Personal preferences belong in ~/.claude/CLAUDE.md, which never touches the repo.

Does Claude Code memory count against the context window?

Yes. Every loaded memory file takes tokens before your first message. Short files and folder-level CLAUDE.md files keep that cost down.

How do I make Claude Code forget something?

Delete the line from the CLAUDE.md file, or delete the file in the auto memory folder. Use /memory to see which files are loaded.

Is /compact the same as memory?

No. /compact summarizes the current conversation to free up context inside one session. Nothing from it is written to a memory file, so it doesn’t help the next session.

Where Valta fits

Valta is a hosted vault of Markdown notes with an MCP server. Add it to Claude Code with one claude mcp add line, connect the same vault to Claude, ChatGPT and Cursor, and every one of them can save, search and read your notes. No AI runs on Valta’s side: Claude Code writes the handoff note, Valta keeps it and suggests related notes to link. Repo rules stay in CLAUDE.md; Valta holds the context that crosses tools. Setup steps are in connecting Valta to Claude, ChatGPT and Cursor.

The Free plan includes one vault and up to 100 notes, enough to try the handoff habit for a few weeks. Create a free account.

One vault for every AI you use.

Start free

More in Memory

Free · Pro from $9/mo See pricing

Contact support

We reply by email, usually within one business day.