Solution · For security teams

Your engineers' agents already have a shell. The gateway checks each call, not the model.

Protect checks each tool call on the gateway, outside the model, before your agent runs it. A blocked call never reaches the shell, and the model only reads why.

The agent tries

The agent hides the file name inside a substitution.

Blocked · never reaches your shellRead environment files

Read as cat .env. The rule matches what the call does, not its text.

context-mode Protect blocked this command, so it was NOT executed:
Blocked by your team's policy: Read environment files. .env files hold secrets.

A Codex build sends its shell as a list of words.

{ "name": "local_shell",
  "input": { "action": { "type": "exec",
    "command": ["bash", "-lc", "cat .env"] } } }
Blocked · never reaches your shellRead environment files

Protect finds a shell by the shape of its input, not by its name.

You want to see a rule at work before it blocks.

aws s3 rm s3://backups --recursive
RunsChange cloud resources · monitor

The call runs. The log records "would block".

Balanced puts this rule in Monitor. Locked down blocks it.

A key on a laptop tries to turn Protect off.

API key: turn Protect off
403

An API key can only tighten the policy. To loosen it, a person signs in and gives a reason.

An auditor asks what the agents tried.

In each row

  • time, decision, mode
  • rule, type, tool
  • program, host, path
  • project, session, policy version

Never in a row

  • command text
  • flag values
  • environment values
  • file contents

Export as CSV or JSON Lines.

The problem

A rule inside the prompt is a request. A rule outside it is a control.

The shell is already open

In one session an agent can read a .env file, push to main or run rm -rf ~.

Text checks are easy to get past

Agents name their shells in many ways and hide one command inside another, such as cat $(echo .env).

Each laptop has its own rules

Client permissions live on each machine. You cannot see in one place what agents tried, or prove what was stopped.

How it works

Watch first. Then block.

  1. 01Keep every call on the gateway

    Rules run on the gateway, outside the model, so the model cannot change or skip them. For Claude Code, pin the base URL in managed settings. Codex cannot be pinned this way yet; see the limits.

  2. 02Run rules in Monitor

    A rule in Monitor lets the call run and logs "would block". Activity lists programs, sites and tool servers no rule covers yet.

  3. 03Keep the audit trail

    Each block goes into the decision log, with no command text. Each rule change goes into a hash-chained History. Export both for your auditor.

The agent sends its request through Context Mode to the model. The model answers with a tool call. Protect checks the call in Context Mode, against your policy. An allowed call goes back to the agent and runs. A blocked call goes back as a refusal and is written to the decision log. Your agent and the shell The model asks for a tool call Context Mode gateway Protect: check the call by what it does, against your policy allow: runs block: refusal decision log and policy history the model cannot change the rules
The model asks for a tool call. Protect checks it on the gateway before the call goes back to your agent. The model cannot change the rule: it only reads the refusal.
Proof

Tested by trying to get past it. On production.

126 of 126Protect API checks pass on production
42of the 103 matrix cases are bypass attempts
25 and 22live checks pass in real Claude Code and Codex sessions, 1 skip each
403for an API key that tried to turn Protect off

No refused call had a side effect. The test run and its findings →

What you can show an auditor

Every decision recorded. Every change in a hash chain.

ControlWhat Protect does
Where it decidesOn the gateway, before your agent runs the call
How a rule matchesBy what a call does, not its text: a command wrapped in xargs, ssh or another wrapper meets the same rule
Who can loosen itA person signed in to the console, with a reason. An API key can only tighten it.
Org policyOn Team, one policy for the org that agents cannot loosen
Decision logTime, rule, tool, program, host and path. No command text, flag values or file contents. Export as CSV or JSON Lines.
Policy historyWho, how and why for every change, in a hash chain. An edited or deleted entry breaks it.

Limits: Protect reads the call, not the program, so a script file or a compiled program gets past it. Keep the client sandbox on too. All limits →

Products used

What this uses.

Protect

Core protections, presets, packs, Sites and your own rules, checked on every tool call.

Protect docs

Every rule type, the decision log, history and each limit. See how to keep the gateway on.

Team and Enterprise

One org policy, or your own gateway: a dedicated instance or your own Cloudflare account.

Pricing

Protect is in every plan, Free included. It is off until you turn it on.

Related: Secure coding agents · For the enterprise · For platform teams

One policy for every agent. Held where the model cannot reach it.

npx @context-mode/cli connects your agents. 1,000 requests free, no card.

Get started free

Your coding agent costs less and remembers your project.

Start free: 1,000 requests, every feature, no card. After you sign in, the console gives you one command to connect Claude Code or Codex.

Read the docs