Hindsight long-term memory for DeepSeek Harness: injects relevant memories before each turn and retains finished turns to a Hindsight bank. Requires DSH ^0.2.0-rc.1 (verified on 0.2.0-rc.2).
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:jackyytche/dsh-hindsight-memory
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
把 Hindsight 变成 DeepSeek Harness 的
管线级长期记忆:不暴露任何 agent 工具,模型调用前后自动完成记忆的注入与留存
(即 Hermes Agent 的 pre_llm_call / post_llm_call 钩子模式)。
运行时要求:DeepSeek Harness
0.2.0-rc.1。 插件在package.json中把这些@deepseek-ai/dsh-*包声明为 peer,profile 的兼容性 闸门会在不匹配的 dsh 上直接拒载,而不是运行期静默失灵。
工作原理
| 钩子 | DSH 事件 | 行为 |
|---|---|---|
| Auto-Recall | agent/pre-step(waterfall) |
每轮一次(对齐 Hermes 的 prologue 语义):仅在 turn 的第一个 LLM 调用(step 1)前,取最新用户消息(≤800 字符)作 query 调 Hindsight recall,把相关记忆作为一条 user 消息追加进步骤批次(source kind: "hindsight-memory"、form: "snapshot")。后续 step 不再召回——turn 级 WeakMap 认领(防重放),工具循环内复用 step 1 已持久化的那一块。琐碎输入跳过(对齐 Hermes is_trivial_prompt):“好的/嗯/ok/谢谢/继续”等寒暄确认及 / 斜杠命令不发起召回。 |
| Auto-Retain | session/event(observer) |
每次 append 都投递一次(0.2.0-rc.1 起事件带 (session, event) 参数):按 turn/start → user/message / assistant/message → turn/end 增量累积该轮 User/Assistant 文本,turn/end 时异步 retain 入库(fire-and-forget,绝不阻塞循环),aborted 轮次跳过。 |
- 标题生成、会话摘要等内务 LLM 调用不经过 agent loop,天然不受记忆注入污染。
- 留存是 append 驱动的:被播种(resume/restore)的历史事件不会重新发布,因此 不会重复留存旧轮次。
- 只有
source.kind === "user"的消息被当作「人类输入」;harness 注入的上下文 (时间上下文、技能目录、system-reminder)既不作为召回 query,也不进入留存正文。 - Hindsight 任何故障都被隔离:recall 失败 → 本步无注入;retain 失败 → 仅记日志,聊天永不中断。
- 子 agent / fork 会话默认同样参与(
includeSubagents可关)。
设置界面
插件带浏览器半:重启后设置侧边栏会出现独立分节 设置 → Hindsight 记忆插件
(顶级条目,注册于 settings.section slot,id 为本插件的 entry id
hindsight-memory),可就地编辑并保存:
| 控件 | 字段 | 说明 |
|---|---|---|
| 启用开关 | enabled |
关闭后立即停止注入与留存 |
| API URL | apiUrl |
Hindsight API 地址 |
| API KEY | apiKey |
Bearer Token,留空不认证(schema 标记 role("secret"),不会回传给浏览器) |
| BANK ID | bankId |
记忆库名,多端指向同一 bank 即可共享记忆 |
| Recall Budget | recallBudget |
low / mid / high 三档 |
每字段支持「重置」(清除用户层覆盖,回退到组合层配置值);保存失败时保留草稿可修正重试。 页面无条件注册:宿主未提供该命名空间(或插件未激活)时显示明确提示,而不是整页消失。
配置分层遵循 DSH 0.2.0-rc.1 语义:schema 默认值 ← 组合层 entry config(bundle
patch / profile patch)← 用户层。本插件没有单独的设置文档,所谓「用户层」就是
profile 文档里那条 hindsight-memory entry 的 config;因为字段都声明了
volatile(),保存后下一轮即可生效,无需重启。
配置(全部可省略)
- insert:
- id: hindsight-memory
name: dsh-hindsight-memory
config:
apiUrl: http://127.0.0.1:28888 # Hindsight API
apiKey: "" # 可选 Bearer token
bankId: dsh # 记忆 bank
autoRecall: true
autoRetain: true
recallBudget: low # low / mid / high
recallTypes: [observation] # 只注入蒸馏后的观察层
maxQueryChars: 800
recallTimeoutMs: 8000 # 服务端冷启动首个 recall 可能偏慢
maxMemories: 8
maxBlockChars: 4000
retainContext: conversation between the DSH agent and the user
retainTags: [source:dsh]
includeSubagents: true
retainEveryNTurns: 1
verbose: false
bundle 自带的 cordis.patch.yml 已写入 apiUrl / bankId 默认值;在 profile 的
cordis.patch.yml 里再插一条同 id 的 insert 即可覆盖任意键。
安装
dsh plugin --profile web add dsh-hindsight-memory # 或本地路径
安装器会把包写进 profile 依赖与 dsh.profile.bundles,bundle patch 随之生效。
重启 dsh web 后,宿主日志应出现:
hindsight-memory: active (api=… bank=… enabled=true)
启动时不应再出现 warning: … plugins did not activate 或
Plugin dsh-hindsight-memory@… is incompatible with dsh …。
测试
node tests/plugin.test.mjs # 宿主半侧:25 项(config 引用、召回、留存、节流…)
node tests/client.test.mjs # 浏览器半侧:按 __ModuleLoader__ 契约加载并驱动 slot 注册
卸载 / 回滚
dsh plugin --profile web remove dsh-hindsight-memory
验证
- 新会话告诉 agent 一个事实(如「我的服务器叫 atlas」),正常聊完一轮。
- 打开 Hindsight UI(部署机的 29999 端口)→ bank
dsh,应看到刚留存的User: … / Assistant: …记忆。 - 再开一个全新会话直接问「我的服务器叫什么」——回答应直接带上答案, 全程没有调用任何工具。
Links
More in this category
vectorize-io/hindsight#coding-agents★ 51291
Hindsight, agent memory that learns: long-term project memory with auto recall and retain, knowledge pages, deep reflection, and per-repo memory banks.
volcengine/OpenViking#examples/dsh-memory-plugin★ 40273
OpenViking memory and context bundle for DeepSeek Harness: pre-step auto-recall and profile injection, session capture, `viking://` URI guarding, and recall/write memory tools backed by an OpenViking server.
agentscope-ai/ReMe#dsh★ 3646
Connects DeepSeek Harness to ReMe's local-first, self-evolving personal knowledge base: automatically captures completed main-agent conversations as user-owned Markdown memory, searches conversations and source material through reme_search with BM25, optional embeddings, and wikilink expansion, and schedules daily memory consolidation.
zilliztech/memsearch#MemSearch★ 2759
Shared Markdown memory for DSH and other coding agents, with automatic capture, pre-step context injection, searchable recall, and memory-to-skill self-evolution through a review panel.
vshulcz/deja-vu#extensions/dsh★ 1244
Reads the session files thirty-three other coding agents on this machine already wrote — Claude Code, Codex, Cursor, VS Code Copilot Chat, opencode, OpenClaw, Hermes, Kimi, Cline, Zed and more — including sessions from before it was installed: six tools (deja_recall, deja_session, deja_blame, deja_fix, deja_how, deja_remember), a /deja command, and optional automatic recall added to the runtime context. Local BM25 index, no LLM, no embeddings, no network (dsh plugin --profile web add dsh-deja).
adoresever/graph-memory★ 655
Traceable, searchable cross-session memory for DeepSeek Harness — conversation knowledge as typed graph nodes (TASK/SKILL/EVENT) and typed edges.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.