diff --git a/install.sh b/install.sh index a3d6db6..4949b8e 100644 --- a/install.sh +++ b/install.sh @@ -32,9 +32,14 @@ PMEM_PATH="pmem" _expect_workdir="" for arg in "$@"; do if [[ -n "$_expect_workdir" ]]; then - OPENCLAW_DIR="$arg" - PLUGIN_DEST="${OPENCLAW_DIR}/extensions/memory-powermem" - _expect_workdir="" + if [[ "$arg" == -* ]]; then + echo "install.sh: Warning: Missing value for --workdir; ignoring." >&2 + _expect_workdir="" + else + OPENCLAW_DIR="$arg" + PLUGIN_DEST="${OPENCLAW_DIR}/extensions/memory-powermem" + _expect_workdir="" + fi continue fi [[ "$arg" == "-y" || "$arg" == "--yes" ]] && INSTALL_YES="1" @@ -52,6 +57,10 @@ for arg in "$@"; do exit 0 } done +if [[ -n "$_expect_workdir" ]]; then + echo "install.sh: ERROR: Option --workdir requires a path." >&2 + exit 1 +fi RED='\033[0;31m' GREEN='\033[0;32m' @@ -88,11 +97,12 @@ detect_openclaw_instances() { [[ "$(basename "$d")" == .openclaw ]] || [[ "$(basename "$d")" == .openclaw-* ]] || continue list+=("$d") done - echo "${list[@]}" + printf '%s\n' "${list[@]}" } select_workdir() { - local instances=($(detect_openclaw_instances)) + local instances=() + mapfile -t instances < <(detect_openclaw_instances) || true if [[ ${#instances[@]} -le 1 ]]; then return 0 fi diff --git a/skills/install-powermem-memory/SKILL.md b/skills/install-powermem-memory/SKILL.md index ba30cf1..6ffc3cb 100644 --- a/skills/install-powermem-memory/SKILL.md +++ b/skills/install-powermem-memory/SKILL.md @@ -27,23 +27,30 @@ This skill folder includes supplementary docs to reference when needed: ## When User Asks to Install +**Important:** PowerMem must be installed and running (or `pmem` available) **before** installing this plugin. The one-liner `install.sh` only installs the OpenClaw plugin; it does **not** install PowerMem. Users who run the script first often see failures because PowerMem is missing. + 1. **Check OpenClaw** Run `openclaw --version`. If not installed, tell the user to install OpenClaw first: `npm install -g openclaw` and `openclaw onboard`. -2. **Check PowerMem** - - **HTTP mode**: User must have PowerMem server running (e.g. `pip install powermem`, create `.env`, then `powermem-server --port 8000`). - - **CLI mode**: User needs `pmem` on PATH (and optionally a PowerMem `.env`). No server required. +2. **Install and verify PowerMem** (do this before installing the plugin) + - **Python**: PowerMem requires **Python 3.10+**. Have the user run `python3 --version`. If older, ask them to upgrade. + - **HTTP mode** + - Install: `pip install powermem` (recommended: use a virtualenv: `python3 -m venv .venv && source .venv/bin/activate` then `pip install powermem`). + - Create `.env`: copy from [PowerMem .env.example](https://github.com/oceanbase/powermem/blob/master/.env.example) or create a minimal one with at least: `DATABASE_PROVIDER=sqlite`, `LLM_PROVIDER`/`LLM_API_KEY`/`LLM_MODEL`, `EMBEDDING_PROVIDER`/`EMBEDDING_API_KEY`/`EMBEDDING_MODEL`/`EMBEDDING_DIMS`. + - Start server **in the directory that contains `.env`**: `powermem-server --host 0.0.0.0 --port 8000`. + - Verify: `curl -s http://localhost:8000/api/v1/system/health` should return OK. + - **CLI mode** + - Install: `pip install powermem` (same as above; ensure the env is activated so `pmem` is on PATH). + - Check: `pmem --version` or `which pmem`. If not found, user may need to activate the venv or use full path to `pmem`. + - Optional: create PowerMem `.env` (e.g. via `pmem config init`) for DB/LLM/Embedding if using intelligent extraction. 3. **Install the plugin** If the user has the repo path: ```bash - openclaw plugins install /path/to/memory-powermem - ``` - Or from GitHub one-liner: - ```bash - curl -fsSL https://raw.githubusercontent.com/ob-labs/memory-powermem/main/install.sh | bash + openclaw plugins install memory-powermem ``` + 4. **Configure OpenClaw** Set memory slot and config. Example (HTTP, local server): ```bash @@ -115,6 +122,8 @@ Restart the gateway after changing the memory slot. | Symptom | Fix | |---------|-----| -| `openclaw ltm health` fails | For HTTP: ensure PowerMem server is running and `baseUrl` is correct. For CLI: ensure `pmem` is on PATH and optional `.env` is valid. | -| Plugin not loaded | Check `plugins.slots.memory` is `memory-powermem` and restart gateway. | -| Add/search returns 500 or empty | Check PowerMem server logs; usually LLM/Embedding API key or model in PowerMem `.env`. | +| **`pip install powermem` fails** | Ensure Python 3.10+ (`python3 --version`). Use a clean venv. On network or build errors, try `pip install powermem --no-build-isolation` or install problematic deps (e.g. `psycopg2-binary`, `pyobvector`) separately first. See [PowerMem repo](https://github.com/oceanbase/powermem) issues if needed. | +| **`pmem` or `powermem-server` not found** | Installed in a virtualenv: activate it (`source .venv/bin/activate`) so they are on PATH. Or run `python -m powermem.cli.main` for CLI and start server via `python -m server.cli.server` (see PowerMem docs). | +| **`openclaw ltm health` fails** | For HTTP: ensure PowerMem server is running and `baseUrl` is correct; run server in the directory that contains `.env`. For CLI: ensure `pmem` is on PATH and optional `.env` is valid. | +| **Plugin not loaded** | Check `plugins.slots.memory` is `memory-powermem` and restart gateway. | +| **Add/search returns 500 or empty** | Check PowerMem server logs; usually missing or wrong LLM/Embedding API key or model in PowerMem `.env`. Ensure `.env` has at least `LLM_*` and `EMBEDDING_*` set for the provider you use. | diff --git a/skills/install-powermem-memory/config-reference.md b/skills/install-powermem-memory/config-reference.md index bbba3b3..4402c50 100644 --- a/skills/install-powermem-memory/config-reference.md +++ b/skills/install-powermem-memory/config-reference.md @@ -4,6 +4,15 @@ Quick reference for this skill folder. See **SKILL.md** for full details. --- +## Installing PowerMem (do this before the plugin) + +- **Python 3.10+** required. Check with `python3 --version`. +- **Install**: `pip install powermem` (prefer inside a virtualenv). +- **HTTP mode**: Create a `.env` (copy from [PowerMem .env.example](https://github.com/oceanbase/powermem/blob/master/.env.example)), set at least database + LLM + Embedding. Start server in that directory: `powermem-server --port 8000`. Verify: `curl -s http://localhost:8000/api/v1/system/health`. +- **CLI mode**: Ensure `pmem` is on PATH (e.g. activate the venv where powermem is installed). Optional: `pmem config init` for `.env`. + +--- + ## Plugin configuration | Key | Default | Description |