← Back to Skills Marketplace
aaroncxxx

Drop Caches Cleanup

by aaroncxxx · GitHub ↗ · v1.2.0 · MIT-0
cross-platform ✓ Security Clean
92
Downloads
0
Stars
1
Active Installs
2
Versions
Install in OpenClaw
/install drop-caches-cleanup
Description
一键清理系统内存(RAM)/ One-click system memory cleanup. 当用户说"清理内存"、"释放内存"、"一键清理"、"drop caches"、"内存太高"、"卡"、"慢" / "clear memory"、"free memory"、"memory cleanup"、"system...
README (SKILL.md)

一键清理内存 / One-Click Memory Cleanup

一键清理 Linux Page Cache 或 macOS 内存缓存,释放物理内存。 One-click cleanup of Linux Page Cache / macOS memory cache to free physical RAM.

关于作者 — 十五年老米粉了!!冲!!!v1.2 优化:分级清理、阈值检查、macOS 支持、内存计算修正。

使用方法 / Usage

bash "{baseDir}/scripts/cleanup.sh" [options]

Options

Flag Description
--level 1|2|3 清理级别:1=page cache, 2=dentries+inodes, 3=全部(默认)
--threshold \x3Cpct> 内存使用率低于此值时跳过清理 (0-100)
--dry-run 仅显示内存状态,不执行清理
--json JSON 格式输出
-h, --help 显示帮助

Examples

# 基础清理(全部缓存)
bash "{baseDir}/scripts/cleanup.sh"

# 只清理 page cache
bash "{baseDir}/scripts/cleanup.sh" --level 1

# 内存使用率低于 70% 时跳过
bash "{baseDir}/scripts/cleanup.sh" --threshold 70

# 先看看状态,不执行
bash "{baseDir}/scripts/cleanup.sh" --dry-run

# JSON 输出(方便程序消费)
bash "{baseDir}/scripts/cleanup.sh" --json

功能 / Features

  • ✅ Linux drop_caches + macOS purge 双平台支持
  • ✅ 分级清理(level 1/2/3)
  • ✅ 阈值检查(低于阈值自动跳过)
  • ✅ Dry-run 模式(只看不做)
  • ✅ 权限预检(不够直接报错)
  • ✅ 内存计算修正(用 available 差值,非 used 差值)
  • ✅ 清理后自动评估(✅良好 / ⚠️偏高 / 🔴危险)
  • ✅ JSON 结构化输出
  • ✅ 定时清理建议

清理级别说明

Level Linux macOS
1 Page Cache only purge(整体清理)
2 dentries + inodes purge
3 全部(默认) purge

macOS 只有 purge 一个级别,--level 参数在 macOS 上不影响行为。

输出示例

⚡ Drop Caches Cleanup v1.2.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🖥️  平台: Linux | 清理级别: level 3
📊 清理前:
   总量: 3499MB | 已用: 2788MB | 可用: 711MB | 空闲: 150MB

🧹 正在清理 (level 3)...

📊 清理后:
   总量: 3499MB | 已用: 1988MB | 可用: 1511MB | 空闲: 950MB

🎉 成功释放 800MB 可用内存!
✅ 内存状态良好 (56%)

💡 如需定时清理,可配置 cron:
   0 */6 * * * /path/to/cleanup.sh --threshold 70
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

