@a9i5k4/dsh-auto-memory 0.1.28 → 0.1.30

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 CHANGED
@@ -1,266 +1,352 @@
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
- A cache-friendly three-layer memory engine for the DeepSeek Harness Web GUI — lean auto injection, per-turn AI consolidation, on-demand reads and cross-tool memory inheritance — wrapped in human touches: proactive calendar reminders, warm AI greetings, and a daily journal that writes itself.
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
- > pnpm v11 默认限制安装发布不足 1 天的版本。当天发布想立即拿到新版,在 profile 目录的 pnpm-workspace.yaml `minimumReleaseAge: 0`,或用显式版本 `pnpm add @a9i5k4/dsh-auto-memory@0.1.16`。(pnpm v11 blocks packages published <1 day ago; set `minimumReleaseAge: 0` in pnpm-workspace.yaml or use an explicit version for same-day releases.)
29
-
30
- Then edit `package.json` in that directory and append to the `dsh.profile.bundles` array:
31
-
32
- ```json
33
- "@a9i5k4/dsh-auto-memory"
34
- ```
35
-
36
- Restart **dsh web** to activate (the 「Memory」entry appears in the sidebar).
37
-
38
- > No pnpm? Use npm: `npm install @a9i5k4/dsh-auto-memory`
39
-
40
- ## Updating (check & upgrade)
41
-
42
- The plugin is a normal npm package, so updating is one command in the same profile directory:
43
-
44
- ```bash
45
- cd ~/.dsh/profiles/web
46
- pnpm up @a9i5k4/dsh-auto-memory # or: npm install @a9i5k4/dsh-auto-memory@latest
47
- ```
48
-
49
- Then restart **dsh web**.
50
-
51
- 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).
52
-
53
- ## AI-Era Installation (copy-paste for your AI)
54
-
55
- > 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.
56
-
57
- ```text
58
- Install the npm package @a9i5k4/dsh-auto-memory in the DeepSeek Harness web profile
59
- directory ~/.dsh/profiles/web (run "pnpm add @a9i5k4/dsh-auto-memory" or "npm install @a9i5k4/dsh-auto-memory"),
60
- append "@a9i5k4/dsh-auto-memory" to the dsh.profile.bundles array in package.json,
61
- then restart dsh web to activate the plugin.
62
- ```
63
-
64
- ---
65
-
66
- ## A companion that takes initiative
67
-
68
- Auto Memory is designed to feel less like a database and more like an assistant who knows you:
69
-
70
- - **Proactive reminders** when the AI notices a deadline, appointment or promise in your conversation, it files it into the calendar automatically and reminds you in later sessions before the time arrives (`calendar_add` / `calendar_done` / `calendar_remove`).
71
- - **Warm greetings** an AI-written greeting for the current period (morning / afternoon / evening) that mentions your most important work of the day; come back after an hour away and it says "welcome back" and catches you up.
72
- - **It writes its own journal** after every conversation turn, a small subagent quietly decides what's worth keeping and appends topic-grouped entries to today's log; long-term decisions are promoted to project notes and cross-project rules to user-level memory. You never have to remember to log anything.
73
- - **Daily reflections** structured results / lessons / next steps are kept in the background, so you can review how a day really went.
74
- - **Calendar with human touches** — semantic colors for urgency, a day timeline (07:00–22:00), location and reminder fields; the AI maintains it from context instead of you filling forms.
75
- - **Inherited memory** — memories accumulated in WorkBuddy / CodeBuddy / Claude Code / Codex are discoverable and importable, so the plugin picks up where your other AI tools left off.
76
-
77
- ### Under the hood engineering that stays out of your way
78
-
79
- - **Prefix-cache friendly** static rules live in the system prompt, dynamic memory in runtime snapshots; the prompt stays byte-stable so DeepSeek's prefix cache keeps hitting (no repeated re-encoding of your whole history).
80
- - **Lean injection, low token cost** — only the last day of logs + a reflection digest are injected; everything else is fetched on demand via `memory_read` / `memory_recall`.
81
- - **Rate-limited AI** auto-consolidation runs at most 8×/day with a configurable cooldown (doubled outside work hours), so memory stays useful without burning your budget.
82
- - **Credentials never enter the prompt** — sensitive sections (tokens / secrets / credentials) are filtered out of injection while staying safe in the files.
83
- - **Cross-workspace & cross-tool** centralized storage readable from any session; memories from WorkBuddy / CodeBuddy / Claude Code / Codex are discoverable and importable.
84
-
85
- ## Features
86
-
87
- ### Three-layer Memory
88
-
89
- | Layer | Location | Description |
90
- |---|---|---|
91
- | User-level memory | `~/.dsh/memory/MEMORY.md` | Cross-project rules & preferences |
92
- | Project notes | `~/.dsh/memory/workspaces/{workspace}/MEMORY.md` | Project conventions & decisions (centralized) |
93
- | Daily logs | `~/.dsh/memory/workspaces/{workspace}/YYYY-MM-DD.md` | Append-only work log (centralized) |
94
- | Reflections | `~/.dsh/memory/workspaces/{workspace}/reflections/YYYY-MM-DD.md` | Daily reflection (structured, kept in background) |
95
-
96
- > **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).
97
-
98
- - **Auto injection (at the end of the system prompt)**: every prompt gets a `<memory_system>` block (user rules + project notes + reflection digest + recent 1 day of log tails + external memory paths + 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
99
- - **Lean by default, details on demand (v0.1.24)**: injection stays small — the last 1 day of logs, a reflection digest (achievements section only), and paths for external memory instead of full text. `memory_read` fetches full log/reflection/user/notes/calendar files when needed; sensitive sections (credentials/tokens/secrets) are **filtered out of the prompt** but kept in the files
100
- - **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
101
-
102
- ### Auto-Consolidation memory writes itself after every turn (v0.1.9)
103
-
104
- Every finished conversation turn is automatically evaluated (via a small subagent) and anything worth keeping is written for youno reliance on the model remembering to log:
105
-
106
- - **Today's log** gets entries like `- 21:03 [自动沉淀] …` — no manual `memory_log` needed for routine work
107
- - **Long-term value is promoted**: project decisions/architecture → project notes (with a `## YYYY-MM-DD` heading); cross-project rules → user-level memory
108
- - **Small talk is skipped** (content threshold `autoConsolidateMinChars`), each turn is deduplicated by turn number, subagent turns are ignored
109
- - **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
110
- - **`memory_consolidate` tool**: read recent logs and distill long-term decisions / architecture / user preferences into MEMORY.md on demand ("dream-like" consolidation)
111
- - Configurable in `~/.dsh/dsh-auto-memory.json`: `autoConsolidate` (default true), `autoConsolidateMinChars` (default 240), `autoConsolidateCooldownMinutes` (default 30, doubled 22:00–08:00), `autoConsolidateDailyMax` (default 8) — all adjustable in the Settings → Automation section
112
-
113
- ### AI Greetings & Three-level Drawers (Overview page, v0.1.9)
114
-
115
- The first thing you see when opening the memory panel is an **AI-generated** period greeting, not a template and not technical info:
116
-
117
- - **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
118
- - **Drawer titles are the AI summaries**: the "Today afternoon / Today evening" window titles are replaced with the AI's casual summary text itself
119
- - **Three-level drawer structure**:
120
- - Level 1: period drawer, titled with the AI summary
121
- - Level 2: inside it, small drawers — one per work item the AI distilled (with a point count)
122
- - Level 3: expand a work item to read its detail points
123
- - **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
124
- - **Smart timing**: if you were away for more than 1 hour and come back, the greeting says "Welcome back" with what was finished meanwhile
125
- - **Daily reflection stays in background**: structured reflections (results / lessons / next steps) are kept, while the front page only shows a light greeting
126
-
127
- ### Smart Search (Search tab, v0.1.9)
128
-
129
- The Search tab adds a **Smart search** button next to the keyword search:
130
-
131
- - The AI expands your natural-language query into 3-6 keywords (e.g. "last time publishing npm hit a snag" → 发布 / 踩坑 / GitHub / npm / 推送)
132
- - Scans all three memory layers plus reflections with those keywords
133
- - 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
134
- - Raw keyword hits with their sources are listed under the answer
135
-
136
- ### Calendar View (Four Quadrants)
137
-
138
- 「Calendar」tab (liquid-glass monthly view):
139
-
140
- - Monthly grid, today highlighted, click any date to add an item
141
- - **Four-quadrant colors**: Urgent & Important (red) / Important (blue) / Urgent (orange) / Neither (gray)
142
- - Click an item to toggle done, click again to delete; legend + weekday header
143
- - **Cross-conversation persistence**: data lives at user level `~/.dsh/memory/CALENDAR.md`, shared across workspaces, survives DSH reinstall
144
- - **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
145
-
146
- ### Agent Tools
147
-
148
- `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`
149
-
150
- ### UI
151
-
152
- - Sidebar 「Memory」entry floating panel (Overview / Logs / Notes / Reflections / Connect / Calendar / Search)
153
- - 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
154
- - **External memory inheritance**: import memories accumulated by other AI tools (CodeBuddy / Claude Code / Codex / project convention files)
155
-
156
- ---
157
-
158
- ## Screenshots
159
-
160
- All screenshots below are real captures of the plugin running inside the DSH Web GUI (Chinese UI for now; English UI captures will be added later).
161
-
162
- ### Memory panel overview — away greeting & AI period summaries
163
-
164
- <img width="480" alt="Memory panel overview" src="docs/screenshots/overview-zh.png">
165
-
166
- ### Connect inherit global memory & history sessions from other AI agents
167
-
168
- <img width="480" alt="Connect tab" src="docs/screenshots/connect-zh.png">
169
-
170
- ### Calendar AI adds items, toggles status and marks completion from context
171
-
172
- <img width="480" alt="Calendar tab" src="docs/screenshots/calendar-zh.png">
173
-
174
- ### Workspace mind map — auto-generated, workspace-centered cross-workspace overview
175
-
176
- <img width="480" alt="Workspace mind map" src="docs/screenshots/workspace-map-zh.png">
177
-
178
- ### Settings — highly customizable, covers most technical details
179
-
180
- <img width="480" alt="Auto Memory settings" src="docs/screenshots/settings-zh.png">
181
- <img width="480" alt="Auto Memory settings (2)" src="docs/screenshots/settings-2-zh.png">
182
-
183
- ## Beyond the screenshots
184
-
185
- - **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).
186
- - **Smart search**: ask in natural language — the AI expands your query into keywords, scans every memory layer, then answers conversationally with sources cited.
187
- - **Calendar with day timeline (v0.1.24)**: click a date to open a 07:00–22:00 timeline with events placed on their time slots; add events with location/reminder/details; the AI proactively files deadlines via `calendar_add` and marks them done via `calendar_done`/`calendar_remove`.
188
- - **Workspace mind map (v0.1.24)**: an AI-generated graph of workspaces, topics and cross-workspace links; pan by dragging, resize with the slider, click a card for details.
189
- - **Memory panel UI (v0.1.24)**: liquid-glass panel with smooth animations everywhere — tab strip with arrow scrolling, expanding sections (greeting drawers, workspace summaries), floating save bar in Settings that highlights when there are unsaved changes.
190
- - **External memory management (v0.1.24)**: per-source view/import/remove — imported sources show "✓" and become "Delete" buttons per target (notes vs user-level); full content is read on demand and never injected in bulk.
191
- - **Calendar reminders**: pending items are injected into future sessions' system prompts until completed — the AI reminds you without being asked.
192
- - **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.
193
-
194
- ---
195
-
196
- ## Configuration
197
-
198
- Defaults (JSON file `~/.dsh/dsh-auto-memory.json`):
199
-
200
- ```json
201
- {
202
- "userMemoryDir": "~/.dsh/memory",
203
- "projectMemoryDir": ".dsh-memory",
204
- "injectEnabled": true,
205
- "injectBudgetChars": 2400,
206
- "recentDaysInjected": 1,
207
- "reflectEnabled": true,
208
- "reflectStyle": "auto",
209
- "locale": "zh",
210
- "autoConsolidate": true,
211
- "autoConsolidateMinChars": 240,
212
- "autoConsolidateCooldownMinutes": 30,
213
- "autoConsolidateDailyMax": 8,
214
- "externalInjectionChars": 1400,
215
- "memoryRoot": "~/.dsh/memory/workspaces",
216
- "dayBoundaryMinutes": 450
217
- }
218
- ```
219
-
220
- Adjustable in the GUI (Settings → Auto Memory), including the UI language (zh / en), the panel font size and the day boundary.
221
-
222
- ### v0.1.27 hardening (memory hygiene gate — keeps external dirt out)
223
-
224
- - **Write gate on the three write tools**: `memory_log_dev` / `memory_note_dev` / `memory_user_dev` now run content through `sanitizeForWrite` before writing suspected mojibake (GBK round-trip artifacts), stutter degeneration (word/char loops, punctuation-separated included) and consecutive duplicate lines (≥3) are rejected with a reason; append entries cap at 8,000 chars, full rewrites (replace) at 200,000; appends are also deduped against the file's last ~60 lines (the `- HH:MM` log prefix does not affect matching).
225
- - **Hygiene family fixes**: removed the `进行中` false positive from the mojibake pattern (added the real artifact `杩涜涓`), switched mojibake counting to global matching (it previously counted at most 1 hit, letting dirty long texts slip past the threshold), stutter detection now works across punctuation, and the duplicate-line check is reset by blank lines (no more false positives on short lines repeated across paragraphs).
226
- - **External memory import is link-only**: `memory_external_dev` import now records only source file path pointers instead of copying content — keeping dirty content from other AI tools (WorkBuddy/CodeBuddy/Claude Code/Codex) out of local memory.
227
- - **Injection-side scrub + voice discipline**: mojibake lines, code blocks and stutter lines are scrubbed before injection; the injected block adds a "how to read memory" note and voice discipline — write all memory entries as third-person objective statements, no first-person thinking narration.
228
-
229
- ### v0.1.28 dirty-token checker (prion-scan integrated — stops the "model silently degrades" class)
230
-
231
- - **Write gate now rejects raw JSON envelopes & base64 residue**: besides mojibake / stutter / duplicate lines, the write gate also rejects lines matching external-AI-profile JSON signatures (`memoryBlock` / `"uid":` / `updatedAt` / `"role":"... "`) and base64 residue lines — so an external tool profile can never be pasted into memory wholesale again.
232
- - **Full mojibake table (34 features, verbatim from prion-scan.mjs)**: the GBK round-trip residue list is completed, catching the exact artifacts this class of "garbage token" shows up as.
233
- - **New "Scan dirty tokens" in Settings → Debug Center**: one-click prion-style scan of user-level memory / project notes / today's log / reflections — returns a per-file report by line range (mojibake / raw JSON envelope / long lines >500 / base64 / duplicate lines, duplicate ## headings) with **locations only, no content**, so you can spot residual dirt without reading it.
234
-
235
- ### v0.1.9 hardening (budget / boundary / picker)
236
-
237
- - **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.
238
- - **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.
239
- - **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.
240
- - **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.
241
- - **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).
242
- - **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.
243
-
244
- ---
245
-
246
- ## Structure
247
-
248
- - `lib/index.js` — Host half: engine, injection, tools, routes (zero runtime deps, Node built-ins only)
249
- - `lib/client.js` Browser half: memory panel (with calendar view) + settings page (built-in zh/en i18n)
250
- - `cordis.patch.yml` — Plugin row (`auto-memory`)
251
-
252
- ---
253
-
254
- ## Limitations
255
-
256
- - Memory files are plain-text Markdown; no secrets stored unless explicitly requested.
257
- - `memory_recall` session search depends on the deployed session-query index; without it, only local search works.
258
- - Plugin-set changes require a dsh restart.
259
-
260
- ---
261
-
262
- ## Release Info
263
-
264
- - GitHub: https://github.com/Aik358/dsh-auto-memory
265
- - npm: `@a9i5k4/dsh-auto-memory`
266
- - License: BSD-3-Clause
1
+ # dsh-auto-memory — Auto Memory & Proactive Companion for DeepSeek Harness
2
+
3
+ <p align="center">
4
+ <a href="https://htmlpreview.github.io/?https://github.com/Aik358/dsh-auto-memory/blob/preview/docs/landing/index.html"><strong>🌐 Landing page (full feature tour · data flow · papers · screenshots)</strong></a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="docs/screenshots/promo/promo-1-hero.png"><img width="820" alt="dsh-auto-memory hero: she remembers, unbidden" src="docs/screenshots/promo/promo-1-hero.png"></a>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="docs/screenshots/promo/promo-1-hero.png"><img width="130" alt="hero" src="docs/screenshots/promo/promo-1-hero.png"></a>
13
+ <a href="docs/screenshots/promo/promo-2-tour.png"><img width="130" alt="welcome tour" src="docs/screenshots/promo/promo-2-tour.png"></a>
14
+ <a href="docs/screenshots/promo/promo-3-recall.png"><img width="130" alt="recall & crystallization" src="docs/screenshots/promo/promo-3-recall.png"></a>
15
+ <a href="docs/screenshots/promo/promo-4-unattended.png"><img width="130" alt="unattended mode" src="docs/screenshots/promo/promo-4-unattended.png"></a>
16
+ <a href="docs/screenshots/promo/promo-5-external.png"><img width="130" alt="external memory inheritance" src="docs/screenshots/promo/promo-5-external.png"></a>
17
+ <a href="docs/screenshots/promo/promo-6-greeting.png"><img width="130" alt="scheduled greetings" src="docs/screenshots/promo/promo-6-greeting.png"></a>
18
+ </p>
19
+ <p align="center"><sub>Promo gallery · six frames · click any thumbnail to view full size</sub></p>
20
+
21
+ <details>
22
+ <summary><b>Promo gallery, frame by frame</b> (expand and flip through)</summary>
23
+
24
+ #### Frame 1 · Hero — She remembers, unbidden
25
+
26
+ <p align="center"><img width="720" alt="hero" src="docs/screenshots/promo/promo-1-hero.png"></p>
27
+
28
+ #### Frame 2 · Welcome Tour Every feature, explained and toggled on the spot
29
+
30
+ <p align="center"><img width="720" alt="welcome tour" src="docs/screenshots/promo/promo-2-tour.png"></p>
31
+
32
+ #### Frame 3 · Recall & Crystallization — Conversation condenses into skills, traceably
33
+
34
+ <p align="center"><img width="720" alt="recall" src="docs/screenshots/promo/promo-3-recall.png"></p>
35
+
36
+ #### Frame 4 · Unattended Mode Runs all night, zero small talk, zero interruptions
37
+
38
+ <p align="center"><img width="720" alt="unattended" src="docs/screenshots/promo/promo-4-unattended.png"></p>
39
+
40
+ #### Frame 5 · External Memory Inheritance — Your other AIs feed her memory too
41
+
42
+ <p align="center"><img width="720" alt="external" src="docs/screenshots/promo/promo-5-external.png"></p>
43
+
44
+ #### Frame 6 · Scheduled Greetings — Every day remembered
45
+
46
+ <p align="center"><img width="720" alt="greeting" src="docs/screenshots/promo/promo-6-greeting.png"></p>
47
+
48
+ </details>
49
+
50
+ <p align="center">
51
+ <a href="README.md">中文</a> · <b>English</b> · License BSD-3-Clause · <code>pnpm add @a9i5k4/dsh-auto-memory</code>
52
+ </p>
53
+
54
+ > **v0.1.30 MAJOR UPDATE** — A brand-new Welcome Tour: every feature introduced step by step with per-feature switches; an Office/Fluent-style liquid-glass app icon family; a changelog intro animation; and an unattended mode built for long batch jobs.
55
+
56
+ A **proactive associative-memory plugin** for the DeepSeek Harness Web GUI: memory is recalled by situation and injected into the next turn without the model ever asking for it — alongside three-layer auto-consolidation, AI greetings and daily reflections, calendar reminders, cross-tool memory inheritance, and production-grade unattended/batch support.
57
+
58
+ **The problem it solves**: AI assistants start from zero every session, and every existing memory solution still relies on the model "remembering to look" — call a tool, send a request; skip it once and the memory might as well not exist. This plugin removes the instruction entirely: a host-side middleware watches the conversation context continuously, and the right memories walk toward the model on their own — your preferences, project conventions, yesterday's progress, next week's deadlines, plus that "welcome back" when you return.
59
+
60
+ ---
61
+
62
+ ## Highlights in 30 seconds
63
+
64
+ | | |
65
+ |---|---|
66
+ | **Proactive recall, zero instructions** | Memory is never fetched by the model — the host watches context and recalls automatically, injected at a fixed boundary, prefix-cache friendly |
67
+ | **Three-layer memory engine** | User rules → project notes → daily logs; injected + on-demand recall |
68
+ | **Memory writes itself** | A subagent quietly evaluates every turn and files topic-grouped entries you never "remember to log" |
69
+ | **Every activation is auditable** | Each recall decision carries a full evidence chain, gradeable in the Recall review tab; skills crystallize from cross-session evidence |
70
+ | **Proactive reminders** | The AI spots deadlines and promises in conversation, files them into the calendar and reminds you later |
71
+ | **Everything is a switch** | Welcome tour + settings page, every feature individually toggleable (incl. unattended mode) |
72
+ | **External memory inheritance** | Memories from WorkBuddy / CodeBuddy / Claude Code / Codex are scanned, importable, per-source managed |
73
+ | **Production-grade hygiene** | Write gate (mojibake/stutter/JSON-injection blocking) + dirty-token scanner + credentials never enter prompts |
74
+
75
+ ---
76
+
77
+ ## Welcome Tour (new in v0.1.30)
78
+
79
+ After first install or an upgrade, the plugin auto-plays a **step-by-step welcome tour** not an ad popup, but the home of every feature switch:
80
+
81
+ <p align="center"><img width="720" alt="welcome tour" src="docs/screenshots/tour-welcome.png"></p>
82
+
83
+ - **One Office/Fluent-style liquid-glass app icon per step**: cyan inject, amber greeting, green calendar, violet engine, sky radar, coral finish each with its own looping motion (bell sway, page flip, radar sweep, rising spark…)
84
+ - **Flip every feature right in the tour**: switches write config instantly; no second trip to settings required
85
+ - **Semantic-engine detection/download inline**: the three retrieval tiers (lexical 0GB floor → built-in ~130MB → advanced Python BGE-M3) are auto-detected and one-click installable (SHA256 verify + inference self-test)
86
+ - **Live external-memory scan**: WorkBuddy / Claude Code / Codex sources found on your machine, tick-per-source
87
+ - **No "how do I close this"**: closing mid-tour lands on a finish page telling you exactly where each feature lives in Settings
88
+
89
+ <p align="center"><img width="720" alt="tour core" src="docs/screenshots/tour-core.png"></p>
90
+
91
+ One-time catch-up for upgraders: from v0.1.30 every user auto-plays the full tour once after upgrading, then the changelog follows (skippable). Reopen anytime via **Settings → Appearance → Welcome tour → ▶ Replay**.
92
+
93
+ ---
94
+
95
+ ## Three-layer memory system
96
+
97
+ | Layer | Location | Content |
98
+ |---|---|---|
99
+ | User-level memory | `~/.dsh/memory/MEMORY.md` | Cross-project rules & preferences |
100
+ | Project notes | `~/.dsh/memory/workspaces/{workspace}/MEMORY.md` | Conventions & decisions |
101
+ | Daily logs | `~/.dsh/memory/workspaces/{workspace}/YYYY-MM-DD.md` | Append-only work log |
102
+ | Daily reflections | `…/reflections/YYYY-MM-DD.md` | Structured review (results / lessons / next) |
103
+
104
+ **Injection strategy**: static discipline lives in the system prompt (byte-stable, keeps the prefix cache hot); dynamic memory rides a runtime snapshotonly the last day of logs plus a reflection digest are injected, everything else is fetched on demand via `memory_read` / `memory_recall`. Credential/secret sections are **always filtered out of prompts**.
105
+
106
+ ---
107
+
108
+ ## Feature tour
109
+
110
+ ### Auto-consolidation memory writes itself
111
+
112
+ After every turn a small subagent quietly evaluates what happened: long-term-valuable topics are grouped into today's log (`## Topic (HH:MM)` + bullets), durable decisions are promoted to project notes, cross-project rules to user-level memory, small talk is skipped, failures queue and retry every 5 minutes (a 15-second heartbeat file proves the loop is alive). Daily write budgets with AI auto-compaction — going over budget never rejects a write.
113
+
114
+ ### Activation & crystallization — interrupt only when it matters
115
+
116
+ Associative recall detects memory needs directly in the conversation chain and injects at the next boundary (prefix-cache friendly); frequent workflows crystallize into skill checklists that attach automatically, promote after cross-session validation (approvals in the Memory Hub tab, 90-day auto-archive with pinning). **Every "should I interrupt" decision can be reviewed and graded** in the Recall review tab (A activate / P prefetch / S suppress / H harmful / E edit); the review queue digests into policy hints.
117
+
118
+ <p align="center"><img width="720" alt="refine" src="docs/screenshots/panel-refine.png"></p>
119
+
120
+ ### Unattended mode built for batch jobs
121
+
122
+ Running long pipelines or automated flows? Settings → Automation offers **Unattended mode** and **auto-unattended overnight** (22:00-08:00, tunable). While engaged: no greetings, no niceties or behavioural directives, calendar silent, context stable — tokens go to the work, not the small talk.
123
+
124
+ ### AI greetings & daily reflections
125
+
126
+ A period-aware greeting (morning/afternoon/evening) that mentions your most important work; return after an hour away and the memory panel auto-opens with "welcome back" plus a recent-work digest; the first session of each day presents yesterday's structured reflection.
127
+
128
+ ### Smart search
129
+
130
+ Ask in natural language — the AI expands your query into keywords, scans every memory layer, and answers conversationally with sources cited; cross-workspace search included.
131
+
132
+ ### Calendar maintained by the AI
133
+
134
+ The AI spots deadlines and promises in conversation and files them (`calendar_add`); pending items are injected into later sessions until completed; day view is a 07:00–22:00 timeline with location/reminder fields and urgency-tinted colors.
135
+
136
+ ### External memory inheritance
137
+
138
+ Sessions and memories from WorkBuddy / CodeBuddy / Claude Code / Codex are scanned, importable per source (**path pointers only, never copied content**), removable per source; import-side and injection-side hygiene gates keep external dirt out.
139
+
140
+ ### Memory hygiene (production-grade write gate)
141
+
142
+ - All three write tools run `sanitizeForWrite`: GBK mojibake (34-feature table), stutter degeneration, consecutive duplicate lines, external-AI-profile JSON signatures, base64 residue — rejected with a human-readable reason
143
+ - Settings Debug Center "Scan dirty tokens": one-click scan of user memory / notes / logs / reflections, reported by line range (locations only, no content)
144
+ - Caps: 8,000 chars per append, 200,000 per rewrite; appends deduped against the last ~60 lines
145
+
146
+ ---
147
+
148
+ ## Engineering core (restraint by design)
149
+
150
+ - **Zero runtime dependencies** beyond Node built-ins
151
+ - **Prefix-cache friendly**: byte-stable prompts keep DeepSeek's prefix cache hitting — your history is never re-encoded
152
+ - **Rate-limited AI**: auto-consolidation ≤8×/day with cooldown; useful memory without burning budget
153
+ - **Centralized storage**: all workspace memory under one root (`~/.dsh/memory/workspaces/`), readable from any session
154
+ - **30-day distillation**: old logs are AI-distilled into project notes; originals archived, nothing lost
155
+
156
+ ---
157
+
158
+ ## UI gallery
159
+
160
+ ### Memory panel · Overview (away greeting + AI period summaries)
161
+
162
+ <img width="480" alt="overview" src="docs/screenshots/panel-overview.png">
163
+
164
+ ### Memory Hub · three stores + skill promotion approvals
165
+
166
+ <img width="480" alt="hub" src="docs/screenshots/panel-hub.png">
167
+
168
+ ### Recall review · grade every activation decision
169
+
170
+ <img width="720" alt="refine" src="docs/screenshots/panel-refine.png">
171
+
172
+ ### Welcome tour · feature switches + engine detection
173
+
174
+ <img width="720" alt="tour" src="docs/screenshots/tour-toggles.png">
175
+
176
+ <details>
177
+ <summary><b>More screenshots</b> (click to expand)</summary>
178
+
179
+ ### External memory scan (inside the tour)
180
+
181
+ <img width="720" alt="external scan" src="docs/screenshots/tour-external.png">
182
+
183
+ ### Connect other AI tools
184
+
185
+ <img width="480" alt="connect" src="docs/screenshots/connect-en.png">
186
+
187
+ ### Calendar view
188
+
189
+ <img width="480" alt="calendar" src="docs/screenshots/calendar-zh.png">
190
+
191
+ ### Workspace mind map
192
+
193
+ <img width="480" alt="workspace map" src="docs/screenshots/workspace-map-zh.png">
194
+
195
+ ### Settings
196
+
197
+ <img width="480" alt="settings" src="docs/screenshots/settings-en.png">
198
+ <img width="480" alt="settings 2" src="docs/screenshots/settings-2-zh.png">
199
+
200
+ </details>
201
+
202
+ ---
203
+
204
+ ## Install (one command)
205
+
206
+ > Prerequisite: install [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) and start `dsh web` at least once.
207
+
208
+ Run in the **profile directory** (`~/.dsh/profiles/web`):
209
+
210
+ ```bash
211
+ cd ~/.dsh/profiles/web
212
+ pnpm add @a9i5k4/dsh-auto-memory
213
+ ```
214
+
215
+ Then edit `package.json` in that directory and append to the `dsh.profile.bundles` array:
216
+
217
+ ```json
218
+ "@a9i5k4/dsh-auto-memory"
219
+ ```
220
+
221
+ Restart **dsh web** (the 「Memory」entry appears in the sidebar).
222
+
223
+ > No pnpm? `npm install @a9i5k4/dsh-auto-memory` works the same.
224
+ > pnpm v11 blocks packages published <1 day ago: set `minimumReleaseAge: 0` in pnpm-workspace.yaml or pin an explicit version for same-day updates.
225
+
226
+ ### AI-era installation
227
+
228
+ Copy this to the AI assistant you're already using:
229
+
230
+ ```text
231
+ Install the npm package @a9i5k4/dsh-auto-memory in the DeepSeek Harness web profile
232
+ directory ~/.dsh/profiles/web (pnpm add or npm install),
233
+ append "@a9i5k4/dsh-auto-memory" to the dsh.profile.bundles array in package.json,
234
+ then restart dsh web to activate the plugin.
235
+ ```
236
+
237
+ ### Updating
238
+
239
+ ```bash
240
+ cd ~/.dsh/profiles/web && pnpm up @a9i5k4/dsh-auto-memory
241
+ ```
242
+
243
+ The Settings → Auto Memory page has a "Check for updates" button comparing your version with the npm registry; registry installs get a one-click update.
244
+
245
+ ---
246
+
247
+ ## Configuration
248
+
249
+ Config file `~/.dsh/dsh-auto-memory.json` (everything adjustable in the Settings GUI, zh/en UI and panel font size included):
250
+
251
+ ```json
252
+ {
253
+ "userMemoryDir": "~/.dsh/memory",
254
+ "memoryRoot": "~/.dsh/memory/workspaces",
255
+ "injectEnabled": true,
256
+ "injectBudgetChars": 2400,
257
+ "recentDaysInjected": 1,
258
+ "reflectEnabled": true,
259
+ "autoConsolidate": true,
260
+ "autoConsolidateCooldownMinutes": 30,
261
+ "autoConsolidateDailyMax": 8,
262
+ "unattendedMode": false,
263
+ "unattendedAuto": false,
264
+ "unattendedAutoHours": ["22:00-08:00"],
265
+ "memoryHubEnabled": true,
266
+ "externalSources": { "workbuddy-user": true, "claude-global": true },
267
+ "dayBoundaryMinutes": 450
268
+ }
269
+ ```
270
+
271
+ > Full key reference lives in the Settings page — every switch has a description, and every welcome-tour switch maps 1:1 to settings.
272
+
273
+ ---
274
+
275
+ ## Structure
276
+
277
+ - `lib/index.js` — Host half: engine, injection, tools, routes (zero runtime deps, Node built-ins only)
278
+ - `lib/client.js` — Browser half: memory panel (calendar / mind map) + settings page + welcome tour (zh/en i18n)
279
+ - `python/` — optional Python semantic sidecar (BGE-M3 int8, advanced tier)
280
+ - `cordis.patch.yml` — plugin registration row
281
+
282
+ ## Architecture
283
+
284
+ All milestones are implemented and live-verified. The full interactive architecture map lives at [docs/proactive-associative-memory-system-map.html](docs/proactive-associative-memory-system-map.html); the core layering:
285
+
286
+ ```
287
+ DeepSeek Harness (Node, 127.0.0.1:3080)
288
+ ├─ JS memory core (lib/*_pre.js, zero runtime deps)
289
+ │ M1 session isolation · M2 ContextObserver projection
290
+ │ M3 memory anchoring (anchored records + sidecar identity)
291
+ │ M4 corpus adapter + shadow retrieval host (evidence store)
292
+ │ M5 context/evidence bridge (envelope · coverage · cite/correction)
293
+ │ M6 activation inbox (validate→offer→claim→reference tail→delivered/seen)
294
+ │ lexical_pre_v2 lexical fallback retrieval (BM25 + CJK 2gram, 0GB always-on)
295
+ │ C2 built-in semantic tier (e5-small q8 ~130MB, default)
296
+ └─ Python sidecar M7 (optional, lazy-spawned child process)
297
+ worker_semantic_pre_v1.py
298
+ ├─ index_sync: JS-authorized paged index build (digest checks, scope grouping)
299
+ ├─ dense: BGE-M3 int8 + para-512 chunks + cosine (R@5 0.925)
300
+ ├─ hybrid: dense 0.7 + lexical 0.3 fusion
301
+ └─ fv2 activation policy: two lanes + hard gates (echo/correction/stale/scope)
302
+ ```
303
+
304
+ **Separation of powers**: the Python semantic layer decides *what to recall and when to suggest*; the JS authority layer decides identity, authorization, timing, and delivery — Python never creates evidence nor injects directly. Data flow: `context_push → M5 envelope → decision → M6 fixed-boundary injection → delivered/seen evidence back`.
305
+
306
+ ### Design papers
307
+
308
+ The design is not guesswork — every algorithmic conclusion comes from reproducible experiments, frozen into an engineering decision ledger:
309
+
310
+ | Paper | Content |
311
+ |---|---|
312
+ | [Multilingual Embedding Retrieval Study](docs/M7-RESEARCH-PAPER.md) | 3 models × 5 chunkings × 6 retrieval channels ≈ 90 evaluation cells; BGE-M3 leads across the board, frozen as decisions D1–D11 |
313
+ | [Activation v2: The Echo Trap](docs/M7-ACTIVATION-V2-PAPER.md) | Why semantic relevance ≠ recall necessity — activation policy technical report + dual-track deployment architecture (§7) |
314
+ | [Embedding Benchmark Report](docs/M7-EMBEDDING-BENCHMARK.md) | Frozen basis for model/chunk/fusion: bge-m3 + para-512-noov + weighted fusion |
315
+ | [Frozen Algorithm Decisions D1–D11](docs/M7-ALGORITHM-DECISION.md) | The decision ledger from research conclusions to production implementation |
316
+ | [Held-out Human-Gold Acceptance](docs/M7-ACTIVATION-V2-HOLDEDOUT-EVAL.md) | 67 human-labeled verdicts: actPrecision 0.917 / harmful injections 0 / echo tier 7/7 |
317
+ | [Python Sidecar Contract](docs/PYTHON-SIDECAR-CONTRACT.md) | Protocol / lifecycle / authority boundary / per-milestone regression evidence |
318
+
319
+ Papers were authored by the autonomous engineering agent (ZCode / GLM); all conclusions were frozen into the production implementation under human review.
320
+
321
+ ## Known limitations
322
+
323
+ - Memory files are plain-text Markdown; no secrets stored unless explicitly requested.
324
+ - `memory_recall` session search depends on the deployed session-query index; without it, only local search works.
325
+ - Plugin-set changes require a dsh restart.
326
+
327
+ ---
328
+
329
+ ## Community
330
+
331
+ - [@ProperSAMA](https://github.com/ProperSAMA) — panel readability fix for DSH Desktop enhanced mode (transparent/Mica materials) + entry-button anti-occlusion & outside-click/Esc close ([PR #12](https://github.com/Aik358/dsh-auto-memory/pull/12))
332
+ - [@nkh0472](https://github.com/nkh0472) — unattended/batch workflow hardening feedback that drove the welcome tour and per-feature switches ([Issue #10](https://github.com/Aik358/dsh-auto-memory/issues/10))
333
+
334
+ ---
335
+
336
+ ## Credits
337
+
338
+ This project is built human-machine collaboratively. In addition to engineering and community contributions above:
339
+
340
+ - **Aik358** — project owner: product direction, architecture, and engineering.
341
+ - **ZCode (GLM, Z.ai)** — autonomous engineering agent: M-series semantic-engine implementation, benchmark research papers ([M7-RESEARCH-PAPER](docs/M7-RESEARCH-PAPER.md) / [Activation v2 report](docs/M7-ACTIVATION-V2-PAPER.md)), regression suites, and the landing-page design/build.
342
+ - **Kimi K3 (Moonshot AI)** — frontend agent: contributed to the v0.1.30 welcome-tour interface assets and visual QA.
343
+
344
+ AI agents are credited as authors of the research papers and parts of the implementation, under human review and direction.
345
+
346
+ ---
347
+
348
+ ## Release
349
+
350
+ - GitHub: https://github.com/Aik358/dsh-auto-memory
351
+ - npm: `@a9i5k4/dsh-auto-memory`
352
+ - License: BSD-3-Clause