Claude Code Session Resume Loses Memory of Prior Work

You resume a Claude Code session and it acts like a fresh start — forgetting the plan, the decisions, the half-finished refactor. Diagnose snapshot scope, compaction, and memory layers.

You close your laptop. Next morning, claude --resume (or whatever resume flow you use) pops up the session. It looks like the same conversation — the tool-call history is visible, the plan is there. But the moment you say “continue”, Claude asks what project this is, re-reads files it already read yesterday, and re-proposes a design you explicitly rejected at 5pm. Session resume gives you the appearance of continuity without the substance. Under the hood, what survives a resume is the visible transcript, but everything that was in the model’s working context — the implicit summaries, the tool-result memory, the inferred decisions — is reconstructed from scratch, often imperfectly.

Common causes

Ordered by impact.

1. Auto-compaction discarded the working context

Long sessions get compacted: older turns are summarized and the raw text is dropped. When you resume, only the summary is left. Nuance gone — “we decided not to use Redis” becomes a one-line note that might or might not survive into the rehydrated context.

How to spot it: The transcript shows a [summarized] marker, or older turns look truncated. Decisions you remember making are not in the visible history.

2. Resume only loads the message history, not tool results

Some resume flows preserve the user/assistant text but DROP the tool result blocks (file contents, command output) to save tokens. The next turn, Claude knows it “read foo.ts” but does not actually have foo.ts’s content anymore.

How to spot it: Claude immediately re-reads the same files it read yesterday. Bytes-in counter resets despite the visible transcript.

3. CLAUDE.md or settings changed between sessions

If you edited CLAUDE.md or .claude/settings.json between sessions, the resumed context still has the OLD rules, but the system prompt has the NEW ones. Inconsistent behavior.

How to spot it: Behavior differs from before close — using a different package manager, different test command, etc.

4. Resume started in a different working directory

claude --resume looks up the session file but the cwd dictates which CLAUDE.md, which .claude/, and which file paths are valid. If you resumed from a different shell location, the relative paths in the transcript no longer point to the same files.

How to spot it: Claude says “file not found” for paths that worked yesterday, or reads a different file at the same relative path.

5. Subagent / Task results were ephemeral

Task tool subagents produce results that get inserted into the parent transcript at the time. If the parent transcript was summarized, the subagent’s findings collapsed into a one-line summary. The original detail is unrecoverable.

How to spot it: You remember a deep research result from a subagent run; on resume, only a brief mention exists.

6. The session file itself is from a different version

After Claude Code updates, older session files may be partially incompatible. Resume succeeds technically but some fields fail to load.

How to spot it: Resume worked yesterday with same file, today it does not, and you upgraded Claude Code in between.

7. Plan / TodoWrite list lives in a separate store that did not persist

If you used a planning tool that maintained state outside the chat, that store may have been local-only and is now empty. Visible plan items are gone.

How to spot it: You had a checklist of 12 items; after resume, the TodoWrite list shows 0 items but the chat history mentions them.

Before you start

  • Note the elapsed time between sessions (more time, more compaction risk).
  • Have a clear sample of “lost memory” — a specific decision or task that should have carried over.
  • Check whether you updated Claude Code or changed configs since the previous session.
  • Decide what you actually need: full state continuation, or just enough context to keep going?

Information to collect

  • Session file path (commonly under ~/.claude/sessions/ or similar — check claude --debug).
  • Size of the session file (wc -c).
  • Whether compaction was triggered (search for compacted in the file or debug log).
  • Claude Code version now vs at original session start.
  • Any external state files (TodoWrite store, agent.log) that should be paired.

Step-by-step fix

Ordered by ROI — cheapest first.

Step 1: Re-prime context with a “current state” message

Best 90-second fix for any resume:

Quick context dump before we continue:

Project: <name>
Goal of this session: <goal>
Where we left off: <specific step or file>
Decisions already made (do not re-propose):
- <decision 1>
- <decision 2>
Files in scope: <list>
Next concrete step: <action>

This costs you 60 seconds and saves an hour of re-derivation.

Step 2: Read the right files BEFORE asking Claude to act

Pre-emptively re-read the load-bearing files:

Read these files to refresh context:
- src/auth/login.ts (the one we are refactoring)
- src/auth/login.test.ts (the test we are keeping green)
- docs/architecture.md (the constraints)
Then summarize back to me what you understand. Do not act until I confirm.

