Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,7 @@ integrations/dsh/coverage/
integrations/dsh/*.tgz
!integrations/dsh/plugins/powercontext/lib/
!integrations/dsh/plugins/powercontext/lib/**

# PowerContext OpenClaw plugin (Node)
integrations/openclaw/plugins/memory-powercontext/artifacts/
integrations/openclaw/plugins/memory-powercontext/*.tgz
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ js-api-generate-check: ## Verify generated JS operations are current.
js-test: ## Run DeepSeek Harness plugin unit tests.
@pnpm --dir integrations/dsh/plugins/powercontext test

.PHONY: openclaw-plugin-build
openclaw-plugin-build: ## Build the external OpenClaw memory plugin.
@pnpm --dir integrations/openclaw/plugins/memory-powercontext build

.PHONY: openclaw-plugin-pack
openclaw-plugin-pack: ## Build and pack the external OpenClaw memory plugin.
@pnpm --dir integrations/openclaw/plugins/memory-powercontext pack:local

.PHONY: build
build: clean-build ## Build wheel file
@echo "🚀 Creating wheel file"
Expand Down
103 changes: 103 additions & 0 deletions docs/en/docs/how-to/configure-openclaw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
title: Configure OpenClaw Memory
description: Install the PowerContext memory provider as an external OpenClaw plugin.
---

# Configure OpenClaw Memory

PowerContext integrates with OpenClaw as an external memory plugin. The plugin
lives in this repository, while OpenClaw continues to own session identity,
authorization, transcripts, and lifecycle hooks. No OpenClaw source changes
are required.

## Install from a source directory

Use OpenClaw 2026.8.1-beta.2 or newer. Earlier releases do not expose the
memory-provider plugin API used by this integration. From the PowerContext
checkout, build the plugin and install it through OpenClaw's normal managed
local-plugin flow:

~~~bash
cd integrations/openclaw/plugins/memory-powercontext
pnpm install
pnpm build
openclaw plugins install . --force
~~~

OpenClaw copies the plugin into its managed installation directory and records
the install source. After source changes, run pnpm build and the install
command again to update the runtime. Uninstall it with:

~~~bash
openclaw plugins uninstall memory-powercontext
~~~

## Install the npm package

After publishing to npm, use OpenClaw's normal upstream npm-plugin installation
flow:

~~~bash
openclaw plugins install npm:@oceanbase/openclaw-memory-powercontext
~~~

For offline validation of an unpublished version, build a local npm tarball:

Build an npm tarball when the OpenClaw host should install a managed copy:

~~~bash
cd integrations/openclaw/plugins/memory-powercontext
pnpm pack:local
openclaw plugins install npm-pack:./artifacts/oceanbase-openclaw-memory-powercontext-0.0.1.tgz --force
~~~

The tarball includes the compiled dist/index.js runtime and
openclaw.plugin.json.

## Configure the memory slot

Set the plugin as OpenClaw's exclusive memory provider and point it at a
running PowerContext Server:

~~~json
{
"plugins": {
"slots": {
"memory": "memory-powercontext"
},
"entries": {
"memory-powercontext": {
"enabled": true,
"hooks": {
"allowConversationAccess": true
},
"config": {
"endpoint": "http://127.0.0.1:8000",
"tokenEnv": "POWERCONTEXT_CLIENT_API_TOKEN",
"scopeMode": "agent",
"autoRecall": true,
"autoCapture": true
}
}
}
}
}
~~~

Export POWERCONTEXT_CLIENT_API_TOKEN in the Gateway process when the Server
requires authentication, then restart the Gateway. The plugin keeps agent
memory isolated by default. Group, channel, and incognito sessions are not
captured or searched. `hooks.allowConversationAccess` is an explicit OpenClaw
permission for the plugin to receive conversation content; it is required for
automatic recall and source capture.

## Verify the installation

~~~bash
openclaw plugins inspect memory-powercontext --runtime --json
openclaw plugins list
~~~

The runtime inspection should show the memory capability and the four memory
tools. If the host reports an incompatible plugin API, upgrade OpenClaw or use
a plugin release matching that host version.
1 change: 1 addition & 0 deletions docs/en/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ read and maintain Memory in a later Codex session for the same project.
- For an end-to-end first experience, read the [Codex quickstart](tutorials/codex-quickstart.md).
- To install, start, update, or relocate a local service, read [Install and run](how-to/install-and-run.md).
- To control project scope, prompt capture, or local authentication, read [Configure Codex](how-to/configure-codex.md).
- To connect OpenClaw to the PowerContext memory backend, read [Configure OpenClaw Memory](how-to/configure-openclaw.md).
- To configure another host, read [Configure Claude Code](how-to/configure-claude-code.md) or
[Configure DeepSeek Harness](how-to/configure-dsh.md).
- To understand the boundary between durable Memory and a temporary Handoff, read
Expand Down
92 changes: 92 additions & 0 deletions docs/zh/docs/how-to/configure-openclaw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
title: 配置 OpenClaw Memory
description: 将 PowerContext Memory 作为外部 OpenClaw 插件安装和配置。
---

# 配置 OpenClaw Memory

PowerContext 通过外部 Memory 插件接入 OpenClaw。插件代码由本仓库维护,
OpenClaw 继续负责会话身份、授权、transcript 和生命周期钩子,不需要修改
OpenClaw 源码。

## 从源码目录安装

请使用 OpenClaw 2026.8.1-beta.2 或更高版本。更早的版本未提供本集成需要的
Memory provider Plugin API。在 PowerContext checkout 中构建插件,然后让 OpenClaw
按标准的本地插件安装流程托管它:

~~~bash
cd integrations/openclaw/plugins/memory-powercontext
pnpm install
pnpm build
openclaw plugins install . --force
~~~

该命令会把插件复制到 OpenClaw 的托管安装目录,并记录安装来源。源码更新后,
重新执行 pnpm build 和安装命令即可更新运行时。移除插件:

~~~bash
openclaw plugins uninstall memory-powercontext
~~~

## 安装 npm 包

发布到 npm 后,使用 OpenClaw upstream 的标准 npm 插件安装方式:

~~~bash
openclaw plugins install npm:@oceanbase/openclaw-memory-powercontext
~~~

需要在未发布版本上做离线验证时,构建本地 npm tarball:

~~~bash
cd integrations/openclaw/plugins/memory-powercontext
pnpm pack:local
openclaw plugins install npm-pack:./artifacts/oceanbase-openclaw-memory-powercontext-0.0.1.tgz --force
~~~

该包包含编译后的 dist/index.js 运行时和 openclaw.plugin.json。

## 配置 Memory slot

将插件设为 OpenClaw 的唯一 Memory provider,并指向运行中的 PowerContext Server:

~~~json
{
"plugins": {
"slots": {
"memory": "memory-powercontext"
},
"entries": {
"memory-powercontext": {
"enabled": true,
"hooks": {
"allowConversationAccess": true
},
"config": {
"endpoint": "http://127.0.0.1:8000",
"tokenEnv": "POWERCONTEXT_CLIENT_API_TOKEN",
"scopeMode": "agent",
"autoRecall": true,
"autoCapture": true
}
}
}
}
}
~~~

如果 Server 开启鉴权,请在 Gateway 进程中导出 POWERCONTEXT_CLIENT_API_TOKEN,
然后重启 Gateway。默认按 agent 隔离 Memory;群组、频道和 incognito 会话不会
被采集或搜索。`hooks.allowConversationAccess` 是 OpenClaw 对该插件读取会话内容
的显式授权;自动召回和 Source 采集都需要该授权。

## 验证安装

~~~bash
openclaw plugins inspect memory-powercontext --runtime --json
openclaw plugins list
~~~

运行时检查应显示 Memory capability 和四个 Memory 工具。如果提示 Plugin API
不兼容,请升级 OpenClaw,或选择与当前 host 版本匹配的插件版本。
1 change: 1 addition & 0 deletions docs/zh/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Codex 会话中读取并维护 Memory。
- 想完成一次端到端体验:阅读 [Codex 快速入门](tutorials/codex-quickstart.md)。
- 想安装、启动、升级或迁移本地服务:阅读 [安装和运行](how-to/install-and-run.md)。
- 想调整项目 scope、提示词采集或本地鉴权:阅读 [配置 Codex](how-to/configure-codex.md)。
- 想通过本地插件把 OpenClaw 接入 PowerContext Memory:阅读 [配置 OpenClaw Memory](how-to/configure-openclaw.md)。
- 想配置其他宿主:阅读 [配置 Claude Code](how-to/configure-claude-code.md) 或
[配置 DeepSeek Harness](how-to/configure-dsh.md)。
- 想理解长期 Memory 与临时 Handoff 的适用边界:阅读[理解 Memory 和 Handoff](explanation/memory-and-handoff.md)。
Expand Down
80 changes: 80 additions & 0 deletions integrations/openclaw/plugins/memory-powercontext/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# PowerContext Memory for OpenClaw

This directory contains an external OpenClaw memory plugin. It is intentionally
owned by the PowerContext repository: installing it does not require changing
the OpenClaw source tree or bundling a fork of OpenClaw.

The plugin uses OpenClaw's public plugin SDK to register the exclusive memory
provider, while PowerContext remains the HTTP memory backend. OpenClaw remains
the authority for agent/session identity, private-session checks, prompt
lifecycle, and session transcript storage.

It requires OpenClaw 2026.8.1-beta.2 or newer. Earlier releases do not expose
the memory-provider plugin API used by this integration.

## Local development install

From this directory, install the build dependencies and build the runtime
entry. The OpenClaw SDK is supplied by the OpenClaw host at runtime; it is not
bundled into this package:

```bash
pnpm install
pnpm build
```

Then install the plugin through OpenClaw's managed local-plugin flow:

```bash
openclaw plugins install . --force
```

The install is managed by OpenClaw and reversible. Remove it with:

```bash
openclaw plugins uninstall memory-powercontext
```

To test the managed npm installation path, create a local tarball:

```bash
pnpm pack:local
openclaw plugins install npm-pack:./artifacts/oceanbase-openclaw-memory-powercontext-0.0.1.tgz --force
```

The tarball contains `dist/index.js` and `openclaw.plugin.json`; it can be
installed by a released OpenClaw CLI without a checkout of this repository.
Use `npm:@oceanbase/openclaw-memory-powercontext` after publishing a release.

## OpenClaw configuration

Set the memory slot and configure the PowerContext Server in `openclaw.json`:

```json
{
"plugins": {
"slots": {
"memory": "memory-powercontext"
},
"entries": {
"memory-powercontext": {
"enabled": true,
"hooks": {
"allowConversationAccess": true
},
"config": {
"endpoint": "http://127.0.0.1:8000",
"tokenEnv": "POWERCONTEXT_CLIENT_API_TOKEN"
}
}
}
}
}
```

Start PowerContext separately, export `POWERCONTEXT_CLIENT_API_TOKEN` when
server authentication is enabled, and restart the OpenClaw Gateway.
`hooks.allowConversationAccess` is required for automatic recall and source
capture because those hooks receive conversation content. Group and channel
sessions are not captured or searched. Protected transcript recall is not
emulated by this plugin.
18 changes: 18 additions & 0 deletions integrations/openclaw/plugins/memory-powercontext/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2026 OceanBase.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


export { default } from "./index.js";
Loading
Loading