Skip to content

How to give Claude Code persistent context across separate terminal sessions? ​

Claude Code already carries context between sessions through two mechanisms: CLAUDE.md files that you write and auto memory notes that Claude writes. Anthropic says both load at the start of every conversation and act as context rather than enforced configuration (memory documentation). claude --continue serves a different purpose: it loads the most recent conversation in the current directory (CLI reference).

Each mechanism has a boundary. A memory server becomes useful when you need one server setup across projects on your machine, or memory that other tools using the same account and memory rules can reach.

TL;DR

  • Put stable project instructions in CLAUDE.md. Use ~/.claude/CLAUDE.md or ~/.claude/rules/ for personal instructions that should apply across projects on your machine.
  • Auto memory is Claude-written, enabled by default in local sessions, and stored in a project-specific memory directory. Anthropic states: “Auto memory is machine-local.”
  • Use claude --continue to load the latest conversation in the current directory. Use --resume to select a conversation from local history.
  • Add an MCP memory server at user scope only when its broader boundary is useful. Then authenticate it, add memory-use rules, and verify the labeled server tool call.
MechanismWhat it keepsWho writes itWhere it livesWhere its documented boundary appears
CLAUDE.mdInstructions and project contextYou, or Claude with your directionProject files or user-level filesProject instructions can travel through version control; personal rules apply “on your machine”
Auto memoryNotes based on corrections and preferencesClaudeA memory directory derived from the Git repositoryAnthropic states: “Auto memory is machine-local”
Saved conversationMessages, tool calls and results, subject to documented compaction behaviorClaude CodeSession history associated with a project directory--continue selects the latest conversation in the current directory
Memory MCP serverInformation written and read through server toolsThe agent under installed memory rulesThe connected memory serviceUser scope covers projects on the machine; cross-tool use depends on the service, account and rules

When you need one setup that applies in every project, or memory that other tools on the same account can reach, the next step is a memory server added at user scope. Several have a path into Claude Code, and the steps below use one of them.

Mnemoverse, which publishes this library, makes one of the memory servers mentioned here, and the step-by-step part uses it.

What does Claude Code keep between sessions on its own? ​

CLAUDE.md is Anthropic’s plain-text mechanism for instructions that Claude reads at the start of a session.

Anthropic separates persistent instructions from saved conversations. Its documentation says: “Each Claude Code session begins with a fresh context window. Two mechanisms carry knowledge across sessions: CLAUDE.md files: instructions you write to give Claude persistent context.” It then identifies auto memory as the second mechanism and says both load at the start of every conversation (memory documentation).

A project-level CLAUDE.md is appropriate for repository conventions, commands and constraints. Anthropic says project instructions can be shared with a team through version control. To create a starting file, run /init, then use /memory to refine it (commands).

Auto memory is “notes Claude writes itself based on your corrections and preferences”.

Auto memory is on by default in local sessions. Claude decides what may be useful in a future conversation, and MEMORY.md acts as an index for its memory directory. The index and topic files remain until you or Claude edits or deletes them (memory documentation).

The third mechanism is the saved conversation.

A saved conversation is a Claude Code session associated with a project directory and retained in session history.

Use:

bash
claude --continue

Anthropic defines this flag as “Load the most recent conversation in the current directory” (CLI reference). The current sessions documentation describes conversation history as messages, tool calls and results, with a compaction caveat (sessions).

These mechanisms solve different problems. CLAUDE.md carries chosen instructions. Auto memory carries Claude-written notes. A saved conversation resumes prior work.

Where does each kind of Claude Code context stop? ​

The conversation is tied to its directory. --continue selects the latest conversation there, while --resume reopens a conversation from the machine’s local history (CLI reference, Claude Code on the web).

The session picker can widen beyond the current directory. Anthropic documents Ctrl+W for all worktrees of a repository and Ctrl+A for every project “on this machine” (sessions).

Instruction files have other scopes:

  • ~/.claude/CLAUDE.md holds personal preferences for all projects.
  • Personal rules in ~/.claude/rules/ apply to every project “on your machine.”
  • A project CLAUDE.md can be shared through version control.

These scopes come from Anthropic’s memory documentation.

