Every time you start a new AI session, it forgets everything. MemPalace fixes that — a free, open-source memory layer that gives Claude Code, Claude Desktop, LM Studio, Cursor, and VSCode a shared, searchable, persistent brain. No API key. No cloud. Everything stays on your machine. Here’s how to set it up in under 25 minutes.
Why Your AI Keeps Forgetting — and How to Fix It
Every time you open a new conversation with an AI assistant, you start from zero. It doesn’t remember the project you described last Tuesday, the tech stack decision you made yesterday, or the client context you’ve explained a dozen times. That’s not a model problem — it’s a memory architecture problem.
MemPalace (famously backed by actress Milla Jovovich) solves it by giving your AI a local, structured, semantically-searchable memory that persists between sessions. You configure it once, and from that point your AI accumulates real knowledge about your work.
The mental model is a filing cabinet: Wings are your projects or clients, Rooms are topics within a project, and Drawers hold individual memories. Retrieval is semantic — you ask in plain language, not with exact keywords, and it finds what’s relevant.
It works with Claude Code, LM Studio, and other MCP-compatible tools. Everything is stored locally — no cloud account, no API key, no subscription.
Once you are done installing and setting everything up, you can even keep MemPalace in sync, on all your machines, using the mempalace-cloud-sync open-source script I made, for free!
Prerequisites
- Python 3.9 or higher (3.11+ recommended)
- One or more of: Claude Code, Claude Desktop, LM Studio 0.3.5+ (this is the only 100% private method, where your memories never leave your PC), Cursor, or VSCode 1.99+ with the GitHub Copilot extension
- ~300 MB free disk space (for the local sentence-transformer model)
- A terminal (PowerShell on Windows, Terminal on macOS/Linux)
Part 1 — Install MemPalace
Option A: pip (simplest)
pip install mempalace
Option B: uv
uv tool install mempalace
On first run, MemPalace downloads an ~80 MB sentence-transformer model for semantic search. This happens once — subsequent launches are instant.
Verify the install:
python -c "import mempalace; print(mempalace.__version__)"
You should see
3.3.5
or higher.
The Palace Structure
MemPalace creates a config folder at
~/.mempalace/
(Windows:
C:\Users\YourName\.mempalace\
). Open
mempalace.yaml
to see your Wings:
wing: .mempalace
rooms:
- name: general
description: All project files
keywords: []
- name: work
description: Work Projects
keywords:
- work
- name: personal
description: Personal Projects
keywords:
- personal
Wings are top-level projects or people. Rooms are topics within a wing. Drawers are individual memory entries. You can add wings and rooms freely by editing this YAML file.
Part 2 — Wire MemPalace with Claude Code
Step 1: Register the MCP server
claude mcp add mempalace -- python -m mempalace.mcp_server
python
is not in your PATH, use the full executable path:
claude mcp add mempalace -- "C:\Users\YourName\AppData\Local\Programs\Python\Python313\python.exe" -m mempalace.mcp_server
To find your path, run
where python
in PowerShell.
Step 2: Verify the connection
claude mcp list
You should see
mempalace
listed with a ✓ Connected status.
Step 3: Restart Claude Code
Close and reopen Claude Code so it picks up the new server. After restart, MemPalace’s 29 tools become available in every conversation.
Most-used tools Claude gains access to
| Tool | What it does |
|---|---|
mempalace_search
| Semantic search across all memories |
mempalace_status
| Overview of your palace — stats and wings |
mempalace_list_wings
| List all wings and their rooms |
| Drawer tools | Store, retrieve, update, delete individual memories |
| Tunnel tools | Navigate cross-wing context — e.g. a client who spans multiple projects |
Step 4: Tell Claude to actually use it (CLAUDE.md)
Claude Code reads a file called
CLAUDE.md
at the start of every session. Adding a MemPalace section there gives Claude clear rules for when to write and when to read — no manual prompting needed.
Open (or create) the file at
~/.claude/CLAUDE.md
and add:
## MemPalace Memory — Read and Write Rules
MemPalace is a local semantic memory MCP server. Use it to persist conversation context progressively.
### When to WRITE (proactive — do this automatically)
Save memories incrementally as a conversation unfolds — not just at the end. Any time
something worth keeping comes up, write it immediately:
- Decisions made or rationale explained
- Tools configured, commands run, file paths used
- Project context, client details, preferences stated
- Problems solved and how
Use the most relevant wing (work, personal, general) and room. Create new rooms if none fit.
Do not wait to be asked.
### When to READ (on demand only — do NOT search automatically)
Only search MemPalace when the user explicitly asks you to recall something:
- "do you remember…"
- "last time we…"
- "what did we decide about…"
- "can you recall…"
Do NOT search at the start of conversations or proactively. Wait to be asked.
### Tools
- mempalace_search — semantic search, natural-language query
- mempalace_status — palace overview
- mempalace_list_wings — list wings and rooms
- tool_add_drawer — save a memory (wing, room, content)
With this in place, Claude writes memories quietly as you work — no prompting required. It won’t flood the start of each session with lookups either; it only searches when you ask it to remember something specific.
myapp_1.46.0
→
myapp_1.47.0
), add one line to the project’s own
CLAUDE.md
(or create one in the project root):
mempalace_room: myproject
Claude Code loads both the global and project-level CLAUDE.md simultaneously, so it will see the room declaration and use that room automatically — no matter what the folder is called.
Part 3 — Wire MemPalace with LM Studio
Step 1: Locate the MCP config file
| Platform | Path |
|---|---|
| Windows |
C:\Users\YourName\.lmstudio\mcp.json
|
| macOS / Linux |
~/.lmstudio/mcp.json
|
If the file doesn’t exist yet, create it.
Step 2: Add the MemPalace entry
Open
mcp.json
and add the
mempalace
block inside
mcpServers
. If the file is empty, use this as your starting template:
{
"mcpServers": {
"mempalace": {
"command": "python",
"args": ["-m", "mempalace.mcp_server"]
}
}
}
If you already have other MCP servers configured, add the entry alongside them:
{
"mcpServers": {
"some-other-server": { ... },
"mempalace": {
"command": "python",
"args": ["-m", "mempalace.mcp_server"]
}
}
}
python
is not recognized globally, use the full path with double backslashes:
"command": "C:\\Users\\YourName\\AppData\\Local\\Programs\\Python\\Python313\\python.exe"
Step 3: Load it in LM Studio
- Open LM Studio
- Go to the Program tab in the right sidebar
- Click Install → Edit mcp.json
- Save the file — LM Studio auto-detects the change, no restart required
Step 4: Tell your LM Studio model to use it
In the Chat tab, open the system prompt field for the model you use most and add:
You have access to a MemPalace MCP server that gives you persistent semantic memory.
Write rules (automatic — do not wait to be asked):
- As the conversation unfolds, save anything worth keeping to the right wing and room:
decisions, configurations, file paths, project context, preferences, problems solved.
- Save incrementally as topics come up, not just at the end of the session.
- Use mempalace_list_wings first to pick the right location before writing.
Read rules (on demand only):
- Only search MemPalace when the user explicitly asks you to recall something —
"do you remember...", "last time we...", "what did we decide about...".
- Do NOT search automatically at the start of conversations.
- When asked to recall, use mempalace_search with the user's keywords.
Save as a preset — this prompt carries across all future sessions with that model.
The current project's MemPalace room is: myproject
. Update it when you switch projects.Part 4 — Wire MemPalace with Claude Desktop
Step 1: Locate (or create) the config file
| Platform | Path |
|---|---|
| Windows |
%APPDATA%\Claude\claude_desktop_config.json
|
| macOS |
~/Library/Application Support/Claude/claude_desktop_config.json
|
If the file doesn’t exist, create both the
Claude
folder and the file. Claude Desktop reads this file on every launch.
Step 2: Add the MemPalace entry
Claude Desktop uses the same
mcpServers
format as LM Studio and Cursor:
{
"mcpServers": {
"mempalace": {
"command": "python",
"args": ["-m", "mempalace.mcp_server"]
}
}
}
"command": "C:\\Users\\YourName\\AppData\\Local\\Programs\\Python\\Python313\\python.exe"
Step 3: Restart Claude Desktop
Fully quit and reopen the app. You can confirm it’s working by clicking the tools icon (hammer icon) in the chat input — MemPalace tools should appear in the list.
Step 4: Tell Claude to use it
Claude Desktop doesn’t have a global system prompt file like CLAUDE.md. The best approach is to use a Project:
- Open Claude Desktop and click New Project
- Open the project’s Instructions field
- Paste in the MemPalace memory rules:
You have access to a MemPalace MCP server that gives you persistent semantic memory.
Write rules (automatic — do not wait to be asked):
- As the conversation unfolds, save anything worth keeping to the right wing and room:
decisions, configurations, file paths, project context, preferences, problems solved.
- Save incrementally as topics come up, not just at the end of the session.
- Use mempalace_list_wings first to pick the right location before writing.
Read rules (on demand only):
- Only search MemPalace when the user explicitly asks to recall something —
"do you remember...", "last time we...", "what did we decide about...".
- Do NOT search automatically at the start of conversations.
All conversations inside that project will follow these rules automatically. Create one project per client or domain to keep context well-organised.
mempalace_room: myproject
. Claude Desktop reads the Instructions on every conversation start, so it will always write to and search the right room without guessing.Part 5 — Wire MemPalace with Cursor
Step 1: Locate (or create) the global MCP config
| Platform | Path |
|---|---|
| Windows |
C:\Users\YourName\.cursor\mcp.json
|
| macOS / Linux |
~/.cursor/mcp.json
|
Step 2: Add the MemPalace entry
Cursor uses the same
mcpServers
format as LM Studio — no
type
field needed:
{
"mcpServers": {
"mempalace": {
"command": "python",
"args": ["-m", "mempalace.mcp_server"]
}
}
}
"command": "C:\\Users\\YourName\\AppData\\Local\\Programs\\Python\\Python313\\python.exe"
Step 3: Restart Cursor
Fully quit and reopen Cursor. Open a chat in Agent mode — MemPalace tools will now appear in the tool list.
Step 4a: Set the global behavior rule (once — applies to every project)
Go to Cursor Settings → Rules → User Rules and paste the following. This tells Cursor’s AI exactly when to write, when to read, and how to figure out which MemPalace room belongs to the current project — automatically, for every codebase you open.
## MemPalace (Persistent Memory)
Use the `mempalace` MCP server for all persistent memory.
### Project room detection (in order — stop at first match)
1. Active project rule declares `mempalace_room: <name>` → use that name exactly
2. Run `git remote get-url origin` → take the last path segment, strip `.git` and any
trailing version suffix (_1.2.3, -v1.46, _1.46.0 etc.) → use the result
3. Use the current working directory folder name, stripping version suffixes the same way
4. None of the above work → ask the user once: "What should I call this project in
MemPalace?" — save their answer as a memory immediately
### Write proactively — don't wait to be asked
Save to MemPalace during the session whenever:
- A significant decision is made or rationale explained
- A tool is configured, command pattern discovered, or important file path established
- A non-obvious bug is solved or workaround found
- Architecture, workflow, or project structure is clarified
- The user states a preference or constraint
### Read on demand — only when triggered
Search MemPalace when:
- User says "do you remember", "last time", "what did we decide", "can you recall"
- Starting a complex multi-step task where prior context would clearly change the approach
### Tools
- Write: mempalace_add_drawer(wing, room, content) — use wing `work` for project memories
- Search: mempalace_search(query) — scope to the detected project room first
That’s the only global step. Cursor reads these User Rules in every session across every project — you never need to touch them again.
Step 4b: Pin the room name per project (optional — eliminates all guessing)
The global rule above can auto-detect project names from the git remote URL or folder name. But if your project folder changes with version bumps (e.g.
myapp_1.46.0
→
myapp_1.47.0
), or if your git repo name doesn’t match what you call the project, auto-detection can give inconsistent results. The fix is a single line in the project’s Cursor rules.
Option A — Add to your existing project rule (the cleanest approach if you already have a
.cursor/rules/myproject.mdc
):
mempalace_room: myproject
Just drop that line anywhere in the rule body. The global User Rule reads it and uses that room.
Option B — Create a dedicated file (if you have no project rules yet):
---
description: MemPalace room for this project
alwaysApply: true
---
mempalace_room: myproject
Save it as
.cursor/rules/mempalace.mdc
in the project root. Cursor loads it automatically on every session, regardless of what the folder is named — so when you clone
myapp_1.47.0
, the right room is picked up immediately with zero manual steps.
Part 6 — Wire MemPalace with VSCode
Step 1: Locate (or create) the global MCP config
| Platform | Path |
|---|---|
| Windows |
%APPDATA%\Code\User\mcp.json
|
| macOS |
~/Library/Application Support/Code/User/mcp.json
|
| Linux |
~/.config/Code/User/mcp.json
|
You can also add servers via the Command Palette: MCP: Add Server.
Step 2: Add the MemPalace entry
VSCode uses a
servers
key (not
mcpServers
) and requires an explicit
"type": "stdio"
field:
{
"servers": {
"mempalace": {
"type": "stdio",
"command": "python",
"args": ["-m", "mempalace.mcp_server"]
}
}
}
"command": "C:\\Users\\YourName\\AppData\\Local\\Programs\\Python\\Python313\\python.exe"
Step 3: Restart VSCode
Fully quit and reopen VSCode. In the Copilot Chat panel, switch the mode selector to Agent. MemPalace tools will now be available.
Step 4: Tell Copilot to use it
Create the file
.github/copilot-instructions.md
in your project root — Copilot reads it automatically in Agent mode:
## MemPalace Memory — Read and Write Rules
mempalace_room: myproject
MemPalace is a local semantic memory MCP server. Use it to persist conversation context progressively.
Write rules (automatic — do not wait to be asked):
- Save decisions, configs, file paths, project context, preferences, and problems solved.
- Save incrementally as topics come up, not just at the end.
- Use mempalace_list_wings to pick the right wing and room before writing.
- Always write to the room declared above (mempalace_room).
Read rules (on demand only):
- Only search MemPalace when the user explicitly asks to recall something.
- Do NOT search automatically at the start of conversations.
Replace
myproject
with your actual project name. This file travels with the repo — when you move to a new version folder, Copilot picks up the same room name automatically.
For a global rule that applies across all projects, go to VSCode Settings → search “copilot instructions” and add the write/read rules (without the
mempalace_room
line) under
github.copilot.chat.codeGeneration.instructions
.
Troubleshooting
“Cannot import chromadb” error on first launch
This is a known version conflict between chromadb and the opentelemetry packages. Fix it by running:
pip install --upgrade "opentelemetry-sdk>=1.41.0" "opentelemetry-exporter-otlp-proto-common>=1.41.0"
Then retry starting the MCP server.
Claude Code shows mempalace as disconnected
Run
where python
(Windows) or
which python
(macOS/Linux) to get your exact Python path, then update the MCP command to use the full path instead of just
python
.
LM Studio doesn’t pick up the server
Double-check your JSON syntax — a missing comma or unescaped backslash will silently break it. Paste your
mcp.json
into jsonlint.com to validate before saving.
What’s Next
Once MemPalace is running across your tools, Claude Code, Claude Desktop, LM Studio, Cursor, and VSCode all share the same persistent memory store. A decision you logged in a Claude Code session is searchable from Claude Desktop, Cursor, or Copilot — and vice versa. Over time your AI accumulates real context about your work instead of starting fresh every session.
A few ideas to get started:
- Create a Wing per client or major project
- Ask Claude to summarize and save key decisions at the end of each work session
- Use
identity.txtin~/.mempalace/to store standing context you always want the AI to know — your tech stack, team preferences, recurring constraints
MemPalace is open source and free: github.com/mempalace/mempalace