A macOS menu-bar app that automatically closes inactive applications and cleans up their caches β powered by Apple's on-device AI.
Your Mac accumulates open apps you forgot about. App Guardian silently watches which app you're using, and after a configurable idle period it asks Apple's on-device AI whether the app is safe to close β then quits it and cleans its cache directory.
No cloud. No API keys. Runs entirely on your machine.
- π΅οΈ Passive monitoring β polls the frontmost app every 10 seconds; zero performance impact
- π€ Apple Intelligence decisions β uses apfel to ask Apple's Foundation Model whether an app should be closed (skippable)
- π§Ή Cache cleanup β deletes
~/Library/Caches/<bundle-id>after each close - π« Exclusion list β protect any app from ever being touched
- β± Configurable timeout β default 30 min, change it in the menu
- π Force-quit fallback β graceful quit first; force-kills if the app doesn't respond in 10 s
- π Statistics screen β today / 7-day / all-time closes and cache freed, top closed apps
- π Persistent log β every action written to
~/.config/app-guardian/guardian.log - π’ Coloured menu-bar icon β custom green ghost, always visible
| Requirement | Notes |
|---|---|
| macOS 26 (Tahoe) | Required for Apple Intelligence via apfel |
| Apple Silicon | M1 or later |
| Python 3.11+ | brew install python |
| apfel | Optional β disable in menu if not installed |
No apfel? The app works fine without it. Toggle off "Use Apple Intelligence" in the menu and it will close all idle apps that aren't on the exclusion list.
brew tap TomGranot/app-guardian
brew install app-guardian
brew services start app-guardian# 1. Clone
git clone https://github.com/TomGranot/app-guardian.git
cd app-guardian
# 2. Install apfel (optional but recommended)
brew tap Arthur-Ficial/tap && brew install apfel
# 3. Install Python dependencies
./setup.sh
# 4. Run
./run.sh./install-agent.shThis installs a LaunchAgent that starts App Guardian on login and restarts it if it crashes.
To uninstall:
launchctl unload ~/Library/LaunchAgents/com.appguardian.menubar.plist
rm ~/Library/LaunchAgents/com.appguardian.menubar.plistClick the π» icon in your menu bar:
| Menu item | What it does |
|---|---|
| β Monitoring ON | Toggle monitoring on/off |
| π N apps tracked | Click to see idle times for all tracked apps |
| β± Timeout: 30 min | Set the inactivity threshold |
| π« Excluded Appsβ¦ | Edit the list of apps that are never closed |
| β Use Apple Intelligence | Toggle apfel AI decisions on/off |
| β Clean cache on close | Toggle cache cleanup on/off |
| π§Ή Clean All Caches Now | One-shot cache clean for all running apps |
| π Statisticsβ¦ | View close history and cache savings |
| π View Log | Open the log in Console.app |
When an app has been idle past the timeout, App Guardian sends a one-sentence prompt to the local Foundation Model:
macOS app: 'Slack' Idle: 45 min RAM: 312 MB
Should this app be auto-quit when idle?
Reply with exactly one word β YES or NO.
The model's YES/NO answer is cached for the session so it only calls the model once per app. If apfel is unreachable, the app defaults to closing.
Settings are stored at ~/.config/app-guardian/config.json:
{
"enabled": true,
"timeout_minutes": 30,
"excluded_apps": ["Finder", "Dock", "Siri", "..."],
"apfel_url": "http://localhost:11434/v1",
"use_apfel": true,
"clean_cache": true,
"force_quit_timeout": 10
}- Everything runs locally β no network requests except to
localhost:11434(apfel) - History is stored at
~/.config/app-guardian/history.json(never uploaded anywhere) - No telemetry, no analytics, no accounts
PRs welcome. Open an issue first for anything beyond a small fix.
git clone https://github.com/TomGranot/app-guardian.git
cd app-guardian && ./setup.sh
python app_guardian.py # runs directly for developmentMIT β see LICENSE.