Profiles: 运行多个 Agent
在同一台机器上运行多个独立的 Hermes Agent — 每个都有自己的配置、API 密钥、记忆、会话、技能和网关。
什么是 Profile?
Profile 是一个完全隔离的 Hermes 环境。每个 Profile 都有自己的目录,包含自己的 config.yaml、.env、SOUL.md、记忆、会话、技能、计划任务和状态数据库。Profile 让你可以为不同目的运行独立的 Agent — 编程助手、个人机器人、研究 Agent — 不会有任何交叉污染。
当你创建一个 Profile 时,它会自动成为自己的命令。创建一个名为 coder 的 Profile,你立即拥有 coder chat、coder setup、coder gateway start 等命令。
快速开始
hermes profile create coder # 创建 profile + "coder" 命令别名
coder setup # 配置 API 密钥和模型
coder chat # 开始聊天
就这样。coder 现在是一个完全独立的 Agent。它有自己的配置、自己的记忆、自己的一切。
创建 Profile
空白 Profile
hermes profile create mybot
创建一个带有捆绑技能种子化的全新 Profile。运行 mybot setup 来配置 API 密钥、模型和网关令牌。
仅克隆配置(--clone)
hermes profile create work --clone
将当前 Profile 的 config.yaml、.env 和 SOUL.md 复制到新 Profile。相同的 API 密钥和模型,但全新的会话和记忆。编辑 ~/.hermes/profiles/work/.env 使用不同的 API 密钥,或编辑 ~/.hermes/profiles/work/SOUL.md 使用不同的人格。
克隆一切(--clone-all)
hermes profile create backup --clone-all
复制所有内容 — 配置、API 密钥、人格、所有记忆、完整会话历史、技能、计划任务、插件。一个完整的快照。可用于备份或分叉已有上下文的 Agent。
从特定 Profile 克隆
hermes profile create work --clone --clone-from coder
当 Honcho 启用时,--clone 会自动为新 Profile 创建专用的 AI 对等体,同时共享相同的用户工作区。每个 Profile 构建自己的观察和身份。详情参见 Honcho -- 多 Agent / Profiles。
使用 Profiles
命令别名
每个 Profile 自动在 ~/.local/bin/<name> 创建一个命令别名:
coder chat # 与 coder Agent 聊天
coder setup # 配置 coder 的设置
coder gateway start # 启动 coder 的网关
coder doctor # 检查 coder 的健康状态
coder skills list # 列出 coder 的技能
coder config set model.model anthropic/claude-sonnet-4
别名适用于每个 hermes 子命令 — 它只是 hermes -p <name> 的底层实现。
-p 标志
你也可以用任何命令显式指定 Profile:
hermes -p coder chat
hermes --profile=coder doctor
hermes chat -p coder -q "hello" # 可以在任何位置使用
持久默认(hermes profile use)
hermes profile use coder
hermes chat # 现在指向 coder
hermes tools # 配置 coder 的工具
hermes profile use default # 切换回来
设置一个默认项,这样普通的 hermes 命令就会针对那个 Profile。像 kubectl config use-context。
了解你所在的位置
CLI 始终显示哪个 Profile 是活跃的:
- 提示符:
coder ❯而不是❯ - 横幅:启动时显示
Profile: coder hermes profile:显示当前 Profile 名称、路径、模型、网关状态
运行网关
每个 Profile 都运行自己的网关作为独立的进程,有自己的机器人令牌:
coder gateway start # 启动 coder 的网关
assistant gateway start # 启动 assistant 的网关(独立进程)
不同的机器人令牌
每个 Profile 有自己的 .env 文件。在每个中配置不同的 Telegram/Discord/Slack 机器人令牌:
# 编辑 coder 的令牌
nano ~/.hermes/profiles/coder/.env
# 编辑 assistant 的令牌
nano ~/.hermes/profiles/assistant/.env
安全:令牌锁
如果两个 Profile 意外使用相同的机器人令牌,第二个网关将被阻止,并给出明确命名冲突 Profile 的清晰错误。支持 Telegram、Discord、Slack、WhatsApp 和 Signal。
持久服务
coder gateway install # 创建 hermes-gateway-coder systemd/launchd 服务
assistant gateway install # 创建 hermes-gateway-assistant 服务
每个 Profile 有自己的服务名称。它们独立运行。
配置 Profiles
每个 Profile 有自己的:
config.yaml— 模型、提供者、工具集、所有设置.env— API 密钥、机器人令牌SOUL.md— 人格和指令
coder config set model.model anthropic/claude-sonnet-4
echo "You are a focused coding assistant." > ~/.hermes/profiles/coder/SOUL.md
更新
hermes update 拉取代码一次(共享)并自动将新的捆绑技能同步到所有 Profiles:
hermes update
# → 代码已更新(12 次提交)
# → 技能已同步:default(已是最新)、coder(+2 新)、assistant(+2 新)
用户修改的技能永远不会被覆盖。
管理 Profiles
hermes profile list # 显示所有 Profiles 及状态
hermes profile show coder # 显示一个 Profile 的详细信息
hermes profile rename coder dev-bot # 重命名(更新别名 + 服务)
hermes profile export coder # 导出到 coder.tar.gz
hermes profile import coder.tar.gz # 从归档导入
删除 Profile
hermes profile delete coder
这会停止网关、移除 systemd/launchd 服务、移除命令别名并删除所有 Profile 数据。你需要输入 Profile 名称来确认。
使用 --yes 跳过确认:hermes profile delete coder --yes
你不能删除默认 Profile(~/.hermes)。要删除一切,使用 hermes uninstall。
Tab 补全
# Bash
eval "$(hermes completion bash)"
# Zsh
eval "$(hermes completion zsh)"
将行添加到你的 ~/.bashrc 或 ~/.zshrc 以获得持久补全。在 -p 后补全 Profile 名称、Profile 子命令和顶级命令。
工作原理
Profiles 使用 HERMES_HOME 环境变量。当你运行 coder chat 时,包装脚本设置 HERMES_HOME=~/.hermes/profiles/coder 然后启动 hermes。由于代码库中 119+ 文件通过 get_hermes_home() 解析路径,一切自动作用域到 Profile 的目录 — 配置、会话、记忆、技能、状态数据库、网关 PID、日志和计划任务。
默认 Profile 就是 ~/.hermes 本身。无需迁移 — 现有安装的工作方式相同。