Rules as Code: from complex rules to explainable interpretations

Thema:
Data sharing
20 August 2025

Complying with laws and regulations is essential for daily operations in organizations, but interpreting these rules—often written in complex legal language—is usually slow, error-prone, and leads to inconsistent application. Rules as Code offers a solution: it transforms rules into machine-readable logic, enabling greater precision, consistency, and automation in their execution.

Go directly to our tools

From rules to code for automation, through technology

Implementing and enforcing rules (laid down in for instance legislation, organisational policies, and industry standards) can be challenging. Rules as Code bridges the gap between policy and practice: it allows to automatically act on code that is based on interpretation of rules. These rules may come from legislations, policies, standards, business processes, and so on. Rules as Code provides not only consistency in interpreting and discussing rules, but also enables automatic execution thereof by digital systems. Furthermore, letting organisations publish their rule interpretations fosters the transparency of policy execution. For public and private organisations alike, this offers:

  • More consistent and faster execution of policy;
  • Greater transparency for citizens and implementing bodies;
  • Opportunities to automate policy execution to reduce administrative burdens, e.g. to allocate benefits to citizens;
  • Improved organisational compliance with laws, standards, and other sources of rules by improving consistency of rule interpretations;
  • Opportunities to automatically validate organisational compliance.

Systemic perspective

How do we fulfil these promises? By initiative of the Dutch Ministry of the Interior and Kingdom Relations, TNO contributes to the development of the Rules as Code movement with a unique approach. Unlike approaches that focus on individual applications to automatically execute rules, TNO takes a systemic perspective, centering Rule Governance. Our starting point is that automation of rule execution requires a shared understanding of the meaning of the concept ‘rule’.

To this end, TNO developed a method to express any rule in elementary components. For starters, TNO’s Calculemus protocol describes the steps and kinds of knowledge involved in executing a ‘task’. FLINT is the Formal Language to INTerpret sources of rules that govern the execution of this task. FLINT breaks rules down into simple building blocks, that specify:

  • What action does the rule describe?
  • Who performs the action, and who is the object thereof?
  • Under which conditions is the action valid?
  • What is the supposed result of the action?

By describing rules in this structured way – ‘interpreting’ them – they become explainable, clear, and verifiable. Further, because FLINT expresses rules using elementary components, FLINT-based interpretations can be compared to rule interpretations based on other interpretation schemes. Ultimately, this will allow the approach to intermediate between different (technology-dependent) rule interpretation methods that are already on the market.

rules as code process image en
Visualisation of TNO’s Rules as Code approach to executing tasks and interpreting the rules that govern it: Calculemus.

An infographic visualising TNO’s Rules as Code approach to executing tasks and interpreting rules relevant for this task with Rules as Code, called Calculemus. The infographic shows 5 adjacent circles. Every circle has an arrow feeding into the next one, to represent the process. The steps to the approach are: set task; collect sources; make interpretations; make executable interpretations; and use to execute task. There are also arrows from the last circle going backwards. Reading backwards, the figure says: adjust executable interpretations based on the task execution; add interpretations based on the created executable interpretations; add sources based on the created interpretations; and adjust the set task based on the collected sources.

TNO’s toolbox

TNO has developed a variety of open-source tools to help organisations interpret and execute rules using the FLINT method. These tools come with demos, user guides, and access to the source code. With our Toolbox, especially our user-friendly Rule Editor and Choppr, any person or organisation can start building real-world applications with the Rules as Code paradigm today.

Rule Editor: A user-friendly interface for analysing and structuring rules. Users can upload a file with the rules to interpret and map out act and fact relations in this source. Additionally, an incorporated large language model can automatically deduct these relations, for the user to verify. The editor visualizes the relations and generates a structured and fully transparent model with executable interpretations of rules that reduce ambiguity. The model can be exported in RDF and JSON formats. The editor supports FLINT as interpretation methodology and will support other interpretation schemes in the future.

Go to the tool or check out GitLab

Choppr: This tool converts documents or web pages into a structured format (i.e. RDF or JSON), while preserving the original content and layout. This ensures that truly any source of rules can be uploaded to the Interpretation Editor.

Go to the tool or check out GitLab

FLINT Filler: This tool automatically generates FLINT Frames from text loaded into the Rule Editor, powered by natural language processing. Users can choose between three options: (1) a rule-based approach which uses syntactical tags and rules to define the elements for the frames; (2) a machine learning-based approach where a model learns to add semantic role labels to words in a sentence (Semantic Role Labeling); and (3) a generative LLM approach where an LLM (GPT) is queried to label the words.

Check out GitLab

Legal Questions Chatbot: Employees of municipalities can ask this chatbot legal questions about local regulations. Powered by natural language processing, the chatbot provides an understandable answer and references the articles in the regulation that the answer is based on. The chatbot is currently in development. Curious to pilot it in your organisation?

Please contact us.

Knowledge Models: Underlying the whole Toolbox are the knowledge models and ontologies developed by TNO. The Calculemus protocol describes the steps and kinds of knowledge involved in performing a ‘task’ governed by rules. FLINT is the formal language to interpret the sources of the rules relevant to the task. It is a language for someone to describe what they think the rules mean in a given context. Interpreting a set of sources of rules (such as laws) thus yields a FLINT model. Such a model describes the consequences of rules and references the sources thereof. The knowledge models are thus foundational to TNO’s Rules as Code approach.

Go to the tool or check out Gitlab

An open-source approach

As a public research organisation, TNO contributes to the future of Rules as Code by providing its cutting-edge methods and tools as open source. The FLINT method has already been applied in the domain of immigration and is currently being tested in areas such as social security (in combination with a chatbot), the Dutch national budget cycle, health insurance, and pensions.

But we don’t just build software. We foster a diverse community focused on standardising rules and ensuring interoperability between rule-based systems and tools. To do so, we collaborate and validate our results with Dutch ministries, governmental agencies, and academia.

Rules as Code today and in the future

Rules as Code is not a distant vision: it’s already here, and it’s reshaping how we govern, regulate, and execute tasks laid down in rules. By bridging the gap between regulation and (automated) execution, TNO unlocks new possibilities for digital governance. This ensures that rules are not only written, but also understood and applied consistently across systems, with full transparency. Are you interested in launching a Rules as Code pilot in your organisation?

Get inspired

43 resultaten, getoond 1 t/m 5

Digitalisation and sustainability: how AI can help

Informatietype:
Insight
28 January 2025
The Twin Transition calls for smart technologies that accelerate processes, such as popular AI tools. How can these be used responsibly for circularity??

Time setter story: Kallol Das

Informatietype:
Insight
1 December 2024

Digital Product Passport

Informatietype:
Article

Time setter story: Annemieke Kips

Informatietype:
Insight
15 November 2024

Time setter story: Belma Turkovic

Informatietype:
Insight
15 November 2024