How to connect TencentDB Agent Memory to OpenClaw: local long-term memory, log compression and traceable retrieval

Install TencentDB Agent Memory for OpenClaw: Use local SQLite + sqlite-vec to save long-term memory, enable tool log offload on demand, and trace back the original evidence by node_id.

Once a long OpenClaw task spans multiple rounds of tool calls, two problems usually arise: the context becomes clogged with logs, or new sessions require reinterpretation of project conventions. TencentDB Agent Memory provides local long-term memory and short-term log compression for OpenClaw: SQLite + sqlite-vec is used by default to hierarchically organize long-term information; after offload is enabled, the complete tool output is saved to an external file and only a streamlined symbolic state is injected into the context. Project official warehouse

This article only deals with OpenClaw access. The key goal is not to “make the agent remember everything” but to make it able to retrieve facts when needed and allow you to trace high-level summaries back to the original conversation or tool log.

Confirm two things before installation

  1. Currently OpenClaw can start and execute basic conversations normally; first solve the model, permission or Gateway issues, and then add the memory plug-in.
  2. You know the backup location and access boundaries of local data. The memory may contain project context, task records, and tool output and should not be treated as a temporary, unrelated cache.

When accessing for the first time, it is recommended to enable only long-term memory first, and then enable log compression after confirming that the recall is correct. In this way, once an error occurs, it can be clearly determined whether it is caused by memory extraction, retrieval or offload configuration.

Install and enable plugins

Install using the OpenClaw native plugin command:

1
2
openclaw plugins install @tencentdb-agent-memory/memory-tencentdb
openclaw gateway restart

Subsequent upgrades should also use OpenClaw’s plug-in update command to avoid plug-ins being disabled due to semantic version range:

1
openclaw plugins update @tencentdb-agent-memory/memory-tencentdb

Enabled in ~/.openclaw/openclaw.json:

1
2
3
4
5
{
  "memory-tencentdb": {
    "enabled": true
  }
}

The official README states that the default backend is local SQLite + sqlite-vec. When enabled, the plug-in captures conversations, extracts memories, aggregates scenes, generates personas, and does recall before the next round; it does not require additional calls to external APIs for the memory function.

Test long-term memory with a set of verifiable facts

Don’t just ask, “Do you remember me?” Please take a test with answers and reviewability:

1
2
3
第 1 轮:告诉 Agent 当前项目的包管理器、测试命令和一条明确的输出约定。
第 2 轮:让它执行一个与这些约定相关的小任务。
新会话:询问测试命令和输出约定,并要求说明信息来源或不确定项。

Passing the standard does not mean that it recited more content, but that it correctly retrieved the facts and did not add information that did not exist without authorization. If project commitments have changed, old memories should be updated or cleared rather than expecting the model to automatically determine which ones are out of date.

Enable short-term log compression (offload)

Tool output, search results, and error stacks are often the main sources of token bloat for long tasks. The project’s offload feature will move the full log to an external file, leaving the compressed Mermaid state diagram in context. Official requirements require OpenClaw and plug-in versions to be at least 0.3.4.

Open in plugin configuration:

1
2
3
4
5
6
7
8
9
{
  "memory-tencentdb": {
    "config": {
      "offload": {
        "enabled": true
      }
    }
  }
}

Then register the context engine slot and let OpenClaw hand over the context-offload request to the plugin:

1
2
3
4
5
6
7
{
  "plugins": {
    "slots": {
      "contextEngine": "memory-tencentdb"
    }
  }
}

Finally, run the patch provided by the project so that the after-tool-call message can be uninstalled and restored:

1
bash scripts/openclaw-after-tool-call-messages.patch.sh

This patch only needs to be run once per OpenClaw installation; it will need to be reapplied after an OpenClaw upgrade.

How traceable retrieval works

Log compression should not equal a loss of detail. The short-term link of TencentDB Agent Memory is:

1
2
3
4
5
完整工具日志 → refs/*.md
步骤摘要 → jsonl 索引
Mermaid 状态图(带 node_id)→ 注入 Agent 上下文

When the Agent or you need to verify a conclusion, the corresponding summary and original log can be found from the Mermaid state diagram along node_id. Long-term memory follows a similar drill-down relationship: Persona → Scenario → Atom → Conversation. Therefore, when troubleshooting “why the Agent remembered it incorrectly”, you should first go back to the original evidence instead of just modifying the final summary.

Three acceptance checks that should be done after activation

  1. Long-term recall: Correctly retrieve a test fact in a new session, and be able to admit uncertain items.
  2. Log traceback: Execute a multi-tool calling task and confirm that the original output can still be found through node_id after compression.
  3. Failure Protection: Deliberately let a tool call fail and check whether the error message, original logs, and next round of recovery are still understandable.

If you only see the context shortened but cannot trace back the original information, offload should not be used for important production tasks. The premise of compression is to be recoverable, not to reduce the token itself.

Security boundaries for configuration and data

Defaulting to local storage does not mean security can be ignored. Suggestions:

  1. Incorporate the memory data directory into the encrypted backup and recovery drill.
  2. Don’t put keys in conversations, tool logs, or personas that shouldn’t be saved long-term.
  3. After updating OpenClaw or plug-ins, use a test session to confirm that memory extraction, recall, and offload are not degraded.
  4. Regularly review old personas, scenarios, and project engagements to remove outdated or sensitive information.

If you want to deploy Hermes, Docker Gateway or OpenAI compatible local models at the same time, you can read [TencentDB Agent Memory local deployment overview] (/en/2026/07/15/tencentdb-agent-memory-local-deployment-ollama-guide/).

FAQ

If you still forget the project agreement after enabling it, where should you check first?

First confirm that the plug-in is enabled, the Gateway has been restarted, and test whether it really spans a new session; then check the triggering timing of memory extraction and the permissions of the storage directory. Don’t fuzz your tests; use verifiable commands, paths, or output conventions.

Why can’t I see the complete log after offloading?

The complete log should be saved to an external log such as refs/*.md without fully injecting the context. Backtrack through node_id and the summary index in the Mermaid diagram; if the file does not exist or cannot be read, first check whether the path, permissions and patch have been applied correctly.

Does offload have to be enabled?

no. Only long-term memory can be used for short tasks or early in debugging. Only turn on offload if the tool output is actually causing context bloat and you have verified that the backlink is intact.

Summary

The safe sequence for accessing TencentDB Agent Memory is: first install and enable the OpenClaw plug-in, test long-term recall with verifiable facts, then turn on offload as needed, register context engine, apply patches, and finally check whether node_id can return to the original log. The result is an auditable local memory system rather than an uninterpretable automatic summary.

记录并分享
Built with Hugo
Theme Stack designed by Jimmy