Preflight Checklist
Problem Statement
Currently, there is no built-in way to delete sessions from within Claude Code. When users want to remove old, test, or sensitive sessions, they must:
- Exit Claude Code or open a separate terminal
- Manually navigate to
~/.claude/projects/
- Find the correct
.jsonl session file
- Manually delete the file
This breaks the workflow and is error-prone — especially for users who frequently create sessions for testing or experimentation and want to keep their session list clean when using /resume.
The existing /clear command only clears conversation history within the current session — it does not delete the session itself. There is currently no way to permanently remove a session without leaving Claude Code.
Proposed Solution
Add a /delete command with two modes:
Mode 1: Delete current session
Deletes the currently active session, prompts for confirmation, then exits or starts a new session.
> /delete
Delete current session "portfolio-fixes"? (y/n): y
Session deleted. Starting new session...
Mode 2: Delete session by name
Deletes a specific session by name, similar to how /resume <session-name> works. Shows a list if the name matches multiple sessions.
> /delete my-old-session
Delete session "my-old-session"? (y/n): y
Session deleted.
Ambiguous name handling:
> /delete test
Multiple sessions found:
1. test-auth-flow
2. test-database-migration
3. test-ui-components
Select a session to delete (1-3): 2
Delete session "test-database-migration"? (y/n): y
Session deleted.
Detailed behavior:
| Scenario |
Expected Behavior |
/delete with no arguments |
Targets the current active session |
/delete <name> with exact match |
Targets that specific session |
/delete <name> with multiple matches |
Shows numbered list to choose from |
/delete <name> with no match |
Error: No session found matching "<name>" |
Confirmation declined (n) |
Cancels, returns to current session |
| Deleting current active session |
Starts a new session or exits |
| Deleting a non-active session |
Remains in current session |
Alternative Solutions
No response
Priority
High - Significant impact on productivity
Feature Category
CLI commands and flags
Use Case Example
- I'm working on a project and create multiple test sessions to experiment with different approaches
- After finding the right approach, I have 5-10 leftover test sessions cluttering my
/resume list
- One of those test sessions accidentally contains an API key I pasted during debugging
- Currently, I have to exit Claude Code, navigate to
~/.claude/projects/, figure out which .jsonl files correspond to which sessions, and delete them manually
- With
/delete, I could simply type /delete test-session-3 and confirm — done in seconds without leaving Claude Code
- This keeps the session list clean and the sensitive data removed immediately
Additional Context
This feature would complete the session lifecycle within Claude Code:
Create → Work → Resume → Clear → Delete
Currently the lifecycle is incomplete — users can create, work in, resume, and clear sessions, but cannot delete them without leaving the CLI.
How /delete fits with existing commands:
| Command |
What It Does |
/resume |
Lists and resumes a previous session |
/clear |
Clears conversation history (session still exists) |
/delete (proposed) |
Permanently deletes a session file |
Additional considerations:
- A
--force or -f flag could skip the confirmation prompt for power users
- Session files are stored as
.jsonl in ~/.claude/projects/
- Should handle edge cases: non-existent sessions, permission errors, deleting the last session
Preflight Checklist
Problem Statement
Currently, there is no built-in way to delete sessions from within Claude Code. When users want to remove old, test, or sensitive sessions, they must:
~/.claude/projects/.jsonlsession fileThis breaks the workflow and is error-prone — especially for users who frequently create sessions for testing or experimentation and want to keep their session list clean when using
/resume.The existing
/clearcommand only clears conversation history within the current session — it does not delete the session itself. There is currently no way to permanently remove a session without leaving Claude Code.Proposed Solution
Add a
/deletecommand with two modes:Mode 1: Delete current session
Deletes the currently active session, prompts for confirmation, then exits or starts a new session.
Mode 2: Delete session by name
Deletes a specific session by name, similar to how
/resume <session-name>works. Shows a list if the name matches multiple sessions.Ambiguous name handling:
Detailed behavior:
/deletewith no arguments/delete <name>with exact match/delete <name>with multiple matches/delete <name>with no matchNo session found matching "<name>"n)Alternative Solutions
No response
Priority
High - Significant impact on productivity
Feature Category
CLI commands and flags
Use Case Example
/resumelist~/.claude/projects/, figure out which.jsonlfiles correspond to which sessions, and delete them manually/delete, I could simply type/delete test-session-3and confirm — done in seconds without leaving Claude CodeAdditional Context
This feature would complete the session lifecycle within Claude Code:
Currently the lifecycle is incomplete — users can create, work in, resume, and clear sessions, but cannot delete them without leaving the CLI.
How
/deletefits with existing commands:/resume/clear/delete(proposed)Additional considerations:
--forceor-fflag could skip the confirmation prompt for power users.jsonlin~/.claude/projects/