# Does Claude Code remember between sessions? How memory works

> Does Claude Code remember between sessions? Only through CLAUDE.md files and auto memory. A past chat comes back only when you resume it.

Source: https://shuriken.sh/guides/claude-code-memory-between-sessions

Does Claude Code remember between sessions? Only through CLAUDE.md files and auto memory. A past chat comes back only when you resume it.

By Shuriken Updated 27 October 2026 6 min read

**Contents**

Only what you or Claude wrote down. Every Claude Code session starts with a fresh context window, and two things carry over into it: the CLAUDE.md files you write, and auto memory, the notes Claude keeps in ~/.claude/projects/<project>/memory/. Your past conversations stay on disk, but a new session sees one only if you resume it.

Most "Claude forgot" moments come from expecting more than that. Everything below is from Anthropic's Claude Code docs as we read them on 22 October 2026.

## What Claude Code remembers between sessions #

From [Anthropic's memory page](https://code.claude.com/docs/en/memory): "Each Claude Code session begins with a fresh context window. Two mechanisms carry knowledge across sessions."

| What | Who writes it | Loaded | Where it lives |
| --- | --- | --- | --- |
| CLAUDE.md files | You | Every session, in full | Your home folder, the project, or your organisation's managed location |
| Auto memory | Claude | Every session: the first 200 lines or 25KB of MEMORY.md | ~/.claude/projects/<project>/memory/ on this computer |
| Past conversations | Claude Code, as you work | Only when you resume one | Saved locally; old ones are deleted after [cleanupPeriodDays](https://shuriken.sh/guides/claude-code-history-deleted-after-30-days) (30 days by default) |

Nothing else carries over by default. Say you told Claude yesterday to run pnpm test instead of npm test: a new session doesn't know that unless the line reached a CLAUDE.md or MEMORY.md. The same goes for a decision you made together, or a file Claude read.

claude --continue reopens the most recent conversation in this folder with its full history, and claude --resume lets you choose one from a list ([resuming a Claude Code session](https://shuriken.sh/guides/resume-claude-code-session) has both). That isn't memory. It is the same conversation, opened again.

## CLAUDE.md: the memory you write #

CLAUDE.md files are plain Markdown that Claude reads at the start of every session. They can live in four places, loaded from the broadest to the most specific:

| Scope | Location | Shared with |
| --- | --- | --- |
| Managed policy | /Library/Application Support/ClaudeCode/CLAUDE.md (macOS), /etc/claude-code/CLAUDE.md (Linux and WSL), C:\Program Files\ClaudeCode\CLAUDE.md (Windows) | Everyone on the machine |
| User | ~/.claude/CLAUDE.md | Only you, every project |
| Project | ./CLAUDE.md or ./.claude/CLAUDE.md | Your team, through git |
| Local | ./CLAUDE.local.md (add it to .gitignore ) | Only you, this project |

Four rules in the docs explain most surprises:

- Files add up; they don't override. Claude Code loads the CLAUDE.md in your working folder and in every folder above it, and concatenates them. The one closest to where you started is read last.
- A CLAUDE.md in a subfolder loads only once Claude reads or edits a file in that folder.
- Since v2.1.277, Claude Code reads a repository's AGENTS.md when there is no CLAUDE.md or CLAUDE.local.md in your folder or above it. With both present, it reads only the CLAUDE.md files unless you change the Project instructions setting in /config.
- CLAUDE.md is context, not a rule engine. It is delivered as a message after the system prompt, and Anthropic says "there's no guarantee of strict compliance". For something that must happen every time, use a hook.

## Auto memory: the notes Claude keeps #

Auto memory is on by default in local sessions. As Claude works, it saves four kinds of notes: who you are and how you like to work (user), corrections you gave it (feedback), ongoing work and decisions it can't read from the code (project), and where to find things outside the repo (reference). It skips anything it can work out from the code, and anything your CLAUDE.md already says.

The notes live in ~/.claude/projects/<project>/memory/: one MEMORY.md index, one line per memory, plus a topic file per memory. Only the start of MEMORY.md loads at startup; Claude opens the topic files when it needs them. "Saved 2 memories" or "Recalled 2 memories" in the session means that folder is being written or read.

Every worktree and subfolder of one git repository shares a single memory folder. The folder doesn't leave the computer either: "Auto memory is machine-local," so your laptop and your server each keep their own. Subagents don't get the main conversation's auto memory, except a fork.

To turn it off, use the toggle in /memory, set "autoMemoryEnabled": false in a project's settings, or set CLAUDE_CODE_DISABLE_AUTO_MEMORY=1.

## How to add to Claude Code's memory #

- For a note about you, say it in plain words: "remember that the API tests need a local Redis". Claude saves it to auto memory.
- For a rule the whole team should follow, say "add this to CLAUDE.md", or open the file yourself with /memory.
- In a project without a CLAUDE.md, run /init. Claude reads the codebase and writes a starter file with build commands, test instructions and conventions. If one exists, it suggests improvements instead.
- For private notes on one project, create CLAUDE.local.md at the project root and add it to .gitignore.
- To check what loaded, run /context and look under Memory files.

The current docs describe asking in plain words. They don't mention the old # shortcut, so don't rely on it.

Anthropic's docs name four moments to write something down:

- Claude makes the same mistake a second time.
- A review catches something Claude should have known.
- You type the same correction you typed last session.
- A new teammate would need the same context.

Shuriken runs your coding agents on your own computers and keeps them going when an account hits its limit.

[Download](https://shuriken.sh/download)

## How to keep it short #

CLAUDE.md and the first lines of MEMORY.md ride along on every request, which is why they appear in [why Claude Code uses so many tokens](https://shuriken.sh/guides/why-claude-code-burns-tokens). Short files are followed better. What belongs in the file at all is the subject of [CLAUDE.md best practices](https://shuriken.sh/guides/claude-md-best-practices).

- Aim for under 200 lines per CLAUDE.md. Anthropic's words: "Longer files consume more context and reduce adherence." Claude Code warns at startup when a file is over the recommended length.
- Ask of every line: "Would removing this cause Claude to make mistakes?" If not, cut it.
- @path/to/file imports organise a file but pull the other file in at launch, so the import costs the same.
- Put what only matters in one part of the repo in .claude/rules/ with a paths: list. It loads only when Claude touches a matching file.
- Move procedures such as a release checklist or a review routine into skills, which load only when used.
- Block-level HTML comments (<!-- like this -->) are stripped before Claude sees the file, so notes for humans can stay.
- /doctor proposes cuts for things Claude can read from the code, and /doctor prompt-audit (v2.1.283 or later) looks for stale and conflicting instructions.

Auto memory trims itself: when MEMORY.md nears its 200-line or 25KB limit, Claude Code reminds Claude to shorten the index and move detail into topic files.

## Why did Claude forget something? #

Usually one of these:

- It was only said in chat. After /compact, the conversation becomes a summary. The project-root CLAUDE.md and auto memory are re-read from disk; anything you only typed may not survive.
- It sits in a subfolder file that hasn't loaded yet. Nested CLAUDE.md files and path-scoped rules load when Claude touches a matching file, and after compaction only when it touches one again.
- The file didn't load. Check /context under Memory files. A CLAUDE.md in the folder or above it beats your AGENTS.md, for example.
- Two instructions disagree. The docs warn that Claude "may pick one arbitrarily"; /doctor prompt-audit finds them.
- You're on another computer, and auto memory doesn't travel.

## If you run Claude Code in Shuriken #

Shuriken doesn't add a memory of its own. Each chat is a Claude Code session in your project, so everything above works the same.

Each Claude account you add runs Claude Code with its own config folder. Shuriken links your ~/.claude/CLAUDE.md, your ~/.claude/projects folder (where auto memory lives), your settings, skills, agents and commands into every one, so a chat that moves to another of your accounts finds the same notes ([keeping the same chat across Claude accounts](https://shuriken.sh/guides/keep-the-same-chat-across-claude-accounts)).

Every chat also gets [its own git worktree](https://shuriken.sh/blog/worktree-per-chat). Auto memory is shared across worktrees, but a gitignored CLAUDE.local.md only exists in the checkout where you made it. List it in the project's .worktreeinclude, with anything else you need such as .env, and Shuriken copies it into each new worktree.

A project's settings have a Knowledge section with its instruction files, Claude's memory for the project and its skills. It warns when an always-loaded file passes 1,000 lines.

One limit stays: auto memory is per computer, and Shuriken doesn't copy it between your machines. A chat you run on another computer works with that computer's notes, so anything every machine needs belongs in CLAUDE.md.

Share

[X](https://x.com/intent/post?url=https%3A%2F%2Fshuriken.sh%2Fguides%2Fclaude-code-memory-between-sessions&text=Does%20Claude%20Code%20remember%20between%20sessions%3F%20How%20memory%20works)[LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fshuriken.sh%2Fguides%2Fclaude-code-memory-between-sessions)[Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fshuriken.sh%2Fguides%2Fclaude-code-memory-between-sessions&t=Does%20Claude%20Code%20remember%20between%20sessions%3F%20How%20memory%20works)[Reddit](https://www.reddit.com/submit?url=https%3A%2F%2Fshuriken.sh%2Fguides%2Fclaude-code-memory-between-sessions&title=Does%20Claude%20Code%20remember%20between%20sessions%3F%20How%20memory%20works)[E-mail](mailto:?subject=Does%20Claude%20Code%20remember%20between%20sessions%3F%20How%20memory%20works&body=https%3A%2F%2Fshuriken.sh%2Fguides%2Fclaude-code-memory-between-sessions)

## Sources

- [How Claude remembers your project (Claude Code docs)](https://code.claude.com/docs/en/memory) (accessed 22 October 2026)
- [Explore the context window: what survives compaction (Claude Code docs)](https://code.claude.com/docs/en/context-window) (accessed 22 October 2026)
- [Best practices for Claude Code (Claude Code docs)](https://code.claude.com/docs/en/best-practices) (accessed 22 October 2026)
- [CLI reference: --continue and --resume (Claude Code docs)](https://code.claude.com/docs/en/cli-reference) (accessed 22 October 2026)
- [Manage costs effectively: session data retention (Claude Code docs)](https://code.claude.com/docs/en/costs) (accessed 22 October 2026)

## Frequently asked questions

**Does Claude Code remember my previous conversations?**

Not in a new session, which starts with a fresh context window and sees only your CLAUDE.md files and auto memory. Your conversations are saved on your computer as .jsonl files, and claude --continue or claude --resume opens one again with its history.

**Where does Claude Code store its memory?**

Your instructions live in CLAUDE.md files: ~/.claude/CLAUDE.md for you, CLAUDE.md or .claude/CLAUDE.md in the project for the team, CLAUDE.local.md for your private project notes. Auto memory lives in ~/.claude/projects/<project>/memory/, with MEMORY.md as its index.

**How do I make Claude Code forget something?**

Run /memory, open the auto memory folder or the CLAUDE.md file that holds it, and delete the line. Everything is plain Markdown. To stop auto memory altogether, turn it off in /memory or set CLAUDE_CODE_DISABLE_AUTO_MEMORY=1.

**Is auto memory shared with my team?**

No. Auto memory is machine-local and not shared across machines or cloud environments. What the team should share goes in the project's CLAUDE.md, committed to the repository.

**Does memory survive /compact?**

Partly. The project-root CLAUDE.md and auto memory are read from disk again after /compact, while nested CLAUDE.md files and path-scoped rules come back when Claude next touches a matching file. An instruction you only typed in chat gets summarised away.

Shuriken

The harness for your coding agents.

Run Claude Code, Codex and Gemini CLI on your own computers, move chats to your next account at a limit, and follow every chat from any device.

[Download](https://shuriken.sh/download)

[Other platforms](https://shuriken.sh/download#main)

## Keep reading

- [How to change the model in Claude Code: Guide 27 Oct 2026 3 min read Change the model in Claude Code with /model, claude --model, an environment variable or settings.json. /model wins; Enter in its picker sets your default.](https://shuriken.sh/guides/change-model-in-claude-code)
- [Claude Code API Error 400 on tool_use: what to do: Guide 27 Oct 2026 4 min read A Claude Code API Error 400 about tool use means the saved history has a tool call out of step with its result. Update, then rewind past the broken turn.](https://shuriken.sh/guides/claude-code-api-error-400-tool-use)
- [Claude Code custom slash commands: make your own: Guide 27 Oct 2026 3 min read Make your own Claude Code slash commands: one Markdown file in .claude/commands or a skill, with arguments, shell output and allowed tools. With examples.](https://shuriken.sh/guides/claude-code-custom-slash-commands)
- [Claude Code thinking and effort levels, explained: Guide 27 Oct 2026 4 min read Claude Code's effort levels, low to max, set how much Claude thinks before it acts. What each level is for, the defaults, ultrathink, and how to set it.](https://shuriken.sh/guides/claude-code-effort-levels)
- [Claude Code hooks not working? Why they don't fire: Guide 27 Oct 2026 6 min read A Claude Code hook that never fires is either not loaded (missing from /hooks) or loaded with a matcher that matches nothing. The causes and their fixes.](https://shuriken.sh/guides/claude-code-hooks-not-working)
- [Claude Code keyboard shortcuts and commands cheat sheet: Guide 27 Oct 2026 5 min read Every Claude Code keyboard shortcut worth knowing, for Mac and Windows, plus the slash commands that matter. One page, checked against Anthropic's docs.](https://shuriken.sh/guides/claude-code-keyboard-shortcuts)
- [How to run Claude Code on a Chromebook: Guide 27 Oct 2026 7 min read Claude Code runs on a Chromebook inside ChromeOS's Linux if the chip is 64-bit, Intel and AMD chips have AVX, and there is 4 GB of RAM.](https://shuriken.sh/guides/claude-code-on-a-chromebook)

## Free tools

- [Claude limit reset tracker](https://shuriken.sh/tools/limit-resets/claude)
- [Codex limit reset tracker](https://shuriken.sh/tools/limit-resets/codex)
