# NRules/NRules

Rules engine for .NET, based on the Rete matching algorithm, with internal DSL in C#.

Repository: https://github.com/NRules/NRules
Canonical: https://ross.abutalabs.com/products/nrules
Homepage: https://nrules.net
Language: C#
License: MIT
License Family: permissive
Topics: rules-engine, rete, c-sharp, rules, nrules, dsl, rule-engine
Last push: 2026-04-03T00:52:53+00:00

## Health v2 (maintenance only)
Score: 70/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 75, release rhythm 45, longevity 100
- inputs: {"age_days": 4328, "days_push": 153, "days_rel": 211, "gap_med": 164, "n_releases_24m": 4}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1649, forks 282 (observed 2026-08-28T04:05:16.677601+00:00)

## What it is
NRules is an open-source production rules engine for .NET based on the Rete matching algorithm, with rules authored in C# via an internal fluent DSL. It acts as an inference engine supporting forward chaining, fact queries, and quantifiers, with packages for rule serialization, testing, and DI container integration.

## Use cases
- encode business rules separately from application logic in .NET
- build an inference engine with forward chaining in C#
- implement an insurance quote calculator driven by declarative rules
- author rules in C# using a fluent DSL instead of external rule scripts
- unit test rule definitions and expectations
- serialize rules to and from JSON

## When to choose
- you need a production rules system on the .NET platform
- you want rules written in C# rather than an external DSL
- you need efficient Rete-based pattern matching over facts
- you want rules decoupled from application code in separate assemblies

## When to avoid
- you need a rules engine outside the .NET ecosystem
- you need simple if/else logic that doesn't justify a rules engine
- you require externalized rules authored by non-developers in a business language

## Facets
- artifact type: library
- maturity: active
- function: interpreter, workflow-automation, developer-tools
- domain: developer-tools, backend
- platform: dotnet, cross-platform
- tags: rules-engine, rete-algorithm, inference-engine, forward-chaining, internal-dsl, business-rules, c-sharp, automation

## Member repositories
- NRules/NRules (main) score 70

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:16.677601+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:45:07.212040+00:00, confidence not recorded.
  - readme: https://github.com/NRules/NRules (fetched 2026-08-28T04:05:16.677601+00:00, sha 17b0c1a99bf7)
  - homepage: https://nrules.net (fetched 2026-08-29T11:18:14.361170+00:00, sha e17827eede74)
  - site_page: https://nrules.net/articles/getting-started.html (fetched 2026-08-29T11:18:14.370380+00:00, sha f402cd9d46b4)
  - site_page: https://nrules.net/articles/architecture.html (fetched 2026-08-29T11:18:14.372681+00:00, sha da8bc3a51cc1)
  - site_page: https://nrules.net/api/index.html (fetched 2026-08-29T11:18:14.374587+00:00, sha bb14c4cf673a)
- Data as of 2026-08-30T08:39:29.467469+00:00.
