[FEATURE] Keyboard shortcut to submit prompt in a fresh session (e.g., Cmd+Enter)
Problem Statement
When working in an interactive Claude Code session, I frequently want to start a task with a clean context. My current workflow requires multiple manual steps:
- Type my prompt
- Instead of pressing Enter, I stop
- Copy my prompt
- Run
/clearand wait - Paste my prompt back
- Press Enter
This is a common pattern when switching between unrelated tasks within the same terminal, or when I know the accumulated context will hurt rather than help the next task. The friction of these manual steps adds up significantly over a day of work.
Proposed Solution
Add a keyboard shortcut (e.g., Cmd+Enter on macOS, Ctrl+Enter on Linux/Windows) that submits the current prompt in a fresh session context. Functionally equivalent to /clear + submit, but as a single atomic action.
User experience
- I type my prompt in the interactive REPL
- Instead of pressing Enter (which submits in the current context), I press Cmd+Enter
- Claude Code clears the context and immediately processes my prompt in the fresh session
- I stay in the same interactive session (same terminal, same process)
Bonus: Programmatic access
If this feature exists as a keybinding, it would also be valuable to expose it programmatically — for example, as a hook output action ({ "executeCommand": "/clear" }) or a composable keybinding sequence. But the keyboard shortcut alone would already be a significant workflow improvement.
Alternatives Considered
- UserPromptSubmit hook + external automation (AppleScript/Keyboard Maestro): Works but fragile — relies on timing, terminal focus, and external tools. Not portable across environments.
- Custom slash command: Slash commands cannot invoke other slash commands like
/clear, so this doesn't work. - Keybinding sequences: Current keybindings only support single actions, not chains like "clear then submit."
- Manual
/clear+ re-type: This is what I do today. It works but creates unnecessary friction.
Additional Context
- macOS user, running Claude Code in various terminals (Cursor integrated terminal, iTerm2, Terminal.app)
- This would pair well with the existing mode-switching shortcuts (Shift+Tab, Alt+T for thinking, etc.)
- The
/compactcommand partially addresses this but doesn't give a truly fresh context
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