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

# Use the rslc commands

> Check, format, and package an RSL rater, and read the reference in your terminal.

The examples run on the dwelling-fire rater from [Write your first rater](https://docs.canary.effectiveai.app/rsl/tutorial/first-rater.md). To work on a fresh copy, save the example and enter its folder:

```sh theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
rslc examples get dwelling
cd dwelling
```

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
WROTE dwelling/rater.rsl
WROTE dwelling/tables/BaseRate.csv
```

With a `dwelling/` folder from the tutorial, run `cd dwelling` alone.

| Command | Purpose |
| - | - |
| `rslc check` | Check the implemented algorithm |
| `rslc fmt` | Format the source |
| `rslc export` | Package a rating program |
| `rslc explain` | Explain a check message, with its fix |
| `rslc docs` | Read the language reference offline |

[The command reference](https://docs.canary.effectiveai.app/rsl/reference/commands.md) lists every command and every option.

## Check a rater

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

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
PASS rater.rsl (strict)
cost premium: 16 + 2*|Policy.items| (each list of size 1: 18, 3: 22, 10: 36)
```

The cost line describes calculation work as the number of scheduled items changes.

A failed check prints `FAIL` and one message for each problem. Each message carries a code, the file position, and a suggested fix.

[Checks and guarantees](https://docs.canary.effectiveai.app/rsl/explanation/checks-and-guarantees.md) describes what a passing check establishes.
Review the source interpretation and test independent examples to establish filing fidelity.

## Explain a check message

Pass a message's code to `rslc explain`:

```sh theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
rslc explain E-PROVENANCE
```

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
# E-PROVENANCE: A filed number needs a citation
...
```

The entry states what the check asks for, shows a rater that gets the message, and shows the corrected rater.
[Check messages](https://docs.canary.effectiveai.app/rsl/reference/check-messages.md) holds the same entries by topic.

## Format the source

Apply the standard layout:

```sh theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
rslc fmt rater.rsl
```

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
PASS rater.rsl is formatted
```

A file that needs a change is rewritten in place, and the command prints `FORMATTED rater.rsl`.

To check formatting while preserving the file:

```sh theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
rslc fmt --check rater.rsl
```

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
PASS rater.rsl is formatted
```

A formatting difference produces a diff and a failing exit status.

## Package a rater

After the rater passes its checks, export a bundle:

```sh theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
rslc export rater.rsl --format bundle --out dwelling.zip
```

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
WROTE bundle: dwelling.zip
```

Choose a new output filename. Export fails when the destination already exists.
Export also writes `rater-manifest.json` and `runtime/rslc_wasm.wasm` beside the source.

The bundle includes a book schema and an identity `prepare` function derived from the native rater's input schema.
The book follows the rater's own inputs. Structural IDs identify submissions and list items; names that collide receive distinct table or column names.
Load the bundle with `Program.load` and inspect `program.schema` for its tables and columns.
The generated `prepare` passes those values to the native rater. [Package a program](https://docs.canary.effectiveai.app/relativities/how-to/package-a-program.md) describes custom preparation and regression examples.

> [accordion] Bundle contents
>
> | File | Purpose |
> | - | - |
> | `rater.rsl` | Rating source |
> | `tables/*.csv` | Rating tables |
> | `rater-manifest.json` | Engine identity and file hashes |
> | `runtime/rslc_wasm.wasm` | The rating engine this bundle rates with |
> | `program-manifest.json` | Program identity and file hashes |
> | `program/input-schema.json` | Native input schema |
> | `program/program.py` | Book schema and identity prepare function |
>
> A rater that imports other RSL files or reads enum members from `enums/*.csv` carries those files too.

[Rate submissions with a rater](https://docs.canary.effectiveai.app/relativities/how-to/rate-submissions-with-a-rater.md) shows how to use the bundle in Python.

## Read the reference in your terminal

`rslc docs` prints the reference for the installed version:

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

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
RSL 0.4.1 reference. Run `rslc docs TOPIC`:

  sections     the sections of a file, in order
  types        the types and type forms
  functions    the functions; `rslc docs round` explains one
  annotations  the annotation keys, such as `cite` and `ask`
  messages     the check messages; `rslc explain E-CODE` explains one

`rslc examples` lists the example raters.
```

The same text builds the reference pages on this site, such as [Sections, types and annotations](https://docs.canary.effectiveai.app/rsl/reference/names.md) and [Functions](https://docs.canary.effectiveai.app/rsl/reference/functions.md).
`rslc docs round` explains one function, and `rslc examples` lists the example raters.

## Use commands in scripts

Each command reports its result in its exit status:

| Exit status | Meaning |
| - | - |
| `0` | The command succeeded: the check passed, or the file is formatted |
| `1` | A check failed, `fmt --check` found a difference, or a file is missing |
| `2` | The command line is wrong, such as a missing argument or an unknown command |

Add `--json` for structured output:

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

The check returns one JSON object containing `ok`, `diagnostics`, `cost`, and other details.

Use `--help` to inspect a command’s options:

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


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