Auto memory has its own storage boundary. Anthropic says each project gets a directory at ~/.claude/projects/<project>/memory/. The project path is derived from the Git repository, so worktrees and subdirectories in the same repository share the directory. Its full boundary is explicit: “Auto memory is machine-local. All worktrees and subdirectories within the same git repository share one auto memory directory. Files are not shared across machines or cloud environments” (memory documentation).

You can set autoMemoryDirectory to store auto memory in a different location. Anthropic describes that setting only as a different location.

How do I make Claude Code instructions apply in every project? ​

For personal instructions, place them in:

text
~/.claude/CLAUDE.md

Anthropic classifies this file as personal preferences for all projects. For modular personal rules, use:

text
~/.claude/rules/

Anthropic says those rules apply to every project on your machine (memory documentation).

Subagents have another option. The memory field gives a subagent a persistent directory that survives across conversations, and memory: user is the documented scope for learnings across projects. This remains part of auto memory. Turning off auto memory also disables the subagent memory field (subagents).

A rule in CLAUDE.md is context, not a forced control. Anthropic states that Claude treats these files as context rather than enforced configuration. If a rule is not being followed, inspect how it is written and loaded. The distinction between instructions and enforcement is covered in how CLAUDE.md, AGENTS.md and Cursor rules work.

How do I carry what one session learned into the next? ​

If a conversation produces a durable project rule, ask Claude to “add this to CLAUDE.md,” or edit the file through /memory. Anthropic’s direct guidance is: “Add conversation-only instructions to CLAUDE.md to make them persist” (memory documentation).

Anthropic also publishes the claude-md-management plugin in claude-plugins-official. Its /revise-claude-md command captures session learnings at the end of a session. The plugin presents proposed changes as diffs and applies them only with your approval (plugin page).

Install it with:

text
/plugin install claude-md-management@claude-plugins-official

In a session, the command opens the /plugin panel on the plugin's details so you can review it and choose a scope first; user scope makes it available in every project on the machine (plugin installation). If claude-plugins-official is not on the Marketplaces tab of /plugin, Anthropic says to add it with /plugin marketplace add anthropics/claude-plugins-official (Anthropic marketplaces).

This plugin is one maintenance route, not the only inspection route. In Claude Code 2.1.283 or later, Anthropic documents /doctor prompt-audit for checking instruction files for outdated or conflicting content (memory documentation).

How does context reach another computer, a teammate or a cloud session? ​

Committed files provide the documented route for repository context. A project CLAUDE.md can travel through version control. A project-scoped .mcp.json can also be committed. Anthropic says teammates who clone the repository receive an approval prompt for the configured server (MCP quickstart).

Cloud sessions start from a fresh clone. Anthropic says committed repository content is available there and advises committing configuration that a cloud session needs (cloud environments).

Local and user-scoped MCP configuration has a separate boundary. Anthropic states: “Those write to ~/.claude.json on your machine, not the repo. Add the server with claude mcp add --scope project, which writes the repo’s .mcp.json, and commit that file” (cloud environments).

Claude Code surfaces also retain distinct session lists. Anthropic says the desktop app, claude.ai/code and the VS Code extension “each keep their own session list,” while the desktop app can resume a CLI session (sessions). On one computer, the terminal, local desktop sessions and VS Code extension read the same settings files, so a user-scoped plugin installed in one is available in the other two (plugin installation).

Do not confuse a saved conversation with shared instructions or shared memory.

When is a memory server worth adding? ​

A memory MCP server is a service that exposes memory operations to Claude Code through the Model Context Protocol.

It earns its place when its scope answers a requirement that CLAUDE.md, auto memory and saved conversations do not.

The first reason is configuration scope. Anthropic says an MCP server added without the intended scope can remain tied to the current project. Adding it at user scope makes it available across all projects on your machine while keeping it private to your user account (MCP quickstart, MCP configuration).

The second reason is cross-tool memory. Mnemoverse documents memory under the same account across supported tools. Without memory rules in each tool, the memory is there but goes unused (MCP server). Connecting a server provides tools, but does not itself make the assistant use them.

Some paths into Claude Code include:

