HN🔥 12
💬 8

Claude Codeの暴走を阻止!賢く権限を管理するコンテキスト対応ガード「nah」

schipperai
約1時間前

ディスカッション (6件)

0
schipperaiOP
👍12約1時間前

「--dangerously-skip-permissions」を使いたいけれど、未追跡のファイルを勝手に消されたり、秘密鍵を抜かれたり、マルウェアを仕込まれたりするのは避けたい。そんなエンジニアのために「nah」を作りました。\n\nClaude Codeの標準的な権限システムはツールごとの「許可か拒否か」ですが、これではスケーリングしません。「一部のファイル削除はいいが、git checkoutはダメ」といった細かな判断が必要だからです。たとえ権限を絞っても、IQ 200を誇るOpus(AI)ならガードをすり抜ける方法を見つけ出してしまうかもしれません。ブラックリストを手動で更新し続けるのは、まさに不毛な作業です。\n\nnahはPreToolUseフックとして機能し、ミリ秒単位で動作する決定論的分類器を用いて、すべてのツール実行をその「実際の内容」に基づいて分類します。コマンドをfilesystem_read、package_run、db_write、git_history_rewriteなどのアクションタイプにマッピングし、「許可」「コンテキスト(対象に依存)」「要確認」「ブロック」といったポリシーを適用します。\n\nすべてを自動分類できるわけではありませんが、曖昧なものはオプションでLLMに判断を仰ぐことも可能です。判断できなかったものはその場で承認でき、次からは聞かれないように構成できます。\n\n設定不要でそのまま使えますし、必要に応じてフルカスタマイズも可能です。依存関係なしのPython標準ライブラリのみで動作するMITライセンスのツールです。\n\npip install nah && nah install\n\nGitHub: https://github.com/manuelschipper/nah

1
schipperai
約1時間前

Hi HN, author here - happy to answer any questions.

4
stingraycharles
23分前

I’m a bit confused:

“We needed something like --dangerously-skip-permissions that doesn’t nuke your untracked files, exfiltrate your keys, or install malware.”

Followed by:

“Don't use --dangerously-skip-permissions. In bypass mode, hooks fire asynchronously — commands execute before nah can block them.”

Doesn’t that mean that it’s limited to being used in “default”-mode, rather than something like “—dangerously-skip-permissions” ?

Regardless, this looks like a well thought out project, and I love the name!

5
jc-myths
12分前

This is exactly the kind of thing I've been wanting. I use Claude Code as my primary dev tool and the permission fatigue is a real problem, after a hundred approvals you stop reading and just hit yes. Which defeats the purpose entirely.

The deterministic classifier approach is smart. Pattern matching on action types is way more reliable than asking another LLM "is this safe?" The taxonomy idea (filesystem_read vs package_run vs db_write) maps well to how I actually think about risk when I'm paying attention.

One question: how does it handle chained operations? Like when Claude does a git checkout that's fine on its own, but it's part of a sequence that ends up nuking untracked files?