ADR-006: Jurisdiction-Agnostic Ruleset Organization
Status
Accepted
rulesets/test-min/, rulesets/test-max/) that exercise it, and a federal option registry (compliance/federal-options/) that enumerates the state-option layer machine-checkably.
federal_year, hot reload and CANOPY_JURISDICTION mechanisms in §2, §3, §4 and §6 were built differently, and the §3 sample is illustrative. Rulesets is the live description.
{fiscal_year}.{major}.{minor} mandate and its "stores the version string in the rule_evaluations audit table" clause are superseded — a ruleset file’s version is free-form human change tracking that no code parses, and the corpus content hash persisted in ruleset_corpus_versions is the audit and replay identity. The body is unchanged; see Amendment 2.
Context
ADR-003 established that all eligibility logic lives in versioned JDM ruleset files evaluated by canopy-rules.
The current ruleset path is rulesets/georgia/, which works for Georgia DHS but implies that other jurisdictions would need to fork the entire ruleset directory or modify Georgia’s rules.
Public benefit programs are administered under a combination of:
-
Federal floor rules — mandated by statute and regulation; no state option (e.g., gross income test at 130% FPL is the federal floor for SNAP; the net income test at 100% FPL is mandatory)
-
Federal parameters — set annually by federal agencies (e.g., FPL thresholds, maximum SNAP allotments, standard deductions); apply uniformly across all jurisdictions
-
State options — explicit state elections that can be exercised independently (e.g., BBCE, simplified reporting, interview waiver, vehicle exclusion methodology)
-
State-set values — thresholds and amounts that states determine entirely (e.g., TANF benefit amounts, TANF income limits, Medicaid income limits above federal floor)
-
State-specific provisions — unique to a jurisdiction (e.g., Georgia Pathways 1115 waiver work requirement)
A jurisdiction deploying Canopy needs to: * Use the correct federal parameters for the current fiscal year * Configure their elected state options * Set their own state-determined thresholds * Add any jurisdiction-specific provisions
The question is how to structure the ruleset repository to support this without requiring jurisdictions to copy-edit an entire ruleset library.
Decision
1. Ruleset directory structure
Each jurisdiction has its own directory under rulesets/:
rulesets/
├── federal/ # Federal parameters (FPL tables, max allotments)
│ ├── fpl-2026.json # FY2026 Federal Poverty Level table by household size
│ ├── snap-allotments-2026.json # FY2026 SNAP maximum monthly allotments
│ ├── snap-deductions-2026.json # FY2026 SNAP standard deductions, shelter caps
│ └── ...
├── georgia/ # Georgia DHS jurisdiction-specific rulesets
│ ├── snap-eligibility.json
│ ├── snap-benefit-calculation.json
│ ├── snap-categorical-eligibility.json
│ ├── snap-abawd.json
│ ├── tanf-eligibility.json
│ ├── tanf-benefit-calculation.json
│ ├── tanf-work-requirements.json
│ ├── medicaid-magi.json
│ ├── medicaid-non-magi.json
│ ├── medicaid-eligibility-hierarchy.json
│ ├── chip-eligibility.json
│ ├── caps-eligibility.json
│ └── wic-eligibility.json
└── {other-jurisdiction}/ # Future jurisdictions
└── ...
2. Federal parameters as shared input data
Federal parameters (FPL thresholds, SNAP maximum allotments, standard deductions) are not hardcoded in jurisdiction rulesets.
They are stored in rulesets/federal/ as versioned JSON data files.
canopy-rules loads federal parameter files at startup and makes them available as named inputs to any ruleset evaluation.
A jurisdiction ruleset references federal parameters by name:
{
"nodes": [
{
"type": "inputNode",
"id": "federal_params",
"name": "Federal Parameters",
"source": "federal/snap-deductions-2026"
},
...
]
}
Federal parameter files are updated annually when FNS publishes new figures (typically each October). A federal parameter update does not require changes to any jurisdiction ruleset — the rulesets reference the parameter file by name, and the parameter file is replaced.
canopy-rules supports a federal_year configuration parameter (default: current fiscal year) to select which federal parameter vintage to use.
This allows testing future-year parameters before they take effect.
3. Jurisdiction configuration
Each jurisdiction that deploys Canopy provides a jurisdiction.toml configuration file (loaded by canopy-rules at startup):
[jurisdiction]
name = "georgia"
display_name = "Georgia Department of Human Services"
admin_unit_label = "County" # or "Region", "District", "Chapter"
federal_year = 2026 # which vintage of federal parameters to use
[snap]
bbce_enabled = true
bbce_income_limit_pct_fpl = 130 # Georgia: 130% (same as gross income limit)
bbce_asset_test_eliminated = true
simplified_reporting = true
interview_waiver_enabled = true
vehicle_exclusion_method = "one_per_licensed_adult" # or "fmv_cap"
standard_certification_months = 12
elderly_disabled_certification_months = 24
medical_deduction_standard_enabled = false # Georgia uses actual expenses
[tanf]
income_limit_pct_fpl = 50
max_monthly_grant_family_3 = 280 # USD
time_limit_months = 60
[medicaid]
expansion_type = "pathways_1115_waiver" # "full_expansion", "no_expansion", "pathways_1115_waiver"
pathways_work_requirement_hours_per_month = 80
chip_upper_income_limit_pct_fpl = 247
[caps]
income_limit_pct_smi = 85 # Federal ceiling; Georgia may set lower
Jurisdiction configuration is read by canopy-rules and injected as named inputs to ruleset evaluations alongside federal parameters.
4. Ruleset versioning
Each ruleset file carries a version header:
{
"version": "2026.1.0",
"jurisdiction": "georgia",
"program": "snap",
"effective_date": "2026-10-01",
"description": "SNAP eligibility rules for Georgia, FY2026",
"nodes": [...]
}
canopy-rules stores the version string in the rule_evaluations audit table with every evaluation.
When a policy change triggers a ruleset update, the version is incremented.
Older ruleset versions remain importable for retrospective QC review and appeals.
Version format: {fiscal_year}.{major}.{minor}
* fiscal_year — changes when federal parameters change (annually)
* major — changes when eligibility logic changes (new categories, new deduction types)
* minor — changes when values change within existing logic (threshold adjustments, error corrections)
5. Adding a new jurisdiction
A new jurisdiction deploying Canopy:
-
Creates
rulesets/{jurisdiction}/directory -
Copies the
rulesets/georgia/ruleset templates as a starting point -
Creates
rulesets/{jurisdiction}/jurisdiction.tomlwith their configuration -
Updates threshold values and state option flags in
jurisdiction.toml -
Modifies or extends ruleset files for any jurisdiction-specific provisions (e.g., a unique categorical eligibility pathway)
-
Does not need to modify any Rust code
The only code change a new jurisdiction requires is adding their jurisdiction value to the CANOPY_JURISDICTION environment variable in their deployment configuration.
6. canopy-rules loading behavior
At startup, canopy-rules:
-
Reads
CANOPY_JURISDICTIONenvironment variable (default:georgia) -
Loads
jurisdiction.tomlfromrulesets/{jurisdiction}/jurisdiction.toml -
Loads all federal parameter files for the configured
federal_year -
Imports all
*.jsonruleset files fromrulesets/{jurisdiction}/ -
Makes federal parameters and jurisdiction config available as named inputs in all evaluations
Rulesets are hot-reloadable: PUT /v1/rulesets/{name} replaces a ruleset in memory and database without service restart (for policy updates).
Rationale
Why per-jurisdiction directories instead of parameterized templates?
An alternative considered was a single set of "template" rulesets with jurisdiction parameters injected at evaluation time. This was rejected because:
-
JDM rulesets are not designed as parameterized templates — they are decision tables
-
Jurisdiction-specific provisions (e.g., Georgia Pathways work requirement) are structural additions, not parameter substitutions
-
A jurisdiction with highly divergent rules (tribal TANF, for example) would need to override most of the template anyway
-
Per-jurisdiction directories make the scope of jurisdictional changes obvious from the file tree
Why jurisdiction.toml for configuration instead of more JDM files?
Threshold values and option flags are configuration, not decision logic.
Putting them in jurisdiction.toml (a structured config file) rather than JDM makes them:
-
Easier to read and audit (TOML is more readable than JDM JSON for named values)
-
Faster to update (changing a TOML value doesn’t require re-importing a JDM file)
-
Consistent across all rulesets in a jurisdiction (one file, not twelve)
-
Easier to diff between jurisdictions or between fiscal years
Why fiscal-year versioning for federal parameters?
SNAP allotments, FPL thresholds, and standard deductions are updated each October 1 (start of federal fiscal year). Versioning by fiscal year makes it unambiguous which parameter vintage applies to a given evaluation. This is critical for QC review: a case evaluated in FY2025 must be reviewable with FY2025 parameters, even after FY2026 parameters are loaded.
Consequences
Benefits
-
Zero code changes to deploy Canopy in a new jurisdiction — only ruleset files and
jurisdiction.toml -
Federal parameter updates require only replacing one JSON file per parameter type per year
-
Jurisdiction-specific provisions are isolated to one directory — no risk of one jurisdiction’s rules affecting another
-
Audit trail includes ruleset version — every determination is reproducible from historical ruleset versions
-
OpenStack analogy holds: Canopy is the platform;
rulesets/{jurisdiction}/is the configuration layer
Costs and risks
-
Ruleset library grows with each new jurisdiction — needs governance to prevent divergence in logic that should be shared
-
Testing must cover all jurisdiction profiles, not just Georgia — CI must parameterize integration tests by jurisdiction
-
Federal parameter files must be maintained annually — risk of forgetting to update them before October 1 cutover
Out of scope
-
Automated FPL table import from HHS API — future enhancement
-
Multi-jurisdiction single deployment (one Canopy instance serving multiple states) — not supported; requires separate deployments
-
Tribal TANF-specific adaptations — will be addressed when the first tribal TANF jurisdiction adopts Canopy
Amendment 1 (2026-09-17) — as built
Status unchanged (still Accepted). The directory principle and the federal / jurisdiction split hold; several mechanisms §Decision describes in the present tense were built in a different shape. This amendment records the shipped shape; the Decision and Consequences are not edited. The live description of the tree, the file format and jurisdiction.toml is Rulesets.
-
Loader and hot reload (§6).
NamedFilesystemLoader::scan(services/canopy-rules/src/engine.rs) walksrulesets/federal/thenrulesets/{jurisdiction}/once at startup; a jurisdiction file shadows a federal file of the same name. There is noPUT /v1/rulesets/{name}: the rules API (crates/canopy-contracts-rules/src/paths.rs) isLIST_RULE_SETS,GET_RULE_SET,EVALUATE,LIST_EVALUATIONSandGET_CORPUS, and therule_setstable was dropped (services/canopy-rules/migrations/20260412000000_drop_rule_sets_table.sql). A ruleset change is a commit plus a service restart (ADR-003 Amendment 1). -
Federal parameters (§2). No
rulesets/georgia/.jsoncontains a JDMinputNodewith a"source"reference. Callers pass jurisdiction thresholds in the evaluation envelope undercontext.thresholds.(namespacedincrates/canopy-rules-client/src/lib.rs), and the federal JSON files load as named rulesets through the same loader. There is nofederal_yearknob — no.rs,.toml,.jsonor.yamlin the tree names one; vintage is carried by effective-dated file names (snap-allotments-2026.json,snap-allotments-2027.json) and the per-family cutover windows inrulesets/federal/indexing.toml(ADR-011, 2026-06-09 amendment; ADR-031). -
jurisdiction.toml(§3). The §3 sample is illustrative (2026-03). The real file (rulesets/georgia/jurisdiction.toml) carries[meta](uuid,version— the ADR-028 policy-parameter revision),[jurisdiction](name,fips_state_code,admin_unit_label,timezone, …) and nested program tables; it has nodisplay_nameand nofederal_year. Every service that consumes it (all butcanopy-exchange) resolves it at startup from its own configured slug, notcanopy-rulesalone. -
Jurisdiction selection (§5, §6). The per-service key is
CANOPY_<SERVICE>__JURISDICTION(ServiceSettings::jurisdiction, required with no shipped default since #2627: only the development overlayconfig/<service>/dev.yamlnames one); the unprefixedCANOPY_JURISDICTION(JURISDICTION_ENVincrates/canopy-common/src/settings.rs) is a whole-stack override layered under the per-service key (Configuration Reference › Layering). The slug must name an existingrulesets/<slug>/jurisdiction.toml(validate_jurisdiction_exists). -
Directory tree (§1).
snap-categorical-eligibility.jsonandsnap-abawd.jsonwere never created.rulesets/also holdsdefault/,test-min/andtest-max/(ADR-011, ADR-032), andrulesets/georgia/carriescitations.toml,idp.toml,theme.tomland thecomposition/,notices/,scenarios/andworkflows/directories beside the JDM files. -
Versioning (§4). Three SNAP names use
{fiscal_year}.{major}.{minor}—snap-eligibility.json(2026.1.2),snap-self-employment-deduction.json(2026.1.0) andrulesets/federal/snap-alien-eligibility.json(2026.1.2; this bullet first counted two, the count Amendment 2 corrects); the other rulesets usevN.N.rule_evaluationsrecordsrule_set_name, not a version string (services/canopy-rules/migrations/20260326000000_create_rules_tables.sql); reproducibility is carried by the ADR-028 snapshot’spolicy_params_version([meta].version) and the ADR-002 Amendment 2 composite policy target (corpus_hashfromGET /v1/corpus). The mixed version convention is recorded here, not normalised.
Amendment 2 (2026-09-17) — the ruleset version string is free-form; the corpus hash is the identity (#2101)
Status unchanged (still Accepted). This amendment records the decision posted on #2101 (2026-09-17, option B): §4 is rewritten to the as-built contract instead of the ruleset files being normalised to §4; the Decision, Rationale and Consequences are not edited. Amendment 1's versioning bullet recorded the mixed convention without ruling on it; this amendment rules, and corrects that bullet’s count — rulesets/federal/snap-alien-eligibility.json (2026.1.2) is a third fiscal-year-form name beside the two SNAP files it lists.
-
What
versionis. A ruleset file’s top-levelversionis a free-form string for human change tracking; an author bumps it when that helps a reader of the diff, in whichever form the file already uses. No code parses it:NamedFilesystemLoader::scan(services/canopy-rules/src/engine.rs) reads a file’snodes(to recognise a JDM file) andnameand nothing else of the header (get_rule_set, behindGET /v1/rule-sets/{name}, returns the parsed file as one JSON document — every key,versionincluded — without inspecting any key); the only occurrences of the word inservices/canopy-rules/src,crates/canopy-rules-client/srcandcrates/canopy-contracts-rules/srcare comments and error strings about the corpus version; andcargo xtask rules lint-inputslistsversionamong the metadata keys it skips (is_metadata_pointer,xtask/src/cmd/rules_lint.rs). The tree keeps both forms as they are —2026.1.2/2026.1.0on the three SNAP names (snap-eligibility.json,snap-self-employment-deduction.json,federal/snap-alien-eligibility.json; nine files) andvN.Mon the other forty-three nodes-bearing JDM files underdefault/,georgia/,test-min/,test-max/andfederal/(census 2026-09-17: fifty-two files, the same string on every jurisdiction copy of a file). The{fiscal_year}.{major}.{minor}format, the meaning of its three parts and "When a policy change triggers a ruleset update, the version is incremented" are withdrawn as requirements; no lint rejects any form and none is planned. ThevN.Mform matches the'v1.0'default of the droppedrule_sets.versioncolumn (services/canopy-rules/migrations/20260326000000_create_rules_tables.sql). -
What the audit trail stores.
rule_evaluationshas never held a version string. Its columns areid,rule_set_name,context_type,context_id,input,output,duration_msandcreated_at(20260326000000_create_rules_tables.sql;idlost itsgen_random_uuid()default under20260805000000_v7_pk_defaults.sql), andstore::record_evaluation_tx(services/canopy-rules/src/store.rs) binds every column butcreated_at—idminted in the store (canopy_types::id::RuleEvaluationId::new()), the other six from theEvaluationAuditRecordthe engine builds per audited evaluation: the ruleset’s logicalname, the caller’s(context_type, context_id), theinputandoutputenvelopes and the timing (RulesEngine::evaluate, skipped for?audit=false). The table is service-internal evaluation telemetry written off the hot path byEvaluationAuditor(#1296), not the audit of record. §4’s "stores the version string in therule_evaluationsaudit table with every evaluation" is superseded by this bullet. -
What identifies a ruleset version. The identity of the rules a determination ran against is the corpus content hash (#682). At startup
scandigests the raw bytes of every winning JDM file (Sha256::digest(raw.as_bytes())) andcompute_corpus_hashfolds the name-sorted digests into one SHA-256, so a byte change in any such file — aversionedit included — changes the hash. The hash is returned ascorpus_hashon everyEvaluateResponse(crates/canopy-contracts-rules/src/rule_sets.rs), served live byGET /v1/corpus(CorpusInfo; the corpus half of the ADR-002 Amendment 2 composite policy target), stamped into the determination snapshot asDeterminationSnapshot::corpus_hash(crates/canopy-contracts-eligibility/src/snapshot.rs; ADR-028) and carried perRuleFiring, whoseRuleRefdoc states the rule: the version of a rule site is the evaluation’scorpus_hash, and per-rule semantic versioning is deliberately not minted. -
What replay reads.
RulesEngine::newpersists the winning content of the booted corpus toruleset_corpus_versions—corpus_hash,ruleset_name,content,created_at, primary key(corpus_hash, ruleset_name)(services/canopy-rules/migrations/20260626000000_create_ruleset_corpus_versions.sql) — throughstore::persist_corpus_versionbefore the service serves traffic, andPOST /v1/evaluate?corpus_hash=<hash>rebuilds that exact corpus from the table (replay_corpus→store::load_corpus_version; an unknown hash is 422, T2-7 #680). The persistedcontentis zen-engine’sDecisionContent, which serialisesnodesandedgesonly (zen-engine0.55.0,src/model/decision_content.rs), so the humanversionstring is not in the replay table at all — it is witnessed only through the file bytes the hash covers. §4’s "Older ruleset versions remain importable for retrospective QC review and appeals" and the Consequence "Audit trail includes ruleset version — every determination is reproducible from historical ruleset versions" read as-built as this table keyed by this hash. Parameter vintage — §Rationale’s "why fiscal-year versioning" — travels in the effective-dated federal file names,rulesets/federal/indexing.tomland the ADR-028 Amendment 6params_digest, not in a ruleset header (Amendment 1).
Rulesets › Adding a ruleset and Jurisdiction Onboarding › Step 3 state the scheme in one sentence each and point here.
Amendment 3 (2026-11-11) — a decision is federal by law, not by sameness (#3371)
Status unchanged. A JDM decision lives in the federal layer when the program's rules are uniform nationally and a State varies them only through options federal law enumerates (compliance/federal-options/), each reaching the decision as pack data. Otherwise it is the jurisdiction pack's. snap-eligibility, snap-benefit-calculation, snap-self-employment-deduction and wic-eligibility meet the test and moved to the federal layer; no pack carries a copy, and a pack that ships one must declare it (overrides, declared overrides). Identical text across packs is not evidence: the packs were copied from Georgia's. The Medicaid, CHIP, TANF and CAPS decisions stay in the packs until each is classified (#3373).
Amendment 4 (2026-11-17) — a pack declares its classes of assistance (#655)
Status unchanged. §3 put a jurisdiction's values in jurisdiction.toml and left its vocabulary in code: the Medicaid and CHIP classes of assistance were a Rust enum of one State's programmes, with their limits as flat keys, their labels and denial sentences as string tables, and their T-MSIS groups as a separate map. A second State could not write Medicaid without those programmes.
A class of assistance is now a row the pack declares ([[medicaid.classes]]: code, label, track, benefit type, T-MSIS group, named limits and values), and shared code names none. The pack's decisions answer class codes and read each class's limits from the row; canopy-medicaid refuses a code no row declares. Denial sentences are rows too ([[medicaid.denial_reasons]]), the Express Lane income thresholds are the pack's ([medicaid.express_lane]), and a determination carries the label and sentences it was decided with, so a letter printed later says what the pack said then. Rulesets › Medicaid and CHIP classes is the live description.
What stays in code is what federal law fixes: the three tracks (magi, non_magi, chip), the benefit types, the Medicare Part A bases, and the Express Lane tiers medicaid and chip. The rule this sets for later work: a closed vocabulary belongs in shared code only when federal law closes it; otherwise it is rows in the pack, checked by canopy config check.
Amendment 5 (2026-11-21) — canopy's own state machine is not a pack vocabulary (#2211)
Status unchanged. Amendment 4 set the rule that a closed vocabulary belongs in shared code only when federal law closes it. This amendment records a second case the maintainer ruled on 2026-11-16 (#3415): a closed list that names the states or transitions of canopy's own machinery stays in code, because canopy's code branches on each member and a pack that added one would add nothing the code could act on.
The administrative-denial reasons are that case. AdministrativeDenialReason has two members, missed_interview and verification_not_provided: the two procedural failures on which canopy itself denies an application (7 CFR 273.2(h)(1)-(2)). Each is bound by a constraint to the row that proves it, and the reopen and reinstatement paths branch on which one it is. The list stays an enum and a CHECK, and the neutrality gate records it as by design.
The same ruling moved the lists that are a jurisdiction's to the pack: the intake document types, the reported income sources and the manual citation of each intake section (the intake plan). Interview modes and postponement revert reasons are neither settled case: a waiver interview mode carries machinery of its own, and they wait on a jurisdiction-extension plan (#3500).