Skip to content

Plugin Re-initializes on Every Tool Execution - Performance Impact #12

@620newcastle-debug

Description

@620newcastle-debug

Bug Description

The openclaw-supermemory plugin re-initializes on every tool execution, causing 1-2 second delays per operation and showing "supermemory: initialized" repeatedly in logs.

Environment

  • OpenClaw version: 2026.2.6-3
  • Plugin version: 1.0.4
  • OS: Ubuntu (AWS EC2)
  • Node: v22.22.0

Configuration

{
  "plugins": {
    "slots": { "memory": "openclaw-supermemory" },
    "entries": {
      "openclaw-supermemory": {
        "enabled": true,
        "config": {
          "apiKey": "sm_...",
          "autoRecall": true,
          "autoCapture": true
        }
      }
    }
  }
}


2026-02-09T05:01:39.412Z supermemory: initialized (container: openclaw_ip_172_26_7_162)
2026-02-09T05:01:49.247Z supermemory: initialized
2026-02-09T05:02:06.183Z supermemory: initialized
2026-02-09T05:02:18.131Z supermemory: initialized

14 initializations in 6 minutes during normal operation.

Impact

• 1-2 second delay added to every agent tool call
• Status shows "unavailable" despite functioning
• Significant performance degradation
Expected Behavior

Plugin should initialize once at startup and reuse the connection.

Steps to Reproduce

1. Install openclaw-supermemory plugin
2. Configure with valid API key
3. Run any agent operation that triggers tools (exec, web_fetch, etc.)
4. Observe logs showing repeated initialization
Technical Analysis

After reviewing the plugin source code:

1. The SupermemoryClient is instantiated in the register() function (index.ts:14-15)
2. The initialized log comes from the client constructor (client.ts:35)
3. The plugin correctly registers hooks once (before_agent_start, agent_end)
Conclusion: The plugin code appears correct — the client should only be created once during plugin registration. The repeated initialization suggests an OpenClaw plugin lifecycle issue where register() is being called multiple times, possibly due to:

• Slot re-assignment during agent runs
• Hook-triggered plugin re-registration
• Gateway state changes causing reloads
Troubleshooting Already Attempted

• Verified API key is valid (memories store/recall correctly)
• Tried different API keys (OpenClaw-specific vs general)
• Confirmed config schema compliance
• Reviewed plugin source - initialization logic appears correct
Request

Can you investigate why the plugin re-initializes on every tool execution hook rather than maintaining a persistent connection? Happy to provide additional logs or test fixes.


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions