Skip to content

feat: weekly cache cleanup and daily low-disk alert - #13

Merged
twistedmelonman merged 4 commits into
mainfrom
claude/feat-disk-space-automation-20261022
Oct 23, 2026
Merged

twistedmelonman merged 4 commits into
mainfrom
claude/feat-disk-space-automation-20261022

Conversation

@twistedmelonman

Copy link
Copy Markdown
Member

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 guard
and 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 prune and
    xcrun simctl delete unavailable under timeout. It deletes no path
    itself. A guard test fails if a code line calls rm, rmdir, mv,
    unlink, shred or -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 the
    disposable macOS VMs that Protocol 3's new destructive-code rule needs.
  • README: both scripts; the workflows line no longer lists a removed
    workflow or says ralph-burndown runs on mimolette.

Neither LaunchAgent is installed yet. That happens after merge.

Testing

  • tests/disk-cleanup.bats (17) and tests/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 an rm.
  • The no-delete guard pattern was checked against 6 bad and 6 good lines
    under both BSD grep and GNU grep 3.12.
  • disk-space-alert.sh 500 on ASIAGO, outside the sandbox, showed a real
    notification.
  • shellcheck -S info clean; plists pass plutil -lint.

Claude Code Bot 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
twistedmelonman merged commit 272dc44 into main Oct 23, 2026
6 checks passed
@twistedmelonman
twistedmelonman deleted the claude/feat-disk-space-automation-20261022 branch October 23, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant