> ## 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.

# Check messages: guidelines

> A guideline uses a rater and adds roles, question owners and referrals.

*Generated from the `rslc` compiler.*

## E-USE

**Read a used program through its outcomes.**

A guideline prices a submission with a rater it names in `use ts = "rater.rsl"`. The rater's root record becomes a type, `ts.Policy`, and a call reads one result: `ts(self.policy).premium`.

The check keeps the used rater a closed box. The guideline gives it inputs and reads the values its `RatingOutcomes` lists. Each read is a call, so one spelling marks every place the guideline depends on the rater.

The rater's author is then free to change its internal calculations. The guideline keeps working while the outcomes stay the same.

**Example**

The referral reads the rater's premium by path, `self.policy.premium`, where a call belongs.

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
            premium: Premium = ts(self.policy).premium
        }
    } refer large_account when self.policy.premium >= large_premium
            to @Role.manager because "The premium is $10,000 or more." [cite: guideline:p2]
}
```

```sh theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
rslc check bad/guideline.rsl
```

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
FAIL bad/guideline.rsl (strict)
error: E-USE bad/guideline.rsl:34:32: `ts.Policy.premium` is an outcome of the program used as `ts`; read it as `ts(…).premium`, the one spelling of a used program's outcome
```

**Fix**

Read the outcome as a call of the used program.

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
            premium: Premium = ts(self.policy).premium
        }
    } refer large_account when ts(self.policy).premium >= large_premium
            to @Role.manager because "The premium is $10,000 or more." [cite: guideline:p2]
}
```

**Other causes**

Reading the used program:

* The guideline reads a calculation that the rater's `RatingOutcomes` leaves out. Add it to the rater's `RatingOutcomes`, then read it as a call.
* A call names an outcome the rater lacks, such as `ts(self.policy).total`. Use a name from the rater's `RatingOutcomes`.
* A call's argument is an expression, or a record other than the rater's root. Pass a path to the root record, such as `self.policy`.
* A call stands alone, as `ts(self.policy)`. Read one outcome of it, or `match` it.
* A `match` on a call has arms other than `Rated(r)` and `Declined`, or its `Declined` arm binds a name.
* One calculation matches the call and another reads an outcome directly. Read every outcome through `match`.
* The guideline has a `use` and calls it nowhere. Read an outcome, or remove the `use`.

The `use` line:

* The path names a file that is missing, a file in another folder, or the guideline itself. Keep the rater beside the guideline.
* Two `use` lines share an alias. Give each its own.
* The alias contains `__`, or the guideline declares a name that starts with the alias and `__`. Rename it.
* The `use` line carries a list of outcomes in braces. Write `use ts = "rater.rsl"` alone.
* The `use` sits in an imported file. Move it to the guideline.

The used file:

* The used file declares `Roles` or `Acts`, or has a `use` of its own. A used program is a plain rater.
* The used file lacks `RatingOutcomes`. Declare the values the guideline reads.
* Both files declare `Premium`, or another numeric type of the language, with different precisions. Make the two declarations the same.

> [accordion] Complete files
>
> ```rsl bad/guideline.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.1",
>     carrier: "Example Mutual",
>     state: AZ,
>     product: "Staffing Liability Underwriting Guideline",
>     effective_date: 2026-01-01
> }
>
> use ts = "rater.rsl"
>
> Roles = { uw < manager }
>
> Acts = { quote: @Role.uw, bind: @Role.uw }
>
> Sources = {
>     guideline: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     large_premium [cite: guideline:p2] = 10000
> }
>
> Records = {
>     Submission = {
>         inputs {
>             policy: ts.Policy
>         },
>         step premium {
>             premium: Premium = ts(self.policy).premium
>         }
>     } refer large_account when self.policy.premium >= large_premium
>             to @Role.manager because "The premium is $10,000 or more." [cite: guideline:p2]
> }
>
> RatingOutcomes = {
>     premium: Submission.premium
> }
> ```
>
> ```rsl bad/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.1",
>     carrier: "Example Mutual",
>     state: AZ,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> Sources = {
>     manual: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000000"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     rate_per_1000 [cite: manual:p3] = 2
> }
>
> Records = {
>     Policy = {
>         inputs {
>             payroll: Num {precision: int} where self in [0, 100000000]
>         },
>         step rating {
>             premium: Premium [cite: manual:p3] = round(self.payroll / 1000 * rate_per_1000, 2, half_up)
>         }
>     }
> }
>
> RatingOutcomes = {
>     premium: Policy.premium
> }
> ```
>
> ```rsl good/guideline.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.1",
>     carrier: "Example Mutual",
>     state: AZ,
>     product: "Staffing Liability Underwriting Guideline",
>     effective_date: 2026-01-01
> }
>
> use ts = "rater.rsl"
>
> Roles = { uw < manager }
>
> Acts = { quote: @Role.uw, bind: @Role.uw }
>
> Sources = {
>     guideline: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     large_premium [cite: guideline:p2] = 10000
> }
>
> Records = {
>     Submission = {
>         inputs {
>             policy: ts.Policy
>         },
>         step premium {
>             premium: Premium = ts(self.policy).premium
>         }
>     } refer large_account when ts(self.policy).premium >= large_premium
>             to @Role.manager because "The premium is $10,000 or more." [cite: guideline:p2]
> }
>
> RatingOutcomes = {
>     premium: Submission.premium
> }
> ```
>
> ```rsl good/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.1",
>     carrier: "Example Mutual",
>     state: AZ,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> Sources = {
>     manual: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000000"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     rate_per_1000 [cite: manual:p3] = 2
> }
>
> Records = {
>     Policy = {
>         inputs {
>             payroll: Num {precision: int} where self in [0, 100000000]
>         },
>         step rating {
>             premium: Premium [cite: manual:p3] = round(self.payroll / 1000 * rate_per_1000, 2, half_up)
>         }
>     }
> }
>
> RatingOutcomes = {
>     premium: Policy.premium
> }
> ```

## E-ROLE

**A role is declared before it is named.**

A guideline says who does what on a submission. `Roles` lists the roles in chains that read lowest first, such as `uw < manager`. `Acts` gives `quote` and `bind` each a role. An input takes a role with `by @Role.uw`, and a referral goes `to @Role.manager`.

The check asks that every `@Role.name` is a role the `Roles` section declares, and that `Roles` and `Acts` are well formed. A submission then always has someone with the authority to answer each question and sign off each referral.

The check also keeps a role's answers apart from the terms of a quote. An input marked `per quote` is a term: each quote of a submission may hold its own answer to it. A role's answer is a judgment about the risk, and every quote of a submission prices one risk. So an input takes `by` or `per quote`, one of the two.

**Example**

The referral goes to `@Role.supervisor`, and `Roles` declares `uw` and `manager`.

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
        }
    } refer large_account when self.premium >= large_premium
            to @Role.supervisor because "The premium is $10,000 or more." [cite: guideline:p2]
}
```

