How to Make Claude Code Remember Project Context Between Sessions

# ai# claude# coding# productivity
How to Make Claude Code Remember Project Context Between SessionsAbdeljabbar Elassali

Everyone hacks Claude Code memory with markdown files and plugins. Here's an honest breakdown of every method, from CLAUDE.md to handoff files to a real persistent memory layer.

How to Make Claude Code Remember Project Context Between Sessions

Quick answer: Claude Code starts every session with a fresh context window. The common fixes are CLAUDE.md files, /remember handoff notes, and community memory plugins with session hooks. They all work locally and manually. If you want memory that persists automatically, is searchable, and follows you to other tools, connect an external memory layer over MCP. Details on every option below.

The actual problem

Claude Code is stateful within a session and amnesiac between them. Close the session, compact the context, start a new machine, and it's gone: the architecture decision from Tuesday, the bug you already diagnosed, the convention you agreed on. For real projects, this means paying the re-explanation tax every single day.

Option 1: CLAUDE.md (the baseline everyone should use)

A CLAUDE.md file in your project root gets loaded into context automatically. Put your stack, conventions, commands, and gotchas there. It's the highest-ROI five minutes in Claude Code.

Limits: it's static. It doesn't record what happened, only what you wrote down by hand. And it never leaves the repo.

Option 2: handoff files and the /remember pattern

The community converged on a pattern: before ending a session, have Claude write a handoff note (what's done, what's next, non-obvious context) to a file like .remember/remember.md, and read it back next session. Several plugins automate this with hooks:

  • SessionStart hooks load memory files into context when a session begins.
  • PostToolUse hooks auto-save session state when enough has changed.
  • Status line shows context usage so you know when to save and compact.

Popular implementations include the various claude-remember plugins on GitHub. They work, and they're a genuine improvement over nothing.

Limits, honestly assessed:

  • Everything is local files. New machine, new clone, no memory. Nothing syncs.
  • No real retrieval. It's file concatenation, not semantic search. Your context window fills with everything, relevant or not.
  • Manual discipline. The pipeline captures what happened only if the hooks fire and the files stay maintained. Rotten handoff files are worse than none.
  • Claude-Code-only. Your ChatGPT, Cursor, and Codex sessions never see any of it.

Option 3: --resume and session forking

Claude Code can resume previous sessions. Useful, but it's the same machine, the same project, and you're resuming a conversation, not querying a memory. It doesn't compose knowledge across sessions or tools.

Option 4: an external memory layer over MCP (what I switched to)

The setup I actually kept is Vilix AI, a persistent memory layer that Claude Code talks to over MCP (Model Context Protocol). Why it beats the file-based approaches:

It's automatic, not ceremonial. You connect Vilix AI once as an MCP server in Claude Code. Every turn runs a memory loop: get_context loads relevant memories before the reply, save_turn persists the exchange after. No /remember incantations, no hook scripts to maintain.

It retrieves instead of dumping. Memories are indexed with semantic and keyword search. A new session pulls what's relevant to the current task, not the entire .remember/ directory. Your context window stays lean.

It stores structured state, not just notes. Beyond conversation history, it holds projects and tasks (what's done, what's next) and rules, both personal user_rules and per-project project_rules like stack and conventions. That's the stuff you'd otherwise retype into every handoff file.

It leaves Claude Code. Same memory serves ChatGPT, Cursor, Codex, Grok, Manus, and your phone. Explain your project once, in any tool, and Claude Code already knows it next session. The memory is server-side in your account, so it survives machine switches, fresh clones, and context compactions.

A concrete before/after

Before: Monday I architect an API route in Claude Code. Tuesday's session starts blank. I paste the handoff file, which is now 400 lines, half stale. I spend 15 minutes re-explaining anyway.

After: Monday's session saved its turns automatically. Tuesday I just start working. When I ask about the route, the relevant decisions surface on their own. When I switch to Cursor in the afternoon, it's all still there.

Which option should you pick?

  • Solo dev, one machine, small projects: CLAUDE.md + a handoff file is fine. Don't over-engineer.
  • You like tinkering: the claude-remember style plugins with hooks are a fun, capable setup.
  • You work across tools, devices, or with a team: files don't cut it anymore. Connect a memory layer over MCP. I use Vilix AI, free to try, and it's the first setup that survived contact with my actual workflow.

Markdown files were the prototype. A real memory layer is the product.