Claude Code Session Memory
Session Memory quietly summarises each Claude Code session and loads the relevant ones next time you open the project.
Problem: You fire up a fresh Claude Code session and burn the first five minutes recapping what you built yesterday. The auth flow is done. A database schema is picked. The API shape is decided. None of that is in the model's head.
Quick Win: Check whether Session Memory is already turned on for your setup. When Claude Code boots, watch the terminal for a line that looks like this:
Recalled 3 memories (ctrl+o to expand)
If that shows up, summaries from earlier work in this project were pulled in automatically. Hit ctrl+o and you can inspect exactly what got loaded. If you don't see the line yet, the rest of this guide explains when and how the feature kicks in.
What Session Memory Actually Is
Think of Session Memory as a background clerk. It runs on its own during every session, pays attention to what's happening, pulls the useful pieces out of your conversation, and writes them down as structured summaries on disk. CLAUDE.md is the opposite. You write and maintain CLAUDE.md by hand. Session Memory needs nothing from you.
Two kinds of terminal messages tell you it's working:
- "Recalled X memories" prints at the start of a session. Summaries from earlier work in the same project just got loaded into Claude's context.
- "Wrote X memories" prints while you work. Claude just saved a fresh snapshot of the current session.
Either line comes with (ctrl+o to expand) so you can open up whatever was recalled or written.
How It Works Under the Hood
A background process handles Session Memory on every session you open. The moving parts are worth understanding.
Storage Location
Summaries live as structured markdown files, one per session, at a predictable path:
~/.claude/projects/<project-hash>/<session-id>/session-memory/summary.md
Every session gets its own folder, and its own summary inside. The folders pile up over time and form a trail of everything you've worked on inside a given project.
Extraction Cadence
Saving does not happen on every message. The schedule is deliberate:
- First extraction: Triggers after roughly 10,000 tokens of conversation
- Subsequent updates: Every ~5,000 tokens or after every 3 tool calls, whichever comes first
That rhythm keeps summaries useful and keeps compute off trivial back-and-forth. A five-minute typo fix yields almost nothing. A deep architecture discussion yields a lot.
Cross-Session Recall
Start a new session and Claude will pull relevant past summaries into context for you. Each one comes tagged with a note: "from PAST sessions that might not be related to the current task." Claude reads them as background reference, not as orders to follow.
The tagging is important. Decisions you made three weeks ago do not come back as hard rules. You get the continuity without being locked into stale choices.
What Gets Remembered
Every summary follows the same shape:
- Session title: An auto-generated description of what you worked on (e.g., "Implement user dashboard with role-based access")
- Current status: Completed items, discussion points, open questions
- Key results: Important outcomes, decisions made, patterns chosen
- Work log: A chronological record of actions taken during the session
A summary covers what got done and why, not a word-for-word replay of the messages. Compression is the whole point. Hours of work shrink down to a focused digest that Claude pulls in almost instantly.
The /remember Command
Session Memory holds raw history. The /remember command is what turns that history into lasting project knowledge.
Run /remember and Claude walks through the session summaries at the path above, looks for patterns that keep showing up across sessions, and drafts updates to CLAUDE.local.md. You get final say on each addition before it's written.
Say Claude has noticed across three sessions that you keep nudging the same rule: "always use server actions instead of API routes." /remember flags that line as a good target for permanent memory. Once it lands in CLAUDE.local.md, Claude picks up the pattern from the first message of the next session, no correction needed.
Think of it as the handoff between automatic memory and deliberate configuration.
Instant Compaction
Before Session Memory existed, running /compact could cost you up to two minutes of dead time. Claude would reread the whole conversation and hand-roll a summary right then. Now /compact returns instantly.
The reason is that a summary is already sitting on disk. Compaction no longer has to write a new one from scratch. It grabs the latest summary, drops it into a fresh context window, and hands you back control. Your context workflow ends up both quicker and more predictable.
That difference matters most on long sessions. Instead of dreading the pause at 80% context, you can compact on a whim. The summary is always ready.
Availability and Requirements
Session Memory ships on Anthropic's first-party API. If Claude Code is talking to the model through a Claude Pro or Max subscription, the feature is on by default.
A few things to know about availability:
- API providers: Bedrock, Vertex, and Foundry users don't have access to Session Memory. The feature requires Anthropic's native API infrastructure.
- Feature gating: Session Memory is gated behind the
tengu_session_memoryStatsig feature flag. A related flag,tengu_sm_compact, enables the instant compaction behavior. - Timeline: The underlying system has existed since roughly v2.0.64 in late 2025. The visible terminal messages ("Recalled/Wrote memories") became prominent around v2.1.30 and v2.1.31 in early February 2026.
On a supported plan and still not seeing the recall line? Your account probably has not been flipped yet. The rollout is gradual.
Working With Session Memory
Inspect Your Stored Memories
Browse your session memories directly:
# Find your project's memory directory
ls ~/.claude/projects/
# List all sessions for a specific project
ls ~/.claude/projects/<project-hash>/
# Read a specific session's summary
cat ~/.claude/projects/<project-hash>/<session-id>/session-memory/summary.mdMaximize What Gets Captured
The clearer the shape of a session, the richer the summary it produces:
- State your intent early: "I'm building the payment integration using Stripe" gives Claude a clear session title
- Summarize decisions explicitly: "We decided on webhook-based sync instead of polling" becomes a key result
- Ask Claude to document: "Document the architecture decisions we just made" triggers a richer extraction
Understand the Relationship With CLAUDE.md
The two systems serve different jobs and work together well:
| Aspect | Session Memory | CLAUDE.md |
|---|---|---|
| Created by | Claude (automatic) | You (manual) |
| Scope | Per-session snapshots | Persistent project rules |
| Priority | Background reference | High-priority instructions |
| Best for | Continuity, context recall | Standards, architecture, commands |
A setup that uses both is the strongest. The automatic system gives you continuity across sessions. CLAUDE.md gives you the rules Claude actually has to follow. The /remember command is the bridge, promoting patterns from one side into the other.
Next Steps
- Set up your CLAUDE.md memory system for persistent project instructions
- Explore auto memory to let Claude take its own notes about your project
- Learn context management strategies to work within token limits
- Explore context management for advanced cross-session workflows
- Understand context engineering for production AI systems
The best kind of feature is the one you stop noticing. Session Memory sits behind the session, captures the parts that deserve capturing, and puts them back in reach the next time they matter. Open a new session and find Claude already aware of yesterday's work. That is the feature quietly doing its job.
Stop configuring. Start building.
Claude Code Context Buffer
The autocompact buffer shrank from 45K to 33K tokens in early 2026. Here's what changed and how to work around it.
Auto Memory in Claude Code
Auto memory lets Claude keep running notes on your project. Here is how it works, where the files sit, and when to pick it over CLAUDE.md.