Skip to content

feat: add cleanup CLI subcommand#34

Open
mtibbits wants to merge 1 commit into
JCSnap:mainfrom
mtibbits:feat/cleanup-cli
Open

feat: add cleanup CLI subcommand#34
mtibbits wants to merge 1 commit into
JCSnap:mainfrom
mtibbits:feat/cleanup-cli

Conversation

@mtibbits

@mtibbits mtibbits commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Problem

When the queue hits rate limits repeatedly, Claude Code creates artifacts in
~/.claude/ (JSONL logs, todo stubs, debug transcripts, telemetry files) that
accumulate rapidly — thousands of junk files during a multi-hour rate-limit
window. The per-execution cleanup (PR #32) prevents new accumulation, but
existing backlogs from before that fix still need a one-time purge.

Solution

Adds claude-queue cleanup [--dry-run] to scan ~/.claude/ and remove
rate-limit artifacts in bulk. No claude binary needed (E3 pattern).

Identification strategy: Scans debug transcripts (~/.claude/debug/*.txt)
for rate_limit_error in the content (authoritative signal), then deletes
correlated JSONL, todo, and telemetry files by UUID.

# Preview what would be deleted
claude-queue cleanup --dry-run

# Delete all rate-limit artifacts
claude-queue cleanup

Example output:

Identified 5178 rate-limited session(s)
Deleted 15534 rate-limit artifact(s)

Test plan

  • 4 new tests in tests/test_cli.py::TestCleanup
    • Dry-run reports but does not delete
    • Real run deletes debug, JSONL, and todo artifacts
    • Non-rate-limited debug files are preserved
    • Empty ~/.claude/ handled gracefully
  • All existing tests pass unchanged

🤖 Generated with Claude Code

@mtibbits mtibbits force-pushed the feat/cleanup-cli branch 3 times, most recently from 17e44be to 2c8ac3a Compare March 16, 2026 02:34
Adds `claude-queue cleanup [--dry-run]` to remove rate-limit artifacts
from ~/.claude/. Identifies rate-limited sessions by scanning debug
transcripts for 'rate_limit_error', then deletes correlated JSONL,
todo, and telemetry files by UUID.

No claude binary needed (E3 pattern).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Matthew Tibbits <mtibbits@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant