Hermes Agent Skill(当前版本 v2.0)封装了 NousResearch Hermes Agent 的 CLI 调用能力,使 WorkBuddy/Claw 可以通过 Shell 命令利用 Hermes 的核心功能。v2.0 的改进是完全可移植、无硬编码路径,支持在任意实例上一键安装。
一、首次安装与配置 检测到 Hermes 未安装时,可运行一键安装脚本: bash ~/.workbuddy/skills/hermes-agent/scripts/install_hermes.sh 或自定义安装目录: bash ~/.workbuddy/skills/hermes-agent/scripts/install_hermes.sh --prefix ~/custom/path 安装脚本会自动检测 Python 3.11+ 环境、克隆 Hermes Agent 源码、创建 Python 虚拟环境并安装依赖、创建 ~/.local/bin/hermes CLI 入口、初始化 ~/.hermes/ 配置目录,并生成默认 .env 配置模板。 安装后需编辑配置文件填入 API Key:nano ~/.hermes/.env。文档列出的可选提供商包括智谱 AI(GLM_API_KEY)、OpenRouter(OPENROUTER_API_KEY)、Anthropic(ANTHROPIC_API_KEY)、OpenAI(OPENAI_API_KEY)。 验证安装可使用 export PATH="$HOME/.local/bin:$PATH" 后运行 hermes --version,或运行 hermes doctor 进行诊断。 迁移到其他 Claw 实例时,将整个 Skill 目录复制到目标实例并重新执行安装脚本、配置 API Key 即可。
二、主要能力与使用方式
- 调用模式:快速问答使用 hermes run "问题" --non-interactive --no-stream;带上下文使用 --context-file ./ctx.md --non-interactive 注入项目上下文;子代理委托使用 scripts/hermes_delegate.sh;技能查询使用 hermes skills list;记忆搜索使用 hermes memory search "关键词";状态检查使用 hermes status 或 hermes doctor。
- CLI 基础命令:hermes 启动交互式对话;hermes run "prompt" [选项] 用于单轮执行。非交互模式选项包括 --non-interactive(关闭交互式 TUI)、--no-stream(禁用流式输出,返回完整结果)、--context-file PATH(注入上下文文件)、--toolset NAME(限制使用的工具集)、--model MODEL(指定模型)、--timeout SECONDS(超时时间,默认 300 秒)。
- 子代理委托:可通过 wrapper 脚本调用,如 ./scripts/hermes_delegate.sh --task "分析竞品A和B的产品特性" --tools "web_search,browser,file_write" --timeout 300 --output ./result.md;也可直接在 hermes run 中使用 delegate_task 工具。
- 记忆管理:hermes memory search "关键词" 搜索历史记忆;hermes memory notes list 查看所有笔记;hermes memory notes add "重要发现:..." 添加手动笔记;hermes memory export ./backup/ 与 hermes memory import ./backup/ 导出/导入记忆。
- 技能管理:hermes skills list、hermes skills create my-skill --description "描述"、hermes skills edit my-skill、hermes skills remove my-skill。
- 插件管理:hermes plugins list、hermes plugins install user/repo、hermes plugins enable/disable/update/remove plugin-name。
- 定时任务:hermes cron list、hermes cron add --name "日报" --cron "0 9 * * *" --message "生成总结"、hermes cron pause/resume/remove TASK_ID。
- MCP 集成:hermes mcp serve --port 8080 启动 MCP Server;hermes mcp connect <server-config> 连接外部 MCP 服务。
三、脚本说明 scripts/hermes_wrapper.sh 为统一 CLI 封装脚本,提供 JSON 格式化输出和错误处理,输出包含 success、output、error、duration_ms 字段,用法如 ./scripts/hermes_wrapper.sh run "分析内容" --timeout 60。 scripts/hermes_delegate.sh 为子代理委托专用脚本,选项包括 --tools、--timeout、--output、--max-concurrent(默认 3)、--context-file、-v。 scripts/install_hermes.sh 为一键安装脚本,支持 --skip-deps 和 --prefix DIR。
四、模型配置 可运行 hermes model 进入交互式配置向导,或直接编辑 ~/.hermes/config.yaml,其中 model.provider 支持 openrouter、anthropic、openai、gemini、zai、kimi-coding、nous、custom,并可设置 default 默认模型与 base_url 自定义 API 地址。
五、最佳实践与注意事项 推荐始终使用 --non-interactive --no-stream 避免 TUI 阻塞;设置合理超时(简单任务 60s,复杂任务 300s);用 --toolset 限制工具集以减少 Token 消耗;将大段背景信息放入上下文文件;网络问题时自动重试 1-2 次。注意事项包括:每次调用都有 Token 成本、并发最多 3 个子代理、长时间任务必须设置 timeout、不要在 Skill 文件中硬编码密钥、确保 Python 3.11+。
六、故障排除与文件结构 常见问题处理:command not found: hermes 时设置 PATH 或重新执行安装脚本;TypeError: unsupported operand 时确保 Python 3.11+;API Key 错误时检查 ~/.hermes/.env;连接超时检查网络或更换 LLM 提供商;子代理失败可减少 --max-concurrent 或增加 --timeout;安装脚本失败可运行 hermes doctor 诊断。 文件结构包含 SKILL.md、_meta.json、scripts/(install_hermes.sh、hermes_wrapper.sh、hermes_delegate.sh)以及 references/ 参考文档。
版本记录:v2.0.0(2026-04-12)为完全可移植版,移除所有硬编码路径,添加一键安装脚本,支持任意 Claw 实例迁移;v1.0.0(2026-04-11)为初始版本,支持基础 CLI 调用、子代理委托、记忆/技能管理。