{"name":"TencentDB Agent Memory: Enhancing AI Agents with Layered Long-Term Memory","description":"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.","github":"https://github.com/TencentCloud/TencentDB-Agent-Memory","url":"https://osrepos.com/repo/tencentcloud-tencentdb-agent-memory","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/tencentcloud-tencentdb-agent-memory","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/tencentcloud-tencentdb-agent-memory.md","json":"https://osrepos.com/repo/tencentcloud-tencentdb-agent-memory.json","topics":["AI Agent","Long-Term Memory","LLM","TypeScript","Vector Search","OpenClaw Plugin","Hermes Agent","Local-First AI"],"keywords":["AI Agent","Long-Term Memory","LLM","TypeScript","Vector Search","OpenClaw Plugin","Hermes Agent","Local-First AI"],"stars":null,"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.","content":"## Introduction\n\nTencentDB 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.\n\n## Installation\n\nThe project supports integration with OpenClaw and Hermes agents.\n\n### For OpenClaw:\n\n1.  **Install the plugin:**\n    bash\n    openclaw plugins install @tencentdb-agent-memory/memory-tencentdb\n    openclaw gateway restart\n    \n2.  **Enable zero-config:**\n    Add the following to `~/.openclaw/openclaw.json`:\n    c\n    // ~/.openclaw/openclaw.json\n    {\n      \"memory-tencentdb\": {\n        \"enabled\": true\n      }\n    }\n    \n3.  **Enable short-term compression (optional, requires version ? 0.3.4):**\n    First, update `~/.openclaw/openclaw.json` to enable offloading:\n    c\n    {\n      \"memory-tencentdb\": {\n        \"config\": {\n          \"offload\": {\n            \"enabled\": true\n          }\n        }\n      }\n    }\n    \n    Then, register the slot in your plugin config:\n    c\n    {\n      \"plugins\": {\n        \"slots\": {\n          \"contextEngine\": \"memory-tencentdb\"\n        }\n      }\n    }\n    \n    Finally, apply the runtime patch:\n    bash\n    bash scripts/openclaw-after-tool-call-messages.patch.sh\n    \n\n### For Hermes:\n\nThere are two main ways to integrate with Hermes:\n\n*   **Docker (greenfield, requires version ? 0.3.4):**\n    Navigate to the `docker/opensource` directory in the cloned repository.\n    Build the Docker image:\n    bash\n    docker build -f Dockerfile.hermes -t hermes-memory .\n    \n    Run the container, replacing `your-api-key` with your actual key:\n    bash\n    docker run -d \\\n      --name hermes-memory \\\n      --restart unless-stopped \\\n      -p 8420:8420 \\\n      -e MODEL_API_KEY=\"your-api-key\" \\\n      -e MODEL_BASE_URL=\"https://api.lkeap.cloud.tencent.com/v1\" \\\n      -e MODEL_NAME=\"deepseek-v3.2\" \\\n      -e MODEL_PROVIDER=\"custom\" \\\n      -v hermes_data:/opt/data \\\n      hermes-memory\n    \n    Verify the Gateway:\n    bash\n    curl http://localhost:8420/health\n    \n    Enter the Hermes interactive shell:\n    bash\n    docker exec -it hermes-memory hermes\n    \n\n*   **Attach to Existing Hermes (No Docker):**\n    1.  Download the plugin package:\n        bash\n        mkdir -p ~/.memory-tencentdb\n        TEMP_DIR=$(mktemp -d)\n        cd \"$TEMP_DIR\"\n        npm init -y --silent\n        npm install @tencentdb-agent-memory/memory-tencentdb@latest --omit=dev\n        cp -r node_modules/@tencentdb-agent-memory/memory-tencentdb \\\n              ~/.memory-tencentdb/tdai-memory-openclaw-plugin\n        rm -rf \"$TEMP_DIR\"\n        \n    2.  Install Gateway dependencies:\n        bash\n        cd ~/.memory-tencentdb/tdai-memory-openclaw-plugin\n        npm install --omit=dev\n        npm install tsx\n        \n    3.  Link to the Hermes plugin directory:\n        bash\n        rm -rf ~/.hermes/hermes-agent/plugins/memory/memory_tencentdb\n        ln -sf ~/.memory-tencentdb/tdai-memory-openclaw-plugin/hermes-plugin/memory/memory_tencentdb \\\n               ~/.hermes/hermes-agent/plugins/memory/memory_tencentdb\n        \n    4.  Declare the provider in `~/.hermes/config.yaml`:\n        yaml\n        memory:\n          provider: memory_tencentdb\n        \n    5.  Configure Gateway environment variables in `~/.hermes/.env`:\n        bash\n        MEMORY_TENCENTDB_GATEWAY_CMD=\"sh -c 'cd ~/.memory-tencentdb/tdai-memory-openclaw-plugin && exec npx tsx src/gateway/server.ts'\"\n        MEMORY_TENCENTDB_GATEWAY_HOST=\"127.0.0.1\"\n        MEMORY_TENCENTDB_GATEWAY_PORT=\"8420\"\n        TDAI_LLM_API_KEY=\"sk-your-api-key-here\"\n        TDAI_LLM_BASE_URL=\"https://api.openai.com/v1\"\n        TDAI_LLM_MODEL=\"gpt-4o\"\n        \n    6.  Start the Gateway (auto-discovery or manual run):\n        bash\n        cd ~/.memory-tencentdb/tdai-memory-openclaw-plugin\n        npx tsx src/gateway/server.ts\n        \n    7.  Verify:\n        bash\n        curl http://127.0.0.1:8420/health\n        \n\n## Examples\n\nThe 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.\n\n*   [OpenClaw × Agent Memory Demo](https://github.com/user-attachments/assets/09c64a2c-9997-42c0-90a3-a15e250cfa43){:target=\"_blank\"}\n*   [Hermes × Agent Memory Demo](https://github.com/user-attachments/assets/69045512-e75f-4c84-99dd-52ffa6e9e317){:target=\"_blank\"}\n\n## Why Use TencentDB Agent Memory\n\nTencentDB 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.\n\n*   **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.\n*   **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.\n*   **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_id` for detail retrieval.\n*   **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.\n*   **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.\n\n## Links\n\n*   **GitHub Repository:** [TencentCloud/TencentDB-Agent-Memory](https://github.com/TencentCloud/TencentDB-Agent-Memory){:target=\"_blank\"}\n*   **GitHub Issues:** [Report bugs or ask questions](https://github.com/Tencent/TencentDB-Agent-Memory/issues){:target=\"_blank\"}\n*   **GitHub Discussions:** [Share ideas and engage with the community](https://github.com/Tencent/TencentDB-Agent-Memory/discussions){:target=\"_blank\"}\n*   **Discord Community:** [Join the chat](https://discord.gg/kDtHb5RW2){:target=\"_blank\"}","metrics":{"detailViews":4,"githubClicks":1},"dates":{"published":null,"modified":"2026-07-07T00:33:07.000Z"}}