Esc key semantics are inconsistent and make stopping an agent dangerously easy (CLI)

Status Open
Maintainer reply None cached
Activity 1 comment · opened Aug 4, 2026

Environment: Claude Code CLI on macOS (darwin 25.5), interactive terminal session.

Problem

The Esc key means different things in different screens of the CLI, and one of those meanings is destructive:

  • In some views, Esc collapses/dismisses a panel — a harmless, reversible UI action.
  • In the main conversation view, Esc stops a running background agent / interrupts the current turn — a destructive, non-reversible action.

Because the same key is harmless in one context and destructive in another, muscle memory from the harmless context causes accidental agent kills. In a long working session today, long-running agents (30+ minute implementation tasks) were stopped unintentionally this way; the work in their context is lost and they cannot always be resumed cleanly, so the cost of the slip is high.

Why this matters

Stopping an agent mid-task is one of the most expensive accidental actions available in the CLI, and it is currently bound to the single easiest-to-hit key on the keyboard — the same key users press reflexively to dismiss things. There is no confirmation, no undo, and the visual feedback that an agent was killed (vs a panel dismissed) is easy to miss.

Suggestions (any of these would help)

  1. Require a confirmation (or a double-press, like the existing double-Esc patterns) before Esc stops a running agent — especially one that has been running for more than a few seconds.
  2. Give "stop agent" a deliberate, distinct binding (e.g. Ctrl+C, which already carries interrupt semantics) and reserve Esc for dismiss/collapse consistently across all screens.
  3. At minimum, make the post-stop state loudly visible and offer a one-key "resume the agent you just stopped".

Expected: one key, one meaning — Esc dismisses; something deliberate interrupts.
Actual: Esc dismisses in one screen and kills long-running work in another.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