TencentDB Agent Memory: Share Experience, Not Privacy

Project context shouldn’t need to be re-explained in every session. Documents shouldn’t be re-read from page one. A proven workflow shouldn’t be rediscovered from scratch next time.

This quote from the TencentDB Agent Memory README hits a core pain point in today’s Agent applications: experience can’t be accumulated — every session starts from zero.

This article breaks down the design philosophy behind TencentDB Agent Memory and how it solves this problem.

The Core Problem: Agent Amnesia

flowchart LR
    A["Agent A hits a bug"] --> B["Experience stays in chat"] --> C["Agent B repeats the mistake"] --> D["Team reinvents the wheel"]

Most agents work like this: you spend 20 minutes teaching it project context, it completes the task, and the conversation ends. Next session with a different agent — or even the same one — you start over.

TencentDB Agent Memory’s solution is straightforward: turn experience into reusable assets so the next agent can pick up where you left off.

Design Philosophy: Three Core Judgments

Before diving into technical details, let’s look at three design judgments behind TencentDB Agent Memory. These judgments shaped the entire product:

Judgment 1: Memory Isn’t Flat — It Grows in Layers

Most agent memory solutions store everything flat and recall everything at once. TencentDB chose layering:

flowchart TD
    subgraph "Memory Layers"
        L0["L0 Conversation<br/>Raw dialogue & full context"]
        L1["L1 Atom<br/>Facts, preferences, constraints & events"]
        L2["L2 Scenario<br/>Knowledge blocks organized by project or scene"]
        L3["L3 Persona<br/>Long-term profile, stable patterns & high-level cognition"]
    end

    L0 -->|"Asynchronous refinement"| L1
    L1 -->|"Aggregation"| L2
    L2 -->|"Abstraction"| L3

    L3 -->|"Quick context entry"| Agent
    L2 -->|"Scene recovery"| Agent
    L1 -->|"Precise recall"| Agent
    L0 -->|"Original text verification"| Agent
LayerWhat It StoresPrimary UseRetrieval Strategy
L0 ConversationRaw dialogue & full contextVerify original text, timing, and sourceBM25 exact match
L1 AtomFacts, preferences, constraints & eventsPrecise recall of actionable informationVector search + RRF
L2 ScenarioKnowledge blocks organized by project or sceneQuickly restore a work contextSemantic search
L3 PersonaLong-term profile, stable patterns & high-level cognitionGet agents into user/team contextDirect injection

Why this design?

Context windows are a scarce resource. Injecting L0 full conversation every time would explode token consumption. But injecting only L3’s highly abstracted profile would lose specific details. Layering allows the system to recall on demand: use L2/L3 for quick context entry in daily use, and fall back to L1/L0 via BM25 + vector search + RRF fusion when specific facts are needed.

This is a precision vs. cost tradeoff: layering adds indexing and retrieval complexity but significantly reduces per-session token consumption.

Judgment 2: Memory Isn’t a Global Prompt — It’s an Agent’s Loadout

flowchart TD
    subgraph "Traditional: Global Injection"
        A1["All Memory"] --> A2["Inject into all Agents"]
    end

    subgraph "TencentDB: Loadout Assembly"
        B1["Memory Asset Pool"] --> B2["Team Filter"]
        B2 --> B3["ACL Filter"]
        B3 --> B4["Relevance Recall"]
        B4 --> B5["Inject into specific Agent"]
    end

Traditional approaches dump all memory into the System Prompt — simple but problematic:

  • Token waste: most memory is irrelevant to the current task
  • Noise interference: irrelevant information can mislead the agent
  • Privacy leaks: no granular control over who sees what

TencentDB’s Loadout mechanism solves these issues:

VisibilitySemanticsUse Case
privateOnly owner can read, team admin excludedPersonal preferences, private decisions
teamTeam members can read, managed by Owner/AdminShared docs, public Skills
restrictedFine-grained via User/Role/Agent ACLSensitive info, role-specific assets
agentTargeted assembly for same-team agentsMemory transfer between agents

This is a product decision: TencentDB chose to make “sharing” an explicit action, not a default. New memories are private by default and require active sharing. This aligns with enterprise data security expectations.

Judgment 3: Knowledge Isn’t Injected by the Ton — It’s Called on Demand

