memory-pro

vakyi/memory-sqlite

Otheropenclawby vakyi

Summary

OpenClaw plugin exposing 0 skills.

Install to Claude Code

openclaw plugin add vakyi/memory-sqlite

Run in Claude Code. Add the marketplace first with /plugin marketplace add vakyi/memory-sqlite if you haven't already.

README.md

<div align="center">

๐Ÿง  memory-sqlite ยท ๐ŸฆžOpenClaw Plugin

AI Memory Assistant for OpenClaw Agents

Give your AI agent a brain that actually remembers โ€” across sessions, across agents, across time.

---

> โš ๏ธ Fork Notice > > This is a fork of CortexReach/memory-lancedb-pro, modified to solve old CPU compatibility issues. > > Plugin ID: memory-pro (was memory-lancedb-pro) > > Key Changes: > - LanceDB โ†’ SQLite + Fallback: Added better-sqlite3 and JSONL fallback for broader CPU compatibility > - Auto Backend Selection: Automatically chooses LanceDB (if supported) โ†’ SQLite โ†’ Fallback > > Upstream: CortexReach/memory-lancedb-pro | Original Author: win4r > > Why this fork? LanceDB requires AVX2 CPU instructions, which are not available on older CPUs (pre-Haswell, ~2013). This fork enables the plugin to work on legacy hardware.

---

