{"skill":{"slug":"lily-memory","displayName":"Lily Memory Plugin","summary":"Persistent memory plugin for OpenClaw agents. Hybrid SQLite FTS5 keyword + Ollama vector semantic search with auto-capture, auto-recall, stuck-detection, and...","description":"---\nname: lily-memory\ndescription: Persistent memory plugin for OpenClaw agents. Hybrid SQLite FTS5 keyword + Ollama vector semantic search with auto-capture, auto-recall, stuck-detection, and memory consolidation.\nmetadata:\n  openclaw:\n    requires:\n      bins: [node]\n      npm: [better-sqlite3]\n    primaryEnv: \"\"\n---\n\n# Lily Memory\n\nPersistent memory plugin for OpenClaw agents. Gives your agent long-term memory that survives session resets, compaction, and restarts.\n\n## What It Does\n\n- **Auto-recall**: Injects relevant memories as context before each LLM turn\n- **Auto-capture**: Extracts facts from conversations and stores them automatically\n- **Hybrid search**: SQLite FTS5 keyword search + Ollama vector cosine similarity\n- **Stuck detection**: Detects topic repetition and nudges the agent to break loops\n- **Memory consolidation**: Deduplicates entries on startup\n- **Dynamic entities**: Config-driven allowlist + runtime tool to add entities\n- **Graceful degradation**: Works without Ollama (keyword-only mode)\n- **Minimal dependencies**: Uses better-sqlite3 for secure parameterized queries + native fetch\n\n## Requirements\n\n- Node.js 18+ (for native `fetch`)\n- `better-sqlite3` npm package (installed via `npm install`)\n- Optional: Ollama with `nomic-embed-text` model for semantic search\n\n## Quick Start\n\n1. Install the plugin to your extensions directory\n2. Add to your `openclaw.json`:\n\n```json\n{\n  \"plugins\": {\n    \"slots\": { \"memory\": \"lily-memory\" },\n    \"entries\": {\n      \"lily-memory\": {\n        \"enabled\": true,\n        \"config\": {\n          \"dbPath\": \"~/.openclaw/memory/decisions.db\",\n          \"entities\": [\"config\", \"system\"]\n        }\n      }\n    }\n  }\n}\n```\n\n3. Restart the gateway: `openclaw gateway restart`\n\n## Tools\n\n| Tool | Description |\n|------|-------------|\n| `memory_search` | FTS5 keyword search across all facts |\n| `memory_entity` | Look up all facts for a specific entity |\n| `memory_store` | Save a fact to persistent memory |\n| `memory_semantic_search` | Vector similarity search via Ollama |\n| `memory_add_entity` | Register a new entity at runtime |\n\n## Configuration\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `dbPath` | string | `~/.openclaw/memory/decisions.db` | SQLite database path |\n| `autoRecall` | boolean | `true` | Inject memories before each turn |\n| `autoCapture` | boolean | `true` | Extract facts from responses |\n| `maxRecallResults` | number | `10` | Max memories per turn |\n| `maxCapturePerTurn` | number | `5` | Max facts per response |\n| `stuckDetection` | boolean | `true` | Topic repetition detection |\n| `vectorSearch` | boolean | `true` | Ollama semantic search |\n| `ollamaUrl` | string | `http://localhost:11434` | Ollama endpoint |\n| `embeddingModel` | string | `nomic-embed-text` | Embedding model |\n| `consolidation` | boolean | `true` | Dedup on startup |\n| `vectorSimilarityThreshold` | number | `0.5` | Min cosine similarity |\n| `entities` | array | `[]` | Additional entity names |\n\n## Architecture\n\n**Recall flow**: Extract keywords from message -> FTS5 + vector search -> merge and deduplicate -> inject as context\n\n**Capture flow**: Regex scan for `entity: key = value` patterns -> validate entity against allowlist -> store to SQLite -> async embed via Ollama\n\n**Stuck detection**: Track top 5 content words per response -> Jaccard similarity -> if 3+ consecutive >60% overlap, inject Reflexion nudge\n\n## License\n\nMIT\n","tags":{"latest":"5.2.3","embeddings":"5.0.0","memory":"5.0.0","sqlite":"5.0.0","vectors":"5.0.0"},"stats":{"comments":0,"downloads":2222,"installsAllTime":6,"installsCurrent":6,"stars":2,"versions":7},"createdAt":1771293150905,"updatedAt":1778491560329},"latestVersion":{"version":"5.2.3","createdAt":1771463207541,"changelog":"add install spec to plugin manifest, fix dependency metadata","license":null},"metadata":{"setup":[],"os":null,"systems":null},"owner":{"handle":"kevinodell","userId":"s173fth4ey6e5k4sb1bxz6gmv5885330","displayName":"kevinodell","image":"https://avatars.githubusercontent.com/u/11198666?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779972298226}}