Git 安装
Section titled “Git 安装”使用单行命令即可更新至最新版本:
hermes update该命令会拉取最新代码、更新依赖项,并提示你配置自上次更新以来新增的任何选项。
pip 安装
Section titled “pip 安装”PyPI 发布版本会跟踪带标签的版本(主版本和次版本发布),而不是 main 分支上的每一次提交。检查更新并升级:
hermes update --check # 查看 PyPI 上是否有更新版本hermes update # 运行 pip install --upgrade hermes-agent或者手动执行:
pip install --upgrade hermes-agent # 或者:uv pip install --upgrade hermes-agent更新期间会发生什么(git installs)
Section titled “更新期间会发生什么(git installs)”运行 hermes update 时,将执行以下步骤:
- 配对数据快照 (Pairing-data snapshot) —— 保存一个轻量级的更新前状态快照(涵盖
~/.hermes/pairing/、飞书评论规则以及其他在运行时修改的状态文件)。可以通过 快照与回滚 中描述的流进行恢复,或者解压 Hermes 在~/.hermes/目录旁生成的最新快速快照 zip 文件。 - Git 拉取 (Git pull) —— 从
main分支拉取最新代码并更新子模块。 - 安装依赖 (Dependency install) —— 运行
uv pip install -e ".[all]"以获取新增或变更的依赖项。 - 配置迁移 (Config migration) —— 检测自当前版本以来新增的配置选项,并提示你进行设置。
- 网关自动重启 (Gateway auto-restart) —— 更新完成后会刷新正在运行的网关,使新代码立即生效。通过服务管理器管理的网关(Linux 上的 systemd,macOS 上的 launchd)将通过服务管理器重启。手动启动的网关在 Hermes 能够将运行中的 PID 映射回配置文件时会自动重新启动。
仅预览:hermes update --check
Section titled “仅预览:hermes update --check”想在实际拉取前知道自己是否落后于 origin/main?运行 hermes update --check —— 它会获取更新,并排对比本地提交和最新的远程提交;如果已同步则退出码为 0,如果落后则为 1。此操作不会修改文件,也不会重启网关。适用于需要判断“是否有更新”的脚本和 cron 任务。
更新前完整备份:--backup
Section titled “更新前完整备份:--backup”对于高价值的配置文件(生产网关、团队共享安装),你可以选择在拉取前对 HERMES_HOME(配置、认证、会话、技能、配对信息)进行完整备份:
hermes update --backup或者将其设置为每次运行的默认行为:
updates: pre_update_backup: true在早期版本中,--backup 是始终开启的行为,但对于庞大的主目录,它会增加数分钟的更新时间,因此现在改为可选开启。上述轻量级的配对数据快照仍会无条件运行。
预期的输出如下:
$ hermes updateUpdating Hermes Agent...📥 Pulling latest code...Already up to date. (或: Updating abc1234..def5678)📦 Updating dependencies...✅ Dependencies updated🔍 Checking for new config options...✅ Config is up to date (或: Found 2 new options — running migration...)🔄 Restarting gateways...✅ Gateway restarted✅ Hermes Agent updated successfully!推荐的更新后验证
Section titled “推荐的更新后验证”hermes update 处理了主要的更新路径,但进行快速验证可以确保一切正常:
git status --short—— 如果工作树意外变动,请在继续前检查。hermes doctor—— 检查配置、依赖项和服务健康状况。hermes --version—— 确认版本已按预期升级。- 如果你使用了网关:
hermes gateway status - 如果
doctor报告 npm 审计问题:在标记的目录中运行npm audit fix。
如果终端在更新途中断开连接
Section titled “如果终端在更新途中断开连接”hermes update 具备防止意外丢失终端的保护机制:
- 更新过程会忽略
SIGHUP信号,因此关闭 SSH 会话或终端窗口不再会导致安装中途夭折。pip和git子进程也会继承此保护,因此 Python 环境不会因连接掉线而处于半安装状态。 - 更新运行期间,所有输出都会同步记录到
~/.hermes/logs/update.log。如果终端消失,请重新连接并检查日志,查看更新是否完成以及网关重启是否成功:tail -f ~/.hermes/logs/update.log Ctrl-C(SIGINT) 和系统关机 (SIGTERM) 信号仍会被响应 —— 这些属于刻意的取消操作,而非意外。
你不再需要将 hermes update 放在 screen 或 tmux 中来防止终端掉线。
检查当前版本
Section titled “检查当前版本”hermes version可以前往 GitHub Releases 页面 对比最新发布版本。
通过消息平台更新
Section titled “通过消息平台更新”你也可以直接从 Telegram、Discord、Slack、WhatsApp 或 Teams 发送以下指令进行更新:
/update这将拉取最新代码、更新依赖项并重启运行中的网关。机器人会在重启期间短暂下线(通常为 5–15 秒),随后恢复运行。
如果你是手动安装的(而非通过快速安装程序):
cd /path/to/hermes-agentexport VIRTUAL_ENV="$(pwd)/venv"
# Pull latest codegit pull origin main
# Reinstall (picks up new dependencies)uv pip install -e ".[all]"
# Check for new config optionshermes config checkhermes config migrate # Interactively add any missing options如果更新引入了问题,你可以回滚到之前的版本:
cd /path/to/hermes-agent
# 列出最近的 10 个版本git log --oneline -10
# 回滚到特定提交git checkout <commit-hash>git submodule update --init --recursiveuv pip install -e ".[all]"
# 如果网关正在运行,请重启它hermes gateway restart要回滚到特定的发布标签 (Release Tag):
git checkout v0.6.0git submodule update --init --recursiveuv pip install -e ".[all]"Nix 用户注意
Section titled “Nix 用户注意”如果你是通过 Nix flake 安装的,更新由 Nix 包管理器管理:
# 更新 flake 输入nix flake update hermes-agent
# 或者使用最新版本升级nix profile upgrade hermes-agentNix 安装是不可变的 —— 回滚通过 Nix 的世代 (generation) 系统处理:
nix profile rollback详见 Nix 设置。
Git 安装的卸载
Section titled “Git 安装的卸载”hermes uninstall卸载程序会询问你是否保留配置文件(~/.hermes/)以便将来重新安装。
pip 安装的卸载
Section titled “pip 安装的卸载”pip uninstall hermes-agentrm -rf ~/.hermes # Optional — keep if you plan to reinstallrm -f ~/.local/bin/hermesrm -rf /path/to/hermes-agentrm -rf ~/.hermes # 可选 —— 如果计划重装则保留