TencentDB Agent Memory: Enhancing AI Agents with Layered Long-Term Memory
This repository profile is provided by osrepos.com, an open source repository discovery platform.

Summary
TencentDB Agent Memory provides AI agents with fully local, long-term memory through a 4-tier progressive pipeline, eliminating external API dependencies. It significantly reduces token usage and improves task success rates by employing symbolic short-term memory and layered long-term memory. This innovative approach helps agents learn workflows and retain context more effectively.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
TencentDB Agent Memory is an advanced solution designed to equip AI agents with robust, fully local long-term memory capabilities. It introduces a novel 4-tier progressive pipeline, ensuring zero external API dependencies for memory management. This project addresses critical challenges in AI agent performance, particularly in reducing token consumption and enhancing task success rates over long-horizon sessions. By moving beyond flat storage, TencentDB Agent Memory enables agents to remember, learn, and reason more effectively.
Installation
The project supports integration with OpenClaw and Hermes agents.
For OpenClaw:
Install the plugin:
openclaw plugins install @tencentdb-agent-memory/memory-tencentdb openclaw gateway restartEnable zero-config:
Add the following to~/.openclaw/openclaw.json:// ~/.openclaw/openclaw.json { "memory-tencentdb": { "enabled": true } }Enable short-term compression (optional, requires version ? 0.3.4):
First, update~/.openclaw/openclaw.jsonto enable offloading:{ "memory-tencentdb": { "config": { "offload": { "enabled": true } } } }Then, register the slot in your plugin config:
{ "plugins": { "slots": { "contextEngine": "memory-tencentdb" } } }Finally, apply the runtime patch:
bash scripts/openclaw-after-tool-call-messages.patch.sh
For Hermes:
There are two main ways to integrate with Hermes:
Docker (greenfield, requires version ? 0.3.4):
Navigate to thedocker/opensourcedirectory in the cloned repository.
Build the Docker image:docker build -f Dockerfile.hermes -t hermes-memory .Run the container, replacing
your-api-keywith your actual key: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="custom" \ -v hermes_data:/opt/data \ hermes-memoryVerify the Gateway:
curl http://localhost:8420/healthEnter the Hermes interactive shell:
docker exec -it hermes-memory hermesAttach to Existing Hermes (No Docker):
Download the plugin package:
mkdir -p ~/.memory-tencentdb TEMP_DIR=$(mktemp -d) cd "$TEMP_DIR" npm init -y --silent npm install @tencentdb-agent-memory/memory-tencentdb@latest --omit=dev cp -r node_modules/@tencentdb-agent-memory/memory-tencentdb \ ~/.memory-tencentdb/tdai-memory-openclaw-plugin rm -rf "$TEMP_DIR"Install Gateway dependencies:
cd ~/.memory-tencentdb/tdai-memory-openclaw-plugin npm install --omit=dev npm install tsxLink to the Hermes plugin directory:
rm -rf ~/.hermes/hermes-agent/plugins/memory/memory_tencentdb ln -sf ~/.memory-tencentdb/tdai-memory-openclaw-plugin/hermes-plugin/memory/memory_tencentdb \ ~/.hermes/hermes-agent/plugins/memory/memory_tencentdbDeclare the provider in
~/.hermes/config.yaml:memory: provider: memory_tencentdbConfigure Gateway environment variables in
~/.hermes/.env:MEMORY_TENCENTDB_GATEWAY_CMD="sh -c 'cd ~/.memory-tencentdb/tdai-memory-openclaw-plugin && exec npx tsx src/gateway/server.ts'" MEMORY_TENCENTDB_GATEWAY_HOST="127.0.0.1" MEMORY_TENCENTDB_GATEWAY_PORT="8420" TDAI_LLM_API_KEY="sk-your-api-key-here" TDAI_LLM_BASE_URL="https://api.openai.com/v1" TDAI_LLM_MODEL="gpt-4o"Start the Gateway (auto-discovery or manual run):
cd ~/.memory-tencentdb/tdai-memory-openclaw-plugin npx tsx src/gateway/server.tsVerify:
curl http://127.0.0.1:8420/health
Examples
The project's README includes video demonstrations showcasing TencentDB Agent Memory in action with both OpenClaw and Hermes. These demos visually illustrate how the memory system enhances agent performance, particularly in handling complex, long-horizon tasks and maintaining context.
Why Use TencentDB Agent Memory
TencentDB Agent Memory offers significant advantages for AI agents, moving beyond traditional flat memory systems. Its core technologies, memory layering and symbolic memory, provide a robust framework for improved agent performance.
- Reduced Token Usage and Improved Success Rates: By offloading heavy tool logs and condensing information into compact Mermaid symbols, the system drastically cuts token usage, achieving up to a 61.38% reduction. This leads to a substantial increase in task success rates, with benchmarks showing a 51.52% relative improvement in some scenarios.
- Layered Long-Term Memory: Instead of fragmented vector stores, it distills conversations into a semantic pyramid, from raw dialogue (L0) to atomic facts (L1), scene blocks (L2), and user personas (L3). This hierarchical structure ensures that agents remember what's important and can drill down for details when necessary.
- Symbolic Short-Term Memory: Task state transitions are encoded using high-density Mermaid syntax. This allows agents to reason over a concise symbol graph, while full logs are offloaded, maintaining full traceability via
node_idfor detail retrieval. - White-Box Debuggability: Unlike opaque memory systems, TencentDB Agent Memory keeps key intermediates as readable files. Scenario blocks are Markdown, personas are in
persona.md, and task canvases are Mermaid, making debugging a transparent process from high-level abstractions to ground-truth evidence. - Production-Ready Engineering: The project is designed for real-world applications, offering an OpenClaw plugin, Hermes Gateway adapter, local SQLite backend with
sqlite-vec, and hybrid retrieval (BM25 + vector + RRF) for both keyword and semantic recall.
Links
- GitHub Repository: TencentCloud/TencentDB-Agent-Memory
- GitHub Issues: Report bugs or ask questions
- GitHub Discussions: Share ideas and engage with the community
- Discord Community: Join the chat
Related repositories
Similar repositories that may be relevant next.

