npx skills add ...
npx skills add win4r/memory-lancedb-pro-skill --skill memory-lancedb-pro
Comprehensive guide for maintaining, debugging, and upgrading the memory-lancedb-pro OpenClaw plugin — an enhanced LanceDB-backed long-term memory system with hybrid retrieval (Vector + BM25), cross-encoder reranking, multi-scope isolation, noise filtering, adaptive retrieval, and a management CLI. Use this skill when: (1) developing new features or fixing bugs in memory-lancedb-pro, (2) modifying the retrieval pipeline (vector search, BM25, RRF fusion, reranking, scoring stages), (3) adding or changing embedding providers, (4) updating scope/access control logic, (5) modifying agent tools or CLI commands, (6) troubleshooting memory quality issues (noise, duplicates, low recall), (7) working on the JSONL session distillation pipeline, (8) migrating data between memory backends, or (9) understanding the plugin's architecture to plan enhancements.
npx skills add win4r/memory-lancedb-pro-skill --skill memory-lancedb-pro
memory-lancedb-pro is an enhanced long-term memory plugin for OpenClaw. It replaces the built-in memory-lancedb plugin with advanced retrieval capabilities, multi-scope memory isolation, and a management CLI.
Repository: https://github.com/win4r/memory-lancedb-pro License: MIT | Language: TypeScript (ESM) | Runtime: Node.js via OpenClaw Gateway
| File | Purpose | Key Exports |
|---|---|---|
index.ts | Plugin entry point. Registers with OpenClaw Plugin API, parses config, mounts lifecycle hooks | memoryLanceDBProPlugin (default), shouldCapture, detectCategory |
openclaw.plugin.json | Plugin metadata + full JSON Schema config with uiHints | — |
package.json | NPM package. Deps: @lancedb/lancedb, openai, @sinclair/typebox | — |
cli.ts | CLI: memory-pro list/search/stats/delete/delete-bulk/export/import/reembed/migrate | createMemoryCLI, registerMemoryCLI |
src/store.ts | LanceDB storage layer. Table creation, FTS indexing, CRUD, vector/BM25 search | MemoryStore, MemoryEntry, loadLanceDB |
src/embedder.ts | Embedding abstraction. OpenAI-compatible API, task-aware, LRU cache | Embedder, createEmbedder, getVectorDimensions |
src/retriever.ts | Hybrid retrieval engine. Full scoring pipeline | MemoryRetriever, createRetriever, DEFAULT_RETRIEVAL_CONFIG |
src/scopes.ts | Multi-scope access control | MemoryScopeManager, createScopeManager |
src/tools.ts | Agent tool definitions: memory_recall/store/forget/update/stats/list | registerAllMemoryTools |
src/noise-filter.ts | Noise filter for low-quality content | isNoise, filterNoise |
src/adaptive-retrieval.ts | Skip retrieval for greetings, commands, emoji | shouldSkipRetrieval |
src/migrate.ts | Migration from legacy memory-lancedb | MemoryMigrator, createMigrator |
scripts/jsonl_distill.py | JSONL session distillation script (Python) | — |
For detailed deep-dives into each subsystem, read the appropriate reference file:
EMBEDDING_DIMENSIONS map in src/embedder.ts, add ittask and normalized, extend buildPayload() in src/embedder.tsembedder.test() methodRerankProvider type in src/retriever.tsbuildRerankRequest() for request format (headers + body)parseRerankResponse() for response parsingrerankProvider enum in openclaw.plugin.jsonprivate apply<StageName>(results: RetrievalResult[]): RetrievalResult[] method in MemoryRetrieverRetrievalConfig interfacehybridRetrieval() and vectorOnlyRetrieval()DEFAULT_RETRIEVAL_CONFIGopenclaw.plugin.jsonregisterMemory<ToolName>Tool() in src/tools.tsType.Object() from @sinclair/typeboxstringEnum() from openclaw/plugin-sdk for enum paramscontext.scopeManagerregisterAllMemoryTools() — decide if core (always) or management (optional){ content: [{ type: "text", text }], details: {...} }registerMemoryCLI() in cli.tsmemory.command("name <args>").description("...").option("--flag", "...").action(async (args, opts) => { ... })--json flag for machine-readable outputprocess.exit(1) for error casesapi.registerCli() in index.tsshouldCapture(text) in index.ts controls what gets auto-capturedMEMORY_TRIGGERS regex array defines trigger patterns (supports EN/CJK)detectCategory(text) classifies captures as preference/fact/decision/entity/otheragent_end hook, limited to 3 per turnbefore_agent_start hook (OFF by default)shouldSkipRetrieval() from src/adaptive-retrieval.ts gates retrieval<relevant-memories> XML block with UNTRUSTED DATA warningsanitizeForContext() strips HTML, newlines, limits to 300 chars per memory1 / (1 + exp(-score/5))${VAR} syntax resolved at config parse time; gateway service may not inherit shell envnode test/cli-smoke.mjsopenclaw plugins doctor, openclaw memory-pro statsembedder.test() returns { success, dimensions, error? }retriever.test() returns { success, mode, hasFtsSupport, error? }