News for hackers. Stuff that matters.
Re:Codex is EATING my Mac's disk space by glenngillen on Saturday October 17, 2026 @05:37PM (#50135380)
I'd been running into a lot of disk pressure on my system from agents running. I discovered two main causes:

- my approach to using git worktrees for all work. Not entirely surprising, the duplicated build artifacts in each worktree being the main culprit here. There were some limited gains to be had by just being more efficient with how builds were managed but ultimately I just had to limit the number of concurrent features I was working on in a couple of particularly large repos.

- more insidious was the fact I was actually hitting memory limits more than I realised and causing my mac to have to swap heavily. The system was surprisingly still quite performant while this was happening... until it wasn't. Unfortunately as best I can tell the only "fix" when this happens is to restart the machine. There's no way to have the system reclaim any of the swap space once it's written to disk. Which if you have it thrash a couple of times a day (especially easy if you leave something running overnight) adds up very quickly.

Re:Codex is EATING my Mac's disk space by _matthew_ on Saturday October 17, 2026 @07:54PM (#50136354)
I ran into similar issues. Sometimes though there are good language specific solutions. For Rust based worktrees you should definitely check out https://mr-boxington.jdx.dev/ .

Regarding swapping, are you sure it's not just from ram backed tmpfs partition? For me that was it and most of the swap was from /tmp. So I created an agressive job that runs frequently to delete all tmp files not used in the last ~2 hours without any command holding handles to it.

The other thing I found was that there were a bunch of leftover processes from prior coding agents forking commands and just leaving them. So I had to build a system into my agent spawner to automatically launch each agent session in a cgroup whose processes all get killed on task completion.

Re:Codex is EATING my Mac's disk space by singularity2001 on Saturday October 17, 2026 @05:53PM (#50135491)
switching to copy on write worktrees is the biggest game changer it should become common knowledge pretty soon and it's already available on most operating systems
Re:Codex is EATING my Mac's disk space by jwiz on Sunday October 18, 2026 @12:58AM (#50138038)
He's saying the build artifacts themselves are consuming the space
Re:Codex is EATING my Mac's disk space by glenngillen on Sunday October 18, 2026 @01:32AM (#50138185)
thanks to the parent you're replying to, I discovered there's numerous projects that try to retrofit CoW into worktrees + also fill in the gaps for mostly-shared data like build artifacts! I've decided to take lane (https://github.com/lukeed/lane) for a spin as I type to see how it goes.
Re:Codex is EATING my Mac's disk space by thesz on Sunday October 18, 2026 @02:40AM (#50138484)
You also need a deduplication, because with simple copy on write you will have a copy for writing the same - change a byte in a file, get a copy, then change it back, get a duplicate.

Deduplication in ZFS needs 5G of RAM for 1TB of logical data - if you expect your agents to produce 2TB of data, you should provide 10G of RAM for deduplication.

Re:Codex is EATING my Mac's disk space by malfist on Sunday October 18, 2026 @10:09AM (#50141230)
Why are your agents expected to produce 2TB of data? Not criticizing, I'm curious. Outside of classifiers I don't have any of my agents produce data, they produce scripts to produce data so it can be deterministic
Re:Codex is EATING my Mac's disk space by vikramkr on Monday October 19, 2026 @12:20PM (#50154290)
Tons of screenshots to check for visual bugs - they have a tendency to run smoke tests and benchmarks for everything - and as tokens get cheaper it's easier to fan out more and more subagents that set up their own environment etc. if you want to get the capabilities you're paying for out of them you have to let them run in a loop hill climbing until everything works. But if you don't invest in specifically supporting the agentsby building a good dev environment for them - sure they're good enough to unblock themselves but whatever they do is going to be chock full of slop (like the crashpad reports...). And they won't clean up after themselves. Partly because dumber models and smart models hitting a stupid spike will clean up after themselves by wiping your dev server and breaking all the other sessions that unblocked themselves in chaotic ways, partly because you might have updated permissions/instructions after a previous rather annoying experience like that to strictly ban commands that delete files and containers and stuff. I was running into my machine crashing after hundreds of gigs of storage space were consistently being eaten up over a day and it was all slop. Dead worktrees, "smoke tests," dead docker containers, dead anonymous volumes, files full of screenshots, playwright screen recordings at way too high a resolution, clones of a dev DB, saved logs, etc. a lot of that was fixed by a couple instructions in a markdown file telling the agents to not be stupid about that but a lot of the rest requires actually investing in the agent's dev environment so like they can run their own independent server without doing some ad hoc nonsense that leaves behind yet another random docker volume
Re:Codex is EATING my Mac's disk space by thesz on Tuesday October 20, 2026 @01:32AM (#50161725)
Any substantial work on substantial software project can give you that. It is often the case with C++ that some logic resides in header files included by most of the project. If you change that logic, you have to rebuild your project and you will get mostly the same object and/or executable files for most of source code, but still slightly different [1].

[1] https://stackoverflow.com/questions/75452073/understanding-e...

