Under cont-init sys.argv[0] is container_boot.py, so scan_profile_flag
treated the boot as a real `hermes` run: a CMD like
`-p 'Work Bot' gateway run --no-supervise` printed the CLI error and
raised SystemExit(2) from _foreground_gateway_profile and
gateway_run_no_supervise, aborting 02-reconcile-profiles before any
profile slot was registered.
Both inspectors now go through scan_profile_flag_quietly, which swallows
the exit and output and reports "the CLI would reject this", i.e. not a
foreground no-supervise run (the CMD exits 2 by itself). The real CLI
path in main.py still rejects the name loudly.
`_s6_supervised_gateway_run` (the pre-argparse profile selection) matched only the exact
`--no-supervise` spelling, while container boot used the argparse-backed check that accepts
abbreviations. With a sticky standalone `active_profile` and `gateway run --no-supervis`, boot
left that profile's s6 slot down for the foreground CMD while the CMD itself skipped the sticky
profile and ran root: the standalone profile had no gateway.
Move the argparse-backed `gateway_run_no_supervise` into hermes_cli/_parser.py and use it from
both container_boot and main, so they cannot disagree. main only parses when s6 is running.
Independent review of #154927:
- `hermes gateway -p coder run --no-supervise` was missed (the hand-rolled scan read `coder` as
the subcommand), so the s6 root slot booted beside it. Gateway-ness now comes from
gateway.status.looks_like_gateway_command_line and the profile from scan_profile_flag, the
pre-parse main._apply_profile_override uses (moved to hermes_cli._parser so the boot
reconciler can share it without importing the CLI entry point). Bare `gateway --no-supervise`,
which argparse rejects, no longer counts.
- `-p solo gateway run --no-supervise` on a standalone profile still started gateway-solo from
its saved desired_state: two pollers on solo's token. Its slot now stays down (intent kept).
- The boot notice said the root slot "was started instead" when the foreground CMD kept it down.
Narrow #152653 to defaults only. CLI caps come from DEFAULT_CONFIG, TUI foreground resolution uses that same source, explicit/background budgets remain unchanged, and panels say unlimited. Timeout display uses the shared default without seeding terminal.timeout over a shell override.
Keep the original delegation fix with Max Freedom Pollards authorship. The ignored-config reader/writer policy, refusal and preflight machinery are not included. resolve_turn_limit remains in its original owner; config_turn_limit contains only the display formatter. Ten scoped guards pass; seven fail on base with three existing-behavior cases remaining green. Ruff clean; ty adds no diagnostics.
Final gate wave on #152477 (6b78fd266d):
- OpenRouter relays an upstream failure on the choice (``finish_reason: "error"``, a
``choices[0].error``), possibly beside partial text: both now fail, the error classified like
any provider error (401 -> live_auth);
- a malformed Responses-style body (``output[].content`` not a list) is live_response, as the
docs say, instead of live_unknown; a failed/cancelled status is handled in its own branch;
- tui_gateway/methods_config.py's setup readiness still hand-rolled the credential predicate this
PR extracted; it now calls runtime_readiness.runtime_has_credentials (identical rules);
- ``hermes --help`` lists ``hermes fallback check``; docs name the failing and answering statuses.
Second-model findings deliberately left to #152505 (wrong verdicts inside the new command, no
existing-behaviour change): final-wire re-detection, swap-policy credentials, stream failure state.
`hermes -z` has run through the gateway (`_run_oneshot_from_args` ->
`launch_gateway_chat`) at every dispatch site for a while, but the old
in-process runner stayed behind: `hermes_cli.oneshot.run_oneshot` /
`_run_agent` built a bare AIAgent outside the session authority, and
`hermes_cli.main._run_and_exit_oneshot` (with its
`_cleanup_oneshot_runtime` cleanup table) was its only caller. Nothing
outside tests reached any of it.
Delete that path. `hermes_cli.main._exit_after_oneshot` stays exactly as
it is: `--cpu-profile` names it as the one-shot hard-exit path and it
writes the profile before `os._exit`; only its docstring loses the
pointer to the removed cleanup helper. `hermes_cli/oneshot.py` keeps
only what the gateway path and gateway CLI turns still import: the
exit-code mapping, the `--usage-file` ledger with its auxiliary-usage
delta, and `--toolsets` normalization. The process-receipt eval probe
now calls `process_registry.wait_for_pending_completions` directly.
Tests that only exercised the deleted runner are removed; the exit-code
and usage-file tests now call the kept helpers directly; the cost-guard
test patches the gateway launcher instead of the removed function. A new
test pins that `hermes -z` dispatches to `launch_gateway_chat`.
Refs #145171 (EP-11a)
`hermes --cpu-profile PATH ...` profiles the process from argument parsing to
exit and writes PATH (pstats) plus PATH.txt (top 80 functions by cumulative
time). A relative PATH goes under the active profile's logs/profiles/.
- Enabled in _prepare_agent_startup (every parsed launch: fast chat path, full
parser, -z) plus the Termux TUI fast path, which skips it.
- -z/--oneshot exits through os._exit (atexit skipped on purpose), so
_exit_after_oneshot writes the profile explicitly.
- No env var: the flag is the only switch.
- main.py stays at its size on main: _dashboard_validate_serve_args moved to
main_dashboard.py to offset the added lines.
`hermes mcp serve` (mcp_serve.py) moves to the official mcp-serve plugin in
hermes-official-plugins, which registers `hermes mcp-serve` and also carries
the `--tools` mode from #83364.
- delete mcp_serve.py and tests/test_mcp_serve.py (the suite moved with it)
- drop the serve subparser, its dispatcher branch, the mcp agent-subcommand
row and the inline MCP discovery path only `mcp serve` reached
- LEFT_CORE row (command + old_command): `hermes mcp serve` and a bare
`hermes mcp-serve` without the plugin print the new spelling and the
install line on stderr. MCP clients live outside Hermes, so no home shows
the feature in use and nothing installs automatically.
- docs, locale tips and the bundled cli-reference point at the plugin
agent/transports/hermes_tools_mcp_server.py stays: the codex_app_server
runtime launches it as its hermes-tools MCP server.
8 conflicts, all from main's lint sweep (#135281 "Harder linter fixes" + the RUF series:
implicit-Optional, unused-unpacked-variable, next(...) for [...][0]). No other main commit touches
a conflicted file. Resolution: the branch side of each file plus main's exact autofix
(ruff 0.15.10, main's ruff.strict.toml, --fix --unsafe-fixes) on it. ruff.strict.toml takes main's
copy (the newly enabled rules). tests/cron/test_bot_chat_delivery_child_env.py stays deleted
(1cc9cb9199 retired its lane).
The spotify toolset (plugins/spotify) and its loopback-PKCE login (hermes_cli/auth_spotify.py)
now live in NousResearch/hermes-spotify, installed from the plugin catalog. Same pattern as the
Home Assistant move (fb9fc8a3dd): a LEFT_CORE row installs the plugin for every home that was
using it (a Spotify login in auth.json, or the spotify toolset in platform_toolsets) on
`hermes update` / first start; the toolset name, tool names, schemas, env vars and stored login
(providers.spotify) are unchanged, so nobody re-authenticates.
The one user-visible change is the login command: plugins cannot extend `hermes auth`, so the
plugin registers `hermes spotify login|status|logout`. LeftCoreFeature gains a `cli` field and
moved_command_hint() turns `hermes auth [status|logout] spotify`, and `hermes spotify` while the
plugin is not loaded, into a line naming the new command and the install/enable step for this
home. The dashboard's "needs login" hint names the new command too.
Core drops the Spotify auth constants/dispatch, the CONFIGURABLE_TOOLSETS row and post-setup
step, the core `spotify` entries in the shared-metrics toolset enums, its tests, and the docs
(en + zh-Hans) now point at `hermes plugins install spotify` / `hermes spotify login`.
Follow-up to kshitij review item #1 (k1, 2ee1cd1ebb).
k1 made -s / --checkpoints / --pass-session-id / --accept-hooks creation policy of
the TUI session. Three of them were declared on the top-level parser, but
--checkpoints existed only on the `chat` subparser, so `hermes --tui --checkpoints`
(the TUI form the docs and earlier gateway refusals pointed users to) failed with
"unrecognized arguments: --checkpoints" before anything launched.
Declare it on the top-level parser like --pass-session-id, and make the chat copy
default to SUPPRESS so `hermes --checkpoints chat` keeps the value (the subparser
contract pinned by test_chat_subparser_inherited_value_flags_use_suppress).
The `--verbose` refusal had the same gap: it pointed at `hermes --tui -v`, which
the top-level parser also rejects (-v is a `chat` option). It now names
`hermes chat --tui -v`, and a test parses every `hermes ...` command the
relocation hints name.
Live (tmux, fake HOME, loopback model): `hermes --tui --checkpoints` reaches ready,
the session policy carries checkpoints.enabled=true, and a write_file turn fills the
checkpoint store (0 entries without the flag). `-s probe-skill` puts the skill body
in the model's system prompt, `--pass-session-id` puts "Session ID:" there, and
`--accept-hooks` records the profile hook in shell-hooks-allowlist.json.
Red on r5-picked: test_checkpoints_parses_at_the_top_level_and_survives_chat
([--tui --checkpoints] and [--checkpoints chat]) and
test_every_relocation_hint_names_a_command_that_parses.
Review: https://github.com/NousResearch/hermes-agent/pull/135061
When a provider that left core is configured but not installed (offline,
lazy installs off, a failed migration), doctor, memory status, memory setup
<name> and the CLI's unknown-command error now print
`hermes [-p <profile>] plugins install <name>` instead of pointing at
hermes memory setup or ~/.hermes/plugins/. In-tree catalog only, no network;
-p is added whenever a bare command would install into another profile.
Merge #8: 2,771 commits from main (4b05f764fa). Ports main's moved code into the
unified runtime (run.py/run_turn.py splits, tui_gateway server, backup/restore
split), keeps the detached-daemon Desktop lifecycle, and adapts main's new tests
to the owner/authority contracts (canonical session deletes, retired-id
tombstones, zero-writer browsing, hermes_yaml, platforms() markers).
Follow-up to the salvaged #114497 rows: the issue asks for the profile-scoped
gateway lifecycle, and `status` is the verb an operator reaches for right
after start/stop, so it joins the epilogue; the `-p` row now names the
`--profile` long form too. The install row moves next to its siblings so
the gateway verbs read as one block.
Tests are trimmed to two invariants on the RENDERED help (the wiring, not
the constant): the profile-scoped form is documented while `-p` stays a
pre-argparse flag (never a parser option), and every gateway service verb
is listed.
Reconcile plugin declarations and validation through PM's atomic generation publication; preserve external runtimes, target markers, and conflict refusal. Keep one source-update completion owner and port upstream lifecycle changes to the PM desktop/runtime paths.
Users who set a sticky profile with `hermes profile use <name>` saw
`[HERMES_HOME fallback] HERMES_HOME is unset but active profile is '<name>'
... Any data this process writes will land in the wrong profile` printed by
EVERY `hermes` invocation (`--version`, `update`, `gateway restart`), even
though the CLI re-homes to that profile a few lines later and nothing lands
in the wrong place.
`main._apply_profile_override` scans argv with `top_level_value_flag_sets()`,
which builds the real parser BEFORE the override sets HERMES_HOME. Since
23036e20a6 the `--no-config` help string spells the config path through
`display_hermes_home()` -> `get_hermes_home()`, and that lookup fires the
one-shot fallback warning for a throwaway help string.
`display_hermes_home()` takes an optional `home`; the parser's `_cfg_path()`
passes `get_process_hermes_home()`, which reads HERMES_HOME without the
warning and, after the override, IS the profile home — so `hermes -p coder
--help` still shows `~/.hermes/profiles/coder/config.yaml`. The genuine
warning (a process that really runs under the wrong home) is untouched.
Fixes#112319
Part of #112839
Squashed integration of the user-facing message audit for this surface set.
Full per-finding receipts: /tmp/ux-audit/lanes/*-receipt.md (campaign artifacts).
Adds a --format flag to hermes chat single-query mode. stream-json
emits newline-delimited JSON events (init, text, tool_use, tool_result,
result envelope with token stats + exit code) to stdout for CI
pipelines and external tooling. Session ID stays on stderr.
Salvaged from PR #12278 by @ProDrifterDK onto current main, including
the follow-up commit enforcing the single-query contract (implies
quiet, rejects --tui, emits a final result record with exit code 130
on interrupt).
The canonical CLI now forwards safe_mode/ignore_user_config as session.create
policy (moved from _UNSUPPORTED to _POLICY, `--base-url`/`--api-key` gain real
chat flags) instead of mutating HERMES_SAFE_MODE/HERMES_IGNORE_USER_CONFIG in
the client environment, where they would ride into an authority spawn.
_prepare_agent_startup/cmd_chat treat a bypass chat as pure transport: no env
mutation, no plugin/MCP/hook discovery, no profile probing or model cost guard
(gateway_chat_startup), no display.interface read. gateway/run.py's import-time
config→env bridge returns the frozen snapshot inside a bypass worker instead of
opening the profile YAML. A bypass launch requires an explicit --model.
tests/hermes_cli/test_safe_mode.py is rewritten from the dead env-mutation
assertion into the live contract (recipe D-F): sentinel plugin/hook/SOUL/rules/
skill in a disposable profile fire on an ordinary turn in the owner; the real
`hermes chat --safe-mode --provider custom --base-url … --model … --api-key …
-Q -q` on a PTY gets the loopback reply, one canonical admission and one
terminal worker_executions row, worker pid != owner pid, zero /plugins/ or
profile YAML/rules/skill opens in the worker (audit hook with stacks), zero
sentinel events for the worker pid, no HERMES_SAFE_MODE in the daemon env;
a malformed config.yaml before the second launch still works and is not
repaired; --ignore-user-config alone still discovers plugins but reads no YAML.
Pin uv and uvx to the PM interpreter instead of ambient Python discovery.
A matching dependency stamp cannot prove that installed files still exist.
Repair now rebuilds the recorded workspace and lock in a fresh generation,
checks startup imports, and publishes the selection only after success.
Run startup recovery before dependency activation. Keep manual PM repair
reachable when the selected environment is damaged. Preserve plugin
selection, retry ownership, and the previous generation on failure.
Remove the separate pip, ensurepip, per-extra, and install-time quarantine
ladders. Keep orphan launcher restoration.
Verification: 717 targeted tests passed on native Windows ARM64, with
56 skipped. Ruff, diff checks, and the source-scoped compat check passed.
A disposable real Hermes install recovered deleted YAML and dotenv files,
then printed CLI help with exit 0. Its lock and stamp stayed unchanged.
The full suite and a release build were not run for this change.
For each issue anchor present in BASE 63279301bc non-test .py and absent on HEAD, the BASE comment/docstring block was re-attached at the HEAD location of the code it explained (matched by the distinctive code line / enclosing def). Sentences already covered by an existing HEAD comment were deduped; the issue number always survives. Insert-only: no code lines changed.
On a real TTY, `hermes chat -q "…"` (and `--tui -q`) now starts a normal
interactive session with the prompt submitted literally as the first turn —
no slash-command routing, no '!' shell dispatch, no $(...) interpolation,
no file-drop rewriting — matching how other coding agents handle seeded
launches (Omarchy prompted agent terminals, basecamp/omarchy#8705).
Legacy answer-and-exit is preserved everywhere automation depends on it:
- new `hermes chat --oneshot` flag (distinct dest from top-level -z)
- -Q/--quiet machine-readable contract
- any non-TTY stdio (kanban workers, cron, pipes, A2A)
- top-level `hermes -z` unchanged
CLI: seeded prompt rides a _SeededQueryMessage sentinel through
process_loop, which skips the slash/!/file-drop dispatchers for that one
message. TUI: STARTUP_QUERY submits via a new literal path (submitLiteral)
that bypasses dispatchSubmission and the input.detect_drop rewrite.
Mirror the full update_cmd._holder_value_flags precedent: derive both
top-level value-flag sets from build_top_level_parser() with a cached
frozenset, and fall back to a handwritten snapshot if parser
introspection ever fails, so argv classification keeps working on a
broken tree. Parity test pins the derived sets against the live parser
so drift fails CI.
Builds on #93551 (fangliquanflq) and #93570 (aniruddhaadak80) for #93530.
The subprocess-based exclusivity test invoked hermes_cli.main in the CI
environment where startup exits 1 before the manual guard runs. Enforce
the conflict in argparse itself (mutually exclusive group, exit 2 at parse
time) and test the parser directly; the manual guard stays for programmatic
namespace fills.
The Bot Mode teammate-DM protocol told agents to inline the message into a
double-quoted shell argument: quotes truncated the body and $(...)/backticks
executed on the sender's machine. The protocol now writes the message to a
temp file and delivers it via a new 'hermes chat --query-file' flag (or '-'
for stdin); 'hermes peer dm' already accepted stdin and the peer recipe now
uses it. No shell pass touches the body at any point.
Supersedes the tool-based approach in #89077 — same bug, fixed with a CLI
flag + protocol rewrite instead of a new model tool.
Co-authored-by: mehmetkr-31 <mehmetkr-31@users.noreply.github.com>
`hermes chat -c "<title>" -q "<text>"` silently no-oped when no session
matched the title under quiet/programmatic use: the not-found message was
written to stdout (the channel quiet callers parse as the final response),
so a background send to a not-yet-existing named session vanished with no
error. Surfaces via Hermes-Bot-Mode bot-to-bot handoffs (#86794).
- not-found message now goes to stderr (exit 1 unchanged), so programmatic
callers always see it even with -Q/--quiet
- new --create-if-missing: with `-c <title>` and no matching session, create
a fresh session carrying the title and proceed — the deterministic
"send to this named thread, making it if needed" primitive plugins asked for
- extract the -c resolution block into _resolve_continue_arg for testability
Tests: flag parsing, titled-session creation, stderr routing, source guard.
--resume latest resolves the most recent session through the same
workspace-scoped MRU lookup as -c (TUI source first under --tui, with
classic-CLI fallback). --in DIR chdirs before session resolution so the
lookup keys off DIR's workspace, and pins the session there by skipping
the recorded-cwd restore.
Requested by @Jeff9James: hermes --tui --resume latest --in ./dir
A task could already pin a model and provider, but not how hard the worker
thinks: reasoning effort came from the assigned profile's config and nothing
per-task could reach it. Pairing a small model with high effort, or a big one
with thinking off, meant editing the worker profile itself.
Adds a tasks.reasoning_effort column (migrated, NULL = inherit the profile)
with set_reasoning_effort(), a create_task kwarg, and a --reasoning spawn flag.
Kept deliberately independent of model_override: a task may run the profile's
own model at a different depth, and clearing a model override no longer resets
the depth the operator chose. "none" is a value (thinking off), not a clear.
--reasoning is new on the CLI too — the level was only reachable through the
/reasoning slash command, so the dispatcher had no flag to pass. It overrides
agent.reasoning_effort for one run and is never persisted.
The default max_iterations/agent.max_turns budget was set when long
agentic runs were rare; complex tasks now routinely exceed 90 tool
calls. Raise the default to 500 across every surface that hardcodes
the fallback: AIAgent constructor, DEFAULT_CONFIG, CLI resolution
chain, gateway env bridge, cron scheduler, and TUI gateway. Explicit
user config values are unaffected (deep-merge preserves them; no
_config_version bump needed).
Docs (en + zh-Hans), CLI help text, tips, and pinned tests updated
to match.
Resuming a session cd's back into its recorded working directory, so it resumes
in the repo it belonged to. `--no-restore-cwd` opts out; skipped under
--worktree (that path owns its dir); best-effort — a missing dir warns and stays
put rather than failing the resume.
Co-authored-by: Cary Palmer <palmer@dugoutfantasy.com>
`hermes -t web chat` silently dropped the toolset filter (and the same
hold true for `-m`, `--provider`, `--tui`, `--dev` placed before
`chat`). Reported in #28780 for `-t/--toolsets`; the others are sibling
failures with the same root cause.
Root cause: the chat subparser re-declared these flags with `default=None`
(or `default=False` for store_true) on top of the matching top-level
parser flags. When argparse dispatches into the subparser it shares the
namespace via `dest`, so the subparser's default overwrites whatever the
top-level parser parsed before the subcommand. `-s/--skills`, `-r/-c/-w`,
`--yolo`, and `--pass-session-id` already use `default=argparse.SUPPRESS`
for exactly this reason — the chat-subparser action becomes a no-op
unless the user explicitly passes the flag after `chat`, and the parent
value survives.
Reproduction (origin/main, before fix):
>>> parser.parse_known_args(["-t", "web", "chat"]).toolsets
None
>>> parser.parse_known_args(["chat", "-t", "web"]).toolsets
'web'
After fix:
>>> parser.parse_known_args(["-t", "web", "chat"]).toolsets
'web'
>>> parser.parse_known_args(["chat", "-t", "web"]).toolsets
'web'
Sibling flags fixed in the same commit because they share the exact same
argparse pattern bug — verified via a new contract test that scans every
chat-subparser action whose `dest` is also on the top-level parser and
asserts `default is argparse.SUPPRESS`. The test fails on origin/main
listing all five offenders and passes after this fix.
Test additions in tests/hermes_cli/test_argparse_flag_propagation.py:
- TestChatSubparserInheritedValueFlags exercising real `_parser` build
(not the hand-rolled replica) so it catches future drift.
- Parametrized before-chat / after-chat cases for `-t`, `--toolsets`,
`-m`, `--model`, `--provider`.
- Negative case: passing none of the flags leaves attrs at the top-level
parser's `None` default (SUPPRESS does not remove existing attrs).
- Combined case: all three value flags before `chat` simultaneously.
- store_true cases for `--tui` / `--dev`.
- Contract test asserting every shared-`dest` flag on chat uses SUPPRESS.
Fixes#28780.
* feat(oneshot): add --usage-file JSON usage report to hermes -z
Pipelines driving hermes -z (batch reviewers, cron scripts, eval
harnesses) had no way to account for per-invocation spend: the agent
computes estimated_cost_usd and full token counts internally, but
oneshot mode discards everything except the final response text.
- hermes -z PROMPT --usage-file PATH writes a JSON report after the
run: estimated_cost_usd, cost_status/source, input/output/cache/
reasoning/total tokens, api_calls, model, provider, session_id,
completed, failed.
- Written even when the run fails (with a failure field) so callers
can always account for spend; the write itself is best-effort and
never masks the run's own outcome.
- Flag registered in both the full parser and the Termux fast path;
added to both value-flag scan sets so profile detection stays
correct.
Validation: 6 unit tests + live E2E (real -z run produced a report
with real OpenRouter cost + token counts).
* test: include usage_file kwarg in oneshot dispatch assertions
The two dispatch tests assert the exact kwargs dict passed to
run_oneshot; the new usage_file kwarg must appear there.
* feat(cli): add --safe-mode troubleshooting flag
Inspired by Claude Code v2.1.169 (June 2026): run Hermes with all
customizations disabled to isolate setup problems from product bugs.
--safe-mode implies --ignore-user-config and --ignore-rules, and
additionally skips plugin discovery (hermes_cli/plugins.py) and MCP
server loading (tools/mcp_tool.py) via the internal HERMES_SAFE_MODE
env bridge.
* fix(desktop): keep composer usable during reconnect
Add `display.interface` config key so users can make the modern TUI the
default for bare `hermes` / `hermes chat` without exporting HERMES_TUI=1 in
every shell. Default stays "cli" to preserve current behavior.
Add a `--cli` flag (mirrors `--tui`) so an explicit invocation can force the
classic prompt_toolkit REPL even when `display.interface: tui` is configured.
Precedence (highest first): `--cli` > `--tui`/`HERMES_TUI=1` > config
`display.interface` > classic REPL. Two resolvers enforce it:
* `_resolve_use_tui(args)` — the args-aware resolver used by `cmd_chat`
and the Termux fast-TUI path (uses full load_config()).
* `_wants_tui_early(argv)` — a dependency-free early resolver used by
mouse-residue suppression and the Termux fast paths, which run before
argparse / hermes_cli.config are importable (minimal cached YAML read).
Both `--cli` and `--tui` are registered via `_inherited_flag`, so they are
carried across self-relaunch automatically.
- config: add display.interface ("cli" default), bump _config_version 25->26.
The generic missing-field migration + load_config() deep-merge seed the key
for existing configs; no bespoke migration block needed.
- docs: document --cli flag and display.interface in cli-commands.md and
the TUI user guide.
- tests: new test_default_interface_resolution.py covering resolver
precedence at every layer, early resolver edge cases (missing/garbage
config), parser flags, and relaunch inheritance.