memory-eternal 0.1.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.
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "https://anthropic.com/claude-code/plugin.schema.json",
3
+ "name": "memory-eternal",
4
+ "version": "0.1.0",
5
+ "description": "璁板繂鏍稿績锛圡emory Eternal锛夛細鐭ヨ瘑鍗¤嚜鍔ㄦ矇娣€/鍙洖锛岀粺涓€ ~/.dsh/memory-vault锛屼細璇濈粨鏉熻嚜鍔ㄥ叆搴撹繘寰呭鏍搞€?,
6
+ "author": {
7
+ "name": "EternalNight996",
8
+ "url": "https://github.com/EternalNight996"
9
+ },
10
+ "license": "MIT",
11
+ "hooks": { "source": "./hooks/hooks.claude.json" },
12
+ "skills": ["./skills/"],
13
+ "mcp_servers": [
14
+ {
15
+ "name": "memory",
16
+ "command": "node",
17
+ "args": ["${CLAUDE_PLUGIN_ROOT}/bin/dsh-memory.mjs", "mcp"]
18
+ }
19
+ ]
20
+ }
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "memory-eternal",
3
+ "version": "0.1.0",
4
+ "description": "璁板繂鏍稿績锛圡emory Eternal锛夛細鐭ヨ瘑鍗¤嚜鍔ㄦ矇娣€/鍙洖锛岀粺涓€ ~/.dsh/memory-vault锛屼細璇濈粨鏉熻嚜鍔ㄥ叆搴撹繘寰呭鏍搞€?,
5
+ "author": {
6
+ "name": "EternalNight996",
7
+ "url": "https://github.com/EternalNight996"
8
+ },
9
+ "license": "MIT",
10
+ "homepage": "https://github.com/EternalNight996/dsh-memory-eternal",
11
+ "repository": "https://github.com/EternalNight996/dsh-memory-eternal",
12
+ "skills": "./skills/",
13
+ "mcpServers": "./.mcp.json",
14
+ "hooks": "./hooks/hooks.codex.json"
15
+ }
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "memory-eternal",
3
+ "version": "0.1.0",
4
+ "description": "璁板繂鏍稿績锛圡emory Eternal锛夛細鐭ヨ瘑鍗¤嚜鍔ㄦ矇娣€/鍙洖锛岀粺涓€ ~/.dsh/memory-vault锛屼細璇濈粨鏉熻嚜鍔ㄥ叆搴撹繘寰呭鏍搞€?,
5
+ "author": {
6
+ "name": "EternalNight996",
7
+ "url": "https://github.com/EternalNight996"
8
+ },
9
+ "license": "MIT",
10
+ "homepage": "https://github.com/EternalNight996/dsh-memory-eternal",
11
+ "repository": "https://github.com/EternalNight996/dsh-memory-eternal",
12
+ "mcpServers": "./.mcp.json",
13
+ "hooks": "./hooks/hooks.cursor.json"
14
+ }
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
package/.mcp.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "mcpServers": {
3
+ "memory": {
4
+ "command": "node",
5
+ "args": ["${CLAUDE_PLUGIN_ROOT}/bin/dsh-memory.mjs", "mcp"],
6
+ "env": {}
7
+ }
8
+ }
9
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 EternalNight996
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,224 @@
1
+ # 🧠 memory-eternal — A "second brain" for your AI
2
+
3
+ <p align="center">
4
+ <img src="https://img.shields.io/badge/DeepSeek%20Harness-plugin-3B82F6" alt="DSH plugin" />
5
+ <img src="https://img.shields.io/npm/v/memory-eternal" alt="npm version" />
6
+ <img src="https://img.shields.io/github/stars/EternalNight996/memory-eternal?style=flat" alt="GitHub stars" />
7
+ <img src="https://img.shields.io/github/license/EternalNight996/memory-eternal" alt="license" />
8
+ <a href="https://dsh.market/"><img src="https://raw.githubusercontent.com/2BingLing/dsh-market/master/assets/readme/badge-listed.svg" alt="DSH Market listed" /></a>
9
+ </p>
10
+
11
+ > **Auto-captures knowledge after every conversation and survives across sessions; recall fetches only the relevant chunks — saves tokens, less noise.**
12
+ > Fully self-built, zero third-party memory framework, no DSH source changes, one vault shared by every Agent, plain Markdown & git-manageable.
13
+
14
+ <p align="center"><strong>⭐ Star it if you like it!</strong> <br/><sub>DSH one-liner: <code>dsh plugin --profile web add memory-eternal</code></sub></p>
15
+
16
+ <p align="center">
17
+ <img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/memory-eternal.gif" width="880" alt="Auto-capture + visual library + knowledge graph (demo)" />
18
+ </p>
19
+
20
+ ---
21
+
22
+ ## 🚀 Get Started in 5 Minutes
23
+
24
+ ### 🟦 DeepSeek Harness (DSH) — focus
25
+
26
+ **Install** (dsh-desktop via DSH CLI, one command):
27
+
28
+ ```bash
29
+ # dsh-desktop (recommended): install via DSH CLI into the profile
30
+ dsh plugin --profile web add memory-eternal
31
+
32
+ # or update directly in the profile (pnpm workspace). Use pnpm — `npm install` throws EUNSUPPORTEDPROTOCOL
33
+ cd ~/.dsh/profiles/web && pnpm add memory-eternal@latest
34
+ ```
35
+
36
+ After **restarting dsh web**, three things are live immediately:
37
+
38
+ | Effect | Where |
39
+ |---|---|
40
+ | Auto-capture of knowledge cards | Happens every turn, no action needed |
41
+ | `memory_recall` tool | Agent calls it automatically when it needs history |
42
+ | Visual UI | Sidebar bottom `Memory` button / Settings → Memory |
43
+
44
+ **Entry**: The sidebar-footer `Memory` button opens the vault (its left rail includes Cards / Graph / Usage / **Audit Center** / Recycle Bin / **Memory Config**); "DSH Settings → Memory" is the pure config page.
45
+
46
+ **Edit config**: Vault left rail "Memory Config" (or DSH Settings → Memory) → DSH memory config / cost control / auto-audit config / self-hosting — just hit "Save Config". `autoWebMode` / `watchdogAutoSpawn` changes require a DSH restart.
47
+
48
+ ### 🟨 Claude Code
49
+
50
+ ```bash
51
+ npm i -g memory-eternal # installs CLI + MCP (auto-writes ~/.claude.json + SessionEnd hook)
52
+ ```
53
+
54
+ Ready after install: say "recall 数据库选型" in a session → auto-retrieves memory; on session end / before context compaction → auto-captures.
55
+
56
+ ### 🟧 Codex CLI / Cursor
57
+
58
+ ```bash
59
+ npm i -g memory-eternal # auto-writes Codex config.toml / Cursor mcp.json
60
+ ```
61
+
62
+ Restart the tool → MCP is in the list; just use: `用 memory_recall 查一下项目历史决策`.
63
+
64
+ ### 🟩 Browser (no Agent needed)
65
+
66
+ ```bash
67
+ dsh-memory open # starts web + opens browser (default http://127.0.0.1:7999)
68
+ ```
69
+
70
+ Stats / search / card grid (add-edit-merge-import-export) / knowledge graph — all here. Same UI as the DSH embed; data stays in sync.
71
+
72
+ > **zcode (Zhipu)**: no native MCP; bridge via [zcode-open-bridge](https://github.com/tizerluo/zcode-open-bridge) or use the CLI directly.
73
+
74
+ ---
75
+
76
+ ## 📖 Command Reference
77
+
78
+ ```bash
79
+ dsh-memory recall "database selection" # retrieve
80
+ dsh-memory capture "important note..." # manual capture (- reads stdin)
81
+ dsh-memory sweep ~/.claude/projects # mine existing sessions
82
+ dsh-memory setup [--dry-run] # re-run / preview auto-mount (idempotent)
83
+ dsh-memory mcp # MCP stdio (mount to any MCP client)
84
+ dsh-memory serve [--port 7999] # run web in foreground
85
+ dsh-memory open # ensure web alive + open browser
86
+ dsh-memory watchdog [--port 7799] # watchdog keep-alive (standalone process)
87
+ ```
88
+
89
+ When not running on DSH, the `dsh-memory` command comes from `npm i -g`.
90
+
91
+ ---
92
+
93
+ ## ⚙️ Self-hosting (plain words)
94
+
95
+ Three concepts, don't mix them:
96
+
97
+ - **How the web server stays alive** (`autoWebMode`) → `init`=pull once at DSH start (default); `interval`=DSH in-process timer probes & auto-restarts (0 extra memory); `manual`=fully manual, only from `dsh-memory open`.
98
+ - **Watchdog process** (`watchdogAutoSpawn`, default on) → a **standalone** node process that can pull web up even after DSH exits (~+47 MB RAM). Only turn on for 7×24 keep-alive.
99
+ - **Auto-mount MCP** (`autoMcpSetup`, default off) → whether to auto-write MCP into Claude Code/Codex/Cursor config. Off = don't touch your machine config; run `dsh-memory setup` manually when needed.
100
+
101
+ **Change these**: Vault left rail "Memory Config" (or DSH Settings → Memory) → edit the table and save; `autoWebMode` / `watchdogAutoSpawn` need a DSH restart.
102
+
103
+ **MCP is a protocol, not a resident service**: the agent spawns it per session and exits when done — no "auto-start on boot" concept.
104
+
105
+ ### Three deployment intensities
106
+
107
+ | Scenario | Config | Memory |
108
+ |---|---|---|
109
+ | Personal dev (default) | `autoWebMode=init` + `watchdogAutoSpawn=off` | web 47 MB |
110
+ | Resident 7×24 | `watchdogAutoSpawn=on` | web + watchdog 47+47 MB |
111
+ | True boot auto-start (no DSH) | Windows Task Scheduler runs `dsh-memory watchdog --port 7799 --interval 5000 --max-restart 10` | same |
112
+
113
+ ---
114
+
115
+ ## ⚙️ Memory Config (plain words)
116
+
117
+ > All settings live in the **vault left rail "Memory Config"** (or DSH Settings → Memory) — edit and hit "Save". Here's the full page (plugin info / Agent MCP mount status / auto-audit config):
118
+
119
+ <p align="center">
120
+ <img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/memory-config.png" width="880" alt="Memory config page" />
121
+ </p>
122
+
123
+ ### 1. Most used
124
+
125
+ | Setting | Default | In plain words |
126
+ |---|---|---|
127
+ | Auto capture | on | auto-store useful content as cards after each turn |
128
+ | Auto recall | on | AI auto-queries memory when it needs history |
129
+ | Vault dir | `~/.dsh/memory-vault` | where memory lives, plain Markdown & git-able |
130
+
131
+ ### 2. Save money (important)
132
+
133
+ | Setting | Default | In plain words |
134
+ |---|---|---|
135
+ | **Distill cards** | on | **compress** a conversation into a sharp card (calls AI, costs money). **Off = store raw text, zero cost** |
136
+ | **Dedup feeds AI** | on | judge if new content is a duplicate (calls AI). **Off = simple dedup**, saves one AI call |
137
+ | Distill output cap | 900 | max chars per compress, bigger = sharper but pricier |
138
+ | Recall min score | 2 | how "close" a match must be to return; bigger = sharper but leaks more (cheaper) |
139
+ | Min capture chars | 200 | too-short chats aren't stored (avoids small-talk waste) |
140
+ | Daily quota | 60 | max cards per day, prevents AI burning money |
141
+
142
+ ### 3. How the service runs
143
+
144
+ | Setting | Default | In plain words |
145
+ |---|---|---|
146
+ | Keep-alive `autoWebMode` | init | `init`=open web once at DSH start; `interval`=periodically check & restart if dead; `manual`=fully manual |
147
+ | Watchdog `watchdogAutoSpawn` | on | a **standalone process** keeps web alive (+47 MB). Personal use can turn off |
148
+ | Auto-mount MCP `autoMcpSetup` | off | **lets Claude Code / Codex / Cursor use your memory**. On = auto-configures them; Off = never touches your config, run `dsh-memory setup` manually |
149
+
150
+ > 💰 **To save money**: turn `Distill cards` off, lower `Distill output cap`, raise `Recall min score`.
151
+
152
+ ### 🎯 One-click presets
153
+
154
+ Top of the config page: **🟢 A Light / 💰 B Budget / ⭐ C Premium** — click to fill, then Save:
155
+
156
+ | Plan | Scenario | Keep-alive | Watchdog | Distill | Distill cap | Recall min | Memory | LLM cost |
157
+ |---|---|---|---|---|---|---|---|---|
158
+ | 🟢 **A Light** | Personal dev (default) | init | off | on | 900 | 2 | ~47 MB | normal |
159
+ | 💰 **B Budget** | Tight budget / many Agents | init | off | **off** | 500 | 3 | ~47 MB | **~0** |
160
+ | ⭐ **C Premium** | Long projects / teams | interval | **on** | on | 1200 | 1 | ~94 MB | high |
161
+
162
+ ---
163
+
164
+ ## 🛡️ Audit Center & Recycle Bin
165
+
166
+ New cards go to the **Audit Center** (`pending`) by default and enter the main vault only after you approve them; rejected ones move to "Rejected", where you can restore or delete to the recycle bin. Cards matching an exemption (audit mode = skip all / exempt agents / exempt kinds) go straight in; recycle-bin cards are recoverable within 30 days, then auto-purged.
167
+
168
+ <p align="center">
169
+ <img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/audit-center.png" width="880" alt="Audit Center" />
170
+ </p>
171
+
172
+ - **Pending / Rejected** tabs, filtered by type / date / agent; select all and approve / reject / delete-to-recycle in one click.
173
+ - Rules in "Memory Config → Auto-audit config": `audit mode` (audit all / skip all) + `exempt agents` + `exempt kinds` + `recycle retention days`.
174
+
175
+ ### 🥇 Why the audit system is more reliable (vs other memory products)
176
+
177
+ Most memory products (mem0 / Zep / agentmemory…) auto-ingest **everything** the moment a conversation ends, good or bad — noise, wrong facts, and sensitive content all go in and get recalled later, **polluting context and amplifying hallucinations**.
178
+
179
+ memory-eternal uses **human-in-the-loop auditing** — only trusted content enters the main vault:
180
+
181
+ | Dimension | Other memory products | memory-eternal audit system |
182
+ |---|---|---|
183
+ | Ingest | Auto-ingest all, no gate | New cards first enter the **Audit Center (`pending`)**, approved before entering the vault |
184
+ | Quality | No filtering of noise/errors | Only cards you've confirmed → more accurate recall, less noise |
185
+ | Traceability | No source/audit trail | Every card carries `submittedBy` author + `pending/approved/rejected` state |
186
+ | No-friction | — | Exempt agents / exempt kinds hit → trusted cards go straight in, zero wait |
187
+ | Safety | Delete = gone forever | Recycle-bin soft delete, recoverable within 30 days |
188
+
189
+ ---
190
+
191
+ ## 🧬 Why Fully Self-built
192
+
193
+ Most memory solutions lean on third-party frameworks / spin up an MCP service / lock memory in a private store. This plugin builds the skeleton itself — **zero third-party runtime deps**, logic readable line by line:
194
+
195
+ | Module | Self-built | Replaces |
196
+ |---|---|---|
197
+ | Dedup | lexical Jaccard bigram (0.62) + semantic dedup | duplicate-card prevention |
198
+ | Retrieval | CJK-aware: Chinese whole-word + char bigram | no full-text search engine needed |
199
+ | Graph | force-directed + `[[wikilink]]`/shared-tag edges | see knowledge links at a glance |
200
+ | Storage | plain `.md` with frontmatter | not locked in, readable, git-able, any tool can read |
201
+
202
+ > Same direction as popular projects (summarize→store→recall), but positioned differently: **local, self-built, zero-dep, readable & controllable**. If you already use mem0/Zep etc., just layer this as a "local persistent memory base".
203
+
204
+ ---
205
+
206
+ ## 🛠 Development / Test
207
+
208
+ ```bash
209
+ npm i
210
+ npm test # unit tests: vault dedup/retrieval/graph + capture pipeline + API shapes
211
+ npm run build # builds lib/client.js (DSH embed) + web/app.js (standalone web bundle)
212
+ ```
213
+
214
+ ---
215
+
216
+ ## 📄 License
217
+
218
+ MIT
219
+
220
+ ---
221
+
222
+ > **Make your AI truly remember: dialogue auto-captured, knowledge at your fingertips.** ⭐ Star it if you like, Let's make AI not forget.
223
+ >
224
+ > 中文 README: [README.md](README.md)
package/README.md ADDED
@@ -0,0 +1,236 @@
1
+ # 🧠 memory-eternal — 给 AI 装「第二大脑」
2
+
3
+ <p align="center">
4
+ <img src="https://img.shields.io/badge/DeepSeek%20Harness-plugin-3B82F6" alt="DSH plugin" />
5
+ <img src="https://img.shields.io/npm/v/memory-eternal" alt="npm version" />
6
+ <img src="https://img.shields.io/github/stars/EternalNight996/memory-eternal?style=flat" alt="GitHub stars" />
7
+ <img src="https://img.shields.io/github/license/EternalNight996/memory-eternal" alt="license" />
8
+ <a href="https://dsh.market/"><img src="https://raw.githubusercontent.com/2BingLing/dsh-market/master/assets/readme/badge-listed-zh.svg" alt="DSH Market 收录" /></a>
9
+ </p>
10
+
11
+ > **对话结束自动沉淀,跨会话不失忆;召回只取相关小块,省 token 少噪音。**
12
+ > 全自研、零第三方记忆框架、不改 DSH 源码、一个记忆库所有 Agent 共享,纯 Markdown 可 git 管理。
13
+
14
+ <p align="center"><strong>⭐ 觉得好用就点个 Star</strong>! <br/><sub>DSH 一条命令:<code>dsh plugin --profile web add memory-eternal</code></sub></p>
15
+
16
+ <p align="center">
17
+ <img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/memory-eternal.gif" width="880" alt="对话自动沉淀 + 图形化知识库 + 知识图谱(演示)" />
18
+ </p>
19
+
20
+ ---
21
+
22
+ ## 🚀 五分钟上手
23
+
24
+ ### 🟦 DeepSeek Harness(DSH)—— 重点
25
+
26
+ **装**(dsh-desktop 用 DSH CLI,一条命令):
27
+
28
+ ```bash
29
+ # dsh-desktop 用户(推荐):DSH CLI 直接装进 profile
30
+ dsh plugin --profile web add memory-eternal
31
+
32
+ # 或直接在 profile(pnpm workspace)里更新。注意用 pnpm,npm install 会报 EUNSUPPORTEDPROTOCOL
33
+ cd ~/.dsh/profiles/web && pnpm add memory-eternal@latest
34
+ ```
35
+
36
+ **重启 dsh web** 后,三样东西立即生效:
37
+
38
+ | 效果 | 在哪看 |
39
+ |---|---|
40
+ | 自动沉淀知识卡 | 每轮对话结束自动发生,无需操作 |
41
+ | `memory_recall` 工具 | Agent 需要历史时自动调用 |
42
+ | 图形化界面 | 侧边栏底部「记忆」按钮 / 设置 → 记忆 |
43
+
44
+ **入口**:侧边栏底部「记忆」按钮 → 记忆库(左栏含 知识卡 / 知识图谱 / 用量 / **审核中心** / 回收中心 / **记忆配置**);「DSH 设置 → 记忆」= 纯配置页。
45
+
46
+ **改配置**:记忆库左栏「记忆配置」(或 DSH 设置 → 记忆)→ DSH 记忆配置 / 成本控制 / 自动审核配置 / 服务自管理,点「保存配置」即写入。`autoWebMode`/`watchdogAutoSpawn` 的改动需重启 DSH 生效。
47
+
48
+ ### 🟨 Claude Code
49
+
50
+ ```bash
51
+ npm i -g memory-eternal # 装 CLI + MCP(写 ~/.claude.json mcpServers.memory)
52
+ dsh-memory connect claude # 写 ~/.claude/settings.json 的 SessionEnd hook → 会话结束自动沉淀
53
+ ```
54
+
55
+ 装完即用:会话里说「recall 一下数据库选型」→ 自动检索记忆;会话结束 → 自动沉淀进统一 `~/.dsh/memory-vault`(新卡 `pending` 待审核)。
56
+
57
+ ### 🟧 Codex CLI / Cursor
58
+
59
+ ```bash
60
+ npm i -g memory-eternal # 装完自动写 Codex config.toml / Cursor mcp.json 的 mcpServers.memory
61
+ dsh-memory connect codex # 写用户级 ~/.codex/hooks.json 的 Stop hook → 会话结束自动沉淀(含 Codex Desktop)
62
+ dsh-memory connect cursor # 写 ~/.cursor/hooks.json 的 stop/sessionEnd hook → 自动沉淀
63
+ ```
64
+
65
+ 重启工具 → MCP 已在列表,会话里直接:`用 memory_recall 查一下项目历史决策`;会话结束自动沉淀进统一 `~/.dsh/memory-vault`(新卡 `pending` 待审核)。
66
+
67
+ > **三种 agent 同一套库**:全部写入 `~/.dsh/memory-vault`,每卡 `submittedBy` 区分作者(DeepSeek Harness / claude-code / codex / cursor),主库只显已审核、审核中心管新卡。
68
+
69
+ > **原生插件(可选,平台 Marketplace)**:仓库含 `.claude-plugin` / `.codex-plugin` / `.cursor-plugin` 清单,可 `claude /plugin marketplace add EternalNight996/memory-eternal` + `/plugin install`、`codex plugin marketplace add EternalNight996/memory-eternal` + `codex plugin add`、Cursor Settings→Plugins。`connect` 走用户级 hooks.json(更稳,不依赖 Marketplace 审核;Codex Desktop 也走这条)。
70
+
71
+ > **只保留本插件(卸载其它记忆插件,如 agentmemory)**:`dsh-memory` 只写自己的键(`mcpServers.memory` / 含 `capture.mjs` 的 hooks),不依赖、也不冲突任何其它记忆插件。卸载其它插件需在其自身配置层删除对应条目(如 Codex 的 `[marketplaces.*]` 与 `hooks.state.*`、其 `hooks.json` 事件、`~/.agentmemory` 数据目录)。
72
+
73
+
74
+
75
+ ### 🟩 浏览器(不依赖任何 Agent)
76
+
77
+ ```bash
78
+ dsh-memory open # 起 web + 开浏览器(默认 http://127.0.0.1:7999)
79
+ ```
80
+
81
+ 统计 / 搜索 / 知识卡(增删改合并导入导出)/ 知识图谱,全在此。与 DSH 内嵌页同一份 UI,数据同步。
82
+
83
+ > **zcode(智谱)**:暂无原生 MCP,经社区 [zcode-open-bridge](https://github.com/tizerluo/zcode-open-bridge) 转 MCP 或用 CLI。
84
+
85
+ ---
86
+
87
+ ## 📖 命令速查
88
+
89
+ ```bash
90
+ dsh-memory recall "数据库选型" # 检索
91
+ dsh-memory capture "重要结论..." # 手动沉淀(- 读 stdin)
92
+ dsh-memory sweep ~/.claude/projects # 挖掘已有会话记录
93
+ dsh-memory setup [--dry-run] # 重跑/预览自动挂载(幂等)
94
+ dsh-memory connect <claude|codex|cursor> # 写会话结束自动沉淀 hook(用户级 hooks.json,含 Codex Desktop)
95
+ dsh-memory mcp # MCP stdio(挂任意 MCP 客户端)
96
+ dsh-memory serve [--port 7999] # 前台跑 web
97
+ dsh-memory open # ensure web 存活 + 开浏览器
98
+ dsh-memory watchdog [--port 7799] # 看门狗保活 web(独立进程)
99
+ ```
100
+
101
+ 单独装(不发 DSH)时 `dsh-memory` 命令来自 `npm i -g`。
102
+
103
+ ---
104
+
105
+ ## ⚙️ 服务自管理(白话)
106
+
107
+ **三个概念**,别搞混:
108
+
109
+ - **web server 怎么保活**(`autoWebMode`)→ `init`=DSH 启动时拉一次(默认);`interval`=DSH 进程内定时探活自动拉起(0 额外内存);`manual`=全手动只从 `dsh-memory open` 起。
110
+ - **看门狗进程**(`watchdogAutoSpawn`,默认开)→ 一个**独立** node 进程,DSH 退出了它也能拉起 web(约 +47 MB 内存)。只在要 7×24 保活时开。
111
+ - **自动挂载 MCP**(`autoMcpSetup`,默认关)→ 是否自动把 MCP 写进 Claude Code/Codex/Cursor 配置。关 = 不碰你本机配置文件,需要时手动 `dsh-memory setup`。
112
+
113
+ **改这些**:记忆库左栏「记忆配置」(或 DSH 设置 → 记忆)→ 表格里改,点「保存配置」;`autoWebMode`/`watchdogAutoSpawn` 需重启 DSH 生效。
114
+
115
+ **MCP 是协议不是常驻服务**:agent 开会话才 spawn,用完即退,没有「开机自启」一说。
116
+
117
+ ### 三种部署强度
118
+
119
+ | 场景 | 配置 | 内存 |
120
+ |---|---|---|
121
+ | 个人开发(默认) | `autoWebMode=init` + `watchdogAutoSpawn=off` | web 47 MB |
122
+ | 常驻 7×24 | `watchdogAutoSpawn=on` | web + watchdog 47+47 MB |
123
+ | 真正开机自启(无 DSH) | Windows 计划任务跑 `dsh-memory watchdog --port 7799 --interval 5000 --max-restart 10` | 同上 |
124
+
125
+ ---
126
+
127
+ ## ⚙️ 记忆配置(大白话)
128
+
129
+ > 所有配置都在 **记忆库左栏「记忆配置」**(或 DSH 设置 → 记忆)里改,点「保存配置」生效。下图就是配置页全貌(含插件信息 / Agent MCP 挂载状态 / 自动审核配置):
130
+
131
+ <p align="center">
132
+ <img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/memory-config.png" width="880" alt="记忆配置页" />
133
+ </p>
134
+
135
+ ### 一、最常用
136
+
137
+ | 配置项 | 默认 | 大白话说明 |
138
+ |---|---|---|
139
+ | 自动沉淀 | 开 | 每轮聊完自动把有用的内容存成知识卡 |
140
+ | 自动召回 | 开 | AI 需要历史时自动帮你查记忆 |
141
+ | 记忆库目录 | `~/.dsh/memory-vault` | 记忆存哪,纯 Markdown 可 git 管理 |
142
+
143
+ ### 二、省钱包(重要)
144
+
145
+ | 配置项 | 默认 | 大白话说明 |
146
+ |---|---|---|
147
+ | **蒸馏知识卡** | 开 | 把对话**压缩**成精炼知识卡(要调 AI,花钱)。**关掉 = 存原文**,一分钱不花 |
148
+ | **语义去重喂 AI** | 开 | 判断新内容是不是重复(要调 AI)。**关掉 = 用简单去重**,省一次 AI 调用 |
149
+ | 蒸馏输出上限 | 900 | 压缩一次最多写多少字,越大越准越费钱 |
150
+ | 召回相关性阈值 | 2 | 检索要「多像」才返回,越大越准但漏得越多(越省) |
151
+ | 捕获最小长度 | 200 | 对话太短不存,避免闲聊浪费 |
152
+ | 日配额 | 60 | 一天最多存几张,防 AI 烧钱 |
153
+
154
+ ### 三、服务怎么跑
155
+
156
+ | 配置项 | 默认 | 大白话说明 |
157
+ |---|---|---|
158
+ | 保活模式 `autoWebMode` | init | `init`=DSH 启动时开一次 web;`interval`=定时检查挂了自动重启;`manual`=全靠手动 |
159
+ | 看门狗 `watchdogAutoSpawn` | 开 | 后台一个**独立进程**保证 web 不死(+47 MB 内存)。个人用可关 |
160
+ | 自动挂载 MCP `autoMcpSetup` | 关 | **让 Claude Code / Codex / Cursor 也能用你的记忆库**。开=自动配好它们;关=不碰你电脑配置,手动跑 `dsh-memory setup` |
161
+
162
+ > 💰 **想省钱**:把「蒸馏知识卡」关掉、调低「蒸馏输出上限」、调高「召回相关性阈值」。
163
+
164
+ ### 🎯 一键推荐配置(按场景点一下)
165
+
166
+ 配置页顶部有 **🟢 A 轻量省心 / 💰 B 极致省钱 / ⭐ C 高质量** 三个按钮,点一下自动填好对应值,再点保存即可:
167
+
168
+ | 方案 | 场景 | 保活 | 看门狗 | 蒸馏 | 蒸馏上限 | 召回阈值 | 内存 | LLM 成本 |
169
+ |---|---|---|---|---|---|---|---|---|
170
+ | 🟢 **A 轻量省心** | 个人开发(默认)| init | 关 | 开 | 900 | 2 | ~47 MB | 正常 |
171
+ | 💰 **B 极致省钱** | 预算敏感/多 Agent | init | 关 | **关** | 500 | 3 | ~47 MB | **近 0** |
172
+ | ⭐ **C 高质量** | 长项目/团队 | interval | **开** | 开 | 1200 | 1 | ~94 MB | 高 |
173
+
174
+ ---
175
+
176
+ ## 🛡️ 审核中心 & 回收中心
177
+
178
+ 新卡默认进**审核中心**(`pending`),由你确认后才入主库;驳回的进「已驳回」,可恢复或删除进回收站。命中免审条件(审核模式=全部免审 / 免审智能体 / 免审类型)的新卡直接入库;回收站软删卡 30 天内可恢复,超期自动永久删除。
179
+
180
+ <p align="center">
181
+ <img src="https://raw.githubusercontent.com/EternalNight996/memory-eternal/main/assets/screen/audit-center.png" width="880" alt="审核中心" />
182
+ </p>
183
+
184
+ - **待审核 / 已驳回** 双页签,按类型 / 日期 / 智能体筛选,全选后一键「批准 / 驳回 / 删除进回收站」。
185
+ - 审核规则在「记忆配置 → 自动审核配置」:`审核模式`(全部要审 / 全部免审)+ `免审智能体` + `免审类型` + `回收保留天数`。
186
+
187
+ ### 🥇 为什么审核系统更靠谱(对比其它记忆产品)
188
+
189
+ 多数记忆产品(mem0 / Zep / agentmemory…)对话一结束就**自动全量入库**,好坏不论——噪音、错误事实、敏感内容一起进库,之后又被召回,**污染上下文、放大幻觉**。
190
+
191
+ memory-eternal 走**人机协同审核**,只让可信内容进主库:
192
+
193
+ | 维度 | 其它记忆产品 | memory-eternal 审核系统 |
194
+ |---|---|---|
195
+ | 入库 | 自动全量,无把关 | 新卡先进**审核中心(pending)**,人工批准才入主库 |
196
+ | 质量 | 未过滤噪音/错误 | 只保留你确认过的卡 → 召回更准、噪声更低 |
197
+ | 可信 | 无来源/审核追溯 | 每卡带 `submittedBy` 作者 + `pending/approved/rejected` 审核状态 |
198
+ | 免打扰 | — | 免审智能体 / 免审类型命中 → 可信卡直接入库,零等待 |
199
+ | 容错 | 删了就没 | 回收站软删,30 天内可恢复 |
200
+
201
+ ---
202
+
203
+ ## 🧬 为什么全自研
204
+
205
+ 市面上记忆方案多,但大多依赖第三方框架 / 动不动起 MCP 服务 / 记忆锁私有库。本插件把骨架自己搭,**零第三方运行时依赖**,逻辑逐行可读:
206
+
207
+ | 模块 | 自研实现 | 替代什么 |
208
+ |---|---|---|
209
+ | 去重 | 词法 Jaccard bigram(0.62)+ 语义去重 | 防重复卡 |
210
+ | 检索 | CJK 感知:中文整词 + 字符 bigram | 无需全文搜索引擎 |
211
+ | 图谱 | 力导向 + `[[wikilink]]`/共享标签连边 | 知识关联一眼看清 |
212
+ | 存储 | 带 frontmatter 的普通 `.md` | 不锁库、可读、可 git、可被任意工具读 |
213
+
214
+ > 与热门项目同向(总结→存储→按需召回),但定位不同:**本地、自研、零依赖、可读可控**。如果你已在用 mem0/Zep 等,也能把它当「本地持久记忆底座」叠加使用。
215
+
216
+ ---
217
+
218
+ ## 🛠 开发 / 测试
219
+
220
+ ```bash
221
+ npm i
222
+ npm test # 单元测试:vault 去重/检索/图谱 + capture 管线 + API 形状
223
+ npm run build # 构建 lib/client.js(DSH 内嵌)+ web/app.js(独立 web bundle)
224
+ ```
225
+
226
+ ---
227
+
228
+ ## 📄 License
229
+
230
+ MIT
231
+
232
+ ---
233
+
234
+ > **让 AI 真正记住你:对话自动沉淀,知识随手可查。** ⭐ 觉得有用就点个 Star,Let's make AI not forget.
235
+ >
236
+ > English README: [README.en.md](README.en.md)