---
title: "How rules work"
description: "A Shell's policy is plain-English rules. Clam checks every request against them before it runs, and anything not allowed is blocked."
route: /docs/policies/how-rules-work
---

# How rules work

A Shell's policy is a set of plain-English rules for what your agent may do with your email. Clam checks every request through that Shell before the action runs. Anything the rules don't allow is blocked.

## What happens when I write a rule?

Clam turns your words into permissions and shows you its interpretation before you activate them. Check that the review matches what you meant. Warnings explain anything Clam couldn't apply.

Once you activate the policy, those permissions govern the agent's requests.

## What happens when my agent makes a request?

Clam checks the action and the emails involved. There are three outcomes:

- Allow: the action runs.
- Ask me before: the action waits for your [approval](https://useclam.ai/docs/trust/approvals).
- Block: the action doesn't run.

A matching block overrides both approval and allow rules. A matching approval rule requires your approval even if another rule allows the action.

For example, suppose you allow reading work email but block banking email. A message labelled both work and banking is blocked. A message labelled only travel is also blocked: no rule allows reading it.

## What can rules use?

Rules pair an action, such as reading, archiving, drafting or replying, with the mail it applies to. Search follows your read rules; reply all follows your reply rules.

Clam categorizes email by its content, using labels such as work, receipts and banking. Rules can use these labels, your custom labels or Gmail's own, such as Inbox and Starred.

Rules can also use senders, recipients, subjects, dates, attachments and read state. They can't directly match words in an email's body; use labels for topics.

For replies and forwards, label permissions apply to the original email. Label blocks also check the outgoing text's categories. Recipient rules check everyone on To, Cc and Bcc.

## What if an email hasn't been labelled?

Email without a Clam label stays blocked until it has been labelled and checked against your rules. Clam can label newly arrived mail when your agent first requests it. If labelling hasn't finished, try again shortly.

Now write your own: [Writing effective policies](https://useclam.ai/docs/policies/writing-effective-policies).
