@a9i5k4/dsh-auto-memory 0.1.11 → 0.1.12

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.
Files changed (3) hide show
  1. package/README.md +226 -227
  2. package/README.zh-CN.md +232 -231
  3. package/package.json +4 -1
package/README.md CHANGED
@@ -1,228 +1,227 @@
1
- # dsh-auto-memory — DSH Auto Memory Plugin / DSH 自动记忆插件
2
-
3
- <p align="center">
4
- <img width="820" alt="dsh-auto-memory banner" src="docs/banner.jpg">
5
- </p>
6
-
7
- An auto-memory plugin for the DeepSeek Harness Web GUI: three-layer memory (user-level / project notes / daily logs) with automatic injection and retrieval, daily reflections, AI period greetings with three-level drawers, auto-consolidation after every turn, smart search, a calendar view and settings page, and inheritance of memories from other AI tools.
8
-
9
- DSH Web GUI 的记忆插件:三层记忆自动注入与检索、每日反思、AI 时段问候与三级抽屉、每轮自动沉淀、智能检索、日历视图与设置页,支持继承其他 AI 工具的历史记忆。
10
-
11
- > **Quick install**: `cd ~/.dsh/profiles/web` → `pnpm add @a9i5k4/dsh-auto-memory` → append `"@a9i5k4/dsh-auto-memory"` to `dsh.profile.bundles` in that directory's `package.json` → restart **dsh web** (the 「Memory」entry appears in the sidebar). Full instructions in [Installation](#installation-one-command); no-pnpm alternative: `npm install @a9i5k4/dsh-auto-memory`.
12
-
13
- [**English**](README.md) | [中文版](README.zh-CN.md)
14
-
15
- ---
16
-
17
- ## Features
18
-
19
- ### Three-layer Memory
20
-
21
- | Layer | Location | Description |
22
- |---|---|---|
23
- | User-level memory | `~/.dsh/memory/MEMORY.md` | Cross-project rules & preferences |
24
- | Project notes | `~/.dsh/memory/workspaces/{workspace}/MEMORY.md` | Project conventions & decisions (centralized) |
25
- | Daily logs | `~/.dsh/memory/workspaces/{workspace}/YYYY-MM-DD.md` | Append-only work log (centralized) |
26
- | Reflections | `~/.dsh/memory/workspaces/{workspace}/reflections/YYYY-MM-DD.md` | Daily reflection (structured, kept in background) |
27
-
28
- > **Centralized storage (WorkBuddy-style)**: all workspace memories live under one root — `~/.dsh/memory/workspaces/`, one subdirectory per workspace (readable by any model in any session via injection + cross-workspace `memory_recall`). Legacy per-workspace `.dsh-memory/` folders are auto-migrated on first run after upgrade (the old copies are kept, not deleted).
29
-
30
- - **Auto injection (at the end of the system prompt)**: every prompt gets a `<memory_system>` block (user rules + project notes + recent reflections + recent N days of log tails + pending calendar items + writing discipline); it is placed at the very end of the system prompt so the model reads the memory discipline right before replying
31
- - **Visible memory ops**: when the AI updates or searches memory, it says so in plain text in the chat reply (e.g. "Logged X to today's journal", "I checked memory and found..."), not hidden inside tool calls
32
-
33
- ### Auto-Consolidation — memory writes itself after every turn (v0.1.9)
34
-
35
- Every finished conversation turn is automatically evaluated (via a small subagent) and anything worth keeping is written for you — no reliance on the model remembering to log:
36
-
37
- - **Today's log** gets entries like `- 21:03 [自动沉淀] …` — no manual `memory_log` needed for routine work
38
- - **Long-term value is promoted**: project decisions/architecture → project notes (with a `## YYYY-MM-DD` heading); cross-project rules → user-level memory
39
- - **Small talk is skipped** (content threshold `autoConsolidateMinChars`), each turn is deduplicated by turn number, subagent turns are ignored
40
- - **Agent traces in the GUI**: the overview shows "Auto-consolidated N points today (latest HH:MM)"; the panel refreshes on open, every 30s while open, and via the ⟳ button
41
- - **`memory_consolidate` tool**: read recent logs and distill long-term decisions / architecture / user preferences into MEMORY.md on demand ("dream-like" consolidation)
42
- - Configurable in `~/.dsh/dsh-auto-memory.json`: `autoConsolidate` (default true), `autoConsolidateMinChars` (default 60)
43
-
44
- ### AI Greetings & Three-level Drawers (Overview page, v0.1.9)
45
-
46
- The first thing you see when opening the memory panel is an **AI-generated** period greeting, not a template and not technical info:
47
-
48
- - **AI-written greeting**: a subagent writes a warm, casual greeting for the current period (morning / forenoon / noon / afternoon / evening), mentioning your most important work of the day; generated once per period per day and cached in `.dsh-memory/greetings/` — no repeated API cost
49
- - **Drawer titles are the AI summaries**: the "Today afternoon / Today evening" window titles are replaced with the AI's casual summary text itself
50
- - **Three-level drawer structure**:
51
- - Level 1: period drawer, titled with the AI summary
52
- - Level 2: inside it, small drawers — one per work item the AI distilled (with a point count)
53
- - Level 3: expand a work item to read its detail points
54
- - **Summaries are cached**: structured results live in `.dsh-memory/summaries/`; opening the panel reads the cache (offline-friendly, no regeneration); the ⟳ refresh button or returning after >1h away forces a fresh generation; every summary shows its generation time
55
- - **Smart timing**: if you were away for more than 1 hour and come back, the greeting says "Welcome back" with what was finished meanwhile
56
- - **Daily reflection stays in background**: structured reflections (results / lessons / next steps) are kept, while the front page only shows a light greeting
57
-
58
- ### Smart Search (Search tab, v0.1.9)
59
-
60
- The Search tab adds a **Smart search** button next to the keyword search:
61
-
62
- - The AI expands your natural-language query into 3-6 keywords (e.g. "last time publishing npm hit a snag" → 发布 / 踩坑 / GitHub / npm / 推送)
63
- - Scans all three memory layers plus reflections with those keywords
64
- - The AI then composes a **conversational answer** in natural language, citing where each fact came from (log date / project note / user-level memory) — it never fabricates facts not present in memory
65
- - Raw keyword hits with their sources are listed under the answer
66
-
67
- ### Calendar View (Four Quadrants)
68
-
69
- 「Calendar」tab (liquid-glass monthly view):
70
-
71
- - Monthly grid, today highlighted, click any date to add an item
72
- - **Four-quadrant colors**: Urgent & Important (red) / Important (blue) / Urgent (orange) / Neither (gray)
73
- - Click an item to toggle done, click again to delete; legend + weekday header
74
- - **Cross-conversation persistence**: data lives at user level `~/.dsh/memory/CALENDAR.md`, shared across workspaces, survives DSH reinstall
75
- - **AI-maintained**: the AI extracts deadlines and appointments from conversations and writes them to the calendar automatically (`calendar_add` / `calendar_list` / `calendar_done` / `calendar_remove`), restating it in plain text; pending items are injected into every session's system prompt
76
-
77
- ### Agent Tools
78
-
79
- `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`
80
-
81
- ### UI
82
-
83
- - Sidebar 「Memory」entry → floating panel (Overview / Logs / Notes / Reflections / Connect / Calendar / Search)
84
- - Settings page (Settings → Auto Memory): storage paths, injection budget, reflection style, UI language (中文 / English), **panel font size (Small / Normal / Large / Extra large, default Large)** applies immediately, no save needed
85
- - **External memory inheritance**: import memories accumulated by other AI tools (CodeBuddy / Claude Code / Codex / project convention files)
86
-
87
- ---
88
-
89
- ## Screenshots
90
-
91
- All screenshots below are real captures of the plugin running inside the DSH Web GUI.
92
-
93
- ### Main interface the Auto Memory panel (Connect tab)
94
-
95
- <img width="720" alt="Auto Memory panel in the DSH web UI" src="docs/screenshots/main-connect-en.png">
96
-
97
- ### Connect tab — inherit memories accumulated by other AI tools
98
-
99
- <img width="720" alt="Connect tab" src="docs/screenshots/connect-en.png">
100
-
101
- ### Overview AI-written greeting, today's drawers & cross-workspace summaries
102
-
103
- <img width="720" alt="Overview tab" src="docs/screenshots/overview-en.png">
104
-
105
- ### Calendar AI-maintained four-quadrant schedule
106
-
107
- <img width="720" alt="Calendar tab" src="docs/screenshots/calendar-en.png">
108
-
109
- ### Reflections structured daily reviews
110
-
111
- <img width="720" alt="Reflections tab" src="docs/screenshots/reflections-en.png">
112
-
113
- ### Settings — memory storage, day boundary, daily budget, update check
114
-
115
- <img width="720" alt="Auto Memory settings" src="docs/screenshots/settings-en.png">
116
-
117
- ## Beyond the screenshots
118
-
119
- - **Auto-consolidation**: every finished turn is evaluated by a small subagent and topic-grouped entries are written to today's log automatically (`## 主题(HH:MM)` + bullet points) — no `memory_log` needed for routine work. Long-term value is promoted to project notes / user-level memory, small talk is skipped, failures are queued and retried every 5 minutes (a 15-second heartbeat file proves the loop is alive).
120
- - **Smart search**: ask in natural language — the AI expands your query into keywords, scans every memory layer, then answers conversationally with sources cited.
121
- - **Calendar reminders**: pending items are injected into future sessions' system prompts until completed — the AI reminds you without being asked.
122
- - **One-click update**: the settings page shows your installed version vs. the npm registry latest; registry installs get a one-click update button (pnpm/npm runs under the hood), then restart to apply.
123
-
124
- ---
125
- ## Installation (one command)
126
-
127
- > Prerequisite: install [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) and start `dsh web` at least once.
128
-
129
- Run in the **profile directory** (`~/.dsh/profiles/web`):
130
-
131
- ```bash
132
- cd ~/.dsh/profiles/web
133
- pnpm add @a9i5k4/dsh-auto-memory
134
- ```
135
-
136
- Then edit `package.json` in that directory and append to the `dsh.profile.bundles` array:
137
-
138
- ```json
139
- "@a9i5k4/dsh-auto-memory"
140
- ```
141
-
142
- Restart **dsh web** to activate (the 「Memory」entry appears in the sidebar).
143
-
144
- > No pnpm? Use npm: `npm install @a9i5k4/dsh-auto-memory`
145
-
146
- ## Updating (check & upgrade)
147
-
148
- The plugin is a normal npm package, so updating is one command in the same profile directory:
149
-
150
- ```bash
151
- cd ~/.dsh/profiles/web
152
- pnpm up @a9i5k4/dsh-auto-memory # or: npm install @a9i5k4/dsh-auto-memory@latest
153
- ```
154
-
155
- Then restart **dsh web**.
156
-
157
- The Settings → Auto Memory page has a **Check for updates** button that compares your installed version with the latest one on the npm registry (it shows the update command when a newer version exists).
158
-
159
- ---
160
-
161
- ## AI-Era Installation (copy-paste for your AI)
162
-
163
- > It's the AI era — just copy the sentence below to your AI assistant (DeepSeek / Claude / Codex etc.) and it will do the installation for you.
164
-
165
- ```text
166
- Install the npm package @a9i5k4/dsh-auto-memory in the DeepSeek Harness web profile
167
- directory ~/.dsh/profiles/web (run "pnpm add @a9i5k4/dsh-auto-memory" or "npm install @a9i5k4/dsh-auto-memory"),
168
- append "@a9i5k4/dsh-auto-memory" to the dsh.profile.bundles array in package.json,
169
- then restart dsh web to activate the plugin.
170
- ```
171
-
172
- ---
173
-
174
- ## Configuration
175
-
176
- Defaults (JSON file `~/.dsh/dsh-auto-memory.json`):
177
-
178
- ```json
179
- {
180
- "userMemoryDir": "~/.dsh/memory",
181
- "projectMemoryDir": ".dsh-memory",
182
- "injectEnabled": true,
183
- "injectBudgetChars": 2400,
184
- "recentDaysInjected": 3,
185
- "reflectEnabled": true,
186
- "reflectStyle": "auto",
187
- "locale": "zh",
188
- "autoConsolidate": true,
189
- "autoConsolidateMinChars": 60,
190
- "memoryRoot": "~/.dsh/memory/workspaces",
191
- "dayBoundaryMinutes": 450
192
- }
193
- ```
194
-
195
- Adjustable in the GUI (Settings → Auto Memory), including the UI language (zh / en), the panel font size and the day boundary.
196
-
197
- ### v0.1.9 hardening (budget / boundary / picker)
198
-
199
- - **Daily write budget with auto-compaction**: user memory 4000 chars/day, project notes ≤ 3000 chars/day (shared across sessions, reset at the day boundary). Going over the budget never rejects the write the framework compacts the pre-today sections with an AI pass (merge duplicates, drop stale entries, keep hard facts) and then writes; if AI is unavailable, the oldest sections are archived to `archived-user.md` / `archive/notes-archived.md` (nothing is lost). Compaction is throttled to once per 10 minutes.
200
- - **Day boundary (late-night belongs to yesterday)**: `dayBoundaryMinutes` (default 450 = 07:30). Work logged before the boundary is appended to the previous day's log, and the daily reflection for the previous day starts only after the boundary no more "it's 00:30, tell me what you did yesterday" right after midnight.
201
- - **Native OS folder picker**: the "Browse…" button next to the memory root opens the real system folder picker (via the DSH directory-picker native backend); falls back to the in-app browser when no native picker is available. Changing the root auto-migrates existing workspace memory folders to the new location (old files are kept) and all path variables follow the new config on the next refresh.
202
- - **30-day distillation**: `memory_maintain` distills logs older than 30 days with an AI pass into the project notes, archives the originals under `archive/`, and removes them from the active log list.
203
- - **First-turn injection guarantee**: a `pre-step` hook awaits the memory state refresh before the first step, so the model sees memory from the very first token (previously the async load could leave the first turn empty).
204
- - **Per-step reminder with timestamp**: the injected discipline block carries a live `HH:MM:SS` timestamp that refreshes on every prompt assembly, and a 15-second heartbeat file proves the background loop is alive.
205
-
206
- ---
207
-
208
- ## Structure
209
-
210
- - `lib/index.js` — Host half: engine, injection, tools, routes (zero runtime deps, Node built-ins only)
211
- - `lib/client.js` — Browser half: memory panel (with calendar view) + settings page (built-in zh/en i18n)
212
- - `cordis.patch.yml` — Plugin row (`auto-memory`)
213
-
214
- ---
215
-
216
- ## Limitations
217
-
218
- - Memory files are plain-text Markdown; no secrets stored unless explicitly requested.
219
- - `memory_recall` session search depends on the deployed session-query index; without it, only local search works.
220
- - Plugin-set changes require a dsh restart.
221
-
222
- ---
223
-
224
- ## Release Info
225
-
226
- - GitHub: https://github.com/Aik358/dsh-auto-memory
227
- - npm: `@a9i5k4/dsh-auto-memory`
1
+ # dsh-auto-memory — DSH Auto Memory Plugin / DSH 自动记忆插件
2
+
3
+ <p align="center">
4
+ <img width="820" alt="dsh-auto-memory banner" src="docs/banner.jpg">
5
+ </p>
6
+
7
+ An auto-memory plugin for the DeepSeek Harness Web GUI: three-layer memory (user-level / project notes / daily logs) with automatic injection and retrieval, daily reflections, AI period greetings with three-level drawers, auto-consolidation after every turn, smart search, a calendar view and settings page, and inheritance of memories from other AI tools.
8
+
9
+ DSH Web GUI 的记忆插件:三层记忆自动注入与检索、每日反思、AI 时段问候与三级抽屉、每轮自动沉淀、智能检索、日历视图与设置页,支持继承其他 AI 工具的历史记忆。
10
+
11
+ > **Quick install**: `cd ~/.dsh/profiles/web` → `pnpm add @a9i5k4/dsh-auto-memory` → append `"@a9i5k4/dsh-auto-memory"` to `dsh.profile.bundles` in that directory's `package.json` → restart **dsh web** (the 「Memory」entry appears in the sidebar). Full instructions in [Installation](#installation-one-command); no-pnpm alternative: `npm install @a9i5k4/dsh-auto-memory`.
12
+
13
+ [**English**](README.md) | [中文版](README.zh-CN.md)
14
+
15
+ ---
16
+
17
+ ## Installation (one command)
18
+
19
+ > Prerequisite: install [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) and start `dsh web` at least once.
20
+
21
+ Run in the **profile directory** (`~/.dsh/profiles/web`):
22
+
23
+ ```bash
24
+ cd ~/.dsh/profiles/web
25
+ pnpm add @a9i5k4/dsh-auto-memory
26
+ ```
27
+
28
+ Then edit `package.json` in that directory and append to the `dsh.profile.bundles` array:
29
+
30
+ ```json
31
+ "@a9i5k4/dsh-auto-memory"
32
+ ```
33
+
34
+ Restart **dsh web** to activate (the 「Memory」entry appears in the sidebar).
35
+
36
+ > No pnpm? Use npm: `npm install @a9i5k4/dsh-auto-memory`
37
+
38
+ ## Updating (check & upgrade)
39
+
40
+ The plugin is a normal npm package, so updating is one command in the same profile directory:
41
+
42
+ ```bash
43
+ cd ~/.dsh/profiles/web
44
+ pnpm up @a9i5k4/dsh-auto-memory # or: npm install @a9i5k4/dsh-auto-memory@latest
45
+ ```
46
+
47
+ Then restart **dsh web**.
48
+
49
+ The Settings Auto Memory page has a **Check for updates** button that compares your installed version with the latest one on the npm registry (it shows the update command when a newer version exists).
50
+
51
+ ## AI-Era Installation (copy-paste for your AI)
52
+
53
+ > It's the AI era just copy the sentence below to your AI assistant (DeepSeek / Claude / Codex etc.) and it will do the installation for you.
54
+
55
+ ```text
56
+ Install the npm package @a9i5k4/dsh-auto-memory in the DeepSeek Harness web profile
57
+ directory ~/.dsh/profiles/web (run "pnpm add @a9i5k4/dsh-auto-memory" or "npm install @a9i5k4/dsh-auto-memory"),
58
+ append "@a9i5k4/dsh-auto-memory" to the dsh.profile.bundles array in package.json,
59
+ then restart dsh web to activate the plugin.
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Features
65
+
66
+ ### Three-layer Memory
67
+
68
+ | Layer | Location | Description |
69
+ |---|---|---|
70
+ | User-level memory | `~/.dsh/memory/MEMORY.md` | Cross-project rules & preferences |
71
+ | Project notes | `~/.dsh/memory/workspaces/{workspace}/MEMORY.md` | Project conventions & decisions (centralized) |
72
+ | Daily logs | `~/.dsh/memory/workspaces/{workspace}/YYYY-MM-DD.md` | Append-only work log (centralized) |
73
+ | Reflections | `~/.dsh/memory/workspaces/{workspace}/reflections/YYYY-MM-DD.md` | Daily reflection (structured, kept in background) |
74
+
75
+ > **Centralized storage (WorkBuddy-style)**: all workspace memories live under one root `~/.dsh/memory/workspaces/`, one subdirectory per workspace (readable by any model in any session via injection + cross-workspace `memory_recall`). Legacy per-workspace `.dsh-memory/` folders are auto-migrated on first run after upgrade (the old copies are kept, not deleted).
76
+
77
+ - **Auto injection (at the end of the system prompt)**: every prompt gets a `<memory_system>` block (user rules + project notes + recent reflections + recent N days of log tails + pending calendar items + writing discipline); it is placed at the very end of the system prompt so the model reads the memory discipline right before replying
78
+ - **Visible memory ops**: when the AI updates or searches memory, it says so in plain text in the chat reply (e.g. "Logged X to today's journal", "I checked memory and found..."), not hidden inside tool calls
79
+
80
+ ### Auto-Consolidation — memory writes itself after every turn (v0.1.9)
81
+
82
+ Every finished conversation turn is automatically evaluated (via a small subagent) and anything worth keeping is written for you — no reliance on the model remembering to log:
83
+
84
+ - **Today's log** gets entries like `- 21:03 [自动沉淀] …` no manual `memory_log` needed for routine work
85
+ - **Long-term value is promoted**: project decisions/architecture project notes (with a `## YYYY-MM-DD` heading); cross-project rules user-level memory
86
+ - **Small talk is skipped** (content threshold `autoConsolidateMinChars`), each turn is deduplicated by turn number, subagent turns are ignored
87
+ - **Agent traces in the GUI**: the overview shows "Auto-consolidated N points today (latest HH:MM)"; the panel refreshes on open, every 30s while open, and via the ⟳ button
88
+ - **`memory_consolidate` tool**: read recent logs and distill long-term decisions / architecture / user preferences into MEMORY.md on demand ("dream-like" consolidation)
89
+ - Configurable in `~/.dsh/dsh-auto-memory.json`: `autoConsolidate` (default true), `autoConsolidateMinChars` (default 60)
90
+
91
+ ### AI Greetings & Three-level Drawers (Overview page, v0.1.9)
92
+
93
+ The first thing you see when opening the memory panel is an **AI-generated** period greeting, not a template and not technical info:
94
+
95
+ - **AI-written greeting**: a subagent writes a warm, casual greeting for the current period (morning / forenoon / noon / afternoon / evening), mentioning your most important work of the day; generated once per period per day and cached in `.dsh-memory/greetings/` — no repeated API cost
96
+ - **Drawer titles are the AI summaries**: the "Today afternoon / Today evening" window titles are replaced with the AI's casual summary text itself
97
+ - **Three-level drawer structure**:
98
+ - Level 1: period drawer, titled with the AI summary
99
+ - Level 2: inside it, small drawers — one per work item the AI distilled (with a point count)
100
+ - Level 3: expand a work item to read its detail points
101
+ - **Summaries are cached**: structured results live in `.dsh-memory/summaries/`; opening the panel reads the cache (offline-friendly, no regeneration); the ⟳ refresh button or returning after >1h away forces a fresh generation; every summary shows its generation time
102
+ - **Smart timing**: if you were away for more than 1 hour and come back, the greeting says "Welcome back" with what was finished meanwhile
103
+ - **Daily reflection stays in background**: structured reflections (results / lessons / next steps) are kept, while the front page only shows a light greeting
104
+
105
+ ### Smart Search (Search tab, v0.1.9)
106
+
107
+ The Search tab adds a **Smart search** button next to the keyword search:
108
+
109
+ - The AI expands your natural-language query into 3-6 keywords (e.g. "last time publishing npm hit a snag" → 发布 / 踩坑 / GitHub / npm / 推送)
110
+ - Scans all three memory layers plus reflections with those keywords
111
+ - The AI then composes a **conversational answer** in natural language, citing where each fact came from (log date / project note / user-level memory) — it never fabricates facts not present in memory
112
+ - Raw keyword hits with their sources are listed under the answer
113
+
114
+ ### Calendar View (Four Quadrants)
115
+
116
+ 「Calendar」tab (liquid-glass monthly view):
117
+
118
+ - Monthly grid, today highlighted, click any date to add an item
119
+ - **Four-quadrant colors**: Urgent & Important (red) / Important (blue) / Urgent (orange) / Neither (gray)
120
+ - Click an item to toggle done, click again to delete; legend + weekday header
121
+ - **Cross-conversation persistence**: data lives at user level `~/.dsh/memory/CALENDAR.md`, shared across workspaces, survives DSH reinstall
122
+ - **AI-maintained**: the AI extracts deadlines and appointments from conversations and writes them to the calendar automatically (`calendar_add` / `calendar_list` / `calendar_done` / `calendar_remove`), restating it in plain text; pending items are injected into every session's system prompt
123
+
124
+ ### Agent Tools
125
+
126
+ `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`
127
+
128
+ ### UI
129
+
130
+ - Sidebar 「Memory」entry → floating panel (Overview / Logs / Notes / Reflections / Connect / Calendar / Search)
131
+ - Settings page (Settings → Auto Memory): storage paths, injection budget, reflection style, UI language (中文 / English), **panel font size (Small / Normal / Large / Extra large, default Large)** — applies immediately, no save needed
132
+ - **External memory inheritance**: import memories accumulated by other AI tools (CodeBuddy / Claude Code / Codex / project convention files)
133
+
134
+ ---
135
+
136
+ ## Screenshots
137
+
138
+ All screenshots below are real captures of the plugin running inside the DSH Web GUI.
139
+
140
+ ### Main interface — the Auto Memory panel (Connect tab)
141
+
142
+ <img width="480" alt="Auto Memory panel in the DSH web UI" src="docs/screenshots/main-connect-en.png">
143
+
144
+ ### Connect tab inherit memories accumulated by other AI tools
145
+
146
+ <img width="480" alt="Connect tab" src="docs/screenshots/connect-en.png">
147
+
148
+ ### Overview AI-written greeting, today's drawers & cross-workspace summaries
149
+
150
+ <img width="480" alt="Overview tab" src="docs/screenshots/overview-en.png">
151
+
152
+ ### Calendar — AI-maintained four-quadrant schedule
153
+
154
+ <img width="480" alt="Calendar tab" src="docs/screenshots/calendar-en.png">
155
+
156
+ ### Reflections — structured daily reviews
157
+
158
+ <img width="480" alt="Reflections tab" src="docs/screenshots/reflections-en.png">
159
+
160
+ ### Settings — memory storage, day boundary, daily budget, update check
161
+
162
+ <img width="480" alt="Auto Memory settings" src="docs/screenshots/settings-en.png">
163
+
164
+ ## Beyond the screenshots
165
+
166
+ - **Auto-consolidation**: every finished turn is evaluated by a small subagent and topic-grouped entries are written to today's log automatically (`## 主题(HH:MM)` + bullet points) — no `memory_log` needed for routine work. Long-term value is promoted to project notes / user-level memory, small talk is skipped, failures are queued and retried every 5 minutes (a 15-second heartbeat file proves the loop is alive).
167
+ - **Smart search**: ask in natural language the AI expands your query into keywords, scans every memory layer, then answers conversationally with sources cited.
168
+ - **Calendar reminders**: pending items are injected into future sessions' system prompts until completed — the AI reminds you without being asked.
169
+ - **One-click update**: the settings page shows your installed version vs. the npm registry latest; registry installs get a one-click update button (pnpm/npm runs under the hood), then restart to apply.
170
+
171
+ ---
172
+
173
+ ## Configuration
174
+
175
+ Defaults (JSON file `~/.dsh/dsh-auto-memory.json`):
176
+
177
+ ```json
178
+ {
179
+ "userMemoryDir": "~/.dsh/memory",
180
+ "projectMemoryDir": ".dsh-memory",
181
+ "injectEnabled": true,
182
+ "injectBudgetChars": 2400,
183
+ "recentDaysInjected": 3,
184
+ "reflectEnabled": true,
185
+ "reflectStyle": "auto",
186
+ "locale": "zh",
187
+ "autoConsolidate": true,
188
+ "autoConsolidateMinChars": 60,
189
+ "memoryRoot": "~/.dsh/memory/workspaces",
190
+ "dayBoundaryMinutes": 450
191
+ }
192
+ ```
193
+
194
+ Adjustable in the GUI (Settings → Auto Memory), including the UI language (zh / en), the panel font size and the day boundary.
195
+
196
+ ### v0.1.9 hardening (budget / boundary / picker)
197
+
198
+ - **Daily write budget with auto-compaction**: user memory ≤ 4000 chars/day, project notes ≤ 3000 chars/day (shared across sessions, reset at the day boundary). Going over the budget never rejects the write — the framework compacts the pre-today sections with an AI pass (merge duplicates, drop stale entries, keep hard facts) and then writes; if AI is unavailable, the oldest sections are archived to `archived-user.md` / `archive/notes-archived.md` (nothing is lost). Compaction is throttled to once per 10 minutes.
199
+ - **Day boundary (late-night belongs to yesterday)**: `dayBoundaryMinutes` (default 450 = 07:30). Work logged before the boundary is appended to the previous day's log, and the daily reflection for the previous day starts only after the boundary no more "it's 00:30, tell me what you did yesterday" right after midnight.
200
+ - **Native OS folder picker**: the "Browse…" button next to the memory root opens the real system folder picker (via the DSH directory-picker native backend); falls back to the in-app browser when no native picker is available. Changing the root auto-migrates existing workspace memory folders to the new location (old files are kept) and all path variables follow the new config on the next refresh.
201
+ - **30-day distillation**: `memory_maintain` distills logs older than 30 days with an AI pass into the project notes, archives the originals under `archive/`, and removes them from the active log list.
202
+ - **First-turn injection guarantee**: a `pre-step` hook awaits the memory state refresh before the first step, so the model sees memory from the very first token (previously the async load could leave the first turn empty).
203
+ - **Per-step reminder with timestamp**: the injected discipline block carries a live `HH:MM:SS` timestamp that refreshes on every prompt assembly, and a 15-second heartbeat file proves the background loop is alive.
204
+
205
+ ---
206
+
207
+ ## Structure
208
+
209
+ - `lib/index.js` — Host half: engine, injection, tools, routes (zero runtime deps, Node built-ins only)
210
+ - `lib/client.js` — Browser half: memory panel (with calendar view) + settings page (built-in zh/en i18n)
211
+ - `cordis.patch.yml` — Plugin row (`auto-memory`)
212
+
213
+ ---
214
+
215
+ ## Limitations
216
+
217
+ - Memory files are plain-text Markdown; no secrets stored unless explicitly requested.
218
+ - `memory_recall` session search depends on the deployed session-query index; without it, only local search works.
219
+ - Plugin-set changes require a dsh restart.
220
+
221
+ ---
222
+
223
+ ## Release Info
224
+
225
+ - GitHub: https://github.com/Aik358/dsh-auto-memory
226
+ - npm: `@a9i5k4/dsh-auto-memory`
228
227
  - License: BSD-3-Clause
