Your Mac Is Losing Gigabytes to AI Worktrees (Clean Storage and Protect Battery With Mole + AlDente)

November 23, 2026•6 min read•Updated Nov 2026
On this page+

Check System Settings -> Storage on a developer's MacBook and you will usually find the same annoyance: 100+ GB stuck under "System Data" with zero breakdown of what is safe to delete.

If you run AI coding agents every day, there is an even faster leak sitting beside Xcode caches and Docker images: isolated worktrees.

Every time Codex, T3 Code, or a subagent spins up a fresh worktree branch, it ends up with its own node_modules, .next, .open-next, .venv, or .wrangler directory. On a 256 GB MacBook Air (~228 GB usable), twenty tasks a week can push disk usage past 90% before you notice. Meanwhile, leaving that same laptop plugged into your monitor all week holds the battery at 100% under heat while containers and builds compile.

I rely on two lightweight tools to stay ahead of both: Mole for terminal disk cleanup and diagnostics, and AlDente for desk charge limits.


Part 1: Find and Purge Hidden Gigabytes With Mole

Mole is an open-source macOS CLI cleaner and system monitor—fast, scriptable, and completely transparent about what it touches before deleting anything.

brew install mole

You can invoke it as mole or the shorter alias mo. Running mo alone opens the main menu, or you can run each tool directly.

Check Disk and Battery Pressure First (mo status)

Before guessing what needs cleaning, check mo status for a live view of disk usage, purgeable APFS space, swap pressure, and battery health/cycles:

Annotated mo status terminal dashboard showing memory swap pressure, 208G used out of 228G APFS storage, and battery health metrics
mo status inside Ghostty highlights APFS storage saturation (208G used / 20G free) alongside RAM swap pressure and battery cycle health.

If you want to pipe telemetry into a script or quick check, mo status --json prints the same snapshot as JSON.

Always Dry-Run System Caches First (mo clean)

Never let a cleanup tool delete caches blindly. Preview every category and byte total with --dry-run:

mo clean --dry-run

If you also want to inspect root-level system caches, authenticate sudo upfront with sudo -v && mo clean --dry-run.

Annotated mo clean --dry-run Ghostty output showing dry run preview mode, 25 whitelist rules, and gigabytes in user app caches
mo clean --dry-run lists recoverable user caches and logs up front while keeping 25 core whitelist rules active by default.

Once the dry-run looks safe, run the sweep or add exceptions with --whitelist:

mo clean
mo clean --whitelist

Target AI Coding Worktrees With mo purge

mo purge is the command that reclaims the most space for developers. It scans configured workspace roots and removes stale build artifacts (node_modules, .next, dist, target, .venv) from dormant branches and repos without touching source code.

Configure ~/.config/mole/purge_paths interactively via mo purge --paths, or point it straight at your agent worktree folders:

~/.codex/worktrees
~/.t3/worktrees
~/projects

Then preview and clean dormant build artifacts cleanly:

mo purge --dry-run
mo purge

Every Other mo Command Worth Keeping

CommandPurposeSafe preview / option
mo cleanClears user/system caches, old logs, crash reportsmo clean --dry-run
mo purgeDeletes stale build artifacts across worktrees and reposmo purge --dry-run
mo analyzeInteractive TUI disk explorer (mo analyze /Volumes for drives)Read-only
mo uninstallRemoves apps along with leftover preferences and cachesmo uninstall --dry-run
mo installerFinds and removes leftover .dmg and .pkg installersmo installer --dry-run
mo slimStrips unused Intel (x86_64) slices from Apple Silicon Universal binariesmo slim --dry-run
mo optimizeRefreshes system caches and background servicesmo optimize --dry-run
mo statusLive CPU, RAM/swap, APFS disk, and battery dashboardmo status --json
mo historyReviews past Mole cleanup runsmo history --json
mo touchidEnables Touch ID authentication for sudo promptsmo touchid enable --dry-run

(Enabling mo touchid is useful on its own—you can approve sudo in Ghostty with a fingerprint instead of retyping your password.)


Part 2: Cap Desk Charging at 80% With AlDente

Freeing SSD space solves sluggish builds, but keeping a MacBook plugged into a charger 90% of the week wears down battery cells just as steadily.

macOS's built-in Optimized Battery Charging tries to predict when you will unplug—so anyone working irregular hours or long overnight runs still ends up pinned at 100% while Docker, Next.js builds, and local agents generate sustained heat.

Comparison diagram contrasting uncapped 100% desk charging with AlDente's 80% hardware charge ceiling and Heat Protection
Holding an 80% charge ceiling at your desk avoids sustained high-voltage heat stress; lift it to 100% only before traveling.

AlDente enforces deterministic limits straight in your menu bar:

  1. Set an 80% daily cap (or 70–80%): Once charged to your limit, external power runs the Mac directly without holding cells at 100% voltage.
  2. Enable Heat Protection: Pauses charging automatically whenever battery temperature climbs under heavy builds or container workloads.
  3. Top up to 100% on travel days: Click once to lift the cap before stepping away from your desk or heading to a flight.
  4. Run monthly calibration: Because staying capped at 80% for weeks can let macOS's percentage estimate drift, cycle cleanly once a month so battery reporting stays accurate.

Weekly Maintenance Routine

  1. Run mo status and mo clean --dry-run whenever free disk drops below ~30 GB or builds start swapping heavily.
  2. Run mo purge --dry-run after wrapping multi-PR agent sprints so old .t3/worktrees and .codex/worktrees checkouts do not hoard duplicate node_modules.
  3. Leave AlDente capped at 80% on desk days and pair your runs with Amphetamine, Raycast Coffee, or caffeinate so tasks finish without mid-build sleep.

If you are refining the rest of your macOS environment, check out Every Developer Should Set Up Their Terminal Like This and 8 Mac Apps for Dev and AI Workflows.

Enjoyed this article? Share it with your network!