AI Agent多开不打架:Profile隔离架构与核心命令

一、Profile 基础概念

Profile 实质上是相互隔离的 Agent 实例,各实例配备专属的完整资源集,彼此之间互不干扰。

  • 专属目录路径:~/.hermes/profiles/<名称>/
  • 独享文件清单:config.yaml(模型/工具配置)、.env(密钥存储)、SOUL.md(人设定义)
  • 隔离数据:记忆库 state.db、会话 sessions、技能 skills、定时 cron 以及网关服务

实例化后将自动派生对应的专属命令别名。

二、核心命令

1. 构建 Profile

# 空白新建
hermes profile create coder

# 从当前profile复制配置(不复制.env密钥,安全)
hermes profile create writer --clone

# 从指定profile复制配置
hermes profile create tester --clone-from coder

# 完整克隆(配置+密钥+记忆+会话全复制,慎用,密钥会同步)
hermes profile create backup --clone-all

参数详解:

  • --clone:仅复刻 configSOUL.md,排除 .env(适用于常规克隆场景)
  • --clone-from:明确指定待复制的源 profile 配置
  • --clone-all:全量复刻所有数据,涵盖 API 密钥及历史会话记忆

2. 移除 Profile

# 删除
hermes profile delete

参数详解:

  • delete:彻底移除指定 profile(包含缓存与记忆数据)

3. 其他高频指令

# 查看命令
hermes profile -h
命令 作用 示例
hermes profile list 列出全部 profile hermes profile list
hermes profile current 看当前正在使用哪个 profile hermes profile current
hermes profile use <名字> 切换 profile hermes profile use brand_test
hermes profile show 展示当前 profile 元信息 hermes profile show
hermes profile rename 旧名 新名 重命名 profile hermes profile rename old new
hermes profile export file.yaml 导出当前 profile 配置 hermes profile export brand_test.yaml
hermes profile import file.yaml 导入配置到当前 profile hermes profile import brand_test.yaml
hermes profile alias 配置别名(极少使用)

三、常用操作

变更环境并重启网关以使配置生效

hermes profile use brand_test
hermes gateway stop
hermes gateway start

清空当前 profile 的上下文/缓存(v0.9.0 版本无 reset 指令,需手动移除文件)

hermes profile use brand_test
# 删除会话缓存
rm -rf /root/.hermes/cache/profiles/brand_test
# 可选:删除该profile持久记忆
rm -rf /root/.hermes/memories/brand_test
# 重启网关
hermes gateway restart

复刻现有的 profile 副本(用于配置迁移)

# 切源环境,导出配置
hermes profile use brand_test
hermes profile export brand_test.yaml

# 创建新环境,导入
hermes profile create brand_test_new
hermes profile use brand_test_new
hermes profile import brand_test.yaml

# 重启网关
hermes gateway restart

注意事项:默认的 use 切换在特定场景下可能干扰其他网关配置,引发冲突;若遇此类状况,建议尝试通过 -p 参数单独启动网关

# 直接进入brand_test对话,不切换全局默认
hermes -p brand_test chat

# 直接重启该profile网关(不用先use)
hermes -p brand_test gateway restart

# 查看该profile信息
hermes -p brand_test profile show

# 查看该profile的MCP列表
hermes -p brand_test skills list

# 执行健康检查
hermes -p brand_test doctor

关键避坑:

  • -p gateway start 启动网关仅对当次进程有效;若后台驻留旧 gateway 进程,须先执行 stop 终止旧进程。
  • -p 参数不会篡改 .env 文件;密钥依然维持全局共享状态。

临时测试建议:优先选用 -p 参数,避免污染 shell 的默认 profile。

0

评论0

请先
显示验证码
没有账号?注册  忘记密码?