Skip to content

Profile 系统与发行版

我们可以使用 Hermes 创建多个独立 Agent——一个专门写代码,一个负责运维,一个做研究。

本章介绍 Profile 系统如何在一台机器上运行多个完全隔离的 Agent 实例,以及如何将整个 Agent 打包为发行版共享给他人。


Profile 系统:一台机器,多个独立 Agent

什么是 Profile

Profile 是一个独立的 Hermes 主目录。每个 Profile 拥有自己完全隔离的配置和数据:

bash
~/.hermes/profiles/<name>/
├── config.yaml     # 模型、工具、终端后端等所有设置
├── .env            # API Key、Bot Token(各档案各自独立)
├── SOUL.md         # Agent 人格与身份设定
├── memories/       # 独立的持久记忆(MEMORY.md、USER.md)
├── skills/         # 独立的技能目录
├── cron/           # 独立的定时任务
└── state.db        # 独立的会话历史数据库

关键设计:创建 Profile 后,它自动成为一个独立命令。创建名为 coder 的 Profile,你立即拥有 coder chatcoder setupcoder gateway start 等所有子命令——就像装了一个完全独立的 Hermes 实例。

快速上手

三步创建一个独立的编码助手:

实例

bash

# 步骤一:创建 Profile,自动生成 coder 命令

hermes profile create coder

# 步骤二:配置这个 Profile 的 API Key 和模型

coder setup

# 步骤三:开始聊天

coder chat

三种创建模式

实例

bash

# 模式一:全新 Profile(空白配置,内置技能已预置)

hermes profile create mybot

# 模式二:克隆配置(config.yaml + .env + SOUL.md + 技能,

#          记忆和会话不复制)

hermes profile create work --clone

# 模式三:完整克隆(包括记忆、技能、定时任务、插件,

#          不含会话历史)

hermes profile create backup --clone-all

# 从指定 Profile 克隆

hermes profile create work-backup --clone-from coder --clone-all
模式复制内容不复制内容适用场景
全新(默认)仅内置技能从零开始配置新 Agent
--clone配置、环境变量、人格、技能记忆、会话历史同一 Agent 的不同变体
--clone-all配置、记忆、技能、定时任务、插件会话历史完整备份

切换和使用 Profile

实例

python

# 方式一:使用自动生成的命令别名(最常用)

coder chat

coder gateway start

coder skills list

coder config set model.default anthropic/claude-sonnet-4-6

# 方式二:-p 标志显式指定

hermes -p coder chat

hermes --profile=coder doctor

hermes chat -p coder -q "你好"

# 方式三:设置当前默认(类似 kubectl config use-context)

hermes profile use coder      # 之后直接运行 hermes 就会用 coder

hermes profile use default    # 切回默认

