RuleWeaver
A compiler that turns published regulation into executable, source-linked rules — where the language model proposes and deterministic software decides.
The problem
Human rules are published as prose. Production systems need precise logic, dates, thresholds, exceptions, and version history. That translation is expensive, duplicated across institutions, hard to audit, and easy to get wrong.
For: Public-benefit and tax administrations, and the analysts who currently hand-encode eligibility rules into code nobody can trace back to statute.
What I built
A standards-first compiler built around a canonical typed IR. Authoritative source is ingested and hash-verified, an LLM proposes clause segmentations and rule extractions, six deterministic checks stand between those proposals and the IR, a human approves through a reviewer application with a hash-chained audit log, and only approved rules execute. An OpenFisca code generator emits a runnable country package.
The hard part
Building a review gate that actually works. Independent expert encoders agree at roughly zero percent without a shared vocabulary, and automation bias degrades even expert review — so the gate had to be tested adversarially with planted errors rather than assumed effective.
The tradeoff
Kept the model permanently out of the runtime decision path, accepting slower coverage in exchange for a system whose outputs are deterministic and defensible. v0.1 was rescoped to a narrow domain — tax and public-benefit eligibility — rather than claiming generality it had not earned.
What went wrong
The original ten-point v0.1 definition was not deliverable and M0 could not close as written — its exit criteria depended on backlog items scheduled after it. Both were caught in a review against external research and resolved by rescoping, recorded in ADR-017 through ADR-022 rather than quietly dropped.
What this does not do
- The OpenFisca export is a structural claim. The generated package is checked structurally and parses, but nobody has run it under OpenFisca and compared results against the deterministic evaluator.
- Thresholds still come from the hand-encoded package; parameter extraction is not built.
- Ingestion handles eCFR XML only — no PDF, no Akoma Ntoso.
- There is no public benchmark, so cross-system comparison is not yet possible.