> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloudthinker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Approval Rules

> Find, review, accept, and edit the Rules that let an agent write run on its own, wait for a person, or never run

A Rule names one kind of write, such as `ec2:StopInstances` on your staging AWS account, and decides it before the [Approval mode](https://docs.cloudthinker.io/guide/approvals/approval-mode.md) does, once CloudThinker turns on Rule enforcement for your workspace. It's off by default: while the **Rules** step says **In preview**, Rules only record what they would decide and the Approval mode alone decides, so choose **Manual** for writes that must wait for a person ([details](#troubleshooting)). Agents propose Rules as they work, and nothing changes until a workspace Admin accepts one.

## Prerequisites

* The workspace Admin role to accept, edit, disable, or restore a Rule. Developers and Viewers can read Rules.
* At least one cloud account or cluster [connection](https://docs.cloudthinker.io/guide/connections/overview.md) to use **Find rules**.

## What a Rule contains

| Field | What it means |
| - | - |
| **Effect** | **Allow** runs the write. **Ask first** waits for a person. **Deny** refuses it. |
| **Operations** | The calls it covers. A `*` matches any part, so `ec2:Stop*` or `*:*`. AWS uses the IAM action name, such as `ec2:StopInstances`. Other connection types name operations their own way, so ask for those Rules with `/create-policy` and CloudThinker picks valid names from the connection's catalog. |
| **Connection type** and **Connections** | The connections it covers. Leave **Connections** empty to cover every connection of that type. |
| **Runs from** | The run types it covers: **Chat**, **Resolve**, **Optimize**, **Automations**, **Review**. Empty means all runs. |
| **Window** | How long the Rule lasts. Empty means no expiry. |
| **Note** | Why the Rule exists, for the next person who reads it |
| **Who approves this?** | **Ask first** only: Default approvers or one approver group, and whether it **Needs 2 different people** |
| **Never allow break-glass** | **Deny** only: no one can override it, not even the workspace owner |

A Rule never matches a read, sensitive reads included, because reads always run. An **Allow** Rule never matches a call CloudThinker cannot identify, such as a command that builds its arguments at run time, a program CloudThinker doesn't model, or an API path outside the connection's catalog. An **Allow** on every operation must name its connections.

Each Rule shows an access badge so you can spot risky ones fast:

| Badge | The Rule covers |
| - | - |
| **Write** | Calls that change a resource |
| **Destructive** | Deletes and other destructive calls, such as a Git force push |
| **Session** | Calls that open a remote shell, such as `ssh` |
| **Sensitive read** | Reads of secrets, such as a credentials file. These run anyway, so this part of the Rule never matches. |
| **Every operation** | `*:*`, every call on its connections |

## Find Rules for your workspace

A check-up is a chat where CloudThinker reads your connections, Optimize findings, incidents, alerts, and approval history, then proposes Rules for you to accept.

**1. Open the Rules tab**

Open **Approvals** in the sidebar, then the **Rules** tab.

![Rules tab with Active, Needs review, and Dismissed tabs, and the Add from template and Find rules buttons](https://mintcdn.com/cloudthinker/7N5Axt6gSxkmeWiW/images/v2/approvals-rules.webp?fit=max\&auto=format\&n=7N5Axt6gSxkmeWiW\&q=85\&s=628b2d66f5933714902a76aee3ef60f3)

The Rules tab: active Rules, Rules waiting for review, and Add from template or Find rules

**2. Pick what to look for**

Click **Find rules**. Keep or clear each focus:

| Focus | What it proposes |
| - | - |
| **Hand off toil** | Allow Rules for writes on development and staging connections |
| **Guard production** | Ask first Rules for destructive and session calls, plus Ask first or Deny on production writes people declined |
| **Clean up Rules** | Fixes for Rules that are unused, too wide, or missing a connection |

**3. Start the check-up**

Click **Start check-up**. It takes 5–10 minutes and uses credits. While it runs, the button reads **Check-up running** and opens that chat.

**Success state:** the banner on the **Rules** tab says how many Rules need your review, with a **Review** button.

You can also start a check-up from any chat by typing `/find-rules`.

## Ask for one Rule in chat

When you already know the Rule you want, type `/create-policy` in a chat. CloudThinker asks what you need, checks what your Rules do today, and posts a proposal card.

```text theme={null}
/create-policy Let agents stop and start EC2 instances on aws-staging without asking. Keep everything else on that account as it is.
/create-policy Always ask the On-call SRE group before any rds:Delete* call on production.
```

To turn a call you just approved into a Rule, click **Approve and draft rule** on its approval card. The call runs now, and a side chat drafts the Rule.

## Review and accept Rules

**1. Open the review**

On the **Rules** tab, click **Review** in the banner, or open the **Needs review** tab.

**2. Check each Rule**

Open a Rule to read it. **What would change** replays the last 7 or 30 days of calls against it and tells you how many would run without asking, ask first, or be refused, with example commands.

**3. Select and accept**

Nothing is selected at first. Select up to 50 Rules, then click **Accept** or **Dismiss**. An **Allow** on every operation, a destructive **Allow**, or a flagged **Allow** (one imported from an old grant that covers a risky access class, such as session calls) asks you to confirm first.

**Success state:** a toast says "Accepted N Rules" and offers **Undo**. A Rule that failed stays in the list with its reason.

The same proposals show as cards in the chat that made them. **Accept** on the card does the same as **Accept** on the **Rules** tab.

> [!NOTE]
>
> A proposal that overlaps **Always blocked**, the built-in list of calls that never run, cannot be accepted. It would never take effect, so dismiss it.

## Edit, disable, or restore a Rule

Open a Rule on the **Rules** tab. As an admin, you see the edit form straight away.

| Action | Result |
| - | - |
| **Save** on an active Rule | Replaces it at once. The old version is kept as **Replaced** and leaves the list. |
| **Save** on a proposal | Keeps it under **Needs review**. Accept it to turn it on. |
| **Change with AI** | Opens a chat that drafts the change as a new proposal |
| **Disable** | Stops the Rule from matching any call and moves it to **Dismissed** |
| **Restore** on a dismissed Rule | Makes it active again at once, with no expiry |

## Windows

A Window is a short-lived Rule made with one click: **Approve for…** on an approval card. It covers the exact operation and connection that was approved, only in that one chat or incident. It always ends: after **1 hour**, when the incident ends (**This incident**), or after **30 days**. A 30-day Window still never applies outside the chat where you approved it.

Windows show on the **Rules** tab with the source **Window** and their end time. You cannot edit a Window. To end it early, click **Disable** in its row menu.

## Filter the list

The **Active**, **Needs review**, and **Dismissed** tabs show their counts. Filter by **Source**, **Connector**, **Runs from**, or **Approved by**, or search by name.

| Source | Who made the Rule |
| - | - |
| **Person** | Someone in the Rule form |
| **Agent** | An agent proposal or a check-up |
| **Runbook** | A runbook |
| **Imported** | An old trust or runbook grant, or a policy file |
| **Window** | **Approve for…** on an approval card |
| **Template** | **Add from template** on the **Rules** tab |

## Export and import your policy

Keep your policy as a file, for example in Git, and load it into another workspace. Both actions are in the **…** menu next to **Find rules**.

* **Export active Rules** downloads `policy-<workspace>-<date>.yaml`. It holds your active Rules, approver groups, Approval modes, and the two-person setting. It never holds Windows, proposals, or secrets.
* **Import policy** reads a YAML or JSON file of up to 1 MB. It shows what would change and lists each problem by line and field first. It applies the file only when you click, and keeps the file if the apply fails. Import merges: Rules in the file are added or updated by `slug`, and Rules missing from the file stay as they are. Select **Remove Rules that are not in the file** to dismiss them instead. Imported **Ask first** and **Deny** Rules start active. An imported **Allow** Rule waits for review unless you turn on **Activate Allow Rules**.

```yaml theme={null}
version: 1
level: auto_ai_ask
origin_levels:
  automation: auto_ai_refuse
approver_groups:
  - name: On-call SRE
    members: [sre-lead@example.com]
rules:
  - slug: stop-staging
    description: Let the agent stop staging instances
    effect: allow
    connector: aws
    aliases: [aws-staging]
    operations: [ec2:StopInstances]
  - slug: ask-before-rds-delete
    effect: require_approval
    connector: aws
    operations: [rds:Delete*]
    approver_group: On-call SRE
```

| Key | Values |
| - | - |
| `level`, and each value in `origin_levels` | `manual`, `auto_rules_ask` (Rules · Ask me), `auto_rules_refuse` (Rules · Refuse), `auto_ai_ask` (Rules + AI · Ask me), `auto_ai_refuse` (Rules + AI · Refuse) |
| `origin_levels` keys, and a Rule's `applies_to` (**Runs from**) | `chat`, `resolve`, `keeper` (Optimize), `automation`, `review` |
| `effect` | `allow`, `require_approval` (Ask first), `deny` |
| `aliases` | Connection names (**Connections**) |
| `description` | The Rule's **Note** |
| `expires_at` | The Rule's end time (**Window** field) |
| `approver_group`, `two_person` | **Who approves this?** and **Needs 2 different people** |
| `break_glass_blocked` | **Never allow break-glass**, Deny only |
| `settings.two_person_mode` | `off`, `destructive`, `all_writes` |
| `approver_groups[].members` | Member email addresses |

## Troubleshooting

> [accordion] Find rules is not shown
>
> The agent's policy tool isn't turned on for your CloudThinker deployment, so check-ups, **Change with AI**, and the `/find-rules` and `/create-policy` commands are hidden. It's not a setting on this page. Contact CloudThinker support, or whoever runs your self-hosted deployment, to ask for it. You can still edit Rules in the form, add them from a template, or import a policy file.

> [accordion] Find rules asks you to connect something first
>
> A check-up needs at least one cloud account or cluster. Add one in [Connections](https://docs.cloudthinker.io/guide/connections/overview.md), then try again.

> [accordion] Accept is turned off
>
> You need the workspace Admin role, or the Rule overlaps **Always blocked**. If the Rule changed after you opened it, reload it and review it again.

> [accordion] The Rules tab says Rules are in preview
>
> Rules do not decide yet in this workspace. Each call is checked against them and only the result is recorded, so you can review and accept proposals now. Until enforcement is on, the [Approval mode](https://docs.cloudthinker.io/guide/approvals/approval-mode.md) alone decides each write. CloudThinker turns enforcement on per workspace; contact CloudThinker support to ask for it.

> [accordion] An Allow Rule does not let a write run
>
> Check enforcement first: if the **Rules** tab says Rules are in preview, no Rule decides anything yet (see above). Then check the mode: **Manual** asks before every write, even one an Allow Rule covers. Then check **Runs from** and **Connections**. A Rule only matches the run types and connections it names.

## Next steps

> [card] [Approval mode](https://docs.cloudthinker.io/guide/approvals/approval-mode.md)
>
> Decide what happens to a write that no Rule covers

> [card] [Approvers and Activity](https://docs.cloudthinker.io/guide/approvals/approvers.md)
>
> Choose who answers an Ask first Rule and audit what Rules decided


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.