SuperAPI AI Directory

c-drive-cleaner

Security & auditing

View repository

Updated 10-15 17:30

About this skill

AI software lifecycle (AF category)

When "cleanup not working" or AI software keeps eating the C drive, first run ./analyze.ps1 -Categories AF -OutputFormat json -RecordGrowth. AF uses a native scan to account for installation directories, Electron session data, runtime, models, extensions, indexes, state, and update remnants, and strictly splits them into four categories: safe caches, tool/manually managed items, must-keep items, and items to be researched.

  • The entire application directory is always only usage evidence, not equal to a cleanable quota; only extensions/ai-footprints.json components precisely declared in it can enter the cleanup candidates.
  • scanner_metadata.AF.discovery_candidates is the real-machine learning queue. Large but unclassified subdirectories can only enter review, and can only be promoted to cleanup rules after source verification and rescan testing.
  • ./cleaners/clean-ai-footprints.ps1 previews by default; append -ReallyDelete to execute, and fail closed for active processes, C drive boundaries, and reparse points.
  • ./migrators/plan-ai-footprints.ps1 generates a read-only migration plan from the latest AF report. Official environment variables/CLI first, installer/system settings second, junction last; migration and cache quotas may overlap and cannot be added together.
  • For the detailed closed loop, promotion gates, and upstream basis, see references/ai-software-lifecycle.md。

Targeted optimization (O category)

Run .\analyze.ps1 -Categories "O" to scan known high-value targeted items:

  • Qoder: only clean SharedClientCache\index、SharedClientCache\cache、CachedData and other caches; keep User\workspaceStorage、User\History and User\globalStorage。
  • WorkBuddy: only match %LOCALAPPDATA%\Temp\workbuddy-update-* update remnants; close WorkBuddy before handling.
  • Codex: only handle .cache\codex-runtimes under codex-runtime-install-* and codex-primary-runtime.previous-*; keep the current codex-primary-runtime. Whisper models are listed separately as a cautious item.

Use .\cleaners\clean-targeted-optimization.ps1 -WhatIf to preview, and after confirmation append -ReallyDelete; the script will check related processes and block out-of-bounds paths.

TRAE CN and TRAE SOLO CN uniformly go through the AF lifecycle layer and are not repeatedly measured in the O category. The verified effective safe scope is CachedData, Electron/GPU/Dawn/Shader caches,logs and Crashpad\reports; must keep User、ModularData、WebStorage and Local Storage. Real verification only distills anonymized conclusions of "multiple GB reclaimable with no failed items", and does not submit device capacity, user paths, or software usage profiles.

If the target itself or any ancestor directory is a junction/symbolic link, the C drive scan must not count or clean along the link. It should be reported as partial; when the link target is on the D/E drive, deletion will only free space on the target drive.

Infrequently used software and C drive miscellaneous information

  • U category lists "candidates to be confirmed" by installation date, size, and evidence quality; quick mode only reuses uninstall registry sizes, while full mode only supplements size measurement for possibly related C drive installation directories, and does not traverse D/E drive software. It cannot reliably know the last used time, does not automatically uninstall, and does not recommend directly deleting installation directories.
  • MX category explains space outside cleanup rules: C drive first-level directories, root directory system files, first-level scattered files in user directories, extension distribution, and permission blind spots. MX is an information layer, results may overlap, and they cannot be added together as reclaimable space.
  • For detailed boundaries and decision criteria, see references/unused-and-misc.md。

Vendor-managed storage (MS class)

  • MS Identify large directories that are "indeed manageable, but should not be directly deleted by a general-purpose cleaner." Currently covers WPS cloud document local cache and ESP-IDF download archives.
  • For WPS, you must first confirm synchronization is complete, then use the client's "Free up space/Change location"; for ESP-IDF, preferentially run the current version idf_tools.py uninstall --dry-run --remove-archives, and always keep tools and python_env。
  • MS only produces cautionary items, with no direct cleaner. For detailed boundaries and official entrances, see references/vendor-managed-storage.md。

