@a9i5k4/dsh-auto-memory 0.1.25 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +266 -234
- package/README.zh-CN.md +264 -232
- package/lib/client.js +56 -1
- package/lib/index.js +234 -24
- package/package.json +1 -1
package/README.zh-CN.md
CHANGED
|
@@ -1,232 +1,264 @@
|
|
|
1
|
-
# dsh-auto-memory — DSH
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<img width="820" alt="dsh-auto-memory 宣传图" src="docs/banner.jpg">
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
DSH Web GUI
|
|
8
|
-
|
|
9
|
-
> **快速安装**:`cd ~/.dsh/profiles/web` → `pnpm add @a9i5k4/dsh-auto-memory` → 在该目录 `package.json` 的 `dsh.profile.bundles` 里追加 `"@a9i5k4/dsh-auto-memory"` → 重启 **dsh web**(侧边栏出现「记忆」入口)。完整步骤见 [安装](#安装npm-一键);没有 pnpm 可用 `npm install @a9i5k4/dsh-auto-memory`。
|
|
10
|
-
|
|
11
|
-
[English](README.md) | [中文版](README.zh-CN.md)
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## 安装(NPM 一键)
|
|
16
|
-
|
|
17
|
-
> 前提:已安装 DeepSeek Harness(dsh)并至少启动过一次 `dsh web`。
|
|
18
|
-
|
|
19
|
-
在 **profile 目录**(`~/.dsh/profiles/web`)下执行:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
cd ~/.dsh/profiles/web
|
|
23
|
-
pnpm add @a9i5k4/dsh-auto-memory
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
然后编辑该目录下的 `package.json`,在 `dsh.profile.bundles` 数组里追加:
|
|
27
|
-
|
|
28
|
-
```json
|
|
29
|
-
"@a9i5k4/dsh-auto-memory"
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
保存后**重启 dsh web**,插件即生效(侧边栏出现「记忆」入口)。
|
|
33
|
-
|
|
34
|
-
> 没有 pnpm?用 npm 也行:`npm install @a9i5k4/dsh-auto-memory`
|
|
35
|
-
|
|
36
|
-
## 更新(检查与升级)
|
|
37
|
-
|
|
38
|
-
插件就是普通的 npm 包,更新同样是在 profile 目录里一条命令:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
cd ~/.dsh/profiles/web
|
|
42
|
-
pnpm up @a9i5k4/dsh-auto-memory # 或: npm install @a9i5k4/dsh-auto-memory@latest
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
然后**重启 dsh web** 生效。
|
|
46
|
-
|
|
47
|
-
设置 → 自动记忆 页面有「检查更新」按钮,会拿你当前安装的版本和 npm registry 上的最新版对比(有新版时直接显示更新命令)。
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## AI 时代安装(把这句话直接丢给 AI)
|
|
52
|
-
|
|
53
|
-
> 现在是 AI 时代,你可以直接把下面这句话复制给你的 AI 助手(DeepSeek / Claude / Codex 等),它会帮你完成安装:
|
|
54
|
-
|
|
55
|
-
```text
|
|
56
|
-
请在 DeepSeek Harness 的 web profile 目录 ~/.dsh/profiles/web 下安装 npm 包
|
|
57
|
-
@a9i5k4/dsh-auto-memory(执行 pnpm add @a9i5k4/dsh-auto-memory 或 npm install),
|
|
58
|
-
然后在 package.json 的 dsh.profile.bundles 数组追加 "@a9i5k4/dsh-auto-memory",
|
|
59
|
-
最后重启 dsh web 使插件生效。
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
##
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
|
|
125
|
-
###
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
-
|
|
223
|
-
-
|
|
224
|
-
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
-
|
|
231
|
-
-
|
|
232
|
-
|
|
1
|
+
# dsh-auto-memory — DSH 自动记忆与人性化交互插件
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img width="820" alt="dsh-auto-memory 宣传图" src="docs/banner.jpg">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
DSH Web GUI 的缓存友好三层记忆引擎:精简自动注入、每轮 AI 自动沉淀、按需读取与跨工具记忆继承——并点缀以人性化细节:主动日历提醒、暖心 AI 问候、自己会写的每日日志。
|
|
8
|
+
|
|
9
|
+
> **快速安装**:`cd ~/.dsh/profiles/web` → `pnpm add @a9i5k4/dsh-auto-memory` → 在该目录 `package.json` 的 `dsh.profile.bundles` 里追加 `"@a9i5k4/dsh-auto-memory"` → 重启 **dsh web**(侧边栏出现「记忆」入口)。完整步骤见 [安装](#安装npm-一键);没有 pnpm 可用 `npm install @a9i5k4/dsh-auto-memory`。
|
|
10
|
+
|
|
11
|
+
[English](README.md) | [中文版](README.zh-CN.md)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 安装(NPM 一键)
|
|
16
|
+
|
|
17
|
+
> 前提:已安装 DeepSeek Harness(dsh)并至少启动过一次 `dsh web`。
|
|
18
|
+
|
|
19
|
+
在 **profile 目录**(`~/.dsh/profiles/web`)下执行:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
cd ~/.dsh/profiles/web
|
|
23
|
+
pnpm add @a9i5k4/dsh-auto-memory
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
然后编辑该目录下的 `package.json`,在 `dsh.profile.bundles` 数组里追加:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
"@a9i5k4/dsh-auto-memory"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
保存后**重启 dsh web**,插件即生效(侧边栏出现「记忆」入口)。
|
|
33
|
+
|
|
34
|
+
> 没有 pnpm?用 npm 也行:`npm install @a9i5k4/dsh-auto-memory`
|
|
35
|
+
|
|
36
|
+
## 更新(检查与升级)
|
|
37
|
+
|
|
38
|
+
插件就是普通的 npm 包,更新同样是在 profile 目录里一条命令:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
cd ~/.dsh/profiles/web
|
|
42
|
+
pnpm up @a9i5k4/dsh-auto-memory # 或: npm install @a9i5k4/dsh-auto-memory@latest
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
然后**重启 dsh web** 生效。
|
|
46
|
+
|
|
47
|
+
设置 → 自动记忆 页面有「检查更新」按钮,会拿你当前安装的版本和 npm registry 上的最新版对比(有新版时直接显示更新命令)。
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## AI 时代安装(把这句话直接丢给 AI)
|
|
52
|
+
|
|
53
|
+
> 现在是 AI 时代,你可以直接把下面这句话复制给你的 AI 助手(DeepSeek / Claude / Codex 等),它会帮你完成安装:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
请在 DeepSeek Harness 的 web profile 目录 ~/.dsh/profiles/web 下安装 npm 包
|
|
57
|
+
@a9i5k4/dsh-auto-memory(执行 pnpm add @a9i5k4/dsh-auto-memory 或 npm install),
|
|
58
|
+
然后在 package.json 的 dsh.profile.bundles 数组追加 "@a9i5k4/dsh-auto-memory",
|
|
59
|
+
最后重启 dsh web 使插件生效。
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 主动懂你的伙伴
|
|
65
|
+
|
|
66
|
+
自动记忆想让你感觉:它不像一个数据库,而像一个了解你的助手——
|
|
67
|
+
|
|
68
|
+
- **主动提醒** — AI 在对话里发现 deadline、约定或承诺时,自动写进日历,并在之后的会话中赶在时间到达前提醒你(`calendar_add` / `calendar_done` / `calendar_remove`)。
|
|
69
|
+
- **暖心问候** — 每个时段(早上 / 下午 / 晚上)都有 AI 写的问候,还会提起你今天最重要的工作;离开超过一小时回来,它会说「欢迎回来」并帮你补上这段时间发生了什么。
|
|
70
|
+
- **它自己写日志** — 每轮对话结束,一个小型子代理悄悄判断什么值得记,按主题把条目追加进今日日志;长期决策升格到项目笔记、跨项目规则升格到用户级记忆。你永远不用记得去记录。
|
|
71
|
+
- **每日反思** — 结构化记录成果 / 教训 / 下一步,想回顾时可以看看一天到底过得怎么样。
|
|
72
|
+
- **有人情味的日历** — 紧急程度用语义色区分,07:00-22:00 当天时间轴,支持地点与提醒字段;AI 从上下文帮你维护,而不是让你去填表单。
|
|
73
|
+
- **记忆继承** — WorkBuddy / CodeBuddy / Claude Code / Codex 里积累的记忆可被发现并导入,插件接着你其他 AI 工具留下的进度继续。
|
|
74
|
+
|
|
75
|
+
### 底层工程 — 技术默默服务,不打扰你
|
|
76
|
+
|
|
77
|
+
- **前缀缓存友好** — 静态规则在系统提示词里保持字节级稳定,动态记忆走运行时快照,DeepSeek 前缀缓存持续命中(不会反复重编码你的全部历史)。
|
|
78
|
+
- **注入精简、token 成本低** — 只注入最近 1 天日志 + 反思精华,其余通过 `memory_read` / `memory_recall` 按需读取。
|
|
79
|
+
- **AI 调用限频** — 自动沉淀每天最多 8 次、间隔可配置(非工作时间自动翻倍),记忆有用又不烧预算。
|
|
80
|
+
- **凭据不进 prompt** — 敏感段落(令牌 / 密钥 / 凭据)从注入中过滤,文件里安全保留。
|
|
81
|
+
- **跨工作区与跨工具** — 集中式存储任何会话可读;WorkBuddy / CodeBuddy / Claude Code / Codex 的记忆可发现并导入。
|
|
82
|
+
|
|
83
|
+
## 功能
|
|
84
|
+
|
|
85
|
+
### 三层记忆
|
|
86
|
+
|
|
87
|
+
| 层 | 位置 | 说明 |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| 用户级记忆 | `~/.dsh/memory/MEMORY.md` | 跨项目规则/偏好(用户明确要求时写) |
|
|
90
|
+
| 项目笔记 | `~/.dsh/memory/workspaces/{工作区}/MEMORY.md` | 项目长期约定、决策、架构要点(集中式) |
|
|
91
|
+
| 每日日志 | `~/.dsh/memory/workspaces/{工作区}/YYYY-MM-DD.md` | append-only 工作日志(集中式) |
|
|
92
|
+
| 反思 | `~/.dsh/memory/workspaces/{工作区}/reflections/YYYY-MM-DD.md` | 每日反思(后台结构化积累) |
|
|
93
|
+
|
|
94
|
+
> **集中式存储(WorkBuddy 式)**:所有工作区的记忆统一存放在一个根目录 `~/.dsh/memory/workspaces/` 下,每工作区一个子目录——任何模型、任何会话都能通过注入 + 跨工作区 `memory_recall` 读取。旧版分散在各工作区 `.dsh-memory/` 的记忆会在升级后首次运行时自动迁移(旧副本保留不删)。
|
|
95
|
+
|
|
96
|
+
- **自动注入(放在系统提示词末尾)**:每次组装系统提示词时注入 `<memory_system>` 块(用户规则 + 项目笔记 + 反思精华 + 最近 1 天日志尾部 + 外部记忆路径 + 未完成日历事项 + 写入纪律),并置于提示词**最末尾**——模型在回复前最后读到记忆纪律,遵循度更高
|
|
97
|
+
- **注入精简、细节按需(v0.1.24)**:注入保持轻量——只含最近 1 天日志、反思「成果回顾」精华、外部记忆绝对路径(不再整段注入);需要完整日志/反思/记忆文件时用 `memory_read` 工具按需读取;**敏感段落(凭据/令牌/密钥)从注入中过滤**(文件保留,不进 prompt)
|
|
98
|
+
- **记忆操作可见**:更新/检索记忆时,AI 会在对话正文中明文说明(如"已把 X 记入今日日志""我查了记忆,发现…"),不藏在工具调用里
|
|
99
|
+
|
|
100
|
+
### 每轮自动沉淀 — 记忆自己写自己(v0.1.9)
|
|
101
|
+
|
|
102
|
+
每轮对话结束时自动评估本轮内容(经小型 subagent 判断+提炼),值得记的自动写入,无需你手动调 memory_log,也不依赖模型记得写:
|
|
103
|
+
|
|
104
|
+
- **今日日志**自动追加 `- 21:03 [自动沉淀] …` 条目
|
|
105
|
+
- **长期价值自动升格**:项目决策/架构 → 项目笔记(带 `## YYYY-MM-DD` 日期标题);跨项目规则 → 用户级记忆
|
|
106
|
+
- **寒暄轮自动跳过**(内容门槛 `autoConsolidateMinChars`);按 turn 去重,每轮只写一次;子代理轮次不参与
|
|
107
|
+
- **GUI 有 Agent 参与痕迹**:概览页显示"今日已自动沉淀 N 条要点(最近 HH:MM)";面板打开即刷新、打开期间每 30 秒自动重拉、⟳ 按钮手动刷新
|
|
108
|
+
- **`memory_consolidate` 工具**:AI 读最近日志发散提炼,把有长期价值的决策/架构/用户偏好固化进 MEMORY.md("做梦式"固化)
|
|
109
|
+
- 可在 `~/.dsh/dsh-auto-memory.json` 配置:`autoConsolidate`(默认开)、`autoConsolidateMinChars`(默认 240)、`autoConsolidateCooldownMinutes`(默认 30,22:00-08:00 自动翻倍)、`autoConsolidateDailyMax`(默认 8)——全部可在设置页「自动化」分组调整
|
|
110
|
+
|
|
111
|
+
### AI 时段问候与三级抽屉(概览页,v0.1.9)
|
|
112
|
+
|
|
113
|
+
打开记忆面板第一眼看到的是 **AI 生成**的生活化问候,不是模板、不是严肃的技术信息:
|
|
114
|
+
|
|
115
|
+
- **AI 写问候**:subagent 按当前时段(早上/上午/中午/下午/晚上)写一句温暖随口的问候,自然提起今天最重要的 1-2 件工作;每天每时段生成一次并缓存到 `.dsh-memory/greetings/`,不重复消耗 API
|
|
116
|
+
- **抽屉标题就是 AI 总结**:"今日下午 / 今日晚上" 的大窗口标题替换为 AI 总结的原文(如"下午这段你干得真不少呢,最能看到成果的就是 dsh-auto-memory 这一条线…")
|
|
117
|
+
- **三级抽屉结构**:
|
|
118
|
+
- 第一层:时段抽屉,标题即 AI 总结
|
|
119
|
+
- 第二层:拉开后是若干小抽屉——AI 归纳的每项工作(带细点数)
|
|
120
|
+
- 第三层:展开某项工作,阅读其细点
|
|
121
|
+
- **总结有缓存**:结构化结果存 `.dsh-memory/summaries/`;打开面板读缓存(离线可看、不重复生成);⟳ 刷新键或暂离超 1 小时回来才强制重新生成;每份总结显示生成时间
|
|
122
|
+
- **智能时机**:离开超过 1 小时(下班/暂离)再打开,自动显示"欢迎回来"并列出期间的完成事项
|
|
123
|
+
- **每日反思**:后台保留结构化反思(成果/教训/要点),前台只有轻松问候
|
|
124
|
+
|
|
125
|
+
### 智能检索(检索页,v0.1.9)
|
|
126
|
+
|
|
127
|
+
检索页在「检索」旁新增「**智能检索**」按钮:
|
|
128
|
+
|
|
129
|
+
- AI 把你的自然语言查询扩散成 3-6 个关键词(如"上次发布 npm 踩的坑" → 发布 / 踩坑 / GitHub / npm / 推送)
|
|
130
|
+
- 用这些关键词扫描三层记忆 + 反思
|
|
131
|
+
- AI 再**综合成一段自然语言回答**,注明每条信息来自哪份记忆(日志日期/项目笔记/用户级),**绝不编造记忆里没有的事实**
|
|
132
|
+
- 回答下方列出关键词与原始命中明细(来源 + 原文)
|
|
133
|
+
|
|
134
|
+
### 日历视图(四象限)
|
|
135
|
+
|
|
136
|
+
「日历」页签(液态玻璃风格月视图):
|
|
137
|
+
|
|
138
|
+
- 月视图网格,今日高亮,点击任意日期添加事项
|
|
139
|
+
- **四象限色标**:重要紧急(红)/ 重要不紧急(蓝)/ 紧急不重要(橙)/ 不重要不紧急(灰)
|
|
140
|
+
- 点条目切换完成状态,再点删除;图例 + 星期头
|
|
141
|
+
- **跨对话持久**:数据存用户级 `~/.dsh/memory/CALENDAR.md`,所有工作区共享,重装 DSH 不丢
|
|
142
|
+
- **AI 主动维护**:AI 会从对话中提取 deadline、约定时间等自动写入日历(`calendar_add` / `calendar_list` / `calendar_done` / `calendar_remove`),并在正文转述;未完成事项注入每次会话的系统提示词
|
|
143
|
+
|
|
144
|
+
### Agent 工具
|
|
145
|
+
|
|
146
|
+
`memory_log` / `memory_note` / `memory_user` / `memory_recall` / `memory_external` / `memory_maintain` / `memory_status` / `memory_reflect` / `memory_consolidate` / `calendar_add` / `calendar_list` / `calendar_done` / `calendar_remove`
|
|
147
|
+
|
|
148
|
+
### 界面
|
|
149
|
+
|
|
150
|
+
- 侧边栏「记忆」入口 → 浮层面板(概览/日志/笔记/反思/接续/日历/检索)
|
|
151
|
+
- 设置页(设置 → 自动记忆):存储位置、注入预算、反思风格、界面语言(中文 / English)、**界面字号(小/标准/大/特大,默认大)**——切换立即生效,无需保存
|
|
152
|
+
- **外部记忆继承**:接入其他 AI 工具(CodeBuddy / Claude Code / Codex / 项目约定文件)积累的记忆
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## 界面截图
|
|
157
|
+
|
|
158
|
+
以下都是插件在 DSH Web GUI 中的真实运行截图(当前为中文界面;英文界面截图稍后补充)。
|
|
159
|
+
|
|
160
|
+
### 记忆面板概览 — 暂离问候、AI 总结等
|
|
161
|
+
|
|
162
|
+
<img width="480" alt="记忆面板概览" src="docs/screenshots/overview-zh.png">
|
|
163
|
+
|
|
164
|
+
### 接续 — 从其他 AI Agent 提取全局记忆与历史会话
|
|
165
|
+
|
|
166
|
+
<img width="480" alt="接续页签" src="docs/screenshots/connect-zh.png">
|
|
167
|
+
|
|
168
|
+
### 日历 — AI 根据上下文自动添加事项、切换状态、标记完成
|
|
169
|
+
|
|
170
|
+
<img width="480" alt="日历页签" src="docs/screenshots/calendar-zh.png">
|
|
171
|
+
|
|
172
|
+
### 工作区导图 — 自动生成的以工作区为中心的跨工作区记忆导图
|
|
173
|
+
|
|
174
|
+
<img width="480" alt="工作区记忆导图" src="docs/screenshots/workspace-map-zh.png">
|
|
175
|
+
|
|
176
|
+
### 设置 — 高度自定义,可操作绝大部分技术细节
|
|
177
|
+
|
|
178
|
+
<img width="480" alt="自动记忆设置" src="docs/screenshots/settings-zh.png">
|
|
179
|
+
<img width="480" alt="自动记忆设置(续)" src="docs/screenshots/settings-2-zh.png">
|
|
180
|
+
|
|
181
|
+
## 截图之外
|
|
182
|
+
|
|
183
|
+
- **每轮自动沉淀**:每轮对话结束由小代理自动评估,按主题分组写进今日日志(`## 主题(HH:MM)` + 要点列表)——常规工作不需要手动 memory_log。有长期价值的内容自动升格项目笔记 / 用户级记忆;寒暄轮跳过;AI 失败入队,每 5 分钟重试(15 秒心跳文件证明轮询存活)。
|
|
184
|
+
- **智能检索**:自然语言提问,AI 扩成关键词扫描全部记忆层,再综合成带出处的自然语言回答。
|
|
185
|
+
- **日历与当天时间轴(v0.1.24)**:点击日期打开 07:00-22:00 时间轴,事件按时间槽落位;支持地点/提醒/补充说明;AI 主动提取 deadline 用 `calendar_add` 写入、`calendar_done`/`calendar_remove` 维护。
|
|
186
|
+
- **工作区思维导图(v0.1.24)**:AI 生成工作区/主题/跨工作区关联图,支持拖动画布、滑块缩放、点击卡片看摘要。
|
|
187
|
+
- **记忆面板 UI(v0.1.24)**:液态玻璃面板 + 全站丝滑动效——模块箭头滚动条、抽屉展开/收起过渡、设置页浮动保存栏(未保存高亮)。
|
|
188
|
+
- **外部记忆管理(v0.1.24)**:按来源查看/接入/移除——已接入显示 ✓、按目标(笔记/用户级)独立删除;内容按需读取,不再整段注入。
|
|
189
|
+
- **日历提醒**:未完成事项注入之后每次会话的系统提示词——AI 不用你提醒就会主动提及。
|
|
190
|
+
- **一键更新**:设置页对比本地版本与 npm registry 最新版;registry 安装的用户可直接「一键更新」(后台自动跑 pnpm/npm),重启后生效。
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 配置
|
|
195
|
+
|
|
196
|
+
默认值(JSON 文件 `~/.dsh/dsh-auto-memory.json`):
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"userMemoryDir": "~/.dsh/memory",
|
|
201
|
+
"projectMemoryDir": ".dsh-memory",
|
|
202
|
+
"injectEnabled": true,
|
|
203
|
+
"injectBudgetChars": 2400,
|
|
204
|
+
"recentDaysInjected": 1,
|
|
205
|
+
"reflectEnabled": true,
|
|
206
|
+
"reflectStyle": "auto",
|
|
207
|
+
"locale": "zh",
|
|
208
|
+
"autoConsolidate": true,
|
|
209
|
+
"autoConsolidateMinChars": 240,
|
|
210
|
+
"autoConsolidateCooldownMinutes": 30,
|
|
211
|
+
"autoConsolidateDailyMax": 8,
|
|
212
|
+
"externalInjectionChars": 1400,
|
|
213
|
+
"memoryRoot": "~/.dsh/memory/workspaces",
|
|
214
|
+
"dayBoundaryMinutes": 450
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
可在 GUI(设置 → 自动记忆)中调整,包括界面语言(zh / en)、界面字号与日界。
|
|
219
|
+
|
|
220
|
+
### v0.1.27 基础加固(记忆卫生闸门 — 防外部脏内容污染)
|
|
221
|
+
|
|
222
|
+
- **三个写入工具接入写闸门**:`memory_log_dev` / `memory_note_dev` / `memory_user_dev` 写入前先过 `sanitizeForWrite`——疑似乱码(GBK 错误编码往返产物)、复读退化(单词/单字循环,标点分隔也识别)、连续重复行(≥3)一律拒绝并回执原因;追加(append)单条上限 8000 字、整篇重写(replace)上限 20 万字;追加时与文件尾部近 60 行做复读去重(日志行的 `- HH:MM` 前缀不影响判定)。
|
|
223
|
+
- **卫生函数族修复**:乱码特征表移除 `进行中` 假阳性(补真实乱码形态 `杩涜涓`)、乱码计数改为全局匹配(此前永远只计 1 处,长文本脏内容可绕过阈值)、复读检测支持标点分隔、重复行检测由空行打断(避免误伤隔段相同的短行)。
|
|
224
|
+
- **外部记忆纯链接导入**:`memory_external_dev` 的 import 只落源文件路径指针,不再整段写入内容——防止其他 AI 工具(WorkBuddy/CodeBuddy/Claude Code/Codex)记忆中的脏内容经导入混入本地记忆。
|
|
225
|
+
- **注入端清洗与语体纪律**:注入前自动剔除乱码行/代码块/复读行;注入块新增「记忆定位—读法」说明与语体纪律——写记忆一律第三人称客观陈述,禁止第一人称思考腔与过程复述。
|
|
226
|
+
|
|
227
|
+
### v0.1.28 脏 token 检查器(prion-scan 整合 — 根治「模型无故降级」这一类问题)
|
|
228
|
+
|
|
229
|
+
- **写入闸门新增 raw JSON envelope 与 base64 残骸拒写**:在乱码/复读/重复行之外,闸门还拒绝命中外部 AI 工具画像 JSON 签名(`memoryBlock` / `"uid":` / `updatedAt` / `"role":"... "`)与 base64 残骸行——外部画像再也无法整段混入本地记忆。
|
|
230
|
+
- **乱码特征表补全至 34 项(与 prion-scan.mjs 逐字一致)**:覆盖 GBK 错误编码往返的全部真实残骸形态,能精确抓到这一类「垃圾 token」。
|
|
231
|
+
- **新增「扫描脏 token」(设置页 → 调试中心)**:一键 prion 式扫描用户级记忆 / 项目笔记 / 今日日志 / 反思——按文件、按行区间返回 mojibake / raw JSON envelope / 超长行 >500 / base64 / 重复内容行、重复 ## 标题报告;**只给位置不含正文**,发现残骸不用读它也能定位。
|
|
232
|
+
|
|
233
|
+
### v0.1.9 加固(预算 / 日界 / 目录选择器)
|
|
234
|
+
|
|
235
|
+
- **每日写入预算 + 超限自动压缩**:用户级记忆 ≤4000 字/天、项目笔记 ≤3000 字/天(所有会话共享一天额度,日界重置)。超限不拒绝写入——框架先把「今天之前」的旧内容交给 AI 压缩(合并重复、删除过期、保留硬信息)腾出空间再写;AI 不可用时把最早段落归档到 `archived-user.md` / `archive/notes-archived.md`,信息不丢。压缩 10 分钟节流。
|
|
236
|
+
- **日界(凌晨的活儿归昨晚)**:`dayBoundaryMinutes`(默认 450 = 早上 7:30)。日界之前的活儿记入前一天日志,前一天的每日反思也要等过了日界才开始——凌晨不再一过午夜就催「昨天干了什么」。
|
|
237
|
+
- **系统原生文件夹选择器**:记忆根目录旁的「浏览…」按钮直接弹系统的文件夹选择器(经 DSH directory-picker 原生后端);无原生选择器时自动回退内嵌浏览。更换根目录时自动把已有工作区记忆迁移到新位置(旧文件保留),所有路径变量在下一次刷新时跟随新配置。
|
|
238
|
+
- **30 天蒸馏**:`memory_maintain` 把 30 天前的旧日志交给 AI 提炼进项目笔记,原文保底归档到 `archive/`,并从活跃日志列表移除。
|
|
239
|
+
- **首轮注入保障**:`pre-step` 钩子在第一步放行前等待记忆状态刷新,模型从第一个 token 起就能看到记忆(此前异步加载可能让首轮注入为空)。
|
|
240
|
+
- **每步带时间戳的提醒**:注入的纪律块携带实时 `HH:MM:SS` 时间戳,每次组装提示词都刷新;另有 15 秒心跳文件证明后台轮询存活。
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## 结构
|
|
245
|
+
|
|
246
|
+
- `lib/index.js` — Host 半:引擎、注入、工具、路由(零运行时依赖,仅 node 内置模块)
|
|
247
|
+
- `lib/client.js` — 浏览器半:记忆面板(含日历视图)+ 设置页(内置中英双语)
|
|
248
|
+
- `cordis.patch.yml` — 插件行(`auto-memory`)
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## 限制
|
|
253
|
+
|
|
254
|
+
- 记忆文件为明文 Markdown;不存密钥,除非用户明确要求。
|
|
255
|
+
- `memory_recall` 的历史会话检索依赖部署的 session-query 索引,未启用时仅本地检索。
|
|
256
|
+
- 插件集变更需重启 dsh 生效。
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## 发布信息
|
|
261
|
+
|
|
262
|
+
- GitHub: https://github.com/Aik358/dsh-auto-memory
|
|
263
|
+
- npm: `@a9i5k4/dsh-auto-memory`
|
|
264
|
+
- License: BSD-3-Clause
|
package/lib/client.js
CHANGED
|
@@ -346,6 +346,32 @@ window.__ModuleLoader__.load({
|
|
|
346
346
|
|
|
347
347
|
// ───────────────────────── 更新弹窗 / 首次指导 ─────────────────────────
|
|
348
348
|
var CHANGELOG = {
|
|
349
|
+
'0.1.28': { zh: [
|
|
350
|
+
'脏 token 检查器(prion-scan 四类启发式整合):mojibake GBK 残骸特征表补全至 34 项(与 prion-scan.mjs 逐字一致),写入闸门新增 raw JSON envelope(memoryBlock/"uid"/updatedAt/"role")与 base64 残骸行拒写——外部 AI 工具画像无法再整段混入。',
|
|
351
|
+
'新增「扫描脏 token」:设置页调试中心一键扫描用户级/项目笔记/每日日志/反思,按行区间返回 mojibake / raw JSON / 超长行 / base64 / 重复块报告(只给位置,不含正文)。',
|
|
352
|
+
], en: [
|
|
353
|
+
'Dirty-token checker (prion-scan heuristics integrated): the GBK mojibake residue table is completed to 34 features (verbatim identical to prion-scan.mjs); the write gate now also rejects raw JSON envelopes (memoryBlock/"uid"/updatedAt/"role") and base64 residue lines — external AI tool profiles can no longer be pasted in wholesale.',
|
|
354
|
+
'New "Scan dirty tokens": one-click scan of user/notes/log/reflection files in Settings → Debug Center, reporting mojibake / raw JSON / long lines / base64 / duplicate blocks by line range (location only, no content).',
|
|
355
|
+
] },
|
|
356
|
+
'0.1.27': { zh: [
|
|
357
|
+
'记忆卫生闸门(写端):memory_log/note/user 三个写入工具先过 sanitizeForWrite——疑似乱码(GBK 错误编码往返)/复读退化(词/字符循环,含跨标点)/连续重复行(≥3)拒绝并中文回执;append 单条上限 8000 字、replace 整篇 20 万字;追加前 tailHas 与文件尾部近 60 行做包含式复读去重。',
|
|
358
|
+
'全写入口审计:唯一漏网=API.note(概览页手动追加)已补同套闸门,回归 42 用例全过。',
|
|
359
|
+
'外部记忆接入只存路径指针,不再复制内容;注入端清洗乱码行/代码块/复读行;注入块加"记忆定位/读法"与语体纪律(条目一律第三人称客观陈述)。',
|
|
360
|
+
], en: [
|
|
361
|
+
'Memory hygiene write gate: the three write tools (log/note/user) run through sanitizeForWrite — suspected mojibake (GBK round-trip), stutter degeneration (including punctuation-separated) and consecutive duplicate lines (≥3) are rejected with a reason; appends cap at 8,000 chars, rewrites at 200,000; appends are deduped against the last ~60 lines (tailHas).',
|
|
362
|
+
'Full write-entry audit: the only leak (API.note manual append) now goes through the same gate; 42 regression cases all pass.',
|
|
363
|
+
'External memory import records only path pointers; injection scrubs mojibake/code-block/stutter lines; the injected block adds "how to read memory" and the voice discipline (entries must be third-person objective statements).',
|
|
364
|
+
] },
|
|
365
|
+
'0.1.20': { zh: [
|
|
366
|
+
'修复:正式发布流程 cordis.patch.yml(loader 入口 id + 包名)转换事故——发布包与开发版 identity 完全隔离,不再互相撞车。',
|
|
367
|
+
], en: [
|
|
368
|
+
'Fix: cordis.patch.yml conversion mishap in the release pipeline (loader entry id + package name) — published package identity is now fully isolated from the dev build.',
|
|
369
|
+
] },
|
|
370
|
+
'0.1.26': { zh: [
|
|
371
|
+
'文档:README 定位改为「技术先行 + 人性化」——intro 强调缓存友好三层记忆引擎,新增「底层工程」章节(前缀缓存友好/注入精简/AI限频/凭据过滤/跨工具),与「主动懂你的伙伴」章节互补。',
|
|
372
|
+
], en: [
|
|
373
|
+
'Docs: README repositioned as tech-first with human touch — intro highlights the cache-friendly three-layer memory engine; a new "Under the hood" section (prefix-cache friendly / lean injection / rate-limited AI / credential filtering / cross-tool) complements the "companion that takes initiative" section.',
|
|
374
|
+
] },
|
|
349
375
|
'0.1.25': { zh: [
|
|
350
376
|
'文档:README 界面截图更新为最新实机截图(记忆面板概览/接续/日历/工作区导图/设置),中英双语说明。',
|
|
351
377
|
], en: [
|
|
@@ -499,6 +525,7 @@ window.__ModuleLoader__.load({
|
|
|
499
525
|
smartRecall: '/api/dsh-auto-memory/smart-recall',
|
|
500
526
|
workspaces: '/api/dsh-auto-memory/workspaces',
|
|
501
527
|
debug: '/api/dsh-auto-memory/debug',
|
|
528
|
+
scanDirty: '/api/dsh-auto-memory/scan-dirty',
|
|
502
529
|
browseDir: '/api/dsh-auto-memory/browse-dir',
|
|
503
530
|
pickDir: '/api/dsh-auto-memory/pick-dir',
|
|
504
531
|
updateCheck: '/api/dsh-auto-memory/update-check',
|
|
@@ -1687,6 +1714,25 @@ window.__ModuleLoader__.load({
|
|
|
1687
1714
|
var busyPair = useState(false)
|
|
1688
1715
|
var busy = busyPair[0]
|
|
1689
1716
|
var setBusy = busyPair[1]
|
|
1717
|
+
var scanPair = useState(null)
|
|
1718
|
+
var scan = scanPair[0]
|
|
1719
|
+
var setScan = scanPair[1]
|
|
1720
|
+
var scanBusyPair = useState(false)
|
|
1721
|
+
var scanBusy = scanBusyPair[0]
|
|
1722
|
+
var setScanBusy = scanBusyPair[1]
|
|
1723
|
+
var scanFiles = scan && scan.files ? scan.files : null
|
|
1724
|
+
var filesTotal = scan && scan.files ? scan.files.length : 0
|
|
1725
|
+
var totalFindings = scan ? (scan.totalFindings || 0) : 0
|
|
1726
|
+
var scanError = scan && scan.error ? scan.error : ''
|
|
1727
|
+
function runScan() {
|
|
1728
|
+
if (scanBusy) return
|
|
1729
|
+
setScanBusy(true)
|
|
1730
|
+
setScan(null)
|
|
1731
|
+
fetch(API.scanDirty).then(function (r) { return r.json() }).then(function (d) {
|
|
1732
|
+
setScan(d || {})
|
|
1733
|
+
setScanBusy(false)
|
|
1734
|
+
}).catch(function (e) { setScan({ error: String(e && e.message || e) }); setScanBusy(false) })
|
|
1735
|
+
}
|
|
1690
1736
|
function refresh() {
|
|
1691
1737
|
if (busy) return
|
|
1692
1738
|
setBusy(true)
|
|
@@ -1732,7 +1778,16 @@ window.__ModuleLoader__.load({
|
|
|
1732
1778
|
kv(t('kvDup'), data.duplicateHeadings + t('kvDupCount'), data.duplicateHeadings > 0),
|
|
1733
1779
|
kv(t('kvMem'), t('kvMemUser') + ' ' + (data.memoryFiles.user.exists ? fmtSize(data.memoryFiles.user.size) : t('kvMemMissing')) + ' · ' + t('kvMemNotes') + ' ' + (data.memoryFiles.notes.exists ? fmtSize(data.memoryFiles.notes.size) : t('kvMemMissing')) + ' · ' + t('kvMemLog') + ' ' + (data.memoryFiles.log.exists ? fmtSize(data.memoryFiles.log.size) : t('kvMemMissing')), !data.memoryFiles.log.exists),
|
|
1734
1780
|
kv(t('kvWs'), currentWs() || t('kvWsUnknown'), false),
|
|
1735
|
-
kv(t('kvApi'), probes ? Object.keys(probes).map(function (k) { return k + '=' + (probes[k].status !== undefined ? probes[k].status : probes[k].error) }).join(' ') : '…', apiBad)
|
|
1781
|
+
kv(t('kvApi'), probes ? Object.keys(probes).map(function (k) { return k + '=' + (probes[k].status !== undefined ? probes[k].status : probes[k].error) }).join(' ') : '…', apiBad),
|
|
1782
|
+
h('div', { 'data-dam-row': '', style: { marginTop: '6px', alignItems: 'flex-start', flexDirection: 'column' } },
|
|
1783
|
+
h('div', { 'data-dam-row': '' },
|
|
1784
|
+
h('button', { 'data-dam-btn': '', title: 'prion-scan 式四类启发式,只报位置不含正文', onClick: runScan, disabled: scanBusy }, scanBusy ? (locale === 'zh' ? '扫描中…' : 'Scanning…') : (locale === 'zh' ? '扫描脏 token' : 'Scan dirty tokens')),
|
|
1785
|
+
h('span', { 'data-dam-hint': '', style: { marginLeft: '8px' } }, scanError ? scanError : (scan === null ? (locale === 'zh' ? '检查用户级/笔记/日志/反思的 mojibake / raw JSON / 超长行 / base64 / 重复块' : 'Check user/notes/log/reflections: mojibake, raw JSON, long lines, base64, duplicates') : (scanFiles && scanFiles.length ? (locale === 'zh' ? '共 ' + filesTotal + ' 个文件,命中 ' + totalFindings + ' 处' : filesTotal + ' files, ' + totalFindings + ' findings') : (locale === 'zh' ? '✓ 未发现脏 token' : '✓ no dirty tokens'))))),
|
|
1786
|
+
scanFiles && scanFiles.length ? scanFiles.map(function (sf) {
|
|
1787
|
+
return h('div', { 'data-dam-row': '', style: { alignItems: 'flex-start', flexDirection: 'column', gap: '2px', marginTop: '4px' } },
|
|
1788
|
+
h('span', { style: { fontWeight: 600, fontSize: 'calc(11px * var(--dam-scale))' } }, sf.name + ' [' + sf.sizeKB + 'KB, ' + sf.lines + ' 行]'),
|
|
1789
|
+
sf.findings.map(function (fd) { return h('div', { 'data-dam-hint': '', style: { whiteSpace: 'pre-wrap' } }, '行 ' + fd.range + ' | ' + fd.type) }))
|
|
1790
|
+
}) : null))
|
|
1736
1791
|
}
|
|
1737
1792
|
|
|
1738
1793
|
// ───────────────────────── 更新弹窗 / 首次指导(毛玻璃) ─────────────────────────
|