The format

How RuleSpec compares

A side-by-side look at the same statute encoded in RuleSpec, DMN, OpenFisca, and Catala — and what each one chooses to leave out.

rulespec-us/statutes/26/1411/a.yamlSingle self-contained file
format: rulespec/v1
module:
  summary: IRC section 1411(a) imposes the net investment income tax.
imports:
  - us:statutes/26/1411/b
  - us:statutes/26/1411/c
rules:
  - name: niit_rate
    kind: parameter
    dtype: Rate
    source: 26 USC 1411(a)
    versions:
      - effective_from: '2013-01-01'
        formula: '0.038'
  - name: net_investment_income_tax
    kind: derived
    entity: TaxUnit
    dtype: Money
    period: Year
    unit: USD
    source: 26 USC 1411(a)
    versions:
      - effective_from: '2013-01-01'
        formula: |-
          niit_rate * min(
              net_investment_income,
              max(0, modified_agi - threshold_amount)
          )

Format comparison

RuleSpec is purpose-built for encoding law with auditability and temporal accuracy.

CapabilityDMNOpenFisca/PECatalaRuleSpec
Legal citationsPartialPartial
Temporal versioning
Formula languageFEELPythonCustomPython-like
File formatXMLPy + YAMLCustomYAML
Self-contained
Reform modeling
No magic numbers
LLM-friendlyPartialPartial

Legal citations

Filepath mirrors statute citation. rulespec-us/statutes/26/24/d/1/B.yaml encodes 26 USC § 24(d)(1)(B).

Time-varying values

Policy values change over time. Definitions track every historical value with effective_from effective dates.

No magic numbers

Only small integers (-1 to 3) allowed in formulas. All policy values must come from named definitions with statute citations.

Cross-references

Statute sections reference each other by name. The compiler resolves dependencies via topological sort.

Reform modeling

The amend keyword overrides any definition with new values. Model policy reforms without touching enacted statute files.

Temporal formulas

When laws change, track different formula versions with from effective dates and sunset provisions.

The encoded files are written for compilers, not for casual reading. The human-readable view of any encoded law lives in the app.