跳到主要内容

更新与卸载

更新

使用一条命令即可更新到最新版本:

hermes update

这会拉取最新代码、更新依赖,并提示你配置自上次更新以来新增的选项。

提示

hermes update 会自动检测新增的配置项并提示你添加。如果你跳过了这个提示,可以手动运行 hermes config check 查看缺失项,再执行 hermes config migrate 以交互方式补上。

更新时会发生什么

当你运行 hermes update 时,会依次执行以下步骤:

  1. Git pull — 从 main 分支拉取最新代码并更新子模块
  2. Dependency install — 运行 uv pip install -e ".[all]" 安装新增或发生变化的依赖
  3. Config migration — 检测你当前版本之后新增的配置项,并提示你完成设置
  4. Gateway auto-restart — 如果网关服务正在运行(Linux 上是 systemd,macOS 上是 launchd),更新结束后它会自动重启,让新代码立刻生效

预期输出大致如下:

$ hermes update
Updating Hermes Agent...
📥 Pulling latest code...
Already up to date. (or: Updating abc1234..def5678)
📦 Updating dependencies...
✅ Dependencies updated
🔍 Checking for new config options...
✅ Config is up to date (or: Found 2 new options — running migration...)
🔄 Restarting gateway service...
✅ Gateway restarted
✅ Hermes Agent updated successfully!

推荐的更新后验证

hermes update 已经覆盖了主要的更新流程,但做一次快速检查可以确认一切都落得很干净:

  1. git status --short — 如果工作树意外变脏,先检查清楚再继续
  2. hermes doctor — 检查配置、依赖和服务健康状态
  3. hermes --version — 确认版本是否如预期更新
  4. 如果你在用网关:执行 hermes gateway status
  5. 如果 doctor 提示 npm audit 问题:到对应目录运行 npm audit fix
Dirty working tree after update

如果 git status --shorthermes update 后显示了意料之外的变更,请先停下来检查。这通常说明本地改动被重新套用了更新后的代码之上,或某个依赖步骤刷新了 lockfile。

如果更新过程中终端断开了

hermes update 自带了针对意外终端丢失的保护:

  • 更新过程会忽略 SIGHUP,因此关闭 SSH 会话或终端窗口,不会再让它在安装中途被杀掉。pipgit 子进程也会继承这层保护,因此不会因为连接中断把 Python 环境留在半安装状态。
  • 更新运行期间,所有输出都会同步写入 ~/.hermes/logs/update.log。如果终端消失了,重新连回来后可以检查日志,确认更新是否完成,以及网关重启是否成功:
tail -f ~/.hermes/logs/update.log
  • Ctrl-C(SIGINT)和系统关机(SIGTERM)依然会被正常响应,因为这属于有意取消,不是意外中断。

因此,你已经不再需要用 screentmux 来包一层 hermes update,以防终端断开。

检查当前版本

hermes version

并与 GitHub releases page 上的最新发布版本进行对比。

从消息平台发起更新

你也可以直接在 Telegram、Discord、Slack 或 WhatsApp 中发送:

/update

这会拉取最新代码、更新依赖并重启网关。bot 在重启期间会短暂离线(通常 5-15 秒),随后恢复。

手动更新

如果你是手动安装的(不是通过快速安装器):

cd /path/to/hermes-agent
export VIRTUAL_ENV="$(pwd)/venv"

# Pull latest code and submodules
git pull origin main
git submodule update --init --recursive

# Reinstall (picks up new dependencies)
uv pip install -e ".[all]"
uv pip install -e "./tinker-atropos"

# Check for new config options
hermes config check
hermes config migrate # Interactively add any missing options

回滚说明

如果某次更新引入了问题,你可以回滚到之前的版本:

cd /path/to/hermes-agent

# List recent versions
git log --oneline -10

# Roll back to a specific commit
git checkout <commit-hash>
git submodule update --init --recursive
uv pip install -e ".[all]"

# Restart the gateway if running
hermes gateway restart

如果要回滚到某个具体的 release tag:

git checkout v0.6.0
git submodule update --init --recursive
uv pip install -e ".[all]"
注意

如果新版本新增过配置项,回滚后可能出现配置不兼容。回滚后请运行 hermes config check;若遇到错误,请从 config.yaml 中删除无法识别的选项。

给 Nix 用户的说明

如果你是通过 Nix flake 安装的,更新由 Nix 包管理器负责:

# Update the flake input
nix flake update hermes-agent

# Or rebuild with the latest
nix profile upgrade hermes-agent

Nix 安装本身是不可变的,回滚则由 Nix 的 generation 系统处理:

nix profile rollback

更多内容请参阅 Nix Setup


卸载

hermes uninstall

卸载器会让你选择是否保留配置文件(~/.hermes/),以便将来重新安装时继续使用。

手动卸载

rm -f ~/.local/bin/hermes
rm -rf /path/to/hermes-agent
rm -rf ~/.hermes # Optional — keep if you plan to reinstall
信息

如果你把网关安装成了系统服务,请先停止并禁用它:

hermes gateway stop
# Linux: systemctl --user disable hermes-gateway
# macOS: launchctl remove ai.hermes.gateway