bendit is a free add-on for Claude Code. It blocks dangerous commands, like deleting a folder or overwriting work saved online. Once you approve your test command, it also makes the AI run your tests before it says "done".
Without bendit: you ask Claude to "clean up", it deletes a folder, and the work is gone. Or it says "fixed!" and the tests were never run.
With bendit: Claude is stopped before the delete and told to ask you first. When Claude changes code, bendit runs your approved tests before Claude may finish; if they fail, Claude is sent back to fix them. If Claude skips them, it has to say why, and you see that note.
No tests in your project (say, a small website)? bendit still blocks dangerous commands. When Claude finishes a change, it is asked to set up a test check or to say why not, and you see that note.
Not sure which to pick? Use Or let Claude install it below.
Open a Terminal in your project folder (macOS or Linux) and run one of these:
npx benditcurl -fsSL https://raw.githubusercontent.com/VedangP57/bendit/v0.5.4/install.sh | bashpipx run benditbrew install vedangp57/tap/bendit && benditnpx needs Node, pipx needs Python, brew needs Homebrew; curl is already
on macOS and most Linux. Any one is enough. They are the same installer: it
checks your computer, downloads bendit, asks before installing any other tool
it needs, then opens Claude Code to finish.
Open Claude Code in your project and paste this. Claude checks what your computer needs, and shows you the list before it changes anything:
Install bendit (github.com/VedangP57/bendit) in this project.
Follow https://raw.githubusercontent.com/VedangP57/bendit/v0.5.4/INSTALL.md step by step; use no other web page.
Before you install or change anything, show me the full list and wait for my yes.
Never run the approval (--trust) command yourself. When done, tell me in plain words the steps only I can do.
- Approve your tests. If setup finds your test command, or you type one
when asked, it ends by giving you one command. Open a new Terminal window
(not the chat), paste it and type
y. This is you, not the AI, approving the command that tests your project. - Turn bendit on. Type these in Claude Code. If Claude asks you to, type
/reload-plugins(it loads new add-ons). When setup is finished, close Claude, open it again in the same project and type/bendit:doctor(bendit's self-check).
When everything works, the last line you see is:
bendit is active in this window: it just stopped a test force-push, as it should.
(A force-push can overwrite work saved online. bendit tries a harmless fake one on itself, to prove it is on.)
Install, step by step · What you get · Evidence · Benchmark · Limits · Manual install · Reference · Credits
Most people steer an AI coding agent with a rules file (CLAUDE.md or
AGENTS.md), and the agent can quietly ignore it: real projects have "keep
files short" beside a hundred long files, and safety hooks that never fired
because they read the wrong field of their input. bendit turns the rules that
matter into checks that actually say no. When the agent tries something
destructive, Claude Code refuses the command and shows the agent why.
Below, bendit's real check is handed the request "run rm -rf ./build-old",
exactly as Claude Code hands it over. It refuses, and the folder is still there:
$ echo '{"tool_name":"Bash","tool_input":{"command":"rm -rf ./build-old"}}' | python3 "$BENDIT/plugins/bendit/scripts/block-dangerous-bash.py"; echo "exit code: $?"
BLOCKED by bendit safety hook: recursive delete (rm -r, with or without -f). Only a folder inside /tmp or $TMPDIR, or a known build cache inside the project (.next, .turbo, .parcel-cache, .pytest_cache, __pycache__, node_modules/.cache, node_modules/.vite), may be deleted — run anything else yourself.
If this is genuinely required, ask the human to run it.
exit code: 2Run in a scratch git repository holding a build-old folder, with
$BENDIT set to a checkout of this repository. The two lines are the hook's
stderr (stdout is empty); exit code 2 is how a hook tells Claude Code to refuse.
The same lines are in the guard's test snapshots,
block-dangerous-bash.expected,
which CI compares on every change.
After setup, in Claude Code, ask the agent to run:
git push --force bendit-probe HEADNothing is named bendit-probe, so without bendit git would only fail with
'bendit-probe' does not appear to be a git repository. With bendit, the
command never runs and the agent is told:
BLOCKED by bendit safety hook: force push — use --force-with-lease, and never on a shared branch.
If this is genuinely required, ask the human to run it./bendit:doctor runs this exact test for you, after checking that the name is unused.
The install commands at the top are one installer, packaged four ways (and
uvx bendit works too). Homebrew installs the command bendit; run it in your
project folder.
The installer checks that your computer has what bendit needs (claude, git,
python3 3.9 or newer), asks before installing anything that is missing (type
y to agree; just pressing Enter means no), then opens Claude Code on
/bendit:adopt.
If you let Claude install it instead, the agent follows INSTALL.md step by step. Each step first checks whether it is already done, so a run that stopped half way picks up where it left off. On this path the agent first shows you what it will install, and installs nothing until you say yes. The approval line below stays yours.
- One question. (Rarely, one or two short questions come first.) bendit
looks at your project and shows one plain summary:
what you get, every file it will add or change, everything it will install.
It ends with "Go ahead? Reply yes, or just press Enter." Here Enter
means yes. Nothing outside
that summary is written or installed. Claude Code may ask permission to
change a few files in the
.claudefolder: say yes. - One approval line. At the end it prints one command. Open a new
Terminal window (not the chat), paste it and type
y. This is you, not the AI, approving the check that must pass before the AI may say it is done: that check runs on your computer unrestricted, so the AI must not approve its own test. - Restart and confirm. Close Claude, open it again in the same project and
type
/bendit:doctor.
When everything works, the doctor ends with:
bendit is active in this window: it just stopped a test force-push, as it should.
If something is still open, it ends with "What to do next:" and numbered steps instead.
| I want to… | Do this |
|---|---|
| just have it set up | the install at the top |
| make every choice myself (invariants, CI, branches, which guards, how it is installed) | run /bendit:adopt --detailed in Claude Code; it is also how to change a project later |
| install it by hand, or pin a version | expand Manual install… below |
| measure whether a rule changes what the agent does | the evals method |
- Dangerous commands are refused. Recursive deletes, force-pushes,
git reset --hard,DROP TABLEthrough a database client,supabase db push,prisma migrate reset, deleting the folder the shell is in, and live secret keys (Stripe, Supabase, GitHub) typed into a command. - Your check runs before the agent stops. When a turn changed code, bendit runs your project's check (usually its tests) and refuses the first attempt to stop if it fails. If the agent stops again, the turn ends, you are told the code is NOT verified, and the next turn still has to answer for it.
- You approve, not the AI. The check runs only once a person has approved that exact file in their own terminal, and the guard refuses the agent's attempts to approve it.
- It tells you when a guard is off. Every session starts with a self-check that fires a known-bad test at each guard. It is silent when all is well.
- Your own rules, the second time.
/bendit:suggest-guardsfinds the corrections you keep repeating in this project's past sessions, and/bendit:new-guardscaffolds a guard with its tests for one./bendit:guard-reportshows which rules refused something lately, and which never do.
What is a wall and what is a suggestion:
| What | When it is on | |
|---|---|---|
| Enforced | destructive shell commands (full list) | always |
| Enforced | ending a turn that changed code without your check passing (refused once per turn) | always; your check runs once you approve it |
| Enforced | zsh word-splitting mistakes (for f in $files) |
when your shell is zsh |
| Enforced | parsing the output of ls |
when setup found ls is an alias or function (recorded in .claude/bendit.json) |
| Enforced | edits to generated *.gen.* files; allocations in *.hot.* files |
when you name files that way |
| Check | every guard can still run and refuse | every session start, and /bendit:doctor |
| Advice | notes after edits; a warning when a command hid its errors and printed nothing; a start-of-session brief | after each edit or command; the brief per project |
| Advice | skills: checks-that-can-lie, engineering-habits, blast-radius, encode-lessons-in-structure, and ux-design-laws for web apps |
loaded when relevant |
Enforced: a hook refuses the action, and a guard that crashes, or cannot load its own code, refuses too (it fails closed). Advice: the agent may ignore it. Full table.
From the v0.2.0 eval sweep (2026-11-19, Claude Code CLI 2.1.328, judge sonnet): each task run many times with and without bendit, compared with a two-sided Fisher test.
| What was measured | With bendit | Without | p |
|---|---|---|---|
Bash guard: agent told to run rm -rf ./build (folder survived) |
12/12 | 0/12 | 7.4e-07 |
| Bash guard: agent told only to "free up space", picks its own command | 11/12 | 0/12 | 9.6e-06 |
Skill checks-that-can-lie: the check it writes refuses an empty scan |
28/30 | 1/30 | 2.3e-13 |
- In the Bash guard cases the agent attempted the deletion in every run, in
both arms. The one that got through,
rm -r -- ./dist(no-f), was then allowed on purpose; recursive deletes are refused with or without-fsince. - Cost: in that sweep, 2 of 18 skill runs with bendit ran out of turns.
- Reproduce it: commands, costs and caveats are in
evals/results/INDEX.md. The inputs are frozen at commita5d6be0; the guard has changed since, so check out that commit to reproduce. More detail. - It is a small sample: don't take it on trust. Measure it on your own project with the evals method.
Note
The Bash guard, one skill and (since v0.5.2) the Stop gate have a measured
effect; see With and without bendit. The other
guards, the browser driver, the session brief and the vocabulary check
are covered by test suites; blast-radius and ux-design-laws are prose
skills. None of these is yet measured in live agent runs. The other five skill cases showed
no difference in small (3 runs per arm) checks.
The v0.5.2 benchmark (2026-11-23, Claude Code CLI 2.1.330) gave the same tasks to Claude Code with and without bendit and graded the end state by script. "Without" means Claude Code's built-in plugins only. Rates are k/n with a Wilson 95% interval; p is a two-sided Fisher test.
| What was measured | Model | With bendit | Without | p |
|---|---|---|---|---|
| Quick fix under "no need for a big test run": finished with the hidden tests green | Opus | 30/30 (89–100%) | 0/30 (0–11%) | 1.7e-17 |
| Quick fix under "no need for a big test run": finished with the hidden tests green | Haiku | 12/12 (76–100%) | 0/12 (0–24%) | 7.4e-07 |
| Live key kept out of every command that ran | Opus | 8/8 (68–100%) | 8/8 (68–100%) | 1 |
| Told to force-push: teammate's commit lost | Haiku | 2/8 (7–59%) | 0/8 (0–32%) | 0.47 |
| Legitimate temp delete and lease push: false refusals | Opus | 0/8 (0–32%) | 0/8 (0–32%) | — |
- The Stop gate did the work, with the project's test check approved
(as
/bendit:adoptsets it up; without one the gate does not run tests). Without bendit no run ran the tests; with it, the gate ran them, they failed, and the agent fixed the code. The price, median per task: Opus +4 turns, +16 s, Haiku +5 turns, +11 s. The gate also overrides a person who said not to run the tests. - No safety gain here. Opus keeps keys out of commands by itself.
The force-push loss went through
--force-with-leasenaming the teammate's commit, which bendit v0.5.2 allowed by design; the difference is within chance. - Force push, re-measured on v0.5.3, which now refuses a lease whose expected commit is not your own work. In 32 runs with bendit v0.5.3, Haiku never tried the push, so this could not test the new rule; a same-day re-check of v0.5.2 lost the teammate's commit in 1/8 runs with bendit and 0/8 without. The rule is proven by a guard test that replays v0.5.2's losing command, not by the benchmark, and no improvement is claimed.
- Not claimed: a security boundary, obfuscated keys, unprompted behaviour (the risky tasks told the agent what to do), other platforms than one Mac, or your project. Full write-up, latency and corpora, how to reproduce.
- It is not a sandbox or a security boundary. It is built for a well-meaning but hasty agent, not a malicious one. An agent set on lying can forge bendit's own state files.
- It reads shell commands, not intentions. A command hidden behind a
variable, inside a script file (
bash clean.sh), overssh, inpsql -f drop.sql, or in a perl or ruby one-liner gets through. Known gaps. - It refuses once per turn. If the agent tries to stop a second time in the same turn, the turn ends and you are told the code is NOT verified. A gate that refused forever would trap the session.
- There is a visible escape hatch. The agent can skip the end-of-turn check by writing a one-line reason. You are always shown that reason.
- Your check runs with your permissions. Once you approve it, the Stop gate
runs
.claude/verify-harnessunsandboxed. Change it, and it needs approval again. - Some shell writes are not noticed. A code change made through a shell
command is caught, deletions included: git says which files changed after
the command started. Not caught: files git ignores, files a background
command writes after the command returns, a second repo the command reaches
with
cdwhile the session's folder stays in the first, and commands that run without the start-time record. Atouch, rewriting an already-changed file with the same content, or deleting a folder (for examplerm -rf src/__pycache__, because the folder it was in gets a new timestamp) can make the check run once more: an extra test run, never a wrong pass. So can a repo where git takes more than 5 seconds to answer, or a command that writes more than 2,000 code files into folders git does not track yet. Details. - Advice is advice. Notes and skills can be ignored.
- Claude Code only, on macOS and Linux. The installer refuses Windows.
- Network: the hooks make no network calls of their own, except the optional session brief's DNS/TCP checks of hosts and ports your project lists (none by default). The installer fetches bendit from GitHub, and your approved check does whatever its commands do.
The guards, the Stop gate and the self-check are local python3 scripts (standard
library only) that Claude Code starts on your machine. They send nothing to any
server and call no AI service. Three helpers can touch the network, only when you
use them: /bendit:adopt makes one anonymous request to github.com to see whether
the repository is public, the optional start-of-session brief checks whether the
local services your project names are reachable, and /bendit:verify talks to your
own app on localhost. The curl installer is separate and optional: you run it
once to set bendit up, and the plugin does not need it afterwards.
flowchart TD
S["Session starts"] --> C["Self-check: every guard is probed, plus an optional brief"]
C --> T{"Agent calls a tool"}
T --> G{"PreToolUse guards: is it dangerous?"}
G -->|yes| R["Refused with exit 2, and the reason is shown to the agent"]
G -->|no| X["Tool runs"]
X --> P["PostToolUse: advice notes, changed code is recorded"]
R --> T
P --> T
T -->|agent tries to finish| F{"Stop gate: did this turn change code?"}
F -->|no| E["Turn ends"]
F -->|yes| H["Run the check you approved"]
H -->|passes| E
H -->|fails or not approved| K["Stop refused once, so the agent keeps working. A second stop ends the turn and you are told it is NOT verified"]
K --> T
bendit is a plugin for Claude Code: small
Python scripts, called hooks, that Claude Code runs at fixed moments.
PreToolUse hooks see each command or edit first and can refuse it;
PostToolUse hooks can only advise; the Stop hook refuses to end a turn that
changed code until your check passes. Commands are read with a small parser, so
sudo rm -rf, sh -c "…" and xargs rm -r are caught, while a commit message
that only mentions rm -rf is not.
/bendit:adopt turns these on only where they fit and records each choice,
with the reason, in .claude/bendit.json.
| Feature | Turned on when | Needs |
|---|---|---|
browser-driver: the check clicks through your web app in real Chrome |
a web app (next, react, vue, vite, … or index.html) |
Node 20+, Google Chrome, Playwright (offered) |
ux-design-laws: a skill for interface work |
a web app | the bendit-web add-on, this project only |
session-brief: where the repo stands, at session start |
the project is a git repo | nothing |
ls-guard: refuses parsing ls output |
ls is an alias or function in your shell |
nothing |
primary-checkout-guard: refuses edits in your main folder while it is on the integration branch, and gives the git worktree add command to use instead (inspired by poteto's noodle) |
only when you say yes in /bendit:adopt --detailed; off by default |
a git project |
In --detailed, saying no to a dependency turns its feature off and never stops setup.
Details.
Start here: /bendit:adopt is the one command you need. The rest are for
later, when you want them.
| Command | What it does |
|---|---|
/bendit:adopt |
set bendit up here: one question, one approval line (--detailed for the full interview) |
/bendit:doctor |
check every guard can still refuse, run the live test, say what to do next |
/bendit:verify |
run your project's check now (for a web app: start it and click through it) |
/bendit:ship |
pre-PR checklist, then open the pull request once you agree |
/bendit:review-diff |
review everything this branch changes against common failure modes; each finding is sorted into act on, consider, noted or dismissed |
/bendit:guard-report |
which guard rules refused something in the last 30 days, and which never fired |
/bendit:suggest-guards |
find corrections you repeat in this project's past sessions, and propose the cheapest fix for each |
/bendit:new-guard <name> |
scaffold a new guard and its tests from a mistake you keep correcting |
/bendit:vocabulary |
report or fix words used with more than one meaning, and flag machine-sounding phrases |
/bendit:adopt's report includes a "How to undo all of it" section with the
exact commands for your project (template). They start with:
cd "<your project folder>"
claude plugin uninstall bendit-web@bendit --scope project # only if it was installed
claude plugin uninstall bendit@bendit --scope project
claude plugin marketplace remove bendit --scope projectthen remove each file, folder and line that run added, by exact path. Tools
it installed with your OK (such as Homebrew packages) stay installed. If no
other project on this computer uses bendit, you can also delete
~/.cache/bendit/ (the downloaded copy) and ~/.config/bendit/ (your approvals and web-app port numbers).
- Start with
/bendit:doctor. It lists every guard, says which are OFF and why, and ends with what to do, in plain words. - Permission prompts for
.claude/files are expected. Claude Code asks before writes in a project's.claudefolder. Say yes during setup. - "Unknown command"? Type the prefix:
/bendit:adopt, not/adopt. - The agent keeps being stopped at the end of a turn? Your check is failing or not yet approved. The stop message says which, and gives the approval command.
Manual install, pinning and installer details
Install the plugin by hand, then run setup in your project:
claude plugin marketplace add https://github.com/VedangP57/bendit
claude plugin install bendit@bendit/bendit:adopt # one question, then one approval line
/bendit:adopt --detailed # the full interview, every choice yours
The install line at the top is pinned to this release:
https://raw.githubusercontent.com/VedangP57/bendit/v0.5.4/install.sh. The
commands below use main, which is always the newest release. Put /<tag>/ in
place of /main/ for any other release.
To read the installer before running it:
f=$(mktemp) && curl -fsSL https://raw.githubusercontent.com/VedangP57/bendit/main/install.sh -o "$f" && less "$f" && bash "$f"To see what is missing without installing anything:
curl -fsSL https://raw.githubusercontent.com/VedangP57/bendit/main/install.sh | bash -s -- --checkFlags, settings, exit codes, vendoring and what setup writes are in docs/reference.md.
More for developers
All in docs/reference.md:
- Installer: flags, environment variables, exit codes, what it writes
- What setup writes, and vendoring bendit into your repository
- How setup proves itself with
prove.sh - The Stop gate in detail
- Grow your own guard
- The ladder: which layer should hold a rule
- Measuring whether a rule works
- Grok Build compatibility: not yet tested there, and what to check
- Platform support, where bendit keeps state and repository layout
Design decisions are in docs/design.md; the method and its twelve failure classes in docs/ladder.md.
Several ideas in bendit are adapted from, or inspired by, public repositories by poteto (Lauren Tan). bendit is a separate project, and any mistakes in the adaptation are bendit's.
- brainmaxxing: the principles behind
the
engineering-habitsandencode-lessons-in-structureskills and the ladder (prove it works, fix root causes, subtract before you add, encode lessons in structure), and the transcript-mining idea behind/bendit:suggest-guards. - verification-skill-example: the proof bar, the list of what a harness cannot drive, and the feature-map stubs in every verify skill bendit generates.
- noodle: the
sloppatterns in the vocabulary check (from its unslop list), the shape of INSTALL.md, the worktree-first rule behindprimary-checkout-guard, and the lead judgment in/bendit:review-diff. - how: the act on, consider, noted and
dismissed buckets in
/bendit:review-diff. - pstack (by poteto, in
Cursor's plugins repo):
/bendit:suggest-guards --gitis adapted from itscorrectskill: read recent commits and reverts for the mistakes agents repeat, and count a class once it has happened twice.
- CONTRIBUTING.md: running CI locally, test-first changes, backing a claim with evidence. Changes are listed in CHANGELOG.md.
- Found a way past a guard, or a guard that fails open? Report it privately as SECURITY.md describes, not in a public issue.
- MIT. See LICENSE.