Tencent has released TencentDB Agent Memory, an open-source memory system designed to improve how AI agents handle long-term recall and context. The project, available under the MIT license on GitHub, addresses the common issue of context bloat and recall failure in long-horizon agent tasks.
The Problem with Current Agent Memory
Most existing memory systems store data in fragmented chunks within a flat vector store, relying on blind similarity searches that lack high-level guidance. TencentDB Agent Memory introduces a layered approach with symbolic short-term memory to overcome this limitation.
Four-Tier Memory Architecture
Instead of a flat log, the system builds a four-level memory pyramid:
- L0 Conversation: Raw dialogue logs
- L1 Atom: Atomic facts extracted from conversations
- L2 Scenario: Scene blocks representing groups of interactions
- L3 Persona: User profile summarizing day-to-day preferences
The Persona layer is queried first, with deeper layers accessed only when finer detail is needed. Lower layers preserve raw evidence, while upper layers maintain structured summaries.
Storage is heterogeneous: facts and logs go into databases for full-text retrieval, while personas, scenes, and canvases are kept as human-readable Markdown files under ~/.openclaw/memory-tdai/.
Symbolic Short-Term Memory with Mermaid
To reduce token consumption from verbose tool logs, search results, and error traces, the system offloads full logs to external files and encodes state transitions using Mermaid syntax inside a lightweight task canvas. The agent reasons over the symbol graph in its context window and retrieves raw text only when needed by referencing node IDs.
Benchmark Results
Tencent evaluated the system over continuous long-horizon sessions. Key results include:
- WideSearch: Pass rate improved from 33% to 50% (51.52% relative increase), token usage dropped 61.38%
- SWE-bench: Success rate rose from 58.4% to 64.2%, tokens reduced 33.09%
- AA-LCR: Success rate increased from 44.0% to 47.5%, tokens dropped 30.98%
- PersonaMem: Accuracy jumped from 48% to 76%
Retrieval combines BM25 keyword search with vector embeddings using Reciprocal Rank Fusion for hybrid search.
The project integrates with OpenClaw as a plugin and with the Hermes Agent via a Gateway adapter. The default backend uses local SQLite with the sqlite-vec extension, requiring no external API.