Skip to content

Policies

Approval rules say which actions wait for a person. Policies go further: they can refuse an action outright, and they can count what happened before. That lets you write rules such as “a person approves the first deploy each day”, “at most 200 shell commands an hour per sandbox” or “no more model calls once the organization has spent $50 today”. The counts cover every session and every sandbox, not just the agent’s current conversation.

Policies are checked before every tool call an agent makes and before every model call through the cell’s model gateway. A refused action never runs; the agent is told why and can try another way.

Under Policies → New policy, owners build a rule from a few choices (what the agent does, when, and whether to refuse it or ask one or two people), start from an example, or write Cedar forbid rules themselves. A built rule fills in the same text, so it can be read, tried and changed before it’s saved. Anything no rule forbids is allowed.

@reason("force pushes rewrite history")
forbid (principal, action == Action::"tool", resource == Tool::"Bash")
when { context.tool.command like "*git push*--force*" };
Annotation Effect
(none) The action is refused.
@approval A person is asked first, as with approvals. The sandbox sleeps while it waits.
@four_eyes With @approval: the person the agent works for can’t approve it.
@reason("...") What the agent and the log are told.

A policy can cover the whole organization or one team’s sandboxes, and can be switched off without removing it. If two rules match, a refusal wins over asking, and asking wins over allowing.

action Action::"tool" for an agent’s tool call, Action::"model" for a model call
resource Tool::"Bash", Tool::"Edit", Tool::"WebFetch", … or Model::"claude-sonnet-5-5"
context.tool name, command, file, url, host (empty when they don’t apply)
context.model The model, for model calls
context.sandbox id, team, access (shared, private or team), agent, region
context.history.sandbox / .org Calls of the same kind in the last hour and day, in this sandbox or the whole organization
context.history.sandbox_same / .org_same The same, for the same tool or model only
context.history.approved_day Approvals granted in this sandbox in the last day
context.spend Model spending in US cents: sandbox_cents_day, org_cents_day, org_cents_month
context.time hour (0–23) and weekday (mon … sun), in UTC

Counts don’t include the action being checked, nor actions that were refused.

// A second person approves the first deploy each day.
@approval @four_eyes
forbid (principal, action == Action::"tool", resource == Tool::"Bash")
when { context.tool.command like "*deploy*" && context.history.approved_day == 0 };
// At most 200 shell commands an hour in each sandbox.
forbid (principal, action == Action::"tool", resource == Tool::"Bash")
when { context.history.sandbox_same.hour >= 200 };
// No more model calls once the organization has spent $50 today.
forbid (principal, action == Action::"model", resource) when { context.spend.org_cents_day >= 5000 };
// Ask before calling Stripe at weekends.
@approval
forbid (principal, action == Action::"tool", resource)
when { context.tool.host == "api.stripe.com" && (context.time.weekday == "sat" || context.time.weekday == "sun") };

The editor’s Try it panel checks a command or model call against your draft with made-up history, without doing anything. From the command line:

Terminal window
stillbox policies add no-force-push --file no-force-push.cedar
stillbox policies test 'git push --force origin main'
stillbox policies test --model claude-opus-5-5 --sandbox sbx_123 # with that sandbox's real history
stillbox policies log --decision deny
  • Mistakes are caught when saving. Each policy is run against sample requests; text that isn’t valid Cedar, a permit rule, or a rule that refers to something that doesn’t exist is refused with the reason.
  • Policies fail closed. A rule that can’t be evaluated refuses the action rather than letting it through.
  • Model calls can’t wait. A policy marked @approval refuses a model call, since there’s nobody to hold it for.
  • Everything is recorded. Recent decisions keeps 40 days of checks, and every refusal is in the audit log.

Policies are enforced for agents that ask before acting (Claude Code’s hooks, and any program using harnessd approval) and for every model call through the gateway. An agent with a shell can still run commands directly, so pair policies with the sandbox’s internet access rules and narrowly scoped credentials.