Set up Better Approvals
How it works
Section titled “How it works”bs-gate is a small program that runs next to your agent. Claude Code calls it before each tool call, through a hook. Everyday reads, like listing files or git status, pass straight through. Anything that changes something is sent to your BetterID app, which shows you the exact command or file change. You allow it once, allow it for a while, or deny it with a note the agent can read.
If you don’t answer, or anything goes wrong on the way, the answer is no. When the BetterID desktop app is open on the same computer, it’s asked directly and nothing leaves your machine. Otherwise the request goes to your phone through BetterID’s relay, sealed so only your BetterID can read it.
Before you start
Section titled “Before you start”- A Mac (Apple silicon or Intel), or a 64-bit Intel/AMD Linux computer with Ubuntu 22.04 or newer (or another distribution with glibc 2.34 or newer). This is where your agent runs.
- The BetterID app with your identity in it: the desktop app on that computer, or the app on an Android phone. Both are on beta.betterid.net.
- Claude Code, for the hook. Any other command or script can use
bs-gate run.
1. Install bs-gate
Section titled “1. Install bs-gate”On the computer where your agent runs, paste this into a terminal:
curl -fsSL https://updates.betterid.net/bs-gate/install.sh | shThe installer downloads the build for your computer, checks it against its published checksum, and puts bs-gate in /usr/local/bin if you can write there, otherwise in ~/.local/bin. It changes nothing else. At the end it prints the exact commands for the next two steps, with the full path it installed to. Keep that output.
To check: bs-gate --version prints bs-gate 0.1.0 (bs-agent/v1). If the shell says command not found, the folder isn’t on your PATH; use the full path the installer printed, or add that folder to your PATH.
The macOS build is signed and notarized by Apple. Options: BS_GATE_INSTALL_DIR=/some/dir picks the folder, and BS_GATE_VERSION=0.1.0 installs a given version.
2. Pair it with BetterID
Section titled “2. Pair it with BetterID”-
In a terminal, run (with the full path if you need it):
Terminal window bs-gate pair --label "Laptop · Claude Code"It prints a QR code and a
bs-agent-pair:…code. The offer is good for 5 minutes. -
In BetterID, open Settings → Agents and choose Pair an agent. On a phone, scan the QR code. On the desktop app, copy the
bs-agent-pair:text and Paste it. -
The app shows the agent’s name and where it connects. Keep or change the name and its limits, then tap Pair and confirm with your fingerprint, face or PIN.
-
The app and the terminal each show a 6-digit code. If they’re the same, tap It matches in the app and type
yin the terminal. If they differ, or the terminal shows none, tap It doesn’t match and typeN: someone else may have answered the offer. Then pair again.
Only pair an agent you set up yourself. bs-gate status shows who it’s paired with and whether the desktop app can be asked directly.
3. Add the Claude Code hook
Section titled “3. Add the Claude Code hook”Put the hook in your user settings, ~/.claude/settings.json, not in a project’s .claude/settings.json: the agent can edit project files and remove the hook. (Teams can use Claude Code’s managed settings instead.) Merge this into the file, using the full path the installer printed:
{ "hooks": { "PreToolUse": [ { "matcher": "Bash|Write|Edit|MultiEdit|NotebookEdit|WebFetch|WebSearch|mcp__.*", "hooks": [ { "type": "command", "command": "/usr/local/bin/bs-gate hook claude-code", "timeout": 330 } ] } ] }}Keep timeout at 330 or more, so bs-gate always answers before Claude Code gives up on it. Restart Claude Code after changing its settings.
4. Answer a request
Section titled “4. Answer a request”Ask your agent to do something that changes a file or runs a command. BetterID shows the request: on the desktop app if it’s open on that computer, otherwise on your phone. You see the exact action; the agent’s own description is shown too, marked as unverified.
- Allow once: this action, this time.
- Allow for…: the same exact command (or this session’s file changes) for a while, up to 24 hours. Web requests and secrets are asked every time.
- Deny, with an optional Note to the agent such as “use the staging branch instead”. Claude Code shows the note to the model, which can change course.
No answer within two minutes is a denial. Reads that change nothing, such as ls, git diff or running your tests, aren’t sent to you; Claude Code’s own permissions still decide them.
Other commands and secrets
Section titled “Other commands and secrets”Any command, script or CI step can ask first. It runs only if you approve:
bs-gate run -- ./deploy.sh productionKeep a key out of .env files: add it in BetterID under Settings → Agents → Secrets for agents, choose which agents may ask for it, then hand it to one approved command:
bs-gate secret run DATABASE_URL --for "run migrations" -- npm run migrateThe value goes only into that command’s environment. It isn’t written to disk or printed, but the command itself can read it, as it would from a .env file.
Pause, unpair, upgrade
Section titled “Pause, unpair, upgrade”- Pause one agent, or Pause all agents, in Settings → Agents. Their requests are refused until you resume.
- Unpair: run
bs-gate unpairon the computer, and remove the agent in the app too, so its pairing can’t be used again. - Upgrade: run the install command again. It replaces
bs-gatein place and keeps your pairing. - Your own lists:
bs-gate config initwrites the default allow and deny lists, andbs-gate config pathshows where they are.
Troubleshooting
Section titled “Troubleshooting”| What you see | What to do |
|---|---|
| Claude Code runs everything without asking | Check the hook names bs-gate by its full path, sits in your user settings, and that you restarted Claude Code. Run the same path with –version to check it works. |
| Every request is denied with no prompt | The agent may be paused in the app, or the pairing removed. bs-gate status shows the pairing; pair again with bs-gate pair –replace if needed. |
| The phone never shows the request | Open the app. With the desktop app open on that computer, requests go there instead of the phone. Requests last two minutes, then they’re denied. |
| “This pairing code has expired” or “was already used” | Run bs-gate pair again; an offer lasts 5 minutes and works once. |
| The installer says there’s no build for your system | Windows and ARM Linux aren’t built yet. |
What it doesn’t do
Section titled “What it doesn’t do”- It isn’t a sandbox. Approving
./deploy.shapproves whatever that script runs. - It only sees what the agent asks through the hook. Keep the hook where the agent can’t edit it, and give the agent only the access it needs.
- Claude Code is the only agent with a hook today. Other tools can wrap commands in
bs-gate run. - Git servers and deploy steps don’t check approvals yet, even though each one is signed so they can.
More on what it does and why: Better Approvals.
Need help?
Section titled “Need help?”Email contact@betterid.net. Please don’t send secrets, or screenshots that show them.