|

Tencent Open-Sources TencentDB Agent Memory: A 4-Tier Local Memory Pipeline for AI Agents

Tencent has launched TencentDB Agent Memory, an open-source reminiscence system for AI brokers. The challenge ships below the MIT license. It targets an issue acquainted to anybody transport long-horizon brokers: context bloat and recall failure.

It is symbolic short-term reminiscence together with layered long-term reminiscence. It integrates with OpenClaw as a plugin and with the Hermes Agent by a Gateway adapter. The default backend is native SQLite with the sqlite-vec extension, so no exterior API is required.

Why agent reminiscence is tough

Most present reminiscence stacks shred knowledge into fragments and dump them right into a flat vector retailer. Recall then turns into a blind similarity search throughout disconnected fragments, with no macro-level steering. The structure rests on two pillars: reminiscence layering and symbolic reminiscence.

A 4-tier semantic pyramid

For long-term personalization, TencentDB Agent Memory builds a four-level pyramid as a substitute of a flat log. The layers are L0 Conversation, L1 Atom, L2 Scenario, and L3 Persona. These correspond to uncooked dialogue, atomic info, scene blocks, and a consumer profile.

The Persona layer carries day-to-day consumer preferences and is queried first. The system drills right down to Atoms or uncooked Conversations solely when finer element is required. Lower layers protect proof; higher layers protect construction.

Storage is heterogeneous. Facts, logs, and traces are continued in databases for full-text retrieval. Personas, scenes, and canvases are saved as human-readable Markdown recordsdata. Layered reminiscence artifacts reside below ~/.openclaw/memory-tdai/.

Symbolic short-term reminiscence by way of Mermaid

Long-running agent duties eat tokens by verbose software logs, search outcomes, code, and error traces. TencentDB Agent Memory addresses this by context offloading mixed with symbolic reminiscence.

