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.
全量写入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.
系统架构Architecture
四条流水线:记忆写入 → 任务总结与技能进化(异步)→ 智能检索 → 协同共享。每个 Agent 拥有独立记忆空间,通过公共记忆和技能共享实现协同进化。Four pipelines: write → task & skill evolution (async) → retrieval → collaboration. Each agent has isolated memory; public memory and skill sharing enable collective evolution.
数据流Data Flow
写入Write
agent_end→ Capture → Chunk → LLM Summary → Embed → Dedup → Store- 异步:任务检测 → 任务摘要 → 技能评估 → 技能生成/升级Async: task detect → summary → skill eval → create/upgrade
检索Read
- 每轮自动:
before_agent_start用用户消息检索 → LLM 过滤相关 → 注入 system 上下文;无结果时提示 agent 自生成 query 调memory_search。Per turn:before_agent_startsearches with user message → LLM filters relevant → inject system context; if no hits, hint agent to callmemory_searchwith self-generated query. memory_search→ FTS5+Vector → RRF → MMR → Decay → LLM filter → excerpts + chunkId/task_id(无 summary)task_summary/skill_get(skillId|taskId) /memory_timeline(chunkId) /skill_install
快速开始Quick Start
- Node.js ≥ 18
- OpenClaw 已安装OpenClaw installed
- Embedding / Summarizer API 可选,不配自动用本地模型Embedding / Summarizer APIs optional, falls back to local
openclaw plugins install @memtensor/memos-local-openclaw-plugin
openclaw gateway startbash
升级Upgrade
openclaw plugins update memos-local-openclaw-plugin
openclaw gateway stop && openclaw gateway startbash
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).配置Configuration
两种方式:编辑 openclaw.json 或通过 Viewer 网页面板在线修改。支持分级模型。Two methods: edit openclaw.json or via Viewer web panel. Tiered models supported.
{
"plugins": {
"slots": { "memory": "memos-local" },
"entries": { "memos-local": {
"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.
操作步骤Usage
方式一:通过 Viewer 网页面板(推荐)Method 1: Via Viewer Web Panel (Recommended)
- 访问
http://127.0.0.1:18799,切换到 Import 页面。Visithttp://127.0.0.1:18799, switch to the Import page. - 点击 扫描 OpenClaw 原生记忆,系统自动扫描
~/.openclaw/下的 SQLite 数据库和 JSONL 日志。Click Scan OpenClaw Native Memories — the system auto-scans SQLite databases and JSONL logs under~/.openclaw/. - 查看扫描结果(文件数、会话数、消息数),确认后点击 开始导入。Review scan results (files, sessions, messages), then click Start Import.
- 实时查看导入进度条、统计数据(已导入/跳过/合并/错误)和日志。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:
- 任务生成:自动检测会话中的任务边界,为每个会话生成结构化摘要(目标/步骤/结果)。Task generation: Auto-detect task boundaries per session, generate structured summaries (goal/steps/result).
- 技能进化:从已完成的任务中提炼可复用技能,生成 SKILL.md 文件并安装到工作区。Skill evolution: Distill reusable skills from completed tasks, generate SKILL.md and install to workspace.
后处理为串行执行,逐条处理导入的会话。已处理过的会话自动跳过。支持选择只生成任务、只生成技能或两者同时执行。Post-processing runs serially, processing imported sessions one by one. Already processed sessions are auto-skipped. Choose task-only, skill-only, or both.
断点续传Resume & Stop
导入和后处理均支持随时暂停:Both import and post-processing support pause/resume:
- 点击 停止 按钮后,进度自动保存。Click Stop, progress auto-saved.
- 刷新页面后自动检测未完成的导入,恢复进度条显示。On page refresh, auto-detect incomplete imports and restore progress display.
- 再次点击开始即从上次中断处继续,已处理的记忆自动跳过。Click start again to continue from where you left off — processed memories are auto-skipped.
- 导入和后处理在后台运行,关闭 Viewer 页面不影响执行。Import and post-processing run in the background — closing the Viewer page won't interrupt them.
模块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 话题 + 2h 超时)→ 结构化摘要(目标/步骤/结果)。Async boundary detection (LLM topic + 2h timeout) → structured summary (goal/steps/result).
技能进化Skill Evolution
规则过滤 → LLM 评估 → SKILL.md 生成(步骤/警告/脚本)/ 升级 → 质量评分 → 安装。Rule filter → LLM evaluate → SKILL.md (steps/warnings/scripts) / upgrade → score → install.
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
MMR
时间衰减Recency
API
memory_search
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).
skill_search
搜索技能: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
GET /; POST /api/auth/*; GET /api/memories, /api/tasks, /api/skills, /api/stats, /api/logs, /api/log-tools, /api/config; POST/PUT/DELETE /api/memory/:id; PUT /api/skill/:id/visibility.
多智能体协同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.
- 记忆隔离:Agent A 无法检索 Agent B 的私有记忆Memory Isolation: Agent A cannot retrieve Agent B's private memories
- 公共记忆:通过
memory_write_public写入 owner="public" 的记忆,所有 Agent 可检索Public Memory: Usememory_write_publicto write owner="public" memories discoverable by all agents - 技能共享:通过
skill_publish将技能设为公开,其他 Agent 可通过skill_search发现并安装Skill Sharing: Useskill_publishto make skills public; other agents discover and install viaskill_search - 技能检索:
skill_search支持 scope 参数(mix/self/public),FTS + 向量双通道 + RRF 融合 + LLM 相关性判断Skill Discovery:skill_searchsupports scope (mix/self/public), FTS + vector dual channel + RRF fusion + LLM relevance judgment
数据库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
maxResults 6, maxResultsMax 20, minScore 0.45, rrfK 60, mmrLambda 0.7, recencyHalfLife 14d, vectorSearchMaxChunks 0 (search all), dedup 0.93, viewerPort 18799, taskIdle 2h, skillMinChunks 6.