Where Is Claude Code Memory Stored? (CLAUDE.md Explained)

Claude Code has two kinds of memory: CLAUDE.md files that you write, and auto memory that Claude writes for itself. CLAUDE.md lives in your project root or in ~/.claude/CLAUDE.md, while auto memory is stored in ~/.claude/projects/<project>/memory/.

Both are plain Markdown files on your computer, and both are loaded at the start of every session. That’s how Claude “remembers” your project between conversations.

This article explains where each memory file is stored, what goes in it, and how to view, edit, or turn it off.

CLAUDE.md vs auto memory

Here’s the difference at a glance:

CLAUDE.mdAuto memory
Who writes itYouClaude
What it holdsInstructions and rulesThings Claude learned about you and the project
Where it livesProject root or ~/.claude/~/.claude/projects/<project>/memory/
Shared with teamYes, if you commit itNo, it stays on your machine

Where CLAUDE.md files are stored

Claude Code reads CLAUDE.md from several places:

TypeLocationApplies to
Project./CLAUDE.md or ./.claude/CLAUDE.mdEveryone on the project (commit it)
Local./CLAUDE.local.mdOnly you, in this project (add it to .gitignore)
User~/.claude/CLAUDE.mdOnly you, in every project
ManagedA system folder set by your organizationEveryone in the organization

The managed CLAUDE.md is stored in these system folders:

  • macOS: /Library/Application Support/ClaudeCode/CLAUDE.md
  • Linux and WSL: /etc/claude-code/CLAUDE.md
  • Windows: C:\Program Files\ClaudeCode\CLAUDE.md

Claude Code doesn’t pick just one of these files. It loads all of them and combines them.

It also walks up the folder tree. If you run Claude Code in foo/bar/, it loads both foo/bar/CLAUDE.md and foo/CLAUDE.md. A CLAUDE.md inside a subfolder is loaded later, when Claude starts working with files in that subfolder.

How to create a CLAUDE.md file

The quickest way is to run /init inside Claude Code. It looks at your project and writes a starter CLAUDE.md with your build commands and conventions.

You can also write one by hand. Keep it short and specific:

# My App

- Run tests with `npm test`
- Use TypeScript strict mode for all new files
- API routes live in `src/api/`, one file per resource

The official recommendation is to keep each CLAUDE.md under 200 lines. Longer files use more context and Claude follows them less reliably.

A CLAUDE.md file can also pull in other files with @path imports:

See @README.md for the project overview.

Where auto memory is stored

Auto memory is saved in a memory folder inside the project’s folder under ~/.claude/projects/:

~/.claude/projects/<project>/memory/
├── MEMORY.md
├── user_role.md
├── feedback_testing.md
└── ...

The <project> folder name is your project path with every character that isn’t a letter or digit replaced by a dash. For example, /Users/nathan/projects/my-app becomes -Users-nathan-projects-my-app.

All worktrees and subfolders of the same git repository share one memory folder.

Inside it:

  • MEMORY.md is an index with one line per memory. It’s loaded at the start of every session
  • Every other .md file is a single memory, such as your role or a correction you gave Claude. Claude reads these only when it needs them

Only the first 200 lines or 25KB of MEMORY.md are loaded, whichever comes first.

Claude saves four types of memories: facts about you, feedback you’ve given, ongoing project work, and references to outside resources like a dashboard or issue tracker. It doesn’t save things it can figure out from your code.

How to view and edit memory

Run /memory inside Claude Code. It lets you open your memory files in your editor and toggle auto memory on or off.

Since the files are plain Markdown, you can also open them directly:

ls ~/.claude/projects/-Users-nathan-projects-my-app/memory/

If Claude remembered something wrong, edit or delete that file. You can also just tell Claude, “forget that I use Yarn”, and it will update the memory itself.

How to turn off auto memory

Open /memory and switch the auto memory toggle off. This saves autoMemoryEnabled: false to your ~/.claude/settings.json.

To turn it off for a single project, put the same setting in that project’s .claude/settings.json:

{
  "autoMemoryEnabled": false
}

You can also disable it with the environment variable CLAUDE_CODE_DISABLE_AUTO_MEMORY=1.

Is Claude Code memory shared across machines?

No. Auto memory is stored only on the machine where it was written. It doesn’t sync to your other computers or to cloud sessions.

If you want something remembered everywhere, write it in a CLAUDE.md file and commit it to your repository.

Does memory get deleted?

Claude Code automatically deletes session transcripts after 30 days, but it does not delete your auto memory files. They stay until you or Claude removes them.

You can find more about the transcripts in where Claude Code sessions are stored.

Conclusion

Your instructions for Claude go in CLAUDE.md, either in the project root or in ~/.claude/CLAUDE.md for all projects. The notes Claude writes for itself go in ~/.claude/projects/<project>/memory/, indexed by MEMORY.md.

Use /memory to see and edit both.