Profiles:运行多个 Agent
在同一台机器上运行多个彼此独立的 Hermes agent——每个 agent 都拥有各自独立的 config、API keys、memory、sessions、skills 和 gateway。
什么是 profile?
Profile 是一个完全隔离的 Hermes 环境。每个 profile 都有自己的目录,其中包含独立的 config.yaml、.env、SOUL.md、memories、sessions、skills、cron jobs 和 state database。Profile 让你可以为不同用途运行不同的 agent——例如 coding assistant、personal bot、research agent——而不会发生任何交叉污染。
当你创建一个 profile 时,它会自动成为一个独立命令。比如你创建了一个名为 coder 的 profile,那么你立刻就可以使用 coder chat、coder setup、coder gateway start 等命令。
快速开始
hermes profile create coder # 创建 profile + "coder" 命令别名coder setup # 配置 API keys 和 modelcoder chat # 开始聊天
就是这么简单。现在 coder 已经是一个完全独立的 agent。它有自己的 config、自己的 memory,自己的一切。
创建 profile
空白 profile
hermes profile create mybot
创建一个全新的 profile,并预置 bundled skills。然后运行 mybot setup 来配置 API keys、model 和 gateway tokens。
仅克隆配置(--clone)
hermes profile create work --clone
会将当前 profile 的 config.yaml、.env 和 SOUL.md 复制到新的 profile 中。也就是说,API keys 和 model 相同,但 sessions 和 memory 会重新开始。你可以编辑 ~/.hermes/profiles/work/.env 来使用不同的 API keys,或者编辑 ~/.hermes/profiles/work/SOUL.md 来设定不同的 personality。
克隆全部内容(--clone-all)
hermes profile create backup --clone-all
复制所有内容——config、API keys、personality、全部 memories、完整 session history、skills、cron jobs、plugins。这相当于一个完整快照。适合做备份,或者 fork 一个已经具备上下文的 agent。
从指定 profile 克隆
hermes profile create work --clone --clone-from coder
:::tip Honcho memory + profiles
当启用 Honcho 时,--clone 会自动为新 profile 创建一个专属的 AI peer,同时共享同一个 user workspace。每个 profile 都会构建自己的 observations 和 identity。详情见 Honcho — Multi-agent / Profiles。
:::
使用 profiles
命令别名
每个 profile 都会自动获得一个位于 ~/.local/bin/<name> 的命令别名:
coder chat # 与 coder agent 聊天coder setup # 配置 coder 的设置coder gateway start # 启动 coder 的 gatewaycoder doctor # 检查 coder 的健康状态coder skills list # 列出 coder 的 skillscoder config set model.model anthropic/claude-sonnet-4
这个别名适用于所有 hermes 子命令——本质上它只是底层执行 hermes -p <name>。
-p 参数
你也可以在任何命令中显式指定 profile:
hermes -p coder chathermes --profile=coder doctorhermes chat -p coder -q "hello" # 放在任何位置都可以
粘性默认值(hermes profile use)
hermes profile use coderhermes chat # 现在会默认作用于 coderhermes tools # 配置 coder 的 toolshermes profile use default # 切换回默认 profile
这会设置一个默认 profile,让普通的 hermes 命令都指向它。类似于 kubectl config use-context。
知道自己当前在哪个 profile
CLI 会始终显示当前激活的是哪个 profile:
- Prompt:
coder ❯,而不是单纯的❯ - Banner:启动时显示
Profile: coder hermes profile:显示当前 profile 名称、路径、model、gateway 状态
运行 gateways
每个 profile 都会以独立进程运行自己的 gateway,并使用各自独立的 bot token:
coder gateway start # 启动 coder 的 gatewayassistant gateway start # 启动 assistant 的 gateway(独立进程)
不同的 bot tokens
每个 profile 都有自己的 .env 文件。你可以在每个 profile 中配置不同的 Telegram / Discord / Slack bot token:
# 编辑 coder 的 tokensnano ~/.hermes/profiles/coder/.env# 编辑 assistant 的 tokensnano ~/.hermes/profiles/assistant/.env
安全机制:token locks
如果两个 profile 不小心使用了同一个 bot token,第二个 gateway 会被阻止启动,并给出清晰的错误信息,指出发生冲突的 profile。该机制支持 Telegram、Discord、Slack、WhatsApp 和 Signal。
持久化服务
coder gateway install # 创建 hermes-gateway-coder systemd / launchd serviceassistant gateway install # 创建 hermes-gateway-assistant service
每个 profile 都会有自己独立的 service 名称,它们彼此独立运行。
配置 profiles
每个 profile 都拥有独立的:
config.yaml—— model、provider、toolsets 以及所有设置.env—— API keys、bot tokensSOUL.md—— personality 和 instructions
coder config set model.model anthropic/claude-sonnet-4echo "You are a focused coding assistant." > ~/.hermes/profiles/coder/SOUL.md
更新
hermes update 只会拉取一次共享代码,并自动将新的 bundled skills 同步到所有 profiles:
hermes update# → Code updated (12 commits)# → Skills synced: default (up to date), coder (+2 new), assistant (+2 new)
用户修改过的 skills 永远不会被覆盖。
管理 profiles
hermes profile list # 显示所有 profiles 及其状态hermes profile show coder # 显示某个 profile 的详细信息hermes profile rename coder dev-bot # 重命名(会更新 alias 和 service)hermes profile export coder # 导出为 coder.tar.gzhermes profile import coder.tar.gz # 从归档中导入
删除 profile
hermes profile delete coder
这会停止 gateway,移除 systemd / launchd service,移除命令别名,并删除该 profile 的所有数据。系统会要求你输入 profile 名称以确认操作。
使用 --yes 可以跳过确认:hermes profile delete coder --yes
Tab completion
# Basheval "$(hermes completion bash)"# Zsheval "$(hermes completion zsh)"
将这一行添加到 ~/.bashrc 或 ~/.zshrc 中,即可启用持久化补全。它支持补全 -p 后的 profile 名称、profile 子命令以及顶层命令。
工作原理
Profile 依赖 HERMES_HOME 环境变量。当你运行 coder chat 时,wrapper script 会先设置 HERMES_HOME=~/.hermes/profiles/coder,然后再启动 hermes。由于代码库中已有 119+ 个文件通过 get_hermes_home() 来解析路径,因此所有内容都会自动作用域化到该 profile 的目录下——包括 config、sessions、memory、skills、state database、gateway PID、logs 和 cron jobs。
默认 profile 本质上就是 ~/.hermes 本身。不需要迁移——现有安装会保持完全一致的行为。