Actual usage and regeneration tracking

  • Run .\measure-space.ps1 -Paths "<精确路径>" to compare directory entry logical size, logical size after hard link deduplication, and NTFS allocated bytes; for slow full accounting, use the SA class.
  • Run .\track-growth.ps1 -Mode compare -Record to establish a hierarchical v2 baseline. Only aggregate mutually non-overlapping coverage roots;detail is only for attribution, and is not added together with the parent directory.
  • After targeted cleanup execution, read the SessionId given by the cleanup session, and run after 5 minutes, 1 hour, and 24 hours .\track-regeneration.ps1 -Mode check -SessionId <id>。
  • Run .\analyze.ps1 -Categories "WU" to check $WinREAgent, Windows Update downloads, Delivery Optimization, and pending restart signals.
  • In an administrator PowerShell, run .\analyze.ps1 -Categories "AD", read-only accounting for VSS, WinSxS, WindowsApps, Installer, DriverStore, and Reserved Storage; these results only enter inventory and are not counted as cleanable quota. For detailed boundaries, see references/admin-deep-accounting.md。
  • For detailed rules, see references/space-accounting-and-regeneration.md。

Four-piece iterative closed loop

This skill uses a four-layer Loop Engineering mechanism to solve the problem of "after scanning, the cleanup effect is not obvious, and space keeps growing but the source is unknown":

  • references/iteration-loop.md: overall loop—multi-source discovery → pooling plan → execution → verification → consolidation → next round.
  • references/project-pilot.md: project-level PDCA, a fixed 8-step state machine requiring evidence for each step.
  • references/concurrent-dispatcher.md: concurrency scheduling rules for independent scanning/preview, limiting concurrency, isolating output, and avoiding overlapping cleanup.
  • references/code-review-checklist.md: three-layer gatekeeping with pre-change contract, post-change self-check, and milestone external review.

For daily diagnosis, use:

.\iteration-loop.ps1 -Mode diagnose -RecordGrowth

By default it does not delete files; it only records a snapshot of the current C drive and key directories. The next run will show the increment and daily growth rate for each path; only when fast evidence is insufficient does it append -IncludeSlowScan。

CleanSight — AI Disk Health Advisor

I am not a cleanup tool, I am your AI disk health advisor.

传统工具 = 执行层:帮你删文件(但不懂你)
CleanSight = 决策层:理解你 → 分析数据 → 智能建议 → 教你安全执行

💰 Token cost estimate (important)

The core work of this skill is purely local: scanning (PowerShell), logic analysis, and report generation all run locally,does not consume Tokens。

AI conversation turns will consume Tokens (fees for the connected model), but this depends on how many questions you ask.

Scenario Estimated cost (DeepSeek Flash) Description
Run the cleanup script directly (no conversation) ¥0 Purely local, completely free
Let AI run a complete scan + report once ¥0.05-0.1 AI interprets the report and gives suggestions
Let AI guide cleanup execution + follow-up questions ¥0.1-0.3 Normal usage range
Debugging bugs + repeated fixes ¥1.0+ Abnormal situation, should not happen

💡 Money-saving tips: directly running .\cleaners\clean-safe.ps1 -ReallyDelete or .\cleaners\clean-apps.ps1 -RiskLevel safe is completely free.


🧠 Three Core Advantages (Why Use AI Instead of CCleaner)

Advantage Traditional Tools CleanSight
Context Awareness Fixed rules, one-size-fits-all Dynamic analysis based on your usage habits
Dynamic Risk Assessment Only says "can delete/cannot delete" Tells you why + alternatives + migration guidance
Knowledge Empowerment Done once deleted Teaches you the fundamental solution, once and for all

Differentiation Formula: 迁移 > 删除 > 忽略 — Traditional tools only delete; AI teaches you to migrate and preserve functionality while freeing up space.


🔧 Workflow

用户触发 "C盘快满了" / "帮我分析C盘"
  ↓
1. 执行类别只读扫描 + 路径级增长快照(scanners/)
  ↓
2. 生成 AI 决策报告(健康评分 + Tier 分级建议 + 增长证据)
  ↓
3. 先预览和规划,不把“可清理”误报成“已释放”
  ↓
4. 用户选择执行项 → 执行 → 重扫同一路径 → 记录实际释放量

One-Click Mode

.\analyze.ps1                                          # 控制台输出
.\analyze.ps1 -OutputFormat markdown                   # 生成 Markdown 报告
.\analyze.ps1 -OutputFormat json                       # JSON 格式
.\analyze.ps1 -Categories "C,D"                        # 只扫描开发缓存+浏览器
.\analyze.ps1 -Categories "AF" -RecordGrowth           # AI 软件全生命周期占用 + 增长基线
.\analyze.ps1 -Fast                                     # 快速证据集;GR 读取带时间戳快照,跳过 F/H/MX/AD/SA
.\analyze.ps1 -Categories "F,GR" -RecordGrowth          # 原生全盘扫描并建立同源增长基线
.\track-growth.ps1 -Mode compare -Record               # 无 F 结果时的 robocopy 兼容基线
.\measure-space.ps1 -Paths "%APPDATA%\Qoder"          # 核算逻辑大小与 NTFS 分配字节

Scan Category Quick Reference

Category Script Coverage Applicable
AF-AI Lifecycle scan-ai-footprints Install/runtime/models/extensions/indexes/state/update remnants Top choice for continuously growing AI software
A-System Hidden scan-system-hidden hiberfil/pagefile/restore points/WinSxS Just understand it
B-Temporary Cache scan-temp-files Temp/thumbnails/Recycle Bin/Update cache ✅ Daily top choice
C-Development Cache scan-dev-caches npm/pip/cargo/maven/gradle, etc. A must-see for developers
D-Browser scan-browsers Chrome/Edge/Firefox, etc. Everyone
E-Application Data scan-app-data IDE/media/office/AI tools Deep cleanup
MS-Vendor-Managed Storage scan-managed-storage WPS cloud cache, ESP-IDF download archive Only via vendor UI/CLI, do not delete directly
F-Large Files scan-large-files Native concurrent TOP 20 + user directory ranking + growth aggregation Quick location
G-Special Usage scan-special-sources Docker/WSL/game platforms Special needs
H-Security Software scan-security-software EDR/NAC/antivirus Understand only
I-Multiple Versions scan-multi-version Multiple version remnants Tidiness
J-Duplicate Runtimes scan-duplicate-runtimes Electron/CEF duplicates Advanced optimization
K-Input Methods scan-ime-data Dictionaries/logs Detail cleanup
L-Instant Messaging scan-im-apps WeChat/QQ/DingTalk cache Social applications
U-Unused Software Candidates scan-unused-software Uninstall registry, install time, size candidates Suggest confirmation only, do not auto-uninstall
MX-C Drive Miscellaneous Information scan-misc-space Root directory, first-level directories, scattered files, permission blind spots Explains space, does not equal deletable
WU-Windows Update Remnants scan-windows-update-residue WinRE/update downloads/pending restart/CBS logs Read-only, retain until update completes
AD-Administrator Deep Accounting scan-admin-deep-accounting VSS/WinSxS/WindowsApps/Installer/DriverStore/Reserved Storage Administrator read-only explanation layer
SA-NTFS Actual Usage scan-space-accounting Logical, hard link deduplication, allocated bytes Slow on-demand accounting

🛡️ Safety Principles

Risk Level

Mark Meaning Handling
✅ Pure temporary/cache, deletion has no side effects Can be executed directly
⚠️ Low-risk items requiring manual confirmation Execute after backup
❌ System core/enterprise management/user data Never touch
🔴 Suspicious/unknown, AI cannot determine Guide to judge independently

Safety Red Lines (never executed automatically)

  • ❌ Delete system restore points / disable hibernation / move page file
  • ❌ Clean WinSxS /ResetBase
  • ❌ Delete Program Files / user documents/desktop/downloads
  • ❌ Touch enterprise security software (EDR/NAC/antivirus)
  • ❌ vssadmin / diskpart operations

Safety Mechanisms

  1. Read-only by default: Scan scripts are read-only and do not write
  2. WhatIf mode: Cleanup scripts support -WhatIf preview
  3. Explicit confirmation: Dangerous operations require -ReallyDelete
  4. Administrator detection: Automatically check administrator privileges before cleanup (v6.1.2)
  5. Permanent deletion prompt: Before execution, display "Files will be permanently deleted, bypassing the Recycle Bin" (v6.1.2)
  6. Unified deletion gate: All official cleaners verify the allowed root directory, C drive boundary, protected roots, and any ancestor reparse points before deletion; refuse to execute when gate parameters are missing (v6.7.0)

📐 Architecture

c-drive-cleaner/
├── SKILL.md                    ← 你在这里
├── _common.ps1                 ← 公共模块(性能+统一接口)
├── analyze.ps1                 ← 一键入口(console/markdown/json)
│
├── scanners/   (类别只读扫描,含 AF/MS/GR/U/MX/WU/AD/SA)
├── cleaners/   (含 AF 精确组件清理;默认预览并统一走删除门禁)
├── migrators/  (含 AF 只读迁移规划以及 appdata/dev-caches/wsl-docker)
├── extensions/
│   ├── app-signatures.json     ← 100+ 应用签名(14类别)
│   ├── ai-footprints.json      ← AI 软件根、生命周期策略和精确组件规则
│   ├── managed-storage.json    ← 只能走厂商 UI/CLI 的本地缓存与下载归档
│   ├── user-custom.json        ← 用户自定义签名
│   └── scan-discover.ps1       ← 未知应用发现引擎
├── safety/     (备份+快照+回滚)
├── reports/    (生成的报告)
├── scheduled/  (定期自动化)
├── references/  (四件套迭代机制与审查门禁)
├── iteration-loop.ps1  (有界迭代入口,默认只诊断/预览)
├── track-growth.ps1    (路径级快照、增量与日增长率)
├── measure-space.ps1   (NTFS 分配字节与硬链接去重核算)
├── track-regeneration.ps1 (清理后 5m/1h/24h 再生检查)
├── tests/      (可公开的验证脚本与测试方法)
│   └── methodology/            ← 脱敏测试策略与验收标准
└── memory/     (v6.2 个性化系统 — 架构设计中)

Extensibility

Adding a new software signature requires only one line of JSON, with no code changes:

{ "name": "我的软件", "detect_paths": ["%LOCALAPPDATA%\\MyApp\\cache"], "cleanable": true, "risk_level": "safe" }

Edit extensions/user-custom.json Save to take effect.scan-discover.ps1 Can automatically discover unknown large folders.


🛠️ Cleanup Execution (v6.1.2 optimization)

Performance Comparison

Operation Before fix After fix (v6.1.2) Improvement
Delete large amounts of small file cache ❌ May hang for a long time ✅ Has timeout and fallback Significantly improved
Previous target fails ❌ Subsequent targets are not executed ✅ Handled independently and continues Eliminates single-point blocking
Batch cleanup of multiple items ❌ One failure drags down the whole round ✅ Itemized closure Predictable

Administrator Privileges

Automatically detect administrator privileges before executing cleanup, and give a clear prompt when not elevated.

Safety Notice

All cleanup ispermanent deletion (bypassing the Recycle Bin), and a red warning will be shown before execution.


📋 Report Naming Convention

Format Example Meaning
Markdown CleanSight-CS-20260513-143022-72.md Brand-Date-Time-Health Score
JSON CleanSight-CS-20260513-143022-72.json Same as above

Reports automatically include: Executive Summary → Scan Details → AI Decision Recommendations (Tier classification) → Usage Guide → Tool Recommendations


🔄 Maintenance Standards (AI Agent Skill Engineering Standards)

Version Management

  • Follow semantic versioning:MAJOR.MINOR.PATCH
  • All changes are recorded in CHANGELOG.md
  • app-signatures.json of _schema version number stays in sync with the major version

Update process

  1. Signature updates: Edit app-signatures.json or user-custom.json, no code changes needed
  2. Scanner updates: Modify scanners/ the corresponding script under
  3. Report format updates: Modify analyze.ps1 the report generation logic in
  4. Version release: Update SKILL.md version + analyze.ps1 $VERSION + CHANGELOG.md

Compatibility requirements

  • PowerShell 5.1+ (built into Windows)
  • Do not use PS7+-exclusive syntax (such as the ternary operator ?:)
  • Paths use environment variables ($env:LOCALAPPDATA , etc.)
  • Application detection prerequisite Test-Path(skip if it does not exist)

Test verification

# 验证扫描器正常
.\analyze.ps1 -Categories "B"    # 测试临时文件扫描
.\analyze.ps1 -OutputFormat json # 测试 JSON 输出

# 验证清理脚本
.\cleaners\clean-safe.ps1                      # WhatIf 预览
.\cleaners\clean-apps.ps1 -WhatIf -RiskLevel safe  # 预览可清理项

🔄 Cache migration notes

Before migrating, first run the corresponding scanner and use -WhatIf preview; only migrate data with clear boundaries, that can be rebuilt, or that has an official migration mechanism. Real paths, capacities, and application lists are stored only in local reports.

Operation Method Complexity Recommendation
Move npm/pip/yarn caches to the D drive One-line command (Skill automatic) 🟢 Low ✅ Strongly recommended
Move WeChat/Feishu caches No automation script, complex directory structure 🔴 High ❌ Not recommended
Move JetBrains configuration Configuration files and caches are mixed together 🔴 High ❌ Not recommended

v6.5.0 performance and accounting note

  • scan-large-files.ps1 uses 422 bounded NVMe-friendly partitions over a Win32 FindFirstFileExW engine. It keeps a bounded TOP-N set, merges cross-partition user totals, skips reparse targets, and reports inaccessible coverage.
  • The same F pass aggregates the configured growth paths. GR reuses those totals in a full run; -Fast reads the most recent source-tagged snapshot and states its age instead of rescanning parent and child trees.
  • Cleanup totals are built from exact measured paths with parent/child deduplication. Search-index burden and whole Electron/CEF application footprints are inventory only.
  • An anonymized read-only benchmark confirmed that F reuses its traversal for GR and that -Fast avoids redundant work; raw device counts and timings remain local.

v6.6.0 focused-fast and reparse safety note

  • J uses registry install roots plus extensions/runtime-inventory.json in -Fast; ordinary J keeps broad AppData discovery. Both modes must state their coverage, and both found the same 8 runtime roots in the release test.
  • Logical directory measurement now uses in-process Win32 enumeration with a robocopy compatibility fallback. Targeted paths are measured in a bounded four-way batch.
  • Any reparse point in the target's ancestry stops C-drive accounting and targeted cleanup. This prevents redirected Qoder data on D from being reported as C reclaim.
  • VM maps all drive letters through bulk CIM association queries. U reuses the registry inventory and avoids non-C fallback traversal.
  • An anonymized read-only benchmark confirmed that focused J is substantially cheaper than broad J while preserving the broad mode for deep inspection.

v6.7.0 global planning, cleanup guard, and admin accounting note

  • The analyzer resolves all selected signature and multi-version targets first, measures cache misses through one bounded native batch, and seeds the shared cache. Scanner code still owns interpretation; the planner only removes repeated filesystem walks.
  • Every maintained cleaner now passes through one fail-closed deletion gate. It rejects relative paths, drive/system/profile roots, targets outside caller-declared roots, non-C volumes, and any target whose ancestry contains a junction, symlink, or mount point.
  • clean-apps executes the exact measured sub_cleanable paths; a cache-only signature must never fall through to deleting the whole application-data root.
  • AD adds administrator-only, read-only accounting for VSS, WinSxS, WindowsApps, Installer, DriverStore, and Reserved Storage. Protected-store values remain inventory-only.
  • An anonymized read-only benchmark confirmed that planner prewarming removes repeated downstream logical measurements.

