memorix 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.zh-CN.md CHANGED
@@ -5,8 +5,8 @@
5
5
  <h1 align="center">Memorix</h1>
6
6
 
7
7
  <p align="center">
8
- <strong>面向 AI 编码 Agent 的本地优先记忆平台。</strong><br>
9
- Git 真相、推理记忆和跨 Agent 召回统一到一个 MCP 服务器中。
8
+ <strong>面向 Coding Agent 的开源跨 Agent Memory Layer。</strong><br>
9
+ 通过 MCP 兼容 Cursor、Claude Code、Codex、Windsurf、Gemini CLI、GitHub Copilot、Kiro、OpenCode、Antigravity 和 Trae。
10
10
  </p>
11
11
 
12
12
  <p align="center">
@@ -18,29 +18,62 @@
18
18
  </p>
19
19
 
20
20
  <p align="center">
21
- <strong>Git Memory</strong> · <strong>Reasoning Memory</strong> · <strong>跨 Agent 召回</strong> · <strong>控制台仪表盘</strong>
21
+ <strong>Git Memory</strong> | <strong>Reasoning Memory</strong> | <strong>跨 Agent 召回</strong> | <strong>Control Plane Dashboard</strong>
22
22
  </p>
23
23
 
24
24
  <p align="center">
25
- <a href="README.md">English</a> ·
26
- <a href="#快速开始">快速开始</a> ·
27
- <a href="#工作原理">工作原理</a> ·
28
- <a href="#文档导航">文档导航</a> ·
29
- <a href="docs/SETUP.md">配置指南</a>
25
+ <a href="README.md">English</a> |
26
+ <a href="#快速开始">快速开始</a> |
27
+ <a href="#支持的客户端">支持的客户端</a> |
28
+ <a href="#核心工作流">核心工作流</a> |
29
+ <a href="#文档导航">文档导航</a> |
30
+ <a href="docs/SETUP.md">安装与接入</a>
30
31
  </p>
31
32
 
32
33
  ---
33
34
 
35
+ ## 给 Coding Agent 的说明
36
+
37
+ 如果你在用 AI coding agent 帮用户安装、配置或排障 Memorix,请先读 [Agent Operator Playbook](docs/AGENT_OPERATOR_PLAYBOOK.md)。
38
+
39
+ 这份文档是给 agent 的正式操作手册,重点说明:
40
+
41
+ - 安装与运行模式选择
42
+ - Git 与项目绑定规则
43
+ - stdio 与 HTTP control plane 的区别
44
+ - 各 IDE / Agent 的集成和 hooks
45
+ - dot 目录按需生成策略
46
+ - 排障顺序和安全操作边界
47
+
34
48
  ## 为什么是 Memorix
35
49
 
36
- 大多数 AI 编码 Agent 只能记住当前对话。Memorix 提供跨 IDE、跨会话、跨 Agent 的共享持久化记忆层,让工程上下文真正沉淀下来。
50
+ 大多数 Coding Agent 只记得当前线程。Memorix 提供的是一层共享、持久、可检索的项目记忆,让不同 IDE、不同 Agent、不同会话都能在同一套本地记忆库上继续工作。
51
+
52
+ Memorix 的几个关键差异点:
53
+
54
+ - **Git Memory**:把 `git commit` 变成可检索的工程记忆,保留提交来源、变更文件和噪音过滤结果。
55
+ - **Reasoning Memory**:不只记录“改了什么”,还记录“为什么这么做”。
56
+ - **跨 Agent 本地召回**:多个 IDE 和 Agent 可以读取同一套本地记忆,而不是各自形成孤岛。
57
+ - **记忆质量管线**:formation、压缩、保留衰减和 source-aware retrieval 协同工作,而不是一堆彼此独立的小功能。
58
+
59
+ 一句话说,Memorix 解决的是:让多个 Coding Agent 通过 MCP 共享同一套耐久项目记忆,同时保留 Git 真相、推理上下文和本地控制权。
37
60
 
38
- Memorix 的差异化主要在这几条线:
61
+ ## 支持的客户端
39
62
 
