@towzai/dsh-memory
Cross-session memory plugin for DeepSeek Harness (dsh): YAML-backed remember/recall/forget/pin tools, embedding search, and automatic system-prompt injection with WebUI context-injection visibility.
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Towzai/dsh-memory说明文档
阅读完整 README ↗dsh-memory 🧠
为 DeepSeek Harness(dsh)开发的跨会话记忆插件。
基于 YAML 存储的 remember / recall / forget / pin 工具,支持 embedding 语义检索与系统提示词自动注入——智能体"天生带着"记忆,无需记得调用工具。
English | 中文
✨ 特性
| 特性 | 说明 |
|---|---|
| 四个工具 | remember(写)/ recall(语义检索)/ forget(软删除)/ pin(强制注入) |
| Embedding 检索 | HybridSearch(关键词 2-gram + 本地 ollama embedding,RRF 融合)——能命中关键词检索漏掉的口语化表达 |
| 自动注入 | systemPrompt.context() 注册于 order -50:每次会话注入高重要度 + 近期记忆,并在 WebUI 显示为"上下文注入"行 |
| 动态话题注入 | agent/pre-step 监听器按用户当前消息检索记忆(带检索门控,自动跳过"好/行/嗯"等闲聊) |
| 来源标注 | 注入记忆带前缀 "Retrieved memories from the memory store (not conversation history)",模型不会误认为是对话历史 |
| 数据安全 | 串行写入队列(无丢失更新)、损坏文件隔离备份、原子写入、mtime 缓存失效 |
📦 安装
# 方式一:从 GitHub 安装(源码,需 prepare 构建)
dsh plugin --profile add github:towzai/dsh-memory
# 方式二:本地路径安装
dsh plugin --profile add ./dsh-memory
# 方式三:npm 包(如已发布)
dsh plugin --profile add @towzai/dsh-memory
首次 git 安装若被 pnpm 拒绝运行 prepare,按提示把包键加入该 profile 的 pnpm-workspace.yaml:
allowBuilds:
'@towzai/dsh-memory': true
依赖:本地 ollama 实例 + embedding 模型(默认 qwen3-embedding:0.6b,可用环境变量 DSH_MEMORY_EMBED_MODEL 覆盖)。
🛠️ 工具
| 工具 | 作用 |
|---|---|
remember | 保存记忆(content / category / tags / importance / forceInject / source) |
recall | 混合检索(关键词 + embedding)top-N |