CortexReach/memory-lancedb-pro
Enhanced LanceDB memory plugin for OpenClaw — Hybrid Retrieval (Vector + BM25), Cross-Encoder Rerank, Multi-Scope Isolation, Management CLI
memory‑lancedb‑pro – Long‑term memory plugin for OpenClaw agents
What it is – A production‑grade OpenClaw plugin that gives an AI agent a persistent “brain”. It stores conversation snippets, preferences, decisions and other context in a LanceDB vector store and automatically recalls the most relevant pieces when the agent replies.
Key capabilities
| Feature | How it works |
|---|---|
| Auto‑capture | Every chat turn is sent to the plugin; no manual memory_store calls are needed. |
| Smart extraction | An LLM classifies each captured chunk into six categories (profiles, preferences, entities, events, cases, patterns). |
| Hybrid retrieval | Queries are embedded, then searched with both ANN vector similarity and BM25 full‑text search. Results are fused and optionally reranked by a cross‑encoder. |
| Intelligent forgetting | A Weibull decay model reduces the weight of old or low‑importance memories, letting noise fade. |
| Context injection | Before the agent builds its reply, the plugin injects the top‑ranked memories into the prompt automatically. |
| Scope isolation | Memories are partitioned per‑agent, per‑user and per‑project, preventing cross‑talk leakage. |
| Provider‑agnostic embeddings | Works with OpenAI, Jina, Gemini, Ollama or any OpenAI‑compatible API. |
| Tooling | CLI for listing, searching, exporting, importing, re‑embedding, upgrading and migrating the database. |
| Dreaming support | Optional side‑car that treats “dream” reports as public artifacts and indexes them. |
Installation
- One‑click script –
curl …setup-memory.sh && bash setup-memory.sh(handles install, config, and service restart). - OpenClaw CLI –
openclaw plugins install memory-lancedb-pro@beta. - npm –
npm i memory-lancedb-pro@beta(then add the absolute plugin path toplugins.load.paths).
Configuration snapshot (the README’s default JSON):
{
"plugins": {
"slots": { "memory": "memory-lancedb-pro" },
"entries": {
"memory-lancedb-pro": {
"enabled": true,
"config": {
"embedding": {
"provider": "openai-compatible",
"apiKey": "${OPENAI_API_KEY}",
"model": "text-embedding-3-small"
},
"autoCapture": true,
"autoRecall": true,
"smartExtraction": true,
"canonicalCorpus": { "enabled": true, "syncOnSearch": true },
"dreaming": { "enabled": false },
"extractMinMessages": 2,
"extractMaxChars": 8000,
"sessionMemory": { "enabled": false }
}
}
}
}
}
Why these defaults? – They turn on hands‑free learning (autoCapture + smartExtraction) and automatic recall (autoRecall). The low extractMinMessages makes extraction trigger after a normal two‑turn exchange, while disabling per‑session memory avoids polluting the long‑term store with transient summaries.
Runtime architecture (as described in the README):
index.tsregisters the plugin with OpenClaw and wires lifecycle hooks (before_prompt_build).store.tstalks to LanceDB (vector + BM25 indexes, CRUD operations).embedder.tsabstracts the embedding provider.retriever.tsperforms hybrid search, fusion, cross‑encoder reranking and applies the decay boost.smart-extractor.tsruns the LLM classification.tools.tsexposes the agent‑side tools (memory_recall,memory_store,memory_forget,memory_update, plus optional management tools).
Typical workflow
- Capture – After each assistant reply, the plugin extracts salient facts and stores them as rows in LanceDB, also writing the original markdown files (
MEMORY.md,memory/**/*.md, etc.) for human reference. - Recall – When the next user query arrives, the
before_prompt_buildhook runs: the query is embedded, hybrid‑searched, reranked, and the top hits are inserted into the prompt as context snippets. - Decay – Each stored row carries a timestamp and importance score; the Weibull decay engine gradually lowers its relevance unless it is accessed frequently.
Hardware note – LanceDB’s native cosine ANN requires AVX/AVX2. On CPUs lacking those instructions you can disable native cosine (retrieval.disableNativeCosine: true or env var MEMORY_LANCEDB_DISABLE_NATIVE_COSINE=1).
Ecosystem helpers
- Setup script – Handles fresh install, upgrades, config repair, and un‑install.
- Skill package –
memory-lancedb-pro-skilllets a Claude‑Code or OpenClaw agent configure the plugin via natural‑language commands. - Video tutorials – YouTube and Bilibili walkthroughs cover installation, hybrid retrieval internals, and debugging.
Who would use this?
- Developers building long‑running OpenClaw assistants that need to remember user preferences, past decisions, or project context across sessions.
- Teams that want a “brain” for their AI agents without building their own vector store or forgetting logic.
- Anyone who prefers a single, configurable plugin that works with any OpenAI‑compatible embedding provider.
Bottom line – memory‑lancedb‑pro is a fully‑featured, production‑ready memory layer for OpenClaw agents, combining semantic vector search, classic keyword search, decay‑based forgetting, and LLM‑driven extraction, all wrapped in an easy‑install plugin.
Related
- Project