Skip to content

The agent that grows with you

fix(cli): gateway-chat refusals say where each flag went and show a runnable safe-mode command

teknium12f925457092d
diff --git a/hermes_cli/gateway_chat.py b/hermes_cli/gateway_chat.py
index 67bea7e48d6..960640923d8 100644
--- a/hermes_cli/gateway_chat.py
+++ b/hermes_cli/gateway_chat.py
@@ -21,6 +21,28 @@ _UNSUPPORTED = (
)
_POLICY = ("model", "provider", "reasoning", "toolsets", "max_turns", "base_url", "ignore_rules", "api_key",
"safe_mode", "ignore_user_config")
+# Where each refused option lives now; the refusal names it so the user is not left guessing.
+_RELOCATED = {
+ "image": "attach the image in `hermes --tui` or the Desktop app",
+ "skills": "`hermes --tui -s <skill>`",
+ "worktree": "`hermes --tui -w`",
+ "w": "`hermes --tui -w`",
+ "checkpoints": "`checkpoints.enabled: true` in config.yaml, or `hermes --tui --checkpoints`",
+ "pass_session_id": "`hermes --tui --pass-session-id`",
+ "yolo": "`approvals.mode: off` in config.yaml, or `/yolo` inside the session",
+ "accept_hooks": "`hooks_auto_accept: true` in config.yaml, or `hermes --tui --accept-hooks`",
+ "no_restore_cwd": "`--in <dir>` (the gateway keeps the session's frozen cwd)",
+ "usage_file": "`hermes sessions stats` / `hermes insights` after the run",
+ "run_budget": "`agent.run_budget_seconds` in config.yaml",
+ "verbose": "`hermes logs --follow`, or `hermes --tui -v`",
+ "compact": "`display.compact: true` in config.yaml",
+ "list_tools": "`hermes tools list`",
+ "list_toolsets": "`hermes tools list`",
+ "resume latest": "`hermes --tui --resume latest`, or `hermes sessions list` then `--resume <id>`",
+ "continue": "`-c <name>` (or `hermes --tui -c` for the most recent session)",
+ "create-if-missing without -c <name>": "`-c <name> --create-if-missing`",
+}
+_SAFE_MODE_EXAMPLE = 'hermes chat --safe-mode --provider openrouter --model anthropic/claude-sonnet-4 -q "hello"'
def bypass_launch(args) -> bool:
@@ -45,13 +67,16 @@ def validate_options(args):
unsupported.append("create-if-missing without -c <name>")
if unsupported:
flags = ", ".join("--" + name.replace("_", "-") for name in unsupported)
- raise GatewayClientError(f"Unsupported gateway CLI options: {flags}. No local fallback or policy changes were made.")
+ where = "".join(f"\n --{name.replace('_', '-')}: use {_RELOCATED[name]}" for name in unsupported)
+ raise GatewayClientError(
+ f"Unsupported gateway CLI options: {flags}. No local fallback or policy changes were made.{where}")
resuming = getattr(args, "resume", None) or (continue_title(args) and not getattr(args, "create_if_missing", False))
if resuming and (getattr(args, "in_dir", None) or getattr(args, "source", None) or
any(getattr(args, name, None) not in (None, False) for name in _POLICY)):
raise GatewayClientError("Resume retains gateway session policy; creation overrides are unsupported on resume.")
if bypass_launch(args) and not getattr(args, "model", None):
- raise GatewayClientError("--safe-mode / --ignore-user-config read no profile default: pass --model explicitly.")
+ raise GatewayClientError("--safe-mode / --ignore-user-config read no profile default: pass --model explicitly."
+ f"\n Example: {_SAFE_MODE_EXAMPLE}")
async def run_gateway_chat(args):
diff --git a/tests/hermes_cli/test_gateway_chat.py b/tests/hermes_cli/test_gateway_chat.py
index 42190ca2329..5dea52ae582 100644
--- a/tests/hermes_cli/test_gateway_chat.py
+++ b/tests/hermes_cli/test_gateway_chat.py
@@ -27,6 +27,26 @@ def test_unsupported_launch_options_fail_before_connection(monkeypatch, capsys):
assert calls == []
+def test_refusals_name_the_replacement_and_a_runnable_safe_mode_example(monkeypatch, capsys):
+ """An exit-2 refusal tells the user where every refused flag went; the safe-mode
+ refusal prints a command they can run as-is."""
+ from hermes_cli import gateway_chat
+ monkeypatch.setattr(gateway_chat, "connect_gateway", lambda: pytest.fail("connected"))
+ assert gateway_chat.launch_from_args(argparse.Namespace(yolo=True, run_budget=30.0)) == 2
+ err = capsys.readouterr().err
+ assert "--yolo: use" in err and "approvals.mode" in err
+ assert "--run-budget: use" in err and "run_budget_seconds" in err
+ for name in gateway_chat._UNSUPPORTED:
+ assert name in gateway_chat._RELOCATED, f"{name} refused without saying where it went"
+ assert gateway_chat.launch_from_args(argparse.Namespace(safe_mode=True, query="x")) == 1
+ err = capsys.readouterr().err
+ example = next(line.split("Example: ", 1)[1] for line in err.splitlines() if "Example: " in line)
+ import shlex
+ from hermes_cli._parser import build_top_level_parser
+ parsed = build_top_level_parser()[0].parse_args(shlex.split(example)[1:])
+ assert parsed.safe_mode and parsed.model and parsed.provider and parsed.query
+
+
@pytest.mark.asyncio
async def test_creation_preserves_advertised_cwd_model_and_toolsets(monkeypatch, tmp_path):
from contextlib import asynccontextmanager
diff --git a/website/docs/user-guide/cli.md b/website/docs/user-guide/cli.md
index b03177672a4..503200d9f43 100644
--- a/website/docs/user-guide/cli.md
+++ b/website/docs/user-guide/cli.md
@@ -129,7 +129,7 @@ for the exact supported subset and trust boundary.
## Interface Layout
:::info The classic CLI is a gateway client
-`hermes chat` (and the bare `hermes` prompt when `display.interface` is `cli`) no longer runs the agent inside your terminal process. It discovers or starts the profile's gateway (`hermes gateway ensure`), creates or resumes the session there, and attaches over the gateway's local WebSocket — the same session a Desktop window, the TUI, or a Telegram topic can open at the same time. Closing the terminal detaches (`Detached; accepted work continues at the gateway.`); it does not cancel the turn. Your working directory, `--model`, `--provider`, `--reasoning`, `--toolsets`, `--max-turns`, `--ignore-rules`, `--base-url`/`--api-key`, and `--safe-mode`/`--ignore-user-config` are frozen into the session at creation and cannot be changed by `--resume`. `--resume <id-or-title>` and `-c <title>` name the session; the gateway resolves the title (exact id first, then the latest `"<title> #N"` continuation, followed to its live tip) among the sessions you may read, and reports `No session found matching '…'` (exit 1) otherwise. `-c <title> --create-if-missing` creates a session with that title when none exists and resumes it when one does, so programmatic callers (Bot Mode's `Bot Chat` turns) get a deterministic thread. Options that only make sense for an in-process agent — `--image`, `--skills`, `--worktree`, `--checkpoints`, `--yolo`, `--pass-session-id`, bare `--continue` (no name), `--create-if-missing` without `-c <name>`, `--run-budget`, `--verbose`, `--compact`, `--list-tools`, `--list-toolsets`, and `--resume latest` — are refused up front (`Unsupported gateway CLI options: …`, exit 2); nothing falls back to a local agent. In this mode the slash surface is `/stop`, `/approve <id> <choice>`, `/answer <id> <text>`, `/discard <admission_id>`, `/branch [title]`, `/model <model> [--provider name]`, `/compress [focus]`, `/help` and `/quit`; other slash commands print `Unsupported gateway CLI command; use /help.` Use the TUI (`hermes --tui`) for the full slash registry.
+`hermes chat` (and the bare `hermes` prompt when `display.interface` is `cli`) no longer runs the agent inside your terminal process. It discovers or starts the profile's gateway (`hermes gateway ensure`), creates or resumes the session there, and attaches over the gateway's local WebSocket — the same session a Desktop window, the TUI, or a Telegram topic can open at the same time. Closing the terminal detaches (`Detached; accepted work continues at the gateway.`); it does not cancel the turn. Your working directory, `--model`, `--provider`, `--reasoning`, `--toolsets`, `--max-turns`, `--ignore-rules`, `--base-url`/`--api-key`, and `--safe-mode`/`--ignore-user-config` are frozen into the session at creation and cannot be changed by `--resume`. `--resume <id-or-title>` and `-c <title>` name the session; the gateway resolves the title (exact id first, then the latest `"<title> #N"` continuation, followed to its live tip) among the sessions you may read, and reports `No session found matching '…'` (exit 1) otherwise. `-c <title> --create-if-missing` creates a session with that title when none exists and resumes it when one does, so programmatic callers (Bot Mode's `Bot Chat` turns) get a deterministic thread. Options that only make sense for an in-process agent — `--image`, `--skills`, `--worktree`, `--checkpoints`, `--yolo`, `--pass-session-id`, bare `--continue` (no name), `--create-if-missing` without `-c <name>`, `--run-budget`, `--verbose`, `--compact`, `--list-tools`, `--list-toolsets`, and `--resume latest` — are refused up front (`Unsupported gateway CLI options: …`, exit 2); the refusal lists, per flag, where that capability lives now (the TUI flag, the `config.yaml` key, or the `hermes` subcommand), and nothing falls back to a local agent. A `--safe-mode` / `--ignore-user-config` launch reads no profile default model, so it must name one; the refusal prints a complete example such as `hermes chat --safe-mode --provider openrouter --model anthropic/claude-sonnet-4 -q "hello"`. In this mode the slash surface is `/stop`, `/approve <id> <choice>`, `/answer <id> <text>`, `/discard <admission_id>`, `/branch [title]`, `/model <model> [--provider name]`, `/compress [focus]`, `/help` and `/quit`; other slash commands print `Unsupported gateway CLI command; use /help.` Use the TUI (`hermes --tui`) for the full slash registry.
:::
<img className="docs-terminal-figure" src="/docs/img/docs/cli-layout.svg" alt="Stylized preview of the Hermes CLI layout showing the banner, conversation area, and fixed input prompt." />