openclaw-mem 1.0.2 → 1.0.3

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 (3) hide show
  1. package/README.md +19 -17
  2. package/README_CN.md +184 -0
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -5,6 +5,8 @@
5
5
  [![npm version](https://badge.fury.io/js/openclaw-mem.svg)](https://www.npmjs.com/package/openclaw-mem)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
+ English | [中文](README_CN.md)
9
+
8
10
  OpenClaw-Mem automatically captures your conversations and makes them searchable, allowing your AI assistant to remember what you've discussed across sessions.
9
11
 
10
12
  ## ✨ Features
@@ -34,7 +36,6 @@ That's it! Start chatting and your conversations will be remembered.
34
36
 
35
37
  Ask your AI assistant:
36
38
  - "What did we discuss before?"
37
- - "我们之前讨论过什么?"
38
39
  - "What were we working on last time?"
39
40
  - "Remind me about the authentication issue"
40
41
 
@@ -55,22 +56,23 @@ npx openclaw-mem uninstall
55
56
  ## 🏗️ How It Works
56
57
 
57
58
  ```
58
- ┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
59
- Telegram │────▶│ OpenClaw Gateway │────▶│ AI Agent
60
- └─────────────────┘ └──────────────────┘ └─────────────────┘
61
- │ │
62
- ▼ ▼
63
- ┌──────────────┐ ┌─────────────┐
64
- openclaw-mem │ │ Read Tool
65
- hook │ └─────────────┘
66
- └──────────────┘ │
67
- │ ▼
68
- ┌──────────────────────┼─────────────────────────┘
69
- ▼ ▼
70
- ┌───────────────┐ ┌──────────────────┐
71
- │ SQLite DB │ │ SESSION-MEMORY.md │
72
- (persistent) │ │ (injected) │
73
- └───────────────┘ └──────────────────┘
59
+ +-------------+ +------------------+ +------------+
60
+ | Telegram | --> | OpenClaw Gateway | --> | AI Agent |
61
+ +-------------+ +------------------+ +------------+
62
+ | |
63
+ v v
64
+ +--------------+ +------------+
65
+ | openclaw-mem | | Read Tool |
66
+ | hook | +------------+
67
+ +--------------+ |
68
+ | v
69
+ +-------------------+----------------------+
70
+ | |
71
+ v v
72
+ +---------------+ +------------------+
73
+ | SQLite DB | | SESSION-MEMORY.md|
74
+ | (persistent) | | (injected) |
75
+ +---------------+ +------------------+
74
76
  ```
75
77
 
76
78
  ### Event Flow
package/README_CN.md ADDED
@@ -0,0 +1,184 @@
1
+ # OpenClaw-Mem 🧠
2
+
3
+ > 为你的 OpenClaw AI 代理提供持久长期记忆
4
+
5
+ [![npm version](https://badge.fury.io/js/openclaw-mem.svg)](https://www.npmjs.com/package/openclaw-mem)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ [English](README.md) | 中文
9
+
10
+ OpenClaw-Mem 自动捕获你的对话并使其可搜索,让你的 AI 助手能够记住跨会话讨论的内容。
11
+
12
+ ## ✨ 功能特性
13
+
14
+ - **🔄 自动记忆捕获** - 对话自动保存
15
+ - **🔍 全文搜索** - 搜索你的整个对话历史
16
+ - **📊 渐进式披露** - 分层上下文,高效使用 token
17
+ - **🎯 话题检测** - 自动按话题索引讨论内容
18
+ - **💾 本地存储** - 所有数据保存在你的机器上(SQLite)
19
+ - **⚡ 零配置** - 开箱即用
20
+
21
+ ## 🚀 快速开始
22
+
23
+ ```bash
24
+ # 一键安装和设置!
25
+ npx openclaw-mem init
26
+
27
+ # 重启 OpenClaw 网关
28
+ openclaw gateway restart
29
+ ```
30
+
31
+ 就这样!开始聊天,你的对话将被记住。
32
+
33
+ ## 📖 使用方法
34
+
35
+ ### 在聊天中回忆记忆
36
+
37
+ 询问你的 AI 助手:
38
+ - "我们之前讨论过什么?"
39
+ - "上次我们在做什么?"
40
+ - "提醒我关于认证问题的事"
41
+
42
+ ### CLI 命令
43
+
44
+ ```bash
45
+ # 查看记忆状态
46
+ npx openclaw-mem status
47
+
48
+ # 搜索记忆
49
+ npx openclaw-mem search "认证"
50
+ npx openclaw-mem search "AI 记忆"
51
+
52
+ # 卸载(保留数据库)
53
+ npx openclaw-mem uninstall
54
+ ```
55
+
56
+ ## 🏗️ 工作原理
57
+
58
+ ```
59
+ +-------------+ +------------------+ +------------+
60
+ | Telegram | --> | OpenClaw Gateway | --> | AI Agent |
61
+ +-------------+ +------------------+ +------------+
62
+ | |
63
+ v v
64
+ +--------------+ +------------+
65
+ | openclaw-mem | | Read Tool |
66
+ | hook | +------------+
67
+ +--------------+ |
68
+ | v
69
+ +-------------------+----------------------+
70
+ | |
71
+ v v
72
+ +---------------+ +------------------+
73
+ | SQLite DB | | SESSION-MEMORY.md|
74
+ | (持久存储) | | (注入上下文) |
75
+ +---------------+ +------------------+
76
+ ```
77
+
78
+ ### 事件流程
79
+
80
+ 1. **`gateway:startup`** - 初始化记忆数据库
81
+ 2. **`agent:bootstrap`** - 向新会话注入历史上下文
82
+ 3. **`command:new`** - 开始新对话时保存会话摘要
83
+
84
+ ### 渐进式披露
85
+
86
+ 为优化 token 使用,记忆按层级组织:
87
+
88
+ | 层级 | 内容 | Token 消耗 |
89
+ |------|------|-----------|
90
+ | 索引 | 所有观察的紧凑表格 | 低 |
91
+ | 话题 | 关键讨论摘要 | 中 |
92
+ | 详情 | 完整内容(按需) | 高 |
93
+
94
+ ## 📁 文件位置
95
+
96
+ | 文件 | 位置 | 用途 |
97
+ |------|------|------|
98
+ | 数据库 | `~/.openclaw-mem/memory.db` | 持久存储 |
99
+ | Hook | `~/.openclaw/hooks/openclaw-mem/` | 事件处理器 |
100
+ | 记忆上下文 | `~/.openclaw/workspace/SESSION-MEMORY.md` | 注入的上下文 |
101
+
102
+ ## ⚙️ 配置
103
+
104
+ ### 自定义 MEMORY.md
105
+
106
+ 在 `~/.openclaw/workspace/MEMORY.md` 中添加你的偏好:
107
+
108
+ ```markdown
109
+ ## 用户偏好
110
+ - 沟通风格:技术性且简洁
111
+ - 语言:中文
112
+
113
+ ## 长期上下文
114
+ - 正在做:AI 记忆系统
115
+ - 兴趣:机器学习、分布式系统
116
+
117
+ ## 当前关注
118
+ - 当前项目:构建聊天应用
119
+ ```
120
+
121
+ ### 动态话题检测
122
+
123
+ 系统自动从你的实际对话中提取话题:
124
+ - 频繁提及的概念会被自动检测
125
+ - 没有硬编码关键词 - 一切来自你的数据
126
+ - 话题随你的讨论内容变化
127
+
128
+ ## 🔧 故障排除
129
+
130
+ ### 记忆没有被回忆?
131
+
132
+ 1. **重启网关:**
133
+ ```bash
134
+ openclaw gateway restart
135
+ ```
136
+
137
+ 2. **检查 hook 是否安装:**
138
+ ```bash
139
+ ls ~/.openclaw/hooks/openclaw-mem/
140
+ ```
141
+
142
+ 3. **验证数据库有内容:**
143
+ ```bash
144
+ npx openclaw-mem status
145
+ ```
146
+
147
+ ### 搜索找不到结果?
148
+
149
+ - 尝试更简单的搜索词
150
+ - 检查拼写错误
151
+ - 使用实际对话中的关键词
152
+
153
+ ### 数据库问题?
154
+
155
+ ```bash
156
+ # 重置数据库(⚠️ 删除所有记忆)
157
+ rm ~/.openclaw-mem/memory.db
158
+ openclaw gateway restart
159
+ ```
160
+
161
+ ## 🤝 贡献
162
+
163
+ 欢迎贡献!请随时提交 Pull Request。
164
+
165
+ 1. Fork 仓库
166
+ 2. 创建你的功能分支 (`git checkout -b feature/amazing-feature`)
167
+ 3. 提交更改 (`git commit -m 'Add amazing feature'`)
168
+ 4. 推送到分支 (`git push origin feature/amazing-feature`)
169
+ 5. 打开 Pull Request
170
+
171
+ ## 📄 许可证
172
+
173
+ MIT 许可证 - 详见 [LICENSE](LICENSE)
174
+
175
+ ## 🙏 致谢
176
+
177
+ - 灵感来自 [claude-mem](https://github.com/anthropics/claude-mem)
178
+ - 为 [OpenClaw](https://openclaw.ai) 构建
179
+
180
+ ---
181
+
182
+ <p align="center">
183
+ 用 ❤️ 为 AI 社区制作
184
+ </p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-mem",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Persistent memory system for OpenClaw - Give your AI agent long-term memory",
5
5
  "type": "module",
6
6
  "main": "lib/handler.js",
@@ -49,6 +49,7 @@
49
49
  "scripts/commands.js",
50
50
  "docs/",
51
51
  "README.md",
52
+ "README_CN.md",
52
53
  "LICENSE"
53
54
  ],
54
55
  "openclaw": {