---
title: "Memory layer, give your AI persistent memory across sessions | Recipe — StudioMeyer Academy"
description: "Claude Code's built-in memory is per-project. Codex has none. Adding mcp-nex (or local-memory-mcp) gives you durable, searchable memory that works across every MCP client you use."
canonical: "https://studiomeyer.academy/en/recipes/2.2-memory-layer"
language: en
markdown_versions: ["https://studiomeyer.academy/en/recipes/2.2-memory-layer.md"]
publisher: "StudioMeyer Academy, https://studiomeyer.academy (llms.txt: https://studiomeyer.academy/llms.txt)"
---

[← Alle Recipes](https://studiomeyer.academy/recipes)

Phase 2 · Connectivity·4 steps

# Memory layer, give your AI persistent memory across sessions

Claude Code's built-in memory is per-project. Codex has none. Adding mcp-nex (or local-memory-mcp) gives you durable, searchable memory that works across every MCP client you use.

4 steps0%

Du liest ohne Account. Mit [Login](https://studiomeyer.academy/login?next=/recipes/2.2-memory-layer) speichern wir Step-Fortschritt + Notes.

# Memory layer

Claude Code 2026 ships with auto-memory (per-project notes in `~/.claude/projects/.../memory/`). It's good for "build commands and conventions" but bad for cross-project state, fuzzy search, or sharing memory between Claude Code, Codex, and Cursor.

A dedicated memory MCP server fixes that. Two paths:

1. **SaaS (recommended for cross-device):** sign up at memory.studiomeyer.io, get an API key via magic link, point your MCP clients at the URL. Frankfurt-hosted, multi-tenant, OAuth 2.1.
2. **Local stdio (recommended for privacy):** install `local-memory-mcp` from npm, runs in-process, data lives in `~/.local-memory/`. No account, no cloud.

Both expose roughly the same tools (`nex_search`, `nex_learn`, `nex_recall`, `nex_decide`, knowledge-graph entities). Same API, different storage.

### Step 1: Pick a path. SaaS or local

If you switch between machines (laptop + desktop, work + home), use SaaS. Memory follows you.

If you only work on one machine and want zero cloud, use local. No sign-up, no account.

You can have both, local for personal stuff, SaaS for shared / cross-device. They are independent MCP servers and don't sync.

## Step 2A: Local install (privacy path)

```bash
claude mcp add memory -s user -- npx -y local-memory-mcp
```

Restart your Claude Code session. Memory data lives in `~/.local-memory/`. Free, private, fast.

For Codex, in `~/.codex/config.toml`:

```toml
[mcp_servers.memory]
command = "npx"
args = ["-y", "local-memory-mcp"]
```

## Step 2B: SaaS install (cross-device path)

```bash
claude mcp add --transport http memory https://memory.studiomeyer.io/mcp
```

For Codex:

```toml
[mcp_servers.memory]
url = "https://memory.studiomeyer.io/mcp"
```

The first tool call from a fresh client triggers a magic-link flow:

1. Browser opens to memory.studiomeyer.io with a code-challenge
2. You enter your email
3. Magic link arrives (Resend SMTP, ~5 sec)
4. Click link → token issued → MCP client stores refresh token (30-day TTL)

No password, no API key in config. The OAuth handshake is the auth.

### Step 2: Smoke-test from Claude Code

Open a fresh Claude Code session and try:

```
"remember that this project uses Next.js 16 with the App Router"
```

Claude calls `nex_learn` with the content. Then:

```
"what do you remember about this project?"
```

Claude calls `nex_search` and the previous learning comes back. Memory works.

### Step 3: Verify

Run `academy_validate_step`. The validator runs `claude mcp list` and looks for any server matching `memory|nex|local-memory`. If you installed both SaaS and local, you'll see two entries.

### Step 4: First memory hygiene

Don't blindly say "remember everything I tell you". The memory store gets noisy fast.

Three good habits:

1. **Be explicit about importance.** Say "save this as a learning" or "store this in memory". A trigger phrase helps the AI pick the right tool (`nex_learn` vs nothing).
2. **Project-tag everything.** When you save a learning, mention the project name in the content. Memory tools support project filters, useful when you have a memory store across 10 projects.
3. **Search before you save.** "Did I already store something about X?" → if yes, update; if no, save fresh. The gatekeeper inside `nex_learn` does this automatically with similarity-matching, but it helps to think about it.

Memory is the single highest-leverage MCP server you can install. Every other recipe in this guide is more useful with persistent memory because the AI remembers what you've already done.

[← Your first MCP server, claude](https://studiomeyer.academy/recipes/2.1-first-mcp) [Web research. Brave, Exa, and →](https://studiomeyer.academy/recipes/2.3-web-research)

Phase 2

Your first MCP servers (Memory, Research, GitHub, Code Intel)

[Alle Phasen →](https://studiomeyer.academy/recipes)

Concepts

[Memory basics](https://studiomeyer.academy/concepts/memory_basics) [claude mcp add](https://studiomeyer.academy/concepts/mcp_install)

## Sitemap

Public pages of this site as Markdown: [sitemap](https://studiomeyer.academy/sitemap.md). Curated entry point: [llms.txt](https://studiomeyer.academy/llms.txt), full text: [llms-full.txt](https://studiomeyer.academy/llms-full.txt).
