cacheout_smart_clean
Frees disk space by clearing caches in priority order until target GB is met. Use for low disk space scenarios.
Instructions
Intelligently free disk space by clearing caches in priority order.
This is the PRIMARY tool for agents managing disk pressure. Specify how many GB you need freed, and the server clears the safest caches first:
Build artifacts (Xcode DerivedData) — always regenerates
Package manager caches (Homebrew, npm, pip) — re-downloads as needed
Browser caches — rebuilds on browsing
Docker (only if include_caution=true) — destructive, last resort
The server stops as soon as the target is met. Use dry_run=true to preview which categories would be cleaned and how much space would be freed.
Typical use: An agent detects low disk space (or needs room for swap/builds) and calls smart_clean(target_gb=10.0) to free 10 GB immediately.
Args: params: Target GB to free, dry_run flag, and caution inclusion.
Returns: str: JSON report with before/after disk state and what was cleaned. { "target_gb": 10.0, "target_met": true, "total_freed_human": "12.3 GB", "dry_run": false, "disk_before": {"free_gb": 5.2, ...}, "disk_after": {"free_gb": 17.5, ...}, "cleaned": [...], "skipped": [...] }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |