All Products
Search
Document Center

Tablestore:Configure long-term agent memory with Tablestore in OpenClaw

Last Updated:Mar 24, 2026

The @tablestore/openclaw-mem0 plugin connects OpenClaw to Alibaba Cloud Tablestore for durable, vector-backed agent memory. When a conversation yields extractable facts—preferences, habits, or standing context—mem0 structures them and stores embeddings in Tablestore. Later turns retrieve relevant memories into the model context so the agent stays consistent about the user. Install the plugin, wire authentication and models, and confirm the integration with the steps below.

Background

OpenClaw's built-in memory has practical limits: loss after context compaction (Compact), isolated memory per agent, operational overhead for self-hosted embeddings, and difficult backup or migration. Running mem0 on Tablestore addresses these with:

  • Fully managed storage: Alibaba Cloud operates Tablestore. Pay for usage instead of administering a database fleet—cost-effective for many small and medium workloads.

  • Data control: Data remains in your account and is visible in the Tablestore console, with resource isolation, permissions, and monitoring and alerts.

  • Shared memory across agents: Agents that share the same userId use one memory store; Compact does not erase historical memories.

  • Structured extraction: Surfaces names, preferences, and decisions instead of retaining full raw transcripts.

  • Hybrid retrieval: Combines vector similarity with BM25 keyword search for semantic recall plus exact matches at millisecond latency.

Prerequisites

Automatic installation

Send the following prompt to OpenClaw. The agent reads the remote installation guide and walks through configuration.

Read https://tablestore-doc.oss-cn-hangzhou.aliyuncs.com/aliyun-tablestore-ai/openclaw/skill.md and follow the instructions to install and configure the tablestore plugin for OpenClaw.
After installation, tell me what you can do.

If automatic installation fails, follow the manual steps in the next section.

Manual installation

Step 1: Install the plugin

openclaw plugins install @tablestore/openclaw-mem0
Note

After installation, OpenClaw sets openclaw-mem0 as the memory slot provider and disables the built-in memory-core and memory-lancedb.

OpenClaw unpacks plugins with the Node.js tar module. Large packages such as @tablestore/openclaw-mem0 (roughly 7,000 files) can hit a 120-second timeout. Avoid this by downloading with npm, extracting with the system tar utility, then installing from a local folder.

  1. Download the package to /tmp.

    cd /tmp && npm pack @tablestore/openclaw-mem0
  2. Extract the tarball with the system tar command. The command resolves the filename dynamically, so version bumps do not require edits.

    mkdir -p /tmp/openclaw-mem0-install && tar xzf /tmp/$(ls /tmp/tablestore-openclaw-mem0-*.tgz | head -1 | xargs basename) -C /tmp/openclaw-mem0-install --strip-components=1
  3. Install from the local folder.

    openclaw plugins install /tmp/openclaw-mem0-install

Step 2: Configure the plugin

Edit ~/.openclaw/openclaw.json. Add a config object under plugins.entries.openclaw-mem0.

Method 1: AccessKey with an existing instance

{
  "plugins": {
    "entries": {
      "openclaw-mem0": {
        "enabled": true,
        "config": {
          "mode": "open-source",
          "oss": {
            "vectorStore": {
              "provider": "tablestore",
              "config": {
                "endpoint": "https://{Instance Name}.{Region}.ots.aliyuncs.com",
                "instanceName": "{Instance Name}",
                "accessKeyId": "{AccessKey ID}",
                "accessKeySecret": "{AccessKey secret}"
              }
            },
            "embedder": {
              "provider": "openai",
              "config": {
                "apiKey": "{Model Studio API Key}",
                "model": "text-embedding-v3",
                "baseURL": "https://dashscope.aliyuncs.com/compatible-mode/v1"
              }
            },
            "llm": {
              "provider": "openai",
              "config": {
                "apiKey": "{Model Studio API Key}",
                "model": "qwen-plus",
                "baseURL": "https://dashscope.aliyuncs.com/compatible-mode/v1"
              }
            }
          }
        }
      }
    }
  }
}

Method 2: AccessKey with automatic instance creation

Omit endpoint and instanceName to let the plugin create a Tablestore instance in the target region. Set regionId to choose the region; the default is cn-hangzhou.

Note

Each account can own at most 10 Tablestore instances. See Limits.

"vectorStore": {
  "provider": "tablestore",
  "config": {
    "accessKeyId": "{AccessKey ID}",
    "accessKeySecret": "{AccessKey secret}",
    "regionId": "cn-hangzhou"
  }
}
Important

Auto-created instances disable public network access by default. When clients run on the public internet, open the Tablestore console, select the new instance, and enable public network access on the Network Management tab.

Method 3: ECS RAM role authentication

On Alibaba Cloud ECS, use an ECS RAM role instead of embedding AccessKeys in configuration. Attach AliyunOTSFullAccess to the role. See Instance RAM roles.

"vectorStore": {
  "provider": "tablestore",
  "config": {
    "roleName": "{RAM Role Name}",
    "regionId": "cn-hangzhou"
  }
}

For an existing instance, supply endpoint and instanceName instead of regionId, following the structure in Method 1.

Note

The embedder and llm both call DashScope through the OpenAI-compatible API. Set provider to openai and supply your Model Studio API key. The embedder uses text-embedding-v3 (1024 dimensions); the llm uses qwen-plus for memory extraction.

Step 3: Restart the gateway

openclaw gateway restart

Step 4: Verify the installation

openclaw mem0 stats

Successful output resembles:

[TablestoreVectorStore] OTS service status: enabled
Mode: open-source
User: default
Total memories: 0
Graph enabled: false
Auto-recall: true, Auto-capture: true

Total memories reports how many memories are stored. It starts at 0 and increases as conversations run.

Use long-term memory

Automatic extraction and retrieval

After configuration, no extra setup is required. In the TUI or a connected messaging channel, mem0:

  • Extracts when it detects durable user information—dietary preferences, coding habits, project background—and writes it to Tablestore.

  • Retrieves relevant memories before the next turn and injects them into context, so users avoid repeating the same facts.

Search memory

openclaw mem0 search "Hangzhou"

Returns entries semantically related to the query. Use this command to verify writes or inspect retrieval behavior.

Troubleshooting

Symptom

Resolution

Plugin not loaded

Verify plugins.slots.memory is "openclaw-mem0" and plugins.entries["openclaw-mem0"].enabled is true.

Download times out during installation

Point npm at a faster registry, then repeat Step 1: npm config set registry https://registry.npmmirror.com

AccessKeyId is invalid

Confirm the AccessKey ID and secret and that the account is active.

OTSObjectNotExist on first use

Expected on first access; the plugin creates tables and indexes automatically.

Automatic instance creation failed

Confirm the AccessKey has AliyunOTSFullAccess or that the account has not reached the instance limit.

Embedding error

Confirm the Model Studio API key and that quota remains available.

OTSAuthFailed (403)

Auto-created instances disable public access by default. Open the Tablestore console, select the instance, enable public network access on the Network Management tab, and retry.