Claude Code hook

claude-warden

Command safety filter hook that parses shell pipelines and judges each sub-command separately.

32 stars 3 forksHooks Plugin marketplace Source

Install

Inside Claude Code
/plugin marketplace add banyudu/claude-warden
From source
git clone https://github.com/banyudu/claude-warden.git

From the README

Claude Warden

Smart command safety filter for Claude Code, OpenAI Codex CLI, GitHub Copilot CLI, and other AI coding agents. Parses shell commands, evaluates each against configurable safety rules, and returns allow/deny/ask decisions — eliminating unnecessary permission prompts while blocking dangerous commands.

The problem

Claude Code's permission system is all-or-nothing. In the default mode, you're prompted for every shell command — even ls, cat, and grep. This creates a painful UX where you're clicking "Allow" hundreds of times per session on obviously safe commands. The alternative (yolo mode) disables all prompts, which is dangerous.

There's no middle ground: you can't say "allow git but block git push --force", or "allow ssh to my dev server but prompt for production". And compound commands like npm run build && npm test trigger a single opaque prompt with no visibility into what's actually being run.

How Warden solves it

Warden hooks into Claude Code's PreToolUse event and parses every shell command into an AST using bash-parser. This means it doesn't just see npm run build && git push --force as a single string — it walks the AST to extract each individual command, then evaluates them independently against a configurable rule engine.

This AST-based approach enables:

- Pipe and chain decomposition: cat file | grep pattern | wc -l is parsed into three commands, each evaluated separately. All safe → auto-allow. One dangerous → deny the whole pipeline.
- Argument-aware rules: git status → allow, git push --force → prompt. rm temp.txt → allow, rm -rf / → prompt. The evaluator matches against argument patterns, not just command names.
- Recursive evaluation of remote commands: ssh devserver 'cat /etc/hosts' → Warden extracts the remote command, parses it…
Read the full README on GitHub

How hooks work

  • Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
  • They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
  • A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Claude Code docs

Details

Type
Hooks
Language
TypeScript
License
MIT
Last updated
30 June 2026

FAQ

What is claude-warden?

Command safety filter hook that parses shell pipelines and judges each sub-command separately. It is a hook for Claude Code, from banyudu/claude-warden on GitHub.

How do I install claude-warden?

Run /plugin marketplace add banyudu/claude-warden inside Claude Code, then follow the setup in the README.

Is claude-warden popular?

banyudu/claude-warden has 32 GitHub stars and 3 forks. It was last updated on 30 June 2026.

More hooks

Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.