Bug Report: $HOME environment variable corrupted inside Hermes profile runtime context
Description
When a Python script (or child process) runs inside a Hermes profile's session context, the $HOME environment variable is set to /path/.hermes/profiles/<profile_name>/home instead of the actual user home directory (e.g., /home/jack). This causes Path.home() in Python, os.path.expanduser("~"), and any tooling that relies on $HOME to resolve to the wrong directory.
Impact
- All Python scripts using
Path.home() break when run inside an active Hermes session
- Scripts fail to find files under
~/.hermes/ because they look under ~/.hermes/profiles/worker/home/.hermes/
- This affects the
diff-inventory.py helper, daily_session_memory_miner.py, and any custom tooling
- The issue is intermittent — sometimes not reproducible in a fresh terminal
Reproduction
from pathlib import Path
print(Path.home())
# Actual: /home/jack/.hermes/profiles/worker/home (WRONG)
# Expected: /home/jack
Affected Components
- All Python skill helpers that use
Path.home() to resolve Hermes paths
- Any subprocess spawned from within a Hermes agent session
Suggested Fix
Option A — Environment invariant: Ensure $HOME is set to the real user home directory (e.g., /home/jack) before spawning agent sessions, not the profile-relative path.
Option B — Documentation: Document this quirk and recommend that all skill helpers use a fallback pattern:
_HOME = Path(os.environ.get("HOME", "/home/jack"))
if not _HOME.exists() or "worker/home" in str(_HOME) or "profiles/" in str(_HOME):
_HOME = Path("/home/jack")
HERMES_BASE = _HOME / ".hermes"
Option C — Environment variable: Add HERMES_REAL_HOME or similar env var that always points to the actual user home regardless of profile context.
Workaround (applied locally)
All Python helpers now use the environment-robust pattern with corruption detection.
Bug Report:
$HOMEenvironment variable corrupted inside Hermes profile runtime contextDescription
When a Python script (or child process) runs inside a Hermes profile's session context, the
$HOMEenvironment variable is set to/path/.hermes/profiles/<profile_name>/homeinstead of the actual user home directory (e.g.,/home/jack). This causesPath.home()in Python,os.path.expanduser("~"), and any tooling that relies on$HOMEto resolve to the wrong directory.Impact
Path.home()break when run inside an active Hermes session~/.hermes/because they look under~/.hermes/profiles/worker/home/.hermes/diff-inventory.pyhelper,daily_session_memory_miner.py, and any custom toolingReproduction
Affected Components
Path.home()to resolve Hermes pathsSuggested Fix
Option A — Environment invariant: Ensure
$HOMEis set to the real user home directory (e.g.,/home/jack) before spawning agent sessions, not the profile-relative path.Option B — Documentation: Document this quirk and recommend that all skill helpers use a fallback pattern:
Option C — Environment variable: Add
HERMES_REAL_HOMEor similar env var that always points to the actual user home regardless of profile context.Workaround (applied locally)
All Python helpers now use the environment-robust pattern with corruption detection.