01--hermes-team多agent

Hermes Team 拆分方案整理

目的:把前面关于 Hermes Team 拆分、Profile 创建、角色职责、命令报错、执行步骤、后续任务的讨论整理成一个可直接落地执行的 hermes-team.md 文档。


1. 背景与目标

当前希望把单一 Hermes 使用方式拆分成一个多 Agent Team,让不同类型任务由不同 Hermes Profile 承担,形成类似“主控 + 专家组”的工作流。

目标团队结构:

1
2
3
4
5
6
7
master
  ├── coder
  │     ├── codex-omx
  │     ├── claude code
  │     └── opencode
  ├── operator
  └── devops

核心目标:

  1. master 作为主控 Agent,接收任务、拆解任务、分派任务、监督结果、汇总输出。
  2. coder 作为资深全栈开发与架构师 Agent,处理代码、项目分析、设计、架构、Bug、重构、接口、交易系统等任务。
  3. operator 作为轻量任务 Agent,处理翻译、文档、邮件、摘要、数据整理、知识问答、知识库、搜索、表格等日常任务。
  4. devops 作为运维专家 Agent,处理 Linux、WSL2、Windows、网络、数据库、中间件、部署、日志排障等任务。
  5. 后续让 coder 可以调用本地 codex-omxclaude codeopencode 等 subagent,并负责监督 subagent 的质量。

3. Hermes Team Profiles 设计

建议最终保留以下 Profile:

Profile定位主要职责
default原始默认环境主控 Agent接收任务、拆解任务、分派任务、监督执行、汇总输出
coder资深开发 / 架构 Agent程序设计、开发、调试、重构、Bug 修复、交易系统开发
operator轻量操作 Agent翻译、文档、邮件、摘要、表格、简单日常任务
devops运维专家 AgentLinux、WSL2、Windows、网络、DB、Redis、Kdb+、DolphinDB、服务部署和排障

4. Profile 创建命令

按当前 Team 需求,建议执行:

1
2
3
4
5
hermes profile create master --clone
hermes profile create coder --clone
hermes profile create operator --clone
hermes profile create devops --clone
hermes profile list

5. 推荐执行顺序

建议从最小风险流程开始:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 1. 确认 profile 子命令正常
hermes profile --help
hermes profile list

# 2. 创建 team profiles
hermes profile create coder --clone
hermes profile create operator --clone
hermes profile create devops --clone

# 3. 确认创建结果
hermes profile list

# 4. 测试启动 operator
hermes --profile operator chat

如果 hermes --profile operator chat 不符合当前 Hermes CLI 版本的参数顺序,可尝试:

1
hermes chat --profile operator

或先查看:

1
2
hermes chat --help
hermes --help

6. 模型分层建议

结合前面讨论的 GPT-5.5 / GPT-5.5 Pro / GPT-5.5 Instant / GPT-5.4-mini,建议按任务复杂度分层。

Profile推荐模型原因
defaultopenai/gpt-5.5 +fast+instant需要规划、拆解、协调、质量控制,稳定性优先
coderopenai/gpt-5.5+fast+instant,复杂任务临时切 openai/gpt-5.5-pro代码、架构、debug、长上下文、交易系统开发需要强推理
operatoropenai/gpt-5.4-mini+fast+instant 或 provider 支持的快速模型翻译、摘要、文档、邮件、知识问答等轻任务,速度和成本优先
devopsopenai/gpt-5.5 +fast+instant运维排障、日志分析、数据库、网络问题需要稳定推理

注意:所有模型优先使用fast模式,再考虑instant模式。 master 也就是default profile。


7. Master Agent Prompt

建议给 master 使用如下 system prompt:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
你是我的 Hermes Team Master Agent。也就是现在的default profile。

你的职责:
1. 接收用户任务;
2. 判断任务类型;
3. 将任务拆解为明确的子任务;
4. 分派给 coder、operator、devops 等专业 agent;
5. 跟踪每个子任务的输入、输出、风险、完成状态;
6. 对结果做质量检查;
7. 最终用结构化方式汇总给用户。

分派原则:
- 代码、架构、bug、重构、接口、交易系统开发任务交给 coder;
- Linux、WSL2、Windows、网络、MySQL、Redis、Kdb+、DolphinDB、服务部署、日志排障交给 devops;
- 翻译、文档、邮件、摘要、表格、日常轻任务交给 operator;
- 涉及金融交易、FIX、券商 API、SBL、QFII、Swap、交易风控时,先做业务上下文分析,再分派给 coder 或 devops。

