Why Claude Code forgets context between sessions, and how to fix it

A Claude Code conversation does not carry into the next session; only files do. Here is what persists, why notes go stale, and a three-step fix that keeps context small and true.

Updated 2026-12-02

You spend an hour with Claude Code tracking down why the integration tests fail on CI. Next morning you open a new session and it starts the same investigation from scratch. Nothing is broken: a session's conversation is not carried into the next one. What carries over is files.

What persists between sessions

WhatWho writes itWhen Claude sees it
CLAUDE.md (project, user, managed)You and your teamLoaded in full at session start
.claude/rules/YouAt session start, or when matching files are touched for path-scoped rules
Auto memory (MEMORY.md and topic files)Claude, on your machineThe first 200 lines or 25 KB of MEMORY.md at session start; topic files when Claude reads them
The conversationBothNot carried into the next session

From Claude Code’s memory documentation (code.claude.com/docs/en/memory), as checked on 2026-12-02. Auto memory is on by default and can be turned off in /memory.

Why it still goes wrong

  • The useful fact was never written down. Investigations end in a fix, not in a note.
  • It was written into CLAUDE.md, which now costs tokens in every session, whether or not today's task needs it.
  • It was true when written. Then a file moved, a script was renamed or the team changed package manager, and the agent follows the old note anyway.
  • It lives on one laptop. Auto memory is machine-local, so your teammate's agent repeats the investigation you already did.

Fix it in three steps

1. Keep CLAUDE.md for rules that apply to every task: how to build and test, conventions, what never to do. Move everything else out. Check what it costs:

npx threadctx scan

2. Let Claude keep personal preferences in auto memory. How you like answers formatted and which shortcuts you use belong there.

3. Put repository knowledge in a memory that is recalled when relevant and checked before use. With threadctx, Claude saves fixes, decisions and gotchas with memory_write and asks for them with memory_query before similar work. Each note is checked against the repository first: notes naming files or scripts that no longer exist are flagged, notes that contradict the lockfile or instructions are marked as conflicts, and secrets are refused. Team notes go to .threadctx/memory.json and are reviewed in pull requests.

npx threadctx setup

Your next session opens with one line: your context grade, what your instruction files cost per session, and how many memories are in use.

Questions

Does /compact keep context between sessions?

No. Compacting summarises the current conversation so the session can continue; the next session still starts from files such as CLAUDE.md and auto memory.

Should I turn auto memory off?

No need. Auto memory suits personal preferences on your machine. Use checked team memory for facts about the repository that teammates and other agents should get, and that must stay true as the code changes.

Will this make my context bigger?

It should make it smaller. Memory costs nothing until Claude asks for it, and moving situational notes out of CLAUDE.md cuts what every session pays for.

Set it up now.

Free, local, nothing uploaded.

npx threadctx setup

Cursor or VS Code? The same memory as an MCP server: