Skip to main content

Hermes Agent

  • NousResearch/hermes-agent
    • MIT, Python
    • 自我改进 AI agent,支持多平台集成(Telegram、微信、飞书、Discord 等)
  • ~/.hermes/hermes-agent/ — 安装目录(独立 git repo)
  • ~/.hermes/ — 配置/数据目录
    • .env — API keys
    • config.yaml — 主配置
    • SOUL.md — Agent 人格定制
    • skills/ — 技能
    • sessions/ — 会话历史
    • memories/ — 持久记忆
  • 运维文档:wener-infra/.agents/docs/hermes-agent-ops.md
  • 参考
# 安装
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash -s -- --skip-setup
hermes setup # 配置 API key

# 常用
hermes # 启动交互 CLI
hermes update # 升级(git pull + 重装)
hermes config edit # 编辑配置
hermes gateway install # 安装后台 gateway(Telegram/Discord/飞书等)

配置

  • ~/.hermes/config.yaml — 模型、工具、平台等配置
  • ~/.hermes/.env — API keys(gitignored)
model:
provider: custom # custom / anthropic / openrouter / gemini 等
default: gpt-5.4
api_mode: codex_responses # chat_completions / codex_responses / anthropic_messages
context_length: 1050000 # 显式覆盖,避免从 /v1/models 读到错误值
base_url: https://wna.wener.me/v1

smart_model_routing:
enabled: true
max_simple_chars: 160
max_simple_words: 28
cheap_model:
provider: custom
model: gpt-5.4-mini
base_url: https://wna.wener.me/v1
api_mode: codex_responses

display:
busy_input_mode: interrupt
字段说明
provider推理 provider,custom 表示自定义 OpenAI 兼容端点
api_mode传输协议:chat_completions / codex_responses / anthropic_messages
context_length显式覆盖上下文长度,避免从 endpoint 读到错误值
base_url自定义端点 URL

Smart Model Routing

  • 定义:agent/smart_model_routing.py
  • 满足全部条件才用 cheap_model,否则用主模型
条件默认值可配置
消息长度≤ 160 字符max_simple_chars
词数≤ 28 词max_simple_words
换行数≤ 1 行
不含反引号/代码`
不含 URL无 http/www
不含复杂关键词否(硬编码)

复杂关键词(任一命中 → 主模型): debug implement refactor patch error traceback analyze investigate architecture design compare benchmark optimize review terminal shell tool test plan delegate subagent cron docker kubernetes

Platforms / Bridges

平台文件说明
Telegramtelegram.pyBot Token
Discorddiscord.py
Slackslack.py
WhatsAppwhatsapp.pyBaileys(非官方协议,需 Node.js)
飞书 Feishufeishu.py
钉钉 DingTalkdingtalk.py
企业微信 WeComwecom.py
微信 Weixinweixin.pyiLink Bot API,个人账号扫码登录
Matrixmatrix.py仅 Linux
Emailemail.pyIMAP/SMTP
Webhookwebhook.py通用
API Serverapi_server.py

微信接入

  • 基于腾讯 iLink Bot API(ilinkai.weixin.qq.com),对接个人微信账号
  • 登录:hermes weixin(扫码),token 保存到 ~/.hermes/weixin/accounts/
  • 需要 aiohttp + cryptography.[all] 已包含)
platforms:
weixin:
enabled: true
extra:
account_id: 'your-ilink-bot-id'
dm_policy: open # open / allowlist / disabled
group_policy: disabled

已知问题

codex.rate_limits 顺序错误

  • 症状Expected to have received response.created before codex.rate_limits
  • 原因:OpenAI SDK 严格要求 stream 第一个事件是 response.created,codex-lb 先发 codex.rate_limits
  • 修复:手动 apply PR #8134,宽松匹配:
    "Expected to have received" in err_text and "response.created" in err_text
    注:PR 原版 "before response." 不匹配 codex. 前缀,需改为上述宽松版本
  • 注意hermes update 后需重新 apply

skill [error](非致命)

  • 症状📚 skill github:codebase-inspection 0.2s [error]
  • 原因:agent 把 category:name 当 plugin namespace 查询,本地 bundled skill 只支持裸名
  • 影响:非致命,自动重试时用裸名成功加载

Memory

  • byterover — requires API key
  • hindsight — API key / local
  • holographic — local
  • honcho — API key / local
  • mem0 — API key / local
  • openviking — API key / local
  • retaindb — API key / local
  • supermemory — requires API key
  • Built-in only — MEMORY.md / USER.md (default)