Problem
The terminal sandbox environment overrides HOME to {HERMES_HOME}/home/ for profile isolation. While this is intentional for subprocess credential isolation (git, gh, npm, etc.), it silently breaks all code that uses Path.home(), os.path.expanduser(), or os.environ.get("HERMES_HOME", Path.home() / ".hermes").
Impact
| Category |
Files |
What breaks |
| Native root detection |
hermes_constants.py:36, cli.py:3791, profiles.py:152 |
Path.home() / ".hermes" resolves to profile home instead of real ~/.hermes |
| External tool configs |
agent/anthropic_adapter.py:311,333,459, tools/tool_backend_helpers.py:44, gateway/status.py:48 |
Looks for ~/.claude/, ~/.modal.toml, ~/.local/state/ in profile home |
| User file paths |
tools/file_tools.py:82,102, tools/delegate_tool.py:142, cli.py:1088,1158 |
~/myfile expands to profile home instead of real home |
| Wrapper scripts |
profiles.py:152 |
~/.local/bin resolves to profile home |
Root cause
The sandbox sets HOME to the profile's home/ directory. The codebase uses Path.home() (which reads from the process's HOME env var) as a fallback when HERMES_HOME isn't set, and for native path resolution.
Proposed fix
- Capture the real user home at import time (before sandbox overrides
HOME) in hermes_constants.py
- Replace all
Path.home() calls that need the real user home with a new get_real_home() helper
- Keep
Path.home() for expanduser() in file tools (or use the real home for those too)
Files to update:
| File |
Change |
hermes_constants.py |
Add _REAL_HOME and get_real_home() |
hermes_constants.py:36 |
Use get_real_home() in get_default_hermes_root() |
cli.py:3791 |
Use get_real_home() for profile parent detection |
profiles.py:152 |
Use get_real_home() for wrapper dir |
agent/anthropic_adapter.py |
Use get_real_home() for Claude config paths |
tools/tool_backend_helpers.py |
Use get_real_home() for modal.toml |
gateway/status.py:48 |
Use get_real_home() for XDG state fallback |
tools/file_tools.py |
Use get_real_home() for expanduser |
tools/delegate_tool.py |
Use get_real_home() for script paths |
Why this matters
gh CLI auth fails because it looks in profile home for keychain tokens
- Claude adapter can't find real Claude credentials
- User's
~/Documents/myfile.txt resolves to the wrong place
hermes profile list may fail to find the profiles root
Problem
The terminal sandbox environment overrides
HOMEto{HERMES_HOME}/home/for profile isolation. While this is intentional for subprocess credential isolation (git, gh, npm, etc.), it silently breaks all code that usesPath.home(),os.path.expanduser(), oros.environ.get("HERMES_HOME", Path.home() / ".hermes").Impact
hermes_constants.py:36,cli.py:3791,profiles.py:152Path.home() / ".hermes"resolves to profile home instead of real~/.hermesagent/anthropic_adapter.py:311,333,459,tools/tool_backend_helpers.py:44,gateway/status.py:48~/.claude/,~/.modal.toml,~/.local/state/in profile hometools/file_tools.py:82,102,tools/delegate_tool.py:142,cli.py:1088,1158~/myfileexpands to profile home instead of real homeprofiles.py:152~/.local/binresolves to profile homeRoot cause
The sandbox sets
HOMEto the profile'shome/directory. The codebase usesPath.home()(which reads from the process'sHOMEenv var) as a fallback whenHERMES_HOMEisn't set, and for native path resolution.Proposed fix
HOME) inhermes_constants.pyPath.home()calls that need the real user home with a newget_real_home()helperPath.home()forexpanduser()in file tools (or use the real home for those too)Files to update:
hermes_constants.py_REAL_HOMEandget_real_home()hermes_constants.py:36get_real_home()inget_default_hermes_root()cli.py:3791get_real_home()for profile parent detectionprofiles.py:152get_real_home()for wrapper diragent/anthropic_adapter.pyget_real_home()for Claude config pathstools/tool_backend_helpers.pyget_real_home()for modal.tomlgateway/status.py:48get_real_home()for XDG state fallbacktools/file_tools.pyget_real_home()for expandusertools/delegate_tool.pyget_real_home()for script pathsWhy this matters
ghCLI auth fails because it looks in profile home for keychain tokens~/Documents/myfile.txtresolves to the wrong placehermes profile listmay fail to find the profiles root