← 返回 Skills 市场
lufei4

Agentmemory

作者 刘士江 · GitHub ↗ · v1.2.0 · MIT-0
cross-platform ⚠ suspicious
162
总下载
1
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install agentmemory-mcp
功能描述
Persistent cross-session memory for OpenClaw via agentmemory. Use when: - User asks to install/configure agentmemory for OpenClaw - Agent needs to remember p...
使用说明 (SKILL.md)

agentmemory Integration for OpenClaw

Status: ✅ Verified working with OpenClaw v2026.5.4 Version: agentmemory v0.9.9 (iii-engine v0.11.6) MCP Tools: 107 REST + 51 MCP tools available

Persistent memory server giving OpenClaw agents 95.2% R@5 semantic recall across sessions via BM25+Vector+Graph RRF hybrid search.

Architecture

OpenClaw Agent ←→ Gateway (MCP) ←→ agentmemory MCP Server (localhost:3111)
                                              ↓
                                         SQLite/KV Store
                                              ↓
                                      Viewer (localhost:3113)

Quick Start (MCP Mode — 5 minutes)

Step 1: Install and start memory server

# Server runs on localhost:3111, viewer at localhost:3113
npx @agentmemory/agentmemory

Step 2: Configure OpenClaw MCP

Add to ~/.openclaw/openclaw.json under mcp.servers:

{
  "mcp": {
    "servers": {
      "agentmemory": {
        "command": "npx",
        "args": ["-y", "@agentmemory/mcp"]
      }
    }
  }
}

Step 3: Restart Gateway

openclaw gateway restart

Step 4: Verify

curl http://localhost:3111/agentmemory/health
# → {"status":"healthy","version":"0.9.9"}

# View memory dashboard
open http://localhost:3113

MCP Tools (Key ones for OpenClaw)

Tool Purpose
memory_recall Semantic search across all memories
memory_save Store new memories with type/tags
memory_smart_search Hybrid BM25+vector search
memory_timeline View memories chronologically
memory_profile Agent's memory usage stats
memory_snapshot Full memory export as JSON
memory_forget Delete specific memories
memory_context Get context for current session

See references/mcp-tools.md for full list of 51 tools.


systemd Service (Production)

For auto-start and reliable background operation:

Install service

mkdir -p ~/.config/systemd/user
cp /home/lufei/.openclaw/workspace/skills/agentmemory/scripts/agentmemory.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable agentmemory
systemctl --user start agentmemory

# Enable linger (boot without login)
loginctl enable-linger $(whoami)

Service commands

systemctl --user status agentmemory   # Check status
journalctl --user -u agentmemory -f   # View logs
systemctl --user restart agentmemory  # Restart

Integration with MEMORY.md

agentmemory and MEMORY.md serve different purposes — they coexist:

Layer System Purpose Management
Experience agentmemory Manual save, semantic recall, cross-agent memory_save (manual)
Knowledge MEMORY.md Curated decisions, preferences, rules Manual

Coordination rules

  • Before major tasks: Call memory_recall to retrieve relevant experiences
  • After important decisions: Call memory_save with result
  • Curated knowledge: Stays in MEMORY.md (survives compaction)
  • Session start: Both systems loaded; no conflicts

After installation: migrate MEMORY.md (important!)

After completing installation, strongly recommend migrating MEMORY.md content into agentmemory:

  1. Open the dashboard to view current state

    open http://localhost:3113
    

    Initially empty — migration populates it with searchable data.

  2. Migrate MEMORY.md content Since migrate --from-file CLI is not yet available, migrate by:

    • Asking the lobster agent to migrate content for you
    • Or manually calling memory_save for key entries from MEMORY.md
  3. Verify migration results After migration, reopen http://localhost:3113 to confirm data is stored.

Note: MEMORY.md stays intact — both systems coexist. agentmemory handles semantic search; MEMORY.md holds curated knowledge.


Verification

Run the verification script:

bash /home/lufei/.openclaw/workspace/skills/agentmemory/scripts/verify.sh

Expected output:

  • ✅ Memory server on port 3111
  • ✅ Health endpoint responding
  • ✅ Viewer available on port 3113
  • ✅ OpenClaw MCP configured
  • ✅ systemd service active