flowchart LR
    subgraph "Traditional RAG"
        A1["Document Chunking"] --> A2["Vector Search"]
        A2 --> A3["Top-K Injection"]
    end

    subgraph "TencentDB Wiki + CodeGraph"
        B1["Structured Index"] --> B2["API Discovery"]
        B2 --> B3["On-Demand Call"]
        B3 --> B4["Precise Read"]
    end

Traditional RAG chops documents into chunks and returns Top-K fragments. The problem: fragments lose document structure and relationships.

TencentDB’s Wiki and CodeGraph use a different strategy:

ComponentIndexing MethodQuery MethodAdvantage
WikiStructured pages + link graph/v3/tools/list to discover, /v3/tools/call to readPreserves document structure, supports link drill-down
CodeGraphSymbols, files, call relationshipscallers / callees queriesSupports impact analysis, not just text matching

This is a technical tradeoff: pre-indexing adds build cost (asynchronous processing required), but queries are more precise with lower token consumption.

Architecture Overview: How the Three Components Work Together

flowchart TD
    subgraph SA["Deployment Architecture"]
        MC["Memory Core<br/>Memory Processing Engine"] --> MH["Memory Hub<br/>Management Panel + API"]
        MH --> P["Proxy<br/>Agent Access Layer"]
    end

    subgraph MA["Memory Assets"]
        CM["Chat Memory"]
        SK["Skill"]
        WK["Wiki"]
        CG["CodeGraph"]
    end

    subgraph AG["Agent Integration"]
        CC["Claude Code"]
        CB["CodeBuddy"]
        OC["OpenClaw"]
        HM["Hermes"]
    end

    MH --> MA
    P --> AG
ComponentResponsibilityKey Capabilities
Memory CoreMemory processing engineDialogue refinement (L0→L3), Wiki generation, CodeGraph indexing
Memory HubManagement panel + APIAsset CRUD, team/permission management, Agent Loadout assembly
ProxyAgent access layerUnified API interface, adapts to multiple agent frameworks

Deployment is a one-click startup of all three components:

git clone https://github.com/Tencent/TencentDB-Agent-Memory.git
cd TencentDB-Agent-Memory/deploy/global-images
cp .env.example .env
$EDITOR .env       # Fill in two sets of LLM params (memory group + proxy group)
./start-all.sh     # One-click start

Four Memory Assets: Deep Dive

Chat Memory: Layered Memory in Practice

Core question: How do you extract structured memory from raw conversations?

flowchart LR
    subgraph "Input"
        A["User dialog<br/>'Don't refactor the old auth module, mobile is still using it'"]
    end

    subgraph "L1 Atom Extraction"
        B["Fact: Old auth module can't be refactored"]
        C["Constraint: Mobile still depends on it"]
        D["Decision: Keep current implementation"]
    end

    subgraph "L2 Scenario Aggregation"
        E["Scenario: Auth module maintenance decision"]
        F["Link: Mobile dependency relationship"]
    end

    subgraph "L3 Persona Abstraction"
        G["Preference: Values backward compatibility"]
        H["Pattern: Conservative refactoring strategy"]
    end

    A --> B & C & D
    B & C & D --> E & F
    E & F --> G & H

Technical details:

  • L0→L1 extraction: LLM identifies facts, preferences, constraints, and events from conversation
  • L1→L2 aggregation: Organizes Atoms into knowledge blocks by topic or scenario
  • L2→L3 abstraction: Distills long-term profiles and stable patterns from multiple Scenarios

Recall strategy:

User question

Semantic analysis → Determine which memory layer is needed

L2/L3 direct injection (fast context entry)

If specific facts are needed

BM25 + Vector Search + RRF fusion → Recall L1/L0

Limit count + Token budget + Timeout control

Inject into Agent context

Why RRF fusion?

Single retrieval strategies have limitations:

  • BM25: Strong exact matching, but can’t understand semantics
  • Vector search: Strong semantic understanding, but may miss exact keywords
  • RRF (Reciprocal Rank Fusion): Combines both rankings, leveraging their complementary strengths

Skill: Not Just a Prompt — an Executable Unit

