Skip to content

How to Make Claude Code Remember Things Between Sessions

Tomorrow's session starts from zero and cheerfully re-suggests the thing you rejected yesterday. Claude Code has four real persistence mechanisms; the setups that feel like the agent knows the project use all four on purpose.

August 20, 20268 min readShift The Culture

Close a Claude Code session and everything it knew is gone — the decisions, the dead ends it already ruled out, the fact that you renamed that module on Tuesday. Tomorrow's session starts from zero and cheerfully re-suggests the thing you rejected yesterday. This is fixable. Claude Code has four real persistence mechanisms, and the teams that feel like their agent “knows the project” are using all four on purpose.

First, be precise about what dies

The context window dies with the session. That is the working memory — the conversation, the files it read, the outputs it saw. Nothing in it survives unless it was written somewhere. What survives is exactly this list:

  • CLAUDE.md files — loaded into every new session automatically.
  • Auto-memory — notes Claude itself keeps per project and reloads next time.
  • Session transcripts — replayable with --continue / --resume.
  • Anything written to an ordinary file on disk — the mechanism you control completely.

Mechanism 1 — CLAUDE.md: the standing brief

On startup, Claude Code loads ~/.claude/CLAUDE.md(you, every project) and the project's CLAUDE.md (everyone, this repo), plus any files they import with @path lines. This is where durable, always-true information belongs: build commands, conventions, the layout of the repo, the rules of engagement.

Two habits make it work. Add memories the moment they happen — start a message with # and Claude Code offers to file it into a memory file for you; edit the whole thing with /memory. And keep it short: a context file is loaded into every session, paying rent from every session's budget, and a bloated one gets skimmed. What belongs there — and the reason instructions in a fat file stop being followed — is its own article: how to write a CLAUDE.md that actually gets followed.

Mechanism 2 — auto-memory: notes Claude keeps for itself

Newer Claude Code versions maintain a per-project memory directory (a MEMORY.md plus topic files, under ~/.claude/projects/<project>/memory/). Claude records things it judges worth keeping — a gotcha it hit, a fix that worked — and the summary is loaded back at session start. It is genuinely useful and genuinely not sufficient: it remembers what the model found notable, not what you need it to never forget. Treat it as a bonus layer, not the system of record. You can read and prune it like any other file.

Mechanism 3 — resume: same conversation, later

picking up where you left off
claude --continue      # reopen the most recent session in this project
claude --resume        # pick from a list of past sessions

Resuming replays the transcript — the context comes back as it was. This is the right tool for “I have to leave mid-task”, and the wrong tool for long-term memory: an ever-growing transcript drags an ever-larger history into the window (which you pay for), and stale early context anchors the model on old decisions. Resume bridges an interruption. It does not accumulate knowledge.

Mechanism 4 — files you own: the one that scales

The pattern behind every multi-week agent project that works: the project's state lives in files the agent reads and writes, not in anyone's context window. The context file says where they are; every session starts by reading them.

  1. A truth file. One canonical file of current facts — what is deployed where, what is decided, what is dead. Sessions read it before acting and update it when facts change. When memory and the truth file disagree, the file wins, by rule written in CLAUDE.md.
  2. An append-only decision log. Every decision with a date and a reason. This is what stops session #14 from relitigating what session #3 settled — the single most annoying form of agent amnesia.
  3. A handoff note. Ending a work session, have the agent write where it stopped, what is half-done, and the next three steps — then point the next session at the note instead of resuming a 200k-token transcript. Fresh context, full continuity.
Sessions are workers on shifts. Shift workers do not rely on remembering — they rely on the logbook. Write the logbook.

Anti-patterns that feel like memory

  • Pasting yesterday's whole transcript into today's prompt. You are paying to re-read a conversation to recover five facts. Write the five facts down instead.
  • Stuffing everything into CLAUDE.md. Standing brief, not junk drawer. Facts that change belong in the truth file; history belongs in the log.
  • Trusting recall over the record.A model “remembering” that a service is configured is a cache with no invalidation. If it matters, the session verifies against the file — or against the live system.

The whole system on one screen

what goes where
always true, rarely changes   → CLAUDE.md (short; imports for detail)
current facts, change often   → truth file (agent reads first, updates on change)
decisions + reasons           → append-only log (never edited, only appended)
mid-task interruption         → claude --continue / --resume
end of a work session         → handoff note; next session starts fresh from it
model's own observations      → auto-memory (bonus layer; prune occasionally)

Reference: Anthropic's memory documentation covers the file locations and import rules above. For what this unlocks once it works — an operation that survives any single session — see how one person runs a company on AI agents.

SharePost on X
Free · 13 pages · no upsell inside

Get the Operator Field Kit — free

Six production prompts, the five-step operator setup, and nine rules from our own failure log.

  • 6 complete prompts — printed in full, not previews
  • The five-step setup, each step with a pass/fail test
  • 9 rules from the failure log that produced them

The kit, then the occasional operator note. One click unsubscribes and we never sell the address.

Keep reading