Local graph-based memory plugin for OpenClaw with entity extraction, user profiles, and automatic forgetting โ inspired by Supermemory
README
๐ง Supermemory OpenClaw Plugin
Local graph-based memory plugin for OpenClaw โ inspired by Supermemory. Runs entirely on your machine with no cloud dependencies.
Disclaimer: This is an independent project. It is not affiliated with, endorsed by, or maintained by the Supermemory team. The name reflects architectural inspiration, not a partnership.
How It Works
- Auto-capture โ After each AI response, an LLM subagent extracts typed atomic memories (facts, episodes, preferences) and raw entity mentions from the turn, deduplicates them lexically and by vector similarity, then stores them in a local SQLite knowledge graph.
- Graph storage โ Memories are linked to canonical entities and connected by relationship edges:
updates(newer fact supersedes older) andrelated(connected facts sharing entities). - Background maintenance โ A periodic job merges entity aliases (e.g. "Ivan" / "Ivรกn"), expires stale episodic memories, and backfills any missing embeddings.
- Auto-recall โ Before each AI turn, hybrid search (BM25 + vector + graph hops) retrieves the most relevant memories and your user profile, which are injected into the prompt context.
Sequence diagrams available in docs/diagrams/.
Quick Start
Step 1: Install the plugin
openclaw plugins install openclaw-memory-supermemory
Step 2: Run the setup wizard
openclaw supermemory configure
Step 3: Restart OpenClaw
Restart the OpenClaw gateway for the plugin to load.
openclaw gateway restart
Step 4: Check the saved configuration
openclaw supermemory status
You should see a summary of the plugin state, embedding provider, model, and database path.
Step 5: Verify it works
openclaw supermemory stats
You should see output like:
Total memories: 0
Active memories: 0
Superseded memories: 0
Entities: 0
Relationships: 0
Zero counts are normal on first run.
Upgrade Note
If startup fails after upgrading, reinstalling, or switching between older builds, wipe the memory database and let the plugin recreate it:
openclaw supermemory wipe --confirm
Embedding Providers
Supported providers and auto-detected dimensions:
| Model | Provider | Dimensions |
|---|---|---|
embeddinggemma | Ollama | 768 |
qwen3-embedding | Ollama | 4096 |
bge-m3 | Ollama | 1024 |
all-minilm | Ollama | 384 |
nomic-embed-text | Ollama | 768 |
snowflake-arctic-embed2 | Ollama | 1024 |
mxbai-embed-large | Ollama | 1024 |
snowflake-arctic-embed | Ollama | 1024 |
text-embedding-3-small | OpenAI | 1536 |
text-embedding-3-large | OpenAI | 3072 |
Set provider to "ollama" or "openai". Any OpenAI-compatible endpoint also works via baseUrl.
For unlisted models, set embedding.dimensions explicitly. When you do, the plugin forwards that size to providers that support variable-width embeddings and rebuilds vector-state under the new dimension.
AI Tools
The AI uses these tools autonomously:
| Tool | Description |
|---|---|
memory_search | Search across memories using vector + keyword + graph retrieval when embeddings are enabled, otherwise keyword + graph (or keyword-only if graphWeight is 0) |
memory_store | Save information with automatic entity extraction and relationship detection |
memory_forget | Delete memories by ID or search query |
memory_profile | View/rebuild the automatically maintained user profile |
CLI Commands
openclaw supermemory configure # Interactive setup wizard
openclaw supermemory status # Show current configuration
openclaw supermemory stats # Show memory statistics
openclaw supermemory search <query> # Search memories
openclaw supermemory search "<term>" --limit 5
openclaw supermemory profile # View user profile
openclaw supermemory profile --rebuild # Force rebuild profile
openclaw supermemory wipe --confirm # Wipe persisted memory data and re-initialize storage
Interactive Setup
Run openclaw supermemory configure for a guided wizard that reads your existing ~/.openclaw/openclaw.json and writes the plugin entry back after prompting for:
- Plugin enabled/disabled
- Auto-capture and auto-recall toggles
- Embedding provider, model, API key, and base URL
- Custom database path
Run openclaw supermemory status at any time to print a summary of the current configuration.
Run openclaw supermemory wipe --confirm to wipe the SQLite memory store and re-initialize an empty database without changing your saved plugin configuration.
Slash Commands
Three slash commands are registered for quick in-chat memory access:
| Command | Description |
|---|---|
/remember <text> | Store a memory immediately, bypassing auto-capture |
/recall <query> | Run a hybrid search and display matching memories |
/forget <description> | Delete a memory by description; auto-deletes on high-confidence single match, otherwise lists candidates |
Vector Search
The plugin always uses FTS5 keyword search. When graphWeight > 0, it also augments results with graph traversal. When embeddings are enabled, it additionally uses sqlite-vec for vector similarity search and vector-based deduplication.
Because sqlite-vec is bundled with OpenClaw's built-in memory system, the plugin automatically detects and loads the extension from the host environment when embeddings are enabled. This means vector similarity search is usually available out-of-the-box without requiring any additional installation or configuration.
If you prefer to avoid embedding work entirely, set embedding.enabled: false in your configuration. That disables embedding generation, vector retrieval, and vector-based deduplication while preserving any existing stored vectors on disk.
When you turn embeddings back on later, the plugin starts a background backfill. It reindexes any stored vectors first, then embeds older active memories that were captured while embeddings were disabled. Startup is not blocked while this runs.
If you change the embedding provider, model, or explicit dimensions, the plugin clears only its stored vector-state and then backfills under the new embedding space. Memory texts, entities, and relationships stay intact.
Configuration Reference
All settings are optional. The plugin now exposes only the operational knobs that still affect behavior directly.
Core
| Option | Type | Default | Description |
|---|---|---|---|
embedding.enabled | boolean | true | Enable or disable embedding generation, vector retrieval, and vector deduplication |
embedding.provider | string | "ollama" | Embedding provider (ollama, openai, etc.) |
embedding.model | string | "embeddinggemma" | Embedding model name |
embedding.apiKey | string | โ | API key (cloud providers only, supports ${ENV_VAR} syntax) |
embedding.baseUrl | string | โ | Custom API base URL |
embedding.dimensions | number | auto | Override vector dimensions and request that size from providers that support it |
autoCapture | boolean | true | Auto-capture memories from conversations |
autoRecall | boolean | true | Auto-inject memories + profile into context |
dbPath | string | ~/.openclaw/memory/supermemory.db | SQLite database path |
debug | boolean | false | Enable verbose logging |
Profile And Prompt
| Option | Type | Default | Description |
|---|---|---|---|
profileFrequency | number | 50 | Rebuild the profile every N interactions |
maxLongTermItems | number | 20 | Max memories included in the long-term profile section |
maxRecentItems | number | 10 | Max memories included in the recent profile section |
recentWindowDays | number | 7 | How many days count as recent for episodic memories |
profileScanLimit | number | 1000 | Max active memories scanned when rebuilding the profile |
promptMemoryMaxChars | number | 500 | Max characters per memory item when injecting profile or recall context |
Recall And Search
| Option | Type | Default | Description |
|---|---|---|---|
maxRecallResults | number | 10 | Max results returned by the memory_search tool. Auto-recall uses a separate cap. |
vectorWeight | number | 0.5 | Weight for vector similarity in hybrid search |
textWeight | number | 0.3 | Weight for BM25 keyword search |
graphWeight | number | 0.2 | Weight for graph-augmented retrieval |
minScore | number | 0.1 | Minimum combined score for a result to be returned |
vectorMinScoreFactor | number | 0.5 | Multiplied by minScore to set the vector search cut-off (effective floor: minScore ร vectorMinScoreFactor) |
graphSeedLimit | number | 5 | Number of top-scored results used to seed the graph hop walk |
graphHopDepth | number | 2 | Depth of graph traversal per seed node |
mmrLambda | number | 0.7 | MMR trade-off between relevance (1.0) and diversity (0.0) in result re-ranking |
autoRecallMaxMemories | number | 5 | Hard cap on memories injected into the prompt during auto-recall (independent of maxRecallResults) |
autoRecallMinScore | number | 0.3 | Minimum score for a memory to be injected during auto-recall |
Capture And Extraction
| Option | Type | Default | Description |
|---|---|---|---|
captureMaxChars | number | 2000 | Max characters from the assembled conversation turn sent to auto-capture extraction |
extractorMaxItems | number | 10 | Max memories the LLM extractor may return per conversation turn |
Relationships And Forgetting
| Option | Type | Default | Description |
|---|---|---|---|
forgetExpiredIntervalMinutes | number | 60 | Minutes between forgetting cleanup runs |
temporalDecayDays | number | 90 | Days before stale unpinned episodic memories decay |
nearDuplicateThreshold | number | 0.95 | Vector cosine similarity above which an incoming memory is treated as a near-duplicate and skipped |
lexicalDuplicateThreshold | number | 0.88 | Lexical overlap score above which an incoming memory is treated as a lexical duplicate and skipped |
updateVectorMinScore | number | 0.55 | Minimum vector similarity for a candidate memory to be considered for an updates relationship |
maxRelatedEdges | number | 5 | Maximum number of related graph edges written per memory on ingestion |
Semantic Extraction
The plugin uses your configured LLM to extract typed atomic memories, raw entity mentions, and temporal metadata from each conversation turn.
Input conversation:
"Caught up with Ivรกn today. He's working at Santander as an AI Scientist now, doing research on knowledge graphs. He lives in Madrid and mentioned a deadline next Tuesday for a paper submission."
Extracted memories:
fact: Ivรกn works at Santander as an AI Scientistfact: Ivรกn researches knowledge graphsfact: Ivรกn lives in Madridepisode: Ivรกn has a paper submission deadline next Tuesday
Each extracted memory is stored separately with:
- a
memoryType(fact,preference, orepisode) - raw entity mentions such as
Ivรกn,Santander, andMadrid - optional temporal metadata such as
expiresAtIso
Those raw mentions are linked to canonical entities later, so the system can preserve original surface forms while still grouping aliases over time.
Set autoCapture: false to disable auto-capture entirely.
Architecture
For an in-depth breakdown of the graph logic, scoring algorithms, and background processes, see the following document.
openclaw-memory-supermemory/
โโโ index.ts # Plugin entry
โโโ openclaw.plugin.json # Plugin manifest (kind: "memory")
โโโ tests/
โ โโโ integration/
โ โโโ longmemeval/
โ โโโ fixtures/ # Bundled LongMemEval test artifacts
โ โโโ README.md # Test layout and artifact notes
โ โโโ run.ts # Local OpenClaw integration battery / benchmark runner
โโโ src/
โ โโโ config.ts # Config parsing + defaults
โ โโโ db.ts # SQLite: memories, canonical entities, aliases, relationships, profiles
โ โโโ embeddings.ts # Ollama + OpenAI-compatible embedding providers
โ โโโ fact-extractor.ts # LLM semantic extraction + relationship/entity resolvers
โ โโโ graph-engine.ts # Storage orchestration, alias linking, update resolution
โ โโโ entity-text.ts # Entity alias normalization helpers
โ โโโ semantic-runtime.ts # Shared subagent runtime helpers for JSON tasks
โ โโโ memory-text.ts # Injected/synthetic memory filtering and prompt-safe sanitization
โ โโโ search.ts # Hybrid search (vector + FTS5 + graph)
โ โโโ profile-builder.ts # Long-term + recent user profile
โ โโโ forgetting.ts # Expiration, stale-episode cleanup, deferred entity merging
โ โโโ tools.ts # Agent tools (search, store, forget, profile)
โ โโโ hooks.ts # Auto-recall + guarded auto-capture hooks
โ โโโ cli.ts # CLI commands + slash command registration
โ โโโ configure.ts # Interactive setup wizard + status command
โ โโโ logger.ts # Named, debug-aware plugin logger
Storage
All data stored in a single SQLite database:
- memories โ Text, embeddings, memory type, expiration, access tracking,
pinned,parent_memory_id - entities โ Canonical entity clusters
- entity_aliases โ Raw observed entity names / surface forms
- entity_mentions โ Links between memories and aliases
- relationships โ Graph edges (
updates/related) - profile_cache โ Cached long-term + recent user profile
- memories_fts โ FTS5 virtual table for keyword search
- memories_vec โ sqlite-vec virtual table for vector similarity (if enabled)
LongMemEval Integration
The repo includes a LongMemEval runner that evaluates this plugin through a real local OpenClaw agent invocation while keeping benchmark state isolated from your normal ~/.openclaw profile.
# One example per main LongMemEval category + one abstention case
bun run test:integration:longmemeval
# Run the whole bundled oracle fixture
bun run test:integration:longmemeval --preset full
# Run the official LongMemEval evaluator afterwards
bun run test:integration:longmemeval --run-official-eval --official-repo /tmp/LongMemEval
The runner auto-loads repo-root .env.local and .env before reading env defaults. Start from .env.sample.
What the runner does:
- Uses the bundled oracle fixture by default, or a file passed via
--data-file - Creates an isolated
~/.openclaw-<profile>profile - Copies auth and model metadata from
LONGMEMEVAL_SOURCE_STATE_DIR(default:~/.openclaw) - Imports each benchmark instance into a fresh plugin DB
- Asks the benchmark question through
openclaw agent --local - Writes a
predictions.jsonlfile plus a run summary JSON
Capabilities
- configSchema
- Yes
- Executes code
- Yes
- HTTP routes
- 0
- Plugin kind
- memory
- Runtime ID
- openclaw-memory-supermemory
Compatibility
- Built With Open Claw Version
- 2026.4.5
- Plugin Api Range
- >=2026.4.5
Verification
- Tier
- source linked
- Scope
- artifact only
- Summary
- Validated package structure and linked the release to source metadata.
- Commit
- https://gith
- Tag
- https://github.com/ivanvmoreno/supermemory-openclaw/releases/tag/v0.6.7
- Provenance
- No
- Scan status
- clean
Tags
- latest
- 0.6.7
