Agent frameworks

OpenClaw

OpenClaw plugin that backs agent memory with Spectron.

The @surrealdb/spectron-openclaw plugin backs OpenClaw agent memory with Spectron. It gives an agent long-term memory that survives session restarts and fresh chats: relevant memory is recalled before each turn, each turn is persisted afterwards, and the agent gains tools and a CLI for deliberate memory access.

By default the plugin augments OpenClaw's built-in memory. It can optionally take over the memory slot (see Memory modes).

  • OpenClaw 2026.4.27 or newer

  • A Spectron endpoint, API key, and context id (SurrealDB Cloud or the self-hosted Spectron binary)

openclaw plugins install @surrealdb/spectron-openclaw
openclaw spectron setup
openclaw gateway restart

openclaw spectron setup prints the config block and the two hook flags to add.

Configuration lives in ~/.openclaw/openclaw.json under plugins.entries.spectron. Connection fields accept ${ENV_VAR} references so secrets stay out of the file:

{
  "plugins": {
    "entries": {
      "spectron": {
        "enabled": true,
        "hooks": {
          "allowConversationAccess": true,
          "allowPromptInjection": true
        },
        "config": {
          "endpoint": "${SPECTRON_ENDPOINT}",
          "apiKey": "${SPECTRON_API_KEY}",
          "context": "${SPECTRON_CONTEXT}"
        }
      }
    }
  }
}
Important

Both hook flags are required. allowConversationAccess lets OpenClaw deliver the agent_end event to the plugin. Without it, per-turn persistence is silently skipped. allowPromptInjection lets the plugin inject recalled context.

KeyDefaultPurpose
endpointrequiredSpectron API origin, no trailing slash
apiKeyrequiredBearer API key
contextrequiredContext id (namespace and database)
recallScopewhole regionRead lens narrowing recall (scope path, or array of paths)
writeScopekey defaultScope written memories are tagged with
autoRecalltrueInject memory before each turn
autoCapturetruePersist each turn
autoConsolidatetrueConsolidate at session end
autoIndextrueSeed workspace memory files on start or index
recallK5Max hits per recall
injectMode"context"context (formatted text) or recall (ranked hits)

The plugin maps Spectron's operations onto OpenClaw's agent lifecycle:

OpenClaw hookWhat happens
before_prompt_buildRelevant memory is injected as <spectron_memory> before the model runs
agent_endThe turn is persisted, with platform metadata stripped
session_endRecent facts are consolidated into durable observations
gateway_start / spectron indexWorkspace memory files (MEMORY.md, memory/**) are seeded

The agent can call these directly: spectron_recall, spectron_context, spectron_remember, spectron_reflect, spectron_forget, spectron_upload, and spectron_inspect.

openclaw spectron setup [--takeover]   # print config + required hook flags
openclaw spectron status               # config, slot mode, and identity
openclaw spectron health               # check the connection
openclaw spectron index                # seed workspace memory files
openclaw spectron recall <query>       # search memory
openclaw spectron reflect <query>      # synthesise an answer from memory
openclaw spectron forget <query>       # forget matching memories
  • Augment (default): runs alongside the built-in memory core. Nothing about the memory slot changes.

  • Takeover (experimental): openclaw spectron setup --takeover prints a patch that sets plugins.slots.memory to spectron, making Spectron the sole memory provider.

Was this page helpful?