Context ยท Memory ยท Handoff Complete Guide
Claude CodeThree "Memory" Mechanisms in Claude Code โ When Each Is Used and How They Differ
There are three things that can be called "memory" in Claude Code. Each has completely different scope and lifetime.
1. Context โ Current Conversation (Volatile)
The contents of the current ongoing conversation. Has a token limit (context window), so earlier parts get truncated as conversations grow. Can be compressed with /compact or fully reset with /clear.
Only valid within a single session. Disappears when you close the session (though --resume can reopen the session itself).
2. Memory โ Cross-Session Memory (Persistent)
Persistent memory stored as .md files in ~/.claude/projects/project/memory/. Persists across session closures โ even the next day.
Saved via explicit instructions like "remember this", "always use bun", or auto-saved when Claude judges something important. Can be deleted with "forget this".
Memory โ CLAUDE.md. CLAUDE.md is project rules (shared doc committed to Git). Memory is personal preferences, feedback, and work context (local only).
3. Handoff โ Session Transfer
Mechanisms for moving sessions to different environments.
claude -c(--continue): instantly resume last sessionclaude -r(--resume): past session selector/remote-control: access current session from mobile/browserSession transfer between claude.ai โ Claude Code
Handoff carries Context as-is. Memory auto-loads always, so no separate transfer needed.
Context vs Memory vs Handoff
| Criteria | Context | Memory | Handoff |
|---|---|---|---|
| Definition | Current conversation content | Persistent cross-session memory | Session transfer mechanism |
| Lifetime | Gone on session end | Persistent (file-based) | Moves with session |
| Storage | RAM | ~/.claude/projects/*/memory/*.md |
Session history DB |
| Limit | Token window (model-dependent) | MEMORY.md 200-line limit | None |
| Commands | /compact, /clear |
"remember this", "forget this" | -c, -r, /remote-control |
| Git tracked | No | No (local only) | No |
Memory vs CLAUDE.md โ Don't Confuse!
| Criteria | Memory | CLAUDE.md |
|---|---|---|
| Content | Personal preferences, feedback, work context | Project rules, code conventions, architecture |
| Scope | You only (local) | Whole team (Git committed) |
| Example | "User prefers Korean" "Skip trailing summaries" |
"Use SQLite, no jsonb" "Run commands in Docker" |
"Why Doesn't It Remember?" Troubleshooting
Why doesn't it remember what I said earlier?
โ Context was compressed/truncated. After long sessions, earlier conversation is auto-compressed. Use /compact with emphasis, or record important decisions in CLAUDE.md.
Why doesn't it remember yesterday's conversation?
โ Not saved to Memory. Explicitly save with "remember this", or the content wasn't important enough for auto-save. Use "always do X" for important patterns.
Want to continue yesterday's session?
โ Use Handoff. claude -c for recent, claude -r to pick from list. Note: older sessions may have compressed Context.
How to Use
Context: /compact to compress, /clear to reset, statusline to check remaining
Memory: "remember this" or auto-save. Located at ~/.claude/projects/*/memory/
Handoff: claude -c (resume recent), claude -r (select session), /remote-control (mobile)
Memory โ CLAUDE.md โ Memory is personal (local), CLAUDE.md is project rules (Git)
Tags
Source
Anthropic Docs