Skip to content

Feature request: per-agent memory isolation via allowedAgents config #27

@rbutera

Description

@rbutera

In multi-agent OpenClaw setups, the supermemory plugin currently fires for every agent that shares the OpenClaw instance. Since plugins.entries is a global config namespace, there's no way to restrict memory capture and recall to a specific agent without forking the plugin.

This creates a real problem: a user with 10+ agents (engineering agents, research agents, personal companions) ends up with all of them reading from and writing to the same memory container. Memories that were only meant for one agent context bleed into unrelated agent sessions.

Proposed change: add an optional allowedAgents array to the plugin config. When set, the plugin checks ctx.sessionKey in the before_agent_start and agent_end hooks and skips memory operations for any agent not on the list.

{
  "plugins": {
    "entries": {
      "openclaw-supermemory": {
        "enabled": true,
        "config": {
          "apiKey": "${SUPERMEMORY_OPENCLAW_API_KEY}",
          "allowedAgents": ["navi"],
          "containerTag": "navi_main"
        }
      }
    }
  }
}

The implementation is minimal: a guard clause at the top of both hook handlers using the already-available ctx.sessionKey. No API changes, no breaking changes, opt-in only (when allowedAgents is omitted, current behaviour is preserved).

The heartbeat skip via SKIPPED_PROVIDERS is a great precedent for exactly this pattern.

Happy to open a PR if the direction sounds right.

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