dsh-memory
DeepSeek Harness 共享持久记忆插件:所有会话共享一个记忆库,提供 memory_add / memory_search / memory_list / memory_remove 工具,并在 Web 侧边栏提供 Memory 面板
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:joyiok/dsh-memory说明文档
阅读完整 README ↗dsh-memory
DeepSeek Harness(DSH)共享持久记忆插件。
- 一个所有会话共享的记忆库:存储在
$DSH_HOME/storages/dsh-memory.json, web / headless / 任何工作目录的会话都读写同一份数据。 - Agent 工具:
memory_add/memory_search/memory_list/memory_remove, 新会话里 Agent 会自动先检索记忆、遇到值得记住的事实会主动写入。 - Web 侧边栏:底部
Memory按钮,面板支持查看、搜索、添加、删除记忆。 - 原子写入:临时文件 + rename,跨进程写入安全;读取按 mtime 感知外部更新。
安装
cd /home/joy/Documents
dsh plugin --profile web add /home/joy/Documents/dsh-memory-plugin
dsh plugin --profile headless add /home/joy/Documents/dsh-memory-plugin
安装完成后重启 dsh web:
dsh web
验证:dsh --profile web --dump-config 应出现:
# == dsh-memory
- id: memory
name: dsh-memory
使用
让 Agent 记忆 / 回忆
用户:记住:我们的正式语言是中文,token 预算每月 5000 万
Agent:调用 memory_add(content: ..., tags: ["preference", "budget"])
(新会话)
用户:我们之前说过 token 预算多少?
Agent:调用 memory_search(query: "预算") 后回答
Web 面板
左下角 Memory → 输入框写内容 + 逗号分隔标签 → 保存;列表内可搜索、删除。
工具参数
| 工具 | 参数 | 说明 |
|---|---|---|
memory_add | content 必填;tags / category 可选 | 写入一条共享记忆 |
memory_search | query 必填;limit 可选 | 搜索内容 / 标签 / 分类 |
memory_list | category / tags / limit 可选 | 列出记忆 |
memory_remove | id 必填 | 按 id 删除记忆 |
配置
可在 profile 的 cordis.patch.yml 覆盖(覆盖整行 config):
- id: memory
config:
file: /path/to/shared-memory.json # 默认 $DSH_HOME/storages/dsh-memory.json
maxContentChars: 20000 # 单条记忆最大字符数
defaultSearchLimit: 20
maxToolLimit: 100
禁用插件:
- id: memory
disabled: true