Ctrl+Z silently destroys active sessions — this is an unacceptable UX failure for a context-heavy tool
The Problem
\Ctrl+Z\ immediately suspends Claude Code with zero warning, zero confirmation, zero recovery path. Session context — which can represent hours of accumulated work, locked decisions, mid-task state — is gone the moment the terminal closes after the suspend. No prompt. No guard. Nothing.
This is not a niche edge case. \Ctrl+Z\ is one of the easiest accidental keystrokes in a terminal. It sits next to common shortcuts. It fires in an instant. And in Claude Code, the cost of firing it accidentally is disproportionately catastrophic compared to almost any other CLI tool.
Why Claude Code is different
Most CLI tools lose at most a command or a half-written flag when suspended accidentally. Claude Code loses a session — a stateful, context-rich conversation that cannot be reconstructed from disk because it was never written there. The asymmetry between input cost (one accidental keystroke) and output cost (complete session loss) is severe.
This happened during a milestone session. Significant context had been built across multiple project threads. The close protocol was mid-execution. \Ctrl+Z\ fired. The terminal was closed. Everything in the session that hadn't been manually written to files was gone. The backup systems held — but they held despite Claude Code's behavior, not because of it.
What every serious terminal application already does
\vim\, \nano\, \less\, \man\, interactive \python\, \psql\ — all of them guard against accidental exit or suspension when state loss is meaningful. This is a solved problem. The pattern is well-established:
Session active. Suspend? Unsaved context will be lost. [y/N]:
One line. Intercept SIGTSTP. Prompt. If the user confirms, suspend normally. If not, return to the session. The implementation cost is trivial. The UX cost of not doing it is not.
The Ask
- Intercept \
Ctrl+Z\(SIGTSTP) during active sessions and require explicit confirmation before suspending. - Treat accidental suspension as the real failure mode it is. Users running multi-hour sessions with accumulated context should not be one misplaced keystroke away from total loss.
- Consider the same treatment for \
Ctrl+C\when a session is mid-task — at minimum, a "are you sure?" on first press, with a second press to confirm.
Claude Code is positioning itself as the tool for serious, sustained engineering work. Serious tools protect their users from catastrophic accidental state loss. This one doesn't. It should.
Environment
- Platform: Linux (WSL2)
- Shell: bash
- Claude Code CLI
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