![OpenClaw Plugin](https://github.com/openclaw/openclaw) ![License: MIT](LICENSE)

English | ็ฎ€ไฝ“ไธญๆ–‡

</div>

---

Why memory-lancedb-pro?

Most AI agents have amnesia. They forget everything the moment you start a new chat.

memory-lancedb-pro is a production-grade long-term memory plugin for OpenClaw that turns your agent into an AI Memory Assistant โ€” it automatically captures what matters, lets noise naturally fade, and retrieves the right memory at the right time. No manual tagging, no configuration headaches.

Your AI Memory Assistant in Action

Without memory โ€” every session starts from zero:

> You: "Use tabs for indentation, always add error handling." > (next session) > You: "I already told you โ€” tabs, not spaces!" ๐Ÿ˜ค > (next session) > You: "...seriously, tabs. And error handling. Again."

With memory-lancedb-pro โ€” your agent learns and remembers:

> You: "Use tabs for indentation, always add error handling." > (next session โ€” agent auto-recalls your preferences) > Agent: (silently applies tabs + error handling) โœ… > You: "Why did we pick PostgreSQL over MongoDB last month?" > Agent: "Based on our discussion on Feb 12, the main reasons were..." โœ…

That's the difference an AI Memory Assistant makes โ€” it learns your style, recalls past decisions, and delivers personalized responses without you repeating yourself.

What else can it do?

| | What you get | |---|---| | Auto-Capture | Your agent learns from every conversation โ€” no manual memory_store needed | | Smart Extraction | LLM-powered 6-category classification: profiles, preferences, entities, events, cases, patterns | | Intelligent Forgetting | Weibull decay model โ€” important memories stay, noise naturally fades away | | Hybrid Retrieval | Vector + BM25 full-text search, fused with cross-encoder reranking | | Context Injection | Relevant memories automatically surface before each reply | | Multi-Scope Isolation | Per-agent, per-user, per-project memory boundaries | | Any Provider | OpenAI, Jina, Gemini, Ollama, or any OpenAI-compatible API | | Full Toolkit | CLI, backup, migration, upgrade, export/import โ€” production-ready |

---

Quick Start

Installation

This fork is not published to npm. Install via git clone:

# Clone the fork
git clone https://github.com/vakyi/memory-sqlite.git ~/.openclaw/plugins/memory-sqlite

# Install dependencies
cd ~/.openclaw/plugins/memory-sqlite
pnpm install

SQLite Binary Setup:

The SQLite backend requires better-sqlite3 with native bindings. The installation process includes an automatic postinstall hook that will:

1. First, try to download a precompiled binary for your platform (fastest) 2. Then, fall back to building from source if download fails

Manual installation if needed:

# Download precompiled binary (recommended)
npm run fetch-sqlite

# Or rebuild from source (requires Python + build tools)
npm rebuild better-sqlite3

# Force re-download even if binary exists
FORCE_DOWNLOAD=1 npm run fetch-sqlite

Supported Platforms:

| OS | Architecture | Status | |----|-------------|--------| | Windows | x64, arm64 | โœ… Prebuilt available | | macOS | x64, arm64 (Apple Silicon) | โœ… Prebuilt available | | Linux | x64, arm64 | โœ… Prebuilt available |

Source Build Requirements:

  • Windows: Visual Studio Build Tools + Python
  • macOS: Xcode Command Line Tools
  • Linux: gcc, g++, make, python

Add to your openclaw.json:

{
  "plugins": {
    "slots": { "memory": "memory-pro" },
    "entries": {
      "memory-pro": {
        "enabled": true,
        "config": {
          "backend": "sqlite",
          "embedding": {
            "provider": "openai-compatible",
            "apiKey": "${OPENAI_API_KEY}",
            "model": "text-embedding-3-small"
          },
          "autoCapture": true,
          "autoRecall": true,
          "smartExtraction": true,
          "extractMinMessages": 2,
          "extractMaxChars": 8000,
          "sessionMemory": { "enabled": false }
        }
      }
    }
  }
}

Storage Backend Options:

| Backend | Description | |---------|-------------| | "auto" (default) | LanceDB (if CPU supports AVX2) โ†’ SQLite โ†’ Fallback JSONL | | "lancedb" | Force LanceDB (requires AVX2, best performance) | | "sqlite" | Force SQLite with FTS5 (no CPU requirement, good performance) | | "fallback" | Force in-memory Map + JSONL file storage (maximum compatibility) |

Why these defaults?

  • autoCapture + smartExtraction โ†’ your agent learns from every conversation automatically
  • autoRecall โ†’ relevant memories are injected before each reply
  • extractMinMessages: 2 โ†’ extraction triggers in normal two-turn chats
  • sessionMemory.enabled: false โ†’ avoids polluting retrieval with session summaries on day one

Validate & restart:

openclaw config validate
openclaw gateway restart
openclaw logs --follow --plain | grep "memory-pro"

You should see:

  • memory-pro: smart extraction enabled
  • memory-pro@...: plugin registered

Done! Your agent now has long-term memory.

<details> <summary><strong>More installation paths (existing users, upgrades)</strong></summary>

Already using OpenClaw?

1. Add the plugin with an absolute plugins.load.paths entry 2. Bind the memory slot: plugins.slots.memory = "memory-pro" 3. Verify: openclaw plugins info memory-pro && openclaw memory-pro stats

Upgrading from pre-v1.1.0?

# 1) Backup
openclaw memory-pro export --scope global --output memories-backup.json
# 2) Dry run
openclaw memory-pro upgrade --dry-run
# 3) Run upgrade
openclaw memory-pro upgrade
# 4) Verify
openclaw memory-pro stats

See CHANGELOG-v1.1.0.md for behavior changes and upgrade rationale.

</details>

<details> <summary><strong>Telegram Bot Quick Import (click to expand)</strong></summary>

If you are using OpenClaw's Telegram integration, the easiest way is to send an import command directly to the main Bot instead of manually editing config.

Send this message:

Help me connect this memory plugin with the most user-friendly configuration: https://github.com/CortexReach/memory-lancedb-pro

Requirements:
1. Set it as the only active memory plugin
2. Use Jina for embedding
3. Use Jina for reranker
4. Use gpt-4o-mini for the smart-extraction LLM
5. Enable autoCapture, autoRecall, smartExtraction
6. extractMinMessages=2
7. sessionMemory.enabled=false
8. captureAssistant=false
9. retrieval mode=hybrid, vectorWeight=0.7, bm25Weight=0.3
10. rerank=cross-encoder, candidatePoolSize=12, minScore=0.6, hardMinScore=0.62
11. Generate the final openclaw.json config directly, not just an explanation

</details>

---

Architecture

> Full walkthrough: installation, configuration, and hybrid retrieval internals.

![YouTube Video](https://youtu.be/MtukF1C8epQ)

https://youtu.be/MtukF1C8epQ

![Bilibili Video](https://www.bilibili.com/video/BV1zUf2BGEgn/)

https://www.bilibili.com/video/BV1zUf2BGEgn/

---

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   index.ts (Entry Point)                โ”‚
โ”‚  Plugin Registration ยท Config Parsing ยท Lifecycle Hooks โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚          โ”‚          โ”‚          โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ store  โ”‚ โ”‚embedderโ”‚ โ”‚retrieverโ”‚ โ”‚   scopes    โ”‚
    โ”‚ .ts    โ”‚ โ”‚ .ts    โ”‚ โ”‚ .ts    โ”‚ โ”‚    .ts      โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚                     โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”           โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚migrate โ”‚           โ”‚noise-filter.ts โ”‚
    โ”‚ .ts    โ”‚           โ”‚adaptive-       โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ”‚retrieval.ts    โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  tools.ts   โ”‚   โ”‚  cli.ts  โ”‚
    โ”‚ (Agent API) โ”‚   โ”‚ (CLI)    โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

> For a deep-dive into the full architecture, see docs/memory_architecture_analysis.md.

<details> <summary><strong>File Reference (click to expand)</strong></summary>

| File | Purpose | | --- | --- | | index.ts | Plugin entry point. Registers with OpenClaw Plugin API, parses config, mounts lifecycle hooks | | openclaw.plugin.json | Plugin metadata + full JSON Schema config declaration | | cli.ts | CLI commands: memory-pro list/search/stats/delete/delete-bulk/export/import/reembed/upgrade/migrate | | src/store.ts | LanceDB storage layer. Table creation / FTS indexing / Vector search / BM25 search / CRUD | | src/embedder.ts | Embedding abstraction. Compatible with any OpenAI-compatible API provider | | src/retriever.ts | Hybrid retrieval engine. Vector + BM25 โ†’ Hybrid Fusion โ†’ Rerank โ†’ Lifecycle Decay โ†’ Filter | | src/scopes.ts | Multi-scope access control | | src/tools.ts | Agent tool definitions: memory_recall, memory_store, memory_forget, memory_update + management tools | | src/noise-filter.ts | Filters out agent refusals, meta-questions, greetings, and low-quality content | | src/adaptive-retrieval.ts | Determines whether a query needs memory retrieval | | src/migrate.ts | Migration from built-in memory-lancedb to Pro | | src/smart-extractor.ts | LLM-powered 6-category extraction with L0/L1/L2 layered storage and two-stage dedup | | src/decay-engine.ts | Weibull stretched-exponential decay model | | src/tier-manager.ts | Three-tier promotion/demotion: Peripheral โ†” Working โ†” Core |

</details>

---

Core Features

Hybrid Retrieval

Query โ†’ embedQuery() โ”€โ”
                       โ”œโ”€โ†’ Hybrid Fusion โ†’ Rerank โ†’ Lifecycle Decay Boost โ†’ Length Norm โ†’ Filter
Query โ†’ BM25 FTS โ”€โ”€โ”€โ”€โ”€โ”˜
  • Vector Search โ€” semantic similarity via LanceDB ANN (cosine distance)
  • BM25 Full-Text Search โ€” exact keyword matching via LanceDB FTS index
  • Hybrid Fusion โ€” vector score as base, BM25 hits receive a weighted boost (not standard RRF โ€” tuned for real-world recall quality)
  • Configurable Weights โ€” vectorWeight, bm25Weight, minScore

Cross-Encoder Reranking

  • Built-in adapters for Jina, SiliconFlow, Voyage AI, and Pinecone
  • Compatible with any Jina-compatible endpoint (e.g., Hugging Face TEI, DashScope)
  • Hybrid scoring: 60% cross-encoder + 40% original fused score
  • Graceful degradation: falls back to cosine similarity on API failure

Multi-Stage Scoring Pipeline

| Stage | Effect | | --- | --- | | Hybrid Fusion | Combines semantic and exact-match recall | | Cross-Encoder Rerank | Promotes semantically precise hits | | Lifecycle Decay Boost | Weibull freshness + access frequency + importance ร— confidence | | Length Normalization | Prevents long entries from dominating (anchor: 500 chars) | | Hard Min Score | Removes irrelevant results (default: 0.35) | | MMR Diversity | Cosine similarity > 0.85 โ†’ demoted |

Smart Memory Extraction (v1.1.0)

  • LLM-Powered 6-Category Extraction: profile, preferences, entities, events, cases, patterns
  • L0/L1/L2 Layered Storage: L0 (one-sentence index) โ†’ L1 (structured summary) โ†’ L2 (full narrative)
  • Two-Stage Dedup: vector similarity pre-filter (โ‰ฅ0.7) โ†’ LLM semantic decision (CREATE/MERGE/SKIP)
  • Category-Aware Merge: profile always merges, events/cases are append-only

Memory Lifecycle Management (v1.1.0)

  • Weibull Decay Engine: composite score = recency + frequency + intrinsic value
  • Three-Tier Promotion: Peripheral โ†” Working โ†” Core with configurable thresholds
  • Access Reinforcement: frequently recalled memories decay slower (spaced-repetition style)
  • Importance-Modulated Half-Life: important memories decay slower

Multi-Scope Isolation

  • Built-in scopes: global, agent:<id>, custom:<name>, project:<id>, user:<id>
  • Agent-level access control via scopes.agentAccess
  • Default: each agent accesses global + its own agent:<id> scope

Auto-Capture & Auto-Recall

  • Auto-Capture (agent_end): extracts preference/fact/decision/entity from conversations, deduplicates, stores up to 3 per turn
  • Auto-Recall (before_agent_start): injects <relevant-memories> context (up to 3 entries)

Noise Filtering & Adaptive Retrieval

  • Filters low-quality content: agent refusals, meta-questions, greetings
  • Skips retrieval for greetings, slash commands, simple confirmations, emoji
  • Forces retrieval for memory keywords ("remember", "previously", "last time")
  • CJK-aware thresholds (Chinese: 6 chars vs English: 15 chars)

---

<details> <summary><strong>Compared to Built-in <code>memory-lancedb</code> (click to expand)</strong></summary>

| Feature | Built-in memory-lancedb | memory-lancedb-pro | | --- | :---: | :---: | | Vector search | Yes | Yes | | BM25 full-text search | - | Yes | | Hybrid fusion (Vector + BM25) | - | Yes | | Cross-encoder rerank (multi-provider) | - | Yes | | Recency boost & time decay | - | Yes | | Length normalization | - | Yes | | MMR diversity | - | Yes | | Multi-scope isolation | - | Yes | | Noise filtering | - | Yes | | Adaptive retrieval | - | Yes | | Management CLI | - | Yes | | Session memory | - | Yes | | Task-aware embeddings | - | Yes | | LLM Smart Extraction (6-category) | - | Yes (v1.1.0) | | Weibull Decay + Tier Promotion | - | Yes (v1.1.0) | | Any OpenAI-compatible embedding | Limited | Yes |

</details>

---

Configuration

<details> <summary><strong>Full Configuration Example</strong></summary>

{
  "embedding": {
    "apiKey": "${JINA_API_KEY}",
    "model": "jina-embeddings-v5-text-small",
    "baseURL": "https://api.jina.ai/v1",
    "dimensions": 1024,
    "taskQuery": "retrieval.query",
    "taskPassage": "retrieval.passage",
    "normalized": true
  },
  "dbPath": "~/.openclaw/memory/lancedb-pro",
  "autoCapture": true,
  "autoRecall": true,
  "retrieval": {
    "mode": "hybrid",
    "vectorWeight": 0.7,
    "bm25Weight": 0.3,
    "minScore": 0.3,
    "rerank": "cross-encoder",
    "rerankApiKey": "${JINA_API_KEY}",
    "rerankModel": "jina-reranker-v3",
    "rerankEndpoint": "https://api.jina.ai/v1/rerank",
    "rerankProvider": "jina",
    "candidatePoolSize": 20,
    "recencyHalfLifeDays": 14,
    "recencyWeight": 0.1,
    "filterNoise": true,
    "lengthNormAnchor": 500,
    "hardMinScore": 0.35,
    "timeDecayHalfLifeDays": 60,
    "reinforcementFactor": 0.5,
    "maxHalfLifeMultiplier": 3
  },
  "enableManagementTools": false,
  "scopes": {
    "default": "global",
    "definitions": {
      "global": { "description": "Shared knowledge" },
      "agent:discord-bot": { "description": "Discord bot private" }
    },
    "agentAccess": {
      "discord-bot": ["global", "agent:discord-bot"]
    }
  },
  "sessionMemory": {
    "enabled": false,
    "messageCount": 15
  },
  "smartExtraction": true,
  "llm": {
    "apiKey": "${OPENAI_API_KEY}",
    "model": "gpt-4o-mini",
    "baseURL": "https://api.openai.com/v1"
  },
  "extractMinMessages": 2,
  "extractMaxChars": 8000
}

</details>

<details> <summary><strong>Embedding Providers</strong></summary>

Works with any OpenAI-compatible embedding API:

| Provider | Model | Base URL | Dimensions | | --- | --- | --- | --- | | Jina (recommended) | jina-embeddings-v5-text-small | https://api.jina.ai/v1 | 1024 | | OpenAI | text-embedding-3-small | https://api.openai.com/v1 | 1536 | | Voyage | voyage-4-lite / voyage-4 | https://api.voyageai.com/v1 | 1024 / 1024 | | Google Gemini | gemini-embedding-001 | https://generativelanguage.googleapis.com/v1beta/openai/ | 3072 | | Ollama (local) | nomic-embed-text | http://localhost:11434/v1 | provider-specific |

</details>

<details> <summary><strong>Rerank Providers</strong></summary>

Cross-encoder reranking supports multiple providers via rerankProvider:

| Provider | rerankProvider | Example Model | | --- | --- | --- | | Jina (default) | jina | jina-reranker-v3 | | SiliconFlow (free tier available) | siliconflow | BAAI/bge-reranker-v2-m3 | | Voyage AI | voyage | rerank-2.5 | | Pinecone | pinecone | bge-reranker-v2-m3 |

Any Jina-compatible rerank endpoint also works โ€” set rerankProvider: "jina" and point rerankEndpoint to your service (e.g., Hugging Face TEI, DashScope qwen3-rerank).

</details>

<details> <summary><strong>Smart Extraction (LLM) โ€” v1.1.0</strong></summary>

When smartExtraction is enabled (default: true), the plugin uses an LLM to intelligently extract and classify memories instead of regex-based triggers.

| Field | Type | Default | Description | |-------|------|---------|-------------| | smartExtraction | boolean | true | Enable/disable LLM-powered 6-category extraction | | llm.auth | string | api-key | api-key uses llm.apiKey / embedding.apiKey; oauth uses a plugin-scoped OAuth token file by default | | llm.apiKey | string | (falls back to embedding.apiKey) | API key for the LLM provider | | llm.model | string | openai/gpt-oss-120b | LLM model name | | llm.baseURL | string | (falls back to embedding.baseURL) | LLM API endpoint | | llm.oauthProvider | string | openai-codex | OAuth provider id used when llm.auth is oauth | | llm.oauthPath | string | ~/.openclaw/.memory-pro/oauth.json | OAuth token file used when llm.auth is oauth | | llm.timeoutMs | number | 30000 | LLM request timeout in milliseconds | | extractMinMessages | number | 2 | Minimum messages before extraction triggers | | extractMaxChars | number | 8000 | Maximum characters sent to the LLM |

OAuth llm config (use existing Codex / ChatGPT login cache for LLM calls):

{
  "llm": {
    "auth": "oauth",
    "oauthProvider": "openai-codex",
    "model": "gpt-5.4",
    "oauthPath": "${HOME}/.openclaw/.memory-pro/oauth.json",
    "timeoutMs": 30000
  }
}

Notes for llm.auth: "oauth":

  • llm.oauthProvider is currently openai-codex.
  • OAuth tokens default to ~/.openclaw/.memory-pro/oauth.json.
  • You can set llm.oauthPath if you want to store that file somewhere else.
  • auth login snapshots the previous api-key llm config next to the OAuth file, and auth logout restores that snapshot when available.
  • Switching from api-key to oauth does not automatically carry over llm.baseURL. Set it manually in OAuth mode only when you intentionally want a custom ChatGPT/Codex-compatible backend.

</details>

<details> <summary><strong>Lifecycle Configuration (Decay + Tier)</strong></summary>

| Field | Default | Description | |-------|---------|-------------| | decay.recencyHalfLifeDays | 30 | Base half-life for Weibull recency decay | | decay.frequencyWeight | 0.3 | Weight of access frequency in composite score | | decay.intrinsicWeight | 0.3 | Weight of importance ร— confidence | | decay.betaCore | 0.8 | Weibull beta for core memories | | decay.betaWorking | 1.0 | Weibull beta for working memories | | decay.betaPeripheral | 1.3 | Weibull beta for peripheral memories | | tier.coreAccessThreshold | 10 | Min recall count before promoting to core | | tier.peripheralAgeDays | 60 | Age threshold for demoting stale memories |

</details>

<details> <summary><strong>Access Reinforcement</strong></summary>

Frequently recalled memories decay more slowly (spaced-repetition style).

Config keys (under retrieval):

  • reinforcementFactor (0-2, default: 0.5) โ€” set 0 to disable
  • maxHalfLifeMultiplier (1-10, default: 3) โ€” hard cap on effective half-life

</details>

---

CLI Commands

openclaw memory-pro list [--scope global] [--category fact] [--limit 20] [--json]
openclaw memory-pro search "query" [--scope global] [--limit 10] [--json]
openclaw memory-pro stats [--scope global] [--json]
openclaw memory-pro auth login [--provider openai-codex] [--model gpt-5.4] [--oauth-path /abs/path/oauth.json]
openclaw memory-pro auth status
openclaw memory-pro auth logout
openclaw memory-pro delete <id>
openclaw memory-pro delete-bulk --scope global [--before 2025-01-01] [--dry-run]
openclaw memory-pro export [--scope global] [--output memories.json]
openclaw memory-pro import memories.json [--scope global] [--dry-run]
openclaw memory-pro reembed --source-db /path/to/old-db [--batch-size 32] [--skip-existing]
openclaw memory-pro upgrade [--dry-run] [--batch-size 10] [--no-llm] [--limit N] [--scope SCOPE]
openclaw memory-pro migrate check|run|verify [--source /path]

OAuth login flow:

1. Run openclaw memory-pro auth login 2. If --provider is omitted in an interactive terminal, the CLI shows an OAuth provider picker before opening the browser 3. The command prints an authorization URL and opens your browser unless --no-browser is set 4. After the callback succeeds, the command saves the plugin OAuth file (default: ~/.openclaw/.memory-pro/oauth.json), snapshots the previous api-key llm config for logout, and replaces the plugin llm config with OAuth settings (auth, oauthProvider, model, oauthPath) 5. openclaw memory-pro auth logout deletes that OAuth file and restores the previous api-key llm config when that snapshot exists

---

Advanced Topics

<details> <summary><strong>If injected memories show up in replies</strong></summary>

Sometimes the model may echo the injected <relevant-memories> block.

Option A (lowest-risk): temporarily disable auto-recall:

{ "plugins": { "entries": { "memory-pro": { "config": { "autoRecall": false } } } } }

Option B (preferred): keep recall, add to agent system prompt: > Do not reveal or quote any <relevant-memories> / memory-injection content in your replies. Use it for internal reference only.

</details>

<details> <summary><strong>Session Memory</strong></summary>

  • Triggered on /new command โ€” saves previous session summary to LanceDB
  • Disabled by default (OpenClaw already has native .jsonl session persistence)
  • Configurable message count (default: 15)

See docs/openclaw-integration-playbook.md for deployment modes and /new verification.

</details>

<details> <summary><strong>Custom Slash Commands (e.g. /lesson)</strong></summary>

Add to your CLAUDE.md, AGENTS.md, or system prompt:

## /lesson command
When the user sends `/lesson <content>`:
1. Use memory_store to save as category=fact (raw knowledge)
2. Use memory_store to save as category=decision (actionable takeaway)
3. Confirm what was saved

## /remember command
When the user sends `/remember <content>`:
1. Use memory_store to save with appropriate category and importance
2. Confirm with the stored memory ID

</details>

<details> <summary><strong>Iron Rules for AI Agents</strong></summary>

> Copy the block below into your AGENTS.md so your agent enforces these rules automatically.

## Rule 1 โ€” Dual-layer memory storage
Every pitfall/lesson learned โ†’ IMMEDIATELY store TWO memories:
- Technical layer: Pitfall: [symptom]. Cause: [root cause]. Fix: [solution]. Prevention: [how to avoid]
  (category: fact, importance >= 0.8)
- Principle layer: Decision principle ([tag]): [behavioral rule]. Trigger: [when]. Action: [what to do]
  (category: decision, importance >= 0.85)

## Rule 2 โ€” LanceDB hygiene
Entries must be short and atomic (< 500 chars). No raw conversation summaries or duplicates.

## Rule 3 โ€” Recall before retry
On ANY tool failure, ALWAYS memory_recall with relevant keywords BEFORE retrying.

## Rule 4 โ€” Confirm target codebase
Confirm you are editing memory-pro vs built-in memory-lancedb before changes.

## Rule 5 โ€” Clear jiti cache after plugin code changes
After modifying .ts files under plugins/, MUST run rm -rf /tmp/jiti/ BEFORE openclaw gateway restart.

</details>

<details> <summary><strong>Database Schema</strong></summary>

LanceDB table memories:

| Field | Type | Description | | --- | --- | --- | | id | string (UUID) | Primary key | | text | string | Memory text (FTS indexed) | | vector | float[] | Embedding vector | | category | string | Storage category: preference / fact / decision / entity / reflection / other | | scope | string | Scope identifier (e.g., global, agent:main) | | importance | float | Importance score 0-1 | | timestamp | int64 | Creation timestamp (ms) | | metadata | string (JSON) | Extended metadata |

Common metadata keys in v1.1.0: l0_abstract, l1_overview, l2_content, memory_category, tier, access_count, confidence, last_accessed_at

> Note on categories: The top-level category field uses 6 storage categories. The 6-category semantic labels from Smart Extraction (profile / preferences / entities / events / cases / patterns) are stored in metadata.memory_category.

</details>

<details> <summary><strong>Troubleshooting</strong></summary>

"Cannot mix BigInt and other types" (LanceDB / Apache Arrow)

On LanceDB 0.26+, some numeric columns may be returned as BigInt. Upgrade to memory-lancedb-pro >= 1.0.14 โ€” this plugin now coerces values using Number(...) before arithmetic.

SQLite / better-sqlite3 Issues

Problem: Cannot find module 'better-sqlite3' or native binding load failure

Solutions: 1. Run npm run fetch-sqlite to download precompiled binary 2. Or npm rebuild better-sqlite3 to build from source 3. Set backend: "fallback" to use JSONL storage instead

Problem: Build fails with Python/g++ errors (Windows)

Solution: Install Visual Studio Build Tools with C++ support, then:

npm config set msvs_version 2019
npm rebuild better-sqlite3

Problem: Build fails on macOS

Solution: Install Xcode Command Line Tools:

xcode-select --install
npm rebuild better-sqlite3

Problem: Download script fails with 404

Solution: Your platform/architecture may not have prebuilt binaries. Build from source instead:

npm rebuild better-sqlite3

</details>

---

Documentation

| Document | Description | | --- | --- | | Upstream: OpenClaw Integration Playbook | Deployment modes, verification, regression matrix | | Upstream: Memory Architecture Analysis | Full architecture deep-dive | | Upstream: CHANGELOG v1.1.0 | v1.1.0 behavior changes and upgrade rationale | | Upstream: Long-Context Chunking | Chunking strategy for long documents |

---

About This Fork

Repository: vakyi/memory-sqlite

Upstream: CortexReach/memory-lancedb-pro

This fork adds SQLite and Fallback JSONL storage backends for compatibility with older CPUs that lack AVX2 support. All other features remain identical to the upstream project.

---

Dependencies

| Package | Purpose | | --- | --- | | better-sqlite3 โ‰ฅ9.0.0 | Primary storage (SQLite with FTS5) | | @lancedb/lancedb โ‰ฅ0.26.2 | Optional: LanceDB backend (requires AVX2 CPU) | | openai โ‰ฅ6.21.0 | OpenAI-compatible Embedding API client | | @sinclair/typebox 0.34.48 | JSON Schema type definitions |

---

License

MIT

Related plugins

Browse all โ†’