/new, /model, /help, and everything else — are defined once in a central registry and automatically propagate to every consumer: CLI help output, gateway dispatch, Telegram bot command menu, Slack subcommand routing, and tab autocomplete.
The CommandDef dataclass
Every slash command is represented by aCommandDef instance in hermes_cli/commands.py:
Fields
Adding a slash command
1
Add CommandDef to COMMAND_REGISTRY
Open Every downstream consumer — CLI help, gateway help, Telegram menu, Slack routing, autocomplete — derives from this registry at import time. No other registry-related changes are needed.
hermes_cli/commands.py and add a CommandDef entry to the COMMAND_REGISTRY list. Place it in the appropriate category section.2
Add handler in HermesCLI.process_command()
Open For persistent settings, use
cli.py and add a branch in HermesCLI.process_command(). Commands are dispatched on the canonical name returned by resolve_command():save_config_value() in cli.py rather than writing to the config file directly.3
Add gateway handler in gateway/run.py (if applicable)
If the command should be available in messaging platforms (i.e. Skip this step if you set
gateway_only=True or neither flag is set), add a handler in gateway/run.py:cli_only=True on the CommandDef.4
For persistent settings, use save_config_value()
If the command changes a configuration value that should persist across sessions, use the
save_config_value() helper in cli.py rather than directly writing to the config file:How aliases work
Aliases are fully automatic. Adding an alias to thealiases tuple on a CommandDef is the only change required. All consumers update automatically:
- CLI dispatch —
resolve_command()maps both canonical name and aliases to the sameCommandDef - CLI help — aliases shown alongside the canonical command
- Gateway dispatch —
GATEWAY_KNOWN_COMMANDSfrozenset includes all aliases - Telegram bot menu — canonical name only (aliases excluded from the visible menu)
- Slack routing —
slack_subcommand_map()maps every alias to the command handler - Tab autocomplete —
COMMANDSflat dict includes alias → description entries
/background command has the bg alias:
/background my task and /bg my task resolve to the same handler with zero extra code.
Command categories
Commands are grouped by category in/help output. Use the appropriate category:
Derived consumers
All downstream consumers are built fromCOMMAND_REGISTRY at import time: