{"slug": "show-hn-replay-your-claude-code-logs-to-count-parallel-session-collisions", "title": "Show HN: Replay your Claude Code logs to count parallel session collisions", "summary": "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.", "body_md": "**English** |\n  [한국어](https://github.com/dooly6276/claude-bulkhead/blob/main/README.ko.md) |\n  [简体中文](https://github.com/dooly6276/claude-bulkhead/blob/main/README.zh-CN.md) |\n  [日本語](https://github.com/dooly6276/claude-bulkhead/blob/main/README.ja.md) |\n  [Español](https://github.com/dooly6276/claude-bulkhead/blob/main/README.es.md) |\n  [Português (Brasil)](https://github.com/dooly6276/claude-bulkhead/blob/main/README.pt-BR.md)\n\n**Hooks that stop parallel Claude Code sessions on one machine from killing each other's servers or running it out of RAM.**\n\n8 guards, 10 commands, a status line, 6 slash commands, 1 skill, zero dependencies\n\n[**What is it**](#what-is-it) |\n  [**Scan**](#do-you-need-it-ask-your-transcripts) |\n  [**Why**](#why-this-exists) |\n  [**Features**](#what-it-does) |\n  [**Install**](#install) |\n  [**Quick start**](#quick-start) |\n  [**Remote**](#run-heavy-jobs-on-another-machine-optional) |\n  [**How it works**](#how-it-works) |\n  [**Guards**](#guards) |\n  **FAQ**\n\n**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).\n\nClaude 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.\n\nbulkhead 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.\n\n**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.\n\n**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.\n\n| Without bulkhead | With bulkhead | \n|---|---|\n| 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. | \n| 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. | \n| 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. | \n| A session checks out another branch in a tree that a second session is editing. | checkout-guard blocks it and suggests `git worktree add` . | \n| 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. | \n| 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` . | \n| 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. | \n| 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. | \n| 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. | \n\nYou 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.\n\n```\n/plugin install bulkhead@bulkhead      # then, inside Claude Code:\n/bulkhead:scan 30d\n```\n\nIt 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).\n\nA 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.\n\n- 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.\n- 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.\n- Three sessions start `npm test` ,`next build` and a Playwright run in the same minute, and the machine stops responding.\n- A session ends and the dev servers it started keep running.\n\nThe Claude Code tracker has many reports of exactly this:\n\n- [#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.\n- [#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.\n- [#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.\n- [#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.\n- [#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.\n- [#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.\n\nclaude-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.\n\n| **[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. | \n| **[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. | \n| **[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. | \n| **[disk-guard](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/disk-guard.md)**<sup>new</sup>Blocks `du -sh ~` ,`find /` without`-maxdepth` , and disk scans run in parallel, which stall the disk every session shares. | **[`bulkhead scan`](#do-you-need-it-ask-your-transcripts)**<sup>new</sup>Replays your past Claude Code transcripts against the guards: what they would have stopped, and how many sessions ran at once. | \n| **[basics](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/basics.md)** Blocks `rm -rf` at a root, home or a folder directly in it, force-pushes to`main` , resets that would lose uncommitted work, and commits authored as Claude. | **[`bulkhead status`, `top`, `log`, `doctor`](#see-what-is-running)** Shows every session, its RAM, its ports, queued jobs, and what the guards have blocked. | \n| **[Status line](#status-line)**`3 sessions  2 heavy  9.1 GB free` in the Claude Code status line, in under 100 ms. | **[Config and slash commands](#configuration)** Per-machine and per-project config with allow lists, plus `/bulkhead:scan` ,`/bulkhead:status` ,`/bulkhead:log` ,`/bulkhead:doctor` and`/bulkhead:reap` . | \n\nOptional: **[`bulkhead remote`](#run-heavy-jobs-on-another-machine-optional)** runs a test suite, a build or a browser run on another machine over SSH, when this one has no RAM to spare.\n\nRecorded with [docs/demo.sh](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/demo.sh). The two sessions are stand-in processes named `claude`; everything printed comes from the hook scripts and `bulkhead status`.\n\n```\n/plugin marketplace add dooly6276/claude-bulkhead\n/plugin install bulkhead@bulkhead\n```\n\nNode 18 or later must be on `PATH`. The native Claude Code installer does not install Node, so check with `node --version` first. Without Node every hook fails to start: nothing is blocked, and Claude Code shows a `hook error` notice for each hook on every tool call. There are no other dependencies.\n\n1. Install the plugin as above and start a new Claude Code session.\n2. See what it would have caught: run `/bulkhead:scan 30d` , or`bulkhead scan` in the Bash tool. It reads your last month of transcripts and changes nothing.\n3. Check the setup. Inside Claude Code run `/bulkhead:doctor` , or run`bulkhead doctor` in the Bash tool. Every line should say`OK` . A`WARN` or`FAIL` line names the guard and the reason.\n4. Open a terminal next to your sessions and run `bulkhead top` to watch sessions, RAM, ports and heavy jobs live. Press`q` to quit.\n\nAfter that there is nothing to do. The guards run on every Bash and PowerShell call. To see what they stopped, run `bulkhead log` or `/bulkhead:log`; `bulkhead log --summary` counts blocks per guard on your machine. To change a threshold or allow a command, see [docs/configuration.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/configuration.md). All commands are listed in [docs/commands.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/commands.md).\n\nWhen several sessions run test suites and builds at once, one machine runs out of RAM: memory-guard blocks the commands, or bulkhead-slot makes them queue. If you have a second machine that is mostly idle, `bulkhead remote` runs the heavy command there instead.\n\n```\nbulkhead remote add buildbox dev@192.168.1.20 --ssh-option=IdentityFile=~/.ssh/buildbox\nbulkhead remote run -- npm test\n[bulkhead remote] buildbox: 3f2a1c9 already there, 3 changed files (24 KB), 1 deleted\n[bulkhead remote] buildbox  copy a  /home/dev/bulkhead-remote/acme-web-3f9a1c  port 7172\n...test output...\n[bulkhead remote] exit 0 after 1m 12s (copy a)\n```\n\n- **What is sent.** The current commit as a git bundle (only the commits the remote does not have yet) and your uncommitted changes, deletions included. Ignored files stay here unless you name them with`--files` . Nothing outside the repository is sent.\n- **Where it runs.** In one of up to 8 copies of the repository on the remote, so parallel runs do not share a working tree.`node_modules` is kept between runs. Each run gets its own port in`$BULKHEAD_PORT` .\n- **Room.** Locks on the remote hold a copy and a job slot, and`--gb=N` waits until N GB is free there. When there is no room within`--wait` minutes, it exits 3.\n- **Cleanup.** When the command ends, or the SSH connection drops (Ctrl-C, a tool timeout), everything it started on the remote is stopped, including a server left on its port.\n- **The remote** needs only an SSH server,`bash` ,`git` and`tar` . Linux, macOS and Windows with Git for Windows all work.\n\n`bulkhead remote fetch PATH` brings files back from the copy the last run used, and `bulkhead remote status` shows each remote's free RAM and running jobs. In Claude Code, `/bulkhead:remote <command>` runs a command there in the background. Setup, options and exit codes: [docs/remote.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/remote.md).\n\n``` php\nflowchart LR\n  CC[\"Claude Code session\"] -->|\"PreToolUse: Bash, PowerShell\"| G[\"kill-guard, wait-guard, memory-guard,<br>port-guard, checkout-guard, disk-guard, basics\"]\n  CC -->|\"SessionEnd, SessionStart\"| R[\"orphan-reaper (background)\"]\n  G -->|\"read\"| P[\"process table, listening ports,<br>~/.claude/sessions\"]\n  G <-->|\"read, append\"| S[(\"state dir ~/.claude/bulkhead<br>slots, guards.log, events.jsonl\")]\n  B[\"bulkhead-slot\"] <--> S\n  G -->|\"exit 2 + message: blocked\"| CC\n  G -->|\"exit 0: allowed\"| CC\n  G -.->|\"any error: exit 0\"| CC\n```\n\nEach guard is a separate Node script with no dependencies. Claude Code pipes the tool call to it as JSON. The guard reads the command text, and only when the command matches does it look further: at the process table, the listening ports, the session files Claude Code keeps in `~/.claude/sessions`, free RAM, or `git status`. A block is exit code 2 with a message that tells Claude what to do instead. Any error inside a guard lets the call through, so a broken guard never stops your work.\n\nEvery session on the machine shares one state directory. bulkhead-slot keeps its RAM reservations there, and every block is recorded there. More detail, including the state directory layout and how sessions are found on each OS, is in [docs/architecture.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/architecture.md).\n\nEach guard has a page with the exact commands it blocks, what passes, the message Claude sees, and its limits. The short version:\n\n## **kill-guard**: kills by program name\n\nBlocks `taskkill /IM`, `taskkill /FI` without a PID, `Stop-Process -Name`, `Get-Process node | Stop-Process`, `pkill`, `killall`, `kill $(pgrep node)`, `wmic ... delete` and similar when they target a program other sessions share, such as `node`, `python`, `java`, `chrome`, `git` or `vite`. Kills by PID and by project path pass. Kills by port pass too, unless another session owns the port; port-guard checks those. Claude is told how to find its own PIDs.\n\nTurn off: `BULKHEAD_DISABLE=kill-guard`. Details: [docs/guards/kill-guard.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/kill-guard.md).\n\n## **port-guard**: ports owned by another session\n\nBlocks starting a dev server (`npm run dev`, `next dev`, `vite`, `uvicorn`, `rails s` and more) on a port that another Claude session's process tree is listening on, and suggests a free port. It also blocks kill-by-port commands such as `npx kill-port 3000`, `fuser -k 3000/tcp` and `lsof -ti :3000 | xargs kill` when another session owns that port.\n\nTurn off: `BULKHEAD_DISABLE=port-guard`. Details: [docs/guards/port-guard.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/port-guard.md).\n\n## **memory-guard and bulkhead-slot**: RAM\n\nmemory-guard blocks heavy commands (test runners, `next build`, `tsc`, Gradle, the Android emulator, Playwright, `cargo test`, `docker build` and similar) when free RAM is under 3 GB, or under 15% of RAM on machines with less than 20 GB. `bulkhead-slot run --gb=4 -- <command>` waits until the shared RAM budget has room, runs the command, and frees the slot when it exits.\n\nTurn off: `BULKHEAD_DISABLE=memory-guard`. Details: [docs/guards/memory-guard.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/memory-guard.md).\n\n## **checkout-guard**: two sessions in one git tree\n\nBlocks `git checkout <branch>`, `switch`, `stash`, `reset --hard`, `clean -f`, `rebase`, `merge`, `restore .` and a dirty `pull` when another live session works in the same tree, and suggests `git worktree add`. Also blocks `git add -A`, `git add .` and `git commit -a` there (`stage-all`), which would sweep the other session's half-finished edits into your commit, and `rm -rf` or `git worktree remove` of a folder another live session works in (`remove-session-dir`). On Windows it blocks `git worktree remove --force` on a worktree that holds junctions, which git has followed into the main checkout.\n\nTurn off: `BULKHEAD_DISABLE=checkout-guard`, or one rule with `BULKHEAD_DISABLE=stage-all` or `remove-session-dir`. Details: [docs/guards/checkout-guard.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/checkout-guard.md).\n\n## **disk-guard**: whole-disk and parallel scans\n\nBlocks `du`, `ncdu`, `dust`, `ls -R`, `Get-ChildItem -Recurse` and `dir /s` over the whole drive, the home folder or every user's home (`du -sh ~`, `du -sh ~/*`, `ncdu /`), `find /` and `find ~` without `-maxdepth`, and disk scans run in parallel wherever they point: `xargs -P 10 du`, GNU `parallel`, `du ... &` in a loop, `ForEach-Object -Parallel`. One folder at a time passes (` du -sh node_modules`, `du -sh ~/Library/Caches`).\n\nTurn off: `BULKHEAD_DISABLE=disk-guard`. Details: [docs/guards/disk-guard.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/disk-guard.md).\n\n## **wait-guard**: long foreground waits\n\nBlocks a foreground command whose sleeps can add up to more than 180 seconds. The prompt cache expires after about five minutes without a request, so a subagent polling in the foreground rewrites the whole context every time it wakes. Claude is told to run the loop with `run_in_background: true`. Sleeps in a background job (` sleep 600 &`) pass. With the default 120 second tool timeout a wait cannot pass the default limit, so it blocks only when the call raises the timeout.\n\nTurn off: `BULKHEAD_DISABLE=wait-guard`, or raise the limit with `BULKHEAD_WAIT_MAX_SEC`. Details: [docs/guards/wait-guard.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/wait-guard.md).\n\n## **orphan-reaper**: processes left by sessions that exited\n\nWhen a session exits, a hidden background waiter stops what it started from its tool shells and left running: dev servers and anything else listening on a port, test runners and their workers (Vitest, Jest, Playwright, pytest and xdist, `cargo test`, `go test` and more), watchers such as `tsc --watch` and nodemon, builds such as `next build`, and headless browsers. A pass at session start catches what a crash left behind. Editors, terminals, shared daemons such as Gradle or adb, and anything you started yourself are never touched. `bulkhead reap --dry-run` shows what it would stop and why. Windows, Linux and macOS (macOS tested with fixtures).\n\nTurn off: `BULKHEAD_DISABLE=orphan-reaper`. Details: [docs/guards/orphan-reaper.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/orphan-reaper.md).\n\n## **basics**: four mistakes that cannot be undone\n\n`rm-root` (`rm -rf` at a root, a top-level folder such as `/srv`, home, a folder directly in home such as `~/Documents`, or above the repository), `force-push-main` (`git push --force` to `main` or `master`; `--force-with-lease` passes), `discard-changes` (`git reset --hard` or `git clean -fd` that would lose uncommitted work) and `agent-author` (`--author=\"Claude <noreply@anthropic.com>\"`, `git config user.name Claude` and the like, so your commits keep counting as yours).\n\nTurn off: `BULKHEAD_DISABLE=basics`, or one rule by name. Details: [docs/guards/basics.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/guards/basics.md).\n\nGeneral safety packs protect a session from dangerous commands. For example, [claude-forge](https://github.com/sangrokjung/claude-forge) includes hooks that filter leaked secrets from output, block piped remote scripts and stop destructive SQL, and [dcg](https://github.com/Dicklesworthstone/destructive_command_guard) and [cc-safety-net](https://github.com/kenryu42/claude-code-safety-net) cover destructive shell and git commands broadly. They are worth using.\n\nbulkhead covers a different problem: sessions on one machine getting in each other's way through process ownership, ports, shared RAM and a shared git tree. Only its `basics` rules overlap with those packs, and you can turn them off with `BULKHEAD_DISABLE=basics` if another pack already covers them. bulkhead runs alongside other hooks: Claude Code runs every hook that matches a tool call, and the call is stopped if any of them blocks it.\n\nThe defaults need no setup. To change them, use a config file: `~/.claude/bulkhead/config.json` for the machine, and `<repo>/.claude/bulkhead.json` for one project (found by walking up to the folder with `.git`). Project settings win over the global file. For example, a project that runs `ffmpeg` on purpose and has a slow integration suite:\n\n```\n{\n  \"killGuard\": { \"allowNames\": [\"ffmpeg\"] },\n  \"waitGuard\": { \"limitSeconds\": 300 },\n  \"portGuard\": { \"ignorePorts\": [9229] },\n  \"basics\": { \"protectedBranches\": [\"main\", \"release\"] }\n}\n```\n\nEvery guard can be turned off with `\"<guard>\": { \"enabled\": false }`. `bulkhead config` prints every setting, its value and where it came from. A broken file is ignored, the guards keep their defaults, and the session shows one notice at startup. All keys are in [docs/configuration.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/configuration.md), and [config.example.json](https://github.com/dooly6276/claude-bulkhead/blob/main/config.example.json) sets each of them.\n\nEnvironment variables still work and win over both files. The simplest place for them is the `env` block of `~/.claude/settings.json`.\n\n## All environment variables\n\n| Variable | Default | Same as | \n|---|---|---|\n| `BULKHEAD_DISABLE` | empty | Comma-separated guards to turn off: `kill-guard` ,`wait-guard` ,`memory-guard` ,`port-guard` ,`checkout-guard` ,`disk-guard` ,`orphan-reaper` ,`basics` , or`all` . Single rules can be turned off too:`rm-root` ,`force-push-main` ,`discard-changes` ,`agent-author` ,`stage-all` ,`remove-session-dir` . A name here is off whatever the files say | \n| `BULKHEAD_WAIT_MAX_SEC` | 180 | `waitGuard.limitSeconds` | \n| `BULKHEAD_MIN_FREE_GB` | 3, or 15% of RAM if less | `memory.minFreeGb` | \n| `BULKHEAD_SLOT_FLOOR_GB` | 5, or 25% of RAM if less | `memory.slotFloorGb` | \n| `BULKHEAD_MAX_COMMIT_PCT` | 75 | `memory.maxCommitPct` (Windows only) | \n| `BULKHEAD_NO_LOG` | empty | `log.enabled: false` when set to`1` | \n| `BULKHEAD_STATE_DIR` | `~/.claude/bulkhead` | Where slots, the event log, `guards.log` and the global config file live | \n| `BULKHEAD_SSH` | `ssh` on`PATH` | The ssh client `bulkhead remote` runs | \n\n`bulkhead` is on the Bash tool's `PATH` next to `bulkhead-slot`. Inside Claude Code, `/bulkhead:scan [30d]`, `/bulkhead:status`, `/bulkhead:log [24h|7d]`, `/bulkhead:doctor` and `/bulkhead:reap` run the matching command and summarize it. To run it in your own terminal, call it by path, for example `node ~/.claude/plugins/cache/bulkhead/bulkhead/0.2.0/bin/bulkhead top` (the cache path depends on your install; `/plugin` shows it). Every command that prints a table takes `--json`. The full reference is [docs/commands.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/commands.md).\n\nEvery Claude Code session on the machine, the memory its process tree uses, what it has listening on a port, the jobs held in bulkhead-slot and the ones waiting, and free RAM:\n\n``` bash\n$ bulkhead status\nSESSION  STARTED       RSS     PROJECT\n18672    Oct 12 17:49  1.4 GB  ~/src/acme-web\n  :3000  node.exe  pid 24632\n21888    Oct 12 17:52  353 MB  ~/src/acme-web-auth\n26448    03:43         625 MB  ~/src/acme-web-checkout\n  :3001  node.exe  pid 31020\n\nSLOT    GB  PID    AGE    COMMAND\nslot-1  4   30112  6 min  npx playwright test\n\nWAITING  GB  PID    FOR    COMMAND\n#1       3   30200  2 min  npm run build\n\n9.9 GB free of 31.8 GB, commit 68%\n```\n\n`bulkhead slot ...` is the same as `bulkhead-slot ...`.\n\nThe same view, live and full screen. It refreshes every 2 seconds on Linux and macOS and every 4 seconds on Windows, where one process scan takes 1 to 2 seconds. The scan runs in a worker thread, so keys never wait for it. `q`, `Esc` or `Ctrl-C` quit, `r` refreshes.\n\n```\nbulkhead top  14:30:05                                         scan 1.4s  every 4s  q quit  r refresh\nRAM ████████████████░░░░░░░░░░░░░░  9.9 GB free of 31.8 GB  commit 68%\n\nSESSIONS 3\nPID      STARTED       PROJECT                         RSS              PROCS  PORTS\n18672    Oct 12 17:49  ~/src/acme-web               1.4 GB  ██████████     12  :3000 :24678\n21888    Oct 12 17:52  ~/src/acme-web-auth          353 MB  ███░░░░░░░      3  -\n26448    03:43         ~/src/acme-web-checkout      625 MB  ████░░░░░░      5  :3001\n\nHEAVY JOBS  1 running, 1 waiting\nslot-1  4 GB   30112   6 min   npx playwright test\nwait #1 3 GB   30200   2 min   npm run build  (this machine has 16 GB; one heavy job at a time)\n\nRECENT BLOCKS\n14:29  kill-guard     taskkill-im    ~/src/acme-web-auth      taskkill /F /IM node.exe\n14:12  wait-guard     poll-loop      ~/src/acme-web-checkout  until [ -f out/DONE ]; do sleep 30; done\n```\n\nOn a narrow terminal it drops columns instead of wrapping. When the output is not a terminal, or with `--once`, it prints one snapshot and exits.\n\nEvery block, and every process orphan-reaper stops, is one JSON line in `<state dir>/events.jsonl` with the time, guard, rule, session, project and the command cut to 200 characters. The file stays on your machine, rotates at 1 MB, and keeps one old file. `BULKHEAD_NO_LOG=1` turns it off.\n\n``` bash\n$ bulkhead log --summary --since 7d\n10 blocks in the last 7 days, 3 projects, 4 sessions\n\nGUARD         RULE             COUNT  LAST\nwait-guard    poll-loop            3  06:40  ████████████████████████\nwait-guard    long-sleep           2  06:40  ████████████████\nbasics        force-push-main      1  06:40  ████████\nbasics        rm-root              1  06:40  ████████\nkill-guard    pkill                1  06:40  ████████\nkill-guard    taskkill-im          1  06:40  ████████\nmemory-guard  slot-files           1  06:40  ████████\n\nPROJECT                  COUNT\n~/src/acme-web               4\n~/src/acme-web-auth          3\n~/src/acme-web-checkout      3\n```\n\n`bulkhead log -n 20` lists the events themselves, `--since 30m|24h|7d|2w|<date>` limits the time, and `--guard kill-guard` limits the guard.\n\nChecks Node, the plugin files, the state directory, the config files, each guard (on or off, and why), a real hook run, the process reader with its timing, the session files, the RAM limits computed for this machine, held slots, the event log and git. The exit code is 1 when any check fails.\n\n``` bash\n$ bulkhead doctor\nOK    node            v24.11.0\nOK    plugin          ~/.claude/plugins/cache/bulkhead/bulkhead/0.2.0, hooks: 2 SessionStart, 1 SessionEnd, 7 PreToolUse\nOK    state dir       ~/.claude/bulkhead is writable\nOK    config          no config files, defaults in use\nOK    kill-guard      on\nOK    wait-guard      on, limit 180s\nOK    memory-guard    on\nOK    port-guard      on\nOK    checkout-guard  on\nOK    disk-guard      on\nOK    basics          on, protected branches: main, master\nOK    orphan-reaper   on, at session start and after each session ends\nOK    hook run        kill-guard blocked a test command in 90 ms\nOK    processes       356 processes, 21 listening ports, 8 Claude sessions in 2.4s\nOK    sessions        ~/.claude/sessions (8 session files)\nOK    memory          12.2 of 31.8 GB free, commit 43%, memory-guard blocks heavy commands below 3 GB, bulkhead-slot keeps 5 GB free for a second job, and waits while commit is above 75%\nOK    slots           none held\nOK    event log       ~/.claude/bulkhead/events.jsonl, empty so far\nOK    git             2.52.0.windows.1\n\n19 OK, 0 WARN, 0 FAIL\n```\n\nPrints a port that nothing listens on, checked on IPv4 and IPv6, so a second worktree can start its server without guessing:\n\n```\nnpm run dev -- --port $(bulkhead port --near 3000)\n```\n\nRuns orphan-reaper now. `--dry-run` lists what it would stop, the rule that matched and why the session counts as exited, without stopping anything:\n\n``` bash\n$ bulkhead reap --dry-run\nwould stop 30112  test-runner  node ~/src/acme-web/node_modules/vitest/dist/workers/forks.js\n  Vitest and its worker pool (tinypool); its session has exited and removed snapshot-bash-1791860359256-ezwkie.sh; 6 processes from 30080\n1 tree would be stopped. Run `bulkhead reap` to stop it.\n```\n\n`bulkhead-statusline` prints one line for the Claude Code status line:\n\n```\n3 sessions  2 heavy  9.1 GB free\n```\n\nSessions are the live entries in `~/.claude/sessions`, heavy is the number of jobs holding a bulkhead-slot, and free is the same measure memory-guard uses. It does not scan processes, takes under 100 ms, and caches the line for 5 seconds in the state directory.\n\nA plugin cannot set the main status line (plugin settings only support `agent` and `subagentStatusLine`), so add it to `~/.claude/settings.json` yourself:\n\n```\n{\n  \"statusLine\": {\n    \"type\": \"command\",\n    \"command\": \"node ~/.claude/plugins/cache/bulkhead/bulkhead/0.2.0/bin/bulkhead-statusline\",\n    \"refreshInterval\": 10\n  }\n}\n```\n\nThe path contains the plugin version, so update it after a plugin update. If you already have a status line script, call `bulkhead-statusline` from it and append its output.\n\n**Does it slow Claude Code down?**\nA little. Each guard is one short Node process. On a Windows 11 desktop with Node 24, `node scripts/bench-hooks.js 15` measured 40 to 49 ms per guard on an allowed command (median of 15 runs), and 33 ms for starting Node alone. Writing a block to the event log adds no measurable time. The guards only do slow work, such as reading the process list (a second or two on Windows), when the command matches: a dev server start on a port that already answers, a kill, a heavy command. The status line takes under 100 ms and is cached for 5 seconds.\n\n**It blocked something it should not have. What do I do?**\nRun `bulkhead log` to see the exact command and reason. Let it through in the project config, `<repo>/.claude/bulkhead.json`: `killGuard.allowNames` for a program name, `portGuard.ignorePorts` for a shared port, `waitGuard.limitSeconds` for a longer wait, or `\"enabled\": false` for the whole guard in that project. See [docs/configuration.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/configuration.md). Then please open a [false positive issue](https://github.com/dooly6276/claude-bulkhead/issues/new?template=false-positive.yml) with the line from `bulkhead log`, so the pattern can be fixed for everyone.\n\n**Is it useful with a single session?**\nYes. kill-guard, wait-guard, memory-guard and basics protect one session and its subagents just as well. port-guard and checkout-guard only act when another session is alive, and orphan-reaper cleans up after sessions that have exited.\n\n**Which systems does it support?**\nWindows, Linux and macOS, with Node 18 or later. orphan-reaper on macOS is tested with fixtures of `ps` output but not yet on a real Mac, and on Linux it needs a Claude Code version that sets `CLAUDE_PID` for tool shells. On Windows, `bulkhead-slot` runs commands through Git Bash when it is installed and through `cmd.exe` otherwise.\n\n**Does it send anything anywhere?**\nNo. There is no telemetry and no network call. The only socket it opens is port-guard's connection attempt to `localhost` to see whether a port answers. Logs stay in the state directory. The one exception is `bulkhead remote`, which connects over SSH to a machine you configured, and only when you run it.\n\nMore questions, including how the guards can be bypassed and how the RAM numbers are measured, are in [docs/faq.md](https://github.com/dooly6276/claude-bulkhead/blob/main/docs/faq.md).\n\n- The guards read command text. They split it into commands and open wrappers such as `bash -c` ,`cmd /c` ,`powershell -EncodedCommand` and`sudo` up to three levels deep, but a kill or a sleep hidden in a script file, a shell function or an alias is not seen. They catch the common shapes, not a determined workaround.\n- memory-guard and bulkhead-slot only see RAM. They do not limit CPU, disk or GPU.\n- bulkhead-slot is only used when called. Nothing forces every session to queue through it.\n- Each guard page lists its own limits.\n\n```\n/plugin uninstall bulkhead@bulkhead\n/plugin marketplace remove bulkhead\n```\n\nThen delete the state directory (`~/.claude/bulkhead`, or `BULKHEAD_STATE_DIR` if you set it) and remove the `statusLine` entry from `~/.claude/settings.json` if you added one.\n\nAdd this badge to your project's README:\n\n```\n[![Guarded by bulkhead](https://img.shields.io/badge/guarded_by-bulkhead-34d6b4?style=flat-square)](https://github.com/dooly6276/claude-bulkhead)\n```\n\nSee [CONTRIBUTING.md](https://github.com/dooly6276/claude-bulkhead/blob/main/CONTRIBUTING.md). Security reports: [SECURITY.md](https://github.com/dooly6276/claude-bulkhead/blob/main/SECURITY.md). The changelog is in [CHANGELOG.md](https://github.com/dooly6276/claude-bulkhead/blob/main/CHANGELOG.md), and what bulkhead stores and sends is in [PRIVACY.md](https://github.com/dooly6276/claude-bulkhead/blob/main/PRIVACY.md).", "url": "https://wpnews.pro/news/show-hn-replay-your-claude-code-logs-to-count-parallel-session-collisions", "canonical_source": "https://github.com/dooly6276/claude-bulkhead", "published_at": "2026-11-09 00:55:37+00:00", "updated_at": "2026-11-09 01:32:30.551005+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "ai-safety"], "entities": ["Claude Code", "bulkhead", "dooly6276", "Anthropic"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/show-hn-replay-your-claude-code-logs-to-count-parallel-session-collisions", "markdown": "https://wpnews.pro/news/show-hn-replay-your-claude-code-logs-to-count-parallel-session-collisions.md", "text": "https://wpnews.pro/news/show-hn-replay-your-claude-code-logs-to-count-parallel-session-collisions.txt", "jsonld": "https://wpnews.pro/news/show-hn-replay-your-claude-code-logs-to-count-parallel-session-collisions.jsonld"}}