Skip to content

Add claude clean command to manage cache and logs #11646

Description

@fkart

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

Claude Code accumulates significant disk space over time from:

  • Debug logs (can reach 3GB+)
  • Old proxy databases (1GB+ per version)
  • Proxy session files (171+ log files, 30MB)
  • Project caches (2GB+)
  • File history (50MB+)

This accumulation can cause performance issues and crashes.

Proposed Solution

Add a built-in claude clean command with two modes:

Regular clean (safe, keeps project data)

claude clean

Deep clean (removes project caches too)

claude clean --deep

What it should clean:

Regular clean:

  • Debug logs older than N days
  • Old proxy databases (keep latest version only)
  • Old proxy session files (keep current session)
  • File history
  • Shell snapshots
  • Old todos

Deep clean:

  • Everything above +
  • Project caches
  • Command history

Alternative Solutions

Users must manually identify and delete these files, or write custom cleanup scripts.

Impact:

In my case, ~/.claude grew from 184MB to 6.5GB over a few weeks, contributing to stability issues. After cleanup: 97% reduction (6.5GB → 170MB).

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

claude clean
claude clean --deep

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreautocloseIssue will be closed automaticallyenhancementNew feature or requesthas reproHas detailed reproduction steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions