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

# Check messages: state files

> A state file extends a base rater and states what one state changes. These messages concern its base and its forms.

*Generated from the `rslc` compiler.*

## E-EXTENDS

**A state file extends one base it reads.**

A state file names its base with `extends`: a file in the state file's own folder, `extends "base.rsl"`, or a released rater, `extends "example-gl" release 4`. The check reads the base first, compiles it alone, and applies the state file to it.

A released rater stands in `releases/example-gl/4/`, beside the state file. A state file writes one `extends`, and names a file that exists. A state file is a rater, and so is its base: `use` and `component: guideline` belong to a guideline that uses the state file. The guideline compiles it as the merged rater. A state file is checked from its file, beside its base, so `extends` in a source compiled from its text names no base. A base may itself extend another state file, and each file of that stack appears once.

**Example**

The state file names its base `countrywide.rsl`, and the folder holds the base as `base.rsl`.

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

extends "countrywide.rsl"

Sources = {
```

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

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
FAIL bad/rater.rsl (strict)
error: E-EXTENDS bad/rater.rsl:9:1: rater.rsl extends `countrywide.rsl`, and countrywide.rsl cannot be opened: No such file or directory (os error 2)
```

**Fix**

Name the file that holds the base.

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

extends "base.rsl"

Sources = {
```

> [accordion] Complete files
>
> ```rsl bad/base.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 bad/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.2",
>     carrier: "Example Mutual",
>     state: NV,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> extends "countrywide.rsl"
>
> Sources = {
>     filing: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> replace Constants = {
>     rate_per_1000 [cite: filing:p2] = 2.5
> }
> ```
>
> ```rsl good/base.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/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.2",
>     carrier: "Example Mutual",
>     state: NV,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> extends "base.rsl"
>
> Sources = {
>     filing: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> replace Constants = {
>     rate_per_1000 [cite: filing:p2] = 2.5
> }
> ```

## E-LAYER-ITEM

**A state form names a base declaration.**

`replace`, `amend` and `drop` each change a declaration of the base. Each form names one that the base holds: a table, a constant, a type, a record, a chain step or the code of a rule.

The check compares each name with the base. A name the base lacks is a misspelling, or a declaration of the state's own. A state's own declaration stands in a plain section, such as `Constants = { … }`. The forms of a state file stand in the state file itself, and an imported file holds sections only. A file that writes a form names its base with `extends`, and a source compiled from its text, which has no base, writes none.

**Example**

The state file replaces `rate_per_100`, and the base names its constant `rate_per_1000`.

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
replace Constants = {
    rate_per_100 [cite: filing:p2] = 2.5
}
```

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

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
FAIL bad/rater.rsl (strict)
error: E-LAYER-ITEM bad/rater.rsl:19:5: rater.rsl writes `replace` on `rate_per_100`, and base.rsl declares no constant `rate_per_100`; a state-only constant stands in its own section, with no `replace`
```

**Fix**

Name the base's constant.

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
replace Constants = {
    rate_per_1000 [cite: filing:p2] = 2.5
}
```

> [accordion] Complete files
>
> ```rsl bad/base.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 bad/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.2",
>     carrier: "Example Mutual",
>     state: NV,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> extends "base.rsl"
>
> Sources = {
>     filing: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> replace Constants = {
>     rate_per_100 [cite: filing:p2] = 2.5
> }
> ```
>
> ```rsl good/base.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/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.2",
>     carrier: "Example Mutual",
>     state: NV,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> extends "base.rsl"
>
> Sources = {
>     filing: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> replace Constants = {
>     rate_per_1000 [cite: filing:p2] = 2.5
> }
> ```

## E-REPLACE-INCOMPLETE

**A replacement covers the base's declaration.**

Each calculation of the base reads the state's replacement, so the replacement holds everything the base declares. A replaced table has the base's keys in the same order, and each base column under its name and type. A table's rows are the rows of one file. A state that changes one row declares the whole table in `replace Tables` and names its own CSV. That CSV file holds a row for each key of the base's rows, so the base table's own CSV file stays in the folder, and a bundle of the state holds it. Each key compares by its declared type. A number key, such as a band, compares by value, so `1` and `1.0` are one key. An enumeration key compares by its text, so the values `"1"` and `"1.0"` are two.

A replaced enumeration holds every member of the base's enumeration, and the state replaces each base table that the type keys. A table in the state's own `Tables` section is keyed by the state's type, and needs no replacement. Each base member keeps its id, so every read of the base reads the same member. A new member takes the next id. A band type stays a band type, a code a code and a value list a value list. A replaced constant is a value of the base's type. A replacement may add columns and members.

**Example**

The state's `ClassRate` names its column `rate`, and the base's calculations read `rate_per_1000`.

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
    ClassRate [cite: filing:p2] :
        table dims (operation: Operation) -> {
            rate: Rate
        }
        path: "tables/nv/ClassRate.csv"
```

```csv theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
operation,rate
staffing,2.5
peo,3
```

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

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
FAIL bad/rater.rsl (strict)
error: E-REPLACE-INCOMPLETE bad/rater.rsl:19:5: rater.rsl replaces the table `ClassRate` of base.rsl, and it has no column `rate_per_1000`; a replacement holds every key and column of the base's table, under the same names and types
```

**Fix**

Keep the base's column name in the state's table and in its CSV file.

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
    ClassRate [cite: filing:p2] :
        table dims (operation: Operation) -> {
            rate_per_1000: Rate
        }
        path: "tables/nv/ClassRate.csv"
```

```csv theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
operation,rate_per_1000
staffing,2.5
peo,3
```

> [accordion] Complete files
>
> ```rsl bad/base.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
>     }
> }
>
> Types = {
>     Operation = {
>         staffing,
>         peo
>     }
> }
>
> Tables = {
>     ClassRate [cite: manual:p3] :
>         table dims (operation: Operation) -> {
>             rate_per_1000: Rate
>         }
>         path: "tables/ClassRate.csv"
> }
>
> Records = {
>     Policy = {
>         inputs {
>             payroll: Num {precision: int} where self in [0, 100000000],
>             operation: Operation
>         },
>         step rating {
>             rate_per_1000: Rate = lookup!(ClassRate, self.operation).rate_per_1000,
>             premium: Premium [cite: manual:p3] = round(self.payroll / 1000 * self.rate_per_1000, 2, half_up)
>         }
>     }
> }
>
> RatingOutcomes = {
>     premium: Policy.premium
> }
> ```
>
> ```rsl bad/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.2",
>     carrier: "Example Mutual",
>     state: NV,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> extends "base.rsl"
>
> Sources = {
>     filing: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> replace Tables = {
>     ClassRate [cite: filing:p2] :
>         table dims (operation: Operation) -> {
>             rate: Rate
>         }
>         path: "tables/nv/ClassRate.csv"
> }
> ```
>
> ```csv bad/tables/ClassRate.csv theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> operation,rate_per_1000
> staffing,2
> peo,2.4
> ```
>
> ```csv bad/tables/nv/ClassRate.csv theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> operation,rate
> staffing,2.5
> peo,3
> ```
>
> ```rsl good/base.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
>     }
> }
>
> Types = {
>     Operation = {
>         staffing,
>         peo
>     }
> }
>
> Tables = {
>     ClassRate [cite: manual:p3] :
>         table dims (operation: Operation) -> {
>             rate_per_1000: Rate
>         }
>         path: "tables/ClassRate.csv"
> }
>
> Records = {
>     Policy = {
>         inputs {
>             payroll: Num {precision: int} where self in [0, 100000000],
>             operation: Operation
>         },
>         step rating {
>             rate_per_1000: Rate = lookup!(ClassRate, self.operation).rate_per_1000,
>             premium: Premium [cite: manual:p3] = round(self.payroll / 1000 * self.rate_per_1000, 2, half_up)
>         }
>     }
> }
>
> RatingOutcomes = {
>     premium: Policy.premium
> }
> ```
>
> ```rsl good/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.2",
>     carrier: "Example Mutual",
>     state: NV,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> extends "base.rsl"
>
> Sources = {
>     filing: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> replace Tables = {
>     ClassRate [cite: filing:p2] :
>         table dims (operation: Operation) -> {
>             rate_per_1000: Rate
>         }
>         path: "tables/nv/ClassRate.csv"
> }
> ```
>
> ```csv good/tables/ClassRate.csv theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> operation,rate_per_1000
> staffing,2
> peo,2.4
> ```
>
> ```csv good/tables/nv/ClassRate.csv theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> operation,rate_per_1000
> staffing,2.5
> peo,3
> ```

## E-LAYER-CONFLICT

**One layer supplies each name.**

Each name of a state's rater has one supplier: the base, or one form of one state file. A plain section of a state file declares names of the state's own. A name the base holds stands in a `replace` or an `amend` form.

A stack of state files follows the same rule. Two files of the stack, or two forms of one file, that supply one name get this message. A field a state file adds to a record is one name too: the file adds each input, calculation and chain step once, in one `amend Records` form or one `amend chain` step.

**Example**

The state file declares the constant `rate_per_1000` in a plain section, and the base declares it too.

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

Constants = {
    rate_per_1000 [cite: filing:p2] = 2.5
}
```

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

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
FAIL bad/rater.rsl (strict)
error: E-LAYER-CONFLICT bad/rater.rsl:19:5: rater.rsl declares the constant `rate_per_1000`, and base.rsl declares it too; write it in `replace Constants = { … }`, or give the state's constant a name of its own
```

**Fix**

Replace the base's constant.

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

replace Constants = {
    rate_per_1000 [cite: filing:p2] = 2.5
}
```

> [accordion] Complete files
>
> ```rsl bad/base.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 bad/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.2",
>     carrier: "Example Mutual",
>     state: NV,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> extends "base.rsl"
>
> Sources = {
>     filing: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     rate_per_1000 [cite: filing:p2] = 2.5
> }
> ```
>
> ```rsl good/base.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/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.2",
>     carrier: "Example Mutual",
>     state: NV,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> extends "base.rsl"
>
> Sources = {
>     filing: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> replace Constants = {
>     rate_per_1000 [cite: filing:p2] = 2.5
> }
> ```

## E-FOREIGN-CITE

**A base cites its own sources.**

A base compiles alone and under each state file that extends it. A citation of the base names a source that the base declares, so the base reads the same in each of them.

A state's page that restates a base value belongs to the state file. The state file declares the source and re-cites the value with `replace`.

**Example**

The base cites the state's filing, and only the state file declares the source `filing`.

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
Constants = {
    rate_per_1000 [cite: filing:p2] = 2
}
```

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

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

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
FAIL bad/rater.rsl (strict)
error: E-FOREIGN-CITE bad/base.rsl:17:26: base.rsl cites `filing`, a source only rater.rsl declares; a base cites its own sources, so it reads the same alone and under every state file. Move the citation to a `replace` in rater.rsl, or declare the source in base.rsl
```

**Fix**

Cite the base's own manual in the base, and re-cite the value in the state file. The replacement keeps the base's value.

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
Constants = {
    rate_per_1000 [cite: manual:p3] = 2
}
```

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

replace Constants = {
    rate_per_1000 [cite: filing:p2] = 2
}
```

> [accordion] Complete files
>
> ```rsl bad/base.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: filing:p2] = 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 bad/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.2",
>     carrier: "Example Mutual",
>     state: NV,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> extends "base.rsl"
>
> Sources = {
>     filing: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
> ```
>
> ```rsl good/base.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/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.2",
>     carrier: "Example Mutual",
>     state: NV,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> extends "base.rsl"
>
> Sources = {
>     filing: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> replace Constants = {
>     rate_per_1000 [cite: filing:p2] = 2
> }
> ```

## E-CHAIN-NARROW

**A chain amendment adds a step.**

A chain is the arithmetic of a calculation, `((head op v1) op v2) …`, under its `round`. A step is named by the value it reads. `amend chain` adds a named step before or after a base step, and the base steps keep their order and their values.

An added step stands after the value the chain starts from, and has a name of its own. An amended record adds calculations under names of their own too. Each value of the base keeps its definition in every state.

**Example**

The state file adds a surcharge before `payroll`, the value the premium's chain starts from.

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
amend chain Policy.premium {
    surcharge: * nv_surcharge before payroll [cite: filing:p2]
}
```

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

```text theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
FAIL bad/rater.rsl (strict)
error: E-CHAIN-NARROW bad/rater.rsl:23:5: rater.rsl adds the step `surcharge` to the chain `Policy.premium` before `payroll`, and the chain of base.rsl starts from `payroll`: a step before it would change what the chain starts from. Write `after payroll`
```

**Fix**

Put the step after a base step. Here the surcharge follows the rate.

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
amend chain Policy.premium {
    surcharge: * nv_surcharge after rate_per_1000 [cite: filing:p2]
}
```

> [accordion] Complete files
>
> ```rsl bad/base.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 bad/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.2",
>     carrier: "Example Mutual",
>     state: NV,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> extends "base.rsl"
>
> Sources = {
>     filing: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     nv_surcharge [cite: filing:p2] = 1.05
> }
>
> amend chain Policy.premium {
>     surcharge: * nv_surcharge before payroll [cite: filing:p2]
> }
> ```
>
> ```rsl good/base.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/rater.rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
> spec {
>     rsl: "0.4.2",
>     carrier: "Example Mutual",
>     state: NV,
>     product: "Staffing Liability",
>     effective_date: 2026-01-01
> }
>
> extends "base.rsl"
>
> Sources = {
>     filing: Source = {
>         artifact: artifact("00000000-0000-4000-8000-000000000001"),
>         kind: pdf
>     }
> }
>
> Constants = {
>     nv_surcharge [cite: filing:p2] = 1.05
> }
>
> amend chain Policy.premium {
>     surcharge: * nv_surcharge after rate_per_1000 [cite: filing:p2]
> }
> ```


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