claude-code-cleaner
v0.1.2
Published
Browse and delete Claude Code chat sessions across all projects, from a terminal UI.
Maintainers
Readme
claude-code-cleaner
Browse and delete Claude Code chat sessions across all your projects, from a terminal UI. Sessions are shown by their title, not their opaque uuid, so you can actually tell what you're deleting.
Unofficial, community tool. Not affiliated with or endorsed by Anthropic.
Requirements
- Node.js >= 22
- macOS/Linux (uses
lsoffor a best-effort "is this session active" check; falls back gracefully if unavailable)
Install / run
npx claude-code-cleaneror install globally:
npm install -g claude-code-cleaner
ccscWhat it does
Claude Code stores each chat session as a <uuid>.jsonl file under ~/.claude/projects/,
grouped by project. This tool scans that directory, resolves each session's real title (and
which project it belongs to, even if the mangled directory name is ambiguous), and lets you
multi-select and delete sessions you no longer want — freeing disk space and cleaning up
project/session lists.
Usage
ccsc # launch the interactive TUI
ccsc --json # print all projects/sessions as JSON, no TUI
ccsc --dry-run # (in the TUI) preview a delete without touching disk
ccsc --trash # (in the TUI) move deleted sessions to ~/.claude/.trash instead of
# permanently removing them
ccsc --claude-dir <dir> # point at a different projects directory (mainly for testing)Keybindings
| Key | Action |
| --- | --- |
| ↑/↓, j/k | Navigate |
| Enter | Open project / open delete confirmation for current selection |
| A (project list) | Browse sessions across all projects at once |
| / | Search/filter by title |
| Esc | Clear search, or go back |
| Space | Toggle selection |
| a | Select all visible (filtered) sessions |
| A (session list) | Select all sessions across all projects |
| s | Cycle sort mode (date / size / title) |
| d | Open delete confirmation for current selection |
| r | Rescan |
| ? | Toggle help |
| q | Quit |
Safety
- Deletion is permanent by default and requires an explicit confirmation step. Pass
--trashto move sessions to~/.claude/.trash/<timestamp>/instead of deleting them outright, or--dry-runto preview without touching disk. - The session you're currently running
ccscfrom inside (if launched from within an active Claude Code session) is automatically detected and protected from deletion. - Sessions with a very recent modification time, or that another process appears to have open
(best-effort
lsofcheck), are flagged as "possibly active" in the list, and require typingDELETEto confirm rather than a single keypress. - This tool never modifies
~/.claude.jsonor any other Claude Code internal state — deleting a session only removes its own<uuid>.jsonlfile (and sibling<uuid>/subagent data, if present). Self-contained by design.
Development
npm install
npm run dev -- --claude-dir test/fixtures/claude-home/projects # run against synthetic fixtures
npm test
npm run buildLicense
MIT
