Hermes进阶操作

一、Profile 基础概念

profile独立隔离的Agen实例,每个拥有完全独立的全套资源互补干扰

  • 独立目录:~/.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:复制 config、SOUL.md,不复制 .env(推荐日常克隆)
  • --clone-from:指定profile复制配置
  • --clone-all:完整复制全部数据,含 API 密钥、历史对话记忆

2.删除Pofile

# 删除
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 设置别名(很少用)

三、常用操作

  1. 切换环境 + 重启网关生效配置

    hermes profile use brand_test
    hermes gateway stop
    hermes gateway start
    
  2. 清理当前 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
    
  3. 复制一套已有 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
    
  4. 需要注意: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
    
  5. 重要坑

    • ‑p gateway start 启动网关,只会对本次进程生效;如果你后台已有旧 gateway 进程,需要先 stop 旧进程。
    • -p 不会修改 .env 文件;密钥依旧全局共用。
    • 建议临时测试:优先用 ‑p,不污染 shell 默认 profile。

文章摘自:https://www.cnblogs.com/wylshkjj/p/22494922