← Back to Skills Marketplace
Cache Cleanup
by
xaiohuangningde
· GitHub ↗
· v1.0.0
663
Downloads
0
Stars
1
Active Installs
1
Versions
Install in OpenClaw
/install cache-cleanup
Description
清理过期缓存文件、auto-flush 文件、旧日志,释放磁盘空间。
README (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
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install cache-cleanup - After installation, invoke the skill by name or use
/cache-cleanup - Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Frequently Asked Questions
What is Cache Cleanup?
清理过期缓存文件、auto-flush 文件、旧日志,释放磁盘空间。 It is an AI Agent Skill for Claude Code / OpenClaw, with 663 downloads so far.
How do I install Cache Cleanup?
Run "/install cache-cleanup" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Cache Cleanup free?
Yes, Cache Cleanup is completely free (open-source). You can download, install and use it at no cost.
Which platforms does Cache Cleanup support?
Cache Cleanup is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Cache Cleanup?
It is built and maintained by xaiohuangningde (@xaiohuangningde); the current version is v1.0.0.
More Skills