Claude Code Session Memory: CLAUDE.md & More [2026]
Claude Code is stateless between sessions. Close a chat and open a new one—Claude has no memory of your previous work, decisions, or conventions. This is by design (each session gets a fresh 1M token context window). But you can give Claude institutional memory three ways: 1) CLAUDE.md files in your repo, 2) the /memory command and memory files, and 3) keeping sessions lean so context lasts longer (via Token Limits compression). Together these mean Claude carries real knowledge across days of work.
Claude Code does not store conversation history between sessions. Every new session is a blank slate. This is a feature—you get a fresh context window—but it means you have to re-explain your project, conventions, and gotchas to Claude in every session. The fix is not to make Claude remember, but to encode knowledge in files that Claude reads automatically.
Approach 1: CLAUDE.md files (the best approach)
Create a CLAUDE.md file in your project root. Claude Code loads this file automatically at the start of every session. Use it to encode your project context: coding conventions, architecture decisions, gotchas, tools, required environment variables, and common commands.
Example CLAUDE.md structure:
Claude Code reads CLAUDE.md automatically at the start of every session. The file serves as a permanent knowledge base that does not reset between sessions.
Approach 2: /memory command and memory files
Claude Code has a built-in /memory command. Type /memory add "key" "value" to store a fact that Claude retains within a session. Type /memory list to see all stored facts. This helps within a single session but does not persist across sessions.
Use /memory for temporary context: "This is a payment integration task" or "User is on the auth module refactor". When you start a new session and need that context, re-enter it with /memory add again.
Approach 3: Keep sessions lean with compression
The longer a session runs without hitting the token limit, the more context Claude retains from your conversation. Install Token Limits to compress tool outputs 60-90%. A typical 3-hour session that would normally hit limits (forcing a restart) can now run 8-10 hours. More session time = more context retention within that session.
This does not make Claude remember across sessions, but it extends individual sessions so you have more uninterrupted time with continuous context.
Recommended approach: Combine all three
- Create CLAUDE.md in your repo root with architecture, conventions, and gotchas
- Install Token Limits so sessions last longer and you retain more context within them
- Use /memory during a session for temporary, task-specific context
- At end of session, note important discoveries or decisions in CLAUDE.md for the next session
What goes in CLAUDE.md
- ✓Architecture: Tech stack, folder structure, key entry points
- ✓Conventions: Code style, naming, commit formats, branch patterns
- ✓Gotchas: Known issues, common build failures, environment setup quirks
- ✓Commands: How to run tests, build, deploy, migrate database
- ✓Required vars: Environment variables, API keys, config locations
- ✓Context: Domain knowledge, business logic, why decisions were made
Example: A real CLAUDE.md
Encode your project knowledge once, use it forever
CLAUDE.md files give Claude permanent context about your project. Combined with Token Limits compression, you get days-long sessions with continuous context. Create one file, solve context amnesia across all future sessions.
FAQ
Does Claude Code automatically find CLAUDE.md?
Yes. Claude Code looks for CLAUDE.md in your repo root at the start of each session. Create it once and it loads automatically.
Can I have multiple CLAUDE.md files?
You can create CLAUDE.md in subdirectories for context-specific info (e.g., src/CLAUDE.md for frontend context). Claude reads the most relevant one for your current task.
Should I commit CLAUDE.md to git?
Yes. CLAUDE.md is documentation for your project. Commit it so all developers (and Claude) see the same conventions and architecture.
Does /memory persist across Claude Code sessions?
No. /memory is session-only. Use it for temporary context within a session. Use CLAUDE.md for permanent, cross-session knowledge.
Can CLAUDE.md replace watching token usage?
No. CLAUDE.md reduces how much context you have to re-explain. Token Limits extends how long sessions last. Use both.