# memory-lancedb-pro

> A LanceDB-backed memory plugin for OpenClaw that captures what matters from every conversation, lets noise decay on a Weibull curve, and injects the right memories back before each reply

- Category: Agents & Automation / Agent Memory
- Language: JavaScript
- Licence: MIT
- Repository: https://github.com/CortexReach/memory-lancedb-pro
- Canonical page: https://ai-tldr.dev/tools/memory-lancedb-pro/
- Updated: 2026-09-17

## In short

memory-lancedb-pro fills the OpenClaw memory slot with a LanceDB-backed long-term store. The problem it addresses is the one every agent user hits: you state a preference, the session ends, and the next session starts from zero. It sits in the Agent Memory category of the Agents & Automation tools and is open-source, written in JavaScript and licensed MIT.

## Overview

memory-lancedb-pro fills the OpenClaw memory slot with a LanceDB-backed long-term store. The problem it addresses is the one every agent user hits: you state a preference, the session ends, and the next session starts from zero. The plugin captures preferences, decisions and project context as they come up in conversation, and surfaces the relevant ones automatically before the agent's next reply — no manual `memory_store` call, no tagging discipline required of the user.

Capture is LLM-driven. Rather than storing raw transcript, a smart-extraction pass classifies what it finds into six categories — profiles, preferences, entities, events, cases and patterns — so a stated coding convention is stored as a durable preference while small talk is not. Forgetting is modelled explicitly: a Weibull decay curve keeps memories that keep proving useful and lets noise fade, which is what stops the store degrading into an ever-growing pile that retrieval has to fight through.

Retrieval is hybrid. A dense vector search over LanceDB runs alongside BM25 full-text search, the two result sets are fused, and a cross-encoder reranks the survivors before anything is injected into context. Scope isolation is first-class: memory boundaries can be drawn per agent, per user and per project, so a work project's decisions do not leak into a personal assistant's answers. Embeddings can come from OpenAI, Jina, Gemini, Ollama or any OpenAI-compatible endpoint.

Since v1.1.0-beta.10 the plugin targets OpenClaw 2026.3+ and its newer plugin architecture, using `before_prompt_build` hooks in place of the deprecated `before_agent_start`; after upgrading, the project asks you to run `openclaw doctor --fix`. When it owns the memory slot it exposes one capability over two coordinated stores: plugin memory in LanceDB (semantic recall) and a canonical corpus of source-of-truth files — `MEMORY.md`, `memory/**/*.md`, recent session transcripts — which is indexed into LanceDB when `canonicalCorpus.enabled` is set. One hardware caveat is called out prominently: the CPU must support AVX, and LanceDB's native vector search may need AVX2 on some Linux x64 builds, with a JavaScript-cosine fallback available for AVX-only machines.

## What it does

- Auto-capture with LLM-powered smart extraction into six categories — profiles, preferences, entities, events, cases and patterns
- Intelligent forgetting via a Weibull decay model, so important memories persist and noise fades instead of accumulating
- Hybrid retrieval: dense vector search plus BM25 full-text, fused and then cross-encoder reranked
- Automatic context injection — relevant memories surface before each reply, with no explicit recall call
- Multi-scope isolation: per-agent, per-user and per-project memory boundaries
- Any embedding provider — OpenAI, Jina, Gemini, Ollama, or any OpenAI-compatible API
- A canonical-corpus layer that semantically indexes MEMORY.md, memory/**/*.md and recent session transcripts alongside the vector store
- A production toolkit around the store: CLI, backup, migration, upgrade and export/import

## Getting started

The plugin installs through the OpenClaw CLI or npm and is then wired into openclaw.json. Check first that your CPU reports AVX — LanceDB's native vector search may need AVX2 on some Linux x64 builds and can crash AVX-only CPUs with SIGILL.

1. Check your CPU supports AVX

   No output means the instruction set is not reported. On an AVX-only machine, set retrieval.disableNativeCosine: true (or MEMORY_LANCEDB_DISABLE_NATIVE_COSINE=1) to use a scoped row scan with JavaScript cosine ranking instead.

```bash
grep -o 'avx[^ ]*' /proc/cpuinfo | head -1
```

2. Install via the OpenClaw CLI

   This is the recommended path. Installing through npm instead works, but then the plugin's install directory must be added as an absolute path under plugins.load.paths in openclaw.json — the project notes this is the most common setup mistake.

```bash
openclaw plugins install memory-lancedb-pro@beta
```

3. Wire it into openclaw.json

   Claim the memory slot and configure an embedding provider. The defaults shown are the ones the project recommends for day one: auto-capture plus smart extraction so the agent learns from every conversation, auto-recall so memories are injected before each reply, extraction triggering from two-turn chats, and session summaries left off so they do not pollute retrieval early on.

```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
          },
          "extractMinMessages": 2,
          "extractMaxChars": 8000,
          "sessionMemory": { "enabled": false }
        }
      }
    }
  }
}
```

4. After an upgrade, run the doctor

   v1.1.0-beta.10 moved to OpenClaw 2026.3+'s before_prompt_build hooks, replacing the deprecated before_agent_start. The doctor repairs configuration left over from the old architecture.

```bash
openclaw doctor --fix
```

## When to use it

- Reach for it when an OpenClaw agent keeps being told the same preferences and conventions every session
- Reach for it when you need to ask why a past decision was made and want the agent to answer from a record rather than a guess
- Reach for it when one machine runs several agents or projects and their memories must not bleed into each other
- Reach for it when the built-in memory slot retrieves too loosely and you want BM25 plus vector search with a reranker in front of context injection

## Version history

- 2026-09-17 v1.1.0-beta.10: Adapted the plugin to OpenClaw 2026.3+'s new plugin architecture, moving to before_prompt_build hooks in place of the deprecated before_agent_start. Existing installs should run `openclaw doctor --fix` after upgrading.