40
- - **Git Memory**:把 `git commit` 转成带来源、可检索、可过滤噪音的工程记忆。
41
- - **Reasoning Memory**:不仅记录“改了什么”,还能记录“为什么这样做”。
42
- - **跨 Agent 本地召回**:Cursor、Windsurf、Claude Code、Codex、Copilot、Kiro、OpenCode、Gemini CLI 等都可以读写同一套本地记忆。
43
- - **质量治理管线**:Formation、写入压缩、保留衰减、source-aware retrieval 协同工作,而不是一堆孤立工具。
63
+ 当前已经做了明确适配的集成目标有:
64
+
65
+ - Cursor
66
+ - Claude Code
67
+ - Codex
68
+ - Windsurf
69
+ - Gemini CLI
70
+ - GitHub Copilot
71
+ - Kiro
72
+ - OpenCode
73
+ - Antigravity
74
+ - Trae
75
+
76
+ 如果某个客户端能通过 MCP 连接本地命令或 HTTP 端点,通常也可以接入 Memorix,只是暂时没有单独的适配器或引导页。
44
77
 
45
78
  ---
46
79
 
@@ -52,35 +85,92 @@ Memorix 的差异化主要在这几条线:
52
85
  npm install -g memorix
53
86
  ```
54
87
 
55
- 初始化项目配置:
88
+ 初始化 Memorix 配置:
56
89
 
57
90
  ```bash
58
91
  memorix init
59
92
  ```
60
93
 
61
- Memorix 采用“两类文件、两种职责”:
94
+ `memorix init` 会让你在 `Global defaults` 和 `Project config` 之间选择作用域。
95
+
96
+ Memorix 使用两类文件:
97
+
98
+ - `memorix.yml`:行为配置和项目设置
99
+ - `.env`:API key 等 secrets
100
+
101
+ 然后按你的目标选择一条最顺手的路径:
102
+
103
+ | 你想做什么 | 运行命令 | 适合场景 |
104
+ | --- | --- | --- |
105
+ | 先把 Memorix 快速接到一个 IDE 里 | `memorix serve` | Cursor、Claude Code、Codex、Windsurf、Gemini CLI 等 stdio MCP 客户端 |
106
+ | 在后台长期运行 HTTP MCP + Dashboard | `memorix background start` | 日常使用、多 Agent、协作、dashboard |
107
+ | 把 HTTP 模式放在前台调试或自定义端口 | `memorix serve-http --port 3211` | 调试、手动观察日志、自定义启动方式 |
108
+
109
+ 对大多数用户来说,先从下面两条里选一条就够了:
62
110
 
63
- - `memorix.yml`:行为配置、项目策略
64
- - `.env`:密钥和敏感端点
111
+ - `memorix serve`:你只想尽快在 IDE 里用起来
112
+ - `memorix background start`:你想要 dashboard 和后台常驻的 HTTP control plane
65
113
 
66
- 选择一种运行模式:
114
+ 可选的本地交互式界面:
67
115
 
68
116
  ```bash
69
- memorix serve
117
+ memorix
70
118
  ```
71
119
 
72
- `serve` 用于标准的 stdio MCP 集成。
120
+ 只有在你确实想在 TTY 里直接使用本地 workbench 时,才需要运行裸命令 `memorix`。对大多数用户来说,它不是主安装路径。
121
+
122
+ 配套命令:
123
+
124
+ ```bash
125
+ memorix background status
126
+ memorix background logs
127
+ memorix background stop
128
+ ```
129
+
130
+ 如果你确实需要把 HTTP control plane 放在前台运行、做调试、手动观察日志或使用自定义端口,再用:
73
131
 
74
132
  ```bash
75
133
  memorix serve-http --port 3211
