← 返回 Skills 市场
99
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install cleaner4rookies
功能描述
OpenClaw 临时文件自动清理工具。扫描 ~/.openclaw/workspace/ 下的临时文件,按规则自动归档或删除,防止工作区膨胀。面向 ClawHub 小白用户,默认安全(dry-run)+ 自动备份归档。
使用说明 (SKILL.md)
openclaw-cleaner 🧹
清理 OpenClaw 临时文件,防止工作区膨胀。默认安全,值得信赖。
功能
- 自动扫描
~/.openclaw/workspace/下的临时文件(音频/文档/图片/日志等) - 支持归档(安全移走)和删除两种处理方式
- 默认 dry-run:先显示清理预览,确认后才执行
- 操作前自动创建归档目录,文件不会凭空消失
- 支持 cron 定时或手动触发
- 白名单机制:重要文件永不误删
安装
npx skills add ~/.openclaw/workspace/skills/openclaw-cleaner
或手动安装:
git clone https://github.com/your-repo/openclaw-cleaner.git ~/.openclaw/workspace/skills/openclaw-cleaner
快速开始
1. 预览(推荐先跑)
bash ~/.openclaw/workspace/skills/openclaw-cleaner/scripts/cleaner.sh
输出示例:
═══════════════════════════════════════════
🧹 openclaw-cleaner
模式: 🔍 dry-run(只显示,不删除)
═══════════════════════════════════════════
━━ 归档规则 ━━
[Telegram等下载文件尽快分流] (3 个文件)
🔍 [dry-run] doc1.docx (12K)
🔍 [dry-run] doc2.pdf (8K)
━━ 删除规则 ━━
[测试音频残留,无保留价值] (2 个文件)
🔍 [dry-run] lobster-test.mp3 (128K)
2. 正式执行
加 --force 才真正删/归档:
bash ~/.openclaw/workspace/skills/openclaw-cleaner/scripts/cleaner.sh --force
配置
编辑 ~/.openclaw/workspace/cleaner.yaml(不存在则自动使用内置 config.yaml):
# 清理规则
rules:
- pattern: "*.mp3 *.wav *.m4a"
action: delete
age_days: 0 # 0 = 立即
- pattern: "*.docx *.doc *.pdf"
action: archive # 移到归档目录
age_days: 1 # 超过1天触发
- pattern: "*.png *.jpg *.gif"
action: delete
age_days: 7 # 超过7天触发
- pattern: "media/inbound/*"
action: archive
age_days: 3
# 执行控制
dry_run: true # 默认预览,要关闭设为 false
archive_dir: "~/.openclaw/workspace/cleaner-archive"
cron_schedule: "" # 填 "0 3 * * *" = 每天凌晨3点
# 白名单(绝对路径,不会被删除)
whitelist:
- "~/.openclaw/workspace/SOUL.md"
- "~/.openclaw/workspace/MEMORY.md"
cron 定时任务
在 cleaner.yaml 里填入 cron 表达式:
cron_schedule: "0 3 * * *" # 每天凌晨3点
或手动通过 OpenClaw cron 管理:
cron add --name "openclaw-cleaner" \
--schedule "0 3 * * *" \
--command "bash ~/.openclaw/workspace/skills/openclaw-cleaner/scripts/cleaner.sh --force"
⚠️ 强烈建议:首次用 cron 前,先手动跑一次 dry-run,确认规则符合预期。
安全特性
| 特性 | 说明 |
|---|---|
| 默认 dry-run | 永远先显示预览,不直接操作 |
| 自动归档 | 删除改为归档到 cleaner-archive/,可恢复 |
| 白名单 | 显式声明的文件永不删除 |
| 详细日志 | 记录每个文件的处理结果 |
卸载
rm -rf ~/.openclaw/workspace/skills/openclaw-cleaner
rm -rf ~/.openclaw/workspace/cleaner-archive
# 如有 cron,手动删除对应的 cron job
故障排除
| 问题 | 解法 |
|---|---|
| "未找到配置文件" | 确认 ~/.openclaw/workspace/cleaner.yaml 或 config.yaml 存在 |
| 想恢复归档的文件 | 去 ~/.openclaw/workspace/cleaner-archive/ 找 |
| 某些文件不该删 | 加入 whitelist 列表 |
| dry-run 显示 0 个文件 | 说明没有符合条件(时间阈值未到)的文件 |
更新日志
v1.0.0
- 首发:支持归档/删除、白名单、dry-run、cron 定时
安全使用建议
This appears to be a local workspace-cleaner and is coherent with its description, but review before running: 1) Run the provided script without --force first (dry-run) to inspect what will be changed. 2) Verify the config file path (~/.openclaw/workspace/cleaner.yaml) and archive_dir are correct and do not point to important locations; whitelist entries can include absolute paths so double-check them. 3) Inspect scripts/cleaner.sh for behavior you accept (it will mv or rm files when --force is used). 4) Do not run any git clone or npx install from an unknown or placeholder repo URL — obtain the code from a trusted source or the registry package. 5) Be aware the script has some parsing/logic bugs (e.g., time cutoff calculation and some basename handling) that may affect which files are selected; consider testing on a small sample directory or patching the script before enabling cron. If you want more assurance, request the authoritative source repository or a patch addressing the noted bugs before installing.
功能分析
Type: OpenClaw Skill
Name: cleaner4rookies
Version: 1.0.0
The skill bundle is a legitimate utility designed to manage and clean temporary files within the OpenClaw workspace (~/.openclaw/workspace/). The core logic in scripts/cleaner.sh implements a safety-first approach, defaulting to a 'dry-run' mode and providing an archiving mechanism instead of immediate deletion. It includes a whitelist feature to protect sensitive files (e.g., SOUL.md, MEMORY.md) and lacks any indicators of data exfiltration, unauthorized network activity, or persistence mechanisms. While the YAML parsing in the shell script is rudimentary, it does not pose a security risk beyond typical shell script limitations.
能力评估
Purpose & Capability
Name/description (cleaning ~/.openclaw/workspace) matches the included script and config rules. The script only operates on the user's HOME/.openclaw/workspace and an archive directory under that workspace; no unrelated services or credentials are requested.
Instruction Scope
SKILL.md and the script stick to scanning and moving/deleting files in ~/.openclaw/workspace and an archive dir. However: the whitelist supports arbitrary absolute paths (so a user could whitelist files outside the workspace), and SKILL.md instructs cloning from a placeholder GitHub URL (your-repo) which is not a real upstream — ensure you obtain code from a trusted source. Also the script relies on a config file (~/.openclaw/workspace/cleaner.yaml or the shipped config.yaml); the runtime will exit if no config is found.
Install Mechanism
There is no formal install spec in the registry (instruction-only), but the package actually includes a runnable script. Installation instructions show 'npx skills add' or 'git clone https://github.com/your-repo/...', and the clone URL is a placeholder — verify the real repository location before running commands that fetch code. No remote downloads or obfuscated installers are present in the packaged files.
Credentials
The skill requests no credentials or environment variables. It uses standard filesystem access to HOME/.openclaw/workspace only. This is proportionate to a cleanup tool. Note: whitelist entries and archive_dir accept absolute paths, so a misconfigured config could cause the tool to touch files outside the intended workspace.
Persistence & Privilege
The skill does not request 'always: true' and does not modify other skills or system-wide config. Cron usage is optional and must be configured by the user; the skill does not auto-register itself into system cron in the provided files.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install cleaner4rookies - 安装完成后,直接呼叫该 Skill 的名称或使用
/cleaner4rookies触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
工作区越来越卡?openclaw-cleaner 自动清理 OpenClaw 临时文件,支持归档备份,默认安全预览,零门槛上手。
元数据
常见问题
openclaw-cleaner 是什么?
OpenClaw 临时文件自动清理工具。扫描 ~/.openclaw/workspace/ 下的临时文件,按规则自动归档或删除,防止工作区膨胀。面向 ClawHub 小白用户,默认安全(dry-run)+ 自动备份归档。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 99 次。
如何安装 openclaw-cleaner?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install cleaner4rookies」即可一键安装,无需额外配置。
openclaw-cleaner 是免费的吗?
是的,openclaw-cleaner 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
openclaw-cleaner 支持哪些平台?
openclaw-cleaner 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 openclaw-cleaner?
由 beforesun(@beforesun)开发并维护,当前版本 v1.0.0。
推荐 Skills