MemOSMemOS本地插件文档Local Plugin Docs
用户文档User Docs · @memtensor/memos-local-plugin

OpenClaw 与 Hermes 的本地进化记忆系统Local evolving memory for OpenClaw and Hermes

MemOS Local Plugin 提供一个 agent-agnostic 的算法核心和两个宿主适配器。OpenClaw 使用进程内 TypeScript 插件,Hermes 使用 Python MemoryProvider + JSON-RPC bridge;两者共享同一套 L1/L2/L3/Skill 算法,但运行时数据完全隔离。MemOS Local Plugin ships one agent-agnostic core with two host adapters. OpenClaw uses an in-process TypeScript plugin; Hermes uses a Python MemoryProvider and JSON-RPC bridge. Both share the same L1/L2/L3/Skill algorithm while keeping runtime data isolated.

快速开始Quick Start

安装器支持 macOS / Linux / Windows,会自动检查 Node.js 20+、下载 npm 包、重建原生依赖、写入 config.yaml,并按需启动宿主运行时。The installer supports macOS/Linux/Windows. It checks Node.js 20+, downloads the npm package, rebuilds native dependencies, writes config.yaml, and starts the host runtime when needed.

macOS / Linux:macOS / Linux:

# Latest from the repository
curl -fsSL https://raw.githubusercontent.com/MemTensor/MemOS/main/apps/memos-local-plugin/install.sh | bash

Windows (PowerShell):Windows (PowerShell):

# Latest from the repository
irm https://raw.githubusercontent.com/MemTensor/MemOS/main/apps/memos-local-plugin/install.ps1 | iex

从源码目录安装或测试指定版本:Install from a source checkout or test a specific version:

cd apps/memos-local-plugin
bash install.sh --version 2.0.0-beta.11

# Or test a local package before publishing
npm pack
bash install.sh --version ./memtensor-memos-local-plugin-*.tgz
注意:Note: 新版安装器不再支持 --port。OpenClaw 固定使用 18799,Hermes 固定使用 18800,避免两个宿主共享一个 UI 导致写入归属不清。The new installer no longer supports --port. OpenClaw owns 18799; Hermes owns 18800, avoiding ambiguous writes across hosts.

运行时路径Runtime Paths

Agent代码安装位置Code Installed To数据与配置Data and ConfigViewer
OpenClaw~/.openclaw/extensions/memos-local-plugin/~/.openclaw/memos-plugin/http://127.0.0.1:18799
Hermes~/.hermes/memos-plugin/~/.hermes/memos-plugin/http://127.0.0.1:18800

运行时目录包含:Each runtime directory contains:

config.yaml        # only config file; chmod 600, secrets live here
data/memos.db      # SQLite: sessions, episodes, traces, policies, world, skills, feedback
skills/            # crystallized skill packages
logs/              # memos.log, error.log, audit.log, llm.jsonl, perf.jsonl, events.jsonl
daemon/            # bridge pid/port files, mostly for Hermes
升级或卸载插件不会删除 data/skills/logs/config.yamlUpgrade and uninstall flows do not remove data/, skills/, logs/, or config.yaml.

分层架构Layered Architecture

Agent HostOpenClaw / Hermes
AdapterTS / Python
agent-contractDTO / events / JSON-RPC
corealgorithm + storage
OpenClaw

标准 OpenClaw 插件,入口、工具和 hooks 直接调用 core。Standard OpenClaw plugin entry, tools, and hooks calling core directly.

Hermes

Python MemoryProvider 通过 bridge.cts 的 JSON-RPC 方法代理到 core。Python MemoryProvider proxies to core through bridge.cts JSON-RPC methods.

Viewer

