跳到主要内容

CLI 界面

Hermes Agent 的 CLI 是一个完整的终端用户界面,不是 Web UI。它支持多行编辑、斜杠命令补全、对话历史、中断并重定向,以及流式工具输出,专为长期在终端中工作的人设计。

提示

Hermes 还提供了一个现代化 TUI,支持模态浮层、鼠标选择和非阻塞输入。可通过 hermes --tui 启动,详见 TUI 指南。

Running the CLI

# Start an interactive session (default)
hermes

# Single query mode (non-interactive)
hermes chat -q "Hello"

# With a specific model
hermes chat --model "anthropic/claude-sonnet-4"

# With a specific provider
hermes chat --provider nous # Use Nous Portal
hermes chat --provider openrouter # Force OpenRouter

# With specific toolsets
hermes chat --toolsets "web,terminal,skills"

# Start with one or more skills preloaded
hermes -s hermes-agent-dev,github-auth
hermes chat -s github-pr-workflow -q "open a draft PR"

# Resume previous sessions
hermes --continue # Resume the most recent CLI session (-c)
hermes --resume <session_id> # Resume a specific session by ID (-r)

# Verbose mode (debug output)
hermes chat --verbose

# Isolated git worktree (for running multiple agents in parallel)
hermes -w # Interactive mode in worktree
hermes -w -q "Fix issue #123" # Single query in worktree

Interface Layout

Stylized preview of the Hermes CLI layout showing the banner, conversation area, and fixed input prompt.

Hermes CLI 的横幅、对话流和固定输入提示以稳定的文档插图展示,而不是脆弱的文本艺术。

欢迎横幅会一眼显示当前模型、终端后端、工作目录、可用工具和已安装技能。

Status Bar

输入区域上方有一条持久状态栏,会实时更新:

 ⚕ claude-sonnet-4-20250514 │ 12.4K/200K │ [██████░░░░] 6% │ $0.06 │ 15m
