Memory protocol enforcement plugin: bridges the opencode-memory MCP server, forces memory_weave before tool calls, auto-ingests turns, and injects memory context into agent steps.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:baaai123/dsh-memory-protocol
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
为 DeepSeek Harness 打造的长期记忆插件 — 桥接 opencode-memory MCP 服务器,并附加强制记忆协议。
哼,杂鱼又忘事了吧? 工具调用前先给我 weave 记忆、每轮对话自动存档——省得你三秒重置、重复学习。才、才不是特地为你准备的,只是看不得你每次从零开始犯蠢。
作用
这个 bundle 装两样东西:
- memory-mcp — 通过官方
@deepseek-ai/dsh-mcp-client桥接 opencode-memory 的 Python MCP 服务器(15 个memory_*工具:weave/search/ingest/classify/teach_skill 等) - 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):
pip install --user "memory-skill[onnx]" optimum[onnxruntime] huggingface_hub(已安装则跳过)- 下载
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 则跳过下载) |
没有 Python 侧时,插件以 fail-open 模式运行(不强制执行协议、agent 不被阻塞),并显示一次性引导提示。 引导完成并重启 dsh 后,memory 工具注册、严格协议自动恢复。
配置
memory-protocol 的配置项(cordis.patch.yml 中可调):
config:
enforceWeave: true # 工具调用前强制 weave(未 weave 拒绝)
injectWeave: true # 自动注入记忆上下文
autoIngest: true # 每轮自动存档
allowlist: [] # 豁免工具名(除 memory_* 外)
工作原理
dsh (Web / headless)
├─ memory-mcp @deepseek-ai/dsh-mcp-client ──> python3 -m memory_skill.mcp_server
│ └─ 15 个 mcp__opencode_memory__* 工具
└─ memory-protocol 强制协议
├─ tools/pre-execute 未 weave → deny
├─ agent/pre-step weave + 注入
└─ agent/turn-stopping 自动 ingest
License
MIT
截图

| 架构 | 强制执行演示 | 配置项 |
|---|---|---|
![]() |
![]() |
![]() |
演示为真实运行输出:未 weave 调工具 → ⛔ DENY;pre-step 自动 weave 并注入记忆上下文;turn-stopping 自动 ingest。
Links
More in this category
vectorize-io/hindsight#coding-agents★ 60728
Hindsight, agent memory that learns: long-term project memory with auto recall and retain, knowledge pages, deep reflection, and per-repo memory banks.
volcengine/OpenViking#examples/dsh-memory-plugin★ 42125
OpenViking memory and context bundle for DeepSeek Harness: pre-step auto-recall and profile injection, session capture, `viking://` URI guarding, and recall/write memory tools backed by an OpenViking server.
MemTensor/MemOS#memos-local-plugin★ 12376
Local-first memory plugin for DeepSeek Harness: layered L1/L2/L3 memory with automatic capture, manual memos_* retrieval tools, and a built-in memory viewer.
agentscope-ai/ReMe#dsh★ 3796
Connects DeepSeek Harness to ReMe's local-first, self-evolving personal knowledge base: automatically captures completed main-agent conversations as user-owned Markdown memory, searches conversations and source material through reme_search with BM25, optional embeddings, and wikilink expansion, and schedules daily memory consolidation.
zilliztech/memsearch#MemSearch★ 2866
Shared Markdown memory for DSH and other coding agents, with automatic capture, pre-step context injection, searchable recall, and memory-to-skill self-evolution through a review panel.
vshulcz/deja-vu#extensions/dsh★ 1529
Reads the session files forty-two other coding agents on this machine already wrote (Claude Code, Codex, Cursor, VS Code Copilot Chat, opencode, OpenClaw, Hermes, Kimi, Cline, Zed and more), including sessions from before it was installed: six tools (deja_recall, deja_session, deja_blame, deja_fix, deja_how, deja_remember), a /deja command, and optional automatic recall added to the runtime context. Local BM25 index, no LLM, no embeddings, no network (dsh plugin --profile web add dsh-deja).



Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.