clean-sessions

Automate cleanup of Claude Code session transcripts and folders.

2|1|Updated Feb 8, 2021
One-click install
npx skills add https://github.com/jstoobz/dotfiles --skill clean-sessions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-sessions
Source: https://github.com/jstoobz/dotfiles/tree/main/claude/skills/session-kit/clean-sessions
Command: npx skills add https://github.com/jstoobz/dotfiles --skill clean-sessions

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps users keep Claude Code workspace clean by removing outdated or unused sessions from the resume picker, reducing clutter and confusion.

Core Features & Use Cases

  • Discover and classify Claude Code sessions by age, activity, and naming to identify candidates for cleanup.
  • Interactive per-category selection with safe, auto-selected cleanups and a dry-run preview before any deletion.
  • Preserve important artifacts (memory files and project metadata) while deleting only the raw transcripts and per-session directories.

Quick Start

Run the cleanup script to start the interactive session management:

  • python3 ~/.claude/skills/clean-sessions/scripts/clean-sessions.py You can optionally target a specific project with --project PATH or preview changes with --dry-run.

Frequently Asked Questions about clean-sessions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I clean up Claude Code session transcripts and remove old folders?

To clean up Claude Code sessions, you can run a Python script that scans local session indexes under ~/.claude/projects, categorizes outdated transcripts, and interactively deletes per-session directories. It updates the sessions-index.json after deletion to ensure auditable cleanup.

Can I preview which Claude Code sessions will be deleted before committing?

Yes, you can preview session cleanup changes by running the script with the --dry-run flag. This allows you to review which outdated transcripts and session folders will be removed before any actual deletion occurs.

Does Claude Code session cleanup delete project memory files and metadata?

No, Claude Code session cleanup preserves important artifacts like memory files and project metadata. It only targets the raw transcripts and per-session directories, ensuring your project configuration remains intact while reducing resume picker clutter.

What's the best way to manage Claude Code session clutter for a specific project?

You can manage Claude Code session clutter for a specific project by running the cleanup script with the --project PATH argument. This targets only the session indexes and transcripts within the specified project directory.

Do I need to install external dependencies to automate Claude Code session cleanup?

No, you do not need external dependencies to automate Claude Code session cleanup. The script operates entirely using Python's standard library, requiring only a standard Python 3 environment to run.

Why does the Claude Code resume picker show so many outdated sessions?

The Claude Code resume picker shows outdated sessions because old transcripts and session folders accumulate under ~/.claude/projects. Running an interactive cleanup script categorizes these by age and activity to help you safely remove the clutter.