You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43-16Lines changed: 43 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@
8
8
9
9
# OpenClaw Memory (PowerMem) Plugin
10
10
11
-
This plugin lets [OpenClaw](https://github.com/openclaw/openclaw) use long-term memory via [PowerMem](https://github.com/oceanbase/powermem): intelligent extraction, Ebbinghaus forgetting curve, multi-agent isolation.
11
+
This plugin lets [OpenClaw](https://github.com/openclaw/openclaw) use long-term memory via [PowerMem](https://github.com/oceanbase/powermem): intelligent extraction, Ebbinghaus forgetting curve, multi-agent isolation. Supports HTTP v2 (per-request config + agent memory sharing), LLM-based experience extraction, and optional dual-write to local SQLite.
12
12
13
13
**Default:****CLI mode** — the plugin runs `pmem` locally (no `powermem-server`). Use **HTTP mode** when you already run a shared PowerMem API (teams / enterprise).
**Note:** Running `npm i memory-powermem` in a Node project only adds the package to that project’s `node_modules`; it does **not** register the plugin with OpenClaw. To use this as an OpenClaw plugin, you must run `openclaw plugins install memory-powermem` (or install from a path as above), then restart the gateway.
187
187
188
-
After install, run `openclaw plugins list` and confirm `memory-powermem` is listed. With **no**`plugins.entries["memory-powermem"].config`, the plugin uses **defaults**: `mode: "cli"`, `envFile` under `~/.openclaw/powermem/powermem.env`, `pmemPath: "pmem"`, plus `autoCapture` / `autoRecall` / `inferOnAdd` enabled. Ensure `pmem` is on PATH (or set `pmemPath`) and the env file exists and is valid.
188
+
After install, run `openclaw plugins list` and confirm `memory-powermem` is listed. With **no**`plugins.entries["memory-powermem"].config`, the plugin uses **defaults**: `mode: "cli"`, `pmemPath: "bundled"` (npm `powermem` from plugin dependencies), `useOpenClawModel: true` (SQLite under OpenClaw state + LLM from `agents.defaults.model`), plus `autoCapture` / `autoRecall` / `inferOnAdd` enabled. No separate `powermem.env` is required unless you opt out of OpenClaw model injection.
189
189
190
190
---
191
191
192
192
## Step 3: Configure OpenClaw (optional)
193
193
194
-
If you use **CLI mode** with the default paths and `pmem` on PATH, you can skip this step. Customize for HTTP, a different URL/API key, or a non-default `envFile` / `pmemPath`.
194
+
If you use **CLI mode** with defaults (`bundled` + OpenClaw model injection), you can skip this step. Customize for HTTP, a different URL/API key, Python `pmem` (`pmemPath: "auto"`or an absolute path), or a `powermem``.env` via `envFile`.
195
195
196
196
**CLI (default):**
197
197
@@ -205,7 +205,7 @@ If you use **CLI mode** with the default paths and `pmem` on PATH, you can skip
-**CLI (default):** You may omit `mode` and use CLI when `baseUrl` is empty; use `envFile`+`pmemPath`.
237
+
-**CLI (default):** You may omit `mode` and use CLI when `baseUrl` is empty. Default `pmemPath` is `bundled` (npm CLI). Use `envFile`and/or`pmemPath` when you need a custom setup.
234
238
-**HTTP:** When `mode` is `http`, `baseUrl` is required; if you set `baseUrl` without `mode`, the plugin treats it as HTTP. Do **not** append `/api/v1` to `baseUrl`. If the server uses API key auth, add `"apiKey"`.
235
239
-**Restart the OpenClaw gateway** (or Mac menubar app) after changing config.
236
240
@@ -283,16 +287,32 @@ After installing, uninstalling, or changing config, restart the OpenClaw gateway
283
287
284
288
| Option | Required | Description |
285
289
|---------------|----------|-------------|
286
-
|`mode`| No | Backend: `"cli"` (default) or `"http"`. If omitted, non-empty `baseUrl` implies `http`. |
287
-
|`baseUrl`| Yes (http) | PowerMem API base URL when `mode` is `http`, e.g. `http://localhost:8000`, no `/api/v1` suffix. |
288
-
|`apiKey`| No | Set when PowerMem server has API key authentication enabled (http mode). |
289
-
|`envFile`| No | CLI: path to PowerMem `.env` (default when using plugin defaults: `~/.openclaw/powermem/powermem.env`). |
290
-
|`pmemPath`| No | CLI: path to `pmem` executable; default `pmem`. |
291
-
|`userId`| No | User isolation (multi-user); default `openclaw-user`. |
292
-
|`agentId`| No | Agent isolation (multi-agent); default `openclaw-agent`. |
293
-
|`autoCapture`| No | Auto-store from conversations after agent ends; default `true`. |
294
-
|`autoRecall`| No | Auto-inject relevant memories before agent starts; default `true`. |
295
-
|`inferOnAdd`| No | Use PowerMem intelligent extraction when adding; default `true`. |
290
+
|`mode`| No | Backend: `"cli"` (default) or `"http"`. If omitted, non-empty `baseUrl` implies `http`. |
291
+
|`baseUrl`| Yes (http) | PowerMem API base URL when `mode` is `http`, e.g. `http://localhost:8000`, no `/api/v1` suffix. |
292
+
|`apiKey`| No | Set when PowerMem server has API key authentication enabled (http mode). |
293
+
|`httpApiVersion`| No | HTTP API version: `"v1"` (default) or `"v2"`. |
294
+
|`requestConfig`| No | HTTP v2 only: forwarded as `config` in each request (e.g. `memory_db` settings). |
295
+
|`envFile`| No | CLI: path to PowerMem `.env` (default when using plugin defaults: `~/.openclaw/powermem/powermem.env`). |
296
+
|`pmemPath`| No | CLI: `bundled` (default), `auto`, or path/command for `pmem`. |
297
+
|`userId`| No | User isolation (multi-user). If omitted or set to `"auto"`, a stable ID is generated and stored in `<stateDir>/powermem/identity.json`. |
298
+
|`agentId`| No | Agent isolation (multi-agent). If omitted or set to `"auto"`, a stable ID is generated and stored in `<stateDir>/powermem/identity.json`. |
299
+
|`autoCapture`| No | Auto-store from conversations after agent ends; default `true`. |
300
+
|`autoRecall`| No | Auto-inject relevant memories before agent starts; default `true`. |
301
+
|`autoExperience`| No | Auto-extract procedural experiences via LLM; default `true`. |
302
+
|`experienceRecall`| No | Include experiences in recall results; default `true`. |
303
+
|`inferOnAdd`| No | Use PowerMem intelligent extraction when adding; default `true`. |
304
+
|`dualWrite`| No | HTTP only: write to remote + local SQLite and queue failed writes. |
305
+
|`localDbPath`| No | Local SQLite path for `dualWrite`. |
306
+
|`localUserId`| No | Local namespace for `dualWrite` (defaults to `userId`). |
307
+
|`localAgentId`| No | Local namespace for `dualWrite` (defaults to `agentId`). |
308
+
|`syncOnResume`| No | Whether to sync pending writes on startup; default `true`. |
309
+
|`syncBatchSize`| No | Pending sync batch size; default `50`. |
310
+
|`syncMinIntervalMs`| No | Minimum interval between sync attempts; default `5000`. |
311
+
|`syncBaseDelayMs`| No | Base delay for retry backoff; default `5000`. |
312
+
|`syncMaxDelayMs`| No | Max delay for retry backoff; default `60000`. |
313
+
|`syncMaxRetries`| No | Max retry count per pending item; default `10`. |
314
+
315
+
**Memory partitioning and sharing:** Use `userId` / `agentId` for logical isolation. In HTTP v2, `agent_memory_share` supports cross-agent sharing within the same `userId`; use `cross_scope_share` when you need to copy memories across both `userId` and `agentId` scopes.
296
316
297
317
**Auto-capture:** When a session ends, this round’s user/assistant text is sent to PowerMem (`infer: true`) for extraction and storage. At most 3 items per round, each up to about 6000 characters.
298
318
@@ -305,6 +325,13 @@ Exposed to OpenClaw agents:
305
325
-**memory_recall** — Search long-term memories by query.
306
326
-**memory_store** — Store one memory (optional intelligent extraction on write).
307
327
-**memory_forget** — Delete by memory ID or by search query.
328
+
-**experience_store** — Store a procedural experience.
**1. `openclaw ltm health` fails or cannot connect**
322
349
323
-
-**CLI:**`pmem` on PATH or correct `pmemPath`; valid`.env` at `envFile`.
350
+
-**CLI:**npm `powermem` installed with the plugin (`bundled`), or correct `pmemPath`; optional`.env` at `envFile` if not using OpenClaw model injection.
324
351
-**HTTP:** PowerMem is running (HTTP server in a terminal, or Docker); `baseUrl` is correct (e.g. `http://localhost:8000`; watch for `127.0.0.1` vs `localhost` mismatches).
325
352
- Remote server: use the host IP or hostname instead of `localhost`.
0 commit comments