memory-forge 0.1.9 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,93 +1,76 @@
1
1
  # MemoryForge
2
2
 
3
- > AI Agent 持久记忆引擎。8 MCP 工具 + 5 个自动化引擎。Free 层本地运行,Pro Shelby 去中心化云同步。
3
+ > Persistent memory engine for AI agents. 8 MCP tools + 5 auto-engines. Free tier runs locally, Pro tier adds Shelby decentralized cloud sync.
4
4
 
5
- ## 安装
5
+ ## Install
6
6
 
7
7
  ```bash
8
8
  npx memory-forge setup
9
9
  ```
10
10
 
11
- 自动配置 Claude Code hooksSessionStart / Stop / PreCompact),导入已有规则为记忆。
11
+ Auto-configures Claude Code hooks (SessionStart / Stop / PreCompact) and imports existing rules as memories.
12
12
 
13
- Free 层零依赖外部服务。Pro 层需 `SHELBY_API_KEY` 启用 Shelby 云同步。
13
+ Free tier has no external service dependencies. Pro tier requires a `SHELBY_API_KEY` for Shelby cloud sync.
14
14
 
15
- ## 核心能力
15
+ ## Core Capabilities
16
16
 
17
- **8 MCP 工具(Agent 直接调用):**
17
+ **8 MCP Tools (invoked by agent directly):**
18
18
 
19
- | 工具 | 说明 |
19
+ | Tool | Description |
20
20
  |---|---|
21
- | `memory_store` | 存储记忆,自动向量化 + 命名 + 去重合并 |
22
- | `memory_search` | 语义检索(向量 + 关键词双模式) |
23
- | `memory_recall` | ID 精确获取 |
24
- | `memory_list` | 列出记忆,支持分类 / 标签过滤 |
25
- | `memory_forget` | 删除记忆(本地 + Shelby 同步) |
26
- | `memory_context` | 加载当前会话上下文 |
27
- | `memory_export` | 导出 JSON Markdown |
28
- | `memory_share` | 打包记忆供队友导入 |
29
-
30
- **5 个自动化引擎(用户无感知):**
31
-
32
- | 引擎 | 说明 |
21
+ | `memory_store` | Store memories with auto-embedding, naming, and dedup merge |
22
+ | `memory_search` | Semantic search (vector + keyword dual-mode) |
23
+ | `memory_recall` | Exact recall by memory ID |
24
+ | `memory_list` | List memories with category/tag filtering |
25
+ | `memory_forget` | Delete a memory (local + Shelby tombstone) |
26
+ | `memory_context` | Load current session context |
27
+ | `memory_export` | Export as JSON or Markdown |
28
+ | `memory_share` | Package a memory for teammate import |
29
+
30
+ **5 Auto-Engines (zero user awareness):**
31
+
32
+ | Engine | Description |
33
33
  |---|---|
34
- | autoName | 从内容自动提取记忆名称 |
35
- | autoMerge | 检测 >80% 重叠自动合并 |
36
- | autoPriority | 基于访问频率 + 时效计算优先级(Ebbinghaus 遗忘曲线) |
37
- | autoDecay | 90 天未访问自动归档 |
38
- | autoCapture | 会话结束自动更新优先级 + 清理过期;PreCompact 提醒 Agent 保存关键信息 |
34
+ | autoName | Extract name from content automatically |
35
+ | autoMerge | Detect >80% overlap and merge duplicates |
36
+ | autoPriority | Priority scoring via access frequency + recency (Ebbinghaus curve) |
37
+ | autoDecay | Auto-archive at 90 days of inactivity |
38
+ | autoCapture | Session-end priority recalc + PreCompact save reminders |
39
39
 
40
- ## 定价
40
+ ## Pricing
41
41
 
42
- | 方案 | 说明 |
42
+ | Tier | Description |
43
43
  |---|---|
44
- | **Free** | 8 工具,本地存储,无限制记忆 |
45
- | **Pro** | + Shelby 去中心化云同步,多设备 |
44
+ | **Free** | 8 tools, local storage, unlimited memories |
45
+ | **Pro** | + Shelby decentralized cloud sync, cross-device |
46
46
 
47
- Pro 当前在测试网阶段。
47
+ Pro is currently on Shelbynet testnet.
48
48
 
49
- ## 技术栈
49
+ ## Tech Stack
50
50
 
51
- - **MCP 协议**: `@modelcontextprotocol/sdk` (stdio transport)
52
- - **嵌入模型**: Transformers.js / Xenova all-MiniLM-L6-v223MB,本地运行,失败自动降级关键词搜索)
53
- - **云存储 (Pro)**: `@shelby-protocol/sdk` (Shelbynet / Aptos)
54
- - **运行时**: Node.js 18+, TypeScript
51
+ - **MCP Protocol**: `@modelcontextprotocol/sdk` (stdio transport)
52
+ - **Embeddings**: Transformers.js / Xenova all-MiniLM-L6-v2 (23MB, local, auto-fallback to keyword)
53
+ - **Cloud (Pro)**: `@shelby-protocol/sdk` (Shelbynet / Aptos)
54
+ - **Runtime**: Node.js 18+, TypeScript
55
55
 
56
- ## 项目结构
56
+ ## Docs
57
57
 
58
- ```
59
- agentvault/
60
- ├── README.md
61
- ├── package.json
62
- ├── server.json # MCP Registry manifest
63
- ├── Dockerfile
64
- ├── smithery.yaml
65
- ├── tsconfig.json
66
- └── src/
67
- ├── index.ts # MCP Server 入口 + CLI 路由
68
- ├── store.ts # MemoryStore: LRU 缓存 + 向量/关键词搜索
69
- ├── embedding.ts # Transformers.js 嵌入引擎
70
- ├── setup.ts # 一键安装流程
71
- ├── pro.ts # Pro 激活 + Shelby 云同步
72
- ├── auto/
73
- │ └── index.ts # 5 个自动化引擎
74
- ├── storage/
75
- │ ├── local.ts # 本地 Markdown 存储
76
- │ └── shelby.ts # Shelby 云存储
77
- ├── hooks/
78
- │ └── install.ts # Claude Code hooks 配置
79
- └── migrate/
80
- └── import.ts # 规则导入 + 去重
81
- ```
58
+ | Document | Content |
59
+ |---|---|
60
+ | [TECHNICAL.md](TECHNICAL.md) | API reference, data model, architecture, security |
61
+ | [TUTORIAL.md](TUTORIAL.md) | Install guide, daily use, Pro setup, troubleshooting |
62
+ | [SPEC.md](SPEC.md) | Product specification and roadmap |
63
+ | [ARCHITECTURE.md](ARCHITECTURE.md) | System architecture and data flow |
64
+ | [MARKET.md](MARKET.md) | Competitive analysis |
82
65
 
83
- ## 安全
66
+ ## Security
84
67
 
