How to Make Claude Code Remember Everything Between Sessions

Claude Code forgets everything when you close it.

April 15, 2026

How to Make Claude Code Remember Everything Between Sessions

TL;DR: Claude Code forgets everything when you close it. Two built-in commands fix this: /memory saves your project context between sessions, and /compact compresses long conversations to keep Claude fast and reduce token usage.


If you’ve ever opened Claude Code and had to re-explain your entire project from scratch, you’ve experienced the biggest frustration of working with AI coding agents. Every session starts at zero. Claude doesn’t remember your project, your decisions, what you built yesterday, or where you left off.

Two commands fix this completely, and most Claude Code users don’t know they exist.

The Problem

Claude Code sessions are independent by default. Close the window, and everything from that conversation is gone. The next session has no idea what you were working on. So you spend the first 5-10 minutes of every session re-explaining your project, your tech stack, what you’ve already built, and what you’re trying to do next.

This wastes time and burns tokens on context that Claude should already have.

Command #1: /memory

The /memory command tells Claude to save everything important about your current session. It captures your project details, architecture decisions, what you’ve built so far, known issues, and where you left off.

This gets stored in your project so the next time you open Claude Code in the same directory, it automatically loads that context. Claude already knows what’s going on before you type a single word.

When to use /memory:

  • Before closing any session (most important)
  • After making significant architecture decisions
  • After completing a major feature or milestone
  • When you want Claude to remember something specific for future sessions

You can also manually edit the memory file (CLAUDE.md in your project root) to add permanent context that Claude should always know - coding standards, project architecture, API key locations, team conventions.

Command #2: /compact

The /compact command compresses your entire conversation into a condensed summary. In long sessions, Claude’s context window fills up with old messages, code blocks, error logs, and debugging back-and-forth. This slows Claude down and wastes tokens because it has to re-read everything to stay current.

Running /compact clears the old conversation and replaces it with a tight summary of what matters. Claude keeps all the important context but drops the noise.

When to use /compact:

  • When your conversation gets long (50+ messages)
  • When Claude starts forgetting things you said earlier in the session
  • When responses slow down noticeably
  • After finishing one phase and before starting the next
  • Anytime Claude seems to be “losing the plot”

The Token Reduction Bonus

Using /compact regularly reduces your token usage significantly. Instead of Claude re-reading a 200-message conversation every time it responds, it reads a compressed summary. Fewer input tokens means lower costs and faster responses.

Pair /compact with /memory and your sessions stay fast, focused, and consistent across days and weeks.

The Workflow

Here’s how to combine both commands for the best experience:

  1. Start of session - Claude automatically loads your memory. Review it and correct anything outdated.
  2. During long sessions - Run /compact every 30-50 messages to keep things lean.
  3. After milestones - Run /memory to save the new project state.
  4. Before closing - Always run /memory. This is the most important habit.
  5. For permanent context - Edit CLAUDE.md directly in your project root.

FAQ

Does /memory work across different projects? Yes, but each project keeps its own memory. The context saved in one project directory won’t bleed into another.

Will /compact lose important information? No. It creates a summary of the key decisions, current state, and what you’re working on. The raw conversation text is compressed, but the important context is preserved.

How much does /compact reduce token usage? It depends on how long your conversation is. A 200-message session compressed to a summary can reduce input tokens by 70-80% on subsequent responses.

Can I see what Claude remembers? Yes. Check the CLAUDE.md file in your project root. This is where memory is stored. You can read it, edit it, or add to it directly.

Do I need to run both commands every session? /memory before closing is the essential one. /compact is for long sessions that start slowing down. Short sessions may not need /compact at all.