disk-cleanup

Automated disk space cleanup and maintenance for OpenClaw deployments. Cleans 12 categories: memory SQLite orphan tmp files, SQLite VACUUM, Docker dangling images/volumes/build cache, OpenClaw gateway logs, /tmp temp files, workspace backup artifacts, delivery queue stale entries, systemd journal vacuum, package manager caches (npm/yarn/pnpm/bun/prisma), rotated syslogs and btmp, git workspace gc, and stale migration artifacts (e.g. QMD models after backend switch). Use when: disk is filling up, after long-running deployments, as weekly cron maintenance, when disk usage exceeds 80%, when memory reindex leaves orphan .sqlite.tmp files, or when Docker images accumulate from sandbox rebuilds. Triggers on: disk cleanup, disk full, free space, storage maintenance, prune, vacuum, cleanup script, disk usage high.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "disk-cleanup" with this command: npx skills add yagebin79386/disk-cleanup

Disk Cleanup

Automated disk space recovery for OpenClaw deployments. Covers 12 cleanup categories that OpenClaw does not handle natively (as of 2026.3.13).

What OpenClaw Already Handles (skip these)

  • Session store: session.maintenance config (pruneAfter, maxEntries, rotateBytes)
  • Sandbox containers: sandbox.prune config (idleHours, maxAgeDays)
  • Context pruning: contextPruning config (cache-ttl mode)

What This Skill Handles (the gaps)

#CategoryTypical GrowthTrigger
1Memory SQLite .tmp-* orphansHundreds of MB from failed reindexAlways
2Memory SQLite VACUUMFragmentation after heavy use--aggressive
3Docker images/volumes/build cacheGB from sandbox rebuildsAlways
4Gateway logs (/tmp/openclaw/*.log)Grows daily>3 days old
5/tmp OpenClaw temp filesPatrol/board/cron artifacts>24h old
6Workspace .prebind.* backupsHundreds of MB per backup>7 days old
7Delivery queue old entriesGrows with message volume>7 days old
8systemd journalGB on default VPS configs>500MB
9npm/yarn/pnpm/bun/prisma/node-gyp cacheGB from skill/plugin installs>100MB
10Rotated syslogs + btmpSSH brute-force logs on public VPSAlways
11Git workspace .gitAuto-commit growth (board-move etc.)>200MB
12QMD/migration artifactsStale after backend switchAuto-detected

Quick Start

Run directly:

# Preview what would be cleaned (safe, no deletions)
bash scripts/disk-cleanup.sh --dry-run

# Normal cleanup
bash scripts/disk-cleanup.sh

# Deep cleanup: includes SQLite VACUUM + aggressive git gc
bash scripts/disk-cleanup.sh --aggressive

# Cron mode: only outputs summary line
bash scripts/disk-cleanup.sh --quiet

Schedule as Cron Job

Weekly Sunday 04:00 CET (recommended):

Use the cron tool:
  schedule: { kind: "cron", expr: "0 3 * * 0", tz: "Europe/Luxembourg" }
  payload: { kind: "agentTurn", message: "Run disk cleanup: bash scripts/disk-cleanup.sh --aggressive --quiet. Report results." }
  sessionTarget: "isolated"

Or integrate into an existing infra-health-check script by adding a disk usage threshold trigger:

DISK_PCT=$(df / --output=pcent | tail -1 | tr -d ' %')
if [ "$DISK_PCT" -ge 85 ]; then
  bash /path/to/disk-cleanup.sh --quiet
fi
if [ "$DISK_PCT" -ge 90 ]; then
  bash /path/to/disk-cleanup.sh --aggressive --quiet
fi

Environment Variables

VariableDefaultDescription
OPENCLAW_HOME~/.openclawOpenClaw state directory
OPENCLAW_WORKSPACE$(pwd)Agent workspace root

Exit Codes

  • 0 — Success (cleaned or nothing to clean)
  • 1 — Error during cleanup

Output Format

Last line is machine-parseable:

CLEAN|0|0B|44%          # Nothing cleaned
CLEANED|5|1.2GB|67%     # 5 actions, freed 1.2GB, now at 67%

Safety

  • --dry-run previews all actions without deleting
  • SQLite VACUUM only on --aggressive and only when fragmentation ≥5%
  • Docker prune only removes dangling (untagged) images; named images are safe
  • btmp is truncated (not deleted) — system expects the file to exist
  • Journal vacuum installs a persistent 500MB limit to prevent regrowth
  • Git gc uses --auto by default; --aggressive only with flag

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Huo15 Openclaw Enhance

火一五·克劳德·龙虾增强插件 v5.7.8 — 全面适配 openclaw 2026.4.24:peerDep ^4.24 + build/compat 同步到 4.24 + 14 处 api.on 全部去掉 as any 改成 typed hook(hookName 联合类型 + handler 自动推断 Pl...

Registry SourceRecently Updated
General

Content Trend Analyzer

Aggregates and analyzes content trends across platforms to identify hot topics, user intent, content gaps, and generates data-driven article outlines.

Registry SourceRecently Updated
General

Prompt Debugger

Debug prompts that produce unexpected AI outputs — diagnose failure modes, identify ambiguity and conflicting instructions, test variations, compare model re...

Registry SourceRecently Updated
General

Indie Maker News

独行者 Daily - 变现雷达。读对一条新闻,少走一年弯路。每天5分钟,给创业者装上商业雷达。聚焦一人公司、副业、创业变现资讯,智能分类,行动导向。用户下载即能用,无需本地部署!

Registry SourceRecently Updated