Clean up Claude Code debug logs with a command and a hook
See a slash command and a session-end hook clear the Claude Code debug logs that ate 351 gigabytes of disk space.
Who it's for: Anyone who uses Claude Code every day, especially if disk space has started disappearing.
The problem: A known bug can send Claude Code into an infinite logging loop that fills its debug folder. On a laptop with 494 gigabytes, 458 were in use, and the Mac storage view did not show where it went.
The cleanup-debug-logs command deletes debug logs above a size threshold you choose, 1 gigabyte by default, and asks before deleting anything. A bash hook runs the same cleanup every time a session ends.
Takeaways:
- Deleting debug logs frees space with no performance impact on Claude Code.
- Install the hook so cleanup runs after every session.
- Pass a smaller threshold, like 10m, to clear more files on demand.
- Ask Claude Code to investigate other storage problems on your computer.