> For the complete documentation index, see [llms.txt](https://knowledge.rollcredits.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledge.rollcredits.io/approvals/rules.md).

# Write AI approval rules

Write plain-English rules that an AI checks transactions against when they're sent for approval, and see where flagged transactions show up for reviewers.

Approval rules are plain-English rules an AI checks every transaction against when it's sent for approval. Open them from **Approvals > Approval Rules** in the sidebar, which shows the page to Owners, Super Admins and Managers.

A failed rule only flags the transaction for a reviewer. It never blocks, approves or rejects anything, and the flag clears once any reviewer approves.

## Add a rule

1. Select **Add rule**.
2. In **Applies to** at the top, choose **Project - this project only** or **Company - every project in the company**. Only Owners and Super Admins can choose Company.
3. Enter a **Name**, such as "Large invoices need a PO".
4. In **Rule**, write the rule the way you'd explain it to a new coordinator. For example: "Flag any invoice over $10,000 that does not reference a purchase order number."
5. Under **Applies to**, below the rule, tick the kinds of transaction it checks: **Invoices**, **Estimates**, **P-Card**, **Other Expenses** and **Journal Entries**. All start ticked. Leave at least one.
6. Leave **Enabled** on to start checking with the rule. Turn it off to keep the rule without checking it.
7. Select **Save**.

A name can be up to 200 characters, and a rule up to 10,000.

A flag shows reviewers the rule's name and the AI's explanation, not the rule text, so give each rule a name that explains itself.

## What happens when you save

Saving first checks whether the AI can evaluate the rule with what RollCredits knows about a transaction. If it can check all of the rule, the rule saves. Otherwise, one of these notes opens with an explanation:

* **The AI can only check part of this rule**: the explanation says which part won't be checked. Select **Save anyway** to save it, and the AI checks the parts it can. Or select **Back** and reword it.
* **The AI can't check this rule**: a rule like this can't be saved. Select **Back** and reword it, using the explanation as a guide.

If the check itself can't run, RollCredits tells you and saves the rule without it.

The AI reads the transaction's details in RollCredits, such as amounts, coding, notes, custom fields and where its budget lines stand, plus its main attached document. It doesn't read additional documents.

## Edit a rule

1. Select **Edit** on the rule.
2. Make your changes in **Edit approval rule**.
3. Select **Save**.

The save check runs again only when you change the **Name**, the **Rule** or the kinds of transaction. Turning a rule on or off, or moving it between Project and Company, saves without it. Only Owners and Super Admins can move a rule to or from Company.

## Delete a rule

1. Select **Delete** on the rule.
2. In **Delete approval rule**, select **Confirm**.

Transactions already flagged by the rule keep the explanation they were given.

## The rules list

Each rule shows its name, a **Company** or **Project** label, the rule text and the kinds of transaction it applies to. Rules that are turned off also show **Disabled**.

* Company rules are listed first. They show on every project's Approval Rules page, and each transaction is checked against both the company's rules and its project's rules.
* Managers see Company rules marked **Company managed**, with **Edit** and **Delete** greyed out.
* When there are no rules yet, the page says "No approval rules yet. Add one to start flagging transactions for review."

## When transactions are checked

* The AI checks a transaction each time it's sent for approval, against every enabled rule for its kind of transaction, until a reviewer approves it. If it's then rejected, or someone selects **Undo Send** or **Undo Approve**, the next send checks it again.
* Transactions from RollCredits payroll runs are never checked.
* A transaction is flagged only when it fails at least one rule. If the AI can't run, the transaction goes through approval as usual, with no flag.

## Where reviewers see flags

Everyone who can see a flagged transaction sees its flag.

* On the Review page, an **AI flagged only** checkbox appears while any transaction you can see on the production is flagged. See [Review and approve transactions](/approvals/review.md).
* In a transaction's side panel, an **AI flagged** badge shows at the top, with a count when more than one rule failed. At the top of the **Approvals** tab, **Flagged by AI review (N)** lists each failed rule's name with the AI's explanation. See [Review and edit a transaction](/transactions/transactions/edit-a-transaction.md).
* In the transactions table, the **AI Review** column shows **Flagged**. The column appears once a transaction is flagged. See [Find and edit transactions in the table](/transactions/transactions/find-and-edit.md).
* In envelope review, the envelope's review header shows "N flagged by AI review" and each flagged receipt shows **AI flagged** with its findings. Press **F** to jump to the next flagged receipt. When you select **Approve all (N)**, the window shows how many of those receipts are flagged. See [Review an envelope](/approvals/review/review-envelopes.md).

Point at an **AI flagged** or **Flagged** badge to see its findings, which end with when the transaction was checked.

{% hint style="info" %}
Under **Couldn't check**, the findings list rules the AI couldn't judge for that transaction because it didn't have what the rule needs, with the reason. These never flag a transaction on their own, so they appear only alongside a failed rule.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://knowledge.rollcredits.io/approvals/rules.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
