Feature Request: Auto-save input buffer to prevent loss of unsaved prompts

Resolved 💬 5 comments Opened Jan 17, 2026 by eatnug Closed Mar 6, 2026

Problem

When writing long prompts in Claude Code's interactive mode, accidentally pressing the down arrow key causes all typed text to disappear due to command history navigation. This text is not recoverable, leading to frustration when users lose significant work.

Current Workarounds

  • Use Ctrl+R for history search instead of arrow keys
  • Enable multiline mode with Option+Enter or Shift+Enter
  • Draft long prompts in external text editors

While these help prevent the issue, they don't solve the core problem: there's no way to recover accidentally lost text.

Proposed Solution

Implement an auto-save mechanism for the input buffer that preserves typed text before submission:

Implementation Options

  1. Undo/Redo for Input Buffer
  • Add Ctrl+Z / Ctrl+Y support for input line undo/redo
  • Maintain an undo history of text changes independent from command history navigation
  • Similar to how Bash's readline library handles undo
  1. Persistent Draft Recovery
  • Auto-save input buffer to a temporary file every N seconds or N characters
  • Provide a recovery command (e.g., /recover or Ctrl+X Ctrl+R) to restore lost text
  • Clear saved draft after successful submission
  1. Navigation Safety Mode
  • Option to disable history navigation with arrow keys when input is not empty
  • Or require a modifier key (e.g., Ctrl+Up/Down) for history navigation when text exists

Benefits

  • Prevents data loss from accidental keystrokes
  • Improves UX for users writing complex, multi-paragraph prompts
  • Aligns with expected behavior from modern text editors and IDEs
  • Reduces friction in the interactive workflow

Use Case

This is particularly valuable for:

  • Users drafting detailed technical prompts
  • Complex multi-step instructions
  • Users on laptops where accidental key presses are more common
  • Accessibility - users with motor control challenges

Technical Considerations

This would require changes at the terminal input layer (likely in the readline/prompt handling), which is outside the scope of Claude Code skills/hooks since they only execute after submission.

Related

This issue emerged from user discussion about why text disappears and whether skills could solve it. Unfortunately, skills/hooks cannot intercept pre-submission input, making this a core feature request.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