# OpenClaw Native Memory

Source: https://docs.rushdb.com/2.x/connect/openclaw-memory/

`@rushdb/openclaw-memory` adds automatic, lifecycle-aware RushDB recall and persistence while leaving OpenClaw's local Markdown and SQLite memory active.

This is different from the existing MCP and skills integration:

| Level                     | Behavior                                                 |
| ------------------------- | -------------------------------------------------------- |
| RushDB MCP                | The model can choose database tools                      |
| MCP + RushDB skills       | Tools plus procedural query and modeling guidance        |
| `@rushdb/openclaw-memory` | Automatic pre-inference recall and post-turn persistence |

The plugin is additive. It does not claim OpenClaw's exclusive `kind: "memory"` capability.

## Install

```bash
openclaw plugins install @rushdb/openclaw-memory
```

Set the API key in the gateway environment, then configure the plugin:

```json
{
  "plugins": {
    "entries": {
      "rushdb-memory": {
        "enabled": true,
        "hooks": {
          "allowConversationAccess": true,
          "allowPromptInjection": true
        },
        "config": {
          "profileId": "default",
          "autoRecall": true,
          "autoCapture": true,
          "recallTimeoutMs": 300
        }
      }
    }
  }
}
```

Required environment variable:

```bash
export RUSHDB_API_KEY=your-project-api-key
```

For self-hosting, also set `RUSHDB_API_URL`. Set `RUSHDB_MEMORY_SCOPE_SALT` so hashes of channel and participant identifiers cannot be correlated across deployments.

## Privacy behavior

Every write and recall is constrained by `agentId`, `profileId`, `privacyScope`, `participantScopeHash`, and `sandboxEligible` before semantic ranking. The plugin fails closed for:

- group and channel sessions;
- cron, hook, node, subagent, heartbeat, and incognito sessions;
- sandboxed prompt contexts;
- channel conversations without a trusted participant identifier.

Local/CLI sessions default to the exact session as their participant scope. Set `localScopeId` only when multiple local sessions intentionally share memory.

Only the latest bounded user/assistant pair is captured. System messages, complete transcripts, tool calls, command output, and local file paths are not uploaded automatically.

## Reliability

Completed episodes are first written to a local outbox at `~/.openclaw/rushdb-memory/outbox`. A background writer uses deterministic `eventId` values and RushDB `upsert` with `mergeBy: ["eventId"]`. If RushDB is unavailable, OpenClaw's reply and local memory continue normally and the outbox remains available for replay after restart.

Managed embedding indexes are eventually consistent. A bounded recent-write cache supplies read-your-own-write recall until the `EPISODE.summary` index is ready.

## Verify

1. Tell the agent a stable project decision.
2. End the session and start another authorized private session.
3. Ask about the decision without explicitly calling a RushDB tool.
4. Take RushDB offline and confirm the user conversation still completes.

Use [MCP and Agent Skills](/learn/tutorials/agent-memory/agent-skills-with-openclaw) alongside the plugin when the model also needs explicit graph operations.