Builds of some of projects I've been working on required 20Gbytes and more of disk space.

Re:Codex is EATING my Mac's disk space by singularity2001 on Sunday October 18, 2026 @05:05PM (#50145468)
change a byte ... change it back, get a duplicate.

What are realistic scenarios in which you change a byte back?

Re:Codex is EATING my Mac's disk space by vikramkr on Monday October 19, 2026 @12:04PM (#50154078)
Agents do weird shit
Re:Codex is EATING my Mac's disk space by thesz on Tuesday October 20, 2026 @01:34AM (#50161739)
Add debug logging, delete debug logging.
Re:Codex is EATING my Mac's disk space by josephg on Saturday October 17, 2026 @09:08PM (#50136836)
On Linux I’ve taken to disabling swap before doing memory heavy operations. Claude will carelessly run benchmarks and tasks which gobble up all available memory. When that happens, I’m not sure why but my system becomes unresponsive and I can’t kill the process. If I disable swap, the oom killer takes care of whatever Claude was doing and Claude figures it out after the fact.
Re:Codex is EATING my Mac's disk space by trollbridge on Saturday October 17, 2026 @10:02PM (#50137130)
You can use systemd-oomd to force OOM killing without having to completely disable swap. It's quite handy for this especially since you can tell it to aim its OOM heavy artillery at only certain tasks (i.e. only processes that are descendants of claude-cli.)
Re:Codex is EATING my Mac's disk space by treve on Sunday October 18, 2026 @01:10AM (#50138092)
One thing to also look out for is some distros will but /tmp in RAM, and claude loves to fill that
Re:Codex is EATING my Mac's disk space by machomaster on Sunday October 18, 2026 @12:24PM (#50142491)
Using Zswap might help you.
Re:Codex is EATING my Mac's disk space by monster_truck on Saturday October 17, 2026 @09:29PM (#50136935)
It's so goddamn bad, I wish it was easier to turn all of this garbage off. I used to spend time defining parallel work lanes to issue to subagents as frontloaded development work with set validation checkpoints and it worked great. Now attempting to do this with 8, 16 subagents will balloon out into hundreds of gigs of fucking mess

Copy on write worktrees do absolutely nothing to solve this, either. The build artifacts alone will do it

Re:Codex is EATING my Mac's disk space by nullpoint420 on Sunday October 18, 2026 @05:38AM (#50139480)
Agreed. I thought I was being smug by telling my agents to use btrfs for specific workloads. Sure, it took me longer to run out of space, but I of course ended up running out of space
Re:Codex is EATING my Mac's disk space by satvikpendem on Saturday October 17, 2026 @10:36PM (#50137334)
For the first part you might be interested in Anthropic recently creating their own version control system that's server based like SVN, and it seems to ease their memory pressure too. It's called `scion`.
Re:Codex is EATING my Mac's disk space by treve on Saturday October 17, 2026 @10:47PM (#50137395)
If git used reflink / CoW when available it would make this a lot faster.
Re:Codex is EATING my Mac's disk space by bentcorner on Sunday October 18, 2026 @12:41AM (#50137976)
My work provides me a Mac laptop plus remote Windows VMs and I've completely stopped using my Mac for agent builds/tests - I give them ssh access to WSL instances and they can go hog wild on the VMs.

It's all a bit adhoc - agents still need to pull (or I need to keep the main enlistment up to date on these machines) - I'm thinking of using containers or something else like github actions keep things cleaner, but right now it's "good enough".

Regardless I'm pretty happy with how it's working so far. Previously I'd be letting agents do work in the background and they'd kick off builds in the middle of a meeting or something and I'd start dropping video streams until I killed everything.

Re:Codex is EATING my Mac's disk space by feelamee on Sunday October 18, 2026 @05:54AM (#50139556)
tho, I also met this problem and found a solution for me - develop all in one worktree on a single branch, then cherry-pick to the second worktree to the needed branch.

So, only first worktree is built: - less space needed. - less time spent on build, which is usually caused by switching branches. - you are not required to merge/rebase of master branch to solve conflicts, which also cause long time rebuilds.

Re:Codex is EATING my Mac's disk space by tonytamps on Sunday October 18, 2026 @08:16AM (#50140417)
I'll take a stab in the dark here and say that if you're using Docker (or Rancher, etc..) I found they aren't releasing memory properly and caused a similar issue to what you're describing.

Switching to Orbstack solved the problem for me because of their memory management efforts. Just wanted to mention it in case it leads to an easy fix for someone else too.

Re:Codex is EATING my Mac's disk space by veidr on Sunday October 18, 2026 @10:50AM (#50141593)
same here — not trying to shill OrbStack, but switching to it has "magically" solved weird problems that would otherwise have consumed my actual time to debug
Re:Codex is EATING my Mac's disk space by tonytamps on Sunday October 18, 2026 @10:56AM (#50141647)
It does seem like magic but I hope it's excellent engineering. It was valuable enough for me to start paying for it.