跪拜 Guibai
← All articles
Agent · TypeScript · Open Source

Tencent's Agent Memory Library Hits GitHub #1 with a Layered Architecture That Cuts Token Costs by 61%

By 苏灿烤鱼 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Agent context management is the bottleneck now that models can execute multi-step tasks. A memory layer that compresses without losing evidence and enforces team-level permissions addresses the gap between single-session demos and multi-Agent, long-running production workloads.

Summary

TencentDB Agent Memory organizes Agent context into four reusable asset types—Chat Memory, Skills, Wiki, and CodeGraph—and layers long-term memory from raw conversation up to persona profiles. Short-term context gets compressed into a Mermaid state diagram, with verbose logs offloaded to external files and traceable via node IDs. A three-tier visibility model (private, team, restricted) and Agent Loadout system let teams bind different assets to different Agents. Official benchmarks on OpenClaw show a 61% token reduction on WideSearch and a 33% drop on SWE-bench, alongside accuracy gains of 51% and 59% on WideSearch and PersonaMem respectively. The project explicitly rejects both indiscriminate history dumping and irreversible lossy summarization. Deployment requires three Docker images and a proxy, and the 13,404-star repository carries only 51 watchers and 503 open issues after four months, suggesting early hype outweighs production adoption so far.

Takeaways
Long-term memory is structured as a four-layer pyramid: L0 raw conversation, L1 atomic facts, L2 scenarios, L3 persona profiles, with daily reads hitting only the top layer.
Short-term context compresses tool outputs into a Mermaid state diagram while archiving full logs externally, keeping context small but traceable via node_id.
Storage is heterogeneous: facts sit in a database for full-text search; profiles live as human-readable Markdown for auditability.
Three visibility levels—private, team, restricted—plus Agent Loadout let different Agents mount different asset sets with different priorities.
Official self-tests on OpenClaw report a 61% token reduction on WideSearch and a 33% reduction on SWE-bench, with success-rate gains of 51% and 10% respectively.
PersonaMem accuracy jumped from 48% to 76% in the same test setup.
The repository gained over 3,000 stars in three days to reach #1 on GitHub Trending, but holds only 51 watchers and 503 open issues.
Deployment requires three Docker images, a proxy, and a patch script to enable short-term compression on the host.
The README claims an MIT license, but GitHub does not recognize it as a standard license.
Conclusions

The star-to-watcher ratio (13,404 to 51) is a red flag for production readiness; it signals bookmarking behavior rather than active integration.

Benchmarks run exclusively on OpenClaw and are self-reported—no third-party reproduction exists yet, so the 61% token savings should be treated as a vendor claim.

503 open issues in four months is high for a project of this scope and suggests integration friction that the star count obscures.

The layered design is genuinely different from flat vector recall, but the engineering cost is steep: three containers, a proxy, and host patching before short-term compression works.

Tencent is positioning this as enterprise infrastructure, not a personal tool—the permission model and cross-framework ambition target an internal Agent middle-platform, not a single developer's workflow.

Concepts & terms
Semantic memory pyramid
A four-tier structure (L0 raw conversation → L1 atomic facts → L2 scenarios → L3 persona profiles) where higher layers abstract and compress lower ones; retrieval reads the top layer first and drills down only when detail is needed.
Symbolic memory
A compression technique that keeps only a lightweight Mermaid state diagram in the Agent's context window while offloading full tool-output logs to external files, using node_id references to trace back to the original evidence.
Agent Loadout
A configuration mechanism that binds specific memory assets (Chat Memory, Skills, Wiki, CodeGraph) and their priorities to individual Agents, enforcing what each Agent can see and use.
From the discussion
Featured comments
echoVic

Done something similar, adding an easily overlooked point: layering solves 'what to store,' but the real difficulty is 'when to trust.' Is the index still trustworthy after a crash and rebuild? Could recall overwrite a current decision with an expired answer? The pitfall I've stepped in: the biggest risk of a memory system isn't forgetting, but remembering the wrong thing and using it with full confidence. Evidence traceability and version invalidation are more important than layering itself.

苏灿烤鱼

Agreed. This is also why the official stance is not to recommend production use yet. It's like there's a lab-validated direction now, but it's not enough to handle the various complexities of a production environment. But since the lab direction has been validated and the hype is so high now, this project still has a chance to be tested in production later!

echoVic

Agreed. The hype validates whether the direction is right, but production tests whether the details are solid enough — I'm focused on just two landing points: whether memory can still be mapped back to the original text after index rebuild (evidence traceability), and how expired facts get identified and down-weighted (version invalidation). If these two points aren't solved, 'remembering the wrong thing' will be more troublesome than 'forgetting' in production.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