Claude Code Forgets Things Between Sessions: What Actually Persists

Claude Code Forgets Things Between Sessions: What Actually Persists

If Claude Code forgets context between sessions, it is working as designed: every new session, and every /clear, starts with a fresh context window. What you said in the chat is not carried forward. Only files on disk come back automatically, mainly your CLAUDE.md files and Claude’s own auto memory.

The quick fix: to pick up the same conversation, run claude --continue (latest session) or claude --resume (choose one). To make a fact stick for every future session, tell Claude “Remember that…” so it saves the note to auto memory, or say “add this to CLAUDE.md” for a rule the whole team should share. Then check what loaded with /context all or /memory.

We tested every reset in a real session below: exit and continue, /clear, a brand-new session, and a saved memory that came back the next time.

Browse all our Claude Code tutorials for more fixes and how-tos.

Tested with Claude Code v2.1.332 on macOS on November 29, 2026. We used a throwaway demo project called tidy-notes with one tiny Python file, a short CLAUDE.md and a fresh Git repository. We started Claude Code with project and local settings only, and pointed auto memory to a folder inside the demo, so our personal setup stayed out of the test.

We tested on macOS; the Windows and Linux steps follow Anthropic’s official instructions, and the commands and file names work the same way there.

Quick Summary: What Survives in Claude Code

What you doYour chatCLAUDE.mdAuto memoryTested by us?
Exit, then claude --continueRestoredLoadedLoadedYes
/clearGone from contextLoadedLoadedYes
Start a new claude sessionNot loadedLoadedLoadedYes
/compact or auto-compactReplaced by a summaryRe-read from diskRe-read from diskFrom the docs
A different computerNot thereOnly if committed to GitNot there (machine-local)From the docs

Why Claude Code Forgets Context

Claude Code keeps everything it knows about your current session in one context window. That window holds the system prompt, your instruction files, the files Claude read, and the whole back-and-forth of your chat. When the session ends or you clear it, that window starts over.

Anthropic’s memory documentation says it plainly: each session begins with a fresh context window, and two things carry knowledge across sessions. Those are CLAUDE.md files, which you write, and auto memory, which Claude writes for itself.

So when it feels like Claude Code “forgot” something, ask one question first: was that fact ever saved to a file? If you only typed it into the chat, it lived in the context window and nowhere else.

Chat is short-term memory. Files are long-term memory. Claude Code only reloads the files.

The two kinds of long-term memory

CLAUDE.md filesAuto memory
Who writes itYou (or Claude when you ask)Claude
What goes in itRules and instructionsLearnings, corrections, preferences
Where it lives./CLAUDE.md, ~/.claude/CLAUDE.md and others~/.claude/projects/<project>/memory/
How much loadsThe whole file at launchFirst 200 lines or 25KB of MEMORY.md
Shared with teammatesYes, if you commit itNo, it stays on this machine

If you want the full tour of both systems, our memory system guide goes deeper into MEMORY.md, and this post sticks to the “why did it forget?” side.

What We Tested: Four Resets, One Fact

To see what really persists, we gave Claude one fact that lived only in the chat: “our launch date is December 5.” Then we reset the session in different ways and asked for the date again. We kept every prompt tiny, so the whole test used just a handful of short messages.

Test 1: Exit and resume with claude –continue

We told Claude the launch date, typed /exit, and then started again with claude --continue. That flag reopens the most recent session in the current folder, so the old chat came back with it.

Claude Code terminal where the user exits, runs claude --continue, and Claude still answers December 5
After /exit and claude –continue, the old chat is restored and Claude still knows the date.

Claude answered “December 5.” right away. Resuming does not create memory; it simply reloads the saved transcript, which Claude Code writes to disk as you work.

Test 2: /clear wipes the chat

Next we started a fresh session, gave the same fact, ran /clear, and asked again. This time Claude said we had never given a launch date, and that it found no saved memory of one.

Claude Code after /clear saying no launch date was given, then saving the date to auto memory with Wrote 2 memories
After /clear the chat fact is gone. Asking Claude to remember it writes two memory files.

Notice the small “Listed 1 directory” line. Before answering, Claude checked its auto memory folder, which was still empty at that point.

Test 3: Ask Claude to remember

In the same session we typed: “Remember for future sessions: our launch date is December 5.” Claude Code showed “Wrote 2 memories” and confirmed the save. It also added the year on its own and said so, which is a good reason to read what it saved.

Here are the two files it created. MEMORY.md is a one-line index, and the topic file holds the details with a type: project label, matching the four note types in the docs (user, feedback, project and reference).