ElementDescription
Model name当前模型名(超过 26 个字符会截断)
Token count已使用上下文 token / 最大上下文窗口
Context bar带阈值颜色编码的可视化填充条
Cost估算的会话成本(未知或零价模型则为 n/a
Duration已经过的会话时长

状态栏会自动适配终端宽度:宽度 >= 76 列时显示完整布局,52 到 75 列时显示紧凑布局,低于 52 列时只显示最简信息(模型 + 时长)。

上下文颜色规则:

ColorThresholdMeaning
Green< 50%空间充足
Yellow50–80%逐渐变满
Orange80–95%接近上限
Red>= 95%即将溢出,建议考虑 /compress

如需更详细的拆分,包括按类别区分的成本(输入 token 与输出 token),请使用 /usage

Session Resume Display

当你恢复一个已有会话(hermes -chermes --resume <id>)时,横幅和输入提示之间会显示一个 “Previous Conversation” 面板,用于紧凑回顾先前的对话历史。详见 Sessions — Conversation Recap on Resume

Keybindings

KeyAction
Enter发送消息
Alt+Enter or Ctrl+J插入换行(多行输入)
Alt+V当终端支持时,从剪贴板粘贴图片
Ctrl+V粘贴文本,并在可能时附带剪贴板图片
Ctrl+B当语音模式启用时开始 / 停止录音(voice.record_key,默认 ctrl+b
Ctrl+C中断 agent(2 秒内双击可强制退出)
Ctrl+D退出
Ctrl+Z将 Hermes 挂起到后台(仅 Unix)。在 shell 中运行 fg 继续。
Tab接受自动建议(ghost text)或补全斜杠命令

Slash Commands

输入 / 即可看到补全面板。Hermes 支持大量 CLI 斜杠命令、动态技能命令,以及用户自定义的快速命令。

常见示例:

CommandDescription
/help显示命令帮助
/model查看或切换当前模型
/tools列出当前可用工具
/skills browse浏览技能中心和官方 optional skills
/background <prompt>在单独的后台会话中运行一个 prompt
/skin查看或切换当前 CLI skin
/voice on启用 CLI 语音模式(按 Ctrl+B 录音)
/voice tts切换 Hermes 回复的语音播报
/reasoning high提高推理强度
/title My Session为当前会话命名

完整的 CLI 与消息平台内置命令列表,请参见 Slash Commands Reference

关于设置、provider、静默调优,以及消息 / Discord 中的语音使用,请参见 Voice Mode

提示

命令不区分大小写,/HELP/help 的效果完全相同。已安装的技能也会自动变成斜杠命令。

Quick Commands

你可以定义自定义命令,在不调用 LLM 的情况下即时执行 shell 命令。这些命令既适用于 CLI,也适用于消息平台(Telegram、Discord 等)。

# ~/.hermes/config.yaml
quick_commands:
status:
type: exec
command: systemctl status hermes-agent
gpu:
type: exec
command: nvidia-smi --query-gpu=utilization.gpu,memory.used --format=csv,noheader

配置完成后,只需在任意聊天中输入 /status/gpu。更多示例见 Configuration guide

Preloading Skills at Launch

如果你在启动前就已经知道本会话需要启用哪些技能,可以直接在命令行中传入:

hermes -s hermes-agent-dev,github-auth
hermes chat -s github-pr-workflow -s github-auth

Hermes 会在第一轮对话开始前,把每个指定技能加载进会话 prompt 中。这个参数同时适用于交互模式和单次查询模式。

Skill Slash Commands

安装在 ~/.hermes/skills/ 下的每个技能都会自动注册为一个斜杠命令。技能名本身就是命令名:

/gif-search funny cats
/axolotl help me fine-tune Llama 3 on my dataset
/github-pr-workflow create a PR for the auth refactor

# Just the skill name loads it and lets the agent ask what you need:
/excalidraw

Personalities

你可以设置预定义 personality,改变 agent 的说话风格:

/personality pirate
/personality kawaii
/personality concise

内置 personality 包括:helpfulconcisetechnicalcreativeteacherkawaiicatgirlpirateshakespearesurfernoiruwuphilosopherhype

你也可以在 ~/.hermes/config.yaml 中定义自定义 personality:

personalities:
helpful: "You are a helpful, friendly AI assistant."
kawaii: "You are a kawaii assistant! Use cute expressions..."
pirate: "Arrr! Ye be talkin' to Captain Hermes..."
# Add your own!

Multi-line Input

输入多行消息有两种方式:

  1. Alt+Enter or Ctrl+J - 插入新的一行
  2. 反斜杠续行 - 在行尾输入 \ 继续下一行:
❯ Write a function that:\
1. Takes a list of numbers\
2. Returns the sum
信息

支持直接粘贴多行文本。你可以使用 Alt+EnterCtrl+J 插入换行,也可以直接粘贴整段内容。

Interrupting the Agent

你可以在任意时刻中断 agent:

  • 在 agent 工作时输入新消息并按 Enter,当前操作会被中断,随后处理你的新指令
  • Ctrl+C - 中断当前操作(2 秒内按两次可强制退出)
  • 正在运行的终端命令会被立即终止(先 SIGTERM,1 秒后 SIGKILL)
  • 中断期间输入的多条消息会被合并成一个 prompt

Busy Input Mode

display.busy_input_mode 配置项决定了在 agent 正忙时按下 Enter 会发生什么:

ModeBehavior
"interrupt"(默认)你的消息会立即中断当前操作,并马上处理
"queue"你的消息会静默排队,在 agent 完成当前工作后作为下一轮发送
# ~/.hermes/config.yaml
display:
busy_input_mode: "queue" # or "interrupt" (default)

Queue 模式适合那些想先写好后续消息,但又不想不小心打断当前工作的场景。未知值会自动回退到 "interrupt"

Suspending to Background

在 Unix 系统中,可以按 Ctrl+Z 把 Hermes 挂起到后台,就像其他终端进程一样。shell 会打印提示:

Hermes Agent has been suspended. Run `fg` to bring Hermes Agent back.

在 shell 中输入 fg,就能从原位置恢复会话。Windows 不支持该功能。

Tool Progress Display

CLI 会在 agent 工作时显示动态反馈:

思考动画(API 调用期间):

  ◜ (。•́︿•̀。) pondering... (1.2s)
◠ (⊙_⊙) contemplating... (2.4s)
✧٩(ˊᗜˋ*)و✧ got it! (3.1s)

工具执行流:

  ┊ 💻 terminal `ls -la` (0.3s)
┊ 🔍 web_search (1.2s)
┊ 📄 web_extract (2.1s)

可通过 /verbose 在以下显示模式间循环切换:off → new → all → verbose。这个命令也可以启用于消息平台,详见 configuration

Tool Preview Length

display.tool_preview_length 配置项控制工具调用预览行中最多显示多少字符,比如文件路径或终端命令。默认值是 0,表示不限制,完整显示路径和命令。

# ~/.hermes/config.yaml
display:
tool_preview_length: 80 # Truncate tool previews to 80 chars (0 = no limit)

这对于窄终端,或者工具参数中包含很长文件路径时特别有用。

Session Management

Resuming Sessions

当你退出 CLI 会话时,终端会打印恢复命令:

Resume this session with:
hermes --resume 20260225_143052_a1b2c3

Session: 20260225_143052_a1b2c3
Duration: 12m 34s
Messages: 28 (5 user, 18 tool calls)

恢复选项包括:

hermes --continue                          # Resume the most recent CLI session
hermes -c # Short form
hermes -c "my project" # Resume a named session (latest in lineage)
hermes --resume 20260225_143052_a1b2c3 # Resume a specific session by ID
hermes --resume "refactoring auth" # Resume by title
hermes -r 20260225_143052_a1b2c3 # Short form

恢复时会从 SQLite 中完整加载历史对话。agent 能看到所有先前的消息、工具调用和回复,就像你从未离开过一样。

你可以在聊天中使用 /title My Session Name 为当前会话命名,也可以在命令行中使用 hermes sessions rename <id> <title>。如果想浏览过去的会话,则使用 hermes sessions list

Session Storage

CLI 会话保存在 Hermes 的 SQLite 状态数据库 ~/.hermes/state.db 中。数据库中会记录:

  • 会话元数据(ID、标题、时间戳、token 计数器)
  • 消息历史
  • 压缩 / 恢复链条中的 lineage
  • session_search 所依赖的全文搜索索引

某些消息平台适配器还会在数据库旁边保留各平台的 transcript 文件,但 CLI 本身恢复会话时只依赖 SQLite 会话存储。

Context Compression

当长对话接近上下文上限时,Hermes 会自动对其进行总结:

# In ~/.hermes/config.yaml
compression:
enabled: true
threshold: 0.50 # Compress at 50% of context limit by default

# Summarization model configured under auxiliary:
auxiliary:
compression:
model: "google/gemini-3-flash-preview" # Model used for summarization

压缩触发后,中间轮次会被摘要化,而前 3 轮和后 4 轮始终保留。

Background Sessions

你可以在单独的后台会话中运行一个 prompt,同时继续使用当前 CLI 做别的事:

/background Analyze the logs in /var/log and summarize any errors from today

Hermes 会立即确认任务,并把控制权还给你:

🔄 Background task #1 started: "Analyze the logs in /var/log and summarize..."
Task ID: bg_143022_a1b2c3

How It Works

每个 /background prompt 都会在守护线程中启动一个完全独立的 agent 会话

  • 会话隔离 - 后台 agent 不知道你当前会话的历史,只会接收你给它的那条 prompt
  • 配置相同 - 后台 agent 会继承当前会话的模型、provider、工具集、推理设置和 fallback model
  • 前台不阻塞 - 当前会话保持完全可交互。你可以继续聊天、运行命令,甚至再启动更多后台任务
  • 支持多个任务 - 你可以同时运行多个后台任务,每个都有独立编号

Results

后台任务完成后,其结果会以一个面板的形式出现在终端中:

╭─ ⚕ Hermes (background #1) ──────────────────────────────────╮
│ Found 3 errors in syslog from today: │
│ 1. OOM killer invoked at 03:22 — killed process nginx │
│ 2. Disk I/O error on /dev/sda1 at 07:15 │
│ 3. Failed SSH login attempts from 192.168.1.50 at 14:30 │
╰──────────────────────────────────────────────────────────────╯

如果任务失败,你会看到错误通知。如果配置中开启了 display.bell_on_complete,任务完成时终端还会响铃。

Use Cases

  • 长时间研究 - 在你写代码时,让 /background 去研究量子纠错的最新进展
  • 文件分析 - 在继续对话的同时,让 /background 去扫描整个仓库里的 Python 文件并汇总安全问题
  • 并行调查 - 同时启动多个后台任务,从不同角度并行探索
信息

后台会话不会出现在主会话历史里。它们是独立会话,拥有自己的任务 ID(例如 bg_143022_a1b2c3)。

Quiet Mode

默认情况下,CLI 运行在 quiet mode:

  • 抑制工具的详细日志输出
  • 启用 kawaii 风格的动画反馈
  • 保持输出简洁、友好

如果你需要调试输出:

hermes chat --verbose