文档来源:hermes-agent.nousresearch.com/docs/user-g…
最后更新:2026-04-22
概述
Profiles(配置文件) 允许在同一台机器上运行多个独立的 Hermes Agent,每个 Agent 拥有:
- 独立的配置文件 (config.yaml)
- 独立的 API 密钥 (.env)
- 独立的人格设定 (SOUL.md)
- 独立的记忆 (memories)
- 独立的会话历史 (sessions)
- 独立的技能 (skills)
- 独立的定时任务 (cron jobs)
- 独立的状态数据库
使用场景:可以为不同用途创建不同的 Agent,例如:
- 编程助手 (coding assistant)
- 个人机器人 (personal bot)
- 研究助手 (research agent)
核心概念
什么是 Profile?
一个 Profile 是一个独立的 Hermes 主目录。创建名为 coder 的 Profile 后,会自动获得以下命令别名:
coder chat- 开始聊天coder setup- 配置设置coder gateway start- 启动网关coder doctor- 检查健康状态coder skills list- 列出技能coder config set model.model anthropic/claude-sonnet-4- 配置模型
创建 Profile
1. 空白 Profile(Blank Profile)
hermes profile create mybot
- 创建全新的 Profile,包含默认的技能包
- 运行
mybot setup配置 API 密钥、模型和网关令牌
2. 仅克隆配置(--clone)
hermes profile create work --clone
- 复制当前 Profile 的
config.yaml、.env和SOUL.md - 相同的 API 密钥和模型,但全新的会话和记忆
- 可编辑
~/.hermes/profiles/work/.env使用不同的 API 密钥 - 可编辑
~/.hermes/profiles/work/SOUL.md设置不同的人格
3. 克隆所有内容(--clone-all)
hermes profile create backup --clone-all
- 复制所有内容:配置、API 密钥、人格、所有记忆、完整会话历史、技能、定时任务、插件
- 适用于备份或分叉已有上下文的 Agent
4. 从指定 Profile 克隆
hermes profile create work --clone --clone-from coder
- 从指定的
coderProfile 克隆配置
5. Honcho 记忆 + Profiles
当 Honcho 启用时,--clone 会自动为新 Profile 创建专用的 AI peer,同时共享相同的用户工作区。每个 Profile 建立自己的观察和身份。
使用 Profile
命令别名
每个 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" # -p 可以放在任何位置
设置默认 Profile(Sticky Default)
hermes profile use coder
hermes chat # 现在默认使用 coder
hermes tools # 配置 coder 的工具
hermes profile use default # 切换回默认
类似于 kubectl config use-context
确认当前 Profile
CLI 始终显示当前激活的 Profile:
- 提示符:
coder ❯而不是❯ - 启动横幅:显示
Profile: coder - hermes profile 命令:显示当前 Profile 名称、路径、模型、网关状态
Profile vs Workspace vs 沙盒
这是常见的混淆点,需要明确区分:
概念
说明
Profile
给 Hermes 独立的状态目录(config.yaml、.env、SOUL.md、sessions、memory、logs、cron jobs、gateway state)
Workspace
终端命令的工作目录,由 terminal.cwd 单独控制
Sandbox
限制文件系统访问的机制,Profile 不提供沙盒功能
重要注意事项
-
默认本地终端后端:Agent 仍具有与用户账户相同的文件系统访问权限
-
Profile 不会阻止 Agent 访问 Profile 目录外的文件夹
-
如需让 Profile 在特定项目文件夹中启动,在
config.yaml中设置绝对路径:terminal: backend: local cwd: /absolute/path/to/project
-
使用
cwd: "."在本地后端表示 "Hermes 启动时的目录",不是 "Profile 目录" -
SOUL.md可以指导模型,但不强制执行工作区边界 -
SOUL.md的更改在新会话中生效,现有会话可能仍使用旧的提示状态 -
询问模型 "你在哪个目录?" 不是可靠的隔离测试方法
运行网关(Gateway)
独立进程
每个 Profile 运行独立的网关节程,拥有独立的 Bot Token:
coder gateway start # 启动 coder 的网关
assistant gateway start # 启动 assistant 的网关(独立进程)
配置不同的 Bot Token
每个 Profile 有自己的 .env 文件:
# 编辑 coder 的令牌
nano ~/.hermes/profiles/coder/.env
# 编辑 assistant 的令牌
nano ~/.hermes/profiles/assistant/.env
安全:令牌锁定(Token Locks)
如果两个 Profile 意外使用相同的 Bot Token,第二个网关会被阻止并显示明确的错误信息,指出冲突的 Profile 名称。
支持的平台:Telegram、Discord、Slack、WhatsApp、Signal
持久化服务
coder gateway install # 创建 hermes-gateway-coder systemd/launchd 服务
assistant gateway install # 创建 hermes-gateway-assistant 服务
每个 Profile 有独立的服务名称,独立运行。
配置 Profile
每个 Profile 拥有独立的:
文件
用途
config.yaml
模型、Provider、工具集、所有设置
.env
API 密钥、Bot Token
SOUL.md
人格设定和指令
配置示例
# 设置模型
coder config set model.model anthropic/claude-sonnet-4
# 设置人格
echo "You are a focused coding assistant." > ~/.hermes/profiles/coder/SOUL.md
# 设置默认工作目录
coder config set terminal.cwd /absolute/path/to/project
更新 Profile
hermes update
# → Code updated (12 commits)
# → Skills synced: default (up to date), coder (+2 new), assistant (+2 new)
hermes update一次性拉取代码(共享)- 自动同步新技能到所有 Profile
- 用户修改的技能不会被覆盖
管理 Profile
查看和管理
hermes profile list # 显示所有 Profile 及状态
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 子命令
- 顶级命令
工作原理
HERMES_HOME 环境变量
Profile 使用 HERMES_HOME 环境变量实现隔离。
运行 coder chat 时,包装脚本会设置:
HERMES_HOME=~/.hermes/profiles/coder
然后启动 hermes。
路径解析
代码库中 119+ 文件通过 get_hermes_home() 解析路径,因此 Hermes 状态自动限定在 Profile 目录内:
- 配置
- 会话
- 记忆
- 技能
- 状态数据库
- 网关 PID
- 日志
- 定时任务
与工作目录的关系
- 工具执行从
terminal.cwd开始(或在本地后端使用cwd: "."时为启动目录) - 不是自动从
HERMES_HOME开始
默认 Profile
默认 Profile 就是 ~/.hermes 本身,无需迁移,现有安装工作方式不变。
快速开始示例
# 1. 创建 Profile
hermes profile create coder
# 2. 配置 API 密钥和模型
coder setup
# 3. 开始聊天
coder chat
完成!coder 现在是一个独立的 Hermes Profile,拥有自己的配置、记忆和状态。
目录结构
~/.hermes/ # 默认 Profile
├── config.yaml
├── .env
├── SOUL.md
├── memories/
├── sessions/
├── skills/
├── cron/
└── ...
~/.hermes/profiles/coder/ # coder Profile
├── config.yaml
├── .env
├── SOUL.md
├── memories/
├── sessions/
├── skills/
├── cron/
└── ...
~/.hermes/profiles/assistant/ # assistant Profile
├── config.yaml
├── .env
├── SOUL.md
├── memories/
├── sessions/
├── skills/
├── cron/
└── ...
最佳实践
- 用途分离:为不同用途创建不同 Profile(编程、研究、写作等)
- API 密钥管理:使用
--clone创建新 Profile 后,根据需要修改.env使用不同的 API 密钥 - 人格定制:为每个 Profile 定制
SOUL.md以匹配其用途 - 工作目录配置:在
config.yaml中明确设置terminal.cwd以确保可预测的起始目录 - 定期备份:使用
--clone-all创建完整备份 - 服务隔离:每个 Profile 的网关服务独立运行,便于管理