← Back to Skills Marketplace
bettermen

存储清理

by bettermen · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
41
Downloads
0
Stars
1
Active Installs
1
Versions
Install in OpenClaw
/install storage-clean
Description
AI-powered disk storage cleaner for Windows. Scan disk usage, generate interactive HTML report with 3-color grading (green/yellow/red), and safely clean junk...
README (SKILL.md)

storage-clean — AI Disk Storage Cleaner Skill

AI 磁盘存储清理工具技能 智能扫描磁盘占用,生成交互式 HTML 报告,三色分级安全清理。


概述

storage-clean 是一个 AI 驱动的磁盘存储清理工具,参考数字生命卡兹克的开源方案设计。支持:

  • 快速扫描磁盘占用(几分钟完成)
  • 生成交互式 HTML 报告(三色分级)
  • 安全清理(二次确认,支持移到废纸篓/直接删除)
  • 可被 aioom 调用(作为存储清理模块)

项目路径: C:\Users\PC\.workbuddy\skills\storage-clean\ 报告端口: 本地文件(直接用浏览器打开 HTML 文件)


三色分级规则

颜色 含义 操作
🟢 绿灯 纯缓存、临时文件、安装包残留,可放心清理 提供"移到废纸篓"和"直接删除"按钮
🟡 黄灯 需要用户确认(如下载视频、项目文件夹) 只提供"在资源管理器中打开"入口
🔴 红灯 重要文件(系统文件、正在使用的应用核心数据) 解释不能删除的原因,提供访问入口

调用方式

方式一:独立调用(推荐)

用户说"帮我看看存储"或"清理磁盘"时触发:

import subprocess, os, webbrowser
from pathlib import Path

SKILL_DIR = r"C:\Users\PC\.workbuddy\skills\storage-clean"
SCANNER_PY = os.path.join(SKILL_DIR, "scripts", "scanner.py")

def run_storage_clean():
    """运行存储清理,生成 HTML 报告并打开"""
    result = subprocess.run(
        ["python", SCANNER_PY],
        cwd=SKILL_DIR,
        capture_output=True,
        text=True
    )
    # 解析输出,获取生成的 HTML 报告路径
    output_lines = result.stdout.strip().split("\
")
    html_path = None
    for line in output_lines:
        if line.startswith("REPORT:"):
            html_path = line[7:].strip()
            break
    
    if html_path and os.path.exists(html_path):
        webbrowser.open(f"file://{html_path}")
        print(f"已打开存储清理报告:{html_path}")
    else:
        print("扫描失败,未生成报告")

方式二:被 aioom 调用

在 aioom 的 SKILL.md 中添加存储清理入口:

# 在 aioom 中调用 storage-clean
import subprocess, os

STORAGE_CLEAN_DIR = r"C:\Users\PC\.workbuddy\skills\storage-clean"
SCANNER_PY = os.path.join(STORAGE_CLEAN_DIR, "scripts", "scanner.py")

def aioom_storage_clean():
    """aioom 存储清理接口"""
    subprocess.Popen(
        ["python", SCANNER_PY],
        cwd=STORAGE_CLEAN_DIR,
        creationflags=subprocess.CREATE_NO_WINDOW
    )

扫描路径(Windows)

🟢 绿灯(可放心清理)

路径 说明 预估大小
%TEMP% / %TMP% 系统临时文件 可变
%LOCALAPPDATA%\Temp 用户临时文件 可变
C:\Windows\Temp Windows 临时文件夹 可变
Chrome 缓存 %LOCALAPPDATA%\Google\Chrome\User Data\Default\Cache 可变
Edge 缓存 %LOCALAPPDATA%\Microsoft\Edge\User Data\Default\Cache 可变
Firefox 缓存 %APPDATA%\Mozilla\Firefox\Profiles\*.default\cache2 可变
回收站 C:\$Recycle.Bin 可变
B站缓存 %LOCALAPPDATA%\bilibili\bloom-player\cache 可变
微信缓存 %APPDATA%\Tencent\WeChat\cache 可变
企业微信缓存 %APPDATA%\Tencent\WXWork\cache 可变
QQ 缓存 %APPDATA%\Tencent\QQ\cache 可变
钉钉缓存 %APPDATA%\DingTalk\cache 可变
飞书缓存 %LOCALAPPDATA%\Lark\cache 可变
Python pip 缓存 %LOCALAPPDATA%\pip\cache 可变
npm 缓存 `%APPDATA%\
pm-cache` 可变
yarn 缓存 %LOCALAPPDATA%\Yarn\cache 可变
VS Code 缓存 %APPDATA%\Code\Cache 可变
缩略图缓存 %LOCALAPPDATA%\Microsoft\Windows\Explorer humbcache_*.db 可变
浏览器下载历史 浏览器下载记录(不影响已下载文件) 0