Uninstall

MCP mode removal

  1. Remove from openclaw.json mcp.servers section
  2. openclaw gateway restart

Full removal

systemctl --user stop agentmemory
systemctl --user disable agentmemory
rm ~/.config/systemd/user/agentmemory.service
pkill -f "agentmemory"

Troubleshooting

"Connection refused on port 3111"

Memory server not running. Start it:

systemctl --user start agentmemory
# Or manually: npx @agentmemory/agentmemory

"Config invalid" after editing openclaw.json

Ensure mcp.servers path (not mcpServers). Run:

openclaw status  # Should show "Config valid"

View real-time logs

journalctl --user -u agentmemory -f --since "1 hour ago"


中文版 Chinese Version

agentmemory × OpenClaw 集成

状态: ✅ 已验证兼容 OpenClaw v2026.5.4 版本: agentmemory v0.9.9(引擎 iii v0.11.6) MCP 工具: 107 个 REST + 51 个 MCP 工具

持久化记忆服务,为 OpenClaw Agent 提供跨会话语义召回能力(R@5 95.2%),基于 BM25+向量+图谱混合搜索。

系统架构

OpenClaw Agent ←→ Gateway (MCP) ←→ agentmemory MCP 服务器 (localhost:3111)
                                              ↓
                                          SQLite/KV 存储
                                              ↓
                                        浏览器仪表板 (localhost:3113)

快速开始(MCP 模式 — 5 分钟)

第一步:启动记忆服务器

npx @agentmemory/agentmemory
# 服务器端口:3111(API)、3113(浏览器仪表板)

第二步:配置 OpenClaw MCP

~/.openclaw/openclaw.json 中加入:

{
  "mcp": {
    "servers": {
      "agentmemory": {
        "command": "npx",
        "args": ["-y", "@agentmemory/mcp"]
      }
    }
  }
}

第三步:重启 Gateway

openclaw gateway restart

第四步:验证

curl http://localhost:3111/agentmemory/health
# → {"status":"healthy","version":"0.9.9"}

# 打开记忆仪表板
open http://localhost:3113

核心 MCP 工具

工具 用途
memory_recall 跨所有记忆的语义搜索
memory_save 以类型/标签存储新记忆
memory_smart_search BM25+向量混合搜索
memory_timeline 按时间线查看记忆
memory_profile Agent 记忆使用统计
memory_snapshot 完整记忆导出 JSON
memory_forget 删除指定记忆
memory_context 获取当前会话上下文

完整 51 个工具列表见 references/mcp-tools.md


systemd 服务(生产环境推荐)

安装服务:

mkdir -p ~/.config/systemd/user
cp /home/lufei/.openclaw/workspace/skills/agentmemory/scripts/agentmemory.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable agentmemory
systemctl --user start agentmemory

# 启用 linger(开机免登录自动启动)
loginctl enable-linger $(whoami)

常用命令:

systemctl --user status agentmemory   # 查看状态
journalctl --user -u agentmemory -f  # 实时日志
systemctl --user restart agentmemory  # 重启

与 MEMORY.md 的协同

两个系统分工不同,共存互补:

层级 系统 用途 管理方式
经验层 agentmemory 手动保存重要内容、语义召回、跨 Agent 共享 memory_save(手动调用)
知识层 MEMORY.md 精心整理的决策、偏好、规则 手工维护

协调规则:

  • 任务开始前 → 调用 memory_recall 检索相关经验
  • 重要决策后 → 调用 memory_save 保存结果
  • 精选知识 → 留在 MEMORY.md(不受会话压缩影响)
  • 会话启动时 → 两个系统同时加载,无冲突

首次安装后:迁移 MEMORY.md(重要!)

安装完成后,强烈建议将 MEMORY.md 的核心内容迁移到 agentmemory:

  1. 打开仪表板查看当前状态

    open http://localhost:3113
    

    初始是空的,迁移后才有数据可搜。

  2. 手动迁移 MEMORY.md 内容 由于 migrate --from-file CLI 命令暂不可用,请通过以下方式迁移核心内容:

    • 在 OpenClaw 对话中让龙虾帮你迁移
    • 或手动调 memory_save 保存 MEMORY.md 中的重要条目
  3. 验证迁移结果 迁移完成后,再次打开 http://localhost:3113 查看记忆仪表板,确认数据已入库。

