Skip to content

fix: registerMemoryCapability API not found in OpenClaw 2026.3.31 #1559

Closed

Description

@MUFISH780

Pre-submission checklist | 提交前检查

  • I have searched existing issues and this hasn't been mentioned before | 我已搜索现有问题,确认此问题尚未被提及
  • I have read the project documentation and confirmed this issue doesn't already exist | 我已阅读项目文档并确认此问题尚未存在
  • This issue is specific to MemOS and not a general software issue | 该问题是针对 MemOS 的,而不是一般软件问题

Bug Description | 问题描述

Plugin version: 1.0.9 (also 1.0.9-beta.1)
OpenClaw version: 2026.3.31

When the plugin registers, it calls api.registerMemoryCapability() which does not exist in OpenClaw 2026.3.31.

Error:
TypeError: api.registerMemoryCapability is not a function

Expected Behavior

The plugin should use the correct OpenClaw memory plugin API. Based on OpenClaw 2026.3.31 SDK documentation, the available memory-related APIs are:

  • api.registerMemoryPromptSection(builder) — Memory prompt section builder
  • api.registerMemoryFlushPlan(resolver) — Memory flush plan resolver
  • api.registerMemoryRuntime(runtime) — Memory runtime adapter

How to Reproduce | 如何重现

  1. Install plugin: openclaw plugins install @memtensor/memos-local-openclaw-plugin
  2. Restart gateway
  3. Check plugin status — it fails to load with the error above

Environment | 环境信息

  • OpenClaw: 2026.3.31
  • Plugin: @memtensor/memos-local-openclaw-plugin@1.0.9
  • Node.js: v22.22.1
  • OS: Linux (Debian)

Additional Context | 其他信息

The error occurs at index.ts:163:

api.registerMemoryCapability({
  promptBuilder: buildMemoryPromptSection,
});

This API method does not exist in the current OpenClaw version. Please update the plugin to use the correct memory plugin API.

### Willingness to Implement | 实现意愿

- [ ] I'm willing to implement this myself | 我愿意自己解决
- [x] I would like someone else to implement this | 我希望其他人来解决

