# 微信自动回复调试实录(2026-07-14) ## 错误序列与修复 | # | 错误现象 | 根因 | 修复 | |---|---------|------|------| | 1 | 回复是 `hermes --resume xxx` | generate() 取 stdout 最后一行,最后一行是 CLI 命令 | 加噪音过滤 | | 2 | 回复是 `Resume this session with:` | 噪音过滤漏了 hermes 元数据 | 加更多噪音关键词 | | 3 | 回复是分隔线 `───` | 分隔线没过滤 | 加分隔线检测 | | 4 | 回复混杂整段 prompt+上下文 | hermes chat 将 prompt 回显到 stdout | 改用文件 I/O:hermes 写文件,orch 读文件 | | 5 | 回复很短(21/25/47 字符) | 取最后一行丢弃了前面的完整报告 | 取所有有效行拼接 | | 6 | 回复是 `===报告===` 分隔符 | 分隔符方案不可靠,hermes 不总是输出 | 弃用,改用文件 I/O | | 7 | 同一条消息反复触发 | 去重只在成功路径持久化 | 全路径持久化 msgId | | 8 | admin 任务超时后回退 member 闲聊 | fallback 逻辑不适合任务模式 | 任务失败调用 reply-failure-report skill | | 9 | 发给 jimmy 的消息发给了陌生人 | rcontact 模糊匹配 | 要求精确匹配,多结果时确认 | | 10 | 失败报告假承诺"我重试一次" | reply-failure-report prompt 太宽松 | skill v2.0 明确禁止假承诺 | ## 架构演进 ``` v1: orch → hermes chat → stdout 解析 → 发送 问题:stdout 含 prompt+工具+结果,无法可靠提取 v2: orch → hermes chat → 文件 I/O → 发送 问题:裸 prompt,没有 Plan→Execute→Verify→Report v3: orch → hermes chat -s reply-task-executor → 文件 I/O → 发送 当前:skill 驱动,四步 Loop,文件 I/O,去重全路径 ``` ## 当前架构 ``` orch 接收消息 → 去重检查(msgId) → admin + 任务关键词 → 两段式 → ack 秒回 → hermes chat -s reply-task-executor --yolo -t terminal,file,web → Plan → Execute → Verify → Report → write_file → orch 读文件 → _verify_draft → 发送 → admin + 闲聊 → 单段式 → member → hermes -z → 其他人 → review ``` ## 关键设计决策 1. **文件 I/O > stdout 解析**:不再尝试从 stdout 提取回复 2. **Skill > 硬编码**:逻辑在 skill 里,代码只是执行引擎 3. **Loop > 一步黑盒**:admin 任务必须走 Plan→Execute→Verify→Report 4. **去重全路径**:成功/失败/跳过都持久化 msgId 5. **失败不 silence**:用 reply-failure-report skill 诚实地告诉对方