76
134
  ```
77
135
 
78
- `serve-http` 用于 HTTP transport、团队协作,以及与之共端口的 dashboard。
136
+ 如果你在多个工作区或多个 Agent 之间共享 HTTP control plane,请让每个 session 都在开始时调用 `memorix_session_start(projectRoot=...)`。
137
+
138
+ 更细的启动根路径选择、项目绑定、配置优先级和 agent 操作说明,放在 [docs/SETUP.md](docs/SETUP.md) 和 [Agent Operator Playbook](docs/AGENT_OPERATOR_PLAYBOOK.md) 里。
139
+
140
+ 把 Memorix 加进你的 MCP 客户端:
141
+
142
+ ### 通用 stdio MCP 配置
143
+
144
+ ```json
145
+ {
146
+ "mcpServers": {
147
+ "memorix": {
148
+ "command": "memorix",
149
+ "args": ["serve"]
150
+ }
151
+ }
152
+ }
153
+ ```
154
+
155
+ ### 通用 HTTP MCP 配置
156
+
157
+ ```json
158
+ {
159
+ "mcpServers": {
160
+ "memorix": {
161
+ "transport": "http",
162
+ "url": "http://localhost:3211/mcp"
163
+ }
164
+ }
165
+ }
166
+ ```
167
+
168
+ 如果你用的是 HTTP control plane,并且会跨多个工作区或多个 Agent 共享,请确保客户端或 agent 在每个项目 session 开始时调用 `memorix_session_start(projectRoot=绝对工作区路径)`。
79
169
 
80
- Memorix 加入 MCP 配置:
170
+ 下面这些客户端示例展示的是最简单的 stdio 形态。如果你更想使用共享的 HTTP control plane,请沿用上面的通用 HTTP 配置块,并到 [docs/SETUP.md](docs/SETUP.md) 查看各客户端字段差异。
81
171
 
82
172
  <details open>
83
- <summary><strong>Cursor</strong> · <code>.cursor/mcp.json</code></summary>
173
+ <summary><strong>Cursor</strong> | <code>.cursor/mcp.json</code></summary>
84
174
 
85
175
  ```json
