Claude Code has a class of bugs that should make every engineer pause.
/tmp/claude-*-cwd: created by every Bash invocation, never deleted.
tmpclaude-*-cwd: same pattern, but written into your project directory. They show up in git status. They persist across sessions.
Task subagent output under /private/tmp/claude-{uid}/: no TTL, no size cap, no session cleanup.
One documented case: 537 GB from a single session, filled a 2 TB disk. The same user hit it six times in 30 days.
~/.claude/ itself: grows unbounded.
The root cause of the cwd leak is one missing line. The code reads the temp file with readFileSync, then never calls unlinkSync. An unmatched allocation in a hot path, multiplied across millions of invocations.
Every serious engineer internalises this early:
— Open a file → close it.
— Acquire a lock → release it.
— Allocate memory → free it.
— Create a temp artefact → unlink it.
— Spawn a goroutine → bound its lifetime.
We have entire language features dedicated to enforcing the pairing.
RAII in C++.
defer in Go.
try-with-resources in Java.
using in C#.
Context managers in Python.
We encoded the discipline into the syntax, the type system, the runtime, anywhere the compiler could enforce it on our behalf.
The moment your code creates something - a file, a connection, a span, a subprocess, a cache entry - you owe the system a matching teardown.
If you cannot point to the line of code where that teardown lives, you have a leak.
If you are shipping AI-adjacent tooling right now and your users have to write a shell script to keep their drives alive: you have outsourced discipline to your users' disks.
That is a design choice. It is not a good one.
#ClaudeCode #AIDrivenDevelopment #ShitHitsTheRoof #ReplaceEngineersWithAISlop
Logging the data is the ultimate "reality check" for any dev clarity beats guessing every time!