dsh-plugin-memory 0.16.1 → 0.17.0
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/CHANGELOG.md +31 -0
- package/README.md +39 -221
- package/README.zh.md +43 -231
- package/docs/CONFIGURATION.md +77 -0
- package/docs/DESIGN.md +74 -0
- package/lib/boot.js +4 -3
- package/lib/client.js +183 -3
- package/lib/graph-search.js +69 -0
- package/lib/graph.js +3 -2
- package/lib/index-page.js +5 -4
- package/lib/index.js +71 -4
- package/lib/pages.js +8 -5
- package/lib/paths.js +57 -0
- package/lib/reveal.js +83 -0
- package/lib/session-gate.js +9 -8
- package/lib/soul.js +16 -8
- package/lib/types/index.d.ts +6 -0
- package/package.json +1 -1
- package/scripts/memory.mjs +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
所有记录跟随 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/) 风格;版本号与 `package.json` 保持一致。
|
|
4
4
|
|
|
5
|
+
## [0.17.0] - 2026-11-05
|
|
6
|
+
|
|
7
|
+
### Added(0.17.0:图谱搜索定位 + 双击打开文件)
|
|
8
|
+
|
|
9
|
+
- **图谱搜索**:3D 图谱上方新增搜索框——按 label > id > type > tag 排序匹配,回车或点击候选即把目标节点**旋转到画面正中**并选中(邻居自动高亮),几十个节点里三秒找到任意一页。
|
|
10
|
+
- **双击节点打开文件**:host 新增 `POST /api/memory/reveal`,在 Finder(macOS)/ Explorer(Windows)/ xdg-open(Linux)里定位并选中对应 `.md`;路径经 realpath 边界校验,越界/非文件一律 400(`lib/reveal.js` 用注入的 execFile 测试,确认非法 id 不会执行任何命令)。
|
|
11
|
+
- 新增纯函数 `lib/graph-search.js`(匹配排序 + 聚焦相机角度),客户端内联同一套并有对齐测试;失败提示走 `graphRevealFailed`。
|
|
12
|
+
|
|
13
|
+
### Changed(C+E 交互调整 + 体检修复)
|
|
14
|
+
|
|
15
|
+
- **打开文件的交互改成 C+E**:选中节点 → 详情行出现 **「在 Finder 中显示」** 与 **「复制路径」** 按钮(双击仍是快捷方式);新增只读的 `GET /api/memory/path` 用于复制绝对路径。
|
|
16
|
+
- **reveal 改为等待命令结果**:`revealFile` 现在是 async,`open -R`/`explorer`/`xdg-open` 失败(沙箱、权限、缺命令)时路由返回 500、客户端显示错误并**自动复制路径**(兜底提示在 Finder 里 ⌘⇧G 粘贴),不再出现"假装成功但没打开"。
|
|
17
|
+
- **双击不再丢选中**:修掉双击时第二次 pointerup 取消选中、详情行闪烁消失的问题。
|
|
18
|
+
|
|
19
|
+
### Docs(README 精简 + Windows 说明)
|
|
20
|
+
|
|
21
|
+
- **README 重构**:中英各从 ~290 行压缩到 **102 行**——顶部直接声明 **macOS · Windows · Linux** 支持,新增「跨平台(含 Windows)」章节(路径变量展开 / CRLF 保留 / `open -R`·`explorer /select,`·`xdg-open` / 大小写匹配);长内容拆进 `docs/CONFIGURATION.md`(完整配置表、boot 预算、覆盖示例、兼容性)与 `docs/DESIGN.md`(架构、人格层、主动机制、图谱、FAQ 细节)。
|
|
22
|
+
- 已核对所有本地链接与截图引用,无死链。
|
|
23
|
+
|
|
24
|
+
### Cross-platform(Windows 兼容)
|
|
25
|
+
|
|
26
|
+
- 路径配置支持 `~` / `~\` / `%USERPROFILE%` / `$HOME` 展开(`lib/paths.js`,host/CLI 共用;`~` 只在 POSIX 有效的问题已消除)。
|
|
27
|
+
- CRLF 文件按 LF 解析(frontmatter / SOUL / 受管区块 / 图谱),写回时保留文件自身换行风格(`SOUL.md`、页面 `last_access`)——Windows 编辑器保存的库不再解析失败或被整体 LF 化。
|
|
28
|
+
- 图谱「在 Finder 中显示」:Windows 改用 `explorer` + `/select,` 与路径分开传参(含空格路径安全),并把 explorer 的退出码 1 视为成功;Linux 用 `xdg-open`。
|
|
29
|
+
- `disabledWorkspaces` 在 Windows 上大小写不敏感。
|
|
30
|
+
- 新增 `paths` 5 条测试、CRLF 解析/写回、Windows 大小写匹配、win32 命令与退出码测试;全量 **336/336**。
|
|
31
|
+
|
|
32
|
+
### Tests
|
|
33
|
+
|
|
34
|
+
- 新增 `graph-search` 6 条、`reveal` 5 条(含命令失败路径)、`graph-card` 2 条(搜索框/内联一致性)、`session-control` 2 条(reveal 坏请求 + path 路由);全量 **327/327**。
|
|
35
|
+
|
|
5
36
|
## [0.16.1] - 2026-11-05
|
|
6
37
|
|
|
7
38
|
### Fixed
|
package/README.md
CHANGED
|
@@ -10,275 +10,93 @@
|
|
|
10
10
|
<img alt="node" src="https://img.shields.io/badge/node-%3E%3D18-green">
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
|
-
>
|
|
13
|
+
> Long-term memory for DeepSeek Harness — a portable markdown memory store with a soul, injected at every session start.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
**macOS · Windows · Linux** · Node ≥ 18 · DSH `^0.2.1-rc.5` · MIT
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## What it does
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
A Cordis plugin that gives DSH agents **persistent, cross-session, migratable memory**: plain markdown + git (the *LLM Wiki* pattern), a `SOUL.md` persona, and a boot block **auto-injected through runtime context** — a hard guarantee, not a hope that the model decides to call a skill.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## Quickstart
|
|
22
22
|
|
|
23
23
|
```sh
|
|
24
24
|
# 1. install
|
|
25
25
|
dsh plugin --profile <profile> add dsh-plugin-memory
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
2. **Restart the app
|
|
29
|
-
|
|
30
|
-
3. **Confirm it took.** `dsh-memory doctor` gives an environment check-up (scaffold, orphan pages, git state, boot budget) and ends with the command that fixes each finding. Or open **Settings → Memory** for the health dashboard and hot-editable options.
|
|
31
|
-
|
|
32
|
-
After that the loop is simple: the agent writes memories back as you work, and you can steer the store by hand whenever you like — it is plain markdown plus git, nothing locked in.
|
|
28
|
+
2. **Restart the app.** In the first session the agent starts the **soul-forging** conversation itself (or skip it: **Settings → Memory → Basic soul**, one save).
|
|
29
|
+
3. **Verify:** `dsh-memory doctor`, or open **Settings → Memory** for the health dashboard and hot settings.
|
|
33
30
|
|
|
34
31
|
## Features
|
|
35
32
|
|
|
36
|
-
- **
|
|
37
|
-
- **
|
|
38
|
-
- **
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
41
|
-
- **
|
|
42
|
-
- **
|
|
43
|
-
- **
|
|
44
|
-
- **Embedded skill**: registers the `memory` skill through `ctx.skills.register()` (the operating protocol ships with the plugin); a project-level `.dsh/skills/memory` file skill can still override it.
|
|
45
|
-
- **Anti-laziness digest nudge**: after a turn ends, if the agent sits idle and the store has not been written for `digestNudgeAfterMinutes`, the plugin injects a digest reminder (a synthetic message through `agent.followup`), turning "settle the session at the end" from self-discipline into a mechanism, with cooldown and a per-session cap so it never nags. **Independent of dsh-plugin-heartbeat** — either plugin can be installed alone.
|
|
46
|
-
- **Proactive recall (personification)**: when the conversation goes quiet, the plugin brings up, in the first person, one thing it **genuinely remembers** about you or the two of you (a preference, a past event, an open decision, recent progress) — turning memory from "write-only" into something actually used, the way an old friend naturally recalls something rather than reporting status. The interval is **randomised** between a minimum and a maximum (no fixed rhythm), paired with a per-session cap: no nagging, no fabrication, no forcing conversation. Purely conversational; it never writes the store. **Also independent of heartbeat**.
|
|
47
|
-
- **Automatic git commits**: after `autoCommitQuietSeconds` of quiet, store changes are silently `git add -A && git commit` (skipped when there is no `.git`) — history becomes rollback-able without depending on the agent remembering to commit.
|
|
48
|
-
- **Settings panel**: a "Memory" section in the DSH settings page — master switch, store directory, boot injection, skill registration, and proactive recall (switch + random interval range + per-session cap) are all hot-editable and take effect immediately, no restart.
|
|
49
|
-
- **Automatic index upkeep (declarative compilation)**: index lines are no longer hand-written. A page declares `summary:` in its frontmatter, and `dsh-memory index --write` rewrites the line as a projection of it (tag ≤32 / summary ≤48 / whole line ≤132 characters), **changing only line content while preserving sections and order byte for byte**, and idempotently. `index --check` gives a machine verdict (non-zero exit when there is drift), and `index --sync-frontmatter` backfills summaries already written in the index into the pages (a one-off migration for older stores). The digest reminder appends a note when the index has drifted, so the agent can fix it in passing.
|
|
50
|
-
- **Cross-linking as a default action**: `index.md` is the directory (who exists); page-to-page links are the **relationships** (who relates to whom). In a real store measured here, 29 pages had only 1 genuine cross-link, yet the graph and all cross-page synthesis rest on that layer. Three places now push it together: the remember flow in `skills/memory.md`, the workflow in the `MEMORY.md` template, and the closing instruction of the digest reminder all require "add 1–3 related-page links for every page you touched this time".
|
|
51
|
-
- **Link suggestions**: `dsh-memory graph --suggest` lists, for pages that have only their index entry and no content relationship, who they ought to reference — scored by shared topic tags, title words, and same type, with the reason stated (`shared #dsh` / `title word dsh` / `same type`). Report-only: whether and how to link stays the agent's call. Also available as `GET /api/memory/graph?suggest=1`.
|
|
52
|
-
- **Memory graph (3D, v0.16.0)**: a read-only relationship graph in the settings page, now an interactive **3D sphere** rendered on Canvas (zero dependency, no WebGL): Fibonacci-sphere placement (same type forms a contiguous colour band; deterministic, no randomness), perspective projection, depth fog and node glow. **Interactive**: drag empty space to rotate, wheel to zoom (0.5×–2.4×), drag a node to arrange it in 3D (positions survive the 25-second live refresh), double-click empty space to reset, auto-spin (disabled when `prefers-reduced-motion`). **Hover or click lights up the neighbourhood immediately**; click detection uses a displacement+duration double threshold (≤5px, ≤350ms), so a light tap is no longer mistaken for a drag — that was the demo bug where neighbours did not light up on click. The selected node is drawn last (never occluded), neighbours keep their labels, and the card shows the selected node's type/degree/neighbour count. The 3D maths lives in `lib/graph-3d.js` (pure functions with tests) and is mirrored inside `client.js` (the client can only require platform seeds) with a consistency test pinning both. Three edge kinds stay distinguishable: page links = solid blue, index routing = grey dashed, shared tags = thin violet. `GET /api/memory/graph` (read-only, live).
|
|
53
|
-
- **`dsh-memory checkup`**: folds the four readers (lint's integrity, status's counts, the dashboard's size and freshness, graph's relationships) into **one prioritised report** — size, freshness bars, connectivity, consistency checks, ending with "the N things most worth doing". The four numbers are diagnosis; "do these three things" is the product. Exits non-zero when there is work to do, so scripts can consume it. `--boot=N` computes the index share against your boot budget.
|
|
54
|
-
- **Memory health dashboard**: below the same section is a **read-only** dashboard — memory pages / index routes / word count, an access-freshness bar chart (today / ≤7 / ≤30 / ≤90 / >90 days), four health verdicts (index links, orphan pages, frontmatter, freshness) with a health score, stale-page candidates, and the 5 most recent log entries. Data comes from the new `GET /api/memory/insights` (computed live per request, never cached), and its criteria share a source with `dsh-memory lint`, so the dashboard and the CLI cannot contradict each other.
|
|
55
|
-
- **Zero build**: plain ESM JavaScript, no compilation step, usable straight after `pnpm add`.
|
|
56
|
-
|
|
57
|
-
## Persona, politeness and growth (v0.12.0)
|
|
58
|
-
|
|
59
|
-
Four small additions turn the memory from "storage with a soul" into a companion that behaves:
|
|
60
|
-
|
|
61
|
-
- **Speech-right arbitration with other proactive plugins (A)**: before sending anything proactive — a recall, a digest reminder or a growth recap — the plugin claims the shared `${DSH_HOME:-~/.dsh}/proactive-cooldown.json` (`{ version: 1, speaker: 'memory' | 'heartbeat', at: <epoch ms> }`, atomic tmp+rename). If another speaker claimed inside `proactiveCooldownSeconds` (default **180**, `0` disables), the message is deferred and **the cadence is not consumed** — the next trigger retries. Neither plugin imports the other; both implement the same protocol independently, so either can be installed, upgraded or removed alone.
|
|
62
|
-
- **Tone drift (B)**: `lib/tone.js` injects a small `## Tone (adapt to context)` section right after SOUL (≤12 lines, **charged to the boot budget** — its character cost is deducted before the per-file allocation): crunch/urgent fix → short sentences, conclusion first, zero jokes; deep night (23:00–06:00) → shorter and gentler; errors/bad news → facts and the fix before any feelings; milestone/finished → one light line, then back to business. `toneGuideEnabled` (default `true`) switches it, `toneIntensity` (`low` / `medium` / `off`, default `low`) sets how visible it is.
|
|
63
|
-
- **Expression, never fake emotion (C)**: the same section draws the line — describe the **observed situation and care**, never claim inner feelings ("I am … / I feel …"); only three occasions are allowed: risk/bad news, milestones/completion, and the first line after 3+ days without contact.
|
|
64
|
-
- **Weekly growth recap (D)**: `growthRecapEnabled` (default `true`) and `growthRecapIntervalDays` (default `7`). It rides the **recall channel** (same cadence, same per-session cap, same arbitration lock) and reads only what the store already proves — recent `log.md` headlines and page mtimes — so there is no invented progress. `<store>/.growth-recap.json` remembers the last delivery, so a restart does not repeat the same week.
|
|
65
|
-
|
|
66
|
-
## Architecture
|
|
67
|
-
|
|
68
|
-
The plugin owns the **workflow**, never the **data format**:
|
|
33
|
+
- **Remembering across sessions** — boot block = SOUL + MEMORY protocol + `index.md` + recent activity, with a per-file budget so the index tail is not truncated first.
|
|
34
|
+
- **A soul, not just storage** — SOUL + BOOTSTRAP forging; a quick-setup card writes a managed block; persona names are read from SOUL, never hard-coded.
|
|
35
|
+
- **You stay in control** — per-session switch (chip / `/memory on|off` / panel) and `disabledWorkspaces` defaults.
|
|
36
|
+
- **A companion** — digest nudge, proactive recall, weekly growth recap, context-sensitive tone; shared speech floor with other proactive plugins.
|
|
37
|
+
- **Portable** — plain markdown + git, `pack`/`unpack`, optional auto-commit.
|
|
38
|
+
- **Memory graph** — interactive 3D sphere: rotate / zoom / drag nodes, search-to-focus, hover or click to light up neighbours; select a node → **Reveal in Finder** or **Copy path**.
|
|
39
|
+
- **Health tools** — dashboard, `checkup`, `lint`, `doctor`, automatic `last_access` stamping.
|
|
40
|
+
- **Zero build, bilingual panel, hot-editable config.**
|
|
69
41
|
|
|
70
|
-
|
|
71
|
-
dsh-plugin-memory (this plugin)
|
|
72
|
-
├── lib/index.js # Cordis entry: boot injection + runtime skill registration + settings hot-edits
|
|
73
|
-
├── lib/boot.js # boot block rendering (SOUL/MEMORY/index + recent log, budgeted per file)
|
|
74
|
-
├── lib/pages.js # page access accounting: extractReferencedPages / touchPages (last_access)
|
|
75
|
-
├── lib/insights.js # data layer for the health dashboard (pages/distribution/freshness/checks, read-only)
|
|
76
|
-
├── lib/activity-tracker.js # the two polite gates: has the user spoken + is this the active session
|
|
77
|
-
├── lib/digest-guard.js # anti-laziness digest nudge (idle + store unwritten -> followup reminder)
|
|
78
|
-
├── lib/recall-nudge.js # proactive recall (idle -> one true recollection in the first person, never writes)
|
|
79
|
-
├── lib/scaffold.js # store scaffolding (templates are created, never overwritten)
|
|
80
|
-
├── lib/client.js # client half: the "Memory" settings section + health dashboard
|
|
81
|
-
├── skills/memory.md # the embedded skill's operating protocol
|
|
82
|
-
└── scripts/memory.mjs # CLI: init/search/touch/lint/status/pack/unpack
|
|
83
|
-
|
|
84
|
-
The store (your data, default ~/.memory)
|
|
85
|
-
├── SOUL.md # persona and soul (user-owned)
|
|
86
|
-
├── BOOTSTRAP.md # soul-forging checklist (takes priority until complete)
|
|
87
|
-
├── MEMORY.md # schema and maintenance protocol (self-describing)
|
|
88
|
-
├── index.md # page directory log.md # timeline (append-only)
|
|
89
|
-
├── identity/ user/ skills/ decisions/ projects/{active,archive}/ concepts/
|
|
90
|
-
└── raw/ # immutable source material
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Installation
|
|
94
|
-
|
|
95
|
-
```sh
|
|
96
|
-
dsh plugin --profile <profile> add dsh-plugin-memory
|
|
97
|
-
```
|
|
42
|
+
## Cross-platform
|
|
98
43
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
Restart the profile (restart the DSH Desktop app) to take effect.
|
|
102
|
-
|
|
103
|
-
> 📌 **Version requirement: DSH session format v4 + official DeepSeek Harness 0.2.1-rc.5 series** (0.13.x declares `engines.dsh`; older hosts are refused by the gate — see [Compatibility](#compatibility))
|
|
104
|
-
>
|
|
105
|
-
> Injected messages use the producer-owned source kind `plugin:memory`. v4's native admission explicitly rejects the v3-era `{ kind: 'plugin', plugin: 'memory' }` wrapper with
|
|
106
|
-
> `format v4 message requires a producer-owned source kind` (the error is wrapped as `code: "UNKNOWN"`, so it surfaces in the UI as `... source kind UNKNOWN` — `UNKNOWN` is the error code, not a kind value).
|
|
107
|
-
>
|
|
108
|
-
> The v4 and v3 whitelists are **mutually exclusive** (v3 only recognises `plugin`), so one build cannot support both. **0.8.0 and earlier trigger this error on v4**; older DSH should stay on 0.8.0.
|
|
109
|
-
|
|
110
|
-
> ⚠️ Do **not** hand-write `- insert: {id: dsh-memory, ...}` into the profile's `cordis.patch.yml`: that produces two entries with the same name alongside the bundle manifest's automatic mount, and the whole profile fails to start with `duplicate loader entry id "dsh-memory"` (a real incident on 2026-08-18). Runtime settings (enabled / memoryDir / autoInject / registerSkill / recallEnabled) go through `<dshHome>/memory.json` (hot-edited from the settings panel); composition settings are in the table below. To override a composition key, use an **id override entry without `insert`** (see Configuration).
|
|
44
|
+
**macOS, Windows and Linux are supported.** Path settings expand `~`, `~\`, `%USERPROFILE%` and `$HOME`; CRLF files are parsed as LF and **written back with their own newline style**; *Reveal in Finder* maps to `open -R` (macOS), `explorer /select,` (Windows, space-safe argv) and `xdg-open` (Linux); `disabledWorkspaces` matching is case-insensitive on Windows. Details: [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
|
|
111
45
|
|
|
112
46
|
## Configuration
|
|
113
47
|
|
|
114
|
-
|
|
115
|
-
|---|---|---|
|
|
116
|
-
| `enabled` | `true` | Master switch: when off, no boot injection and no `memory` skill registration |
|
|
117
|
-
| `memoryDir` | `~/.memory` | Absolute path to the store (`~` is expanded) |
|
|
118
|
-
| `bootFiles` | `[SOUL.md, MEMORY.md, index.md]` | Files injected at session start |
|
|
119
|
-
| `bootMaxChars` | `12000` | Total character budget for the boot block (keeps context usage bounded); per-file allocation below |
|
|
120
|
-
| `bootFileBudgets` | — | Per-file character caps, e.g. `{ index.md: 3500 }`; unlisted files share the remainder (composition layer, restart required) |
|
|
121
|
-
| `trackPageAccess` | `true` | On the session's first user message, stamp `last_access` on the pages the boot block actually injected (when off, the decay table needs manual upkeep) |
|
|
122
|
-
| `autoInject` | `true` | Inject the boot block at session start |
|
|
123
|
-
| `deferUntilUserSpeaks` | `true` | Inject only after the user's first real message (the boot block, recall and digest reminders all obey it); hot-editable |
|
|
124
|
-
| `activeSessionOnly` | `true` | Inject only into the "currently active session" (the one that most recently received a user message); background sessions are left alone; hot-editable |
|
|
125
|
-
| `registerSkill` | `true` | Register the embedded `memory` skill |
|
|
126
|
-
| `scaffold` | `true` | Create the store templates when missing (create only, never overwrite) |
|
|
127
|
-
| `configFile` | `<dshHome>/memory.json` | Path to the user-editable JSON config (read/written by the settings panel) |
|
|
128
|
-
| `digestNudgeEnabled` | `true` | Master switch for the anti-laziness digest reminder (composition) |
|
|
129
|
-
| `digestNudgeAfterMinutes` | `120` | How long the store may go unwritten before reminding |
|
|
130
|
-
| `digestNudgeCooldownMinutes` | `180` | Minimum gap between two reminders |
|
|
131
|
-
| `digestNudgeMaxPerSession` | `2` | Maximum reminders per session |
|
|
132
|
-
| `recallEnabled` | `true` | Master switch for proactive recall (hot-editable) |
|
|
133
|
-
| `recallIntervalMinMinutes` | `30` | Lower bound of the random interval (minutes, hot-editable) |
|
|
134
|
-
| `recallIntervalMaxMinutes` | `240` | Upper bound of the random interval (minutes, hot-editable) |
|
|
135
|
-
| `recallMaxPerSession` | `3` | Maximum recalls per session (hot-editable) |
|
|
136
|
-
| `proactiveCooldownSeconds` | `180` | Shared speech-floor cooldown against other proactive plugins (`0` = off) |
|
|
137
|
-
| `toneGuideEnabled` | `true` | Inject the context-sensitive tone section after SOUL |
|
|
138
|
-
| `toneIntensity` | `low` | `low` / `medium` / `off` (pure engineering voice) |
|
|
139
|
-
| `growthRecapEnabled` | `true` | Weekly growth recap on the recall channel |
|
|
140
|
-
| `growthRecapIntervalDays` | `7` | Days between growth recaps |
|
|
141
|
-
| `disabledWorkspaces` | `[]` | Workspaces (session cwd, `~` expanded, path-boundary match) that default to memory **off**; a per-session override still wins; hot-editable |
|
|
142
|
-
| `sessionStateFile` | `<dshHome>/memory-sessions.json` | Where per-session overrides live (composition) |
|
|
143
|
-
| `sessionTtlDays` | `7` | Days a session override stays valid before it is pruned (composition) |
|
|
144
|
-
| `autoCommit` | `true` | Git auto-commit switch for the store (composition) |
|
|
145
|
-
| `autoCommitQuietSeconds` | `60` | How long changes must be quiet before committing (debounce) |
|
|
146
|
-
| `autoCommitIntervalSeconds` | `60` | Change polling interval |
|
|
147
|
-
|
|
148
|
-
### Settings panel (hot edits)
|
|
149
|
-
|
|
150
|
-
The section is registered as **"Memory"** in the English UI and **「记忆」** in the Chinese UI — it follows DSH's own language setting (see [Language](#language) below).
|
|
151
|
-
|
|
152
|
-
Sixteen settings are editable in the "Memory" section of the DSH settings page and take effect **immediately**: `enabled` / `memoryDir` / `autoInject` / `deferUntilUserSpeaks` / `activeSessionOnly` / `registerSkill` / `recallEnabled` / `recallIntervalMinMinutes` / `recallIntervalMaxMinutes` / `recallMaxPerSession` / `proactiveCooldownSeconds` / `toneGuideEnabled` / `toneIntensity` / `growthRecapEnabled` / `growthRecapIntervalDays` / `disabledWorkspaces` — boot injection, the two polite gates, skill registration, proactive recall (including its random interval and cap), speech-right arbitration, the tone section, the weekly growth recap and the per-session switch all follow the change at once; switching the store directory scaffolds the new one automatically (when `scaffold: true`). The remaining keys (`bootFiles` / `bootMaxChars` / `bootFileBudgets` / `trackPageAccess` / `scaffold` / `configFile` / `sessionStateFile` / `sessionTtlDays` / `digestNudge*` / `autoCommit*`) only apply at the composition layer and need a restart.
|
|
153
|
-
|
|
154
|
-
A **Review now** button sits beside them: it is a **control, not a setting** — it asks the plugin to send one growth recap immediately. It still respects the speech floor (it backs off if the other plugin is speaking), sends nothing when this week has no new material, works even while `recallEnabled` is off, and reports the outcome in the panel (sending / sent / deferred / session busy / no content / disabled / failed) — the result notice clears itself after 5 seconds.
|
|
48
|
+
Sixteen hot keys edit live under **Settings → Memory**. The full table, boot-budget rules and composition overrides are in [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
|
|
155
49
|
|
|
156
50
|

|
|
157
51
|
|
|
158
|
-
### Language
|
|
159
|
-
|
|
160
|
-
The settings panel and its sidebar label follow DSH's own language setting (**Settings → General → Language**) and switch live — no restart: Chinese shows 「记忆」, English shows "Memory". Panel copy is registered as the `memory` locale namespace through `ctx.locale`, so the renderer re-renders the whole panel (form, health dashboard, graph card) in the active language and injects a `t(key)` seat into the section. The sidebar icon claim key is derived from that same label, so a language switch re-claims the right row. The dashboard's health-check labels **and details** are rebuilt client-side from locale-neutral `data` the insights route ships (`lib/insights.js` keeps the Chinese `label`/`detail` strings for the CLI); an older host payload without `data` falls back to those Chinese strings. User content (page titles, `log.md` headlines) and the CLI's own Chinese output are content, not UI copy, and stay as-is.
|
|
161
|
-
|
|
162
|
-
### Compatibility
|
|
163
|
-
|
|
164
|
-
`package.json` declares `engines.dsh: "^0.2.1-rc.5"`, and the host enforces it with `semver.satisfies(..., { includePrerelease: true })` — the prerelease detail matters: `^0.2.1` or `>=0.2.0` do **not** match `0.2.1-rc.5`, so only the explicit prerelease range works (it also covers the eventual 0.2.1 stable). Two host services became load-bearing on the way here: the `locale` service (0.11+: the panel registers its dictionaries through it) and session projections (0.12+: speech arbitration and the growth recap read them). On an older host the gate refuses to load the plugin instead of letting it run half-broken; at runtime a missing projection still degrades gracefully — no recap, no speech-floor claim, never a crash.
|
|
165
|
-
|
|
166
|
-
### Boot budget allocation (why the index is not truncated first)
|
|
167
|
-
|
|
168
|
-
`bootMaxChars` is a total budget, allocated per file rather than split evenly:
|
|
169
|
-
|
|
170
|
-
1. Files with a `bootFileBudgets` entry take their own allowance first;
|
|
171
|
-
2. the remaining files each get an equal share, **capped by their real size** — a short file returns its unused allowance to the pool;
|
|
172
|
-
3. the pool then tops up files that still have content left to inject (each up to twice the equal share): **`index.md` first**, then the rest by descending size — so which file gets truncated is decided by size, not by the order in `bootFiles`.
|
|
173
|
-
|
|
174
|
-
When every file is under the equal share, the result is byte-for-byte identical to the old even-split rule; it only diverges once the store grows. This also means: **`index.md` is a routing table, not a summary table** — it is injected in full, and bloat costs you the persona and other memories.
|
|
175
|
-
|
|
176
|
-
> **How is the "currently active session" decided?** The DSH host has no "currently focused session" signal (active session is a front-end concept). The plugin uses **the live root agent that most recently received a real user message** as a proxy: whichever session you speak in is the active one; switching away without sending a message is invisible to the host (a known limit of the proxy). Exact "expanded/focused" precision would need a small client-side focus report.
|
|
177
|
-
|
|
178
|
-
### Memory health dashboard
|
|
179
|
-
|
|
180
|
-
Below the "Memory" section is a **read-only** dashboard fed by `GET /api/memory/insights`:
|
|
181
|
-
|
|
182
|
-
| Display | Meaning |
|
|
183
|
-
|---|---|
|
|
184
|
-
| pages / index routes / word count | Store size (counted in characters, so Chinese is not inflated 3× by bytes) |
|
|
185
|
-
| Health score (0–100) | Weighted from orphan pages, missing `salience`/`type`, stale pages, and broken index links |
|
|
186
|
-
| Access freshness bars | today / ≤7 / ≤30 / ≤90 / >90 days / never stamped (driven by automatic `last_access` stamping) |
|
|
187
|
-
| Four checks | Index links complete, no orphan pages, frontmatter complete, access freshness — same source as `dsh-memory lint` |
|
|
188
|
-
| Stale candidates | Pages older than 90 days or never stamped, sorted by staleness (top 8) |
|
|
189
|
-
| Recent activity | The 5 newest `log.md` headlines |
|
|
190
|
-
|
|
191
|
-
The dashboard is **live**: refetched each time the settings page opens (or after any config change), never persisted, cached, or written back to the store. On a headless deployment without `webServer`, that route and the dashboard simply do not exist; everything else is unaffected.
|
|
192
|
-
|
|
193
|
-
To override a composition key (for example raising the boot budget), write an **id override entry without `insert`** in the profile's `cordis.patch.yml`:
|
|
194
|
-
|
|
195
|
-
```yaml
|
|
196
|
-
- id: dsh-memory
|
|
197
|
-
config:
|
|
198
|
-
bootMaxChars: 12000
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
> Implementation note: DSH's settings wire only serves a hard-coded namespace allowlist, so a plugin namespace cannot be written through it. This plugin therefore uses its own channel: config lives in `<dshHome>/memory.json` (schema-validated, atomically written), served by the plugin's self-registered `GET/POST /api/memory/config` routes, which the client section fetches directly.
|
|
202
|
-
|
|
203
|
-
## First run: soul-forging
|
|
204
|
-
|
|
205
|
-
After installation, the agent's first task in the first session is **not** to work, but to talk with you about its soul: name, personality, values, tone, boundaries, plus who you are and what you are to each other. Each item is confirmed and written back to `SOUL.md` / `user/profile.md` until `BOOTSTRAP.md`'s `status` becomes `complete`. You can skip or defer at any time.
|
|
206
|
-
|
|
207
|
-
Prefer not to chat about it? **Settings → Memory → Basic soul** fills the three essentials in one save (my name / your name / baseline persona), writes them into a managed block in `SOUL.md`, and marks forging complete — the same result as the conversation, in ten seconds.
|
|
208
|
-
|
|
209
|
-
## The four operations
|
|
210
|
-
|
|
211
|
-
- **remember**: distil what is worth persisting into pages, updating `index.md` and appending to `log.md` in the same pass. Keep routing-table discipline when maintaining the index: one line per page, a one-sentence summary (≤ 80 characters) plus `salience`.
|
|
212
|
-
- **recall**: read the boot block at session start; on a query, consult `index.md` first and then drill into pages; use `dsh-memory search <keywords>` when needed.
|
|
213
|
-
- **consolidate**: `dsh-memory lint` finds contradictions, orphans, and cold pages due for archiving; `dsh-memory status` shows the stale-page distribution.
|
|
214
|
-
- **forget**: explicit forgetting happens immediately; automatic decay follows salience + last_access (cold pages are archived first). `last_access` is maintained by the plugin — no manual edits.
|
|
215
|
-
|
|
216
52
|
## CLI
|
|
217
53
|
|
|
218
54
|
```sh
|
|
219
|
-
dsh-memory init [dir]
|
|
220
|
-
dsh-memory search <query>
|
|
221
|
-
dsh-memory
|
|
222
|
-
dsh-memory
|
|
223
|
-
dsh-memory
|
|
224
|
-
|
|
225
|
-
dsh-memory checkup [--boot=N] # one report: size/freshness/connectivity/consistency + prioritised actions
|
|
226
|
-
dsh-memory lint # integrity check
|
|
227
|
-
dsh-memory doctor # environment check-up + the command that fixes each finding
|
|
228
|
-
dsh-memory status # health overview (including stale-page counts)
|
|
229
|
-
dsh-memory pack [out.tar.gz] # export an archive (with manifest)
|
|
230
|
-
dsh-memory unpack <archive> [--force] # restore from an archive
|
|
55
|
+
dsh-memory init [dir] # scaffold the store
|
|
56
|
+
dsh-memory search <query> # full-text search
|
|
57
|
+
dsh-memory checkup # one prioritised health report
|
|
58
|
+
dsh-memory doctor # environment check-up
|
|
59
|
+
dsh-memory graph --suggest # who should link to whom (report only)
|
|
60
|
+
dsh-memory pack / unpack # move the store between machines
|
|
231
61
|
```
|
|
232
62
|
|
|
233
|
-
Store resolution
|
|
63
|
+
Store resolution: `$MEMORY_DIR` → `./.memory` → `~/.memory`.
|
|
234
64
|
|
|
235
|
-
##
|
|
65
|
+
## Docs
|
|
236
66
|
|
|
237
|
-
|
|
67
|
+
[Configuration](docs/CONFIGURATION.md) · [Design notes](docs/DESIGN.md) · [Migration](docs/MIGRATION.md) · [Proactive protocol](docs/PROACTIVE-PROTOCOL.md) · [Contributing](CONTRIBUTING.md) · [Security](SECURITY.md) · [Changelog](CHANGELOG.md)
|
|
238
68
|
|
|
239
69
|
## FAQ
|
|
240
70
|
|
|
241
|
-
**
|
|
242
|
-
The file skill is a
|
|
243
|
-
|
|
244
|
-
**Q: Does the boot block get re-injected on every request and burn tokens?**
|
|
245
|
-
No. Runtime context is deduplicated by projection: an unchanged payload is injected once, and an updated memory replaces the old snapshot.
|
|
246
|
-
|
|
247
|
-
**Q: Where should the store live?**
|
|
248
|
-
`~/.memory` by default (global, cross-project). For per-project isolation, point `memoryDir` inside the project, or let the agent maintain `.memory/` there.
|
|
249
|
-
|
|
250
|
-
**Q: Can it be encrypted?**
|
|
251
|
-
If the memory holds sensitive content, put `memoryDir` on an encrypted volume or in a private repository. The format is unchanged and the plugin is unaware.
|
|
71
|
+
**Does it burn tokens every request?** No — runtime context is deduplicated by projection; an unchanged payload is injected once.
|
|
72
|
+
**File skill vs plugin?** The file skill is a soft guarantee (only its blurb is injected); this plugin is a hard one. They coexist (the file skill ranks higher); remove any hand-written persona to avoid double injection.
|
|
73
|
+
**Where should the store live?** `~/.memory` by default; point `memoryDir` inside a project for isolation.
|
|
252
74
|
|
|
253
75
|
## Development
|
|
254
76
|
|
|
255
77
|
```sh
|
|
256
78
|
git clone https://github.com/LittleBlackTong/dsh-plugin-memory.git
|
|
257
79
|
cd dsh-plugin-memory
|
|
258
|
-
node scripts/memory.mjs --self-test # smoke test
|
|
80
|
+
node scripts/memory.mjs --self-test # smoke test, nothing to install
|
|
81
|
+
node --test # full suite
|
|
259
82
|
```
|
|
260
83
|
|
|
261
|
-
Zero build: `lib/` is runtime code as-is
|
|
262
|
-
|
|
263
|
-
The test suite (`node --test`) currently holds **260 tests**, and CI (`.github/workflows/ci.yml`) runs it together with `node scripts/memory.mjs --self-test`. Contribution and security policies live in [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md); the cross-plugin speech-floor protocol is documented in [docs/PROACTIVE-PROTOCOL.md](docs/PROACTIVE-PROTOCOL.md).
|
|
84
|
+
Zero build: `lib/` is runtime code as-is. CI runs both commands.
|
|
264
85
|
|
|
265
86
|
## Roadmap
|
|
266
87
|
|
|
267
|
-
- [ ]
|
|
268
|
-
- [ ]
|
|
269
|
-
- [ ]
|
|
270
|
-
- [ ]
|
|
271
|
-
- [ ] Encrypted memory storage option
|
|
88
|
+
- [ ] Embedding / BM25 retrieval
|
|
89
|
+
- [ ] MCP server for non-DSH agents
|
|
90
|
+
- [ ] Encrypted store option
|
|
91
|
+
- [ ] TypeScript rewrite
|
|
272
92
|
|
|
273
93
|
## Feedback & community
|
|
274
94
|
|
|
275
|
-
- **
|
|
276
|
-
- **WeChat group
|
|
95
|
+
- **Bugs / features / PRs**: [open an issue](https://github.com/LittleBlackTong/dsh-plugin-memory/issues) — the durable channel.
|
|
96
|
+
- **WeChat group**「dsh-plugin-memory 插件沟通」: scan below (QR codes expire ~7 days; open an issue if it no longer works).
|
|
277
97
|
|
|
278
98
|

|
|
279
99
|
|
|
280
|
-
> WeChat group QR codes expire every 7 days. If the code no longer works, open an issue (or ask in the group) and I'll refresh it.
|
|
281
|
-
|
|
282
100
|
## License
|
|
283
101
|
|
|
284
102
|
[MIT](LICENSE)
|