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

# Rules, grants and decisions

> A rule holds or opens acts, a grant names the role for each step, and a decision stands while what it read is unchanged.

A process decides which acts are open with two parts.
A **rule** holds an act, or opens one. A **grant** names the role that may take each step.
A **decision** by a role settles a rule, and it stands while the values it read stay the same.

## Rules

A rule is a condition in a process. While the condition holds, the rule acts on the acts that it names.
While the condition is unknown, the rule waits for the answers it reads.

| Rule | While its condition holds |
| - | - |
| A check with a `code` | Declines the subject, which opens the `refuse` act |
| `refer … to @Role.r` | Holds each offer until `r` decides: it is recorded, not taken |
| `require … before bind` | Holds the accept act until its role records the receipt |
| `[… overridable by @Role.r]` | Declines the subject until `r` overrides it with a reason |
| `[… not_offered]` | Holds the offer of one option, and the subject stays eligible |
| `note … to @Role.r` | Shows the case to `r`, and every act stays open |

A check in a function refuses a call. A rule in a process acts on the acts of a subject.

## Grants

| Grant | Written as | Means |
| - | - | - |
| Answer | `financially_sound: Bool by @Role.uw` | `uw` answers this input |
| Act | `bind: accept live -> bound by @Role.uw` | `uw` takes this act |
| Decide | `refer new_venture … to @Role.manager` | `manager` decides this rule |
| Override | `[… overridable by @Role.manager]` | `manager` may lift this decline, with a reason |

`Roles` orders the roles once, lowest first:

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
Roles = { assistant < uw < manager }
```

In RSL 0.4.2, a role may do what each role below it does.
Roles in two chains stand side by side, and each one answers only its own questions.
An input with a `by` takes answers from that role and the roles above it. Every other input takes an answer from any role.
The log refuses a write by another role as `NOT_AUTHORIZED`.

## Lapse

This rule of the staffing example asks a manager to decide on a young firm:

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
        refer new_venture when self.years_in_operation < established_years
            to @Role.manager because "The firm is in operation for less than 3 years." [cite: guideline:p1]
```

The manager's `decide` entry records the values that the condition read: here, `years_in_operation`.

* The decision stands while each of those values is the same.
* When one changes, the decision lapses, and the status names the changed value.
* A change to any other answer, such as the payroll, leaves the decision standing.
* A return to the values it read restores the decision, while the documents it cites stay the same.

An offer follows the same rule. It stands while the program, the answers and the decisions it rests on stay the same.
This status of the staffing example names what changed under each lapsed offer:

```sh theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
rslc examples get staffing
cd staffing
rslc script bind.script --keep submission.jsonl
rslc log status submission.jsonl
```

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
...
status: accepted
offers:
  draft  lapsed (policy.payroll, years_in_operation changed)
  q1  lapsed (policy.payroll, years_in_operation, new_venture changed)
  q2  accepted
referrals:
  new_venture  Approved  @manager
outcomes:
  premium = 6000
```

## Related

* [Guidelines](https://docs.canary.effectiveai.app/rsl/reference/language.md#guidelines) in the language reference gives each form of a rule and a grant.
* [Statuses](https://docs.canary.effectiveai.app/rsl/reference/submission-log.md#statuses) lists each referral and offer state and when a decision lapses.
* [Turn guidelines into a program](https://docs.canary.effectiveai.app/guides/underwriting/write-guidelines.md) writes these rules for one submission.


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