Full software logs are offloaded to exterior recordsdata below refs/*.md. State transitions are encoded in Mermaid syntax inside a light-weight activity canvas. The agent causes over the image graph in its context window.

When it wants the uncooked textual content, it greps for a node_id and retrieves the corresponding file. The Tencent dev workforce describes this as a deterministic drill-down from top-layer image to mid-layer index to bottom-layer uncooked textual content.

Benchmark numbers

Results are measured over steady long-horizon periods, not remoted turns. SWE-bench, for instance, runs 50 consecutive duties per session to simulate context-accumulation strain.

On BroadSearch, integrating the plugin with OpenClaw raises cross price from 33% to 50%, a 51.52% relative enchancment. Token utilization drops from 221.31M to 85.64M, a 61.38% discount.

On SWE-bench, success climbs from 58.4% to 64.2% whereas tokens fall from 3474.1M to 2375.4M, a 33.09% discount. On AA-LCR, the success price strikes from 44.0% to 47.5%. Tokens drop from 112.0M to 77.3M, a 30.98% discount.

For long-term reminiscence, PersonaMem accuracy rises from 48% to 76%. Note: these numbers come from Tencent’s personal evaluations.

Recall and retrieval

Retrieval defaults to a hybrid technique. The system combines BM25 key phrase search with vector embeddings, fused utilizing Reciprocal Rank Fusion (RRF). Developers can swap to pure key phrase or embedding mode by a config subject. The BM25 tokenizer helps each Chinese (jieba) and English.

Default settings set off an L1 reminiscence extraction each 5 turns. A consumer persona is generated each 50 new reminiscences. Recall returns 5 objects by default with a 5-second timeout. On timeout, the system skips injection quite than blocking the dialog.

Installation and developer floor

The OpenClaw integration ships as a single npm package deal: @tencentdb-agent-memory/memory-tencentdb. The challenge requires Node.js 22.16 or increased. Enabling it takes one config flag. The plugin then handles dialog seize, reminiscence extraction, scene aggregation, persona era, and recall.

For Hermes, a Docker picture bundles the agent, the plugin, and the TDAI Memory Gateway. The default mannequin is Tencent Cloud’s DeepSeek-V3.2. Any OpenAI-compatible endpoint works by the MODEL_PROVIDER=customized flag.

Two instruments are uncovered to brokers throughout 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 can also be obtainable as a substitute for native SQLite.

Marktechpost’s Visual Explainer



TencentDB Agent Memory — Preview

Preview — that is how the embed will look inside your WordPress put up.

Open Source  /  Tencent

TencentDB Agent Memory

A quick-start information to totally native, 4-tier long-term reminiscence for AI brokers.

01  /  OVERVIEW

What is TencentDB Agent Memory?

An MIT-licensed reminiscence system for AI brokers that mixes symbolic short-term reminiscence with a 4-tier long-term reminiscence pipeline. Runs totally native with zero exterior API dependencies.

Short-term reminiscence

Offloads verbose software logs to recordsdata and retains a compact Mermaid activity canvas in context.

Long-term reminiscence

Distills conversations right into a 4-tier semantic pyramid: L0 → L1 → L2 → L3.

Local backend

Defaults to SQLite + sqlite-vec. Tencent Cloud Vector Database (TCVDB) is non-obligatory.

Integrations

Ships as an OpenClaw plugin and a Hermes Agent Docker picture.

02  /  ARCHITECTURE

The 4-Tier Semantic Pyramid

Long-term reminiscence is layered, not flat. Upper layers carry construction; decrease layers protect proof.

L3 · PersonaUser profile (persona.md)
L2 · ScenarioScene blocks (Markdown)
L1 · AtomAtomic info (JSONL)
L0 · ConversationRaw dialogue
Drill-down path: Persona → Scenario → Atom → Conversation. References use node_id and result_ref for deterministic traceback.

03  /  SYMBOLIC SHORT-TERM

Mermaid activity canvas + context offloading

Verbose intermediate logs are the biggest token customers in lengthy duties. The plugin offloads them to disk and retains a high-density image graph in context.

How it really works

  • Full software logs are offloaded to refs/*.md below the info listing.
  • State transitions are encoded in Mermaid syntax inside a light-weight activity canvas.
  • The agent causes over the image graph, then greps a node_id to drag uncooked textual content.
Storage path on disk: ~/.openclaw/memory-tdai/. All artifacts are human-readable for white-box debugging.

04  /  INSTALL

Install the OpenClaw plugin

Requires Node.js 22.16 or increased and an OpenClaw set up.

# Install the npm package deal as an OpenClaw plugin
openclaw plugins set up @tencentdb-agent-memory/memory-tencentdb
openclaw gateway restart

Zero-config allow

Add the next to ~/.openclaw/openclaw.json to show it on with default SQLite + sqlite-vec.

{
  "memory-tencentdb": {
    "enabled": true
  }
}

05  /  CONFIGURATION

Daily-tuning parameters

Every subject has a smart default. The commonest knobs are listed beneath.

Field Default Description
storeBackend sqlite Storage backend
recall.technique hybrid key phrase / embedding / hybrid (RRF)
recall.maxResults 5 Items returned per recall
recall.timeoutMs 5000 Skip injection on timeout
pipeline.everyNConversations 5 L1 extraction each N turns
persona.set offEveryN 50 Generate persona each N reminiscences
offload.enabled false Short-term compression toggle

06  /  SHORT-TERM COMPRESSION

Enable Mermaid offloading (v0.3.4+)

Three steps to activate context offload for long-horizon duties.

Step 1 · Enable offload in plugin config

{
  "memory-tencentdb": {
    "config": {
      "offload": { "enabled": true }
    }
  }
}

Step 2 · Register the slot so OpenClaw routes offload requests

{
  "plugins": {
    "slots": {
      "contextEngine": "openclaw-context-offload"
    }
  }
}

Step 3 · Apply the runtime patch (as soon as per OpenClaw set up)

bash scripts/openclaw-after-tool-call-messages.patch.sh

07  /  HERMES DOCKER

Run memory-enabled Hermes in a single container

A single Docker picture bundles Hermes Agent, the memory_tencentdb plugin, and the TDAI Memory Gateway.

# Build the picture
docker construct -f Dockerfile.hermes -t hermes-memory .

# Run the container (default mannequin: DeepSeek-V3.2 on Tencent Cloud LKE)
docker run -d 
  --name hermes-memory 
  --restart unless-stopped 
  -p 8420:8420 
  -e MODEL_API_KEY="your-api-key" 
  -e MODEL_BASE_URL="https://api.lkeap.cloud.tencent.com/v1" 
  -e MODEL_NAME="deepseek-v3.2" 
  -e MODEL_PROVIDER="customized" 
  -v hermes_data:/decide/knowledge 
  hermes-memory

# Health verify
curl http://localhost:8420/well being
Any OpenAI-compatible endpoint works by MODEL_PROVIDER=customized. Memory knowledge persists within the hermes_data quantity.

08  /  AGENT TOOLS & RECALL

What the agent sees

Two instruments are uncovered to the agent throughout a session. Recall makes use of BM25 + vector + RRF fusion by default.

tdai_memory_search

Search throughout L1 Atoms, L2 Scenarios, and L3 Persona.

tdai_conversation_search

Search uncooked L0 Conversation historical past.

Retrieval defaults

  • Hybrid technique: BM25 key phrase + vector embedding, fused by way of Reciprocal Rank Fusion.
  • BM25 tokenizer helps Chinese (jieba) and English.
  • Returns 5 objects per recall; 5000 ms timeout; on timeout it skips injection.
  • References embrace node_id and result_ref for traceback.

09  /  BENCHMARKS

Reported beneficial properties with OpenClaw

Measured over steady long-horizon periods, not remoted turns. SWE-bench runs 50 consecutive duties per session.

Benchmark Baseline With Plugin Δ Pass Δ Tokens
BroadSearch 33% 50% +51.52% −61.38%
SWE-bench 58.4% 64.2% +9.93% −33.09%
AA-LCR 44.0% 47.5% +7.95% −30.98%
PersonaMem 48% 76% +59%
Numbers come from Tencent’s personal evaluations and replicate the mixing with OpenClaw.

10  /  RESOURCES

Where to go subsequent

Documentation, supply code, and group channels.

Source code

github.com/Tencent/TencentDB-Agent-Memory

npm package deal

@tencentdb-agent-memory/memory-tencentdb

License

MIT

Roadmap

Portable reminiscence, automated Skill era, visible debugging dashboard.


01 / 10

Curated by MARKTECHPOST  ·  AI Research, Engineered for Builders

Key Takeaways

  • TencentDB Agent Memory is Tencent's open-source (MIT) reminiscence system for AI brokers, constructed on symbolic short-term reminiscence together with a layered long-term reminiscence pipeline with zero exterior API dependencies.
  • Long-term reminiscence is structured as a 4-tier semantic pyramid (L0 Conversation → L1 Atom → L2 Scenario → L3 Persona), with drill-down by way of node_id and result_ref as a substitute of flat vector recall.
  • Short-term reminiscence offloads verbose software logs to refs/*.md and retains solely a compact Mermaid activity canvas in context, slicing token utilization whereas preserving full traceability.
  • Reported beneficial properties when built-in with OpenClaw: BroadSearch cross price 33% → 50% with a 61.38% token discount, 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 picture for Hermes, with native SQLite + sqlite-vec by default, hybrid BM25 + vector + RRF retrieval, and an non-obligatory Tencent Cloud Vector Database (TCVDB) backend.


Check out the RepoAlso, be at liberty to comply with us on Twitter and don’t overlook to affix 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 associate with us for selling your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar and so on.? Connect with us

The put up Tencent Open-Sources TencentDB Agent Memory: A 4-Tier Local Memory Pipeline for AI Agents appeared first on MarkTechPost.

Similar Posts