[Bug] Prompt history navigation loses or overwrites in-progress draft

Resolved 💬 3 comments Opened Dec 31, 2025 by 0xnfrith Closed Jan 4, 2026

Bug Description
Report 1: Bug Report

[Automated Bug Detection System]

UNEXPECTED BEHAVIOR: Prompt history navigation overwrites in-progress draft with old/deleted content

## Issue
When composing a long prompt in Claude Code's input field and using the up-arrow to browse command history, returning to the draft (via down-arrow) does not reliably restore the in-progress text. Instead, users encounter either:

  1. A completely deleted draft (empty input)
  2. An old, previously-saved draft from much earlier

This creates a dangerous situation where significant prompt work can be lost mid-composition.

## Expected Behavior
Navigating through history (up-arrow) and returning to the current position (down-arrow to bottom) should restore the exact in-progress draft that was being composed before history navigation began.

## Actual Behavior (tested 2025-12-31)

  1. Start typing a long prompt in the Claude Code input
  2. Press up-arrow to browse through previous commands
  3. Press down-arrow repeatedly to return to the "draft" position
  4. Result: Draft content is either missing entirely or replaced with stale content from a previous session

## Impact

  • Loss of significant work when composing complex prompts
  • Erosion of trust in the input system
  • Users forced to externally draft prompts to avoid data loss
  • Particularly painful for multi-paragraph prompts or those with code blocks

## Suggested Fix

  • Cache the current draft buffer separately from history entries
  • On history navigation start, snapshot the current input
  • Ensure down-arrow past the most recent history entry restores this snapshot exactly
  • Consider persisting draft state across brief disconnects as well

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.0.76
  • Feedback ID: 7359196a-1de4-453b-9bcd-5665566ca586

Errors

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/0xnfrith/.local/share/claude/versions/2.0.76 (expected in multi-process scenarios)\n    at XZR (/$bunfs/root/claude:2430:2165)\n    at fUA (/$bunfs/root/claude:2430:1885)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-12-31T13:52:08.656Z"}]

View original on GitHub ↗

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