Terminal showing the autoMemoryDirectory setting, the MEMORY.md index line and the launch-date.md memory file Claude wrote
The real files on disk: a one-line MEMORY.md index and a topic file with the saved date.

Test 4: A brand-new session remembers

Finally we exited and started a plain claude session with no resume flag. We asked, “What launch date are we working toward?” and Claude answered “December 5, 2026” instantly, without reading any extra files.

A brand-new Claude Code session answering December 5, 2026 from auto memory
A fresh session with no resume flag still knows the date, because MEMORY.md loads at startup.

That is the whole fix in one picture. The fact survived because it now lives in a file that Claude Code loads at the start of every session.

Diagram of what survives in Claude Code after exit and continue, clear or new session, compaction, and moving to another computer
Four common resets and what each one keeps: files come back, chat-only facts don’t.

How to Fix Claude Code Forgetting Context

Pick the fix that matches what you lost. Fixes 1 to 3 were tested in our session; the rest come from Anthropic’s official docs, and we say so in each one.

Fix 1: Resume the session instead of starting a new one

If you just want yesterday’s conversation back, don’t start a blank session. Use one of these (tested):

  • claude --continue reopens the most recent session in the current folder.
  • claude --resume opens a picker of saved sessions; claude --resume <name> jumps straight to a named one.
  • /resume switches sessions from inside Claude Code.
  • /rename or claude -n <name> gives a session a name you can find later.
The Claude Code /resume session picker listing saved sessions with titles, age, branch and size
The /resume picker lists every saved session in this project, including ones you cleared.

The picker also lists sessions you left with /clear, since the docs say sessions are saved continuously and you can return after exiting or clearing. Our guide to resuming Claude sessions covers naming and branching, and if the picker can’t find one, see the failed to load fix.

Fix 2: Ask Claude to remember it

For a personal fact or preference you want in every future session, say “Remember that…” (tested). According to the docs, Claude saves it to auto memory, and the first 200 lines or 25KB of MEMORY.md load at the start of each session.

If nothing gets saved, check that auto memory is on. Open /memory and look at the toggle at the top. You can also turn it off per project with "autoMemoryEnabled": false in .claude/settings.json, or everywhere with the CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 environment variable, so make sure neither is set by accident.

The Claude Code /memory panel showing Auto-memory on, project and user instructions, and Open auto-memory folder
/memory shows the auto memory toggle and a shortcut to the folder where Claude keeps its notes.

Auto memory is per repository and shared by all worktrees of the same Git repo. A folder outside Git gets its own memory, so moving a project to a new path can make it look empty.

Fix 3: Put project rules in CLAUDE.md

Team conventions, build commands and “always do X” rules belong in CLAUDE.md, not in the chat. Ask Claude “add this to CLAUDE.md” or open the file from /memory. The docs say Claude gets the whole of each CLAUDE.md that loads at launch (up to 4 MiB), and Anthropic suggests keeping each file under 200 lines.

To confirm both kinds of memory loaded, run /context all (tested). In our session the Memory files section listed CLAUDE.md and memory/MEMORY.md.

Claude Code /context output listing CLAUDE.md and memory/MEMORY.md under Memory files
/context shows which memory files loaded into this session and how many tokens each one uses.

If a file you expect is missing from that list, read our fix for when Claude ignores CLAUDE.md, and check the right spot in our guide to every CLAUDE.md location.

Fix 4: Know what compaction keeps (from the docs)

Long sessions compact automatically, and you can run /compact yourself. Compaction replaces the conversation with a summary, so details you only said in chat can get squeezed out.

The context window docs list what comes back: the project-root CLAUDE.md and auto memory are re-injected from disk, and up to five recently used files are re-read. Rules with paths: frontmatter and nested CLAUDE.md files only return when Claude touches a matching file again.

Anthropic docs table listing what survives compaction in Claude Code, including CLAUDE.md and auto memory re-injected from disk
Anthropic’s own table: CLAUDE.md and auto memory are re-read from disk after compaction.

Before a big compaction, steer it with /compact focus on the auth bug fix style instructions. Our comparison of clear versus compact explains when to use each, and you can also control auto-compact if it fires at bad moments.

Fix 5: Keep MEMORY.md short (from the docs)

Only the first 200 lines or 25KB of MEMORY.md load, whichever comes first. The docs say anything past that limit is dropped on the next load, and Claude Code warns Claude to tidy the index when it gets close.

Open the folder from /memory now and then. Delete stale lines and merge duplicates, because it is all plain markdown you can edit.

Fix 6: Pass your launch flags again when you resume (from the docs)

Sometimes the chat comes back but tools seem missing. The sessions docs say claude --continue and claude --resume don’t restore flags like --mcp-config, --plugin-dir, --add-dir, --settings or --allowedTools, so add them again.