🟡 黄灯(需用户确认)

路径 说明
%USERPROFILE%\Downloads 下载文件夹(可能包含重要文件)
%USERPROFILE%\Desktop 桌面(可能包含重要文件)
视频缓存(B站等) 用户可能想保留的离线视频
项目构建产物 node_modules, dist, build, __pycache__

🔴 红灯(不可删除)

路径 说明
C:\Windows\System32 Windows 系统文件
C:\Program Files 已安装程序
%APPDATA%\Microsoft\Windows\Start Menu 开始菜单
正在使用的应用数据 %APPDATA%\Google\Chrome\User Data\Default\History(正在使用)

功能一:快速扫描磁盘状态

使用 psutil 获取磁盘信息(无需生成报告):

import psutil

def get_disk_info():
    """获取磁盘信息"""
    partitions = psutil.disk_partitions()
    disk_info = []
    for part in partitions:
        if 'cdrom' in part.opts or part.fstype == '':
            continue
        usage = psutil.disk_usage(part.mountpoint)
        disk_info.append({
            'device': part.device,
            'mountpoint': part.mountpoint,
            'fstype': part.fstype,
            'total': usage.total,
            'used': usage.used,
            'free': usage.free,
            'percent': usage.percent
        })
    return disk_info

# 示例输出
disks = get_disk_info()
for d in disks:
    print(f"{d['device']} ({d['mountpoint']}) - {d['percent']:.1f}% 已用")
    print(f"  总计: {d['total']/1024**3:.1f} GB")
    print(f"  已用: {d['used']/1024**3:.1f} GB")
    print(f"  可用: {d['free']/1024**3:.1f} GB")

功能二:生成完整扫描报告

运行 scanner.py 脚本,生成交互式 HTML 报告:

python "C:\Users\PC\.workbuddy\skills\storage-clean\scripts\scanner.py"