ProviderPath named in its documentation
Anthropicclaude-md-management plugin
Mem0Plugin and Mem0 MCP server
SupermemoryClaude Code plugin and remote HTTP MCP server
CogneeCognee memory plugin, MCP integration and hosted MCP server
claude-memClaude-Mem plugin
rememberremember@dpt-plugins plugin
MnemoverseRemote MCP server and Claude Code plugin path

These are examples, not an exhaustive list. For a selection framework, see MCP memory servers for Claude Code and Cursor.

How do I connect a memory server to Claude Code, step by step? ​

The following path uses the hosted Mnemoverse MCP server.

1. Add the server at user scope ​

Run this in your shell, outside a Claude session:

bash
claude mcp add --scope user --transport http mnemoverse https://mcp.mnemoverse.com/mcp

Anthropic documents this command shape and says user scope registers a server across projects on the machine (MCP quickstart). Anthropic accepts -s as the short form of --scope (MCP configuration).

The command works the same in shells including PowerShell and Command Prompt, according to Anthropic’s quickstart.

A session that is already open does not pick up the new server. In the words of the Mnemoverse Claude Code page: "A session that was already running when the command ran does not load the new server, even when Claude ran the command for you: exit and start claude again first" (Claude Code setup).

2. Confirm that authentication is required ​

Adding the server does not start sign-in. Run:

bash
claude mcp list

Before authentication, the expected state is:

text
! Needs authentication

No memory tools are available until sign-in completes (agent setup, MCP quickstart).

3. Sign in ​

Start Claude Code, run /mcp, choose mnemoverse, then select Authenticate. The flow opens console.mnemoverse.com, where you sign in with a Mnemoverse account (remote MCP server).

Claude Code 2.1.186 or later also supports shell login (agent setup):

bash
claude mcp login mnemoverse

After authentication, /mcp reports the server as connected, and claude mcp list shows ✔ Connected (agent setup, MCP quickstart).

A free Mnemoverse account is required. Its Free plan includes the MCP server and remote connector (remote MCP server, pricing).

4. Add memory rules ​

Run:

text
/mcp__mnemoverse__setup_memory

Claude Code also exposes MCP prompts in the / menu as /servername:promptname (MCP). For this setup, that is /mnemoverse:setup_memory (MCP) (MCP configuration, agent memory).

The setup prompt presents the rules, identifies the appropriate instruction file and offers to add them. Choose the project CLAUDE.md or ~/.claude/CLAUDE.md for every project.

This step is required because connecting adds tools, not a usage habit. A request made only in chat lasts for that chat. Rules in an instruction file load at the start of later sessions (agent memory, MCP server).

5. Test the connection ​

Ask Claude to call memory_stats. A zero result is normal for a new account and still confirms that the connection works (agent memory).

An alternative setup path uses the Mnemoverse connector at https://mcp.mnemoverse.com/mcp. It works in claude.ai, Claude Desktop, mobile and Claude Code (Claude Code setup). Anthropic says connectors added at claude.ai/customize/connectors load in the CLI when you sign in with the same account, provided the active authentication method is a claude.ai subscription login (MCP quickstart, MCP configuration).

Use one path for the same endpoint: Anthropic says a server you added yourself takes precedence over a claude.ai connector with the same URL (MCP configuration). If the connector supplies the server, type / and choose the setup_memory entry marked (MCP).

How do I check which memory answered? ​

Each mechanism leaves its own signal, so check the signal rather than the answer:

text
Is the fact in a loaded instruction file?   /context → Memory files      → CLAUDE.md
Did Claude Code print "Saved / Recalled N memories"?                    → auto memory
Is there a tool call labeled with the server name?                      → the MCP server
None of these?                              current context or the model's own knowledge

CLAUDE.md ​

Run:

text
/context

Inspect the Memory files list. Anthropic documents this as the way to confirm that an instruction file loaded (memory documentation).

Auto memory ​

A general request to remember something goes to auto memory. Claude Code shows messages such as “Saved 2 memories” or “Recalled 2 memories” when it writes or reads the project memory directory (memory documentation).

MCP memory server ​

Anthropic’s test is the tool-call label: “The tool call in Claude’s output is labeled with the server name, which is how you confirm the answer came from the MCP server rather than Claude’s built-in knowledge” (MCP quickstart).

