TencentCloud / TencentDB-Agent-Memory
TencentCloud / TencentDB-Agent-Memory
Agents remember, Humans innovate. 智能体负责记忆,人类负责创新。
Highlights
亮点
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 48% to 76%. TencentDB Agent Memory = 符号化短期记忆 + 分层长期记忆。符号化短期记忆将繁重的工具日志卸载并压缩为紧凑的 Mermaid 符号,从而减少 Token 消耗并提高任务成功率。分层长期记忆将碎片化的对话提炼为结构化的用户画像(Persona)和场景(Scene),而非平铺的向量堆叠。集成到 OpenClaw 后,Token 消耗最高降低 61.38%,通过率提升 51.52%(相对值),PersonaMem 准确率从 48% 提升至 76%。
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 |
| Short-term SWE-bench | 58.4% | 64.2% | +9.93% | 3474.1M | 2375.4M |
| Short-term AA-LCR | 44.0% | 47.5% | +7.95% | 112.0M | 77.3M |
| 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. 以上结果是在连续的长周期会话中测得,而非孤立的单轮对话。例如,SWE-bench 每个会话运行 50 个连续任务,以模拟现实世界长周期智能体面临的上下文累积压力。
Overview
概述
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. 记忆的目的不是让 AI 囤积一切,而是让人们不必重复自己。在实践中,我们不断向智能体重复解释相同的 SOP、项目背景、工具约定和输出格式。这些信息不应被反复提及,也不应被不加区分地塞入上下文中。TencentDB Agent Memory 帮助智能体学习你的工作流、保留任务上下文并复用过往经验。我们拒绝暴力堆砌历史记录和不可逆的有损摘要。相反,我们将记忆设计为一个分层系统:用符号化记忆处理任务内的信息过载,用分层记忆处理跨会话的经验。让智能体记住该记住的,让人们专注于判断、创造和真正重要的工作。
Core Technology: Reject Flat Storage, Embrace Layering and Symbolization
核心技术:拒绝扁平存储,拥抱分层与符号化
Our architecture rests on two pillars: memory layering and symbolic memory. Together they ensure Agents do not merely “remember more”, but “reason better”. 我们的架构基于两大支柱:记忆分层和符号化记忆。它们共同确保智能体不仅是“记得更多”,而是“推理更好”。
1. Memory Layering: Progressive Disclosure with Heterogeneous Storage
1. 记忆分层:基于异构存储的渐进式披露
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: TencentDB Agent Memory 采用分层作为统一的架构范式:
- Short-term context layering. The bottom layer archives raw tool outputs (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. 短期上下文分层。 底层归档原始工具输出 (refs/.md);中间层提取步骤级摘要 (jsonl);顶层将状态压缩为轻量级的 Mermaid 画布。智能体在上下文中只需关注顶层结构,当发生错误时,可通过 node_id 向下钻取至底层。
- Long-term personalization layering. In place of flat logs, we build a semantic pyramid: L0 Conversation (raw dialogue) → L1 Atom (atomic facts) → L2 Scenario (scene blocks) → L3 Persona (user profile). The Persona layer carries day-to-day preferences; the system drills down to Atoms only when details matter. 长期个性化分层。 我们构建了一个语义金字塔来替代扁平日志:L0 对话(原始对话)→ L1 原子(原子事实)→ L2 场景(场景块)→ L3 用户画像(用户配置)。Persona 层承载日常偏好;系统仅在需要细节时才向下钻取至原子层。
- Skill generation layering. Layering also applies to actions. The middle layer derives common solution patterns (Scenario) from bottom-layer execution traces (Conversation), and the top layer distills reusable Skills or standard SOPs (Persona). 技能生成分层。 分层同样适用于行动。中间层从底层执行轨迹(对话)中推导出通用的解决方案模式(场景),顶层则提炼出可复用的技能或标准 SOP(用户画像)。
- 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. 异构存储与渐进式披露。 双层存储策略支撑着这一架构。底层(事实、日志、轨迹)持久化在数据库中以实现稳健的全文检索;顶层(用户画像、场景、画布)以人类可读的 Markdown 文件存储,以实现高信息密度和白盒检查。底层保留证据,顶层保留结构。
- 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)”. 全链路可追溯与无损恢复。 压缩往往会牺牲可追溯性。TencentDB Agent Memory 通过维护从高层抽象回溯到原始证据的确定性路径,避免了不可逆的压缩。无论是卸载的错误日志还是提炼的用户偏好,系统都保证了完整的钻取路径:“顶层符号(用户画像/画布)→ 中间层索引(场景/jsonl)→ 底层原始文本(L0 对话/refs)”。
2. Symbolic Memory: Maximum Semantics in Minimum Symbols (Mermaid Canvas)
2. 符号化记忆:以最少符号实现最大语义(Mermaid 画布)
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: 在长任务中,最大的 Token 消耗者是冗长的中间日志(搜索结果、代码、错误轨迹)。为了解决这个问题,我们将上下文卸载与符号化记忆相结合:
- Mermaid symbol graph. Instead of verbose prose or flat JSON, we encode task state transitions in high-density Mermaid syntax — precise enough for LLMs to parse, concise enough for humans to read. Mermaid 符号图。 我们不再使用冗长的文字或扁平的 JSON,而是用高密度的 Mermaid 语法对任务状态转换进行编码——既精确到足以让 LLM 解析,又简洁到足以让人类阅读。
- History offloading. Full tool logs are offloaded to external files; only a lightweight Mermaid task map remains in context. 历史卸载。 完整的工具日志被卸载到外部文件,上下文中仅保留轻量级的 Mermaid 任务图。
- 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. node_id 追踪。 智能体基于符号图进行推理;若需验证细节,它会通过 node_id 检索并立即获取完整的原始文本——在降低 Token 成本的同时保持了完全的可追溯性。
(Graph omitted for brevity)
Loading Quick Start
快速开始
🎬 Demos: OpenClaw_eg.mp4, Hermes_eg.mp4