Fix 7: Mind the other limits (from the docs)

  • Old transcripts are deleted after the cleanupPeriodDays setting, but memory files are excluded from that cleanup.
  • Auto memory is machine-local, so a new laptop or a cloud session won’t see it. Commit CLAUDE.md to carry rules across machines.
  • Subagents don’t get the main session’s auto memory, except a fork, which inherits the parent conversation.
  • Sessions run with claude -p don’t appear in the picker or in claude --continue; resume them by session ID.

Where Should Each Fact Live?

Most “Claude Code forgets” problems disappear once each fact sits in the right place. Use this ladder when you’re about to type something important into the chat.

Decision ladder: one-off facts go in chat, must-happen rules in a hook, team rules in project CLAUDE.md, personal notes in auto memory
Decide where a fact belongs: chat for this task, a hook for must-do rules, CLAUDE.md for the team, auto memory for you.

Remember that both CLAUDE.md and auto memory are context, not enforced settings. The docs point you to hooks or deny rules when something must happen every single time.

Try It Yourself

Make a small test folder, run git init, start claude, and paste this prompt. Then run /clear and ask about your stack again to see the memory at work.

Remember for future sessions: in this project we use pnpm, not npm,
and tests run with "pnpm test". Then tell me which memory file you saved it to.

Next, open /memory, pick the auto memory folder and read the file Claude wrote. Edit one word yourself and start a new session to see your change loaded.

Common Mistakes

  • Starting a blank claude session when you meant to continue; use claude --continue instead.
  • Typing team rules into chat every morning instead of saving them to CLAUDE.md.
  • Assuming /clear deletes your history; it only clears the context, and the old session stays in /resume.
  • Letting MEMORY.md grow past 200 lines, so the newest notes never load.
  • Expecting auto memory on a second computer; it never leaves the machine.
  • Putting a must-keep rule in a paths: rule file and losing it after compaction.

Pro Tips

  • Name long-running work with /rename, so claude --resume auth-refactor finds it in one step.
  • Before a long task, ask Claude to write its plan into a file; our guide to planning with files shows the pattern.
  • Check your context budget with /context; our walkthrough of the context window explains each line.
  • Use autoMemoryDirectory in settings if you want auto memory in a folder you back up.
  • Review saved memories weekly; Claude can guess details, like the year it added in our test.

Cheat Sheet

Cheat sheet of Claude Code commands and settings for resuming sessions and saving memory between sessions
Commands and settings for getting the chat back and saving facts for good.

Frequently Asked Questions

Does Claude Code remember previous conversations?

Not on its own. A new session starts fresh, but the old conversation is saved, so claude --continue or claude --resume brings it back. For facts that should load every time, use auto memory or CLAUDE.md.

Does /clear delete my conversation?

No. It clears the context so Claude stops seeing the old chat, but the session stays saved and appears in the /resume picker. CLAUDE.md and auto memory still load after /clear.

Where does Claude Code store its memory?

Auto memory lives in ~/.claude/projects/<project>/memory/ by default, with a MEMORY.md index plus topic files. You can move it with the autoMemoryDirectory setting.

Why did Claude forget my instructions after compaction?

The instruction was probably only in the chat, or in a nested CLAUDE.md or paths: rule that hasn’t reloaded yet. Move it to the project-root CLAUDE.md, which is re-read from disk after compaction.

Can I turn auto memory off?

Yes. Use the toggle in /memory, set autoMemoryEnabled to false in a project’s settings, or set CLAUDE_CODE_DISABLE_AUTO_MEMORY=1. For other errors, see our list of common Claude errors.

Conclusion

Claude Code forgets context between sessions because each session, and each /clear, starts with a fresh context window, and only files on disk are loaded back in. In our test, claude --continue brought the old chat back, /clear lost the fact, and one “Remember that…” prompt saved it to auto memory so a brand-new session answered correctly. Keep team rules in CLAUDE.md, personal notes in auto memory, and must-happen rules in hooks, and Claude will stop forgetting what matters. For more on the model behind it, see our Claude AI overview.

Newsletter

New AI tools in your inbox

The best new tools and the AI news that matters, in one short email. Unsubscribe any time.

Free · No spam · Unsubscribe any time

✓ Looks like you’re subscribed

Loading Google’s sign-up form…

Looks like you’re already subscribed

Thanks for reading! New AI tools and the AI news that matters will land in your inbox.

Not subscribed yet? Refresh the page to load the sign-up form.

The sign-up form couldn’t load. If you use an ad or content blocker, allow news.google.com and reload the page.

Free instant check before you pay. Takes a few seconds.

Scroll to Top