Platform engineering · Process engine
Niro: a process engine on Brando.
Niro runs business processes written in BPMN 2.0, with execution, durability, timers, correlation and audit supplied by Brando. A process instance is an actor, its tokens are facts, and its whole history is kept forever. The target is BPMN 2.0 Process Execution Conformance, with CMMN for case work and DMN decision tables for rules.
A process instance is an actor
BPMN 2.0 XML ──▶ reader ──▶ typed model ──▶ compiler ──▶ definition (content-addressed, versioned)
│ pinned
▼
process instance = one Brando actor
token moves ──▶ facts on the forever log
service task ──▶ effect (once, or an incident)
user task ──▶ open command to a task actor
timer ──▶ named durable timer
message ──▶ keyed command, or correlation-index subscriptionBPMN 2.0 XML
▼ reader
typed model
▼ compiler
definition
(content-addressed, versioned)
▼ pinned
process instance = one Brando actor
token move ▶ fact on the forever log
service task ▶ effect, made once
(or an incident)
user task ▶ open command to its
task actor
timer ▶ named durable timer
message ▶ keyed command, or a
correlation-index
subscription- The definition is a pinned value. A compiled definition is content-addressed by the SHA-256 of its canonical bytes, so the same model in another layout or element order has the same digest. An instance pins the deployment it started on for its whole life.
- Tokens are facts. Each input (a start, a task completion, a fired timer, a message, an incident resolved) is one Brando round: the interpreter advances every token that can move, as far as it can, and stops at a wait or an end. That step is recorded as one fact, so replay reconstructs the exact token history.
- Expressions are pure. Gateway conditions and correlation keys use a small, deterministic subset of FEEL.
now()is the round's instant, never a clock, and evaluation never fails: what has no answer isnull, as in FEEL. - The interpreter is ordinary application code. Niro adds no runtime of its own. A BPMN need that Brando cannot meet is a finding: a missing primitive, which gets a failing simulation first.
What exists today
Measured by what the code has, not by the design.
| Part | What it does | Status |
|---|---|---|
| BPMN 2.0 reader and writer | Total: every document becomes a model or a list of refusals, each at a line and column. Diagram layout (BPMN DI) is read past; elements with no execution semantics are tolerated; every other element is refused by name with the tier that will support it. The writer emits one canonical document that reads back to the same model. | Built |
| Typed model | A definitions document as types whose invalid shapes cannot be built; structural faults are refused when the model is made. | Built |
| Compiler | Static checks: start events, expressions in the FEEL subset, exclusive-gateway conditions that provably cover every case when there is no default, no implicit splits or ends, every node reachable from a start and reaching an end, no loop without a wait. Produces the content-addressed definition. | Built |
| Tier-1 engine on Brando | A pure interpreter for one instance, mapped onto Brando actors, effects, timers and the correlation index. Deployments are versioned per process and survive restarts. | Built |
| Conformance corpus | 133 BPMN cases with declared outcomes: 86 that compile and carry declared runs (inputs, the facts each step records, the terminal state), and 47 that must be refused with exactly the declared refusals. Every declared run executes on Brando in simulation. A CMMN corpus (89 cases) and a DMN decision corpus (38 cases) are held the same way. | Built |
| CMMN cases on Brando | A CMMN 1.1 reader and compiler, and a case interpreter on Brando: one case is one actor, and each input is one atomic step whose sentries settle to a fixed point. Stages, human and process tasks, milestones, timer event listeners, case file items, sentries, and required and repetition rules are read; everything else is refused by name. | Built |
| DMN decision tables | A subset of DMN 1.2 to 1.5: one decision table with hit policy FIRST, statically checked, compiled to a content-addressed decision and evaluated with a trace of the row that fired. Other hit policies and logic are refused by name. | Built |
| Task inbox | Open user tasks listed per owner, ordered by priority and due date, through Brando's indexed slots: a page is one bounded read of the store and wakes no instance. | Built |
| Retiring ended instances | Instances, tasks and cases that have ended retire through Brando's retirement after a retention the application must set. Deployments never retire. | Built |
| Stock models | Processes more than one application deploys, kept once as data, each held to a declared interface: what its starter gives, its tasks and jobs, and the messages it waits for. | Built |
| Differential conformance against a reference engine | Every corpus case and stock model runs in Niro and in Flowable side by side from the same scripted inputs, compared after every step and at the end. Every disagreement must be listed in a ledger and classed as a Niro bug (with a failing simulation), a reference-engine deviation from the spec, or out of scope, quoting the spec. The harness is built; the ledger still lists open Niro bugs. | In progress |
| SDK | A Rust crate: compile, read and write BPMN, and the engine's operations (below) in Niro's own process terms. Nothing Brando names reaches it. | Built |
| Sealed variables | Erasing a subject ends its instances and withdraws their waits, but the variables already recorded stay readable until Brando's sealed-value contract lands. | Planned |
| Network API, job API for workers in other languages | HTTP and gRPC surfaces generated from the one typed API; external workers fetching and completing jobs under a lease. | Planned |
| Versioning beyond deploy | Instance migration with an explicit node mapping, and what-if replay of an instance against another version. | Planned |
The SDK today
use niro::{Xml, WaitKind, compile};
let definition = compile(Xml::new(xml))?; // BPMN 2.0 XML -> typed Definition, or every refusal
assert_eq!(definition.process().as_str(), "screening");
for wait in definition.waits() { // where an instance can stop
match wait.kind {
WaitKind::Job(job) => println!("{} waits on job {}", wait.node.as_str(), job.as_str()),
WaitKind::UserTask => println!("{} waits on a person", wait.node.as_str()),
_ => {}
}
}
// The same model in another layout or element order has the same digest.
assert_eq!(compile(Xml::new(xml))?.digest(), definition.digest());The engine's operations (lifetimes elided):
trait Engine {
// A new version of its process, or the version already deployed with this content.
fn deploy(&self, document: &str) -> Pending<Deployment>;
// Its state after its first step.
fn start(&self, deployment: &Deployment, instance: &InstanceId, input: &Input) -> Pending<InstanceState>;
// A user task, made once by its completion id.
fn complete(&self, task: &TaskId, completion: &str, variables: &Variables) -> Pending<()>;
// By its business key, or to one instance when it has none.
fn publish(&self, message: &Message, to: Option<&InstanceId>) -> Pending<Published>;
// The incident's step is tried again.
fn resolve(&self, incident: &Incident) -> Pending<InstanceState>;
fn end(&self, instance: &InstanceId, reason: Termination) -> Pending<InstanceState>;
fn instance(&self, instance: &InstanceId) -> Pending<Option<InstanceView>>;
}Mapping to Brando
One module in Niro names both vocabularies; an architecture rule keeps Brando's names out of everything else. Built for tier 1.
| Niro | Brando |
|---|---|
| A process instance | One actor, keyed by its id; its items are its tokens and its pinned deployment |
| A step | One round: the interpreter's changes recorded as one fact, with its instant |
| A service task | An effect requested in the round that opens it. An uncertain or parked outcome becomes an incident, asked again only once resolved |
| A user task | An open command to the task's own actor, closed by the person's completion |
| A message correlated by business key | A subscription at Brando's correlation index |
| A message to the instance itself | A keyed command |
| A timer | A named durable timer, named by its node |
| An interrupting boundary event | The wait's job, task or subscription withdrawn, and its timers cancelled. A late result of a withdrawn job is stale and records nothing |
| A process's deployments | One actor per process: each version a pinned definition, numbered in deploy order; the same content deployed again gets its existing version |
Element support by tier
| Tier | Elements | Status |
|---|---|---|
| Tier 1 | None start and end; service, user and receive tasks; exclusive and parallel gateways; conditional sequence flows; timer intermediate and interrupting boundary events (duration, date); message start and intermediate catch; error end and error boundary. | Built |
| Tier 2, built | Embedded subprocess; event-based and inclusive gateways; interrupting and non-interrupting message boundary events; non-interrupting timer boundary events; timer cycles and timer start events; send tasks; conditional flows out of an activity; user task assignment. | Built |
| Tier 2, remaining | Signals; escalation; terminate end; call activity; multi-instance and loops; script and business-rule tasks; data objects and mappings. | Planned |
| Tier 3 | Event subprocesses; compensation; transactions and cancel; conditional and link events; the complex gateway. | Planned |
| Out of scope | Choreographies, conversations, ad-hoc subprocesses. Refused by name. |
A refusal of an unsupported element names its tier, so a model's author knows whether it is coming or not. The rest of tier 2 and tier 3 rely on Brando mechanisms that are built (named timers, withdrawal, the correlation index, pinned values, actor retirement) and one that is planned (broadcast subscriptions, for signals).
CMMN for case work Built
CMMN models cases: knowledge work whose path is not fixed in advance. The mapping makes one case one actor and needed no new Brando primitives. Decision tasks and discretionary items are not built yet.
| CMMN | Brando |
|---|---|
| Case file and case file items | The case actor's facts and items |
| Plan items and their lifecycle | Items with a folded state machine |
| Sentries | Evaluated to a fixed point inside one round after each fact |
| Stages | Scopes in items; exiting a stage withdraws its open work |
| Milestones | Items marked reached when their sentry holds |
| Human and process tasks | An open command closed by a person; a Niro BPMN child instance on its pinned deployment |
| Timer event listeners | Named durable timers |
Pledge on Niro. A claim opens a Niro CMMN case, from a claim model, at the first fact a person or a compliance step must act on, and the claim files its case file into it exactly once per change; a claim settled straight through opens no case. The case completes when the claim closes, and a claim reopened later opens a new case filed with its current state. Built
DMN decision tables Built
A decision table is read from DMN, statically checked (every expression inside Niro's FEEL subset, every name read one the decision requires, every literal of its column's type), compiled to a content-addressed decision, and evaluated through a plan built once from its rules. Evaluation returns the row that fired, or that no row matched, with a trace. The supported subset is deliberately narrow: hit policy FIRST, unary tests in input entries and literals in output entries; everything else is refused by name.
Pledge's rules are evaluated this way: a ruleset becomes a DMN decision table, compiled once and held within the process's memory budget, and every row's verdict is read back in Pledge's terms.
An agent-first API Planned
Niro's main API is planned to be MCP, generated from the same one typed API as its HTTP and CLI surfaces rather than built as a second API. The intent is that agents draft, check, simulate and backtest processes against real history, then propose changes, and humans approve them on that evidence.
processes.* instances.* read definitions, instances and their history
drafts.create / edit / check author a definition; static checks with positioned refusals
drafts.simulate deterministic, seeded runs with fault injection
drafts.backtest replay real instance history from the forever log against the draft
changes.propose the diff, the simulation and backtest report, and a rationale
changes.approve / reject human only; the proposer can never approve its own change
changes.deploy shadow (effects suppressed), canary, or full
deployments.compare / rollback- Backtests use the forever log. Because every instance's inputs are kept, a draft can be replayed against real history in a sandbox that makes no effects, and its output is a diff of paths.
- Separation of duties. Approval is a human act, signed and policy-governed. The principal that proposed a change can never approve it, and the gate is structural rather than a convention.
- Deployment modes. Shadow runs the new version alongside with its effects suppressed; canary sends a share of new instances to it; full makes it the default for new starts.
- Agents are principals with scopes and budgets, and every proposal, approval and deployment is recorded as a signed fact.
Proof
The testing page summarises this alongside the rest of the stack's testing. Niro is held to the same discipline as Brando. Built for what runs today:
- A simulation world drives instances through seeded inputs with injected crashes and duplicated inputs, and checks that no job is made twice, that each instance's rounds never diverge from its declared run, and that every instance reaches its declared terminal state.
- A stress process runs to completion through duplicates and a crash at every step.
- The conformance corpus covers each tier-1 element and the pairwise interactions that are hard to get right: a parallel join firing once per arrival set, an interrupting boundary withdrawing an open task or a job in flight, a receive task raced by a timer, an error and a timer boundary on one task, a boundary inside a parallel branch, a loop through a wait, a message correlated by business key, and an uncertain job outcome raised and resolved as an incident.
- A fuzzer grows models from Niro's supported constructs by a grammar, drives each through the inputs its state can take, and holds every step to invariants that know no domain. A failure is shrunk and written out as a corpus case, a permanent regression test.
- A case world runs the CMMN corpus on Brando the same way.
Planned Conformance cases for the rest of tier 2 and for tier 3; exact cost ledgers per token move; and dormancy at millions of waiting instances.