# Grants and the ceiling

Every call has a [risk class](https://docs.cmdop.ai/concepts/risk-classes.md). It runs only when the caller's grant and the
machine's ceiling both allow that class.

| | Grant | Ceiling |
|---|---|---|
| Says | which risk classes one agent may use | the most any caller may do on one machine |
| Set | on the owner's page, Agents tab | in `ceiling.json` on the machine |
| Default | `read` for a new agent | `read`, `write`, `destructive`, `exec`, `network` |
| Covers | every machine of the contour | that machine only |
| Changed by | the owner, at once | the owner, at the machine, then a restart |

## How a call is decided

1. The call's tool has one risk class (`fs_write` is `write`, `exec_run` is `exec`).
2. The grant of the agent that calls must hold that class.
3. The machine's ceiling must hold it too. For a call that does not come from a client paired on
   the machine, the class must also be in the ceiling's `unpaired_risks` when it names any.
4. File tools also stay inside the ceiling's `roots`, away from the folders that hold keys unless
   `secrets` is on, and away from the files no tool may change. `control` also needs the app on
   the ceiling's `apps.allow`.

Any "no" returns [`denied`](https://docs.cmdop.ai/reference/errors/denied.md), with a message that names what is
missing. The check never changes a call's arguments: a call runs as sent, or is refused.

## Examples

| Grant | Ceiling | `fs_write` | `exec_run` |
|---|---|---|---|
| `read` | default | denied | denied |
| `read`, `write` | default | runs | denied |
| `read`, `write`, `exec` | `{"risks": ["read", "write"]}` | runs | denied |
| `read`, `write`, `exec` | `{"unpaired_risks": ["read"]}` | denied for MCP agents | denied for MCP agents |

## Related

[Grant risk classes](https://docs.cmdop.ai/guides/access/grant.md) · [Set the ceiling](https://docs.cmdop.ai/guides/access/ceiling.md) ·
[`ceiling.json`](https://docs.cmdop.ai/reference/config/ceiling-json.md)
