JunNanLYS/dsh-layered-memory 预览 preview

JunNanLYS/dsh-layered-memory

DeepSeek Harness长期记忆:对话自动蒸馏为事实/场景/画像三层记忆,每步自动召回注入——让AI基于证据说话,零操作无感使用。

Project Overview项目介绍

This is a native memory plugin built exclusively for DeepSeek Harness (DSH) that implements layered distillation of conversational memory. It automatically runs a four-step pipeline in the background: capturing raw conversation events, distilling them into atomic memory, integrating scene context, and generating user profiles. Before every model inference step, it retrieves relevant memory and injects it into the context window to reduce information loss in long conversations. You can install it via the official DSH CLI using either npx for a no-install run or a pre-installed global dsh command, and it works with both DSH web profiles and terminal TUI profiles.

The plugin is designed for both developers and end users who use DSH to build custom AI agents. It solves common pain points like context window overflow and lost key information in long-running conversations that stretch over multiple sessions. After each conversation completes, it runs the full distillation pipeline automatically in the background, and injects only the most relevant memory for new conversations to avoid wasting valuable context tokens. Users can manually switch between different memory tiers to match the needs of different use cases, from casual daily chat to complex professional work projects.

The plugin is released under the permissive MIT open source license, and requires Node.js version 22.16 or higher to run correctly. It includes built-in workarounds for common issues like slow TTFT (time to first token) from free or low-tier inference providers, including custom route switching, automatic fallback chains, and per-layer routing configurations. It automatically tracks token costs for all distillation steps and provides built-in visualizations of cost trends over different time periods. After installation, users only need to restart DSH to activate the plugin, and all memory data is stored locally on your own machine for privacy.

这是一款专为 DeepSeek Harness 开发的原生分层蒸馏记忆插件,会在后台自动捕获对话,将对话蒸馏分级为L0捕获、L1原子记忆、L2场景整合、L3画像记忆四层,在模型每一步推理前自动将相关记忆注入上下文。可通过官方DSH CLI使用npx或已安装的dsh命令安装,同时支持web端配置文件和终端TUI两种部署形态。

面向使用DeepSeek Harness搭建AI代理的开发者和普通用户,可解决长对话上下文溢出、关键信息遗漏的痛点。对话完成后自动完成分层蒸馏,新对话发起时自动召回相关记忆注入上下文,还支持手动切换记忆档位,适配日常、工作、智能等不同场景的记忆管理需求,同时提供三个记忆工具方便检索历史内容。

本插件采用MIT开源许可,要求Node版本不低于22.16,兼容DSH 0.1.2-alpha.1到0.1.2-rc.1版本。针对部分推理供应商慢速首 token延迟问题,提供了换路由、自动回退链、按层路由三种解决方案,还会自动记录token使用成本,支持可视化查看开销,用户安装后只需重启DSH即可生效。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 note1 项提示
  • 18 stars - an early-stage project星标 18,属于早期项目
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命令行安装

npx -y @deepseek-ai/dsh plugin --profile web add dsh-layered-memory

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

READMEREADME

DeepSeek Harness hero 横幅:对话自动分层蒸馏成记忆,模型每步前自动召回注入——右侧对话气泡逐层溶解为三层渐亮光带,流入带发光圆球与渐变轨道的玻璃胶囊(下有 日常·工作·智能·关闭 四档刻度),光丝回流示意召回注入

dsh-layered-memory

DeepSeek Harness 的分层蒸馏记忆插件:对话在后台自动完成 L0 捕获 → L1 原子记忆 → L2 场景整合 → L3 画像蒸馏,模型每一步前自动把相关记忆注入上下文。

English · 最新发行版 · 反馈问题

npm version DSH 0.1.2 MIT License

快速开始

需要 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 半边就绪。

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

← 上一个 Prev nekro-nxt 下一个 Next dsh-effort-slider →