greenbar
Hooks for Claude Code that stop a false "done".
Claude Code sometimes ends a turn with "Done, all tests pass" when it never ran them, or when they fail.
greenbar adds a Stop hook that runs your project's real checks every time Claude tries to finish. If a
check fails, Claude is not allowed to stop: it gets the failing command and the end of its output, and it
has to fix the cause or tell you plainly what still fails.
It also adds a guard that runs before every tool call and blocks the usual ways an agent hurts a repo:
reading .env files and keys, skipping or deleting tests, force-pushing, --no-verify, git reset --hard,
rm -rf on the wrong folder, and committing a secret.
Free and open source (MIT). Python 3.9+, standard library only, no network calls. 562 test cases.
greenbar is an independent project. It is not made, endorsed or supported by Anthropic.
Install
As a plugin (recommended):
claude plugin marketplace add anchorcoteam/greenbar
claude plugin install greenbar@greenbar
Then, inside a session in your repo, run /greenbar:setup. It finds your test, type-check and lint
commands, asks you to confirm them, and writes .claude/done-gate.json. You can also write that file by hand:
{ "checks": [ { "name": "tests", "run": "npm test --silent" }, { "name": "lint", "run": "npx eslint ." } ] }
Trust step. The gate only runs a config you have approved, so a repo you clone cannot make it run its
own commands. /greenbar:setup does this for you. By hand:
python3 "$(find ~/.claude/plugins -path '*greenbar/hooks/done_gate.py' | head -1)" trust .
Run it again whenever you edit .claude/done-gate.json. Until then the gate allows the stop and tells you why.
The same trust covers .claude/guard.json and .claude/guard.off. Until you trust them, a repo's
guard.json can only add rules, and a repo's guard.off is ignored. Trust is stored in
~/.config/greenbar/trusted.json, never in the repo.
Add .claude/.done-gate/ to your .gitignore. It stores the fingerprint of the last green run.
Without plugins: copy plugins/greenbar/hooks/ into your repo as .claude/hooks/greenbar/ and add the two
entries from plugins/greenbar/hooks/hooks.json to .claude/settings.json, replacing
${CLAUDE_PLUGIN_ROOT}/hooks with $CLAUDE_PROJECT_DIR/.claude/hooks/greenbar.
What it does
Done gate (Stop hook)
- Runs each command in
.claude/done-gate.json when Claude tries to end its turn. Each check runs in
the project folder with CI=1.
- Any non-zero exit or timeout blocks the stop. Claude sees which check failed and the last 40 lines
of its output. If Claude's last message claimed success, the message says so.
- No wasted runs. It fingerprints the working tree (HEAD, the diff and untracked files, or file
times outside git) when your prompt arrives and when Claude stops. If the turn changed nothing (a
question, a plan), or nothing changed since the last green run, it allows the stop without running
anything. A suite that was already red before the turn doesn't punish question-only turns.
- Checks run in their own process group. On a timeout the whole group is killed, so no test workers
are left holding ports. Output is kept on disk, and only the tail is read, with likely secrets redacted.
There is a total budget (
total_timeout_seconds, default 1500) under the hook's 30-minute limit.
- Cannot trap you. After
max_consecutive_blocks failures in a row (default 3), Claude may stop.
You see a warning that the checks are still failing.
- Fails open with a visible warning if its own config or input is broken. A bug in the gate never
locks your session.
Guard (PreToolUse hook)
It is on as soon as the plugin is installed. Defaults, all configurable in .claude/guard.json: