Files
hermes-agent/website/docs/developer-guide/gateway-classic-cli.md
Teknium 0190774d73 docs(gateway): describe the launch options and slash commands the client actually has
The developer guides still listed skills, checkpoints, YOLO, hook acceptance,
pass-session-id, safe mode, ignored rules/user config, title selection,
create-if-missing, usage reports and API credentials as refused by `hermes chat`,
and said other slash commands reject. At this head gateway_chat forwards all of
those as frozen creation policy (`_POLICY`, advertised by runtime.describe from
session_policy.CREATE_FIELDS), and the view dispatches /discard, /branch, /model,
/compress (session.mutate) and /yolo (config.set). Probe
(lanes/docs/probe_chat_flags.py, real parser + validate_options): 13 accepted,
only -w, --image, --run-budget, -v, --no-restore-cwd, bare -c, --resume latest
and a nameless --create-if-missing refuse.

- gateway-classic-cli.md: accepted vs refused table with the reason and
  replacement per refused flag; slash surface; resume may repeat creation flags.
- user-guide/cli.md: same refusal list and frozen-at-creation list; /yolo.
- gateway-local-sessions.md: all six sources; the full CREATE_FIELDS launch
  contract instead of "still return invalid_params"; runtime.describe shape.
- session-storage.md: the gateway is the only canonical session writer; the four
  runtime-ledger tables (ON DELETE RESTRICT, unknown never replayed) and why
  `sessions recover` excludes them.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5458083694
Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5462648005
2026-10-08 19:09:50 -07:00

6.4 KiB

title, description
title description
Classic gateway client How hermes chat / --cli attach to the gateway authority

Classic gateway client (initial migration)

Normal hermes --cli, hermes chat, hermes chat -q '…' -Q, and top-level hermes -z '…' use the gateway authority. Direct cli.main chat launches also hand off before constructing a local agent. Local bootstrap uses the canonical ensure lifecycle and a single-use private control ticket, not service installation. An explicit HERMES_TUI_GATEWAY_URL remains remote-only: failed connection or authentication never launches a local replacement.

The client prints the persisted Session: ID to stderr. Resume with hermes --cli chat --resume ID. Input is admitted with a fresh input_id; events and final replies come from the authority. /quit, /exit, /detach, EOF and closing the terminal detach only. /stop sends an execution-generation-fenced interrupt. Pending approvals display /approve ID once|deny|…; clarification uses /answer ID TEXT. The client uses the displayed prompt ID and its captured generation, not a locally reconstructed waiter. /discard ID acknowledges an admission lost across an owner restart (prompt.resolve_unknown). /branch [title], /model <model> [--provider name] and /compress [here [N] | <focus>] [--preview] are revision-fenced session.mutate operations (hermes_cli/gateway_mutations.py); /yolo [on|off] toggles this session's approval bypass on the owner (config.set key yolo). Every other slash command is refused (Unsupported gateway CLI command; use /help.) instead of running a local mutation; use hermes --tui for the full registry.

One-shot stdout contains only the final reply. Exit status is 0 for a completed admission, 1 for failed execution/connection, 2 for unsupported frontend options, 3 for a pending control that requires interactive reattachment, and 130 for a keyboard detach. A pending control does not imply cancellation. -z no longer implicitly bypasses approval policy.

Launch options

The gateway advertises its accepted creation parameters through runtime.describe (session_create.parameters, from gateway.session_policy.CREATE_FIELDS). The client sends a creation option only when it is advertised; a requested option an older gateway does not advertise is refused (Gateway does not support creation options: …). Caller cwd is sent when advertised; an old gateway lacking cwd support prints a warning that it uses its configured execution directory, while explicit --in rejects. A resume may repeat the exact creation flags the session was frozen with (scripts re-run one command line); any flag that would change the frozen route rejects.

Accepted and frozen into the session at creation (_POLICY in hermes_cli/gateway_chat.py): --model, --provider, --base-url, --api-key (memory-only, never persisted), --reasoning, --toolsets, --max-turns, --skills (rendered once into the frozen prompt), --checkpoints, --yolo, --accept-hooks (also HERMES_ACCEPT_HOOKS=1), --pass-session-id, --ignore-rules, --ignore-user-config and --safe-mode (both need an explicit --model; safe mode runs the turn in an isolated worker that never reads the profile). Also accepted: --source <label>, --resume <id-or-title>, -c <title>, -c <title> --create-if-missing, --in <dir>, --query-file, --format stream-json, and -z ... --usage-file.

Refused with exit 2 (_UNSUPPORTED plus the selection checks in validate_options); the error names where each capability lives now:

Option Why Use instead
-w / --worktree Worktree creation is a launcher-side step the authority does not expose hermes --tui -w
--image No client-side attachment staging on this path attach in hermes --tui or Desktop
--run-budget No per-launch run budget in the creation contract agent.run_budget_seconds in config.yaml
-v / --verbose Display-only; the client has no verbose renderer hermes logs --follow (the refusal also names hermes chat --tui -v, whose canonical Ink path does not yet carry the flag)
--no-restore-cwd The gateway keeps the session's frozen cwd --in <dir>
bare -c, --resume latest Need a breadcrumb/MRU lookup the authority does not expose -c <name>, or hermes --tui -c
--create-if-missing without -c <name> Nothing to create by name -c <name> --create-if-missing

--compact, --list-tools and --list-toolsets are not hermes chat options at all (argparse rejects them); the client keeps refusal text for direct cli.main hand-offs (display.compact, hermes tools list).

Current parity limits — not full classic CLI parity

Full legacy presentation, slash registry parity, interactive history editing, auto-reconnect, lost-ACK durable client journals, remote login bootstrap, cold-owner resume and native Windows/macOS QA remain outstanding. The client preserves an explicit remote URL's existing authentication mechanism; it does not acquire or mint remote credentials.

tests/hermes_cli/test_gateway_chat_native.py exercises native tmux/PTY classic fresh input, detach, persisted-ID resume and one-shot through the ordinary daemon with a loopback model, isolated HOME/HERMES_HOME and caller cwd. Constructor instrumentation records no client AIAgent, SessionDB or GatewayRunner. The test also denies an invalid approval choice, then reconnects and consents before a real terminal effect on an owned fixture. Stale-control/active-Stop native coverage and native clarify interaction remain separate acceptance work.

For two-checkout compatibility testing, load the narrowly scoped pytest option plugin and specify the disposable gateway peer's checkout (the normal runner's hermetic environment deliberately removes arbitrary environment overrides):

scripts/run_tests.sh -j 1 --file-retries 0 tests/hermes_cli/test_gateway_chat_native.py \
  -p tests.hermes_cli.gateway_client_options --client-test-runtime-root=/path/to/runtime-checkout

The receipt explicitly reports caller_cwd_effect_verified. On a cwd-capable runtime the native client submits model/toolsets/cwd and the real terminal writes its actual execution directory into an owned temporary receipt. On an older runtime, explicit --in must reject without that effect. Do not count the latter as cwd parity. Both client and daemon use isolated test homes; this option does not install a service or alter the selected checkout.