by Tencent
TencentDB Agent Memory delivers fully local long-term memory for AI Agents via a 4-tier progressive pipeline, with zero external API dependencies.
# Add to your Claude Code skills
git clone https://github.com/Tencent/TencentDB-Agent-MemoryGuides for using ai agents skills like TencentDB-Agent-Memory.
在不依赖外部托管记忆服务的前提下,为 OpenClaw 提供可持续的本地长期记忆能力(L0→L1→L2→L3),并完成从安装、配置到验收的一次性闭环。
memory-tencentdb先确认基础版本满足要求:
>= 2026.3.13>= 22.16.0执行:
openclaw --version
node -v
若版本不满足,先升级再继续。
执行安装命令:
openclaw plugins install @tencentdb-agent-memory/memory-tencentdb
如已安装则执行更新:
openclaw plugins update memory-tencentdb
编辑 ~/.openclaw/openclaw.json,确保存在:
{
"memory-tencentdb": {
"enabled": true
}
}
说明:该插件支持零配置启动;不补充其它字段也能运行基础能力。
根据用户需求补充如下分组:
capture: 对话捕获与保留策略extraction: L1 提取与去重pipeline: L1→L2→L3 调度recall: 召回数量、阈值、策略persona: 场景与画像触发参数embedding: 向量检索配置(远端 OpenAI 兼容)推荐模板:
{
"memory-tencentdb": {
"capture": {
"enabled": true,
"excludeAgents": [],
"l0l1RetentionDays": 90,
"cleanTime": "03:00"
},
"extraction": {
"enabled": true,
"enableDedup": true,
"maxMemoriesPerSession": 10,
"model": "provider/model"
},
"pipeline": {
"everyNConversations": 5,
"enableWarmup": true,
"l1IdleTimeoutSeconds": 600,
"l2DelayAfterL1Seconds": 90,
"l2MinIntervalSeconds": 900,
"l2MaxIntervalSeconds": 3600,
"sessionActiveWindowHours": 24
},
"recall": {
"enabled": true,
"maxResults": 5,
"scoreThreshold": 0.3,
"strategy": "hybrid"
},
"persona": {
"triggerEveryN": 50,
"maxScenes": 15,
"backupCount": 3,
"sceneBackupCount": 10,
"model": "provider/model"
},
"embedding": {
"enabled": true,
"provider": "openai",
"baseUrl": "https://api.openai.com/v1",
"apiKey": "${EMBEDDING_API_KEY}",
"model": "text-embedding-3-small",
"dimensions": 1536,
"conflictRecallTopK": 5
}
}
}
Last scanned: 5/15/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-05-15T06:56:59.747Z",
"semgrepRan": false,
"npmAuditRan": true,
"pipAuditRan": true
}Highlights · Overview · Core Technology · Features · Quick Start
TencentDB Agent Memory = symbolic short-term memory + layered long-term memory.
- Symbolic short-term memory offloads heavy tool logs and condenses them into compact Mermaid symbols, cutting token usage and improving task success.
- Layered long-term memory distills fragmented conversations into structured personas and scenes, instead of flat vector piles.
When integrated with OpenClaw, it cuts token usage by up to 61.38%, improves pass rate by 51.52% (relative), and raises PersonaMem accuracy from to .
No comments yet. Be the first to share your thoughts!
embedding.provider = "none" 时,向量能力会禁用,仅保留关键词路径。provider(如 openai / deepseek),必须同时提供:
apiKeybaseUrlmodeldimensionsl0l1RetentionDays:
0 表示不清理0 时建议 >=31~2,需显式开启 allowAggressiveCleanup执行:
openclaw gateway restart
检查项:
[memory-tdai] 前缀~/.openclaw/memory-tdai/conversations/、records/、scene_blocks/、vectors.db执行一次最小对话回路并验证:
tdai_memory_searchtdai_conversation_searchopenclaw.json 中 memory-tencentdb.enabled 是否为 true,并确认已重启 Gateway。recall.enabled、scoreThreshold 是否过高。embedding 四元组(apiKey/baseUrl/model/dimensions)是否齐全。l0l1RetentionDays 与 allowAggressiveCleanup。~/.openclaw/openclaw.json,并再次重启 Gateway。apiKey 视为敏感信息;不在聊天、日志、截图中明文扩散。memory-tencentdb 对应配置段,避免覆盖用户其它插件配置。在结束任务前,必须同时满足:
openclaw.json 已存在有效 memory-tencentdb 配置[memory-tdai] 日志可见可在完成后向用户输出:
memory-tencentdb 安装与配置,并重启 Gateway。recall.scoreThreshold、pipeline.everyNConversations、persona.triggerEveryN 与 embedding 模型参数。| Memory Capability | Benchmark | OpenClaw Success | With Plugin | Relative Δ | OpenClaw Tokens | With Plugin Tokens | Relative Δ | | :--- | :--- | :---: | :---: | :---: | :---: | :---: | :---: | | Short-term | WideSearch | 33% | 50% | +51.52% | 221.31M | 85.64M | −61.38% | | Short-term | SWE-bench | 58.4% | 64.2% | +9.93% | 3474.1M | 2375.4M | −33.09% | | Short-term | AA-LCR | 44.0% | 47.5% | +7.95% | 112.0M | 77.3M | −30.98% | | Long-term | PersonaMem | 48% | 76% | +59% | — | — | — |
These results are measured over continuous long-horizon sessions, not isolated turns. For example, SWE-bench runs 50 consecutive tasks per session to simulate the context-accumulation pressure of real-world long-horizon agents.
Memory is not about hoarding everything in the AI — it is about sparing humans from having to repeat themselves.
In practice, we constantly re-explain the same SOPs, project background, tool conventions, and output formats to the Agent. Such information should not require repetition, nor should it be indiscriminately dumped into the context.
TencentDB Agent Memory helps the Agent learn your workflows, retain task context, and reuse past experience. We reject both brute-force history accumulation and irreversible lossy summarization. Instead, we design memory as a layered system: symbolic memory for in-task information overload, and memory layering for cross-session experience.
Let the Agent remember what should be remembered, so people can focus on judgment, creation, and work that truly matters.
Our architecture rests on two pillars: memory layering and symbolic memory. Together they ensure Agents do not merely "remember more", but "reason better".
Traditional memory systems shred data into fragments and dump them into a flat vector store. Recall degenerates into a blind search across disconnected fragments, with no macro-level guidance.
Whether it is long-term knowledge, short-term tasks, or future skill capabilities, memory should never be flat — both its formation and its recall must be hierarchical. TencentDB Agent Memory adopts layering as its unified architectural paradigm:
refs/*.md); the middle layer extracts step-level summaries (jsonl); the top layer condenses state into a lightweight Mermaid canvas. The Agent only needs to attend to the top-layer structure in context, and drills down to the lower layers via node_id when an error occurs.Heterogeneous storage and progressive disclosure. A dual-layer storage strategy underpins this architecture. The bottom layer (facts, logs, traces) is persisted in databases for robust full-text retrieval; the top layer (personas, scenes, canvases) is stored as human-readable Markdown files for high information density and white-box inspection. Lower layers preserve evidence; upper layers preserve structure.
Full traceability and lossless recovery. Compression often sacrifices traceability. TencentDB Agent Memory avoids irreversible compression by maintaining a deterministic path from high-level abstractions back to ground-truth evidence. Whether it is an offloaded error log or a distilled user preference, the system guarantees a complete drill-down path: "top-layer symbol (Persona / canvas) → mid-layer index (Scenario / jsonl) → bottom-layer raw text (L0 Conversation / refs)".
In long tasks, the largest token consumers are verbose intermediate logs (search results, code, error traces). To address this, we combine context offloading with symbolic memory:
node_id tracing. The Agent reasons over the symbol graph; to verify a detail, it greps for the node_id and instantly retrieves the full raw text — cutting token cost while preserving full traceability.graph LR
Log["Verbose Logs<br/>(hundreds of thousands of tokens)"] -->|"1. Offload full text"| FS[("External FS<br/>(refs/*.md)")]
Log -->|"2. Extract relations"| MMD["Mermaid Canvas<br/>(with node_id)"]
MMD -->|"3. Light injection"| Agent(("Agent Context<br/>(a few hundred tokens)"))
Agent -. "4. Recall via node_id" .-> FS
style Log fill:#f1f5f9,stroke:#94a3b8,stroke-dasharray: 5 5,color:#475569
style FS fill:#f8fafc,stroke:#cbd5e1,stroke-width:2px,color:#334155
style MMD fill:#eff6ff,stroke:#3b82f6,stroke-width:2px,color:#1e3a8a
style Agent fill:#fffbeb,stroke:#f59e0b,stroke-width:2px,color:#92400e
openclaw plugins install @tencentdb-agent-memory/memory-tencentdb
openclaw gateway restart
Defaults to a local SQLite + sqlite-vec backend.
// ~/.openclaw/openclaw.json
{
"memory-tencentdb": {
"enabled": true
}
}
Once enabled, TencentDB Agent Memory automatically handles conversation capture, memory extraction, scene aggregation, persona generation, and recall before the next turn.
{
"memory-tencentdb": {
"config": {
"offload": {
"enabled": true
}
}
}
}
Add the slots field so OpenClaw routes context-offload requests to this plugin:
{
"plugins": {
"slots": {
"contextEngine": "openclaw-context-offload"
}
}
}
For the best results, run the patch script below. It hooks after-tool-call messages so they can be offloaded and recovered correctly:
bash scripts/openclaw-after-tool-call-messages.patch.sh
💡 The patch only needs to be applied once per OpenClaw installation. After upgrading OpenClaw, re-run the script to re-apply.
In addition to OpenClaw, this plugin also supports Hermes Agent. You can launch a memory-enabled Hermes with a single command:
# ============ Configuration Pa