由 server/ 提供 /api/v1/* HTTP + SSE,读取 core 的可观察事件和 SQLite 状态。/api/v1/* HTTP + SSE served by server/, reading core events and SQLite state.

Reflect2Evolve

新版算法把记忆拆成四个互相反馈的层级,并用 step-level 与 task-level 两类反馈持续更新。The new algorithm splits memory into four cooperating layers and continuously updates them from step-level and task-level feedback.

层级Layer内容What It Stores价值Why It Matters
L1 trace每一步 action、observation、reflection、value。Step action, observation, reflection, and value.保留可验证证据,支撑后续归纳。Grounded evidence for later induction.
L2 policy跨任务归纳出的 trigger、procedure、verification、boundary。Induced trigger, procedure, verification, and boundary.把重复成功经验变成策略。Turns repeated success into strategy.
L3 world model从 L2 + L1 压缩出的环境认知。Environmental cognition compressed from L2 + L1.让 agent 知道项目长期规律。Gives the agent long-term project context.
Skill可调用的 invocation guide 与 procedure。Callable invocation guide and procedure.把成熟策略结晶成可复用能力。Crystallizes mature policies into reusable capabilities.

奖励回传Reward Backpropagation

V_T = R_human
V_t = alpha_t * R + (1 - alpha_t) * gamma * V_{t+1}
priority = value * time_decay

显式反馈、隐式结果和反思质量共同影响 trace 的价值,L2 候选池、L3 抽象和 Skill 生命周期都依赖这些信号。Explicit feedback, implicit outcomes, and reflection quality all affect trace value. L2 candidates, L3 abstractions, and Skill lifecycle decisions depend on these signals.

三层检索Three-Tier Retrieval

  1. Tier 1 — Skill: 优先找到可直接调用的技能和 invocation guide。Find callable skills and invocation guides first.
  2. Tier 2 — Trace + Episode: 检索具体证据、任务片段和历史操作。Retrieve concrete evidence, task slices, and historical actions.
  3. Tier 3 — World Model: 补充项目级、环境级、长期约束级认知。Add project-level, environment-level, long-term cognition.

检索入口包括 turn start、tool-driven、skill invoke、sub-agent 和 repair。结果通过 RRF 融合、MMR 去冗余,再形成注入包。Entry points include turn start, tool-driven retrieval, skill invoke, sub-agent, and repair. Results are fused with RRF, diversified with MMR, and packed into an injection packet.

Viewer

Overview

KPIs, health, recent events.

Traces

L1 search, value, alpha, feedback.

Policies

L2 candidates, support, gain, status.

World Model

L3 abstractions and source policies.

Skills

Skill lifecycle, eta, invocation guide.

Retrieval

Three-tier preview and debug panel.

Admin / Hub

Optional team-sharing settings surface.

Logs

Channelled logs, tail, filters.

Settings

Redacted config editor.

配置Configuration

config.yaml 是唯一配置文件,敏感字段也写在这里,并由安装器设置为 chmod 600。也可以在 Viewer 的 Settings 页面编辑。config.yaml is the only config file. Secrets live there too, and the installer sets chmod 600. You can also edit it in Viewer Settings.

OpenClaw

version: 1
viewer:
  port: 18799
embedding:
  provider: local
  apiKey: ""
llm:
  provider: host
  apiKey: ""
  model: ""
hub:
  enabled: false
telemetry:
  enabled: true
logging:
  level: info
  detailedView: false

Hermes

version: 1
viewer:
  port: 18800
embedding:
  provider: local
  apiKey: ""
llm:
  provider: openai_compatible
  apiKey: ""   # required for Hermes unless you choose another real provider
  model: ""
hub:
  enabled: false
telemetry:
  enabled: true
logging:
  level: info
  detailedView: false
配置块Block支持值Supported Values
embedding.providerlocal, openai_compatible, gemini, cohere, voyage, mistral
llm.providerhost, local_only, openai_compatible, anthropic, gemini, bedrock
logging.leveltrace, debug, info, warn, error, fatal

HTTP / Events

Endpoint用途Purpose
GET /api/v1/health版本、路径与健康状态。Version, paths, and health.
GET /api/v1/auth/status / POST /api/v1/auth/loginViewer 会话认证。Viewer session authentication.
GET /api/v1/tracesL1 trace 列表。L1 trace list.
GET /api/v1/policiesL2 policy 列表。L2 policy list.
GET /api/v1/world-modelsL3 world model 列表。L3 world-model list.
GET /api/v1/skillsSkill 列表与生命周期。Skill list and lifecycle.
POST /api/v1/feedback显式反馈写入。Explicit feedback write.
GET /api/v1/memory/search / POST /api/v1/memory/search三层检索。Three-tier retrieval.
GET /api/v1/logs/tail查看最近日志。Tail recent logs.
GET /api/v1/events / GET /api/v1/logsCoreEvent 与日志行的 SSE 流。SSE streams for CoreEvents and log records.

安全与本地优先Security and Local-First

  • 数据库、技能包、日志和配置默认都在 ~/.<agent>/memos-plugin/Database, skills, logs, and config live under ~/.<agent>/memos-plugin/.
  • API key 不进入源码目录,不写入 URL,由 config loader 与 logger 做脱敏。API keys never enter the source directory or URLs; config loading and logging redact secrets.
  • Viewer 默认绑定本机地址,每个宿主独立端口,避免跨宿主误写。Viewer binds locally by default; each host has an independent port to avoid cross-host writes.
  • 遥测为匿名使用事件,可随时在配置中关闭。Telemetry is anonymous usage events and can be disabled in config.