为 DeepSeek Harness 提供本地四层长期记忆(L1 轨迹 / L2 策略 / L3 世界模型 / 技能),每次用户轮次自动检索并可注册六个记忆工具。
- 语言
- TypeScript
- License
- Apache-2.0
- 分支
- main
安装
$ dsh plugin --profile web add github:MemTensor/MemOS/apps/memos-local-plugin在终端中运行以上命令,通过 dsh CLI 安装此插件。可在右上角切换 Profile。 第一次用 dsh?看这篇新手教程
对话式安装
帮我安装 DeepSeek Harness 插件 MemTensor/MemOS/apps/memos-local-plugin:先查看仓库 https://github.com/MemTensor/MemOS.git 确认安全性,然后执行安装命令并验证插件加载成功。
把这段指令粘贴给 DSH Web GUI 里的助手,由它代你完成安装与验证。
一句话定位
MemOS 为 DeepSeek Harness 注入本地优先的长期记忆能力:通过 SQLite 把每轮对话、工具结果、用户反馈沉淀为可检索的四层记忆,并在每个用户轮次自动把相关历史回填到上下文,让 DSH 具备跨会话的连续性。
核心能力
- 在每个被接受的非空用户轮次开始时执行一次有上限的自动检索,把相关历史以
<memos_context>形式注入到模型提示中 - 异步捕获对话轮次、工具调用与代码执行结果,写入本地 SQLite 数据库
- 注册六个面向模型调用的记忆工具(
memos_search/memos_get/memos_timeline/memos_environment/memos_skill_list/memos_skill_get),供模型主动查询或加载更详细的历史 - 提供基于本地 HTTP/SSE 的 Viewer 面板(默认
127.0.0.1:18801),可视化浏览和编辑记忆数据 - 自动复用宿主 DSH 已配置的模型与凭据作为辅助 LLM(如摘要、反思),无需重复配置 API Key
- 通过 L1 轨迹 / L2 策略 / L3 世界模型 / 技能 四层结构,从历史中归纳可复用的子任务策略并固化为可调用技能
技术实现
- 语言: TypeScript(ESM 模块)
- 关键依赖:
@deepseek-ai/cordis(Cordis 注入容器)、better-sqlite3(本地存储)、@huggingface/transformers(本地向量嵌入)、@preact/signals+ Vite Viewer(面板 UI) - 架构模式: 以 Cordis bundle 形式注入宿主进程;不启动独立守护进程、不走 JSON-RPC sidecar;通过
agent/pre-step/session/event/session/disposed等宿主事件钩子串联自动检索与后台捕获,并通过 DSH 的tools服务注册记忆工具 - 入口文件:
apps/memos-local-plugin/adapters/deepseek-harness/index.ts(apply 钩子),由cordis.patch.yml注入到 Cordis bundle 栈
适用场景
当用户希望 DeepSeek Harness 的对话能够在多次会话之间保持上下文连续性,或者希望把项目知识、工具调用结果沉淀为可复用的私有记忆时使用。它特别适合长周期项目协作、个人知识库累积、以及需要让模型记住用户偏好与历史决策的工作流。
前置依赖与兼容性
| 依赖 | 最低版本 | 说明 |
|---|---|---|
| DeepSeek Harness | >=0.1.0-rc.5 <0.2.0 | 宿主平台,DSH 仍在开发者预览,跨预览版可能需调整适配器 |
| Node.js | ^22.19.0 || >=24.0.0 | DSH 0.1.0-rc.5 的硬性要求,覆盖包自身声明的 >=20.0.0 |
| pnpm | 11.7.0 | 用于原生依赖构建脚本审批;一键安装器在缺失时会临时下载,结束后清理 |
| 平台 | macOS / Linux | 一键安装脚本仅支持 macOS+Linux;Windows 用户可走 DSH 原生 dsh plugin 流 |
| 原生模块 | better-sqlite3、onnxruntime-node、esbuild、sharp | 均为 pnpm 11 需要在 pnpm-workspace.yaml 中显式 allowBuilds 的构建脚本包 |
安装方式
dsh plugin --profile web add github:MemTensor/MemOS/apps/memos-local-plugin
安装完成后需重启当前 DSH profile(Ctrl+C/SIGINT 或 SIGTERM 后再次启动)才能使新 bundle 生效。
配置项
插件通过 Cordis 的 memos-local-memory 行接收配置,可直接修改 $DSH_HOME/profiles/<profile>/cordis.patch.yml 覆盖默认值。注意:DSH 的 patch 层是整体替换 config,覆盖时需要保留全部字段。
| 配置 | 类型 | 说明 | 默认值 |
|---|---|---|---|
enabled | boolean | 是否挂载该适配器;关闭后插件完全不生效 | true |
profileId | string | 命名空间回退标识;带 agentPreset 的会话会以会话值为准 | default |
home | string | 运行时根目录;留空时为 $DSH_HOME/memos-plugin/(默认 ~/.dsh/memos-plugin/) | "" |
recallEnabled | boolean | 是否对每个被接受的非空用户轮次执行自动检索;同轮重复进入会去重 | true |
captureEnabled | boolean | 是否在轮次与工具完成后异步写入数据库 | true |
toolsEnabled | boolean | 是否注册六个 memos_* 工具供模型调用;关闭后只能靠自动检索 | true |
hostLlmEnabled | boolean | 是否在 MemOS 未显式配置 LLM 时复用 DSH 已配置的模型与凭据 | true |
viewerEnabled | boolean | 是否启用本地 HTTP/SSE Viewer;关闭后只有无头记忆运行时 | true |
viewerPort | number | Viewer 监听端口(1–65535),多 profile 共存需分配不同端口 | 18801 |
recallTimeoutMs | number | 自动检索与 memos_search 共享的请求超时(毫秒,最小 100);实际生效上限 3000ms | 3000 |
contextMaxChars | number | 注入到模型的 <memos_context> 内容上限(最小 256) | 6000 |
toolResultMaxChars | number | 记忆工具返回给模型的结果体上限(最小 128) | 1200 |
failOnStartupError | boolean | 启动失败时是否中断 DSH profile 启动;默认只记警告继续运行 | false |
常见问题
Q: 卸载插件会一并删除记忆数据吗?
A: 不会。dsh plugin remove 只移除依赖与 bundle 层,运行时目录($DSH_HOME/memos-plugin/)下的 data/、skills/、config.yaml 会保留下来供重新安装时复用;只有手动删除目录才会清空记忆。
Q: 安装后是否需要单独配置 API Key?
A: 默认情况下 MemOS 会复用宿主 DSH 已配置的模型凭据,无需在 MemOS 中重复填写;只有在 config.yaml 显式设置了非空的 llm.provider 时,才会使用该 provider 自身的凭据。
Q: 升级插件版本或调整 config.yaml 后需要做什么?
A: 需要重启当前 DSH profile 才能生效;DSH 不会在运行中自动发现新安装的包,导入的模块也会在进程生命周期内被缓存。Viewer 内的 Settings 保存 config.yaml 也会提示需要手动重启宿主。
Q: 自动检索每次都会触发吗?问候语会被跳过吗?
A: 不会跳过。所有被接受的非空用户轮次(含 hello 等问候语,以及恢复的会话与 fork)都会触发一次自动检索;同轮重复进入会做去重,插件与工具生成的消息不会触发。
Q: Viewer 面板能远程访问吗?
A: 不能。Viewer 仅绑定 127.0.0.1 或 localhost 的回环地址,配置文件中 viewer.bindHost 设置为非回环地址会被拒绝;不要把回环端口放到反向代理或隧道后。Viewer 没有内置身份认证,开启密码保护需要写入 .auth.json。
Q: 多 DSH profile 同时启用 Viewer 会有冲突吗?
A: 会。多 profile 不能共用同一个 Viewer 端口,需要分配不同的 viewerPort 或仅在一个 profile 中启用 Viewer;不同 profile 共享同一运行时目录时会共用底层记忆,浏览器 cookie 在同主机不同端口间共享,注意登录态互相覆盖。
上手难度
入门 — 仅需一条 dsh plugin 安装命令即可获得自动检索能力,无需手工配置 API Key 或数据库;进阶用户可按需调整 Cordis 配置项或 config.yaml 中的 LLM、embedder、viewer 等设置。
已知问题与限制
- DSH 仍在开发者预览:适配器针对 DSH 0.1.0-rc.5/rc.6 验证,跨预览版的破坏性变更可能让插件失效
- 后台队列与重启间隙的捕获缺口:自动检索从不等待上一轮的捕获、关系分类或意图分类;正常 SIGINT/SIGTERM 时 Cordis 会尝试 bounded drain,但 SIGKILL、崩溃或预算耗尽都可能留下未落库的一轮
- Viewer 仅本地:默认监听
127.0.0.1:18801,不支持远程访问;多 profile 不能共享同一端口,浏览器 cookie 跨端口共享会互相覆盖登录态 - JSON 输出是提示工程而非强制 schema:DSH 当前没有 provider-neutral 的强制 JSON/Schema 输出,MemOS 在 prompt 内提供 JSON 契约并在本地解析,超时/截断/格式错误会触发失败回退
- 预请求阶段的路由边界:每轮自动检索跑在 DSH 关闭该轮
agent/request之前,因此只能读到上一次持久化的请求路由;如果不存在则使用 agent 公开默认 - 背景恢复没有归属路由:在启用 L2/L3/Skill 结晶的全量模式下,启动期的 stale recovery 与 10 分钟 dirty-episode rescore 不归属于任何 DSH 请求;当 MemOS provider 为
host时这两个后台任务会被禁用 - 依赖构建脚本需要审批:首次安装
2.0.16-beta.1等版本时 pnpm 11 会拦截原生模块构建脚本,需要在pnpm-workspace.yaml中明确允许better-sqlite3、esbuild、onnxruntime-node、sharp;protobufjs与 MemOS 自带的 postinstall 提示脚本不应允许 - 不要降级 Transformers.js:4.x 之前的 3.x / ONNX Runtime 1.21 在 macOS 上 DSH 调用
process.exit()时存在析构崩溃,使用本地嵌入的 profile 不能降级该组合
[!TIP] New: Connect MemOS to DeepSeek Harness (
dsh)Add automatic recall, background capture, hybrid retrieval, and a local Memory Viewer to DeepSeek Harness—powered by the same MemOS core used across agent ecosystems.
👾 MemOS: Memory Operating System for LLM & AI Agents
MemOS is a Memory Operating System for LLMs and AI agents that unifies store / retrieve / manage for long-term memory, enabling context-aware and personalized interactions with KB, multi-modal, tool memory, and enterprise-grade optimizations built in.
Key Features
- Unified Memory API: A single API to add, retrieve, edit, and delete memory—structured as a graph, inspectable and editable by design, not a black-box embedding store.
- Multi-Modal Memory: Natively supports text, images, tool traces, and personas, retrieved and reasoned together in one memory system.
- Multi-Cube Knowledge Base Management: Manage multiple knowledge bases as composable memory cubes, enabling isolation, controlled sharing, and dynamic composition across users, projects, and agents.
- Asynchronous Ingestion via MemScheduler: Run memory operations asynchronously with millisecond-level latency for production stability under high concurrency.
- Memory Feedback & Correction: Refine memory with natural-language feedback—correcting, supplementing, or replacing existing memories over time.
News
-
2026-08-17 · 🐋 MemOS Connects with DeepSeek Harness MemOS now brings persistent memory to DeepSeek Harness through both local and cloud plugins. DSH can automatically recall relevant context before a task and retain new experience after a successful turn, without modifying its core.
-
2026-07-02 · 🏆 MemOS Advances Agent and User Memory Benchmarks With MemOS, OpenClaw improves average task completion from 36.63% to 50.87% across five agent tasks. MemOS also achieves 88.83 on LoCoMo and 89.20 on LongMemEval, and leads in OmniMemEval, a unified evaluation of 14 commercial memory products across ten datasets.
-
2026-05-09 · 🧠 memos-local-plugin 2.0 Official local memory plugin for Hermes Agent and OpenClaw. One core powers self-evolving memory across L1 traces, L2 policies, L3 world models, and crystallized Skills, with local-first storage and feedback-driven retrieval.
-
2026-04-10 · 👧🏻 MemOS Hermes Agent Local Plugin Official Hermes Agent memory plugins launched: Hybrid retrieval (FTS5 + vector), smart dedup, tiered skill evolution, multi-agent collaboration. 100% local, zero cloud dependency.
-
2026-03-08 · 🦞 MemOS OpenClaw Plugin — Cloud & Local Official OpenClaw memory plugins launched. Cloud Plugin: hosted memory service with 72% lower token usage and multi-agent memory sharing (MemOS-Cloud-OpenClaw-Plugin). Local Plugin (
v1.0.0): 100% on-device memory with persistent SQLite, hybrid search (FTS5 + vector), task summarization & skill evolution, multi-agent collaboration, and a full Memory Viewer dashboard.
📊 Performance
MemOS leads across multiple benchmarks — evaluated against mainstream commercial memory products across 5 user memory and 5 agent memory tasks.
| Benchmark | Score |
|---|---|
| LoCoMo | 88.83 |
| LongMemEval | 89.20 |
| PersonaMem v2 | 40.58 |
| HaluMem | 80.91 |
| BEAM-10M | 56.75 |
| GDPVal | 62.07 |
| LiveCodeBench | 64.96 |
| OmniMath | 61.00 |
| SWE-Bench | 38.46 |
| BrowseComp-Plus | 23.85 |
Evaluated via OmniMemEval — https://github.com/MemTensor/OmniMemEval.
🎯 What MemOS Is For
MemOS gives AI agents long-term memory. Common uses:
- AI assistants with consistent, context-rich conversations
- Customer support that recalls past tickets and user history
- Personalized agents that adapt to individual preferences
- Multi-agent collaboration with shared or isolated memory
🚀 Quick Start
MemOS is built around four entry points. Pick the one that matches your scenario.
| Cloud API | Self-Host | MemOS Cloud Plugin | Local Plugin | |
|---|---|---|---|---|
| Best for | Your app, fully managed | Teams on own infra | OpenClaw users, zero ops | DeepSeek Harness, Hermes, or OpenClaw; on-device |
| Setup | Get an API key | docker compose up | openclaw plugins install | npm install + agent-specific setup |
| Infra needed | None (hosted) | Neo4j + Qdrant | None (uses MemOS Cloud) | None (local SQLite) |
| Data lives | MemOS Cloud | Your servers | MemOS Cloud | Your machine |
☁️ Use the Cloud API (Hosted)
You want to add memory to your app through a fully managed service — no infrastructure to run.
1. Get an API key:
- Sign up on the MemOS dashboard.
- Go to API Keys and copy your key (starts with
mpg-). Keep it server-side.
2. Add and search memories:
import requests
API_KEY = "mpg-..." # keep this server-side
base = "https://memos.memtensor.cn/api/openmem/v1"
headers = {"Authorization": f"Token {API_KEY}", "Content-Type": "application/json"}
# 1. Add a memory
requests.post(f"{base}/add/message", headers=headers, json={
"user_id": "alice",
"conversation_id": "conv_001",
"messages": [{"role": "user", "content": "I like strawberry"}],
})
# 2. Search memories
res = requests.post(f"{base}/search/memory", headers=headers, json={
"query": "What do I like?",
"user_id": "alice",
})
print(res.json())
Next steps:
- MemOS Cloud Getting Started — connect to MemOS Cloud and enable memory in minutes.
- MemOS Cloud Platform — explore the Cloud dashboard, features, and workflows.
🖥️ Self-Host the MemOS Service
You want to run MemOS as a REST service on your own machine or cluster.
Option A — Docker (recommended):
git clone https://github.com/MemTensor/MemOS.git
cd MemOS
cp docker/.env.example .env # fill in your API keys in .env
cd docker
docker compose up # starts MemOS API + Neo4j + Qdrant
The API is served at http://localhost:8000.
Option B — Run with uvicorn (without Docker):
git clone https://github.com/MemTensor/MemOS.git
cd MemOS
cp docker/.env.example .env # fill in your API keys in .env
# Ensure Neo4j and Qdrant are running, then:
cd src
uvicorn memos.api.server_api:app --host 0.0.0.0 --port 8000 --workers 1
See [docker/.env.example](./docker/.env.example) for all configuration options (LLM provider, embedder, vector DB, graph DB, scheduler). The full deployment guide is at https://memos-docs.openmem.net/open_source/getting_started/rest_api_server/.
Try the API:
import requests, json
headers = {"Content-Type": "application/json"}
base = "http://localhost:8000/product"
# 1. Create a memory cube
requests.post(f"{base}/create_cube", headers=headers, data=json.dumps({
"cube_name": "Alice's memory",
"owner_id": "alice",
"cube_id": "alice_cube",
}))
# 2. Add a memory
requests.post(f"{base}/add", headers=headers, data=json.dumps({
"user_id": "alice",
"writable_cube_ids": ["alice_cube"],
"messages": [{"role": "user", "content": "I like strawberry"}],
"async_mode": "sync",
}))
# 3. Search memories
res = requests.post(f"{base}/search", headers=headers, data=json.dumps({
"query": "What do I like?",
"user_id": "alice",
"readable_cube_ids": ["alice_cube"],
}))
print(res.json())
🧠 MemOS Plugin: Persistent Memory for Your AI Agents ✨
MemOS gives OpenClaw, Hermes, and DeepSeek Harness a shared local memory core; the managed MemOS Cloud Plugin is available for OpenClaw and DeepSeek Harness 🏃🏻
| 🔌 Plugin | 💡 Core Features | 🧩 Resources |
|---|---|---|
| 🧠 memos-local-plugin 2.0 | 🌐 Website · 📖 Docs · 🐙 GitHub · 📦 NPM | |
| ☁️ MemOS Cloud Plugin | 🖥️ MemOS Dashboard · 📖 Full Tutorial |
1. MemOS Cloud Plugin
Use MemOS Cloud for persistent memory in OpenClaw or DeepSeek Harness — no infrastructure to run.
- Repo: MemTensor/MemOS ·
apps/MemOS-Cloud-OpenClaw-Plugin - NPM:
[@memtensor/memos-cloud-openclaw-plugin](https://www.npmjs.com/package/@memtensor/memos-cloud-openclaw-plugin) - Dashboard: https://memos-dashboard.openmem.net/
- Tutorial: https://memos-docs.openmem.net/openclaw/guide
Install:
openclaw plugins install @memtensor/memos-cloud-openclaw-plugin@latest
openclaw gateway restart
The plugin recalls memories from MemOS Cloud before each agent run and saves new messages back after the run ends.
DeepSeek Harness
Connect DeepSeek Harness to MemOS Cloud through its native plugin mechanism. Before the first model step of each user request, the plugin recalls relevant cloud memories; after a successful turn, it saves the new user and assistant messages back to MemOS Cloud.
-
Install the cloud plugin into the default DSH
webprofile:npx @deepseek-ai/dsh plugin --profile web add @memtensor/memos-cloud-dsh-plugin@latest -
Add the API Key to
~/.dsh/.credentials.yaml:MEMOS_API_KEY: mpg-your-key -
Add the minimal plugin configuration to
~/.dsh/settings.yaml:memos-cloud: apiKeyEnv: MEMOS_API_KEY -
Restart the DSH Web profile:
npx @deepseek-ai/dsh web
The cloud plugin is fail-open: a temporary MemOS Cloud outage does not interrupt the current DSH task.
2. Local Plugin (OpenClaw, Hermes, and DeepSeek Harness)
You use DeepSeek Harness, Hermes Agent, or OpenClaw and want 100% on-device memory — nothing leaves your machine.
- Repo: MemTensor/MemOS ·
apps/memos-local-plugin - NPM:
[@memtensor/memos-local-plugin](https://www.npmjs.com/package/@memtensor/memos-local-plugin) - Docs: https://memos-docs.openmem.net/cn/openclaw/local_plugin
- DeepSeek Harness: integration details
- Viewer dashboard: see
apps/memos-local-plugin/viewer/
Install for DeepSeek Harness (macOS / Linux):
curl -fsSL https://raw.githubusercontent.com/MemTensor/MemOS/main/apps/memos-local-plugin/install.sh | bash -s -- --agent dsh --profile web
Install for OpenClaw or Hermes (macOS / Linux):
curl -fsSL https://raw.githubusercontent.com/MemTensor/MemOS/main/apps/memos-local-plugin/install.sh | bash
Install (Windows PowerShell):
irm https://raw.githubusercontent.com/MemTensor/MemOS/main/apps/memos-local-plugin/install.ps1 -OutFile "$env:TEMP\memos-install.ps1"; powershell -ExecutionPolicy Bypass -File "$env:TEMP\memos-install.ps1"
Requires Node.js and an already-installed DeepSeek Harness, OpenClaw, or Hermes. The installer deploys MemOS to the selected agent runtime; the DeepSeek Harness target installs it as an out-of-tree DSH bundle, while the OpenClaw and Hermes targets write the initial config.yaml in their respective agent homes.
Features: hybrid retrieval (FTS5 + vector), smart dedup, tiered skill evolution (L1 traces / L2 policies / L3 world model), multi-agent collaboration, local-first SQLite storage.
🤝 Community
- GitHub Issues: https://github.com/MemTensor/MemOS/issues
- GitHub Discussions: https://github.com/MemTensor/MemOS/discussions
- Discord: https://discord.gg/Txbx3gebZR
- WeChat: scan the QR code to join the group.
📚 Citation
If you use MemOS in your research, please cite:
@article{li2025memos_long,
title={MemOS: A Memory OS for AI System},
author={Li, Zhiyu and Song, Shichao and Xi, Chenyang and Wang, Hanyu and Tang, Chen and Niu, Simin and Chen, Ding and Yang, Jiawei and Li, Chunyu and Yu, Qingchen and Zhao, Jihao and Wang, Yezhaohui and Liu, Peng and Lin, Zehao and Wang, Pengyuan and Huo, Jiahao and Chen, Tianyi and Chen, Kai and Li, Kehang and Tao, Zhen and Ren, Junpeng and Lai, Huayi and Wu, Hao and Tang, Bo and Wang, Zhenren and Fan, Zhaoxin and Zhang, Ningyu and Zhang, Linfeng and Yan, Junchi and Yang, Mingchuan and Xu, Tong and Xu, Wei and Chen, Huajun and Wang, Haofeng and Yang, Hongkang and Zhang, Wentao and Xu, Zhi-Qin John and Chen, Siheng and Xiong, Feiyu},
journal={arXiv preprint arXiv:2507.03724},
year={2025},
url={https://arxiv.org/abs/2507.03724}
}
@article{li2025memos_short,
title={MemOS: An Operating System for Memory-Augmented Generation (MAG) in Large Language Models},
author={Li, Zhiyu and Song, Shichao and Wang, Hanyu and Niu, Simin and Chen, Ding and Yang, Jiawei and Xi, Chenyang and Lai, Huayi and Zhao, Jihao and Wang, Yezhaohui and others},
journal={arXiv preprint arXiv:2505.22101},
year={2025},
url={https://arxiv.org/abs/2505.22101}
}
⚖️ License
MemOS is licensed under the Apache 2.0 License.
收录徽章
[](https://deepseek-plugin.org/plugins/MemTensor/MemOS/apps/memos-local-plugin)把这段 markdown 粘贴到你的 GitHub README,链接回本插件详情页。徽章只声明已被本站收录,不代表安全认证。