跳到主要内容

Hermes Agent

使用及扩展 Hermes Agent 的完整指南 — CLI 用法、设置、配置、生成额外代理实例、网关平台、技能、语音、工具、配置文件,以及简洁的贡献者参考。在帮助用户配置 Hermes、排查问题、生成代理实例或进行代码贡献时,加载此技能。

技能元数据

来源捆绑(默认安装)
路径skills/autonomous-ai-agents/hermes-agent
版本2.0.0
作者Hermes Agent + Teknium
许可证MIT
标签hermes, setup, configuration, multi-agent, spawning, cli, gateway, development
相关技能claude-code, codex, opencode

参考:完整 SKILL.md

信息

以下是 Hermes 在此技能被触发时加载的完整技能定义。这是技能激活时代理所看到的指令。

Hermes Agent

Hermes Agent 是由 Nous Research 开发的开源 AI 代理框架,运行于你的终端、消息平台和 IDE 中。它与 Claude Code (Anthropic)、Codex (OpenAI) 和 OpenClaw 属于同一类别——即利用工具调用来与系统交互的自主编码和任务执行代理。Hermes 兼容任何 LLM 提供商(OpenRouter、Anthropic、OpenAI、DeepSeek、本地模型以及其他 15+ 种),并可在 Linux、macOS、WSL 和原生 Windows 上运行。

Hermes 的独特之处:

  • 通过技能自我改进 — Hermes 通过将可复用的过程保存为技能来从经验中学习。当它解决复杂问题、发现工作流或被纠正时,可以将这些知识持久化为技能文档,以便在未来的会话中加载。技能随时间积累,使代理更擅长处理你的特定任务和环境。
  • 跨会话持久记忆 — 记住你是谁、你的偏好、环境细节以及学到的经验教训。可插拔的记忆后端(内置、Honcho、Mem0 等)让你可以选择记忆的工作方式。
  • 多平台网关 — 同一个代理可运行于 Telegram、Discord、Slack、WhatsApp、Signal、Matrix、电子邮件以及 10+ 其他平台,拥有完整的工具访问权限,而不仅仅是聊天。
  • 提供商无关性 — 在工作流中途切换模型和提供商,无需更改其他任何内容。凭证池会在多个 API 密钥之间自动轮换。
  • 配置文件 (Profiles) — 运行多个独立的 Hermes 实例,各自拥有隔离的配置、会话、技能和记忆。
  • 可扩展性 — 插件、MCP 服务器、自定义工具、Webhook 触发器、Cron 调度以及完整的 Python 生态系统。

人们使用 Hermes 进行软件开发、研究、系统管理、数据分析、内容创作、家庭自动化,以及任何其他受益于具有持久上下文和完整系统访问权限的 AI 代理的场景。

此技能帮助你高效使用 Hermes Agent — 包括设置、配置功能、生成额外代理实例、排查问题、查找正确的命令和设置,以及在需要扩展或贡献时理解系统工作原理。

文档: /docs/

快速开始

# Install
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash

# Interactive chat (default)
hermes

# Single query
hermes chat -q "What is the capital of France?"

# Setup wizard
hermes setup

# Change model/provider
hermes model

# Check health
hermes doctor

CLI 参考

全局标志

hermes [flags] [command]

--version, -V Show version
--resume, -r SESSION Resume session by ID or title
--continue, -c [NAME] Resume by name, or most recent session
--worktree, -w Isolated git worktree mode (parallel agents)
--skills, -s SKILL Preload skills (comma-separate or repeat)
--profile, -p NAME Use a named profile
--yolo Skip dangerous command approval
--pass-session-id Include session ID in system prompt

无子命令时默认为 chat

聊天

hermes chat [flags]
-q, --query TEXT Single query, non-interactive
-m, --model MODEL Model (e.g. anthropic/claude-sonnet-4)
-t, --toolsets LIST Comma-separated toolsets
--provider PROVIDER Force provider (openrouter, anthropic, nous, etc.)
-v, --verbose Verbose output
-Q, --quiet Suppress banner, spinner, tool previews
--checkpoints Enable filesystem checkpoints (/rollback)
--source TAG Session source tag (default: cli)

配置

