Show HN: Replay your Claude Code logs to count parallel session collisions Developer dooly6276 released bulkhead 0.2.0, a zero-dependency set of Claude Code hooks that blocks shell commands from parallel sessions on one machine from interfering with each other. The release adds a `bulkhead scan` command that replays past Claude Code session transcripts against the guards to count collisions, plus a new disk-guard that stops whole-disk and parallel `du` scans, and expands checkout-guard to block `git add -A` from sweeping another session's edits into a commit and to block `rm -rf` of a folder another session is working in. The tool ships 8 guards, 10 commands, a status line, 6 slash commands and 1 skill, and targets users running two or more Claude Code sessions, often one per git worktree, whose agents start dev servers, builds and test runs. English | 한국어 https://github.com/dooly6276/claude-bulkhead/blob/main/README.ko.md | 简体中文 https://github.com/dooly6276/claude-bulkhead/blob/main/README.zh-CN.md | 日本語 https://github.com/dooly6276/claude-bulkhead/blob/main/README.ja.md | Español https://github.com/dooly6276/claude-bulkhead/blob/main/README.es.md | Português Brasil https://github.com/dooly6276/claude-bulkhead/blob/main/README.pt-BR.md Hooks that stop parallel Claude Code sessions on one machine from killing each other's servers or running it out of RAM. 8 guards, 10 commands, a status line, 6 slash commands, 1 skill, zero dependencies What is it what-is-it | Scan do-you-need-it-ask-your-transcripts | Why why-this-exists | Features what-it-does | Install install | Quick start quick-start | Remote run-heavy-jobs-on-another-machine-optional | How it works how-it-works | Guards guards | FAQ New in 0.2.0: bulkhead scan do-you-need-it-ask-your-transcripts replays your past Claude Code sessions against the guards, a new disk-guard https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/disk-guard.md stops whole-disk and parallel scans, checkout-guard now stops git add -A from sweeping another session's edits into your commit and rm -rf of a folder another session works in, and basics stops commits authored as Claude. Release notes: CHANGELOG.md https://github.com/dooly6276/claude-bulkhead/blob/main/CHANGELOG.md . Claude Code hooks are small programs that Claude Code runs at fixed points, for example before every shell command, and that can stop the command and tell Claude why. bulkhead is a set of these hooks for one situation: several Claude Code sessions, and their subagents, working on the same computer at the same time. Each session acts as if it had the machine to itself. bulkhead checks each shell command against what the other sessions are doing: which processes and ports belong to which session, how much RAM is left, and which git tree each session works in. When a command would hurt another session, it is blocked, and Claude gets a message with the safer command to run instead. You need it if you run two or more Claude Code sessions at once, often one per git worktree, or your sessions and subagents start dev servers, builds and test runs. You probably do not need it if you run one session at a time and do not let it start servers or builds. Most of what bulkhead does is about sessions getting in each other's way. | Without bulkhead | With bulkhead | |---|---| | An agent restarts its dev server with pkill node , and every other worktree's server dies with it. | kill-guard blocks the command and tells the agent how to find and stop its own PID. | | Two worktrees run npm run dev . The second moves to 3001, but its agent keeps testing localhost:3000 and sees the other branch. | port-guard blocks the second start and names a free port. bulkhead port prints one on demand. | | Three sessions start next build , npm test and Playwright in the same minute, and the machine freezes. | memory-guard blocks heavy commands when RAM is low. Through bulkhead-slot , the third job waits in a queue until there is room. | | A session checks out another branch in a tree that a second session is editing. | checkout-guard blocks it and suggests git worktree add . | | A session exits, and its dev servers, test workers and watchers keep running and holding RAM and ports. | orphan-reaper stops them within seconds of the session exiting. | | A subagent polls in the foreground for ten minutes. The session cannot answer you, and the prompt cache expires. | wait-guard blocks the loop and asks for run in background: true . | | An agent wants to know what is using disk space and runs ten du at once over your home folder. Every session's builds and git status crawl for minutes. | disk-guard blocks it and asks for one folder at a time. | | Two sessions share a checkout. One runs git add -A && git commit , and the other one's half-finished edits ship in that commit. | checkout-guard blocks it and asks for the file names. | | A "clean up the worktrees" task runs git worktree remove on a worktree a second session is still working in. | checkout-guard blocks it and names the session that is still there. | You do not have to guess. Claude Code keeps every session's transcript in ~/.claude/projects , and bulkhead scan replays the shell commands in them against the guards: how many sessions you really run at once, and how often they already did the things bulkhead blocks. /plugin install bulkhead@bulkhead then, inside Claude Code: /bulkhead:scan 30d It only reads, masks anything that looks like a secret before printing, and sends nothing anywhere. port-guard and the low-RAM check are not replayed, because transcripts do not record which ports and how much RAM were in use; checkout-guard is rebuilt from which sessions were active in the same git tree at that minute. Details: docs/commands.md https://github.com/dooly6276/claude-bulkhead/blob/main/docs/commands.md bulkhead-scan . A common way to speed up work with Claude Code is to run several sessions on one repository, each in its own git worktree, each with its own subagents. git keeps the branches apart. The machine does not: every session shares the same ports, the same process table and the same RAM. That is where they collide. - Two worktrees of the same app both run npm run dev . The second one fails on port 3000, or quietly moves to 3001 while its agent keeps testing localhost:3000 and sees the other branch. - An agent restarts its own server with pkill node or taskkill /IM node.exe and takes down the dev servers and test runs of every other worktree, and sometimes its own session. - Three sessions start npm test , next build and a Playwright run in the same minute, and the machine stops responding. - A session ends and the dev servers it started keep running. The Claude Code tracker has many reports of exactly this: - 13941 https://github.com/anthropics/claude-code/issues/13941 : asked to restart a dev server, Claude ran taskkill //IM node.exe or pkill node and killed its own session. - 34754 https://github.com/anthropics/claude-code/issues/34754 : taskkill //F //IM python.exe killed two long-running simulations, after the user had marked their PIDs as off limits. - 43225 https://github.com/anthropics/claude-code/issues/43225 : asked to restart one bot, Claude force-killed every Python process on the machine, about 20 services. - 53229 https://github.com/anthropics/claude-code/issues/53229 : told to stop only unused dev servers, an agent also killed a gateway and a Postgres process it had not identified. - 15487 https://github.com/anthropics/claude-code/issues/15487 : 24 subagent processes saturated a 4 GB VPS until it had to be rebooted; a commenter froze a 24 GB Mac the same way. - 11502 https://github.com/anthropics/claude-code/issues/11502 and 25180 https://github.com/anthropics/claude-code/issues/25180 : processes started by agents outlive them, 60 Node processes in one report and 550 pytest workers in the other. claude-bulkhead is a set of small hooks that block or clean up each of these. Each one can be turned off on its own. The name is from the bulkhead pattern: one compartment taking on water should not sink the ship. | kill-guard https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/kill-guard.md Blocks pkill node , taskkill /IM , Stop-Process -Name and other kills by program name. Kills by PID pass. | port-guard https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/port-guard.md Blocks starting a dev server on a port another session already serves, and killing that session's server by port. | | memory-guard and bulkhead-slot https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/memory-guard.md Blocks heavy commands when RAM is low, and queues heavy jobs against one RAM budget shared by every session. | checkout-guard https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/checkout-guard.md Blocks git checkout , stash , reset --hard , git add -A and similar when another live session works in the same tree, and deleting a folder another session works in. | | wait-guard https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/wait-guard.md Blocks foreground sleep loops longer than 3 minutes, which make the next request rewrite the whole prompt cache. | orphan-reaper https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/orphan-reaper.md When a session exits, stops the dev servers, test workers, watchers and headless browsers it left running. | | disk-guard https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/disk-guard.md