Accidentally created my first fork bomb with Claude Code
A developer's journey into agentic AI takes an unexpected turn, culminating in an accidental Claude Code fork bomb that bricks their machine and nearly racks up a $3800 API bill. The author details their reluctant embrace of AI coding, showcasing the custom 'skills' and hooks they built to wrangle Claude's eccentricities and optimize their workflow. This post resonates on HN for its candid look at real-world AI development challenges, highlighting both the power and pitfalls of integrating large language models into daily programming tasks.
The Lowdown
The author recounts a chaotic workday start, discovering their computer frozen and hot, realizing they'd inadvertently unleashed a fork bomb via a Claude Code hook. This technical mishap, which ran overnight, nearly led to a hefty API bill and provided a stark lesson in AI system interaction.
- The incident stemmed from a
SessionStarthook designed to spawn two background Claude Code instances, which recursively multiplied, consuming all system resources. - Debugging revealed hundreds of Claude Code processes, quickly identifying the recursive spawning as the cause of the system freeze.
- A crucial factor preventing a much larger API bill was Claude Code's "shitty" and bloated architecture, where each instance consumed so much memory it crashed the system before excessive API calls could be made.
- The author's journey into agentic AI began reluctantly, driven by a desire not to be left behind, leading them to experiment with Claude Code and integrate it into their
nvim/tmuxworkflow. - They developed several custom "skills" to combat Claude's limitations, such as
/yadumbfor logging failed commands,/mementofor conversation history, and/yablindto efficiently manage the context window. - Other notable skills include
/adhdfor personalized task management and/moneyfor maintaining project-specific context due to Claude's poor memory. - The story also details
PreToolUseandPostToolUsehooks for loggingBashcommand executions and their statuses. This firsthand account offers a humorous yet insightful look into the frustrations and ingenuity involved in working with nascent AI coding agents, demonstrating how even "bad" software can sometimes inadvertently save the day.