Blog

skill · curated · memory · agents · local · Jul 27, 2026 · 2 min read

TencentDB Agent Memory: the four-tier memory pyramid that stops your AI agent from starting fresh every session

TencentDB Agent Memory's L0-to-L3 semantic pyramid architecture diagram showing how raw conversations get distilled into atomic facts, scenario blocks, and user personas

Most AI agent "memory" is a flat pile of embeddings in a vector database. Ask a question, get the nearest chunks back. It works until it doesn't — until the agent is asked to reason about patterns across weeks of conversations, and all it can retrieve are isolated fragments with no connective tissue.

What it is

TencentCloud/TencentDB-Agent-Memory takes a different approach. It builds a four-tier semantic pyramid over local SQLite, distilling raw conversations upward through progressively more abstract layers: L0 — raw conversations (what was said) L1 — atomic facts (what was learned) L2 — scenario blocks (when and in what context) L3 — user persona (who the user is, longitudinally) An agent can recall a specific preference from three months ago without loading 50k tokens of chat history into context. It retrieves the L3 persona summary and L2 scene blocks first, then drills into L0/L1 only when it needs exact detail. The system tracks provenance all the way down, so you're not just getting a hallucinated summary — you can trace any fact back to the source conversation.

The short-term side

There's also a symbolic short-term compression layer that's genuinely clever. When a tool call returns a 2,000-token JSON blob, the system externalizes that blob to a file and inserts a compact Mermaid diagram in-context instead. The agent reasons against the symbol; if it needs the full data, it fetches by node_id. Tencent reports a 61% token reduction and a 51% pass-rate improvement in their benchmarks when paired with OpenClaw. Those are big numbers — treat them as best-case until you've run it against your own workload.

When it shines

Long-running assistants where the same user returns repeatedly. Privacy-sensitive environments where sending conversation logs to a cloud vector DB isn't acceptable. Agents where context costs are climbing because the model keeps re-reading things it already "knows." The zero-external-API design is genuine: the default backend is local SQLite with the sqlite-vec extension. You can optionally swap in Tencent's cloud vector DB, but nothing forces you to. MIT license, 9,300+ stars.

The honest caveat

The integration story is young and framework-specific. The primary path is OpenClaw (openclaw plugins install @tencentdb-agent-memory/memory-tencentdb). The Docker/Hermes path works but requires you to configure networking and inject API keys for the LLM that runs the L0→L3 distillation pipeline — yes, the pyramid-building step calls a model, so it's not completely free to operate. There's no drop-in MCP server or one-command Claude Code skill yet. This is a memory *subsystem* you integrate into a compatible agent framework, not a slash command you install and forget. If you're not already on OpenClaw, budget an afternoon.

bash
# If you're on OpenClaw:
openclaw plugins install @tencentdb-agent-memory/memory-tencentdb
openclaw gateway restart

Credit

Built and open-sourced by the TencentCloud team. MIT license. Repo: TencentCloud/TencentDB-Agent-Memory