Claude Code session draft lost when app updates — input not persisted across Claude Code version upgrades
Description
When Claude Code updates (e.g., from 2.1.63 → 2.1.64), any unsent message being composed in the Claude Code input field is permanently lost. The Claude Code session's draft auto-save mechanism writes to Local Storage approximately every 5 seconds, but the update process terminates the Claude Code process without triggering a final save. After the update, Claude Code does not restore the draft from the last auto-save snapshot either — the session appears empty.
This is a Claude Code data loss bug: the user's in-progress Claude Code input (which can be substantial — multi-paragraph prompts) is silently discarded during version upgrades.
Steps to reproduce
- Open a Claude Code session (via Desktop app or terminal)
- Begin typing a long message in the Claude Code input field (spend 30+ seconds typing)
- A Claude Code update becomes available (e.g., 2.1.63 → 2.1.64)
- The update proceeds (either auto-update or user-initiated)
- After update completes, reopen the Claude Code session
Expected behavior
The Claude Code draft should be preserved across version upgrades, either by:
- Claude Code flushing the current draft to persistent storage before the update kills the process
- Claude Code restoring the draft from the last auto-save snapshot after restarting post-update
Actual behavior
- The Claude Code session appears empty after the update — the draft is gone
- The auto-saved data is technically still present in LevelDB SSTable files (
.ldb) but is logically deleted and not recovered by Claude Code - Content typed between the last auto-save (~5 sec interval) and the update is permanently lost
Root cause analysis
Claude Code's draft auto-save writes to Chromium Local Storage (LevelDB) every ~5 seconds. During a version upgrade:
- The update process kills the Claude Code process (UtilityProcess terminated) without signaling a graceful shutdown
- The last auto-save may be up to 5 seconds stale
- After restart, Claude Code does not check for orphaned auto-save entries from the previous version
- The LevelDB entries are logically deleted during post-update cleanup
Technical evidence (forensic recovery from LevelDB)
I manually parsed the LevelDB SSTable files to recover the lost draft:
- Found 72 progressive auto-save snapshots across multiple
.ldbfiles (Snappy-compressed SSTable data blocks) - Snapshots span ~33 minutes of typing, one every ~5 seconds
- Final recovered snapshot: 4,297 characters (message was cut off mid-word — last ~30 seconds of typing lost)
- Auto-save entries stored as JSON:
{"value":"<draft>","tabId":"<id>","timestamp":<epoch_ms>} - After the update, these entries were logically deleted (physically present in
.ldbfiles but absent from live DB reads)
Suggested fix
- Pre-update flush: Before killing the Claude Code process for an update, signal it to flush the current input draft to persistent storage
- Post-update recovery: On startup after a version upgrade, check for orphaned auto-save drafts from the previous session and offer to restore them
- Increase auto-save frequency: Consider reducing the ~5 second auto-save interval for the input field, or flush on every keystroke pause (debounced)
Environment
- macOS (arm64)
- Claude Code updated from 2.1.63 → 2.1.64
- March 2026
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