hermes setup [section]      Interactive wizard (model|terminal|gateway|tools|agent)
hermes model Interactive model/provider picker
hermes config View current config
hermes config edit Open config.yaml in $EDITOR
hermes config set KEY VAL Set a config value
hermes config path Print config.yaml path
hermes config env-path Print .env path
hermes config check Check for missing/outdated config
hermes config migrate Update config with new options
hermes login [--provider P] OAuth login (nous, openai-codex)
hermes logout Clear stored auth
hermes doctor [--fix] Check dependencies and config
hermes status [--all] Show component status

工具与技能

hermes tools                Interactive tool enable/disable (curses UI)
hermes tools list Show all tools and status
hermes tools enable NAME Enable a toolset
hermes tools disable NAME Disable a toolset

hermes skills list List installed skills
hermes skills search QUERY Search the skills hub
hermes skills install ID Install a skill
hermes skills inspect ID Preview without installing
hermes skills config Enable/disable skills per platform
hermes skills check Check for updates
hermes skills update Update outdated skills
hermes skills uninstall N Remove a hub skill
hermes skills publish PATH Publish to registry
hermes skills browse Browse all available skills
hermes skills tap add REPO Add a GitHub repo as skill source

MCP 服务器

hermes mcp serve            Run Hermes as an MCP server
hermes mcp add NAME Add an MCP server (--url or --command)
hermes mcp remove NAME Remove an MCP server
hermes mcp list List configured servers
hermes mcp test NAME Test connection
hermes mcp configure NAME Toggle tool selection

网关(消息平台)

hermes gateway run          Start gateway foreground
hermes gateway install Install as background service
hermes gateway start/stop Control the service
hermes gateway restart Restart the service
hermes gateway status Check status
hermes gateway setup Configure platforms

支持的平台:Telegram、Discord、Slack、WhatsApp、Signal、电子邮件、SMS、Matrix、Mattermost、Home Assistant、钉钉、飞书、企业微信、BlueBubbles (iMessage)、微信 (WeChat)、API 服务器、Webhooks。Open WebUI 通过 API 服务器适配器连接。

平台文档:/docs/user-guide/messaging/

会话

hermes sessions list        List recent sessions
hermes sessions browse Interactive picker
hermes sessions export OUT Export to JSONL
hermes sessions rename ID T Rename a session
hermes sessions delete ID Delete a session
hermes sessions prune Clean up old sessions (--older-than N days)
hermes sessions stats Session store statistics

Cron 任务

hermes cron list            List jobs (--all for disabled)
hermes cron create SCHED Create: '30m', 'every 2h', '0 9 * * *'
hermes cron edit ID Edit schedule, prompt, delivery
hermes cron pause/resume ID Control job state
hermes cron run ID Trigger on next tick
hermes cron remove ID Delete a job
hermes cron status Scheduler status

Webhooks

hermes webhook subscribe N  Create route at /webhooks/<name>
hermes webhook list List subscriptions
hermes webhook remove NAME Remove a subscription
hermes webhook test NAME Send a test POST

配置文件 (Profiles)

hermes profile list         List all profiles
hermes profile create NAME Create (--clone, --clone-all, --clone-from)
hermes profile use NAME Set sticky default
hermes profile delete NAME Delete a profile
hermes profile show NAME Show details
hermes profile alias NAME Manage wrapper scripts
hermes profile rename A B Rename a profile
hermes profile export NAME Export to tar.gz
hermes profile import FILE Import from archive

凭证池

hermes auth add             Interactive credential wizard
hermes auth list [PROVIDER] List pooled credentials
hermes auth remove P INDEX Remove by provider + index
hermes auth reset PROVIDER Clear exhaustion status

其他

hermes insights [--days N]  Usage analytics
hermes update Update to latest version
hermes pairing list/approve/revoke DM authorization
hermes plugins list/install/remove Plugin management
hermes honcho setup/status Honcho memory integration (requires honcho plugin)
hermes memory setup/status/off Memory provider config
hermes completion bash|zsh Shell completions
hermes acp ACP server (IDE integration)
hermes claw migrate Migrate from OpenClaw
hermes uninstall Uninstall Hermes

Slash 命令(会话内)

在交互式聊天会话期间输入这些命令。

会话控制

/new (/reset)        Fresh session
/clear Clear screen + new session (CLI)
/retry Resend last message
/undo Remove last exchange
/title [name] Name the session
/compress Manually compress context
/stop Kill background processes
/rollback [N] Restore filesystem checkpoint
/background <prompt> Run prompt in background
/queue <prompt> Queue for next turn
/resume [name] Resume a named session

配置

/config              Show config (CLI)
/model [name] Show or change model
/personality [name] Set personality
/reasoning [level] Set reasoning (none|minimal|low|medium|high|xhigh|show|hide)
/verbose Cycle: off → new → all → verbose
/voice [on|off|tts] Voice mode
/yolo Toggle approval bypass
/skin [name] Change theme (CLI)
/statusbar Toggle status bar (CLI)

工具与技能

/tools               Manage tools (CLI)
/toolsets List toolsets (CLI)
/skills Search/install skills (CLI)
/skill <name> Load a skill into session
/cron Manage cron jobs (CLI)
/reload-mcp Reload MCP servers
/plugins List plugins (CLI)

网关

/approve             Approve a pending command (gateway)
/deny Deny a pending command (gateway)
/restart Restart gateway (gateway)
/sethome Set current chat as home channel (gateway)
/update Update Hermes to latest (gateway)
/platforms (/gateway) Show platform connection status (gateway)

实用工具

