Does your Agent keep forgetting what you just agreed on? Naming conventions from the last turn vanish; tool-call logs flood the context window; the token bill climbs while task pass rates drop. In May 2026, Tencent open-sourced TencentDB Agent Memory (MIT license)—a local memory engine that combines symbolic short-term memory with a four-layer long-term pyramid, running by default on SQLite + sqlite-vec with zero external API dependencies.
For Kvmjet readers—iOS, Flutter, and AI application developers—this means you can install a plugin on OpenClaw and give your Coding Agent project SOPs, user preferences, and cross-session context in about ten minutes, without building a vector database or stuffing entire histories into every prompt. If you have been stitching together Redis, Pinecone, and custom summarization hooks, this stack is deliberately narrower: one plugin, one SQLite file, and hooks that already understand OpenClaw tool calls. This guide is written to be hands-on: concepts first, copy-paste commands second, then how to land it alongside Cloud Mac / Apple Silicon workflows you already run.
Bottom line: Agents do not need a bigger context window—they need layered, traceable memory. On official benchmarks, TencentDB Agent Memory raised WideSearch ultra-long session pass rates from 33% to 50% while cutting token consumption by roughly 61%. For multi-turn Agent workloads, that often beats simply upgrading to a larger model.
1. Why Agents need layered memory—not just a bigger context window
Long-running Agents usually fail not because the model lacks intelligence, but because irrelevant information drowns the context: a grep returns five thousand lines; a browser scrape fills JSON; fifty SWE-bench subtasks stack in one session—noise everywhere, decision signals pushed to the window edge.
Three common responses each have hard limits:
- Hard truncation: drop early messages. Fast but irreversible—user preferences and root causes disappear together.
- Whole-history summarization: an LLM compresses history. Saves tokens but risks "summary hallucination" with no raw evidence to verify.
- Flat vector RAG: slice conversations, embed, retrieve. Lacks hierarchy from user persona → scenario → atomic fact—recall feels like rummaging through sticky notes.
TencentDB Agent Memory takes a fourth path: layering + symbolization + drill-down traceability. Short-term tasks use a Mermaid state canvas; heavy logs offload to refs/*.md. Cross-session knowledge refines along L0 Conversation → L1 Atom → L2 Scenario → L3 Persona, each layer keeping node_id pointers to underlying source text. Official docs call this "progressive disclosure"—the Agent reads high-level structure by default and drills down when proof is needed. See the Tencent Cloud Agent Memory product overview for the full design.
For mobile and AI product teams, this maps to three daily pain points: a Code Review Agent must remember your Swift style guide; a support bot must recall a key customer's last complaint; an internal ops Agent must remember "never kubectl delete on staging"—none of that should be re-explained every session or lost to irreversible summarization.
2. Core concepts: short-term offload and the L0–L3 pyramid
2.1 Symbolic short-term memory (context offload)
Tool outputs are token black holes. TencentDB Agent Memory offloads + symbolizes: full logs go to the filesystem; the context keeps only a Mermaid task graph with node_id markers. The Agent reasons over the graph; if a step looks wrong, it greps refs/ by node_id for the original text—100% traceable, not a black-box summary.
Available from plugin ≥ 0.3.4 (optional). Register the contextEngine slot in OpenClaw and run the official patch script. On the WideSearch benchmark: +51.52% pass rate, −61.38% tokens.
2.2 Four-layer long-term memory (L0 → L3)
The long-term side is a semantic pyramid, not a flat vector pile:
- L0 Conversation: raw dialogue and tool traces—the evidence layer.
- L1 Atom: structured facts ("user prefers 4-space tab indentation").
- L2 Scenario: scenario blocks ("Flutter pre-release checklist").
- L3 Persona: user/project persona—recalled first in daily prompts.
Retrieval uses BM25 + vector + RRF hybrid search so pure semantic search does not miss exact keywords. Enterprise teams can switch to Tencent Cloud Vector Database (TCVDB); local SQLite is enough for PoC. Architecture and APIs are documented in the GitHub repository README.
2.3 Integration paths
Two main routes today:
- OpenClaw plugin:
@tencentdb-agent-memory/memory-tencentdb, Node.js ≥ 22.16, one-command install. - Hermes Gateway: Docker image or mounted plugin directory for teams already on Hermes orchestration.
If you already run an OpenClaw Gateway from Kvmjet's OpenClaw series, adding the memory layer is one more plugin config—not a rebuild.
| Layer | What is stored | Typical use | Recall method |
|---|---|---|---|
| Short-term · refs | Full tool logs | Debugging, audit | Drill down by node_id |
| Short-term · Mermaid | Task state graph | Long-task reasoning | Stays in context |
| L0–L1 | Dialogue and atomic facts | Exact verification | Hybrid retrieval |
| L2–L3 | Scenarios and persona | Cross-session personalization | Injected into prompt first |
3. 10-minute walkthrough: OpenClaw plugin install and enable
Verified on machines with OpenClaw ≥ 2026.3.13. On a Cloud Mac, confirm node -v ≥ 22.16 first.
3.1 Install the plugin
openclaw plugins install @tencentdb-agent-memory/memory-tencentdb openclaw gateway restart
When upgrading, use the native command—avoid semver ranges that can silently disable the plugin:
openclaw plugins update @tencentdb-agent-memory/memory-tencentdb
3.2 Enable long-term memory with zero config
Edit ~/.openclaw/openclaw.json:
{
"memory-tencentdb": {
"enabled": true
}
}
Save and restart the Gateway. The plugin automatically handles conversation recording, memory extraction, scenario summarization, persona generation, and recall on the next turn. Default data lives in local SQLite—no Tencent Cloud account required.
3.3 Optional: enable short-term memory compression (≥ 0.3.4)
Recommended for long tasks or heavy tool chains. Two steps:
Step 1 — register the contextEngine slot:
{
"memory-tencentdb": {
"enabled": true,
"config": {
"offload": { "enabled": true }
}
},
"plugins": {
"slots": {
"contextEngine": "memory-tencentdb"
}
}
}
Step 2 — run the official patch at the repo root (injects the after-tool-call hook):
bash scripts/openclaw-after-tool-call-messages.patch.sh
The script lives in TencentDB-Agent-Memory/scripts—clone the repo and run it.
3.4 Acceptance checklist (5 minutes)
- In one session, run three tool calls with large output. Confirm the context shows a Mermaid graph instead of full logs.
- Start a new session and ask in natural language: "What code style did I mention last time?"—L1/L3 information should recall.
- Check the local data directory (default SQLite file) grows with conversation; back it up during PoC.
If you are evaluating other Agent stacks in parallel, compare against our Strix AI Agent deployment guide—Security Agents and Coding Agents need different memory profiles, but token economics look similar.
4. Cloud Mac / Apple Silicon use cases
A memory engine is a always-on background service—a different resource profile from "open IDE occasionally." On Kvmjet M4 Cloud Mac nodes, we see strong fit in these scenarios:
- OpenClaw Gateway 24/7: M4 Mac mini standby ~4W suits internal duty Agents; memory SQLite co-located with Gateway cuts latency and data-residency concerns.
- Unified memory + sqlite-vec: vector retrieval benefits from Apple Silicon memory bandwidth; a 16 GB node can run Gateway, memory store, and light Ollama eval without renting a separate x86 vector server.
- iOS / Flutter teams in one domain: when Xcode builds, Fastlane, and a Coding Agent share a Cloud Mac, Agent Memory can remember "this app's certificate profile alias" and "Flutter flavor naming"—alongside our remote M4 build machine CI/CD guide, reducing context fracture between "build box" and "Agent box."
- Local-first compliance: default SQLite backend does not force cloud upload; finance and healthcare PoCs can validate on an internal Cloud Mac before optional TCVDB—easier security review than piping chat logs into third-party SaaS.
5. Cost, performance, and risk comparison
Compare "build your own memory" vs "bare OpenClaw / flat RAG" (rough Q3 2026 estimate for a 20-person team, ~5M Agent tokens/month):
| Approach | Extra infra | Token impact | Personalization | Main risk |
|---|---|---|---|---|
| No memory · large window | $0 | High bill, unstable pass rate | Weak | Truncation loses context |
| DIY vector RAG | $200–600/mo DB | Medium | Medium | Flat retrieval, ops overhead |
| TencentDB Agent Memory local | $0 (reuse Gateway host) | Official −30% to −61% | Strong (L0–L3) | SQLite backup; single point |
| + TCVDB enterprise backend | Usage-based cloud vector DB | Same as above | Strong + multi-node | Cloud data compliance approval |
Relation to API pricing: tokens saved by the memory layer show up directly on OpenAI / Anthropic bills. If you are planning next-gen model budgets, pair this with our GPT-6 API pricing forecast—under multi-turn Agent load, memory compression often beats waiting for the next price drop.
Perceived performance: local sqlite-vec recall is typically milliseconds to low hundreds of ms; the bottleneck is usually LLM calls writing L1/L3, not retrieval. For long sessions, enable offload—otherwise L0 write frequency slows turn intervals.
Risk checklist: (1) corrupted SQLite needs backups; (2) wrong Persona writes persist—spot-check L3 updates in production; (3) patch scripts must be re-run on OpenClaw upgrades—document in your ops runbook.
6. FAQ
Does TencentDB Agent Memory require internet access or a Tencent Cloud account?
Not by default. Out of the box it uses local SQLite + sqlite-vec; conversations and memory stay on your machine. Enterprise multi-node or large-scale vector search can switch to TCVDB, but a ten-minute PoC runs fully offline.
What is the difference between short-term compression and long-term memory?
Short-term targets long tasks within the current session: offload logs, keep a Mermaid graph. Long-term targets across sessions: distill Atoms, Scenarios, and Personas from dialogue. Long-term alone already "remembers the user"; multi-tool coding Agents should enable both.
What are the advantages on a Cloud Mac?
Low-power always-on, unified memory for local vector search, same domain as Xcode/Flutter toolchains. Memory data and build logs on one host beat "Agent in the cloud, code on laptop" with extra VPN and permission splits.
Is OpenClaw the only option?
No. Hermes Gateway has official Docker and mount paths; custom frameworks can use the repo SDK. OpenClaw is the shortest path for readers already on Kvmjet's OpenClaw series.
7. Summary and next steps
TencentDB Agent Memory turns "Agent long-term memory" from a concept into an OpenClaw plugin you can enable in ten minutes: local SQLite with zero dependencies, L0–L3 layers you can trace, short-term offload that materially cuts tokens. For iOS/Flutter/AI developers, suggested next steps:
- Complete install and acceptance from Section 3 on a PoC Cloud Mac;
- Pick your highest-token real workflow (e.g. "large-repo refactor Agent") and run a one-week A/B;
- Write SQLite + refs backup policy before considering TCVDB or merging into production nodes.
Once the memory layer is in place, an Agent starts to feel like a seasoned partner—not a new hire who asks "who are you and what framework is this?" every session.
Run Agent memory and builds on the same Cloud Mac
TencentDB Agent Memory runs on the Gateway host by default—M4 Mac mini Cloud nodes fit this "light service + heavy development" mix well: Apple Silicon unified memory stabilizes sqlite-vec retrieval alongside OpenClaw; ~4W standby suits 24/7 duty Agents; native macOS Node.js and Docker skip arm64 image matching on Linux VPS. When the memory store shares a machine with Xcode and Fastlane, a Coding Agent can actually remember your certificates, flavors, and team conventions.
If you are building an AI dev environment with long-term memory, Kvmjet M4 Cloud Mac is a cost-effective PoC starting point—ten minutes for the memory plugin, an hour on a real repo, a week validating token savings before wider rollout.