ThumbGateThumbGate Verification evidence
guide | local ai agent guardrails

Local guardrails for AI coding agents

A local guardrail runs on your own machine, in the agent's hook, before each command. No proxy, no account and no cloud call decides whether the command runs. ThumbGate is a free, MIT-licensed local guardrail for Claude Code and Cursor that learns its rules from your thumbs-downs.

👍 Thumbs up saves what worked as a lesson
👎 Thumbs down catches repeated mistakes

In short

  • The check runs in the hook process on your machine, before the command, so it works offline and adds no network round trip.
  • Rules and lessons are files in .thumbgate/ in your repo. You can read them, commit them or delete them.
  • Catastrophic commands and secret leaks are Denied by default; a command you gave a thumbs-down is Denied the next time (if that rule would also have blocked commands you allowed before, it warns instead).

What "local" means here

  • The decision: made by npx thumbgate gate-check, run by Claude Code's PreToolUse hook or Cursor's beforeShellExecution hook on your machine.
  • Your data: lessons and rules stay in .thumbgate/ in your repo. Nothing about your commands is uploaded to decide anything.
  • Telemetry: the CLI sends anonymous usage events (a random install id, versions, the event name and which built-in check fired), never the words of your rules. THUMBGATE_NO_TELEMETRY=1 or DO_NOT_TRACK=1 turns it off.
  • No account is needed for the free plan.

What it denies by default (npm 1.64.0)

  • git push --force, git reset --hard, git clean -fdx, rm -rf on home or root, find / -delete and DROP TABLE.
  • Cloud and cluster wipes such as terraform destroy, kubectl delete and aws s3 rm.
  • Sending a secret out, for example curl -d @.env.
  • git push origin main, until you lift it for an hour with npx thumbgate unblock protected-branch-push --reason "why you need it".
  • Any command you gave a thumbs-down, the next time it runs. If that rule would also have blocked commands you let through before, it stays a Warning.

Where it is enforced, and where it is Advisory

In Claude Code, every tool call goes through the PreToolUse hook, so Denied means the command does not run. In Cursor that holds for shell commands; other Cursor tools are Advisory. Codex and Gemini CLI run the same command in their hooks but are not yet tested end to end. In MCP-only clients such as Cline and OpenCode, ThumbGate is Advisory: the agent has to call the check, and nothing stops a command it skips.

Other flagged actions, such as npm publish, are a Warning by default and Denied in Strict mode (THUMBGATE_STRICT_ENFORCEMENT=1). A learned rule matches the command, not its purpose, and ThumbGate is not a sandbox: pair it with containers or a VM if you need to contain what an allowed command does.

Install, check and remove

  • Install in your project folder: npx thumbgate init --agent claude, then restart Claude Code.
  • Check it: echo '{"tool_name":"Bash","tool_input":{"command":"git push --force"}}' | npx thumbgate gate-check should print "permissionDecision":"deny".
  • Remove it: from the next npm release, run npx thumbgate uninstall in your own terminal. Until then, delete the ThumbGate entries under hooks and statusLine in ~/.claude/settings.json. Your lessons stay in .thumbgate/ until you delete the folder.

FAQ

Does ThumbGate need an internet connection to block a command?

No. The check runs in the hook process on your machine and does not wait on a network call.

How is this different from a sandbox?

A sandbox limits what an allowed command can touch. ThumbGate decides whether a command runs at all. They solve different halves, and you can use both.

What does it cost?

Free includes every default Denied check, 3 active learned rules and 2 thumbs a day. Pro is $19/month or $149/year and keeps every learned rule active, with recall and lesson search.