agentmemory - Persistent Memory via MCP for OpenClaw — agentmemory - 通过MCP为OpenClaw实现的持久内存
v2026.5.4通过 agentmemory 为 OpenClaw 提供持久的跨会话内存。使用场景: - 用户要求安装/配置 OpenClaw 的 agentmemory - 代理需要在会话之间记住项目上下文、决策或工作流 - 为 OpenClaw 设置长期内存(MCP 模式) - 将 agentmemory 与现有的 MEMORY.md 系统集成 - 解决 agentmemory 连接问题 - 升级或移除 agentmemory
运行时依赖
安装命令
点击复制本土化适配说明
agentmemory - Persistent Memory via MCP for OpenClaw — agentmemory - 通过MCP为OpenClaw实现的持久内存 安装说明: 安装命令:["openclaw skills install agentmemory-mcp","openclaw gateway restart","openclaw status # Should show \"Config valid\""]
技能文档
agentmemory集成OpenClaw状态:✅ 已验证与OpenClaw v2026.5.4兼容版本:agentmemory v0.9.9(iii-engine v0.11.6)MCP工具:107个REST + 51个MCP工具可用持久内存服务器为OpenClaw代理提供95.2%的R@5语义回忆率,跨会话通过BM25+Vector+Graph RRF混合搜索。架构OpenClaw代理 ←→ 网关(MCP)←→ agentmemory MCP服务器(localhost:3111)↓ SQLite/KV存储 ↓ 查看器(localhost:3113)快速开始(MCP模式 — 5分钟)步骤1:安装并启动内存服务器# 服务器运行在localhost:3111,查看器在localhost:3113npx @agentmemory/agentmemory步骤2:配置OpenClaw MCP在~/.openclaw/openclaw.json中添加mcp.servers:{ "mcp": { "servers": { "agentmemory": { "command": "npx", "args": ["-y", "@agentmemory/mcp"] } } } }步骤3:重启网关openclaw gateway restart步骤4:验证curl http://localhost:3111/agentmemory/health# → {"status":"healthy","version":"0.9.9"}# 查看内存仪表盘open http://localhost:3113MCP工具(OpenClaw的关键工具)工具目的memory_recall跨所有内存的语义搜索memory_save存储新内存带类型/标签memory_smart_search混合BM25+向量搜索memory_timeline按时间顺序查看内存memory_profile代理的内存使用统计memory_snapshot以JSON格式导出全部内存memory_forget删除特定内存memory_context获取当前会话的上下文请参阅references/mcp-tools.md以获取全部51个工具的列表。systemd服务(生产环境)为了实现自动启动和可靠的后台运行:安装服务mkdir -p ~/.config/systemd/usercp /home/lufei/.openclaw/workspace/skills/agentmemory/scripts/agentmemory.service ~/.config/systemd/user/systemctl --user daemon-reloadsystemctl --user enable agentmemorysystemctl --user start agentmemory# 启用linger(无需登录即可启动)loginctl enable-linger $(whoami)服务命令systemctl --user status agentmemory# 查看状态journalctl --user -u agentmemory -f# 查看日志systemctl --user restart agentmemory# 重启与MEMORY.md集成agentmemory和MEMORY.md具有不同的目的 —— 它们共存:层系统目的管理体验agentmemory自动捕获,语义回忆,跨代理MCP知识MEMORY.md策划的决定,偏好,规则手动协调规则在开始重要任务之前:调用memory_recall以检索相关经验在做出重要决定之后:调用memory_save并带上结果策划的知识:存储在MEMORY.md中(在压缩后仍然存在)会话开始:两个系统都已加载;无冲突可选迁移如果MEMORY.md中有有价值的内容:npx @agentmemory/agentmemory migrate --from-file ~/.openclaw/workspace/MEMORY.md验证运行验证脚本:bash /home/lufei/.openclaw/workspace/skills/agentmemory/scripts/verify.sh预期输出:✅ 内存服务器在端口3111✅ 健康端点响应✅ 查看器在端口3113可用✅ OpenClaw MCP配置✅ systemd服务活动卸载MCP模式删除从openclaw.json的mcp.servers部分删除openclaw gateway restart全部删除systemctl --user stop agentmemorysystemctl --user disable agentmemoryrm ~/.config/systemd/user/agentmemory.servicepkill -f "agentmemory"故障排除“连接被拒绝在端口3111”内存服务器未运行。启动它:systemctl --user start agentmemory# 或手动:npx @agentmemory/agentmemory“配置无效”在编辑openclaw.json后确保mcp.servers路径(而不是mcpServers)。运行:openclaw status# 应该显示“配置有效”查看实时日志journalctl --user -u agentmemory -f --since "1 hour ago"