Hermes Agent 完全指南:2 分钟打造你的 AI 智能助手
核心提示:Hermes 是 全球首个自进化 AI 助手,拥有内置学习循环。它从经验中创建技能、在使用中自我改进、主动持久化知识、搜索历史对话,并在跨会话中构建对你的深度理解。本文将带你从零开始安装配置,打造专属 AI 助手。
一、什么是 Hermes Agent?
Hermes Agent 是由 Nous Research 开发的自进化 AI 助手,GitHub 星标 61,000+,是 唯一内置完整学习循环 的 AI 代理。
核心理念
“The agent that grows with you” —— 与你共同成长的智能助手
核心能力
| 特性 | 说明 |
|---|---|
| 🤖 多模型支持 | Nous Portal、OpenRouter (200+ 模型)、z.ai/GLM、Kimi/Moonshot、MiniMax、OpenAI、本地 Ollama |
| 📱 多平台集成 | Telegram、Discord、Slack、WhatsApp、Signal、微信、Email、CLI |
| ⚡ 自动化工具 | 40+ 工具、定时任务、文件操作、终端执行、网页抓取、MCP 集成 |
| 🧠 持久记忆 | 跨会话记忆、用户画像、FTS5 全文搜索、Honcho 辩证用户建模 |
| 🎯 技能系统 | 自动从经验创建技能、使用中自我改进、兼容 agentskills.io 标准 |
| 🔄 自进化循环 | 主动 nudges 持久化知识、搜索历史对话、深度理解用户偏好 |
独特优势
✅ 真实终端界面 — 完整 TUI、多行编辑、斜杠命令自动补全、流式输出 ✅ 生活在你所在的地方 — 单一网关进程支持所有平台,语音备忘录转录 ✅ 封闭学习循环 — 代理策划记忆、自主技能创建、技能自我改进 ✅ 计划自动化 — 内置 cron 调度器,支持任意平台交付 ✅ 委托与并行 — 生成隔离子代理并行工作,Python 脚本调用工具 ✅ 随处运行 — 6 种终端后端(本地/Docker/SSH/Daytona/Singularity/Modal) ✅ 研究就绪 — 批量轨迹生成、Atropos RL 环境、轨迹压缩
二、快速安装(2 分钟)
前置要求
# 系统要求 - Python 3.11+ - Git - 至少 2GB 可用内存 - 支持:Linux、macOS、WSL2、Android (Termux)
Windows 用户:需先安装 WSL2,然后在 WSL 中运行安装命令。
安装步骤
一键安装(推荐)
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
安装后配置
source ~/.bashrc # 或 source ~/.zshrc 重新加载 shell hermes # 开始使用!
手动安装(开发者)
# 1. 克隆仓库 git clone https://github.com/NousResearch/hermes-agent.git cd hermes-agent # 2. 使用 uv 安装(推荐) curl -LsSf https://astral.sh/uv/install.sh | sh uv venv venv --python 3.11 source venv/bin/activate uv pip install -e ".[all,dev]" # 3. 或使用 pip python -m venv venv source venv/bin/activate pip install -e ".[all]"
验证安装
hermes --version hermes doctor # 诊断任何问题
三、快速入门
基础命令
hermes # 交互式 CLI — 开始对话 hermes model # 选择 LLM 提供商和模型 hermes tools # 配置启用的工具 hermes config set # 设置单个配置值 hermes gateway # 启动消息网关(Telegram、Discord 等) hermes setup # 运行完整设置向导(一次性配置所有) hermes claw migrate # 从 OpenClaw 迁移(如之前使用 OpenClaw) hermes update # 更新到最新版本 hermes doctor # 诊断任何问题
CLI vs 消息平台命令对照
Hermes 有两个入口点:终端 UI (hermes) 或消息网关(Telegram、Discord、Slack、WhatsApp、Signal、Email)。
| 操作 | CLI | 消息平台 |
|---|---|---|
| 开始聊天 | hermes | hermes gateway setup + hermes gateway start |
| 新对话 | /new 或 /reset | /new 或 /reset |
| 切换模型 | /model [provider:model] | /model [provider:model] |
| 设置人格 | /personality [name] | /personality [name] |
| 重试/撤销 | /retry, /undo | /retry, /undo |
| 压缩上下文 | /compress, /usage, /insights [--days N] | /compress, /usage, /insights [days] |
| 浏览技能 | /skills 或 /<skill-name> | /skills 或 /<skill-name> |
| 中断当前工作 | Ctrl+C 或发送新消息 | /stop 或发送新消息 |
| 平台状态 | /platforms | /status, /sethome |
四、核心配置
1. 模型配置(config.yaml)
model:
default: qwen3.5-plus
provider: custom
base_url: https://api.example.com/v1
api_key: your-api-key
# 多 Provider 配置
custom_providers:
- name: bailian
base_url: https://dashscope.aliyuncs.com/v1
api_key: sk-xxx
models:
qwen3.5-plus:
context_length: 256000
- name: ollama
base_url: http://localhost:11434
api_mode: chat_completions
2. 终端后端配置
Hermes 支持 6 种终端后端,可在不同环境中运行:
terminal: backend: local # 本地执行(默认) # backend: docker # Docker 容器隔离 # backend: ssh # SSH 远程服务器 # backend: daytona # Daytona 无服务器(成本几乎为零) # backend: singularity # Singularity 容器 # backend: modal # Modal 无服务器 GPU timeout: 180 # 命令超时时间(秒) persistent_shell: true # 保持 Shell 会话 container_memory: 5120 # 容器内存(MB) container_cpu: 1 # CPU 核心数 container_disk: 51200 # 磁盘空间(MB)
后端对比:
| 后端 | 适用场景 | 成本 |
|---|---|---|
local | 本地开发、WSL2 | 免费 |
docker | 隔离环境、CI/CD | 免费 |
ssh | 远程服务器、VPS | $5/月起 |
daytona | 无服务器、按需唤醒 | 几乎免费 |
modal | GPU 任务、无服务器 | 按使用付费 |
singularity | HPC 集群、科研 | 免费 |
3. 记忆系统
memory: memory_enabled: true user_profile_enabled: true memory_char_limit: 2200 user_char_limit: 1375
五、核心功能使用
1. 文件操作
# 读取文件 hermes> read_file path/to/file.py # 写入文件 hermes> write_file path/to/file.py "content here" # 搜索文件内容 hermes> search_files pattern="def.*" target="content" # 补丁编辑 hermes> patch path="file.py" old="old_code" new="new_code"
2. 终端执行
# 运行命令 hermes> terminal command="git status" # 后台运行 hermes> terminal command="python server.py" background=true # 进程管理 hermes> process action="list" hermes> process action="kill" session_id="xxx"
3. 定时任务
# 创建定时任务 hermes> cronjob action="create" \ schedule="0 9 * * *" \ prompt="生成日报" \ deliver="wechat" # 查看任务 hermes> cronjob action="list" # 管理任务 hermes> cronjob action="pause" job_id="xxx" hermes> cronjob action="resume" job_id="xxx"
4. 记忆管理
# 保存记忆 hermes> memory action="add" target="memory" \ content="用户偏好使用 Python 3.11" # 更新用户信息 hermes> memory action="add" target="user" \ content="Name: 张三,Timezone: Asia/Shanghai" # 搜索历史会话 hermes> session_search query="docker 配置"
5. 技能系统
# 查看可用技能 hermes> skills_list # 加载技能 hermes> skill_view name="github-pr-workflow" # 创建技能 hermes> skill_manage action="create" \ name="my-skill" \ content="# SKILL.md 内容"
七、多平台集成
Hermes 支持 单一网关进程 连接所有平台,消息可双向同步。
支持的平台
| 平台 | 配置命令 | 特性 |
|---|---|---|
| Telegram | hermes gateway setup telegram | 语音消息、文件传输 |
| Discord | hermes gateway setup discord | 线程支持、反应表情 |
| Slack | hermes gateway setup slack | 企业集成 |
hermes gateway setup whatsapp | 端到端加密 | |
| Signal | hermes gateway setup signal | 隐私优先 |
hermes gateway setup email | IMAP/SMTP | |
| 微信 | 手动配置 | 国内用户友好 |
网关配置示例
# 启动网关设置向导 hermes gateway setup # 启动网关服务 hermes gateway start # 查看网关状态 hermes gateway status
Discord 配置
discord: require_mention: true # 需要 @mention 才响应 auto_thread: true # 自动创建线程 reactions: true # 启用表情反应 allowed_channels: "general,help" # 允许的频道 free_response_channels: "" # 无需 mention 的频道
Telegram 配置
telegram: bot_token: your-bot-token webhook_url: https://your-domain.com/webhook # 或使用轮询模式 poll_mode: true
八、高级用法
1. 子代理委托
# 并行执行多个任务
hermes> delegate_task tasks=[
{"goal": "分析代码库结构", "toolsets": ["terminal", "file"]},
{"goal": "查找安全问题", "toolsets": ["terminal", "web"]},
{"goal": "生成文档", "toolsets": ["file"]}
]
2. 代码执行沙箱
# 执行 Python 代码(可调用 Hermes 工具)
hermes> execute_code code="""
from hermes_tools import terminal, read_file
result = terminal('git log --oneline')
print(result['output'])
"""
3. 视觉分析
# 分析图片 hermes> vision_analyze \ image_url="/path/to/image.jpg" \ question="这是什么图表?"
4. 语音功能
# 文字转语音 hermes> text_to_speech text="你好,这是语音消息" # 语音转文字(需配置 STT) # 自动在支持的平台启用
九、最佳实践
1. 配置备份
# 备份配置 cp ~/.hermes/config.yaml ~/.hermes/config.yaml.backup cp -r ~/.hermes/skills/ ~/backups/skills/
2. 技能维护
# 定期更新技能 hermes> skills_list hermes> skill_view name="xxx" # 检查技能是否过时 hermes> skill_manage action="patch" ... # 修复问题技能
3. 安全配置
security:
redact_secrets: true # 自动脱敏密钥
tirith_enabled: true # 启用安全检查
command_allowlist: [] # 命令白名单
website_blocklist:
enabled: true
domains: ["malicious.com"]
4. 性能优化
# 启用上下文压缩
compression:
enabled: true
threshold: 0.5
target_ratio: 0.2
# 智能模型路由
smart_model_routing:
enabled: true
max_simple_chars: 160
cheap_model:
provider: openrouter
model: google/gemini-2.5-flash
十、常见问题
Q1: 模型连接超时?
# 检查网络 curl -I https://api.example.com # 切换 Provider hermes> patch config.yaml "provider: custom" "provider: ollama"
Q2: 定时任务不执行?
# 检查 cron 服务状态 hermes> cronjob action="list" # 查看日志 tail -f ~/.hermes/logs/hermes.log
Q3: 记忆丢失?
# 记忆文件位置 ls -la ~/.hermes/memory/ cat ~/.hermes/memory/*.json
Q4: 技能加载失败?
# 验证技能格式 hermes> skill_view name="problematic-skill" # 重新创建技能 hermes> skill_manage action="delete" name="xxx" hermes> skill_manage action="create" name="xxx" ...
十一、资源链接
官方资源
| 资源 | 链接 |
|---|---|
| GitHub | https://github.com/NousResearch/hermes-agent |
| 官方文档 | https://hermes-agent.nousresearch.com/docs/ |
| Nous Research | https://nousresearch.com |
| Discord 社区 | https://discord.gg/NousResearch |
| Skills Hub | https://agentskills.io |
文档分类
| 分类 | 内容 |
|---|---|
| 快速入门 | 2 分钟安装 → 设置 → 第一次对话 |
| CLI 使用 | 命令、快捷键、人格、会话 |
| 配置指南 | 配置文件、Provider、模型、所有选项 |
| 消息网关 | Telegram、Discord、Slack、WhatsApp、Signal |
| 安全 | 命令审批、DM 配对、容器隔离 |
| 工具系统 | 40+ 工具、工具集、终端后端 |
| 技能系统 | 程序性记忆、Skills Hub、创建技能 |
| 记忆 | 持久记忆、用户画像、最佳实践 |
| MCP 集成 | 连接任意 MCP 服务器扩展能力 |
| 定时任务 | 计划任务与平台交付 |
| 上下文文件 | 塑造每次对话的项目上下文 |
| 架构 | 项目结构、代理循环、关键类 |
| 贡献 | 开发设置、代码风格、PR 流程 |
本地路径
~/.hermes/ # 主目录 ├── config.yaml # 配置文件 ├── skills/ # 技能库 ├── memory/ # 记忆数据 ├── checkpoints/ # 会话快照 ├── cron/ # 定时任务 ├── logs/ # 日志目录 └── workspace/ # 工作区
十二、从 OpenClaw 迁移
如果你之前使用 OpenClaw,Hermes 可以自动导入你的设置、记忆、技能和 API 密钥。
迁移命令
# 交互式迁移(完整预设) hermes claw migrate # 预览将迁移的内容 hermes claw migrate --dry-run # 仅迁移用户数据(不含密钥) hermes claw migrate --preset user-data # 覆盖现有冲突 hermes claw migrate --overwrite
迁移内容
| 内容 | 说明 |
|---|---|
| SOUL.md | 人格文件 |
| Memories | MEMORY.md 和 USER.md 条目 |
| Skills | 用户创建的技能 → ~/.hermes/skills/openclaw-imports/ |
| Command allowlist | 审批模式 |
| Messaging settings | 平台配置、允许的用户、工作目录 |
| API keys | 允许的密钥(Telegram、OpenRouter、OpenAI、Anthropic、ElevenLabs) |
| TTS assets | 工作区音频文件 |
| Workspace instructions | AGENTS.md(使用 --workspace-target) |
十三、下一步
现在你已经掌握了 Hermes 的基础用法,可以尝试:
- 🎯 创建第一个定时任务(如每日新闻摘要)
- 🔧 编写自定义技能(自动化你的工作流)
- 🌐 集成更多平台(Discord/Telegram)
- 🧠 配置记忆系统(让 AI 记住你的偏好)
- 🤖 探索子代理功能(并行处理复杂任务)
提示:Hermes 的核心价值在于可扩展性。随着使用深入,你会积累自己的技能库和工作流,让 AI 助手越来越懂你!
有问题? 在评论区留言或访问 GitHub Issues 获取帮助。