Hermes Agent CLI command line
The CLI (command-line interface) is the most native interaction method for Hermes Agent and also the most complete entry point.
This chapter systematically introduces the CLI's three run modes, session management, slash commands, the TUI interface, shortcuts, and scripting tips.
Three run modes
Hermes CLI offers three run modes, from simple Q&A to interactive sessions to pure keyboard operation, covering different use cases.
Mode 1: Interactive session (hermes chat)
This is the most common mode — launch a persistent multi-turn conversation session.
Start an interactive session (using the default profile):
hermes chat
After launch you enter the chat interface; the prompt changes, then after entering a message press Enter to send and the Agent begins replying:

After entering an interactive session, you can send multiple messages in a row, and the Agent remembers the earlier conversation context.
This is the most natural way to use it in daily development — like chatting with a colleague on Slack.
Mode 2: One-off query (-q / --query)
No need to enter an interactive session; just pass the question and get a reply — suitable for scripting and quick queries.
Example
One-off query: send the question, exit after getting a reply
hermes chat
-q
"Write a quicksort function in Python"
Use with a profile
coder chat
-q
"Review the code style of src/main.py"
Use in a shell script
hermes chat
-q
"Extract the error lines from the following logs"
<
error.log
-q Key characteristics of the mode:
- Non-interactive; the Agent exits immediately after replying
- Returns a standard exit code, so scripts can judge success or failure
- Supports pipes and redirection
Mode 3: TUI terminal interface (hermes --tui)
The TUI (Terminal User Interface) provides a full-screen terminal interface operated purely by keyboard.
Example
Launch TUI mode
hermes
--tui
In TUI mode:
Up/down arrows: browse conversation history
Ctrl+N: create a new session
Ctrl+S: toggle the sidebar (files, tool history, etc.)
Ctrl+C: interrupt the Agent's current operation
/ prefix: enter a slash command
Unique advantages of TUI mode:
- The sidebar can show the conversation, file changes, and tool-call history at once
- Pure keyboard operation, no mouse dependency
- Suitable for long, deep-work sessions
Comparison of the three modes
| Mode | Command | Interaction method | Suitable scenarios |
|---|---|---|---|
| Interactive session | hermes chat | Multi-turn dialog; enter a message then wait for a reply | Daily development, complex tasks |
| One-off query | hermes chat -q "..." | Single question, exit after reply | Scripting, quick queries |
| TUI | hermes --tui | Full-screen keyboard operation, multi-panel | Deep work, file-operation-heavy |
Session management
A session is the basic unit of conversation in the CLI. Each session has its own context, token count, and session ID.
Continue and restore sessions
Example
Continue the most recent session (resume after interruption)
hermes
--continue
hermes chat
--continue
Restore by session title (only if named with /title)
hermes
-c
"Refactor the auth module"
Restore precisely by session ID
hermes
-r
20260305
_091234_abc12345
When restoring a session, the Agent keeps the full conversation context, including previous tool-call records and LLM reasoning history.
Start a new session
Example
Use a slash command in an interactive session
/
new
or
/
reset
Same effect: end the current session and start a new one,
The Agent reloads the system prompt and persistent memory
A new session does not keep the previous conversation context, but the persistent memory (MEMORY.md and USER.md) remains visible.
Session title management
Hermes auto-generates a session title after the first round of conversation; you can also name it manually:
Example
Set a title in the session (for later restoration by title)
/
title Database migration plan discussion
View current session info (ID, title, token usage, etc.)
/
status
Context compression
When the conversation history is too long and approaches the context window limit, you can manually trigger compression:
Example
Manually compress the conversation context
/
compress
After compression, old content is summarized to free up space,
and new messages can continue to be sent.
The compressed session creates an auto-lineage:
"Database migration" -> "Database migration #2"
Auto-compression is triggered automatically by Hermes when context nears the limit. /compress just lets you trigger it manually ahead of time. Both have the same effect.
Common slash commands
In interactive sessions and TUI mode, inputs starting with / are recognized as slash commands.
Below are the most commonly used CLI commands, grouped by function.
Session control
| Command | Function |
|---|---|
| /new or /reset | Start a new session |
| /title |
Set the current session title |
| /status | Show session ID, title, token usage |
| /usage | Show token consumption details for this session |
| /compress | Manually compress the conversation context |
| /resume [title] | Restore a previously named session |
Task control
| Command | Function |
|---|---|
| /stop | Interrupt the task the Agent is currently executing |
| /retry | Let the Agent regenerate the last reply |
| /undo | Undo the previous round of dialog (remove the last Q&A pair) |
| /background |
Run a task asynchronously in a background session |
/undo is a conversation-level undo — it removes the last round of Q&A from the session history, and the Agent's context returns to the state before the previous reply. This differs from /retry (which keeps the original Q&A and lets the Agent re-answer).
Model and configuration
| Command | Function |
|---|---|
| /model | View the currently used model |
| /model |
Switch to a specified model |
| /model list | List all available models |
| /reload-mcp | Reload the MCP server configuration |
Security and approval
| Command | Function |
|---|---|
| /yolo | Enable YOLO mode; dangerous commands in the current session are auto-approved |
| /yolo | Type again to disable YOLO mode |
| /approve | Approve the operation currently awaiting approval |
| /deny | Reject the operation currently awaiting approval |
Memory and skills
| Command | Function |
|---|---|
| /memory | View current memory content |
| /memory pending | View pending memory writes awaiting approval |
| /memory approve all | Approve all pending memory writes |
| /skills | List all installed skills |
| /skills search |
Search local and Hub skills |
| /skills install |
Install a skill |
| / |
Invoke the specified skill to perform a task |
| /learn |
Generate a new skill from documentation or a description |
Others
| Command | Function |
|---|---|
| /checkpoint |
Create a file-system checkpoint |
| /rollback [number] | List or restore to a specified checkpoint |
| /cron list | View the scheduled task list |
| /cron pause/resume |
Pause or resume scheduled tasks |
| /suggestions | View the Agent's automation suggestions |
| /voice on/off/tts | Control voice mode |
| /update | Update Hermes to the latest version |
| /help | Show all available commands |
Shortcuts and tips
Keyboard shortcuts
In an interactive session, the following shortcuts improve efficiency:
| Keyboard shortcut | Function |
|---|---|
| Ctrl+C | Interrupt the Agent's current reply or tool execution |
| Ctrl+D | Exit the interactive session |
| Ctrl+L | Clear screen |
| Ctrl+B (voice mode) | Hold to record, release to send |
| Up arrow | Recall the previous input |
| Tab | Auto-complete file paths and skill names |
Multi-line input
When you need to send a message containing line breaks (e.g. a code block):
Example
Method 1: use \n to represent a line break
hermes chat
-q
"Review the following code:\n\ndef hello():\n print('world')"
Method 2: use a heredoc (shell syntax)
hermes chat
-q
"$(cat << 'EOF'
Please analyze this error stack:
Traceback (most recent call last):
File "
app.py
", line 42, in
main()
File "
app.py
", line 38, in main
result = process(data)
TypeError: 'NoneType' object is not iterable
Please provide a fix.
EOF
)"
Pipes and redirection
-q The mode natively supports standard Unix pipes:
Example
Send file content as context to the Agent
cat
error.log
|
hermes chat
-q
"Analyze these error logs and find the root cause"
Save the Agent's reply to a file
hermes chat
-q
"Generate the project's README.md"
README.md
Use the Agent as a filter in a pipe
cat
data.csv
|
hermes chat
-q
"Extract all email addresses, one per line"
emails.txt
Combine with profile command aliases
Each profile auto-generates dedicated command aliases, no need for -p flag:
Example
Use the profile alias directly, concise and natural
coder chat
-q
"Refactor this function"
researcher chat
-q
"Search for the latest Transformer papers"
admin gateway status
is equivalent to
hermes
-p
coder chat
-q
"Refactor this function"
hermes
-p
researcher chat
-q
"Search for the latest Transformer papers"
hermes
-p
admin gateway status
Approval and security control
Approval mode
When executing dangerous commands in the CLI, Hermes shows an approval prompt:
Agent 请求执行: rm -rf /tmp/build/*
原因: 清理构建缓存
[approve/deny]: _
You can decide to approve or reject in real time within the session.
The approval mode is configured in config.yaml:
Example
File path: ~/.hermes/config.yaml
approvals
:
mode
:
manual
manual (default; every dangerous command requires approval)
smart (intelligent judgment; low-risk ones auto-approved)
off (disable approval; not recommended)
timeout
:
60
Seconds to wait for approval; auto-reject on timeout
YOLO mode
When you are sure the Agent's action is safe (e.g. operations in a familiar project), you can temporarily skip approval:
Example
First time typing /yolo: enable YOLO mode
All commands in the current session are auto-approved
/
yolo
The Agent begins executing operations, no more approval prompts...
Type /yolo again: disable YOLO mode and restore approval
/
yolo
YOLO mode only takes effect in the current session; a new session automatically reverts to the approval mode configured in config.yaml. This ensures a temporary relaxation does not become a permanent vulnerability.
Scripting usage
Using Hermes in a shell script
-q The mode's exit codes and standard output let Hermes integrate seamlessly into shell scripts:
Example
#!/bin/bash
File path: scripts/auto-review.sh
Automated code review script — review each Git-changed file in turn
Get all changed Python files
changed_files
=$
(
git diff
--name-only
HEAD~
1
|
grep
'.py$'
)
for
file
in
$changed_files
;
do
echo
"=== Review: $file ==="
Use Hermes to review code, with results output directly to the terminal
hermes chat
-q
"Review the code style and potential issues of the following Python files:
$(cat "$file")
Please list the issues found and suggestions in list form."
2
/
dev
/
null
Check the exit code
if
[
$?
-ne
0
]
;
then
echo
"[Warning] $file encountered an error during review"
fi
echo
""
done
Combine with Git hooks
Below is a Git pre-commit hook example — let the Agent check code before committing:
Example
#!/bin/bash
File path: .git/hooks/pre-commit
Git pre-commit hook: code is checked by the Agent before commit
Get the list of changed files in the staging area
staged_files
=$
(
git diff
--cached
--name-only
)
if
[
-z
"$staged_files"
]
;
then
exit
0
fi
echo
"Hermes Agent is checking code changes..."
Let the Agent review the staged changes
result
=$
(
hermes chat
-q
"Review the following Git staged code changes,\
Only report serious issues (security vulnerabilities, logic errors, destructive changes).\
If there are no serious issues, reply PASS.\
\
Changed files:\n$staged_files\n\
Detailed diff:\n$(git diff --cached)"
2
/
dev
/
null
)
echo
"$result"
If the Agent finds serious issues, block the commit
if
echo
"$result"
|
grep
-q
"PASS"
;
then
echo
"Review passed"
exit
0
else
echo
""
echo
"The Agent found issues that need attention."
echo
"If you are sure it is correct, use git commit --no-verify to skip this check."
exit
1
fi
Scheduled execution
Combined with the system cron or Hermes's built-in Cron system, you can run CLI tasks periodically — but the built-in Hermes Cron is recommended (via hermes cron create), because it can deliver results directly to messaging platforms.