更新与卸载
更新
通过一条命令即可更新到最新版本:
hermes update
此命令会拉取最新代码,更新依赖项,并提示你配置自上次更新以来新增的任何选项。
hermes update 会自动检测新增的配置选项,并提示你添加。如果你跳过了该提示,可以手动运行 hermes config check 来查看缺失的选项,然后运行 hermes config migrate 以交互方式添加它们。
更新期间发生的情况
当你运行 hermes update 时,将执行以下步骤:
- Git 拉取 — 从
main分支拉取最新代码,并更新子模块 - 依赖安装 — 运行
uv pip install -e ".[all]"以获取新增或更改的依赖项 - 配置迁移 — 检测自你当前版本以来新增的配置选项,并提示你设置它们
- 网关自动重启 — 如果网关服务正在运行(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 处理了主要的更新流程,但快速验证可确保一切顺利落地:
git status --short— 如果工作树意外处于非干净状态,请检查后再继续hermes doctor— 检查配置、依赖项和服务健康状况hermes --version— 确认版本号已按预期更新- 如果你使用网关:
hermes gateway status - 如果
doctor报告 npm 审计问题:在标记的目录中运行npm audit fix
如果 git status --short 在 hermes update 后显示意外更改,请停止并检查这些更改。这通常意味着本地修改被重新应用到了更新后的代码上,或某个依赖步骤刷新了锁文件。
检查当前版本
hermes version
与 GitHub 发布页面 上的最新版本进行对比,或检查是否有可用更新:
hermes update --check
从消息平台更新
你也可以通过发送以下内容直接从 Telegram、Discord、Slack 或 WhatsApp 进行更新:
/update
此操作会拉取最新代码,更新依赖项,并重启网关。机器人在重启期间将短暂离线(通常为 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
要回滚到特定的发布标签:
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 的生成系统处理:
nix profile rollback
更多详情请参见 Nix 设置。
卸载
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