Dev.to AI 🤖 Ai 👁 0 📖 7 min read

I Run Coding Agents on Three Macs. Here's What I Refuse to Delete.

What managing three AI coding-agent environments taught me about disk recovery, reproducibility, and knowing when not to clean up. On November 16, 2026, one of my development Macs had about 28 GiB of free disk space. I

What managing three AI coding-agent environments taught me about disk recovery, reproducibility, and knowing when not to clean up.

On November 16, 2026, one of my development Macs had about 28 GiB of free disk space.

I had a target of keeping at least 100 GiB available on each of my three machines.

There was a tempting opportunity to reclaim roughly 10 GiB. The files looked like candidates for cleanup, but they still had open references.

So I deleted nothing.

That particular cleanup recovered exactly 0 GiB. And I consider that the correct decision.

I run AI-assisted development across three Macs: a MacBook Pro and two other machines I refer to as M1 and M3.

The agents create code, run tests, build applications, inspect failures, and prepare changes. Over time, their environments accumulate dependencies, build artifacts, temporary workspaces, models, and evidence from previous tasks.

Disk space eventually becomes a constraint on how much work can run.

The challenge is deciding what can safely disappear without destroying something another agent still needs.

The problem wasn't just large files

When I first investigated our disk usage, I found a familiar pattern.

Each coding task could create its own working directory. Some tasks installed dependencies; others generated Next.js build output. Completed tasks were moved into archive directories.

But archiving a workspace didn't make its generated files disappear.

On October 23, an archived area on our Pro machine had grown to approximately 273 GiB. Within it, 262 directories of node_modules and .next artifacts accounted for about 120.8 GiB of measured target-side storage.

A cleanup limited to artifacts classified as regenerable was followed by a whole-volume free-space increase from 56.2 GiB to 165.5 GiB.

That was a useful recovery. It wasn't proof that every future cleanup would be safe.

The target-side size and the 109.3 GiB change in free space are different measurements. APFS sharing and concurrent disk activity mean they cannot be treated as identical.

And the detailed safety evidence available for an earlier single-directory deletion wasn't independently reconciled for all 262 later targets.

I learned to keep that limitation visible instead of letting a successful cleanup become a blanket rule.

What happened across the three Macs

Here are selected observations from November 16, 2026, in Japan time.

Machine Observation Result
M1 Approximately 55 GiB to 57.1 GiB free 1.69 GiB recovered in a bounded operation
M3 Approximately 25 GiB to 28.0 GiB free 3.17 GiB recovered
M3, later operation 27.9 GiB to 29.1 GiB free Approximately 1.19 GiB recovered
M3, subsequent inspection About 28 GiB free 0 GiB recovered; protected candidates retained
Pro Approximately 101.3 GiB free at inspection No further deletion because active work was protected

These are separate observation windows, not a continuous benchmark. The measurements do not establish sustained capacity or improved execution speed.

The successful bounded removals targeted regenerable dependency and build output.

The zero-recovery inspection was different.

On M3, a large data area still had open-file references. Other potential candidates lacked sufficient proof of safe restoration or deletion authority.

I couldn't establish that removing them would preserve ongoing work.

The correct action was to leave them untouched.

The overall three-machine capacity objective remained incomplete.

A directory name is not a deletion policy

It's tempting to treat certain names as automatically disposable:

  • node_modules — potentially rebuildable dependencies, provided the exact environment and installation inputs are retained
  • .next — generated Next.js output, provided the build inputs and configuration are available
  • Archived worktrees — potentially inactive, but still capable of holding unique source or unmerged commits
  • Logs and execution receipts — possibly the only retained evidence explaining a failed or partially completed task
  • Downloaded models and datasets — potentially expensive, difficult, or impossible to reconstruct identically

The category tells me what to investigate. It doesn't authorize deletion.

For example, node_modules is usually regenerable. But I still need to know whether the workspace is active, whether its dependency lockfile exists, and whether the required package versions remain available.

A model file presents a different question. Even if it can technically be downloaded again, another running process may be using it. Its precise version might also matter to reproducibility.

I treat active work, unshared changes, evidence, secrets, and files without verified restoration paths as protected.

My pre-deletion inspection

I prefer a bounded, read-only inspection before considering any destructive operation.

For a Git-backed workspace, the starting point is simple:

# Set this to the exact repository under inspection.
repo="/path/to/repository"

git -C "$repo" rev-parse HEAD
git -C "$repo" status --porcelain=v1
git -C "$repo" worktree list --porcelain

