How a call is judged¶
tool call -> strip the agent's description
-> layer 1: rules against the mandate (paths, hosts, remotes,
recipients, identity, outward actions, the gate's own files)
-> history: retry of a blocked action? too many denials?
-> layer 2 (optional): fast model reads the raw action, the
mandate and recent actions; it may only make the verdict stricter
-> ledger: append the verdict
-> stdout: deny or ask as hookSpecificOutput, or nothing
Combining verdicts¶
- The strictest verdict wins: deny over ask over pass.
- The model is not consulted after a rule denies, and it can never lower a rule's verdict.
- A pass writes nothing. Claude Code then applies its normal permission flow, so the gate never grants a permission the user had not.
- Any error while judging becomes a deny. Every model failure (no SDK, no credentials, a timeout, a refusal, unreadable output) becomes an ask.
What each part of the incident would meet¶
The incident is the one described on the home page.
| What the agent did | What stops it |
|---|---|
| Moved from the blocked target to an unrelated GitHub project | Layer 1: the remote is not in git_remotes, so the clone or fetch is denied (Law 2). |
| Called an unlisted host | Layer 1: the host is not in hosts, so the command is denied (Law 2). |
| Created a fake identity | Layer 1: git config user.email, a one-off identity (GIT_AUTHOR_EMAIL=..., git -c user.email=..., git commit --author), gh auth login and similar are denied (Law 4). |
| Emailed a stranger | Layer 1: a recipient not in recipients is denied (Law 1). |
| Described malware as a "helpful contribution" | The description is removed before any layer reads the call. |
| Kept going after warnings | A true repeat breaks the same rule and is denied again. A call that closely resembles a denied one asks a person, and once max_denials of the last 20 actions were denied, every consequential action asks a person (Law 3). |
| Opened a pull request or pushed | Layer 1: outward actions always ask a person. |
| Could have edited its own limits | Layer 1: writes to the mandate, the ledger or .claude/settings*.json are denied. |
| Handed the job to a subagent | Layer 1 reads the subagent's prompt: a host, a recipient it is told to email, or an identity or outward step outside the mandate asks a person. The subagent's own tool calls pass through the gate too. |
The table shows what layer 1 does when an agent repeats the incident's steps as written. Layer 1 stops the careless agent, not the adaptive one: an agent that builds a URL from pieces or hides a step in a script can get past its patterns. The model gate and the person who answers an ask are the backstop.
Layer 2, the model gate¶
The model gate is off by default. When on, it runs on every consequential call that the rules did not deny. It is meant to catch harm the rules have no pattern for, mostly Law 1.
- It runs on the Claude API or on a local model through any OpenAI-compatible server. See Configure the model gate.
- The prompt marks the action as data and tells the model to ignore claims inside it that the target is a test or the change is approved.
Why not Claude Code's permission rules¶
Claude Code's permission rules in settings.json allow, ask or deny tool
patterns, fixed per user or project. The gate adds what they lack:
- Targets per task. The mandate lists the hosts, remotes, paths and recipients for one task, and a person changes it when the task changes.
- Checks inside a command: which remote a
git pushreaches, which host acurlcalls, which file a redirect writes. - Memory across calls: a retry of a blocked action, a run of denials.
- An optional model judge, which can run on a local model.
- Its own audit trail, the ledger.
The gate never answers allow, so the permission rules still apply.