Axiom FoundationLocal

The CLI, the subtree model, the presumption model, the JSON shapes, and embedding the engine in your own software.

The command

$ bun scripts/determine.mjs [--root <target>] [options]
--roots [filter]The subtree catalog: every sliceable root with its rule count. An optional filter matches targets and rule names (--roots snap, --roots 18-nycrr).
--root <target>Which subtree to slice (default us:regulations/7-cfr/273/10, the SNAP benefit computation). The root's import closure is compiled by the vendored engine and executed.
--set <slot>=<value>State a fact by slot name; anything unset takes its synthesized screening presumption. Repeatable. Unknown slots error with a pointer to --slots.
--what-if <parameter>=<value>Amend a statutory parameter inside the compiled artifact before running. Output is labeled AMENDED LAW with the current-law value; the corpus on disk is never touched.
--month <YYYY-MM>The determination period (default: the earliest month every parameter in the slice is live for, usually 2026-01).
--output <name>Which output the trace focuses on (default: the slice's first output — the root module's own rules are the outputs).
--tracePrint the chain of citation — every figure with the durable legal id of the rule that produced it.
--depth <n>Trace depth (default 3).
--slotsList every input the slice can consider: entity, type, and slot name.
--jsonThe determination envelope: outputs, the full trace, every input as applied (stated vs presumed), the compiled closure and corpus pin, certification + ledger identity, and engine provenance. The page's JSON affordance emits the identical shape.
--helpUsage with examples.

The subtree model

The corpus subtree is the unit — there is no program registry and no pre-composed bundle. Every module in the vendored corpus (public/corpus/, regenerated from the commit pinned in corpus.lock.json) is a root you can slice at: its transitive import closure is compiled by the same wasm engine, in your tab or your terminal, and the compiled artifact's own expression tree determines which inputs exist. Two kinds of path never offer: Axiom-authored composition/pipeline assembly (state-plan compositions, benefit-calculation compositions, *_pipeline modules) — that is authoring scaffolding, not law, and refuses as a root — and rule-less modules, which have nothing to run.

Certification is a status, not a gate: certified means the slice's full node closure — every rule, parameter, and input ref — is vouched for by the vendored certification ledger (public/corpus/ledger.json); encoded means it runs from the compiled graph without that backing — published, labeled, and on the certification queue. Almost nothing is certified yet; that honesty is the point. Set AXIOM_CERTIFIED_ENFORCEMENT=enforced for the hard cut, where a closure with any uncertified node refuses to run.

$ bun scripts/determine.mjs --roots 7-cfr/273
18 us:regulations/7-cfr/273/10
11 us:regulations/7-cfr/273/11/c
4 us:regulations/7-cfr/273/2/j
12 us:regulations/7-cfr/273/24

Inputs and presumptions

A slice can consider anything its expressions read. The handful you --set are the facts of the case; every other input takes a synthesized screening presumption — zero-state by type, with counts and division denominators presuming 1, dates presuming the period start. A presumption is a legal position, not a hidden default: list them with --slots, override any with --set. Inputs belong to entities (Household, Person, …); a slice instantiates one of each kind, with entity attribution corrected by engine probes.

$ bun scripts/determine.mjs --slots | grep -i shelter
household decimal snap_claimed_homeless_shelter_deduction
household decimal snap_total_allowable_shelter_expenses

JSON output

$ bun scripts/determine.mjs --json --set household_size=2
{ "engine": "axiom",
"runtime": { "id": "axiom-local", "mode": "local-wasm", "engine_version": "0.1.0", … },
"root": "us:regulations/7-cfr/273/10",
"corpus": { "repo": "TheAxiomFoundation/rulespec-us", "commit": "5cc39ed…", "modules": [ … ] },
"period": { "period_kind": "month", "start": "2026-01-01", "end": "2026-02-01" },
"certification": "encoded",
"ledger": { "ledger_id": "fixture-us-ny-snap", "certified_set_version": "38f5286…" },
"amendment": null,
"inputs": [ { "ref": "…#input.household_size", "value": 2, "stated": true }, … ],
"outputs": { "snap_monthly_allotment": "546", "snap_net_monthly_income": "0", … },
"trace": [ { "rule_id": "…", "variable": "…", "value": "…", "sources": [ … ] }, … ],
"warnings": [] }

Judgment outputs come through as holds / not_holds; money and rates as exact decimal strings — the engine does exact decimal arithmetic, never floats.

Use it in your own software

The same WebAssembly build this repo vendors runs in browsers and Node. Serve corpus modules with your app, compile the closure at a root with compile, build a request, execute in-process. No server, no data leaving your product.

// the wasm builds are vendored in this repo — copy them into your app
// (an npm release is planned; nothing is published yet)
 
// browsers and bundlers (ESM) — from public/engine/
import init, { compile, execute } from "./engine/axiom_rules_engine_wasm.js";
await init({ module_or_path: "./engine/axiom_rules_engine_wasm_bg.wasm" });
const artifactJson = compile(JSON.stringify(modules), rootTarget);
const response = JSON.parse(execute(artifactJson, JSON.stringify(request)));
 
// node (CommonJS) — from engine/pkg-node/
const engine = require("./engine/pkg-node/axiom_rules_engine_wasm.js");

The determination envelope's builder is src/lib/envelope.ts — hosted-API naming (rule_id / variable / sources, ledger identity) wherever it is honest offline. The request/response shapes are mirrored in src/lib/engine/types.ts; src/lib/corpus.ts resolves closures, synthesizes the runnable descriptor, and probes entity attribution; src/lib/goldenPath.ts builds a request from that descriptor plus answers, and src/lib/trace.ts turns the explain trace into a citation tree — scripts/determine.mjs is a complete worked integration.

Verify what you run

$ cat corpus.lock.json
# the corpus commit and ledger identity this clone serves — deploys regenerate from exactly these
 
$ bun run test
# the suite: the 7 CFR 273.10 golden path ($478), the composition/pipeline exclusion, the certified-node gate and its leak scan, corpus slicing, the CLI