@shareclz/openclaw-mem0-plugin
v1.1.7
Published
OpenClaw memory plugin using mem0
Readme
OpenClaw Mem0 Plugin
This is a OpenClaw plugin that integrates with Mem0 to provide intelligent long-term memory capabilities for your agents.
Features
- Auto-Recall: Automatically searches for relevant past interactions and injects them into the context before the agent starts (
before_agent_start). - Auto-Capture: Automatically analyzes conversation turns and stores key information into long-term memory after the agent finishes (
agent_end). - Hybrid Scope: Supports both Session Memory (short-term, current conversation) and User Memory (long-term, cross-conversation).
- Dual Mode: Supports both Mem0 Platform (Cloud) and Open-Source (Self-hosted) backends.
- Tools: Provides 5 powerful tools for agents to interact with memory manually:
memory_search: Search for specific information.memory_store: Explicitly save important facts.memory_get: Retrieve a specific memory by ID.memory_list: List all memories for a user.memory_forget: Delete specific or matching memories (GDPR compliant).
Installation
Install via OpenClaw CLI (npm registry):
openclaw plugins install @shareclz/openclaw-mem0-pluginFor a local checkout, install the packed tarball instead of pointing OpenClaw at the whole repository directory. This repo contains other plugin projects and their tooling files, which can trip OpenClaw's install security scan.
npm pack
openclaw plugins install ./shareclz-openclaw-mem0-plugin-*.tgzConfiguration
You can configure the plugin in your ~/.openclaw/openclaw.json, the apikey and host can get from the platform.
The plugin supports two config locations:
plugins.entries["openclaw-mem0-plugin"].config(legacy / plugin-local)- environment variables via
process.envorapi.config.env
Platform Mode (Recommended)
Use the managed Mem0 Cloud service.
{
"plugins": {
"allow": [
"openclaw-mem0-plugin"
],
"slots": {
"memory": "openclaw-mem0-plugin"
},
"entries": {
"openclaw-mem0-plugin": {
"enabled": true,
"config": {
"mode": "platform",
"apiKey": "<your-mem0-api-key>",
"userId": "openclaw-user",
"host": "<your-mem0-platform-host>"
}
}
}
}
}Environment Variables
If you want to avoid the nested plugin config, you can provide Mem0 settings through environment variables:
{
"env": {
"vars": {
"MEM0_MODE": "platform",
"MEM0_API_KEY": "<your-mem0-api-key>",
"MEM0_USER_ID": "openclaw-user",
"MEM0_HOST": "<your-mem0-platform-host>"
}
},
"plugins": {
"allow": [
"openclaw-mem0-plugin"
],
"slots": {
"memory": "openclaw-mem0-plugin"
},
"entries": {
"openclaw-mem0-plugin": {
"enabled": true
}
}
}
}Supported variables include:
MEM0_MODEMEM0_API_KEYMEM0_USER_IDMEM0_HOSTMEM0_AGENT_IDMEM0_ORG_IDMEM0_PROJECT_IDMEM0_AUTO_CAPTUREMEM0_AUTO_RECALLMEM0_ADD_RUNID(optional boolean; when true, includerun_idwhen adding memories)MEM0_ENABLE_ADD_MEMORY_FROM_TOOL_USAGE_MESSAGE(optional boolean; default false; when true, include tool-use messages during auto-capture)MEM0_DEBUG_LOG(optional boolean; default false; when true, write auto-capture debug logs)MEM0_ENABLE_GRAPHMEM0_SEARCH_THRESHOLDMEM0_TOP_KMEM0_CUSTOM_INSTRUCTIONSMEM0_CUSTOM_PROMPTMEM0_CUSTOM_CATEGORIES_JSONMEM0_OSS_JSON
Usage
1. Automatic Memory (Zero-Shot)
Just enable the plugin. When you chat with your agent:
- It will automatically "remember" facts you shared in previous conversations.
- It will "recall" relevant context when you ask related questions.
2. Manual Tools
Your agents can proactively use tools:
User: "Please remember that I'm allergic to peanuts."
Agent: Calls
memory_store({ text: "User is allergic to peanuts", longTerm: true })User: "What was that book I mentioned last week?"
Agent: Calls
memory_search({ query: "book mentioned last week", scope: "long-term" })
CLI Commands
This plugin extends the OpenClaw CLI with memory management commands:
# Search memories
openclaw mem0 search "hobbies"
# Show memory statistics
openclaw mem0 statsAcknowledgements
This project is modified from mem0/openclaw.
License
Apache License Version 2.0
