AIR
LLVM for the Ledger
Compiler infrastructure for accounting: LLMs describe economic events, a deterministic compiler produces balanced, fully traceable journal entries.
99
offline tests
21
golden test cases
7
hard guarantees
9
cited research reports
0
floats allowed
Overview
AIR (Accounting Intermediate Representation) applies the LLVM playbook to bookkeeping. LLMs are brilliant at understanding documents and unreliable at applying hundreds of tax rules, so AIR separates the two: any frontend — an LLM reading an invoice, a bank feed, a POS — only ever emits perspective-neutral economic events, never journal entries. A deterministic pass pipeline compiles those events into balanced entries.
The double-entry invariant Assets = Liabilities + Equity is verified after every compiler pass, and failures surface as clang-style diagnostics with location, cause, and a suggested fix — a compiler error instead of a wrong number. Every tax rate and threshold lives in versioned ALSL policy files with mandatory source citations; the loader rejects uncited rates.
AIR is also a standalone accounting system: an append-only, hash-chained ledger, git-style corrections via reversal-plus-replacement entries, full financial statements, bank reconciliation for camt.053, MT940 and CSV, and an agent SDK where AI agents keep books exclusively through audited syscalls.
Key Features
A universal accounting language
REA-based EconomicEvent schema for sales, purchases, refunds, payments and FX — perspective-neutral, schema-validated, with no debits or account codes anywhere.
A real compiler pipeline
Validation, classification, tax, FX and posting passes under a pass manager that re-verifies the double-entry invariant after every single pass.
Rules as cited data
GST, QST, HST rates, capitalization thresholds and rounding modes live in versioned ALSL YAML policies; the loader rejects any rate without a source citation.
Hash-chained, append-only ledger
Standalone books with a tamper-evident ledger and content-addressed document archive — corrections post reversals and replacements, history is never edited.
Agent syscall SDK
AI agents keep books only through syscalls like Post, Reverse, ClosePeriod and Reconcile; every call, including refusals, lands in a hash-chained audit log.
Total provenance traceability
Every posted cent walks back through an accounting SSA provenance graph to its source event, document, extraction confidence, policy version and rounding mode.
Bank reconciliation built in
Ingests camt.053, MT940 (with statement integrity checks) and CSV statements, matches them against the books, and reports differences on both sides.
Provenance-preserving optimizations
Fuses 50 identical payments into one batch entry, nets refunds against sales, and detects duplicates — provenance survives every transformation.
Fully offline development
The QuickBooks backend and LLM ingestion develop and test entirely offline via mock transports; determinism is property-tested with byte-identical double compiles in CI.
How It Works
schemas/ + core/ — the IR
The AIR JSON Schema plus events, Money, provenance and invariants — the intermediate representation and its verifier, in the LLVM analogy.
aic/ — the compiler
Pass manager, compilation passes, clang-style diagnostics and incremental recompilation: the opt/llc of accounting, deterministic with no LLM, network or clock inside.
alsl/ — rules as data
The rule language and cited, versioned policy sets for taxes, thresholds and rounding — AIR's TableGen equivalent.
kernel/ + backends/ — the runtime and targets
Hash-chained ledger, reporting, workspace, audit and reconciliation, plus native, CSV and QuickBooks output backends.
sdk/ + ingestion/ — the surface
CLI, agent syscalls and a demo agent on one side; document extractors, confidence routing and a human approval queue on the other.
Tech Stack
Core
Integrations
Quality
Highlights
- The one rule that never bends: an LLM only ever produces AIR events — the deterministic compiler alone writes journal entries.
- Same input plus same policies yields byte-identical output, always — property-tested, and CI compiles the demo twice and diffs the results.
- Floats are forbidden end to end: exact decimals everywhere, rejected at every boundary.
- Refused agent actions are audited exactly like successful ones; editing any record breaks the hash chain.
- Real Quebec tax law is encoded and cited down to the statute — GST 5% and QST 9.975% with half-up rounding per Excise Tax Act s.165.2(2).
- Phases 0 through 6 of the roadmap — research, core, compiler, backends, ingestion, agent SDK, optimizations and reconciliation — are complete.