Repository navigation
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。