当前记忆系统深度审核报告

生成时间:2026-05-30 21:12:46

审核范围:Master/default Hermes gateway、built-in memory/user profile、memory_tencentdb、TencentDB Agent Memory sidecar、CCTB Codex/Antigravity mirror、skills、session_search。

执行边界:本次为只读审核;未修改配置,未重启服务,未删除文件,未调用 Report Center 发布。/root/.hermes/HERMES_CHANGELOG_INBOX.md 当前非空,因本任务边界要求只读,已读取但未折叠/删除。

1. 结论摘要

2. 当前架构图


Master/default hermes-gateway.service
  ExecStart: python -m hermes_cli.main --profile default gateway run --replace
  HERMES_HOME=/root/.hermes
  cwd=/root/.hermes/hermes-agent

  Prompt assembly
    ├─ Built-in MEMORY.md        /root/.hermes/memories/MEMORY.md
    ├─ Built-in USER.md          /root/.hermes/memories/USER.md
    ├─ Skills index              /root/.hermes/skills + bundled skills
    ├─ session_search tool       /root/.hermes/state.db FTS/session store
    └─ External memory provider  memory_tencentdb

  memory_tencentdb plugin
    /root/.hermes/hermes-agent/plugins/memory/memory_tencentdb
      -> /opt/TencentDB-Agent-Memory/hermes-plugin/memory/memory_tencentdb

      Python provider / supervisor
        └─ HTTP 127.0.0.1:8424
            TencentDB Agent Memory Gateway sidecar
              cwd=/opt/TencentDB-Agent-Memory
              data=/root/.memory-tencentdb/master/memory-tdai
                ├─ L0 conversations/*.jsonl
                ├─ L1 records/*.jsonl
                ├─ L2 scene_blocks/*.md
                ├─ L3 persona.md
                └─ vectors.db (+ WAL/SHM)

CCTB Codex / Antigravity Telegram bridges
  /root/cc-telegram-bridge/dist/src/index.js --instance codex|antigravity
    └─ after Telegram response delivery:
       best-effort POST /capture to 127.0.0.1:8424
       session_key=cctb:<instance>:chat:<chat_id>
       [source=cctb/<instance> ...]

Important boundary:
  CCTB mirror = append-only shared write.
  It is not TencentDB read injection for Codex/Antigravity.

3. 分层说明

Built-in MEMORY / USER

TencentDB L0 conversations

TencentDB L1 structured memories

TencentDB L2 scene blocks

TencentDB L3 persona

skills

session_search

Codex/Antigravity CCTB mirror

4. 配置与进程证据

Hermes config

核查命令:读取 /root/.hermes/config.yamlmemory 段。


memory_enabled: true
user_profile_enabled: true
provider: memory_tencentdb
memory_char_limit: 2200
user_char_limit: 1375
flush_min_turns: 6
nudge_interval: 10

判断:配置显示 Master/default 同时启用内置 memory/user profile 和外部 provider memory_tencentdb

hermes-gateway.service

核查命令:systemctl show hermes-gateway.service -p ActiveState -p SubState -p ExecMainPID -p ExecMainStartTimestamp -p FragmentPath


ActiveState=active
SubState=running
ExecMainPID=731895
ExecMainStartTimestamp=Sat 2026-05-30 15:34:47 CST
FragmentPath=/etc/systemd/system/hermes-gateway.service

/proc/731895/cmdline/root/.hermes/hermes-agent/venv/bin/python -m hermes_cli.main --profile default gateway run --replace

/proc/731895/cwd/root/.hermes/hermes-agent

筛选环境变量:HERMES_HOME=/root/.hermes;仅见 memory pressure 相关变量,无 TDAI secret 输出。

unit 关键行:


ExecStart=/root/.hermes/hermes-agent/venv/bin/python -m hermes_cli.main --profile default gateway run --replace
WorkingDirectory=/root/.hermes/hermes-agent
Environment="HERMES_HOME=/root/.hermes"
Restart=on-failure
TimeoutStopSec=240

判断:当前 Master/default 是 pinned profile,不依赖 active_profile;运行源码路径是 /root/.hermes/hermes-agent

插件链路

核查路径:/root/.hermes/hermes-agent/plugins/memory/memory_tencentdb


exists=true
is_symlink=true
readlink=/opt/TencentDB-Agent-Memory/hermes-plugin/memory/memory_tencentdb

Python import 证据:


agent.memory_manager -> /root/.hermes/hermes-agent/agent/memory_manager.py
run_agent -> /root/.hermes/hermes-agent/run_agent.py
agent.prompt_builder -> /root/.hermes/hermes-agent/agent/prompt_builder.py
plugins.memory.memory_tencentdb -> /root/.hermes/hermes-agent/plugins/memory/memory_tencentdb/__init__.py

插件 plugin.yamlname: memory_tencentdb,aliases 包含 tdaimemory-tencentdb

TencentDB sidecar

核查命令:ss -ltnp | rg ':8424'


LISTEN 127.0.0.1:8424 users: node pid=731981

核查命令:curl -fsS --max-time 5 http://127.0.0.1:8424/health


{"status":"ok","version":"0.1.0","stores":{"vectorStore":true,"embeddingService":false}}

/proc/731981/cmdline/usr/bin/node ... src/gateway/server.ts

/proc/731981/cwd/opt/TencentDB-Agent-Memory

筛选环境变量显示:


MEMORY_TENCENTDB_GATEWAY_CMD=sh -c 'cd /opt/TencentDB-Agent-Memory && exec npx tsx src/gateway/server.ts'
MEMORY_TENCENTDB_GATEWAY_HOST=127.0.0.1
MEMORY_TENCENTDB_GATEWAY_PORT=8424
MEMORY_TENCENTDB_LOG_DIR=/root/.memory-tencentdb/master/logs
MEMORY_TENCENTDB_ROOT=/root/.memory-tencentdb/master
TDAI_DATA_DIR=/root/.memory-tencentdb/master/memory-tdai
TDAI_GATEWAY_CONFIG=/root/.memory-tencentdb/master/memory-tdai/tdai-gateway.json
TDAI_GATEWAY_HOST=127.0.0.1
TDAI_GATEWAY_PORT=8424
TDAI_LLM_BASE_URL=http://127.0.0.1:8317/v1
TDAI_LLM_MODEL=gpt-5.4-mini

判断:sidecar 当前由 Hermes 环境拉起并运行;embeddingService=false 是配置为 keyword/SQLite 灰度模式,不等于 sidecar 失败。

注册/激活日志

/root/.hermes/logs/agent.log 在当前 gateway 启动后出现:


2026-05-30 15:34:54 Memory provider 'memory_tencentdb' registered (2 tools)
2026-05-30 15:34:54 Memory provider 'memory_tencentdb' activated
2026-05-30 15:34:55 Starting memory-tencentdb Gateway ...
2026-05-30 15:34:58 memory-tencentdb Gateway is ready
2026-05-30 20:58:21 memory-tencentdb Gateway already running (127.0.0.1:8424)
2026-05-30 20:58:21 Memory provider 'memory_tencentdb' activated

判断:这是“当前进程已加载/激活”的直接证据,不只是配置文件显示启用。

5. 数据与召回证据

数据目录规模

根目录:/root/.memory-tencentdb/master/memory-tdai


conversations: 8 files, 207 lines
today conversations/2026-05-30.jsonl: exists, 54 lines, mtime 2026-05-30 20:59:24
records: 8 files, 49 lines
today records/2026-05-30.jsonl: exists, 9 lines, mtime 2026-05-30 15:25:02
scene_blocks: 3 files
persona.md: 5570 bytes, mtime 2026-05-30 15:26:29
vectors.db: 868352 bytes, mtime 2026-05-30 14:06:49
vectors.db-wal: present, mtime 2026-05-30 20:59:24
.metadata/recall_checkpoint.json: present, mtime 2026-05-30 21:05:59

判断:L0 conversations 正在持续写入;L1/L2/L3 今天均存在产物,但最近 scene/persona 更新发生在当前 gateway 启动前,当前启动后的 pipeline 有运行但该轮 L1 extracted=0。

sessionKey 分布

Conversations top session keys:


20260524_055036_51352978: 42
cctb:antigravity:chat:5760817136: 26
20260521_102048_3d864099: 18
20260526_203047_64460810: 16
20260530_130433_8dad8166: 14
20260530_152040_89e9feb9: 14
20260523_100837_ce47aa22: 12

Records top session keys:


20260524_055036_51352978: 10
20260527_194523_d5206e2b: 6
20260523_100837_ce47aa22: 5
20260526_203047_64460810: 5
20260521_102048_3d864099: 4
20260530_084559_7977384a: 4
cctb:antigravity:chat:5760817136: 3

CCTB marker 证据:


cctb:antigravity:chat:5760817136 conversations: 26
cctb:antigravity:smoke conversations: 2
cctb:codex:chat:5760817136 conversations: 2
[source=cctb/antigravity ...]: 28
[source=cctb/codex ...]: 2
records with cctb:antigravity:chat: 3

判断:CCTB 确实写入 Master TencentDB;Codex 写入量目前很少,Antigravity 写入更充分。

scene blocks

Telegram调用与模型恢复.md


created: 2026-05-21T03:19:07.187Z
updated: 2026-05-24T02:39:21.566Z
heat: 18
summary: Telegram 调用、模型状态核验、CLIProxyAPI/Hermes Usage 运维恢复链路。
mtime: 2026-05-24 10:39:40 CST

主要内容:用户通过 Telegram 触发外部 AI 服务调用,用 /model 核验状态;偏好把复杂系统压缩成可执行、可验证的恢复链路;涉及入口迁移、接口验证、面板确认、调度校验、远程 VPS 巡检提示词。

健康数据与热量核验.md


created: 2026-05-25T16:41:24.236Z
updated: 2026-05-25T16:41:24.236Z
heat: 1
summary: 用户核验健康报告中 226 kcal 是否应计入当日消耗。
mtime: 2026-05-26 00:41:37 CST

主要内容:用户对健康数据统计口径敏感,要求热量归因可核验、可解释。

内置记忆迁移承接.md


created: 2026-05-24T00:00:00+08:00
updated: 2026-05-30T07:26:12.901Z
heat: 32
summary: 用户把运维、访问控制与代理订阅收敛为可验证闭环,并开始用 Codex 介入本机记忆系统。
mtime: 2026-05-30 15:26:28 CST

主要内容:承接从内置 USER/MEMORY 瘦身迁移出的系统治理画像;主题集中在运维闭环、访问控制、代理订阅、备份/清理边界、记忆底座治理。

persona / recall 注入证据

persona.md 存在且今天更新;gateway recall 日志显示:


[recall] strategy=keyword, embeddingAvailable=false, vectorStore=available, embeddingService=UNAVAILABLE
[keyword-fts] FTS5 found 5 results
Persona loaded: 1843 chars
Scene navigation generated: 3 scenes
Recall completed in 3ms: context=3267 chars

代码路径证据:agent/conversation_loop.py 在每轮 API call 前调用 agent._memory_manager.prefetch_all(),再用 build_memory_context_block() 包装成 <memory-context> 注入当前 user message;原始持久会话不被这个临时注入污染。

判断:这里可以区分四种状态:


配置显示启用:是,config.yaml provider=memory_tencentdb。
当前进程已加载:是,agent.log 当前启动后 registered/activated。
数据实际写入:是,L0 今天 20:59 写入;L1/L2/L3 今天有产物但异步且当前轮可能 extracted=0。
召回实际注入:有证据支持,/recall 返回 context,代码路径会在 API call 前注入;未抓取完整模型请求体,避免泄露上下文。

6. Codex/Antigravity 关联性

服务证据

cctb-codex.service


ActiveState=active
ExecMainStartTimestamp=Fri 2026-05-29 14:06:46 CST
ExecStart=/usr/bin/node /root/cc-telegram-bridge/dist/src/index.js --instance codex
WorkingDirectory=/root/cc-telegram-bridge
CODEX_TELEGRAM_INSTANCE=codex
CCTB_TDAI_MIRROR_ENABLED=1
CCTB_TDAI_GATEWAY_URL=http://127.0.0.1:8424
CCTB_TDAI_TIMEOUT_MS=5000
CCTB_TDAI_MAX_CHARS=12000

cctb-antigravity.service


ActiveState=active
ExecMainStartTimestamp=Sat 2026-05-30 14:21:03 CST
ExecStart=/usr/bin/node /root/cc-telegram-bridge/dist/src/index.js --instance antigravity
WorkingDirectory=/root/cc-telegram-bridge
CODEX_TELEGRAM_INSTANCE=antigravity
CODEX_EXECUTABLE=/usr/local/bin/agy-codex-wrapper
CCTB_TDAI_MIRROR_ENABLED=1
CCTB_TDAI_GATEWAY_URL=http://127.0.0.1:8424
CCTB_TDAI_TIMEOUT_MS=5000
CCTB_TDAI_MAX_CHARS=12000

代码证据

src/runtime/tdai-capture.ts 和 dist JS 均包含:


user_content
assistant_content
session_key
session_id
user_id
/source prefix [source=cctb/<instance> chat=... update=...]
redaction for token/secret/password/api_key-like strings
truncate max chars controlled by CCTB_TDAI_MAX_CHARS
POST /capture with timeout controlled by CCTB_TDAI_TIMEOUT_MS
best-effort catch logs failure

src/telegram/message-turn.ts 与 dist JS 均在成功交付后调用 mirror;不是模型执行前调用。

灰度点

/root/cc-telegram-bridge/dist/src/runtime/tdai-capture.jsdist/src/telegram/message-turn.js mtime 为 2026-05-30 14:20:58 CST

7. 今天改动是否已应用

数据层

配置层

代码层

Hermes/TencentDB 关键代码 mtime:


/root/.hermes/hermes-agent/plugins/memory/memory_tencentdb/__init__.py  2026-05-30 08:51:59
/root/.hermes/hermes-agent/plugins/memory/memory_tencentdb/client.py    2026-05-30 08:51:59
/root/.hermes/hermes-agent/plugins/memory/memory_tencentdb/supervisor.py 2026-05-30 08:51:59
/opt/TencentDB-Agent-Memory/src/gateway/server.ts                       2026-05-30 08:51:59

这些时间均早于 hermes-gateway.service 当前启动时间 15:34:47。当前 gateway cwd、Python import path 和日志都指向 /root/.hermes/hermes-agent,sidecar cwd 指向 /opt/TencentDB-Agent-Memory

判断:**当前 gateway 已加载今天 Hermes/TencentDB 相关代码**。

gateway 当前进程

重启后行为

在不改配置的情况下,重启 hermes-gateway.service 会继续尝试启用 memory_tencentdb。依赖条件:


/root/.hermes/config.yaml 保持 provider=memory_tencentdb
/root/.hermes/.env 提供 TDAI/MEMORY_TENCENTDB_* 变量
插件 symlink 存在且目标 /opt/TencentDB-Agent-Memory 可读
Node/npx/tsx 依赖可运行
127.0.0.1:8424 可绑定,或已运行的是正确 sidecar
/root/.memory-tencentdb/master/memory-tdai 可读写
CLIProxy 127.0.0.1:8317/v1 和对应 LLM auth 可用于 L1/L2/L3 extraction

操作提醒:任何 Hermes gateway/service 重启前必须先写 /root/.hermes/restart-context/;完成系统、服务、路由、profile、VPS inventory 或 runbook 修改后必须追加 /root/.hermes/HERMES_CHANGELOG_INBOX.md

8. 风险清单

9. 建议路线图

P0:不改架构,只验证与监控

P1:建立固定审计脚本/报告

P2:设计 Codex/Antigravity 读注入灰度

10. 附录

核查命令


sed -n '1,240p' /root/.codex/LONG_TERM_MEMORY.md
[ -s /root/.hermes/HERMES_CHANGELOG_INBOX.md ] && sed -n '1,140p' /root/.hermes/HERMES_CHANGELOG_INBOX.md
python3 - <<'PY'  # parse /root/.hermes/config.yaml memory section
systemctl show hermes-gateway.service -p ActiveState -p SubState -p ExecMainPID -p ExecMainStartTimestamp -p FragmentPath
python3 - <<'PY'  # read /proc/<gateway_pid>/cmdline,cwd,HERMES/TDAI/MEMORY env with redaction
ss -ltnp | rg ':8424'
curl -fsS --max-time 5 http://127.0.0.1:8424/health
python3 - <<'PY'  # inspect plugin symlink and import paths
git -C /root/.hermes/hermes-agent status --short
git -C /root/.hermes/hermes-agent log --since='today 00:00' --oneline --decorate --all --max-count=50
python3 - <<'PY'  # data root counts, JSONL line counts, top sessionKey
python3 - <<'PY'  # scene block META/summary extraction
python3 - <<'PY'  # built-in MEMORY/USER stats
python3 - <<'PY'  # log keyword counts and recent sanitized matches
systemctl show cctb-codex.service cctb-antigravity.service ...
systemctl cat cctb-codex.service cctb-antigravity.service
rg -n 'mirrorTurnToTdaiBestEffort|CCTB_TDAI|/capture|user_content|assistant_content|session_key|session_id|user_id' /root/cc-telegram-bridge/src /root/cc-telegram-bridge/dist/src
journalctl -u cctb-codex.service --since '2026-05-29 00:00:00' --no-pager | rg -i 'tdai|tencent|mirror|capture|timeout|error|failed'
journalctl -u cctb-antigravity.service --since '2026-05-29 00:00:00' --no-pager | rg -i 'tdai|tencent|mirror|capture|timeout|error|failed'

关键文件路径


/root/.hermes/config.yaml
/root/.hermes/.env
/root/.hermes/memories/MEMORY.md
/root/.hermes/memories/USER.md
/root/.hermes/hermes-agent
/root/.hermes/hermes-agent/plugins/memory/memory_tencentdb
/opt/TencentDB-Agent-Memory
/root/.memory-tencentdb/master/memory-tdai
/root/.memory-tencentdb/master/memory-tdai/conversations
/root/.memory-tencentdb/master/memory-tdai/records
/root/.memory-tencentdb/master/memory-tdai/scene_blocks
/root/.memory-tencentdb/master/memory-tdai/persona.md
/root/.memory-tencentdb/master/logs/gateway.stdout.log
/root/.memory-tencentdb/master/logs/gateway.stderr.log
/root/cc-telegram-bridge/src/runtime/tdai-capture.ts
/root/cc-telegram-bridge/dist/src/runtime/tdai-capture.js
/root/cc-telegram-bridge/src/telegram/message-turn.ts
/root/cc-telegram-bridge/dist/src/telegram/message-turn.js

关键服务


hermes-gateway.service
cctb-codex.service
cctb-antigravity.service
cliproxyapi.service  # L1/L2/L3 extraction LLM 依赖

不含 secrets 的关键环境变量


HERMES_HOME=/root/.hermes
MEMORY_TENCENTDB_GATEWAY_HOST=127.0.0.1
MEMORY_TENCENTDB_GATEWAY_PORT=8424
MEMORY_TENCENTDB_GATEWAY_CMD=sh -c 'cd /opt/TencentDB-Agent-Memory && exec npx tsx src/gateway/server.ts'
MEMORY_TENCENTDB_LOG_DIR=/root/.memory-tencentdb/master/logs
MEMORY_TENCENTDB_ROOT=/root/.memory-tencentdb/master
TDAI_DATA_DIR=/root/.memory-tencentdb/master/memory-tdai
TDAI_GATEWAY_CONFIG=/root/.memory-tencentdb/master/memory-tdai/tdai-gateway.json
TDAI_GATEWAY_HOST=127.0.0.1
TDAI_GATEWAY_PORT=8424
TDAI_LLM_BASE_URL=http://127.0.0.1:8317/v1
TDAI_LLM_MODEL=gpt-5.4-mini
CODEX_TELEGRAM_INSTANCE=codex|antigravity
CODEX_EXECUTABLE=/usr/local/bin/agy-codex-wrapper  # antigravity only
CCTB_TDAI_MIRROR_ENABLED=1
CCTB_TDAI_GATEWAY_URL=http://127.0.0.1:8424
CCTB_TDAI_TIMEOUT_MS=5000
CCTB_TDAI_MAX_CHARS=12000

需要人工确认的问题

---

一句话结论:Master/default 当前实际运行的是“内置 MEMORY/USER + TencentDB memory_tencentdb 外部 provider”的叠加记忆系统;Codex/Antigravity 当前只通过 CCTB 共享写入 Master TencentDB,不共享读取。