Repository navigation
Releases
v0.1.4 — 重构 / 人格参数 / 续接与预测 (Reconstruction / Persona / Resume / Predict)
本版是重构底座 + 人格串联的初版:不新增记忆层与存储结构,只给现有记录加「表达字段」,并加上读时重构与人格参数网。设计推导见 设计-重构与人格.md | English version。
变化
| # | 变化 | 涉及文件 |
|---|---|---|
| 1 | 记录新增 eventId / cues / source / confidence / status / validFrom / validTo / reconsolidationCount |
src/memory.js |
| 2 | layer 扩展 procedural / autobiographical(同一结构) |
src/memory.js |
| 3 | 重构:按线索组合情景/语义/情绪/程序/自传体,返回缺口与来源 | src/memory.js |
| 4 | 续接:memory_resume 把会话顺序记录拼成目标/做到/最后/下一步 |
src/memory.js |
| 5 | 预测:memory_predict 返回概念/案例/后果/风险 |
src/memory.js |
| 6 | 人格参数网:注意/提取/解释/表达权重,影响重构取材 | src/persona.js |
| 7 | 反馈记忆 → 人格参数建议;memory_persona_update 持久化 |
src/index.js、persona.json |
| 8 | SQLite 索引补列(event_id / source / status / confidence / cues_json) | src/index-db.js |
| 9 | memory_doctor:健康检查(记录/索引/回收站/损坏文件/候选/反馈) |
src/index.js |
存储表达(不新增结构)
- 同一事件的多条记忆用
eventId串起来(分布式);cues让不同线索唤起不同侧面。 source区分事实/推断;status支持active / candidate / superseded;validFrom/To表示有效区间。- 全部是可选字段,旧记录缺省即默认值,不迁移、不改目录。
重构 / 续接 / 预测
memory_reconstruct:按线索从多个分区取材,组合成「我记得 / 那时的感觉 / 这让我想到 / 类似地我会 / 一路走来」,返回gaps与confidence;引用到的记录reconsolidationCount++,原文不改;支持asOf查某个时间点的版本。memory_resume:不存项目表,取该会话kind=turn的记录按序重组成目标/做到/最后/下一步。memory_predict:语义给概念、情景给案例、程序给后果、情绪给风险。
人格串联
persona.attention/persona.retrieval影响重构取材;interpretation/expression作为给模型的框架提示。memory_feedback写普通反馈记忆,memory_persona给出增量建议,memory_persona_update写入persona.json。
健壮性
- 损坏的记忆文件被跳过(不阻塞启动);损坏的
state.json回退默认值。 - 列表上限:
memory_recall≤ 50、memory_timeline≤ 500、memory_reconstruct≤ 20、/memory-list最多 200 条。 memory_doctor报告记录数、各层数量、索引状态、回收站、损坏文件、候选/反馈数量。
测试
| 测试 | 结果 |
|---|---|
self-test |
✅ 32 / 32 |
emotion-test |
✅ 9 / 9 |
library-test |
✅ 15 / 15 |
consolidate-test |
✅ 10 / 10 |
db-test |
✅ 8 / 8 |
reconstruct-test |
✅ 9 / 9 |
persona-test |
✅ 6 / 6 |
gui-test |
✅ 17 / 17 |
client-test |
✅ 4 / 4 |
robustness-test |
✅ 3 / 3 |
| 合计 | 113 / 113 |
文档(中英双语)
中文为原文,英文为 *.en.md 对照版,共 10 份(含仓库根 README)。每份文档顶部都有双向语言切换器:
| 中文 | English |
|---|---|
README.md(仓库根) |
README.en.md |
dsh-human-memory/README.md |
README.en.md |
更新文档.md |
CHANGELOG.en.md |
实现思路.md |
DESIGN.en.md |
测试文档.md |
TESTING.en.md |
备选方案-人类记忆缺陷.md |
ALTERNATIVES.en.md |
设计-记忆类型与数据库.md |
DESIGN-memory-types-and-database.en.md |
设计-重构与人格.md |
DESIGN-reconstruction-and-persona.en.md |
迭代方向-会话短期记忆.md |
ROADMAP-session-memory.en.md |
迭代方向-用户画像记忆.md |
ROADMAP-user-profile.en.md |
安装
git clone https://github.com/Azurimson/dsh-plugin.git
cd dsh-plugin
dsh plugin --profile <你的 profile> add ./dsh-human-memory从插件市场安装:插件页 → 发现 → 添加索引源,填入
https://raw.githubusercontent.com/Azurimson/dsh-plugin/main/dsh-human-memory/dsh-market.json
可安装 v0.1.0 / v0.1.1 / v0.1.2 / v0.1.3 / v0.1.4 任一版本。
v0.1.4 — Reconstruction, Persona, Resume & Predict
The first release of the reconstruction substrate + persona wiring. No new memory layers or storage structures: existing records gain "expression fields", plus read-time reconstruction and a persona parameter network. Design notes: English | 中文.
Changes
| # | Change | Files |
|---|---|---|
| 1 | Records gain eventId / cues / source / confidence / status / validFrom / validTo / reconsolidationCount |
src/memory.js |
| 2 | layer extended with procedural / autobiographical (same structure) |
src/memory.js |
| 3 | Reconstruction: composes episodic / semantic / emotional / procedural / autobiographical by cue, reports gaps and sources | src/memory.js |
| 4 | Resume: memory_resume turns a session's ordered records into goal / done / last / next |
src/memory.js |
| 5 | Predict: memory_predict returns concepts / cases / consequences / risks |
src/memory.js |
| 6 | Persona parameter network: attention / retrieval / interpretation / expression weights shape reconstruction | src/persona.js |
| 7 | Feedback memory → persona suggestions; memory_persona_update persists |
src/index.js, persona.json |
| 8 | SQLite index extra columns (event_id / source / status / confidence / cues_json) | src/index-db.js |
| 9 | memory_doctor: health check (records / index / trash / corrupt files / candidates / feedback) |
src/index.js |
Storage expression (no new structures)
- Multiple memories of one event are linked by
eventId(distributed);cueslet different cues surface different facets. sourceseparates fact from inference;statussupportsactive / candidate / superseded;validFrom/Tomark validity ranges.- All fields are optional, so old records fall back to defaults — no migration, no directory changes.
Reconstruct / Resume / Predict
memory_reconstruct: gathers across partitions by cue and composes "what I remember / how it felt / what it reminds me of / similarly I would / along the way", returninggapsandconfidence; cited records getreconsolidationCount++without altering their text;asOfreads the version at a point in time.memory_resume: stores no project table — it takes the session'skind=turnrecords in order and rebuilds goal / done / last / next.memory_predict: semantics give concepts, episodes give cases, procedures give consequences, emotions give risks.
Persona wiring
persona.attention/persona.retrievalshape what reconstruction draws on;interpretation/expressionact as framing hints for the model.memory_feedbackstores an ordinary feedback memory,memory_personareturns incremental suggestions,memory_persona_updatewritespersona.json.
Robustness
- Corrupt memory files are skipped (never block startup); a corrupt
state.jsonfalls back to defaults. - List caps:
memory_recall≤ 50,memory_timeline≤ 500,memory_reconstruct≤ 20,/memory-listshows at most 200 entries. memory_doctorreports record count, per-layer counts, index status, trash, corrupt files, candidate and feedback counts.
Tests
10 suites, 113 / 113 passing (32 + 9 + 15 + 10 + 8 + 9 + 6 + 17 + 4 + 3).
Documentation (bilingual)
Nine Chinese documents each have an English counterpart (*.en.md): README, changelog, design rationale, testing plan, alternatives, two design notes, and two roadmap docs.
Install
git clone https://github.com/Azurimson/dsh-plugin.git
cd dsh-plugin
dsh plugin --profile <your profile> add ./dsh-human-memoryFrom the plugin market: Plugins → Discover → Add index source, then enter
https://raw.githubusercontent.com/Azurimson/dsh-plugin/main/dsh-human-memory/dsh-market.json
Any of v0.1.0 – v0.1.4 can be installed.
v0.1.3 — 三轴记忆类型化 / 情绪识别 / SQLite 索引
本版实现三轴记忆类型化(粒度 / 情绪 / 细节分离)+ node:sqlite 索引。设计推导见 设计-记忆类型与数据库.md。
变化
| # | 变化 | 涉及文件 |
|---|---|---|
| 1 | 粒度 gist / detail:默认只回梗概,细节需 detail 才带出 |
src/memory.js |
| 2 | 情绪识别:语气词、标点、强调、重复、反问、emoji 多信号加权 | src/emotion.js |
| 3 | 一条记录多 facet:gist + details + emotion,不拆成多条 | src/memory.js |
| 4 | node:sqlite 索引:按天/会话快速查询,文件仍是真源 | src/index-db.js、src/store.js |
| 5 | memory_rescan:用户发出指令后由 DSH 重新扫描并重建索引 |
src/index.js |
| 6 | 配置新增 database / emotion |
settings.json |
| 7 | 设置卡片:顶部文件夹标签 + 右上角排序按钮 | client/client.js |
粒度(gist / detail)
- 每条记忆带
fidelity字段,默认gist;工作记忆(工具调用)标记为detail。 memory_recall/memory_timeline新增detail参数:默认只返回梗概,detail: true才返回细节记录与details字段。
情绪识别
- 新增
src/emotion.js:显式词 + 抱怨模式 + 语气词 + 强调 + 反问 + emoji + 重复 + 标点,加权后经1-exp(-score)饱和。 - 输出
emotionKind/emotionIntensity/emotionCore,强度 ≥emotion.threshold才记为情绪记忆。
node:sqlite 索引
- 运行时内置
node:sqlite,零额外构建。 - 索引文件
<root>/.index/memory.sqlite,Schema 含fidelity、emotion_kind、session_id、occurred_at,并建索引。 - 启动重建;写入/删除同步;外部变动由
memory_rescan触发重扫;node:sqlite不可用时索引降级,文件存储不受影响。
测试
| 测试 | 结果 |
|---|---|
test/self-test.mjs |
✅ 32 / 32 |
test/emotion-test.mjs |
✅ 9 / 9 |
test/library-test.mjs |
✅ 15 / 15 |
test/consolidate-test.mjs |
✅ 10 / 10 |
test/db-test.mjs |
✅ 8 / 8 |
test/gui-test.mjs |
✅ 17 / 17 |
test/client-test.mjs |
✅ 4 / 4 |
安装
git clone https://github.com/Azurimson/dsh-plugin.git
cd dsh-plugin
dsh plugin --profile <你的 profile> add ./dsh-human-memory从插件市场安装:插件页 → 发现 → 添加索引源,填入
https://raw.githubusercontent.com/Azurimson/dsh-plugin/main/dsh-human-memory/dsh-market.json
可安装 v0.1.0 / v0.1.1 / v0.1.2 / v0.1.3 任一版本。
每个变化点的详细测试方法与预期结果见 更新文档.md。
v0.1.2 — 本地 GUI / 工作记忆 / 行为时间线
本版三件事:设置区卡片成为唯一 GUI(移除独立网页 GUI)、新增工作记忆层、行为记忆增强;并补齐 GitHub / 市场结构与用户画像迭代方向文档。
变化
| # | 变化 | 文件 |
|---|---|---|
| 1 | 设置区卡片成为唯一 GUI;移除独立网页 GUI 与 /memory-gui |
client/client.js、src/gui.js、src/index.js |
| 2 | 新增工作记忆层 memories/working/(精确操作、低权重、短寿命) |
src/memory.js、src/store.js、src/index.js |
| 3 | 行为记忆补充「本轮用了哪些工具」 | src/index.js |
| 4 | 巩固实测写入测试文档 | 测试文档.md |
| 5 | GitHub / 市场结构(LICENSE、CI、dsh.plugin.json) | LICENSE、.github/、dsh.plugin.json |
| 6 | 用户画像迭代方向文档 | 迭代方向-用户画像记忆.md |
设置区卡片(唯一 GUI)
- 注册到设置页左侧「记忆」分区(
settings.section槽)。 - 顶部「打开记忆文件夹」+「刷新」;下方按权重倒序的记忆列表(层级、日期、内容、来源会话)。
- 数据走 DSH 内置 Web 服务器的只读路由
/api/dsh-human-memory/memories与/open-folder,不占用独立端口。 - 每行带删除按钮:点击即移入记忆库
trash/(不弹确认、文件保留),下次巩固时真正删除,可经/restore恢复。
工作记忆层
- 新增
memories/working/(layer: "working"),每轮记录精确操作:运行命令 / 写文件 / 编辑文件 / 读取文件。 - 权重刻意很低(
workingMemory.importance默认0.05),模拟快速淡忘;不设条数上限,靠短 TTL 回收。
⚠️ 破坏性变更
独立网页 GUI、/memory-gui 命令、memory_gui 工具已移除。升级后请改用设置页的「记忆」分区。
测试
| 测试 | 结果 |
|---|---|
test/self-test.mjs |
✅ 27 / 27 |
test/library-test.mjs |
✅ 15 / 15 |
test/consolidate-test.mjs |
✅ 10 / 10 |
test/gui-test.mjs |
✅ 17 / 17 |
安装
git clone https://github.com/Azurimson/dsh-plugin.git
cd dsh-plugin
dsh plugin --profile <你的 profile> add ./dsh-human-memory从插件市场安装:插件页 → 发现 → 添加索引源,填入
https://raw.githubusercontent.com/Azurimson/dsh-plugin/main/dsh-human-memory/dsh-market.json
可安装 v0.1.0 / v0.1.1 / v0.1.2 任一版本。
每个变化点的详细测试方法与预期结果见 更新文档.md。
v0.1.1 — 每轮自动自查 / 目录式记忆库 / 事件日期
本版针对三条反馈做了改造:每轮自动自查、目录式记忆库、事件日期,并附带旧版自动迁移。
新增
- 每轮自动自查:监听
session/event把本轮消息缓冲,在agent/turn-stopping时启发式判断哪些信息值得记住并写入,不必每次都说「记住:」。过滤提问、问候和注入提示,支持「再次提起」强化。可在settings.json用autoCapture.enabled/minChars/maxPerTurn/includeAssistant关闭或调阈值。 - 目录式记忆库:存储从单个
memories.json改为「每条记忆一个文件、按层分目录」,并附人类可读的index.json。写入只重写对应文件,单条记忆可单独查看 / 备份 / 迁移。 - 事件日期(
occurredAt):区分「事件真正发生的时间」与「写入时间」,memory_write支持传入日期,召回结果带[YYYY-MM-DD HH:mm];同一事件重复提及保留最早日期。 - 旧版单文件自动迁移:启动时若发现旧的
memories.json,自动拆分为目录结构,补齐occurredAt,原文件重命名为memories.json.bak保留。
升级步骤(0.1.0 → 0.1.1)
- 更新代码(
package.json版本0.1.1) - 重启 DSH(插件在启动时加载)
- 首次启动自动把旧
memories.json迁移为目录结构
回归测试
| 测试 | 结果 |
|---|---|
test/self-test.mjs |
✅ 16 / 16 |
test/library-test.mjs |
✅ 9 / 9 |
test/plugin-smoke.mjs |
需 DSH 宿主提供 @deepseek-ai/dsh-tools |
pnpm test # self-test + library-test每个变化点的详细测试方法与预期结果见 更新文档.md。
v0.1.0 — 首个公开版本
首个公开版本。
新增
- 模型工具 5 个:
memory_write、memory_recall、memory_forget、memory_consolidate、memory_review - 斜杠命令 3 个:
/memory-list、/memory-review、/memory-consolidate - 遗忘曲线:记忆强度随时间按负加速曲线衰减
- 六维重要性评分:有意义 / 有结构 / 具体 / 自我相关 / 独特 / 有情绪,外加「记忆时长」因子
- 间隔重复与间隔效应:同一事件间隔越久再次被提起,加深越多
- 巩固:把高价值情节记忆合并提炼成语义记忆,原文归档
- 主动复习:列出临近遗忘的记忆
- 纯本地存储:所有记忆存在单个 JSON 文件,不联网、不依赖云端数据库
- 纯 ESM JavaScript,无构建步骤
版本行为说明(重要)
当前版本没有自动抓取对话的机制。记忆只在模型调用 memory_write 时产生。
- 你说「记住:…」是最强的触发信号,模型几乎一定会写。
- 即使不说,模型看到工具描述里写着「重要信息应主动调用」,可能会自己判断写入——但不保证、不可控。
换句话说,本版本提供的是「记忆的存储、衰减与检索模型」,并不负责自动记录每一次对话;「记住什么」的主动权在模型手上。
已知限制
- 语义相关度使用字符 n-gram 相似度,尚未接入 embedding(向量)模型
- 巩固的合并是规则式的(拼接 + 去重),尚未接入 LLM 做摘要提炼
- 自动复习的触发方式尚未定案
安装
git clone https://github.com/Azurimson/dsh-plugin.git
cd dsh-plugin
dsh plugin --profile <你的 profile> add ./dsh-human-memory完整说明见 dsh-human-memory/README.md。