✓ Verified 💻 Development ✓ Enhanced Data

Lily Memory

Persistent memory plugin for OpenClaw agents.

Rating
3.8 (302 reviews)
Downloads
8,569 downloads
Version
1.0.0

Overview

Persistent memory plugin for OpenClaw agents.

Key Features

1

Auto-recall: Injects relevant memories as context before each LLM turn

2

Auto-capture: Extracts facts from conversations and stores them automatically

3

Hybrid search: SQLite FTS5 keyword search + Ollama vector cosine similarity

4

Stuck detection: Detects topic repetition and nudges the agent to break loops

5

Memory consolidation: Deduplicates entries on startup

6

Dynamic entities: Config-driven allowlist + runtime tool to add entities

7

Graceful degradation: Works without Ollama (keyword-only mode)

8

Minimal dependencies: Uses better-sqlite3 for secure parameterized queries + native fetch

Complete Documentation

View Source →

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

  • Install the plugin to your extensions directory
  • Add to your openclaw.json:
json
{
  "plugins": {
    "slots": { "memory": "lily-memory" },
    "entries": {
      "lily-memory": {
        "enabled": true,
        "config": {
          "dbPath": "~/.openclaw/memory/decisions.db",
          "entities": ["config", "system"]
        }
      }
    }
  }
}
  • 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

Installation

Terminal bash

openclaw install lily-memory
    
Copied!

💻Code Examples

example.json
{
  "plugins": {
    "slots": { "memory": "lily-memory" },
    "entries": {
      "lily-memory": {
        "enabled": true,
        "config": {
          "dbPath": "~/.openclaw/memory/decisions.db",
          "entities": ["config", "system"]
        }
      }
    }
  }
}

⚙️Configuration Options

Option Type Default Description
dbPathstringstring`~/.openclaw/memory/decisions.db`
autoRecallstringboolean`true`
autoCapturestringboolean`true`
maxRecallResultsstringnumber`10`
maxCapturePerTurnstringnumber`5`
stuckDetectionstringboolean`true`
vectorSearchstringboolean`true`
ollamaUrlstringstring`http://localhost:11434`
embeddingModelstringstring`nomic-embed-text`
consolidationstringboolean`true`
vectorSimilarityThresholdstringnumber`0.5`
entitiesstringarray`[]`

Tags

#coding_agents-and-ides

Quick Info

Category Development
Model Claude 3.5
Complexity Multi-Agent
Author kevinodell
Last Updated 3/10/2026
🚀
Optimized for
Claude 3.5
🧠

Ready to Install?

Get started with this skill in seconds

openclaw install lily-memory