Repository navigation
claude-bulkhead: a PreToolUse hook for Droid that blocks rm -rf on an empty $VAR, pkill of other sessions and similar #99
dooly6276
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I maintain claude-bulkhead, a set of pre-tool hooks that started on Claude Code and also runs under Factory Droid.
bulkhead setup droid --writeadds onePreToolUsehook onExecuteto~/.factory/hooks.json(or to thehookskey ofsettings.jsonwhen that is where yours live), keeps everything else in the file, and backs it up first. A denial comes back aspermissionDecision: "deny"with the reason.The hook reads the shell command the model is about to run and denies a short list of commands that cannot be undone, with the reason and the safe form. The model usually rewrites the command and carries on. Each rule comes from an accident someone reported this autumn:
rm -rf $D/,rm -rf "$BUILD_DIR"/*andrsync -a --delete src/ $R/when the variable can come out empty (it suggests"${D:?}")~/Library/Application Supportfind ... | xargs -n1 dirname | xargs rm -rf, where a space in a path makesdirnamereturn a parent (it suggests-print0 | xargs -0)rm -rf .giton an existing repositoryRemove-Item -Recurse -Force (Split-Path $home)in PowerShell, where$homeis the automatic variable for the user profilepkill -f nodeorkillall nodewhen the pattern also matches other agent sessions or desktop appsgit add -Aand branch switches in a tree another session is editing, and starting a dev server on a port another session already holdsYou can check a command without installing anything; nothing is executed:
One limit: it reads the command text, so a delete inside a script the model wrote and then runs is not seen. MIT, no dependencies, Node 18+, Windows, macOS and Linux.
https://github.com/dooly6276/claude-bulkhead
All reactions