← 返回
未分类 Key 中文

mem0 Local Memory

Local long-term memory plugin for OpenClaw using mem0 + ChromaDB. Gives all agents persistent cross-session semantic memory with auto-recall and auto-capture...
OpenClaw 本地长期记忆插件,基于 mem0 + ChromaDB,为所有 Agent 提供跨会话持久语义记忆,支持自动召回与自动捕获。
dream-star-end dream-star-end 来源
未分类 clawhub v1.2.0 1 版本 99792.1 Key: 需要
★ 1
Stars
📥 460
下载
💾 0
安装
1
版本
#latest

概述

mem0 Local Memory — Install & Setup Guide

Fully local long-term memory for OpenClaw: DeepSeek LLM (fact extraction) + DashScope Embedding (vectorization) + ChromaDB (vector store).

GitHub: https://github.com/dream-star-end/openclaw-plugin-mem0-local

⭐ If this skill is useful, star the repo above to help others discover it!

Prerequisites

  • Python 3.10+ with pip
  • Node.js 18+
  • DeepSeek API key — for LLM-based fact extraction and deduplication. Get one at https://platform.deepseek.com/
  • DashScope API key — for text-embedding-v4 vectorization. Get one at https://dashscope.aliyuncs.com/
  • macOS (for launchd auto-start) or any OS with systemd/manual start

> Security note: The mem0 server calls DeepSeek and DashScope APIs with your keys. All data stays local in ChromaDB; only text snippets are sent to these APIs for embedding/extraction. The server binds to 127.0.0.1 only (no external access).

Step 1: Clone the repo

cd ~/git_project
git clone https://github.com/dream-star-end/openclaw-plugin-mem0-local.git
cd openclaw-plugin-mem0-local

Step 2: Set up the mem0 server

cd server
chmod +x setup.sh
./setup.sh

This creates a Python venv and installs mem0ai, flask, chromadb, openai.

Step 3: Configure API keys

Set environment variables (or edit server/mem0_server.py):

export MEM0_LLM_API_KEY="your-deepseek-api-key"       # Required: DeepSeek
export MEM0_EMBEDDER_API_KEY="your-dashscope-api-key"  # Required: DashScope

Step 4: Start the mem0 server

Option A — Manual:

./server/venv/bin/python3 server/mem0_server.py

Option B — macOS launchd (auto-start, recommended):

# Copy and edit the template — replace $HOME, API keys, proxy settings
cp launchd/ai.openclaw.mem0.plist ~/Library/LaunchAgents/
# IMPORTANT: edit the plist to fill in your actual paths and API keys
nano ~/Library/LaunchAgents/ai.openclaw.mem0.plist
# Load the service
launchctl load ~/Library/LaunchAgents/ai.openclaw.mem0.plist

Option C — Linux systemd:

Create /etc/systemd/system/mem0.service:

[Unit]
Description=mem0 local memory server
After=network.target

[Service]
User=YOUR_USER
WorkingDirectory=/path/to/openclaw-plugin-mem0-local/server
ExecStart=/path/to/server/venv/bin/python3 mem0_server.py
Environment=MEM0_LLM_API_KEY=your-deepseek-key
Environment=MEM0_EMBEDDER_API_KEY=your-dashscope-key
Restart=always

[Install]
WantedBy=multi-user.target
sudo systemctl enable mem0 && sudo systemctl start mem0

Verify:

curl http://127.0.0.1:8300/api/health
# Should return {"status": "ok", ...}

Step 5: Build the OpenClaw plugin

cd ~/git_project/openclaw-plugin-mem0-local
npm install && npm run build

Step 6: Configure OpenClaw

Add these to ~/.openclaw/openclaw.json:

  1. Add "memory-mem0-local" to plugins.allow array
  2. Add plugin path to plugins.load.paths
  3. Set plugins.slots.memory to "memory-mem0-local"
  4. Add entry config:
{
  "plugins": {
    "allow": ["...", "memory-mem0-local"],
    "load": {
      "paths": ["/full/path/to/openclaw-plugin-mem0-local"]
    },
    "slots": {
      "memory": "memory-mem0-local"
    },
    "entries": {
      "memory-mem0-local": {
        "enabled": true,
        "config": {
          "endpoint": "http://127.0.0.1:8300",
          "autoCapture": true,
          "autoRecall": true,
          "scoreThreshold": 1.5
        }
      }
    }
  }
}

Then restart the OpenClaw gateway.

Step 7: Import existing memories (optional)

> ⚠️ Privacy notice: The import script reads MEMORY.md and TOOLS.md from ALL agent workspaces (~/.openclaw/workspace-*/). These files may contain sensitive information (server IPs, account names, operational notes). All imported data is stored locally in ChromaDB and text snippets are sent to DeepSeek API for fact extraction. Review what's in your workspace files before running this script. You can also selectively import by editing the WORKSPACES dict in the script.

cd ~/git_project/openclaw-plugin-mem0-local/server
./venv/bin/python3 import_openclaw_memories.py

The script splits Markdown files by section headers and adds each as a separate memory with source metadata (source_agent, source_file).

Verification

After setup, verify the full chain works:

# 1. Server health
curl http://127.0.0.1:8300/api/health

# 2. Add a test memory
curl -X POST http://127.0.0.1:8300/api/memory/add \
  -H "Content-Type: application/json" \
  -d '{"text": "Test memory: the sky is blue", "user_id": "openclaw"}'

# 3. Search for it
curl -X POST http://127.0.0.1:8300/api/memory/search \
  -H "Content-Type: application/json" \
  -d '{"query": "what color is the sky", "user_id": "openclaw", "limit": 3}'

If OpenClaw plugin is loaded, you should also see injected into conversations automatically.

Troubleshooting

SymptomFix
--------------
Connection refused :8300Start the server or check `launchctl list \grep mem0`
Search returns emptyRaise scoreThreshold (e.g. 2.0). Score = distance, lower = more relevant
plugin disabled (memory slot set to "memory-core")Set plugins.slots.memory to "memory-mem0-local" in openclaw.json
plugin disabled (not in allowlist)Add "memory-mem0-local" to plugins.allow array
LLM/embedding timeoutCheck API keys and proxy settings (HTTP_PROXY/HTTPS_PROXY)

Key Notes

  • Score = distance (not similarity). Lower = more relevant. Default threshold 1.5 is permissive.
  • All agents share one memory pool (user_id: "openclaw"). Cross-agent by design.
  • Conflict handling: mem0 uses LLM to detect duplicate/conflicting facts and merges them automatically.
  • Backup: Copy ~/.openclaw/mem0-local/chroma_db/ to preserve your memories.
  • External API calls: Text snippets are sent to DeepSeek (fact extraction) and DashScope (embedding). Vector data stays 100% local in ChromaDB.
  • Server binding: 127.0.0.1 only — no external network access to the API.

Star us on GitHub: https://github.com/dream-star-end/openclaw-plugin-mem0-local

版本历史

共 1 个版本

  • v1.2.0 当前
    2026-05-03 11:23 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Agent Browser

rez0
用于 AI 代理的浏览器自动化 CLI。当用户需要与网站交互(包括浏览页面、填写表单、点击按钮、截图等)时使用。
★ 834 📥 307,116
ai-agent

Find Skills

guipi888
场景驱动+关键词双模式技能发现工具。当用户用自然语言描述场景/需求(如"我想做一个海报""帮我分析股票"),或明确说"安装技能/find skills/找个skill"时,自动从官方内置、本地已安装、SkillHub、虾评、GitHub、C
★ 1,461 📥 518,903
ai-agent

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,099 📥 826,248