The KAGAMI mark КАГАМИ
kagami.bg/academy · lesson · machine-readable viewVERIFIED 2026-10-01 · UPDATED 2026-10-01
IDENTITY
module
OpenClaw-07 · Long-term memory for OpenClaw with MemPalace (MCP)
series
OpenClaw · lesson 7
level
Advanced
duration
2–3 h
prerequisites
A working OpenClaw Gateway (lesson 3); Ubuntu on WSL2 or another Linux shell; Python 3.9+ with venv; about 300 MB of free disk for the embedding model and network access for its first download; a folder of notes you may legally index
trust_label
VERIFIED 2026-10-01 (MemPalace: PyPI metadata, GitHub repository, project documentation; OpenClaw: MCP registry, transports and memory documentation) · UPDATED 2026-10-01 · NOT TESTED (the install was not run in the check environment; nothing below was executed end to end)
versions
MemPalace 3.10.0 (PyPI and GitHub release, MIT licence) · OpenClaw release line 2026.9.x (latest seen 2026.9.7)
language
human view: bg · english edition: /en/academy/openclaw/Обучение 7 · Интеграция с MemPalace (дългосрочна памет).html
previous / next
Обучение 6 · Сигурност на OpenClaw.html / Обучение 8 · Гласов контрол с Whisper + OpenClaw.html
PURPOSE

Give an OpenClaw assistant an optional second, searchable long-term memory by running MemPalace as a local stdio MCP server registered in OpenClaw's saved MCP server list. MemPalace stores verbatim text (no summarising), organised into wings (projects or people), rooms (topics) and drawers (the original content), plus a temporal knowledge graph in SQLite. Start read-only through a tool filter, index only material you may keep, and know how to delete it.

KEY CONCEPTS
COMMANDS / PATHS
CHECKLIST
NEXT MODULE

Обучение 8 · Гласов контрол с Whisper + OpenClaw.html · voice control with Whisper and OpenClaw · offer: Quick experiment (kagami.bg/stalbata/)

SOURCES
TAGS
openclawmempalacemcplong-term-memorysemantic-searchknowledge-graphgdprleast-privilege
VERIFIED · 01.10.2026 UPDATED · 01.10.2026

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.

⏱ 2–3 h Advanced OpenClaw · Lesson 7 MCP · Semantic search · GDPR
OpenClaw (Gateway)🔒 local MemPalace (the memory)🔒 local Assistant model — Ollama🔒 local Assistant model — cloud🌐 global
🔄
UPDATED · 01.10.2026 — what changed
The old lesson described commands we could not find in MemPalace's documentation. We checked the project: MemPalace is a real open-source project (MIT licence, a package on PyPI, version 3.10.0 as of 01.10.2026). We fixed the following. The connection: the old lesson ran 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.
⚠️
What we have not run ourselves
We checked the documents and the project's data, but we did not install MemPalace or connect it to OpenClaw end to end (the check environment had no room for the package and the model). That is why there is no "TESTED" label. Unchecked: how OpenClaw behaves with this server through Discord, whether the server runs inside the sandbox from Lesson 3, and the quality of search in Bulgarian. If something does not work, see "Check" and the pages under "Sources".

01What you'll learn

02Before you start

⛔
Long-term memory = a long-term obligation
Everything you index stays and comes back in conversations. Do not put secrets, client documents without permission or other people's personal data in memory "just in case". Start small and read step 7 before adding anything real.