判断当前在哪个 Profile:

  • 命令提示符显示 coder ❯(而非普通的
  • 启动横幅显示 Profile: coder
  • 运行 hermes profile 查看当前 Profile 名称、路径、模型、网关状态

Profile 与工作目录、沙箱的区别

这是最容易混淆的三个概念:

概念控制的内容配置方式
ProfileHermes 自身的状态(配置、记忆、技能、会话)hermes profile create
工作目录终端命令从哪里开始执行terminal.cwd
沙箱文件系统访问范围限制终端后端(docker/modal 等)

Profile 不是沙箱——默认 local 后端下,Agent 仍然拥有和你相同的文件系统权限。如果需要限制访问范围,切换终端后端(见第 05 章)。

让某个 Profile 固定从特定目录开始工作:

实例

bash

# 文件路径:~/.hermes/config.yaml

# 让 coder Profile 固定从项目目录开始

terminal:

  backend: local

  cwd: /absolute/path/to/project

多 Profile 网关:每个 Agent 连接不同平台

每个 Profile 运行自己独立的网关进程,使用各自的 Bot Token:

实例

bash

# 启动各自独立的网关

coder gateway start       # 绑定 coder 的 Telegram Bot

assistant gateway start   # 绑定不同的 Bot

# 安装为持久化系统服务

coder gateway install     # 创建 hermes-gateway-coder systemd 服务

assistant gateway install # 创建 hermes-gateway-assistant 服务

安全防护:如果两个 Profile 意外使用了同一个 Bot Token,第二个网关会立即报错并指出冲突的 Profile 名称,不会发生静默冲突。

Profile 管理命令

实例

javascript

# 列出所有 Profile 及状态

hermes profile list

# 查看某个 Profile 的详细信息

hermes profile show coder

# 重命名(自动更新别名和服务)

hermes profile rename coder dev-bot

# 导出为 coder.tar.gz

hermes profile export coder

# 从存档导入

hermes profile import coder.tar.gz

# 删除(需输入名称确认)

hermes profile delete coder

# 跳过确认直接删除

hermes profile delete coder --yes

不能删除默认 Profile(~/.hermes)。要完全卸载,使用 hermes uninstall。


Profile 发行版:把整个 Agent 共享给他人

Profile Distribution(发行版)将一个完整的 Hermes Agent——人格设定、技能、定时任务、MCP 连接、配置——打包成一个 Git 仓库。

任何人都可以一条命令安装整个 Agent,并在保留自己的记忆、会话和 API Key 的同时接收你的更新。

发行版 vs Profile 备份

维度发行版(Distribution)备份(export/import)
目标受众他人(团队、社区)自己(机器间迁移)
安装方式hermes profile install github.com/...hermes profile import xxx.tar.gz
版本管理Git 仓库 + 标签
更新hermes profile update手动重新导出导入
API Key接收方自行配置包含在导出中

发行版适合场景

  • 向团队分发专用 Agent(合规监控、代码审查、研究助手)
  • 向多台机器部署同一个 Agent,不想手动复制文件
  • 持续迭代 Agent,让接收方通过一条命令拿到最新版本
  • 把 Agent 作为产品分发给社区

创建和发布发行版

第一步:在已有的 Profile 中添加 distribution.yaml

实例

bash

# 文件路径:~/.hermes/profiles/research-bot/distribution.yaml

name: research-bot

version: 1.0.0

description: "自主研究助手,集成 arXiv 和网页工具"

hermes_requires: ">=0.12.0"

author: "你的名字"

license: "MIT"

# 声明接收方需要配置的环境变量

env_requires:

  - name: OPENAI_API_KEY

    description: "OpenAI API Key(用于模型访问)"

    required: true

  - name: SERPAPI_KEY

    description: "SerpAPI Key(用于网页搜索)"

    required: false

    default: ""

第二步:推送到 Git 仓库:

实例

bash

# 进入 Profile 目录,初始化 Git 仓库

cd ~/.hermes/profiles/research-bot

git init

git add .

git commit -m "v1.0.0"

git remote add origin git@github.com:you/research-bot.git

git tag v1.0.0

git push -u origin main --tags

.env 和 auth.json 被自动排除——API Key 不会进入仓库。记忆和会话历史也不会被包含。

安装和更新发行版

实例

sql

# 安装(--alias 会创建同名命令,如 research-bot chat)

hermes profile install github.com/you/research-bot --alias

# 安装后配置 API Key

nano ~/.hermes/profiles/research-bot/.env

# 更新到最新版本(保留自己的记忆和会话)

hermes profile update research-bot

常用命令速查

实例

javascript

# ─── Profile 管理 ───────────────────────────────────────────

hermes profile create <name>                    # 全新创建

hermes profile create <name> --clone            # 克隆配置

hermes profile create <name> --clone-all        # 完整克隆

hermes profile create <name> --clone-from <src> # 从指定档案克隆

hermes profile list                             # 列出所有

hermes profile show <name>                      # 查看详情

hermes profile use <name>                       # 设为默认

hermes profile rename <old> <new>              # 重命名

hermes profile export <name>                    # 导出备份

hermes profile import <file>                    # 导入备份

hermes profile delete <name>                    # 删除

# Profile 命令别名(创建后自动可用)

<name> chat / setup / gateway start / skills list / doctor

# ─── 发行版 ──────────────────────────────────────────────────

hermes profile install github.com/user/repo --alias  # 安装

hermes profile update <name>                         # 更新

AI 思考中...

Hermes Agent Session 生命周期与定时任务

Hermes Agent 部署模式与 Dashboard

基于 VitePress 构建,部署于 GitHub Pages