claude-code - 💡(How to fix) Fix Feature request: Add CLI commands for listing and deleting sessions [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46928Fetched 2026-04-12 13:29:28
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Author
Timeline (top)
labeled ×2commented ×1

Code Example

claude sessions list                # List past sessions (with dates, project, summary)
claude sessions delete <session-id> # Delete a specific session
claude sessions clear               # Delete all sessions (with confirmation)
RAW_BUFFERClick to expand / collapse

Problem

Currently there's no built-in CLI command to list or delete past sessions. claude --resume / claude -r opens an interactive picker to resume sessions, but there's no way to:

  • List sessions non-interactively (e.g., for scripting)
  • Delete specific sessions
  • Clean up old sessions

Users must manually find and remove .jsonl files from ~/.claude/projects/<project>/, which requires knowing the internal storage path and structure.

Proposed Solution

Add session management subcommands, for example:

claude sessions list                # List past sessions (with dates, project, summary)
claude sessions delete <session-id> # Delete a specific session
claude sessions clear               # Delete all sessions (with confirmation)

Why

Session files accumulate over time and there's no ergonomic way to manage them. This would complement the existing --resume and --continue flags with full lifecycle management.

extent analysis

TL;DR

Implementing session management subcommands, such as claude sessions list, claude sessions delete, and claude sessions clear, would provide a solution to manage past sessions.

Guidance

  • Consider adding a claude sessions subcommand with options to list, delete, and clear sessions to provide a user-friendly way to manage session files.
  • To list sessions non-interactively, the claude sessions list command could parse the .jsonl files in ~/.claude/projects/<project>/ and display relevant information.
  • To delete specific sessions, the claude sessions delete <session-id> command could take a session ID as an argument and remove the corresponding .jsonl file.
  • To clean up old sessions, the claude sessions clear command could delete all .jsonl files in ~/.claude/projects/<project>/, possibly with a confirmation prompt.

Example

# Example usage of the proposed session management subcommands
claude sessions list
claude sessions delete <session-id>
claude sessions clear

Notes

The implementation details of the session management subcommands would depend on the internal structure and storage of the session files.

Recommendation

Apply workaround: Implement the proposed session management subcommands to provide a user-friendly way to manage past sessions. This would address the current limitations and provide a more ergonomic way to list, delete, and clean up session files.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING