diff --git a/cli.py b/cli.py index 9bfe55da95b..ce4f8eb43ec 100644 --- a/cli.py +++ b/cli.py @@ -14235,11 +14235,19 @@ class HermesCLI: if not _file_drop and isinstance(user_input, str) and _looks_like_slash_command(user_input): _cprint(f"\n⚙️ {user_input}") - if not self.process_command(user_input): - self._should_exit = True - # Schedule app exit - if app.is_running: - app.exit() + try: + if not self.process_command(user_input): + self._should_exit = True + # Schedule app exit + if app.is_running: + app.exit() + except KeyboardInterrupt: + # Ctrl+C during a slow slash command (e.g. /skills browse, + # /sessions list with a large DB) should interrupt the + # command and return to the prompt, NOT exit the entire + # session. Without this guard a KeyboardInterrupt unwinds + # to the outer prompt_toolkit loop and the session dies. + _cprint("\n[dim]Command interrupted.[/dim]") continue # Expand paste references back to full content