AI-assisted Rules as Code

Assemblic Codify

Turn legislation into tested, validated OpenFisca code, faster — with subject matter experts reviewing and approving every key step.

The problem it solves

Getting from legislation to code was the bottleneck

A traditional Rules as Code project follows four stages: discovery and logic mapping, OpenFisca build and coding, frontend build, and testing. The first two stages — turning legislation into rules statements, visual logic maps, questions and test cases — have traditionally been the most time-consuming part of the process, and a major barrier to Rules as Code adoption worldwide.

Assemblic Codify automates much of this work. Codify takes legislation and rules, maps them into visual logic diagrams, creates test cases, writes OpenFisca code, and validates that code against the test cases.

Assemblic Codify process: analyse rules, generate logic flow charts, write test cases, and produce OpenFisca code

AI drafts. Humans decide.

AI is not making decisions in Assemblic Codify — it produces logic for human review and input. Subject matter experts check the flow chart, review the test cases and outputs, and an OpenFisca expert reviews the final code against the flow chart, test cases and OpenFisca best practice before anything is exported.

Citizens and other users interact with the reviewed, human-approved code — not the AI.

How it works

From legislation to reviewed OpenFisca code

Import Rules dialog in Assemblic Codify, with options to upload a document or import from a URL
01

Upload the legislation

Start with a PDF of the legislation, or point Codify at the URL(s) where it's published. Import it as a new logic map, or add it into an existing project.

Assemblic Codify Legal Advisor chat drafting eligibility logic for a Youth payment
02

AI drafts the logic map

Codify's Legal Advisor works through the legislation with you, drafting eligibility and entitlement logic as a step-by-step conversation you can follow and direct.

Assemblic Codify Editor Agent alongside a blank logic map canvas
03

Build and edit visually

Start a logic map from a blank canvas, or adjust the AI's draft directly, with the Editor Agent on hand to help make changes.

Interactive logic flow chart in Assemblic Codify mapping medical device classification rules
04

Experts review the flow chart

The logic becomes a visual flow chart referencing the source clauses. Subject matter experts review it closely and make any changes needed before test cases are produced.

Assemblic Codify test case validation results showing 20 of 20 scenarios passed
05

Generate and validate test cases

With one click, Codify produces test cases from the flow chart, then validates them against the generated OpenFisca code — automatically checking that the code matches the logic experts approved.

Assemblic Codify export panel for pushing generated OpenFisca code into an Assemblic project
06

Export to OpenFisca and Assemblic

Once an OpenFisca expert has reviewed the code against the flow chart, test cases and best practice, export it with one click straight into your Assemblic project and environment.

Why it matters

What Rules as Code and OpenFisca provide

Rules as Code is the practice of expressing legislation and policy as structured code. OpenFisca is a mature, open-source rules engine purpose-built for encoding eligibility and entitlement rules and exposing them as a queryable API, already used by governments internationally to model tax, benefit and eligibility systems.

A single source of truth

Rules are encoded once, and every channel returns the identical answer — the citizen portal, the contact centre, partner agencies and AI assistants all draw the same determination from the same source.

Explainability

Every answer can be traced to the specific rule and the section of the Act that produced it. Determinations are not opaque — they are auditable and citable.

Versioning, backward

Because the rules are version-controlled, the system can answer not only "what does the law say now?" but "what did the law say on a given date?"

Future-modelling, forward

Proposed amendments can be encoded as a draft version and tested against real scenarios before they commence, quantifying their effect in advance.

The source of truth for AI

The most effective defence against confidently-wrong AI is not to ban it, but to ground it — to give it an authoritative source it must consult before answering. When an AI assistant is asked a question, instead of generating an answer from memory, it can call an OpenFisca API built with Assemblic Codify, receive a definitive determination, and present that — turning a government's interpretation of the law into the authoritative reference AI must defer to.

  • Citable answers, anchored to the encoded rule and the section of the Act
  • Guardrails against hallucination — the API constrains the AI to the legislated position
  • Human and machine parity — everyone receives the identical determination
  • Currency — versioned APIs always reflect the law in force

Ready to accelerate your Rules as Code project?

Assemblic Codify is available as an add-on to any Assemblic plan. See current pricing or talk to our team about your project.