Tools
Memory Sqlite
Local-first memory plugin for OpenClaw. sqlite-vec + FTS5 + RRF fusion.
Install
npm install
npm
README
# openclaw-memory-sqlite
> **Status: on hold.** OpenClaw gateway ships a bundled memory core. This plugin may resume if that core needs to be swapped out for a standalone, file-backed implementation.
Local-first memory plugin for [OpenClaw](https://github.com/brickjawn/OpenClaw). Stores and retrieves agent memory using SQLite — no cloud APIs, no external vector databases.
## What's here
| File | Purpose |
|------|---------|
| `src/db.ts` | Opens a WAL-mode SQLite database, loads sqlite-vec, applies schema (chunks + FTS5 + triggers) |
| `src/embedding.ts` | POSTs text to Ollama `/api/embed`, truncates to configured dimensions, L2-normalizes, returns `Float32Array` |
| `src/index.ts` | Plugin entry point (scaffold only) |
## Architecture intent
The plugin was designed around three layers:
1. **Storage** — `chunks` table as source of truth; FTS5 external-content virtual table kept in sync via triggers; `chunks_vec` virtual table (sqlite-vec) created lazily once embedding dimensions are known.
2. **Embedding** — stateless `embed(text, config)` function targeting a local Ollama instance (e.g. `nomic-embed-text-v2-moe` on `10.0.0.2:11434`). No module-level state; callers own lifecycle and logging.
3. **Retrieval** — planned RRF (Reciprocal Rank Fusion) combining FTS5 BM25 scores with cosine similarity from the vector index. Never implemented.
## Plugin contracts
Declared tools: `memory_search`, `memory_store`, `memory_forget`, `memory_stats`
Declared slot: `memory`
None of these are implemented — only the DB layer and embedding function exist.
## Dev
```bash
npm install
npm test
```
Requires Node 22+. No external services needed for tests (fetch is mocked).
For embedding against a real model, point `EmbeddingConfig.url` at your Ollama host.
## Why it stalled
OpenClaw gateway added a bundled memory core that covers the same use case without a separate plugin install. This repo remains as a reference for the sqlite-vec + FTS5 + RRF approach if the bundled core ever needs replacing.
tools
Comments
Sign in to leave a comment