feat(integrations/OpenClaw): add OpenClaw PowerContext memory plugin - #1282
Conversation
For ReviewersNote: 辛苦各位Reviewers owo) b 集成运行时日志和效果可见观测放在 Evidence 内 目前存在的 review 均已修复 请在合并时注意和 #1314 的合并顺序 如果需要合并后的 Follow-up 可以随时进行 PR 产出!!! Documentation, usage instructions, and the README will be completed in a follow-up PR bcz this PR has LARGE SIZE. This PR focuses on the implementation and adds the following CLI capabilities:
示例命令: powercontext setup openclaw \
--source oceanbase/powercontext \
--ref <ref> \
--server-url http://127.0.0.1:8765 \
--scope-mode agentOne Line Command: powercontext setup openclaw --source oceanbase/powercontext --ref v0.0.2
本 PR 体量较大,是因为它实现的是完整的 OpenClaw 集成,而不是简单的配置适配。除了插件本身,还包含生命周期管理、记忆管理、HTTP 通信、工具注册、内容/隐私/作用域处理、运行时校验、SDK 类型声明、构建配置和插件测试,同时新增了跨平台 Python 配置脚本、 |
Which issue or RFC does this PR close?
Closes #1281.
Rationale for this change
OpenClaw needs a memory provider that can use PowerContext's durable, scoped memory backend without modifying OpenClaw core. OpenClaw remains responsible for agent identity, privacy decisions, transcripts, and lifecycle hooks, while PowerContext provides memory storage, search, recall, and processing.
What changes are included in this PR?
memoryprovider slot.powercontext_memory_search,powercontext_memory_get,powercontext_memory_store,powercontext_memory_revise, andpowercontext_memory_retire.configure-openclaw.pyhelper that enables the plugin, preserves user-definedtools.alsoAllowentries, adds the five PowerContext tools, and removes only those managed entries fordisable/off.powercontext setup openclaw --source <source> --ref <ref>to materialize, build, install, and configure the integration in one command.Evidence
Logs - Detail
Are there any user-facing changes?
Yes.
The plugin requires OpenClaw
2026.8.1-beta.2or newer. After building and installing the local plugin, it can be enabled with:python3 ./scripts/configure-openclaw.py enable http://127.0.0.1:8765 agentThe aligned one-line setup flow is:
The helper updates the memory slot and the OpenClaw coding-tool allowlist without overwriting unrelated
tools.alsoAllowentries. No OpenClaw core source changes or public PowerContext API breaking changes are introduced.How was this change tested?
pnpm --dir integrations/openclaw/plugins/memory-powercontext typecheckpnpm --dir integrations/openclaw/plugins/memory-powercontext test— 16 tests passedpnpm --dir integrations/openclaw/plugins/memory-powercontext builduv run python -m pytest tests/test_openclaw_cli.py tests/test_openclaw_configure_script.py -q— 7 tests passeduv run python -m pytest tests/test_cli.py tests/test_dsh_cli.py tests/test_openclaw_cli.py tests/test_openclaw_configure_script.py tests/test_system_cli.py -q— 69 tests passeduv run python -m pytest tests/e2e/test_runtime_server.py -q— 7 passed, 3 skippedpython3 -m py_compile integrations/openclaw/plugins/memory-powercontext/scripts/configure-openclaw.pyuv run ruff check integrations/openclaw/plugins/memory-powercontext/scripts/configure-openclaw.py tests/test_openclaw_configure_script.py src/powercontext/cli/openclaw.py src/powercontext/cli/system.py tests/test_openclaw_cli.pyuv run ty checkgit diff --checkAI usage statement
AI tools were used during development and validation. Codex based on GPT-5 was used to inspect the repositories, implement the integration, run tests, and validate the OpenClaw plugin installation and runtime behavior.
中文翻译
此 PR 关闭哪个 Issue 或 RFC?
关闭 #1281。
变更原因
OpenClaw 需要一个能够使用 PowerContext 持久化、隔离 Memory 的提供方,同时不修改 OpenClaw 核心代码。OpenClaw 继续负责 Agent 身份、隐私判断、transcript 和生命周期钩子,PowerContext 负责 Memory 的存储、搜索、召回和处理。
此 PR 包含哪些变更?
memoryprovider slot。powercontext_memory_search、powercontext_memory_get、powercontext_memory_store、powercontext_memory_revise和powercontext_memory_retire。configure-openclaw.py:启用插件、保留用户已有的tools.alsoAllow项、加入五个 PowerContext 工具,并在disable/off时只移除由本插件管理的工具。powercontext setup openclaw --source <source> --ref <ref>,用一条命令完成 checkout、构建、安装和集成配置。证据
已使用本地 OpenClaw
2026.8.1-beta.2Gateway 和本地 PowerContext HTTP Server 完成集成验证。配置脚本报告五个受管工具均已加入 allowlist,并在重复 enable 以及 disable/off 操作中保留无关的用户工具。是否有面向用户的变更?
有。
插件要求 OpenClaw
2026.8.1-beta.2或更高版本。构建并安装本地插件后,可以使用以下命令启用:python3 ./scripts/configure-openclaw.py enable http://127.0.0.1:8765 agent对齐其他集成的一行 setup 命令为:
该脚本会更新 memory slot 和 OpenClaw coding-tool allowlist,不会覆盖无关的
tools.alsoAllow项。不修改 OpenClaw 核心代码,也不改变 PowerContext 的公共 API。如何测试?
pnpm --dir integrations/openclaw/plugins/memory-powercontext typecheckpnpm --dir integrations/openclaw/plugins/memory-powercontext test,16 个测试通过pnpm --dir integrations/openclaw/plugins/memory-powercontext builduv run python -m pytest tests/test_openclaw_cli.py tests/test_openclaw_configure_script.py -q,7 个测试通过uv run python -m pytest tests/test_cli.py tests/test_dsh_cli.py tests/test_openclaw_cli.py tests/test_openclaw_configure_script.py tests/test_system_cli.py -q,69 个测试通过uv run python -m pytest tests/e2e/test_runtime_server.py -q,7 个通过、3 个跳过python3 -m py_compile integrations/openclaw/plugins/memory-powercontext/scripts/configure-openclaw.pyuv run ruff check integrations/openclaw/plugins/memory-powercontext/scripts/configure-openclaw.py tests/test_openclaw_configure_script.py src/powercontext/cli/openclaw.py src/powercontext/cli/system.py tests/test_openclaw_cli.pyuv run ty checkgit diff --checkAI 使用声明
本 PR 的开发和验证过程中使用了 AI 工具。Codex(GPT-5)用于检查代码库、实现集成、运行测试,以及验证 OpenClaw 插件的安装和运行时行为。