注意:MEMORY.md 本身保留不动,两套系统共存 — agentmemory 负责语义搜索,MEMORY.md 负责手工精修知识。


验证

bash /home/lufei/.openclaw/workspace/skills/agentmemory/scripts/verify.sh

预期结果:

  • ✅ 记忆服务器在 3111 端口运行
  • ✅ Health 端点正常响应
  • ✅ 仪表板在 3113 端口可访问
  • ✅ OpenClaw MCP 已配置
  • ✅ systemd 服务已激活

卸载

仅移除 MCP 模式:

  1. openclaw.jsonmcp.servers 中删除 agentmemory 条目
  2. 执行 openclaw gateway restart

完全移除:

systemctl --user stop agentmemory
systemctl --user disable agentmemory
rm ~/.config/systemd/user/agentmemory.service
pkill -f "agentmemory"

故障排查

"Connection refused on port 3111" 服务器未启动,启动它:

systemctl --user start agentmemory
# 或手动:npx @agentmemory/agentmemory

修改 openclaw.json 后提示 "Config invalid" 确保路径是 mcp.servers(不是 mcpServers):

openclaw status  # 应显示 "Config valid"

查看实时日志:

journalctl --user -u agentmemory -f --since "1 hour ago"

实际带来的好处

场景 没有 agentmemory 有 agentmemory
会话丢失上下文 每次重新解释背景 自动从历史记忆捞取
跨会话决策追溯 靠 MEMORY.md 手工记录 memory_recall 语义搜索自动找
重复踩同一个坑 不同 session 反复犯错 学到的教训自动积累+衰减
新项目上手 要翻很久聊天记录 语义搜索项目背景即得
记忆体检索 关键词匹配漏检率高 BM25+Vector+Graph RRF,R@5=95.2%
记忆保存方式 全靠手工写 MEMORY.md 手动调 memory_save 保存重要内容

🦞 Skill by 龙虾 — agentmemory-mcp on ClawHub: https://clawhub.ai/lufei4/agentmemory-mcp

安全使用建议
Install only if you intentionally want persistent cross-session memory. Verify the npm packages before running them, avoid saving secrets, review and delete stored memories regularly, and be cautious about enabling the background service or automatic capture until the memory-injection and retention controls are clear.
能力评估
Purpose & Capability
The persistent-memory purpose is coherent, but the included plugin automatically saves session-derived summaries and reinjects recalled memory as system messages, which gives stored content high influence over future sessions.
Instruction Scope
The skill encourages recall before tasks and saving after decisions, but the artifacts do not show clear safeguards for poisoned memories, retention limits, exclusions, or user approval around automatic capture.
Install Mechanism
Setup is user-directed, but it relies on npx-run npm packages without pinned versions and includes optional background-service setup; users should verify package provenance before running it.
Credentials
Localhost endpoints are proportionate for a local memory service, but project/session content may be stored and reused across sessions without visible retention or sensitivity controls.
Persistence & Privilege
Persistent operation is disclosed and aligned with cross-session memory, but the optional systemd/linger setup keeps the memory server running beyond a single task.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install agentmemory-mcp
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /agentmemory-mcp 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.2.0
Bilingual EN/CN description added to frontmatter
v1.1.0
Bilingual EN/CN skill - added full Chinese section, benefits table, coordination rules
v1.0.0
Initial release: MCP mode, systemd service, MEMORY.md coordination, 95.2% R@5 semantic recall, 51 MCP tools
元数据
Slug agentmemory-mcp
版本 1.2.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

Agentmemory 是什么?

Persistent cross-session memory for OpenClaw via agentmemory. Use when: - User asks to install/configure agentmemory for OpenClaw - Agent needs to remember p... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 162 次。

如何安装 Agentmemory?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install agentmemory-mcp」即可一键安装,无需额外配置。

Agentmemory 是免费的吗?

是的,Agentmemory 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Agentmemory 支持哪些平台?

Agentmemory 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Agentmemory?

由 刘士江(@lufei4)开发并维护,当前版本 v1.2.0。

💬 留言讨论