[BUG] /resume inside a running session keeps stale CLAUDE.md and auto-memory context (claude --resume and /clear reload it)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Switching sessions with /resume <id> inside a running Claude Code doesn't reload CLAUDE.md or the auto-memory index (MEMORY.md). The resumed session's instructions context stays whatever was captured before:
- The resumed transcript already has an instructions block: no new block is added, so the old copy stays in context.
- The resumed transcript has none, e.g. one written by a PreCompact hook that forks the conversation: the first message stores the running process's copy, taken at that process's first turn, rather than the files on disk.
Starting with claude --resume <id>, or running /clear, re-reads both files and stores a fresh instructions block. So the three ways into a session disagree.
The "…changed on disk since you last read it" notices partly cover for this. For the edits I tested (up to a ~22 KB CLAUDE.md rewrite and a ~13 KB MEMORY.md rewrite), the notice carried the diff and the model answered from it. But the stale copy stays in context beside the notice. And in one real session, the notice for a rewritten ~16 KB MEMORY.md carried no diff:
…/memory/MEMORY.md changed on disk since you last read it. … The changes are not shown here; use Read if you need the current content.
That session's instructions held the old index (158 entries, 58 of them pointing at memory files that had since been deleted) plus that one-line hint.
What Should Happen?
/resume inside a running session should reload CLAUDE.md files and the auto-memory index the way claude --resume and /clear already do, so the resumed session's instructions match the files on disk at the moment of the switch.
Error Messages/Logs
No error. The evidence is in the session transcript (~/.claude/projects/<project>/<session>.jsonl): the instructions attachment is the line containing Contents of …/CLAUDE.md and Contents of …/MEMORY.md.
Steps to Reproduce
No plugins needed. <project> is the folder's absolute path with every non-alphanumeric character replaced by -. Use a folder that isn't inside a git repo.
- Create
~/cc-resume-repro. Put- MEMMARK: fouras the first line of~/.claude/projects/<project>/memory/MEMORY.md. - In that folder, run
claude -p "Reply OK" --output-format jsonand note thesession_id(call it S). Its transcript stores an instructions block containingfour. - Start
claudein the same folder and send any message. - Rewrite
MEMORY.mdso the first line is- MEMMARK: five. - In the running session:
/resume S, then send: "Without using any tools, quote the MEMMARK line from the memory index in your context." - Open
S.jsonl. It still has exactly one instructions block, and that block saysfour; nothing new was stored. (The reply may still sayfive, taken from the change notice.) /exit, runclaude --resume S, and send the same message.S.jsonlnow has a second instructions block, and it saysfive.
Swapping CLAUDE.md for MEMORY.md gives the same result.
Fork variant (how I hit it): a PreCompact hook that forks the transcript (the context-compacto plugin does this) produces a transcript with no instructions block. Resuming it in place stores the process's first-turn copy. Measured on 2.1.283:
| After the fork is written | Instructions block stored | Background shell | Background agent |
|---|---|---|---|
| /resume <fork> | stale (process's first-turn copy) | survives | survives |
| /clear, then /resume <fork> | fresh | survives | cut off |
| /exit, then claude --resume <fork> | fresh | stopped | stops* |
\*Not tested with an agent; the exit dialog says background work stops unless you choose "Move to background and exit".
So right now, the only ways to get fresh CLAUDE.md and memory into a resumed session also cut off running background agents.
Claude Model
Not sure / Multiple models. Reproduced with Haiku 4.5, first noticed on Opus; the model doesn't affect it.
Is this a regression?
I don't know
Claude Code Version
2.1.283 (Claude Code)
Platform
Anthropic API (Claude Max subscription)
Operating System
macOS
Terminal/Shell
Other: zsh inside tmux