```sh theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
rslc check bad/guideline.rsl
```

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
FAIL bad/guideline.rsl (strict)
error: E-ROLE @0-0: `@Role.supervisor` is not a declared role; the roles are `uw`, `manager`
```

**Fix**

Name a declared role. To add a role, put it in a `Roles` chain, such as `uw < manager < supervisor`.

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
        }
    } refer large_account when self.premium >= large_premium
            to @Role.manager because "The premium is $10,000 or more." [cite: guideline:p2]
}
```

**Other causes**

* The guideline names a role and has `Roles` nowhere. Add `Roles = { … }`.
* A chain puts a role below itself, such as `uw < manager < uw`. Write each chain lowest first.
* The guideline declares `Roles` twice, or `Acts` twice. Keep one of each.
* `Acts` names something other than `quote` and `bind`, or gives one act two roles.
* A role is given by path, such as `policy.payrol by @Role.uw`, and a step of the path misses an input. Spell each step as its record declares it.
* `Roles` or `Acts` sits in an imported file. Move it to the guideline.
* An input of a nested record takes `by`. `rslc submission open` reports this cause. Give the role on the root record by path, `policy.payroll by @Role.uw`.
* An input takes both `by` and `per quote`, such as `limit: Num by @Role.uw per quote`. Keep one of the two.
* An input marked `per quote` sits at or under a path that a role answers, such as `policy.limit` under `policy by @Role.uw`. `rslc submission open` reports this cause. Drop the mark, or drop the role.
* A union or a list is marked `per quote` and holds an input that lacks the mark. `rslc submission open` reports this cause. Mark each input in it, or drop the mark on the union or the list.
* Two arms of one union share a field name, and one arm alone marks it `per quote`. `rslc submission open` reports this cause. Mark the field in both arms, or remove the mark.

