ZCode-style persistent project memory with a full settings manager, index-first injection and agent memory tools.
Install
# from npm (prebuilt)
dsh plugin --profile web add @duke-dsh-plugins/dsh-memory-manager
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:MoonlitDropOfBlood/dsh-memory-manager
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(DSH) Web UI 打造的持久化记忆插件,移植自 ZCode 的项目记忆(Memory):按项目(工作区)保存结构化记忆,并在设置里提供完整的记忆管理页面。
记忆以 ZCode 同款 Markdown 格式落盘(<DSH_HOME>/memories/projects/<project>/memory/*.md,含 MEMORY.md 索引与 memory_summary.md 摘要),并支持一键从 ZCode 记忆目录导入,把 ZCode 里积累的用户偏好 / 反馈 / 技术参考直接搬进 DSH。
功能
| 功能 | 说明 |
|---|---|
| 🧠 ZCode 记忆移植 | 沿用 ZCode 的记忆文件格式(YAML frontmatter + 正文)、类型体系(user / feedback / reference / project / other)与按项目分目录的存储布局 |
| ⚙️ 设置中的记忆管理 | 设置面板新增 记忆管理 页:搜索、项目/类型筛选、按项目分组、新建 / 编辑 / 删除(二次确认)/ 查看正文 |
| 🔄 自动加载到对话 | 每次模型调用自动把「当前项目 + 全局」的记忆索引(名称 + 描述)作为系统提示注入给智能体,省上下文;也可切换为附带正文截断的旧模式 |
| 🤖 Agent 记忆工具 | 注册 memory_save / memory_get / memory_list 三个模型工具:agent 可按需读取记忆全文、跨项目搜索,并在发现用户偏好 / 纠正 / 项目约定时自己回写记忆(同名即更新,origin: agent) |
| 📥 从 ZCode 导入 | 一键扫描 ~/.zcode/cli/memories(memory/ + topics/),按项目 + 名称去重,不覆盖已有记忆 |
| 🌐 全局 + 项目记忆 | global 项目存放跨项目记忆;项目 key 取自工作区路径名,自动清洗为安全片段 |
| 📄 自动索引 | 每次变更自动重写 MEMORY.md 索引与 memory_summary.md 摘要 |
| 🌗 主题适配 | 全部使用 DSH 设计 token(按钮为官方 DSH Button 组件),明暗主题自动跟随 |
安装
标准安装(推荐)
本插件是标准 DSH bundle:package.json 声明 dsh.bundle.patch,包内自带 cordis.patch.yml,用官方 dsh plugin 命令安装:
# 本地开发:pnpm 软链到本仓库,改代码即生效(无需重新复制)
dsh plugin --profile web add /path/to/dsh-memory-manager
# 正式发布:从 GitHub Release tarball 安装
dsh plugin --profile web add https://github.com/MoonlitDropOfBlood/dsh-memory-manager/releases/download/v1.2.0/dsh-memory-manager-1.2.0.tgz
重启 DSH 后,打开 设置 → 记忆管理 即可使用。
dsh plugin add把插件装成 profile 的 npm 依赖并追加到dsh.profile.bundles,启动时 DSH 自动应用包内的cordis.patch.yml挂载插件。卸载:dsh plugin --profile web remove dsh-memory-manager。
宿主兼容性
支持 DSH 0.1.0-rc.7 ~ 0.2.0-rc.x(engines.dsh: ^0.1.0-rc.7 || ^0.2.0-rc.1,已在本机 0.2.0-rc.1 宿主端到端验证)。DSH 0.2.0 起宿主会在启动时按 peerDependencies 的 @deepseek-ai/dsh* 声明做兼容预检,范围不满足的 bundle 会被静默跳过——如果升级宿主后插件消失,先确认版本声明覆盖了新宿主,再跑 npm run e2e(对真实安装验证闸门、Host 激活、CRUD、TypertRegistry 与 client bundle)。
使用
- 打开 设置,侧栏出现 记忆管理 页。
- 列表按项目分组、最新优先;顶部可搜索(名称/描述)、按项目和类型筛选;卡片展示类型徽章与更新时间。
- 自动加载记忆到对话上下文:默认开启。每次模型调用,DSH 会把当前会话工作区项目的记忆 + 全局记忆的索引(名称 + 描述,不含正文)作为系统提示注入给智能体,agent 对某条感兴趣时自行用
memory_get工具读取全文——比全量注入省一个量级的上下文。需要旧行为(每条附带 400 字正文截断)可在记忆管理页打开「注入记忆正文」。 - Agent 回写记忆:agent 在对话中发现值得长期保留的用户偏好、纠正/反馈、项目约定时,会自己调用
memory_save写入记忆(origin: agent),之后每轮索引自动带上它。也可在记忆管理页看到、编辑或删除这些记忆。 - 新建记忆:填写名称(建议短横线 slug,可含中文)、类型、项目(
global= 全局,或某个项目名,可参考工作区建议)、描述与 Markdown 正文。 - 编辑 / 查看 / 删除:每行右侧操作;删除需二次确认(永久,不可恢复)。
- 从 ZCode 导入:一键导入
~/.zcode/cli/memories下各项目的记忆,同名自动跳过,结束后展示每个项目的导入/跳过统计。
工作原理
DSH Web UI
└─ client.js (window.__ModuleLoader__.load bundle)
└─ settings.section 注册「记忆管理」页
└─ ctx.remote.memoryManager.{list|get|create|update|delete|importZCode|getConfig|setConfig}
└─ index.js (MemoryService, TypertRemoteService)
├─ systemPrompt.section(order 90)→ 每次模型调用注入「记忆索引」段落
│ └─ context.agent.session.header.cwd → 项目 key → 项目 + 全局记忆索引(同步渲染,进程内缓存)
├─ ctx.tools.register → memory_save / memory_get / memory_list(agent 回写与按需读取)
│ └─ systemPrompt.section(order 100)→ 工具使用指引
└─ memory-core.mjs(node:fs 直接读写)
├─ <DSH_HOME>/memories/projects/<p>/memory/<name>.md
├─ <DSH_HOME>/memories/projects/<p>/MEMORY.md
├─ <DSH_HOME>/memories/projects/<p>/memory_summary.md
└─ <DSH_HOME>/memories/config.json(autoLoad / injectBody 开关)
记忆存储走 node:fs 直接落在 <DSH_HOME>/memories/(与 DSH 核心写 ~/.dsh 的方式一致),无需 shell 沙箱。
目录结构
dsh-memory-manager/
├── index.js # Host 半:MemoryService(Remote 服务)
├── client.js # Client 半:设置「记忆管理」页 UI bundle
├── typert.host.js # Typert Host manifest(Remote 方法描述)
├── memory-core.mjs # 共享记忆核心(frontmatter / 存储 / 索引 / ZCode 导入),零依赖
├── cordis.patch.yml # dsh bundle patch(挂载行)
├── scripts/self-test.mjs # 独立核心自测(无需 DSH 进程)
├── .github/workflows/ # GitHub Actions 发布
├── AGENTS.md # 面向 AI agent 的开发指南(含踩坑)
└── LICENSE # MIT
开发
npm run check # 全文件语法检查
npm test # 独立核心自测(临时目录 CRUD / 索引 / ZCode 导入)
dsh plugin --profile web add /path/to/dsh-memory-manager # 安装/重装到本机 DSH profile
详见 AGENTS.md——记录了 DSH 正式插件(Host/Client/Typert 三件套)的完整机制和踩坑。
License
本项目遵循 MIT License。
本项目是基于 DeepSeek Harness 构建的社区插件,并非 DeepSeek 官方产品。记忆格式移植自 ZCode 的项目记忆设计。
Links
More in this category
vectorize-io/hindsight#coding-agents★ 46361
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★ 39324
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.
agentscope-ai/ReMe#dsh★ 3555
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★ 2722
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★ 1139
Reads the session files thirty-three 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).
adoresever/graph-memory★ 637
Traceable, searchable cross-session memory for DeepSeek Harness — conversation knowledge as typed graph nodes (TASK/SKILL/EVENT) and typed edges.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.