PowerMem Memory Guide
This skill folder includes supplementary docs:
- - powermem-intro.md — What PowerMem is, features, vs file-based memory.
- config-reference.md — Config keys, state dir, commands.
How It Works
- - Auto-Capture: After a conversation, the plugin sends valuable user/assistant text to PowerMem (optional infer / intelligent extraction).
- Auto-Recall: Before each turn, it searches memories and can inject a
<relevant-memories> block into context.
When User Asks to Install
Recommended order (TO C): (1) OpenClaw installed and default model + provider auth configured. (2) Python 3.10+ verified (python3 --version) before venv / pip install. (3) pip install powermem and pmem available to the gateway (PATH or pmemPath). (4) Install the memory-powermem plugin. No powermem.env is required for the default path.
The curl install.sh deploys the plugin and OpenClaw entries; with -y it may still create ~/.openclaw/powermem/powermem.env as an optional template—it does not run pip install powermem. That file is not required if the user relies on OpenClaw-injected LLM + default SQLite.
- 1. Check OpenClaw
openclaw --version. If missing:
npm install -g openclaw,
openclaw onboard.
Ensure
agents.defaults.model is set (e.g.
openai/gpt-4o-mini) and the corresponding
provider / API key works for normal chat—the plugin reuses that for PowerMem when
useOpenClawModel is true (default).
- 2. Check Python (required before venv / pip)
PowerMem needs
Python 3.10 or newer. Run
python3 --version first; the minor version must be
≥ 10 (e.g. 3.10.x, 3.12.x). Optional strict check:
python3 -c "import sys; assert sys.version_info >= (3, 10), 'Need Python 3.10+'; print(sys.version.split()[0], 'OK')"
If it fails: upgrade Python or use a specific binary (e.g.
python3.12) for all commands below instead of
python3.
- 3. Install PowerMem (CLI — default)
- Venv recommended: e.g.
python3 -m venv ~/.openclaw/powermem/.venv && source ~/.openclaw/powermem/.venv/bin/activate.
-
pip install powermem.
-
Defaults: Plugin injects
SQLite at
<OpenClaw stateDir>/powermem/data/powermem.db and
LLM + embedding env vars derived from OpenClaw. Typical
stateDir is
~/.openclaw unless the user uses another instance (
OPENCLAW_STATE_DIR,
--workdir).
-
Optional envFile: Path to a PowerMem
.env for extra tuning. If the file
exists,
pmem loads it;
OpenClaw-derived vars still override the same keys when
useOpenClawModel is true.
-
useOpenClawModel: false: Disables injection; user must supply a
complete PowerMem config via
.env and/or environment variables.
-
Verify: pmem --version. If the gateway does not inherit the venv, set
pmemPath to the absolute path of
pmem.
- 4. HTTP path (enterprise / shared server)
- Same
Python 3.10+ requirement as CLI; then
pip install powermem,
.env in server working directory,
powermem-server --host 0.0.0.0 --port 8000.
- Check:
curl -s http://localhost:8000/api/v1/system/health.
- 5. Install the plugin
openclaw plugins install /path/to/memory-powermem, or
install.sh from
INSTALL.md.
- 6. Configure OpenClaw
CLI — minimal (recommended, matches plugin defaults):
Do not set envFile unless you need a file. Example:
CODEBLOCK1
CLI — optional .env override file:
CODEBLOCK2
(Only matters if that path exists; OpenClaw can still override LLM keys when useOpenClawModel is true.)
HTTP:
CODEBLOCK3
Optional: apiKey if the server uses auth.
- 7. Verify
Restart
gateway, then in another terminal:
CODEBLOCK4
Confirm memory-powermem is listed and its status is loaded. If it is missing or not loaded, fix install/slot config and restart the gateway before running LTM checks.
CODEBLOCK5
Available Tools
| Tool | Description |
|---|
| memoryrecall | Search long-term memories. Params: query, optional limit, scoreThreshold. |
| memorystore |
Save text; optional infer. Params:
text, optional
importance. |
|
memory_forget | Delete by
memoryId or by
query search. |
Configuration (summary)
| Field | Default | Description |
|---|
| INLINECODE53 | INLINECODE54 | INLINECODE55 or http. |
| INLINECODE57 |
— | Required for HTTP; if
mode omitted and
baseUrl set → HTTP. |
|
apiKey | — | HTTP server auth. |
|
envFile | — | Optional CLI
.env (used only if file exists). |
|
pmemPath |
pmem | CLI binary path. |
|
useOpenClawModel |
true | Inject LLM/embedding from OpenClaw + default SQLite under state dir. |
|
recallLimit |
5 | Max memories per recall. |
|
recallScoreThreshold |
0 | Min score 0–1. |
|
autoCapture /
autoRecall /
inferOnAdd |
true | Auto memory pipeline and infer on add. |
Daily Operations
CODEBLOCK6
Restart the gateway after slot or plugin config changes.
Troubleshooting
| Symptom | Fix |
|---|
| Python < 3.10 | Run step 2 first; upgrade Python or use python3.11 / python3.12 for venv and pip install. Do not skip the version check. |
pip install powermem fails |
Confirm Python 3.10+, clean venv. See
PowerMem issues. |
|
pmem not found | Activate venv or set
pmemPath to the full binary. |
|
openclaw ltm health unhealthy (CLI) | Confirm
agents.defaults.model and provider keys in OpenClaw; gateway version should expose plugin
config +
runtime.modelAuth. Or set
useOpenClawModel: false and a full
envFile. |
|
Health OK but add/search errors | Embedding/LLM mismatch for your provider—see gateway logs; try optional
PowerMem .env from
.env.example. |
|
Wrong SQLite file / instance | Data is under
that OpenClaw instance’s stateDir (
OPENCLAW_STATE_DIR /
--workdir). |
|
HTTP mode | Server running,
baseUrl correct,
apiKey if enabled. |
|
openclaw plugins list: no
memory-powermem, or status is not
loaded | Re-run plugin install; set
plugins.enabled true and
plugins.slots.memory =
memory-powermem; restart
gateway; run
openclaw plugins list again until
memory-powermem shows
loaded. |
PowerMem 内存指南
本技能文件夹包含补充文档:
- - powermem-intro.md — PowerMem 是什么、功能特点、与基于文件的内存的对比。
- config-reference.md — 配置键、状态目录、命令。
工作原理
- - 自动捕获:对话结束后,插件将有价值的用户/助手文本发送至 PowerMem(可选推理/智能提取)。
- 自动召回:每次轮次前,插件搜索记忆并可将 块注入上下文。
当用户要求安装时
推荐顺序(面向客户): (1) 安装 OpenClaw 并配置默认模型 + 提供商认证。(2) 在虚拟环境/pip install 之前验证 Python 3.10+(python3 --version)。(3) pip install powermem 并确保 pmem 对网关可用(PATH 或 pmemPath)。(4) 安装 memory-powermem 插件。默认路径不需要 powermem.env。
curl 命令 install.sh 部署插件和 OpenClaw 条目;使用 -y 参数时,可能仍会创建 ~/.openclaw/powermem/powermem.env 作为可选模板——它不会运行 pip install powermem。如果用户依赖 OpenClaw 注入的 LLM 和默认 SQLite,则不需要该文件。
- 1. 检查 OpenClaw
openclaw --version。如果缺失:npm install -g openclaw,openclaw onboard。
确保已设置
agents.defaults.model(例如 openai/gpt-4o-mini)且对应的
提供商/API 密钥能正常聊天——当
useOpenClawModel 为 true(默认)时,插件会复用该配置用于 PowerMem。
- 2. 检查 Python(在虚拟环境/pip 之前需要)
PowerMem 需要
Python 3.10 或更新版本。首先运行
python3 --version;次版本号必须
≥ 10(例如 3.10.x、3.12.x)。可选严格检查:
bash
python3 -c import sys; assert sys.version_info >= (3, 10), 需要 Python 3.10+; print(sys.version.split()[0], OK)
如果失败:升级 Python 或在以下所有命令中使用特定二进制文件(例如 python3.12)代替 python3。
- 3. 安装 PowerMem(CLI — 默认)
- 推荐使用虚拟环境:例如 python3 -m venv ~/.openclaw/powermem/.venv && source ~/.openclaw/powermem/.venv/bin/activate。
- pip install powermem。
-
默认设置: 插件在
/powermem/data/powermem.db 注入 SQLite,并从 OpenClaw 派生 LLM + 嵌入环境变量。除非用户使用其他实例(OPENCLAWSTATEDIR、--workdir),否则典型的 stateDir 为 ~/.openclaw。
- 可选 envFile: PowerMem .env 文件的路径,用于额外调优。如果文件存在,pmem 会加载它;当 useOpenClawModel 为 true 时,OpenClaw 派生的变量仍会覆盖相同键。
- useOpenClawModel: false: 禁用注入;用户必须通过 .env 和/或环境变量提供完整的 PowerMem 配置。
- 验证: pmem --version。如果网关未继承虚拟环境,将 pmemPath 设置为 pmem 的绝对路径。
- 4. HTTP 路径(企业/共享服务器)
- 与 CLI 相同的 Python 3.10+ 要求;然后 pip install powermem,在服务器工作目录放置 .env,powermem-server --host 0.0.0.0 --port 8000。
- 检查:curl -s http://localhost:8000/api/v1/system/health。
- 5. 安装插件
openclaw plugins install /path/to/memory-powermem,或从 INSTALL.md 运行 install.sh。
- 6. 配置 OpenClaw
CLI — 最小配置(推荐,匹配插件默认值):
除非需要文件,否则不要设置 envFile。示例:
bash
openclaw config set plugins.enabled true
openclaw config set plugins.slots.memory memory-powermem
openclaw config set plugins.entries.memory-powermem.config.mode cli
openclaw config set plugins.entries.memory-powermem.config.pmemPath pmem
openclaw config set plugins.entries.memory-powermem.config.useOpenClawModel true --json
openclaw config set plugins.entries.memory-powermem.config.autoCapture true --json
openclaw config set plugins.entries.memory-powermem.config.autoRecall true --json
openclaw config set plugins.entries.memory-powermem.config.inferOnAdd true --json
CLI — 可选 .env 覆盖文件:
bash
openclaw config set plugins.entries.memory-powermem.config.envFile $HOME/.openclaw/powermem/powermem.env
(仅当该路径存在时有效;当 useOpenClawModel 为 true 时,OpenClaw 仍可覆盖 LLM 键。)
HTTP:
bash
openclaw config set plugins.entries.memory-powermem.config.mode http
openclaw config set plugins.entries.memory-powermem.config.baseUrl http://localhost:8000
可选:如果服务器使用认证,设置 apiKey。
- 7. 验证
重启网关,然后在另一个终端中:
bash
openclaw plugins list
确认 memory-powermem 已列出且状态为 loaded。如果缺失或未加载,修复安装/插槽配置并重启网关,然后再运行 LTM 检查。
bash
openclaw ltm health
openclaw ltm add 我喜欢早上喝咖啡
openclaw ltm search 咖啡
可用工具
| 工具 | 描述 |
|---|
| memoryrecall | 搜索长期记忆。参数:query,可选 limit、scoreThreshold。 |
| memorystore |
保存文本;可选推理。参数:text,可选 importance。 |
| memory_forget | 通过 memoryId 或 query 搜索删除。 |
配置(摘要)
| 字段 | 默认值 | 描述 |
|---|
| mode | cli | cli 或 http。 |
| baseUrl |
— | HTTP 模式必需;如果省略 mode 但设置了 baseUrl → HTTP。 |
| apiKey | — | HTTP 服务器认证。 |
| envFile | — | 可选 CLI .env(仅当文件存在时使用)。 |
| pmemPath | pmem | CLI 二进制路径。 |
| useOpenClawModel | true | 从 OpenClaw 注入 LLM/嵌入 + 状态目录下的默认 SQLite。 |
| recallLimit | 5 | 每次召回的最大记忆数。 |
| recallScoreThreshold | 0 | 最低分数 0–1。 |
| autoCapture / autoRecall / inferOnAdd | true | 自动记忆流水线和添加时推理。 |
日常操作
bash
openclaw gateway
openclaw ltm health
openclaw ltm add 需要记住的一些事实
openclaw ltm search 查询
openclaw config set plugins.slots.memory none
openclaw config set plugins.slots.memory memory-powermem
更改插槽或插件配置后重启网关。
故障排除
先执行步骤 2;升级 Python 或使用 python3.11/python3.12