> [accordion] Complete files
>
> ```rsl bad/guideline.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.1",
>     carrier: "Example Mutual",
>     state: AZ,
>     product: "Staffing Liability Underwriting Guideline",
>     effective_date: 2026-01-01
> }
>
> use ts = "rater.rsl"
>
> Roles = { uw < manager }
>
> Acts = { quote: @Role.uw, bind: @Role.uw }
>
> Sources = {
>     guideline: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     large_premium [cite: guideline:p2] = 10000
> }
>
> Records = {
>     Submission = {
>         inputs {
>             policy: ts.Policy
>         },
>         step premium {
>             premium: Premium = ts(self.policy).premium
>         }
>     } refer large_account when self.premium >= large_premium
>             to @Role.supervisor because "The premium is $10,000 or more." [cite: guideline:p2]
> }
>
> RatingOutcomes = {
>     premium: Submission.premium
> }
> ```
>
> ```rsl bad/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.1",
>     carrier: "Example Mutual",
>     state: AZ,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> Sources = {
>     manual: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000000"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     rate_per_1000 [cite: manual:p3] = 2
> }
>
> Records = {
>     Policy = {
>         inputs {
>             payroll: Num {precision: int} where self in [0, 100000000]
>         },
>         step rating {
>             premium: Premium [cite: manual:p3] = round(self.payroll / 1000 * rate_per_1000, 2, half_up)
>         }
>     }
> }
>
> RatingOutcomes = {
>     premium: Policy.premium
> }
> ```
>
> ```rsl good/guideline.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.1",
>     carrier: "Example Mutual",
>     state: AZ,
>     product: "Staffing Liability Underwriting Guideline",
>     effective_date: 2026-01-01
> }
>
> use ts = "rater.rsl"
>
> Roles = { uw < manager }
>
> Acts = { quote: @Role.uw, bind: @Role.uw }
>
> Sources = {
>     guideline: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     large_premium [cite: guideline:p2] = 10000
> }
>
> Records = {
>     Submission = {
>         inputs {
>             policy: ts.Policy
>         },
>         step premium {
>             premium: Premium = ts(self.policy).premium
>         }
>     } refer large_account when self.premium >= large_premium
>             to @Role.manager because "The premium is $10,000 or more." [cite: guideline:p2]
> }
>
> RatingOutcomes = {
>     premium: Submission.premium
> }
> ```
>
> ```rsl good/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.1",
>     carrier: "Example Mutual",
>     state: AZ,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> Sources = {
>     manual: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000000"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     rate_per_1000 [cite: manual:p3] = 2
> }
>
> Records = {
>     Policy = {
>         inputs {
>             payroll: Num {precision: int} where self in [0, 100000000]
>         },
>         step rating {
>             premium: Premium [cite: manual:p3] = round(self.payroll / 1000 * rate_per_1000, 2, half_up)
>         }
>     }
> }
>
> RatingOutcomes = {
>     premium: Policy.premium
> }
> ```

## E-REFER

**Each referral has its own name.**

A referral sends a submission to a role for sign-off: `refer name when condition to @Role.manager because "…"`. While the condition holds, the submission waits for that role's decision.

The referral's name is the question the role answers, as in `answer large_account = Approved`. The check asks for one referral per name. Each sign-off in the submission log then belongs to exactly one condition.

**Example**

Two referrals share the name `large_account`: one for the manager and one for the director.

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
    } refer large_account when self.premium >= large_premium
            to @Role.manager because "The premium is $10,000 or more." [cite: guideline:p2]
        refer large_account when self.premium >= jumbo_premium
            to @Role.director because "The premium is $50,000 or more." [cite: guideline:p2]
}
```

```sh theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
rslc check bad/guideline.rsl
```

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
FAIL bad/guideline.rsl (strict)
error: E-REFER @0-0: referral `large_account` is declared twice; a referral's name is its question
```

