TencentDB-Agent-Memory: A 4-Layer Memory System for AI Agents
TencentCloud's open-source TencentDB-Agent-Memory gives AI agents a 4-layer memory system with Mermaid-based compression.
TencentCloud has open-sourced TencentDB-Agent-Memory, a project addressing the common 'flat memory' problem in AI agent systems, where context decay, lack of structure, and irreversible compression degrade performance over long sessions. The system organizes memory into a four-layer semantic pyramid: raw Conversation (L0), atomic Facts (L1), Scenario blocks (L2), and a Persona profile (L3), with each upper layer keeping a traceable path back to its source data so summarization never destroys evidence.
The most notable engineering choice is using Mermaid diagrams as a compression format for long agent tasks: verbose tool logs are offloaded to external files while only a lightweight Mermaid canvas with node identifiers stays in context, letting the agent drill back into raw logs only when needed. Benchmarks against OpenClaw show meaningful accuracy gains on both short- and long-term tasks alongside a substantial reduction in token usage.
The system integrates officially with runtimes like Hermes Agent and stores memory as plain Markdown files, making recall results auditable rather than opaque. For engineers, the significance lies in automating context-management decisions that are usually made manually, offering a concrete architecture for reasoning effectively within a fixed context window.