dsh-memory-graph
Verifieddsh-memory-graph · v0.1.2 · MIT
Graph-based memory recall for DeepSeek Harness: word-root graph + 2-hop propagation, with a 3D activation view.
Install
dsh plugin add dsh-memory-graph Confirm the layer applied with dsh --profile default --dump-config — see the install guide.
Source
Published to npm without a public repository. Inspect the package contents before installing.
Tags
Readme
dsh-memory-graph
让 Agent 的记忆看得见、可迁移、会内省。 Make an agent's memory visible, portable, and self-aware.
一个 DeepSeek Harness 插件 + 一组本地工具:把明文记忆、项目档案、技能编译成一张词根关系图, 用 3D 视图点亮“这一轮读了什么”,并把「她长成了什么样」沉淀成可迁移的生命档案。
中文
它解决什么
现在的记忆插件大多做同一件事:存文本 + 关键词检索。结果是:
- 你问“上次那个 Blender 坑”,它只在你恰好用了同样词时命中;
- 你看不见它这一轮到底读了哪几条;
- 换台机器,记忆是一堆散装 Markdown,人格接不上。
这个项目补的是三层:
| 层 | 做法 | 产出 |
|---|---|---|
| 召回 | 词根(共享二元组/中英混排)+ 语义边 + 两跳扩散,idf 压掉高频词 | memory_recall 工具,预算内返回命中条目 |
| 可见 | 记忆/档案/技能/词根四类节点,3D 力导向 + 激活脉冲 | 双击即开的 index.html |
| 可迁移 | 记忆 + 作品 + 被外部证据确认的性格 → 一份 life.json |
换机器加载即“还是她” |
与其它项目的关系(不重造轮子)
| 项目 | 它做什么 | 我们的关系 |
|---|---|---|
| DeepSeek Super-agent | Router/Worker 调度、事件驱动、长程会话 | 挂靠:它自己列出的未解项就有“跨月长程记忆”,正是本项目 |
| raise-an-ai | 养鲸鱼娘:自备模型、B站探索、日记记忆 | 互补:它管“陪伴形态”,我们管“记忆内核”,life.json 可直接做它的存档 |
| total-agent-memory | 3D WebGL 记忆图查看器 | 同类可视化;我们额外带召回与内省 |
| awesome-ai-companion | 桌宠/陪伴项目合集 | 索引,不是竞品 |
| MemGPT / Letta | 分层记忆 + 换页 | 全在上下文层,不进图、不内省 |
内省:自省不给自评分
tools/introspect.py 的规则很硬:
- 一条“我注意到自己…”必须带外部证据(用户纠正 / 测试失败 / 返工),否则拒绝记录;
- ≥2 条证据且含外部锚定,才“晋级”为性格;否则永远停在假设层。
这不是读激活(那需要本地模型),而是可审计的自模型账本。理论依据见 Language Models Don't Always Say What They Think(Turpin 2023)与 Looking Inward(Binder 2024): 自我报告不可靠,必须外部锚定。
安装
# 1) 插件(本地链接)
dsh plugin --profile desktop add link:<repo>/plugins/dsh-memory-graph
# 2) 重建索引(写 docs/memory-graph/index.html)
python tools/build_memory_graph.py
# 3) 召回
python tools/memory_retrieve.py "上次那个 Blender 坑"
# 4) 内省账本
python tools/introspect.py record "过早收敛" "细节留到被指出才补" --evidence "用户:链接也是黑的"
python tools/introspect.py review
# 5) 生命档案
python tools/life_pack.py export --name 蓝毛小女仆
配置:环境变量 DSH_MEMORY_GRAPH_ROOT(工作区根)、DSH_MEMORY_PYTHON(Python 路径)。
设计约束
- 不混训:明文与参数各走各的,只通过结构化消息交互;
- 预算硬顶:召回默认 1200 字,超了降级不硬塞;
- 外部锚定:任何“提升”只在留出任务上算数;
- 纯本地:不联网、不调模型,召回一次 <0.1s、0 token。
English
dsh-memory-graph is a DeepSeek Harness plugin plus a small local toolkit that turns an agent's plain-text memory, project documents and skills into a word-root graph, lets you see which memories a turn actually used in a 3D view, and exports a portable life pack.
Three layers
- Recall — query terms → shared word roots → 2-hop propagation with idf weighting.
Exposed as the
memory_recalltool with a hard character budget. - Visibility — four node types (memory / document / skill / root) in a force-directed 3D scene;
recalled nodes pulse gold. Open
index.htmldirectly, no server needed. - Portability — memories + works + externally-confirmed traits compile into
life.json/life.md. Load it on another machine and she is still her.
Introspection without self-flattery
introspect.py refuses any observation that lacks external evidence (user correction, failing test,
rework). A trait is promoted only with ≥2 evidence items, at least one externally anchored.
Motivated by Language Models Don't Always Say What They Think and Looking Inward.
Non-goals
Not another orchestration framework (see DeepSeek Super-agent), not another desktop pet (see raise-an-ai / awesome-ai-companion). This is the memory core those can sit on.
MIT License.