Replace the built-in memory backend with mem7's LLM-powered fact extraction, vector + graph dual-path recall, automatic deduplication, and Ebbinghaus forgetting curve.
openclaw plugins install @mem7ai/openclaw-mem7
Drop-in memory upgrade for any OpenClaw agent. No code changes needed.
Before each agent turn, relevant memories are searched and injected into the system prompt automatically. The agent always has context.
After each turn, user + assistant messages are processed through LLM fact extraction. New facts are stored, duplicates are merged.
Entities and relations are extracted and stored in a graph database. The agent sees both facts and connections.
Enabled by default. Stale facts fade over time; frequently recalled memories grow stronger. No manual cleanup needed.
Two lifecycle hooks and three tools — that's the entire integration surface.
before_prompt_build hook.<mem7_context>.memory_search, memory_get, memory_list, memory_store, or memory_forget explicitly.agent_end hook sends user + assistant messages through mem7's fact extraction pipeline. New facts stored, duplicates merged. Fire-and-forget — never blocks the response.<mem7_context>
## Relevant memories about this user:
- [2026-03-15] Alice loves playing tennis (score: 0.92)
- [2026-03-10] Alice's coach is Sarah (score: 0.87)
- [2026-02-28] Alice is allergic to dairy (score: 0.74)
## Known relations:
- Alice -[loves_playing]-> tennis
- Alice -[coached_by]-> Sarah
- Alice -[allergic_to]-> dairy
</mem7_context>
Five tools the agent can call explicitly, alongside the automatic hooks.
memory_search
contract
Search session, long-term, or merged memory scopes for facts, preferences, and relations relevant to a query.
query string
required
scope "session" | "long-term" | "all"
default: all
limit integer
default: 5
memory_get
contract
Retrieve a specific memory by UUID, or pass path="all" to list memories for the selected scope.
memoryId string
preferred
path string
legacy / "all"
memory_list
custom
List stored memories for the selected session, long-term, or merged scope.
scope "session" | "long-term" | "all"
default: all
limit integer
default: topK / 50
memory_store
custom
Explicitly store a fact into session or long-term memory. Processed through LLM extraction and dedup.
text string
required
scope "session" | "long-term"
default: long-term
memory_forget
custom
Delete a specific memory by UUID, or search for likely delete candidates by semantic query.
memoryId string
optional
query string
optional
Add the plugin to your ~/.openclaw/openclaw.json.
{
"plugins": {
"slots": { "memory": "openclaw-mem7" },
"entries": {
"openclaw-mem7": {
"enabled": true,
"config": {
"llm": {
"base_url": "http://localhost:11434/v1",
"api_key": "ollama",
"model": "qwen2.5:7b"
},
"embedding": {
"base_url": "http://localhost:11434/v1",
"api_key": "ollama",
"model": "mxbai-embed-large",
"dims": 1024
},
"graph": { "provider": "flat" },
"decay": { "enabled": true }
}
}
}
}
}
All fields except llm and embedding are optional.
| Key | Default | Description |
|---|---|---|
llm |
required | LLM config for fact extraction and dedup (OpenAI-compatible) |
embedding |
required | Embedding provider config |
vector |
{ provider: "flat" } |
Vector store backend — flat (in-memory) or upstash |
graph |
disabled | Graph store — flat, neo4j, or kuzu |
decay |
{ enabled: true } |
Forgetting curve parameters (enabled by default in plugin) |
autoRecall |
true |
Inject relevant memories before each agent turn |
autoRecallLimit |
5 |
Max memories to inject via auto-recall |
topK |
5 |
Default result limit for tool-driven search and list operations |
searchThreshold |
unset | Optional minimum score for plugin search and auto-recall |
autoCapture |
true |
Extract and store facts after each agent turn |
userId |
"default" |
Base user namespace for long-term memory; session scoping is derived separately |
dbPath |
~/.openclaw/mem7 |
Base directory for SQLite history DB and graph data |
The plugin sits between the OpenClaw agent runtime and the mem7 Rust engine.
Unlike standalone mem7, the plugin enables the forgetting curve by default. Long-running OpenClaw sessions accumulate stale facts quickly — decay keeps them fresh.
Auto-recall injects via system prompt, not tool calls. This ensures every turn has context without relying on the agent to call memory_search explicitly.
Auto-capture is fully async. Errors are logged but never block the user-facing response. Memory extraction happens in the background after each turn.
Unlike other OpenClaw memory plugins that use Markdown files, this plugin fully replaces the memory backend. No MEMORY.md is used.
The base userId defaults to "default". The current sessionKey supplies session runId, and keys like agent:<id>:... also derive agentId for per-agent isolation.
If you omit API keys from the plugin config, it falls back to keys already configured in OpenClaw's model providers — no double-configuration needed.