Share memory between OpenClaw and Hermes Agent

更新时间:
复制 MD 格式

Using Memory Storage Service and the official plugins for OpenClaw and Hermes Agent, you can write memory from both agents to a single Tablestore instance. Within the same tenant, other agents can then retrieve and recall this memory. This eliminates the need to repeat context when you switch between agents.

How it works

OpenClaw and Hermes Agent each maintain separate, local memory systems. This causes two problems: when you switch agents, accumulated memory such as preferences, tech stacks, and project backgrounds is not carried over; and when you use multiple agents collaboratively, you have to repeat the same introductory information to each agent.

Memory Storage Service provides AI agents with cloud-based, persistent semantic memory. It offers official plugins for both: @tablestore/openclaw-tablestore-memory for OpenClaw and hermes-tablestore-memory for Hermes Agent. These plugins enable both agents to write memory to the same Tablestore instance. Both agents use the same scope model to organize memory. They interoperate by assigning specific ownership during writes and using wildcard expansion during searches.

Scope field

Write behavior

Search behavior

app_id / tenant_id / memory_store_name

Exact match (must be identical for both agents)

Exact match (defines the sharing scope)

agentId

Exact match (determined by each agent's runtime to distinguish memory sources)

Wildcard *

runId

Exact match (determined by the current session)

Wildcard *

As long as both agents use the same Tablestore instance and the app_id, tenant_id, and memory_store_name configurations are identical, shared memory is enabled within the same tenant. The agentId is determined by each agent's runtime, requires no manual configuration, and naturally distinguishes memory sources.

The Hermes Agent plugin also provides two transparent, automated features: after each conversation turn, it automatically syncs key points to the memory store, and before the next turn, it automatically searches for relevant memory and injects it into the context. This process is transparent to the user, so the agent's responses naturally incorporate memories from all agents.

Prerequisites

Configure the shared memory store

To enable cross-agent communication, ensure the configurations for both agents are identical. Both agents must point to the same Tablestore instance and use the identical app_id, tenant_id, and memory_store_name.

Verify key configuration consistency

Parameter

OpenClaw field

Hermes Agent field

Consistency

Tablestore endpoint

endpoint

endpoint

Must be identical

Tablestore instance name

otsInstanceName

instance_name

Must be identical

AccessKey

accessKeyId / accessKeySecret

TABLESTORE_MEMORY_AK / TABLESTORE_MEMORY_SK

Must be identical

application ID

appId

app_id

Must be identical

tenant ID

tenantId

tenant_id

Must be identical

memory store name

memoryStoreName

memory_store_name

Must be identical

agent ID

agentId (Set by runtime; no configuration required)

agentId (Set by runtime; no configuration required)

Set independently by each agent to distinguish sources

OpenClaw configuration

Run the following command to install the @tablestore/openclaw-tablestore-memory plugin. For detailed instructions, see Implement Tablestore memory in OpenClaw.

openclaw plugins install @tablestore/openclaw-tablestore-memory

Edit the ~/.openclaw/openclaw.json file. Add the tablestore-mem configuration block to plugins.entries and point plugins.slots.memory to tablestore-mem.

{
  "plugins": {
    "slots": {
      "memory": "tablestore-mem"
    },
    "entries": {
      "tablestore-mem": {
        "enabled": true,
        "config": {
          "endpoint": "https://<your-instance>.cn-beijing.ots.aliyuncs.com",
          "otsInstanceName": "<your-instance>",
          "accessKeyId": "<your-access-key-id>",
          "accessKeySecret": "<your-access-key-secret>",
          "appId": "shared-agents",
          "tenantId": "default-tenant",
          "memoryStoreName": "shared_memory",
          "autoCreateMemoryStore": true,
          "minQueryLength": 0
        },
        "hooks": {
          "allowConversationAccess": true
        }
      }
    }
  }
}

Restart the OpenClaw gateway to apply the changes, and then run the diagnostic command to verify the connection.

openclaw gateway restart
openclaw tablestore-mem doctor

If the output shows the ok field as true and memoryStore.ok as true, OpenClaw is correctly connected to Tablestore.

Hermes Agent configuration

Run the following command to install the hermes-tablestore-memory plugin. For detailed instructions, including SDK dependency installation and mirror configuration for networks in Chinese mainland, see Implement Tablestore memory in Hermes Agent.

hermes plugins install --enable https://github.com/aliyun/hermes-tablestore-memory

Add your AccessKey to ~/.hermes/.env.

echo 'TABLESTORE_MEMORY_AK=<your-access-key-id>' >> ~/.hermes/.env
echo 'TABLESTORE_MEMORY_SK=<your-access-key-secret>' >> ~/.hermes/.env

Add the plugin parameters to ~/.hermes/tablestore_memory.json. Ensure that app_id, tenant_id, and memory_store_name are identical to the OpenClaw configuration.

{
  "endpoint": "https://<your-instance>.cn-beijing.ots.aliyuncs.com",
  "instance_name": "<your-instance>",
  "memory_store_name": "shared_memory",
  "app_id": "shared-agents",
  "tenant_id": "default-tenant",
  "enable_rerank": true,
  "auto_create_store": true,
  "timeout": 30.0
}

Activate tablestore-mem as the memory provider and run the diagnostic command to verify the connection.

hermes config set memory.provider tablestore-mem
hermes tablestore-mem doctor

If the output shows the ok field as true, and checks.initialize.ok, checks.describe_memory_store.ok, and checks.list_memories.ok are all true, Hermes Agent is correctly connected to Tablestore.

Verify cross-agent memory sharing

Verify that both agents share the same memory by performing write and recall operations from both sides.

Note

The tablestore-mem add command writes asynchronously by default. Vectorization and indexing can take several seconds to complete. When verifying a write operation, we recommend using the --sync parameter (for Hermes Agent) to wait for the index to complete. If a search immediately after a write returns empty results, wait for about 30 seconds and try again.

Scenario 1: OpenClaw writes, Hermes Agent recalls

Write a memory about project preferences in OpenClaw.

openclaw tablestore-mem add "I am responsible for developing the order service module, using a Java, Spring Boot, and MySQL tech stack"

Switch to Hermes Agent and start a new session. Ask a question that is semantically related to the memory. Hermes Agent automatically recalls the cross-agent memory and injects it into the context during the queue_prefetch() phase.

hermes -z "What module am I responsible for? What is my tech stack?"

The expected response should include facts like "order service module" and "Java/Spring Boot/MySQL". This confirms that Hermes Agent successfully recalled the memory written by OpenClaw.

Scenario 2: Hermes Agent writes, OpenClaw recalls

Write a memory about a team fact in Hermes Agent.

hermes tablestore-mem add --sync "Our team's release window is every Tuesday at 14:00"

Switch to OpenClaw and start a new session. Ask a question related to this fact. OpenClaw will automatically recall the cross-agent memory.

openclaw agent --agent main --message "When is our release window?"

The expected response should include facts like "every Tuesday" and "14:00". This confirms that OpenClaw successfully recalled the memory written by Hermes Agent.

Scenario 3: Cross-agent search with CLI

You can use the CLI command from either agent to search all memories written by both.

openclaw tablestore-mem search "release window"
hermes tablestore-mem search "order service"

The scope.agentId field in the search results will show the original writer (for example, openclaw, hermes, or main), allowing you to trace the memory's origin.

FAQ

Can agents communicate if their app_id, tenant_id, or memory_store_name mismatch?

No. Shared search relies on a scope match (app_id + tenant_id + memory_store_name). If any of these three parameters differ, they are considered different memory scopes, and the memory will not be recalled by the other agent.

Can I still use OpenClaw after migrating to Hermes Agent?

Yes. The hermes claw migrate command performs a copy, not a cut. Your original OpenClaw configuration and local data are not affected, so you can run both agents simultaneously. For the complete migration process, see the official Hermes Agent migration guide.

How to handle network failures during Hermes Agent installation?

Because direct connections to GitHub or PyPI from networks in Chinese mainland can be unstable, consider configuring an Alibaba Cloud PyPI mirror to accelerate dependency downloads. For details, see the "git clone fails or PyPI download is slow during installation" section in Implement Tablestore memory in Hermes Agent.

Related documents