MemOS OpenClaw 插件MemOS OpenClaw Plugin

MemOS

OpenClaw 提供完全本地化的持久记忆、智能任务总结、技能自动进化和多智能体协同。npm 一键安装,支持分级模型配置。 Fully local persistent memory, smart task summarization, auto skill evolution, and multi-agent collaboration for OpenClaw. One-command install, tiered model support.

完全本地化:数据存于本机 SQLite,零云依赖。Viewer 仅 127.0.0.1,密码保护。 Fully local: Data in local SQLite, zero cloud dependency. Viewer 127.0.0.1 only, password-protected.
💾

全量写入Full-Write

每次对话自动捕获,语义分片后持久化。Auto-captures every conversation, chunks semantically.

任务总结与技能进化Tasks & Skills

碎片对话归纳为结构化任务,再提炼为可复用技能并持续升级。Conversations organized into tasks, then distilled into skills that auto-upgrade.

🔍

混合检索Hybrid Search

FTS5 + 向量,RRF,MMR,时间衰减。FTS5 + vector, RRF, MMR, recency decay.

🧠

全量可视化Visualization

记忆/任务/技能/分析/日志/导入/设置 7 个管理页。7 pages: memories, tasks, skills, analytics, logs, import, settings.

💰

分级模型Tiered Models

Embedding/摘要/技能可独立配置不同模型。Each pipeline configurable with different models.

🤝

多智能体协同Multi-Agent

记忆隔离 + 公共记忆 + 技能共享,多 Agent 协同进化。Memory isolation + public memory + skill sharing for collective evolution.

🦐

原生记忆导入Native Memory Import

一键迁移 OpenClaw 内置记忆,智能去重、断点续传、实时进度。One-click migration from OpenClaw built-in memories with smart dedup, resume, and real-time progress.

👥

团队共享中心Team Sharing Hub

Hub-Client 架构,跨实例共享记忆/任务/技能。审批流程、角色管理、实时通知、端口自动推导。Hub-Client architecture for cross-instance sharing. Approval flow, role management, real-time notifications, auto port derivation.

🔗

LLM 智能降级LLM Fallback Chain

技能模型 → 摘要模型 → OpenClaw 原生模型三级自动降级,零手动干预。Skill model → summarizer → OpenClaw native model, auto-fallback with zero manual intervention.

✏️

任务/技能 CRUDTask & Skill CRUD

列表卡片直接编辑、删除、重试技能生成、切换可见性。Edit, delete, retry skill gen, toggle visibility — all from list cards.

系统架构Architecture

四条流水线:记忆写入 → 任务总结与技能进化(异步)→ 智能检索 → 协同共享。每个 Agent 拥有独立记忆空间,通过公共记忆和技能共享实现协同进化。Four pipelines: write → task & skill evolution (async) → retrieval → collaboration. Each agent has isolated memory; public memory and skill sharing enable collective evolution.

OpenClawagent_end
Capture
Ingestchunk→summary→embed→dedup
SQLite+FTS5
Task Processor异步 · 话题检测 → 摘要async · topic → summary
Skill Evolver异步 · 评估 → 生成/升级async · eval → create/up
before_agent_startauto-recall
RecallFTS+Vector
LLM filter
Inject context
Agentmemory_search
RRF→MMR→Decay
LLM filter
excerpts+chunkId/task_id
task_summary / skill_get / memory_timeline

数据流Data Flow

写入Write

  1. agent_end → Capture → Chunk → LLM Summary → Embed → Dedup → Store
  2. 异步:任务检测 → 任务摘要 → 技能评估 → 技能生成/升级Async: task detect → summary → skill eval → create/upgrade

