← Back to brief

reference system hygiene

memory · reference_system_hygiene.md

What it does

Runs every 60 minutes (launchd com.skyrun.system-hygiene). Self-heals what bash can fix; queues the rest for live-ea to handle via the scheduled-tasks MCP.

Auto-fixes (no human, no Claude Code session needed)

1. Claude Code zombies (>2h old)kill -TERM then kill -9 2. Oversize logs (>5MB) → trim to last 1000 lines 3. MCP allowlist drift → if any of the 9 explicitly-disabled MCPs got re-enabled (Claude Desktop update), reset to {"isEnabled": false} 4. Heartbeats >30 days old → delete 5. launchd agents failing repeatedly (>5 failures in last 200 log lines)launchctl unload 6. Stale lock files (/tmp/skyrun_*.lock >1h old) → remove 7. Fix-queue items >24h old → prune

Detects + queues for live-ea

Things requiring the scheduled-tasks MCP (which bash can't reach):

Cron-aware staleness detection

Tasks are NOT flagged as stale during their off-hours. Specifically:

This eliminates weekend / off-hours false positives.

Status logic

ntfy push policy

Live-ea queue handler (Step 7a)

live-ea/SKILL.md Step 7a reads the fix queue every 20 min during business hours:

Files

PathPurpose
Script~/Library/Application Support/SkyRun/system_hygiene.sh
Launch agent~/Library/LaunchAgents/com.skyrun.system-hygiene.plist
Hygiene log~/Library/Logs/skyrun-system-hygiene.log
Fix queue~/Library/Application Support/SkyRun/fix_queue.jsonl
Heartbeats~/Library/Application Support/SkyRun/health/{date}_system-hygiene_*.json

What gets surfaced in the morning brief

Section F of nightly-consolidation reads the latest system-hygiene heartbeat. If status != ok, it flags in morning brief Systems status block as YELLOW with the summary. Anything killed gets a count.

Backstory — why it exists

Discovered 2026-04-26 morning: 56 Claude Code processes running, 11 MCPs auto-enabled, fswatch agent failing 19+ times/day. Cause: scheduled tasks that don't clean-exit, plus auto-installed MCPs on Claude Desktop updates, plus my fswatch experiment that couldn't get FDA. Cleanup brought it to 6 processes / 2 MCPs / fswatch unloaded. The watchdog prevents recurrence — autonomously.

Files

WhatPath
Script~/Library/Application Support/SkyRun/system_hygiene.sh
Launch agent~/Library/LaunchAgents/com.skyrun.system-hygiene.plist
Log~/Library/Logs/skyrun-system-hygiene.log
Heartbeats~/Library/Application Support/SkyRun/health/{date}_system-hygiene_*.json

Manual run

bash
bash "/Users/josephbowens/Library/Application Support/SkyRun/system_hygiene.sh"
cat "$(ls -t ~/Library/Application\ Support/SkyRun/health/system-hygiene | head -1)"

Tuning

If too noisy, raise the per-task staleness tolerances in system_hygiene.sh case block. If process threshold needs adjusting, change the >20 check.

Currently disabled MCPs (re-enable via Claude Extensions Settings/{name}.json)

These were auto-installed but redundant or unused. To re-enable, set {"isEnabled": true} in the matching JSON file:

Active: filesystem (Anthropic standard), fantastical-mcp (calendar — used by Section K pre-meeting briefs).

fswatch / PWA auto-rebuild — currently DISABLED

com.skyrun.pwa-autorebuild was unloaded 2026-04-26 because it failed 19+ times/day (TCC blocked /usr/bin/python3 from reading Desktop). Layer 2 (live-ea rebuilds every 20 min during business hours) is the active freshness mechanism.

To re-enable when FDA is granted: launchctl load ~/Library/LaunchAgents/com.skyrun.pwa-autorebuild.plist.

Related