86
176
  {
@@ -103,7 +193,7 @@ claude mcp add memorix -- memorix serve
103
193
  </details>
104
194
 
105
195
  <details>
106
- <summary><strong>Codex</strong> · <code>~/.codex/config.toml</code></summary>
196
+ <summary><strong>Codex</strong> | <code>~/.codex/config.toml</code></summary>
107
197
 
108
198
  ```toml
109
199
  [mcp_servers.memorix]
@@ -112,13 +202,13 @@ args = ["serve"]
112
202
  ```
113
203
  </details>
114
204
 
115
- 完整 IDE 配置矩阵、Windows 注意事项和排障请看 [docs/SETUP.md](docs/SETUP.md)。
205
+ 完整 IDE 配置矩阵、Windows 注意事项和排障说明见 [docs/SETUP.md](docs/SETUP.md)。
116
206
 
117
207
  ---
118
208
 
119
209
  ## 核心工作流
120
210
 
121
- ### 1. 存储并检索项目记忆
211
+ ### 1. 存储与检索项目记忆
122
212
 
123
213
  常用 MCP 工具包括:
124
214
 
@@ -128,9 +218,9 @@ args = ["serve"]
128
218
  - `memorix_timeline`
129
219
  - `memorix_resolve`
130
220
 
131
- 这条主链适合沉淀决策、踩坑、问题修复、会话交接等上下文。
221
+ 这条主链适合沉淀决策、坑点、问题修复和会话交接。
132
222
 
133
- ### 2. 自动捕获 Git 工程真相
223
+ ### 2. 自动捕获 Git 真相
134
224
 
135
225
  安装 post-commit hook:
136
226
 
@@ -138,19 +228,19 @@ args = ["serve"]
138
228
  memorix git-hook --force
139
229
  ```
140
230
 
141
- 也可以手动导入:
231
+ 或者手动导入:
142
232
 
143
233
  ```bash
144
234
  memorix ingest commit
145
235
  memorix ingest log --count 20
146
236
  ```
147
237
 
148
- Git Memory 会带上 `source='git'`、commit hash、文件列表,以及噪音过滤结果。
238
+ Git Memory 会保留 `source='git'`、提交哈希、文件变更和噪音过滤结果。
149
239
 
150
- ### 3. 运行控制台与协作入口
240
+ ### 3. 运行控制面与 Dashboard
151
241
 
152
242
  ```bash
153
- memorix serve-http --port 3211
243
+ memorix background start
154
244
  ```
155
245
 
156
246
  然后访问:
@@ -158,38 +248,114 @@ memorix serve-http --port 3211
158
248
  - MCP HTTP 端点:`http://localhost:3211/mcp`
159
249
  - Dashboard:`http://localhost:3211`
160
250
 
161
- 这个模式会把 dashboard、团队协作、配置诊断、项目身份健康度等能力统一到同一个入口。
251
+ 配套命令:
252
+
253
+ ```bash
254
+ memorix background status
255
+ memorix background logs
256
+ memorix background stop
257
+ ```
258
+
259
+ 如果你需要把控制面放在前台做调试或手动观察,也可以使用:
260
+
261
+ ```bash
262
+ memorix serve-http --port 3211
263
+ ```
264
+
265
+ 这一模式会把 dashboard、配置诊断、项目身份、团队协作和 Git Memory 视图统一到一个控制面入口里。
266
+
267
+ 当多个 HTTP session 同时存在时,每个 session 都应先用 `memorix_session_start(projectRoot=...)` 显式绑定当前工作区,再去调用项目级记忆工具。
162
268
 
163
269
  ---
164
270
 
165
271
  ## 工作原理
166
272
 
167
273
  ```mermaid
168
- graph TB
169
- A["git commit / agent 工具调用 / 手动存储"] --> B["Memorix Runtime"]
170
- B --> C["Observation / Reasoning / Git Memory"]
171
- C --> D["Formation + Indexing + Graph + Retention"]
172
- D --> E["Search / Detail / Timeline / Dashboard / Team"]
274
+ flowchart LR
275
+ subgraph Ingress["入口层"]
276
+ A1["Git hooks / ingest"]
277
+ A2["MCP tools"]
278
+ A3["CLI / TUI"]
279
+ A4["HTTP dashboard"]
280
+ end
281
+
282
+ subgraph Runtime["Memorix Runtime"]
283
+ B1["stdio MCP server"]
284
+ B2["HTTP control plane"]
285
+ B3["project binding + config"]
286
+ end
287
+
288
+ subgraph Memory["记忆基底"]
289
+ C1["Observation memory"]
290
+ C2["Reasoning memory"]
291
+ C3["Git memory"]
292
+ C4["Session + team state"]
293
+ end
294
+
295
+ subgraph Processing["异步处理"]
296
+ D1["Formation pipeline"]
297
+ D2["Embedding + indexing"]
298
+ D3["Graph linking"]
299
+ D4["Dedup + retention"]
300
+ end
301
+
302
+ subgraph Consumption["消费面"]
303
+ E1["Search / detail / timeline"]
304
+ E2["Dashboard / team views"]
305
+ E3["Agent recall / handoff"]
306
+ end
307
+
308
+ A1 --> B1
309
+ A2 --> B1
310
+ A2 --> B2
311
+ A3 --> B1
312
+ A3 --> B2
313
+ A4 --> B2
314
+
315
+ B1 --> B3
316
+ B2 --> B3
317
+
318
+ B3 --> C1
319
+ B3 --> C2
320
+ B3 --> C3
321
+ B3 --> C4
322
+
323
+ C1 --> D1
324
+ C1 --> D2
325
+ C1 --> D3
326
+ C1 --> D4
327
+ C2 --> D1
328
+ C2 --> D3
329
+ C3 --> D2
330
+ C4 --> D3
331
+
332
+ D1 --> E1
333
+ D2 --> E1
334
+ D3 --> E2
335
+ D4 --> E3
336
+ C4 --> E3
173
337
  ```
174
338
 
175
- ### 三层记忆模型
339
+ Memorix 不是一条单线流水线。它从多个入口接收记忆,把内容落到多种记忆基底上,经过异步质量与索引处理,再通过不同的检索和协作界面提供给用户与 agent。
340
+
341
+ ### 记忆层
176
342
 
177
- - **Observation Memory**:记录 what-changed、how-it-works、gotcha、problem-solution 等工程知识
178
- - **Reasoning Memory**:记录决策理由、备选方案、权衡、风险
179
- - **Git Memory**:从 commit 提取的不可变工程事实
343
+ - **Observation Memory**:记录“改了什么 / 系统怎么工作 / 踩过什么坑”
344
+ - **Reasoning Memory**:记录“为什么这么做 / 替代方案 / 权衡 / 风险”
345
+ - **Git Memory**:记录从提交中提炼出的工程事实
180
346
 
181
347
  ### 检索模型
182
348
 
183
- - 默认搜索是**当前项目隔离**
184
- - `scope="global"` 才会跨项目搜索
185
- - 全局结果可通过带 `projectId` 的 refs 精确打开详情
186
- - source-aware retrieval 会根据问题类型动态提升 Git reasoning memory 的权重
349
+ - 默认搜索是**当前项目作用域**
350
+ - `scope="global"` 可以跨项目搜索
351
+ - 全局结果可通过带项目信息的 ref 再展开
352
+ - source-aware retrieval 会对“发生了什么”问题偏向 Git Memory,对“为什么”问题偏向 reasoning memory
187
353
 
188
354
  ---
189
355
 
190
356
  ## 文档导航
191
357
 
192
- ### 上手与配置
358
+ ### 入门
193
359
 
194
360
  - [Setup Guide](docs/SETUP.md)
195
361
  - [Configuration Guide](docs/CONFIGURATION.md)
@@ -200,7 +366,7 @@ graph TB
200
366
  - [Memory Formation Pipeline](docs/MEMORY_FORMATION_PIPELINE.md)
201
367
  - [Design Decisions](docs/DESIGN_DECISIONS.md)
202
368
 
203
- ### 参考文档
369
+ ### 参考资料
204
370
 
205
371
  - [API Reference](docs/API_REFERENCE.md)
206
372
  - [Git Memory Guide](docs/GIT_MEMORY.md)
@@ -211,8 +377,10 @@ graph TB
211
377
  - [Development Guide](docs/DEVELOPMENT.md)
212
378
  - [Known Issues and Roadmap](docs/KNOWN_ISSUES_AND_ROADMAP.md)
213
379
 
214
- ### 面向 AI 的项目文档
380
+ ### AI / Agent 文档
215
381
 
382
+ - [Agent Operator Playbook](docs/AGENT_OPERATOR_PLAYBOOK.md)
383
+ - [AI Context Note](docs/AI_CONTEXT.md)
216
384
  - [`llms.txt`](llms.txt)
217
385
  - [`llms-full.txt`](llms-full.txt)
218
386
 
@@ -235,17 +403,18 @@ npm run build
235
403
  ```bash
236
404
  memorix status
237
405
  memorix dashboard
406
+ memorix background start
238
407
  memorix serve-http --port 3211
239
408
  memorix git-hook --force
240
409
  ```
241
410
 
242
411
  ---
243
412
 
244
- ## 致谢
413
+ ## 鸣谢
245
414
 
246
- Memorix 借鉴了 [mcp-memory-service](https://github.com/doobidoo/mcp-memory-service)、[MemCP](https://github.com/maydali28/memcp)、[claude-mem](https://github.com/anthropics/claude-code)、[Mem0](https://github.com/mem0ai/mem0) 以及更广义 MCP 生态中的许多思路。
415
+ Memorix 借鉴了 [mcp-memory-service](https://github.com/doobidoo/mcp-memory-service)、[MemCP](https://github.com/maydali28/memcp)、[claude-mem](https://github.com/anthropics/claude-code)、[Mem0](https://github.com/mem0ai/mem0) 和整个 MCP 生态中的许多思路。
247
416
 
248
- ## Star History
417
+ ## Star 历史
249
418
 
250
419
  <a href="https://star-history.com/#AVIDS2/memorix&Date">
251
420
  <picture>