检索Read

  1. 每轮自动:before_agent_start 用用户消息检索 → LLM 过滤相关 → 注入 system 上下文;无结果时提示 agent 自生成 query 调 memory_searchPer turn: before_agent_start searches with user message → LLM filters relevant → inject system context; if no hits, hint agent to call memory_search with self-generated query.
  2. memory_search → FTS5+Vector → RRF → MMR → Decay → LLM filter → excerpts + chunkId/task_id(无 summary)
  3. task_summary / skill_get(skillId|taskId) / memory_timeline(chunkId) / skill_install

快速开始Quick Start

Step 1:安装插件 & 启动Step 1: Install Plugin & Start
首次安装First Install

$ curl -fsSL https://cdn.memtensor.com.cn/memos-local-openclaw/install.sh | bash
安装失败?最常见的问题是 better-sqlite3 原生模块编译失败,可手动重建:cd ~/.openclaw/extensions/memos-local-openclaw-plugin && npm rebuild better-sqlite3。更多方案请查看 安装排查指南better-sqlite3 官方文档Install failed? The most common issue is better-sqlite3 compilation failure. You can manually rebuild it: cd ~/.openclaw/extensions/memos-local-openclaw-plugin && npm rebuild better-sqlite3. See the troubleshooting guide or official better-sqlite3 docs for more solutions.

升级Upgrade

