Works with the AI Agents you already use
claude session cleanup
Claude Code can accumulate local conversation history across projects over time; this skill helps you review what’s there, decide what to keep, and safely clean up the rest.
Free
claude session cleanup
Example session with this skill installed
Preview Claude Code sessions for this project older than 14 days and show me how much space they take.
- Read your context and instructions
- Compiled the claude session cleanup
I generated a read-only preview of the Claude Code sessions in this project that are older than 14 days.
No files were modified or deleted.
Session Cleanup Preview
| Category | Count | Total Size |
|---|---|---|
| Selected for cleanup | 12 groups | 4.2 MB |
| Retained (newer than 14d) | 5 groups | 1.8 MB |
| Protected (active/running) | 1 group | 156 KB |
| Excluded (unknown metadata) | 0 groups | 0 B |
Claude Code internal retention
Your current cleanupPeriodDays is set to 30.
There are 0 sessions in this project that this cleanup policy would retain but Claude Code's own retention setting may remove sooner.
Details
- Selected sessions range from 15 to 42 days old.
- One conversation group is protected because it appears to be active.
- The 12 selected groups include root sessions together with their associated subagent transcripts.
- Nothing was excluded because of insufficient metadata.
Next steps
- To inspect the selected conversations in more detail, ask me to show their titles.
- If you are on Linux and want to remove them, ask me to create a deletion plan for review.
- You can also change the policy, for example: “Keep my latest 5 conversations regardless of age.”
Permanent deletion is a separate, explicit action and is not performed by a preview.
Connects securely to your tools. The creator never sees your data.
About this skill
Claude Code can accumulate local conversation history across projects over time; this skill helps you review what’s there, decide what to keep, and safely clean up the rest.
Claude Session Cleanup provides a safety-first way to inspect that history, apply retention policies, audit disk usage, and—on Linux—permanently remove selected conversations through a reviewed deletion plan.
What it does
- Preview by age — identify conversations older than a period such as 14 or 30 days.
- Keep the latest N — retain your most recently used conversations and select older ones.
- Project scoping — limit analysis to conversations associated with the current project.
- Retention analysis — show which conversation groups are selected, retained, protected, or excluded, and why.
- Disk-usage auditing — report how much local storage the relevant Claude Code session history uses.
- Safe deletion workflow — on Linux, permanent deletion requires a saved, single-use plan that is reviewed and revalidated before anything is removed.
How it works
- Run a preview with a policy such as
--older-than 30dor--keep-latest 10. - Review the selected, retained, protected, and excluded conversation groups.
- If you want to delete selected conversations on Linux, explicitly create a deletion plan.
- Review the saved plan.
- Apply that exact plan to perform permanent cleanup.
Normal previews are read-only. If the state changes or the tool cannot validate a target safely, it fails closed instead of proceeding.
Platform support
Linux: previews, retention analysis, disk-usage audits, and reviewed permanent deletion.
macOS and Windows: previews, retention analysis, and disk-usage audits. Permanent deletion is not currently supported.
The skill requires Python 3.10+ and local access to the user's Claude Code configuration/session directory. It does not work from a cloud sandbox that cannot access that local data.
Why use this instead of deleting files manually?
Claude Code session storage contains more than isolated transcript files. Removing files manually can affect active sessions or related per-session data.
This skill understands the relevant Claude Code session structure, groups related conversation data together, checks for active or unsafe-to-remove sessions, and requires an explicit reviewed plan before permanent deletion.
Use cases
- Preview conversations older than a specific age.
- Keep only the most recent conversations for a project.
- Audit how much disk space Claude Code session history uses.
- Inspect how Claude Code's
cleanupPeriodDaysrelates to existing transcripts. - Permanently remove selected old conversations on Linux after reviewing a deletion plan.
Known limitations
- Permanent deletion is Linux-only.
- Archive, quarantine, and restore are not supported.
- The tool depends on Claude Code's internal local-storage layout.
- Active-session detection is limited to the local machine, configuration directory, and process namespace.
- Conversations that share data with another active/linked session may be protected from deletion.
Open source
Claude Session Cleanup is free and open source under the MIT License:
https://github.com/Gares95/claude-session-cleanup
This is an independent open-source project and is not affiliated with or endorsed by Anthropic.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.
Permanent deletion is Linux-only; macOS and Windows support previews and audits. No archive, quarantine, or restore. Requires local Claude Code session storage and depends on its internal layout. Active-session detection is limited to the local machine/process namespace.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 3 days ago
- Free with an Agensi account
Windows only
- Software
PythonClaude Code
Linux - required only for permanent deletion
Permissions
File Scopes
Reads local Claude Code session metadata/history. Writes only explicitly requested deletion-plan files and, on Linux after plan review, removes selected session artifacts. No browser or network access.