
JunNanLYS/dsh-layered-memory
dsh-layered-memory
Long-term memory for DeepSeek Harness: the AI remembers who you are, your projects and preferences across sessions, keeps personal and work memories separate, zero-config.
Install
npx @deepseek-ai/dsh plugin --profile web add dsh-layered-memoryRestart `dsh web` after install. Bundle APIs can change during the developer preview.
README badge
[](https://dshhub.dev/plugins/dsh-layered-memory)Paste this into your README. The star count updates with every catalog sync.
From the README
Excerpt from JunNanLYS/dsh-layered-memory, cleaned of badges and images.
<img src="./assets/img/Hero.png" width="100%" alt="DeepSeek Harness hero 横幅:对话自动分层蒸馏成记忆,模型每步前自动召回注入——右侧对话气泡逐层溶解为三层渐亮光带,流入带发光圆球与渐变轨道的玻璃胶囊(下有 日常·工作·智能·关闭 四档刻度),光丝回流示意召回注入">
dsh-layered-memory
DeepSeek Harness 的分层蒸馏记忆插件:对话在后台自动完成 L0 捕获 → L1 原子记忆 → L2 场景整合 → L3 画像蒸馏,模型每一步前自动把相关记忆注入上下文。
快速开始
需要 Node ≥ 22.16 与 DeepSeek Harness 0.1.2-alpha.1 ~ 0.1.2-rc.1(0.10.0 起
支持到 0.1.2-rc.1,npm latest 已指向该版本;旧版插件请看
历史版本)。
两种调用方式任选(npx 前缀可替换下面任何 dsh 命令):
# 方式一:npx 直接跑官方 CLI(无需预装 dsh)
npx -y @deepseek-ai/dsh plugin --profile web add dsh-layered-memory
# 方式二:已装 dsh CLI(升级:npm i -g @deepseek-ai/dsh 并重启;
# dsh 是 pnpm 转发器,未装 pnpm 时先 npm i -g pnpm)
dsh plugin --profile web add dsh-layered-memory
# 包源备选:GitHub 仓库 / 本地路径(开发调试,link: 指向仓库,pnpm run build + 重启 dsh 即生效)
dsh plugin --profile web add https://github.com/JunNanLYS/dsh-layered-memory
dsh plugin --profile web add /path/to/dsh-layered-memory
让 Agent 安装(推荐)
如果当前 Agent 可以执行终端命令,把下面这段话完整发送给它:
请为 DeepSeek Harness 的 web Profile 安装 dsh-layered-memory 插件。
只执行下面两条命令,不要修改其他 Profile:
dsh plugin --profile web add dsh-layered-memory
dsh --profile web --dump-config
确认输出中出现 dsh-layered-memory 后告诉我安装结果。
不要替我关闭或重启正在运行的 DSH;安装完成后提醒我手动重启 DSH Web Host。
Agent 应当返回安装结果,并明确告诉你配置中是否已经出现 dsh-layered-memory。
本包声明了 dsh.bundle 组合包层(cordis.patch.yml),安装后会自动挂载插件行——
不需要再手改 $DSH_HOME/profiles/web/cordis.patch.yml。然后重启 DeepSeek Harness,
验证:~/.dsh/memory/ 下出现 conversations/ records/ scenes/ 目录和 memory.db
即插件 apply 成功;设置页出现"记忆"页面(记忆工作台五区)、输入栏出现记忆芯片
(记忆 · 智能)即 client 半边就绪。
卸载:dsh plugin --profile web remove dsh-layered-memory + 重启。数据保留在
~/.dsh/memory/,不需要时手动删除整个目录即可。
终端形态(TUI / headless)
除 web 外,同一插件可直接装进终端形态宿主:
# dsh-tui(Claude Code 风格 TUI 前门,详见 github.com/ccch1mneyyy/dsh-TUI · 官网 https://dshtui.com)
dsh plugin --profile dsh-tui add @deepseek-harness-tui/dsh-tui # 首次:建 profile 并装 TUI 宿主
dsh plugin --profile dsh-tui add dsh-layered-memory
dsh --profile dsh-tui
/memory <auto|chat|work|off>切换当前会话档位,无参数时弹出档位选择面板;- 状态行:提示框上方常驻
记忆:智能等当前档位读数; /settings设置区块:总开关、捕获、蒸馏、召回、蒸馏模型路由与输入预算可直接编辑 (与 web 设置面板同一存储;复杂路由链仍走 web / YAML);- headless(
dsh --profile headless "一次性任务"):捕获与蒸馏照常工作,无界面元素。 web 与终端形态共享~/.dsh/memory/同一份记忆。
从源码开发
git clone https://github.com/JunNanLYS/dsh-layered-memory
cd dsh-layered-memory
pnpm install && pnpm run build
dsh plugin --profile web add . # link: 安装,改代码后 pnpm run build + 重启 dsh 即生效
pnpm run smoke # 冒烟测试(先重编:见下方命令)
npx tsc src/smoke.ts --outDir dist-smoke --module nodenext --moduleResolution nodenext --target es2022 --strict --skipLibCheck --esModuleInterop
依赖管理用 pnpm(与 dsh 官方安装通道一致,版本由 packageManager 字段钉死)。
运行时数据流
<img src="./assets/readme/flow.svg" width="100%" alt="dsh-layered-memory 运行时数据流:左侧 User 与 Assistant 的会话事件流入插件(L0 捕获、L1–L3 蒸馏、检索召回、记忆工具),插件经 agent/pre-step 把相关记忆注入右侧 DSH 核心;蒸馏复用核心的 ctx.llm,数据双写 ~/.dsh/memory/">
…