03Steps

  1. When you need MemPalace

    OpenClaw already has a memory. It is plain Markdown files in the agent workspace: MEMORY.md for durable facts, memory/DATE.md for daily notes and optionally USER.md for preferences. It is searched with the built-in memory_search. Why does this matter? For most people that is enough, and every add-on is one more thing to keep and secure.

    Your needWhat to use
    The assistant remembers preferences and decisions from conversationsOpenClaw's built-in memory
    Search by meaning across thousands of pages of notes, documents or old conversationsMemPalace (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.

  2. 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:

    WhatAs of 01.10.2026
    Repositorygithub.com/MemPalace/mempalace
    PackagePyPI: mempalace, version 3.10.0 (released 16.09.2026)
    LicenceMIT
    Documentationmempalaceofficial.com
    MCPYes — 45 tools according to the documentation
    NeedsPython 3.9+, ChromaDB (comes with the package), about 300 MB for the search model; no AI key
    ✅
    Official places only
    The authors explicitly warn that other sites (for example mempalace.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 numbers
    The 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).
  3. 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 Ubuntu
    sudo apt install python3-venv python3-pip -y
    python3 -m venv ~/.venvs/mempalace
    source ~/.venvs/mempalace/bin/activate
    pip install mempalace
    pip show mempalace

    pip show prints the installed version; write it down. The project also recommends uv tool install mempalace or pipx, 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 model
    On 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.
  4. 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. init scans the folder and writes an entities.json file into it, so run it on a scratch folder.

    bash
    mkdir -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-run only shows what would be stored. Always run it first.
    • --wing notes is the name of the wing — one project, one topic.
    • search returns 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 mine again on the folder. ⚠️ The documentation does not say clearly what happens on a repeat run over changed files, so look with --dry-run first. 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-run has shown that re-running mine on the same folder does not duplicate records. Example (every 6 hours, replace YOUR_LINUX_USER):

    crontab -e · line to add
    0 */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
  5. 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 (replace YOUR_LINUX_USER):

    bash
    openclaw 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 mempalace

    doctor --probe checks 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" in args.

    Now limit the rights. The server carries 45 tools and some of them delete and change things. Start with reading only:

    bash
    openclaw 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 way
    This is the same "least privilege" principle as in Lesson 3. The writing tools (add_drawer, delete_drawer, kg_add and others) you open one at a time, when you have a reason. The filter is removed with openclaw mcp tools mempalace --clear, the whole server with openclaw mcp unset mempalace.
    ⚠️
    What to know about OpenClaw
    According to the documentation, embedded OpenClaw shows MCP tools in the coding and messaging profiles, while minimal hides 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, run openclaw mcp status --verbose, watch the logs with openclaw logs --follow | grep -i mempalace and 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.

  6. How to ask the assistant

    After connecting, the assistant has the memory's tools. The first call to mempalace_status gives 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 Discord
    Search the memory for what we decided about the project deadline and show me the passage and its source.
    text · in Discord
    Which wings and rooms are in the memory? Show me only the names and counts.
    text · in Discord
    Search the "notes" wing only for entries from the last three months about "budget".

    The last example relies on the since and before filters of mempalace_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 through kg_add. ⚠️ We did not check whether mine fills 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.

  7. 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).

    WhatWhere it isHow to remove it
    Verbatim text of everything you indexed — including names, contacts and anything else in itThe memory folder, by default ~/.mempalace/palacemempalace_delete_by_source removes everything from one file, mempalace_delete_drawer one drawer (irreversible)
    Paths of the source files and the names of wings and roomsIn the same recordsAs above
    Facts in the temporal graph (people, relations, dates)~/.mempalace/knowledge_graph.sqlite3kg_invalidate only marks the fact as no longer valid. ⚠️ Targeted erasure is not documented; to erase fully, remove the file
    The agent's diary and conversation recordsIn the memory, if you enable themDo not enable them until you have a reason
    Copies: repair archives and your own backupsWherever you put themBy 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_source shows, without deleting, how many records it would remove (dry_run is on by default); only then do you run it with dry_run=false. mempalace_sync also 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 rules
    1) 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.
  8. Maintenance

    • Updating: the project releases often. Read the release notes, then pip install --upgrade mempalace in the virtual environment; mempalace update check makes 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-run shows what would change. Plain repair makes a copy before touching anything.
    • Rolling back: openclaw mcp unset mempalace and the assistant is as before.

04Check

Checklist

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

  1. MemPalace: repository 🔒 local — description, MIT licence, releases, warning about impostor sites · the PyPI package.
  2. MemPalace: getting started · MCP integration · with OpenClaw.
  3. MemPalace: commands (CLI) · MCP tools · Python interface.
  4. OpenClaw: saved MCP servers — mcp set, doctor, tools · transports (stdio).
  5. OpenClaw: built-in memory · provenance and deletion (memory forget).
  6. Regulation (EU) 2016/679 (GDPR) — Art. 5 (principles) and Art. 17 (right to erasure).