PowerMem + OpenClaw: maximum token savings for AI agents.
This plugin lets OpenClaw use long-term memory via PowerMem: intelligent extraction, Ebbinghaus forgetting curve, multi-agent isolation.
Default: CLI mode — the plugin runs pmem locally (no powermem-server). Use HTTP mode when you already run a shared PowerMem API (teams / enterprise).
Follow the steps in order: install PowerMem, then install the plugin, configure OpenClaw (defaults work for CLI + ~/.openclaw/powermem/powermem.env), and verify.
- OpenClaw installed (CLI + gateway working)
- PowerMem installed (
pip install powermem) withpmemavailable — either on PATH when you start the gateway, or via absolutepmemPathin plugin config .envfor PowerMem with at least database + LLM + Embedding (see PowerMem.env.example); for individuals, prefer~/.openclaw/powermem/powermem.envand SQLite
Choose Option A (CLI, recommended for OpenClaw individuals), Option B (HTTP + pip), or Option C (Docker).
No HTTP server. Matches the plugin’s default (mode: cli).
-
Install PowerMem (venv recommended):
python3 -m venv ~/.openclaw/powermem/.venv source ~/.openclaw/powermem/.venv/bin/activate pip install powermem
-
Config — From a clone of this repo, run
bash install.sh(or the curl one-liner under Install options below) to create an optional~/.openclaw/powermem/powermem.envtemplate, or copy from PowerMem’s.env.example. SetLLM_*andEMBEDDING_*when not relying on OpenClaw-injected models. -
If
pmemexists only inside the venv, setpmemPathin the pluginconfigto the absolute path ofpmemin that venv. -
Verify — With venv activated:
pmem --version. After gateway start:openclaw ltm health.
Use this when you want a standalone API or are not using CLI mode. Best if you already have Python 3.11+ on the machine.
1. Install PowerMem
pip install powermem2. Prepare config
In any directory where you want to keep config (e.g. ~/powermem):
mkdir -p ~/powermem && cd ~/powermem
# Copy from PowerMem repo: if you cloned it, run: cp /path/to/powermem/.env.example .envIf you did not clone the PowerMem repo, create a .env with at least: database + LLM + Embedding. Here is a minimal working example (OceanBase + Qwen; replace with your API key and DB credentials):
# Create .env in ~/powermem (replace your_api_key_here and your_password)
cat > .env << 'EOF'
TIMEZONE=Asia/Shanghai
DATABASE_PROVIDER=oceanbase
OCEANBASE_HOST=127.0.0.1
OCEANBASE_PORT=2881
OCEANBASE_USER=root@sys
OCEANBASE_PASSWORD=your_password
OCEANBASE_DATABASE=powermem
OCEANBASE_COLLECTION=memories
LLM_PROVIDER=qwen
LLM_API_KEY=your_api_key_here
LLM_MODEL=qwen-plus
EMBEDDING_PROVIDER=qwen
EMBEDDING_API_KEY=your_api_key_here
EMBEDDING_MODEL=text-embedding-v4
EMBEDDING_DIMS=1536
EOFReplace your_api_key_here with your Tongyi Qwen API key (and set your_password and other DB fields as needed for OceanBase). For OpenAI or other providers, see PowerMem’s .env.example for LLM_* and EMBEDDING_*.
3. Start the HTTP server
Run this in the same directory as .env:
cd ~/powermem # or wherever .env lives
powermem-server --host 0.0.0.0 --port 8000You should see something like Uvicorn running on http://0.0.0.0:8000. Leave this terminal open.
4. Verify PowerMem
In a new terminal:
curl -s http://localhost:8000/api/v1/system/healthIf you get JSON (e.g. with "status":"healthy"), PowerMem is ready.
Best if you have Docker and prefer not to install Python.
1. Clone PowerMem and prepare .env
git clone https://github.com/oceanbase/powermem.git
cd powermem
cp .env.example .envEdit .env and set at least:
LLM_API_KEY,LLM_PROVIDER,LLM_MODELEMBEDDING_API_KEY,EMBEDDING_PROVIDER,EMBEDDING_MODEL
Database: OceanBase is recommended.
2. Start the container
From the powermem project root (same level as .env):
docker-compose -f docker/docker-compose.yml up -d3. Verify
curl -s http://localhost:8000/api/v1/system/healthJSON response means the server is up. API docs: http://localhost:8000/docs.
- One-click (Linux/macOS):
From a clone:
curl -fsSL https://raw.githubusercontent.com/ob-labs/memory-powermem/main/install.sh | bashcd /path/to/memory-powermem && bash install.sh. Non-interactive: same URL but pipe tobash -s -y. Another OpenClaw instance:bash -s -- --workdir ~/.openclaw-second. Details and troubleshooting: OpenClaw skillinstall-memory-powermem-full(skills/install-memory-powermem-full/). - OpenClaw skill — quickstart (
install-memory-powermem): Copy skills/install-memory-powermem/SKILL.md to~/.openclaw/skills/install-memory-powermem/, then say 「PowerMem 快速安装」 / “PowerMem quickstart” or “Minimal install memory-powermem” / “Install memory powermem minimal”. - OpenClaw skill — full guide (
install-memory-powermem-full): Copy skills/install-memory-powermem-full/SKILL.md (and its sibling.mdfiles in that folder if you mirror the repo) to~/.openclaw/skills/install-memory-powermem-full/, then say 「安装 PowerMem 记忆」 / “Install PowerMem memory”. The quickstart and full-guide skills are independent; use whichever fits your workflow. - Manual: Steps below.
On your machine (use your actual plugin path):
# Install from npm (recommended for end users; downloads and installs from the official npm registry)
openclaw plugins install memory-powermem
# Install from a local directory (e.g. cloned repo)
openclaw plugins install /path/to/memory-powermem
# For development (symlink, no copy)
openclaw plugins install -l /path/to/memory-powermemNote: 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.
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.
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.
CLI (default):
{
"plugins": {
"slots": { "memory": "memory-powermem" },
"entries": {
"memory-powermem": {
"enabled": true,
"config": {
"mode": "cli",
"envFile": "/home/you/.openclaw/powermem/powermem.env",
"pmemPath": "pmem",
"autoCapture": true,
"autoRecall": true,
"inferOnAdd": true
}
}
}
}
}HTTP (shared server):
"config": {
"mode": "http",
"baseUrl": "http://localhost:8000",
"autoCapture": true,
"autoRecall": true,
"inferOnAdd": true
}Notes:
- CLI (default): You may omit
modeand use CLI whenbaseUrlis empty; useenvFile+pmemPath. - HTTP: When
modeishttp,baseUrlis required; if you setbaseUrlwithoutmode, the plugin treats it as HTTP. Do not append/api/v1tobaseUrl. If the server uses API key auth, add"apiKey". - Restart the OpenClaw gateway (or Mac menubar app) after changing config.
In a terminal:
# Check whether PowerMem is reachable
openclaw ltm healthIf there are no errors and you see a healthy status, the plugin is talking to PowerMem.
Then try a manual add and search:
# Add a memory
openclaw ltm add "I prefer a cup of Americano every morning"
# Search by content
openclaw ltm search "coffee"If search returns what you just added (or similar content), the full flow (install PowerMem → install plugin → configure OpenClaw) is working end to end.
Common CLI commands for managing plugins:
| Command | Description |
|---|---|
openclaw plugins list |
List installed plugins; confirm memory-powermem is listed. Use --json for machine-readable output. |
openclaw plugins info <id> |
Show details for a plugin (e.g. openclaw plugins info memory-powermem). |
openclaw plugins uninstall <id> |
Remove the plugin (e.g. openclaw plugins uninstall memory-powermem). Use --keep-files to leave files on disk. |
openclaw plugins enable <id> |
Enable a disabled plugin. |
openclaw plugins disable <id> |
Disable a plugin without uninstalling. |
openclaw plugins doctor |
Diagnose plugin load and configuration issues. |
openclaw plugins update <id> |
Update a plugin installed from npm. Use openclaw plugins update --all to update all. |
After installing, uninstalling, or changing config, restart the OpenClaw gateway for changes to take effect.
| Option | Required | Description |
|---|---|---|
mode |
No | Backend: "cli" (default) or "http". If omitted, non-empty baseUrl implies http. |
baseUrl |
Yes (http) | PowerMem API base URL when mode is http, e.g. http://localhost:8000, no /api/v1 suffix. |
apiKey |
No | Set when PowerMem server has API key authentication enabled (http mode). |
envFile |
No | CLI: path to PowerMem .env (default when using plugin defaults: ~/.openclaw/powermem/powermem.env). |
pmemPath |
No | CLI: path to pmem executable; default pmem. |
userId |
No | User isolation (multi-user); default openclaw-user. |
agentId |
No | Agent isolation (multi-agent); default openclaw-agent. |
autoCapture |
No | Auto-store from conversations after agent ends; default true. |
autoRecall |
No | Auto-inject relevant memories before agent starts; default true. |
inferOnAdd |
No | Use PowerMem intelligent extraction when adding; default true. |
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.
Exposed to OpenClaw agents:
- memory_recall — Search long-term memories by query.
- memory_store — Store one memory (optional intelligent extraction on write).
- memory_forget — Delete by memory ID or by search query.
openclaw ltm search <query> [--limit n]— Search memories.openclaw ltm health— Check PowerMem service health.openclaw ltm add "<text>"— Manually store one memory.
1. openclaw ltm health fails or cannot connect
- CLI:
pmemon PATH or correctpmemPath; valid.envatenvFile. - HTTP: PowerMem is running (HTTP server in a terminal, or Docker);
baseUrlis correct (e.g.http://localhost:8000; watch for127.0.0.1vslocalhostmismatches). - Remote server: use the host IP or hostname instead of
localhost.
2. Add/search returns nothing or 500
- Check PowerMem terminal or Docker logs; often LLM/Embedding not configured or wrong API key.
- Ensure
LLM_API_KEYandEMBEDDING_API_KEYin.envare set and valid.
3. Plugin installed but OpenClaw not using memory
- Confirm
plugins.slots.memoryismemory-powermemandplugins.entries["memory-powermem"].enabledistrue. - Restart the gateway (or OpenClaw app) after config changes.
4. Agent does not search memory until I ask it to
- With
autoRecall: true, the plugin injects system guidance so the agent is told to usememory_recall(or injected<relevant-memories>) when answering about past events, preferences, or people. EnsureautoRecallis not set tofalse. - Auto-recall runs before each turn using the current user message (or the previous user message if the prompt is very short). If the agent still replies without querying memory, try saying explicitly once “check memory for …” to confirm the pipeline; ensure the Web session after
/newuses the same gateway and plugin.
5. Agent tries to read memory/YYYY-MM-DD.md and gets ENOENT
- OpenClaw's built-in session-memory hook writes session snapshots to workspace
memory/YYYY-MM-DD-slug.md. When you use PowerMem as the memory slot, the agent may still be told (by workspace docs or inference) to load those files, causing failedreadcalls. Disable the hook so only PowerMem is used: runopenclaw hooks disable session-memory, or sethooks.internal.entries["session-memory"].enabledtofalsein~/.openclaw/openclaw.json. Restart the gateway after changing config.
cd /path/to/memory-powermem
pnpm install
pnpm lint # type-check
pnpm test # run tests (if any)Apache License 2.0. See LICENSE.
