OpenClaw with a librarian — a Datris MCP server indexing local markdown memory for semantic retrieval

Your agent isn’t amnesiac. It remembers fine — when you remind it. That’s the problem.

Here’s the pattern. Week one, you tell OpenClaw your code review process, your meeting cadence, the three sacred rules about how you handle pull requests. It writes them down. MEMORY.md grows. Daily memory files accumulate. The system is working as designed.

Week three, you ask a question that should pull from that memory. Crickets. Not because the note is gone — it’s right there in ~/.openclaw/workspace/memory/ — but because the model didn’t think to look. Or it looked with the wrong words. Or it loaded the wrong file. You re-explain. The agent nods, writes another note, and you’re back where you started.

This isn’t amnesia. The information exists. The agent just can’t find it on its own.

That’s dementia, more or less. The memories are intact. The retrieval is broken.

Why OpenClaw forgets

OpenClaw has memory out of the box — daily files, a curated MEMORY.md, semantic search over archived sessions. The architecture is sound. The problem is enforcement: every step of the loop is advisory.

The model decides when to save. It decides what’s worth saving. It decides whether to search before answering. Usually it does the right thing. Sometimes — long sessions, after a context compaction, after a restart — it doesn’t. And when it doesn’t, you can’t tell from the outside. The agent answers confidently from whatever’s in its current context, and you only realize later that it ignored a perfectly good note from three weeks ago.

You can prompt around this. You can tell it to always search first. You can ask it to summarize what it remembers before answering. It’ll comply for a turn or two and then drift.

The issue isn’t the prompt. The issue is that memory shouldn’t be the model’s job.

Why the obvious fixes don’t work

Hand-rolled file memory. A PREFERENCES.md here, a CONTEXT.md there, grep on top. Works for a week. Fails the moment you ask a question with different wording than the note. You wrote “ingestion topology.” You ask about “pipeline architecture.” Grep returns nothing. The note is invisible.

MemGPT / Letta. Solves the retrieval problem. But it’s a runtime, not a memory layer. Adopting it means running your agent inside their framework — their loop, their tools, their state model. Fine on a clean slate. Heavy migration if you already like the agent you have.

Neither approach lets OpenClaw stay OpenClaw while gaining real memory.

The actual fix

Don’t replace OpenClaw. Don’t replace the memory files. Stop asking the model to do retrieval.

Run a Datris MCP server next to OpenClaw and put it in front of the memory directory. Local markdown stays canonical — you still author memory the same way, version it the same way, edit it in the same editor. Datris becomes the index.

The change in behavior is structural:

  • Memory capture and retrieval happen at the system layer, not the prompt layer. Restarts don’t matter. Long conversations don’t matter. The agent reasons from the same facts every turn.
  • Retrieval is semantic. “What did we decide about the pipeline architecture?” finds the note filed under “ingestion topology.” The wording mismatch problem disappears.
  • Only the relevant snippets land in context, so the agent doesn’t burn its window loading memory it doesn’t need.
  • The Agents tab in the Datris UI shows every tool call live — vector_search, ai_answer, pipeline_status — so you can see exactly what the agent searched for and what came back. No more guessing whether memory is being consulted.

OpenClaw stays OpenClaw. Your loop, your tools, your skills — unchanged. Point one MCP client at one URL and the dementia goes away.

What this looks like in practice

Six steps if you’re starting from scratch — five if you already have Datris running.

First, install Datris itself: clone the repo, drop your API keys into .env, docker compose up -d. Full bootstrap at docs.datris.ai/installation.

In the Datris UI, set the embedding model to OpenAI text-embedding-3-small under Configuration → AI Providers. Then:

brew tap datris/tap && brew install datris
openclaw mcp set datris '{"url":"http://localhost:3000/sse"}'
openclaw skills install datris-memory
openclaw gateway restart

The third command is the one that matters. datris-memory is an OpenClaw skill — a markdown file with persistent operating instructions for the agent. You install it once.

Tell OpenClaw to run the skill once to ingest your existing memory. It bootstraps the pipeline, parallelizes the uploads, polls jobs to completion, verifies retrieval with semantic search, and writes a summary into a dated audit file. Watch the Agents tab in the Datris UI as it runs — every upload_data, pipeline_status, and vector_search call streams live.

Full setup walkthrough lives at docs.datris.ai/configuring-openclaw. Prefer to watch it run? There’s a screen-recorded walkthrough at datris.ai/videos/openclaw-has-dementia-lets-fix-it that takes you through the same steps end to end.

The architectural payoff

Once the index exists and the skill is active, a few things follow for free.

Recall improves with corpus size. More memory means better retrieval, not slower or noisier. Semantic search ranks by relevance instead of cramming everything into context. Bigger corpus, sharper answers.

One memory layer, many agents. Point Claude Desktop, Claude Code, Cursor, and OpenClaw at the same Datris pipeline. They share memory. No per-tool re-indexing, no drift between agents.

Local-first. Markdown stays on disk. The index lives in your own Datris stack. Wipe and rebuild any time without losing knowledge.

Memory becomes queryable. It’s a real Datris pipeline, so vector search, AI answer, and SQL-shaped questions all work — from the CLI, the REST API, or any MCP client. Not just from inside the agent chat.

Sync is incremental, not all-or-nothing. When you edit a memory file in your editor between sessions, only that file re-ingests. Renames go through delete-then-add. Deletes propagate. The pipeline doesn’t drift away from disk.

The point

Your agent stops forgetting. Your memory files stop being a flat pile of markdown that the model occasionally remembers exists. You get a real semantic layer over the knowledge you’ve been writing down all along.

OpenClaw doesn’t need a new brain. It needs a librarian.