Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    claude session cleanup

    1

    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

    Security scanned
    claude session cleanup

    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

    CategoryCountTotal Size
    Selected for cleanup12 groups4.2 MB
    Retained (newer than 14d)5 groups1.8 MB
    Protected (active/running)1 group156 KB
    Excluded (unknown metadata)0 groups0 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

    1. To inspect the selected conversations in more detail, ask me to show their titles.
    2. If you are on Linux and want to remove them, ask me to create a deletion plan for review.
    3. 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

    1. Run a preview with a policy such as --older-than 30d or --keep-latest 10.
    2. Review the selected, retained, protected, and excluded conversation groups.
    3. If you want to delete selected conversations on Linux, explicitly create a deletion plan.
    4. Review the saved plan.
    5. 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 cleanupPeriodDays relates 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.

    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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    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 forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 3 days ago

    • Free with an Agensi account

    Requires

    Python
    Claude Code
    macOS
    Linux only
    Windows only

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Environment Variables

    File Scopes

    ~/.claude/**
    $CLAUDE_CONFIG_DIR/**

    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.

    Listed3 days ago

    What's inside

    Frequently Asked Questions

    No. Normal use is read-only and produces a preview. Permanent deletion on Linux requires you to explicitly create a saved plan, review it, and then apply that exact plan. The plan is revalidated before deletion.

    Yes for previews, retention analysis, and disk-usage auditing. Permanent deletion is currently supported only on Linux because its process-safety checks depend on Linux facilities such as /proc.

    The tool checks available session and process information and protects conversations that appear to be active or unsafe to remove. It also revalidates saved plans before deletion and fails closed when required safety information is unavailable.

    It reads Claude Code's local session history and related per-session metadata. It does not intentionally modify your project source code, project memory, or Claude Code settings. On Linux, explicitly approved deletion can remove only the session artifacts selected by the reviewed plan.

    No. Claude Session Cleanup is an independent open-source project and is not affiliated with or endorsed by Anthropic.

    Yes. The project is free and open source under the MIT License at https://github.com/Gares95/claude-session-cleanup. The Agensi listing provides a packaged version for convenient skill discovery and installation.

    New in LLM Ops