Feynman: The Open Source AI Research Agent
June 2, 2026
Feynman is an open-source AI research agent designed to automate and streamline complex research tasks. Built with TypeScript, it leverages multiple agents and tools to conduct in-depth investigations, literature reviews, and even experiment replications, providing source-grounded outputs.

CodeGraph: Supercharge AI Coding Agents with Semantic Code Intelligence
May 25, 2026
CodeGraph is a powerful, pre-indexed code knowledge graph designed to enhance AI coding agents like Claude Code, Cursor, and Codex. It significantly reduces token usage and tool calls, offering a faster and more cost-effective way for agents to understand codebases. This 100% local solution provides semantic code intelligence, improving agent efficiency and accuracy.

Agentic Inbox: A Self-Hosted Email Client with AI on Cloudflare Workers
May 18, 2026
Agentic Inbox is an innovative self-hosted email client that integrates an AI agent, running entirely on Cloudflare Workers. It provides a modern web interface for managing emails, enhanced by AI capabilities for reading, searching, and drafting replies. This project leverages Cloudflare's robust ecosystem, including Email Routing, Durable Objects, R2, and Workers AI, to deliver a powerful and secure email solution.

UI-TARS-desktop: The Open-Source Multimodal AI Agent Stack
May 6, 2026
UI-TARS-desktop is an open-source multimodal AI Agent stack from ByteDance, designed to connect cutting-edge AI models with agent infrastructure. It provides both Agent TARS, a general multimodal AI agent with CLI and Web UI, and UI-TARS Desktop, a native GUI agent for local and remote computer/browser control. This powerful tool aims to enable human-like task completion through rich multimodal capabilities and seamless integration with real-world tools.
Source repository
Open the original repository on GitHub.