Tencent has released TencentDB Agent Memory, an open-source memory system for AI agents. The project ships under the MIT license. It targets a problem familiar to anyone shipping long-horizon agents: context bloat and recall failure.
It is symbolic short-term memory along with layered long-term memory. It integrates with OpenClaw as a plugin and with the Hermes Agent through a Gateway adapter. The default backend is local SQLite with the sqlite-vec extension, so no external API is required.
Why agent memory is hard
Most current memory stacks shred data into fragments and dump them into a flat vector store. Recall then becomes a blind similarity search across disconnected fragments, with no macro-level guidance. The architecture rests on two pillars: memory layering and symbolic memory.
A 4-tier semantic pyramid
For long-term personalization, 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. These correspond to raw dialogue, atomic facts, scene blocks, and a user profile.
The Persona layer carries day-to-day user preferences and is queried first. The system drills down to Atoms or raw Conversations only when finer detail is needed. Lower layers preserve evidence; upper layers preserve structure.
Storage is heterogeneous. Facts, logs, and traces are persisted in databases for full-text retrieval. Personas, scenes, and canvases are stored as human-readable Markdown files. Layered memory artifacts live under ~/.openclaw/memory-tdai/.
Symbolic short-term memory via Mermaid
Long-running agent tasks consume tokens through verbose tool logs, search results, code, and error traces. TencentDB Agent Memory addresses this through context offloading combined with symbolic memory.
Full tool logs are offloaded to external files under refs/*.md. State transitions are encoded in Mermaid syntax inside a lightweight task canvas. The agent reasons over the symbol graph in its context window.
When it needs the raw text, it greps for a node_id and retrieves the corresponding file. The Tencent dev team describes this as a deterministic drill-down from top-layer symbol to mid-layer index to bottom-layer raw text.
Benchmark numbers
Results are measured over continuous long-horizon sessions, not isolated turns. SWE-bench, for example, runs 50 consecutive tasks per session to simulate context-accumulation pressure.
On WideSearch, integrating the plugin with OpenClaw raises pass rate from 33% to 50%, a 51.52% relative improvement. Token usage drops from 221.31M to 85.64M, a 61.38% reduction.
On SWE-bench, success climbs from 58.4% to 64.2% while tokens fall from 3474.1M to 2375.4M, a 33.09% reduction. On AA-LCR, the success rate moves from 44.0% to 47.5%. Tokens drop from 112.0M to 77.3M, a 30.98% reduction.
For long-term memory, PersonaMem accuracy rises from 48% to 76%. Note: these numbers come from Tencent’s own evaluations.
Recall and retrieval
Retrieval defaults to a hybrid strategy. The system combines BM25 keyword search with vector embeddings, fused using Reciprocal Rank Fusion (RRF). Developers can switch to pure keyword or embedding mode through a config field. The BM25 tokenizer supports both Chinese (jieba) and English.
Default settings trigger an L1 memory extraction every five turns. A user persona is generated every 50 new memories. Recall returns five items by default with a 5-second timeout. On timeout, the system skips injection rather than blocking the conversation.
Installation and developer surface
The OpenClaw integration ships as a single npm package: @tencentdb-agent-memory/memory-tencentdb. The project requires Node.js 22.16 or higher. Enabling it takes one config flag. The plugin then handles conversation capture, memory extraction, scene aggregation, persona generation, and recall.
For Hermes, a Docker image bundles the agent, the plugin, and the TDAI Memory Gateway. The default model is Tencent Cloud’s DeepSeek-V3.2. Any OpenAI-compatible endpoint works through the MODEL_PROVIDER=custom flag.
Two tools are exposed to agents during a session: tdai_memory_search and tdai_conversation_search. Both return references with node_id and result_ref fields for traceback. A Tencent Cloud Vector Database (TCVDB) backend is also available as an alternative to local SQLite.
Marktechpost’s Visual Explainer
body{margin:0;padding:24px;background:#f5f5f5;font-family:-apple-system,BlinkMacSystemFont,”Segoe UI”,Helvetica,Arial,sans-serif}
.preview-wrap{max-width:900px;margin:0 auto}
.preview-header{padding:14px 18px;background:#ffffff;border:1px solid #e5e5e5;border-radius:8px;margin:0 0 18px 0;color:#666;font-size:13px}
#tdai-guide-mtp{background:#000000!important;color:#ffffff!important;font-family:-apple-system,BlinkMacSystemFont,”Segoe UI”,Helvetica,Arial,sans-serif!important;border:1px solid #1f1f1f!important;border-radius:14px!important;padding:0!important;margin:28px 0!important;overflow:hidden!important;position:relative!important;line-height:1.55!important;-webkit-font-smoothing:antialiased!important}
#tdai-guide-mtp *{box-sizing:border-box!important}
#tdai-guide-mtp hr,#tdai-guide-mtp p:empty,#tdai-guide-mtp del,#tdai-guide-mtp s{display:none!important}
#tdai-guide-mtp .tg-step-line{height:1px!important;background:#1f1f1f!important;border:0!important;margin:0!important;display:block!important}
#tdai-guide-mtp .tg-header{padding:28px 32px 22px 32px!important;border-bottom:1px solid #1f1f1f!important;background:#000000!important}
#tdai-guide-mtp .tg-eyebrow{font-size:11px!important;letter-spacing:2px!important;text-transform:uppercase!important;color:#888888!important;margin:0 0 10px 0!important;font-weight:600!important}
#tdai-guide-mtp .tg-title{font-size:26px!important;font-weight:700!important;color:#ffffff!important;margin:0!important;letter-spacing:-0.5px!important;line-height:1.25!important}
#tdai-guide-mtp .tg-subtitle{font-size:14px!important;color:#a0a0a0!important;margin:8px 0 0 0!important;font-weight:400!important}
#tdai-guide-mtp .tg-stage{position:relative!important;background:#000000!important;min-height:520px!important;padding:0!important}
#tdai-guide-mtp .tg-slides{position:relative!important;width:100%!important}
#tdai-guide-mtp .tg-slide{display:none!important;padding:32px 32px 24px 32px!important;animation:tg-fade 0.35s ease!important}
#tdai-guide-mtp .tg-slide.active{display:block!important}
@keyframes tg-fade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
#tdai-guide-mtp .tg-slide-num{font-size:11px!important;color:#666666!important;letter-spacing:2px!important;margin:0 0 14px 0!important;font-weight:600!important}
#tdai-guide-mtp .tg-slide-title{font-size:22px!important;font-weight:700!important;color:#ffffff!important;margin:0 0 8px 0!important;letter-spacing:-0.3px!important;line-height:1.3!important}
#tdai-guide-mtp .tg-slide-lead{font-size:14px!important;color:#a0a0a0!important;margin:0 0 22px 0!important;line-height:1.6!important}
#tdai-guide-mtp .tg-section{margin:0 0 18px 0!important}
#tdai-guide-mtp .tg-section h4{font-size:12px!important;letter-spacing:1.5px!important;text-transform:uppercase!important;color:#888888!important;margin:0 0 10px 0!important;font-weight:600!important}
#tdai-guide-mtp p{font-size:14px!important;color:#e0e0e0!important;margin:0 0 12px 0!important;line-height:1.6!important}
#tdai-guide-mtp ul{margin:0 0 14px 0!important;padding:0 0 0 18px!important;list-style:none!important}
#tdai-guide-mtp ul li{font-size:14px!important;color:#e0e0e0!important;margin:0 0 8px 0!important;line-height:1.55!important;position:relative!important;padding-left:14px!important}
#tdai-guide-mtp ul li::before{content:”›”!important;position:absolute!important;left:-4px!important;top:0!important;color:#ffffff!important;font-weight:700!important}
#tdai-guide-mtp code{background:#111111!important;color:#ffffff!important;padding:2px 6px!important;border-radius:4px!important;font-family:”SFMono-Regular”,Consolas,”Liberation Mono”,Menlo,monospace!important;font-size:12.5px!important;border:1px solid #1f1f1f!important}
#tdai-guide-mtp pre{background:#0a0a0a!important;color:#ffffff!important;padding:16px 18px!important;border-radius:8px!important;border:1px solid #1f1f1f!important;overflow-x:auto!important;margin:0 0 14px 0!important;font-family:”SFMono-Regular”,Consolas,”Liberation Mono”,Menlo,monospace!important;font-size:12.5px!important;line-height:1.6!important}
#tdai-guide-mtp pre code{background:transparent!important;border:0!important;padding:0!important;color:#ffffff!important;font-size:12.5px!important}
#tdai-guide-mtp .tg-comment{color:#666666!important}
#tdai-guide-mtp .tg-pyramid{display:flex!important;flex-direction:column!important;align-items:center!important;gap:6px!important;margin:8px 0 18px 0!important}
#tdai-guide-mtp .tg-layer{border:1px solid #2a2a2a!important;background:#0a0a0a!important;padding:12px 18px!important;border-radius:6px!important;color:#ffffff!important;font-size:13px!important;text-align:center!important;display:flex!important;flex-direction:column!important;gap:2px!important}
#tdai-guide-mtp .tg-layer-l3{width:55%!important;background:#1a1a1a!important;border-color:#3a3a3a!important}
#tdai-guide-mtp .tg-layer-l2{width:70%!important;background:#141414!important;border-color:#303030!important}
#tdai-guide-mtp .tg-layer-l1{width:85%!important;background:#0d0d0d!important;border-color:#262626!important}
#tdai-guide-mtp .tg-layer-l0{width:100%!important;background:#0a0a0a!important;border-color:#222222!important}
#tdai-guide-mtp .tg-layer-name{font-weight:700!important;font-size:13px!important;color:#ffffff!important;letter-spacing:0.3px!important}
#tdai-guide-mtp .tg-layer-desc{font-size:11.5px!important;color:#888888!important}
#tdai-guide-mtp .tg-table-wrap{overflow-x:auto!important;margin:0 0 14px 0!important;border:1px solid #1f1f1f!important;border-radius:8px!important}
#tdai-guide-mtp table{width:100%!important;border-collapse:collapse!important;font-size:12.5px!important;color:#ffffff!important;background:#000000!important}
#tdai-guide-mtp table th,#tdai-guide-mtp table td{padding:10px 12px!important;text-align:left!important;border-bottom:1px solid #1f1f1f!important;border-right:1px solid #1f1f1f!important;color:#e0e0e0!important}
#tdai-guide-mtp table th{background:#0a0a0a!important;color:#ffffff!important;font-weight:600!important;font-size:11.5px!important;letter-spacing:0.5px!important;text-transform:uppercase!important}
#tdai-guide-mtp table tr:last-child td{border-bottom:0!important}
#tdai-guide-mtp table th:last-child,#tdai-guide-mtp table td:last-child{border-right:0!important}
#tdai-guide-mtp .tg-grid-2{display:grid!important;grid-template-columns:1fr 1fr!important;gap:14px!important;margin:0 0 14px 0!important}
#tdai-guide-mtp .tg-card{border:1px solid #1f1f1f!important;background:#0a0a0a!important;border-radius:8px!important;padding:16px 18px!important}
#tdai-guide-mtp .tg-card h5{font-size:12px!important;letter-spacing:1px!important;text-transform:uppercase!important;color:#888888!important;margin:0 0 8px 0!important;font-weight:600!important}
#tdai-guide-mtp .tg-card p{font-size:13px!important;color:#e0e0e0!important;margin:0!important}
#tdai-guide-mtp .tg-controls{display:flex!important;align-items:center!important;justify-content:space-between!important;padding:18px 32px!important;border-top:1px solid #1f1f1f!important;background:#000000!important}
#tdai-guide-mtp .tg-dots{display:flex!important;gap:8px!important;align-items:center!important}
#tdai-guide-mtp .tg-dot{width:7px!important;height:7px!important;border-radius:50%!important;background:#2a2a2a!important;cursor:pointer!important;border:0!important;padding:0!important;transition:background 0.2s ease!important}
#tdai-guide-mtp .tg-dot.active{background:#ffffff!important}
#tdai-guide-mtp .tg-nav{display:flex!important;gap:10px!important;align-items:center!important}
#tdai-guide-mtp .tg-btn{background:#0a0a0a!important;color:#ffffff!important;border:1px solid #2a2a2a!important;width:38px!important;height:38px!important;border-radius:50%!important;cursor:pointer!important;display:flex!important;align-items:center!important;justify-content:center!important;font-size:18px!important;font-weight:400!important;line-height:1!important;padding:0!important;transition:all 0.2s ease!important;font-family:inherit!important}
#tdai-guide-mtp .tg-btn:hover{background:#ffffff!important;color:#000000!important;border-color:#ffffff!important}
#tdai-guide-mtp .tg-btn:disabled{opacity:0.3!important;cursor:not-allowed!important;background:#0a0a0a!important;color:#ffffff!important;border-color:#2a2a2a!important}
#tdai-guide-mtp .tg-counter{font-size:12px!important;color:#666666!important;letter-spacing:0.5px!important;min-width:40px!important;text-align:center!important}
#tdai-guide-mtp .tg-tagline{padding:18px 32px 22px 32px!important;border-top:1px solid #1f1f1f!important;background:#000000!important;text-align:center!important}
#tdai-guide-mtp .tg-tagline-text{font-size:11px!important;color:#666666!important;letter-spacing:1.5px!important;text-transform:uppercase!important;margin:0!important;font-weight:500!important}
#tdai-guide-mtp .tg-tagline-text strong{color:#ffffff!important;font-weight:700!important;letter-spacing:2px!important}
#tdai-guide-mtp .tg-callout{border-left:2px solid #ffffff!important;background:#0a0a0a!important;padding:12px 16px!important;border-radius:0 6px 6px 0!important;margin:0 0 14px 0!important;font-size:13px!important;color:#e0e0e0!important}
@media (max-width:640px){
#tdai-guide-mtp{margin:16px 0!important;border-radius:10px!important}
#tdai-guide-mtp .tg-header{padding:20px 18px 16px 18px!important}
#tdai-guide-mtp .tg-title{font-size:20px!important}
#tdai-guide-mtp .tg-subtitle{font-size:13px!important}
#tdai-guide-mtp .tg-stage{min-height:auto!important}
#tdai-guide-mtp .tg-slide{padding:22px 18px 18px 18px!important}
#tdai-guide-mtp .tg-slide-title{font-size:18px!important}
#tdai-guide-mtp .tg-slide-lead{font-size:13px!important}
#tdai-guide-mtp p,#tdai-guide-mtp ul li{font-size:13px!important}
#tdai-guide-mtp pre,#tdai-guide-mtp pre code{font-size:11.5px!important;padding:12px 14px!important}
#tdai-guide-mtp .tg-grid-2{grid-template-columns:1fr!important}
#tdai-guide-mtp .tg-controls{padding:14px 18px!important}
#tdai-guide-mtp .tg-btn{width:34px!important;height:34px!important;font-size:16px!important}
#tdai-guide-mtp .tg-tagline{padding:14px 18px 18px 18px!important}
#tdai-guide-mtp .tg-tagline-text{font-size:10px!important;letter-spacing:1.2px!important}
#tdai-guide-mtp .tg-layer-l3{width:75%!important}
#tdai-guide-mtp .tg-layer-l2{width:85%!important}
#tdai-guide-mtp .tg-layer-l1{width:95%!important}
#tdai-guide-mtp table th,#tdai-guide-mtp table td{padding:8px 10px!important;font-size:11.5px!important}
}
Open Source / Tencent
TencentDB Agent Memory
A quick-start guide to fully local, 4-tier long-term memory for AI agents.
01 / 10
Curated by MARKTECHPOST · AI Research, Engineered for Builders
(function(){
var root = document.getElementById(‘tdai-guide-mtp’);
if(!root) return;
var slides = root.querySelectorAll(‘.tg-slide’);
var prev = root.querySelector(‘#tg-prev-mtp’);
var next = root.querySelector(‘#tg-next-mtp’);
var counter = root.querySelector(‘#tg-counter-mtp’);
var dotsWrap = root.querySelector(‘#tg-dots-mtp’);
var total = slides.length;
var current = 0;
function pad(n){return n<10?'0'+n:''+n;}
for(var i=0;i<total;i++){
var d = document.createElement('button');
d.className = 'tg-dot' + (i===0?' active':'');
d.setAttribute('data-idx', i);
d.setAttribute('aria-label','Go to slide '+(i+1));
dotsWrap.appendChild(d);
}
var dots = dotsWrap.querySelectorAll('.tg-dot');
function show(idx){
if(idx=total) return;
slides[current].classList.remove(‘active’);
dots[current].classList.remove(‘active’);
current = idx;
slides[current].classList.add(‘active’);
dots[current].classList.add(‘active’);
counter.textContent = pad(current+1)+’ / ‘+pad(total);
prev.disabled = (current===0);
next.disabled = (current===total-1);
}
prev.addEventListener(‘click’, function(){ show(current-1); });
next.addEventListener(‘click’, function(){ show(current+1); });
for(var j=0;j<dots.length;j++){
dots[j].addEventListener('click', function(e){
var idx = parseInt(e.currentTarget.getAttribute('data-idx'),10);
show(idx);
});
}
show(0);
})();
Key Takeaways
- TencentDB Agent Memory is Tencent’s open-source (MIT) memory system for AI agents, built on symbolic short-term memory along with a layered long-term memory pipeline with zero external API dependencies.
- Long-term memory is structured as a 4-tier semantic pyramid (L0 Conversation → L1 Atom → L2 Scenario → L3 Persona), with drill-down via
node_idandresult_refinstead of flat vector recall. - Short-term memory offloads verbose tool logs to
refs/*.mdand keeps only a compact Mermaid task canvas in context, cutting token usage while preserving full traceability. - Reported gains when integrated with OpenClaw: WideSearch pass rate 33% → 50% with a 61.38% token reduction, SWE-bench 58.4% → 64.2%, AA-LCR 44.0% → 47.5%, and PersonaMem accuracy 48% → 76%.
- Ships as a single npm plugin for OpenClaw and a Docker image for Hermes, with local SQLite + sqlite-vec by default, hybrid BM25 + vector + RRF retrieval, and an optional Tencent Cloud Vector Database (TCVDB) backend.
Check out the Repo. Also, feel free to follow us on Twitter and don’t forget to join our 150k+ ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well.
Need to partner with us for promoting your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar etc.? Connect with us
The post Tencent Open-Sources TencentDB Agent Memory: A 4-Tier Local Memory Pipeline for AI Agents appeared first on MarkTechPost.
This article was originally published on MarkTechPost (AI research simplified). Click below to read the complete article.