Activity

  1. MaiHHConnect commented on Apr 29, 2026

    @MaiHHConnect
  2. added
    ai:taskDispatched to AI coding agent | 已派发给 AI 编码任务
    on Jun 29, 2026
  3. self-assigned this
    on Jun 30, 2026
  4. Memtensor-AI commented on Jun 30, 2026

    @Memtensor-AI
    Collaborator

    🤖 AutoDev has picked up this issue and started working on it.

    Task ID: 7840d0a0fd0dd299
    Working branch: bugfix/autodev-1559
    Target branch: latest dev* branch
    Workflow: opsp (analysis → coding → testing → PR)

    I will post the PR link here once done. If I need more information, I will ask in the comments.

  5. added a commit that references this issue on Jun 30, 2026
    dfe260e
  6. Memtensor-AI commented on Jun 30, 2026

    @Memtensor-AI
    Collaborator

    ✅ AutoDev task 7840d0a0fd0dd299 completed.

    Summary: Fixes issue #1559: OpenClaw 2026.3.31 removed api.registerMemoryCapability and split it into three single-purpose methods (registerMemoryPromptSection, registerMemoryFlushPlan, registerMemoryRuntime). The MemOS Local OpenClaw plugin previously made an unconditional call to the removed method, crashing during plugin registration with TypeError: api.registerMemoryCapability is not a function, which prevented the plugin from loading.

    The fix in apps/memos-local-openclaw/index.ts migrates the call to prefer api.registerMemoryPromptSection(buildMemoryPromptSection) when the host SDK exposes it (OpenClaw 2026.3.31+), with a fallback to the legacy api.registerMemoryCapability({ promptBuilder }) for older hosts. When neither method is exposed, the plugin emits a non-fatal warning via the host logger and continues to load, eliminating the hard-crash failure mode entirely.

    A new regression suite tests/issue-1559-memory-api-migration.test.ts covers all three branches: (1) new API preferred when both are present, (2) legacy fallback when only the legacy method exists, (3) no-op + warn when neither is exposed. Verification: npx vitest run on impacted suites (issue-1559-memory-api-migration, plugin-openclaw-wiring, integration, plugin-impl-access, shutdown-lifecycle, incremental-sharing, hub-eager-connect) — 44/44 passed. The 5 unrelated pre-existing failures (model loading, timing-sensitive task processor, viewer update-install) reproduce on the baseline branch without this change and are out of scope.

    Branch bugfix/autodev-1559 pushed to origin; commit dfe260e. opsp artifacts archived to memos-autodev-specs repo.

    Base branch: main
    Branch: bugfix/autodev-1559
    Commit: dfe260e
    PR: #1991
    Assigned to: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
    Reviewers: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller

  7. added
    ai:testingAI agent is running tests | AI 正在运行测试
    and removed
    ai:codingAI agent is coding | AI 正在编码
    on Jun 30, 2026
  8. added a commit that references this issue on Jul 2, 2026
    609ded4
  9. added
    ai:codingAI agent is coding | AI 正在编码
    and removed
    ai:testingAI agent is running tests | AI 正在运行测试
    ai:taskDispatched to AI coding agent | 已派发给 AI 编码任务
    on Jul 2, 2026
  10. Memtensor-AI commented on Jul 2, 2026

    @Memtensor-AI
    Collaborator

    🤖 AutoDev has picked up this issue and started working on it.

    Task ID: aa7384b576a80c35
    Working branch: bugfix/autodev-1559
    Target branch: latest dev* branch
    Workflow: opsp (analysis → coding → testing → PR)

    I will post the PR link here once done. If I need more information, I will ask in the comments.

  11. added a commit that references this issue on Jul 2, 2026
    9453cbc
  12. Memtensor-AI commented on Jul 2, 2026

    @Memtensor-AI
    Collaborator

    ✅ AutoDev task aa7384b576a80c35 completed.

    Summary: Fixes #1559: the @memtensor/memos-local-openclaw-plugin failed to load on OpenClaw 2026.3.31 because it still called the removed umbrella api.registerMemoryCapability({promptBuilder}) at apps/memos-local-openclaw/index.ts:163. OpenClaw 2026.3.31 split that umbrella into three focused registrars — registerMemoryPromptSection, registerMemoryFlushPlan, registerMemoryRuntime — so the call threw TypeError: api.registerMemoryCapability is not a function and the plugin refused to initialize.

    The fix rewrites register() to feature-detect the new registerMemoryPromptSection(builder) API and use it preferentially, falling back to the legacy registerMemoryCapability({ promptBuilder }) for older gateways, and logging a warning if neither method is present. Only the prompt-section builder is needed — the plugin does not implement flush plans or memory runtimes — so this is a minimal, backwards-compatible migration.

    Test evidence: a new tests/memory-registration-api.test.ts (3 cases) locks in preference of the new API, the legacy-fallback path, and the no-throw safeguard. Six existing test stubs were extended to expose both entry points. npx vitest run tests/memory-registration-api.test.ts → 3/3 pass; targeted run of touched files (plugin-openclaw-wiring, plugin-impl-access, shutdown-lifecycle, hub-eager-connect, integration, incremental-sharing) → 41/41 pass. Broader npx vitest run --exclude e2e/accuracy → 213 pass; the 3 pre-existing failures (skill-auto-install, task-processor, update-install) exist on the base branch too and are unrelated to this change (confirmed via git stash re-run). npx tsc --noEmit is clean.

    Base branch: main
    Branch: bugfix/autodev-1559
    Commit: 9453cbc
    PR: #2037
    Assigned to: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller
    Reviewers: @MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller

  13. added
    ai:testingAI agent is running tests | AI 正在运行测试
    and removed
    ai:codingAI agent is coding | AI 正在编码
    on Jul 2, 2026
  14. added a commit that references this issue on Jul 2, 2026
    c9f270f
  15. added and removed
    ai:testingAI agent is running tests | AI 正在运行测试
    on Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:pluginOpenClaw & Hermestypes:bugSomething isn't working | 功能异常

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions