Repository navigation
feat: weekly cache cleanup and daily low-disk alert - #13
Merged
twistedmelonman merged 4 commits intoOct 23, 2026
Merged
Conversation
added 4 commits
October 23, 2026 15:19
Weekly LaunchAgent (Sunday 04:00) that runs npm cache clean --force, uv cache prune and xcrun simctl delete unavailable (under timeout). A missing tool is a logged skip; a failed step does not stop the others but makes the run exit 1. Free space is logged before and after. The script deletes no path itself. An earlier, never-committed version had a Puppeteer step with its own rm -rf behind a denylist path guard. On 2026-10-22 a red-phase test passed `//` to that guard before the fix existed, and the loop removed ~40 apps from /Applications. That step is gone, and a guard test now fails if a code line calls rm, rmdir, mv, unlink, shred or -delete. The tests use BATS_TEST_TMPDIR, so the test file has no rm either. The design doc records the incident. README: describe disk-cleanup.sh; correct the workflows line, which listed a workflow that no longer exists and said ralph-burndown runs on mimolette (it is no longer in operation).
Protocol 3's new destructive-code rule (claude-config PR 778) sends tests that may reach a real destructive command, and every red-phase safety test, to a disposable environment. A Linux container cannot run tmutil, diskutil, launchctl or simctl, and a GitHub macOS runner costs about 10x a Linux one. mimolette is an always-on arm64 Mac on macOS 27.0.1 with 158 GiB free. The design: a non-admin `claude` account, a forced-command ssh key, Tart VMs cloned from a clean base with no shared folders, code sent in as a git bundle on stdin, results out as text only, and every VM deleted after its run. It lists a known-bad validation run to do before first use and the open questions (headless start, base image, clone cost, guest network). Nothing on mimolette changes until it is approved.
On 2026-10-22 free space fell from 52 to 37 GiB between two weekly runs of the snapshot thinner, and nothing said so. This LaunchAgent (daily 09:00) reads free space on /System/Volumes/Data and posts a macOS notification when it is below 40 GiB; the first argument overrides the threshold. 40, not 50, so it stays quiet on a shortfall the 50 GiB thinner clears. It deletes nothing. An unreadable volume also posts a notification and exits 1. The title and message go to AppleScript as argv, never as script text. osascript exits 0 even when the notification service is unreachable (seen inside the Claude Code sandbox), so the log line is the record.
simctl hung past 300 s during the 2026-10-22 cleanup. timeout sends only SIGTERM by default, so a simctl that ignores it would still hang the run. `timeout -k 10s` follows with SIGKILL, capping the step at timeout + 10 s. GNU timeout exits 137 after that SIGKILL, and also when the child is SIGKILLed from outside before any timeout (checked with coreutils 9.12). The 137 log line names both causes rather than claiming a timeout.
twistedmelonman
deleted the
claude/feat-disk-space-automation-20261022
branch
October 23, 2026 23:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On 2026-10-22 the data volume reached 92% used. Nothing cleans npm, uv or
simulator caches, and nothing warns when free space drops between weekly
snapshot-thinning runs.
The first, never-committed version of this branch also had a Puppeteer
step with its own
rm -rf. A red-phase test passed//to its path guardand removed ~40 apps from /Applications. Backups restored them. The design
doc's Incident section has the details. That version is not in this
history.
What
disk-cleanup.sh+LaunchAgents/com.asiago.disk-cleanup.plist: weekly(Sunday 04:00)
npm cache clean --force,uv cache pruneandxcrun simctl delete unavailableundertimeout. It deletes no pathitself. A guard test fails if a code line calls
rm,rmdir,mv,unlink,shredor-delete.disk-space-alert.sh+LaunchAgents/com.asiago.disk-space-alert.plist:daily (09:00) notification when free space is below 40 GiB, or when it
cannot be read. Deletes nothing.
docs/plans/2026-10-23-mimolette-vm-test-runner.md: design only, for thedisposable macOS VMs that Protocol 3's new destructive-code rule needs.
workflow or says ralph-burndown runs on mimolette.
Neither LaunchAgent is installed yet. That happens after merge.
Testing
tests/disk-cleanup.bats(17) andtests/disk-space-alert.bats(15)pass locally, inside the Claude Code sandbox. Both suites stub every
external tool and use
BATS_TEST_TMPDIR, so neither has anrm.under both BSD grep and GNU grep 3.12.
disk-space-alert.sh 500on ASIAGO, outside the sandbox, showed a realnotification.
-S infoclean; plists passplutil -lint.