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

未关闭
#205 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
5/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
活跃
技术栈
shell
领域
devtools

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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 的维护者。

主要语言
没有语言数据
星标
1.9k
派生
74
平均合并
2 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

OpenGithubs/weekly 的其他 Issue

查看 OpenGithubs/weekly 的全部 Issue

相似的 Issue

更多 DevTools Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。