Smart Memory

v1.0.0

Smart memory plugin for OpenClaw — LLM-powered extraction, hybrid ANN search, tier lifecycle, spreading activation, procedural rules, WAL, Mem0, and session-state hot RAM.

@mattstvartak/finch-smart-memory·runtime finch-memory·by @onenomad
Code Pluginsource linkedCommunity code plugin. Review compatibility and verification before install.

README

Finch Smart Memory — OpenClaw Plugin

An intelligent memory plugin for OpenClaw that replaces manual memory curation with automatic extraction, hybrid search, and cognitive-science-inspired memory lifecycle management. Uses your existing OpenClaw model provider — no extra API keys required.

Built by OneNomad LLC.

Features

  • LLM-powered extraction — automatically pulls facts, preferences, decisions, and corrections from conversations using your configured model
  • Hybrid search — combines LanceDB native ANN vector search with keyword matching, recency/frequency bonuses, and graph-based spreading activation
  • Tier lifecycle — memories flow through daily, short-term, long-term, and archive tiers with automatic promotion and decay
  • Procedural rules — learns behavioral rules from user corrections ("always do X", "never do Y") with confidence tracking
  • WAL (Write-Ahead Log) — real-time memory capture during conversations, before responding
  • Session state — hot RAM scratchpad that survives compaction and restarts
  • Mem0 cloud — optional managed extraction via Mem0 with auto-deduplication
  • Recall outcomes — feedback loop that strengthens helpful memories and demotes irrelevant ones
  • Auto-consolidation — runs maintenance automatically at session start
  • Prompt injection — automatically injects relevant memories into the system prompt

Installation

From ClawHub

openclaw plugins install clawhub:@onenomad/finch-smart-memory

From npm

openclaw plugins install @onenomad/finch-smart-memory

Manual install (from source)

git clone https://github.com/mattstvartak/finch-smart-memory.git
cd finch-smart-memory
npm install
npm run build
openclaw plugins install ./

Updating

From ClawHub

openclaw plugins update @onenomad/finch-smart-memory

Or update all plugins at once:

openclaw plugins update --all

Manual update (from source)

cd finch-smart-memory
git pull
npm install
npm run build

Configuration

Enable the plugin in your openclaw.json:

{
  "plugins": {
    "entries": {
      "finch-smart-memory": {
        "enabled": true
      }
    }
  }
}

Settings

All settings are optional. Configure under plugins.entries.finch-smart-memory.config:

{
  "plugins": {
    "entries": {
      "finch-smart-memory": {
        "enabled": true,
        "config": {
          "extractionProvider": "local",
          "cheapModel": "google/gemini-2.5-flash-lite-preview",
          "embeddingModel": "google/text-embedding-004",
          "mem0UserId": "default",
          "maxRecallChunks": 10,
          "maxRecallTokens": 1500,
          "autoExtract": true,
          "autoMaintain": true
        }
      }
    }
  }
}
SettingDefaultDescription
extractionProviderlocallocal (your OpenClaw model), mem0, or both
cheapModelgoogle/gemini-2.5-flash-lite-previewModel for extraction/classification
embeddingModelgoogle/text-embedding-004Model for vector embeddings
mem0UserIddefaultMem0 user scope
maxRecallChunks10Max memories returned per search
maxRecallTokens1500Token budget for recalled memories
autoExtracttrueAuto-extract memories after conversations
autoMaintaintrueRun consolidation at session start

Mem0 (optional)

If using Mem0 cloud extraction, set the API key as an environment variable:

export MEM0_API_KEY="your-key-here"

Then set extractionProvider to mem0 or both.

Registered Tools

Once installed, the plugin registers these tools that the agent can call:

ToolDescription
memory_searchHybrid ANN vector + keyword search with spreading activation
memory_formatSearch and format memories for system prompt injection
memory_ingestWAL: immediately persist a memory before responding
memory_extractExtract memories from a conversation with LLM classification
memory_maintainRun consolidation (decay, promote, link, merge)
memory_rulesShow active procedural rules
memory_outcomeRecord recall outcome (helpful/corrected/irrelevant)
memory_sessionManage session state (hot RAM)
memory_statsShow memory statistics
memory_mem0_syncSync Mem0 cloud memories to local (optional)

How It Works

Architecture

Conversations ──> Extract ──> LanceDB (vectors + metadata)
                                  |
                    +-------------+-------------+
                    |             |             |
               Vector ANN   Keyword Match   Graph Walk
                    |             |             |
                    +-------------+-------------+
                                  |
                           Score + Rank
                                  |
                         Token Budget Cap
                                  |
                       Format for Prompt

Memory Tiers

daily (2d) ──> short-term (14d) ──> long-term (90d) ──> archive
                    ^                                       |
                    +───── reactivation (recalled) ─────────+

Cognitive Layers

  • Episodic — events tied to a moment ("user debugged OAuth yesterday")
  • Semantic — enduring facts ("user prefers TypeScript")
  • Procedural — behavioral rules ("always show code before explanation")

Spreading Activation

Based on Collins & Loftus (1975). When top-scoring memories are found, the system walks their graph edges to discover related memories not directly matching the query. Two hops deep, with activation decaying at each hop.

Procedural Rules

Learned from user corrections and explicit instructions. Each rule has a confidence score (0.0-1.0) that increases with reinforcement (+0.1) and decreases with contradiction (-0.2). Dead rules (confidence = 0) are pruned automatically.

Recall Outcomes

When recalled memories are marked as helpful/corrected/irrelevant:

  • Helpful: importance +0.05, triggers reconsolidation
  • Corrected: importance -0.10
  • Irrelevant: importance -0.05
  • Co-recalled helpful memories strengthen their graph edges

Data Storage

All data lives in ~/.openclaw/smart-memory/:

~/.openclaw/smart-memory/
├── SESSION-STATE.md     # Hot RAM scratchpad
└── lance/               # LanceDB tables
    ├── chunks.lance/    # Memory chunks with embeddings
    ├── daily_logs.lance/# Daily extraction logs
    └── rules.lance/     # Procedural rules

Security

Network calls

This plugin makes outbound requests to exactly two services:

  • Your configured model provider (via OpenClaw runtime) — LLM completions and embeddings
  • Mem0 (via mem0ai npm package) — only when extractionProvider is mem0 or both

No other endpoints are contacted. No telemetry or analytics.

API keys

  • LLM calls use your existing OpenClaw model provider — no extra API key needed
  • MEM0_API_KEY — optional, only needed if using Mem0 cloud extraction, set as environment variable

Prompt injection

When enabled (default), the plugin automatically injects recalled memories into the system prompt. To disable:

{ "config": { "autoExtract": false, "autoMaintain": false } }

Local storage

Memories and rules are stored locally in ~/.openclaw/smart-memory/lance/. No memory content is sent anywhere except to your configured model provider and optionally Mem0.

License

MIT

Capabilities

configSchema
Yes
Executes code
Yes
HTTP routes
0
Plugin kind
memory
Runtime ID
finch-memory

Compatibility

Built With Open Claw Version
2026.3.24
Plugin Api Range
>=2026.3.0

Verification

Tier
source linked
Scope
artifact only
Summary
Validated package structure and linked the release to source metadata.
Commit
f8ad0573e42c
Tag
f8ad0573e42c928b16a032f872a42adefc549e55
Provenance
No
Scan status
clean

Tags

latest
1.0.0