Long-term memory for OpenClaw with MemPalace
We give the assistant a second memory it can search by meaning across your notes and documents. It lives on your machine, connects through MCP and starts read-only. Along the way we say what gets stored and how to delete it.
mempalace mcp --port 5000. In the documentation that command only prints how to set up your client, while the server is python -m mempalace.mcp_server, which talks over standard input and output with no port. The import script: the Palace class and the add_memory and get_memory methods are not in the documented interface; we replaced the script with the documented mempalace mine and mempalace search. OpenClaw: openclaw mcp set is officially documented; we added the mcp doctor --probe check and a tool filter so you can start read-only. New sections: when you need an add-on at all (OpenClaw has its own built-in memory), a warning about impostor sites, and a section on personal data and deletion. We removed names of people and partners from the examples, internal paths and the n8n automation.
01What you'll learn
- How OpenClaw remembers on its own, and when adding MemPalace is worth it.
- What MemPalace really is, where to get it safely and which version it is.
- How to install it in an isolated environment and build your first memory with
init,mineandsearch. - How to register it in OpenClaw through MCP and give it read-only tools first.
- How to ask the assistant so it answers from memory instead of guessing.
- What personal data is collected, where it goes and how to delete it (a GDPR note).
02Before you start
- A working OpenClaw — see Lesson 3. You will also use the
openclaw mcp …commands. - Ubuntu (WSL2 or another Linux) with Python 3.9+ and
venv. About 300 MB free and network access for the first download of the search model. - A folder of notes you are allowed to index. For the first try, make a small folder with a few text or Markdown files.
- Decide which model reads the memory: local 🔒 local or cloud 🌐 global. Recalled passages go into the request to the model, and with a cloud model they go to its provider (more in step 7).
03Steps
-
When you need MemPalace
OpenClaw already has a memory. It is plain Markdown files in the agent workspace:
MEMORY.mdfor durable facts,memory/DATE.mdfor daily notes and optionallyUSER.mdfor preferences. It is searched with the built-inmemory_search. Why does this matter? For most people that is enough, and every add-on is one more thing to keep and secure.Your need What to use The assistant remembers preferences and decisions from conversations OpenClaw's built-in memory Search by meaning across thousands of pages of notes, documents or old conversations MemPalace (or another memory add-on) Facts with dates: "who decided what, and when it stopped being true" MemPalace's temporal graph If you are in neither of the last two rows, stop here and use the built-in memory.
-
What MemPalace is and where we get it
MemPalace is an open-source project for local AI memory. It stores verbatim text (it does not summarise) and searches it by meaning. It arranges it into wings (a project or a person), rooms (topics) and drawers (the original content). It also has a temporal graph of facts in a local SQLite database. This is what we checked:
What As of 01.10.2026 Repository github.com/MemPalace/mempalace Package PyPI: mempalace, version 3.10.0 (released 16.09.2026)Licence MIT Documentation mempalaceofficial.com MCP Yes — 45 tools according to the documentation Needs Python 3.9+, ChromaDB (comes with the package), about 300 MB for the search model; no AI key ✅Official places onlyThe authors explicitly warn that other sites (for examplemempalace.tech) are impostors and may distribute malware. Install only from PyPI or the official repository and do not run scripts from other addresses.ℹ️About the advertised numbersThe project publishes search benchmark results. They are its own, and we do not repeat them as fact; on your Bulgarian notes the result may differ. Test with your own examples (step 4). -
Install in an isolated environment
Why a virtual environment? The package pulls in several large dependencies; in a separate environment they do not mix with your other programs and are removed with one line. In Ubuntu:
bash · in Ubuntusudo apt install python3-venv python3-pip -y python3 -m venv ~/.venvs/mempalace source ~/.venvs/mempalace/bin/activate pip install mempalace pip show mempalacepip showprints the installed version; write it down. The project also recommendsuv tool install mempalaceorpipx, but the next steps rely on a known path to the environment's Python, so we use a virtual environment here.⚠️The first search downloads a modelOn first need for embeddings the package downloads a model: about 80 MB for the English-only one and about 300 MB for the multilingual one the project recommends. You need network access. The model is chosen in the first-run setup (python -m mempalace.onboarding); changing it later requires rebuilding the index. For Bulgarian text pick the multilingual one. ⚠️ We have not run it. -
Your first memory: init, mine, search
Make a small folder with a few notes (in Ubuntu, not under
/mnt/c) and go through the three documented commands.initscans the folder and writes anentities.jsonfile into it, so run it on a scratch folder.bashmkdir -p ~/memory-test # put a few .md or .txt files with your own sample notes in the folder source ~/.venvs/mempalace/bin/activate mempalace init ~/memory-test mempalace mine ~/memory-test --wing notes --dry-run mempalace mine ~/memory-test --wing notes mempalace search "what did we decide about the deadline" --wing notes--dry-runonly shows what would be stored. Always run it first.--wing notesis the name of the wing — one project, one topic.searchreturns verbatim passages with a similarity score. If the results do not satisfy you, the memory is not ready for the assistant yet.
When you add or delete files, run
mineagain on the folder. ⚠️ The documentation does not say clearly what happens on a repeat run over changed files, so look with--dry-runfirst. Cleaning out records of deleted files is a separate tool (mempalace_sync, see step 7).Optional — regular refresh. The old lesson ran the import on a schedule with
cron. The idea is useful, but switch it on only after a--dry-runhas shown that re-runningmineon the same folder does not duplicate records. Example (every 6 hours, replaceYOUR_LINUX_USER):crontab -e · line to add0 */6 * * * /home/YOUR_LINUX_USER/.venvs/mempalace/bin/mempalace mine /home/YOUR_LINUX_USER/memory-test --wing notes >> /home/YOUR_LINUX_USER/mempalace-mine.log 2>&1 -
Connect to OpenClaw through MCP
MCP is the common "socket" through which the assistant calls tools. MemPalace's server is launched by the client itself as a child process (
python -m mempalace.mcp_server) and talks over standard input and output. There is no open port, so there is nothing to defend from outside. Register it with the full path to the environment's Python (replaceYOUR_LINUX_USER):bashopenclaw mcp set mempalace '{"command":"/home/YOUR_LINUX_USER/.venvs/mempalace/bin/python","args":["-m","mempalace.mcp_server"]}' openclaw mcp doctor mempalace --probe openclaw mcp show mempalacedoctor --probechecks both the saved entry and that the server really starts and lists tools. By default the memory is in~/.mempalace; set another location with"--palace","PATH"inargs.Now limit the rights. The server carries 45 tools and some of them delete and change things. Start with reading only:
bashopenclaw mcp tools mempalace --include 'mempalace_status,mempalace_search,mempalace_list_wings,mempalace_list_rooms,mempalace_get_taxonomy,mempalace_get_drawer,mempalace_list_drawers,mempalace_kg_query,mempalace_kg_timeline' openclaw gateway restartℹ️Why this wayThis is the same "least privilege" principle as in Lesson 3. The writing tools (add_drawer,delete_drawer,kg_addand others) you open one at a time, when you have a reason. The filter is removed withopenclaw mcp tools mempalace --clear, the whole server withopenclaw mcp unset mempalace.⚠️What to know about OpenClawAccording to the documentation, embedded OpenClaw shows MCP tools in thecodingandmessagingprofiles, whileminimalhides them;tools.deny: ["bundle-mcp"]switches them all off. ⚠️ We have not checked how it behaves with Discord and with the sandbox from Lesson 3. If the tools do not appear, runopenclaw mcp status --verbose, watch the logs withopenclaw logs --follow | grep -i mempalaceand see "Sources".There is also a container (
ghcr.io/mempalace/mempalace) that you hand to the client as a stdio server. This lesson does not use it; see the project's documentation. -
How to ask the assistant
After connecting, the assistant has the memory's tools. The first call to
mempalace_statusgives it a "memory protocol": before answering about a person, a project or a past event, search, do not guess. Try it in your channel (mentioning the bot), with your own data, not someone else's:text · in DiscordSearch the memory for what we decided about the project deadline and show me the passage and its source.text · in DiscordWhich wings and rooms are in the memory? Show me only the names and counts.text · in DiscordSearch the "notes" wing only for entries from the last three months about "budget".The last example relies on the
sinceandbeforefilters ofmempalace_search: they look at when it was filed into memory, not when the document was written. The temporal graph (mempalace_kg_query,mempalace_kg_timeline) is a different thing — facts with a start and an end of validity, which fill up with facts added throughkg_add. ⚠️ We did not check whetherminefills it on its own.The negative test: ask something that is certainly not in the memory. A good result is "not found", not an invented answer. If the assistant answers confidently without a source, do not trust it and go back to step 4: check the search in the terminal first.
-
Personal data: what is stored and how to delete it
This step is not legal advice but a working minimum. If you use the memory purely for personal purposes, data protection rules may not apply to you directly; if you use it for work, clients or a team, they do. The basics are in the GDPR: collect only what is needed (Art. 5(1)(c)), keep it only as long as needed (point (e)) and erase on a justified request (Art. 17).
What Where it is How to remove it Verbatim text of everything you indexed — including names, contacts and anything else in it The memory folder, by default ~/.mempalace/palacemempalace_delete_by_sourceremoves everything from one file,mempalace_delete_drawerone drawer (irreversible)Paths of the source files and the names of wings and rooms In the same records As above Facts in the temporal graph (people, relations, dates) ~/.mempalace/knowledge_graph.sqlite3kg_invalidateonly marks the fact as no longer valid. ⚠️ Targeted erasure is not documented; to erase fully, remove the fileThe agent's diary and conversation records In the memory, if you enable them Do not enable them until you have a reason Copies: repairarchives and your own backupsWherever you put them By hand; include them in your retention plan What leaves the machine. According to the documentation the project sends nothing out unless you configure it to (for example a remote embedding service). But recalled text goes into the request to the assistant's model: with a cloud model it goes to the provider. For other people's personal data use a local model or do not index it.
Deletion you have rehearsed. First on a test record:
mempalace_delete_by_sourceshows, without deleting, how many records it would remove (dry_runis on by default); only then do you run it withdry_run=false.mempalace_syncalso gives a report first. To remove everything: remove the registration (openclaw mcp unset mempalace), delete the memory folder, the graph file and all copies. You open these tools in OpenClaw only if you really want the assistant to delete by itself.✅Three rules1) Index only what you have the right to keep. 2) Do not put other people's personal data in memory without need. 3) Before you add a source, know how you will delete it. OpenClaw's built-in memory is deleted separately:openclaw memory forget(see "Sources") does not affect MemPalace. -
Maintenance
- Updating: the project releases often. Read the release notes, then
pip install --upgrade mempalacein the virtual environment;mempalace update checkmakes an explicit check. Do not switch on automatic updates for something that holds your data. - Backup: the memory is a folder and one graph file; back them up like your other settings (see Lesson 3.2) and remember that the copies are personal data too.
- Damage:
mempalace repair --dry-runshows what would change. Plainrepairmakes a copy before touching anything. - Rolling back:
openclaw mcp unset mempalaceand the assistant is as before.
- Updating: the project releases often. Read the release notes, then
04Check
Checklist
- You know why the built-in memory is not enough for you (or you decided not to add MemPalace).
- The package is from PyPI or the official repository, in a separate environment; the version is written down.
- The indexed folder holds only what is allowed;
--dry-runwas reviewed before the realmine. mempalace searchin the terminal returns meaningful passages before OpenClaw is involved.openclaw mcp doctor mempalace --probepasses; the assistant has only the read tools.- A question with no answer in memory gets "not found".
- You know whether the model is local or cloud and what follows from that.
- You tried deletion on a test record; copies are in your retention plan.
Quiz
1. How is MemPalace connected to OpenClaw in this lesson?
2. Why do we start with openclaw mcp tools mempalace --include …?
3. Which statement about personal data is true?
4. What is the right result for a question whose answer is not in the memory?
05What's next
06Sources
- MemPalace: repository 🔒 local — description, MIT licence, releases, warning about impostor sites · the PyPI package.
- MemPalace: getting started · MCP integration · with OpenClaw.
- MemPalace: commands (CLI) · MCP tools · Python interface.
- OpenClaw: saved MCP servers —
mcp set,doctor,tools· transports (stdio). - OpenClaw: built-in memory · provenance and deletion (
memory forget). - Regulation (EU) 2016/679 (GDPR) — Art. 5 (principles) and Art. 17 (right to erasure).