For a clean test:

  1. Temporarily disable auto memory with the toggle in /memory, or set CLAUDE_CODE_DISABLE_AUTO_MEMORY=1.
  2. Start a session and say: Remember in Mnemoverse that I prefer concise commit messages.
  3. Confirm that Claude makes a tool call labeled with the Mnemoverse server name.
  4. Start a new session and ask: What is my preference for commit messages?
  5. Confirm another tool call labeled with the server name.

The example stores a personal preference, not a project fact. Do not infer the source from the answer alone. Check the label.

Turning off auto memory also disables subagent memory, because Anthropic defines subagent memory as part of auto memory (subagents).

Why does Claude not use the memory server? ​

A common symptom is a new session answering from current context without calling the server. Check these points in order.

  1. Confirm the rules loaded. Run /context and inspect Memory files.
  2. Run the setup prompt. Use /mcp__mnemoverse__setup_memory, then place the rules in the intended CLAUDE.md.
  3. Check server scope. If /mcp is empty in a new repository, the server may have been added in local scope elsewhere. Re-add it with --scope user.
  4. Check for name shadowing. A local server with the same name takes precedence over a user-scoped server (troubleshooting).
  5. Check authentication. Signing out or changing accounts removes access to the tools. Signing back in with the same Mnemoverse account restores access (remote MCP server).
  6. Check the account. Credentials associated with another account can expose an empty store without an error (Claude Code setup).

What about two terminals open at the same time? ​

This article answers the sequential-session case. For active sessions, project-root and user-level CLAUDE.md files are read once at session start. Edited content loads after the next /clear, /compact or restart (prompt caching).

Claude Code also has cross-session messaging. Anthropic defines it as one session delivering a message to another. Its documented boundary matters: “A message is a piece of text one Claude writes to another, never the sender’s conversation history or files” (cross-session messaging).

What this page does not claim ​

No performance, latency or benchmark figure for anyone. The paths named are examples, not a list of all of them. Every quotation was read on the date given in Sources. This page answers for sequential sessions; for two sessions open at once it repeats only what Anthropic documents.

Common questions ​

How to give Claude Code persistent context across separate terminal sessions? ​

Put durable instructions in CLAUDE.md, let auto memory retain Claude-written notes, and use claude --continue when you need the latest saved conversation in the current directory. Add a user-scoped memory MCP server when you need one server configuration across projects on the machine or memory available to other tools using the same account and memory rules.

How to stop AI coding assistant from forgetting my project rules across sessions? ​

Put project rules in a project CLAUDE.md and commit it when the team should share those instructions. Use ~/.claude/CLAUDE.md or ~/.claude/rules/ for personal instructions that should apply across projects on your machine. Run /context to confirm that Claude Code loaded the expected memory files.

Why do my AI tools lose knowledge when I switch from my IDE to terminal sessions? ​

Claude Code surfaces keep their own session lists, even when some local surfaces read the same settings files. A saved conversation is different from shared instructions or account-backed memory. Use committed CLAUDE.md files for shared project instructions, or a memory server supported by both tools with memory rules installed in both.

Does Claude Code remember anything between sessions? ​

Yes. Anthropic documents CLAUDE.md files and auto memory as the two mechanisms that carry knowledge across sessions, and saved conversations separately. CLAUDE.md and auto memory load at the start of conversations, while --continue loads the most recent conversation in the current directory.

How do I add a memory MCP server to Claude Code for all my projects? ​

Run claude mcp add with --scope user from your shell, authenticate the server, install its memory rules in ~/.claude/CLAUDE.md, and test the connection. User scope makes the server available across projects on your machine.

How do I tell whether an answer came from CLAUDE.md, auto memory or a memory server? ​

Use /context to inspect loaded CLAUDE.md files, look for Claude Code’s Saved or Recalled memories messages for auto memory, and inspect the tool call label for the MCP server name. For a clean server test, temporarily disable auto memory and verify labeled server calls in a new session.

Sources ​

Anthropic ​

Mnemoverse ​

Sources read on 1 November 2026.

Edward Izgorodin · Mnemoverse · 2026-11-02