lily-memory

Persistent memory plugin for OpenClaw agents. Hybrid SQLite FTS5 keyword + Ollama vector semantic search with auto-capture, auto-recall, stuck-detection, and memory consolidation.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "lily-memory" with this command: npx skills add kevinodell/lily-memory

Lily Memory

Persistent memory plugin for OpenClaw agents. Gives your agent long-term memory that survives session resets, compaction, and restarts.

What It Does

  • Auto-recall: Injects relevant memories as context before each LLM turn
  • Auto-capture: Extracts facts from conversations and stores them automatically
  • Hybrid search: SQLite FTS5 keyword search + Ollama vector cosine similarity
  • Stuck detection: Detects topic repetition and nudges the agent to break loops
  • Memory consolidation: Deduplicates entries on startup
  • Dynamic entities: Config-driven allowlist + runtime tool to add entities
  • Graceful degradation: Works without Ollama (keyword-only mode)
  • Minimal dependencies: Uses better-sqlite3 for secure parameterized queries + native fetch

Requirements

  • Node.js 18+ (for native fetch)
  • better-sqlite3 npm package (installed via npm install)
  • Optional: Ollama with nomic-embed-text model for semantic search

Quick 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"]
        }
      }
    }
  }
}
  1. Restart the gateway: openclaw gateway restart

Tools

ToolDescription
memory_searchFTS5 keyword search across all facts
memory_entityLook up all facts for a specific entity
memory_storeSave a fact to persistent memory
memory_semantic_searchVector similarity search via Ollama
memory_add_entityRegister a new entity at runtime

Configuration

OptionTypeDefaultDescription
dbPathstring~/.openclaw/memory/decisions.dbSQLite database path
autoRecallbooleantrueInject memories before each turn
autoCapturebooleantrueExtract facts from responses
maxRecallResultsnumber10Max memories per turn
maxCapturePerTurnnumber5Max facts per response
stuckDetectionbooleantrueTopic repetition detection
vectorSearchbooleantrueOllama semantic search
ollamaUrlstringhttp://localhost:11434Ollama endpoint
embeddingModelstringnomic-embed-textEmbedding model
consolidationbooleantrueDedup on startup
vectorSimilarityThresholdnumber0.5Min cosine similarity
entitiesarray[]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

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

Vector Memory Hack

Fast semantic search for AI agent memory files using TF-IDF and SQLite. Enables instant context retrieval from MEMORY.md or any markdown documentation. Use when the agent needs to (1) Find relevant context before starting a task, (2) Search through large memory files efficiently, (3) Retrieve specific rules or decisions without reading entire files, (4) Enable semantic similarity search instead of keyword matching. Lightweight alternative to heavy embedding models - zero external dependencies, <10ms search time.

Registry SourceRecently Updated
2.4K9Profile unavailable
Automation

Neolata Memory Engine

Graph-native memory engine for AI agents — hybrid vector+keyword search, biological decay, Zettelkasten linking, trust-gated conflict resolution, explainabil...

Registry SourceRecently Updated
3640Profile unavailable
Research

Mema Brain

Mema's personal brain - SQLite metadata index for documents and Redis short-term context buffer. Use for organizing workspace knowledge paths and managing ep...

Registry SourceRecently Updated
5460Profile unavailable
Automation

Agent Memory Local

Local-first memory retrieval for Agent/OpenClaw workspaces. Use when the user asks about prior work, decisions, dates, preferences, root causes, todo history...

Registry SourceRecently Updated
00Profile unavailable