package/README.zh-CN.md CHANGED
@@ -1,232 +1,233 @@
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
- ## 功能
16
-
17
- ### 三层记忆
18
-
19
- | | 位置 | 说明 |
20
- |---|---|---|
21
- | 用户级记忆 | `~/.dsh/memory/MEMORY.md` | 跨项目规则/偏好(用户明确要求时写) |
22
- | 项目笔记 | `~/.dsh/memory/workspaces/{工作区}/MEMORY.md` | 项目长期约定、决策、架构要点(集中式) |
23
- | 每日日志 | `~/.dsh/memory/workspaces/{工作区}/YYYY-MM-DD.md` | append-only 工作日志(集中式) |
24
- | 反思 | `~/.dsh/memory/workspaces/{工作区}/reflections/YYYY-MM-DD.md` | 每日反思(后台结构化积累) |
25
-
26
- > **集中式存储(WorkBuddy 式)**:所有工作区的记忆统一存放在一个根目录 `~/.dsh/memory/workspaces/` 下,每工作区一个子目录——任何模型、任何会话都能通过注入 + 跨工作区 `memory_recall` 读取。旧版分散在各工作区 `.dsh-memory/` 的记忆会在升级后首次运行时自动迁移(旧副本保留不删)。
27
-
28
- - **自动注入(放在系统提示词末尾)**:每次组装系统提示词时注入 `<memory_system>` 块(用户规则 + 项目笔记 + 最近反思 + 最近 N 天日志尾部 + 未完成日历事项 + 写入纪律),并置于提示词**最末尾**——模型在回复前最后读到记忆纪律,遵循度更高
29
- - **记忆操作可见**:更新/检索记忆时,AI 会在对话正文中明文说明(如"已把 X 记入今日日志""我查了记忆,发现…"),不藏在工具调用里
30
-
31
- ### 每轮自动沉淀 — 记忆自己写自己(v0.1.9)
32
-
33
- 每轮对话结束时自动评估本轮内容(经小型 subagent 判断+提炼),值得记的自动写入,无需你手动调 memory_log,也不依赖模型记得写:
34
-
35
- - **今日日志**自动追加 `- 21:03 [自动沉淀] …` 条目
36
- - **长期价值自动升格**:项目决策/架构 → 项目笔记(带 `## YYYY-MM-DD` 日期标题);跨项目规则 → 用户级记忆
37
- - **寒暄轮自动跳过**(内容门槛 `autoConsolidateMinChars`);按 turn 去重,每轮只写一次;子代理轮次不参与
38
- - **GUI Agent 参与痕迹**:概览页显示"今日已自动沉淀 N 条要点(最近 HH:MM)";面板打开即刷新、打开期间每 30 秒自动重拉、⟳ 按钮手动刷新
39
- - **`memory_consolidate` 工具**:AI 读最近日志发散提炼,把有长期价值的决策/架构/用户偏好固化进 MEMORY.md("做梦式"固化)
40
- - 可在 `~/.dsh/dsh-auto-memory.json` 配置:`autoConsolidate`(默认开)、`autoConsolidateMinChars`(默认 60)
41
-
42
- ### AI 时段问候与三级抽屉(概览页,v0.1.9)
43
-
44
- 打开记忆面板第一眼看到的是 **AI 生成**的生活化问候,不是模板、不是严肃的技术信息:
45
-
46
- - **AI 写问候**:subagent 按当前时段(早上/上午/中午/下午/晚上)写一句温暖随口的问候,自然提起今天最重要的 1-2 件工作;每天每时段生成一次并缓存到 `.dsh-memory/greetings/`,不重复消耗 API
47
- - **抽屉标题就是 AI 总结**:"今日下午 / 今日晚上" 的大窗口标题替换为 AI 总结的原文(如"下午这段你干得真不少呢,最能看到成果的就是 dsh-auto-memory 这一条线…")
48
- - **三级抽屉结构**:
49
- - 第一层:时段抽屉,标题即 AI 总结
50
- - 第二层:拉开后是若干小抽屉——AI 归纳的每项工作(带细点数)
51
- - 第三层:展开某项工作,阅读其细点
52
- - **总结有缓存**:结构化结果存 `.dsh-memory/summaries/`;打开面板读缓存(离线可看、不重复生成);⟳ 刷新键或暂离超 1 小时回来才强制重新生成;每份总结显示生成时间
53
- - **智能时机**:离开超过 1 小时(下班/暂离)再打开,自动显示"欢迎回来"并列出期间的完成事项
54
- - **每日反思**:后台保留结构化反思(成果/教训/要点),前台只有轻松问候
55
-
56
- ### 智能检索(检索页,v0.1.9)
57
-
58
- 检索页在「检索」旁新增「**智能检索**」按钮:
59
-
60
- - AI 把你的自然语言查询扩散成 3-6 个关键词(如"上次发布 npm 踩的坑" → 发布 / 踩坑 / GitHub / npm / 推送)
61
- - 用这些关键词扫描三层记忆 + 反思
62
- - AI 再**综合成一段自然语言回答**,注明每条信息来自哪份记忆(日志日期/项目笔记/用户级),**绝不编造记忆里没有的事实**
63
- - 回答下方列出关键词与原始命中明细(来源 + 原文)
64
-
65
- ### 日历视图(四象限)
66
-
67
- 「日历」页签(液态玻璃风格月视图):
68
-
69
- - 月视图网格,今日高亮,点击任意日期添加事项
70
- - **四象限色标**:重要紧急(红)/ 重要不紧急(蓝)/ 紧急不重要(橙)/ 不重要不紧急(灰)
71
- - 点条目切换完成状态,再点删除;图例 + 星期头
72
- - **跨对话持久**:数据存用户级 `~/.dsh/memory/CALENDAR.md`,所有工作区共享,重装 DSH 不丢
73
- - **AI 主动维护**:AI 会从对话中提取 deadline、约定时间等自动写入日历(`calendar_add` / `calendar_list` / `calendar_done` / `calendar_remove`),并在正文转述;未完成事项注入每次会话的系统提示词
74
-
75
- ### Agent 工具
76
-
77
- `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`
78
-
79
- ### 界面
80
-
81
- - 侧边栏「记忆」入口 → 浮层面板(概览/日志/笔记/反思/接续/日历/检索)
82
- - 设置页(设置 自动记忆):存储位置、注入预算、反思风格、界面语言(中文 / English)、**界面字号(小/标准/大/特大,默认大)**——切换立即生效,无需保存
83
- - **外部记忆继承**:接入其他 AI 工具(CodeBuddy / Claude Code / Codex / 项目约定文件)积累的记忆
84
-
85
- ---
86
-
87
- ## 界面截图
88
-
89
- 以下都是插件在 DSH Web GUI 中的真实运行截图。
90
-
91
- ### 主界面 — 「自动记忆」浮窗(接续页签)
92
-
93
- <img width="720" alt="自动记忆浮窗" src="docs/screenshots/main-connect-zh.png">
94
-
95
- ### 接续 继承其他 AI 工具积累的记忆
96
-
97
- <img width="720" alt="接续页签" src="docs/screenshots/connect-zh.png">
98
-
99
- ### 概览 — AI 问候语、今日抽屉与跨工作区总结
100
-
101
- <img width="720" alt="概览页签" src="docs/screenshots/overview-zh.png">
102
-
103
- ### 日历 — AI 维护的四象限日程
104
-
105
- <img width="720" alt="日历页签" src="docs/screenshots/calendar-zh.png">
106
-
107
- ### 检索 — 关键词检索与智能检索
108
-
109
- <img width="720" alt="检索页签" src="docs/screenshots/search-zh.png">
110
-
111
- ### 反思(英文界面示例)
112
-
113
- <img width="720" alt="反思页签" src="docs/screenshots/reflections-en.png">
114
-
115
- ### 设置 — 记忆存储、日界、每日预算、更新检查
116
-
117
- <img width="720" alt="自动记忆设置" src="docs/screenshots/settings-zh.png">
118
-
119
- <img width="720" alt="自动记忆设置(调试中心)" src="docs/screenshots/settings-debug-zh.png">
120
-
121
- ## 截图之外
122
-
123
- - **每轮自动沉淀**:每轮对话结束由小代理自动评估,按主题分组写进今日日志(`## 主题(HH:MM)` + 要点列表)——常规工作不需要手动 memory_log。有长期价值的内容自动升格项目笔记 / 用户级记忆;寒暄轮跳过;AI 失败入队,每 5 分钟重试(15 秒心跳文件证明轮询存活)。
124
- - **智能检索**:自然语言提问,AI 扩成关键词扫描全部记忆层,再综合成带出处的自然语言回答。
125
- - **日历提醒**:未完成事项注入之后每次会话的系统提示词——AI 不用你提醒就会主动提及。
126
- - **一键更新**:设置页对比本地版本与 npm registry 最新版;registry 安装的用户可直接「一键更新」(后台自动跑 pnpm/npm),重启后生效。
127
-
128
- ---
129
- ## 安装(NPM 一键)
130
-
131
- > 前提:已安装 DeepSeek Harness(dsh)并至少启动过一次 `dsh web`。
132
-
133
- 在 **profile 目录**(`~/.dsh/profiles/web`)下执行:
134
-
135
- ```bash
136
- cd ~/.dsh/profiles/web
137
- pnpm add @a9i5k4/dsh-auto-memory
138
- ```
139
-
140
- 然后编辑该目录下的 `package.json`,在 `dsh.profile.bundles` 数组里追加:
141
-
142
- ```json
143
- "@a9i5k4/dsh-auto-memory"
144
- ```
145
-
146
- 保存后**重启 dsh web**,插件即生效(侧边栏出现「记忆」入口)。
147
-
148
- > 没有 pnpm?用 npm 也行:`npm install @a9i5k4/dsh-auto-memory`
149
-
150
- ## 更新(检查与升级)
151
-
152
- 插件就是普通的 npm 包,更新同样是在 profile 目录里一条命令:
153
-
154
- ```bash
155
- cd ~/.dsh/profiles/web
156
- pnpm up @a9i5k4/dsh-auto-memory # 或: npm install @a9i5k4/dsh-auto-memory@latest
157
- ```
158
-
159
- 然后**重启 dsh web** 生效。
160
-
161
- 设置 → 自动记忆 页面有「检查更新」按钮,会拿你当前安装的版本和 npm registry 上的最新版对比(有新版时直接显示更新命令)。
162
-
163
- ---
164
-
165
- ## AI 时代安装(把这句话直接丢给 AI)
166
-
167
- > 现在是 AI 时代,你可以直接把下面这句话复制给你的 AI 助手(DeepSeek / Claude / Codex 等),它会帮你完成安装:
168
-
169
- ```text
170
- 请在 DeepSeek Harness 的 web profile 目录 ~/.dsh/profiles/web 下安装 npm 包
171
- @a9i5k4/dsh-auto-memory(执行 pnpm add @a9i5k4/dsh-auto-memory 或 npm install),
172
- 然后在 package.json dsh.profile.bundles 数组追加 "@a9i5k4/dsh-auto-memory",
173
- 最后重启 dsh web 使插件生效。
174
- ```
175
-
176
- ---
177
-
178
- ## 配置
179
-
180
- 默认值(JSON 文件 `~/.dsh/dsh-auto-memory.json`):
181
-
182
- ```json
183
- {
184
- "userMemoryDir": "~/.dsh/memory",
185
- "projectMemoryDir": ".dsh-memory",
186
- "injectEnabled": true,
187
- "injectBudgetChars": 2400,
188
- "recentDaysInjected": 3,
189
- "reflectEnabled": true,
190
- "reflectStyle": "auto",
191
- "locale": "zh",
192
- "autoConsolidate": true,
193
- "autoConsolidateMinChars": 60,
194
- "memoryRoot": "~/.dsh/memory/workspaces",
195
- "dayBoundaryMinutes": 450
196
- }
197
- ```
198
-
199
- 可在 GUI(设置 → 自动记忆)中调整,包括界面语言(zh / en)、界面字号与日界。
200
-
201
- ### v0.1.9 加固(预算 / 日界 / 目录选择器)
202
-
203
- - **每日写入预算 + 超限自动压缩**:用户级记忆 ≤4000 字/天、项目笔记 ≤3000 字/天(所有会话共享一天额度,日界重置)。超限不拒绝写入——框架先把「今天之前」的旧内容交给 AI 压缩(合并重复、删除过期、保留硬信息)腾出空间再写;AI 不可用时把最早段落归档到 `archived-user.md` / `archive/notes-archived.md`,信息不丢。压缩 10 分钟节流。
204
- - **日界(凌晨的活儿归昨晚)**:`dayBoundaryMinutes`(默认 450 = 早上 7:30)。日界之前的活儿记入前一天日志,前一天的每日反思也要等过了日界才开始——凌晨不再一过午夜就催「昨天干了什么」。
205
- - **系统原生文件夹选择器**:记忆根目录旁的「浏览…」按钮直接弹系统的文件夹选择器(经 DSH directory-picker 原生后端);无原生选择器时自动回退内嵌浏览。更换根目录时自动把已有工作区记忆迁移到新位置(旧文件保留),所有路径变量在下一次刷新时跟随新配置。
206
- - **30 天蒸馏**:`memory_maintain` 30 天前的旧日志交给 AI 提炼进项目笔记,原文保底归档到 `archive/`,并从活跃日志列表移除。
207
- - **首轮注入保障**:`pre-step` 钩子在第一步放行前等待记忆状态刷新,模型从第一个 token 起就能看到记忆(此前异步加载可能让首轮注入为空)。
208
- - **每步带时间戳的提醒**:注入的纪律块携带实时 `HH:MM:SS` 时间戳,每次组装提示词都刷新;另有 15 秒心跳文件证明后台轮询存活。
209
-
210
- ---
211
-
212
- ## 结构
213
-
214
- - `lib/index.js` — Host 半:引擎、注入、工具、路由(零运行时依赖,仅 node 内置模块)
215
- - `lib/client.js` — 浏览器半:记忆面板(含日历视图)+ 设置页(内置中英双语)
216
- - `cordis.patch.yml` — 插件行(`auto-memory`)
217
-
218
- ---
219
-
220
- ## 限制
221
-
222
- - 记忆文件为明文 Markdown;不存密钥,除非用户明确要求。
223
- - `memory_recall` 的历史会话检索依赖部署的 session-query 索引,未启用时仅本地检索。
224
- - 插件集变更需重启 dsh 生效。
225
-
226
- ---
227
-
228
- ## 发布信息
229
-
230
- - GitHub: https://github.com/Aik358/dsh-auto-memory
231
- - npm: `@a9i5k4/dsh-auto-memory`
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
+ | 层 | 位置 | 说明 |
69
+ |---|---|---|
70
+ | 用户级记忆 | `~/.dsh/memory/MEMORY.md` | 跨项目规则/偏好(用户明确要求时写) |
71
+ | 项目笔记 | `~/.dsh/memory/workspaces/{工作区}/MEMORY.md` | 项目长期约定、决策、架构要点(集中式) |
72
+ | 每日日志 | `~/.dsh/memory/workspaces/{工作区}/YYYY-MM-DD.md` | append-only 工作日志(集中式) |
73
+ | 反思 | `~/.dsh/memory/workspaces/{工作区}/reflections/YYYY-MM-DD.md` | 每日反思(后台结构化积累) |
74
+
75
+ > **集中式存储(WorkBuddy 式)**:所有工作区的记忆统一存放在一个根目录 `~/.dsh/memory/workspaces/` 下,每工作区一个子目录——任何模型、任何会话都能通过注入 + 跨工作区 `memory_recall` 读取。旧版分散在各工作区 `.dsh-memory/` 的记忆会在升级后首次运行时自动迁移(旧副本保留不删)。
76
+
77
+ - **自动注入(放在系统提示词末尾)**:每次组装系统提示词时注入 `<memory_system>` 块(用户规则 + 项目笔记 + 最近反思 + 最近 N 天日志尾部 + 未完成日历事项 + 写入纪律),并置于提示词**最末尾**——模型在回复前最后读到记忆纪律,遵循度更高
78
+ - **记忆操作可见**:更新/检索记忆时,AI 会在对话正文中明文说明(如"已把 X 记入今日日志""我查了记忆,发现…"),不藏在工具调用里
79
+
80
+ ### 每轮自动沉淀 — 记忆自己写自己(v0.1.9)
81
+
82
+ 每轮对话结束时自动评估本轮内容(经小型 subagent 判断+提炼),值得记的自动写入,无需你手动调 memory_log,也不依赖模型记得写:
83
+
84
+ - **今日日志**自动追加 `- 21:03 [自动沉淀] …` 条目
85
+ - **长期价值自动升格**:项目决策/架构 → 项目笔记(带 `## YYYY-MM-DD` 日期标题);跨项目规则 → 用户级记忆
86
+ - **寒暄轮自动跳过**(内容门槛 `autoConsolidateMinChars`);按 turn 去重,每轮只写一次;子代理轮次不参与
87
+ - **GUI 有 Agent 参与痕迹**:概览页显示"今日已自动沉淀 N 条要点(最近 HH:MM)";面板打开即刷新、打开期间每 30 秒自动重拉、⟳ 按钮手动刷新
88
+ - **`memory_consolidate` 工具**:AI 读最近日志发散提炼,把有长期价值的决策/架构/用户偏好固化进 MEMORY.md("做梦式"固化)
89
+ - 可在 `~/.dsh/dsh-auto-memory.json` 配置:`autoConsolidate`(默认开)、`autoConsolidateMinChars`(默认 60)
90
+
91
+ ### AI 时段问候与三级抽屉(概览页,v0.1.9)
92
+
93
+ 打开记忆面板第一眼看到的是 **AI 生成**的生活化问候,不是模板、不是严肃的技术信息:
94
+
95
+ - **AI 写问候**:subagent 按当前时段(早上/上午/中午/下午/晚上)写一句温暖随口的问候,自然提起今天最重要的 1-2 件工作;每天每时段生成一次并缓存到 `.dsh-memory/greetings/`,不重复消耗 API
96
+ - **抽屉标题就是 AI 总结**:"今日下午 / 今日晚上" 的大窗口标题替换为 AI 总结的原文(如"下午这段你干得真不少呢,最能看到成果的就是 dsh-auto-memory 这一条线…")
97
+ - **三级抽屉结构**:
98
+ - 第一层:时段抽屉,标题即 AI 总结
99
+ - 第二层:拉开后是若干小抽屉——AI 归纳的每项工作(带细点数)
100
+ - 第三层:展开某项工作,阅读其细点
101
+ - **总结有缓存**:结构化结果存 `.dsh-memory/summaries/`;打开面板读缓存(离线可看、不重复生成);⟳ 刷新键或暂离超 1 小时回来才强制重新生成;每份总结显示生成时间
102
+ - **智能时机**:离开超过 1 小时(下班/暂离)再打开,自动显示"欢迎回来"并列出期间的完成事项
103
+ - **每日反思**:后台保留结构化反思(成果/教训/要点),前台只有轻松问候
104
+
105
+ ### 智能检索(检索页,v0.1.9)
106
+
107
+ 检索页在「检索」旁新增「**智能检索**」按钮:
108
+
109
+ - AI 把你的自然语言查询扩散成 3-6 个关键词(如"上次发布 npm 踩的坑" → 发布 / 踩坑 / GitHub / npm / 推送)
110
+ - 用这些关键词扫描三层记忆 + 反思
111
+ - AI 再**综合成一段自然语言回答**,注明每条信息来自哪份记忆(日志日期/项目笔记/用户级),**绝不编造记忆里没有的事实**
112
+ - 回答下方列出关键词与原始命中明细(来源 + 原文)
113
+
114
+ ### 日历视图(四象限)
115
+
116
+ 「日历」页签(液态玻璃风格月视图):
117
+
118
+ - 月视图网格,今日高亮,点击任意日期添加事项
119
+ - **四象限色标**:重要紧急(红)/ 重要不紧急(蓝)/ 紧急不重要(橙)/ 不重要不紧急(灰)
120
+ - 点条目切换完成状态,再点删除;图例 + 星期头
121
+ - **跨对话持久**:数据存用户级 `~/.dsh/memory/CALENDAR.md`,所有工作区共享,重装 DSH 不丢
122
+ - **AI 主动维护**:AI 会从对话中提取 deadline、约定时间等自动写入日历(`calendar_add` / `calendar_list` / `calendar_done` / `calendar_remove`),并在正文转述;未完成事项注入每次会话的系统提示词
123
+
124
+ ### Agent 工具
125
+
126
+ `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`
127
+
128
+ ### 界面
129
+
130
+ - 侧边栏「记忆」入口 → 浮层面板(概览/日志/笔记/反思/接续/日历/检索)
131
+ - 设置页(设置 自动记忆):存储位置、注入预算、反思风格、界面语言(中文 / English)、**界面字号(小/标准/大/特大,默认大)**——切换立即生效,无需保存
132
+ - **外部记忆继承**:接入其他 AI 工具(CodeBuddy / Claude Code / Codex / 项目约定文件)积累的记忆
133
+
134
+ ---
135
+
136
+ ## 界面截图
137
+
138
+ 以下都是插件在 DSH Web GUI 中的真实运行截图。
139
+
140
+ ### 主界面 「自动记忆」浮窗(接续页签)
141
+
142
+ <img width="480" alt="自动记忆浮窗" src="docs/screenshots/main-connect-zh.png">
143
+
144
+ ### 接续 — 继承其他 AI 工具积累的记忆
145
+
146
+ <img width="480" alt="接续页签" src="docs/screenshots/connect-zh.png">
147
+
148
+ ### 概览 AI 问候语、今日抽屉与跨工作区总结
149
+
150
+ <img width="480" alt="概览页签" src="docs/screenshots/overview-zh.png">
151
+
152
+ ### 日历 AI 维护的四象限日程
153
+
154
+ <img width="480" alt="日历页签" src="docs/screenshots/calendar-zh.png">
155
+
156
+ ### 检索 关键词检索与智能检索
157
+
158
+ <img width="480" alt="检索页签" src="docs/screenshots/search-zh.png">
159
+
160
+ ### 反思(英文界面示例)
161
+
162
+ <img width="480" alt="反思页签" src="docs/screenshots/reflections-en.png">
163
+
164
+ ### 设置 — 记忆存储、日界、每日预算、更新检查
165
+
166
+ <img width="480" alt="自动记忆设置" src="docs/screenshots/settings-zh.png">
167
+
168
+ <img width="480" alt="自动记忆设置(调试中心)" src="docs/screenshots/settings-debug-zh.png">
169
+
170
+ ## 截图之外
171
+
172
+ - **每轮自动沉淀**:每轮对话结束由小代理自动评估,按主题分组写进今日日志(`## 主题(HH:MM)` + 要点列表)——常规工作不需要手动 memory_log。有长期价值的内容自动升格项目笔记 / 用户级记忆;寒暄轮跳过;AI 失败入队,每 5 分钟重试(15 秒心跳文件证明轮询存活)。
173
+ - **智能检索**:自然语言提问,AI 扩成关键词扫描全部记忆层,再综合成带出处的自然语言回答。
174
+ - **日历提醒**:未完成事项注入之后每次会话的系统提示词——AI 不用你提醒就会主动提及。
175
+ - **一键更新**:设置页对比本地版本与 npm registry 最新版;registry 安装的用户可直接「一键更新」(后台自动跑 pnpm/npm),重启后生效。
176
+
177
+ ---
178
+
179
+ ## 配置
180
+
181
+ 默认值(JSON 文件 `~/.dsh/dsh-auto-memory.json`):
182
+
183
+ ```json
184
+ {
185
+ "userMemoryDir": "~/.dsh/memory",
186
+ "projectMemoryDir": ".dsh-memory",
187
+ "injectEnabled": true,
188
+ "injectBudgetChars": 2400,
189
+ "recentDaysInjected": 3,
190
+ "reflectEnabled": true,
191
+ "reflectStyle": "auto",
192
+ "locale": "zh",
193
+ "autoConsolidate": true,
194
+ "autoConsolidateMinChars": 60,
195
+ "memoryRoot": "~/.dsh/memory/workspaces",
196
+ "dayBoundaryMinutes": 450
197
+ }
198
+ ```
199
+
200
+ 可在 GUI(设置 → 自动记忆)中调整,包括界面语言(zh / en)、界面字号与日界。
201
+
202
+ ### v0.1.9 加固(预算 / 日界 / 目录选择器)
203
+
204
+ - **每日写入预算 + 超限自动压缩**:用户级记忆 ≤4000 字/天、项目笔记 ≤3000 字/天(所有会话共享一天额度,日界重置)。超限不拒绝写入——框架先把「今天之前」的旧内容交给 AI 压缩(合并重复、删除过期、保留硬信息)腾出空间再写;AI 不可用时把最早段落归档到 `archived-user.md` / `archive/notes-archived.md`,信息不丢。压缩 10 分钟节流。
205
+ - **日界(凌晨的活儿归昨晚)**:`dayBoundaryMinutes`(默认 450 = 早上 7:30)。日界之前的活儿记入前一天日志,前一天的每日反思也要等过了日界才开始——凌晨不再一过午夜就催「昨天干了什么」。
206
+ - **系统原生文件夹选择器**:记忆根目录旁的「浏览…」按钮直接弹系统的文件夹选择器(经 DSH directory-picker 原生后端);无原生选择器时自动回退内嵌浏览。更换根目录时自动把已有工作区记忆迁移到新位置(旧文件保留),所有路径变量在下一次刷新时跟随新配置。
207
+ - **30 天蒸馏**:`memory_maintain` 30 天前的旧日志交给 AI 提炼进项目笔记,原文保底归档到 `archive/`,并从活跃日志列表移除。
208
+ - **首轮注入保障**:`pre-step` 钩子在第一步放行前等待记忆状态刷新,模型从第一个 token 起就能看到记忆(此前异步加载可能让首轮注入为空)。
209
+ - **每步带时间戳的提醒**:注入的纪律块携带实时 `HH:MM:SS` 时间戳,每次组装提示词都刷新;另有 15 秒心跳文件证明后台轮询存活。
210
+
211
+ ---
212
+
213
+ ## 结构
214
+
215
+ - `lib/index.js` — Host 半:引擎、注入、工具、路由(零运行时依赖,仅 node 内置模块)
216
+ - `lib/client.js` — 浏览器半:记忆面板(含日历视图)+ 设置页(内置中英双语)
217
+ - `cordis.patch.yml` — 插件行(`auto-memory`)
218
+
219
+ ---
220
+
221
+ ## 限制
222
+
223
+ - 记忆文件为明文 Markdown;不存密钥,除非用户明确要求。
224
+ - `memory_recall` 的历史会话检索依赖部署的 session-query 索引,未启用时仅本地检索。
225
+ - 插件集变更需重启 dsh 生效。
226
+
227
+ ---
228
+
229
+ ## 发布信息
230
+
231
+ - GitHub: https://github.com/Aik358/dsh-auto-memory
232
+ - npm: `@a9i5k4/dsh-auto-memory`
232
233
  - License: BSD-3-Clause
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@a9i5k4/dsh-auto-memory",
3
3
  "description": "DSH 自动记忆插件:三层记忆(用户级/项目笔记/每日日志)自动注入与检索、每轮对话自动沉淀、每日反思、可视化面板与设置页,支持继承其他 AI 工具的记忆。",
4
- "version": "0.1.11",
4
+ "version": "0.1.12",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -39,5 +39,8 @@
39
39
  "type": "git",
40
40
  "url": "git+https://github.com/Aik358/dsh-auto-memory.git"
41
41
  },
42
+ "peerDependencies": {
43
+ "@deepseek-ai/cordis": "^4.0.1"
44
+ },
42
45
  "license": "BSD-3-Clause"
43
46
  }