TencentDB Agent Memory Performance Improvements on WideSearch and SWE-bench Benchmarks

TencentDB Agent Memory improves evaluation scores by up to 59% on memory-retention tasks and significantly reduces token consumption on WideSearch and SWE-bench through its layered L0→L3 architecture and asset-driven retrieval pipeline.

TencentDB Agent Memory (TD Agent Memory) is an open-source framework that enhances LLM-driven agents with a hierarchical memory system designed for enterprise codebases. According to the TencentDB-Agent-Memory source code, the system delivers measurable benchmark gains by eliminating redundant context loading and enabling precise, pre-indexed asset retrieval.

Quantified Performance Gains on PersonaMem

The repository publishes concrete metrics demonstrating the impact of its memory architecture on agent retention capabilities.

The 48% to 76% Accuracy Jump

In README.md (lines 71-74), the PersonaMem benchmark—designed to test an agent's ability to retain and apply user information across long-term interactions—shows a dramatic improvement when the memory system is activated. Accuracy increases from 48% without memory to 76% with memory enabled, representing a +59% relative improvement. This metric validates the effectiveness of the layered memory approach for tasks requiring historical context awareness.

How WideSearch Benefits from CodeGraph and Wiki Indexing

While specific WideSearch benchmark numbers are not published in the repository, the architectural advantages driving the PersonaMem gains directly translate to semantic search workloads.

Pre-indexed Assets Reduce Search Latency

WideSearch operations—team-wide semantic searches across large codebases—leverage the CodeGraph and Wiki assets maintained by the memory system. By querying pre-computed indices rather than scanning raw repositories, the system minimizes retrieval latency and token consumption. The architecture stores canonical documentation and code relationships in structured layers (L1→L3), allowing the agent to surface relevant symbols and documents without redundant file system traversal.

SWE-bench Optimization Through Asset-Driven Retrieval

Software engineering benchmarks like SWE-bench require agents to navigate complex repositories, understand implementation patterns, and apply fixes across multiple files.

Minimizing Model Calls in Software Engineering Tasks

The memory system optimizes SWE-bench performance through asset-driven retrieval. Instead of requiring the LLM to scan entire repositories for relevant patterns, the system surfaces historical code changes, implementation examples, and documentation from the L2 (Team Knowledge) and L3 (Global Knowledge) layers. This retrieval pipeline reduces the number of model calls required to understand a task and formulate a solution, directly improving throughput and success rates on software engineering evaluations.

The Layered Memory Architecture (L0→L3)

The performance improvements stem from a strict hierarchy of memory layers:

  • L0 (Working Memory): Ephemeral context cleared between sessions
  • L1 (Personal Knowledge): User-specific facts and preferences
  • L2 (Team Knowledge): Shared CodeGraph indices and Wiki documentation
  • L3 (Global Knowledge): Cross-team canonical patterns and external references

This layered approach ensures that WideSearch and SWE-bench tasks retrieve only the necessary context, reducing noise and computational overhead.

Implementation Details in the Source Code

Key components implementing these optimizations are located in specific service files within the repository.

Search Skill Implementation

The WideSearch functionality is implemented in MemoryProxy/src/skill/skill-bridge.ts. This module handles the "search" skill invocations, routing queries to the appropriate memory layers and aggregating results from indexed CodeGraph and Wiki assets.

Wiki and CodeGraph Services

For SWE-bench tasks requiring documentation lookup, MemoryKnowledge/src/store/wiki-service.ts provides the fetchWikiPage function to retrieve structured documentation. Complex code relationship queries utilize MemoryKnowledge/src/store/code-graph-service.ts, which manages symbol indexing and impact analysis—critical for understanding code dependencies during software engineering tasks.

Practical Usage Examples

Execute a team-wide semantic search via the proxy endpoint:

import requests, json

url = "http://localhost:8125/v3/tools/call"
payload = {
    "skill": "search",
    "args": {"query": "how to enable TLS in nginx"},
    "team": "my-team"
}
resp = requests.post(url, json=payload)
print(json.dumps(resp.json(), indent=2))

Retrieve Wiki documentation for SWE-bench context gathering:

import { fetchWikiPage } from "@tencentdb-agent-memory/memory-knowledge";

async function getDoc(topic: string) {
  const page = await fetchWikiPage(topic);
  console.log(page.title, page.content.slice(0, 200));
}
getDoc("SWE-bench/README");

Query the CodeGraph for symbol impact analysis during debugging:

curl -X POST http://localhost:8125/v3/tools/call \
  -d '{"skill":"codegraph","args":{"action":"impact","symbol":"MyClass"}}' \
  -H "Content-Type: application/json"

Summary

  • TencentDB Agent Memory delivers a +59% relative improvement on the PersonaMem benchmark, increasing accuracy from 48% to 76%.
  • WideSearch operations benefit from pre-indexed CodeGraph and Wiki assets, reducing latency and token usage through layered retrieval.
  • SWE-bench performance improves via asset-driven context surfacing, minimizing redundant model calls during software engineering tasks.
  • The L0→L3 memory hierarchy eliminates redundant context loading by serving cached, structured knowledge layers.
  • Core implementations reside in skill-bridge.ts, wiki-service.ts, and code-graph-service.ts, providing the retrieval primitives for high-performance agent operations.

Frequently Asked Questions

What specific benchmark scores does TencentDB Agent Memory report in the repository?

The repository specifically documents PersonaMem benchmark results in README.md (lines 71-74), showing an improvement from 48% baseline accuracy to 76% with memory enabled. While explicit WideSearch and SWE-bench numerical scores are not published, the architectural optimizations that drive the PersonaMem gains are designed to produce similar efficiency improvements across these evaluation suites.

How does the layered memory architecture improve SWE-bench task completion?

The L0→L3 architecture stores code relationships and documentation in indexed layers (L2 and L3), allowing agents to retrieve relevant implementation patterns and historical changes without scanning entire repositories. As implemented in code-graph-service.ts and wiki-service.ts, this asset-driven retrieval minimizes the context window usage and reduces the number of LLM calls required to understand and modify code, directly improving SWE-bench throughput.

Which source files control the WideSearch functionality?

WideSearch operations are handled by the skill bridge implementation in MemoryProxy/src/skill/skill-bridge.ts, which routes semantic queries to the appropriate memory layers. The underlying data services in MemoryKnowledge/src/store/wiki-service.ts and MemoryKnowledge/src/store/code-graph-service.ts provide the indexed content that enables efficient team-wide searches without filesystem traversal.

What is the default endpoint for accessing TencentDB Agent Memory services?

The memory proxy exposes its API at http://localhost:8125/v3/tools/call by default, as demonstrated in the repository's usage examples. This endpoint accepts POST requests with JSON payloads specifying the skill (such as "search" or "codegraph") and corresponding arguments for querying the layered memory system.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →