SuperAPI AI Directory

c-drive-cleaner

Office & productivity

View repository

Updated 11-05 16:16

About this skill

AI Software Lifecycle (AF class)

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

  • The entire application directory is always only usage evidence, not equal to the cleanable quota; only components precisely declared in extensions/ai-footprints.json can enter the cleanup candidates.
  • scanner_metadata.AF.discovery_candidates is the on-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 defaults to preview; 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 class)

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

  • Qoder: only clean caches such as SharedClientCache\index、SharedClientCache\cache、CachedData ; keep User\workspaceStorage、User\History and User\globalStorage。
  • WorkBuddy: only match %LOCALAPPDATA%\Temp\workbuddy-update-* update leftovers; close WorkBuddy before processing.
  • Codex: only process .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 checks related processes and blocks out-of-bounds paths.

TRAE CN and TRAE SOLO CN uniformly go through the AF lifecycle layer and are not re-measured in the O class. 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 deposits anonymized conclusions of "multiple GB recoverable with no failure 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 only frees space on the target drive.

Infrequently used software and C drive miscellaneous information

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

Vendor-managed storage (MS category)

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

Actual usage and regrowth tracking

  • Run .\measure-space.ps1 -Paths "<精确路径>" to compare the logical size of directory entries, the logical size after hard-link deduplication, and NTFS allocated bytes; for slow full accounting use SA category.
  • Run .\track-growth.ps1 -Mode compare -Record to establish a hierarchical v2 baseline. Only aggregate non-overlapping coverage roots;detail only attributes, and is not added to parent directories.
  • After targeted cleanup execution, read the SessionId given by the cleanup session, and run at 5 minutes, 1 hour, and 24 hours later .\track-regeneration.ps1 -Mode check -SessionId <id>。
  • Run .\analyze.ps1 -Categories "WU" to check $WinREAgent, Windows Update downloads, Delivery Optimization, and pending reboot signals.
  • Run in an administrator PowerShell .\analyze.ps1 -Categories "AD", read-only accounting of 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 adopts a four-layer Loop Engineering mechanism to solve the problem of "cleanup effects being不明显 after scanning, and space continuously growing without knowing the source":

  • references/iteration-loop.md: Master loop — multi-source discovery → pool planning → execution → verification → consolidation → next round.
  • references/project-pilot.md: Project-level PDCA, with a fixed 8-step state machine and requiring evidence at each step.
  • references/concurrent-dispatcher.md: Concurrency scheduling rules for independent scan/preview, limiting concurrency, isolating output, and avoiding overlapping cleanup.
  • references/code-review-checklist.md: Three-layer gates: 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 snapshots 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 will it additionally run -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), analysis logic, and report generation all run locally,without consuming Tokens。

AI conversation turns will consume Tokens (fees of 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
Have the AI run a full scan + report ¥0.05-0.1 AI interprets the report and gives suggestions
Have the 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: Run directly .\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 Ends once deleted Teaches you the root solution, once and for all

Differentiation Formula: 迁移 > 删除 > 忽略 — Traditional tools only delete; AI teaches you to migrate while preserving functionality and 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 First 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 first choice
C-Developer 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 cleaning
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 cleaning
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 Suggestion and confirmation only, no automatic uninstall
MX-C Drive Miscellany scan-misc-space Root directory, first-level directories, scattered files, permission blind spots Explains space, does not mean deletable
WU-Windows Update Remnants scan-windows-update-residue WinRE/update downloads/pending reboot/CBS logs Read-only, keep 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 Levels

Marker 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-managed/user data Never touch
🔴 Suspicious/unknown, AI cannot determine Guide user 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 checks administrator privileges before cleanup (v6.1.2)
  5. Permanent deletion warning: Before execution, displays "Files will be permanently deleted, bypassing the Recycle Bin" (v6.1.2)
  6. Unified deletion gate: Before deletion, all formal cleaners verify the allowed root directories, C drive boundaries, protected roots, and any ancestor reparse points; execution is refused when gate parameters are absent (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 and save to take effect.scan-discover.ps1 can automatically discover unknown large folders.


🛠️ Cleanup Execution (v6.1.2 Optimized)

Performance Comparison

Operation Before Fix After Fix (v6.1.2) Improvement
Deleting large amounts of small file caches ❌ May hang for a long time ✅ Has timeout and fallback Significantly improved
Preceding target fails ❌ Subsequent targets are not executed ✅ Process independently and continue Eliminates single point of blocking
Batch cleanup of multiple items ❌ One failure drags down the whole round ✅ Per-item completion Predictable

Administrator Privileges

Automatically detects administrator privileges before executing cleanup, and gives a clear prompt when not elevated.

Safety Warning

All cleanups arepermanent deletions (bypassing the Recycle Bin), and a red warning is 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 synchronized with the major version

Update process

  1. Signature update: Edit app-signatures.json or user-custom.json, no code changes needed
  2. Scanner update: Modify the corresponding script under scanners/ the corresponding script
  3. Report format update: Modify the report generation logic in 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 first checks 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 to preview; only migrate data with clear boundaries that can be rebuilt or 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 drive D One command (automatic via Skill) 🟢 Low ✅ Strongly recommended
Move WeChat/Feishu caches No automation scripts, 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 · Smart suggestions · Empower execution

Virtual memory enhancement rules (VM)

When running analyze.ps1 -Categories "VM" , first read the registry PagingFiles configuration, then use the actual file size of pagefile.sys as a supplementary check. When permissions are insufficient, it must be marked as "cannot read"; the page file must not be falsely reported as nonexistent.

  • First distinguish three things: freeing C drive space, increasing system commit capacity, and gaining I/O performance benefits; migrating the page file usually only guarantees one of the first two, and does not speed things up by default.
  • The maximum configured page file value is not the current usage; space savings should be estimated based on the actual file size or a verifiable initial configuration.
  • Compare available space, physical disk number, media type, and bus type one by one for fixed drives such as C/D/E; the target drive must retain a safety margin beyond the current maximum configured value.
  • When a "small page file on C + primary page file on a non-C drive" already exists, report it as a hybrid layout first, and do not repeatedly suggest large-scale migration.
  • The page file on the C drive may be related to crash dumps; before confirming dump requirements, do not recommend removing it or setting 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 be verified by rescanning after a restart.