session-cleanup

Clean stale runs, sessions, and traces from ~/.ai storage.

5|Updated Feb 8, 2026
One-click install
npx skills add https://github.com/tiancaiamao/ai --skill session-cleanup-tiancaiamao
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: session-cleanup
Source: https://github.com/tiancaiamao/ai/tree/main/skills/session-cleanup
Command: npx skills add https://github.com/tiancaiamao/ai --skill session-cleanup-tiancaiamao

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps reclaim disk space by identifying and cleaning up stale, short, or abandoned AI session data under ~/.ai/, including runs, sessions, and traces.

Core Features & Use Cases

  • Safe usage review: Checks current storage usage before making any deletion decision.
  • Targeted cleanup: Handles runs, sessions, and traces with age-based and size-based filters.
  • Guarded execution: Uses dry-run defaults, confirmation prompts, and configurable thresholds to reduce accidental data loss.
  • Use case: A user notices their AI workspace is growing too large and wants a controlled way to free space without deleting important configuration files.

Quick Start

Use the session-cleanup skill to inspect ~/.ai usage, review what can be removed, and confirm a safe cleanup to reclaim disk space.

Frequently Asked Questions about session-cleanup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I clean up stale AI sessions and traces taking up disk space?

You can clean up stale AI sessions and traces by running a Bash script that applies age-based and size-based filters to prune abandoned runs, sessions, and traces from your ~/.ai directory. The process uses dry-run defaults and confirmation prompts to ensure safe deletion.

What is the safest way to free up ~/.ai disk space without losing important files?

The safest way to free up ~/.ai disk space is using a guarded cleanup script that starts with a dry-run mode, checks current storage usage, and requires confirmation prompts before deleting. This ensures important configuration files are preserved while only removing stale data.

Can I configure age thresholds for pruning AI agent runs and session data?

Yes, you can configure age thresholds and mode-based deletion controls for pruning AI agent runs and session data. The script allows you to set specific time thresholds to safely target and remove only old or abandoned traces.

Does the session cleanup script support dry-run mode before deleting files?

Yes, the session cleanup script supports dry-run defaults. It inspects your storage usage and reviews what can be removed before requiring explicit confirmation, ensuring no accidental data loss occurs during the maintenance process.

What should I do if my AI workspace is growing too large on my disk?

If your AI workspace is growing too large, you should run a controlled cleanup script to reclaim disk space. It identifies short, stale, or abandoned runs and sessions under ~/.ai/ and removes them using configurable age thresholds while protecting your configuration files.

When should I avoid using age-based deletion for AI trace retention?

You should avoid using age-based deletion for AI trace retention if you need to keep specific historical runs for auditing, as the cleanup script automatically prunes data older than your configured thresholds without distinguishing between important and unimportant traces.