Skip to content

Rules engine · open source

The rules engine

Data version
v1.0.1
Data checked as of
How to cite
How to cite

A small program that compares the answers about a company with what each rule in the registry asks. It uses no AI: the same data always gives the same result. It returns which provisions relate to that company, why, and which instruments help. This page is for developers; if you only want to see your result, use the demo.

What it is

The rules engine is the first part of AI Business Core. It takes two things: the answers about a company (its profile) and the list of rules and provisions. It applies fixed rules and returns a list of references. Whoever uses it passes in the data; the engine fetches nothing on its own.

Deterministic
The same input with the same as-of date always gives the same output.
Rules-based, no AI
It uses no artificial intelligence or language models: it compares lists of values.
No network, no storage
It makes no network calls and never stores, caches or sends anything.
Runs anywhere
It is TypeScript with no runtime dependencies and no Node APIs: it works in a browser, a worker or a server.

What goes in: the organization profile

The profile describes the company with the registry’s codes. Every field is optional; if one is missing, a default value is used.

Table Profile fields the engine takes
FieldWhat it holdsDefaultValues in the registry
jurisdictionsJurisdictions where it operates or where the people it uses AI with are: customers, workers, job candidates, users (countries, states, the EU)none19
rolesIts relation to AI: uses it (deployer), sells it (provider), is a public body…deployer6
sizeSize of the organizationmedium4
industriesIndustries it works innone17
use_casesWhat it uses AI for (use cases)none20
dataData categories the AI usespersonal7

Deployment profiles

The guided path also asks for deployment profiles, which are cumulative. Before the engine is called, each profile is translated into registry roles and use cases:

P1

Uses AI inside software it buys (assistants, AI features in SaaS).

translates into: Uses AI tools made by other companies (deployer) · Staff use AI chatbots for work

P2

Connects models to its own processes or products through APIs or retrieval (RAG).

translates into: Uses AI tools made by other companies (deployer)

P3

Hosts models on its own or rented infrastructure, including open-weight models.

translates into: Uses AI tools made by other companies (deployer)

P4

Trains or fine-tunes models.

translates into: Models are trained or fine-tuned on own data

P5

Uses agents that act in systems (send, buy, change records, run code).

translates into: Uses AI tools made by other companies (deployer) · AI carries out tasks on its own in the company’s systems

What comes out

The result carries the as-of date used and three things: the provisions that matched, with their reason; the linked instruments, sorted into groups; and, in the guided path, a suggested level.

Provisions with their reason

Each matching provision comes back with its id, the rule and jurisdiction it belongs to, the citation, the status and the date from which it applies. Any result can therefore be traced back to the registry entry that produced it.

Instruments by group

Each registry provision links instrument ids. The engine does not interpret those ids: it sorts them into the result groups the registry defines, and the caller turns them into titles or links. When several provisions point to the same instrument, it stays in the highest group and keeps every reason.

Table Result groups defined in the registry
Group idName in the registryWhen it is used
requiredLinked to a regulation in forceProvision with status “In force” or “Adopted, applies later” with no application date, or one already reached on the as-of date; main link.
upcomingLinked to a regulation with a future application dateThe same kind of provision, with a future application date. The result gives the earliest date.
recommendedReference good practiceSupporting links, provisions with status “Regulator guidance”, “Voluntary standard” or “Bill”, and good-practice rules.

Provisions with status “Lapsed or superseded” are ignored.

Suggested level

From the guided-path answers, the suggestLevel function proposes a level with fixed rules: Reinforced for profiles P3 to P5, a regulated sector or a high-impact use case; Basic when the organization is micro or small, uses only P1 and handles no special-category data; Standard otherwise. It is a suggestion: the organization picks its level.

How an applicability condition is evaluated

Every registry provision has an applicability condition: a description, as data, of the profiles it refers to. The engine evaluates it with four rules.

OR between conditions
When the condition is a list, one matching alternative is enough.
AND between keys
Within one alternative, the profile must match every key that appears (role, industry, use case, data, size).
Any of within a key
For each key, one of the listed values is enough.
No negation
There is no “not” operator. Exclusions are written as positive lists. An empty condition, or a key with an empty list, places no restriction.

In addition, a provision is only considered when its rule’s jurisdiction is among the profile’s, expanded with their parent jurisdictions (for example, Spain brings in the EU) and the international references.

An example from the registry

The condition of provision es-ley-10-2025.human-attention (Ley 10/2025, arts. 2, 3.11, 8, 9.2 y 10.3; disposición transitoria única (original text in Spanish)), as recorded in the registry:

Reading

Any of these cases:

    • Industry:Telecom, water, power or gasorBanking, lending and fintechorInsuranceorTransport and logistics
    • ANDUse of AI:An AI assistant serves customersorAI carries out tasks on its own in the company’s systems
  1. OR
    • Use of AI:An AI assistant serves customersorAI carries out tasks on its own in the company’s systems
    • ANDSize:250 people or more
