diff --git a/cli.py b/cli.py index 759c09b4619..af3210f3cb9 100644 --- a/cli.py +++ b/cli.py @@ -11954,9 +11954,22 @@ class HermesCLI: pass print("Resume this session with:") - print(f" hermes --resume {self.session_id}") + # Session IDs are profile-constrained, so the resume hint must + # include `-p ` for non-default profiles. Without this, + # copying the hint from a non-default profile fails to find the + # session on the next invocation. The "default" and "custom" + # profile names use the standard HERMES_HOME, so no -p needed. + try: + from hermes_cli.profiles import get_active_profile_name + _active_profile = get_active_profile_name() + except Exception: + _active_profile = "default" + profile_flag = ( + "" if _active_profile in ("default", "custom") else f" -p {_active_profile}" + ) + print(f" hermes --resume {self.session_id}{profile_flag}") if session_title: - print(f" hermes -c \"{session_title}\"") + print(f" hermes -c \"{session_title}\"{profile_flag}") print() print(f"Session: {self.session_id}") if session_title: