ClaudeMods
☰
JA
● — 人がオンライン ・閲覧 — 回
スポンサー作品を投稿
GitHub リポジトリ · 投稿者 Sea-University-7237

エージェントの「oc delete —all」を読まずに承認したので、Claude Code の新しい関数フックでガードレール(と他10個のMOD)を作った

著者はエージェントの `oc delete --all` を読まずに承認し、Kubernetes名前空間をほぼ消去しかけた後、新しい関数フックAPIを使って11個のClaude Codeプラグインのスイートを構築しました。主要MODのguardrailsは、大量のkubectl/oc削除、rm -rf、強制プッシュ、シークレット読み取りなどの破壊的コマンドをブロックし、ユーザーがブロックしたことをClaudeに伝えます。他のMODは、アクティビティ監視、デスクトップ通知、コンテキスト追跡、使用制限、プロンプトコーチング、コマンド発見、MODマネージャーをカバーしています。11個中9個はモデルを呼び出さず、テレメトリはなく、プロジェクトは無料でMITライセンスです。

翻訳済み

この mod について

Redditユーザーu/Sea-University-7237による投稿で、新しい関数フックAPIを使って構築された11個のClaude Codeプラグインのスイートが説明されています。きっかけは、著者がエージェントの oc delete --all を読まずに承認し、名前空間を部分的に消去した事件です。主力MODのguardrailsは、ユーザーがルールを切り替えてrm -rf、大量のkubectl/oc削除、強制プッシュ、破壊的なgit操作、.env読み取り、インストール、ネットワークアクセスをブロックでき、ユーザーがアクションをブロックしたことをClaudeに通知して回避させないようにします。残りのMOD:activity、notify、context-keeper、usage-meter、prompt-coach、command-hub、toolbox、changes、loop-breaker、クイックバーランチャー、およびそれらをインストール・切り替えるための/mods。9個のMODはモデルを呼び出しません。prompt-coachとcontext-keeperのハンドオフノートはClaude Codeを経由します。マーケットプレイスの更新チェック以外にテレメトリはありません。READMEには、関与するすべてのプロセスとファイルが記載されています。制限:guardrailsはツールに渡されるコマンドを検査するため、oc delete --all は捕捉できますが、エージェントが作成して後で実行するスクリプトは捕捉できません。claude plugin marketplace add mishgoldenberg/claude-mods と claude plugin install mod-manager@claude-mods でインストールし、再起動して/modsを実行します。Claude Code 2.1.286+が必要です。リポジトリ:https://github.com/mishgoldenberg/claude-mods

インストール

インストール方法は元のソースをご確認ください。

原文 / README

A while ago I asked an agent (Claude Code on a self-hosted model) to "delete everything you added in the last command". It came back with oc delete --all. I hit approve without reading it, and it started wiping the namespace. I caught it about halfway. Rebuilding the rest from Confluence pages took me two days. Claude Code recently added function hooks, which are plugins that run inside it, see every tool call before it executes, and can draw their own panels. So I built the stuff I wish I'd had that day. The one that matters most is guardrails. You click rules on or off: block rm -rf, mass kubectl/oc deletes, force-push, destructive git, reading .env, installs, network, or keep Claude inside the project folder. When it blocks something it tells Claude the user blocked it and not to work around it. The rest: - activity: shows what Claude is running right now, for how long, and when it's waiting for your approval - notify: a desktop notification (Windows/macOS/Linux) when a long task finishes or an approval has been sitting there - context-keeper: what's filling your context window, plus checkpoints saved to disk so /compact and /clear don't lose the thread - usage-meter: 5h/7d limit bars with burn rate and cache hit ratio - prompt-coach: when a prompt is vague (like mine was), it suggests a sharper version and you pick which one to send. It never rewrites anything silently - command-hub: the built-in commands people miss (/rewind, /btw, /context) explained, plus a form to make your own - toolbox, changes, loop-breaker (catches Claude retrying the same failing command), a quickbar launcher, and /mods to install and toggle all of them Nine of the eleven never call a model, so they cost no tokens. The two that do (prompt-coach and the context-keeper handoff note) go through Claude Code itself. There's no telemetry, and the only other network traffic is the marketplace check when you click update in /mods. The README lists every process and file they touch. To be clear about the limits: guardrails is a seatbelt, not a sandbox. It checks the command the agent passes to a tool, so it would have caught my oc delete --all, but it won't catch a script the agent writes and then runs. How Claude helped: I built the whole thing in Claude Code (Opus). I wrote the feature list and the rules I wanted. Claude read the function hooks API types, wrote the mods, ran the plugin validator on each one, and wrote the tests (64 on the guardrail rules, running in CI). My job was testing in the real desktop app and reporting what broke. Funny part: its own guardrails kept blocking its edits during the build, and it fixed the rule instead of working around it. What I learned: - How you deny matters more than what you deny. A plain "blocked" makes the model try a reworded command. "The user blocked this, don't work around it, ask them" makes it stop and explain. - Matching raw command text is noisy. Commit messages that just mentioned rm -rf got blocked. Ignoring quoted text (unless the command runs a shell inline like bash -c or | sh) fixed most of it. - Anything that changes what gets sent to the model has to be visible. A silent prompt rewriter is worse than none. It's free and MIT licensed, no account needed. Install: claude plugin marketplace add mishgoldenberg/claude-mods claude plugin install mod-manager@claude-mods Then restart and type /mods. Needs Claude Code 2.1.286 or newer. Repo: https://github.com/mishgoldenberg/claude-mods What annoys you in Claude Code that a mod could fix? I'm picking the next ones from the comments. submitted by /u/Sea-University-7237 [link] [comments]

バッジを取得

あなたのプロジェクトですか?このバッジを README やサイトに貼ると、このページにリンクします。

Featured on ClaudeMods
サイズ
テーマ
Markdown
HTML

関連作品