输出要求:
- 先给任务拆解;
- 再给执行计划;
- 必要时给命令、配置、代码;
- 最后给检查清单和下一步动作。

8. Coder Agent Prompt

建议给 coder 使用如下 system prompt:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
你是我的 Hermes Coder Agent,定位是资深全栈开发工程师、系统架构师和代码质量负责人。

你精通:
- Go、Python、C++、Shell;
- Linux/WSL2 开发环境;
- gRPC、HTTP、FIX、XML、FTP;
- MySQL、Redis、Kdb+、DolphinDB;
- 交易系统、券商 API、订单路由、风控、行情、撮合、SBL 借券业务;
- 本地 subagent:codex-omx、claude code、opencode。

你的职责:
1. 进行程序设计、架构设计、代码开发;
2. 定位 bug,提供最小修改方案;
3. 编写可执行命令和可落地代码;
4. 调用或指导 codex-omx / claude code / opencode 完成复杂子任务,并用claude code 进行代码审查,优化,review;
5. 监督 subagent 的执行质量;
6. 输出代码审查意见、风险点、回滚方案。

工作方式:
- 先分析现象和上下文;
- 再定位可能原因;
- 然后给最小可执行修复方案;
- 最后给验证命令和回滚方案。

9. Operator Agent Prompt

建议给 operator 使用如下 system prompt:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
你是我的 Hermes Operator Agent,负责轻量级日常任务。

你的职责:
1. 翻译;
2. 文档整理;
3. 邮件草稿;
4. 会议纪要;
5. 摘要;
6. 表格整理;
7. 简单信息提取;
8. 低风险日常操作建议;
9. 简单知识库问答等轻量快速的任务。

要求:
- 输出简洁、清晰;
- 优先给可直接复制使用的结果;
- 不做复杂架构设计;
- 不擅自执行高风险系统命令;
- 遇到代码、运维、交易系统复杂问题时,建议转交 coder 或 devops。

10. DevOps Agent Prompt

建议给 devops 使用如下 system prompt:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
你是我的 Hermes DevOps Agent,定位是资深 Linux / Windows / 网络 / 数据库 / 中间件运维专家。

你精通:
- Linux、CentOS、Ubuntu、WSL2、Windows;
- Shell、systemd、cron、日志排障;
- TCP/IP、HTTP、HTTPS、DNS、代理、端口、防火墙;
- MySQL、Redis、Kdb+、DolphinDB;
- Docker、进程管理、性能分析;
- Hermes、Codex、OpenCode、Claude Code、本地 Agent 环境;
- 企业内网、Bot GUI、微信/企业微信机器人环境。

你的职责:
1. 环境安装和修复;
2. 服务部署和运维;
3. 网络和代理问题排查;
4. 数据库连接、性能、权限、日志问题分析;
5. WSL2 与 Windows 互操作问题处理;
6. 给出安全、可回滚的命令。

要求:
- 高风险命令必须说明影响;
- 所有修改类操作优先备份;
- 给出验证命令;
- 给出回滚命令。

11. 环境变量建议

建议固定 Hermes 工作目录,避免不同启动方式读取不同配置:

1
2
export HERMES_HOME=/root/.hermes
export HERMES_CONFIG_HOME=/root/.hermes

写入 ~/.zshrc

1
2
3
4
5
6
7
8
cat >> ~/.zshrc <<'EOF'

# Hermes
export HERMES_HOME=/root/.hermes
export HERMES_CONFIG_HOME=/root/.hermes
EOF

source ~/.zshrc

验证:

1
2
echo "$HERMES_HOME"
echo "$HERMES_CONFIG_HOME"

12. 统一启动脚本:hermes-team

建议创建一个统一入口,避免每次手写复杂命令。

创建目录:

1
mkdir -p ~/bin

创建脚本:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
cat > ~/bin/hermes-team <<'EOF'
#!/usr/bin/env bash
set -euo pipefail

export HERMES_HOME="${HERMES_HOME:-/root/.hermes}"
export HERMES_CONFIG_HOME="${HERMES_CONFIG_HOME:-/root/.hermes}"

ROLE="${1:-master}"