applies_when · Data
[
  {
    "industries": ["telecom_utilities", "financial_services", "insurance", "transport_logistics"],
    "use_cases": ["customer_chatbot", "ai_agents"]
  },
  {
    "use_cases": ["customer_chatbot", "ai_agents"],
    "sizes": ["large"]
  }
]

See the entry in the registry

Two profiles evaluated with matches()

These results are computed when this page is built, with the engine’s matches function. Profile A has a value for every key of the first alternative; profile B has only the first key.

Profile A
{
  jurisdictions: ["ES"],
  roles: ["deployer"],
  industries: ["telecom_utilities"],
  use_cases: ["customer_chatbot"],
  data: ["personal"],
  size: "medium"
}

Result:matches → truematches

Profile B
{
  jurisdictions: ["ES"],
  roles: ["deployer"],
  industries: ["telecom_utilities"],
  use_cases: [],
  data: ["personal"],
  size: "medium"
}

Result:matches → falsedoes not match

Usage

The package ships as TypeScript source (@vreinn/aibc-engine): use it from a bundler or a TypeScript-aware runtime such as Vite, esbuild, tsx or Vitest. This example uses a minimal sample knowledge base; each comment shows the value the line returns.

assess.ts
import { assess, groupByTier, type EngineKB } from "@vreinn/aibc-engine";

const kb: EngineKB = {
  taxonomy: { jurisdictions: [{ id: "EU", parent: null }, { id: "ES", parent: "EU" }] },
  regulations: [
    {
      id: "eu_ai_act",
      jurisdiction: "EU",
      status: "in_force",
      obligations: [
        {
          id: "eu_ai_literacy",
          citation: "Art. 4",
          status: "in_force",
          applies_from: "2025-02-02",
          applies_when: { roles: ["deployer", "provider"] },
          templates: { required: ["ai_literacy_plan"], supporting: ["ai_use_policy"] },
        },
      ],
    },
  ],
  baseline: [{ id: "bl_policy", templates: { recommended: ["ai_use_policy"] }, reason: "A usage policy is good practice." }],
};

const result = assess({ jurisdictions: ["ES"], roles: ["deployer"], size: "small" }, kb, "2026-06-01");

result.jurisdictions; // ["INTL","ES","EU"]
result.obligations.map((o) => o.obligation); // ["eu_ai_literacy"]
result.templates.map((t) => [t.id, t.bucket]); // [["ai_literacy_plan","required"],["ai_use_policy","recommended"]]
Object.entries(groupByTier(result)).map(([tier, docs]) => [tier, docs.map((t) => t.id)]); // [["required",["ai_literacy_plan"]],["recommended",["ai_use_policy"]],["nice_to_have",[]]]

Signature of the main function

function assess(profile: ProfileInput, kb: EngineKB, asOf?: string): AssessResult;

If you leave out the as-of date (asOf, as YYYY-MM-DD), the engine uses today’s date in UTC. For reproducible results, always pass it.

Suggested level

level.ts
import { suggestLevel, EMPTY_ANSWERS } from "@vreinn/aibc-engine";

suggestLevel({ ...EMPTY_ANSWERS, size: "small", hq: "ES", markets: ["ES"], profiles: ["P1"] }); // {"level":"basic","reason":"small_and_simple"}
suggestLevel({ ...EMPTY_ANSWERS, size: "small", hq: "ES", markets: ["ES"], profiles: ["P1", "P5"] }); // {"level":"reinforced","reason":"advanced_profile"}

The public API also includes runGuidedPath, which turns guided-path answers into engine input, runs assess, and adds the suggested level and the list of countries the registry does not cover yet.

What it does not do

  • It gives no legal advice.
  • It does not state whether an organization meets a rule or not: results are references based on the answers given.
  • It does not take into account facts that are not in the profile: a provision can depend on details the profile does not capture.
  • It drafts nothing with AI, and it does not keep the profile or the results.

Only the text published in official sources is legally authoritative.

License and code

LicenseApache-2.0

The engine code is licensed under Apache-2.0. © 2026 GROU LLC. Created by VREINN. You may use, modify and redistribute it, including for commercial purposes, keeping the license notices. The license grants no rights to the AI Business Core trademark.

Public repository (opens an external site)

Licenses of each layerHow to contribute

The three layers

The engine is the code layer. The data it evaluates comes from the Obligations Registry, and the drafted documents of the instruments its results point to are offered by AI Policy Generator.

AI Business Core has three parts: an open rules engine, an open registry of the laws and frameworks of each place and the paid, already drafted documents of each instrument.
  1. 01

    Rules engine

    An open program that compares the answers about your company with what each rule asks. It tells you which registry provisions relate to you and why.
    Open sourceLicenseApache-2.0
  2. 02

    Obligations Registry

    An open list of rules and provisions by country. Each one has its citation, official source and the date it was checked.
    Open dataLicenseCC-BY-4.0
  3. 03

    Drafted documents (opens an external site)

    Each instrument’s document (policies, procedures, records) ready to adapt. Each one shows which registry provisions it helps address. Offered by AI Policy Generator.
    AI Policy GeneratorLicenseCommercial