$ curl -fsSL https://cdn.memtensor.com.cn/memos-local-openclaw/install.sh | bash
升级自动完成依赖安装、旧版清理和原生模块编译,无需手动操作。如果 update 命令不可用,先删除旧目录再重新安装:rm -rf ~/.openclaw/extensions/memos-local-openclaw-plugin && openclaw plugins install @memtensor/memos-local-openclaw-plugin(记忆数据不受影响)。Upgrade automatically handles dependencies, legacy cleanup, and native module compilation. If update is unavailable, delete the old directory first: rm -rf ~/.openclaw/extensions/memos-local-openclaw-plugin && openclaw plugins install @memtensor/memos-local-openclaw-plugin (memory data is stored separately and won't be affected).

Step2: 配置Step2: Configuration

两种方式:编辑 openclaw.json 或通过 Viewer 网页面板在线修改。支持分级模型。Two methods: edit openclaw.json or via Viewer web panel. Tiered models supported.

{
  "plugins": {
    "slots": { "memory": "memos-local-openclaw-plugin" },
    "entries": { "memos-local-openclaw-plugin": {
      "config": {
        "embedding": {                           // lightweight
          "provider": "openai_compatible",
          "model": "bge-m3",
          "endpoint": "https://your-api-endpoint/v1",
          "apiKey": "sk-••••••"
        },
        "summarizer": {                          // mid-tier
            "provider": "openai_compatible",
          "model": "gpt-4o-mini",
          "endpoint": "https://your-api-endpoint/v1",
          "apiKey": "sk-••••••"
        },
        "skillEvolution": {
          "summarizer": {                        // high-quality
            "provider": "openai_compatible",
            "model": "claude-4.6-opus",
            "endpoint": "https://your-api-endpoint/v1",
            "apiKey": "sk-••••••"
          }
        },
        "recall": {                               // optional
          "vectorSearchMaxChunks": 0   // 0=search all; set 200000–300000 only if slow on huge DB
        },
        "viewerPort": 18799
      }
    }}
  }
}json
安装后每次对话自动存入记忆。访问 http://127.0.0.1:18799 使用 Viewer。Every conversation auto-stored. Visit http://127.0.0.1:18799 for Viewer.

🦐 记忆迁移 — 再续前缘🦐 Memory Migration — Reconnect

将 OpenClaw 原生内置的记忆数据(SQLite 存储的对话历史)无缝迁移到 MemOS 的智能记忆系统。你和 AI 共同积累的每一段对话,都值得被记住。Seamlessly migrate OpenClaw's native built-in memory data (SQLite conversation history) to MemOS's intelligent memory system. Every conversation you've built with AI deserves to be remembered.

核心特性:一键导入 · 智能去重 · 断点续传 · 任务与技能生成 · 实时进度 · 🦐 标识导入来源Key Features: One-click import · Smart dedup · Resume anytime · Task & skill gen · Real-time progress · 🦐 source tagging

操作步骤Usage

方式一:通过 Viewer 网页面板(推荐)Method 1: Via Viewer Web Panel (Recommended)

  1. 访问 http://127.0.0.1:18799,切换到 Import 页面。Visit http://127.0.0.1:18799, switch to the Import page.
  2. 点击 扫描 OpenClaw 原生记忆,系统自动扫描 ~/.openclaw/ 下的 SQLite 数据库和 JSONL 日志。Click Scan OpenClaw Native Memories — the system auto-scans SQLite databases and JSONL logs under ~/.openclaw/.
  3. 查看扫描结果(文件数、会话数、消息数),确认后点击 开始导入Review scan results (files, sessions, messages), then click Start Import.
  4. 实时查看导入进度条、统计数据(已导入/跳过/合并/错误)和日志。Monitor real-time progress bar, stats (stored/skipped/merged/errors), and logs.

方式二:通过 Agent 对话Method 2: Via Agent Chat

在与 OpenClaw 的对话中,直接让 AI 操作:In your conversation with OpenClaw, tell the AI:

// Example prompts
"请帮我导入 OpenClaw 的原生记忆"
"Import my OpenClaw native memories"text

方式三:通过 HTTP APIMethod 3: Via HTTP API

# 1. 扫描
curl http://127.0.0.1:18799/api/migrate/scan

# 2. 开始导入(SSE 流式进度)
curl http://127.0.0.1:18799/api/migrate/start

# 3. 停止导入
curl -X POST http://127.0.0.1:18799/api/migrate/stopbash

后处理:任务与技能生成Post-Processing: Task & Skill Generation

导入完成后,可选择对导入的记忆进行后处理:After import, optionally post-process imported memories:

后处理在同一 Agent 内串行执行,不同 Agent 之间可并行(并发度可配置 1–8)。已处理过的会话自动跳过。支持选择只生成任务、只生成技能或两者同时执行。Post-processing runs serially within each agent, with parallel processing across agents (configurable concurrency 1–8). Already processed sessions are auto-skipped. Choose task-only, skill-only, or both.

断点续传Resume & Stop

导入和后处理均支持随时暂停:Both import and post-processing support pause/resume:

🦐 来源标识:所有通过迁移导入的记忆都带有 🦐 标识,在 Viewer 的记忆列表中可一眼区分原生导入和对话生成的记忆。🦐 Source Tag: All migrated memories are tagged with 🦐, making them visually distinguishable from conversation-generated memories in the Viewer.

模块Modules

Capture

过滤 system/self-tool,剥离 OpenClaw 元数据。保留 user/assistant/tool。Filter system/self-tool, strip metadata. Keep user/assistant/tool.

Ingest

异步队列:语义分片 → LLM 摘要 → 向量化 → 智能去重(Top-5 相似 + LLM 判 DUPLICATE/UPDATE/NEW,UPDATE 合并摘要并追加内容)→ 存储;演化块记录 merge_history。Async queue: chunk → summary → embed → smart dedup (Top-5 similar + LLM DUPLICATE/UPDATE/NEW; UPDATE merges summary and appends content) → store; evolved chunks track merge_history.

任务总结Task Summarization

异步逐轮检测任务边界:分组为用户回合 → 第一条直接分配 → 后续每条由 LLM 判断话题是否切换(强偏向 SAME,避免过度分割)→ 2h 超时强制切分 → 结构化摘要(目标/步骤/结果)。支持编辑、删除、重试技能生成。Async per-turn boundary detection: group into user turns → first turn assigned directly → each subsequent turn checked by LLM topic judge (strongly biased toward SAME to avoid over-splitting) → 2h timeout forces split → structured summary (goal/steps/result). Supports edit, delete, retry skill generation.

技能进化Skill Evolution

规则过滤 → LLM 评估(可重复/有价值的任务才生成技能)→ SKILL.md 生成(步骤/警告/脚本)/ 升级 → 质量评分 → 安装。LLM 使用三级降级链(技能模型 → 摘要模型 → OpenClaw 原生模型)。支持编辑、删除、设为公开/私有。Rule filter → LLM evaluate (only repeatable/valuable tasks generate skills) → SKILL.md (steps/warnings/scripts) / upgrade → score → install. LLM uses a 3-level fallback chain (skill model → summarizer → OpenClaw native model). Supports edit, delete, toggle visibility.

Recall

FTS5+Vector → RRF(k=60) → MMR(λ=0.7) → Decay(14d) → Normalize → Filter(≥0.45) → Top-K。自动关联 Task/Skill。FTS5+Vector → RRF(k=60) → MMR(λ=0.7) → Decay(14d) → Normalize → Filter(≥0.45) → Top-K. Auto-links Task/Skill.

Viewer

7 页:记忆 CRUD/搜索/演化标识、任务(对话气泡)、技能(版本/下载)、分析、日志(工具调用输入输出)、OpenClaw 原生记忆导入、在线配置。密码保护。7 pages: memory CRUD/search/evolution badges, tasks (chat bubbles), skills (versions/download), analytics, logs (tool call I/O), OpenClaw native memory import, online config. Password-protected.

检索算法Retrieval

RRF

\[ \text{RRF}(d) = \sum_i \frac{1}{k + \text{rank}_i(d) + 1} \]

MMR

\[ \text{MMR}(d) = \lambda \cdot \text{rel}(d) - (1-\lambda) \cdot \max \text{sim}(d, d_s) \]

时间衰减Recency

\[ \text{final} = \text{score} \times \bigl(0.3 + 0.7 \times 0.5^{t/14}\bigr) \]

API

query (required), maxResults (20), minScore (0.45), role. Returns excerpts(原文片段)+ chunkId / task_id,无 summary;经 LLM 相关性过滤。excerpts + chunkId/task_id, no summary; LLM relevance filter.

memory_get

获取记忆块完整原文。Get full original text of a memory chunk. chunkId, maxChars (optional).

memory_timeline

以 chunkId 为锚点的上下文邻居。Context neighbors by chunkId. chunkId, window (2).

task_summary

任务结构化摘要。Structured task summary. taskId or query.

skill_get / skill_install

skill_get 支持 skillId 或 taskId(按任务解析技能);skill_install 安装到工作区。skill_get accepts skillId or taskId; skill_install installs to workspace.

memory_write_public

写入公共记忆(owner="public"),所有 Agent 均可检索。Write public memory (owner="public"), discoverable by all agents. content (required), summary (optional).

搜索技能:FTS5 关键词 + 向量语义双通道,RRF 融合后经 LLM 判断相关性。Search skills via FTS5 + vector, RRF fusion, then LLM relevance judgment. query (required), scope ("mix" | "self" | "public", default "mix").

skill_publish / skill_unpublish

skill_publish 将技能设为公开,其他 Agent 可通过 skill_search 发现并安装。skill_unpublish 设为私有。skill_publish makes a skill public and discoverable via skill_search. skill_unpublish sets it private. skillId (required).

memory_viewer

返回 Viewer URL。Returns Viewer URL.

Viewer HTTP

MethodPath说明Description
GET/Memory Viewer HTML
POST/api/auth/*setup / login / reset / logout
GET/api/memories记忆列表(分页、过滤)Memory list (pagination, filters)
GET/api/search混合搜索(向量 minScore 0.64 + FTS5 降级)Hybrid search (vector minScore 0.64 + FTS5 fallback)
POST/PUT/DELETE/api/memory/:id记忆 CRUDMemory CRUD
GET/api/tasks任务列表(状态过滤)Task list (status filter)
GET/PUT/DELETE/api/task/:id任务详情/编辑/删除Task detail/edit/delete
POST/api/task/:id/retry-skill重试技能生成Retry skill generation
GET/api/skills技能列表Skill list
GET/PUT/DELETE/api/skill/:id技能详情/编辑/删除Skill detail/edit/delete
PUT/api/skill/:id/visibility设置公开/私有Set public/private
GET/api/skill/:id/download技能 ZIP 下载Download as ZIP
GET/api/stats, /api/metrics统计与分析Stats & metrics
GET/api/logs工具调用日志Tool call logs
GET/PUT/api/config在线配置Online configuration
GET/POST/api/migrate/*记忆导入(扫描/开始/停止/SSE 进度)Memory import (scan/start/stop/SSE)
POST/GET/api/migrate/postprocess/*后处理(任务/技能生成)Post-process (task/skill gen)

👥 团队共享中心👥 Team Sharing Hub

Team Sharing 将多个 OpenClaw 实例连接为协作网络。一个实例作为 Hub(团队服务端),其他实例作为 Client 连接。私有数据始终留在本地,仅明确共享的任务、记忆和技能对团队可见。Team Sharing connects multiple OpenClaw instances into a collaborative network. One instance serves as the Hub (team server) while others connect as Clients. Private data stays local — only explicitly shared tasks, memories, and skills are visible to the team.

Hub 团队服务端 · 共享记忆/技能Team Server · Shared Memory/Skills 🧠 86 📋 12 ⚡ 5 OpenClaw A 前端开发 · 234 记忆Frontend · 234 Memories online 📤 skill_publish OpenClaw B 后端开发 · 158 记忆Backend · 158 Memories online 📤 task_share OpenClaw C 测试工程 · 89 记忆QA/Testing · 89 Memories online ⬇ skill_pull …N 更多实例More
🏗️

Hub-Client

一个 Hub 存储共享数据,客户端按需查询。角色可动态切换。One Hub stores shared data; clients query on demand. Roles switchable dynamically.

🔌

端口自动推导Auto Port

Hub 端口自动从网关端口推导(+11),冲突时重试最多 3 次。Hub port auto-derived from gateway port (+11); retries up to 3 times on conflict.

审批流程Approval Flow

新成员提交加入申请,管理员审批后方可访问团队数据。New members submit join requests; admin approval required before accessing team data.

🔔

实时通知Notifications

角色变更、资源共享/移除、Hub 上下线等事件即时通知。Instant notifications for role changes, resource sharing/removal, Hub status changes.

配置Setup

启动 Hub(团队服务端)Start a Hub (Team Server)

{
  "sharing": {
    "enabled": true,
    "role": "hub",
    "hub": {
      "teamName": "My Team",
      "teamToken": "${MEMOS_TEAM_TOKEN}"
      // port auto-derived from gateway; set explicitly only if needed
    }
  }
}json

加入 Hub(客户端)Join a Hub (Client)

{
  "sharing": {
    "enabled": true,
    "role": "client",
    "client": {
      "hubAddress": "192.168.1.100:18800"
    }
  }
}json
也可以通过 Viewer → 设置 → 团队共享 面板直接配置,无需手动编辑 JSON。You can also configure sharing through the Viewer → Settings → Team Sharing panel without editing JSON.

管理员功能Admin Features

功能Feature说明Description
审批加入Approve/Reject审批或拒绝待审用户Approve or reject pending members
提升/降级Promote/Demote提升成员为管理员或降级为普通成员;被操作用户收到通知Promote members to admin or demote to regular member; affected users receive notifications
移除成员Remove Member移除团队成员(带确认弹窗,不可移除自己)Remove team members (with confirmation, self-removal prevented)
团队概览Team Overview查看团队名称、总成员数、活跃成员数View team name, total members, active member count
Hub 关闭通知Shutdown Notify关闭 Hub 时自动通知所有客户端All clients notified automatically when Hub shuts down

多实例部署Multi-Instance Deployment

同一台机器上可运行多个 OpenClaw 实例(如个人 + 工作),端口和数据完全隔离:Run multiple OpenClaw instances on the same machine (e.g., personal + work) with full isolation:

资源Resource隔离方式Isolation示例Example
Viewer自动推导端口Auto-derived port18799 / 19011
HubgatewayPort + 1118800 / 19012
Cookie基于端口的唯一名称Port-based unique namememos_session_18799 / memos_session_19011
Database独立 state 目录Separate state dir~/.openclaw/memos-local/ / ~/oc-work/memos-local/

通知事件Notification Events

事件Event接收方Recipient
role_promoted被提升的用户Promoted user
role_demoted被降级的用户Demoted user
resource_shared团队成员Team members
resource_removed资源所有者Resource owner
hub_shutdown所有客户端All clients
member_joined / left管理员Admin

团队共享 API 工具Team Sharing API Tools

Tool说明Description
task_share / task_unshare将任务推送到 / 移除出团队Push task to / remove from team
skill_publish / skill_unpublish发布 / 取消发布技能到团队Publish / unpublish skill to team
network_memory_detail获取团队记忆完整内容Fetch full team memory content
network_skill_pull拉取团队技能到本地Pull team skill bundle locally
network_team_info查看当前团队连接状态Show current team connection state
完整的团队共享工作流请参阅 HUB-SHARING-GUIDE.mdFor the complete team sharing workflow, see HUB-SHARING-GUIDE.md.

多智能体协同Multi-Agent Collaboration

MemOS 原生支持多 Agent 场景。每个 Agent 的记忆和任务通过 owner 字段隔离(格式 agent:{agentId}),检索时自动过滤为当前 Agent + public。MemOS natively supports multi-agent scenarios. Each agent's memories and tasks are isolated via an owner field (agent:{agentId}); retrieval automatically filters to current agent + public.

LLM 降级链LLM Fallback Chain

所有 LLM 调用(摘要、话题检测、去重、技能生成/升级)均使用三级自动降级机制:All LLM calls (summary, topic detection, dedup, skill generation/upgrade) use a 3-level automatic fallback chain:

skillSummarizer技能专用模型(可选)Skill-dedicated (optional)
summarizer通用摘要模型General summarizer
OpenClaw Native从 openclaw.json 读取Auto-detected from openclaw.json

数据库Database

~/.openclaw/memos-local/memos.db, WAL. Tables: chunks (owner), chunks_fts, embeddings, tasks (owner), skills (owner, visibility), skill_versions, task_skills, skill_embeddings, skills_fts.

安全Security

Viewer 仅 127.0.0.1;密码 SHA-256;HttpOnly+SameSite Cookie;会话 24h;数据仅本地。127.0.0.1 only; SHA-256 password; HttpOnly+SameSite; 24h session; data stays local.

默认值Defaults

参数Parameter默认Default说明Description
maxResults6 (max 20)默认返回数Default result count
minScore (tool)0.45memory_search 最低分memory_search minimum
minScore (viewer)0.64Viewer 搜索向量阈值Viewer search vector threshold
rrfK60RRF 融合常数RRF fusion constant
mmrLambda0.7MMR 相关性 vs 多样性MMR relevance vs diversity
recencyHalfLife14d时间衰减半衰期Recency decay half-life
vectorSearchMaxChunks0 (all)0=搜索全部;大库可设 200k-300k0=search all; set 200k-300k for large DBs
dedup threshold0.75语义去重余弦相似度Semantic dedup cosine similarity
viewerPort18799Memory Viewer
taskIdle2h任务空闲超时Task idle timeout
topicJudgeWarmup1LLM 话题判断预热(用户消息数)LLM topic judge warm-up (user turns)
skillMinChunks6技能评估最小 chunk 数Min chunks for skill evaluation
importConcurrency1 (max 8)导入 Agent 并行度Import agent parallelism

MemOSMemOS MemOS — OpenClaw Plugin · Docs

首页Home · 安装排查指南Troubleshooting · npm · GitHub · MIT