Empty sessions after /clear appear in --resume picker as "(session)"

Resolved 💬 4 comments Opened Mar 1, 2026 by richard-scott Closed Apr 6, 2026

Bug Description

After using /clear in a session and then exiting, the empty post-clear session appears in the --resume / claude -r picker with the label (session). These accumulate over time and clutter the resume list, making it harder to find real sessions.

Steps to Reproduce

  1. Start a Claude Code session
  2. Have a conversation (so there's a real session)
  3. Run /clear
  4. Exit Claude (e.g., /exit or Ctrl+C)
  5. Run claude -r to open the resume picker

Expected Behavior

The empty session created after /clear should not appear in the resume picker. Sessions with no user messages have nothing to resume.

Actual Behavior

A new entry labelled (session) appears in the resume picker. Each /clear + exit cycle adds another one, expanding the list with useless entries.

Suggested Fix

Either:

  • Don't persist sessions that contain no user messages
  • Filter out empty sessions from the --resume picker
  • Don't create a new session on /clear until the user actually sends a message

Environment

  • Claude Code CLI (latest)
  • Linux (also likely affects macOS/Windows)

View original on GitHub ↗

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