@memtensor/memos-cloud-openclaw-plugin 0.1.18 → 0.1.19
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/LICENSE +201 -201
- package/README.md +316 -316
- package/README_ZH.md +321 -321
- package/clawdbot.plugin.json +1 -1
- package/index.js +826 -811
- package/lib/arms-reporter.js +116 -116
- package/lib/check-update.js +202 -202
- package/lib/config-resolution-schema.js +50 -50
- package/lib/config-ui/app.css +1022 -1022
- package/lib/config-ui/app.js +1454 -1454
- package/lib/config-ui/index.html +113 -113
- package/lib/memos-cloud-api.js +891 -867
- package/moltbot.plugin.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +46 -46
- package/scripts/sync-version.js +45 -45
- package/test/direct-session-user-id.test.mjs +125 -125
- package/test/query-strip.test.mjs +406 -333
- package/update.md +0 -9
package/README_ZH.md
CHANGED
|
@@ -1,321 +1,321 @@
|
|
|
1
|
-
# MemOS Cloud OpenClaw Plugin(Lifecycle 插件)
|
|
2
|
-
|
|
3
|
-
官方维护:MemTensor。
|
|
4
|
-
|
|
5
|
-
这是一个最小可用的 OpenClaw lifecycle 插件,功能是:
|
|
6
|
-
- **召回记忆**:在每轮对话前从 MemOS Cloud 检索记忆并注入上下文
|
|
7
|
-
- **添加记忆**:在每轮对话结束后把消息写回 MemOS Cloud
|
|
8
|
-
|
|
9
|
-
## 功能
|
|
10
|
-
- **Recall**:`before_prompt_build`(旧版 OpenClaw 回退到 `before_agent_start`)→ `/search/memory`
|
|
11
|
-
- **Add**:`agent_end` → `/add/message`
|
|
12
|
-
- **Config UI**:启动 gateway 时同时启动本地插件配置页面,用来编辑 `plugins.entries.memos-cloud-openclaw-plugin.config`
|
|
13
|
-
- 使用 **Token** 认证(`Authorization: Token <MEMOS_API_KEY>`)
|
|
14
|
-
|
|
15
|
-
## 配置页面
|
|
16
|
-
- Gateway 启动后,插件会同时拉起一个本地配置页面,并在终端输出访问地址(默认:`http://127.0.0.1:38463`)。
|
|
17
|
-
- 页面会直接读取并写回当前宿主的配置文件:
|
|
18
|
-
- OpenClaw:`~/.openclaw/openclaw.json`
|
|
19
|
-
- Moltbot:`~/.moltbot/moltbot.json`
|
|
20
|
-
- ClawDBot:`~/.clawdbot/clawdbot.json`
|
|
21
|
-
- 如果默认端口被占用,插件会自动顺延到下一个可用端口。
|
|
22
|
-
- 页面保存后会写回 `plugins.entries.memos-cloud-openclaw-plugin.config`。(注意:保存后可能需要手动重启 Gateway 以使配置生效)
|
|
23
|
-
|
|
24
|
-
## 安装
|
|
25
|
-
|
|
26
|
-
### 方式 A — NPM(推荐)
|
|
27
|
-
```bash
|
|
28
|
-
openclaw plugins install @memtensor/memos-cloud-openclaw-plugin@latest
|
|
29
|
-
openclaw gateway restart
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
> **Windows 用户注意**:
|
|
33
|
-
> 如果遇到 `Error: spawn EINVAL` 报错,这是 OpenClaw Windows 安装器的已知问题。请使用下方的 **方式 B**(手动安装)。
|
|
34
|
-
|
|
35
|
-
确认 `~/.openclaw/openclaw.json` 中已启用:
|
|
36
|
-
```json
|
|
37
|
-
{
|
|
38
|
-
"plugins": {
|
|
39
|
-
"entries": {
|
|
40
|
-
"memos-cloud-openclaw-plugin": { "enabled": true }
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### 方式 B — 手动安装(Windows 解决方案)
|
|
47
|
-
1. 从 [NPM](https://www.npmjs.com/package/@memtensor/memos-cloud-openclaw-plugin) 下载最新的 `.tgz` 包。
|
|
48
|
-
2. 解压到本地目录(例如 `C:\Users\YourName\.openclaw\extensions\memos-cloud-openclaw-plugin`)。
|
|
49
|
-
3. 修改配置 `~/.openclaw/openclaw.json`(或 `%USERPROFILE%\.openclaw\openclaw.json`):
|
|
50
|
-
|
|
51
|
-
```json
|
|
52
|
-
{
|
|
53
|
-
"plugins": {
|
|
54
|
-
"entries": {
|
|
55
|
-
"memos-cloud-openclaw-plugin": { "enabled": true }
|
|
56
|
-
},
|
|
57
|
-
"load": {
|
|
58
|
-
"paths": [
|
|
59
|
-
"C:\\Users\\YourName\\.openclaw\\extensions\\memos-cloud-openclaw-plugin"
|
|
60
|
-
]
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
*注意:解压后的文件夹通常包含一个 `package` 子文件夹,请指向包含 `package.json` 的那层目录。*
|
|
66
|
-
|
|
67
|
-
修改配置后需要重启 gateway。
|
|
68
|
-
|
|
69
|
-
## 环境变量
|
|
70
|
-
插件运行时配置的优先级是:**插件 config → env 文件**。为符合纯粹的安全沙箱规范,插件不再支持回退到进程环境变量去读取敏感凭证。
|
|
71
|
-
在 env 文件层,按顺序读取(**openclaw → moltbot → clawdbot**),每个键优先使用最先匹配到的值。
|
|
72
|
-
|
|
73
|
-
**配置位置**
|
|
74
|
-
- 文件(优先级顺序):
|
|
75
|
-
- `~/.openclaw/.env`
|
|
76
|
-
- `~/.moltbot/.env`
|
|
77
|
-
- `~/.clawdbot/.env`
|
|
78
|
-
- 每行格式:`KEY=value`
|
|
79
|
-
|
|
80
|
-
**快速配置(Shell / Windows)**
|
|
81
|
-
```bash
|
|
82
|
-
echo 'MEMOS_API_KEY="mpg-..."' >> ~/.openclaw/.env
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
若未读取到 `MEMOS_API_KEY`,插件会提示配置方式并附 API Key 获取地址。
|
|
86
|
-
|
|
87
|
-
**最小配置**
|
|
88
|
-
```env
|
|
89
|
-
MEMOS_API_KEY=YOUR_TOKEN
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
**可选配置**
|
|
93
|
-
- `MEMOS_BASE_URL`(默认 `https://memos.memtensor.cn/api/openmem/v1`)
|
|
94
|
-
- `MEMOS_API_KEY`(必填,Token 认证)—— 获取地址:https://memos-dashboard.openmem.net/cn/apikeys/
|
|
95
|
-
- `MEMOS_USER_ID`(可选,默认 `openclaw-user`)
|
|
96
|
-
- `MEMOS_USE_DIRECT_SESSION_USER_ID`(默认 `false`;开启后,对 `agent:main:<provider>:direct:<peer-id>` 这类私聊 sessionKey,会把 `<peer-id>` 作为 MemOS `user_id`)
|
|
97
|
-
- `MEMOS_CONVERSATION_ID`(可选覆盖)
|
|
98
|
-
- `MEMOS_KNOWLEDGEBASE_IDS`(可选;逗号分隔的全局知识库 ID 列表,用于 `/search/memory`,例如:`"kb-123, kb-456"`)
|
|
99
|
-
- `MEMOS_ALLOW_KNOWLEDGEBASE_IDS`(可选;逗号分隔的知识库 ID 列表,用于 `/add/message`,例如:`"kb-123"`)
|
|
100
|
-
- `MEMOS_TAGS`(可选;逗号分隔的标签列表,用于 `/add/message`,默认:`"openclaw"`,例如:`"openclaw, dev"`)
|
|
101
|
-
- `MEMOS_RECALL_GLOBAL`(默认 `true`;为 true 时检索不传 conversation_id)
|
|
102
|
-
- `MEMOS_MULTI_AGENT_MODE`(默认 `false`;是否开启多 Agent 数据隔离模式)
|
|
103
|
-
- `MEMOS_ALLOWED_AGENTS`(可选;多 Agent 模式下的白名单,逗号分隔,例如 `"agent1,agent2"`;为空则所有 Agent 均启用)
|
|
104
|
-
- `MEMOS_CONVERSATION_PREFIX` / `MEMOS_CONVERSATION_SUFFIX`(可选)
|
|
105
|
-
- `MEMOS_CONVERSATION_SUFFIX_MODE`(`none` | `counter`,默认 `none`)
|
|
106
|
-
- `MEMOS_CONVERSATION_RESET_ON_NEW`(默认 `true`,需 hooks.internal.enabled)
|
|
107
|
-
- `MEMOS_RECALL_FILTER_ENABLED`(默认 `false`;开启后先用你指定的模型过滤召回记忆再注入)
|
|
108
|
-
- `MEMOS_RECALL_FILTER_BASE_URL`(OpenAI 兼容接口,例如 `http://127.0.0.1:11434/v1`)
|
|
109
|
-
- `MEMOS_RECALL_FILTER_API_KEY`(可选,若你的接口需要鉴权)
|
|
110
|
-
- `MEMOS_RECALL_FILTER_MODEL`(用于筛选记忆的模型名)
|
|
111
|
-
- `MEMOS_RECALL_FILTER_TIMEOUT_MS`(默认 `30000`)
|
|
112
|
-
- `MEMOS_RECALL_FILTER_RETRIES`(默认 `1`)
|
|
113
|
-
- `MEMOS_RECALL_FILTER_CANDIDATE_LIMIT`(默认每类 `30` 条)
|
|
114
|
-
- `MEMOS_RECALL_FILTER_MAX_ITEM_CHARS`(默认 `500`)
|
|
115
|
-
- `MEMOS_RECALL_FILTER_FAIL_OPEN`(默认 `true`;筛选失败时回退为“不过滤”)
|
|
116
|
-
- `MEMOS_CAPTURE_STRATEGY`(默认 `last_turn`;记忆捕获策略)
|
|
117
|
-
- `MEMOS_ASYNC_MODE`(默认 `true`;异步模式添加记忆)
|
|
118
|
-
- `MEMOS_THROTTLE_MS`(默认 `0`;请求节流时间,单位毫秒)
|
|
119
|
-
- `MEMOS_INCLUDE_ASSISTANT`(默认 `true`;记忆是否包含助手回复)
|
|
120
|
-
- `MEMOS_MAX_MESSAGE_CHARS`(默认 `20000`;单条记忆最大字符数限制)
|
|
121
|
-
|
|
122
|
-
## 可选插件配置
|
|
123
|
-
在 `plugins.entries.memos-cloud-openclaw-plugin.config` 中设置:
|
|
124
|
-
```json
|
|
125
|
-
{
|
|
126
|
-
"baseUrl": "https://memos.memtensor.cn/api/openmem/v1",
|
|
127
|
-
"apiKey": "YOUR_API_KEY",
|
|
128
|
-
"userId": "memos_user_123",
|
|
129
|
-
"useDirectSessionUserId": false,
|
|
130
|
-
"conversationId": "openclaw-main",
|
|
131
|
-
"queryPrefix": "important user context preferences decisions ",
|
|
132
|
-
"recallEnabled": true,
|
|
133
|
-
"recallGlobal": true,
|
|
134
|
-
"addEnabled": true,
|
|
135
|
-
"captureStrategy": "last_turn",
|
|
136
|
-
"includeAssistant": true,
|
|
137
|
-
"conversationIdPrefix": "",
|
|
138
|
-
"conversationIdSuffix": "",
|
|
139
|
-
"conversationSuffixMode": "none",
|
|
140
|
-
"resetOnNew": true,
|
|
141
|
-
"memoryLimitNumber": 6,
|
|
142
|
-
"preferenceLimitNumber": 6,
|
|
143
|
-
"knowledgebaseIds": [],
|
|
144
|
-
"includePreference": true,
|
|
145
|
-
"includeToolMemory": false,
|
|
146
|
-
"toolMemoryLimitNumber": 6,
|
|
147
|
-
"tags": ["openclaw"],
|
|
148
|
-
"agentId": "",
|
|
149
|
-
"multiAgentMode": false,
|
|
150
|
-
"allowedAgents": [],
|
|
151
|
-
"asyncMode": true,
|
|
152
|
-
"recallFilterEnabled": false,
|
|
153
|
-
"recallFilterBaseUrl": "http://127.0.0.1:11434/v1",
|
|
154
|
-
"recallFilterApiKey": "",
|
|
155
|
-
"recallFilterModel": "qwen2.5:7b",
|
|
156
|
-
"recallFilterTimeoutMs": 30000,
|
|
157
|
-
"recallFilterRetries": 1,
|
|
158
|
-
"recallFilterCandidateLimit": 30,
|
|
159
|
-
"recallFilterMaxItemChars": 500,
|
|
160
|
-
"recallFilterFailOpen": true,
|
|
161
|
-
"throttleMs": 0,
|
|
162
|
-
"maxMessageChars": 20000
|
|
163
|
-
}
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
## 工作原理
|
|
167
|
-
### 1) 召回(新版 OpenClaw 使用 `before_prompt_build`;旧版回退到 `before_agent_start`)
|
|
168
|
-
- 组装 `/search/memory` 请求
|
|
169
|
-
- `user_id`、`query`(= prompt + 可选前缀)
|
|
170
|
-
- 默认**全局召回**:`recallGlobal=true` 时不传 `conversation_id`
|
|
171
|
-
- 可选 `filter` / `knowledgebase_ids`
|
|
172
|
-
- (可选)若开启 `recallFilterEnabled`,会先把 `memory/preference/tool_memory` 候选发给你配置的模型做二次筛选,只保留 `keep` 的条目
|
|
173
|
-
- 将稳定的 MemOS 召回协议通过 `appendSystemContext` 注入,而检索到的 `<memories>` 数据块继续通过 `prependContext` 注入
|
|
174
|
-
|
|
175
|
-
### 2) 添加(agent_end)
|
|
176
|
-
- 默认只写**最后一轮**(user + assistant)
|
|
177
|
-
- 构造 `/add/message` 请求:
|
|
178
|
-
- `user_id`、`conversation_id`
|
|
179
|
-
- `messages` 列表
|
|
180
|
-
- 可选 `tags / info / agent_id / app_id`
|
|
181
|
-
|
|
182
|
-
## 多Agent支持(Multi-Agent)
|
|
183
|
-
插件内置对多Agent模式的支持(`agent_id` 参数):
|
|
184
|
-
- **开启模式**:需要在配置中设置 `"multiAgentMode": true` 或在环境变量中设置 `MEMOS_MULTI_AGENT_MODE=true`(默认为 `false`)。
|
|
185
|
-
- **动态获取**:开启后,执行生命周期钩子时会自动读取上下文中的 `ctx.agentId`。(注:OpenClaw 的默认 Agent `"main"` 会被自动忽略,以保证老用户的单 Agent 数据兼容性)。
|
|
186
|
-
- **数据隔离**:在调用 `/search/memory`(检索记忆)和 `/add/message`(添加记录)时会自动附带该 `agent_id`,从而保证即使是同一用户下的不同 Agent 之间,记忆和反馈数据也是完全隔离的。
|
|
187
|
-
- **静态配置**:如果需要,也可在上述插件的 `config` 中显式指定 `"agentId": "your_agent_id"` 作为固定值。
|
|
188
|
-
|
|
189
|
-
### 按 Agent 开关记忆插件
|
|
190
|
-
|
|
191
|
-
在多 Agent 模式下,可以通过 `MEMOS_ALLOWED_AGENTS` 精确控制哪些 Agent 启用记忆功能。未在白名单中的 Agent 将完全跳过记忆召回和记忆添加。
|
|
192
|
-
|
|
193
|
-
**环境变量配置**(在 `~/.openclaw/.env` 中设置):
|
|
194
|
-
```env
|
|
195
|
-
MEMOS_MULTI_AGENT_MODE=true
|
|
196
|
-
MEMOS_ALLOWED_AGENTS="agent1,agent2"
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
多个 Agent ID 之间用英文逗号分隔。
|
|
200
|
-
|
|
201
|
-
**插件配置**(在 `openclaw.json` 中设置):
|
|
202
|
-
```json
|
|
203
|
-
{
|
|
204
|
-
"plugins": {
|
|
205
|
-
"entries": {
|
|
206
|
-
"memos-cloud-openclaw-plugin": {
|
|
207
|
-
"enabled": true,
|
|
208
|
-
"config": {
|
|
209
|
-
"multiAgentMode": true,
|
|
210
|
-
"allowedAgents": ["agent1", "agent2"]
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
**行为规则**:
|
|
219
|
-
| 配置 | 效果 |
|
|
220
|
-
|------|------|
|
|
221
|
-
| `MEMOS_ALLOWED_AGENTS` 未设置或为空 | 所有 Agent 均启用记忆 |
|
|
222
|
-
| `MEMOS_ALLOWED_AGENTS="agent1,agent2"` | 仅 `agent1` 和 `agent2` 启用,其余跳过 |
|
|
223
|
-
| `MEMOS_ALLOWED_AGENTS="agent1"` | 仅 `agent1` 启用,其他 Agent 均跳过 |
|
|
224
|
-
| `MEMOS_MULTI_AGENT_MODE=false` | 白名单不生效,所有请求按单 Agent 模式处理 |
|
|
225
|
-
|
|
226
|
-
> **注意**:白名单仅在 `multiAgentMode=true` 时生效。关闭多 Agent 模式时,所有 Agent 的记忆功能均正常工作,白名单配置被忽略。
|
|
227
|
-
|
|
228
|
-
### 按 Agent 独立配置参数(agentOverrides)
|
|
229
|
-
|
|
230
|
-
除了按 Agent 开关记忆功能外,你还可以通过 `agentOverrides` 为**每个 Agent 配置不同的记忆参数**,包括知识库、召回条数、相关性阈值等。
|
|
231
|
-
|
|
232
|
-
**插件配置**(在 `openclaw.json` 中设置):
|
|
233
|
-
```json
|
|
234
|
-
{
|
|
235
|
-
"plugins": {
|
|
236
|
-
"entries": {
|
|
237
|
-
"memos-cloud-openclaw-plugin": {
|
|
238
|
-
"enabled": true,
|
|
239
|
-
"config": {
|
|
240
|
-
"multiAgentMode": true,
|
|
241
|
-
"allowedAgents": ["default", "research-agent", "coding-agent"],
|
|
242
|
-
"knowledgebaseIds": [],
|
|
243
|
-
"memoryLimitNumber": 6,
|
|
244
|
-
"relativity": 0.45,
|
|
245
|
-
|
|
246
|
-
"agentOverrides": {
|
|
247
|
-
"research-agent": {
|
|
248
|
-
"knowledgebaseIds": ["kb-research-papers", "kb-academic"],
|
|
249
|
-
"memoryLimitNumber": 12,
|
|
250
|
-
"relativity": 0.3,
|
|
251
|
-
"includeToolMemory": true,
|
|
252
|
-
"captureStrategy": "full_session",
|
|
253
|
-
"queryPrefix": "research context: "
|
|
254
|
-
},
|
|
255
|
-
"coding-agent": {
|
|
256
|
-
"knowledgebaseIds": ["kb-codebase", "kb-api-docs"],
|
|
257
|
-
"memoryLimitNumber": 9,
|
|
258
|
-
"relativity": 0.5,
|
|
259
|
-
"addEnabled": false
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
**环境变量配置**(在 `~/.openclaw/.env` 中设置):
|
|
270
|
-
你可以使用 `MEMOS_AGENT_OVERRIDES` 来配置一个 JSON 字符串,覆盖全局参数。注意:`.env` 中的配置优先级低于 `openclaw.json` 中的 `agentOverrides` 配置。
|
|
271
|
-
```env
|
|
272
|
-
MEMOS_AGENT_OVERRIDES='{"research-agent": {"memoryLimitNumber": 12, "relativity": 0.3}, "coding-agent": {"memoryLimitNumber": 9}}'
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
**工作原理**:
|
|
276
|
-
- `agentOverrides.<agentId>` 中的字段会覆盖该 Agent 对应的全局默认值
|
|
277
|
-
- 只需写需要覆盖的字段,其余参数从全局配置继承
|
|
278
|
-
- 若某个 Agent 没有对应的 override 条目,则完全使用全局配置
|
|
279
|
-
|
|
280
|
-
**可覆盖字段**:
|
|
281
|
-
|
|
282
|
-
| 字段 | 说明 |
|
|
283
|
-
|------|------|
|
|
284
|
-
| `knowledgebaseIds` | `/search/memory` 使用的知识库 ID 列表 |
|
|
285
|
-
| `memoryLimitNumber` | 召回的事实记忆最大条数 |
|
|
286
|
-
| `preferenceLimitNumber` | 召回的偏好记忆最大条数 |
|
|
287
|
-
| `includePreference` | 是否启用偏好记忆召回 |
|
|
288
|
-
| `includeToolMemory` | 是否启用工具记忆召回 |
|
|
289
|
-
| `toolMemoryLimitNumber` | 工具记忆最大条数 |
|
|
290
|
-
| `relativity` | 相关性阈值(0-1) |
|
|
291
|
-
| `recallEnabled` | 该 Agent 是否启用记忆检索 |
|
|
292
|
-
| `addEnabled` | 该 Agent 是否启用记忆写入 |
|
|
293
|
-
| `captureStrategy` | `last_turn` 或 `full_session` |
|
|
294
|
-
| `queryPrefix` | 搜索查询前缀 |
|
|
295
|
-
| `maxItemChars` | 注入 prompt 时每条记忆的最大字符数 |
|
|
296
|
-
| `maxMessageChars` | 写入记忆时每条消息的最大字符数 |
|
|
297
|
-
| `includeAssistant` | 写入记忆时是否包含助手回复 |
|
|
298
|
-
| `recallGlobal` | 全局召回(不传 conversation_id) |
|
|
299
|
-
| `recallFilterEnabled` | 是否启用模型二次过滤 |
|
|
300
|
-
| `recallFilterModel` | 过滤模型名 |
|
|
301
|
-
| `recallFilterBaseUrl` | 过滤模型接口地址 |
|
|
302
|
-
| `recallFilterApiKey` | 过滤模型鉴权密钥 |
|
|
303
|
-
| `allowKnowledgebaseIds` | `/add/message` 允许写入的知识库 |
|
|
304
|
-
| `tags` | `/add/message` 标签 |
|
|
305
|
-
| `throttleMs` | 请求节流间隔 |
|
|
306
|
-
|
|
307
|
-
## 私聊 Session User ID(Direct Session User ID)
|
|
308
|
-
- **默认行为**:仍然使用配置里的 `userId`(或 `MEMOS_USER_ID`),完全兼容旧行为。
|
|
309
|
-
- **开启方式**:在插件 config 中设置 `"useDirectSessionUserId": true`,或在环境变量中设置 `MEMOS_USE_DIRECT_SESSION_USER_ID=true`。
|
|
310
|
-
- **行为说明**:开启后,像 `agent:main:<provider>:direct:<peer-id>` 这样的私聊 sessionKey,会把 `<peer-id>` 当作 MemOS `user_id`。
|
|
311
|
-
- **不会影响的场景**:像 `agent:main:<provider>:channel:<channel-id>` 这类非私聊 sessionKey,仍继续使用配置好的 fallback `userId`。
|
|
312
|
-
- **作用范围**:同一套解析逻辑同时作用于 `buildSearchPayload()` 和 `buildAddMessagePayload()`,保证 recall 与 add 一致。
|
|
313
|
-
- **配置优先级**:仍遵循插件现有规则——插件 config 优先,其次是 `.env` 文件(`~/.openclaw/.env` -> `~/.moltbot/.env` -> `~/.clawdbot/.env`)。
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
## 说明
|
|
317
|
-
- 未显式指定 `conversation_id` 时,默认使用 OpenClaw `sessionKey`。**TODO**:后续考虑直接绑定 OpenClaw `sessionId`。
|
|
318
|
-
- 可配置前后缀;`conversationSuffixMode=counter` 时会在 `/new` 递增(需 `hooks.internal.enabled`)。
|
|
319
|
-
|
|
320
|
-
## 致谢
|
|
321
|
-
- 感谢 @anatolykoptev(Contributor)— 领英:https://www.linkedin.com/in/koptev?utm_source=share&utm_campaign=share_via&utm_content=profile&utm_medium=ios_app
|
|
1
|
+
# MemOS Cloud OpenClaw Plugin(Lifecycle 插件)
|
|
2
|
+
|
|
3
|
+
官方维护:MemTensor。
|
|
4
|
+
|
|
5
|
+
这是一个最小可用的 OpenClaw lifecycle 插件,功能是:
|
|
6
|
+
- **召回记忆**:在每轮对话前从 MemOS Cloud 检索记忆并注入上下文
|
|
7
|
+
- **添加记忆**:在每轮对话结束后把消息写回 MemOS Cloud
|
|
8
|
+
|
|
9
|
+
## 功能
|
|
10
|
+
- **Recall**:`before_prompt_build`(旧版 OpenClaw 回退到 `before_agent_start`)→ `/search/memory`
|
|
11
|
+
- **Add**:`agent_end` → `/add/message`
|
|
12
|
+
- **Config UI**:启动 gateway 时同时启动本地插件配置页面,用来编辑 `plugins.entries.memos-cloud-openclaw-plugin.config`
|
|
13
|
+
- 使用 **Token** 认证(`Authorization: Token <MEMOS_API_KEY>`)
|
|
14
|
+
|
|
15
|
+
## 配置页面
|
|
16
|
+
- Gateway 启动后,插件会同时拉起一个本地配置页面,并在终端输出访问地址(默认:`http://127.0.0.1:38463`)。
|
|
17
|
+
- 页面会直接读取并写回当前宿主的配置文件:
|
|
18
|
+
- OpenClaw:`~/.openclaw/openclaw.json`
|
|
19
|
+
- Moltbot:`~/.moltbot/moltbot.json`
|
|
20
|
+
- ClawDBot:`~/.clawdbot/clawdbot.json`
|
|
21
|
+
- 如果默认端口被占用,插件会自动顺延到下一个可用端口。
|
|
22
|
+
- 页面保存后会写回 `plugins.entries.memos-cloud-openclaw-plugin.config`。(注意:保存后可能需要手动重启 Gateway 以使配置生效)
|
|
23
|
+
|
|
24
|
+
## 安装
|
|
25
|
+
|
|
26
|
+
### 方式 A — NPM(推荐)
|
|
27
|
+
```bash
|
|
28
|
+
openclaw plugins install @memtensor/memos-cloud-openclaw-plugin@latest
|
|
29
|
+
openclaw gateway restart
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> **Windows 用户注意**:
|
|
33
|
+
> 如果遇到 `Error: spawn EINVAL` 报错,这是 OpenClaw Windows 安装器的已知问题。请使用下方的 **方式 B**(手动安装)。
|
|
34
|
+
|
|
35
|
+
确认 `~/.openclaw/openclaw.json` 中已启用:
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"plugins": {
|
|
39
|
+
"entries": {
|
|
40
|
+
"memos-cloud-openclaw-plugin": { "enabled": true }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 方式 B — 手动安装(Windows 解决方案)
|
|
47
|
+
1. 从 [NPM](https://www.npmjs.com/package/@memtensor/memos-cloud-openclaw-plugin) 下载最新的 `.tgz` 包。
|
|
48
|
+
2. 解压到本地目录(例如 `C:\Users\YourName\.openclaw\extensions\memos-cloud-openclaw-plugin`)。
|
|
49
|
+
3. 修改配置 `~/.openclaw/openclaw.json`(或 `%USERPROFILE%\.openclaw\openclaw.json`):
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"plugins": {
|
|
54
|
+
"entries": {
|
|
55
|
+
"memos-cloud-openclaw-plugin": { "enabled": true }
|
|
56
|
+
},
|
|
57
|
+
"load": {
|
|
58
|
+
"paths": [
|
|
59
|
+
"C:\\Users\\YourName\\.openclaw\\extensions\\memos-cloud-openclaw-plugin"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
*注意:解压后的文件夹通常包含一个 `package` 子文件夹,请指向包含 `package.json` 的那层目录。*
|
|
66
|
+
|
|
67
|
+
修改配置后需要重启 gateway。
|
|
68
|
+
|
|
69
|
+
## 环境变量
|
|
70
|
+
插件运行时配置的优先级是:**插件 config → env 文件**。为符合纯粹的安全沙箱规范,插件不再支持回退到进程环境变量去读取敏感凭证。
|
|
71
|
+
在 env 文件层,按顺序读取(**openclaw → moltbot → clawdbot**),每个键优先使用最先匹配到的值。
|
|
72
|
+
|
|
73
|
+
**配置位置**
|
|
74
|
+
- 文件(优先级顺序):
|
|
75
|
+
- `~/.openclaw/.env`
|
|
76
|
+
- `~/.moltbot/.env`
|
|
77
|
+
- `~/.clawdbot/.env`
|
|
78
|
+
- 每行格式:`KEY=value`
|
|
79
|
+
|
|
80
|
+
**快速配置(Shell / Windows)**
|
|
81
|
+
```bash
|
|
82
|
+
echo 'MEMOS_API_KEY="mpg-..."' >> ~/.openclaw/.env
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
若未读取到 `MEMOS_API_KEY`,插件会提示配置方式并附 API Key 获取地址。
|
|
86
|
+
|
|
87
|
+
**最小配置**
|
|
88
|
+
```env
|
|
89
|
+
MEMOS_API_KEY=YOUR_TOKEN
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**可选配置**
|
|
93
|
+
- `MEMOS_BASE_URL`(默认 `https://memos.memtensor.cn/api/openmem/v1`)
|
|
94
|
+
- `MEMOS_API_KEY`(必填,Token 认证)—— 获取地址:https://memos-dashboard.openmem.net/cn/apikeys/
|
|
95
|
+
- `MEMOS_USER_ID`(可选,默认 `openclaw-user`)
|
|
96
|
+
- `MEMOS_USE_DIRECT_SESSION_USER_ID`(默认 `false`;开启后,对 `agent:main:<provider>:direct:<peer-id>` 这类私聊 sessionKey,会把 `<peer-id>` 作为 MemOS `user_id`)
|
|
97
|
+
- `MEMOS_CONVERSATION_ID`(可选覆盖)
|
|
98
|
+
- `MEMOS_KNOWLEDGEBASE_IDS`(可选;逗号分隔的全局知识库 ID 列表,用于 `/search/memory`,例如:`"kb-123, kb-456"`)
|
|
99
|
+
- `MEMOS_ALLOW_KNOWLEDGEBASE_IDS`(可选;逗号分隔的知识库 ID 列表,用于 `/add/message`,例如:`"kb-123"`)
|
|
100
|
+
- `MEMOS_TAGS`(可选;逗号分隔的标签列表,用于 `/add/message`,默认:`"openclaw"`,例如:`"openclaw, dev"`)
|
|
101
|
+
- `MEMOS_RECALL_GLOBAL`(默认 `true`;为 true 时检索不传 conversation_id)
|
|
102
|
+
- `MEMOS_MULTI_AGENT_MODE`(默认 `false`;是否开启多 Agent 数据隔离模式)
|
|
103
|
+
- `MEMOS_ALLOWED_AGENTS`(可选;多 Agent 模式下的白名单,逗号分隔,例如 `"agent1,agent2"`;为空则所有 Agent 均启用)
|
|
104
|
+
- `MEMOS_CONVERSATION_PREFIX` / `MEMOS_CONVERSATION_SUFFIX`(可选)
|
|
105
|
+
- `MEMOS_CONVERSATION_SUFFIX_MODE`(`none` | `counter`,默认 `none`)
|
|
106
|
+
- `MEMOS_CONVERSATION_RESET_ON_NEW`(默认 `true`,需 hooks.internal.enabled)
|
|
107
|
+
- `MEMOS_RECALL_FILTER_ENABLED`(默认 `false`;开启后先用你指定的模型过滤召回记忆再注入)
|
|
108
|
+
- `MEMOS_RECALL_FILTER_BASE_URL`(OpenAI 兼容接口,例如 `http://127.0.0.1:11434/v1`)
|
|
109
|
+
- `MEMOS_RECALL_FILTER_API_KEY`(可选,若你的接口需要鉴权)
|
|
110
|
+
- `MEMOS_RECALL_FILTER_MODEL`(用于筛选记忆的模型名)
|
|
111
|
+
- `MEMOS_RECALL_FILTER_TIMEOUT_MS`(默认 `30000`)
|
|
112
|
+
- `MEMOS_RECALL_FILTER_RETRIES`(默认 `1`)
|
|
113
|
+
- `MEMOS_RECALL_FILTER_CANDIDATE_LIMIT`(默认每类 `30` 条)
|
|
114
|
+
- `MEMOS_RECALL_FILTER_MAX_ITEM_CHARS`(默认 `500`)
|
|
115
|
+
- `MEMOS_RECALL_FILTER_FAIL_OPEN`(默认 `true`;筛选失败时回退为“不过滤”)
|
|
116
|
+
- `MEMOS_CAPTURE_STRATEGY`(默认 `last_turn`;记忆捕获策略)
|
|
117
|
+
- `MEMOS_ASYNC_MODE`(默认 `true`;异步模式添加记忆)
|
|
118
|
+
- `MEMOS_THROTTLE_MS`(默认 `0`;请求节流时间,单位毫秒)
|
|
119
|
+
- `MEMOS_INCLUDE_ASSISTANT`(默认 `true`;记忆是否包含助手回复)
|
|
120
|
+
- `MEMOS_MAX_MESSAGE_CHARS`(默认 `20000`;单条记忆最大字符数限制)
|
|
121
|
+
|
|
122
|
+
## 可选插件配置
|
|
123
|
+
在 `plugins.entries.memos-cloud-openclaw-plugin.config` 中设置:
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"baseUrl": "https://memos.memtensor.cn/api/openmem/v1",
|
|
127
|
+
"apiKey": "YOUR_API_KEY",
|
|
128
|
+
"userId": "memos_user_123",
|
|
129
|
+
"useDirectSessionUserId": false,
|
|
130
|
+
"conversationId": "openclaw-main",
|
|
131
|
+
"queryPrefix": "important user context preferences decisions ",
|
|
132
|
+
"recallEnabled": true,
|
|
133
|
+
"recallGlobal": true,
|
|
134
|
+
"addEnabled": true,
|
|
135
|
+
"captureStrategy": "last_turn",
|
|
136
|
+
"includeAssistant": true,
|
|
137
|
+
"conversationIdPrefix": "",
|
|
138
|
+
"conversationIdSuffix": "",
|
|
139
|
+
"conversationSuffixMode": "none",
|
|
140
|
+
"resetOnNew": true,
|
|
141
|
+
"memoryLimitNumber": 6,
|
|
142
|
+
"preferenceLimitNumber": 6,
|
|
143
|
+
"knowledgebaseIds": [],
|
|
144
|
+
"includePreference": true,
|
|
145
|
+
"includeToolMemory": false,
|
|
146
|
+
"toolMemoryLimitNumber": 6,
|
|
147
|
+
"tags": ["openclaw"],
|
|
148
|
+
"agentId": "",
|
|
149
|
+
"multiAgentMode": false,
|
|
150
|
+
"allowedAgents": [],
|
|
151
|
+
"asyncMode": true,
|
|
152
|
+
"recallFilterEnabled": false,
|
|
153
|
+
"recallFilterBaseUrl": "http://127.0.0.1:11434/v1",
|
|
154
|
+
"recallFilterApiKey": "",
|
|
155
|
+
"recallFilterModel": "qwen2.5:7b",
|
|
156
|
+
"recallFilterTimeoutMs": 30000,
|
|
157
|
+
"recallFilterRetries": 1,
|
|
158
|
+
"recallFilterCandidateLimit": 30,
|
|
159
|
+
"recallFilterMaxItemChars": 500,
|
|
160
|
+
"recallFilterFailOpen": true,
|
|
161
|
+
"throttleMs": 0,
|
|
162
|
+
"maxMessageChars": 20000
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## 工作原理
|
|
167
|
+
### 1) 召回(新版 OpenClaw 使用 `before_prompt_build`;旧版回退到 `before_agent_start`)
|
|
168
|
+
- 组装 `/search/memory` 请求
|
|
169
|
+
- `user_id`、`query`(= prompt + 可选前缀)
|
|
170
|
+
- 默认**全局召回**:`recallGlobal=true` 时不传 `conversation_id`
|
|
171
|
+
- 可选 `filter` / `knowledgebase_ids`
|
|
172
|
+
- (可选)若开启 `recallFilterEnabled`,会先把 `memory/preference/tool_memory` 候选发给你配置的模型做二次筛选,只保留 `keep` 的条目
|
|
173
|
+
- 将稳定的 MemOS 召回协议通过 `appendSystemContext` 注入,而检索到的 `<memories>` 数据块继续通过 `prependContext` 注入
|
|
174
|
+
|
|
175
|
+
### 2) 添加(agent_end)
|
|
176
|
+
- 默认只写**最后一轮**(user + assistant)
|
|
177
|
+
- 构造 `/add/message` 请求:
|
|
178
|
+
- `user_id`、`conversation_id`
|
|
179
|
+
- `messages` 列表
|
|
180
|
+
- 可选 `tags / info / agent_id / app_id`
|
|
181
|
+
|
|
182
|
+
## 多Agent支持(Multi-Agent)
|
|
183
|
+
插件内置对多Agent模式的支持(`agent_id` 参数):
|
|
184
|
+
- **开启模式**:需要在配置中设置 `"multiAgentMode": true` 或在环境变量中设置 `MEMOS_MULTI_AGENT_MODE=true`(默认为 `false`)。
|
|
185
|
+
- **动态获取**:开启后,执行生命周期钩子时会自动读取上下文中的 `ctx.agentId`。(注:OpenClaw 的默认 Agent `"main"` 会被自动忽略,以保证老用户的单 Agent 数据兼容性)。
|
|
186
|
+
- **数据隔离**:在调用 `/search/memory`(检索记忆)和 `/add/message`(添加记录)时会自动附带该 `agent_id`,从而保证即使是同一用户下的不同 Agent 之间,记忆和反馈数据也是完全隔离的。
|
|
187
|
+
- **静态配置**:如果需要,也可在上述插件的 `config` 中显式指定 `"agentId": "your_agent_id"` 作为固定值。
|
|
188
|
+
|
|
189
|
+
### 按 Agent 开关记忆插件
|
|
190
|
+
|
|
191
|
+
在多 Agent 模式下,可以通过 `MEMOS_ALLOWED_AGENTS` 精确控制哪些 Agent 启用记忆功能。未在白名单中的 Agent 将完全跳过记忆召回和记忆添加。
|
|
192
|
+
|
|
193
|
+
**环境变量配置**(在 `~/.openclaw/.env` 中设置):
|
|
194
|
+
```env
|
|
195
|
+
MEMOS_MULTI_AGENT_MODE=true
|
|
196
|
+
MEMOS_ALLOWED_AGENTS="agent1,agent2"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
多个 Agent ID 之间用英文逗号分隔。
|
|
200
|
+
|
|
201
|
+
**插件配置**(在 `openclaw.json` 中设置):
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"plugins": {
|
|
205
|
+
"entries": {
|
|
206
|
+
"memos-cloud-openclaw-plugin": {
|
|
207
|
+
"enabled": true,
|
|
208
|
+
"config": {
|
|
209
|
+
"multiAgentMode": true,
|
|
210
|
+
"allowedAgents": ["agent1", "agent2"]
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**行为规则**:
|
|
219
|
+
| 配置 | 效果 |
|
|
220
|
+
|------|------|
|
|
221
|
+
| `MEMOS_ALLOWED_AGENTS` 未设置或为空 | 所有 Agent 均启用记忆 |
|
|
222
|
+
| `MEMOS_ALLOWED_AGENTS="agent1,agent2"` | 仅 `agent1` 和 `agent2` 启用,其余跳过 |
|
|
223
|
+
| `MEMOS_ALLOWED_AGENTS="agent1"` | 仅 `agent1` 启用,其他 Agent 均跳过 |
|
|
224
|
+
| `MEMOS_MULTI_AGENT_MODE=false` | 白名单不生效,所有请求按单 Agent 模式处理 |
|
|
225
|
+
|
|
226
|
+
> **注意**:白名单仅在 `multiAgentMode=true` 时生效。关闭多 Agent 模式时,所有 Agent 的记忆功能均正常工作,白名单配置被忽略。
|
|
227
|
+
|
|
228
|
+
### 按 Agent 独立配置参数(agentOverrides)
|
|
229
|
+
|
|
230
|
+
除了按 Agent 开关记忆功能外,你还可以通过 `agentOverrides` 为**每个 Agent 配置不同的记忆参数**,包括知识库、召回条数、相关性阈值等。
|
|
231
|
+
|
|
232
|
+
**插件配置**(在 `openclaw.json` 中设置):
|
|
233
|
+
```json
|
|
234
|
+
{
|
|
235
|
+
"plugins": {
|
|
236
|
+
"entries": {
|
|
237
|
+
"memos-cloud-openclaw-plugin": {
|
|
238
|
+
"enabled": true,
|
|
239
|
+
"config": {
|
|
240
|
+
"multiAgentMode": true,
|
|
241
|
+
"allowedAgents": ["default", "research-agent", "coding-agent"],
|
|
242
|
+
"knowledgebaseIds": [],
|
|
243
|
+
"memoryLimitNumber": 6,
|
|
244
|
+
"relativity": 0.45,
|
|
245
|
+
|
|
246
|
+
"agentOverrides": {
|
|
247
|
+
"research-agent": {
|
|
248
|
+
"knowledgebaseIds": ["kb-research-papers", "kb-academic"],
|
|
249
|
+
"memoryLimitNumber": 12,
|
|
250
|
+
"relativity": 0.3,
|
|
251
|
+
"includeToolMemory": true,
|
|
252
|
+
"captureStrategy": "full_session",
|
|
253
|
+
"queryPrefix": "research context: "
|
|
254
|
+
},
|
|
255
|
+
"coding-agent": {
|
|
256
|
+
"knowledgebaseIds": ["kb-codebase", "kb-api-docs"],
|
|
257
|
+
"memoryLimitNumber": 9,
|
|
258
|
+
"relativity": 0.5,
|
|
259
|
+
"addEnabled": false
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
**环境变量配置**(在 `~/.openclaw/.env` 中设置):
|
|
270
|
+
你可以使用 `MEMOS_AGENT_OVERRIDES` 来配置一个 JSON 字符串,覆盖全局参数。注意:`.env` 中的配置优先级低于 `openclaw.json` 中的 `agentOverrides` 配置。
|
|
271
|
+
```env
|
|
272
|
+
MEMOS_AGENT_OVERRIDES='{"research-agent": {"memoryLimitNumber": 12, "relativity": 0.3}, "coding-agent": {"memoryLimitNumber": 9}}'
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**工作原理**:
|
|
276
|
+
- `agentOverrides.<agentId>` 中的字段会覆盖该 Agent 对应的全局默认值
|
|
277
|
+
- 只需写需要覆盖的字段,其余参数从全局配置继承
|
|
278
|
+
- 若某个 Agent 没有对应的 override 条目,则完全使用全局配置
|
|
279
|
+
|
|
280
|
+
**可覆盖字段**:
|
|
281
|
+
|
|
282
|
+
| 字段 | 说明 |
|
|
283
|
+
|------|------|
|
|
284
|
+
| `knowledgebaseIds` | `/search/memory` 使用的知识库 ID 列表 |
|
|
285
|
+
| `memoryLimitNumber` | 召回的事实记忆最大条数 |
|
|
286
|
+
| `preferenceLimitNumber` | 召回的偏好记忆最大条数 |
|
|
287
|
+
| `includePreference` | 是否启用偏好记忆召回 |
|
|
288
|
+
| `includeToolMemory` | 是否启用工具记忆召回 |
|
|
289
|
+
| `toolMemoryLimitNumber` | 工具记忆最大条数 |
|
|
290
|
+
| `relativity` | 相关性阈值(0-1) |
|
|
291
|
+
| `recallEnabled` | 该 Agent 是否启用记忆检索 |
|
|
292
|
+
| `addEnabled` | 该 Agent 是否启用记忆写入 |
|
|
293
|
+
| `captureStrategy` | `last_turn` 或 `full_session` |
|
|
294
|
+
| `queryPrefix` | 搜索查询前缀 |
|
|
295
|
+
| `maxItemChars` | 注入 prompt 时每条记忆的最大字符数 |
|
|
296
|
+
| `maxMessageChars` | 写入记忆时每条消息的最大字符数 |
|
|
297
|
+
| `includeAssistant` | 写入记忆时是否包含助手回复 |
|
|
298
|
+
| `recallGlobal` | 全局召回(不传 conversation_id) |
|
|
299
|
+
| `recallFilterEnabled` | 是否启用模型二次过滤 |
|
|
300
|
+
| `recallFilterModel` | 过滤模型名 |
|
|
301
|
+
| `recallFilterBaseUrl` | 过滤模型接口地址 |
|
|
302
|
+
| `recallFilterApiKey` | 过滤模型鉴权密钥 |
|
|
303
|
+
| `allowKnowledgebaseIds` | `/add/message` 允许写入的知识库 |
|
|
304
|
+
| `tags` | `/add/message` 标签 |
|
|
305
|
+
| `throttleMs` | 请求节流间隔 |
|
|
306
|
+
|
|
307
|
+
## 私聊 Session User ID(Direct Session User ID)
|
|
308
|
+
- **默认行为**:仍然使用配置里的 `userId`(或 `MEMOS_USER_ID`),完全兼容旧行为。
|
|
309
|
+
- **开启方式**:在插件 config 中设置 `"useDirectSessionUserId": true`,或在环境变量中设置 `MEMOS_USE_DIRECT_SESSION_USER_ID=true`。
|
|
310
|
+
- **行为说明**:开启后,像 `agent:main:<provider>:direct:<peer-id>` 这样的私聊 sessionKey,会把 `<peer-id>` 当作 MemOS `user_id`。
|
|
311
|
+
- **不会影响的场景**:像 `agent:main:<provider>:channel:<channel-id>` 这类非私聊 sessionKey,仍继续使用配置好的 fallback `userId`。
|
|
312
|
+
- **作用范围**:同一套解析逻辑同时作用于 `buildSearchPayload()` 和 `buildAddMessagePayload()`,保证 recall 与 add 一致。
|
|
313
|
+
- **配置优先级**:仍遵循插件现有规则——插件 config 优先,其次是 `.env` 文件(`~/.openclaw/.env` -> `~/.moltbot/.env` -> `~/.clawdbot/.env`)。
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
## 说明
|
|
317
|
+
- 未显式指定 `conversation_id` 时,默认使用 OpenClaw `sessionKey`。**TODO**:后续考虑直接绑定 OpenClaw `sessionId`。
|
|
318
|
+
- 可配置前后缀;`conversationSuffixMode=counter` 时会在 `/new` 递增(需 `hooks.internal.enabled`)。
|
|
319
|
+
|
|
320
|
+
## 致谢
|
|
321
|
+
- 感谢 @anatolykoptev(Contributor)— 领英:https://www.linkedin.com/in/koptev?utm_source=share&utm_campaign=share_via&utm_content=profile&utm_medium=ios_app
|