UX: Slash command menu selects wrong command when using arrow keys after partial match
Describe the bug
When typing a partial slash command that matches a specific item, the menu highlights the correct match — but pressing the down arrow key to \"confirm\" or \"navigate to\" it instead moves the selection to the next item in the list, which then executes unintentionally.
Steps to reproduce
- Start typing
/coin the input — the menu highlights/context(correct match) - Press the down arrow key, expecting to select/confirm the highlighted item
- The selection moves down to the next command (
/clear) - Press Enter —
/clearruns instead of/context
Expected behavior
- The down arrow should move selection within the filtered list in a predictable, clearly communicated way
- Critically:
/clearshould require a confirmation prompt ("Are you sure? This will erase your conversation and cannot be undone.") given how destructive and irreversible it is
Actual behavior
/clear executed silently and immediately, erasing the entire conversation with no warning and no way to recover.
Why this is high severity
/clear is the most destructive command in the CLI and the only one with no undo. A single accidental keypress — very easy when navigating a menu — permanently destroys conversation context that may represent significant work. All other destructive actions in modern CLIs (e.g., git reset --hard, rm -rf) are either prompted or at minimum require deliberate additional input.
Suggested fixes
- Add a confirmation prompt to
/clear:"This will erase your conversation history. Continue? [y/N]"— this alone would have prevented the data loss. - Fix arrow key UX in the slash menu: Typing a partial match and pressing down should not jump past the matched item to a destructive command.
- Consider renaming or visually separating
/clearfrom other commands in the menu to reduce proximity to/context.
Environment
- OS: macOS Darwin 25.2.0
- Shell: zsh
- Claude Code version: 2.1.71
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