注意事项 / Notes

  • ⚠️ Linux 需要 root/sudo 权限
  • ⚠️ macOS 需安装 Xcode CLI tools(xcode-select --install
  • ✅ 只清理缓存(安全操作,不影响数据)
  • ⏱️ 清理后可能需要几秒才能看到完整效果

定时清理(Cron)

# 每 6 小时检查一次,使用率超 70% 才清理
0 */6 * * * /path/to/cleanup.sh --threshold 70 --json >> /var/log/mem-cleanup.log

版本历史

v1.2.0 (2026-04-27)

  • 🔀 分级清理:--level 1/2/3,默认 level 3(全部)
  • 🍎 macOS 支持:自动检测并使用 purge 命令
  • 🎯 阈值检查:--threshold 低于阈值自动跳过
  • 🔍 Dry-run:--dry-run 只看状态不执行
  • 🔧 内存计算修正:用 available 差值替代 used 差值
  • 🔒 权限预检:执行前检查 root/sudo
  • 📊 清理后评估:✅/⚠️/🔴 三级评估
  • 📋 JSON 输出:--json 结构化数据
  • 💡 cron 建议:清理后提示定时清理配置

v1.1.0 (2026-04-25)

  • 🚀 首发:Linux Page Cache 一键清理,前后对比显示
Usage Guidance
This skill is coherent with its purpose: it simply runs a shell script that calls sync and writes to /proc/sys/vm/drop_caches on Linux or runs macOS purge. Before using, review the script (you already have the content), and note it requires root/sudo on Linux — only run it when you understand and accept that elevated permission. Test with --dry-run and --threshold to avoid unnecessary runs, and avoid scheduling automatic runs on critical systems unless you understand the operational impact (cache drops can momentarily change performance). If you prefer, copy the script locally and run it manually rather than giving an automated agent sudo access.
Capability Analysis
Type: OpenClaw Skill Name: drop-caches-cleanup Version: 1.2.0 The skill is a legitimate system utility designed to clear memory caches on Linux (via /proc/sys/vm/drop_caches) and macOS (via the purge command). The script scripts/cleanup.sh includes safety features such as a dry-run mode, threshold-based execution, and privilege pre-checks, with no evidence of data exfiltration, persistence mechanisms, or malicious prompt injection.
Capability Assessment
Purpose & Capability
Name/description describe one‑click memory/cache cleanup and the included script implements exactly that: Linux drop_caches (writing to /proc/sys/vm/drop_caches) and macOS purge. No unrelated binaries, env vars, or services are requested.
Instruction Scope
SKILL.md instructs running the bundled shell script with clear flags and explains behavior (dry-run, threshold, JSON). The instructions do not ask the agent to read unrelated files, send data externally, or access unrelated credentials.
Install Mechanism
No install spec or remote downloads; the skill is instruction+script only. Nothing is fetched from external URLs or written to system paths by an installer step.
Credentials
The skill requests no environment variables or external credentials. It does require root/sudo at runtime on Linux, which is appropriate and documented for the operation performed.
Persistence & Privilege
always is false and the skill does not modify agent/system-wide settings. It requires elevated privileges only when actually performing drop_caches, which is expected for this operation.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install drop-caches-cleanup
  3. After installation, invoke the skill by name or use /drop-caches-cleanup
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.2.0
分级清理 --level 1/2/3; macOS purge 适配; 阈值检查 --threshold; dry-run 模式; 内存计算修正(avail差值); 权限预检; 清理后评估; JSON 输出
v1.1.0
- Added one-click Linux Page Cache cleanup to instantly free physical RAM. - Displays memory status before and after cleanup, and shows the amount of memory freed. - Uses the `sync && echo 3 > /proc/sys/vm/drop_caches` command for effective cache drop. - Requires root/sudo permissions for operation. - Only clears Page Cache, ensuring safe operation without data loss.
Metadata
Slug drop-caches-cleanup
Version 1.2.0
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 2
Frequently Asked Questions

What is Drop Caches Cleanup?

一键清理系统内存(RAM)/ One-click system memory cleanup. 当用户说"清理内存"、"释放内存"、"一键清理"、"drop caches"、"内存太高"、"卡"、"慢" / "clear memory"、"free memory"、"memory cleanup"、"system... It is an AI Agent Skill for Claude Code / OpenClaw, with 92 downloads so far.

How do I install Drop Caches Cleanup?

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

Is Drop Caches Cleanup free?

Yes, Drop Caches Cleanup is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Drop Caches Cleanup support?

Drop Caches Cleanup is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Drop Caches Cleanup?

It is built and maintained by aaroncxxx (@aaroncxxx); the current version is v1.2.0.

💬 Comments