This page documents the interactive terminal chat experience provided by the Hermes Agent CLI. It covers the REPL architecture, prompt_toolkit integration, slash commands, and session management.
The interactive chat is managed primarily by the HermesCLI class in cli.py. It orchestrates the lifecycle of a conversation by bridging user input to the AIAgent core.
prompt_toolkit to manage a fixed input widget (TextArea) at the bottom of the terminal with scrolling output above cli.py60-75hermes_cli/banner.py renders the ASCII logo and version labels.hermes_cli/commands.py provides a central COMMAND_REGISTRY for slash commands and tab-completion hermes_cli/commands.py64-130AIAgent (from run_agent.py) handles the conversation loop, tool execution, and response management run_agent.py5-21Diagram 1: Interactive Chat Component Map
Sources: cli.py55-75 hermes_cli/commands.py45-64 run_agent.py17-21 cli.py81-89
The CLI uses an asynchronous REPL loop. patch_stdout() is used to ensure that background updates (like the agent's spinner or tool progress) do not corrupt the user's input line cli.py63 The system supports multi-line input via Shift+Enter or Ctrl+Enter aliases cli.py81-89
Diagram 2: Input-to-Agent Execution Flow
Sources: cli.py60-90 hermes_cli/commands.py1-9 run_agent.py136-141 gateway/run.py68-70
Commands are defined in hermes_cli/commands.py and categorized for the help system. The COMMAND_REGISTRY is the single source of truth for the CLI, gateway, and autocomplete hermes_cli/commands.py61-64
| Command | Alias | Description |
|---|---|---|
/new | /reset | Start a new session (fresh ID + history) hermes_cli/commands.py68-69 |
/retry | - | Retry the last message (resend to agent) hermes_cli/commands.py80 |
/undo | - | Remove the last user/assistant exchange hermes_cli/commands.py83-84 |
/rollback | - | List or restore filesystem checkpoints hermes_cli/commands.py93-94 |
/background | /bg | Run a prompt in a separate background session hermes_cli/commands.py102-103 |
/goal | - | Set a standing goal Hermes works on across turns hermes_cli/commands.py114-115 |
/steer | - | Inject a mid-run note after the next tool call hermes_cli/commands.py112-113 |
| Command | Alias | Description |
|---|---|---|
/model | - | Switch model/provider for this session hermes_cli/commands.py137-138 |
/config | - | Show or edit current configuration hermes_cli/commands.py134-135 |
/status | - | Show session info, token totals, and recaps hermes_cli/commands.py120 |
/clear | - | Clear screen and start a new session hermes_cli/commands.py73-74 |
Sources: hermes_cli/commands.py64-140
Interactive mode ensures continuity through several mechanisms:
~/.hermes/ by default hermes_cli/config.py4-6~/.hermes_history via prompt_toolkit.history.FileHistory cli.py61ContextCompressor monitors context usage and triggers summarization. Manual compression is available via /compress hermes_cli/commands.py91-92~/.hermes/.env and the project root run_agent.py119-132When a session starts, the system resolves credentials and configuration using a priority chain:
config.yaml → .env → defaults hermes_cli/config.py9-15~/.hermes/.env while behavior settings go to config.yaml hermes_cli/config.py5-6request_timeout_seconds) are applied at runtime cli-config.yaml.example109-124hermes_cli/auth.py manages tokens for providers like Nous Portal and xAI hermes_cli/auth.py4-17Diagram 3: Provider Resolution Hierarchy
Sources: hermes_cli/auth.py8-13 hermes_cli/config.py4-15 hermes_cli/models.py39-99 cli-config.yaml.example13-43
Refresh this wiki
This wiki was recently refreshed. Please wait 3 days to refresh again.