v7.0.0 AI software lifecycle and live-learning note

  • AF accounts for C-located logical AI footprints across installs, Electron profiles, runtimes, models, extensions, indexes, state and updater residue in one native pass. Whole roots stay inventory-only; only exact configured components enter cleanup totals.
  • The report exposes a non-destructive learning queue for large unclassified children. A discovery remains review until its semantics, safety and repeated measurements justify a config change.
  • The AF cleaner defaults to preview, blocks active applications and reparse ancestry, and writes before/after cleanup sessions. The migration planner is read-only and prefers official environment variables or vendor lifecycle commands.
  • Empty optional regex arrays are normalized explicitly so they can never match every installed package. The release test covers configuration structure, preservation invariants and this regression.
  • An anonymized discovery/classification round confirmed that AF separates safe cache, managed/confirm items, migration candidates, and remaining review hotspots without exposing raw device totals.

v7.1.0 unexplained-byte learning and broader AI coverage note

  • AF now reports only the unclassified remainder of a mixed-data child. Already classified nested cache/state paths are collapsed to a non-overlapping union before subtraction, so neither repeated parent reports nor parent/child double counting can distort the learning queue.
  • The lifecycle config adds DoubaoWork, ZCode, LobsterAI, CodeBuddy, Doubao, iChat and GitHub Copilot. Validation requires every legacy ai_tools signature path to overlap an AF root, preventing the lifecycle layer from silently falling behind the older signature catalog.
  • AF terminology now states its measurement basis precisely: logical file lengths physically located on C with reparse targets excluded. NTFS allocated bytes and real free-space changes remain cleanup-session/SA evidence.
  • An anonymized validation pass confirmed that configured groups, safe/managed/preserve boundaries, the unexplained-hotspot queue, and native enumeration all converged without deleting or migrating source data.

v7.2.0 vendor-managed storage and scan reuse note

  • MS separates vendor-managed storage from direct cleanup. WPS cloud cache must go through sync-aware WPS controls; ESP-IDF archive cleanup must go through its version-aware tool flow. Neither source has a direct cleaner.
  • An anonymized NTFS accounting pass confirmed that WPS cachedata stays vendor-managed and only ESP-IDF dist is surfaced for review, while tools and python_env remain preserved.
  • F now seeds exact aggregate measurements into the shared cache. MX batches only remaining root directories, avoiding a second full traversal.

CleanSight v7.3.0 — AI Disk Health Advisor Understand you · Analyze data · Intelligent suggestions · Empower execution

Virtual memory hardening rules (VM)

When running analyze.ps1 -Categories "VM" , prioritize reading the registry PagingFiles configuration, then use pagefile.sys the actual file size to assist judgment. When permissions are insufficient, it must be marked as "unable to read"; the page file must not be falsely reported as nonexistent.

  • First distinguish three things: freeing up C drive space, increasing system commit capacity, and gaining I/O performance benefits; migrating the page file usually guarantees only one of the first two, and cannot be assumed to improve speed.
  • The maximum configured page file value is not the current usage; space benefits are estimated based on the actual file size or a verifiable initial configuration.
  • For fixed drives such as C/D/E, compare available space, physical disk number, media type, and bus type one by one; the target drive must reserve a safety margin beyond the current maximum configured value.
  • When a "small page file on C drive + primary page file on a non-C drive" already exists, prioritize reporting it as a hybrid layout and do not repeatedly suggest large-scale migration.
  • The C drive page file may be related to crash dumps; before confirming dump requirements, it is not recommended to remove it or change it to 0.
  • Do not automatically modify the registry, system properties, or page file; any migration/size adjustment must first show WhatIf/preview, obtain explicit confirmation, and scan again for verification after restart.