前言¶
DSH 的插件机制允许把额外能力以 profile bundle 方式接入 Web profile。对于需要在 DSH 会话中保留长期记忆、生成用户画像,并支持对话和记忆搜索的使用者,dsh-tdai-memory 提供了一个记忆层:先做 L0 对话捕获,再做 L1 结构化记忆提取,最后在 prompt assembly 时进行自动召回注入。
这是什么¶
dsh-tdai-memory 是 Scorp1o117 维护的 DeepSeek Harness 插件,定位为 TencentDB Agent Memory 的移植版本。许可证为 MIT,package.json 版本为 0.2.14,要求 Node >=22.18。
它主要解决记忆沉淀、结构化提取、召回注入和搜索问题。插件会复用现有 ~/.memory-tencentdb/memory-tdai 数据目录,因此如果该目录中已有记忆数据,可继续沿用。
核心功能¶
下面介绍其能力边界。
- L0 conversation capture:每一轮对话写入 raw conversation storage,存储形态为
JSONL + SQLite + FTS + vectors。 - L1 structured memory:后台 LLM 管道从对话中提取 facts / preferences / events,写入
records/,并保留SQLite + FTS + vectors。 - L2 scenes / L3 persona:生成 scene blocks 和 user profile。
- Automatic recall injection:在 prompt assembly 时,将相关记忆和用户画像作为 dynamic context 注入。
- Tools:提供
tdai_memory_search(L1 structured search)和tdai_conversation_search(L0 raw-text search)。 - Configuration:配置通过
tdai-memory:settings namespace 管理,也可以在 Web UI Settings → 记忆 section 中修改。
安装与启用¶
先确认本地环境。dsh-tdai-memory 的 engines.node 要求 >=22.18。版本兼容性方面:
0.2.13及更高版本要求 DSH0.1.0-rc.7或更高版本,并已测试0.1.0-rc.7、0.1.0-rc.8、0.1.1-rc.1。- DSH
0.1.0-rc.6用户需要固定使用dsh-tdai-memory@0.2.11。
安装命令:
dsh plugin --profile web add dsh-tdai-memory
该命令会把插件作为 standard profile bundle 安装到 web profile。安装或调整配置后,需要重启 dsh web:
dsh web
设置项变更在重启后生效。
典型用法¶
LLM 和 embedding 的 API key 可以放在 $DSH_HOME/settings.yaml 的 tdai-memory: 命名空间下,也可以在 Web UI settings page 的“记忆 / Memory”栏目中设置。
$DSH_HOME/settings.yaml 示例:
tdai-memory:
llm:
apiKey: '<llm-api-key>'
embedding:
apiKey: '<embedding-api-key>'
profile patch 的 base layer 可以只保留基础字段,具体配置放在 settings 中:
- id: tdai-memory
name: 'dsh-tdai-memory'
config: {}
如果选择 fully local embedding backend,node-llama-cpp 是 optional peer,并且默认不安装。
适用场景与注意¶
适合在 DSH Web profile 中使用以下能力:
- 长期保存对话历史,并支持 raw-text 搜索。
- 从对话中提取 facts / preferences / events。
- 生成 scene blocks 和 user profile。
- 在后续 prompt assembly 中自动注入相关记忆。
使用前需要注意:
- 插件以当前
dsh进程权限运行。安装前应检查源码、许可证和依赖关系;本插件许可证为 MIT。 - 插件不修改 host installation 中的文件。
dedup默认关闭,原因是 LLM conflict-detection output parsing 不稳定。- 提取模型表现需要单独评估:
mimo-v2.5可以正确提取,但每次调用约20-30s;deepseek-v4-flash会产生 invalid extraction JSON。 - 设置项变更在重启后生效。
链接¶
- GitHub:
https://github.com/Scorp1o117/dsh-tdai-memory - 插件目录页(插件线索,独立站点):
https://www.skillhub.cn/plugins/Scorp1o117/dsh-tdai-memory