Cache Cleanup

清理过期缓存文件、auto-flush 文件、旧日志,释放磁盘空间。

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 305 · 1 current installs · 1 all-time installs
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Suspicious
medium confidence
!
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.
What to consider before installing
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.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.0
Download zip
latestvk97ad4n46k23gez8em9r6btr75822mwg

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

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

Files

3 total
Select a file
Select a file to preview.

Comments

Loading comments…