脚本会:

  1. 扫描所有绿灯、黄灯、红灯路径
  2. 计算每个路径的占用大小
  3. 生成 JSON 数据
  4. 渲染 HTML 报告到 reports/ 目录
  5. 输出报告路径(REPORT:C:\path o\report.html

功能三:在 HTML 报告中执行清理

HTML 报告提供以下操作:

🟢 绿灯文件清理

  • 移到废纸篓:可逆操作,删错可以恢复
  • 直接删除:立即释放空间,不可恢复
  • 一键清理所有绿灯文件:批量操作,需二次确认

🟡 黄灯文件处理

  • 在资源管理器中打开:用户手动查看并决定
  • 移到废纸篓(安全子路径):只删除可安全清理的部分

🔴 红灯文件访问

  • 在资源管理器中打开:查看文件,但不提供删除选项

功能四:长期优化建议

报告最后提供系统存储优化建议,例如:

  • 开启"存储感知"功能(Windows 10/11)
  • 定期清理系统还原点
  • 将用户文件夹(文档、图片等)移动到其他分区
  • 使用紧凑型虚拟内存设置

报告 HTML 结构

生成的 HTML 报告包含:

  1. 磁盘总览:总容量、已用、剩余,彩色进度条
  2. 占用排行 Top 5:最大的 5 类文件
  3. 执行建议:清理优先级
  4. 三色分级详情区
    • 🟢 绿灯文件列表(可展开,有清理按钮)
    • 🟡 黄灯文件列表(可展开,只有打开按钮)
    • 🔴 红灯文件列表(可展开,只有访问按钮)
  5. 长期优化建议

安全机制

  1. 只读扫描:扫描阶段全程只读,不执行任何写操作
  2. 二次确认:点击删除按钮后,弹出确认框
  3. 可逆操作优先:默认提供"移到废纸篓"选项
  4. 实时更新:清理后页面实时更新为"已清理"状态

常见场景处理

场景:用户说"帮我看看存储"

  1. 先用 get_disk_info() 展示磁盘总览
  2. 运行 scanner.py 生成完整报告
  3. 用浏览器打开 HTML 报告

场景:用户说"清理磁盘垃圾"

  1. 先生成报告让用户确认
  2. 用户点击报告中的"一键清理"按钮
  3. 弹出二次确认框
  4. 执行清理

场景:aioom 调用存储清理

  1. aioom 检测到内存占用高(可能是磁盘交换导致)
  2. 调用 aioom_storage_clean() 接口
  3. 生成报告并通知用户

文件清单

storage-clean/
├── SKILL.md              # Skill 定义文件(本文件)
├── scripts/
│   ├── scanner.py        # 扫描脚本(生成 JSON 数据)
│   └── cleaner.py        # 清理脚本(执行删除操作)
├── templates/
│   └── report_template.html  # HTML 报告模板
└── reports/              # 生成的报告存放目录

依赖

  • Python 3.8+
  • psutil(磁盘信息获取)
  • 浏览器(打开 HTML 报告)

安装依赖:

pip install psutil

注意事项

  1. 权限问题:某些系统文件路径需要管理员权限才能访问
  2. 正在使用的文件:某些文件可能被占用,无法删除
  3. 网络路径:扫描时跳过网络驱动器
  4. 符号链接:正确处理符号链接,避免循环扫描

更新日志

v1.0.0 (2026-06-09)

  • 初始版本
  • 支持 Windows 系统
  • 三色分级(绿/黄/红)
  • 交互式 HTML 报告
  • 可被 aioom 调用
Usage Guidance
Review carefully before installing. Use this only if you are comfortable with a skill that can scan local folders and run deletion commands. Prefer moving items to the Recycle Bin, inspect every generated command before letting an agent execute it, avoid running the local server, and do not use permanent delete unless you have verified the exact path.
Capability Assessment
Purpose & Capability
Scanning disk usage and offering cleanup is coherent with the stated purpose, but cleaner.py can recycle or permanently delete any caller-supplied file or directory, not just scanner-approved junk paths.
Instruction Scope
The instructions disclose deletion, report generation, and browser opening, but they claim confirmation-oriented safe cleanup while the executable cleaner accepts destructive commands directly and the report encourages asking an agent to run generated cleanup commands.
Install Mechanism
The artifact is a plain skill with Python scripts and no package-install hook beyond requiring python.exe and psutil; no hidden installer or persistence mechanism was found.
Credentials
The scanner reads common Windows temp, browser cache, app cache, Downloads, Desktop, Documents project folders, and disk metadata, then writes persistent HTML and JSON reports containing local paths; this is mostly purpose-aligned but sensitive and broad for a cleanup helper.
Persistence & Privilege
No autostart persistence was found, but server.py can expose unauthenticated localhost endpoints for cleaning arbitrary paths, opening arbitrary existing paths, and shutting down the process, with wildcard CORS and no token or origin check.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install storage-clean
  3. After installation, invoke the skill by name or use /storage-clean
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release: AI-powered disk storage cleaner with interactive HTML reports, traffic-light classification, one-click command generation
Metadata
Slug storage-clean
Version 1.0.0
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 1
Frequently Asked Questions

What is 存储清理?

AI-powered disk storage cleaner for Windows. Scan disk usage, generate interactive HTML report with 3-color grading (green/yellow/red), and safely clean junk... It is an AI Agent Skill for Claude Code / OpenClaw, with 41 downloads so far.

How do I install 存储清理?

Run "/install storage-clean" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is 存储清理 free?

Yes, 存储清理 is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does 存储清理 support?

存储清理 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created 存储清理?

It is built and maintained by bettermen (@bettermen); the current version is v1.0.0.

💬 Comments