🧠 TencentDB-Agent-Memory:腾讯开源的 Agent 记忆层,Token 省 61% 通过率提 51%,pip install 即用 / TencentDB Agent Memory: Tencent's Agent Memory Layer Cuts Tokens 61%, Boosts Pass Rate 51%
你的 AI Agent 是不是每次对话都像第一次见面?明明刚才教过它的 SOP,下一轮又忘了。传统做法是把所有历史一股脑塞进 context——但 token 消耗直接爆炸,而且重要的信息反而淹没在日志垃圾里。
TencentDB Agent Memory(GitHub: Tencent/TencentDB-Agent-Memory,2.2k stars)用「分层记忆 + 符号化压缩」解决了这个问题。不是平铺直叙的向量存储,而是把 Agent 记忆分成四层:
- L0 原始对话:保留完整证据链
- L1 原子事实:提取关键信息
- L2 场景块:归纳通用模式
- L3 人格画像:用户偏好、工作流、输出格式
配合 Mermaid 符号图谱——把上百 KB 的工具日志压缩成几百 token 的符号图,Agent 只读顶层结构,需要细节时通过 node_id 精准回查。
实测数据(不是画饼)
| 场景 | 原生 | 带记忆 | 变化 |
|---|---|---|---|
| WideSearch 通过率 | 33% | 50% | +51.52% |
| SWE-bench 通过率 | 58.4% | 64.2% | +9.93% |
| Token 消耗(WideSearch) | 221.31M | 85.64M | −61.38% |
| PersonaMem 准确率 | 48% | 76% | +59% |
快速开始
配合 OpenClaw
openclaw plugins install @tencentdb-agent-memory/memory-tencentdb
openclaw gateway restart
然后在 ~/.openclaw/openclaw.json 里启用:
{
"memory-tencentdb": {
"enabled": true
}
}
// 默认用本地 SQLite + sqlite-vec,零配置
开启短上下文压缩(需 ≥0.3.4):
{
"memory-tencentdb": {
"config": {
"offload": {
"enabled": true
}
}
}
}
配合 Hermes Agent(Docker)
docker run -d \
-e HERMES_MEMORY_BACKEND=tencentdb \
-e TENCENTDB_MEMORY_ENABLED=true \
-v ./data:/app/data \
nousresearch/hermes-agent:latest
核心设计思路
他们拒绝「平铺向量存储」这个词我特别喜欢。传统记忆系统把所有东西切碎丢进向量库,回忆的时候跟大海捞针一样。TencentDB 的方案是:
下层存证据(原始日志、工具输出),上层存结构(画像、场景、符号图)。 从上层到下层有完整的追溯路径——上层符号 → 中层索引 → 底层原文。压缩了,但可追溯。
TencentDB Agent Memory: Tencent's Open-Source Memory Layer for AI Agents
Your AI agent forgets everything between sessions? SOPs you taught it vanish after the next turn? TencentDB Agent Memory (2.2k★ GitHub) solves this with a layered memory + symbolic compression architecture.
It organizes memory into 4 tiers: L0 raw conversation → L1 atomic facts → L2 scenario blocks → L3 persona profiles. Instead of dumping everything into a flat vector DB, it compresses verbose tool logs into compact Mermaid symbol graphs — the agent keeps only ~200 tokens of symbolic context, and drills down via node_id when it needs details.
Numbers that speak:
- WideSearch pass rate: 33% → 50% (+51.52%)
- SWE-bench pass rate: 58.4% → 64.2% (+9.93%)
- Token consumption cut by 61.38%
- Persona memory accuracy: 48% → 76%
Quick start with OpenClaw:
openclaw plugins install @tencentdb-agent-memory/memory-tencentdb
openclaw gateway restart
Zero-config local backend (SQLite + sqlite-vec). Just set "enabled": true in your config.
The philosophy: lower layers store evidence (raw logs, tool outputs), upper layers store structure (personas, scenarios, symbol maps). Full traceability from abstraction back to ground truth — compressed, but never lossy.