flowchart TD
    subgraph "Skill Structure"
        A["Version Management"]
        B["Resource Files<br/>Config/Scripts/Templates"]
        C["Trigger Boundary<br/>When to activate"]
        D["Execution Steps<br/>Operation sequence"]
        E["Validation Rules<br/>Post-execution checks"]
    end

    subgraph "Skill Lifecycle"
        F["Agent executes task"] --> G["Skill is distilled"]
        G --> H["Personal Skill is private"]
        H --> I["Review & Share"]
        I --> J["Equip to other agents"]
    end

Skill vs. Prompt:

DimensionPromptSkill
StructurePlain textVersion + resources + steps + validation
ReusabilityOne-shotIterable, rollbackable
ControllabilityNoneTrigger boundaries and validation rules
TraceabilityNoneVersion history and usage records

Real-world example:

# Release Checklist Skill
version: 2.1
resources:
  - checklist.md
  - rollback-script.sh
trigger:
  when: "agent is about to deploy code"
  confidence: 0.9
steps:
  - Read checklist.md
  - Verify each item
  - If issues found, execute rollback
validation:
  - Check all tests pass
  - Check deployment script is executable
  - Check rollback path exists

Wiki + CodeGraph: Structured Knowledge Graph

Wiki’s design inspiration comes from Karpathy’s LLM Wiki: treating documents as knowledge assets incrementally maintained by LLMs, generating compound interest over time.

flowchart TD
    subgraph "Wiki Construction"
        A["Source Documents<br/>PRD/Design Specs/Operations Manuals"] --> B["LLM Processing"]
        B --> C["Structured Pages"]
        C --> D["Link Graph"]
    end

    subgraph "CodeGraph Construction"
        E["Code Repository"] --> F["AST Parsing"]
        F --> G["Symbol Index"]
        G --> H["Call Relationship Graph"]
    end

    subgraph "Agent Query"
        I["/v3/tools/list"] --> J["Discover available assets"]
        J --> K["/v3/tools/call"]
        K --> L["Read specific page/source code"]
    end

Key differences:

Traditional RAGTencentDB Wiki/CodeGraph
Document chunking loses structurePreserves document structure and link relationships
Text matching can’t understand call relationshipsIndexes symbols, call relationships, and impact paths
May return duplicate fragmentsPrecise reads of specific pages or functions
Can’t do impact analysisCan query callers / callees

CodeGraph impact analysis in practice:

Agent wants to modify UserService.login()

Traditional RAG:
  Search "UserService login" → returns relevant code snippets
  Agent doesn't know which places call this method

CodeGraph:
  Query UserService.login()'s callers
  Finds: AuthController, SessionManager, TokenService all depend on it
  Agent knows which modules will be affected by this change

Comparison with Industry Solutions

vs. Mem0

Mem0 is another popular agent memory solution.

DimensionMem0TencentDB Agent Memory
PositioningGeneral memory layerTeam-level memory hub
Memory structureFlat storageLayered (L0-L3)
Team collaborationNo native supportFull Team + ACL
Skill managementNoneVersioned Skill assets
Code understandingNoneCodeGraph call relationships
Deployment complexityLow (single service)Medium (three components)

Core difference: Mem0 suits lightweight memory needs for individuals or small teams; TencentDB is better for enterprise scenarios requiring team collaboration, asset management, and code understanding.

vs. LangGraph Memory

LangGraph provides a Memory module with conversation history management.

DimensionLangGraph MemoryTencentDB Agent Memory
Memory typesConversation historyFour asset types
StorageIn-memory/Redis/PostgresDedicated storage engine
Team collaborationMust build yourselfNative support
Knowledge graphNeeds separate integrationWiki + CodeGraph built-in
Access controlMust build yourselfFour-tier visibility + ACL

Core difference: LangGraph Memory is more flexible (customizable storage backend) but requires more development work; TencentDB is more opinionated and works out of the box.

vs. Zep

Zep is a commercial agent memory platform.

DimensionZepTencentDB Agent Memory
DeploymentSaaS / Self-hostedSelf-hosted (open source)
Memory typesConversation history + entity extractionFour asset types
Team collaborationBasic supportFull Team + ACL
CostUsage-based pricingFree (open source)
Data controlSaaS data in the cloudFull self-control

