macOS memory guardrail
KlodyMem
What it is
Swift daemon watching real memory pressure and suspending heavy consumers before suffocation. Two supervised agents: the guard and the menu bar.
The architect's call
ps rss understates the MLX footprint by a factor of ~30: only phys_footprint tells the truth.What went wrong
Three beliefs measured, then dropped. Swap ratio looked like the obvious signal: it sits around 96% permanently, because the pager resizes its own file. Using it as a threshold fires continuously. Swap growth of roughly 1 GiB/s while loading a 35-billion-parameter model is normal, not an incident. And ps rss understates the MLX footprint by a factor near 30 — only phys_footprint tells the truth. Any monitoring built on rss therefore reports all is well right up until the system dies.
A perfectly silent SIGKILL 137. Copying a signed Mach-O binary with cp invalidates its signature, and macOS kills it with no usable message. The sequence that works is rm, then cp, then codesign -f -s -. Several hours lost hunting an application bug that did not exist.
What stays deliberately disabled. Force-quitting applications at the critical threshold exists in the code but is not armed. A memory guardrail that closes the user's browser without warning will not survive a week.
The figures
The code
Capabilities engaged
Related projects
- Klody Core — Control plane
- klodyfan — Fan control · anti-throttle
Your data cannot leave the building?
That is precisely the problem I solve. A 30-minute call is enough to scope an audit.