* feat(integrations): add ZCode memory plugin Package ReMe lifecycle hooks, MCP tools, and the reme-memory skill as an installable ZCode plugin. The hook queues completed turns locally and retries delivery from later sessions so transient service failures do not lose memory. * fix(zcode): resolve pre-commit failures without blocking delivery * fix(zcode): honor disabled memory, keep one prompt copy, document setup Address the review on the ZCode integration: - config.example.json ships an empty api_url so the default single-port deployment is derived from mcp_url instead of pointing at a port the default `reme start` does not open. - remember_prompt writes a single cache record per turn: a payload without a turn ID is read back from latest.json, so the extra hashed copy left plaintext prompt text behind after the turn was delivered. - flush_worker re-reads auto_memory before delivering and leaves pending files untouched when recording was disabled mid-flight; it also uses a worker.rerun marker so a delivery request arriving while another pass holds the lock triggers a rescan instead of being dropped. - README/README_ZH now follow the Qoder guide: dependency install, model credentials, an executable `reme start` with an explicit workspace, platform-specific commands, empty-api_url derivation, the memory_interval example vs default, MCP reconnect after endpoint changes, a health_check/version check before the memory test, and a qualified statement about the async hook field and the detached worker. - Regression tests cover all four behaviors. Co-Authored-By: Claude Code <noreply@anthropic.com> * docs(zcode): state the verified ZCode build Name the build the plugin was verified on and the reason compatibility rests on payload fields rather than a version number. Co-Authored-By: Claude Code <noreply@anthropic.com> * test(zcode): name unused flush_all config with an underscore * fix(zcode): make worker handoff race-safe and honor the recording switch The rerun marker was written only after a failed lock acquisition, so a contender suspended between the failed acquire and the marker write left a queued session and a marker with no worker to process them. The worker now publishes its request before contending for the lock, which leaves exactly two outcomes: the owner sees the marker and scans again, or the lock is free and this worker delivers itself. worker.rerun also dropped force semantics, so a SessionStart force request lost to a Stop owner whose rerun pass then stayed non-forced. A separate, never downgraded worker.force marker keeps the stronger request until the next pass. The auto_memory switch was checked once at worker entry and the snapshot reused for every batch, so disabling recording during a run still submitted later batches. The switch is now rechecked before every network submission and unsent queue files are preserved when it is disabled. Co-Authored-By: Claude Code <noreply@anthropic.com> * fix(zcode): claim worker requests atomically and scope them by endpoint The force marker was read with exists() and removed with unlink(), so a SessionStart contender that published worker.rerun and worker.force while a force=False owner held the lock had its request deleted by a pass that never saw it; the owner then delivered unforced and both markers were gone. Requests are now consumed by one atomic rename that returns whether this pass owns the force request, so a marker published after that step stays on disk for the next pass. worker.lock, worker.rerun and worker.force lived in the shared data directory while the queues are endpoint-scoped. An old-endpoint worker awaiting its acknowledgement therefore blocked a worker for a newly configured endpoint and then consumed its request while rescanning only the old queue. Scheduling state now lives under workers/<endpoint digest>, beside the queue it serves, so each endpoint's request reaches a worker that scans that endpoint. validate_config resolved the default Asia/Shanghai without checking whether an IANA database exists, so a Windows host without tzdata failed with "timezone must be an IANA timezone". Missing timezone data and an invalid key now report different errors, and the setup docs install tzdata on Windows and state what a missing database logs. Co-Authored-By: Claude Code <noreply@anthropic.com> * style(zcode): satisfy pre-commit on the timezone and endpoint tests Add the trailing comma add-trailing-comma expects in the missing-timezone-data error and rename the unused call() argument in the endpoint-switch regression test, so Pre-commit stays green without touching behavior. Co-Authored-By: Claude Code <noreply@anthropic.com> --------- Co-authored-by: Claude Code <noreply@anthropic.com>
5.8 KiB
| title | description |
|---|---|
| Agent 集成 | 通过 CLI、HTTP、MCP、Skill 和宿主适配器把 ReMe 接入 Agent。 |
Agent 集成
ReMe 把记忆能力放在独立服务和用户拥有的 workspace 中。Agent 可以通过标准接口调用同一套记忆,而不必把存储逻辑绑定到某一个模型或宿主。
选择接入方式
| 场景 | 推荐方式 |
|---|---|
| 本机脚本或 Hook | ReMe CLI |
| 应用后端 | HTTP Client |
| 支持工具协议的 Agent | MCP |
| DeepSeek Harness | @agentscope-ai/reme-dsh-plugin profile bundle |
| OpenClaw | @agentscope-ai/reme-openclaw-plugin |
| Claude Code | 启动 ReMe 后安装插件 |
| Qoder | 启动 ReMe 后安装插件 |
| ZCode | 启动 ReMe 后安装插件 |
| Hermes Agent | Memory provider adapter |
| Codex | 启动 ReMe 后安装插件 |
| 其他 coding agent | reme_memory Skill 或 MCP |
通用接入循环
一个完整但可控的 Agent 记忆循环通常包含:
- 会话开始或回答前,用
search找到相关记忆; - 对高价值结果使用
read,必要时用traverse展开关系; - 在回答中保留 workspace-relative 来源路径;
- 会话结束后,把原始消息交给
auto_memory; - 由后台或定时任务把 daily 内容整理到 digest。
搜索不到内容时应明确返回空结果,不应把模型推测当成历史记忆。
MCP
默认 HTTP 服务在 http://127.0.0.1:2333/mcp 提供 streamable HTTP MCP。常用工具包括:
searchreadtraverselistauto_memoryproactive_read
根据宿主风险模型,可以用 service.jobs 只暴露只读工具,或将写入工具放在单独配置中。
CLI 和 Skill
仓库中的 skills/reme_memory/SKILL.md 描述了一个通用 Agent 工作流,包括安装检查、服务发现、检索、读取和写入边界。它适合能够执行本地命令的 Agent。
Skill 不应:
- 未经允许安装或升级 Python 环境;
- 发现端口冲突后停止未知进程;
- 把召回的工具结果再次写入对话来源;
- 将密钥或敏感信息写入记忆。
DeepSeek Harness
安装自包含的 DeepSeek Harness 插件:
dsh plugin --profile web add @agentscope-ai/reme-dsh-plugin
发布页:Awesome DSH Plugin 和 npm。
插件会在新的根 Agent 会话中注入长期记忆使用指引,并提供只读 reme_search 工具;它不会把所有历史记忆预先塞入上下文。
已完成的用户/助手对话可以分批在后台交给 auto_memory,并由带时区的计划任务调用 auto_dream 整理 daily note。
DSH 设置可配置服务地址、指引语言、搜索数量、捕获间隔、根 Agent 过滤和整理计划。ReMe Status 页面包含 Overview、 Auto Memory、Memory Consolidation、Components、Journal 和 Personal Knowledge Base 六个视图。运行时计数只用于诊断, workspace 中的 Markdown 仍是持久事实来源。
OpenClaw
安装独立发布的 OpenClaw 插件:
openclaw plugins install clawhub:@agentscope-ai/reme-openclaw-plugin
发布页:ClawHub 和 npm。该插件拥有自己的宿主适配 ReMe HTTP 边界和发布周期。
Claude Code
先启动 ReMe HTTP 服务,再安装 Claude Code 的 ReMe 插件。 插件统一提供自动召回、完成轮次记录和记忆查询,所需 Hook、MCP 工具与 Skill 随插件安装。 本宿主使用插件安装流程接入。
Codex
先启动 ReMe HTTP 服务,再安装 Codex 的 ReMe 插件,在 /hooks 中信任插件 Hook。
新建会话后即可使用自动召回、记录和插件提供的记忆工具。本宿主同样使用插件安装流程接入。
两端各自保存插件配置与重试队列,记忆存储和整理由 ReMe 服务负责。
Qoder
先启动 ReMe HTTP 服务,再安装 Qoder 的 ReMe 插件。插件整包提供生命周期
Hook、MCP Bridge 和 reme-memory Skill;Qoder 以 user 级插件统一加载全部组件,不再需要手工维护
settings.json 中的 ReMe Hook。
Qoder 的 transcript 与 Claude Code 一样使用 user/assistant JSONL。插件会捕获完成轮次,把失败写入 留在本地队列重试,并通过配置的 HTTP Job API 提交。使用期间需保持 ReMe 服务运行。
ZCode
先启动 ReMe HTTP 服务,再添加本地市场并安装 ZCode 的 ReMe 插件。
插件整包提供生命周期 Hook、MCP Bridge 和 reme-memory Skill。
ZCode 只提供 7 个 Hook 事件,且当前 async 字段仍在主流程执行。适配器会在
UserPromptSubmit 暂存用户文本,在 Stop 与最终回复配对,再启动脱离宿主的后台投递进程;
SessionStart 重试残留批次。失败写入会保留在按服务地址隔离的本地队列中。
Hermes Agent
integrations/hermes_agent/ 提供 HTTP 和 Embedded 双模式 memory provider:模型调用前检索相关记忆,每轮结束后异步调用 auto_memory,并通过 Hermes 通用配置面板展示设置。完整配置见该目录 README。
生产接入建议
- 明确选择稳定、绝对的
workspace_dir; - 启动前复用
reme find_reme发现的服务; - 以
reme help为当前 Job 契约; - 为写入动作设置超时和失败日志;
- 不因记忆服务暂时不可用而阻塞宿主的核心回答流程;
- 对远程访问使用认证、TLS 和最小 Job allowlist。