openclaw-cleaner

v1.0.0

OpenClaw 临时文件自动清理工具。扫描 ~/.openclaw/workspace/ 下的临时文件,按规则自动归档或删除,防止工作区膨胀。面向 ClawHub 小白用户,默认安全(dry-run)+ 自动备份归档。

0· 56·0 current·0 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for beforesun/cleaner4rookies.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "openclaw-cleaner" (beforesun/cleaner4rookies) from ClawHub.
Skill page: https://clawhub.ai/beforesun/cleaner4rookies
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Canonical install target

openclaw skills install beforesun/cleaner4rookies

ClawHub CLI

Package manager switcher

npx clawhub@latest install cleaner4rookies
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
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.
Assessment
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.

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

latestvk978ek9s14e6bsemjyj8qxz6ds85bvnn
56downloads
0stars
1versions
Updated 2d ago
v1.0.0
MIT-0

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.yamlconfig.yaml 存在
想恢复归档的文件~/.openclaw/workspace/cleaner-archive/
某些文件不该删加入 whitelist 列表
dry-run 显示 0 个文件说明没有符合条件(时间阈值未到)的文件

更新日志

v1.0.0

  • 首发:支持归档/删除、白名单、dry-run、cron 定时

Comments

Loading comments...