← 返回列表
⚠ 装前注意
跨会话存取事实偏好,按语义召回并自动注入上下文
基本兼容但装前注意:未发布到 npm registry,仅可从源码安装 · 最近上游提交 2026/8/14 · 已提供中文文档
DeepSeek Harness 的语义长期记忆:hindsight_retain/recall/reflect 工具 + 基于本地 Hindsight 守护进程(pgvector + DeepSeek embeddings)的自动召回
综合分
32.4
GitHub 分
32.4
用户评分
—
★ Stars
1
周下载量
—
安装插件(需先安装 dsh CLI 引擎:npm install -g @deepseek-ai/dsh)
dsh plugin --profile web add WeilaiSun/dsh-hindsight-memory未发布到 npm registry,仅可从源码安装,改用 GitHub 源安装
数据截至 2026/9/16(元数据每日更新 · 实装验证按队列轮转,单条结论的验证时间见上方)
安装兼容性检查⚠ 装前注意
以下结论由程序自动检查 npm 包、engines 声明与入口文件得出,未做人工实机验证——能装不等于用着没问题。
✗npm 包dsh-hindsight-memory(未发布到 npm,仅可源码安装)
✓Node 引擎要求 >=20 · 基线 Node 22.19 满足
✓dsh CLI 依赖未声明 dsh 版本约束
✓入口文件main/exports/bin 已声明
未发布到 npm registry,仅可从源码安装
验证方式:npm registry 存在性 + package.json 静态校验 · 最后验证 2026/9/18 18:58:28
依赖的 DSH / Cordis 模块
@deepseek-ai/schemastery@deepseek-ai/cordis@deepseek-ai/dsh-agent@deepseek-ai/dsh-llm@deepseek-ai/dsh-tools用户评分
还没有人投票,来当第一个
订阅周报,不错过优质插件更新
每周一封 · 高评分插件 + 新用户活动
README
dsh-hindsight-memory
为 DeepSeek Harness 提供的语义长期记忆——基于本地 Hindsight 守护进程(PostgreSQL + pgvector + DeepSeek 嵌入),提供原生 hindsight_retain / hindsight_recall / hindsight_reflect 工具,并可在每个 agent 步骤前可选地注入 auto-recall。
一切皆为插件——这是一个 Cordis 插件,可通过 dsh plugin add 安装。
为什么
DeepSeek Harness 的内置记忆是会话级的(每会话事件日志 + AGENTS.md 指令)。本插件增加了跨会话语义记忆:高价值事实、用户偏好和经验教训会被嵌入到向量存储中,并按语义而非关键词检索——就像 Hermes 的 Hindsight 集成一样。
特性
- hindsight_retain —— 写入一条记忆;Hindsight 会自动提取事实、解析实体、生成嵌入、对相似事实去重,并按时间/语义建立关联。
- hindsight_recall —— 语义搜索(嵌入相似度 + 知识图谱扩散激活)。查询不需要匹配关键词。
- hindsight_reflect —— 对召回的事实 / 心智模型 / 指令进行 LLM 综合,给出提炼后的答案。
- autoRecall —— 启用后,插件会挂接 agent/pre-step,并在每个步骤前将相关记忆作为 用户消息注入,使模型不会在冷启动状态下开始任务。
- 隔离 —— 插件驱动其自己的 Hindsight 配置文件(默认 deepseek):独立的守护进程端口、独立的 PostgreSQL 实例、独立的 bank。它从不读取或写入其他配置文件的数据。
前置条件
- 本地安装的 Hindsight,其 venv 中带有 Python 包 hindsight_embed。
- 用于嵌入的 DeepSeek API key(或任何 OpenAI 兼容端点)。
默认值假定为标准 Hermes 布局(F:\Hermes\HERMES_HOME\...);如果你的安装位于其他位置,请通过配置覆盖。
安装
从 GitHub 安装(当前可用):
dsh plugin --profile web add git+https://github.com/WeilaiSun/dsh-hindsight-memory.git
从 npm 安装(发布后):
dsh plugin --profile web add dsh-hindsight-memory
然后将该行添加到你的 agent 预设或配置文件补丁(cordis.patch.yml)中:
- id: hindsight-memory
name: 'dsh-hindsight-memory'
config:
autoRecall: true
新会话会加载它(agent 预设在会话创建时固定)。
配置
| 键 | 默认值 | 描述 |
|---|---|---|
| venvPython | F:\Hermes\HERMES_HOME\hermes-agent\venv\Scripts\python.exe | 已安装 hindsight_embed 的 Python |
| configJson | F:\Hermes\HERMES_HOME\hindsight\config.json | 包含 llm_api_key / llm_base_url / llm_model 的 JSON(DeepSeek key 的来源;绝不硬编码) |
| llmBaseUrl / llmModel / llmProvider | DeepSeek 默认值 | 嵌入端点;deepseek/openai_compatible/openrouter 映射为 openai |
| profile | deepseek | Hindsight 配置名称(独立的守护进程端口 + PG 实例 + bank) |
| bank | = profile | 由 retain/recall/reflect 使用的 bank id |
| autoRecall | false | 在每个 agent 步骤前注入相关记忆 |
| recallTypes | ["observation","experience","world"] | 搜索的事实类型 |
| recallLimit | 4 | 每次召回的最大记忆数 |
| recallMinUserChars | 20 | 触发自动召回前用户消息的最小长度 |
| recallBudgetTokens | 1200 | 自动召回注入的 token 预算 |
用法
模型直接调用这些工具。示例保留策略(对应一种自演化协议):
- 在复杂任务(5 次以上工具调用)之后、解决一个陷阱之后、当用户表达持久偏好时,或在关键设计决策之后进行保留。
- 在复杂任务开始时、当用户引用过去的工作时,或当某种情况看起来像是重复时进行召回。
agent preset row with auto-recall enabled
- id: hindsight-memory
name: 'dsh-hindsight-memory'
config:
autoRecall: true
recallLimit: 5
工作原理
agent step (autoRecall) / model tool call
│
▼
plugin (node) ──ensure daemon──▶ hindsight_embed (Python) ──spawn──▶ Hindsight daemon (REST)
│ │
└────────── fetch ──▶ /v1/default/banks/{bank}/memories[/recall|/reflect]
│
PostgreSQL + pgvector + DeepSeek embeddings
守护进程在首次使用时自动启动,并在空闲时停止(默认 10 分钟)。插件会缓存守护进程 URL,并在失败时重新确保其运行。
开发
git clone
cd dsh-hindsight-memory
node --check lib/index.js # syntax
node smoke-test.mjs # end-to-end: fake ctx + real daemon
许可证
MIT扫码进群