Skip to content

Government · Moraph software

Tax Code "Rule-as-Code" Engine

Draft tax rules once, in a form people can review and processing systems can load

Overview

The Tax Code Rule-as-Code Engine lets tax law specialists write rules in a structured, readable format that is tied clause by clause to the statute, regulation or guidance it implements. Each rule is tested against worked examples, reviewed by counsel and released as a versioned, machine-readable JSON package that your processing systems' teams download and load. The link from legal text to running logic stays visible for every version, so reviewers can see what changed and why.

The problem it solves

When tax law changes, policy specialists describe the change in documents, developers interpret those documents into code in several processing systems, and testers try to confirm the result matches the law. Each hand-off is a chance for the meaning to drift. The same rule can be implemented differently in different systems, effective dates are tracked separately from the logic, and when a question arises about why a calculation behaves as it does, tracing it back to the legal text means reading code and old requirement documents side by side.

Who it’s for

  • Tax administration agencies implementing changes to tax law and guidance
  • Tax law specialists and policy analysts who interpret new provisions
  • Counsel who review the legal reading of each rule
  • Engineering teams who maintain tax processing and forms systems
  • Testing, audit and oversight staff who need to trace logic to law

How the work flows

  1. DraftA tax law specialist opens the provision being implemented and writes the rule in a structured format of definitions, conditions, calculations and effective dates, with each part linked to the clause it comes from.
  2. TestEach rule is run against worked examples written by the specialist, including edge cases and examples from published guidance, so the logic is checked before anyone downstream relies on it.
  3. ReviewCounsel, and a second specialist where peer review is on, review the rule beside its legal source, the interpretation notes and the test results, and approve or return it.
  4. PublishApproved rule versions are released as a versioned JSON package that consuming teams download, with the release record readable through the Work API and release notes describing what changed.

What it does

Structured rule format
Rules are written as definitions, conditions, calculations and effective dates in a format specialists can read, the engine runs against worked examples, and processing systems load from the release package.
Clause-level citations
Every part of a rule links to the clause of statute, regulation or guidance it implements, and the link is kept across versions.
Effective dating
Rules carry effective and end dates, and transition provisions are modeled explicitly, so the right version applies to each tax period.
Worked-example testing
Specialists write examples with expected results, and every rule change is run against the full example set.
Step-by-step trace
Each result can be explained step by step, showing the conditions met, values used and the clause behind each step.
Version comparison
Compare two versions of a rule to see changed conditions, calculations, dates and citations, and which examples now give a different result.
Review and approval
Clause-level comments, recorded interpretation questions and answers, and separate approvals for the legal reading and for release.
Shared definitions
Terms used across many provisions are defined once and referenced, so a change to a definition shows every rule it affects.
Release packages
Approved versions published as versioned JSON packages with release notes, downloaded by consuming teams, with each release record readable through the Work API.
Impact view
Before release, see which rules, forms and consuming systems a change touches, from the dependencies recorded in the engine.
Synthetic test data
Worked examples use constructed scenarios rather than real return information, so testing does not require access to taxpayer data.
Audit trail
Every edit, test run, comment, approval and release recorded with the person and time.

Who uses it

Tax law specialist
As a User, drafts rules, writes worked examples and raises interpretation questions
Legal reviewer
As a User, reviews the reading of the law in a rule someone else drafted and sent, and approves or returns it
Rules engineer
As a User, maintains shared definitions and helps specialists with complex rules
Release manager
As a Product administrator, groups approved versions into releases and promotes them from the test channel to production
Consuming system team
As a Viewer, reads released rules and runs their own tests against test-channel packages
Auditor or oversight reviewer (read-only)
As a Viewer, views rules (not a rule marked Restricted before a version is approved), versions, tests, approvals and the audit trail, with no ability to change them

Integrations

Tax processing systems
Your processing systems' teams download each released package as a JSON file, and can read the release record, with its versions and package fingerprint, through the Work API. Moraph doesn't push packages into your systems.
Legal source library
Statutory, regulatory and guidance text loaded clause by clause by your team, or through the Work API from your legal source library, with versions kept as the text changes.
Source control and build pipelines
Consuming teams can commit the downloaded package to their source control and continuous integration tools and test it like any other dependency, then report results on the release or through the Work API.
Requirements and work tracking
Rule changes can be linked to the work items your agency uses to manage legislative implementation.
Forms and instructions
Rule references can be shared with the teams that produce forms and instructions, so they can check that the published guidance and the logic agree.
Sign-in
Staff sign in with their Moraph account, using email and password and, optionally, two-step verification. Sign-in through your own identity provider (SAML or OpenID Connect) is not offered.
Work API
Rule, version, test and approval data available to your reporting tools through the Moraph Work API.

Security

Data residency
Rules, examples and review records are hosted on Cloudflare's network, in a database that is not restricted to a jurisdiction.
Access by role
Drafting, legal approval and release are kept apart, and a rule marked Restricted is hidden from viewers and Work API keys until a version is approved.
Encryption
Data is stored in Cloudflare D1 and files in Workers KV, which Cloudflare encrypts at rest with keys Cloudflare manages, and every connection uses HTTPS. The product adds no encryption of its own to its records and files.
Complete audit trail
Every edit, test, approval and release is recorded with the user and time, and the product offers no way to edit that history.

Hosting and deployment

Moraph cloud
Hosted on Cloudflare's network.
Rule packages run in your systems
Released packages are executed by your own processing systems or by an execution component installed in your environment, so production calculations do not depend on Moraph's cloud.
With a managed service
Optionally run alongside a Moraph managed service for administration, rule-engineering support and integration support.

Implementation

Scope and pilot provisions
We agree with your policy and engineering leads which provisions to model first, usually a recent change with known expected results.
Rule format and conventions
Drafting conventions, shared definitions and citation styles are agreed with your specialists and counsel, and documented.
Legal source loading
The statutory, regulatory and guidance text in scope is loaded and versioned, with your team confirming the sources.
Consuming system integration
The package format is walked through with one consuming system team, which builds the loading on its side and reports its tests against the first test release.
Roles and approvals
Roles and the review and release rules are set to match your agency's procedures for legal review and release.
Training and handover
Specialists, reviewers and engineers are trained on drafting, testing and release, and Moraph works alongside your team on the first provisions.

What it doesn’t do

  • It does not interpret the law for your agency. Every rule reflects the reading of your specialists and counsel, and Moraph does not provide tax or legal advice.
  • It does not process returns or hold taxpayer accounts. Your processing systems run the released rules.
  • Some provisions depend on judgment, facts and circumstances that cannot be reduced to conditions and calculations; these are recorded as inputs a person or system must supply, not decided by the engine.
  • A rule is only as reliable as its worked examples. Testing shows the rule matches the examples written, not that the examples cover every case.
  • Moraph holds no FedRAMP authorization for this product. We provide control documentation to support your agency's own authorization decision.
  • Existing logic in legacy processing systems is not converted automatically; provisions are modeled in the engine as your agency chooses to bring them across.
  • Consuming systems must be changed to read the released packages, and that work sits with the teams that own them.
  • It is designed for tax provisions. Other areas of law can be modeled but are outside the conventions delivered at implementation.

How to evaluate it

  • Ask a specialist to model a recent provision and judge whether counsel could review it without help
  • Check that every step of a rule traces to a specific clause
  • Write edge-case examples, including a transition period, and review how failures are explained
  • Compare two versions of a rule and confirm the differences shown are complete
  • Have an engineering team consume a test release in a non-production system
  • Confirm role separation: who can draft, approve the legal reading and release

Questions

Do policy specialists need to write code?

No. Rules are written in a structured format of definitions, conditions and calculations that specialists can learn without programming. Rules engineers support more complex structures.

Does the engine decide how the law should be read?

No. Your specialists draft the reading and your counsel approves it. The engine records the reading, tests it and keeps the link to the legal text.

Do we need taxpayer data to test rules?

No. Worked examples are built from constructed scenarios. If your agency chooses to test against return information, that happens within your own systems and under your own controls.

How do our processing systems use the rules?

Their teams download each released package as a JSON file and change their systems to load it; the release record, with its versions and package fingerprint, is readable through the Work API. Moraph doesn't push packages or run calculations in your systems.

Is it FedRAMP authorized?

No. Moraph holds no FedRAMP authorization for this product. We provide control documentation to support your agency's own authorization decision.

How do we try it before buying?

A demonstration uses fictional provisions. For a deeper evaluation, your specialists can model a recent provision with known expected results and compare the engine's output with your current implementation.

Tax Code "Rule-as-Code" EngineSign in to request