Skip to content

The agent that grows with you

docs(hermes_cli/AGENTS.md): map the gateway facade and its siblings

teknium15470f260cac7
diff --git a/hermes_cli/AGENTS.md b/hermes_cli/AGENTS.md
index 4e782c2873d..0c229d53792 100644
--- a/hermes_cli/AGENTS.md
+++ b/hermes_cli/AGENTS.md
@@ -18,6 +18,15 @@ Moved bodies late-bind cli-level names via `from cli import ...` at call time, s
`_LIGHT_MODE_CACHE`, ...) and every `global`-writing function stay in `cli.py`. **Rich** renders banner/panels; **prompt_toolkit**
handles input + autocomplete; `KawaiiSpinner` (`agent/display.py`) animates API calls and prints
the `┊` activity feed. `load_cli_config()` in `cli.py` merges CLI defaults + user YAML.
+
+`hermes_cli/gateway.py` is the `hermes gateway` facade (process discovery, systemd backend, command
+dispatch); topical siblings re-exported by the facade: `gateway_service_unit.py` (systemd unit
+generation/refresh), `gateway_launchd.py` (macOS LaunchAgent backend), `gateway_setup_wizard.py`
+(`hermes gateway setup`: `_PLATFORMS` registry, status table, per-platform prompts, service offer),
+`gateway_windows*.py`, `gateway_supervised_restart.py`, `gateway_migrate*.py`, `gateway_multiplex_*.py`,
+`gateway_enroll.py`, `gateway_command_errors.py`. Sibling bodies read facade names through `_gw()`
+(late binding on `hermes_cli.gateway`), so monkeypatch on the facade; mutable state such as
+`_resolved_launchd_domain` stays a facade global.
`process_command()` resolves the canonical name via `resolve_command()` then dispatches through
`HermesCLI._SLASH_DISPATCH` (`canonical -> (method name, pass_arg)`), falling back to a
`_handle_<name>_command` method by naming convention. **There is no `elif` ladder — do not add one.**
@@ -225,8 +234,10 @@ every KeepAlive respawn, #110637).
Service installs are a matrix, not a unit file: `gateway_service_unit.py::generate_systemd_unit(system=,
run_as_user=)` (systemd unit generation / `systemd_unit_is_current` / `refresh_systemd_unit_if_needed` live in that
sibling and read facade helpers late-bound through `hermes_cli.gateway`, so patch them on the facade; user unit AND `--system` unit with `User=`; an unresolvable `User=` is a blocker,
-never a dir-owner fallback), `generate_launchd_plist` (`gui/<uid>` then `user/<uid>` domains, never a
-`~/Library/LaunchAgents` glob), Windows Scheduled Task and the Desktop-spawned backend all carry the
+never a dir-owner fallback), `gateway_launchd.py::generate_launchd_plist` (`gui/<uid>` then `user/<uid>` domains, never a
+`~/Library/LaunchAgents` glob; the whole launchd backend — plist refresh, `launchctl` bootstrap/kickstart,
+`launchd_start/stop/restart/status`, detached-process degrade — lives in that sibling, with the domain cache
+`_resolved_launchd_domain` staying a facade global), Windows Scheduled Task and the Desktop-spawned backend all carry the
profile's `HERMES_HOME` (and `HOME` for the service user) explicitly — a supervisor starts with an
empty environment, so the env override that makes `-p` work interactively does not exist there. A
change to install/restart/status regenerates and diffs every kind; both user and system units are