← 返回 Skills 市场
xaiohuangningde

Cache Cleanup

作者 xaiohuangningde · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
663
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install cache-cleanup
功能描述
清理过期缓存文件、auto-flush 文件、旧日志,释放磁盘空间。
使用说明 (SKILL.md)

Cache Cleanup

清理各类缓存和临时文件,释放磁盘空间。

能力轮廓

  • 输入:缓存目录
  • 输出:清理报告
  • 核心:扫描 → 分类 → 清理

工作流

1. 扫描缓存目录
2. 识别过期文件(按类型设定过期时间)
3. 统计大小
4. 清理
5. 报告

目标目录

目录 类型 过期时间
~/.npm/_cache/ NPM 缓存 7 天
~/.cache/ 通用缓存 7 天
/tmp/ 临时文件 1 天
~/.openclaw/logs/ 日志文件 14 天
~/.openclaw/browser/ 浏览器缓存 3 天
~/.openclaw/sandbox/ 沙箱 7 天
~/.openclaw/sandbox-neko/ 猫娘沙箱 7 天
~/.openclaw/canvas/ Canvas 缓存 3 天

清理规则

类型 规则
日志 .log, .jsonl > 14 天
缓存 所有 > 7 天
临时 所有 > 1 天
浏览器 所有 > 3 天

磁盘告警

  • 磁盘使用 > 80% 时增强清理
  • 清理前检查磁盘使用率

主动性

  • 每3天执行一次
  • 磁盘使用率高时主动清理

使用方式

# 手动执行
~/.openclaw/workspace/skills/cache-cleanup/cleanup.sh

# 配置定时任务(每3天凌晨2点)
cron job add cache-cleanup "0 2 */3 * *" ~/.openclaw/workspace/skills/cache-cleanup/run.sh
安全使用建议
Do not install or schedule this script without addressing the mismatches. Specific recommendations: 1) Verify which paths you want cleaned: the README lists many user-level dirs, but the script only operates on /root/.openclaw — change WORKSPACE to $HOME/.openclaw or make it a configurable parameter. 2) Do not run as root unless you understand the impact; running as root could delete files in root's home. 3) The SKILL.md suggests a run.sh for cron but no run.sh is included — create a safe wrapper that does a dry-run first. 4) Test with finds printed (no -delete) to confirm what will be removed, and back up important data. 5) Consider adding explicit safety checks (confirm disk path exists, confirm non-empty WORKSPACE) and avoid rm -rf patterns unless absolutely necessary. 6) If you want broader cache cleanup (e.g., ~/.npm/_cache, ~/.cache), modify the script explicitly rather than relying on the SKILL.md. These inconsistencies make the skill suspicious until corrected; if the author can provide an updated script that is parameterized, documents intended runtime user, and includes the missing run.sh, reassess for coherence.
功能分析
Type: OpenClaw Skill Name: cache-cleanup Version: 1.0.0 The OpenClaw AgentSkills bundle 'cache-cleanup' is designed to remove old cache files, temporary files, and logs to free up disk space. The `SKILL.md` provides clear, benign instructions and descriptions. The `cleanup.sh` script uses standard Unix commands (`find`, `rm`, `df`) to delete files based on age within specified directories, primarily within the agent's own workspace (`/root/.openclaw`) and common temporary locations (`/tmp`). There is no evidence of data exfiltration, unauthorized network activity, or malicious prompt injection attempts against the agent. While the script uses powerful commands like `rm -rf`, their usage is consistent with the stated purpose of cleanup and confined to expected cache/temp locations, indicating no malicious intent.
能力评估
Purpose & Capability
SKILL.md advertises cleaning many user-level caches (~/.npm/_cache, ~/.cache, /tmp, etc.), but cleanup.sh does not touch ~/.npm/_cache or ~/.cache and instead operates on a hard-coded WORKSPACE=/root/.openclaw. The declared targets in documentation do not match the actual script, which is disproportionate to the stated purpose and may cause surprise if run with elevated privileges.
Instruction Scope
SKILL.md describes scanning, classification, and enhanced cleaning when disk usage >80%, but the script only logs the disk usage and does not change behavior based on the threshold. The docs suggest a scheduled run via a run.sh, but no run.sh is included; the script ignores the broader set of directories listed in the docs and only deletes files in specific workspace and /tmp patterns. The mismatch grants the agent less or different scope than promised and leaves ambiguous behavior.
Install Mechanism
Instruction-only skill with no install spec and a single shell script. No external downloads or package installs are present.
Credentials
No environment variables or credentials are requested (good). However, the script hard-codes WORKSPACE=/root/.openclaw, which implies root-home access; if executed as root this gives the script broad filesystem reach over root's workspace. The hard-coded root path is unexpected relative to the SKILL.md's ~ (home) references and should be parameterized or documented.
Persistence & Privilege
skill.json contains a cron field and SKILL.md recommends adding a cron job, so the skill is intended to run periodically. always:false (good). There is no install mechanism to automatically register the cron and run.sh referenced in docs is missing, so automatic persistence is manual rather than implicit—still, users should be cautious about scheduling deletion scripts.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install cache-cleanup
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /cache-cleanup 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
cache-cleanup 1.0.0 - Initial release for automated cache and log cleanup. - Scans specified directories, identifies expired files by type, and removes them to free disk space. - Generates a cleanup report detailing actions taken. - Supports enhanced cleanup when disk usage exceeds 80%. - Can be executed manually or scheduled as a recurring cron job.
元数据
Slug cache-cleanup
版本 1.0.0
许可证
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Cache Cleanup 是什么?

清理过期缓存文件、auto-flush 文件、旧日志,释放磁盘空间。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 663 次。

如何安装 Cache Cleanup?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install cache-cleanup」即可一键安装,无需额外配置。

Cache Cleanup 是免费的吗?

是的,Cache Cleanup 完全免费(开源免费),可自由下载、安装和使用。

Cache Cleanup 支持哪些平台?

Cache Cleanup 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Cache Cleanup?

由 xaiohuangningde(@xaiohuangningde)开发并维护,当前版本 v1.0.0。

💬 留言讨论