dsh-mnemon 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.
Files changed (145) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +169 -0
  3. package/README.md +169 -0
  4. package/cordis.patch.yml +15 -0
  5. package/docs/README.md +8 -0
  6. package/docs/en/README.md +39 -0
  7. package/docs/en/architecture.md +129 -0
  8. package/docs/en/assets/project-architecture.svg +182 -0
  9. package/docs/en/configuration.md +204 -0
  10. package/docs/en/development.md +178 -0
  11. package/docs/en/getting-started.md +147 -0
  12. package/docs/en/interfaces.md +159 -0
  13. package/docs/en/operations.md +151 -0
  14. package/docs/en/project-overview.md +247 -0
  15. package/docs/en/roadmap.md +41 -0
  16. package/docs/en/storage-model.md +179 -0
  17. package/docs/en/workflows.md +290 -0
  18. package/docs/zh-CN/README.md +39 -0
  19. package/docs/zh-CN/architecture.md +129 -0
  20. package/docs/zh-CN/assets/project-architecture.svg +182 -0
  21. package/docs/zh-CN/assets/screenshots/conversation-recall.png +0 -0
  22. package/docs/zh-CN/assets/screenshots/conversation-writeback.png +0 -0
  23. package/docs/zh-CN/assets/screenshots/documents-markdown.png +0 -0
  24. package/docs/zh-CN/assets/screenshots/entities-context.png +0 -0
  25. package/docs/zh-CN/assets/screenshots/memory-content.png +0 -0
  26. package/docs/zh-CN/assets/screenshots/overview-memory-graph.png +0 -0
  27. package/docs/zh-CN/assets/screenshots/recall-agent-answer.png +0 -0
  28. package/docs/zh-CN/assets/screenshots/runtime-memory.png +0 -0
  29. package/docs/zh-CN/configuration.md +204 -0
  30. package/docs/zh-CN/development.md +178 -0
  31. package/docs/zh-CN/getting-started.md +147 -0
  32. package/docs/zh-CN/interfaces.md +159 -0
  33. package/docs/zh-CN/operations.md +151 -0
  34. package/docs/zh-CN/project-overview.md +247 -0
  35. package/docs/zh-CN/roadmap.md +41 -0
  36. package/docs/zh-CN/storage-model.md +179 -0
  37. package/docs/zh-CN/workflows.md +290 -0
  38. package/lib/client.js +6288 -0
  39. package/lib/client.js.map +1 -0
  40. package/lib/index.js +4453 -0
  41. package/lib/types/client/MnemonLogo.d.ts +7 -0
  42. package/lib/types/client/MnemonLogo.d.ts.map +1 -0
  43. package/lib/types/client/MnemonLogo.js +6 -0
  44. package/lib/types/client/MnemonLogo.js.map +1 -0
  45. package/lib/types/client/MnemonSettingsCard.d.ts +9 -0
  46. package/lib/types/client/MnemonSettingsCard.d.ts.map +1 -0
  47. package/lib/types/client/MnemonSettingsCard.js +109 -0
  48. package/lib/types/client/MnemonSettingsCard.js.map +1 -0
  49. package/lib/types/client/MnemonView.d.ts +11 -0
  50. package/lib/types/client/MnemonView.d.ts.map +1 -0
  51. package/lib/types/client/MnemonView.js +1239 -0
  52. package/lib/types/client/MnemonView.js.map +1 -0
  53. package/lib/types/client/api.d.ts +68 -0
  54. package/lib/types/client/api.d.ts.map +1 -0
  55. package/lib/types/client/api.js +80 -0
  56. package/lib/types/client/api.js.map +1 -0
  57. package/lib/types/client/index.d.ts +4 -0
  58. package/lib/types/client/index.d.ts.map +1 -0
  59. package/lib/types/client/index.js +36 -0
  60. package/lib/types/client/index.js.map +1 -0
  61. package/lib/types/client/locales.d.ts +1054 -0
  62. package/lib/types/client/locales.d.ts.map +1 -0
  63. package/lib/types/client/locales.js +1062 -0
  64. package/lib/types/client/locales.js.map +1 -0
  65. package/lib/types/client/settings.d.ts +17 -0
  66. package/lib/types/client/settings.d.ts.map +1 -0
  67. package/lib/types/client/settings.js +49 -0
  68. package/lib/types/client/settings.js.map +1 -0
  69. package/lib/types/commands.d.ts +6 -0
  70. package/lib/types/commands.d.ts.map +1 -0
  71. package/lib/types/commands.js +100 -0
  72. package/lib/types/commands.js.map +1 -0
  73. package/lib/types/config-values.d.ts +4 -0
  74. package/lib/types/config-values.d.ts.map +1 -0
  75. package/lib/types/config-values.js +4 -0
  76. package/lib/types/config-values.js.map +1 -0
  77. package/lib/types/config.d.ts +49 -0
  78. package/lib/types/config.d.ts.map +1 -0
  79. package/lib/types/config.js +55 -0
  80. package/lib/types/config.js.map +1 -0
  81. package/lib/types/contracts.d.ts +272 -0
  82. package/lib/types/contracts.d.ts.map +1 -0
  83. package/lib/types/contracts.js +2 -0
  84. package/lib/types/contracts.js.map +1 -0
  85. package/lib/types/documents.d.ts +149 -0
  86. package/lib/types/documents.d.ts.map +1 -0
  87. package/lib/types/documents.js +503 -0
  88. package/lib/types/documents.js.map +1 -0
  89. package/lib/types/guidance.d.ts +9 -0
  90. package/lib/types/guidance.d.ts.map +1 -0
  91. package/lib/types/guidance.js +18 -0
  92. package/lib/types/guidance.js.map +1 -0
  93. package/lib/types/index.d.ts +15 -0
  94. package/lib/types/index.d.ts.map +1 -0
  95. package/lib/types/index.js +45 -0
  96. package/lib/types/index.js.map +1 -0
  97. package/lib/types/lifecycle.d.ts +75 -0
  98. package/lib/types/lifecycle.d.ts.map +1 -0
  99. package/lib/types/lifecycle.js +380 -0
  100. package/lib/types/lifecycle.js.map +1 -0
  101. package/lib/types/memory-bodies.d.ts +47 -0
  102. package/lib/types/memory-bodies.d.ts.map +1 -0
  103. package/lib/types/memory-bodies.js +160 -0
  104. package/lib/types/memory-bodies.js.map +1 -0
  105. package/lib/types/process.d.ts +14 -0
  106. package/lib/types/process.d.ts.map +1 -0
  107. package/lib/types/process.js +65 -0
  108. package/lib/types/process.js.map +1 -0
  109. package/lib/types/review-activity.d.ts +33 -0
  110. package/lib/types/review-activity.d.ts.map +1 -0
  111. package/lib/types/review-activity.js +37 -0
  112. package/lib/types/review-activity.js.map +1 -0
  113. package/lib/types/rpc.d.ts +12 -0
  114. package/lib/types/rpc.d.ts.map +1 -0
  115. package/lib/types/rpc.js +225 -0
  116. package/lib/types/rpc.js.map +1 -0
  117. package/lib/types/runner.d.ts +29 -0
  118. package/lib/types/runner.d.ts.map +1 -0
  119. package/lib/types/runner.js +150 -0
  120. package/lib/types/runner.js.map +1 -0
  121. package/lib/types/runtime-memory.d.ts +104 -0
  122. package/lib/types/runtime-memory.d.ts.map +1 -0
  123. package/lib/types/runtime-memory.js +415 -0
  124. package/lib/types/runtime-memory.js.map +1 -0
  125. package/lib/types/service.d.ts +173 -0
  126. package/lib/types/service.d.ts.map +1 -0
  127. package/lib/types/service.js +508 -0
  128. package/lib/types/service.js.map +1 -0
  129. package/lib/types/settings.d.ts +6 -0
  130. package/lib/types/settings.d.ts.map +1 -0
  131. package/lib/types/settings.js +75 -0
  132. package/lib/types/settings.js.map +1 -0
  133. package/lib/types/storage-scope.d.ts +39 -0
  134. package/lib/types/storage-scope.d.ts.map +1 -0
  135. package/lib/types/storage-scope.js +179 -0
  136. package/lib/types/storage-scope.js.map +1 -0
  137. package/lib/types/subagent.d.ts +97 -0
  138. package/lib/types/subagent.d.ts.map +1 -0
  139. package/lib/types/subagent.js +619 -0
  140. package/lib/types/subagent.js.map +1 -0
  141. package/lib/types/tools.d.ts +8 -0
  142. package/lib/types/tools.d.ts.map +1 -0
  143. package/lib/types/tools.js +328 -0
  144. package/lib/types/tools.js.map +1 -0
  145. package/package.json +111 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-external contributors
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,169 @@
1
+ <h1 align="center">dsh-mnemon</h1>
2
+
3
+ <p align="center"><a href="./README.md">简体中文</a> | <strong>English</strong></p>
4
+
5
+ <p align="center">
6
+ <a href="./docs/en/project-overview.md">
7
+ <img src="./docs/assets/dsh-mnemon-memory-system-demo-poster.jpg" alt="Mnemon Memory Spaces page with the multi-space catalog, activation state, and live relationship graph" width="720">
8
+ </a>
9
+ </p>
10
+
11
+ > **A deep integration of [Mnemon](https://github.com/mnemon-dev/mnemon) and DSH that gives DSH comprehensive memory capabilities.**
12
+
13
+ `dsh-mnemon` is a local Mnemon memory plugin for DeepSeek Harness (DSH). It organizes always-available runtime memory, readable project Documents, and on-demand long-term Memory Spaces into a supervised, searchable, maintainable three-tier system.
14
+
15
+ The plugin brings Mnemon's durable Memory Space capabilities into DSH and adds Runtime Memory, Documents, lifecycle integration, bounded subagents, the WebUI, commands, and permission boundaries. Current user instructions and repository facts always take precedence over historical memory.
16
+
17
+ > **What's more?** More DSH-native capabilities are on the way. **Memory to View.**
18
+
19
+ ## Live demo
20
+
21
+ ![dsh-mnemon memory system walkthrough covering status, Runtime Memory, the multi-space graph, Documents, recall, entities, and supervised writeback](./docs/assets/dsh-mnemon-memory-system-demo.gif)
22
+
23
+ ## Three memory tiers
24
+
25
+ | Tier | What belongs here | How it is retained | How it reaches context |
26
+ |---|---|---|---|
27
+ | Runtime Memory | User preferences, stable conventions, environment facts, frequently used lessons | Explicit operations or an eligible background review update `memories.json`, then generate `USER.md` / `MEMORY.md` projections | Injected directly every turn |
28
+ | Project Documents | Designs, investigations, procedures, rationale, and handoffs | Create or update managed Markdown and `index.json`; capacity maintenance creates a Mnemon cold reference before moving the original | Search active Documents first, then read full text on demand |
29
+ | Memory Spaces | Cross-session facts, decisions, entities, and relationships | A bounded `spawn` worker selects the narrowest space, checks duplicates, and writes four-graph memory through Mnemon `remember` / `link` | Recalled on demand from active Memory Spaces only |
30
+
31
+ ```text
32
+ Reusable knowledge produced by current work
33
+ |
34
+ +-- Compact, stable, useful every turn
35
+ | root Agent / eligible fork review
36
+ | |
37
+ | add | replace | remove
38
+ | v
39
+ | memories.json (source of truth)
40
+ | |
41
+ | USER.md + MEMORY.md ----------> every prompt
42
+ |
43
+ +-- Complete designs, research, procedures, handoffs
44
+ | root Agent / eligible fork review
45
+ | |
46
+ | create | update
47
+ | v
48
+ | index.json + active/*.md ------> full text after search
49
+ | |
50
+ | Mnemon cold reference -> archived/*.md (maintenance)
51
+ |
52
+ `-- Cross-session facts, decisions, entities, relations
53
+ root Agent
54
+ |
55
+ spawn: route / deduplicate / write
56
+ v
57
+ Mnemon CLI -> <space>/mnemon.db
58
+ |
59
+ spawn: recall active spaces only -> bounded evidence
60
+ ```
61
+
62
+ ## Highlights
63
+
64
+ - Proactive memory routing: built-in prompts, lifecycle cues, and tool descriptions encourage the LLM to use every read/write surface when useful; explicit requests to revisit, retain, correct, forget, or document are routed to the matching tier and operation.
65
+ - One `global`, `workspace`, or `custom` storage scope for all three tiers.
66
+ - A Memory Space directory in which each space has a stable ID, name, routing description, activation state, and its own `mnemon.db`.
67
+ - Bounded subagents: isolated `spawn` workers handle durable recall and semantic writes; a `fork` worker inherits a completed checkpoint for background review.
68
+ - Safe capacity maintenance: USER memory is compacted locally, MEMORY entries are archived before compaction, and Documents are cold-indexed before migration; revision conflicts preserve the original data.
69
+ - Native DSH integration through model tools, `/mnemon` commands, a bilingual Web workspace, global light/dark themes, and diagnostics.
70
+ - Local-first execution: the CLI is started with argument arrays and no shell, and no remote memory service is required.
71
+
72
+ ## Prerequisites
73
+
74
+ - A working DSH Web profile.
75
+ - A local `mnemon` CLI.
76
+ - A subagent provider supporting `outputSchema`, `toolFilter`, `persona`, and `depthLimit`. Regular semantic work prefers `spawn`; the default background review also requires a provider named `fork` that inherits parent context.
77
+
78
+ ## Quick start
79
+
80
+ Install Mnemon:
81
+
82
+ ```sh
83
+ # macOS
84
+ brew install --cask mnemon-dev/tap/mnemon
85
+
86
+ # macOS / Linux via Go
87
+ go install github.com/mnemon-dev/mnemon@latest
88
+
89
+ mnemon --version
90
+ ```
91
+
92
+ Install the plugin and restart the DSH Web profile:
93
+
94
+ ```sh
95
+ dsh plugin --profile web add dsh-mnemon
96
+ dsh --profile web
97
+ ```
98
+
99
+ Pre-release builds not yet published to npm can be installed from git:
100
+
101
+ ```sh
102
+ dsh plugin --profile web add "github:omdsh-dev/dsh-mnemon"
103
+ ```
104
+
105
+ For a local checkout, use an absolute path:
106
+
107
+ ```sh
108
+ dsh plugin --profile web add "link:/absolute/path/to/dsh-mnemon"
109
+ ```
110
+
111
+ Open “Settings -> Plugin Configuration -> Mnemon” to select a storage scope, then create or activate a Memory Space in the conversation's “Memory System” tab. Configuration applies after restart. Changing the scope never migrates, merges, or deletes old data automatically.
112
+
113
+ ## Minimal configuration
114
+
115
+ Configuration lives in `$DSH_HOME/settings.yaml` (commonly `~/.dsh/settings.yaml` by default):
116
+
117
+ ```yaml
118
+ mnemon:
119
+ storageScope: global # global | workspace | custom
120
+ ```
121
+
122
+ - `global`: `MNEMON_DATA_DIR`, or `~/.mnemon` when unset.
123
+ - `workspace`: `.mnemon` under the DSH Host launch directory.
124
+ - `custom`: an absolute or `~/...` path supplied through `dataDir`.
125
+
126
+ See the [configuration reference](./docs/en/configuration.md) for every option, precedence rules, and read-only mode.
127
+
128
+ ## Entry points
129
+
130
+ The Web workspace contains Status, Runtime, Memory Spaces, Documents, Distill, Recall, Entities, and Content pages in three divider-separated groups: “Status” stands alone; “Runtime, Memory Spaces, Documents” cover the three storage tiers; “Distill, Recall, Entities, Content” are the read/write tools. Its main interface follows DSH's global Chinese/English locale.
131
+
132
+ Common commands:
133
+
134
+ ```text
135
+ /mnemon status
136
+ /mnemon recall <query>
137
+ /mnemon related <full memory ID>
138
+ /mnemon remember <stable, self-contained durable insight>
139
+ /mnemon forget <full memory ID>
140
+ ```
141
+
142
+ The recommended lookup order is: hot memory -> active Documents -> active Memory Spaces -> the archived original referenced by a hit. Do not persist temporary progress, raw logs, secrets, or ordinary facts that can be recovered directly from the repository.
143
+
144
+ ## Documentation
145
+
146
+ - [Documentation hub](./docs/en/README.md)
147
+ - [Project overview](./docs/en/project-overview.md)
148
+ - [Getting started](./docs/en/getting-started.md)
149
+ - [Architecture](./docs/en/architecture.md)
150
+ - [Storage and three-tier memory model](./docs/en/storage-model.md)
151
+ - [Lifecycle and workflows](./docs/en/workflows.md)
152
+ - [Configuration reference](./docs/en/configuration.md)
153
+ - [WebUI, tools, commands, and RPC](./docs/en/interfaces.md)
154
+ - [Operations, security, and troubleshooting](./docs/en/operations.md)
155
+ - [Development and verification](./docs/en/development.md)
156
+ - [Roadmap](./docs/en/roadmap.md)
157
+
158
+ ## Development
159
+
160
+ ```sh
161
+ pnpm install
162
+ pnpm run verify
163
+ ```
164
+
165
+ `verify` runs TypeScript checks, Vitest, and the production build. Generated artifacts are written to and committed under `lib/`. See the [development guide](./docs/en/development.md) for release and real-WebUI validation procedures.
166
+
167
+ ## License
168
+
169
+ MIT.
package/README.md ADDED
@@ -0,0 +1,169 @@
1
+ <h1 align="center">dsh-mnemon</h1>
2
+
3
+ <p align="center"><strong>简体中文</strong> | <a href="./README.en.md">English</a></p>
4
+
5
+ <p align="center">
6
+ <a href="./docs/zh-CN/project-overview.md">
7
+ <img src="./docs/assets/dsh-mnemon-memory-system-demo-poster.jpg" alt="Mnemon 记忆体页:多记忆体目录、激活状态与实时关系图" width="720">
8
+ </a>
9
+ </p>
10
+
11
+ > **[Mnemon](https://github.com/mnemon-dev/mnemon) 与 DSH 的深度集成,为 DSH 提供完备的记忆系统能力。**
12
+
13
+ `dsh-mnemon` 是 DeepSeek Harness(DSH)的本地 Mnemon 记忆插件。它把每轮可见的运行时热记忆、可直接阅读的项目档案(Documents)和按需召回的长期记忆体(Memory Spaces)组织成一个受监督、可检索、可维护的三层体系。
14
+
15
+ 插件把 Mnemon 的长期记忆体能力接入 DSH,并补充 Runtime Memory、Documents、生命周期、受限子 Agent、WebUI、命令和权限边界。当前用户指令和仓库事实始终高于历史记忆。
16
+
17
+ > **What's more?** 更多 DSH Native 能力支持正在路上。**Memory to View.**
18
+
19
+ ## 实机演示
20
+
21
+ ![dsh-mnemon 记忆系统实机演示:状态、运行时记忆、多记忆体图谱、档案、检索、实体与监督写回](./docs/assets/dsh-mnemon-memory-system-demo.gif)
22
+
23
+ ## 三层记忆
24
+
25
+ | 层级 | 适合保存 | 如何记住 | 如何进入上下文 |
26
+ |---|---|---|---|
27
+ | 运行时热记忆 | 用户偏好、稳定约定、环境事实、常用经验 | 显式操作或合格的后台审查更新 `memories.json`,再生成 `USER.md` / `MEMORY.md` 投影 | 每轮直接注入 |
28
+ | 项目档案 | 设计、调查、流程、架构理由、交接材料 | 创建或更新受管 Markdown 与 `index.json`;整理容量时先建立 Mnemon 冷引用,再迁移原文 | 先检索 active Documents,再按需读取全文 |
29
+ | 记忆体 | 跨会话的长期事实、决策、实体与关系 | 受限 `spawn` worker 选择最窄空间并查重,通过 Mnemon `remember` / `link` 写入四图 | 只从已激活 Memory Spaces 按需召回 |
30
+
31
+ ```text
32
+ 当前任务产生的可复用信息
33
+ |
34
+ +-- 短小、稳定、每轮常用
35
+ | 主 Agent / 合格的 fork 审查
36
+ | |
37
+ | add | replace | remove
38
+ | v
39
+ | memories.json(权威源)
40
+ | |
41
+ | USER.md + MEMORY.md ----------> 每轮 prompt
42
+ |
43
+ +-- 完整设计、调查、流程与交接
44
+ | 主 Agent / 合格的 fork 审查
45
+ | |
46
+ | create | update
47
+ | v
48
+ | index.json + active/*.md ------> 检索后按需全文
49
+ | |
50
+ | Mnemon 冷引用 -> archived/*.md(容量整理)
51
+ |
52
+ `-- 跨会话事实、决策、实体与关系
53
+ 主 Agent
54
+ |
55
+ spawn:选空间 / 查重 / 写入
56
+ v
57
+ Mnemon CLI -> <space>/mnemon.db
58
+ |
59
+ spawn:仅召回 active 空间 -------> 有界证据
60
+ ```
61
+
62
+ ## 核心能力
63
+
64
+ - 主动记忆路由:内置 Prompt、生命周期提示与工具说明会启发 LLM 按需调用全部读写能力;用户明确要求回顾、记住、修改、忘记或建档时,会自动选择对应层级和操作。
65
+ - 统一的 `global`、`workspace` 或 `custom` 存储范围,覆盖三层数据。
66
+ - 多记忆体目录:每个记忆体拥有稳定 ID、名称、路由说明、激活状态和独立 `mnemon.db`。
67
+ - 受限子 Agent:长期召回与语义写入使用隔离的 `spawn` worker;后台审查使用继承已完成 checkpoint 的 `fork` worker。
68
+ - 可靠容量维护:USER 热记忆在本地保守合并,MEMORY 热记忆先归档再压缩,Documents 先建立冷索引再迁移;revision 冲突时保留原数据。
69
+ - DSH 原生体验:模型工具、`/mnemon` 命令、双语 Web 工作台、全局明暗主题和诊断状态页。
70
+ - 本地优先:CLI 以参数数组启动且禁用 shell;数据库和文档不需要远程记忆服务。
71
+
72
+ ## 前置条件
73
+
74
+ - 可用的 DSH Web profile。
75
+ - 本地 `mnemon` CLI。
76
+ - 支持 `outputSchema`、`toolFilter`、`persona` 和 `depthLimit` 的子 Agent provider。常规语义操作优先使用 `spawn`;默认后台审查还需要名为 `fork`、可继承父上下文的 provider。
77
+
78
+ ## 快速开始
79
+
80
+ 安装 Mnemon:
81
+
82
+ ```sh
83
+ # macOS
84
+ brew install --cask mnemon-dev/tap/mnemon
85
+
86
+ # macOS / Linux,也可通过 Go 安装
87
+ go install github.com/mnemon-dev/mnemon@latest
88
+
89
+ mnemon --version
90
+ ```
91
+
92
+ 安装插件并重启 DSH Web profile:
93
+
94
+ ```sh
95
+ dsh plugin --profile web add dsh-mnemon
96
+ dsh --profile web
97
+ ```
98
+
99
+ 未发布到 npm 的预发布版本可从 git 安装:
100
+
101
+ ```sh
102
+ dsh plugin --profile web add "github:omdsh-dev/dsh-mnemon"
103
+ ```
104
+
105
+ 本地开发检出使用绝对路径:
106
+
107
+ ```sh
108
+ dsh plugin --profile web add "link:/absolute/path/to/dsh-mnemon"
109
+ ```
110
+
111
+ 打开 DSH 的“设置 -> 插件配置 -> Mnemon”选择存储范围,再进入会话的“记忆系统”Tab 创建或激活记忆体。配置重启后生效;切换范围不会自动迁移、合并或删除旧数据。
112
+
113
+ ## 最小配置
114
+
115
+ 配置位于 `$DSH_HOME/settings.yaml`(默认通常为 `~/.dsh/settings.yaml`):
116
+
117
+ ```yaml
118
+ mnemon:
119
+ storageScope: global # global | workspace | custom
120
+ ```
121
+
122
+ - `global`:`MNEMON_DATA_DIR`,未设置时为 `~/.mnemon`。
123
+ - `workspace`:启动 DSH Host 时工作目录下的 `.mnemon`。
124
+ - `custom`:`dataDir` 指定的绝对路径或 `~/...` 路径。
125
+
126
+ 完整配置、覆盖优先级和只读模式见[配置参考](./docs/zh-CN/configuration.md)。
127
+
128
+ ## 使用入口
129
+
130
+ Web 工作台提供状态、运行时、记忆体、档案、沉淀、检索、实体、内容八个页面,分为三组:「状态」独立成第一组;「运行时、记忆体、档案」对应三层存储;「沉淀、检索、实体、内容」为读写工具。主要界面随 DSH 全局语言在中文与英文间切换。
131
+
132
+ 常用命令:
133
+
134
+ ```text
135
+ /mnemon status
136
+ /mnemon recall <查询>
137
+ /mnemon related <完整记忆 ID>
138
+ /mnemon remember <稳定、自包含的长期洞察>
139
+ /mnemon forget <完整记忆 ID>
140
+ ```
141
+
142
+ 推荐的查询顺序是:热记忆 -> active Documents -> 已激活记忆体 -> 命中记录指向的归档原文。不要把临时进度、原始日志、秘密或可直接从仓库重新获得的普通事实写入长期记忆。
143
+
144
+ ## 文档
145
+
146
+ - [文档中心](./docs/zh-CN/README.md)
147
+ - [项目介绍](./docs/zh-CN/project-overview.md)
148
+ - [快速开始](./docs/zh-CN/getting-started.md)
149
+ - [架构设计](./docs/zh-CN/architecture.md)
150
+ - [存储与三层记忆模型](./docs/zh-CN/storage-model.md)
151
+ - [生命周期与核心流程](./docs/zh-CN/workflows.md)
152
+ - [配置参考](./docs/zh-CN/configuration.md)
153
+ - [WebUI、工具、命令与 RPC](./docs/zh-CN/interfaces.md)
154
+ - [运维、安全与故障排查](./docs/zh-CN/operations.md)
155
+ - [开发与验证](./docs/zh-CN/development.md)
156
+ - [Roadmap](./docs/zh-CN/roadmap.md)
157
+
158
+ ## 开发
159
+
160
+ ```sh
161
+ pnpm install
162
+ pnpm run verify
163
+ ```
164
+
165
+ `verify` 依次运行 TypeScript 检查、Vitest 测试和生产构建。构建产物写入并提交到 `lib/`;详细发布与真实 WebUI 验证流程见[开发文档](./docs/zh-CN/development.md)。
166
+
167
+ ## License
168
+
169
+ MIT。
@@ -0,0 +1,15 @@
1
+ # Mount the Mnemon bridge into a DSH profile. The profile's own final patch
2
+ # may replace this config row to select an explicit binary or data directory.
3
+ - insert:
4
+ - id: mnemon
5
+ name: dsh-mnemon
6
+ config:
7
+ routingGuidance: true
8
+ lifecycleEnabled: true
9
+ recallMode: guided
10
+ writebackMode: guided
11
+ idleReviewMs: 30000
12
+ tabEnabled: true
13
+ writeEnabled: true
14
+ timeoutMs: 10000
15
+ defaultRecallLimit: 10
package/docs/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # dsh-mnemon 文档 / Documentation
2
+
3
+ - [简体中文](./zh-CN/README.md)
4
+ - [English](./en/README.md)
5
+
6
+ 根目录 README 只保留项目概览和快速开始;架构、数据模型、生命周期、接口、运维和开发细节在此维护。
7
+
8
+ The root README stays focused on orientation and quick start. Architecture, data model, lifecycle, interfaces, operations, and development details live here.
@@ -0,0 +1,39 @@
1
+ # dsh-mnemon Documentation
2
+
3
+ [简体中文](../zh-CN/README.md) | **English** | [Back to project home](../../README.en.md)
4
+
5
+ These documents use the current implementation as the source of truth. The root README provides a quick overview; this section expands on design rationale, boundaries, transactional workflows, configuration, and operations.
6
+
7
+ ## Recommended Reading Path
8
+
9
+ 1. [Project Overview](./project-overview.md): project positioning, the Mnemon-to-DSH integration boundary, the three-tier model, system architecture, and good fits.
10
+ 2. [Getting Started](./getting-started.md): installation, initial configuration, and basic verification.
11
+ 3. [Architecture](./architecture.md): boundaries between the DSH Host, Web Client, control layer, subagents, and the Mnemon CLI.
12
+ 4. [Storage and the Three-Layer Memory Model](./storage-model.md): semantics and directory layout of Runtime Memory, Documents, and Memory Spaces.
13
+ 5. [Lifecycle and Core Workflows](./workflows.md): recall, writes, background review, capacity maintenance, and archiving.
14
+ 6. [Configuration Reference](./configuration.md): all settings, defaults, precedence, and provider requirements.
15
+ 7. [WebUI, Tools, Commands, and RPC](./interfaces.md): all user-facing and model-facing entry points.
16
+ 8. [Operations, Security, and Troubleshooting](./operations.md): locks, permissions, backup, recovery, and known limitations.
17
+ 9. [Development and Verification](./development.md): module structure, tests, builds, and release checks.
18
+ 10. [Roadmap](./roadmap.md): unfinished reliability, operations, and internationalization work.
19
+
20
+ ## Terminology
21
+
22
+ | 中文 | English | Meaning |
23
+ |---|---|---|
24
+ | 记忆体 | Memory Space | A native named Mnemon Store with its own `mnemon.db` |
25
+ | 运行时热记忆 | Runtime Memory / hot memory | Compact user profile and working memory injected directly into every turn |
26
+ | 项目档案 | Project Documents | Complete Markdown project knowledge managed by the plugin |
27
+ | 活跃档案 | Active Document | A Document included in default near-field search |
28
+ | 归档 | Archive | Original text that has a long-term index and does not count toward active capacity |
29
+ | 沉淀 | Distill / supervised writeback | Persistent writes after LLM judgment, deduplication, and routing |
30
+ | 召回 | Recall | Reading historical evidence from active Memory Spaces |
31
+
32
+ Brand names, commands, tool names, configuration keys, RPC endpoints, and code symbols remain untranslated.
33
+
34
+ ## Documentation Boundaries
35
+
36
+ - Current user instructions and repository facts take precedence over historical memory.
37
+ - `state/` is currently reserved; background review watermarks still exist only in Host process memory.
38
+ - The main Web workspace is available in Chinese and English; command output, tool cards, and some backend diagnostics are not yet fully internationalized.
39
+ - `docs/sedimentation-research.md` is a historical research record, not a specification or user guide.
@@ -0,0 +1,129 @@
1
+ # Architecture
2
+
3
+ [简体中文](../zh-CN/architecture.md) | **English** | [Documentation Center](./README.md)
4
+
5
+ ## Positioning
6
+
7
+ `dsh-mnemon` is an integration and supervision layer between DSH and Mnemon, not a new database engine:
8
+
9
+ - DSH provides the root Agent, lifecycle events, subagent providers, tools, commands, settings, and Web extension points;
10
+ - the plugin provides the control plane for three knowledge layers, routing policies, transactional barriers, and UI;
11
+ - the local `mnemon` CLI provides named Stores, SQLite persistence, four graph types, recall, relationships, and soft deletion.
12
+
13
+ ## Component Diagram
14
+
15
+ [![dsh-mnemon runtime architecture](./assets/project-architecture.svg)](./assets/project-architecture.svg)
16
+
17
+ Solid lines show deterministic data or control paths; purple dashed lines show LLM-supervised paths. Runtime Memory and Documents use managed files directly. Only Memory Spaces call the local Mnemon CLI through `MnemonRunner`. Click the image to open the original SVG.
18
+
19
+ ## Host Composition Root
20
+
21
+ `src/index.ts::apply()` assembles the plugin in this order:
22
+
23
+ ```text
24
+ settings.register("mnemon")
25
+ -> resolveConfig
26
+ -> createRunner
27
+ -> MnemonService
28
+ -> RuntimeMemoryController
29
+ -> DocumentManager
30
+ -> StorageScopeInspector
31
+ -> MnemonSubagentCoordinator
32
+ -> MnemonLifecycle
33
+ -> tools / commands / prompt sections
34
+ -> register RPC when a Web connection exists
35
+ ```
36
+
37
+ The Host declares dependencies on `tools`, `settings`, `commands`, `agents`, and `subagents`. The Web client additionally depends on slots, connection, and DSH locale services.
38
+
39
+ ## Dual Paths for the Root Agent and Workers
40
+
41
+ The same `mnemon_*` tools route calls according to whether the caller is a subagent, preventing recursive delegation:
42
+
43
+ ```text
44
+ root Agent calls mnemon_recall
45
+ -> coordinator starts a bounded recall worker
46
+ -> worker calls mnemon_memory_bodies and mnemon_recall
47
+ -> tool sees origin=subagent
48
+ -> call reaches MnemonService directly
49
+ -> structured evidence returns to root Agent
50
+ ```
51
+
52
+ Long-term semantic writes, relationships, soft deletion, and Memory Space creation, updates, and merges use the same pattern. Ordinary Runtime Memory and Document mutations first pass through the coordinator but are usually committed directly by the deterministic control layer; only capacity maintenance or archiving requires an additional worker.
53
+
54
+ ## Two Types of Subagent
55
+
56
+ ### `spawn`
57
+
58
+ `spawn` uses a new isolated context. For each task type, the plugin supplies:
59
+
60
+ - a fixed persona;
61
+ - a minimal tool allowlist;
62
+ - a structured output schema within the subset supported by DSH;
63
+ - `maxDepth: 1`;
64
+ - a cancellable signal and bounded token budget.
65
+
66
+ It is used for recall, long-term semantic writes, evidence-bound answers, hot-memory maintenance, and Document archiving.
67
+
68
+ ### `fork`
69
+
70
+ Scored background review requires a provider named `fork` with `inheritsParentContext=true`. It inherits only a completed parent checkpoint and determines whether to maintain hot memory or at most one Project Document. It is not a continuation of the user's task, and it does not inject review reasoning into the main conversation.
71
+
72
+ The current review allowlist excludes `mnemon_remember`, `mnemon_forget`, and Memory Space maintenance tools, so background review cannot modify long-term Memory Spaces directly.
73
+
74
+ ## Control Plane and Data Plane
75
+
76
+ ```text
77
+ LLM-owned judgment Host-owned guarantees
78
+ ------------------ ---------------------
79
+ what is worth keeping input validation
80
+ which Memory Space fits path boundary
81
+ whether two items are duplicates process timeout/cancel
82
+ how to summarize a Document file lock + atomic rename
83
+ whether a reusable artifact exists UTF-8 capacity accounting
84
+ revision conflict rejection
85
+ read/write RPC authority
86
+ ```
87
+
88
+ Persona constraints must be distinguished from hard Host guarantees. For example, the MEMORY archival worker is instructed to cover every committed hot-memory item, but the Host can strictly validate only the structured action, revision, and byte budget; the Host does validate USER compaction source coverage item by item.
89
+
90
+ ## Web Boundary
91
+
92
+ The WebUI does not start system processes or open SQLite directly:
93
+
94
+ ```text
95
+ browser component
96
+ -> typed client wrapper
97
+ -> DSH RPC authority check
98
+ -> Host validation
99
+ -> controller / service / bounded worker
100
+ -> local CLI or managed files
101
+ ```
102
+
103
+ Read channels require `trusted-host`; memory write channels and settings channels require `loopback`. When `writeEnabled=false`, the Host does not register memory write channels.
104
+
105
+ ## Internationalization
106
+
107
+ `src/client/locales.ts` defines `MnemonKey` from the Chinese key set, and the English dictionary must satisfy the same set of keys; `src/client/index.ts` registers both dictionaries with the DSH locale. The main Web pages and settings card switch immediately with the DSH global language and reuse the global light or dark theme.
108
+
109
+ Command output, tool-card titles, persisted compatibility-default Memory Space names, and some backend errors are still monolingual. This is a known gap on the Roadmap.
110
+
111
+ ## Key Modules
112
+
113
+ | Module | Responsibility |
114
+ |---|---|
115
+ | `src/index.ts` | Host composition and registration |
116
+ | `src/config.ts` | Configuration schema, defaults, and resolution |
117
+ | `src/process.ts` | Bounded process execution without a shell |
118
+ | `src/runner.ts` | CLI discovery, arguments, serialization, and JSON parsing |
119
+ | `src/service.ts` | Application facade for long-term memory |
120
+ | `src/memory-bodies.ts` | Memory Space catalog metadata |
121
+ | `src/runtime-memory.ts` | Hot-memory source of truth and projections |
122
+ | `src/documents.ts` | Documents control plane |
123
+ | `src/subagent.ts` | Worker orchestration and capacity transactions |
124
+ | `src/lifecycle.ts` | Per-root-Agent lifecycle |
125
+ | `src/review-activity.ts` | Deterministic review scoring |
126
+ | `src/tools.ts` | Model tools and root/worker routing |
127
+ | `src/rpc.ts` | Web read/write channels |
128
+ | `src/storage-scope.ts` | Read-only inventory of the three storage scopes |
129
+ | `src/client/*` | Web workspace, settings, and locale |