CAS-2540 — Cargo-targets disk budget
CAS-2540 — Cargo-targets disk budget
Status: shipped (2026-05-13, commit 7d57df0)
Owner: Castellan (implementation), Master of Craft (architecture)
Problem
Recurring disk-full incidents blocked all engineering work. The Worktree Sweeper and Ravens disk probes caught the symptom but only after the crisis, and only through manual intervention. Each fill required a human-triggered migrate-worktree-cargo.sh run to recover.
What shipped
Five-layer structural fix:
| Layer | Component | What it does |
|---|---|---|
| 1 | enforce-cargo-budget.sh | LRU eviction across all officer target dirs — evicts deps → build → incremental until under budget. Skips files younger than 5 min and respects the smoke-test lock. |
| 2 | cargo-budgets.conf | Per-officer budget caps: backend/frontend 12 GB, others 6–8 GB. Config-driven — no code change needed to adjust. |
| 3 | com.paperclip.cargo-budget-enforcer.plist.tmpl | launchd daemon: hourly enforcement (StartInterval=3600) + RunAtLoad=true. Replaces the 4-hour Paperclip routine (which ran only while Paperclip was up). |
| 4 | cargo-budget-alert.sh | Per-role 80% threshold alert. Fires after each enforcement run; surfaced to Paperclip logs. |
| 5 | enforce-cargo-budgets.sh | Dispatcher wrapper wired into install.sh and check-daemon-health.sh. |
Key behaviours
- Smoke-lock guard — eviction is skipped when
~/.paperclip/state/smoke-test.lockis held by a live process. Prevents pruning incremental artifacts mid-smoke. - 5-minute safety window (
MIN_AGE_MINUTES=5) — recently written files are never evicted. Protects in-flight builds. - Dry-run mode —
enforce-cargo-budget.sh --dry-runreports what would be evicted without touching disk. - Idempotent — safe to run multiple times; already-under-budget dirs are no-ops.
Files
.agents/skills/casaconomy-task-worktree/scripts/ enforce-cargo-budget.sh — main enforcer cargo-budgets.conf — per-officer GB caps.paperclip/ scripts/enforce-cargo-budgets.sh — dispatcher scripts/cargo-budget-alert.sh — 80% alert scripts/check-daemon-health.sh — wired in for health reporting launchd/com.paperclip.cargo-budget-enforcer.plist.tmpl — daemon template install.sh — registers daemon on setupFollow-up (separate CAS)
- Disk-level push notification
- Post-merge hook integration
disk-budget-status.shsummary command- SKILL.md entry for task-worktree skill