This forces full content into the live context, not just summaries.

Step 3: Use a session-state file checked into the repo

Maintain a .claude/session-notes.md (or similar) that captures decisions, open questions, and current step. Update it before closing each day. On resume, prompt:

Read .claude/session-notes.md and recap to me before doing anything else.

This survives compaction because it lives outside the conversation.

Step 4: Resume from the correct cwd

cd ~/projects/myrepo
claude --resume <session-id>

Always verify cwd matches the original session’s cwd. Confirm with:

What is your current working directory? Print it.

Step 5: Re-sync with current CLAUDE.md

After resume:

Please re-read CLAUDE.md from disk and acknowledge any changes since the last loaded version. Treat the current file as authoritative.

Forces Claude to pick up edits made between sessions.

Step 6: Accept resume is bounded; restart for big changes

For multi-day work, do not rely on resume across more than 1-2 close/reopen cycles. Instead:

  1. End each working session by writing a “current state” note in the repo.
  2. Start each new session fresh with claude (not --resume).
  3. Open by saying “Read .claude/session-notes.md and continue”.

The fresh session has a clean context window and no compaction debt.

Step 7: For very long projects, externalize the plan

Use a file like PLAN.md checked into the repo:

# Refactor auth to async/await

## Completed
- [x] login.ts converted
- [x] signup.ts converted
- [x] login.test.ts updated

## In progress
- [ ] reset-password.ts (started, partial)

## Not started
- [ ] sso.ts
- [ ] mfa.ts

## Decisions
- Using axios for HTTP, not fetch (team preference)
- No new dependencies allowed

The plan never lives in the conversation; it lives in git, and every session reads it.

Verify

  • After a fresh resume + reprime, ask Claude to recite the current step and decisions; match against what you wrote.
  • Run the next concrete step and confirm it does not redo prior work.
  • Open the session file and confirm the size is reasonable (compaction events visible if any).
  • After 1-2 days, compare session quality vs starting fresh with notes — fresh+notes should win in most cases.

Long-term prevention

  • Externalize state. Anything that must survive 24 hours belongs in a file in the repo, not in the chat.
  • Treat resume as a 1-day tool. For multi-day work, restart with notes.
  • Keep CLAUDE.md and PLAN.md updated as you go; do not save it for end-of-day.
  • Tag major decisions with explicit markers in the chat (“DECISION: using axios, not fetch”) so they survive summarization better.
  • Commit work in progress at end of day; the diff is also a memory aid.
  • See related context-loss patterns in Claude Code context broken and Claude Code output truncated by context.
  • Audit your ~/.claude/sessions/ periodically and delete stale ones — resume from old files is more trouble than starting fresh.

Common pitfalls

  • Trusting that --resume will pick up where you left off “with full memory” — it will not.
  • Putting the entire plan in the chat (“here are the 30 steps”) instead of in a file.
  • Resuming and immediately giving a vague instruction (“continue”) — Claude has no good way to know what that means after compaction.
  • Editing CLAUDE.md between sessions without telling the resumed Claude to re-read it.
  • Treating subagent findings as durable; they are not.
  • Forgetting to cd to the right directory before --resume; see Claude Code project CLAUDE.md not loading for the cwd resolution rules.
  • Updating Claude Code mid-week and being surprised that a Friday session does not resume cleanly on Monday.

FAQ

Q: Is there a setting to disable compaction?

Not really. Compaction is what lets long sessions exist at all. The fix is to externalize the parts you need to survive — not to fight compaction.

Q: Does --resume reload tool results?

It loads the message history. Tool result blocks may be replaced with summaries to save tokens. Treat tool results as ephemeral.

Q: How long can a session realistically run before resume gets unreliable?

In our experience, 8-12 hours of active use, or ~3 close-and-reopen cycles. Beyond that, fresh + notes is more reliable.

Q: Can I export a session to disk before closing?

Yes — copy the session file from ~/.claude/sessions/ or use the export command if your CLI supports it. Useful for audit, but resuming from an exported copy has the same compaction limits.

Q: Why does Claude sometimes ask me a question I already answered yesterday?

The answer was compacted out. Either re-answer in the new turn, or surface the answer from your notes file before asking Claude to proceed.

Tags: #Claude Code #session #memory #Troubleshooting #context