赫尔墨斯-克劳德密码
Hermes计划和协调,而Claude Code处理实际的实现——读取文件、编写代码、运行命令、提交等等。
运作原理
Hermes (coordinator)
│
├─→ claude_code_delegate("implement auth middleware in /app")
│ └─→ claude -p "implement auth middleware..." --permission-mode bypassPermissions
│ └─→ [reads files, writes code, runs tests, returns result]
│
├─→ claude_code_research("how does the payment flow work in /api")
│ └─→ claude -p "READ-ONLY: how does..." --tools Read Glob Grep Bash Agent
│
└─→ claude_code_batch([task1, task2, task3]) ← parallel execution
├─→ claude -p "task 1..." &
├─→ claude -p "task 2..." &
└─→ claude -p "task 3..." &特性
claude_code_delegate--发送自主编码任务(读写访问)claude_code_research--只读代码库探索和分析claude_code_batch--最多并行运行5个任务claude_code_continue--恢复多回合工作流的上一个会话(仅限MCP)- 模型选择 --路线到
opus(复杂),sonnet(标准),或haiku(简单) - 会话连续性 --通行证
session_id继续以前的工作 - 预算控制 --设置
max_budget_usd每项任务 - 工具限制 --限制Claude Code可以使用的工具
- 多目录 --授予对其他目录的访问权限
add_dirs
安装
先决条件
快速安装
git clone https://github.com/DevvGwardo/hermes-claude-code.git
cd hermes-claude-code
./install.sh # Install both MCP server + Hermes plugin
# or
./install.sh mcp # MCP server only
./install.sh plugin # Hermes plugin only选项A:MCP服务器(适用于Hermes、Claude Code和任何MCP客户端)
cd hermes-claude-code
npm install在Hermes注册 --添加到 ~/.hermes/config.yaml:
mcp_servers:
claude-code:
command: node
args: [/path/to/hermes-claude-code/server.mjs]
timeout: 660使用克劳德代码注册 --添加到 ~/.claude/mcp.json:
{
"mcpServers": {
"claude-code": {
"command": "node",
"args": ["/path/to/hermes-claude-code/server.mjs"]
}
}
}选项B:Hermes插件(本地集成)
# Symlink or copy the plugin into Hermes plugins directory
ln -s /path/to/hermes-claude-code/hermes-plugin ~/.hermes/plugins/claude-code重新启动Hermes——工具会自动出现。
用法
来自爱马仕
安装后,Hermes可以在对话中使用这些工具:
You: Build a REST API for user management in /projects/my-app
Hermes: I'll delegate this to Claude Code.
→ claude_code_delegate(task="Create a REST API with CRUD endpoints for user management using Express.js. Include: POST /users, GET /users/:id, PUT /users/:id, DELETE /users/:id. Use a SQLite database. Add input validation and error handling.", work_dir="/projects/my-app")并行任务
You: Set up the backend and frontend for my new project simultaneously
Hermes: I'll run both tasks in parallel.
→ claude_code_batch(tasks=[
{task: "Create Express.js backend with auth...", work_dir: "/projects/backend"},
{task: "Create React frontend with login page...", work_dir: "/projects/frontend"}
])研究模式
You: How does the authentication flow work in this codebase?
Hermes: Let me have Claude Code analyze that.
→ claude_code_research(question="Trace the full authentication flow from login to session creation. Identify all middleware, token generation, and session storage mechanisms.", work_dir: "/projects/my-app")多回合工作流程
# Step 1: Initial implementation
→ claude_code_delegate(task="Create user model...", work_dir="/app")
# Returns session_id: "abc-123"
# Step 2: Continue with tests (MCP server only)
→ claude_code_continue(message="Now add unit tests for the user model", session_id="abc-123")配置
环境变量
| 变量 | 默认值 | 描述 |
|---|---|---|
CLAUDE_CODE_BIN | claude | Claude Code CLI二进制文件的路径 |
CLAUDE.md集成
添加到您的项目 CLAUDE.md 指导Hermes何时委派:
## Claude Code Delegation
When implementing features or fixing bugs, delegate self-contained sub-tasks
to Claude Code using the `claude_code_delegate` tool.
### When to delegate
- Writing new functions, modules, or files with clear requirements
- Bug fixes with clear scope
- Refactoring specific files
- Running tests and fixing failures
### When NOT to delegate
- Tasks requiring back-and-forth with the user
- Architecture decisions
- Tasks that depend on conversation context Hermes hasn't passed建筑
MCP服务器(server.mjs)
封装Node.js MCP服务器 claude CLI。用途 @modelcontextprotocol/sdk 对于MCP协议和产卵 claude -p 每个任务的子流程。
Hermes插件(hermes-plugin/)
Python插件,通过以下方式将工具直接注册到Hermes的工具注册表中 PluginContext.register_tool().用途 subprocess.run() 援引克劳德准则 ThreadPoolExecutor 用于并行批处理执行。
这两种方法都会产生相同的结果——根据您的设置进行选择:
- MCP服务器:可与任何兼容MCP的客户端(Hermes、Claude Code、Cursor等)配合使用
- Hermes插件:更紧密的集成,没有额外的过程,出现在
hermes tools文本用户界面
许可证
麻省理工学院
