
TencentDB Agent Memory命令行工具全解析memory-tencentdb-ctl使用指南【免费下载链接】TencentDB-Agent-MemoryTencentDB Agent Memory is a team-level memory hub for AI Agents — turning conversations, docs, and code into four reusable memory assets (Chat Memory, Skill, LLM-Wiki, Code-Graph) that are governed, shared, and equipped across agents and frameworks.项目地址: https://gitcode.com/GitHub_Trending/te/TencentDB-Agent-MemoryTencentDB Agent Memory是AI Agent的团队级记忆中枢能将对话、文档和代码转化为四种可重用的记忆资产Chat Memory、Skill、LLM-Wiki、Code-Graph并在智能体和框架之间进行治理、共享和配备。而memory-tencentdb-ctl作为其命令行工具是日常运维和配置的核心入口掌握它能让你轻松管理TencentDB Agent Memory的各项功能。快速了解memory-tencentdb-ctlmemory-tencentdb-ctl.sh是配合install_hermes_memory_tencentdb.sh使用的运维脚本。先通过安装脚本部署好插件和Node依赖之后日常的启停、配置等操作就全部通过memory-tencentdb-ctl.sh来完成啦~ 两种运行模式脚本有两种模式默认是独立模式完全不触碰~/.hermes模式激活方式做什么不做什么standalone默认无需任何参数启停Gateway写$TDAI_DATA_DIR/tdai-gateway.json日志落$TDAI_DATA_DIR/logs/不写$HERMES_HOME/env.d/不改$HERMES_HOME/config.yaml不读hermes相关envhermes命令行追加--hermes或环境MEMORY_TENCENTDB_MODEhermesstandalone的全部 config llm同步写$HERMES_HOME/env.d/memory-tencentdb-llm.sh日志落$HERMES_HOME/logs/memory_tencentdb/开放enable-hermes-memory子命令—为什么hermes模式要多写env文件因为hermes进程会托管式地把Gateway以子进程拉起来supervisor用os.environ.copy()传环境此时Gateway读不到tdai-gateway.json所在的shell环境必须通过$HERMES_HOME/env.d/*.sh让hermes自身source才能把凭据传进去。独立模式下Gateway自己读JSON无此需要。核心路径说明路径变量约定以下会用$HERMES_HOME指代hermes的家目录默认~/.hermes但你可以通过环境变量覆盖例如export HERMES_HOME/srv/hermes脚本和hermes自身都遵守这个变量。自0.4.x起所有tdai相关数据/代码默认收纳到统一根目录$MEMORY_TENCENTDB_ROOT默认~/.memory-tencentdb之下$TDAI_INSTALL_DIR默认$MEMORY_TENCENTDB_ROOT/tdai-memory-openclaw-plugin即~/.memory-tencentdb/tdai-memory-openclaw-plugin$TDAI_DATA_DIR默认$MEMORY_TENCENTDB_ROOT/memory-tdai即~/.memory-tencentdb/memory-tdai下文出现这些变量时先export一份覆盖再跑命令即可全局生效。旧版本使用~/tdai-memory-openclaw-plugin与~/memory-tdaiinstall_hermes_memory_tencentdb.sh在升级时会自动迁移这两个旧目录到新位置。路径standalonehermes作用$TDAI_INSTALL_DIR✅✅插件源码 node_modulessrc/gateway/server.ts$TDAI_DATA_DIR/tdai-gateway.json✅✅Gateway主配置llm/memory.embedding/memory.tcvdb/memory.storeBackend权限0600$TDAI_DATA_DIR/logs/✅ 日志—gateway.stdout.log/gateway.stderr.log/gateway.pid$HERMES_HOME/logs/memory_tencentdb/—✅ 日志同上换目录$HERMES_HOME/env.d/memory-tencentdb-llm.sh—✅hermes启动前source给supervisor托管的Gateway子进程注入LLM凭据$HERMES_HOME/config.yaml—✅enable-hermes-memory修改其memory.providerGateway监听127.0.0.1:8420127.0.0.1:8420可被MEMORY_TENCENTDB_GATEWAY_HOST/PORT覆盖所有路径都能用同名环境变量覆盖再次列出便于对照MEMORY_TENCENTDB_ROOT默认~/.memory-tencentdb、TDAI_INSTALL_DIR默认$MEMORY_TENCENTDB_ROOT/tdai-memory-openclaw-plugin、TDAI_DATA_DIR默认$MEMORY_TENCENTDB_ROOT/memory-tdai、HERMES_HOME默认~/.hermes、MEMORY_TENCENTDB_LOG_DIR、MEMORY_TENCENTDB_GATEWAY_HOST/PORT。依赖bash、python3、node 22、npx、lsof或ss。安装与调用方式脚本随npm包发布到node_modules/.../scripts/下但没有注册为bin命令。要用全局命令名调用必须自己做一次软链。从npm包里直接运行无需任何配置npm install tencentdb-agent-memory/memory-tencentdb # 项目内安装路径可由npm root动态算出 $(npm root)/tencentdb-agent-memory/memory-tencentdb/scripts/memory-tencentdb-ctl.sh --help # 全局安装则用npm root -g $(npm root -g)/tencentdb-agent-memory/memory-tencentdb/scripts/memory-tencentdb-ctl.sh --helpnpm root/npm root -g会在所有包管理器npm / pnpm / yarn和不同的prefix配置下返回正确目录避免硬编码node_modules/路径。适合一次性、临时使用的场景。软链到PATH推荐给运维/长期使用不论脚本来源git clone出来的仓库 /npm install装的包 / 自定义部署目录先把脚本路径算出来存到一个变量里再统一做软链。这样无需关心你把仓库放在~/code/、/opt/、还是别的什么地方。# 第一步定位memory-tencentdb-ctl.sh的真实路径任选一种来源 # (a) 从git仓库在仓库根目录或任意子目录里执行 SCRIPT$(git -C $(git rev-parse --show-toplevel) ls-files | \ grep -E scripts/memory-tencentdb-ctl\.sh$ | head -1) SCRIPT$(git rev-parse --show-toplevel)/$SCRIPT # (b) 从已npm全局安装的包 SCRIPT$(npm root -g)/tencentdb-agent-memory/memory-tencentdb/scripts/memory-tencentdb-ctl.sh # (c) 从项目本地的node_modules SCRIPT$(npm root)/tencentdb-agent-memory/memory-tencentdb/scripts/memory-tencentdb-ctl.sh # (d) 完全手写绝对路径如部署到非标准位置 SCRIPT/opt/tdai/scripts/memory-tencentdb-ctl.sh # 第二步验证路径正确然后软链 test -f $SCRIPT echo ok: $SCRIPT || { echo not found; exit 1; } chmod x $SCRIPT sudo ln -sf $SCRIPT /usr/local/bin/memory-tencentdb-ctl # 同样的办法把install_hermes_memory_tencentdb.sh链接成install-memory-tencentdb可选 INSTALL_SCRIPT$(dirname $SCRIPT)/install_hermes_memory_tencentdb.sh test -f $INSTALL_SCRIPT { chmod x $INSTALL_SCRIPT sudo ln -sf $INSTALL_SCRIPT /usr/local/bin/install-memory-tencentdb }之后直接memory-tencentdb-ctl …/install-memory-tencentdb …。为什么不直接用npm bin注册这两个脚本是运维工具而不是包的核心API主仓库希望用户显式完成PATH注册避免无意中污染全局命令空间并避免npm卸载时静默移除运维入口。生命周期管理两种模式通用memory-tencentdb-ctl start # 若:8420已占用会直接返回否则后台spawn等待/health通过 memory-tencentdb-ctl stop # 先SIGTERM5s内未退则SIGKILL memory-tencentdb-ctl restart memory-tencentdb-ctl status # 打印模式、端口、data/log路径、进程状态 memory-tencentdb-ctl health # GET /health纯python3实现不要求curl memory-tencentdb-ctl logs # tail -f stdout stderr memory-tencentdb-ctl logs err 500 # 只看stderr最近500行启动命令解析顺序环境变量MEMORY_TENCENTDB_GATEWAY_CMDinstall_hermes_memory_tencentdb.sh写入/etc/profile.d/memory-tencentdb-env.sh的那条。回退到sh -c cd $TDAI_INSTALL_DIR exec npx tsx src/gateway/server.ts。启动时会自动source的环境文件两种模式/etc/profile.d/memory-tencentdb-env.sh仅hermes模式/etc/profile.d/hermes-env.sh以及$HERMES_HOME/env.d/*.sh配置LLM / Embedding / VDB三类凭据统一落到$TDAI_DATA_DIR/tdai-gateway.json0600原子写。config llm在--hermes模式下会额外写一份env文件Embedding / VDB从不写env。LLM配置# standalone模式只写tdai-gateway.json memory-tencentdb-ctl config llm \ --api-key sk-xxxxxxxxxxxx \ --base-url https://api.openai.com/v1 \ --model gpt-4o \ --restart # hermes模式tdai-gateway.json $HERMES_HOME/env.d/memory-tencentdb-llm.sh memory-tencentdb-ctl --hermes config llm \ --api-key sk-xxxxxxxxxxxx \ --base-url https://api.openai.com/v1 \ --model gpt-4o \ --restartJSON写入点$.llm.{baseUrl, apiKey, model}。env文件写入仅--hermesTDAI_LLM_*及MEMORY_TENCENTDB_LLM_*别名Python provider的get_config_schema()会读后者。Embedding配置默认关闭providernone。启用远端OpenAI兼容服务memory-tencentdb-ctl config embedding \ --provider openai \ --api-key sk-xxxx \ --base-url https://api.openai.com/v1 \ --model text-embedding-3-small \ --dimensions 1536 \ --restart # 关闭embedding退化为BM25/关键词召回 memory-tencentdb-ctl config embedding --provider none --restartJSON写入点$.memory.embedding.{provider, baseUrl, apiKey, model, dimensions, enabled, proxyUrl?}。qclawprovider额外要求--proxy-url。校验规则与src/config.ts的parseConfig()对齐dimensions为正整数非none必须带apiKey/baseUrl/model/dimensions缺项直接报错不写半残JSON。VectorDBTencent Cloud VDB / tcvdb配置memory-tencentdb-ctl config vdb \ --url http://xxx-vdb.tencentclb.com:8100 \ --username root \ --api-key YOUR-VDB-API-KEY \ --database openclaw_memory \ --alias primary \ --embedding-model bge-large-zh \ --ca-pem /etc/ssl/vdb-ca.pem \ --restartJSON写入点$.memory.tcvdb.{url, username, apiKey, database, alias?, caPemPath?, embeddingModel?}。默认同时把$.memory.storeBackend切到tcvdb只想预埋配置先不切加--no-set-backend。--ca-pem只写路径不复制文件脚本会校验可读性。退回本地SQLite关闭VDB后端# 默认保留memory.tcvdb凭据方便随时再切回去仅把storeBackend改回sqlite memory-tencentdb-ctl config vdb-off --restart # 同时把腾讯云VDB的url / apiKey / database等凭据从JSON中清掉 memory-tencentdb-ctl config vdb-off --purge-creds --restartJSON写入点把$.memory.storeBackend设为sqlite--purge-creds时额外删除整段$.memory.tcvdb。$.llm/$.memory.embedding等其它顶级段完全保留hermes侧memory.provider不动仍是memory_tencentdb只是它内部存储退回sqlite。配置文件不存在时给出warn并写入仅含{memory:{storeBackend:sqlite}}的最小配置。与config vdb完全镜像可与--dry-run/--restart组合使用。查看当前配置memory-tencentdb-ctl config show打印tdai-gateway.jsonapiKey/password/token字段自动脱敏为redacted:NN chars。hermes模式下额外打印$HERMES_HOME/env.d/memory-tencentdb-*.shAPI key也会脱敏可直接贴工单。打通hermes仅--hermes模式memory-tencentdb-ctl --hermes enable-hermes-memory幂等把$HERMES_HOME/config.yaml的memory:段的provider:改成memory_tencentdb不存在则新增整段。改完后重启hermessource $HERMES_HOME/env.d/memory-tencentdb-llm.sh pkill -f hermes-agent || true hermes关于写入策略脚本采用格式保真双路径永不重写整个YAML首选检测到ruamel.yaml时走round-trip完整保留注释、键序、引号、缩进风格推荐pip install --user ruamel.yaml享受最佳保真度非必装降级未安装ruamel时走最小化原位行编辑——只重写provider:那一行缩进直接从同段已有兄弟键的前缀逐字符拷贝零猜测、零格式破坏若memory:段不存在则在文件末尾追加最小段缩进从文档其它顶级段的子键拓印。 实测对真实~/.hermes/config.yaml做byte-for-byte diff除provider值本身外其余字节完全一致。非hermes模式下调用该命令会直接报错退出。想反过来保留hermes provider不变仅让TDAI内部存储退回sqlite用§5.4的config vdb-off即可不需要也不要改hermes的memory.provider。典型使用流程场景AGateway独立部署不使用hermes# 1) 安装 # INSTALL_SCRIPT的取值方式见上文3.2节git rev-parse / npm root / 手填均可 # 例如从git仓库根INSTALL_SCRIPT$(git rev-parse --show-toplevel)/scripts/install_hermes_memory_tencentdb.sh # 从npm全局 INSTALL_SCRIPT$(npm root -g)/tencentdb-agent-memory/memory-tencentdb/scripts/install_hermes_memory_tencentdb.sh bash $INSTALL_SCRIPT # 2) 只配Gateway所需凭据 memory-tencentdb-ctl config llm --api-key sk-... --base-url https://api.openai.com/v1 --model gpt-4o memory-tencentdb-ctl config embedding --provider openai --api-key sk-... --base-url https://api.openai.com/v1 \ --model text-embedding-3-small --dimensions 1536 memory-tencentdb-ctl config vdb --url http://xxx:8100 --api-key ... --database openclaw_memory # 3) 启动 自检 memory-tencentdb-ctl start memory-tencentdb-ctl status memory-tencentdb-ctl health # 预期: {status:ok,...}场景B集成hermes# 1) 安装与场景A相同INSTALL_SCRIPT由上文3.2节算出 bash $INSTALL_SCRIPT # 2) 全程加--hermes或export MEMORY_TENCENTDB_MODEhermes一次 memory-tencentdb-ctl --hermes config llm --api-key sk-... --base-url https://api.openai.com/v1 --model gpt-4o memory-tencentdb-ctl --hermes config embedding --provider openai --api-key sk-... \ --base-url https://api.openai.com/v1 \ --model text-embedding-3-small --dimensions 1536 memory-tencentdb-ctl --hermes config vdb --url http://xxx:8100 --api-key ... --database openclaw_memory # 3) 启动Gateway通常由hermes supervisor托管这里是手动兜底 memory-tencentdb-ctl --hermes start memory-tencentdb-ctl --hermes status # 4) 在hermes config里启用provider并重启hermes memory-tencentdb-ctl --hermes enable-hermes-memory source $HERMES_HOME/env.d/memory-tencentdb-llm.sh pkill -f hermes-agent ; hermes如果嫌--hermes每次都要带可以export MEMORY_TENCENTDB_MODEhermes之后所有调用自动切到hermes模式命令行无需再加--hermes。场景C临时把TDAI的存储退回sqlite保留hermes集成适用于VDB不可达/排障/离线开发等场景希望hermes端memory.provider仍是memory_tencentdb但让Gateway改用本地SQLite落盘。# (A) 默认保留memory.tcvdb凭据仅把storeBackend切回sqlite memory-tencentdb-ctl config vdb-off --restart # (B) 排障结束想切回vdb当前需要重新跑一次config vdb必填项需重新提供 # 即使JSON里凭据还在脚本是基于必填校验的重新声明语义不是toggle memory-tencentdb-ctl config vdb \ --url http://xxx-vdb.tencentclb.com:8100 \ --api-key 你的KEY \ --database openclaw_memory \ --restart # (C) 彻底放弃vdb清掉凭据 memory-tencentdb-ctl config vdb-off --purge-creds --restart之所以(B)不提供零参数vdb-on是因为原config vdb子命令把--url/--api-key/--database设为强校验避免用户拼装出半残配置如果你希望把已存的凭据重新激活也做成单命令告诉维护者补一个config vdb-on即可实现方式与vdb-off完全镜像。不要为了切回sqlite去改~/.hermes/config.yaml的memory.providerhermes看到的依然是memory_tencentdbprovider存储后端切换是Gateway内部的事对hermes完全透明。全局选项 调试技巧所有写操作支持--dry-run放在命令最前会打印将要写入的内容但不落盘memory-tencentdb-ctl --dry-run config llm --api-key k --base-url https://x --model m敏感文件权限一律0600env.d/memory-tencentdb-llm.sh含明文API key不要commit。启动失败memory-tencentdb-ctl logs err 200查看stderr手动前台跑一遍更容易看到报错cd $TDAI_INSTALL_DIR npx tsx src/gateway/server.ts端口冲突MEMORY_TENCENTDB_GATEWAY_PORT18420 memory-tencentdb-ctl restart。验证hermes有没有吃到新envhermes模式tr \0 \n /proc/$(pgrep -n hermes-agent)/environ | grep -E TDAI_|MEMORY_TENCENTDB_退出码码含义0成功1参数错误 / 业务校验失败如--base-url非http(s)在standalone下调hermes专属命令2写盘失败磁盘满、权限不足等127依赖缺失python3/node/npx要封装成systemd unit基于memory-tencentdb-ctl start/memory-tencentdb-ctl stop写Typeforking的service即可Gateway是无状态HTTP sidecar不依赖systemd readiness协议。TencentDB Agent Memory记忆金字塔TencentDB Agent Memory的记忆管理采用金字塔结构从下到上分为L0 Raw Log、L1 Atomic Memory、L2 Scene Block和L3 Persona四个层级通过memory-tencentdb-ctl工具可以更好地对这些记忆资产进行管理和配置。通过这篇指南相信你已经对memory-tencentdb-ctl命令行工具有了全面的了解。无论是独立部署Gateway还是集成hermes都能轻松应对。赶紧动手试试让TencentDB Agent Memory为你的AI Agent团队提供强大的记忆支持吧【免费下载链接】TencentDB-Agent-MemoryTencentDB Agent Memory is a team-level memory hub for AI Agents — turning conversations, docs, and code into four reusable memory assets (Chat Memory, Skill, LLM-Wiki, Code-Graph) that are governed, shared, and equipped across agents and frameworks.项目地址: https://gitcode.com/GitHub_Trending/te/TencentDB-Agent-Memory创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考