85
- - Free 层全本地,零网络请求(除首次模型下载 23MB
86
- - Pro 层记忆上传至 Shelby 链上存储,每条有 Aptos 交易证明
87
- - API key 通过环境变量注入,不存储密钥明文
88
- - 支持 GDPR 被遗忘权(`memory_forget` 删除本地 + 链上 tombstone
68
+ - Free tier is fully local — zero network requests (except one-time 23MB model download)
69
+ - Pro tier uploads to Shelby blockchain storage with Aptos transaction proofs
70
+ - API key via environment variable; secrets never stored in plaintext
71
+ - GDPR right-to-erasure via `memory_forget` (local + on-chain tombstone)
89
72
 
90
- ## 测试
73
+ ## Tests
91
74
 
92
75
  ```bash
93
76
  npm test # 48 tests, 100% pass
package/TECHNICAL.md CHANGED
@@ -1,40 +1,40 @@
1
- # MemoryForge 技术文档
1
+ # MemoryForge — Technical Documentation
2
2
 
3
- > 版本 0.1.8 | 8 MCP 工具 + 5 自动引擎 | Free 本地 + Pro Shelby
3
+ > Version 0.2.0 | 8 MCP Tools + 5 Auto-Engines | Free (local) + Pro (Shelby cloud)
4
4
 
5
- ## 目录
5
+ ## Table of Contents
6
6
 
7
- 1. [系统架构](#系统架构)
8
- 2. [数据模型](#数据模型)
9
- 3. [MCP 工具 API 参考](#mcp-工具-api-参考)
10
- 4. [自动引擎](#自动引擎)
11
- 5. [Hook 系统](#hook-系统)
12
- 6. [存储层](#存储层)
13
- 7. [嵌入引擎](#嵌入引擎)
14
- 8. [安全模型](#安全模型)
15
- 9. [Pro (Shelby )](#pro-层-shelby-云)
16
- 10. [错误处理与降级](#错误处理与降级)
7
+ 1. [System Architecture](#system-architecture)
8
+ 2. [Data Model](#data-model)
9
+ 3. [MCP Tool API Reference](#mcp-tool-api-reference)
10
+ 4. [Auto-Engines](#auto-engines)
11
+ 5. [Hook System](#hook-system)
12
+ 6. [Storage Layer](#storage-layer)
13
+ 7. [Embedding Engine](#embedding-engine)
14
+ 8. [Security Model](#security-model)
15
+ 9. [Pro Tier (Shelby Cloud)](#pro-tier-shelby-cloud)
16
+ 10. [Error Handling & Degradation](#error-handling--degradation)
17
17
 
18
18
  ---
19
19
 
20
- ## 系统架构
20
+ ## System Architecture
21
21
 
22
22
  ```
23
23
  ┌─────────────────────────────────────┐
24
- │ AI Agent (Claude Code / Cursor) │ MCP stdio 协议
24
+ │ AI Agent (Claude Code / Cursor) │ MCP stdio protocol
25
25
  ├─────────────────────────────────────┤
26
- │ CLI 路由 (index.ts)
26
+ │ CLI Router (index.ts)
27
27
  │ setup / pro / hook / MCP Server │
28
28
  ├─────────────────────────────────────┤
29
29
  │ 8 MCP Tools │
30
30
  │ store / search / recall / list │
31
31
  │ forget / context / export / share │
32
32
  ├──────────────┬──────────────────────┤
33
- │ Free │ Pro
34
- memoryStore │ ShelbyNodeClient │
33
+ │ Free Tier │ Pro Tier
34
+ MemoryStore │ ShelbyNodeClient │
35
35
  │ local .md │ upload/download/list │
36
36
  ├──────────────┴──────────────────────┤
37
- │ 5 Auto Engines │
37
+ │ 5 Auto-Engines │
38
38
  │ name → merge → priority → decay │
39
39
  │ → contextSummary │
40
40
  ├─────────────────────────────────────┤
@@ -45,47 +45,47 @@
45
45
  └─────────────────────────────────────┘
46
46
  ```
47
47
 
48
- ### 源文件结构
48
+ ### Source File Structure
49
49
 
50
50
  ```
51
51
  agentvault/src/
52
- ├── index.ts # 入口: CLI 路由 + MCP Server
53
- ├── store.ts # MemoryStore: 内存索引 + 搜索
54
- ├── embedding.ts # Transformers.js 延迟加载引擎
55
- ├── setup.ts # 一键安装流程
56
- ├── pro.ts # Pro 激活 + 同步
57
- ├── auto/index.ts # 5 自动引擎
52
+ ├── index.ts # Entry: CLI routing + MCP Server
53
+ ├── store.ts # MemoryStore: in-memory index + search
54
+ ├── embedding.ts # Transformers.js lazy-load engine
55
+ ├── setup.ts # One-command install flow
56
+ ├── pro.ts # Pro activation + bidirectional sync
57
+ ├── auto/index.ts # 5 auto-engines
58
58
  ├── storage/
59
- │ ├── local.ts # Markdown 文件读写
60
- │ └── shelby.ts # Shelby API 封装
61
- ├── hooks/install.ts # Claude Code hooks 配置
62
- └── migrate/import.ts # 规则导入 + 去重
59
+ │ ├── local.ts # Markdown file read/write
60
+ │ └── shelby.ts # Shelby cloud API wrapper
61
+ ├── hooks/install.ts # Claude Code hooks configuration
62
+ └── migrate/import.ts # Rule import + dedup
63
63
  ```
64
64
 
65
65
  ---
66
66
 
67
- ## 数据模型
67
+ ## Data Model
68
68
 
69
- ### Memory 接口
69
+ ### Memory Interface
70
70
 
71
71
  ```typescript
72
72
  interface Memory {
73
73
  id: string; // UUID v4
74
- name: string; // 人类可读名称 (autoName 生成, 最长40字符)
75
- content: string; // 原始内容
76
- category: string; // 分类: user-preference | project-context | decision-log | code-pattern
77
- tags: string[]; // 标签列表
78
- priority: number; // 1-10, autoPriority 动态调整
79
- vector: number[]; // 384-dim 嵌入向量
80
- created_at: string; // ISO-8601 创建时间
81
- access_count: number; // 访问次数 (touch)
82
- last_accessed: string | null; // 最后访问时间
74
+ name: string; // Human-readable name (autoName, max 40 chars)
75
+ content: string; // Raw content
76
+ category: string; // user-preference | project-context | decision-log | code-pattern
77
+ tags: string[]; // Tag list
78
+ priority: number; // 110, dynamically adjusted by autoPriority
79
+ vector: number[]; // 384-dim embedding vector
80
+ created_at: string; // ISO-8601 creation timestamp
81
+ access_count: number; // Touch count
82
+ last_accessed: string | null; // Last access timestamp
83
83
  }
84
84
  ```
85
85
 
86
- ### 本地存储格式
86
+ ### Local Storage Format
87
87
 
88
- 文件路径: `~/.memory-forge/memories/{id}.md`
88
+ Path: `~/.memory-forge/memories/{id}.md`
89
89
 
90
90
  ```markdown
91
91
  # Memory Name
@@ -99,22 +99,22 @@ interface Memory {
99
99
  User prefers camelCase naming, single quotes, and 2-space indent.
100
100
  ```
101
101
 
102
- ### MemoryStore 索引
102
+ ### MemoryStore Index
103
103
 
104
- - `Map<string, Memory>` 主存储
105
- - `Map<string, Float32Array>` 向量缓存
106
- - LRU 淘汰: 5000 条上限, 超出淘汰最低访问量×优先级
107
- - 去重: Jaccard 相似度 > 0.8 自动合并
104
+ - `Map<string, Memory>` primary store
105
+ - `Map<string, Float32Array>` vector cache
106
+ - LRU eviction: 5,000 entry cap, evicts lowest `access_count × priority`
107
+ - Dedup: Jaccard similarity > 0.8 triggers auto-merge
108
108
 
109
109
  ---
110
110
 
111
- ## MCP 工具 API 参考
111
+ ## MCP Tool API Reference
112
112
 
113
- 所有工具通过 MCP stdio 协议调用。Agent 自动获得,无需手动调用。
113
+ All tools are invoked via the MCP stdio protocol. The agent receives them automatically — no manual invocation required.
114
114
 
115
115
  ### memory_store
116
116
 
117
- 存储一条记忆。自动向量化、命名、去重合并。
117
+ Store a memory. Auto-embeds, names, and dedup-merges.
118
118
 
119
119
  ```typescript
120
120
  // Input
@@ -122,37 +122,37 @@ User prefers camelCase naming, single quotes, and 2-space indent.
122
122
  content: string; // required, min 1 char
123
123
  category?: string; // "general" | "user-preference" | "project-context" | "decision-log" | "code-pattern"
124
124
  tags?: string[]; // default: []
125
- priority?: number; // 1-10, default: 5
125
+ priority?: number; // 110, default: 5
126
126
  }
127
127
 
128
128
  // Output (success)
129
129
  {
130
130
  success: true;
131
- merged?: boolean; // true if merged with existing memory (>80% overlap)
131
+ merged?: boolean; // true if merged with existing (>80% overlap)
132
132
  memory_id: string;
133
133
  name: string;
134
134
  preview: string; // first 200 chars
135
135
  }
136
136
  ```
137
137
 
138
- **内部流程:**
139
- 1. `embed(content)` → 384-dim vector (失败则 vector=[])
140
- 2. `autoName(content)` → 从内容提取名称
141
- 3. `autoMerge(store, memory)` → 检查已有记忆, >0.8 Jaccard 则合并
142
- 4. `saveMemory(memory)` → 写本地 Markdown
143
- 5. `store.add(memory)` → 更新 LRU 缓存
144
- 6. Pro: `uploadMemory(memory)` → Shelby (async, fire-and-forget)
138
+ **Internal pipeline:**
139
+ 1. `embed(content)` → 384-dim vector (null on failure)
140
+ 2. `autoName(content)` → extract name from content
141
+ 3. `autoMerge(store, memory)` → check existing, merge if Jaccard > 0.8
142
+ 4. `saveMemory(memory)` → write local Markdown
143
+ 5. `store.add(memory)` → update LRU cache
144
+ 6. Pro: `uploadMemory(memory)` → Shelby cloud (async, fire-and-forget)
145
145
 
146
146
  ### memory_search
147
147
 
148
- 语义检索记忆。向量优先, 失败自动降级关键词。
148
+ Semantic memory search. Vector-first, auto-fallback to keyword.
149
149
 
150
150
  ```typescript
151
151
  // Input
152
152
  {
153
- query: string; // required, 自然语言
154
- limit?: number; // 1-20, default: 5
155
- min_similarity?: number; // 0-1, default: 0.6
153
+ query: string; // required, natural language
154
+ limit?: number; // 120, default: 5
155
+ min_similarity?: number; // 01, default: 0.6
156
156
  category?: string; // filter by category
157
157
  tags?: string[]; // filter by tags (OR match)
158
158
  }
@@ -172,21 +172,21 @@ User prefers camelCase naming, single quotes, and 2-space indent.
172
172
  }
173
173
  ```
174
174
 
175
- **评分公式 (向量模式):**
175
+ **Scoring formula (vector mode):**
176
176
  ```
177
177
  score = cosineSimilarity(queryVec, memoryVec)
178
178
  × (priority / 5)
179
179
  × (1 + min(access_count, 10) × 0.05)
180
180
  ```
181
181
 
182
- **评分公式 (关键词模式):**
182
+ **Scoring formula (keyword mode):**
183
183
  ```
184
184
  score = (contentHits × 2 + nameHits × 3) + priority
185
185
  ```
186
186
 
187
187
  ### memory_recall
188
188
 
189
- ID 精确获取一条记忆。
189
+ Exact retrieval by memory ID.
190
190
 
191
191
  ```typescript
192
192
  // Input
@@ -204,21 +204,21 @@ score = (contentHits × 2 + nameHits × 3) + priority
204
204
 
205
205
  ### memory_list
206
206
 
207
- 列出记忆目录,支持分页和过滤。
207
+ List memories with pagination and filtering.
208
208
 
209
209
  ```typescript
210
210
  // Input
211
211
  {
212
212
  category?: string; // filter
213
213
  tags?: string[]; // filter (OR match)
214
- limit?: number; // 1-100, default: 20
214
+ limit?: number; // 1100, default: 20
215
215
  offset?: number; // default: 0
216
216
  }
217
217
 
218
218
  // Output
219
219
  {
220
- total: number; // 总记忆数
221
- count: number; // 当前页数量
220
+ total: number; // total memory count
221
+ count: number; // current page count
222
222
  memories: [{
223
223
  memory_id, name, category,
224
224
  tags, priority,
@@ -229,7 +229,7 @@ score = (contentHits × 2 + nameHits × 3) + priority
229
229
 
230
230
  ### memory_forget
231
231
 
232
- 删除一条记忆(本地文件 + 内存缓存)。
232
+ Delete a memory (local file + in-memory cache).
233
233
 
234
234
  ```typescript
235
235
  // Input
@@ -245,30 +245,30 @@ score = (contentHits × 2 + nameHits × 3) + priority
245
245
 
246
246
  ### memory_context
247
247
 
248
- 加载当前会话上下文,返回最近访问的高优先级记忆摘要。
248
+ Load current session context — returns top recently-accessed, high-priority memory summaries.
249
249
 
250
250
  ```typescript
251
251
  // Input
252
- { limit?: number; // 1-20, default: 5 }
252
+ { limit?: number; // 120, default: 5 }
253
253
 
254
254
  // Output
255
255
  {
256
256
  context_loaded: true;
257
257
  memory_count: number;
258
- context: string; // 格式: "- [name] preview..."
258
+ context: string; // format: "- [name] preview..."
259
259
  }
260
260
  ```
261
261
 
262
- **排序:** `access_count` DESC, 同分则 `priority` DESC
262
+ **Sort order:** `access_count` DESC, ties broken by `priority` DESC.
263
263
 
264
264
  ### memory_export
265
265
 
266
- 导出记忆为 JSON Markdown
266
+ Export memories as JSON or Markdown.
267
267
 
268
268
  ```typescript
269
269
  // Input
270
270
  {
271
- memory_ids?: string[]; // 不指定则导出全部
271
+ memory_ids?: string[]; // omit to export all
272
272
  format?: "json" | "markdown"; // default: "json"
273
273
  }
274
274
 
@@ -289,7 +289,7 @@ score = (contentHits × 2 + nameHits × 3) + priority
289
289
 
290
290
  ### memory_share
291
291
 
292
- 打包单条记忆供队友导入。
292
+ Package a single memory for import by teammates.
293
293
 
294
294
  ```typescript
295
295
  // Input
@@ -313,78 +313,78 @@ score = (contentHits × 2 + nameHits × 3) + priority
313
313
 
314
314
  ---
315
315
 
316
- ## 自动引擎
316
+ ## Auto-Engines
317
317
 
318
- 所有引擎位于 `src/auto/index.ts`。
318
+ All engines are located in `src/auto/index.ts`.
319
319
 
320
320
  ### autoName
321
321
 
322
- 从内容提取人类可读名称。
322
+ Extracts a human-readable name from content.
323
323
 
324
324
  ```
325
- 算法:
326
- 1. 移除代码块 (```...```)
327
- 2. 取前 40 字符
328
- 3. 换行替换为空格
329
- 4. 空内容 → "memory"
325
+ Algorithm:
326
+ 1. Strip code blocks (```...```)
327
+ 2. Take first 40 chars
328
+ 3. Replace newlines with spaces
329
+ 4. Empty content → "memory"
330
330
  ```
331
331
 
332
332
  ### autoMerge
333
333
 
334
- 检测并合并重复记忆。
334
+ Detects and merges duplicate memories.
335
335
 
336
336
  ```
337
- 算法:
338
- 1. Jaccard 相似度: |setA ∩ setB| / min(|setA|, |setB|)
339
- 2. 单词长度 3
340
- 3. 阈值: > 0.8 → 合并
341
- 4. 合并后重新计算向量
337
+ Algorithm:
338
+ 1. Jaccard similarity: |setA ∩ setB| / min(|setA|, |setB|)
339
+ 2. Minimum word length: 3 chars
340
+ 3. Threshold: > 0.8 → merge
341
+ 4. Recompute embedding vector after merge
342
342
  ```
343
343
 
344
344
  ### autoPriority
345
345
 
346
- 基于 Ebbinghaus 遗忘曲线计算优先级 (1-10)
346
+ Computes priority score (110) based on the Ebbinghaus forgetting curve.
347
347
 
348
348
  ```
349
- 公式:
350
- freqWeight = min(access_count, 50) / 50
351
- recencyWeight = 1 - (daysSinceLastAccess / 90) // clamp 0-1
352
- ageWeight = 1 - min(ageDays, 365) / 365
349
+ Formula:
350
+ freqWeight = min(access_count, 50) / 50
351
+ recencyWeight = 1 - (daysSinceLastAccess / 90) // clamp 01
352
+ ageWeight = 1 - min(ageDays, 365) / 365
353
353
 
354
354
  priority = 1 + 9 × (freqWeight × 0.4 + recencyWeight × 0.4 + ageWeight × 0.2)
355
355
  ```
356
356
 
357
357
  ### autoDecay
358
358
 
359
- Ebbinghaus 遗忘曲线判定记忆是否归档。
359
+ Determines whether a memory should be archived.
360
360
 
361
361
  ```
362
- | 天数 | 衰减值 | 含义 |
363
- |------|--------|------|
364
- | ≤1 | 1.0 | 活跃 |
365
- | ≤7 | 0.8 | 近期 |
366
- | ≤30 | 0.5 | 衰减中 |
367
- | ≤90 | 0.2 | 弱记忆 |
368
- | >90 | 0 | 归档 (删除) |
362
+ | Days | Decay Value | Status |
363
+ |----------|-------------|-------------------|
364
+ | ≤1 | 1.0 | Active |
365
+ | ≤7 | 0.8 | Recent |
366
+ | ≤30 | 0.5 | Decaying |
367
+ | ≤90 | 0.2 | Weak |
368
+ | >90 | 0 | Archived (deleted) |
369
369
  ```
370
370
 
371
371
  ### generateContextSummary
372
372
 
373
- 生成 Agent 上下文摘要。
373
+ Generates a context summary for agent injection.
374
374
 
375
375
  ```
376
- 算法:
377
- 1. 取全部记忆, access_count DESC, priority DESC 排序
378
- 2. 截取 top-N
379
- 3. 每条截断 150 字符
380
- 4. 格式: "- [name] content..."
376
+ Algorithm:
377
+ 1. Sort all memories by access_count DESC, priority DESC
378
+ 2. Truncate to top-N
379
+ 3. Truncate each to 150 chars
380
+ 4. Format: "- [name] content..."
381
381
  ```
382
382
 
383
383
  ---
384
384
 
385
- ## Hook 系统
385
+ ## Hook System
386
386
 
387
- 配置位置: `~/.claude/settings.json`
387
+ Configuration location: `~/.claude/settings.json`
388
388
 
389
389
  ```json
390
390
  {
@@ -402,125 +402,126 @@ Ebbinghaus 遗忘曲线判定记忆是否归档。
402
402
  }
403
403
  ```
404
404
 
405
- ### 生命周期
405
+ ### Lifecycle
406
406
 
407
407
  ```
408
- SessionStart → 加载 top-5 记忆注入 Agent 上下文 (stdout)
408
+ SessionStart → Load top-5 memoriesInject into agent context (stdout)
409
409
 
410
- Agent 工作 memory_store / memory_search / ...
410
+ Agent works Calls memory_store / memory_search / etc.
411
411
 
412
- PreCompact → 加载 top-8 记忆 + 注入存储指令 → Agent 自动保存
412
+ PreCompact → Load top-8 memories + inject save instruction → Agent auto-saves
413
413
 
414
- Stop → autoPriority 重算 + autoDecay 检查 + 归档过期记忆
414
+ Stop → autoPriority recalc + autoDecay check + archive expired
415
415
 
416
- (下次) SessionStart → 记忆已保留
416
+ (next) SessionStart → Memories preserved
417
417
  ```
418
418
 
419
- ### 关键设计决策
419
+ ### Key Design Decision
420
420
 
421
- **为什么 PreCompact 而非 Stop auto-capture?**
422
- Stop hook 只在正常退出时触发。`kill` / 关终端窗口 / 崩溃 → Stop 不跑。PreCompact 在上下文快满时一定触发,此时进程还活着,Agent 能执行存储指令。
421
+ **Why PreCompact instead of Stop for auto-capture?**
422
+
423
+ The Stop hook only fires on graceful exit. `kill`, closing the terminal window, or crashes will skip it. PreCompact always fires when the context window approaches its limit — the process is still alive and the agent can execute the save instruction.
423
424
 
424
425
  ---
425
426
 
426
- ## 存储层
427
+ ## Storage Layer
427
428
 
428
- ### Free (本地 Markdown)
429
+ ### Free Tier (Local Markdown)
429
430
 
430
- - 路径: `~/.memory-forge/memories/{id}.md`
431
- - 格式: YAML frontmatter + Markdown body
432
- - 编码: UTF-8
433
- - 权限: 用户文件系统控制
434
- - 网络:
431
+ - Path: `~/.memory-forge/memories/{id}.md`
432
+ - Format: YAML-like frontmatter + Markdown body
433
+ - Encoding: UTF-8
434
+ - Permissions: user filesystem control
435
+ - Network: zero
435
436
 
436
- ### Pro (Shelby )
437
+ ### Pro Tier (Shelby Cloud)
437
438
 
438
- - SDK: `@shelby-protocol/sdk` ^0.3.1 (optionalDep)
439
- - 网络: Shelbynet 测试网
440
- - 认证: API Key + Ed25519 链上账户
441
- - Blob 格式: `memories/{id}.json` (JSON)
442
- - 过期: 365
443
- - 数据流: 双向同步 (session 启动时 ↓↑, memory_store 时 ↑)
439
+ - SDK: `@shelby-protocol/sdk` ^0.3.1 (optionalDependency)
440
+ - Network: Shelbynet testnet
441
+ - Auth: API Key + Ed25519 on-chain account
442
+ - Blob format: `memories/{id}.json` (JSON)
443
+ - Expiry: 365 days
444
+ - Data flow: bidirectional sync (↓↑ on session start, on memory_store)
444
445
 
445
- **Pro 数据流:**
446
+ **Pro data flow:**
446
447
  ```
447
448
  SessionStart:
448
449
  syncAll():
449
- ↓ listBlobs() → 获取远程记忆列表
450
- ↓ downloadMemory() → 下载本地不存在的 (30s timeout)
451
- ↑ uploadMemory() → 上传本地有而远程无的
452
- 双向同步完成
450
+ ↓ listBlobs() → fetch remote memory list
451
+ ↓ downloadMemory() → download anything not local (30s timeout)
452
+ ↑ uploadMemory() → upload local-only memories
453
+ Bidirectional sync complete
453
454
 
454
455
  memory_store:
455
- saveMemory() → 本地
456
- uploadMemory() → Shelby (fire-and-forget, 失败不阻塞)
456
+ saveMemory() → local
457
+ uploadMemory() → Shelby (fire-and-forget, failure is non-blocking)
457
458
  ```
458
459
 
459
460
  ---
460
461
 
461
- ## 嵌入引擎
462
+ ## Embedding Engine
462
463
 
463
- ### 技术栈
464
+ ### Tech Stack
464
465
 
465
- - 库: `@huggingface/transformers` ^3.0.0
466
- - 模型: Xenova/all-MiniLM-L6-v2
467
- - 大小: ~23MB (首次下载, 后续缓存)
468
- - 维度: 384
469
- - 池化: mean pooling + L2 normalize
466
+ - Library: `@huggingface/transformers` ^3.0.0
467
+ - Model: Xenova/all-MiniLM-L6-v2
468
+ - Size: ~23MB (one-time download, cached thereafter)
469
+ - Dimensions: 384
470
+ - Pooling: mean pooling + L2 normalization
470
471
 
471
- ### 降级策略
472
+ ### Degradation Strategy
472
473
 
473
474
  ```
474
- 加载模型
475
- 成功: cos similarity search
476
- 失败: keyword matching (Jaccard)
477
- + 5 分钟自动重试
478
- + sleep(300s) 防止请求风暴
475
+ Load model
476
+ Success: cosine similarity search
477
+ Failure: keyword matching (Jaccard)
478
+ + 5-minute auto-retry
479
+ + sleep(300s) to prevent request storms
479
480
  ```
480
481
 
481
- ### 性能
482
+ ### Performance
482
483
 
483
- - 首次加载: 3-10s (取决于网络, 23MB 下载)
484
- - 后续推理: < 100ms
485
- - 降级关键词: < 10ms
486
- - 模型缓存: Transformers.js 内置缓存
484
+ - First load: 310s (depends on network; 23MB download)
485
+ - Subsequent inference: < 100ms
486
+ - Keyword fallback: < 10ms
487
+ - Model caching: Transformers.js built-in cache
487
488
 
488
489
  ---
489
490
 
490
- ## 安全模型
491
+ ## Security Model
491
492
 
492
- ### Free
493
+ ### Free Tier
493
494
 
494
- - 全部数据在 `~/.memory-forge/` 目录
495
- - 零持续网络请求
496
- - 唯一网络: 首次模型下载 (HuggingFace CDN, 23MB)
497
- - 模型下载失败关键词降级, 零功能损失
495
+ - All data in `~/.memory-forge/` directory
496
+ - Zero ongoing network requests
497
+ - Only network: one-time model download (HuggingFace CDN, 23MB)
498
+ - Model download failure keyword fallback, zero functionality loss
498
499
 
499
- ### Pro
500
+ ### Pro Tier
500
501
 
501
- - API Key: 环境变量 `SHELBY_API_KEY` 注入, 不落盘
502
- - 私钥: `~/.memory-forge/pro.json`, Ed25519 格式
503
- - 传输: HTTPS (Shelbynet API)
504
- - 链上: 每条记忆 → Aptos blob upload transaction
505
- - 删除: tombstone blob (标记删除, 链上不可篡改)
502
+ - API Key: `SHELBY_API_KEY` environment variable only — never written to disk
503
+ - Private Key: `~/.memory-forge/pro.json`, Ed25519 format
504
+ - Transport: HTTPS (Shelbynet API)
505
+ - On-chain: each memory → Aptos blob upload transaction
506
+ - Deletion: tombstone blob (marks deletion; chain is immutable)
506
507
 
507
- ### 记忆权限
508
+ ### Memory Permissions
508
509
 
509
- - 文件系统权限 = 记忆权限 (Free)
510
- - 链上账户签名 = 记忆权限 (Pro)
511
- - 无内置认证/授权层 (Agent 已通过 Claude Code 认证)
510
+ - Filesystem permissions = memory permissions (Free)
511
+ - On-chain account signature = memory permissions (Pro)
512
+ - No built-in auth layer (agent is already authenticated by Claude Code)
512
513
 
513
514
  ---
514
515
 
515
- ## 错误处理与降级
516
-
517
- | 场景 | 行为 | 影响 |
518
- |------|------|------|
519
- | 嵌入模型下载失败 | 关键词搜索, 5min 重试 | 搜索精度下降, 功能可用 |
520
- | 嵌入模型推理失败 | 返回 null, 关键词降级 | 单次查询降级 |
521
- | Shelby 上传失败 | console.error, 不阻塞 | Pro 同步不同步, 本地完好 |
522
- | Shelby 下载超时 | 30s timeout, 返回 null | 该条不同步, 其他正常 |
523
- | Shelby 链上 gas 不足 | 上传失败 + 错误消息 | Pro 不可用, Free 完好 |
524
- | parseMemoryFile 损坏 | 跳过该文件, 返回 null | 损坏文件被忽略 |
525
- | 磁盘写失败 | 静默失败 | 记忆丢失 (极罕见) |
526
- | LRU 5000 | 淘汰最低 access_count × priority | 旧记忆清出内存, 磁盘保留 |
516
+ ## Error Handling & Degradation
517
+
518
+ | Scenario | Behavior | Impact |
519
+ |----------|----------|--------|
520
+ | Embedding model download fails | Keyword search, 5min retry | Lower search precision, functional |
521
+ | Embedding model inference fails | Return null, keyword fallback | Single query degraded |
522
+ | Shelby upload fails | console.error, non-blocking | Pro sync delayed, local intact |
523
+ | Shelby download timeout | 30s timeout, return null | That memory skipped, others OK |
524
+ | Shelby on-chain gas insufficient | Upload fails + error message | Pro unavailable, Free intact |
525
+ | parseMemoryFile corrupt | Skip file, return null | Corrupt file ignored |
526
+ | Disk write fails | Silent failure | Memory lost (extremely rare) |
527
+ | LRU at 5,000 limit | Evict lowest access_count × priority | Old memories evicted from cache, disk preserved |
package/TUTORIAL.md CHANGED
@@ -1,353 +1,349 @@
1
- # MemoryForge 使用教程
1
+ # MemoryForge — Tutorial
2
2
 
3
- > 一条命令。零配置。AI Agent 从此拥有持久记忆。
3
+ > One command. Zero config. Your AI agent now has persistent memory.
4
4
 
5
- ## 目录
5
+ ## Table of Contents
6
6
 
7
- 1. [快速开始](#快速开始)
8
- 2. [工作原理](#工作原理)
9
- 3. [日常使用](#日常使用)
10
- 4. [Pro (云同步)](#pro-版-云同步)
11
- 5. [管理记忆](#管理记忆)
12
- 6. [最佳实践](#最佳实践)
13
- 7. [排错指南](#排错指南)
14
- 8. [卸载](#卸载)
7
+ 1. [Quick Start](#quick-start)
8
+ 2. [How It Works](#how-it-works)
9
+ 3. [Daily Use](#daily-use)
10
+ 4. [Pro Tier (Cloud Sync)](#pro-tier-cloud-sync)
11
+ 5. [Managing Memories](#managing-memories)
12
+ 6. [Best Practices](#best-practices)
13
+ 7. [Troubleshooting](#troubleshooting)
14
+ 8. [Uninstall](#uninstall)
15
15
 
16
16
  ---
17
17
 
18
- ## 快速开始
18
+ ## Quick Start
19
19
 
20
- ### 安装
20
+ ### Install
21
21
 
22
22
  ```bash
23
23
  npx memory-forge setup
24
24
  ```
25
25
 
26
- 一步完成:
27
- - 安装 Claude Code hooks (SessionStart / Stop / PreCompact)
28
- - 自动导入已有规则 (CLAUDE.md / .cursor/rules / .gitconfig)
29
- - 预加载嵌入模型 (23MB, 首次, 后续离线)
30
- - 全局安装 `memory-forge` 命令
26
+ This single command:
27
+ - Installs Claude Code hooks (SessionStart / Stop / PreCompact)
28
+ - Auto-imports existing rules (CLAUDE.md / .cursor/rules / .gitconfig)
29
+ - Preloads the embedding model (23MB, one-time, offline thereafter)
30
+ - Globally installs the `memory-forge` command
31
31
 
32
- **支持平台:** Claude Code (全平台), Cursor (通过 MCP), Windsurf, VS Code
32
+ **Supported platforms:** Claude Code (all platforms), Cursor (via MCP), Windsurf, VS Code.
33
33
 
34
- ### 验证安装
34
+ ### Verify
35
35
 
36
- 重启 Claude Code,你会看到:
36
+ Restart Claude Code. You should see:
37
37
 
38
38
  ```
39
39
  - [Git User Info] Git user email: xxx
40
40
  - [Claude Code Rules] For independent parallel tasks...
41
41
  ```
42
42
 
43
- 这表示 SessionStart hook 已生效,Agent 加载了你的记忆。
43
+ This means the SessionStart hook is active and the agent has loaded your memories.
44
44
 
45
45
  ---
46
46
 
47
- ## 工作原理
47
+ ## How It Works
48
48
 
49
- ### 自动化记忆生命周期
49
+ ### Automated Memory Lifecycle
50
50
 
51
51
  ```
52
- 你打开 Claude Code
53
- → Agent 自动加载你的偏好和项目上下文
54
-
55
- 你工作...
56
- → Agent 自动记住你的编码风格、技术决策、项目偏好
57
-
58
- 上下文快满时 (PreCompact)
59
- → Agent 自动保存关键信息到记忆库
60
- 即使你强制关终端,记忆也不会丢失
61
-
62
- 你关闭 Claude Code (Stop)
63
- 自动更新记忆优先级 (常用记忆提高权重)
64
- 自动归档 90 天未用的旧记忆
65
-
66
- 下次打开
67
- → Agent 又什么都记得
52
+ You open Claude Code
53
+ → Agent auto-loads your preferences and project context
54
+
55
+ You work...
56
+ → Agent automatically remembers your coding style, technical decisions, project preferences
57
+
58
+ Context window nearly full (PreCompact)
59
+ → Agent auto-saves critical information to the memory store
60
+ Even if you force-close the terminal, memories survive
61
+
62
+ You close Claude Code (Stop)
63
+ Auto-update memory priorities (frequently-used memories get higher weight)
64
+ Auto-archive memories unused for 90+ days
65
+
66
+ Next session
67
+ → Agent remembers everything
68
68
  ```
69
69
 
70
- ### 你什么都不用做
70
+ ### You Do Nothing
71
71
 
72
- Agent 自动:
73
- - **存储**: 你提到偏好、决策、教训Agent `memory_store`
74
- - **搜索**: 需要回忆之前的事Agent `memory_search`
75
- - **维护**: 优先级调整、过期清理自动
72
+ The agent automatically:
73
+ - **Stores**: you mention preferences, decisions, lessons agent calls `memory_store`
74
+ - **Searches**: needs to recall something agent calls `memory_search`
75
+ - **Maintains**: priority adjustment, expiry cleanup fully automatic
76
76
 
77
77
  ---
78
78
 
79
- ## 日常使用
79
+ ## Daily Use
80
80
 
81
- ### 基本交互
81
+ ### Basic Interaction
82
82
 
83
83
  ```
84
- 你: "我偏好 camelCase 命名,单引号,2 空格缩进"
84
+ You: "I prefer camelCase naming, single quotes, 2-space indent"
85
85
 
86
- Agent 自动调 memory_store → 记忆保存
87
- 下次写代码,Agent 自动遵循你的偏好。
86
+ Agent auto-calls memory_store → memory saved
87
+ Next time you write code, the agent follows your preferences automatically.
88
88
 
89
89
  ---
90
90
 
91
- 你: "之前那个 token 刷新 bug 怎么修的?"
91
+ You: "How did we fix that token refresh bug?"
92
92
 
93
- Agent memory_search → 找到相关记忆
94
- "6 15 日,你在 auth.ts 修了 token 过期判断从 < 改为 <="
93
+ Agent calls memory_search → finds relevant memory
94
+ "On June 15, you fixed auth.ts the token expiry check was using < instead of <="
95
95
 
96
96
  ---
97
97
 
98
- 你: "帮我重构认证模块"
98
+ You: "Help me refactor the auth module"
99
99
 
100
- Agent memory_context → 加载上下文
101
- "好的。根据之前的记录,项目用 React 19 + JWT + refresh token 模式。从 auth.ts 开始?"
100
+ Agent calls memory_context → loads context
101
+ "Got it. Based on prior records, this project uses React 19 + JWT + refresh token pattern. Start from auth.ts?"
102
102
  ```
103
103
 
104
- ### 主动使用
104
+ ### Explicit Commands
105
105
 
106
- 你也可以明确让 Agent 操作记忆:
106
+ You can also tell the agent explicitly:
107
107
 
108
108
  ```
109
- "存储一条记忆: 生产数据库用 PostgreSQL 16,连接串在 .env.production"
110
- "搜索关于部署流程的记忆"
111
- "列出我所有的记忆"
112
- "导出全部记忆为 Markdown"
113
- "删除 ID xxx 的旧记忆"
109
+ "Store a memory: production database uses PostgreSQL 16, connection string in .env.production"
110
+ "Search for memories about deployment"
111
+ "List all my memories"
112
+ "Export all memories as Markdown"
113
+ "Forget the memory with ID xxx"
114
114
  ```
115
115
 
116
116
  ---
117
117
 
118
- ## Pro (云同步)
118
+ ## Pro Tier (Cloud Sync)
119
119
 
120
- ### 什么情况需要 Pro
120
+ ### When You Need Pro
121
121
 
122
- - 你有多台电脑,想在设备间共享记忆
123
- - 你担心硬盘故障丢失记忆
124
- - 你想和队友共享项目记忆
122
+ - You use multiple computers and want cross-device memory sync
123
+ - You're worried about disk failure losing your memories
124
+ - You want shared project memories with teammates
125
125
 
126
- ### 开通 Pro
126
+ ### Activating Pro
127
127
 
128
128
  ```bash
129
- # 1. 获取 API Key
130
- # 访问 https://docs.shelby.xyz/sdks/typescript/acquire-api-keys
129
+ # 1. Get an API Key
130
+ # Visit https://docs.shelby.xyz/sdks/typescript/acquire-api-keys
131
131
 
132
- # 2. 激活 Pro
132
+ # 2. Activate Pro
133
133
  SHELBY_API_KEY="your-api-key" memory-forge pro
134
134
 
135
- # 3. 第一次需要充值 APT + ShelbyUSD (测试网水龙头)
136
- # 地址会打印在屏幕上,去 faucet 领取:
135
+ # 3. First time: fund your account with APT + ShelbyUSD (testnet faucet)
136
+ # The address will be printed. Go to the faucet:
137
137
  # APT: https://docs.shelby.xyz/apis/faucet/aptos
138
138
  # ShelbyUSD: https://docs.shelby.xyz/apis/faucet/shelbyusd
139
139
 
140
- # 4. 领取后重新运行同步
140
+ # 4. After claiming tokens, sync again
141
141
  SHELBY_API_KEY="your-api-key" memory-forge pro
142
142
  ```
143
143
 
144
- ### 多设备同步
144
+ ### Cross-Device Sync
145
145
 
146
146
  ```
147
- 设备 A: 激活 Pro → 工作记忆自动上传
148
- 设备 B: 设置 SHELBY_API_KEY 环境变量安装记忆自动下载
149
- → Agent 在设备 B 上也能记住一切
147
+ Device A: Activate Pro → workmemories auto-upload
148
+ Device B: Set SHELBY_API_KEY env var installmemories auto-download
149
+ → Agent on device B remembers everything
150
150
  ```
151
151
 
152
- ### 环境变量
152
+ ### Environment Variable
153
153
 
154
- 建议写入 shell 配置文件:
154
+ Add to your shell config for permanent setup:
155
155
 
156
156
  ```bash
157
- # ~/.bashrc ~/.zshrc
157
+ # ~/.bashrc or ~/.zshrc
158
158
  export SHELBY_API_KEY="your-api-key"
159
159
  ```
160
160
 
161
- 这样每次 Agent 启动自动启用 Pro 同步,无需手动运行命令。
161
+ The agent will auto-sync on every session start.
162
162
 
163
163
  ---
164
164
 
165
- ## 管理记忆
165
+ ## Managing Memories
166
166
 
167
- ### 查看记忆
167
+ ### Viewing Memories
168
168
 
169
169
  ```bash
170
- # 查看记忆文件
170
+ # List memory files
171
171
  ls ~/.memory-forge/memories/
172
172
 
173
- # 读某条记忆
173
+ # Read a specific memory
174
174
  cat ~/.memory-forge/memories/{id}.md
175
175
  ```
176
176
 
177
- 记忆文件是人类可读的 Markdown,可以直接编辑。
177
+ Memory files are human-readable Markdown. You can edit them directly.
178
178
 
179
- ### 导出
179
+ ### Exporting
180
180
 
181
181
  ```
182
- # Agent 方式
183
- "导出全部记忆为 JSON"
184
- "导出关于认证的记忆为 Markdown"
185
-
186
- # 命令行方式
187
- # JSON 导出在 Agent 调用 memory_export 后获取
182
+ # Via agent
183
+ "Export all memories as JSON"
184
+ "Export auth-related memories as Markdown"
188
185
  ```
189
186
 
190
- ### 备份
187
+ ### Backup
191
188
 
192
189
  ```bash
193
- # 本地备份 (Free )
190
+ # Local backup (Free tier)
194
191
  cp -r ~/.memory-forge/memories/ ~/backup/
195
192
 
196
- # Pro 层自动备份到 Shelby
193
+ # Pro tier auto-backs up to Shelby cloud
197
194
  ```
198
195
 
199
- ### 清理
196
+ ### Cleanup
200
197
 
201
198
  ```bash
202
- # 删除全部本地记忆
199
+ # Delete all local memories
203
200
  rm -rf ~/.memory-forge/memories/*.md
204
201
 
205
- # 删除单条
202
+ # Delete a single memory
206
203
  rm ~/.memory-forge/memories/{id}.md
207
204
 
208
- # Pro 账户重置
205
+ # Reset Pro account
209
206
  rm ~/.memory-forge/pro.json
210
207
  ```
211
208
 
212
209
  ---
213
210
 
214
- ## 最佳实践
211
+ ## Best Practices
215
212
 
216
- ### 什么值得记
213
+ ### What's Worth Remembering
217
214
 
218
- | 值得记 | 不值得记 |
219
- |--------|---------|
220
- | 编码风格偏好 | 单次 debug 过程 |
221
- | 项目架构决策 | 临时实验代码 |
222
- | 团队约定 | 过时的配置 |
223
- | 常用命令和流程 | 纯事实性知识 |
224
- | 踩过的坑和解决方案 | 一次性任务 |
215
+ | Worth It | Not Worth It |
216
+ |----------|--------------|
217
+ | Coding style preferences | One-off debug sessions |
218
+ | Project architecture decisions | Temporary experimental code |
219
+ | Team conventions | Outdated configuration |
220
+ | Frequently-used commands and workflows | Pure factual knowledge |
221
+ | Lessons learned and solutions found | One-time tasks |
225
222
 
226
- ### 记忆质量
223
+ ### Memory Quality
227
224
 
228
225
  ```
229
- 好: "项目用 PostgreSQL 16 + Prisma ORM,连接池上限 20"
230
- 差: "数据库是 pg"
226
+ Good: "Project uses PostgreSQL 16 + Prisma ORM, connection pool limit 20"
227
+ Bad: "database is pg"
231
228
 
232
- 好: "用户偏好 camelCase,单引号,2 空格,React 19 + TypeScript strict"
233
- 差: " camelCase"
229
+ Good: "User prefers camelCase, single quotes, 2-space indent, React 19 + TypeScript strict"
230
+ Bad: "uses camelCase"
234
231
 
235
- 好: "6/26 决定用 Redis 缓存 token,因为 DB 查询太慢 (>500ms)"
236
- 差: "用了 Redis"
232
+ Good: "6/26 decided to cache tokens in Redis because DB queries were >500ms"
233
+ Bad: "added Redis"
237
234
  ```
238
235
 
239
- ### 定期维护
236
+ ### Periodic Maintenance
240
237
 
241
- 每月做一次记忆清理:
238
+ Do a memory cleanup once a month:
242
239
 
243
240
  ```
244
- "查看我所有记忆,标记哪些过时了或不再需要"
245
- "删除 3 个月前关于旧项目的记忆"
241
+ "Review all my memories and flag anything outdated or no longer needed"
242
+ "Forget memories related to projects I no longer work on"
246
243
  ```
247
244
 
248
245
  ---
249
246
 
250
- ## 排错指南
247
+ ## Troubleshooting
251
248
 
252
- ### Hook 不生效
249
+ ### Hooks Not Working
253
250
 
254
- **症状:** 打开 Claude Code 看不到记忆加载。
251
+ **Symptom:** Opening Claude Code shows no memory loading.
255
252
 
256
- **解决:**
257
253
  ```bash
258
- # 1. 检查 hook 配置
254
+ # 1. Check hook configuration
259
255
  memory-forge hook session-start
260
256
 
261
- # 2. 重新安装 hooks
257
+ # 2. Reinstall hooks
262
258
  memory-forge setup
263
259
 
264
- # 3. 确认 settings.json
260
+ # 3. Verify settings.json
265
261
  cat ~/.claude/settings.json | grep memory-forge
266
262
 
267
- # 4. 重启 Claude Code
263
+ # 4. Restart Claude Code
268
264
  ```
269
265
 
270
- ### Stop hook 报错
266
+ ### Stop Hook Error
271
267
 
272
- **症状:** 关闭时显示 "Stop hook error"
268
+ **Symptom:** "Stop hook error" on session close.
273
269
 
274
270
  ```bash
275
- # 确认全局安装
271
+ # Confirm global install
276
272
  npm ls -g memory-forge
277
273
 
278
- # 如果不是最新版
274
+ # If not latest
279
275
  npm i -g memory-forge@latest
280
276
 
281
- # 检查 hook 命令格式
282
- # settings.json 中应该是 "memory-forge hook stop",不是 "npx memory-forge hook stop"
277
+ # Check hook command format
278
+ # settings.json should have "memory-forge hook stop", not "npx memory-forge hook stop"
283
279
  ```
284
280
 
285
- ### 记忆搜索不准确
281
+ ### Inaccurate Search Results
286
282
 
287
- **症状:** memory_search 返回无关结果。
283
+ **Symptom:** `memory_search` returns irrelevant results.
288
284
 
289
285
  ```bash
290
- # 检查嵌入模型是否下载成功
291
- # 如果看到 "[MemoryForge] Falling back to keyword matching"
292
- # → 模型下载失败,使用关键词模式
286
+ # Check if embedding model downloaded successfully
287
+ # If you see "[MemoryForge] Falling back to keyword matching"
288
+ # → Model download failed; keyword mode is active
293
289
 
294
- # 解决: 等待 5 分钟自动重试,或手动触发重试
295
- # 模型大小 23MB,确保网络正常
290
+ # Solution: wait 5 minutes for auto-retry, or trigger a retry manually
291
+ # Model size is 23MB — ensure network is working
296
292
  ```
297
293
 
298
- ### Pro 同步失败
294
+ ### Pro Sync Fails
299
295
 
300
- **症状:** "Shelby upload failed: INSUFFICIENT_BALANCE_FOR_TRANSACTION_FEE"
296
+ **Symptom:** "Shelby upload failed: INSUFFICIENT_BALANCE_FOR_TRANSACTION_FEE"
301
297
 
302
298
  ```bash
303
- # 检查账户余额
304
- # faucet 领取 APT + ShelbyUSD
305
- # 然后重新运行 pro 命令
299
+ # Check account balance
300
+ # Visit the faucet to claim APT + ShelbyUSD
301
+ # Then re-run pro
306
302
 
307
303
  SHELBY_API_KEY="your-key" memory-forge pro
308
304
  ```
309
305
 
310
- ### 重复记忆
306
+ ### Duplicate Memories
311
307
 
312
- **症状:** memory_list 显示重复的相似记忆。
308
+ **Symptom:** `memory_list` shows repeated similar memories.
313
309
 
314
310
  ```bash
315
- # 0.1.6+ 已根因修复。如果仍有:
316
- # 1. 升级到最新版
311
+ # 0.1.6+ has a root-cause fix. If you still see duplicates:
312
+ # 1. Upgrade to latest
317
313
  npm i -g memory-forge@latest
318
314
  memory-forge setup
319
315
 
320
- # 2. 手动清理
321
- # 删除 ~/.memory-forge/memories/ 中的重复 .md 文件
316
+ # 2. Manual cleanup
317
+ # Delete duplicate .md files in ~/.memory-forge/memories/
322
318
  ```
323
319
 
324
- ### 完全重置
320
+ ### Full Reset
325
321
 
326
322
  ```bash
327
- # 1. 删记忆
323
+ # 1. Delete memories
328
324
  rm -rf ~/.memory-forge/memories/*.md
329
325
 
330
- # 2. Pro 账户 (可选)
326
+ # 2. Delete Pro account (optional)
331
327
  rm -f ~/.memory-forge/pro.json
332
328
 
333
- # 3. 清除 hooks
334
- # 编辑 ~/.claude/settings.json, 删除含 "memory-forge" 的条目
329
+ # 3. Clear hooks
330
+ # Edit ~/.claude/settings.json, remove all entries containing "memory-forge"
335
331
 
336
- # 4. 重装
332
+ # 4. Reinstall
337
333
  memory-forge setup
338
334
  ```
339
335
 
340
336
  ---
341
337
 
342
- ## 卸载
338
+ ## Uninstall
343
339
 
344
340
  ```bash
345
- # 删除所有本地数据
341
+ # Remove all local data
346
342
  rm -rf ~/.memory-forge/
347
343
 
348
- # 编辑 ~/.claude/settings.json
349
- # 删除 hooks 中包含 "memory-forge" 的所有条目
344
+ # Edit ~/.claude/settings.json
345
+ # Remove all hook entries containing "memory-forge"
350
346
 
351
- # 卸载全局命令
347
+ # Uninstall global command
352
348
  npm uninstall -g memory-forge
353
349
  ```
package/dist/index.js CHANGED
@@ -95,7 +95,7 @@ function startMcpServer() {
95
95
  store.add(m);
96
96
  }
97
97
  preload();
98
- const server = new McpServer({ name: "memory-forge", version: "0.1.7" });
98
+ const server = new McpServer({ name: "memory-forge", version: "0.2.0" });
99
99
  // ── memory_store ──────────────────────────────────────────
100
100
  server.registerTool("memory_store", {
101
101
  title: "存储记忆",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memory-forge",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "description": "Forge persistent memories for your AI agent. 8 MCP tools + 5 auto-engines. Powered by Shelby decentralized cloud.",
5
5
  "type": "module",
6
6
  "license": "MIT",