在不依赖外部托管记忆服务的前提下,为 OpenClaw 提供可持续的本地长期记忆能力(L0→L1→L2→L3),并完成从安装、配置到验收的一次性闭环。
memory-tencentdb
先确认基础版本满足要求:
>= 2026.3.13
>= 22.16.0
执行:
openclaw --version
node -v
若版本不满足,先升级再继续。
执行安装命令:
openclaw plugins install @tencentdb-agent-memory/memory-tencentdb
如已安装则执行更新:
openclaw plugins update memory-tencentdb
编辑 ~/.openclaw/openclaw.json,确保存在:
{
"memory-tencentdb": {
"enabled": true
}
}
说明:该插件支持零配置启动;不补充其它字段也能运行基础能力。
根据用户需求补充如下分组:
capture: 对话捕获与保留策略extraction: L1 提取与去重pipeline: L1→L2→L3 调度recall: 召回数量、阈值、策略persona: 场景与画像触发参数embedding: 向量检索配置(远端 OpenAI 兼容)推荐模板:
{
"memory-tencentdb": {
"capture": {
"enabled": true,
"excludeAgents": [],
"l0l1RetentionDays": 90,
"cleanTime": "03:00"
},
"extraction": {
"enabled": true,
"enableDedup": true,
"maxMemoriesPerSession": 10,
"model": "provider/model"
},
"pipeline": {
"everyNConversations": 5,
"enableWarmup": true,
"l1IdleTimeoutSeconds": 600,
"l2DelayAfterL1Seconds": 10,
"l2MinIntervalSeconds": 900,
"l2MaxIntervalSeconds": 3600,
"sessionActiveWindowHours": 24
},
"recall": {
"enabled": true,
"maxResults": 5,
"scoreThreshold": 0.3,
"strategy": "hybrid"
},
"persona": {
"triggerEveryN": 50,
"maxScenes": 15,
"backupCount": 3,
"sceneBackupCount": 10,
"model": "provider/model"
},
"embedding": {
"enabled": true,
"provider": "openai",
"baseUrl": "https://api.openai.com/v1",
"apiKey": "${EMBEDDING_API_KEY}",
"model": "text-embedding-3-small",
"dimensions": 1536,
"conflictRecallTopK": 5
}
}
}
embedding.provider = "none" 时,向量能力会禁用,仅保留关键词路径。provider(如 openai / deepseek),必须同时提供:
apiKey
baseUrl
model
dimensions
l0l1RetentionDays:
0 表示不清理0 时建议 >=3
1~2,需显式开启 allowAggressiveCleanup
执行:
openclaw gateway restart
检查项:
[memory-tdai] 前缀~/.openclaw/state/memory-tdai/
conversations/、records/、scene_blocks/、vectors.db
执行一次最小对话回路并验证:
tdai_memory_search
tdai_conversation_search
openclaw.json 中 memory-tencentdb.enabled 是否为 true,并确认已重启 Gateway。recall.enabled、scoreThreshold 是否过高。embedding 四元组(apiKey/baseUrl/model/dimensions)是否齐全。l0l1RetentionDays 与 allowAggressiveCleanup。~/.openclaw/openclaw.json,并再次重启 Gateway。apiKey 视为敏感信息;不在聊天、日志、截图中明文扩散。memory-tencentdb 对应配置段,避免覆盖用户其它插件配置。在结束任务前,必须同时满足:
openclaw.json 已存在有效 memory-tencentdb 配置[memory-tdai] 日志可见可在完成后向用户输出:
memory-tencentdb 安装与配置,并重启 Gateway。recall.scoreThreshold、pipeline.everyNConversations、persona.triggerEveryN 与 embedding 模型参数。