Core difference: Zep is a commercial product, ready to use but with costs; TencentDB is open source, requires self-hosting but gives full data control.

Potential Issues & Room for Improvement

Current Limitations

IssueImpactPossible Improvement
Memory extraction credibility is questionableFacts/preferences distilled by LLMs may be inaccurate; bad memories get “inherited”Provenance tracing, confidence scoring, human verification
Wiki/CodeGraph async constructionFirst use requires waitingIncremental updates, pre-warming
CodeGraph prioritizes public reposPoor private repo experienceSSH credential support, local indexing
Memory routing requires manual bindingNot enough automationContent-based auto-routing
Limited cross-framework migrationVendor lock-in riskStandardized memory format

Memory Credibility: The Overlooked Risk

This issue deserves its own section.

TencentDB Agent Memory relies on LLMs to distill L1 Atoms (facts, preferences, constraints) from conversations. But LLM distillation is not always trustworthy:

An LLM may misread user intent — turning “don’t refactor for now” into “never touch this”

An LLM may overgeneralize — treating a one-off preference as a universal rule

An LLM may drop critical context — losing important constraints

An LLM may invent memories that never existed — hallucinations

Worse: those incorrect memories can be assembled into other agents, creating “error inheritance.” A preference Agent A misunderstood becomes a fact Agent B executes.

The current project doesn’t appear to provide:

  • Accuracy evaluation for memory extraction
  • Provenance tracing (which conversation did this memory come from?)
  • Conflict detection (what happens when two memories contradict?)
  • Human verification / correction workflows

What this means: TencentDB Agent Memory solves “how experience can be accumulated and shared,” but not fully “whether the accumulated experience is correct.” Users should treat memory assets as less than 100% trustworthy — critical decisions still need human confirmation.

Design Tradeoffs

Layered vs. Flat: Layering adds complexity but reduces query costs. Is this the right tradeoff? It depends on the use case — if agents primarily need fast context entry, layering is worth it; if they frequently query specific facts, layering may add latency.

Pre-indexed vs. On-demand retrieval: Pre-indexing adds build cost but queries are more precise. Is this the right tradeoff? It depends on document/codebase size — small repos benefit from pre-indexing; large repos may need smarter incremental updates.

Private-first vs. Share-first: Defaulting to private is safer but may slow knowledge flow. Is this the right tradeoff? It depends on enterprise security requirements — strict environments need private-first.

When Should You Use It?

The key question isn’t team size — it’s whether you need these capabilities:

Required CapabilityRecommended Approach
Cross-session memory, experience accumulationRAG + simple memory management
Multi-agent memory sharing and isolationTencentDB Agent Memory
Memory asset versioning and reviewTencentDB Agent Memory
Fine-grained access control (ACL)TencentDB Agent Memory
Structured code understanding (call relationships, impact analysis)TencentDB Agent Memory
Document knowledge graph (preserving structure and links)TencentDB Agent Memory

Specific scenarios:

ScenarioRecommended ApproachReason
Personal agent assistantLightweight RAG + local memorySimple, no maintenance
Enterprise agent platform, no cross-agent sharing neededRAG + custom developmentBig companies use RAG too, it depends on needs
Multi-role agent collaboration with memory isolation and sharingTencentDB Agent MemoryNative Team + ACL support
Knowledge-intensive project requiring code impact analysisTencentDB Agent MemoryCodeGraph provides structured indexing
Skill reuse and version management neededTencentDB Agent MemorySkill is a complete executable unit

Summary

TencentDB Agent Memory’s core value:

  1. Experience as assets: Turn conversations, documents, and code into reusable Chat Memory, Skill, Wiki, and CodeGraph
  2. Layered storage: L0→L3 progressive refinement, BM25 + vector + RRF fusion recall, balancing precision and cost
  3. Precise assembly: Fixed Binding + ACL, load memory by role and need, control noise and privacy
  4. Team collaboration: Share experience, not privacy, with version management and asset review

This solution addresses a real pain point: how to let agent teams continuously accumulate experience, instead of starting from zero every time.

But it comes with costs: higher architectural complexity and operational overhead. Whether to use it depends on whether your scenario truly needs team-level memory management.


References

Attribution

Images and data cited in this article come from the official TencentDB Agent Memory README and have been checked against the source.