Disk Cleaner Skill - Complete Feature Guide for All Agents 🚨 IMPORTANT: Emoji Usage Policy For Script Output (Cross-Platform Safety) - NEVER use emoji in script output - All scripts use ASCII-safe characters - Scripts use: , , , , , , , , - This ensures compatibility with Windows GBK and other non-UTF-8 consoles - DO NOT modify script output to add emoji - This will break cross-platform compatibility For Agent-to-Human Communication (Recommended) - SHOULD use emoji when reporting results to humans - Makes output more readable - Use these emoji in your final reports to users: - (Success) - Co…

Category\\tSize(KiB)\\tPath'\n\n for root in \"${QQ_ROOTS[@]}\"; do\n [[ -e \"$root\" ]] || continue\n safe_root \"$root\" || fail \"unsafe QQ root: $root\"\n (( found += 1 ))\n\n for category in Pic Emoji nt_db Cache 'Code Cache' GPUCache nt_temp log; do\n while IFS= read -r dir; do\n [[ -n \"$dir\" ]] || continue\n kib=$(du -sk \"$dir\" 2>/dev/null | awk '{print $1}') || fail \"cannot measure: $dir\"\n print -r -- \"${category}\"

Disk Cleaner Skill - Complete Feature Guide for All Agents 🚨 IMPORTANT: Emoji Usage Policy For Script Output (Cross-Platform Safety) - NEVER use emoji in script output - All scripts use ASCII-safe characters - Scripts use: , , , , , , , , - This ensures compatibility with Windows GBK and other non-UTF-8 consoles - DO NOT modify script output to add emoji - This will break cross-platform compatibility For Agent-to-Human Communication (Recommended) - SHOULD use emoji when reporting results to humans - Makes output more readable - Use these emoji in your final reports to users: - (Success) - Co…

\\t'\"${kib:-0}\"

Disk Cleaner Skill - Complete Feature Guide for All Agents 🚨 IMPORTANT: Emoji Usage Policy For Script Output (Cross-Platform Safety) - NEVER use emoji in script output - All scripts use ASCII-safe characters - Scripts use: , , , , , , , , - This ensures compatibility with Windows GBK and other non-UTF-8 consoles - DO NOT modify script output to add emoji - This will break cross-platform compatibility For Agent-to-Human Communication (Recommended) - SHOULD use emoji when reporting results to humans - Makes output more readable - Use these emoji in your final reports to users: - (Success) - Co…

\\t'\"$dir\"\n done \u003c \u003c(discover_dirs \"$root\" \"$category\")\n done\n done\n\n (( found > 0 )) || fail \"no recognized QQ storage found\" 2\n}\n\nparse_clean_args() {\n local arg\n CLEAN_DAYS=''\n CLEAN_CATEGORIES=''\n CLEAN_EXECUTE=0\n shift\n\n while (( $# > 0 )); do\n arg=$1\n case \"$arg\" in\n --older-than-days)\n (( $# >= 2 )) || fail \"--older-than-days needs a value\"\n CLEAN_DAYS=$2\n shift 2\n ;;\n --categories)\n (( $# >= 2 )) || fail \"--categories needs a value\"\n CLEAN_CATEGORIES=$2\n shift 2\n ;;\n --execute)\n CLEAN_EXECUTE=1\n shift\n ;;\n *) fail \"unknown option: $arg\" ;;\n esac\n done\n\n [[ \"$CLEAN_DAYS\" == \u003c-> && \"$CLEAN_DAYS\" -gt 0 ]] || fail \"days must be a positive integer\"\n [[ -n \"$CLEAN_CATEGORIES\" ]] || fail \"categories are required\"\n}\n\ncollect_targets() {\n local list_file=$1 cutoff=$2 root category dir\n : > \"$list_file\" || return 1\n TARGET_DIRS=()\n\n for root in \"${QQ_ROOTS[@]}\"; do\n [[ -e \"$root\" ]] || continue\n safe_root \"$root\" || return 1\n for category in ${(s:,:)CLEAN_CATEGORIES}; do\n while IFS= read -r dir; do\n [[ -n \"$dir\" ]] || continue\n TARGET_DIRS+=(\"$dir\")\n find \"$dir\" -xdev -type f ! -newermt \"$cutoff\" -print0 2>/dev/null >> \"$list_file\" || return 1\n done \u003c \u003c(discover_dirs \"$root\" \"$category\")\n done\n done\n}\n\npath_is_targeted() {\n local file=$1 dir\n [[ -f \"$file\" && ! -L \"$file\" ]] || return 1\n for dir in \"${TARGET_DIRS[@]}\"; do\n [[ \"$file\" == \"$dir/\"* ]] && return 0\n done\n return 1\n}\n\nqq_is_stopped() {\n command -v pgrep >/dev/null 2>&1 || return 2\n pgrep -x QQ >/dev/null 2>&1\n case $? in\n 0) return 1 ;;\n 1) return 0 ;;\n *) return 2 ;;\n esac\n}\n\nclean() {\n local cutoff list_file file count blocks bytes deleted=0 failed=0 residual\n parse_clean_args \"$@\"\n\n local category\n for category in ${(s:,:)CLEAN_CATEGORIES}; do\n [[ \"$category\" == Pic || \"$category\" == Emoji ]] || fail \"only Pic and Emoji may be cleaned\"\n done\n\n cutoff=$(date -v-\"${CLEAN_DAYS}\"d '+%Y-%m-%d %H:%M:%S' 2>/dev/null) || fail \"cannot calculate cutoff\"\n list_file=$(mktemp \"${TMPDIR:-/tmp}/qq-cleanup.XXXXXX\") || fail \"cannot create temporary list\"\n CLEAN_LIST_FILE=$list_file\n trap 'rm -f -- \"$CLEAN_LIST_FILE\"' EXIT INT TERM\n collect_targets \"$list_file\" \"$cutoff\" || fail \"cannot collect safe targets\"\n\n count=$(tr -cd '\\000' \u003c \"$list_file\" | wc -c | tr -d ' ')\n if [[ -s \"$list_file\" ]]; then\n blocks=$(xargs -0 stat -f '%b' \u003c \"$list_file\" 2>/dev/null | awk '{s+=$1} END {print s+0}') || fail \"cannot measure targets\"\n else\n blocks=0\n fi\n bytes=$(( blocks * 512 ))\n\n print -- \"mode=$([[ $CLEAN_EXECUTE -eq 1 ]] && print execute || print preview)\"\n print -- \"cutoff=$cutoff\"\n print -- \"categories=$CLEAN_CATEGORIES\"\n print -- \"files=$count\"\n print -- \"estimated_bytes=$bytes\"\n\n if (( CLEAN_EXECUTE == 0 )); then\n print -- \"No files changed. Re-run with --execute only after approval and after quitting QQ.\"\n return 0\n fi\n\n qq_is_stopped\n case $? in\n 0) ;;\n 1) fail \"QQ is running; quit QQ before cleanup\" ;;\n *) fail \"cannot determine whether QQ is running\" ;;\n esac\n\n while IFS= read -r -d '' file; do\n if path_is_targeted \"$file\" && rm -f -- \"$file\"; then\n (( deleted += 1 ))\n else\n (( failed += 1 ))\n fi\n done \u003c \"$list_file\"\n\n collect_targets \"$list_file\" \"$cutoff\" || fail \"cleanup finished but verification failed\"\n residual=$(tr -cd '\\000' \u003c \"$list_file\" | wc -c | tr -d ' ')\n print -- \"deleted_files=$deleted\"\n print -- \"failed_files=$failed\"\n print -- \"residual_files=$residual\"\n df -h /System/Volumes/Data 2>/dev/null | tail -n 1 || true\n\n (( failed == 0 && residual == 0 ))\n}\n\nmain() {\n require_macos\n case ${1:-} in\n audit) audit ;;\n clean) clean \"$@\" ;;\n -h|--help|help|'') usage ;;\n *) usage; exit 64 ;;\n esac\n}\n\nmain \"$@\"\n","content_type":"application/x-sh; charset=utf-8","language":"bash","size":6088,"content_sha256":"f3b0bfb96d22e26757f1e4e10cd04cee40ece3435896f27265371816ff171127"},{"filename":"scripts/scheduler.py","content":"#!/usr/bin/env python3\n\"\"\"\nDisk Cleaner Scheduler - Automated cleanup scheduling\n\nSupports scheduled cleanup tasks with configurable intervals.\nCross-platform scheduler using platform-specific mechanisms.\n\"\"\"\n\nimport json\nimport os\nimport platform\nimport sys\nfrom datetime import datetime, timedelta\nfrom pathlib import Path\nfrom typing import Dict, List\n\n\nclass CleanupScheduler:\n \"\"\"Scheduler for automated disk cleanup tasks.\"\"\"\n\n def __init__(self, config_path: str = None):\n self.config_path = config_path or self._get_default_config_path()\n self.platform = platform.system()\n self.tasks = self._load_tasks()\n\n def _get_default_config_path(self) -> str:\n \"\"\"Get default configuration file path.\"\"\"\n config_dir = os.path.expanduser(\"~/.disk-cleaner\")\n os.makedirs(config_dir, exist_ok=True)\n return os.path.join(config_dir, \"scheduler.json\")\n\n def _load_tasks(self) -> List[Dict]:\n \"\"\"Load scheduled tasks from configuration.\"\"\"\n if os.path.exists(self.config_path):\n with open(self.config_path) as f:\n return json.load(f).get(\"tasks\", [])\n return []\n\n def _save_tasks(self, tasks: List[Dict]):\n \"\"\"Save scheduled tasks to configuration.\"\"\"\n os.makedirs(os.path.dirname(self.config_path), exist_ok=True)\n with open(self.config_path, \"w\") as f:\n json.dump({\"tasks\": tasks}, f, indent=2)\n\n def add_task(\n self,\n name: str,\n path: str,\n schedule: str,\n cleanup_type: str = \"smart\",\n options: Dict = None,\n ):\n \"\"\"Add a new scheduled cleanup task.\"\"\"\n task = {\n \"name\": name,\n \"path\": path,\n \"schedule\": schedule,\n \"cleanup_type\": cleanup_type,\n \"options\": options or {},\n \"enabled\": True,\n \"last_run\": None,\n \"next_run\": self._calculate_next_run(schedule),\n }\n\n self.tasks.append(task)\n self._save_tasks(self.tasks)\n\n def _calculate_next_run(self, schedule: str) -> str:\n \"\"\"Calculate next run time based on schedule.\"\"\"\n now = datetime.now()\n\n # Simple interval parsing (e.g., \"24h\" for every 24 hours)\n if schedule.endswith(\"h\"):\n hours = int(schedule[:-1])\n next_run = now + timedelta(hours=hours)\n return next_run.isoformat()\n\n # Default to daily\n next_run = now + timedelta(days=1)\n return next_run.isoformat()\n\n def list_tasks(self) -> List[Dict]:\n \"\"\"List all scheduled tasks.\"\"\"\n return self.tasks\n\n def remove_task(self, task_name: str):\n \"\"\"Remove a scheduled task by name.\"\"\"\n self.tasks = [t for t in self.tasks if t[\"name\"] != task_name]\n self._save_tasks(self.tasks)\n\n def run_task(self, task: Dict, dry_run: bool = True):\n \"\"\"Execute a single cleanup task.\"\"\"\n path = task[\"path\"]\n cleanup_type = task[\"cleanup_type\"]\n\n print(f\"\\n{'='*60}\")\n print(f\"Running task: {task['name']}\")\n print(f\"Path: {path}\")\n print(f\"Type: {cleanup_type}\")\n print(f\"Mode: {'DRY RUN' if dry_run else 'CLEAN'}\")\n print(f\"{'='*60}\\n\")\n\n # Import cleanup modules\n sys.path.insert(0, str(Path(__file__).parent.parent))\n from diskcleaner.core import SmartCleanupEngine\n\n # Run cleanup\n engine = SmartCleanupEngine(path, cache_enabled=True)\n report = engine.analyze(include_duplicates=True, safety_check=True)\n\n # Display results\n summary = engine.get_summary(report)\n print(summary)\n\n if not dry_run:\n print(\"\\n[!] Actual cleanup not yet implemented in scheduler mode\")\n print(\" Use --force to enable (coming soon)\")\n\n # Update last run time\n task[\"last_run\"] = datetime.now().isoformat()\n task[\"next_run\"] = self._calculate_next_run(task[\"schedule\"])\n self._save_tasks(self.tasks)\n\n def run_due_tasks(self, dry_run: bool = True):\n \"\"\"Run all tasks that are due.\"\"\"\n now = datetime.now()\n due_tasks = []\n\n for task in self.tasks:\n if not task.get(\"enabled\", True):\n continue\n\n next_run = task.get(\"next_run\")\n if next_run and datetime.fromisoformat(next_run) \u003c= now:\n due_tasks.append(task)\n\n if not due_tasks:\n print(\"No tasks due to run.\")\n return\n\n print(f\"Running {len(due_tasks)} due task(s)...\\n\")\n\n for task in due_tasks:\n try:\n self.run_task(task, dry_run=dry_run)\n except Exception as e:\n print(f\"Error running task '{task['name']}': {e}\")\n\n def install_system_scheduler(self):\n \"\"\"Install as system scheduler (cron/task scheduler).\"\"\"\n if self.platform == \"Linux\":\n self._install_cron()\n elif self.platform == \"Darwin\":\n self._install_launchd()\n elif self.platform == \"Windows\":\n self._install_task_scheduler()\n else:\n print(f\"Platform {self.platform} not supported for system scheduling\")\n\n def _install_cron(self):\n \"\"\"Install as cron job on Linux.\"\"\"\n print(\"Cron installation not yet implemented.\")\n print(\"Manual cron entry example:\")\n print(\"0 2 * * * /usr/bin/python3 -m diskcleaner.scheduler --run-tasks\")\n\n def _install_launchd(self):\n \"\"\"Install as launchd service on macOS.\"\"\"\n print(\"Launchd installation not yet implemented.\")\n\n def _install_task_scheduler(self):\n \"\"\"Install as Windows Task Scheduler task.\"\"\"\n print(\"Task Scheduler installation not yet implemented.\")\n\n\ndef print_tasks(tasks: List[Dict]):\n \"\"\"Print scheduled tasks in a formatted table.\"\"\"\n if not tasks:\n print(\"No scheduled tasks.\")\n return\n\n print(f\"\\n{'='*80}\")\n print(f\"{'SCHEDULED TASKS':^80}\")\n print(f\"{'='*80}\\n\")\n\n for i, task in enumerate(tasks, 1):\n status = \"✅ Enabled\" if task.get(\"enabled\", True) else \"❌ Disabled\"\n print(f\"{i}. {task['name']} [{status}]\")\n print(f\" Path: {task['path']}\")\n print(f\" Schedule: {task['schedule']}\")\n print(f\" Type: {task['cleanup_type']}\")\n print(f\" Last run: {task.get('last_run', 'Never')}\")\n print(f\" Next run: {task.get('next_run', 'Not scheduled')}\")\n print()\n\n\ndef main():\n # Fix Windows console encoding for emoji support\n import sys\n\n if sys.platform == \"win32\":\n import codecs\n\n sys.stdout = codecs.getwriter(\"utf-8\")(sys.stdout.buffer, \"strict\")\n sys.stderr = codecs.getwriter(\"utf-8\")(sys.stderr.buffer, \"strict\")\n\n import argparse\n\n parser = argparse.ArgumentParser(description=\"Disk Cleaner Scheduler\")\n parser.add_argument(\"--config\", \"-c\", help=\"Configuration file path\")\n\n subparsers = parser.add_subparsers(dest=\"command\", help=\"Commands\")\n\n # Add task\n add_parser = subparsers.add_parser(\"add\", help=\"Add a new scheduled task\")\n add_parser.add_argument(\"name\", help=\"Task name\")\n add_parser.add_argument(\"path\", help=\"Path to clean\")\n add_parser.add_argument(\"schedule\", help=\"Schedule (e.g., 24h for every 24 hours)\")\n add_parser.add_argument(\n \"--type\",\n \"-t\",\n default=\"smart\",\n choices=[\"smart\", \"temp\", \"cache\", \"logs\"],\n help=\"Cleanup type (default: smart)\",\n )\n\n # List tasks\n subparsers.add_parser(\"list\", help=\"List scheduled tasks\")\n\n # Remove task\n remove_parser = subparsers.add_parser(\"remove\", help=\"Remove a task\")\n remove_parser.add_argument(\"name\", help=\"Task name to remove\")\n\n # Run tasks\n run_parser = subparsers.add_parser(\"run\", help=\"Run due tasks\")\n run_parser.add_argument(\n \"--force\", action=\"store_true\", help=\"Actually delete files (disables dry-run)\"\n )\n\n # Install system scheduler\n subparsers.add_parser(\"install\", help=\"Install as system scheduler\")\n\n args = parser.parse_args()\n\n if not args.command:\n parser.print_help()\n return 0\n\n scheduler = CleanupScheduler(config_path=args.config)\n\n if args.command == \"add\":\n scheduler.add_task(\n name=args.name, path=args.path, schedule=args.schedule, cleanup_type=args.type\n )\n print(f\"[OK] Task '{args.name}' added successfully\")\n print(f\" Schedule: {args.schedule}\")\n print(f\" Next run: {scheduler.tasks[-1]['next_run']}\")\n\n elif args.command == \"list\":\n tasks = scheduler.list_tasks()\n print_tasks(tasks)\n\n elif args.command == \"remove\":\n scheduler.remove_task(args.name)\n print(f\"[OK] Task '{args.name}' removed\")\n\n elif args.command == \"run\":\n dry_run = not args.force\n scheduler.run_due_tasks(dry_run=dry_run)\n\n elif args.command == \"install\":\n scheduler.install_system_scheduler()\n\n return 0\n\n\nif __name__ == \"__main__\":\n sys.exit(main())\n","content_type":"text/x-python; charset=utf-8","language":"python","size":9016,"content_sha256":"961c140b46df688e329b05d55ab77e27b6d119a13052bac10b9fb6b81f0761eb"},{"filename":"scripts/skill_bootstrap.py","content":"#!/usr/bin/env python3\n\"\"\"\nSkill Bootstrap Module - Intelligent Bootstrap Module\n\nThis module ensures disk-cleaner skill package runs correctly in any environment,\nwithout requiring pre-installed diskcleaner package.\n\nFeatures:\n- Auto-detect skill package location\n- Dynamically add module paths to sys.path\n- Cross-platform compatibility handling\n- Graceful error handling and fallback options\n- Environment detection and diagnostic information\n\"\"\"\n\nimport os\nimport platform\nimport sys\nfrom pathlib import Path\nfrom typing import Any, Optional, Tuple\n\n# Safe fallback characters for emoji (for environments that don't support emoji)\nEMOJI_FALLBACKS = {\n \"✅\": \"[OK]\",\n \"❌\": \"[X]\",\n \"⚠️\": \"[!]\",\n \"🎉\": \"[*]\",\n \"📋\": \"[i]\",\n \"📁\": \"[DIR]\",\n \"📦\": \"[PKG]\",\n \"🔐\": \"[KEY]\",\n \"🧪\": \"[TEST]\",\n \"🔍\": \"[?]\",\n \"💡\": \"[i]\",\n \"❓\": \"[?]\",\n}\n\n\ndef safe_print(message: str, file=None):\n \"\"\"\n Safe print function, automatically handles encoding issues\n\n Automatically replaces emoji with ASCII characters in environments like Windows GBK\n that don't support emoji\n \"\"\"\n if file is None:\n file = sys.stdout\n\n try:\n print(message, file=file)\n file.flush()\n except UnicodeEncodeError:\n # Encoding error, replace emoji and Chinese characters\n safe_message = message\n for emoji, fallback in EMOJI_FALLBACKS.items():\n safe_message = safe_message.replace(emoji, fallback)\n\n # If still has encoding issues, try replacing all non-ASCII characters\n try:\n print(safe_message, file=file)\n file.flush()\n except UnicodeEncodeError:\n # Last resort: keep only ASCII\n safe_message = safe_message.encode(\"ascii\", \"replace\").decode(\"ascii\")\n print(safe_message, file=file)\n file.flush()\n\n\ndef init_windows_console():\n \"\"\"\n Initialize Windows console, try setting UTF-8 encoding\n\n This needs to be called before importing any modules\n \"\"\"\n if platform.system().lower() == \"windows\":\n try:\n # Try setting console code page to UTF-8\n import ctypes\n import ctypes.wintypes\n\n # Set console output to UTF-8\n kernel32 = ctypes.windll.kernel32\n kernel32.SetConsoleOutputCP(65001) # CP_UTF8\n\n # Reset stdout/stderr\n if hasattr(sys.stdout, \"buffer\"):\n import io\n\n sys.stdout = io.TextIOWrapper(\n sys.stdout.buffer, encoding=\"utf-8\", errors=\"replace\", line_buffering=True\n )\n if hasattr(sys.stderr, \"buffer\"):\n sys.stderr = io.TextIOWrapper(\n sys.stderr.buffer, encoding=\"utf-8\", errors=\"replace\", line_buffering=True\n )\n except Exception:\n # Use default settings on failure\n pass\n\n\nclass SkillBootstrap:\n \"\"\"Skill package bootstrap - ensures skill package can run independently\"\"\"\n\n def __init__(self):\n self.skill_root: Optional[Path] = None\n self.platform = platform.system().lower()\n self.python_version = sys.version_info\n self.debug = os.environ.get(\"DISK_CLEANER_DEBUG\", \"\").lower() == \"true\"\n\n def log(self, message: str) -> None:\n \"\"\"Debug log output\"\"\"\n if self.debug:\n safe_print(f\"[Bootstrap] {message}\", file=sys.stderr)\n\n def print(self, message: str):\n \"\"\"Safe print method\"\"\"\n safe_print(message)\n\n def detect_skill_root(self) -> Optional[Path]:\n \"\"\"\n Intelligently detect skill package root directory - Universal/Platform/IDE agnostic\n\n Search strategy (priority order):\n 1. Environment variable DISK_CLEANER_SKILL_PATH (manually specified)\n 2. Parent directory of script location\n 3. Current working directory and its parents\n 4. Universal skill directory in user home\n 5. Platform-specific directories\n 6. Paths in sys.path\n \"\"\"\n if self.skill_root:\n return self.skill_root\n\n # Method 0: Check environment variable (highest priority)\n env_path = os.environ.get(\"DISK_CLEANER_SKILL_PATH\")\n if env_path:\n candidate = Path(env_path)\n if self._is_valid_skill_root(candidate):\n self.skill_root = candidate\n self.log(f\"Detected skill root from environment variable: {candidate}\")\n return candidate\n else:\n self.log(f\"Environment variable path invalid: {env_path}\")\n\n # Method 1: Infer from script location\n try:\n import inspect\n\n frame = inspect.currentframe()\n if frame and frame.f_back:\n caller_file = frame.f_back.f_globals.get(\"__file__\")\n if caller_file:\n script_path = Path(caller_file).resolve()\n # Parent of scripts/ directory is skill root\n if script_path.parent.name == \"scripts\":\n candidate = script_path.parent.parent\n if self._is_valid_skill_root(candidate):\n self.skill_root = candidate\n self.log(f\"Detected skill root from script location: {candidate}\")\n return candidate\n except Exception as e:\n self.log(f\"Script location detection failed: {e}\")\n\n # Method 2: Detect from current working directory and its parents\n cwd = Path.cwd()\n search_in_cwd = [\n cwd / \"disk-cleaner\",\n cwd / \"skills\" / \"disk-cleaner\",\n cwd / \".skills\" / \"disk-cleaner\",\n cwd / \"agent-skills\" / \"disk-cleaner\",\n cwd / \".agent-skills\" / \"disk-cleaner\",\n ]\n\n # Add parent directories (max 3 levels)\n for level, parent in enumerate([cwd, *cwd.parents][:3]):\n search_in_cwd.extend(\n [\n parent / \"skills\" / \"disk-cleaner\",\n parent / \".skills\" / \"disk-cleaner\",\n parent / \"agent-skills\" / \"disk-cleaner\",\n ]\n )\n\n for candidate in search_in_cwd:\n if self._is_valid_skill_root(candidate):\n self.skill_root = candidate\n self.log(f\"Detected skill root from working directory: {candidate}\")\n return candidate\n\n # Method 3: Universal skill locations in user home\n home = Path.home()\n user_skill_dirs = [\n home / \"skills\" / \"disk-cleaner\",\n home / \".skills\" / \"disk-cleaner\",\n home / \"agent-skills\" / \"disk-cleaner\",\n home / \".agent-skills\" / \"disk-cleaner\",\n home / \"skill-packages\" / \"disk-cleaner\",\n ]\n\n for candidate in user_skill_dirs:\n if self._is_valid_skill_root(candidate):\n self.skill_root = candidate\n self.log(f\"Detected skill root from user skill directory: {candidate}\")\n return candidate\n\n # Method 4: Platform and IDE specific directories\n platform_specific = []\n\n if self.platform == \"windows\":\n # Windows specific\n appdata = os.environ.get(\"APPDATA\", \"\")\n localappdata = os.environ.get(\"LOCALAPPDATA\", \"\")\n if appdata:\n platform_specific.append(Path(appdata) / \"skills\" / \"disk-cleaner\")\n if localappdata:\n platform_specific.append(Path(localappdata) / \"skills\" / \"disk-cleaner\")\n else:\n # Unix-like (macOS, Linux) specific\n platform_specific.extend(\n [\n home / \".local\" / \"share\" / \"skills\" / \"disk-cleaner\",\n home / \".config\" / \"skills\" / \"disk-cleaner\",\n Path(\"/usr/local/share/skills/disk-cleaner\"),\n Path(\"/opt/skills/disk-cleaner\"),\n ]\n )\n\n # IDE specific directories (universal)\n ide_specific = [\n home / \".cursor\" / \"skills\" / \"disk-cleaner\",\n home / \".windsurf\" / \"skills\" / \"disk-cleaner\",\n home / \".continue\" / \"skills\" / \"disk-cleaner\",\n home / \".aider\" / \"skills\" / \"disk-cleaner\",\n ]\n platform_specific.extend(ide_specific)\n\n for candidate in platform_specific:\n if self._is_valid_skill_root(candidate):\n self.skill_root = candidate\n self.log(f\"Detected skill root from platform/IDE directory: {candidate}\")\n return candidate\n\n # Method 5: Check existing paths in sys.path\n for path_entry in sys.path:\n if path_entry and path_entry not in [\"\", \".\"]:\n test_path = Path(path_entry)\n # Check if directly in skill root\n if self._is_valid_skill_root(test_path):\n self.skill_root = test_path\n self.log(f\"Detected skill root from sys.path: {test_path}\")\n return test_path\n # Check parent\n if self._is_valid_skill_root(test_path.parent):\n self.skill_root = test_path.parent\n self.log(f\"Detected skill root from sys.path parent: {test_path.parent}\")\n return test_path.parent\n\n self.log(\"Could not auto-detect skill root directory\")\n self.log(\"Please set environment variable DISK_CLEANER_SKILL_PATH=/path/to/skill\")\n return None\n\n def _is_valid_skill_root(self, path: Path) -> bool:\n \"\"\"Check if path is a valid skill root directory\"\"\"\n if not path or not path.exists():\n return False\n\n # Check key files and directories\n indicators = [\n path / \"SKILL.md\",\n path / \"scripts\",\n path / \"diskcleaner\",\n path / \"diskcleaner\" / \"__init__.py\",\n path / \"diskcleaner\" / \"core\" / \"progress.py\",\n ]\n\n return all(indicator.exists() for indicator in indicators)\n\n def setup_import_path(self) -> bool:\n \"\"\"\n Setup module import path\n\n Returns:\n True if setup successful, False otherwise\n \"\"\"\n skill_root = self.detect_skill_root()\n\n if not skill_root:\n self.log(\"Cannot find skill root, trying installed diskcleaner\")\n # Try direct import (if already installed)\n return self._try_import_installed()\n\n # Add skill root to sys.path\n skill_root_str = str(skill_root)\n if skill_root_str not in sys.path:\n sys.path.insert(0, skill_root_str)\n self.log(f\"Added to sys.path: {skill_root_str}\")\n\n # Verify import\n return self._verify_import()\n\n def _try_import_installed(self) -> bool:\n \"\"\"Try using installed diskcleaner package\"\"\"\n try:\n import diskcleaner\n\n self.log(f\"Using installed diskcleaner: {diskcleaner.__version__}\")\n return True\n except (ImportError, AttributeError):\n return False\n\n def _verify_import(self) -> bool:\n \"\"\"Verify diskcleaner module can be imported correctly\"\"\"\n try:\n # Try importing key modules\n from diskcleaner.core.progress import ProgressBar\n from diskcleaner.core.scanner import DirectoryScanner\n\n self.log(\"Successfully imported diskcleaner module\")\n return True\n except ImportError as e:\n self.log(f\"Import failed: {e}\")\n return False\n\n def get_environment_info(self) -> dict:\n \"\"\"Get environment diagnostic information\"\"\"\n info = {\n \"platform\": self.platform,\n \"python_version\": (\n f\"{self.python_version.major}.\"\n f\"{self.python_version.minor}.{self.python_version.micro}\"\n ),\n \"python_executable\": sys.executable,\n \"skill_root\": str(self.skill_root) if self.skill_root else None,\n \"sys_path\": sys.path[:5], # First 5 paths\n }\n\n # Check key modules\n info[\"modules\"] = {}\n for module_name in [\"diskcleaner\", \"diskcleaner.core.progress\", \"diskcleaner.core.scanner\"]:\n try:\n __import__(module_name)\n info[\"modules\"][module_name] = \"available\"\n except ImportError:\n info[\"modules\"][module_name] = \"missing\"\n\n return info\n\n def diagnose_import_failure(self) -> str:\n \"\"\"Diagnose import failure reason and provide fix suggestions\"\"\"\n lines = [\n \"=\" * 60,\n \"DISK CLEANER SKILL PACKAGE DIAGNOSTIC REPORT\",\n \"=\" * 60,\n ]\n\n info = self.get_environment_info()\n\n # Basic info\n lines.extend(\n [\n \"\",\n \"[i] Environment Info:\",\n f\" Platform: {info['platform']}\",\n f\" Python: {info['python_version']}\",\n f\" Python path: {info['python_executable']}\",\n ]\n )\n\n # Skill root\n if info[\"skill_root\"]:\n lines.append(f\" Skill root: {info['skill_root']}\")\n else:\n lines.append(\" Skill root: Not found [!]\")\n\n # Module status\n lines.append(\"\")\n lines.append(\"[PKG] Module Status:\")\n for module, status in info[\"modules\"].items():\n icon = \"[OK]\" if status == \"available\" else \"[X]\"\n lines.append(f\" {icon} {module}: {status}\")\n\n # Diagnostic suggestions\n lines.append(\"\")\n lines.append(\"[i] Fix Suggestions:\")\n\n if not info[\"skill_root\"]:\n lines.extend(\n [\n \"\",\n \"Skill root not found. Please try the following methods:\",\n \"\",\n \"Method 1: Ensure running script from correct directory\",\n \" cd skills/disk-cleaner/scripts\",\n \" python analyze_disk.py\",\n \"\",\n \"Method 2: Add skills/disk-cleaner to PYTHONPATH\",\n \" export PYTHONPATH=/path/to/skills/disk-cleaner:$PYTHONPATH\",\n \"\",\n \"Method 3: Reinstall skill package\",\n \" Ensure extracted to correct directory\",\n ]\n )\n\n elif info[\"modules\"].get(\"diskcleaner\") == \"missing\":\n lines.extend(\n [\n \"\",\n \"diskcleaner module missing. Please check:\",\n \" 1. Whether skill package completely extracted\",\n f\" 2. Whether diskcleaner directory exists at: {info['skill_root']}\",\n \" 3. Whether directory contains __init__.py file\",\n ]\n )\n\n lines.append(\"\")\n lines.append(\"=\" * 60)\n\n return \"\\n\".join(lines)\n\n def setup_stdout_encoding(self) -> None:\n \"\"\"\n Intelligently set stdout encoding\n\n Cross-platform handling:\n - Windows: Try UTF-8, fallback to system default\n - Unix: Default to UTF-8\n - Handle non-TTY environments (redirection, pipes)\n \"\"\"\n if not sys.stdout.isatty():\n # Non-interactive environment, use default encoding\n return\n\n if self.platform == \"windows\":\n try:\n # Windows: Try setting to UTF-8\n if hasattr(sys.stdout, \"buffer\"):\n import io\n\n # First try using UTF-8\n try:\n # Test if UTF-8 is available\n test_writer = io.TextIOWrapper(\n sys.stdout.buffer, encoding=\"utf-8\", errors=\"strict\"\n )\n # Try writing an emoji test\n test_writer.write(\"\\u2705\")\n test_writer.flush()\n\n # If successful, use UTF-8\n sys.stdout = io.TextIOWrapper(\n sys.stdout.buffer,\n encoding=\"utf-8\",\n errors=\"replace\", # Use replace to avoid subsequent errors\n )\n if hasattr(sys.stderr, \"buffer\"):\n sys.stderr = io.TextIOWrapper(\n sys.stderr.buffer, encoding=\"utf-8\", errors=\"replace\"\n )\n self.log(\"Set Windows console to UTF-8 encoding\")\n except (UnicodeEncodeError, OSError):\n # UTF-8 unavailable, use system default encoding (usually GBK)\n self.log(\"UTF-8 unavailable, using system default encoding\")\n # Don't modify stdout, keep system default\n except Exception as e:\n self.log(f\"Encoding setup failed, using system default: {e}\")\n # On failure, do nothing and use system default\n\n # Unix systems usually default to UTF-8, no special handling needed\n\n\n# Global bootstrap instance\n_bootstrap_instance: Optional[SkillBootstrap] = None\n\n\ndef get_bootstrap() -> SkillBootstrap:\n \"\"\"Get bootstrap instance (singleton pattern)\"\"\"\n global _bootstrap_instance\n if _bootstrap_instance is None:\n _bootstrap_instance = SkillBootstrap()\n return _bootstrap_instance\n\n\ndef setup_skill_environment(\n require_modules: bool = True, fix_encoding: bool = True\n) -> Tuple[bool, Optional[SkillBootstrap]]:\n \"\"\"\n Setup skill runtime environment\n\n Args:\n require_modules: If True, display diagnostics and exit when module import fails\n fix_encoding: If True, automatically fix stdout encoding\n\n Returns:\n (Success flag, bootstrap instance)\n\n Example:\n >>> success, bootstrap = setup_skill_environment()\n >>> if not success:\n >>> sys.exit(1)\n \"\"\"\n bootstrap = get_bootstrap()\n\n # Fix encoding\n if fix_encoding:\n bootstrap.setup_stdout_encoding()\n\n # Setup import path\n success = bootstrap.setup_import_path()\n\n if require_modules and not success:\n print(bootstrap.diagnose_import_failure(), file=sys.stderr)\n return False, bootstrap\n\n return success, bootstrap\n\n\ndef import_diskcleaner_modules():\n \"\"\"\n Convenience function to import diskcleaner modules\n\n Returns:\n (Success flag, modules dictionary)\n\n Example:\n >>> success, modules = import_diskcleaner_modules()\n >>> if success:\n >>> ProgressBar = modules['ProgressBar']\n >>> DirectoryScanner = modules['DirectoryScanner']\n \"\"\"\n success, bootstrap = setup_skill_environment(require_modules=False)\n\n if not success:\n return False, {}\n\n modules = {}\n\n try:\n from diskcleaner.config import Config\n from diskcleaner.core.cache import CacheManager\n from diskcleaner.core.classifier import FileClassifier\n from diskcleaner.core.progress import ProgressBar\n from diskcleaner.core.safety import SafetyChecker\n from diskcleaner.core.scanner import DirectoryScanner\n from diskcleaner.core.duplicate_finder import DuplicateFinder\n\n modules.update(\n {\n \"ProgressBar\": ProgressBar,\n \"DirectoryScanner\": DirectoryScanner,\n \"Config\": Config,\n \"CacheManager\": CacheManager,\n \"FileClassifier\": FileClassifier,\n \"SafetyChecker\": SafetyChecker,\n \"DuplicateFinder\": DuplicateFinder,\n }\n )\n\n return True, modules\n except ImportError as e:\n bootstrap.log(f\"Module import failed: {e}\")\n return False, modules\n\n\n# When running as script directly, display diagnostic information\nif __name__ == \"__main__\":\n # Initialize console encoding on Windows\n init_windows_console()\n\n import argparse\n\n parser = argparse.ArgumentParser(description=\"Disk Cleaner skill package diagnostic tool\")\n parser.add_argument(\"--debug\", action=\"store_true\", help=\"Show debug information\")\n parser.add_argument(\"--test-import\", action=\"store_true\", help=\"Test module import\")\n\n args = parser.parse_args()\n\n if args.debug:\n os.environ[\"DISK_CLEANER_DEBUG\"] = \"true\"\n\n bootstrap = get_bootstrap()\n\n if args.test_import:\n safe_print(\"Testing module import...\")\n success, modules = import_diskcleaner_modules()\n if success:\n safe_print(\"[OK] Module import successful!\")\n for name in modules.keys():\n safe_print(f\" - {name}\")\n else:\n safe_print(\"[X] Module import failed!\")\n safe_print(bootstrap.diagnose_import_failure())\n sys.exit(1)\n else:\n safe_print(bootstrap.diagnose_import_failure())\n","content_type":"text/x-python; charset=utf-8","language":"python","size":20988,"content_sha256":"0db01565b253a497d71c1ee0df55f8f619bd02a896787f01db1ba9183de10c82"},{"filename":"scripts/test_wizard.py","content":"#!/usr/bin/env python3\n\"\"\"\nTest script for Interactive Wizard\n\nTests the wizard functionality without requiring user interaction.\n\"\"\"\n\nimport sys\nfrom pathlib import Path\n\n# Add parent directory to path\nSCRIPT_DIR = Path(__file__).parent.parent\nsys.path.insert(0, str(SCRIPT_DIR))\n\nfrom scripts.interactive_wizard import InteractiveWizard\n\n\ndef test_wizard_initialization():\n \"\"\"Test wizard initialization.\"\"\"\n print(\"Testing wizard initialization...\")\n\n wizard = InteractiveWizard(\".\")\n assert wizard.target_path.exists(), \"Target path should exist\"\n assert wizard.config is not None, \"Config should be loaded\"\n assert wizard.engine is not None, \"Engine should be initialized\"\n assert wizard.ui is not None, \"UI should be initialized\"\n\n print(\"[OK] Wizard initialization successful\")\n\n\ndef test_scan_mode_config():\n \"\"\"Test scan mode configuration.\"\"\"\n print(\"\\nTesting scan mode configuration...\")\n\n wizard = InteractiveWizard(\".\")\n\n # Test all scan modes\n modes = [\"1\", \"2\", \"3\", \"4\", \"5\"]\n expected = [\"quick\", \"standard\", \"deep\", \"progressive\", \"custom\"]\n\n for mode, expected_name in zip(modes, expected):\n result = wizard._get_scan_mode_config(mode)\n assert result == expected_name, f\"Mode {mode} should map to {expected_name}\"\n display_name = wizard._get_scan_mode_name(result)\n print(f\"[OK] Mode {mode}: {result} ({display_name})\")\n\n\ndef test_size_formatting():\n \"\"\"Test size formatting.\"\"\"\n print(\"\\nTesting size formatting...\")\n\n wizard = InteractiveWizard(\".\")\n\n test_cases = [\n (100, \"100 B\"),\n (1024, \"1.00 KB\"),\n (1048576, \"1.00 MB\"),\n (1073741824, \"1.00 GB\"),\n (1099511627776, \"1.00 TB\"),\n ]\n\n for size_bytes, expected in test_cases:\n result = wizard._format_size(size_bytes)\n assert result == expected, f\"Size {size_bytes} should format as {expected}, got {result}\"\n print(f\"[OK] {size_bytes:,} bytes -> {result}\")\n\n\ndef test_risk_emoji():\n \"\"\"Test risk emoji mapping (ASCII-safe).\"\"\"\n print(\"\\nTesting risk level indicators...\")\n\n wizard = InteractiveWizard(\".\")\n\n test_cases = [\n (\"safe\", \"OK\"),\n (\"confirm_needed\", \"!\"),\n (\"protected\", \"X\"),\n (\"unknown\", \"?\"),\n ]\n\n for risk, expected in test_cases:\n result = wizard._get_risk_emoji(risk)\n assert result == expected, f\"Risk {risk} should map to {expected}\"\n print(f\"[OK] Risk '{risk}': {result}\")\n\n\ndef test_scan_mode_parameters():\n \"\"\"Test scan mode parameter setup.\"\"\"\n print(\"\\nTesting scan mode parameters...\")\n\n from diskcleaner.core.scanner import DirectoryScanner\n from diskcleaner.config import Config\n\n config = Config.load()\n\n # Quick scan\n scanner_quick = DirectoryScanner(\".\", config=config, max_files=10000, max_seconds=1)\n assert scanner_quick.max_files == 10000, \"Quick scan should limit files\"\n assert scanner_quick.max_seconds == 1, \"Quick scan should limit time\"\n print(\"[OK] Quick scan: 10k files, 1 second\")\n\n # Standard scan\n scanner_std = DirectoryScanner(\".\", config=config, max_files=100000, max_seconds=120)\n assert scanner_std.max_files == 100000, \"Standard scan should limit files\"\n assert scanner_std.max_seconds == 120, \"Standard scan should limit time\"\n print(\"[OK] Standard scan: 100k files, 120 seconds\")\n\n # Deep scan\n scanner_deep = DirectoryScanner(\".\", config=config, max_files=None, max_seconds=None)\n # Note: DirectoryScanner sets defaults if None is passed\n # Check if it allows very high limits instead of None\n print(f\"[OK] Deep scan: max_files={scanner_deep.max_files}, max_seconds={scanner_deep.max_seconds}\")\n\n # Progressive scan\n scanner_prog = DirectoryScanner(\".\", config=config, cache_enabled=True)\n assert scanner_prog.cache_enabled is True, \"Progressive scan should use cache\"\n print(\"[OK] Progressive scan: cache enabled\")\n\n\ndef main():\n \"\"\"Run all tests.\"\"\"\n print(\"=\" * 60)\n print(\"Interactive Wizard Test Suite\")\n print(\"=\" * 60)\n\n try:\n test_wizard_initialization()\n test_scan_mode_config()\n test_size_formatting()\n test_risk_emoji()\n test_scan_mode_parameters()\n\n print(\"\\n\" + \"=\" * 60)\n print(\"All tests passed!\")\n print(\"=\" * 60)\n return 0\n\n except AssertionError as e:\n print(f\"\\n[FAILED] {e}\")\n return 1\n except Exception as e:\n print(f\"\\n[ERROR] {e}\")\n import traceback\n traceback.print_exc()\n return 1\n\n\nif __name__ == \"__main__\":\n sys.exit(main())\n","content_type":"text/x-python; charset=utf-8","language":"python","size":4595,"content_sha256":"ca73050bc6b96014debb3a00ce893137bcf4940b5c3076cefe0e8edb0ac2643a"},{"filename":"UNIVERSAL_INSTALL.md","content":"# Universal Installation Guide\n\n## 🌐 Platform & IDE Independent Installation\n\nThis guide works for **ALL platforms** and **ALL AI IDEs**.\n\n---\n\n## 📋 What You Need\n\n- **Python 3.7+** - The ONLY requirement\n- **This skill package** - The .skill file or extracted directory\n\nThat's it! No other dependencies.\n\n---\n\n## 🚀 Quick Install (3 Steps)\n\n### Step 1: Verify Python\n\n```bash\n# Windows\npython --version\n\n# macOS/Linux\npython3 --version\n```\n\nIf you see `Python 3.x.x`, you're ready!\n\nIf not, install from: https://www.python.org/downloads/\n\n### Step 2: Extract Skill Package\n\nExtract `disk-cleaner.skill` to ONE of these locations:\n\n**Recommended (User-level):**\n```bash\n# Windows\n%USERPROFILE%\\skills\\disk-cleaner\\\n\n# macOS/Linux\n~/.skills/disk-cleaner/\n```\n\n**Alternative (Project-level):**\n```bash\nyour-project/skills/disk-cleaner/\n```\n\n**Any location works!** The skill includes intelligent auto-detection.\n\n### Step 3: Verify Installation\n\n```bash\ncd skills/disk-cleaner # Or wherever you extracted it\npython scripts/check_skill.py\n```\n\nExpected output:\n```\n✅ All checks passed! Skill package ready to use.\n```\n\n---\n\n## 🎯 Installation Locations\n\nThe skill works at **ANY** of these levels:\n\n### User Level (Recommended)\n\n```\n~/.skills/disk-cleaner/ # Unix-like (macOS, Linux)\n~/agent-skills/disk-cleaner/ # Alternative\nC:\\Users\\You\\skills\\disk-cleaner\\ # Windows\n```\n\n**Benefits:**\n- ✅ Available to all projects\n- ✅ Single installation\n- ✅ Easy to update\n\n### Project Level\n\n```\nyour-project/\n├── skills/\n│ └── disk-cleaner/ ← Extract here\n├── src/\n└── README.md\n```\n\n**Benefits:**\n- ✅ Project-specific\n- ✅ Version locked\n- ✅ Portable with project\n\n### Global/System Level\n\n```\n/usr/local/share/skills/disk-cleaner/ # Linux (system-wide)\nC:\\ProgramData\\skills\\disk-cleaner\\ # Windows (system-wide)\n```\n\n**Benefits:**\n- ✅ All users can access\n- ✅ Centralized management\n\n**Note:** May require admin privileges.\n\n---\n\n## 🤖 AI IDE Compatibility\n\nThis skill works with **ALL** AI IDEs:\n\n### Cursor\n\n```bash\n# Extract to:\n~/.cursor/skills/disk-cleaner/\n# OR\nyour-project/.cursor/skills/disk-cleaner/\n```\n\nNo configuration needed - Cursor auto-detects.\n\n### Windsurf\n\n```bash\n# Extract to:\n~/.windsurf/skills/disk-cleaner/\n# OR\nyour-project/skills/disk-cleaner/\n```\n\nWorks immediately.\n\n### Continue\n\n```bash\n# Extract to:\n~/.continue/skills/disk-cleaner/\n# OR\nyour-project/skills/disk-cleaner/\n```\n\nOptionally add to config.json:\n```json\n{\n \"skills\": [\"./skills/disk-cleaner\"]\n}\n```\n\n### Aider\n\n```bash\n# Extract anywhere, then use via:\n!python skills/disk-cleaner/scripts/analyze_disk.py\n```\n\n### Claude Code\n\n```bash\n# Extract to:\n~/.claude/skills/disk-cleaner/\n# OR\nyour-project/skills/disk-cleaner/\n```\n\nAuto-detected by Claude Code.\n\n### Other AI IDEs\n\nThe skill works via subprocess - just extract and use!\n\n---\n\n## 🔧 Environment Variables (Optional)\n\nYou can set these to override auto-detection:\n\n```bash\n# Specify skill location\nexport DISK_CLEANER_SKILL_PATH=/path/to/disk-cleaner\n\n# Specify Python command\nexport DISK_CLEANER_PYTHON_CMD=python3\n\n# Enable debug output\nexport DISK_CLEANER_DEBUG=true\n```\n\n**Windows:**\n```cmd\nset DISK_CLEANER_SKILL_PATH=C:\\path\\to\\disk-cleaner\nset DISK_CLEANER_PYTHON_CMD=python\nset DISK_CLEANER_DEBUG=true\n```\n\n---\n\n## 📁 Directory Structure (After Extraction)\n\n```\ndisk-cleaner/\n├── SKILL.md # Universal agent guide\n├── AGENT_QUICK_REF.txt # Quick reference\n├── NO_PYTHON_GUIDE.md # Help without Python\n├── INSTALL.md # This file\n├── scripts/\n│ ├── analyze_disk.py\n│ ├── clean_disk.py\n│ ├── monitor_disk.py\n│ ├── check_skill.py # Diagnostic tool\n│ └── skill_bootstrap.py # Auto-detection module\n└── diskcleaner/ # Self-contained modules\n```\n\n**No additional installation needed!**\n\n---\n\n## ✅ Verification\n\n### Quick Check\n\n```bash\npython scripts/check_skill.py\n```\n\n### Detailed Check\n\n```bash\n# With debug output\nDISK_CLEANER_DEBUG=true python scripts/check_skill.py\n```\n\n### Test Python Import\n\n```bash\npython scripts/skill_bootstrap.py --test-import\n```\n\n---\n\n## 🚨 Troubleshooting\n\n### Problem: Python not found\n\n**Solution:** Install Python 3.7+\n\n**Windows:**\n1. Download from https://www.python.org/downloads/\n2. ✅ Check \"Add Python to PATH\"\n3. Install\n\n**macOS:**\n```bash\nbrew install [email protected]\n```\n\n**Linux:**\n```bash\nsudo apt install python3 # Debian/Ubuntu\nsudo dnf install python3 # Fedora\n```\n\n### Problem: Skill not found\n\n**Solution:** The skill searches many locations. If not found:\n\n1. **Set environment variable:**\n ```bash\n export DISK_CLEANER_SKILL_PATH=/path/to/disk-cleaner\n ```\n\n2. **Extract to recommended location:**\n ```bash\n mkdir -p ~/.skills\n cp -r disk-cleaner ~/.skills/\n ```\n\n3. **Run from extracted location:**\n ```bash\n cd /path/to/disk-cleaner\n python scripts/check_skill.py\n ```\n\n### Problem: Permission denied\n\n**Unix-like (macOS/Linux):**\n```bash\nchmod +x scripts/*.py\n```\n\n**Windows:** Run as Administrator if needed\n\n### Problem: Works in terminal but not in IDE\n\n**Solution:** Check IDE can access Python\n\n**Most IDEs:** Just add Python to system PATH\n\n**Specific IDEs:**\n- **Cursor:** Settings → Path → Python executable\n- **Windsurf:** Settings → Languages → Python\n- **Continue:** config.json → pythonPath\n\n---\n\n## 🎓 Usage Examples\n\n### From Terminal\n\n```bash\n# Analyze current directory\npython scripts/analyze_disk.py\n\n# Preview cleanup\npython scripts/clean_disk.py --dry-run\n\n# Monitor disk\npython scripts/monitor_disk.py\n```\n\n### From Python Script\n\n```python\nimport subprocess\nfrom pathlib import Path\n\nskill_path = Path(\"~/skills/disk-cleaner\").expanduser()\n\n# Analyze\nsubprocess.run(\n ['python', 'scripts/analyze_disk.py'],\n cwd=str(skill_path)\n)\n\n# Clean preview\nsubprocess.run(\n ['python', 'scripts/clean_disk.py', '--dry-run'],\n cwd=str(skill_path)\n)\n```\n\n### From Any AI IDE\n\nThe skill is detected automatically in most IDEs.\n\nIf not, use subprocess:\n```python\n!python skills/disk-cleaner/scripts/analyze_disk.py\n```\n\n---\n\n## 🔄 Updates\n\nTo update the skill:\n\n1. Download new version\n2. Extract to same location\n3. Overwrite existing files\n4. Run `python scripts/check_skill.py` to verify\n\n---\n\n## 📞 Support\n\nIf you encounter issues:\n\n1. Run diagnostic: `python scripts/check_skill.py`\n2. Enable debug: `DISK_CLEANER_DEBUG=true`\n3. Check SKILL.md for troubleshooting\n4. See NO_PYTHON_GUIDE.md if you don't have Python\n\n---\n\n## ✨ Features\n\n- ✅ **Platform Independent** - Works everywhere\n- ✅ **IDE Agnostic** - Compatible with all AI IDEs\n- ✅ **Self-Contained** - No pip install needed\n- ✅ **Auto-Detection** - Finds itself automatically\n- ✅ **Safe by Default** --dry-run for all operations\n- ✅ **Cross-Platform** - Windows, macOS, Linux\n\n---\n\n**That's it! Extract and use - no complex setup required!**\n\nThe skill package works everywhere, with every AI IDE, at any installation level.\n","content_type":"text/markdown; charset=utf-8","language":"markdown","size":7076,"content_sha256":"2f1a6f15c2dc46541bebb0fe70c2530af041f8902d8d3f7e713d712190e6643c"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Disk Cleaner Skill - Complete Feature Guide for All Agents","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"🚨 IMPORTANT: Emoji Usage Policy","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"For Script Output (Cross-Platform Safety)","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"NEVER use emoji in script output","type":"text","marks":[{"type":"strong"}]},{"text":" - All scripts use ASCII-safe characters","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Scripts use: ","type":"text"},{"text":"[OK]","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"[X]","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"[!]","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"[*]","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"[i]","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"[DIR]","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"[FILE]","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"[PKG]","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"[x]","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"This ensures compatibility with Windows GBK and other non-UTF-8 consoles","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"DO NOT modify script output to add emoji","type":"text","marks":[{"type":"strong"}]},{"text":" - This will break cross-platform compatibility","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"For Agent-to-Human Communication (Recommended)","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"SHOULD use emoji when reporting results to humans","type":"text","marks":[{"type":"strong"}]},{"text":" - Makes output more readable","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use these emoji in your final reports to users:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Success) - Completed operations, successful scans","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"❌","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Error) - Failed operations, critical errors","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"⚠️","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Warning) - Warnings, issues that need attention","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"🔍","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Scanning) - Search/scan operations","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"📊","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Statistics) - Analysis results, statistics","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"📁","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Directory) - Directory-related information","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"📦","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Package) - Package/module information","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"🎉","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Success) - Celebratory messages for successful completion","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"🚨","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Critical) - Critical warnings","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"💡","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Tip) - Suggestions, recommendations","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"📋","type":"text","marks":[{"type":"code_inline"}]},{"text":" (List) - Checklists, summaries","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"🔧","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Tool) - Tools, utilities","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"🌐","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Global) - Cross-platform, universal features","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"🛡️","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Safety) - Safety-related information","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"⚡","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Performance) - Performance improvements","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"📝","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Document) - Documentation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"🎓","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Learning) - Educational content","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"📞","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Support) - Help, support information","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"📈","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Growth) - Improvements, gains","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"🎯","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Target) - Goals, objectives","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"🚀","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Launch) - Quick start, fast operations","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"🛠️","type":"text","marks":[{"type":"code_inline"}]},{"text":" (Tools) - Tool-related features","type":"text"}]}]}]}]}]},{"type":"paragraph","content":[{"text":"Example:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"Script output (ASCII): [OK] Scan completed: 50,000 files in 30 seconds\nYour report to human: ✅ Scan completed successfully! Found 50,000 files in 30 seconds","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"📦 COMPLETE FEATURE LIST (READ THIS FIRST!)","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"🚨 CRITICAL: Progressive Scanning (MANDATORY for Large Disks)","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Quick Sample Mode","type":"text","marks":[{"type":"strong"}]},{"text":": 1-second estimation of disk size and scan time","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Progressive Scan Mode","type":"text","marks":[{"type":"strong"}]},{"text":": Get partial results in 30 seconds for large disks","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Smart Time Limits","type":"text","marks":[{"type":"strong"}]},{"text":": Prevent users from waiting hours","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Real-time Feedback","type":"text","marks":[{"type":"strong"}]},{"text":": Progress updates every 2 seconds","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Interruptible","type":"text","marks":[{"type":"strong"}]},{"text":": Ctrl+C to get partial results","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"🔧 Intelligent Bootstrap (Auto-Detection & Import)","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Auto Location Detection","type":"text","marks":[{"type":"strong"}]},{"text":": Searches 20+ common skill package locations","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Environment Variable Support","type":"text","marks":[{"type":"strong"}]},{"text":": DISK_CLEANER_SKILL_PATH override","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Auto Module Import","type":"text","marks":[{"type":"strong"}]},{"text":": Automatically imports diskcleaner modules","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Fallback Mechanisms","type":"text","marks":[{"type":"strong"}]},{"text":": Works even if some features unavailable","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Cross-Platform Python Detection","type":"text","marks":[{"type":"strong"}]},{"text":": Tries both 'python' and 'python3'","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"🌐 Universal Compatibility","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"All AI IDEs","type":"text","marks":[{"type":"strong"}]},{"text":": Cursor, Windsurf, Continue, Aider, Claude Code, etc.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"All Platforms","type":"text","marks":[{"type":"strong"}]},{"text":": Windows, macOS, Linux (including Windows GBK console)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"All Installation Levels","type":"text","marks":[{"type":"strong"}]},{"text":": Global, project, user level","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"No Configuration Needed","type":"text","marks":[{"type":"strong"}]},{"text":": Works out of the box","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Cross-Platform Encoding","type":"text","marks":[{"type":"strong"}]},{"text":": All scripts use ASCII-safe output (v2.0+)","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"🛡️ Safety & Reliability","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Diagnostic Tool","type":"text","marks":[{"type":"strong"}]},{"text":": check_skill.py - verifies all functionality","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Safe Encoding","type":"text","marks":[{"type":"strong"}]},{"text":": All scripts use ASCII characters (no emoji in output)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Safe Defaults","type":"text","marks":[{"type":"strong"}]},{"text":": --dry-run for cleaning, smart limits for scanning","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Protected Paths","type":"text","marks":[{"type":"strong"}]},{"text":": Never deletes system directories or executables","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Error Handling","type":"text","marks":[{"type":"strong"}]},{"text":": Graceful degradation on errors","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"GBK/UTF-8 Compatible","type":"text","marks":[{"type":"strong"}]},{"text":": Works on Windows GBK, UTF-8, and all other encodings","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"⚡ Performance Optimizations (ALL INCLUDED)","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"QuickProfiler","type":"text","marks":[{"type":"strong"}]},{"text":": Fast sampling to estimate scan characteristics","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"ConcurrentScanner","type":"text","marks":[{"type":"strong"}]},{"text":": Multi-threaded I/O for 3-5x speedup","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"os.scandir() Optimization","type":"text","marks":[{"type":"strong"}]},{"text":": 3-5x faster than Path.glob","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"IncrementalCache","type":"text","marks":[{"type":"strong"}]},{"text":": Cache scan results for faster repeat scans","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Memory Monitoring","type":"text","marks":[{"type":"strong"}]},{"text":": Auto-adapts based to available memory","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Early Stopping","type":"text","marks":[{"type":"strong"}]},{"text":": Configurable file/time limits","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Enhanced Cache Detection","type":"text","marks":[{"type":"strong"}]},{"text":": 26+ cache paths (was 8) - 225% improvement","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"🆕 v2.2+ New Features","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Duplicate File Detection","type":"text","marks":[{"type":"strong"}]},{"text":": Find and remove duplicate files with adaptive strategies","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Growth Trend Analysis","type":"text","marks":[{"type":"strong"}]},{"text":": Track disk usage over time, predict when disk will be full","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Interactive Wizard","type":"text","marks":[{"type":"strong"}]},{"text":": Step-by-step guided cleanup with safety confirmations","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"File Organization","type":"text","marks":[{"type":"strong"}]},{"text":": Intelligent file archival and organization (4 strategies)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Enhanced Scan Limits","type":"text","marks":[{"type":"strong"}]},{"text":": 500K files (was 50K), 120s timeout (was 30s)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Deep Scan Mode","type":"text","marks":[{"type":"strong"}]},{"text":": ","type":"text"},{"text":"--deep-scan","type":"text","marks":[{"type":"code_inline"}]},{"text":" for unlimited scanning","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Windows Directory Support","type":"text","marks":[{"type":"strong"}]},{"text":": ","type":"text"},{"text":"--include-windows","type":"text","marks":[{"type":"code_inline"}]},{"text":" for system directory scanning","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"📊 Available Scripts (13+ Total)","type":"text"}]},{"type":"paragraph","content":[{"text":"Core Analysis:","type":"text","marks":[{"type":"strong"}]}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"analyze_disk.py","type":"text","marks":[{"type":"strong"}]},{"text":" - Disk analysis with smart sampling (enhanced v2.2)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"analyze_progressive.py","type":"text","marks":[{"type":"strong"}]},{"text":" - Progressive scanning for large disks","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"find_duplicates.py","type":"text","marks":[{"type":"strong"}]},{"text":" - Duplicate file detection (NEW v2.2)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"analyze_growth.py","type":"text","marks":[{"type":"strong"}]},{"text":" - Growth trend analysis (NEW v2.2)","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Cleaning & Organization:","type":"text","marks":[{"type":"strong"}]},{"text":" 5. ","type":"text"},{"text":"clean_disk.py","type":"text","marks":[{"type":"strong"}]},{"text":" - Safe junk file cleaning (enhanced cache detection) 6. ","type":"text"},{"text":"interactive_wizard.py","type":"text","marks":[{"type":"strong"}]},{"text":" - Interactive guided cleanup (NEW v2.2) 7. ","type":"text"},{"text":"organize_files.py","type":"text","marks":[{"type":"strong"}]},{"text":" - File archival and organization (NEW v2.2)","type":"text"}]},{"type":"paragraph","content":[{"text":"Monitoring & Diagnostics:","type":"text","marks":[{"type":"strong"}]},{"text":" 8. ","type":"text"},{"text":"monitor_disk.py","type":"text","marks":[{"type":"strong"}]},{"text":" - Disk usage monitoring 9. ","type":"text"},{"text":"check_skill.py","type":"text","marks":[{"type":"strong"}]},{"text":" - Diagnostic tool","type":"text"}]},{"type":"paragraph","content":[{"text":"Developer Tools:","type":"text","marks":[{"type":"strong"}]},{"text":" 10. ","type":"text"},{"text":"skill_bootstrap.py","type":"text","marks":[{"type":"strong"}]},{"text":" - Intelligent bootstrap module 11. ","type":"text"},{"text":"package_skill.py","type":"text","marks":[{"type":"strong"}]},{"text":" - Package creation tool 12. ","type":"text"},{"text":"scheduler.py","type":"text","marks":[{"type":"strong"}]},{"text":" - Automated scheduling","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"macOS QQ media cleanup","type":"text"}]},{"type":"paragraph","content":[{"text":"Use ","type":"text"},{"text":"scripts/qq_cleanup_macos.zsh","type":"text","marks":[{"type":"code_inline"}]},{"text":" when QQ pictures or emojis consume excessive space on macOS and chat records must remain intact.","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Audit QQ storage without changing files:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"zsh"},"content":[{"text":"scripts/qq_cleanup_macos.zsh audit","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Preview pictures and emojis older than 90 days:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"zsh"},"content":[{"text":"scripts/qq_cleanup_macos.zsh clean --older-than-days 90 --categories Pic,Emoji","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Report the preview and obtain explicit approval. Quit QQ, then repeat the approved command with ","type":"text"},{"text":"--execute","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Never select ","type":"text"},{"text":"nt_db","type":"text","marks":[{"type":"code_inline"}]},{"text":", account roots, preferences, voice messages, videos, or received files. The script accepts only ","type":"text"},{"text":"Pic","type":"text","marks":[{"type":"code_inline"}]},{"text":" and ","type":"text"},{"text":"Emoji","type":"text","marks":[{"type":"code_inline"}]},{"text":", defaults to preview, and refuses execution while QQ is running. Warn that removed local media might no longer be available in old conversations.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"🚀 Multi-Agent Acceleration (CRITICAL FOR PERFORMANCE)","type":"text"}]},{"type":"paragraph","content":[{"text":"🎯 KEY INSIGHT: Use Sub-Agents for Parallel Processing","type":"text","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"text":"This is one of the MOST POWERFUL features of disk-cleaner when used by AI Agents!","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"Why Use Multiple Agents?","type":"text"}]},{"type":"paragraph","content":[{"text":"Single-threaded scanning:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"Agent scans → [Dir1] → [Dir2] → [Dir3] → ... (sequential, slow)","type":"text"}]},{"type":"paragraph","content":[{"text":"Multi-Agent parallel scanning:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"Main Agent\n ├─ Sub-Agent-1 scans → [Dir1, Dir2, Dir3] (parallel)\n ├─ Sub-Agent-2 scans → [Dir4, Dir5, Dir6] (parallel)\n └─ Sub-Agent-3 scans → [Dir7, Dir8, Dir9] (parallel)\nResult: 3-10x faster! ⚡","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"When to Use Multi-Agent Mode?","type":"text"}]},{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"ALWAYS use when:","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Scanning multiple top-level directories (e.g., C:, D:, E:)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Cleaning multiple user profiles","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Processing large file sets (>100K files)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Time-critical operations","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"❌ ","type":"text"},{"text":"Don't use when:","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Single small directory (\u003c10K files)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Quick analysis (\u003c30 seconds)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Simple cleanup tasks","type":"text"}]}]}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"How to Implement Multi-Agent Scanning","type":"text"}]},{"type":"paragraph","content":[{"text":"Option 1: Use Agent Tool (Recommended for Claude Code)","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# Agent code that spawns sub-agents\nfrom anthropic import Anthropic\n\ndef parallel_scan_directories(directories_list):\n \"\"\"\n Scan multiple directories in parallel using sub-agents\n \"\"\"\n # Split directories among sub-agents (3-5 agents optimal)\n chunks = split_list(directories_list, n_chunks=3)\n \n # Launch sub-agents in parallel\n agents = []\n for i, chunk in enumerate(chunks):\n agent = Anthropic().agent.create(\n name=f\"scanner-{i}\",\n instructions=f\"\"\"\n Scan these directories: {chunk}\n Use disk-cleaner with: --file-limit 50000 --time-limit 60\n Return results in JSON format\n \"\"\",\n model=\"claude-sonnet-4-20250514\" # Fast model\n )\n agents.append(agent)\n \n # Wait for all agents and collect results\n results = [agent.wait() for agent in agents]\n return merge_results(results)","type":"text"}]},{"type":"paragraph","content":[{"text":"Option 2: Parallel Subprocess (Platform Independent)","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"import subprocess\nfrom concurrent.futures import ThreadPoolExecutor, as_completed\n\ndef parallel_scan_subprocess(directories_list):\n \"\"\"\n Scan multiple directories using parallel subprocess calls\n Works with ALL AI IDEs that support subprocess\n \"\"\"\n def scan_directory(directory):\n \"\"\"Scan a single directory\"\"\"\n cmd = [\n 'python',\n 'skills/disk-cleaner/scripts/analyze_disk.py',\n '--path', str(directory),\n '--file-limit', '50000',\n '--json'\n ]\n result = subprocess.run(cmd, capture_output=True, text=True)\n return json.loads(result.stdout)\n \n # Use 3-5 parallel workers\n with ThreadPoolExecutor(max_workers=4) as executor:\n futures = {\n executor.submit(scan_directory, d): d\n for d in directories_list\n }\n \n results = {}\n for future in as_completed(futures):\n directory = futures[future]\n try:\n results[directory] = future.result()\n except Exception as e:\n results[directory] = {\"error\": str(e)}\n \n return results\n\n# Usage: Scan C:\\, D:\\, E:\\ in parallel\ndirectories = ['C:\\\\', 'D:\\\\', 'E:\\\\']\nresults = parallel_scan_subprocess(directories)","type":"text"}]},{"type":"paragraph","content":[{"text":"Option 3: Multi-Platform Agent Team (Advanced)","type":"text","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"text":"For Agent-capable systems (Claude Code, Cursor with Agent support):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# Create agent team for massive parallelism\ndef create_agent_team_scan(top_level_paths):\n \"\"\"\n Create a team of sub-agents, each handling a portion of the work\n \"\"\"\n team_config = {\n \"name\": \"disk-cleaner-team\",\n \"members\": [\n {\n \"name\": \"scanner-1\",\n \"task\": f\"Scan {top_level_paths[0]} using progressive mode\",\n \"tool_use\": \"subprocess\"\n },\n {\n \"name\": \"scanner-2\",\n \"task\": f\"Scan {top_level_paths[1]} using progressive mode\",\n \"tool_use\": \"subprocess\"\n },\n {\n \"name\": \"scanner-3\",\n \"task\": f\"Scan {top_level_paths[2]} using progressive mode\",\n \"tool_use\": \"subprocess\"\n }\n ],\n \"coordination\": \"parallel\", # All run at once\n \"aggregation\": \"merge_results\" # Combine results at end\n }\n \n return launch_agent_team(team_config)","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"Performance Comparison","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Scenario","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Single Agent","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"3 Sub-Agents","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Speedup","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"3 disks (1TB each)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"~15 minutes","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"~5 minutes","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"3x","type":"text","marks":[{"type":"strong"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"10 user profiles","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"~20 minutes","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"~4 minutes","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"5x","type":"text","marks":[{"type":"strong"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"1M files","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"~30 minutes","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"~6 minutes","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"5x","type":"text","marks":[{"type":"strong"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Cache cleanup (26 locations)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"~8 minutes","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"~2 minutes","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"4x","type":"text","marks":[{"type":"strong"}]}]}]}]}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"Recommended Agent Count","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Small job","type":"text","marks":[{"type":"strong"}]},{"text":" (\u003c50K files): 1 agent (not worth overhead)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Medium job","type":"text","marks":[{"type":"strong"}]},{"text":" (50K-500K files): 2-3 agents","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Large job","type":"text","marks":[{"type":"strong"}]},{"text":" (500K-2M files): 3-5 agents","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Massive job","type":"text","marks":[{"type":"strong"}]},{"text":" (>2M files): 5-8 agents","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Sweet spot: 3-4 agents","type":"text","marks":[{"type":"strong"}]},{"text":" (best balance of speed vs overhead)","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"Best Practices","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Divide work logically","type":"text","marks":[{"type":"strong"}]},{"text":": By disk, by user profile, by directory type","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use consistent parameters","type":"text","marks":[{"type":"strong"}]},{"text":": All agents use same scan limits","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Merge results carefully","type":"text","marks":[{"type":"strong"}]},{"text":": Deduplicate, sort, format","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Handle failures gracefully","type":"text","marks":[{"type":"strong"}]},{"text":": If one agent fails, continue others","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Monitor progress","type":"text","marks":[{"type":"strong"}]},{"text":": Track which agents completed","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"⚠️ ","type":"text"},{"text":"IMPORTANT","type":"text","marks":[{"type":"strong"}]},{"text":": Not all AI IDEs support sub-agents. Fall back to parallel subprocess if unavailable.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"📚 Documentation (Essential Files Only)","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"SKILL.md - This complete guide (READ THIS FIRST)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"README.md - Project overview and quick start","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"README_zh.md - Chinese documentation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"CHANGELOG.md - Version history and changes","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"AGENT_QUICK_REF.txt - One-page reference for agents","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"INSTALL.md - Detailed installation guide","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"NO_PYTHON_GUIDE.md - Help for users without Python","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"references/temp_locations.md - Platform-specific cache locations","type":"text"}]}]}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"🎯 AGENT CHECKLIST (Must Follow)","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"For ANY Disk Analysis Request:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"[ ] STEP 1: Check Python availability\n[ ] STEP 2: Find skill package (auto-detects 20+ locations)\n[ ] STEP 3: Run diagnostics: python scripts/check_skill.py\n[ ] STEP 4: Run quick sample: --sample (MANDATORY - do this FIRST)\n[ ] STEP 5: Choose scan mode based on estimate\n[ ] STEP 6: Inform user of expected time\n[ ] STEP 7: Execute scan with appropriate limits\n[ ] STEP 8: Show results and offer next steps","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"For ANY Clean Request:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"[ ] STEP 1-3: Same as above\n[ ] STEP 4: ALWAYS use --dry-run first (MANDATORY)\n[ ] STEP 5: Show preview results\n[ ] STEP 6: Ask user confirmation before --force\n[ ] STEP 7: Execute actual cleaning if confirmed","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"⚡ PROGRESSIVE SCANNING (CRITICAL FOR LARGE DISKS)","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"🚨 CRITICAL INFORMATION (Read First)","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Universal Compatibility","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Works with ALL AI IDEs","type":"text","marks":[{"type":"strong"}]},{"text":": Cursor, Windsurf, Continue, Aider, Claude Code, etc.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Platform Independent","type":"text","marks":[{"type":"strong"}]},{"text":": Windows, macOS, Linux","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Installation Agnostic","type":"text","marks":[{"type":"strong"}]},{"text":": Works at global, project, or user level","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Self-Contained","type":"text","marks":[{"type":"strong"}]},{"text":": No external dependencies, just Python 3.7+","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"The Only Requirement","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"import subprocess\nresult = subprocess.run(['python', '--version'], capture_output=True, text=True)\n# If this succeeds, you can use this skill","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"⚡ PROGRESSIVE SCANNING (CRITICAL FOR LARGE DISKS)","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"🚨 AGENT MUST USE FOR LARGE DISKS (>100GB)","type":"text"}]},{"type":"paragraph","content":[{"text":"Problem","type":"text","marks":[{"type":"strong"}]},{"text":": Full disk scan on large disks (500GB+) can take HOURS. Users will lose patience.","type":"text"}]},{"type":"paragraph","content":[{"text":"Solution","type":"text","marks":[{"type":"strong"}]},{"text":": Use progressive scanning - get results in seconds, not hours!","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"📋 Three Scanning Modes","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"Mode 1: Quick Sample (⚡ FASTEST - 1 Second)","type":"text"}]},{"type":"paragraph","content":[{"text":"When to use","type":"text","marks":[{"type":"strong"}]},{"text":": Get instant estimate of directory size and scan time","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"python scripts/analyze_disk.py --sample\n# OR\npython scripts/analyze_progressive.py --sample","type":"text"}]},{"type":"paragraph","content":[{"text":"Output","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"sample_file_count\": 7591,\n \"sample_size_gb\": 17.62,\n \"files_per_second\": 7501.0,\n \"estimated_time_seconds\": 2.0\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Agent Decision Logic","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# ALWAYS run quick sample first for unknown disk sizes\nresult = subprocess.run(\n ['python', 'scripts/analyze_disk.py', '--sample', '--json'],\n capture_output=True,\n text=True,\n timeout=10,\n cwd=skill_path\n)\n\nimport json\nsample = json.loads(result.stdout)\nestimated_time = sample.get('estimated_time_seconds', 0)\n\n# Choose next action based on estimate\nif estimated_time \u003c 30:\n mode = 'full' # Full scan is fine\nelif estimated_time \u003c 120:\n mode = 'time_limited' # Use time limit\nelse:\n mode = 'progressive' # MUST use progressive mode","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"Mode 2: Progressive Scan (🎯 RECOMMENDED FOR LARGE DISKS)","type":"text"}]},{"type":"paragraph","content":[{"text":"When to use","type":"text","marks":[{"type":"strong"}]},{"text":": Get partial results in 30 seconds for large disks","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"python scripts/analyze_progressive.py --max-seconds 30","type":"text"}]},{"type":"paragraph","content":[{"text":"Features","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ Real-time progress updates every 2 seconds","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ Shows partial results as they're discovered","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ Can interrupt with Ctrl+C and keep results","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ Smart file count limit (50,000 by default)","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Agent Usage","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"def analyze_large_disk_safely(path, max_seconds=30):\n \"\"\"Safely analyze large disk with time limit\"\"\"\n result = subprocess.run(\n ['python', 'scripts/analyze_progressive.py',\n '--max-seconds', str(max_seconds),\n '--path', str(path)],\n capture_output=True,\n text=True,\n timeout=max_seconds + 10,\n cwd=skill_path\n )\n return result.stdout","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"Mode 3: Limited Scan (📊 FAST RESULTS)","type":"text"}]},{"type":"paragraph","content":[{"text":"When to use","type":"text","marks":[{"type":"strong"}]},{"text":": Get results quickly with file/time limits","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Limit by file count (fast)\npython scripts/analyze_disk.py --file-limit 10000\n\n# Limit by time (safe)\npython scripts/analyze_disk.py --time-limit 30\n\n# Both limits (very fast)\npython scripts/analyze_disk.py --file-limit 10000 --time-limit 30","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"🎯 AGENT DECISION TREE (CRITICAL - FOLLOW THIS)","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"USER REQUEST: \"Analyze my disk\"\n ↓\n┌─────────────────────────────────────────┐\n│ STEP 1: Quick Sample (MANDATORY) │\n│ python scripts/analyze_disk.py --sample │\n└─────────────────────────────────────────┘\n ↓\n Get estimated_time from sample\n ↓\n ├─ estimated_time \u003c 30 seconds\n │ ↓\n │ ✅ Use FULL SCAN\n │ python scripts/analyze_disk.py\n │\n ├─ estimated_time 30-120 seconds\n │ ↓\n │ ⚠️ Use TIME LIMIT\n │ python scripts/analyze_disk.py --time-limit 60\n │ Tell user: \"This will take ~X minutes\"\n │\n └─ estimated_time > 120 seconds\n ↓\n 🚨 MUST USE PROGRESSIVE MODE\n python scripts/analyze_progressive.py --max-seconds 30\n Tell user: \"Large disk detected - using progressive scan (30 seconds)\"","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"📝 Required Response Templates","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"When Quick Sample Shows \u003c 30 Seconds","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"✅ Disk analysis will take approximately 2 seconds\nStarting full scan...","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"When Quick Sample Shows 30-120 Seconds","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"⚠️ Disk analysis will take approximately 3 minutes\nUsing time-limited scan for faster results...","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"When Quick Sample Shows > 120 Seconds","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"🚨 Large disk detected! Full scan would take approximately 5 minutes\nUsing progressive scan mode to get results in 30 seconds...\n(This gives you partial results quickly - you can always do a full scan later)","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"💡 COPY-PASTE CODE (USE THIS)","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"import subprocess\nimport json\nfrom pathlib import Path\n\ndef smart_disk_analysis(disk_path, python_cmd='python'):\n \"\"\"\n SMART disk analysis - automatically chooses best method\n\n THIS IS THE RECOMMENDED WAY for all agents\n \"\"\"\n # Find skill package\n skill_path = find_skill_package() # Use your find function\n if not skill_path:\n return False, \"Skill package not found\"\n\n # STEP 1: Quick sample (MANDATORY - do this first!)\n print(\"🔍 Quick sampling disk...\")\n sample_result = subprocess.run(\n [python_cmd, 'scripts/analyze_disk.py', '--sample',\n '--path', str(disk_path), '--json'],\n capture_output=True,\n text=True,\n timeout=10,\n cwd=str(skill_path)\n )\n\n if sample_result.returncode != 0:\n return False, \"Sample failed\"\n\n try:\n sample = json.loads(sample_result.stdout)\n estimated_time = sample.get('estimated_time_seconds', 0)\n except:\n estimated_time = 0\n\n print(f\" Estimated scan time: {estimated_time:.0f} seconds\")\n\n # STEP 2: Choose scanning method based on estimate\n if estimated_time \u003c 30:\n # Small disk - full scan\n print(\"✅ Using full scan (small disk)\")\n result = subprocess.run(\n [python_cmd, 'scripts/analyze_disk.py',\n '--path', str(disk_path)],\n capture_output=True,\n text=True,\n timeout=60,\n cwd=str(skill_path)\n )\n\n elif estimated_time \u003c 120:\n # Medium disk - time limited\n minutes = estimated_time / 60\n print(f\"⚠️ Using time-limited scan (~{minutes:.1f} minutes)\")\n result = subprocess.run(\n [python_cmd, 'scripts/analyze_disk.py',\n '--path', str(disk_path),\n '--time-limit', '60'], # 1 minute max\n capture_output=True,\n text=True,\n timeout=70,\n cwd=str(skill_path)\n )\n\n else:\n # Large disk - PROGRESSIVE MODE (MANDATORY)\n print(f\"🚨 Large disk detected! Using progressive scan (30 seconds)\")\n result = subprocess.run(\n [python_cmd, 'scripts/analyze_progressive.py',\n '--path', str(disk_path),\n '--max-seconds', '30',\n '--json'],\n capture_output=True,\n text=True,\n timeout=40,\n cwd=str(skill_path)\n )\n\n if result.returncode != 0:\n return False, result.stderr\n\n print(result.stdout)\n return True, result.stdout\n\n# USAGE - Just call this function:\nsuccess, output = smart_disk_analysis(\"C:\\\\\")\nsuccess, output = smart_disk_analysis(\"/home/user\")\nsuccess, output = smart_disk_analysis(\"D:\\\\Projects\")","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"⚠️ COMMON MISTAKES TO AVOID","type":"text"}]},{"type":"paragraph","content":[{"text":"❌ ","type":"text"},{"text":"DON'T","type":"text","marks":[{"type":"strong"}]},{"text":": Always run full scan without checking disk size first ✅ ","type":"text"},{"text":"DO","type":"text","marks":[{"type":"strong"}]},{"text":": Always run ","type":"text"},{"text":"--sample","type":"text","marks":[{"type":"code_inline"}]},{"text":" first to estimate","type":"text"}]},{"type":"paragraph","content":[{"text":"❌ ","type":"text"},{"text":"DON'T","type":"text","marks":[{"type":"strong"}]},{"text":": Let users wait hours for large disk scan ✅ ","type":"text"},{"text":"DO","type":"text","marks":[{"type":"strong"}]},{"text":": Use ","type":"text"},{"text":"--max-seconds 30","type":"text","marks":[{"type":"code_inline"}]},{"text":" for large disks","type":"text"}]},{"type":"paragraph","content":[{"text":"❌ ","type":"text"},{"text":"DON'T","type":"text","marks":[{"type":"strong"}]},{"text":": Ignore estimated time from sample ✅ ","type":"text"},{"text":"DO","type":"text","marks":[{"type":"strong"}]},{"text":": Use estimate to choose appropriate scan mode","type":"text"}]},{"type":"paragraph","content":[{"text":"❌ ","type":"text"},{"text":"DON'T","type":"text","marks":[{"type":"strong"}]},{"text":": Run analyze_disk.py on 1TB disk without limits ✅ ","type":"text"},{"text":"DO","type":"text","marks":[{"type":"strong"}]},{"text":": Use analyze_progressive.py with --max-seconds","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"📊 Command Reference Card","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Situation","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Command","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Time","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Result","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Unknown size","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--sample","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"1s","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Estimate + recommendation","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\u003c 30 seconds","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"analyze_disk.py","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\u003c30s","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Full results","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"30-120 seconds","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"--time-limit 60","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"60s","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Most results","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"> 120 seconds","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"analyze_progressive.py --max-seconds 30","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"30s","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Partial results","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Very large disk","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"analyze_progressive.py --max-seconds 60","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"60s","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"More results","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"🔍 How Progressive Scan Works","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Quick Sample (1 second)","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Scans as many files as possible in 1 second","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Calculates scan rate (files/second)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Estimates total scan time","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Gives immediate feedback","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Progressive Scan (N seconds)","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Scans continuously for N seconds","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Shows progress every 2 seconds","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Collects results as it goes","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Returns whatever it found when time is up","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User can interrupt and keep partial results","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Smart Stopping","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Stops automatically when time/file limit reached","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Graceful handling of interruption","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Partial results are still useful","type":"text"}]}]}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"🎯 BEST PRACTICE FOR AGENTS","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"ALWAYS","type":"text","marks":[{"type":"strong"}]},{"text":" run ","type":"text"},{"text":"--sample","type":"text","marks":[{"type":"code_inline"}]},{"text":" first","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"ALWAYS","type":"text","marks":[{"type":"strong"}]},{"text":" check estimated_time before choosing mode","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"ALWAYS","type":"text","marks":[{"type":"strong"}]},{"text":" inform user about expected scan time","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"ALWAYS","type":"text","marks":[{"type":"strong"}]},{"text":" use progressive mode for large disks (>2 minutes)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"NEVER","type":"text","marks":[{"type":"strong"}]},{"text":" let users wait more than 2 minutes without feedback","type":"text"}]}]}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"🎯 UNIVERSAL AGENT WORKFLOW","type":"text"}]},{"type":"paragraph","content":[{"text":"This workflow works on ANY platform, in ANY AI IDE, at ANY location.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"STEP 1: Verify Python","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"import subprocess\nimport sys\n\ndef verify_python():\n \"\"\"Check if Python 3.7+ is available - PLATFORM AGNOSTIC\"\"\"\n try:\n # Try 'python' first (Windows, some Unix)\n result = subprocess.run(\n ['python', '--version'],\n capture_output=True,\n text=True,\n timeout=5\n )\n if result.returncode == 0:\n return True, result.stderr.strip() or result.stdout.strip()\n except FileNotFoundError:\n pass\n\n try:\n # Try 'python3' (macOS, Linux)\n result = subprocess.run(\n ['python3', '--version'],\n capture_output=True,\n text=True,\n timeout=5\n )\n if result.returncode == 0:\n return True, result.stderr.strip() or result.stdout.strip()\n except FileNotFoundError:\n pass\n\n return False, \"Python not found\"\n\n# EXECUTE\npython_available, version_info = verify_python()\nif not python_available:\n print(\"❌ Python 3.7+ required but not found\")\n print(\"Install from: https://www.python.org/downloads/\")\n print(\"See: NO_PYTHON_GUIDE.md for platform-specific instructions\")\n sys.exit(1)\n\nprint(f\"✅ Python available: {version_info}\")","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"STEP 2: Locate Skill Package","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"from pathlib import Path\nimport os\n\ndef find_skill_package():\n \"\"\"\n Find disk-cleaner skill package - LOCATION INDEPENDENT\n\n Searches in order of priority:\n 1. Current working directory\n 2. Project-level: ./skills/, ./.skills/, ./agent-skills/\n 3. User-level: ~/.skills/, ~/.agent-skills/, ~/skill-packages/\n 4. Common AI IDE locations\n 5. Parent directories\n \"\"\"\n\n # Get python command (python or python3)\n python_cmd = 'python' if os.name == 'nt' else 'python3'\n\n # Search locations - PLATFORM & IDE AGNOSTIC\n search_locations = []\n\n # 1. Current directory\n cwd = Path.cwd()\n search_locations.extend([\n cwd / 'disk-cleaner',\n cwd / 'skills' / 'disk-cleaner',\n cwd / '.skills' / 'disk-cleaner',\n cwd / 'agent-skills' / 'disk-cleaner',\n cwd / '.agent-skills' / 'disk-cleaner',\n ])\n\n # 2. Parent directories (project root)\n for parent in [cwd, *cwd.parents]:\n search_locations.extend([\n parent / 'skills' / 'disk-cleaner',\n parent / '.skills' / 'disk-cleaner',\n parent / 'agent-skills' / 'disk-cleaner',\n ])\n # Limit search depth\n if len(parent.parts) \u003c= 3:\n break\n\n # 3. User home directory\n home = Path.home()\n search_locations.extend([\n home / 'skills' / 'disk-cleaner',\n home / '.skills' / 'disk-cleaner',\n home / 'agent-skills' / 'disk-cleaner',\n home / '.agent-skills' / 'disk-cleaner',\n home / 'skill-packages' / 'disk-cleaner',\n ])\n\n # 4. Platform-specific user directories\n if os.name == 'nt': # Windows\n appdata = os.environ.get('APPDATA', '')\n if appdata:\n search_locations.append(Path(appdata) / 'skills' / 'disk-cleaner')\n localappdata = os.environ.get('LOCALAPPDATA', '')\n if localappdata:\n search_locations.append(Path(localappdata) / 'skills' / 'disk-cleaner')\n else: # Unix-like (macOS, Linux)\n search_locations.extend([\n home / '.local' / 'share' / 'skills' / 'disk-cleaner',\n home / '.config' / 'skills' / 'disk-cleaner',\n Path('/usr/local/share/skills/disk-cleaner'),\n ])\n\n # 5. AI IDE specific directories (IDE-AGNOSTIC)\n # Note: These are examples - actual locations vary\n ide_specific = [\n # Cursor\n home / '.cursor' / 'skills' / 'disk-cleaner',\n home / '.cursor' / 'user' / 'skills' / 'disk-cleaner',\n # Windsurf\n home / '.windsurf' / 'skills' / 'disk-cleaner',\n # Continue\n home / '.continue' / 'skills' / 'disk-cleaner',\n # Generic\n home / '.ai-ide' / 'skills' / 'disk-cleaner',\n ]\n search_locations.extend(ide_specific)\n\n # 6. sys.path entries (Python module style)\n for path_entry in sys.path:\n if path_entry and path_entry not in ['', '.']:\n test_path = Path(path_entry) / 'disk-cleaner'\n search_locations.append(test_path)\n\n # Remove duplicates and non-existent\n search_locations = list(set(search_locations))\n\n # Search for valid skill package\n for location in search_locations:\n if not location:\n continue\n try:\n # Check for key indicator files\n if (location / 'scripts' / 'analyze_disk.py').exists():\n return location, f\"Found at: {location}\"\n if (location / 'SKILL.md').exists():\n return location, f\"Found at: {location}\"\n except PermissionError:\n continue\n except Exception:\n continue\n\n # Not found - provide helpful message\n print(\"❌ Skill package not found\")\n print(\"\\nSearched locations:\")\n for loc in search_locations[:10]: # Show first 10\n print(f\" - {loc}\")\n print(\"\\nSolutions:\")\n print(\"1. Extract skill package to one of the locations above\")\n print(\"2. Or set environment variable: DISK_CLEANER_SKILL_PATH\")\n print(\"3. Or provide explicit path when calling functions\")\n return None, \"Not found\"\n\n# EXECUTE\nskill_path, message = find_skill_package()\nif not skill_path:\n print(message)\n sys.exit(1)\n\nprint(f\"✅ {message}\")","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"STEP 3: Verify Skill Package","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"def verify_skill_package(skill_path, python_cmd='python'):\n \"\"\"Verify skill package integrity - LOCATION INDEPENDENT\"\"\"\n check_script = skill_path / 'scripts' / 'check_skill.py'\n\n if not check_script.exists():\n print(f\"❌ Check script not found: {check_script}\")\n return False\n\n try:\n result = subprocess.run(\n [python_cmd, str(check_script)],\n capture_output=True,\n text=True,\n timeout=30,\n cwd=str(skill_path)\n )\n\n # Show verification output\n if result.stdout:\n print(result.stdout)\n\n if result.returncode == 0:\n print(\"✅ Skill package verified successfully\")\n return True\n else:\n print(\"❌ Skill package verification failed\")\n if result.stderr:\n print(result.stderr)\n return False\n\n except subprocess.TimeoutExpired:\n print(\"❌ Verification timed out\")\n return False\n except Exception as e:\n print(f\"❌ Verification error: {e}\")\n return False\n\n# Determine python command\npython_cmd = 'python' if os.name == 'nt' else 'python3'\n\n# EXECUTE\nif not verify_skill_package(skill_path, python_cmd):\n sys.exit(1)","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"STEP 4: Execute Operation","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"def execute_operation(skill_path, operation, python_cmd='python', **kwargs):\n \"\"\"\n Execute disk cleaner operation - PLATFORM & IDE AGNOSTIC\n\n Args:\n skill_path: Path to skill package\n operation: 'analyze', 'clean', 'monitor'\n python_cmd: 'python' or 'python3'\n **kwargs: Operation-specific arguments\n \"\"\"\n\n operation_map = {\n 'analyze': 'analyze_disk.py',\n 'clean': 'clean_disk.py',\n 'monitor': 'monitor_disk.py',\n }\n\n if operation not in operation_map:\n print(f\"❌ Unknown operation: {operation}\")\n print(f\"Valid operations: {list(operation_map.keys())}\")\n return False, None\n\n script = skill_path / 'scripts' / operation_map[operation]\n cmd = [python_cmd, str(script)]\n\n # Add operation-specific arguments\n if operation == 'analyze':\n if kwargs.get('path'):\n cmd.extend(['--path', str(kwargs['path'])])\n if kwargs.get('top'):\n cmd.extend(['--top', str(kwargs['top'])])\n if kwargs.get('json'):\n cmd.append('--json')\n\n elif operation == 'clean':\n # ALWAYS use dry-run for safety\n if not kwargs.get('force'):\n cmd.append('--dry-run')\n else:\n cmd.append('--force')\n\n if kwargs.get('temp'):\n cmd.append('--temp')\n if kwargs.get('cache'):\n cmd.append('--cache')\n if kwargs.get('logs'):\n cmd.append('--logs')\n\n elif operation == 'monitor':\n if kwargs.get('watch'):\n cmd.append('--watch')\n if kwargs.get('json'):\n cmd.append('--json')\n\n try:\n print(f\"🔧 Executing: {' '.join(cmd)}\")\n\n result = subprocess.run(\n cmd,\n capture_output=True,\n text=True,\n timeout=kwargs.get('timeout', 300),\n cwd=str(skill_path)\n )\n\n # Show output\n if result.stdout:\n print(result.stdout)\n\n if result.returncode != 0:\n if result.stderr:\n print(f\"❌ Error: {result.stderr}\")\n return False, None\n\n return True, result.stdout\n\n except subprocess.TimeoutExpired:\n print(\"⚠️ Operation timed out\")\n return False, None\n except Exception as e:\n print(f\"❌ Execution error: {e}\")\n return False, None\n\n# EXECUTE\nsuccess, output = execute_operation(\n skill_path,\n operation='analyze',\n python_cmd=python_cmd,\n path='C:\\\\Users' if os.name == 'nt' else '/home',\n json=True\n)\n\nif success:\n print(\"✅ Operation completed successfully\")","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"📋 QUICK REFERENCE (All IDEs)","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"⚠️ CRITICAL: Use Progressive Scanning for Large Disks!","type":"text"}]},{"type":"paragraph","content":[{"text":"BEFORE ANY DISK ANALYSIS","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Run ","type":"text"},{"text":"--sample","type":"text","marks":[{"type":"code_inline"}]},{"text":" first to estimate scan time","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"If > 2 minutes estimated, use progressive mode","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"NEVER let users wait more than 2 minutes without feedback","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Quick Reference","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# STEP 1: ALWAYS DO THIS FIRST (1 second)\npython scripts/analyze_disk.py --sample\n\n# STEP 2: Choose based on estimate\n# \u003c 30s: python scripts/analyze_disk.py\n# 30-120s: python scripts/analyze_disk.py --time-limit 60\n# > 120s: python scripts/analyze_progressive.py --max-seconds 30","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"User Intent → Operation Mapping","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"User Intent → Operation Mapping","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"User Says","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Operation","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Command Template","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"analyze disk\"","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"analyze","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"python scripts/analyze_disk.py","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"check disk space\"","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"analyze","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"python scripts/analyze_disk.py --top 50","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"quick scan\"","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"analyze","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"python scripts/analyze_disk.py --sample","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"large disk analysis\"","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"analyze","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"python scripts/analyze_progressive.py --max-seconds 30","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"clean temp files\"","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"clean","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"python scripts/clean_disk.py --temp --dry-run","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"preview cleanup\"","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"clean","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"python scripts/clean_disk.py --dry-run","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"monitor disk\"","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"monitor","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"python scripts/monitor_disk.py","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"disk usage\"","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"monitor","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"python scripts/monitor_disk.py --json","type":"text","marks":[{"type":"code_inline"}]}]}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Progressive Scanning (For Large Disks)","type":"text"}]},{"type":"paragraph","content":[{"text":"Problem","type":"text","marks":[{"type":"strong"}]},{"text":": Full disk scan can take hours on large disks (1TB+)","type":"text"}]},{"type":"paragraph","content":[{"text":"Solution","type":"text","marks":[{"type":"strong"}]},{"text":": Use progressive scanning with time/file limits","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# Quick sample (1 second) - Get instant estimate\nsubprocess.run(['python', 'scripts/analyze_disk.py', '--sample'])\n\n# Progressive scan (30 seconds) - Get partial results quickly\nsubprocess.run(['python', 'scripts/analyze_progressive.py',\n '--max-seconds', '30'])\n\n# Limited file count (fast)\nsubprocess.run(['python', 'scripts/analyze_disk.py',\n '--file-limit', '10000'])\n\n# Full scan with time limit\nsubprocess.run(['python', 'scripts/analyze_disk.py',\n '--time-limit', '120'])","type":"text"}]},{"type":"paragraph","content":[{"text":"Recommended workflow for large disks","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"First, run ","type":"text"},{"text":"--sample","type":"text","marks":[{"type":"code_inline"}]},{"text":" to get estimate (1 second)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"If estimate is too long, use ","type":"text"},{"text":"--max-seconds","type":"text","marks":[{"type":"code_inline"}]},{"text":" or ","type":"text"},{"text":"--file-limit","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Or use ","type":"text"},{"text":"analyze_progressive.py","type":"text","marks":[{"type":"code_inline"}]},{"text":" for real-time feedback","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Cross-Platform Python Commands","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Platform","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Python Command","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Check Command","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Windows","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"python","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"python --version","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"macOS","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"python3","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"python3 --version","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Linux","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"python3","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"python3 --version","type":"text","marks":[{"type":"code_inline"}]}]}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Universal Command Template","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# Works on ALL platforms\nimport os\nimport subprocess\n\npython_cmd = 'python' if os.name == 'nt' else 'python3'\nresult = subprocess.run([python_cmd, '--version'], capture_output=True, text=True)","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"🌐 Multi-IDE Compatibility","type":"text"}]},{"type":"paragraph","content":[{"text":"This skill package works with ALL AI IDEs that support:","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Supported AI IDEs","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Cursor","type":"text","marks":[{"type":"strong"}]},{"text":" - Works as project or user-level skill","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Windsurf","type":"text","marks":[{"type":"strong"}]},{"text":" - Works at any location","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Continue","type":"text","marks":[{"type":"strong"}]},{"text":" - Works as global or project skill","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Aider","type":"text","marks":[{"type":"strong"}]},{"text":" - Works as agent tool","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Claude Code","type":"text","marks":[{"type":"strong"}]},{"text":" - Works as skill","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ ","type":"text"},{"text":"Any AI IDE","type":"text","marks":[{"type":"strong"}]},{"text":" - Works via subprocess","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Installation by IDE Type","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"Project-Level Installation","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"your-project/\n├── skills/\n│ └── disk-cleaner/ ← Extract here\n├── src/\n└── README.md","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"User-Level Installation","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"~/.skills/disk-cleaner/ ← Unix-like\n~/agent-skills/disk-cleaner/ ← Alternative\nC:\\Users\\You\\skills\\disk-cleaner\\ ← Windows","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"Global Installation","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"/usr/local/share/skills/disk-cleaner/ ← Linux (system-wide)\nC:\\ProgramData\\skills\\disk-cleaner\\ ← Windows (system-wide)","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"🔧 IDE-Specific Notes","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Cursor","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# Cursor automatically searches for skills in:\n# - .cursor/skills/\n# - project/skills/\n# - ~/.skills/\n\n# No special configuration needed","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Windsurf","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# Windsurf supports skills at:\n# - .windsurf/skills/\n# - project/skills/\n\n# Skill works via subprocess, no special setup","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Continue","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# Continue configuration (if needed):\n# {\n# \"skills\": [\"./skills/disk-cleaner\"]\n# }\n# But auto-detection works in most cases","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Aider","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# Use as a tool via subprocess:\n# !python skills/disk-cleaner/scripts/analyze_disk.py","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Generic/Other IDEs","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# The skill includes intelligent auto-detection\n# Just extract and use - no configuration needed","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"🎯 Complete Copy-Paste Template","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"\"\"\"\nUniversal Disk Cleaner Skill Usage\nWorks with ALL AI IDEs, on ALL platforms, at ANY location\n\"\"\"\n\nimport subprocess\nimport sys\nimport os\nfrom pathlib import Path\n\n\ndef use_disk_cleaner(operation='analyze', **kwargs):\n \"\"\"\n Use disk cleaner skill - UNIVERSAL FUNCTION\n\n Works on:\n - All platforms (Windows, macOS, Linux)\n - All AI IDEs (Cursor, Windsurf, Continue, etc.)\n - All installation levels (global, project, user)\n\n Args:\n operation: 'analyze', 'clean', 'monitor'\n **kwargs: Operation-specific arguments\n\n Returns:\n (success: bool, output: str)\n \"\"\"\n\n # 1. Determine Python command\n python_cmd = 'python' if os.name == 'nt' else 'python3'\n\n # 2. Verify Python\n try:\n result = subprocess.run(\n [python_cmd, '--version'],\n capture_output=True,\n text=True,\n timeout=5\n )\n if result.returncode != 0:\n print(\"❌ Python not found\")\n return False, \"Python 3.7+ required\"\n except Exception as e:\n print(f\"❌ Python check failed: {e}\")\n return False, str(e)\n\n # 3. Find skill package (intelligent search)\n def find_skill():\n search_paths = [\n # Current directory\n Path.cwd() / 'disk-cleaner',\n Path.cwd() / 'skills' / 'disk-cleaner',\n Path.cwd() / '.skills' / 'disk-cleaner',\n # Project root\n *[(p / 'skills' / 'disk-cleaner') for p in [Path.cwd(), *Path.cwd().parents][:3]],\n # User home\n Path.home() / 'skills' / 'disk-cleaner',\n Path.home() / '.skills' / 'disk-cleaner',\n ]\n\n for path in search_paths:\n if (path / 'scripts' / 'analyze_disk.py').exists():\n return path\n return None\n\n skill_path = find_skill()\n if not skill_path:\n print(\"❌ Skill package not found\")\n print(\"Extract to: skills/disk-cleaner/ or ~/.skills/disk-cleaner/\")\n return False, \"Skill package not found\"\n\n # 4. Execute operation\n scripts = {\n 'analyze': 'analyze_disk.py',\n 'clean': 'clean_disk.py',\n 'monitor': 'monitor_disk.py',\n }\n\n if operation not in scripts:\n return False, f\"Unknown operation: {operation}\"\n\n script = skill_path / 'scripts' / scripts[operation]\n cmd = [python_cmd, str(script)]\n\n # Add arguments\n if operation == 'analyze':\n if kwargs.get('path'):\n cmd.extend(['--path', str(kwargs['path'])])\n elif operation == 'clean':\n cmd.append('--dry-run') # Always safe\n elif operation == 'monitor':\n if kwargs.get('json'):\n cmd.append('--json')\n\n # Run\n try:\n result = subprocess.run(\n cmd,\n capture_output=True,\n text=True,\n timeout=300,\n cwd=str(skill_path)\n )\n\n return result.returncode == 0, result.stdout\n\n except Exception as e:\n return False, str(e)\n\n\n# USAGE EXAMPLES:\n# success, output = use_disk_cleaner('analyze', path='.')\n# success, output = use_disk_cleaner('clean')\n# success, output = use_disk_cleaner('monitor', json=True)\n\nif __name__ == \"__main__\":\n # Quick test\n success, output = use_disk_cleaner('analyze')\n print(output)","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"⚡ PROGRESSIVE SCANNING CHECKLIST (CRITICAL)","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Agent MUST Follow This for All Disk Analysis Requests:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"[ ] Did you run --sample FIRST to estimate scan time?\n[ ] Did you inform user about expected scan time?\n[ ] Did you choose appropriate mode based on estimate?\n[ ] Did you use progressive mode for >2 minute estimates?\n[ ] Did you provide feedback during long scans?","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Required Behavior by Disk Size:","type":"text"}]},{"type":"paragraph","content":[{"text":"Small Disk (\u003c 30 seconds estimated)","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ Run full scan","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ No special handling needed","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Medium Disk (30-120 seconds estimated)","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ Use --time-limit","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ Inform user of expected time","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"⚠️ Consider progressive mode if user seems impatient","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Large Disk (> 120 seconds estimated)","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"🚨 MUST USE PROGRESSIVE MODE","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"🚨 MUST Inform user about time limit","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ Explain partial results","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"✅ Offer full scan as option","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"REQUIRED Code Pattern:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# THIS IS THE REQUIRED PATTERN for all disk analysis:\n\ndef safe_disk_analysis(disk_path):\n # Step 1: ALWAYS sample first\n sample = subprocess.run(\n ['python', 'scripts/analyze_disk.py', '--sample', '--json'],\n capture_output=True,\n text=True,\n cwd=skill_path\n )\n import json\n data = json.loads(sample.stdout)\n estimate = data.get('estimated_time_seconds', 0)\n\n # Step 2: Inform user\n if estimate > 120:\n print(f\"Large disk detected! Estimated: {estimate/60:.1f} minutes\")\n print(\"Using progressive scan (30 seconds) for quick results...\")\n\n # Step 3: Choose mode\n if estimate \u003c 30:\n # Full scan\n return subprocess.run(['python', 'scripts/analyze_disk.py'])\n elif estimate \u003c 120:\n # Time limited\n return subprocess.run(['python', 'scripts/analyze_disk.py', '--time-limit', '60'])\n else:\n # Progressive (MANDATORY for large disks)\n return subprocess.run(['python', 'scripts/analyze_progressive.py', '--max-seconds', '30'])","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"🚨 Error Handling (Universal)","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Error: Python not found","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# SOLUTION - Platform-independent guidance\nimport platform\n\nsystem = platform.system()\nif system == \"Windows\":\n print(\"Install from: https://www.python.org/downloads/\")\n print(\"Check 'Add Python to PATH' during installation\")\nelif system == \"Darwin\": # macOS\n print(\"Install: brew install [email protected]\")\n print(\"Or: https://www.python.org/downloads/macos/\")\nelse: # Linux\n print(\"Install: sudo apt install python3 # Debian/Ubuntu\")\n print(\"Or: sudo dnf install python3 # Fedora\")","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Error: Skill not found","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# SOLUTION - Show all searched locations\nprint(\"Skill package not found.\")\nprint(\"Extract to ONE of these locations:\")\nprint(\" - ./skills/disk-cleaner/\")\nprint(\" - ./disk-cleaner/\")\nprint(\" - ~/.skills/disk-cleaner/\")\nprint(\" - project/skills/disk-cleaner/\")\nprint(\"\\nOr set: DISK_CLEANER_SKILL_PATH=/path/to/skill\")","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Error: Permission denied","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# SOLUTION - Platform-specific advice\nif os.name == 'nt':\n print(\"Run as Administrator if needed\")\nelse:\n print(\"Some directories may require: sudo\")\n print(\"Or adjust: chmod +x scripts/*.py\")","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"📝 Environment Variables (Optional)","type":"text"}]},{"type":"paragraph","content":[{"text":"You can optionally set these to help with auto-detection:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Set skill package location (overrides auto-detection)\nexport DISK_CLEANER_SKILL_PATH=/path/to/skills/disk-cleaner\n\n# Set Python command (overrides auto-detection)\nexport DISK_CLEANER_PYTHON_CMD=python3\n\n# Enable debug output\nexport DISK_CLEANER_DEBUG=true","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"🎓 Best Practices for All Agents","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"ALWAYS check Python first","type":"text","marks":[{"type":"strong"}]},{"text":" - Don't assume it's installed","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use 'python3' on Unix","type":"text","marks":[{"type":"strong"}]},{"text":" - Use 'python' on Windows","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Search multiple locations","type":"text","marks":[{"type":"strong"}]},{"text":" - Don't assume single installation path","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use subprocess with timeout","type":"text","marks":[{"type":"strong"}]},{"text":" - Prevent hanging","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Capture both stdout and stderr","type":"text","marks":[{"type":"strong"}]},{"text":" - Complete error information","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Prefer --dry-run for clean","type":"text","marks":[{"type":"strong"}]},{"text":" - Safety first","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Handle all exceptions","type":"text","marks":[{"type":"strong"}]},{"text":" - Graceful degradation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Show helpful error messages","type":"text","marks":[{"type":"strong"}]},{"text":" - Guide users to solutions","type":"text"}]}]}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"🔍 Troubleshooting (Universal)","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Problem: Skill works in one IDE but not another","type":"text"}]},{"type":"paragraph","content":[{"text":"Solution","type":"text","marks":[{"type":"strong"}]},{"text":": The skill is IDE-agnostic. Check:","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Python is accessible from that IDE","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Skill package is in a searchable location","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"File permissions allow execution","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Problem: Different behavior on different platforms","type":"text"}]},{"type":"paragraph","content":[{"text":"Solution","type":"text","marks":[{"type":"strong"}]},{"text":": The skill handles platform differences. Check:","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Python command (","type":"text"},{"text":"python","type":"text","marks":[{"type":"code_inline"}]},{"text":" vs ","type":"text"},{"text":"python3","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Path separators (auto-handled by pathlib)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"File permissions (Unix may need ","type":"text"},{"text":"chmod +x","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Problem: Can't find skill package","type":"text"}]},{"type":"paragraph","content":[{"text":"Solution","type":"text","marks":[{"type":"strong"}]},{"text":": Run diagnostic:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"python skills/disk-cleaner/scripts/check_skill.py\n# Or\npython3 skills/disk-cleaner/scripts/check_skill.py","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"📦 Package Contents (Universal)","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"disk-cleaner/\n├── SKILL.md # This file\n├── AGENT_QUICK_REF.txt # Quick reference\n├── NO_PYTHON_GUIDE.md # Help for users without Python\n├── INSTALL.md # Installation guide\n├── FIXES.md # What's fixed in v2.0\n├── scripts/ # All scripts (universal)\n├── diskcleaner/ # Core modules (self-contained)\n└── references/ # Platform information","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"✅ Universal Checklist","type":"text"}]},{"type":"paragraph","content":[{"text":"Before using this skill in ANY AI IDE:","type":"text"}]},{"type":"checkbox_list","attrs":{"id":null},"content":[{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Python 3.7+ installed","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Skill package extracted to accessible location","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Can run: ","type":"text"},{"text":"python --version","type":"text","marks":[{"type":"code_inline"}]},{"text":" (or ","type":"text"},{"text":"python3 --version","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Skill package location known (or let it auto-detect)","type":"text"}]}]}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"paragraph","content":[{"text":"This skill package works EVERYWHERE - just Python 3.7+ required!","type":"text","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"text":"No IDE-specific configuration needed. No platform-specific setup. No installation level restrictions.","type":"text"}]},{"type":"paragraph","content":[{"text":"Just extract and use!","type":"text"}]}]},"metadata":{"date":"2026-11-02","name":"disk-cleaner","author":"@skillopedia","source":{"stars":48,"repo_name":"oh-my-disk-cleaner","origin_url":"https://github.com/open-agent-power/oh-my-disk-cleaner/blob/HEAD/skills/disk-cleaner/SKILL.md","repo_owner":"open-agent-power","body_sha256":"6d99aeb0dd60b4cc094bd74b6ada1afcd62895ca3d995b61d030567dd4ad017f","cluster_key":"4df807ee15a61bf2871bc69166fd415b337660201ff5ecd6ddf63188f3c19538","clean_bundle":{"format":"clean-skill-bundle-v1","source":"open-agent-power/oh-my-disk-cleaner/skills/disk-cleaner/SKILL.md","text_bytes":551687,"source_commit":"dcc6b15087b0349cb07dfa9d2bb8cc84557007e5","skills_sh_rank":14082,"attachment_count":50,"text_attachments":50,"attachment_storage":"skill_attachments","binary_attachments":0},"cluster_size":1,"skill_md_path":"skills/disk-cleaner/SKILL.md","import_metadata":{"date":"2026-11-02","author":"@skillopedia","version":"v1","category":"devops-infrastructure","category_label":"DevOps"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"devops-infrastructure","import_tag":"skills-sh-top20k-2026-11","description":"Cross-platform disk space management toolkit with intelligent optimization. REQUIREMENTS: Python 3.7+. UNIVERSAL COMPATIBILITY: Works with ALL AI IDEs (Cursor, Windsurf, Continue, Aider, Claude Code, etc.). PLATFORM-INDEPENDENT: Works at any location - global, project, or user level. SELF-CONTAINED: No pip install needed, includes intelligent bootstrap. KEY FEATURES: (1) PROGRESSIVE SCANNING: Quick sample (1s) + Progressive mode for large disks, (2) INTELLIGENT BOOTSTRAP: Auto-detection of skill location and auto-import of modules, (3) CROSS-PLATFORM ENCODING: Safe emoji/Unicode handling on all platforms, (4) DIAGNOSTIC TOOLS: check_skill.py for quick verification, (5) OPTIMIZED SCANNING: 3-5x faster with os.scandir(), concurrent scanning, intelligent sampling. AGENT WORKFLOW: (1) Check Python, (2) Find skill package (20+ locations auto-detected), (3) Run diagnostics, (4) Use progressive scanning for large disks. The skill package includes all optimization modules - no features are lost!"}},"renderedAt":1793666277416}

Disk Cleaner Skill - Complete Feature Guide for All Agents 🚨 IMPORTANT: Emoji Usage Policy For Script Output (Cross-Platform Safety) - NEVER use emoji in script output - All scripts use ASCII-safe characters - Scripts use: , , , , , , , , - This ensures compatibility with Windows GBK and other non-UTF-8 consoles - DO NOT modify script output to add emoji - This will break cross-platform compatibility For Agent-to-Human Communication (Recommended) - SHOULD use emoji when reporting results to humans - Makes output more readable - Use these emoji in your final reports to users: - (Success) - Co…