【开源自荐】claude-bulkhead:在命令执行前拦截编程 Agent 破坏性操作的钩子

Open
#205 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
5/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
shell
Domain
devtools

Research direction

This is a self-promotion post in a weekly newsletter list, not a request for a code change, so there is no file or test to start from. The linked repository dooly6276/claude-bulkhead holds the PreToolUse hooks; a newcomer who wants to help would need the maintainer to state a specific task first. Done would mean the issue is closed or a concrete change is agreed, and it should not be picked up as a first contribution.

Written by the indexing model from the issue text.

Description

claude-bulkhead:在命令执行前拦截编程 Agent 的破坏性操作

claude-bulkhead 是一个开源项目(MIT 协议,零依赖),是一组 PreToolUse 钩子,适用于 Claude Code,也支持 Codex、Gemini CLI、Copilot CLI、Cursor 和 opencode。它在 Agent 执行 shell 命令之前做检查,命中危险操作就直接拦下。

项目地址:https://github.com/dooly6276/claude-bulkhead

几个特点

  • 拦截变量为空时的 rm -rf(例如 rm -rf "$VAR/" 实际删到根目录),以及 rm -rf .git。
  • 拦截会误伤其他会话或桌面应用的 pkill / killall,也拦截抢占其他会话正在使用的端口。
  • 拦截 git add -A 把其他会话还没提交的改动一起提交进去。
  • 每次拦截都会在提示里告诉 Agent 应该改用哪条安全的命令,Agent 可以直接重试,不需要人工介入。
  • 零依赖,不需要额外安装运行库。

怎么用

按仓库 README 里的说明,把钩子配置到你使用的 Agent 即可,安装步骤和各个 Agent 的配置写法都在 README 里。

我是 claude-bulkhead 的维护者。

Dominant language
No language data
Stars
1.9k
Forks
76
Avg merge
3h 36m
Merged PRs (30d)
18

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenGithubs/weekly

All issues in OpenGithubs/weekly

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.