From 2ca4d0d14fa51adb121b29ef4801ffb175ed673f Mon Sep 17 00:00:00 2001 From: Teingi Date: Wed, 18 Mar 2026 15:29:57 +0800 Subject: [PATCH 1/3] plugin: add default config for zero-config setup --- README.md | 8 ++++---- README_CN.md | 10 +++++----- config.ts | 12 ++++++++++++ index.ts | 11 ++++++++++- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9b4c90e..24713ad 100644 --- a/README.md +++ b/README.md @@ -156,15 +156,15 @@ openclaw plugins install /path/to/openclaw-extension-powermem openclaw plugins install -l /path/to/openclaw-extension-powermem ``` -**Note:** Running `npm i openclaw-extension-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 openclaw-extension-powermem` (or install from a path as above), then configure OpenClaw and restart the gateway. +**Note:** Running `npm i openclaw-extension-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 openclaw-extension-powermem` (or install from a path as above), then restart the gateway. -After install, run `openclaw plugins list` and confirm `memory-powermem` is listed. +After install, run `openclaw plugins list` and confirm `memory-powermem` is listed. The plugin uses **default config** when none is set: `baseUrl: "http://localhost:8000"`, `autoCapture`, `autoRecall`, and `inferOnAdd` enabled — so you do not need to edit `~/.openclaw/openclaw.json` for the typical setup (PowerMem on localhost:8000). --- -## Step 3: Configure OpenClaw to use the plugin +## Step 3: Configure OpenClaw (optional) -Edit OpenClaw’s config (e.g. `~/.openclaw/openclaw.json`). At the **root level**, add or merge the `plugins` section: set `plugins.slots.memory` and `plugins.entries["memory-powermem"]`, and set the PowerMem URL. +If you use PowerMem at **http://localhost:8000** with the default options, skip this step. To **customize** (e.g. different URL, API key, or CLI mode), edit OpenClaw's config (e.g. `~/.openclaw/openclaw.json`) and add or merge the `plugins` section. **Example (JSON):** diff --git a/README_CN.md b/README_CN.md index 8948d94..2413546 100644 --- a/README_CN.md +++ b/README_CN.md @@ -8,7 +8,7 @@ # OpenClaw Memory (PowerMem) 插件 -本插件让 [OpenClaw](https://github.com/openclaw/openclaw) 通过 [PowerMem](https://github.com/oceanbase/powermem) 的 HTTP API 使用长期记忆:智能抽取、艾宾浩斯遗忘曲线、多 Agent 隔离。 +本插件让 [OpenClaw](https://github.com/openclaw/openclaw) 通过 [PowerMem](https://github.com/oceanbase/powermem) 使用长期记忆:智能抽取、艾宾浩斯遗忘曲线、多 Agent 隔离。 按顺序操作:先安装并启动 PowerMem,再安装插件、配置 OpenClaw,最后验证。 @@ -157,15 +157,15 @@ openclaw plugins install /path/to/openclaw-extension-powermem openclaw plugins install -l /path/to/openclaw-extension-powermem ``` -**说明:** 在某个 Node 项目里执行 `npm i openclaw-extension-powermem` 只会把包装进该项目的 `node_modules`,**不会**在 OpenClaw 里注册插件。若要在 OpenClaw 里使用本插件,必须执行 `openclaw plugins install openclaw-extension-powermem`(或按上面用本地路径安装),再在 OpenClaw 中配置并重启 gateway。 +**说明:** 在某个 Node 项目里执行 `npm i openclaw-extension-powermem` 只会把包装进该项目的 `node_modules`,**不会**在 OpenClaw 里注册插件。若要在 OpenClaw 里使用本插件,必须执行 `openclaw plugins install openclaw-extension-powermem`(或按上面用本地路径安装),再重启 gateway。 -安装成功后,可用 `openclaw plugins list` 确认能看到 `memory-powermem`。 +安装成功后,可用 `openclaw plugins list` 确认能看到 `memory-powermem`。未在配置中书写本插件 config 时,插件会使用 **默认配置**:`baseUrl: "http://localhost:8000"`,并开启 `autoCapture`、`autoRecall`、`inferOnAdd`,因此典型情况(PowerMem 跑在 localhost:8000)下无需编辑 `~/.openclaw/openclaw.json`。 --- -## 第三步:配置 OpenClaw 使用本插件 +## 第三步:配置 OpenClaw(可选) -编辑 OpenClaw 的配置文件(常见位置:`~/.openclaw/openclaw.json`),在 **根级** 增加或合并 `plugins` 段,并把记忆槽指向本插件,并写上 PowerMem 的地址。 +若 PowerMem 在 **http://localhost:8000** 且使用默认选项,可跳过本步。若要 **自定义**(如改 URL、API Key 或使用 CLI 模式),请编辑 OpenClaw 配置文件(如 `~/.openclaw/openclaw.json`),增加或合并 `plugins` 段。 **示例(JSON):** diff --git a/config.ts b/config.ts index 987d7f4..53fa9a8 100644 --- a/config.ts +++ b/config.ts @@ -149,6 +149,18 @@ function toRecallScoreThreshold(v: unknown): number { export const DEFAULT_USER_ID = "openclaw-user"; export const DEFAULT_AGENT_ID = "openclaw-agent"; +/** + * Default plugin config when openclaw.json has no plugins.entries["memory-powermem"].config. + * Allows "openclaw plugins install openclaw-extension-powermem" to work without manual config. + */ +export const DEFAULT_PLUGIN_CONFIG: PowerMemConfig = { + mode: "http", + baseUrl: "http://localhost:8000", + autoCapture: true, + autoRecall: true, + inferOnAdd: true, +}; + export function resolveUserId(cfg: PowerMemConfig): string { return cfg.userId ?? DEFAULT_USER_ID; } diff --git a/index.ts b/index.ts index 8093c65..4b06121 100644 --- a/index.ts +++ b/index.ts @@ -16,6 +16,7 @@ import type { OpenClawPluginServiceContext } from "openclaw/plugin-sdk"; import { powerMemConfigSchema, + DEFAULT_PLUGIN_CONFIG, resolveUserId, resolveAgentId, type PowerMemConfig, @@ -36,7 +37,15 @@ const memoryPlugin = { configSchema: powerMemConfigSchema, register(api: OpenClawPluginApi) { - const cfg = powerMemConfigSchema.parse(api.pluginConfig) as PowerMemConfig; + const raw = api.pluginConfig; + const toParse = + raw && + typeof raw === "object" && + !Array.isArray(raw) && + Object.keys(raw).length > 0 + ? { ...DEFAULT_PLUGIN_CONFIG, ...raw } + : DEFAULT_PLUGIN_CONFIG; + const cfg = powerMemConfigSchema.parse(toParse) as PowerMemConfig; const userId = resolveUserId(cfg); const agentId = resolveAgentId(cfg); const client = From 4f8cfacf2a6dc1d4334a2ed37763a3a9f5c9296f Mon Sep 17 00:00:00 2001 From: Teingi Date: Wed, 18 Mar 2026 15:55:57 +0800 Subject: [PATCH 2/3] Add OpenClaw plugin commands --- README.md | 18 ++++++++++++++++++ README_CN.md | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/README.md b/README.md index 24713ad..efc0d4e 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,24 @@ If search returns the line you added (or similar), the full flow (PowerMem → p --- +## OpenClaw plugin commands (reference) + +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 ` | Show details for a plugin (e.g. `openclaw plugins info memory-powermem`). | +| `openclaw plugins uninstall ` | Remove the plugin (e.g. `openclaw plugins uninstall memory-powermem`). Use `--keep-files` to leave files on disk. | +| `openclaw plugins enable ` | Enable a disabled plugin. | +| `openclaw plugins disable ` | Disable a plugin without uninstalling. | +| `openclaw plugins doctor` | Diagnose plugin load and configuration issues. | +| `openclaw plugins update ` | 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. + +--- + ## Config options (optional) | Option | Required | Description | diff --git a/README_CN.md b/README_CN.md index 2413546..0f2f2d5 100644 --- a/README_CN.md +++ b/README_CN.md @@ -234,6 +234,24 @@ openclaw ltm search "咖啡" --- +## OpenClaw 插件常用命令(参考) + +管理插件时常用的 CLI 命令: + +| 命令 | 说明 | +|------|------| +| `openclaw plugins list` | 列出已安装插件,确认是否包含 `memory-powermem`。加 `--json` 可输出机器可读格式。 | +| `openclaw plugins info ` | 查看某个插件的详情(例如 `openclaw plugins info memory-powermem`)。 | +| `openclaw plugins uninstall ` | 卸载插件(例如 `openclaw plugins uninstall memory-powermem`)。加 `--keep-files` 可保留磁盘上的文件。 | +| `openclaw plugins enable ` | 启用已安装但被禁用的插件。 | +| `openclaw plugins disable ` | 禁用插件(不卸载)。 | +| `openclaw plugins doctor` | 诊断插件加载与配置问题。 | +| `openclaw plugins update ` | 更新从 npm 安装的插件。使用 `openclaw plugins update --all` 可更新全部。 | + +安装、卸载或修改配置后,需重启 OpenClaw gateway 后才会生效。 + +--- + ## 配置项说明(可选) | 选项 | 必填 | 说明 | From 59fe09adfad985f5ef13cdabade2d7babfbc2bce Mon Sep 17 00:00:00 2001 From: Teingi Date: Wed, 18 Mar 2026 16:43:36 +0800 Subject: [PATCH 3/3] Rename package to memory-powermem --- .github/workflows/release.yml | 2 +- INSTALL.md | 14 +++++++------- README.md | 10 +++++----- README_CN.md | 10 +++++----- config.ts | 2 +- install.sh | 10 +++++----- package-lock.json | 4 ++-- package.json | 2 +- skills/install-powermem-memory/SKILL.md | 4 ++-- skills/install-powermem-memory/powermem-intro.md | 2 +- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 310ad0d..9506dec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,7 +49,7 @@ jobs: PKG_VER="dev-$(date +%Y%m%d)-${GITHUB_SHA::7}" fi mkdir -p release - git archive --format=zip --prefix=openclaw-extension-powermem/ HEAD -o release/openclaw-extension-powermem-$PKG_VER.zip + git archive --format=zip --prefix=memory-powermem/ HEAD -o release/memory-powermem-$PKG_VER.zip # Create GitHub Release only when run on a tag - name: Create GitHub Release diff --git a/INSTALL.md b/INSTALL.md index 1393b8b..05368c3 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -9,20 +9,20 @@ Give [OpenClaw](https://github.com/openclaw/openclaw) long-term memory via [Powe **Prerequisites:** OpenClaw installed (`openclaw --version`). PowerMem is **not** installed by this script—you either run a PowerMem server yourself (HTTP mode) or use the `pmem` CLI (CLI mode). The script only deploys the plugin and configures OpenClaw. ```bash -curl -fsSL https://raw.githubusercontent.com/ob-labs/openclaw-extension-powermem/main/install.sh | bash +curl -fsSL https://raw.githubusercontent.com/ob-labs/memory-powermem/main/install.sh | bash ``` Or run from the repo root (no download): ```bash -cd /path/to/openclaw-extension-powermem +cd /path/to/memory-powermem bash install.sh ``` Non-interactive (defaults: HTTP mode, baseUrl http://localhost:8000): ```bash -curl -fsSL https://raw.githubusercontent.com/ob-labs/openclaw-extension-powermem/main/install.sh | bash -s -y +curl -fsSL https://raw.githubusercontent.com/ob-labs/memory-powermem/main/install.sh | bash -s -y ``` Install to a specific OpenClaw instance: @@ -45,7 +45,7 @@ Copy the skill file into OpenClaw’s skill directory, then ask OpenClaw to do t ```bash mkdir -p ~/.openclaw/skills/install-powermem-memory -cp /path/to/openclaw-extension-powermem/skills/install-powermem-memory/SKILL.md \ +cp /path/to/memory-powermem/skills/install-powermem-memory/SKILL.md \ ~/.openclaw/skills/install-powermem-memory/ ``` @@ -53,7 +53,7 @@ cp /path/to/openclaw-extension-powermem/skills/install-powermem-memory/SKILL.md ```powershell New-Item -ItemType Directory -Force "$env:USERPROFILE\.openclaw\skills\install-powermem-memory" -Copy-Item "path\to\openclaw-extension-powermem\skills\install-powermem-memory\SKILL.md" ` +Copy-Item "path\to\memory-powermem\skills\install-powermem-memory\SKILL.md" ` "$env:USERPROFILE\.openclaw\skills\install-powermem-memory\" ``` @@ -92,9 +92,9 @@ Verify: `curl -s http://localhost:8000/api/v1/system/health` ### 2. Install the plugin into OpenClaw ```bash -openclaw plugins install /path/to/openclaw-extension-powermem +openclaw plugins install /path/to/memory-powermem # Or symlink for development: -openclaw plugins install -l /path/to/openclaw-extension-powermem +openclaw plugins install -l /path/to/memory-powermem ``` Confirm: `openclaw plugins list` shows `memory-powermem`. diff --git a/README.md b/README.md index efc0d4e..9ca764f 100644 --- a/README.md +++ b/README.md @@ -147,16 +147,16 @@ On your machine (use your actual plugin path): ```bash # Install from npm (recommended for end users; OpenClaw downloads the package from the npm registry) -openclaw plugins install openclaw-extension-powermem +openclaw plugins install memory-powermem # Install from a local directory (e.g. cloned repo) -openclaw plugins install /path/to/openclaw-extension-powermem +openclaw plugins install /path/to/memory-powermem # For development (symlink, no copy) -openclaw plugins install -l /path/to/openclaw-extension-powermem +openclaw plugins install -l /path/to/memory-powermem ``` -**Note:** Running `npm i openclaw-extension-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 openclaw-extension-powermem` (or install from a path as above), then restart the gateway. +**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. After install, run `openclaw plugins list` and confirm `memory-powermem` is listed. The plugin uses **default config** when none is set: `baseUrl: "http://localhost:8000"`, `autoCapture`, `autoRecall`, and `inferOnAdd` enabled — so you do not need to edit `~/.openclaw/openclaw.json` for the typical setup (PowerMem on localhost:8000). @@ -320,7 +320,7 @@ Exposed to OpenClaw agents: ## Development ```bash -cd /path/to/openclaw-extension-powermem +cd /path/to/memory-powermem pnpm install pnpm lint # type-check pnpm test # run tests (if any) diff --git a/README_CN.md b/README_CN.md index 0f2f2d5..ee1ba7f 100644 --- a/README_CN.md +++ b/README_CN.md @@ -148,16 +148,16 @@ curl -s http://localhost:8000/api/v1/system/health ```bash # 从 npm 安装(推荐给终端用户;会从 npm 官方源自动下载并安装) -openclaw plugins install openclaw-extension-powermem +openclaw plugins install memory-powermem # 若插件在本机目录(例如克隆下来的) -openclaw plugins install /path/to/openclaw-extension-powermem +openclaw plugins install /path/to/memory-powermem # 开发时想改代码即生效,可用链接方式(不拷贝) -openclaw plugins install -l /path/to/openclaw-extension-powermem +openclaw plugins install -l /path/to/memory-powermem ``` -**说明:** 在某个 Node 项目里执行 `npm i openclaw-extension-powermem` 只会把包装进该项目的 `node_modules`,**不会**在 OpenClaw 里注册插件。若要在 OpenClaw 里使用本插件,必须执行 `openclaw plugins install openclaw-extension-powermem`(或按上面用本地路径安装),再重启 gateway。 +**说明:** 在某个 Node 项目里执行 `npm i memory-powermem` 只会把包装进该项目的 `node_modules`,**不会**在 OpenClaw 里注册插件。若要在 OpenClaw 里使用本插件,必须执行 `openclaw plugins install memory-powermem`(或按上面用本地路径安装),再重启 gateway。 安装成功后,可用 `openclaw plugins list` 确认能看到 `memory-powermem`。未在配置中书写本插件 config 时,插件会使用 **默认配置**:`baseUrl: "http://localhost:8000"`,并开启 `autoCapture`、`autoRecall`、`inferOnAdd`,因此典型情况(PowerMem 跑在 localhost:8000)下无需编辑 `~/.openclaw/openclaw.json`。 @@ -321,7 +321,7 @@ openclaw ltm search "咖啡" ## 本仓库开发命令 ```bash -cd /path/to/openclaw-extension-powermem +cd /path/to/memory-powermem pnpm install pnpm lint # 类型检查 pnpm test # 运行测试(若有) diff --git a/config.ts b/config.ts index 53fa9a8..05b6cf1 100644 --- a/config.ts +++ b/config.ts @@ -151,7 +151,7 @@ export const DEFAULT_AGENT_ID = "openclaw-agent"; /** * Default plugin config when openclaw.json has no plugins.entries["memory-powermem"].config. - * Allows "openclaw plugins install openclaw-extension-powermem" to work without manual config. + * Allows "openclaw plugins install memory-powermem" to work without manual config. */ export const DEFAULT_PLUGIN_CONFIG: PowerMemConfig = { mode: "http", diff --git a/install.sh b/install.sh index 2d7371b..a3d6db6 100644 --- a/install.sh +++ b/install.sh @@ -2,12 +2,12 @@ # # OpenClaw + PowerMem memory plugin installer # Usage (from GitHub): -# curl -fsSL https://raw.githubusercontent.com/ob-labs/openclaw-extension-powermem/main/install.sh | bash +# curl -fsSL https://raw.githubusercontent.com/ob-labs/memory-powermem/main/install.sh | bash # Or from repo root: # bash install.sh [ -y ] [ --workdir PATH ] # # Env: -# REPO=owner/repo - GitHub repo for download (default: ob-labs/openclaw-extension-powermem) +# REPO=owner/repo - GitHub repo for download (default: ob-labs/memory-powermem) # BRANCH=branch - Branch/tag (default: main) # INSTALL_YES=1 - Non-interactive (same as -y) # SKIP_OPENCLAW=1 - Skip openclaw presence check @@ -15,7 +15,7 @@ set -e -REPO="${REPO:-ob-labs/openclaw-extension-powermem}" +REPO="${REPO:-ob-labs/memory-powermem}" BRANCH="${BRANCH:-main}" INSTALL_YES="${INSTALL_YES:-0}" SKIP_OC="${SKIP_OPENCLAW:-0}" @@ -176,8 +176,8 @@ deploy_from_repo() { } deploy_from_github() { - # REPO defaults to ob-labs/openclaw-extension-powermem - [[ -n "$REPO" ]] || REPO="ob-labs/openclaw-extension-powermem" + # REPO defaults to ob-labs/memory-powermem + [[ -n "$REPO" ]] || REPO="ob-labs/memory-powermem" local gh_raw="https://raw.githubusercontent.com/${REPO}/${BRANCH}" local files=( "index.ts" diff --git a/package-lock.json b/package-lock.json index a4573c0..7ac373c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "openclaw-extension-powermem", + "name": "memory-powermem", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "openclaw-extension-powermem", + "name": "memory-powermem", "version": "1.0.0", "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index fca8a2c..d394096 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "openclaw-extension-powermem", + "name": "memory-powermem", "version": "1.0.0", "description": "OpenClaw plugin: long-term memory via PowerMem (HTTP or local CLI; intelligent extraction, Ebbinghaus forgetting curve).", "type": "module", diff --git a/skills/install-powermem-memory/SKILL.md b/skills/install-powermem-memory/SKILL.md index 1dc1018..ba30cf1 100644 --- a/skills/install-powermem-memory/SKILL.md +++ b/skills/install-powermem-memory/SKILL.md @@ -37,11 +37,11 @@ This skill folder includes supplementary docs to reference when needed: 3. **Install the plugin** If the user has the repo path: ```bash - openclaw plugins install /path/to/openclaw-extension-powermem + openclaw plugins install /path/to/memory-powermem ``` Or from GitHub one-liner: ```bash - curl -fsSL https://raw.githubusercontent.com/ob-labs/openclaw-extension-powermem/main/install.sh | bash + curl -fsSL https://raw.githubusercontent.com/ob-labs/memory-powermem/main/install.sh | bash ``` 4. **Configure OpenClaw** diff --git a/skills/install-powermem-memory/powermem-intro.md b/skills/install-powermem-memory/powermem-intro.md index d578b75..1d5ab0d 100644 --- a/skills/install-powermem-memory/powermem-intro.md +++ b/skills/install-powermem-memory/powermem-intro.md @@ -27,7 +27,7 @@ Use this doc when the user asks "what is PowerMem", "why use PowerMem", or needs ## Relationship with OpenClaw - **OpenClaw**: Provides gateway, sessions, tool dispatch, etc.; its **memory slot** must be implemented by a plugin. -- **openclaw-extension-powermem**: Implements the memory slot and forwards store/recall/forget requests to PowerMem (HTTP or CLI). +- **memory-powermem**: Implements the memory slot and forwards store/recall/forget requests to PowerMem (HTTP or CLI). - **PowerMem**: Handles storage, retrieval, intelligent extraction, and forgetting curve; it is where data actually lives. So: the user must **install and run PowerMem first** (or install the `pmem` CLI), then install this plugin and configure the connection (HTTP `baseUrl` or CLI `pmemPath`).