Lily Memory Plugin
by @kevinodell
Persistent memory plugin for OpenClaw agents. Hybrid SQLite FTS5 keyword + Ollama vector semantic search with auto-capture, auto-recall, stuck-detection, and...
clawhub install lily-memoryπ About This Skill
name: lily-memory description: Persistent memory plugin for OpenClaw agents. Hybrid SQLite FTS5 keyword + Ollama vector semantic search with auto-capture, auto-recall, stuck-detection, and memory consolidation. metadata: openclaw: requires: bins: [node] npm: [better-sqlite3] primaryEnv: ""
Lily Memory
Persistent memory plugin for OpenClaw agents. Gives your agent long-term memory that survives session resets, compaction, and restarts.
What It Does
Requirements
fetch)better-sqlite3 npm package (installed via npm install)nomic-embed-text model for semantic searchQuick Start
1. Install the plugin to your extensions directory
2. Add to your openclaw.json:
{
"plugins": {
"slots": { "memory": "lily-memory" },
"entries": {
"lily-memory": {
"enabled": true,
"config": {
"dbPath": "~/.openclaw/memory/decisions.db",
"entities": ["config", "system"]
}
}
}
}
}
3. Restart the gateway: openclaw gateway restart
Tools
| Tool | Description |
|------|-------------|
| memory_search | FTS5 keyword search across all facts |
| memory_entity | Look up all facts for a specific entity |
| memory_store | Save a fact to persistent memory |
| memory_semantic_search | Vector similarity search via Ollama |
| memory_add_entity | Register a new entity at runtime |
Configuration
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| dbPath | string | ~/.openclaw/memory/decisions.db | SQLite database path |
| autoRecall | boolean | true | Inject memories before each turn |
| autoCapture | boolean | true | Extract facts from responses |
| maxRecallResults | number | 10 | Max memories per turn |
| maxCapturePerTurn | number | 5 | Max facts per response |
| stuckDetection | boolean | true | Topic repetition detection |
| vectorSearch | boolean | true | Ollama semantic search |
| ollamaUrl | string | http://localhost:11434 | Ollama endpoint |
| embeddingModel | string | nomic-embed-text | Embedding model |
| consolidation | boolean | true | Dedup on startup |
| vectorSimilarityThreshold | number | 0.5 | Min cosine similarity |
| entities | array | [] | Additional entity names |
Architecture
Recall flow: Extract keywords from message -> FTS5 + vector search -> merge and deduplicate -> inject as context
Capture flow: Regex scan for entity: key = value patterns -> validate entity against allowlist -> store to SQLite -> async embed via Ollama
Stuck detection: Track top 5 content words per response -> Jaccard similarity -> if 3+ consecutive >60% overlap, inject Reflexion nudge
License
MIT
π‘ Examples
1. Install the plugin to your extensions directory
2. Add to your openclaw.json:
{
"plugins": {
"slots": { "memory": "lily-memory" },
"entries": {
"lily-memory": {
"enabled": true,
"config": {
"dbPath": "~/.openclaw/memory/decisions.db",
"entities": ["config", "system"]
}
}
}
}
}
3. Restart the gateway: openclaw gateway restart
βοΈ Configuration
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| dbPath | string | ~/.openclaw/memory/decisions.db | SQLite database path |
| autoRecall | boolean | true | Inject memories before each turn |
| autoCapture | boolean | true | Extract facts from responses |
| maxRecallResults | number | 10 | Max memories per turn |
| maxCapturePerTurn | number | 5 | Max facts per response |
| stuckDetection | boolean | true | Topic repetition detection |
| vectorSearch | boolean | true | Ollama semantic search |
| ollamaUrl | string | http://localhost:11434 | Ollama endpoint |
| embeddingModel | string | nomic-embed-text | Embedding model |
| consolidation | boolean | true | Dedup on startup |
| vectorSimilarityThreshold | number | 0.5 | Min cosine similarity |
| entities | array | [] | Additional entity names |