diff --git a/hermes_cli/cli_commands_mixin.py b/hermes_cli/cli_commands_mixin.py index 4e65155b602..8f9e6b8e886 100644 --- a/hermes_cli/cli_commands_mixin.py +++ b/hermes_cli/cli_commands_mixin.py @@ -834,6 +834,14 @@ class CLICommandsMixin: else: _cprint(f" ↻ Resumed session {target_id}{title_part} — no messages, starting fresh.") + # Retarget the process + tool cwd to where the session was started, so a + # mid-chat /resume (and /sessions , which delegates here) lands in the + # same directory as a startup `hermes -c`/`--resume`. The startup resume + # paths already call this; without it, the terminal/code-exec tools and + # relative-path resolution keep operating in the wrong repo. Idempotent + # and a no-op when the session recorded no cwd. See #38562. + self._restore_session_cwd(session_meta) + def _handle_sessions_command(self, cmd_original: str) -> None: """Handle /sessions [list|] — browse or resume previous sessions.