# Inspect local branch commits absent from remote refs.
git -C "$repo" log --branches \
  --not --remotes --oneline

# Observe current volume capacity.
df -k "$repo"

These commands don't delete anything.

They establish part of the workspace's current state, but they aren't enough by themselves.

I also inspect the exact candidate directory, relevant processes and open files, active task ownership, backup or regeneration evidence, and the scope of any existing authorization.

For a narrowly identified directory, du -sk can estimate allocated size, while a scoped lsof +D inspection may reveal open-file references. The latter can be expensive on large trees, and a lack of visible results is not conclusive proof of safety.

I don't execute a deletion just because a shell command returned successfully or produced no output.

The difference between removing bytes and recovering space

Another lesson came from comparing directory sizes with actual available capacity.

Suppose a cleanup candidate is measured at 20 GiB.

After removal, the filesystem reports only 12 GiB more free space.

I do not report that the machine recovered 20 GiB.

Those two measurements answer different questions.

du helps describe the selected files. df measures available space on the filesystem. Shared blocks, snapshots, and concurrent activity can affect the observed change.

For a meaningful recovery record, I retain the target, its measured size, the volume's free capacity immediately before and after the operation, and the state of protected work.

I also distinguish immediate recovery from sustained headroom.

On our Pro, the October 23 cleanup was followed by approximately 167 GiB free the next morning, 159 GiB later on October 24, and 158 GiB on October 25.

Capacity recovery was accepted on October 25 after additional checks. That did not establish improved CPU performance, reduced task latency, or permanent resolution of resource pressure.

And by November, maintaining free space remained an active operational problem.

I turned the decision process into a Skill

Repeating this investigation manually was becoming part of the problem.

Every time disk pressure returned, I had to reconstruct the same questions: which workspace owns this directory, whether it is active, what created the files, and how they can be restored.

I began encoding that process in a local skill named mac-capacity-recovery.

Its purpose is to standardize the investigation and preserve successful recovery patterns.

The workflow follows a small sequence:

  1. Measure current headroom and identify exact candidates.
  2. Check active ownership, references, Git state, and restoration evidence.
  3. Perform only specifically authorized, bounded cleanup operations.
  4. Measure the resulting free space and verify that protected work remains intact.
  5. Record the result, including an explicit stop when safety cannot be established.

A Skill makes the procedure easier to reuse. It doesn't grant additional filesystem permissions or make uncertain deletions safe.

The local rollout and its acceptance also need to be distinguished. Having a Skill file on one machine doesn't prove that every host has the same active, verified procedure.

For me, the useful improvement is that the next inspection can start from a known method instead of rediscovering the same precautions.

Sometimes the most valuable result is zero

When disk space is low, an agent naturally has an incentive to find something to remove.

That's where a cleanup workflow needs a boundary.

A process that always finds files to delete may appear productive. But it could be making the environment less reproducible with every successful run.

On November 16, M3 still had far less free space than my operating target.

The large candidate with open references remained protected. Other candidates lacked the evidence required for safe removal.

The cleanup stopped without reclaiming additional space.

I still had a capacity problem to solve.

But I hadn't converted a storage problem into a source-integrity or recovery problem.

That distinction matters when you operate AI coding agents over weeks or months instead of running a single coding session.

What I would change from the beginning

If I were setting up these machines again, I would design workspace retention alongside workspace creation.

Every temporary workspace would have an identifiable owner, a source revision, a retention reason, and a clear point at which generated artifacts could become cleanup candidates.

I would keep restoration instructions close to the files they describe.

And I would measure physical headroom after cleanup rather than relying on the size of selected directories.

Not every development environment needs this level of tracking. A disposable local experiment is different from an agent workspace containing unmerged changes or evidence required for a release.

The distinction is the point.

An AI coding agent should be able to explain why a file is safe to remove before it removes it. When it cannot, keeping the file is a valid outcome.

I previously wrote about the gap between CI success and actual macOS installation in CI Can Be Green While the macOS Installer Fails.

This is another part of operating coding agents beyond the code-generation step: keeping the machines usable while preserving the work they produce.

I'm curious how other developers handle this.

Do your AI coding agents clean up their own workspaces? If they do, what prevents them from deleting something another task still needs?

I'm the founder of Netsujo, based in Kyoto, Japan. I work on AI agent systems, software engineering, and reliable execution workflows. The observations in this article come from our internal development operations; they are not presented as an independently reproduced public benchmark.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.