Tencent Open-Sources Memory for TencentDB agent: A 4-tier local memory pipeline for AI Agents

Tencent released TencentDB Agent Memory, an open source memory system for AI agents. The project runs under the MIT license. It addresses a common problem for anyone deploying long-horizon agents: context bloat and recall failure.
It is symbolic short-term memory and superimposed long-term memory. It also integrates OpenClaw as a plugin and Hermes Agent via Gateway adapter. The default backend is local SQLite with the sqlite-vec extension, so no external API is needed.
Why agent memory is difficult
Most current stacks the data into chunks and dump them into a flat vector store. Recall then becomes a uniform blind search for all disconnected pieces, without macro-level manipulation. The architecture relies on two pillars: memory layering and symbolic memory.
Semantic pyramid with 4 levels
With long-term customization, TencentDB Agent Memory builds a four-level pyramid instead of a flat log. The layers are L0 Conversation, L1 Atom, L2 Scenario, and L3 Persona. This includes raw dialogue, atomic facts, scenes, and user profiles.
The Persona layer holds the user's daily preferences and is queried first. The system pulls down to raw Atoms or Conversations only when less detail is needed. The lower layers store evidence; the upper layers maintain the structure.
Storage is not the same. Facts, logs, and traces are persisted to databases for full-text retrieval. People, scenes, and canvases are saved as human-readable Markdown files. Layered memory artifacts reside underneath ~/.openclaw/memory-tdai/.
A short memory of a Mermaid
Long-running agent jobs consume tokens by using verbose tool logs, search results, code, and error tracing. TencentDB agent memory addresses this by decontextualizing in combination with virtual memory.
Full tool logs are uploaded to the external files below refs/*.md. State changes are coded in Mermaid syntax within a lightweight task canvas. The agent places reasons over the symbol graph in its content window.
If it needs raw text, it greps for a node_id and finds the corresponding file. The Tencent dev team describes this as a deterministic pull-down from the top layer symbol to the middle layer index to the raw text of the lower layers.
Benchmark numbers
Results are measured in continuous sessions over a long horizon, not individual curves. The SWE bench, for example, runs 50 consecutive jobs per session to simulate stress accumulation.
In WideSearch, combining the plugin with OpenClaw increases the pass rate from 33% to 50%, a relative improvement of 51.52%. The usage of tokens decreased from 221.31M to 85.64M, a decrease of 61.38%.
On the SWE bench, success increases from 58.4% to 64.2% while tokens fall from 3474.1M to 2375.4M, a decrease of 33.09%. For AA-LCR, the success rate went from 44.0% to 47.5%. Tokens decreased from 112.0M to 77.3M, a decrease of 30.98%.
For long-term memory, PersonaMem's accuracy increases from 48% to 76%. Note: these numbers are from Tencent's research.
Also remember to give back
Recovery is automatic in a hybrid strategy. The program combines BM25 keyword search and vector embedding, combined using Reciprocal Rank Fusion (RRF). Developers can switch to pure keyword or embedding mode by using the edit field. The BM25 tokenizer supports both Chinese (jieba) and English.
The default settings trigger the L1 memory release every five turns. A user's persona is generated every 50 new memories. Recall automatically recalls five items with a 5 second timeout. During shutdown, the system skips the injection rather than blocking the conversation.
Installation and developer environment
OpenClaw integration is shipped as a single npm package: @tencentdb-agent-memory/memory-tencentdb. The project requires Node.js 22.16 or higher. Enabling it takes one configuration flag. The plugin then handles conversation capture, memory extraction, scene synthesis, character generation, and recall.
For Hermes, a Docker image includes an agent, a plugin, and a TDAI Memory Gateway. The default model is DeepSeek-V3.2 for Tencent Cloud. Any OpenAI compatible endpoint works with MODEL_PROVIDER=custom the flag.
Two tools are exposed to agents during a session: tdai_memory_search again tdai_conversation_search. Both return references with node_id again result_ref tracking fields. The Tencent Cloud Vector Database (TCVDB) backend is also available as a local SQLite alternative.
Marktechpost Visual Explainer
Chosen by Company MARKTECHPOST · AI Research, Built for Builders
Key Takeaways
- TencentDB Agent Memory is Tencent's open source (MIT) memory system for AI agents, built on a symbolic short-term memory and long-term memory pipeline with zero external API.
- Long-term memory is structured as a 4-tier semantic pyramid (L0 Conversation → L1 Atom → L2 Scenario → L3 Persona), with drill-down through
node_idagainresult_refinstead of remembering the flat vector. - The temporary memory outputs verbose tool logs to him
refs/*.mdand keeps only the unified Mermaid canvas of work in context, cutting the use of tokens while maintaining full traceability. - Reported benefits when combined with OpenClaw: WideSearch pass rate 33% → 50% with token reduction 61.38%, SWE bench 58.4% → 64.2%, AA-LCR 44.0% → 47.5%, and PersonaMem accuracy → 76% →
- It ships as a single npm plugin for OpenClaw and a Docker image for Hermes, with local SQLite + sqlite-vec by default, mixed retrieval of BM25 + vector + RRF, and a Tencent Cloud Vector Database (TCVDB) backend.
Check it out Repo. Also, feel free to follow us Twitter and don't forget to join our 150k+ ML SubReddit and Subscribe to Our newspaper. Wait! are you on telegram? now you can join us on telegram too.
Need to work with us on developing your GitHub Repo OR Hug Face Page OR Product Release OR Webinar etc.? contact us
Michal Sutter is a data science expert with a Master of Science in Data Science from the University of Padova. With a strong foundation in statistical analysis, machine learning, and data engineering, Michal excels at turning complex data sets into actionable insights.



