ReMe/docs/en/integrations.md
star-nebula d792f450e5
feat(integrations): add ZCode memory plugin (#707)
* 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>
2026-11-25 11:21:28 +08:00

126 lines
6 KiB
Markdown

---
title: Agent Integrations
description: Connect ReMe to agents through the CLI, HTTP, MCP, Skills, and host adapters.
---
# Agent Integrations
ReMe keeps memory in an independent service and a user-owned workspace. Multiple agents can call the same memory system without binding storage to one model or host.
## Choose an interface
| Scenario | Recommended interface |
|---|---|
| Local script or hook | ReMe CLI |
| Application backend | HTTP Client |
| Tool-protocol host | MCP |
| DeepSeek Harness | [`@agentscope-ai/reme-dsh-plugin`](./integrations/dsh.md) profile bundle |
| OpenClaw | [`@agentscope-ai/reme-openclaw-plugin`](./integrations/openclaw.md) |
| Claude Code | [Start ReMe, then install the plugin](./integrations/claude-code.md) |
| Qoder | [Start ReMe, then install the plugin](./integrations/qoder.md) |
| ZCode | [Start ReMe, then install the plugin](./integrations/zcode.md) |
| Hermes Agent | Memory provider adapter |
| Codex | [Start ReMe, then install the plugin](./integrations/codex.md) |
| Other coding agents | `reme_memory` Skill or MCP |
## General memory loop
1. Before answering, call `search` for relevant memory.
2. Use `read` on high-value results and `traverse` when relationships matter.
3. Retain workspace-relative source paths in the answer.
4. At session end, pass source messages to `auto_memory`.
5. Let background or scheduled workflows consolidate daily notes into digest memory.
An empty search result must remain empty; do not present model inference as recalled history.
## MCP
The default HTTP service exposes streamable HTTP MCP at `http://127.0.0.1:2333/mcp`. Common tools include `search`,
`read`, `traverse`, `list`, `auto_memory`, and `proactive_read`.
Use `service.jobs` to expose a read-only subset or keep write tools in a separate configuration.
## CLI and Skill
`skills/reme_memory/SKILL.md` defines a general workflow for agents that can run local commands: installation checks, service discovery, retrieval, reading, and persistence boundaries.
It deliberately avoids silently modifying Python environments, stopping unknown processes on port conflicts, writing recalled tool output back as conversation source, or persisting credentials.
## DeepSeek Harness
Install the self-contained [DeepSeek Harness plugin](./integrations/dsh.md):
```bash
dsh plugin --profile web add @agentscope-ai/reme-dsh-plugin
```
Release links: [Awesome DSH Plugin](https://awesome-dsh-plugin.com/p/agentscope-ai/ReMe--integrations-dsh/) and
[npm](https://www.npmjs.com/package/@agentscope-ai/reme-dsh-plugin).
It injects long-term-memory usage guidance into new root-agent sessions and exposes the read-only `reme_search` tool;
it does not preload the full memory history into the prompt. Completed user/assistant turns can be submitted to
`auto_memory` in background batches, while a timezone-aware schedule runs `auto_dream` to consolidate daily notes.
DSH settings configure the endpoint, guidance language, search limits, capture interval, root-agent filtering, and
consolidation schedule. The ReMe Status page exposes Overview, Auto Memory, Memory Consolidation, Components, Journal,
and Personal Knowledge Base views. Runtime counters are diagnostic state; workspace Markdown remains the durable source
of truth.
## OpenClaw
Install the independently published [OpenClaw plugin](./integrations/openclaw.md):
```bash
openclaw plugins install clawhub:@agentscope-ai/reme-openclaw-plugin
```
Release links: [ClawHub](https://clawhub.ai/agentscope-ai/plugins/reme-openclaw-plugin) and
[npm](https://www.npmjs.com/package/@agentscope-ai/reme-openclaw-plugin). The plugin provides its own host-specific
ReMe HTTP boundary and release lifecycle.
## Claude Code
Start the ReMe HTTP service, then install the [ReMe plugin in Claude Code](./integrations/claude-code.md).
The installed plugin supplies automatic recall, completed-turn recording, and memory queries through its
bundled hooks, MCP tools, and skill. This host uses the plugin installation flow.
## Codex
Start the ReMe HTTP service, install the [ReMe plugin in Codex](./integrations/codex.md), and trust its
hooks in `/hooks`. Open a new conversation to use automatic recall, recording, and the plugin's memory tools.
This host also uses the plugin installation flow. Each host keeps its own plugin configuration and retry
queue; the ReMe service owns memory storage and consolidation.
## Qoder
Start the ReMe HTTP service, then install the [ReMe plugin in Qoder](./integrations/qoder.md). The
plugin bundles lifecycle hooks, an MCP bridge, and the `reme-memory` skill. Qoder loads all bundled
components as one user-scoped plugin; no manual `settings.json` hooks are required.
Qoder transcripts use the same user/assistant JSONL shape as Claude Code. The bundled adapter
captures completed turns, queues failed writes for retry, and submits them through the configured
HTTP Job API. Keep the ReMe service running while using the plugin.
## ZCode
Start the ReMe HTTP service, then add the local marketplace for the
[ReMe plugin in ZCode](./integrations/zcode.md). The plugin bundles lifecycle hooks, an MCP bridge,
and the `reme-memory` skill as one installable package.
ZCode exposes only seven Hook events, and its `async` Hook field currently runs in the foreground.
The adapter caches each user prompt at `UserPromptSubmit`, pairs it with the final response at
`Stop`, and starts a detached delivery process. `SessionStart` retries residual batches. Failed
writes remain in the endpoint-scoped local queue.
## Hermes Agent
`integrations/hermes_agent/` provides a memory provider with HTTP and embedded modes. It recalls context before model calls and asynchronously invokes `auto_memory` after each turn. Its `config_schema.py` is rendered by Hermes' generic memory settings UI.
## Production guidance
- choose a stable absolute `workspace_dir`;
- reuse a service discovered by `reme find_reme`;
- treat `reme help` as the active Job contract;
- apply timeouts and failure logging to writes;
- do not block the host's core response path when memory is temporarily unavailable;
- use authentication, TLS, and a minimal Job allowlist for remote access.