Skip to content

Set up Better Approvals

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.

  • 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.

On the computer where your agent runs, paste this into a terminal:

Terminal window
curl -fsSL https://updates.betterid.net/bs-gate/install.sh | sh

The 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.

  1. 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.

  2. 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.

  3. 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.

  4. The app and the terminal each show a 6-digit code. If they’re the same, tap It matches in the app and type y in the terminal. If they differ, or the terminal shows none, tap It doesn’t match and type N: 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.

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.

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.

Any command, script or CI step can ask first. It runs only if you approve:

Terminal window
bs-gate run -- ./deploy.sh production

Keep 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:

Terminal window
bs-gate secret run DATABASE_URL --for "run migrations" -- npm run migrate

The 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 one agent, or Pause all agents, in Settings → Agents. Their requests are refused until you resume.
  • Unpair: run bs-gate unpair on 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-gate in place and keeps your pairing.
  • Your own lists: bs-gate config init writes the default allow and deny lists, and bs-gate config path shows where they are.
What you seeWhat to do
Claude Code runs everything without askingCheck 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 promptThe 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 requestOpen 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 systemWindows and ARM Linux aren’t built yet.
  • It isn’t a sandbox. Approving ./deploy.sh approves 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.

Email contact@betterid.net. Please don’t send secrets, or screenshots that show them.