Problem
terminal.cwd is a single config key that controls the working directory for all modes (CLI, TUI, gateway, cron, delegation). This creates a silent foot-gun where running hermes setup terminal (or full setup) permanently pins the CLI to $HOME even though the user launched hermes from a project directory.
How users hit this
- Run
hermes setup → choose "Full setup" (or hermes setup terminal)
- See this prompt:
Working directory for messaging sessions:
When using Hermes via Telegram/Discord, this is where
the agent starts. CLI mode always starts in the current directory.
Messaging working directory [/home/user]:
- Hit Enter (accepting the default
$HOME)
- Config now has
terminal.cwd: /home/user
- Later:
cd ~/my-project && hermes → agent runs pwd → /home/user 🤔
The help text even says "CLI mode always starts in the current directory" — but then writes a value that prevents exactly that.
Root cause
The resolution logic in cli.py (lines 473-487) only uses os.getcwd() when terminal.cwd is a placeholder (".", "auto", "cwd"). Once setup writes an absolute path, it is used verbatim for CLI, TUI, gateway — everything.
_CWD_PLACEHOLDERS = (".", "auto", "cwd")
if terminal_config.get("cwd") in _CWD_PLACEHOLDERS:
# Smart: resolves to os.getcwd() for local backend
else:
# Dumb: uses the hardcoded path for ALL modes
Why this exists
The gateway runs as a systemd service where os.getcwd() would be / or the unit's WorkingDirectory=. So gateway/cron needs an explicit anchor directory. But that need is being conflated with CLI behavior via a single config key.
What quick setup does right
The "Quick setup" path (default for first-time users) does NOT ask about cwd — it leaves the default "." from DEFAULT_CONFIG. Only "Full setup" and hermes setup terminal trigger the problematic prompt. So users who picked quick setup are fine until they reconfigure.
Proposed fix
1. CLI and TUI always use os.getcwd() at launch — unconditionally
No config override, no flag. If I cd ~/project && hermes, pwd should say ~/project. Period.
2. Rename/reframe the config as a gateway-only concern
Either:
- Rename to
gateway.cwd or terminal.gateway_cwd (breaking but clear)
- Or keep
terminal.cwd but only consume it in gateway/cron/daemon mode (less breaking)
The config value should only be read when the source is gateway, cron, or delegation — never when it's an interactive CLI/TUI session.
3. Move the setup prompt to gateway configuration
Remove the "Messaging working directory" question from setup_terminal_backend() and move it to setup_gateway() where it belongs. It should only be asked when actually configuring messaging platforms.
Files involved
hermes_cli/setup.py line 1331-1341 — the problematic prompt
cli.py lines 473-487 — the resolution logic that respects placeholders but not explicit paths
hermes_cli/config.py line 471 — DEFAULT_CONFIG correctly defaults to "."
hermes_cli/config.py lines 2989-3031 — deprecated env var warning (related)
Impact
Every user who ran full setup or hermes setup terminal and hit Enter on the default has their CLI silently pinned to $HOME. They'd never know unless they pwd or try to work with relative paths in a project directory.
Problem
terminal.cwdis a single config key that controls the working directory for all modes (CLI, TUI, gateway, cron, delegation). This creates a silent foot-gun where runninghermes setup terminal(or full setup) permanently pins the CLI to$HOMEeven though the user launched hermes from a project directory.How users hit this
hermes setup→ choose "Full setup" (orhermes setup terminal)$HOME)terminal.cwd: /home/usercd ~/my-project && hermes→ agent runspwd→/home/user🤔The help text even says "CLI mode always starts in the current directory" — but then writes a value that prevents exactly that.
Root cause
The resolution logic in
cli.py(lines 473-487) only usesos.getcwd()whenterminal.cwdis a placeholder (".","auto","cwd"). Once setup writes an absolute path, it is used verbatim for CLI, TUI, gateway — everything.Why this exists
The gateway runs as a systemd service where
os.getcwd()would be/or the unit'sWorkingDirectory=. So gateway/cron needs an explicit anchor directory. But that need is being conflated with CLI behavior via a single config key.What quick setup does right
The "Quick setup" path (default for first-time users) does NOT ask about cwd — it leaves the default
"."fromDEFAULT_CONFIG. Only "Full setup" andhermes setup terminaltrigger the problematic prompt. So users who picked quick setup are fine until they reconfigure.Proposed fix
1. CLI and TUI always use
os.getcwd()at launch — unconditionallyNo config override, no flag. If I
cd ~/project && hermes,pwdshould say~/project. Period.2. Rename/reframe the config as a gateway-only concern
Either:
gateway.cwdorterminal.gateway_cwd(breaking but clear)terminal.cwdbut only consume it in gateway/cron/daemon mode (less breaking)The config value should only be read when the source is gateway, cron, or delegation — never when it's an interactive CLI/TUI session.
3. Move the setup prompt to gateway configuration
Remove the "Messaging working directory" question from
setup_terminal_backend()and move it tosetup_gateway()where it belongs. It should only be asked when actually configuring messaging platforms.Files involved
hermes_cli/setup.pyline 1331-1341 — the problematic promptcli.pylines 473-487 — the resolution logic that respects placeholders but not explicit pathshermes_cli/config.pyline 471 —DEFAULT_CONFIGcorrectly defaults to"."hermes_cli/config.pylines 2989-3031 — deprecated env var warning (related)Impact
Every user who ran full setup or
hermes setup terminaland hit Enter on the default has their CLI silently pinned to$HOME. They'd never know unless theypwdor try to work with relative paths in a project directory.