多配置 (Profiles)
Profiles(配置文件)是 Hermes 的隔离环境系统,允许您为不同的用途、项目或身份创建完全独立的 Hermes 实例,每个实例拥有独立的配置、记忆和会话历史。
什么是 Profile
每个 Profile 是一个完全隔离的 Hermes 环境,包含:
~/.hermes/profiles/
├── default/ # 默认 Profile
│ ├── config.yaml # 独立配置
│ ├── memories/
│ │ ├── MEMORY.md # 独立记忆
│ │ └── USER.md
│ ├── state.db # 独立会话数据库
│ └── skills/ # 独立技能(可选)
├── work/ # 工作 Profile
│ ├── config.yaml # 不同的模型、工具集配置
│ ├── memories/
│ │ ├── MEMORY.md # 工作相关记忆
│ │ └── USER.md
│ └── state.db
└── personal/ # 个人 Profile
├── config.yaml
├── memories/
└── state.db关键隔离点:不同 Profile 之间的配置、记忆、会话历史完全不共享,互不干扰。
为什么需要多 Profile
工作与个人隔离
- 工作 Profile:连接公司 API、存储工作项目记忆、使用企业模型
- 个人 Profile:连接个人账户、存储私人信息、使用个人偏好设置
多客户隔离
为不同客户创建独立 Profile,确保客户 A 的信息不会出现在客户 B 的上下文中:
bash
hermes -p client-alpha "帮我分析这份合同"
hermes -p client-beta "审查代码库"多机器人隔离
每个 Telegram / Discord 机器人实例需要独立的 Bot Token,而每个 Bot Token 对应一个 Profile:
yaml
# work profile 的 config.yaml
telegram:
token: "bot_token_for_work_bot"
# personal profile 的 config.yaml
telegram:
token: "bot_token_for_personal_bot"实验性配置测试
在不影响主 Profile 的情况下测试新配置:
bash
hermes profile create test-config --clone-all
# 修改 test-config 的配置,测试新模型或工具集
hermes -p test-config chathermes profile 命令
list — 列出所有 Profile
bash
hermes profile list输出:
NAME ALIAS SESSIONS LAST USED DESCRIPTION
----------- ------ -------- ------------------- ------------------
* default — 234 2025-04-07 15:23 默认配置
work w 89 2025-04-07 14:00 工作项目
personal p 45 2025-04-06 22:30 个人使用
client-a ca 12 2025-04-05 10:15 客户 Alpha 项目
* 当前活跃 Profileuse — 切换当前 Profile
bash
# 切换到 work profile
hermes profile use work
# 切换到 default
hermes profile use default切换后,后续所有 hermes 命令都使用新 Profile,直到再次切换。
create — 创建新 Profile
bash
# 创建空白 Profile
hermes profile create work
# 克隆现有 Profile 的配置(但不克隆会话历史)
hermes profile create work-v2 --clone work
# 克隆所有内容(配置 + 记忆 + 会话历史)
hermes profile create work-backup --clone-all work--clone-all 选项会完整复制源 Profile 的所有数据,适合创建备份或从现有 Profile 衍生新 Profile。
delete — 删除 Profile
bash
# 删除 Profile(需确认)
hermes profile delete test-config
# 强制删除(不确认)
hermes profile delete test-config --force注意:无法删除当前活跃的 Profile,需要先切换到其他 Profile。
show — 查看 Profile 详情
bash
hermes profile show work输出:
Profile: work
路径: ~/.hermes/profiles/work/
创建时间: 2025-03-15 10:00:00
最后使用: 2025-04-07 14:00:32
配置:
模型: claude-opus-4-5
工具集: web, terminal, file, browser, vision
Telegram Bot: 已配置
记忆:
MEMORY.md: 1,834 字符
USER.md: 987 字符
会话:
总数: 89
本月: 23
数据库大小: 45 MBalias — 设置别名
为 Profile 设置简短别名,便于快速切换:
bash
# 设置别名
hermes profile alias work w
hermes profile alias personal p
hermes profile alias client-alpha ca
# 使用别名
hermes -p w chat
hermes -p ca "分析最新合同"rename — 重命名 Profile
bash
hermes profile rename test-config experimentalexport — 导出 Profile
将整个 Profile 打包为可移植的压缩文件:
bash
# 导出到当前目录
hermes profile export work
# 导出到指定路径
hermes profile export work --output ~/backups/work-profile-2025-04.tar.gz
# 导出时排除会话历史(只导出配置和记忆)
hermes profile export work --no-sessions --output work-config-only.tar.gzimport — 导入 Profile
bash
# 导入 Profile(如已存在同名 Profile 则失败)
hermes profile import work-profile-2025-04.tar.gz
# 导入并重命名
hermes profile import work-profile-2025-04.tar.gz --name work-restored
# 覆盖已存在的 Profile
hermes profile import work-profile-2025-04.tar.gz --overwrite使用 Profile
命令行指定
使用 -p 或 --profile 参数临时使用指定 Profile,不影响全局活跃 Profile:
bash
# 使用 work profile 开始聊天
hermes -p work chat
# 使用 work profile 的别名
hermes -p w "帮我审查这个 PR"
# 使用 personal profile 运行定时任务
hermes -p p cron list环境变量
bash
# 通过环境变量指定 Profile
export HERMES_PROFILE=work
hermes chat
# 单次使用
HERMES_PROFILE=work hermes chatShell 别名(推荐工作流)
在 ~/.bashrc 或 ~/.zshrc 中设置快捷别名:
bash
alias hw="hermes -p work"
alias hp="hermes -p personal"
alias hca="hermes -p client-alpha"
# 使用
hw "帮我分析这个 Go 文件的性能问题"
hp "明天的行程安排是什么"Profile 配置示例
工作 Profile(config.yaml)
yaml
# ~/.hermes/profiles/work/config.yaml
model: claude-opus-4-5
toolsets:
- web
- terminal
- file
- browser
- vision
- memory
- todo
telegram:
token: "${WORK_BOT_TOKEN}"
allowed_users: [123456789, 987654321]
memory:
provider: mem0
api_key: "${MEM0_API_KEY}"
stt:
provider: groq
api_key: "${GROQ_API_KEY}"
tts:
provider: edge_tts
voice: zh-CN-YunxiNeural个人 Profile(config.yaml)
yaml
# ~/.hermes/profiles/personal/config.yaml
model: claude-sonnet-4-5 # 节省成本
toolsets:
- web
- vision
- tts
- memory
- todo
- cronjob
telegram:
token: "${PERSONAL_BOT_TOKEN}"
tts:
provider: edge_tts
voice: zh-CN-XiaoxiaoNeural跨 Profile 操作
虽然 Profile 之间完全隔离,但某些操作支持跨 Profile:
bash
# 从 work profile 导出特定会话到 personal profile
hermes -p work sessions export abc123 | hermes -p personal sessions import
# 同步技能(技能可以在多个 Profile 间共享)
hermes profile sync-skills --from work --to personal迁移与分享
Profile 的导出/导入功能适合以下场景:
- 设备迁移:从旧设备迁移到新设备时保留所有配置
- 团队共享:分享标准化的工作 Profile 给团队成员(导出时排除敏感信息)
- 定期备份:将关键 Profile 备份到云存储
bash
# 定期备份脚本示例
#!/bin/bash
DATE=$(date +%Y%m%d)
hermes profile export work --output ~/Dropbox/hermes-backups/work-$DATE.tar.gz
hermes profile export personal --no-sessions --output ~/Dropbox/hermes-backups/personal-config-$DATE.tar.gz
echo "Backup completed: $DATE"