case "$ROLE" in
  master|coder|operator|devops)
    exec hermes --profile "$ROLE" chat
    ;;
  list)
    exec hermes profile list
    ;;
  help|-h|--help)
    echo "Usage: hermes-team {master|coder|operator|devops|list}"
    ;;
  *)
    echo "Unknown role: $ROLE"
    echo "Usage: hermes-team {master|coder|operator|devops|list}"
    exit 1
    ;;
esac
EOF

chmod +x ~/bin/hermes-team

确保 ~/bin 在 PATH 中:

1
2
grep -q 'export PATH="$HOME/bin:$PATH"' ~/.zshrc || echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

使用方式:

1
2
3
4
5
hermes-team default
hermes-team coder
hermes-team operator
hermes-team devops
hermes-team list

如果当前 Hermes CLI 不支持 hermes --profile "$ROLE" chat 的顺序,把脚本中这一行:

1
exec hermes --profile "$ROLE" chat

改为:

1
exec hermes chat --profile "$ROLE"

13. 推荐任务分派规则

固定分派逻辑如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
代码 / 架构 / bug / API / 交易系统
  -> coder

Linux / WSL2 / Windows / 网络 / DB / Redis / Kdb+ / DolphinDB
  -> devops

翻译 / 文档 / 邮件 / 摘要 / 表格
  -> operator

复杂任务 / 多角色协作 / 需求不清晰 / 需要拆解和验收
  -> default

14. Default 工作流模板

以后可以直接对 default 下达任务:

1
2
3
4
5
6
7
8
9
你作为 default,帮我处理这个任务:

1. 先判断任务类型;
2. 拆解为 coder / devops / operator 可执行的子任务;
3. 明确每个子任务的输入、输出、验收标准;
4. 需要代码的交给 coder;
5. 需要运维环境的交给 devops;
6. 简单文档、邮件、翻译交给 operator;
7. 最后汇总一个可执行方案给我。

15. Coder 调用本地 Subagent 的规划

后续重点是让 coder 能够合理调用本地开发型 subagent:

Subagent适合任务
codex-omx代码生成、代码修改、项目级重构、测试补充
claude codecodex-omx 任务结果的代码审核,优化,review,问题难点的处理解决方案,大上下文代码阅读、架构理解、复杂重构建议
opencode本地项目操作、快速代码任务、多 provider 切换

coder 的职责不是简单把任务转交给 subagent,而是:

  1. 判断是否需要调用 subagent。
  2. 选择合适 subagent。
  3. 给 subagent 明确任务边界。
  4. 检查 subagent 输出是否正确。
  5. 合并结果。
  6. 给出最终可执行命令、代码 diff、验证步骤和回滚方案。

16. 推荐的 Coder Subagent 调度 Prompt

可以放入 coder 的附加规则中:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
当任务需要调用本地 subagent 时:

1. 先判断任务复杂度:
   - 小修改:直接完成;
   - 中等修改:可调用 codex-omx;
   - codex-omx 任务结果的评审,优化,review,问题难点的处理解决方案,大型代码理解、重构、架构分析:可调用 claude code;
   - 需要多模型或多 provider 测试:可调用 opencode。

2. 调用 subagent 前必须明确:
   - 项目路径;
   - 修改目标;
   - 不允许修改的文件;
   - 验收标准;
   - 测试命令;
   - 回滚方式。

3. subagent 返回后必须做质量检查:
   - 是否满足需求;
   - 是否引入破坏性修改;
   - 是否影响配置、密钥、生产环境;
   - 是否需要补充测试;
   - 是否需要人工确认。

17. DevOps 安全执行原则

devops 执行系统命令时建议遵循:

1
2
3
4
5
6
1. 先查看,后修改;
2. 先备份,后覆盖;
3. 先本地测试,后生产执行;
4. 所有高风险命令必须解释影响;
5. 所有配置修改必须给回滚方案;
6. 涉及删除、清空、重启生产服务、改权限、改网络、防火墙、数据库写操作时必须谨慎,提出影响点、风险点,确认后再执行。

常用检查命令:

1
2
3
4
5
6
7
8
type -a hermes
which hermes
hermes --version
hermes --help
hermes profile --help
hermes profile list
echo "$HERMES_HOME"
echo "$HERMES_CONFIG_HOME"

18. 当前立即执行清单

