Dev.to · 4 min read

Claude Code Finished an Hour Ago. Why Is Your Mac Still Hot? 9 Tools to Clean Up What AI Agents Leave Behind (2026)

Claude Code Finished an Hour Ago. Why Is Your Mac Still Hot? 9 Tools to Clean Up What AI Agents Leave Behind (2026)

The agent said "Done!" an hour ago. Your fans didn't get the memo: something is still holding port 3000, a test watcher is chewing a core, and the disk has less free space than it did this morning. Coding agents are great at starting things: dev servers, watchers, containers, worktrees, fresh node_modules, the odd brew install. They're much less consistent about stopping them. Here's the cleanup kit I'd keep on a Mac, sorted by what got left behind. Things still running 1. btop btop is a terminal resource monitor with a process list you can filter, view as a tree and send signals to, all with mouse support. Filter for node or python and the orphaned servers and watchers show up fast. Install it with brew install btop. 2. lsof (already on your Mac) When the next npm run dev complains the port is in use, ask macOS who has it: lsof -nP -iTCP:3000 -sTCP:LISTEN That prints the process name and PID. If it's a leftover from the agent's session, kill and you're done. No app needed; lsof ships with macOS. 3. Ollama's ps and stop If you point an agent at local models, a loaded model keeps a big chunk of memory busy. Per the Ollama docs, models stay in memory for 5 minutes after use by default. ollama ps shows what's loaded right now and ollama stop unloads it immediately. Things taking up disk 4. docker system df and prune Agents love spinning up a container "just to test something." docker system df shows how much space images, containers, volumes and build cache are using. docker system prune removes stopped containers, unused networks, dangling images and unused build cache. Volumes are left alone unless you add --volumes, which is the safe default. 5. git worktree list and prune Parallel agent sessions often run in their own worktrees, and those folders are easy to forget. git worktree list shows every checkout attached to the repo. Remove finished ones with git worktree remove , and if you already deleted a folder by hand, git worktree prune clears the stale metadata it left in the repo. 6. npkill Every experiment an agent scaffolds comes with its own dependency folder. npkill (npx npkill) scans from the current directory, lists node_modules and other heavy build leftovers with their sizes and when you last worked in that project, and deletes the one you pick with Space. Profiles cover Python, Rust and more, and --dry-run lets you look without deleting. 7. brew leaves, autoremove and cleanup If you let an agent install CLI tools, Homebrew ends up holding things you never chose. From the brew manpage: brew leaves --installed-on-request lists what was explicitly installed, brew autoremove uninstalls dependencies nothing needs anymore, and brew cleanup removes old versions and stale downloads. Both of the last two accept --dry-run, so you can check first. 8. DaisyDisk For everything the commands above don't cover, DaisyDisk scans the drive and shows usage as clickable rings, so a forgotten simulator cache or model folder is easy to spot. It can also break down "System Data" and find macOS snapshots that quietly eat space. It's a one-time purchase ($9.99 on its buy page), not a subscription. Budget the agent already spent 9. TokenBar The least visible leftover is quota. A long background session or a retry loop can burn through a plan's session or weekly window without you watching. TokenBar is a menu bar app that shows usage and reset times for Claude, Codex, Cursor, Gemini and Copilot, so after a session you can see what it actually cost and when the window resets. It doesn't add any quota. It's built on Peter Steinberger's MIT-licensed CodexBar and credits Pixel Agents. $5/month Basic or $15 lifetime Pro, macOS 14+. Quick picker What got left behind Reach for Fans spinning, mystery CPU btop "Port 3000 is already in use" lsof + kill Memory tied up by a local model ollama ps / ollama stop Old containers and images docker system df / prune Forgotten agent checkouts git worktree list / remove / prune Dependency folders everywhere npkill CLI tools you never chose brew leaves / autoremove / cleanup Space you can't explain DaisyDisk Quota you didn't watch go TokenBar What's the strangest thing you've found still running after an agent said it was finished? And do you clean up after every session, or let it pile up until the disk warning shows?

This is a summary aggregated from Dev.to. Read the complete article on the original site:

Read full article at Dev.to

More AI & Machine Learning News