/branch (/fork)      Branch the current session
/btw Ephemeral side question (doesn't interrupt main task)
/fast Toggle priority/fast processing
/browser Open CDP browser connection
/history Show conversation history (CLI)
/save Save conversation to file (CLI)
/paste Attach clipboard image (CLI)
/image Attach local image file (CLI)

信息

/help                Show commands
/commands [page] Browse all commands (gateway)
/usage Token usage
/insights [days] Usage analytics
/status Session info (gateway)
/profile Active profile info

退出

/quit (/exit, /q)    Exit CLI

关键路径与配置

~/.hermes/config.yaml       Main configuration
~/.hermes/.env API keys and secrets
$HERMES_HOME/skills/ Installed skills
~/.hermes/sessions/ Session transcripts
~/.hermes/logs/ Gateway and error logs
~/.hermes/auth.json OAuth tokens and credential pools
~/.hermes/hermes-agent/ Source code (if git-installed)

配置文件使用 ~/.hermes/profiles/<name>/,布局相同。

配置部分

使用 hermes config edithermes config set section.key value 进行编辑。

部分关键选项
modeldefault, provider, base_url, api_key, context_length
agentmax_turns (90), tool_use_enforcement
terminalbackend (local/docker/ssh/modal), cwd, timeout (180)
compressionenabled, threshold (0.50), target_ratio (0.20)
displayskin, tool_progress, show_reasoning, show_cost
sttenabled, provider (local/groq/openai/mistral)
ttsprovider (edge/elevenlabs/openai/minimax/mistral/neutts)
memorymemory_enabled, user_profile_enabled, provider
securitytirith_enabled, website_blocklist
delegationmodel, provider, base_url, api_key, max_iterations (50), reasoning_effort
checkpointsenabled, max_snapshots (50)

完整配置参考:/docs/user-guide/configuration

提供商

支持 20+ 提供商。通过 hermes modelhermes setup 设置。

提供商认证方式密钥环境变量
OpenRouterAPI 密钥OPENROUTER_API_KEY
AnthropicAPI 密钥ANTHROPIC_API_KEY
Nous PortalOAuthhermes auth
OpenAI CodexOAuthhermes auth
GitHub CopilotTokenCOPILOT_GITHUB_TOKEN
Google GeminiAPI 密钥GOOGLE_API_KEYGEMINI_API_KEY
DeepSeekAPI 密钥DEEPSEEK_API_KEY
xAI / GrokAPI 密钥XAI_API_KEY
Hugging FaceTokenHF_TOKEN
Z.AI / GLMAPI 密钥GLM_API_KEY
MiniMaxAPI 密钥MINIMAX_API_KEY
MiniMax CNAPI 密钥MINIMAX_CN_API_KEY
Kimi / MoonshotAPI 密钥KIMI_API_KEY
Alibaba / DashScopeAPI 密钥DASHSCOPE_API_KEY
Xiaomi MiMoAPI 密钥XIAOMI_API_KEY
Kilo CodeAPI 密钥KILOCODE_API_KEY
AI Gateway (Vercel)API 密钥AI_GATEWAY_API_KEY
OpenCode ZenAPI 密钥OPENCODE_ZEN_API_KEY
OpenCode GoAPI 密钥OPENCODE_GO_API_KEY
Qwen OAuthOAuthhermes login --provider qwen-oauth
自定义端点配置config.yaml 中的 model.base_url + model.api_key
GitHub Copilot ACP外部COPILOT_CLI_PATH 或 Copilot CLI

完整提供商文档:/docs/integrations/providers

工具集

通过 hermes tools(交互式)或 hermes tools enable/disable NAME 启用/禁用。

工具集提供功能
web网络搜索和内容提取
browser浏览器自动化(Browserbase、Camofox 或本地 Chromium)
terminalShell 命令和进程管理
file文件读取/写入/搜索/修补
code_execution沙盒 Python 执行
vision图像分析
image_genAI 图像生成
tts文本转语音
skills技能浏览和管理
memory持久化跨会话记忆
session_search搜索过往对话
delegation子代理任务委派
cronjob计划任务管理
clarify向用户提出澄清性问题
messaging跨平台消息发送
search仅网络搜索(web 的子集)
todo会话内任务规划和跟踪
rl强化学习工具(默认关闭)
moa混合代理(Mixture of Agents,默认关闭)
homeassistant智能家居控制(默认关闭)

工具更改在 /reset(新会话)时生效。它们不会在对话中途应用,以保留提示缓存。


语音与转录

STT(语音 → 文本)

来自消息平台的语音消息会自动转录。

提供商优先级(自动检测):

  1. Local faster-whisper — 免费,无需 API 密钥:pip install faster-whisper
  2. Groq Whisper — 免费层级:设置 GROQ_API_KEY
  3. OpenAI Whisper — 付费:设置 VOICE_TOOLS_OPENAI_KEY
  4. Mistral Voxtral — 设置 MISTRAL_API_KEY

配置:

stt:
enabled: true
provider: local # local, groq, openai, mistral
local:
model: base # tiny, base, small, medium, large-v3

TTS(文本 → 语音)

提供商环境变量免费?
Edge TTS是(默认)
ElevenLabsELEVENLABS_API_KEY免费层级
OpenAIVOICE_TOOLS_OPENAI_KEY付费
MiniMaxMINIMAX_API_KEY付费
Mistral (Voxtral)MISTRAL_API_KEY付费
NeuTTS (本地)无(pip install neutts[all] + espeak-ng免费

语音命令:/voice on(语音对语音),/voice tts(始终语音),/voice off


启动额外的 Hermes 实例

将额外的 Hermes 进程作为完全独立的子进程运行 — 拥有独立的会话、工具和环境。

何时使用此方式而非 delegate_task

delegate_task启动 hermes 进程
隔离性独立对话,共享进程完全独立的进程
持续时间分钟(受父循环限制)小时/天
工具访问权限父级工具的子集完整工具访问权限
交互性是(PTY 模式)
用例快速并行子任务长期自主任务

一次性模式

terminal(command="hermes chat -q 'Research GRPO papers and write summary to ~/research/grpo.md'", timeout=300)

# Background for long tasks:
terminal(command="hermes chat -q 'Set up CI/CD for ~/myapp'", background=true)

交互式 PTY 模式(通过 tmux)

Hermes 使用 prompt_toolkit,需要真实的终端。使用 tmux 进行交互式启动:

# Start
terminal(command="tmux new-session -d -s agent1 -x 120 -y 40 'hermes'", timeout=10)

# Wait for startup, then send a message
terminal(command="sleep 8 && tmux send-keys -t agent1 'Build a FastAPI auth service' Enter", timeout=15)

# Read output
terminal(command="sleep 20 && tmux capture-pane -t agent1 -p", timeout=5)

# Send follow-up
terminal(command="tmux send-keys -t agent1 'Add rate limiting middleware' Enter", timeout=5)

# Exit
terminal(command="tmux send-keys -t agent1 '/exit' Enter && sleep 2 && tmux kill-session -t agent1", timeout=10)

多智能体协调

# Agent A: backend
terminal(command="tmux new-session -d -s backend -x 120 -y 40 'hermes -w'", timeout=10)
terminal(command="sleep 8 && tmux send-keys -t backend 'Build REST API for user management' Enter", timeout=15)

# Agent B: frontend
terminal(command="tmux new-session -d -s frontend -x 120 -y 40 'hermes -w'", timeout=10)
terminal(command="sleep 8 && tmux send-keys -t frontend 'Build React dashboard for user management' Enter", timeout=15)

# Check progress, relay context between them
terminal(command="tmux capture-pane -t backend -p | tail -30", timeout=5)
terminal(command="tmux send-keys -t frontend 'Here is the API schema from the backend agent: ...' Enter", timeout=5)

会话恢复

# Resume most recent session
terminal(command="tmux new-session -d -s resumed 'hermes --continue'", timeout=10)

# Resume specific session
terminal(command="tmux new-session -d -s resumed 'hermes --resume 20260225_143052_a1b2c3'", timeout=10)

提示

  • 对于快速子任务,优先使用 delegate_task — 比启动完整进程的开销更小
  • 在启动编辑代码的智能体时使用 -w(worktree 模式) — 防止 git 冲突
  • 为单次执行模式设置超时 — 复杂任务可能需要 5-10 分钟
  • 使用 hermes chat -q 进行即发即弃操作 — 无需 PTY
  • 交互式会话使用 tmux — 原始 PTY 模式在处理 prompt_toolkit 时存在 \r\n 的问题
  • 对于计划任务,使用 cronjob 工具而非启动新进程 — 可处理交付和重试

故障排除

语音功能无效

  1. 检查 config.yaml 中的 stt.enabled: true
  2. 验证提供商:pip install faster-whisper 或设置 API 密钥
  3. 在网关中:/restart。在 CLI 中:退出并重新启动。

工具不可用

  1. hermes tools — 检查工具集是否已为你的平台启用
  2. 某些工具需要环境变量(检查 .env
  3. 启用工具后执行 /reset

模型/提供商问题

  1. hermes doctor — 检查配置和依赖项
  2. hermes login — 重新认证 OAuth 提供商
  3. 检查 .env 是否包含正确的 API 密钥
  4. Copilot 403 错误gh auth login 生成的令牌适用于 Copilot API。你必须通过 hermes model → GitHub Copilot 使用 Copilot 专用的 OAuth 设备代码流程。

更改未生效

  • 工具/技能: /reset 会使用更新后的工具集启动新会话
  • 配置更改: 在网关中:/restart。在 CLI 中:退出并重新启动。
  • 代码更改: 重启 CLI 或网关进程

技能未显示

  1. hermes skills list — 验证是否已安装
  2. hermes skills config — 检查平台启用状态
  3. 显式加载:/skill namehermes -s name

网关问题

首先检查日志:

grep -i "failed to send\|error" ~/.hermes/logs/gateway.log | tail -20

常见网关问题:

  • SSH 注销后网关停止运行:启用 linger:sudo loginctl enable-linger $USER
  • 关闭 WSL2 后网关停止运行:WSL2 需要在 /etc/wsl.conf 中设置 systemd=true 才能使 systemd 服务正常工作。否则,网关会回退到 nohup(会话关闭时停止运行)。
  • 网关崩溃循环:重置失败状态:systemctl --user reset-failed hermes-gateway

平台特定问题

  • Discord 机器人无响应:必须在 Bot → Privileged Gateway Intents 中启用 Message Content Intent
  • Slack 机器人仅在私信中有效:必须订阅 message.channels 事件。否则,机器人将忽略公共频道。
  • Windows HTTP 400 "No models provided":配置文件编码问题(BOM)。确保 config.yaml 保存为不带 BOM 的 UTF-8 格式。

辅助模型无效

如果 auxiliary 任务(视觉、压缩、会话搜索)静默失败,说明 auto 提供商找不到后端。请设置 OPENROUTER_API_KEYGOOGLE_API_KEY,或者显式配置每个辅助任务的提供商:

hermes config set auxiliary.vision.provider <your_provider>
hermes config set auxiliary.vision.model <model_name>

资源查找指南

查找内容...位置
配置选项hermes config edit配置文档
可用工具hermes tools list工具参考
斜杠命令会话中的 /help斜杠命令参考
技能目录hermes skills browse技能目录
提供商设置hermes model提供商指南
平台设置hermes gateway setup消息传递文档
MCP 服务器hermes mcp listMCP 指南
配置文件 (Profiles)hermes profile listProfiles 文档
Cron 任务hermes cron listCron 文档
记忆功能hermes memory status记忆文档
环境变量hermes config env-path环境变量参考
CLI 命令hermes --helpCLI 参考
网关日志~/.hermes/logs/gateway.log
会话文件~/.hermes/sessions/hermes sessions browse
源代码~/.hermes/hermes-agent/

贡献者快速参考

适用于偶尔贡献者和 PR 作者。完整开发者文档:/docs/developer-guide/

项目布局

hermes-agent/
├── run_agent.py # AIAgent — core conversation loop
├── model_tools.py # Tool discovery and dispatch
├── toolsets.py # Toolset definitions
├── cli.py # Interactive CLI (HermesCLI)
├── hermes_state.py # SQLite session store
├── agent/ # Prompt builder, context compression, memory, model routing, credential pooling, skill dispatch
├── hermes_cli/ # CLI subcommands, config, setup, commands
│ ├── commands.py # Slash command registry (CommandDef)
│ ├── config.py # DEFAULT_CONFIG, env var definitions
│ └── main.py # CLI entry point and argparse
├── tools/ # One file per tool
│ └── registry.py # Central tool registry
├── gateway/ # Messaging gateway
│ └── platforms/ # Platform adapters (telegram, discord, etc.)
├── cron/ # Job scheduler
├── tests/ # ~3000 pytest tests
└── website/ # Docusaurus docs site

配置:~/.hermes/config.yaml(设置),~/.hermes/.env(API 密钥)。

添加工具(3 个文件)

1. 创建 tools/your_tool.py

import json, os
from tools.registry import registry

def check_requirements() -> bool:
return bool(os.getenv("EXAMPLE_API_KEY"))

def example_tool(param: str, task_id: str = None) -> str:
return json.dumps({"success": True, "data": "..."})

registry.register(
name="example_tool",
toolset="example",
schema={"name": "example_tool", "description": "...", "parameters": {...}},
handler=lambda args, **kw: example_tool(
param=args.get("param", ""), task_id=kw.get("task_id")),
check_fn=check_requirements,
requires_env=["EXAMPLE_API_KEY"],
)

2. 添加到 toolsets.py_HERMES_CORE_TOOLS 列表。

自动发现:任何包含顶层 registry.register() 调用的 tools/*.py 文件都会被自动导入——无需手动列表。

所有处理程序必须返回 JSON 字符串。使用 get_hermes_home() 获取路径,切勿硬编码 ~/.hermes

添加斜杠命令

  1. hermes_cli/commands.py 中将 CommandDef 添加到 COMMAND_REGISTRY
  2. cli.pyprocess_command() 中添加处理程序
  3. (可选)在 gateway/run.py 中添加网关处理程序

所有消费者(帮助文本、自动补全、Telegram 菜单、Slack 映射)均自动从中央注册表派生。

Agent 循环(高层概述)

run_conversation():
1. Build system prompt
2. Loop while iterations < max:
a. Call LLM (OpenAI-format messages + tool schemas)
b. If tool_calls → dispatch each via handle_function_call() → append results → continue
c. If text response → return
3. Context compression triggers automatically near token limit

测试

python -m pytest tests/ -o 'addopts=' -q   # Full suite
python -m pytest tests/tools/ -q # Specific area
  • 测试会自动将 HERMES_HOME 重定向到临时目录——切勿触碰真实的 ~/.hermes/
  • 在推送任何更改之前运行完整测试套件
  • 使用 -o 'addopts=' 清除任何内置的 pytest 标志

提交规范

type: concise subject line

Optional body.

类型:fix:feat:refactor:docs:chore:

关键规则

  • 切勿破坏提示缓存——不要在对话过程中更改上下文、工具或系统提示
  • 消息角色交替——切勿连续出现两条 assistant 消息或两条 user 消息
  • 对所有路径使用 hermes_constants 中的 get_hermes_home()(配置文件安全)
  • 配置值放入 config.yaml,机密信息放入 .env
  • 新工具需要 check_fn,以便仅在满足要求时才显示