跪拜 Guibai
← All articles
GitHub · Tencent

TencentDB Agent Memory Turns Chat Histories Into Governable Team Assets

By dong_junshuai ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Agent memory products usually stop at vector search over chat logs. This system instead treats agent experience as versioned, access-controlled, role-assembled assets—changing the boundary from "what can the model recall" to "what should this specific agent be allowed to know." The 14k-star traction in four months signals real demand for memory architectures that go beyond chunk-and-embed, but the missing tests and Beta label mean production adoption still requires its own validation.

Summary

Instead of just chunking conversations for vector search, TencentDB Agent Memory decomposes agent experience into four governed asset classes. Chat Memory captures facts, preferences, and decisions refined through an L0-to-L3 pipeline. Skills extract repeatable workflows with versioning and access control. LLM-Wiki restructures documents into linked, deterministic Markdown pages. CodeGraph indexes symbols and call relationships for structural queries, not another RAG layer.

A Memory Proxy sits between the agent client and upstream LLM, injecting the right assets at the right injection points based on team, agent, and task identity. It speaks both Anthropic and OpenAI protocols, with non-fatal hook failures so one broken knowledge source doesn't crash the main request. The pipeline runs on a competing-consumer worker model with distributed locks, dead-letter queues, and configurable backoff.

The repo has pulled 14,327 stars in four months and ships a substantial 176,000-line TypeScript codebase across four services. But the public default branch carries no test files, component versions are misaligned, and the Team Memory feature is still labeled Beta—making it a technically deep early platform rather than a turnkey knowledge appliance.

Takeaways
Four asset types replace raw chunk storage: Chat Memory (L0–L3 refined facts and preferences), Skill (versioned, ACL-gated workflows), LLM-Wiki (deterministically written structured docs), and CodeGraph (symbol and call-relationship index).
Hybrid search runs FTS5 keyword and vector retrieval in parallel, merges results with Reciprocal Rank Fusion, and degrades gracefully when one path is unavailable.
The L0→L3 pipeline separates high-frequency raw dialogue (which can expire) from low-frequency stable Persona profiles meant for long-term injection.
Skills carry visibility labels (private, team, restricted) and bind to specific agents via ACLs, so not every agent loads every rule.
Wiki ingestion uses a two-stage LLM process with path whitelisting, structural file protection, and canonicalization to prevent the model from overwriting critical pages.
CodeGraph provides eight structural query actions—search, explore, callers, callees, impact, node, status, files—wrapping the external @colbymchenry/codegraph package.
The Proxy adapts both Anthropic and OpenAI protocols, injects context at fixed hook points, and treats hook failures as non-fatal to keep the main request alive.
Task scheduling uses Redis Stream Consumer Groups with distributed locks (240s TTL, 30s renewal), dead-letter queues after three retries, and exponential backoff.
The public default branch contains zero test files despite package.json references to Vitest and E2E scripts; regression quality cannot be verified from the repo alone.
Version numbers drift across components: MemoryCore reads 2.0.0-beta.1 while the release tag is v2.0.0, and Knowledge/Proxy packages are still at 0.1.0.
Conclusions

Structuring memory into four governed asset types is a genuine architectural departure from the dominant chunk-and-embed pattern, but it also multiplies the surface area for bugs, consistency problems, and operator confusion.

The decision to make hook failures non-fatal is a pragmatic availability trade-off that shifts the burden onto operators: a green health check can mask silent memory-load failures unless injection logs are actively monitored.

A 176,000-line TypeScript codebase with zero public tests and a shallow default-branch history is a red flag for production adoption, regardless of how impressive the feature list reads.

The shared serial build queue for Wiki and CodeGraph is a bottleneck waiting to surface in any team that indexes a large monorepo while also ingesting documentation.

Version-number drift across components (v2.0.0 release tag vs. 2.0.0-beta.1 in MemoryCore vs. 0.1.0 elsewhere) suggests the release process hasn't caught up with the feature velocity, which complicates dependency pinning and upgrade planning.

Concepts & terms
Reciprocal Rank Fusion (RRF)
A method for merging ranked results from multiple search systems. It scores each document by summing 1/(k + rank) across all result lists, where k is a constant (often 60). This avoids the problem of comparing raw scores from different retrieval engines like keyword search and vector similarity.
L0–L3 Memory Pipeline
A four-tier refinement process: L0 captures raw dialogue and tool calls; L1 extracts atomic facts, preferences, and decisions with deduplication; L2 aggregates these into stable scenario patterns; L3 generates a long-term Persona profile for injection into future agent sessions.
Dead-Letter Queue
A queue that holds messages that could not be processed successfully after a configured number of retries. It prevents a poison message from blocking the entire pipeline and allows operators to inspect and manually recover failed tasks later.
Agent Context Injection Hook
A fixed point in the request lifecycle where the Memory Proxy inserts retrieved assets (memories, skills, wiki pages, code graph results) into the system prompt, tool definitions, or user messages before forwarding the request to the upstream LLM.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