Memory and sessions
How Claude learns from experience, and how you pick up where you left off
⏱ Est. ~6 min
01 · Read
You write CLAUDE.md to give Claude explicit instructions. But Claude Code also has auto memory — it can save notes about things discovered during a session. Build command quirks, debug patterns, project-specific gotchas.
These notes persist across sessions, so Claude learns from experience. Auto memory lives in ~/.claude/projects/<project>/memory/. Local only, never synced to git.
Key points
- CLAUDE.md = rules you write explicitly
- Auto memory = notes Claude saves from experience
- Memory lives in ~/.claude/projects/<project>/memory/
- Local only — not shared via git
- Toggle with the /memory command in Claude Code
02 · Read
Each Claude Code conversation is a session. Sessions are stored locally and can be resumed later.
But here's the key insight — sessions start from scratch. If you open a new terminal and run claude, it won't automatically know what you were doing yesterday. You need to explicitly resume the session, or rely on CLAUDE.md and memory for context.
Naming sessions is the single most important habit for productive context management.
Key points
- Each conversation is a session, stored locally
- New sessions start from scratch — no prior conversation history
- Named sessions are easier to find and resume later
- CLAUDE.md and memory provide continuity between sessions
03 · Code example
Here are the key commands for managing sessions — name, resume, fork.
Name the current session
/rename "auth-refactor"
Resume the most recent session
claude --continue
Pick from recent sessions
claude --resume
Resume a specific named session
claude --resume auth-refactor
Fork a session (new branch from current state)
claude --continue --fork-session
Name the session as soon as you start work — /rename "feature-name". When you come back to the project, claude --resume shows a picker where you can search, preview, and select. Fork creates a new session from the current state without touching the original.
04 · Step-through
1. Start and name
Open Claude Code and immediately name the session with /rename "what I'm working on". Easier to find later.
2. Do your work
Ask Claude to implement features, fix bugs, write tests. Claude reads CLAUDE.md and memory automatically.
3. Natural ending
When you're done, just close the terminal or press Ctrl+C. The session is saved automatically.
4. Resume later
When you come back, run claude --resume to pick up where you left off, or claude --continue for the most recent session.
05 · Quiz
You were working on a feature yesterday and want to keep going today. What's the fastest way to resume?
- Start a new session and re-explain everything
- Copy-paste the previous conversation
- Run claude --continue to resume the most recent session
- Delete CLAUDE.md and start over
06 · Match
Match each command to what it does.
(This section is interactive — please enable JavaScript.)
Other lessons in this chapter
⚠ The full interactive experience needs JavaScript. Please enable it and reload.
※ This is an independent Traditional Chinese teaching project — not an official Anthropic product. Claude™ is a trademark of Anthropic, PBC.