**Fix**

Give the second referral a name of its own.

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
    } refer large_account when self.premium >= large_premium
            to @Role.manager because "The premium is $10,000 or more." [cite: guideline:p2]
        refer jumbo_account when self.premium >= jumbo_premium
            to @Role.director because "The premium is $50,000 or more." [cite: guideline:p2]
}
```

**Other causes**

* A referral sits on a nested record. `rslc submission open` reports this cause. Move the referral to the root record and read the nested value by path.

> [accordion] Complete files
>
> ```rsl bad/guideline.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.1",
>     carrier: "Example Mutual",
>     state: AZ,
>     product: "Staffing Liability Underwriting Guideline",
>     effective_date: 2026-01-01
> }
>
> use ts = "rater.rsl"
>
> Roles = { uw < manager < director }
>
> Acts = { quote: @Role.uw, bind: @Role.uw }
>
> Sources = {
>     guideline: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     large_premium [cite: guideline:p2] = 10000,
>     jumbo_premium [cite: guideline:p2] = 50000
> }
>
> Records = {
>     Submission = {
>         inputs {
>             policy: ts.Policy
>         },
>         step premium {
>             premium: Premium = ts(self.policy).premium
>         }
>     } refer large_account when self.premium >= large_premium
>             to @Role.manager because "The premium is $10,000 or more." [cite: guideline:p2]
>         refer large_account when self.premium >= jumbo_premium
>             to @Role.director because "The premium is $50,000 or more." [cite: guideline:p2]
> }
>
> RatingOutcomes = {
>     premium: Submission.premium
> }
> ```
>
> ```rsl bad/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.1",
>     carrier: "Example Mutual",
>     state: AZ,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> Sources = {
>     manual: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000000"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     rate_per_1000 [cite: manual:p3] = 2
> }
>
> Records = {
>     Policy = {
>         inputs {
>             payroll: Num {precision: int} where self in [0, 100000000]
>         },
>         step rating {
>             premium: Premium [cite: manual:p3] = round(self.payroll / 1000 * rate_per_1000, 2, half_up)
>         }
>     }
> }
>
> RatingOutcomes = {
>     premium: Policy.premium
> }
> ```
>
> ```rsl good/guideline.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.1",
>     carrier: "Example Mutual",
>     state: AZ,
>     product: "Staffing Liability Underwriting Guideline",
>     effective_date: 2026-01-01
> }
>
> use ts = "rater.rsl"
>
> Roles = { uw < manager < director }
>
> Acts = { quote: @Role.uw, bind: @Role.uw }
>
> Sources = {
>     guideline: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     large_premium [cite: guideline:p2] = 10000,
>     jumbo_premium [cite: guideline:p2] = 50000
> }
>
> Records = {
>     Submission = {
>         inputs {
>             policy: ts.Policy
>         },
>         step premium {
>             premium: Premium = ts(self.policy).premium
>         }
>     } refer large_account when self.premium >= large_premium
>             to @Role.manager because "The premium is $10,000 or more." [cite: guideline:p2]
>         refer jumbo_account when self.premium >= jumbo_premium
>             to @Role.director because "The premium is $50,000 or more." [cite: guideline:p2]
> }
>
> RatingOutcomes = {
>     premium: Submission.premium
> }
> ```
>
> ```rsl good/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.1",
>     carrier: "Example Mutual",
>     state: AZ,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> Sources = {
>     manual: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000000"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     rate_per_1000 [cite: manual:p3] = 2
> }
>
> Records = {
>     Policy = {
>         inputs {
>             payroll: Num {precision: int} where self in [0, 100000000]
>         },
>         step rating {
>             premium: Premium [cite: manual:p3] = round(self.payroll / 1000 * rate_per_1000, 2, half_up)
>         }
>     }
> }
>
> RatingOutcomes = {
>     premium: Policy.premium
> }
> ```


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