← All lab updates
The gate in Claude Code in two minutes
How to put the deterministic gate in front of Claude Code: one install command, two modes, and the rules that decide what the agent may run on your machine.
## Why
Claude Code runs commands on your machine with your permissions. Almost all of them are fine. A few should never run (sudo, a force push, reading your keys), and some are fine only if you say so (a package with no pinned version, a push). The gate checks each command before it runs and answers the same way every time.
## Install
From inside Claude Code:
```
/plugin install splabs-gate --marketplace SiliconPsycheLabs/gate
```
Claude Code asks for your key, the mode and the hosts the agent may reach. Or with pip:
```
pip install "git+https://github.com/SiliconPsycheLabs/gate"
gate claude-code install --key psa_gate_...
```
## Two modes
- **Shadow**: the gate records what it would have decided and blocks nothing. Start here for a day and look at the count.
- **Enforce**: the gate's answer is applied. A refused command does not run and the agent reads the rule's fixed reply. A held command becomes Claude Code's own approval prompt, on the laptop or on the phone.
## What the rules do, out of the box
| The agent tries | The gate |
|---|---|
| `sudo ...` | refuses |
| writing or deleting outside the project folder | refuses |
| reading `.env`, keys or other secret files | refuses |
| `git push --force`, deleting a remote branch, pushing to the default branch | refuses |
| `git push` to a work branch | asks you |
| installing a package with no pinned version | asks you |
| a network call after a secret was read in the session | asks you |
| changing services, containers or cloud resources | asks you |
| editing a test so it always passes or is skipped | asks you |
| editing the gate's own settings | refuses |
The check runs in Claude Code's harness, not in the model, so the agent cannot talk its way past it. Every answer, yours included, goes into the log and the count.
Full guide: the manual chapter on the gate for Claude Code.
This update is not available.