baaai123/dsh-memory-protocol 预览 preview

baaai123/dsh-memory-protocol

DeepSeek Harness 的内存强制插件——将 opencode-memory MCP 服务器与硬协议门桥接

Project Overview项目介绍

dsh-memory-protocol is a native long-term memory plugin built exclusively for DeepSeek Harness. It ships with two core components: the memory-mcp bridge that connects the opencode-memory Python MCP server via DeepSeek Harness’s official MCP client, and the memory-protocol plugin that enforces a structured memory workflow. The memory-mcp component exposes 15 memory-related tools, including weave, search, ingest, classify, and teach_skill, directly to the DSH agent. It is pre-packaged with a DSH bundle manifest, so installation works out of the box via the DSH CLI.

This plugin is designed to fix the common problem of AI agents forgetting past context and starting problem-solving from scratch every new conversation. It follows a strict three-step workflow to maintain persistent memory: it blocks any tool calls that happen before weaving existing memory into the context, automatically weaves and injects memory at the start of each agent step, and automatically ingests new conversation content into the memory bank after each turn. It is intended for any DeepSeek Harness user that wants persistent long-term memory for their agent workflows, to avoid repeating the same learning steps across conversations.

The plugin requires a Python environment, the opencode-memory MCP server, and the BAAI/bge-large-en-v1.5 embedding model (around 1.3GB) to function fully. On first launch, it will automatically bootstrap all dependencies and download the model, but users can set environment variables like MEMORY_SKIP_BOOTSTRAP=1 to disable automatic setup, or customize paths for the Python interpreter, memory database, and embedding model. The project is released under the open-source MIT license, so it is free to use and modify. If Python is not detected on first run, it runs in fail-open mode and shows a one-time setup prompt instead of blocking the agent.

dsh-memory-protocol 是专为 DeepSeek Harness 打造的原生长期记忆插件,包含两个核心组件:一是通过 DSH 官方 MCP 客户端桥接 opencode-memory Python MCP 服务器的 memory-mcp 模块,提供 weave、搜索、导入、分类等 15 个记忆相关工具;二是强制执行记忆流程的 memory-protocol 协议插件。该插件自带 DSH bundle 清单,可直接通过 DSH 官方插件命令安装。

该插件的核心作用是解决大语言模型对话中反复遗忘、从零开始重复学习的问题,标准工作流程分为三步:工具调用前先检查是否已经 weave 整合记忆,未完成则直接拒绝调用;每轮对话开始前自动 weave 并注入历史记忆上下文;每轮对话结束后自动将新对话内容导入持久化记忆库。主要面向需要长期记忆能力的 DeepSeek Harness 用户。

该插件依赖 Python 环境、opencode-memory 的 MCP 服务端以及 BAAI/bge-large-en-v1.5 嵌入模型,首次启动会自动引导完成依赖安装和模型下载,也支持手动配置环境变量跳过自动引导步骤、自定义Python路径、记忆库路径等。项目采用 MIT 许可证开源,完全免费使用。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 2 warnings2 项注意
  • No license declared - all rights reserved by default; ask the author before commercial use or redistribution未声明开源许可证 —— 默认「保留所有权利」,商用或再分发前先问作者
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add dsh-memory-protocol

把 baaai123/dsh-memory-protocol 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-memory-protocol

npm GitHub PyPI

English | 中文

为 DeepSeek Harness 打造的长期记忆插件 — 桥接 opencode-memory MCP 服务器,并附加强制记忆协议。

哼,杂鱼又忘事了吧? 工具调用前先给我 weave 记忆、每轮对话自动存档——省得你三秒重置、重复学习。才、才不是特地为你准备的,只是看不得你每次从零开始犯蠢。

作用

这个 bundle 装两样东西:

  1. memory-mcp — 通过官方 @deepseek-ai/dsh-mcp-client 桥接 opencode-memory 的 Python MCP 服务器(15 个 memory_* 工具:weave/search/ingest/classify/teach_skill 等)
  2. memory-protocol — 强制协议插件,三个 hook:
    • tools/pre-execute — 未 weave 就调其他工具 → 硬拒绝
    • agent/pre-step — 每轮自动 weave 并注入记忆上下文
    • agent/turn-stopping — 每轮自动 ingest 对话

安装

前置依赖:Python MCP server(memory-skill)+ 嵌入模型(bge-large-en-v1.5)。插件启动时会自动引导安装(npm run bootstrap 或插件 autoBootstrap);也可手动安装(下面的命令)。可用 MEMORY_SKIP_BOOTSTRAP=1 关闭自动引导。

# 1. 先装 opencode-memory 的 Python server(提供 memory_skill.mcp_server)
pip install "memory-skill[onnx]" optimum[onnxruntime] huggingface_hub

# 2. 下载嵌入模型(约 1.3GB,自动转 ONNX;国内网络可加 HF_ENDPOINT=https://hf-mirror.com)

# 3. 安装本插件
dsh plugin --profile web add dsh-memory-protocol

默认用 python3 -m memory_skill.mcp_server 启动 MCP server。路径可通过环境变量覆盖:

环境变量 默认 说明
MEMORY_SKILL_PYTHON python3 解释器路径
MEMORY_SKILL_DIR process.cwd() memory-skill 项目目录
MEMORY_SKILL_DB_PATH ~/.memory-skill/memory.db 记忆库路径(server 已内置此绝对默认值;如需共享 opencode 的库,显式指向该库文件)
IMPORTANCE_API_KEY (未设) LLM 重要性评分 key(可选)

自动引导

插件检测到 memory MCP 工具未注册时,会自动触发 scripts/bootstrap-memory.mjs(也可手动 npm run bootstrap):

  1. pip install --user "memory-skill[onnx]" optimum[onnxruntime] huggingface_hub(已安装则跳过)
  2. 下载 BAAI/bge-large-en-v1.5 并转 ONNX(默认 models/bge-large-en-v1.5/;直连失败自动重试 HF_ENDPOINT=https://hf-mirror.com)
环境变量 默认 说明
MEMORY_SKIP_BOOTSTRAP (未设) =1 关闭自动引导
MEMORY_SKIP_INSTALL (未设) =1 跳过 pip install
MEMORY_SKIP_MODEL (未设) =1 跳过模型下载
MEMORY_MODEL_PATH $MEMORY_SKILL_DIR/models/bge-large-en-v1.5 指定模型目录(已有 model.onnx 则跳过下载)

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-relay 下一个 Next dsh-testkit →