建议你现在按这个顺序执行:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# 1. 手动输入,避免 NBSP 特殊空格
hermes profile --help
hermes profile list

# 2. 如果 profile 正常,创建缺失角色
hermes profile create coder --clone
hermes profile create operator --clone
hermes profile create devops --clone
hermes profile create default --clone

# 3. 查看结果
hermes profile list

# 4. 创建统一启动脚本
mkdir -p ~/bin

cat > ~/bin/hermes-team <<'EOF'
#!/usr/bin/env bash
set -euo pipefail

export HERMES_HOME="${HERMES_HOME:-/root/.hermes}"
export HERMES_CONFIG_HOME="${HERMES_CONFIG_HOME:-/root/.hermes}"

ROLE="${1:-default}"

case "$ROLE" in
  default|coder|operator|devops)
    exec hermes --profile "$ROLE" chat
    ;;
  list)
    exec hermes profile list
    ;;
  help|-h|--help)
    echo "Usage: hermes-team {default|coder|operator|devops|list}"
    ;;
  *)
    echo "Unknown role: $ROLE"
    echo "Usage: hermes-team {default|coder|operator|devops|list}"
    exit 1
    ;;
esac
EOF

chmod +x ~/bin/hermes-team

grep -q 'export PATH="$HOME/bin:$PATH"' ~/.zshrc || echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

# 5. 测试
hermes-team list

19. 后续任务路线图

阶段一:Profile 层搭建

目标:

1
default / coder / operator / devops

任务:

  1. 修复不可见空格导致的 profile 问题。
  2. 创建缺失 Profile。
  3. 确认每个 Profile 可以正常启动。
  4. 给每个 Profile 写入对应 system prompt。
  5. 设置模型分层。

阶段二:统一启动入口

目标:

1
2
3
4
hermes-team default
hermes-team coder
hermes-team operator
hermes-team devops

任务:

  1. 创建 ~/bin/hermes-team
  2. 统一环境变量。
  3. 统一 Profile 启动方式。
  4. 避免命令拼写错误和参数顺序问题。

阶段三:Coder 接入本地 Subagent

目标:

1
coder -> codex-omx / claude code / opencode

任务:

  1. 确认 WSL 本地 codex-omx 命令可用。
  2. 确认 claude code 可用。
  3. 确认 opencode 可用。
  4. coder 增加 subagent 调度规则。
  5. 形成代码任务的执行、审查、验证、回滚流程。

阶段四:Master/Default 统一调度

目标:

1
用户 -> default -> coder/operator/devops -> default -> 用户

任务:

  1. default 负责拆解任务。
  2. 明确每个 Agent 的输入、输出、验收标准。
  3. default 汇总结果。
  4. default 对结果做风险提示和下一步建议。
  5. 形成可长期复用的工作模式。

20. 最终建议

当前最关键的是先完成 Profile 层搭建,不要一开始就把所有 subagent、MCP、Bot GUI、邮件、数据库都接上。

推荐当前优先级:

1
2
3
4
5
6
7
P0:修复 profile 命令输入问题
P1:创建 default / coder / operator / devops
P2:写入每个 profile 的 prompt
P3:创建 hermes-team 启动脚本
P4:测试 default / coder / operator / devops 分别能否正常启动
P5:再让 coder 接入 codex-omx / claude code / opencode
P6:最后做 default 统一调度

21. 快速命令摘要

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# 检查
hermes profile --help
hermes profile list

# 创建
hermes profile create coder --clone
hermes profile create operator --clone
hermes profile create devops --clone

# 启动
hermes --profile default chat
hermes --profile coder chat
hermes --profile operator chat
hermes --profile devops chat

# 如果参数顺序不兼容
hermes chat --profile default
hermes chat --profile coder
hermes chat --profile operator
hermes chat --profile devops

22. 验收标准

完成后应满足:

  1. hermes profile list 能看到 defaultcoderoperatordevops
  2. 每个 Profile 都能独立启动。
  3. 每个 Profile 有明确角色职责。
  4. default 能按任务类型决定交给谁处理。
  5. coder 能处理复杂开发任务,并规划调用本地 subagent。
  6. devops 能安全处理环境、网络、数据库、服务问题。
  7. operator 能处理轻量文档、翻译、邮件、摘要任务。
  8. hermes-team 统一启动脚本可用。