跪拜 Guibai
← All articles
Swift · SwiftUI · Artificial Intelligence

AI Agents Drained 500 GB of MacBook Disk in One Week: Swift Weekly #160

By 东坡肘子 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Agent-heavy development now consumes disk as fast as it consumes tokens, and Apple's per-gigabyte upgrade pricing turns that into an expensive failure mode instead of a cheap fix, so storage governance (backup exclusions, snapshot cleanup, temp-dir hygiene) has become part of running agents at all. Shared Simulators and DerivedData can also silently invalidate another agent's test results, which breaks trust in parallel workflows.

Summary

AI coding agents turned a MacBook that normally holds 500–600 GB of free disk into a machine that ran completely dry twice in one week. The first outage traced to an agent generating data inside directories Time Machine was still backing up: local snapshots kept accumulating blocks as files churned, and clearing them plus adding exclusion rules brought the space back. A second incident came from a test script the agent wrote, which called `mkdtempSync` to make a temp directory but no cleanup, so each QA run unpacked the entire 5.7 GB Design repo onto the drive.

Because agents push development forward in a more aggressive, parallelized way than humans do, storage now shares billing with CPU and RAM for AI workflows. Apple's famously expensive storage pricing makes buying a bigger disk an unattractive fix, so the practical answer is behavioral: strict environment boundaries and cleanup rules for agents, or no disk survives brute-force consumption.

Elsewhere in the issue: Instruments-based SwiftUI redraw diagnosis, the iOS 27 Now Playing framework's unified media session model, fold-aware layout for iPhone Duo, and szt, a Swift disk analyzer that scans 667,000 files across 123 GB in 2.4 seconds versus du's roughly 17.

Takeaways
— A MacBook that normally keeps 500–600 GB of free disk ran completely dry twice in one week of agent-driven work.
— Time Machine local snapshots consumed the space because agent working directories stayed in backup scope; excluding them and clearing the snapshots fixed it.
— An agent-written test script called `mkdtempSync` without cleanup, so every QA run unpacked a full 5.7 GB Design repository; repeated runs piled up junk data.
— Both disk incidents were caused by the agent and resolved with the agent's help, matching a working style that is more aggressive and parallelized than humans' linear rhythm.
— szt, a Swift CLI disk analyzer, scanned 667,000 files totaling 123 GB in 2.4 seconds using getattrlistbulk and multithreading, versus about 17 seconds for du.
— SwiftUI performance analysis needs update frequency and trigger causes alongside single `body` execution time.
— Parallel agents on one Xcode project should isolate DerivedData, Simulator, and build configurations; a shared Simulator let one agent run and verify an app another agent had built.
— An ICP record exemption for an offline China App Store app took about 6 days from submitting through Apple Developer to PDF upload and approval, and applies only to the specific app requested.
Conclusions

Storage is the failure mode AI workflows hit late: agents exhaust CPU and RAM loudly, but a disk fills quietly until some unrelated process fails, so disk monitoring and cleanup rules belong in the same loop that reviews generated code.

Agents caused both of the week's disk crises and then helped clean them up, which frames AI workflows as self-generating overhead: the same parallelism that accelerates development also produces messes at a rate humans alone would never hit.

Git worktrees split the source tree but not the runtime, so the shared-Simulator failure generalizes: any environment state shared between agents is a place where one agent's green result can be silently poisoned by another.

SwiftUI deprecating Text's + operator from iOS 26 is an API-design lesson: keeping the full localizable sentence inside interpolation is what lets translators reorder content, and that outweighs the convenience of concatenation.

Concepts & terms
Time Machine local snapshots
Backup copies macOS keeps on the local disk when the backup destination is unavailable; the data blocks they retain for changed and deleted files can silently accumulate and eat a large share of free space.
mkdtempSync
A Node.js call that creates a temporary directory and returns its path; the caller owns cleanup, so omitting it leaks files that pile up across repeated runs.
getattrlistbulk
A macOS system call that retrieves file metadata in bulk, letting disk analyzers like szt scan large trees with multithreading far faster than du.
DerivedData
Xcode's per-project build-output folder; when multiple agents share it along with a Simulator, builds and test runs overwrite each other and quietly invalidate verification.
From the discussion
Featured comments
season_zhu 1 likes

Anyway, I don't know where the disk went. There are clearly only a few projects left, but everything is dedicated to AI. I often use AI to help me analyze and troubleshoot, but it just never suffices.

东坡肘子

AI occupies, AI checks, AI deletes.

season_zhu  → 东坡肘子  · 1 likes

AI spent your tokens.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