memory-lancedb-pro is a long-term memory plugin for OpenClaw that replaces the built-in memory-lancedb plugin with a fuller retrieval pipeline. It stores memories in LanceDB and combines vector search with BM25 full-text search, then reranks and rescores the fused results before injecting them into the agent's prompt.
Retrieval runs as a pipeline: the query is embedded and matched against LanceDB's ANN index while a BM25 index handles exact keywords, the two result sets are fused, an optional cross-encoder reranker (Jina, SiliconFlow, Pinecone, or any compatible endpoint) rescores them, and recency, importance, length, and time-decay weights, a minimum score, and MMR diversity shape the final list. The plugin hooks beforeagentstart, beforepromptbuild, and agentend and exposes memoryrecall, memorystore, and memoryforget tools to the agent.
Memories are partitioned into scopes (global, agent: , custom: , project: , user: ) with per-agent access rules; by default each agent reads global plus its own scope. A CLI covers list, search, stats, delete, export, import, re-embed, and migration from the built-in plugin.
Features
- Hybrid retrieval: vector similarity plus BM25 keyword matching with configurable vectorWeight, bm25Weight, and minScore
- Cross-encoder rerank: 60% reranker score and 40% fused score, falling back to cosine reranking when the API fails
- Scoring pipeline: recency boost (14-day half-life), importance weighting, length normalisation, time decay (60-day half-life), a hard minimum score, and MMR de-duplication above 0.85 similarity
- Adaptive retrieval: skips greetings, slash commands, confirmations, and emoji, and forces recall on memory keywords, with CJK-aware thresholds
- Noise filtering: drops agent refusals, meta-questions, and greetings at capture and store time
- Session strategies: OpenClaw session-memory, plugin reflection with inherited rules, or none
- Self-improvement log: structured learnings and errors written to .learnings/ with review and skill-extraction tools
- Markdown mirror: dual-writes memories to dated Markdown files alongside LanceDB
- Long-context chunking: splits at sentence boundaries with overlap and averages chunk embeddings when a model's context limit is exceeded
- Embedding providers: any OpenAI-compatible endpoint, including OpenAI, Gemini, Jina, and Ollama, with task-aware query and passage embeddings