Skip to content

The agent that grows with you

docs(gateway): describe the launch options and slash commands the client actually has

Teknium0190774d7386
diff --git a/website/docs/developer-guide/gateway-classic-cli.md b/website/docs/developer-guide/gateway-classic-cli.md
index dc5421373f3..be146ececb4 100644
--- a/website/docs/developer-guide/gateway-classic-cli.md
+++ b/website/docs/developer-guide/gateway-classic-cli.md
@@ -18,8 +18,14 @@ 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. Other slash commands explicitly
-reject instead of running local mutations.
+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,
@@ -27,20 +33,49 @@ admission, 1 for failed execution/connection, 2 for unsupported frontend options
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
-The gateway advertises its accepted creation parameters through `runtime.describe`.
-Model, provider, reasoning, toolsets and max-turns are sent only when advertised;
-otherwise explicitly requested options reject. 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. Resume retains existing
-session policy; creation overrides on resume reject.
-
-Images, skills, worktrees, checkpoints, pass-session-id, safe mode, ignored rules
-or user config, YOLO, hook acceptance, continue/latest/title selection,
-create-if-missing, no-restore-cwd, usage reports, run budgets, direct API credentials,
-verbose/compact display and local tool listing are not implemented in this client
-and reject explicitly. Full legacy presentation, slash registry parity, interactive
+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;
diff --git a/website/docs/developer-guide/gateway-local-sessions.md b/website/docs/developer-guide/gateway-local-sessions.md
index 1a49b9484fc..617a55d6f2c 100644
--- a/website/docs/developer-guide/gateway-local-sessions.md
+++ b/website/docs/developer-guide/gateway-local-sessions.md
@@ -65,11 +65,14 @@ OpenAI API-to-local session affinity; those remain separate integration paths.
## Deliberately limited compatibility
-- `source` accepts `cli` (default), `tui`, or `gui`. These select the existing agent
- platforms `cli`, `tui`, and `desktop`, respectively. The native local routing identity
- remains server-owned `Platform.LOCAL`; source never grants messaging/native trust.
- Default TUI selection folds in `project`; GUI folds in `project` and `desktop_ui`.
- GUI policy is independent of `HERMES_DESKTOP` and of the attaching viewer's identity.
+- `source` accepts `cli` (default), `tui`, `gui`, `acp`, `tool` and `oneshot`
+ (`gateway.session_policy.SURFACES`). They select the agent platforms `cli`, `tui`,
+ `desktop`, `acp`, `cli` and `cli`; `tool` (third-party integrations) and `oneshot`
+ (finite `chat -q` / `-z` runs) keep their own stored label so human pickers hide them.
+ The native local routing identity remains server-owned `Platform.LOCAL`; source never
+ grants messaging/native trust. Default TUI selection folds in `project`; GUI folds in
+ the client-surface toolsets (`project`, `desktop_ui`, `catalog`). GUI policy is
+ independent of `HERMES_DESKTOP` and of the attaching viewer's identity.
- Optional flat creation fields: `cwd` (existing absolute gateway-local directory),
`model` (nonempty model identifier on the daemon's configured provider), and `toolsets`
(explicit array of established toolset names, including an empty array). Unknown or
@@ -77,11 +80,16 @@ OpenAI API-to-local session affinity; those remain separate integration paths.
override the default surface additions; CLI/TUI cannot explicitly request `desktop_ui`.
`cwd`, model selection, source and effective toolsets are captured at creation; attach
cannot change them. A conflicting repeat `request_id` returns `invalid_params`.
-- Provider/base URL overrides, reasoning/service-tier, skills, cwd worktree creation,
- seeded history, profile switching, YOLO, and other launch options still return
- `invalid_params`. Provider credentials/routing and reasoning/service-tier defaults still
- use the existing gateway resolution lifecycle; this is not full launch-option parity.
- No supported launch field mutates daemon-wide configuration or process environment.
+- Further frozen launch fields (`CREATE_FIELDS`): `provider`, `base_url` (http(s), no
+ credentials/query/fragment), `api_key` (held in the owner's memory, never persisted),
+ `reasoning`, `max_turns`, `skills` (rendered once into the frozen prompt; refused with a
+ bypass launch), the booleans `yolo`, `checkpoints`, `accept_hooks`, `pass_session_id`,
+ `ignore_rules`, `safe_mode`, `ignore_user_config` (safe mode implies ignore-user-config
+ and runs turns in an isolated worker), `editor` (ACP only), plus `title` (resolve-or-create)
+ and `hidden`. A malformed value returns `invalid_params`. Any other field, cwd worktree
+ creation, seeded history, profile switching and service-tier selection still return
+ `invalid_params`. No supported launch field mutates daemon-wide configuration or process
+ environment.
- Fresh creation requires a server-authenticated identity with `session:create`, supplied
by the gated dashboard or native bootstrap path. The verified legacy `?token=` route
stamps a session-token identity and also supports creation. Callers cannot provide an
@@ -91,7 +99,8 @@ OpenAI API-to-local session affinity; those remain separate integration paths.
not the full historical session picker. `session.info({session_id})` is a lightweight,
authorized view of source, current model, lazy-agent status, and profile ID.
- `ping({})` returns `{pong: true}`. `runtime.describe({})` exposes only authority identity,
- epoch, and the narrow implemented creation contract. It does not claim full runtime
+ epoch, capabilities, and the creation contract (`session_create.sources` and
+ `session_create.parameters`, which clients check before sending a launch option). It does not claim full runtime
protocol readiness, reveal credentials/paths, start an agent, or renew a turn lease.
- Cold restart restores valid private local policies and server-owned routes before execution.
Creation receipts remain bound to their authenticated creating principal and profile;
diff --git a/website/docs/developer-guide/session-storage.md b/website/docs/developer-guide/session-storage.md
index 398cf191e90..0b3849ddabf 100644
--- a/website/docs/developer-guide/session-storage.md
+++ b/website/docs/developer-guide/session-storage.md
@@ -4,6 +4,13 @@ Hermes Agent uses a SQLite database (`~/.hermes/state.db`) to persist session
metadata, full message history, and model configuration across CLI and gateway
sessions. This replaces the earlier per-session JSONL file approach.
+The profile's gateway is the **only writer of canonical sessions**: `hermes chat`,
+the TUI, Desktop (local), the API server, ACP, cron, Bot Chat and Kanban workers are
+clients that admit input to its session authority over `/api/ws` (see
+[Gateway local sessions](./gateway-local-sessions.md)). Out-of-process managed
+workers write through that owner (`RuntimeSessionStore` RPC), never by opening
+`state.db` for transcript writes themselves.
+
Source files: `hermes_state.py` (facade) plus the `hermes_state_*.py` siblings (schema, fts, search, compression, portability, gateway, ...)
## Hermes home and profile isolation
@@ -127,13 +134,27 @@ ownership for a redelivered event.
├── compression_locks — Cross-process compression locking
├── async_delegations — Async delegation bookkeeping
├── delivery_obligations — Gateway outbox (owed replies); created lazily by gateway/delivery_ledger.py
+├── runtime_epoch — Session authority's owner epoch + instance id (one row)
+├── session_admissions — Durable per-session input FIFO (queued → started → terminal; unknown on owner loss)
+├── worker_executions — Managed worker/child/cron/kanban executions bound to a session and epoch
+├── worker_receipts — Ordered, digest-checked results a managed worker reported
└── schema_version — Single-row table tracking migration state
```
+`session_admissions`, `worker_executions` and `worker_receipts` reference `sessions`
+with `ON DELETE RESTRICT`: deleting or pruning a session retires its terminal ledger
+rows in the same transaction and refuses while work is live or `unknown`. An input that
+was `started` when its owner died becomes `unknown` at the next owner start and is never
+replayed; its later inputs wait until it is resolved (`prompt.resolve_unknown`).
+
`hermes sessions recover` copies the row-bearing tables above into the
recovered database (FTS indexes and `schema_version` are regenerated), including
the lazily-created `delivery_obligations` ledger when the source has one — its
-row count is verified like `sessions`/`messages`.
+row count is verified like `sessions`/`messages`. The four runtime-ledger tables
+(`runtime_epoch`, `session_admissions`, `worker_executions`, `worker_receipts`) are
+inventoried and reported as excluded, not copied: a partial ledger could replay
+started effects or adopt another owner's workers. A full `hermes backup` restore keeps
+the complete ledger for startup reconciliation instead.
Key design decisions:
- **WAL mode** for concurrent readers + one writer (gateway multi-platform)
@@ -322,8 +343,9 @@ Declarative column adds use `ALTER TABLE ADD COLUMN` wrapped in try/except to ha
## Write Contention Handling
-Multiple hermes processes (gateway + CLI sessions + worktree agents) share one
-`state.db`. The `SessionDB` class handles write contention with:
+Several processes still open one `state.db`: the gateway (the canonical session
+writer), read-only browsers (dashboard, `hermes sessions list`), maintenance commands,
+and writers of non-session tables. The `SessionDB` class handles write contention with:
- **Short SQLite timeout** (1 second) instead of the default 30s
- **Time-budgeted application-level retry** with random jitter (20-150ms for the
diff --git a/website/docs/user-guide/cli.md b/website/docs/user-guide/cli.md
index 79ea5f3c31d..e313ea05404 100644
--- a/website/docs/user-guide/cli.md
+++ b/website/docs/user-guide/cli.md
@@ -40,8 +40,8 @@ hermes chat --provider openrouter # Force OpenRouter
# With specific toolsets
hermes chat --toolsets "web,terminal,skills"
-# Start with one or more skills preloaded (TUI; classic `hermes chat` refuses -s)
-hermes --tui -s hermes-agent-dev,github-auth
+# Start with one or more skills preloaded (rendered once into the session's prompt)
+hermes chat -s hermes-agent-dev,github-auth
# Resume previous sessions
hermes --resume <session_id> # Resume a specific session by ID (-r)
@@ -147,7 +147,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); 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 [here [N] | <focus>] [--preview]`, `/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`, `--skills`, `--checkpoints`, `--yolo`, `--accept-hooks`, `--pass-session-id`, `--ignore-rules`, `--base-url`/`--api-key`, and `--safe-mode`/`--ignore-user-config` are frozen into the session at creation; `--resume` may repeat the same values but cannot change them. `--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`, `--worktree`/`-w`, `--no-restore-cwd`, `--run-budget`, `--verbose`/`-v`, bare `--continue` (no name), `--create-if-missing` without `-c <name>`, 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 [here [N] | <focus>] [--preview]`, `/yolo [on|off]`, `/help` and `/quit`; other slash commands print `Unsupported gateway CLI command; use /help.` Use the TUI (`hermes --tui`) for the full slash registry.
:::
If a running turn loses its owner while your finite CLI query is queued, the CLI