Skip to main content
System model and derivation | Entity RuntimeHow Entity Runtime's kernel, providers, commands, events, queries, and generated interfaces fit together—and where their models stop.Entity Runtimereferenceentity-runtimereferenceadopterdeveloperreference

System model and derivation

Entity Runtime is a collection of Rust libraries and command surfaces around one deterministic kernel. It can execute an adopter's entity model and derive interfaces from it. The runtime itself is implemented as authored Rust types, traits, and functions; this repository has no whole-system ESS specification from which those subsystems are generated.

This chapter describes the 0.18.1 release. The public API remains in development. An entity's version: 1 is its definition version, independent of the runtime release and File Store format.

Subsystems and boundaries

Arrows below show inputs and calls. Storage IO stays in the selected provider; authentication, trusted time, and external effects belong to the application.

Pan the full-size diagram: swipe or scroll, or focus the canvas and use the arrow keys.

DiagramA visual explanation of the surrounding documentation.
SubsystemModel or contractWhat it owns
Definition inputEntityDefinition, Registry, ValidatedDefinitionSchemas, lifecycles, rules, operation arguments, templates, references, and projections
Decision kernelRuntime, DecisionCommand, Decision, CoreErrorCreation and named operations; deterministic result or typed refusal
RecordingDecisionRecord, Recording, Envelope, RecordedCommitReplay evidence and caller-supplied provenance
PersistenceStore, HistoryProvider, AtomicBatchStoreExpected revisions, accepted state plus history, and explicitly supported batches
Reads and viewsDocumentQueryProvider, projection definitionsOptional filtered document pages and deterministic groupings
Remote and hybridTransport, remote protocol, hybrid policyCaller-selected transport, authority, offline behavior, and recorded divergences
Command surfacesentity-cli, StoredRuntime, entity-mcpInput decoding, provider calls, results, and tool schemas
Projectionsentity-graph, entity-surface, CLI generatorDiagrams, documentation, API contracts, and definition-specific commands

The library guide maps these responsibilities to crates. entity-xtask and scan-support support repository checks; they are not application services. No provider, command surface, or generated API introduces a hosted service automatically.

What is modeled, and what remains a host responsibility?

ConcernDeclared or checked hereBoundary
Entity stateField schemas, identity, definition version, lifecycle state, revisionThe host loads canonical instances; public Rust fields are not an access-control boundary
CommandsCreation and named operations, typed arguments, transitions, preconditions, assignmentsAuthentication and delegation are not operation-argument validation
Domain eventsOptional creation event and ordered operation event templatesNo broker, subscriptions, delivery acknowledgment, or automatic effect execution
RulesPreconditions and invariants, with true/false/unknown resultsEvidence enters as data; the kernel cannot verify an external fact by looking it up
ReferencesTarget entity types, inverse labels, and acyclic declarationsThe host checks referenced instances and graph-wide constraints
HistoryDecision records, recording envelopes, observations, legacy boundariesProvenance records what the caller supplied; it does not authenticate it
Persistence and concurrencyProvider traits, revision checks, record conflicts, provider-specific transactionsAtomicity is bounded by the provider; File Store commits one subject at a time
Queries and projectionsContainment queries, continuation cursors, grouping projectionsNo general search service, SQL interface, or background projection worker
Whole-system architectureAuthored crate boundaries and this coverage mapNo ESS system.yaml, exhaustive system-domain catalog, or generated implementation of the runtime

“The entity is modeled” therefore means its declared fields, operations, rules, and events are checked. It does not mean every surrounding service or business domain has a definition. Adopters must decide which parts of their system cross this boundary and model those explicitly.

Commands, decisions, events, and observations

These are different values with different purposes:

ValueMeaningDoes it change the subject revision?
CommandRequest to create an entity or execute a named operationOnly if accepted and committed
DecisionComplete accepted result, replay record, and domain eventsProposes revision 1 or the next revision; the kernel persists nothing
DomainEventA materialized event template from an accepted decisionShares the decision's revision; one decision can have several events or none
RecordedCommitDecision sealed with record identity, time, and actor informationPersists the accepted revision when the provider commits it
RecordedObservationProvenance-bearing evidence about a subjectNo lifecycle revision change
Typed refusalA request could not be acceptedNo accepted decision or domain events

A decision record retains the normalized command and definition snapshot even when the operation emits no event. Reading events is therefore not a complete audit-history read. Use HistoryProvider for recorded decisions and observations; use complete decision replay to verify execution. Legacy event folding proves less: it checks every revision against the current definition, not against the snapshot that decided it.

For example, the refund quickstart creates refund-104 at revision 1, submits it at revision 2, and approves it at revision 3 with RefundApproved. Approval records a policy decision. A payment provider has not refunded money merely because that event exists.

Pan the full-size diagram: swipe or scroll, or focus the canvas and use the arrow keys.

DiagramA visual explanation of the surrounding documentation.

This is the stored operation path used by generated CLIs and MCP. An exact recorded retry returns the original accepted result before a new decision is made. External publication happens only after a successful commit and needs the host's own delivery and deduplication policy. See retry boundaries for the generic CLI's different behavior.

What is actually derived?

Pan the full-size diagram: swipe or scroll, or focus the canvas and use the arrow keys.

DiagramA visual explanation of the surrounding documentation.
SurfaceDerived partAuthored part
entity executableClap derives argument parsing; entity skill renders version-stamped guidanceTop-level verbs, handlers, and skill prose in the runtime source
Generated domain CLIEntity names, operation subcommands, embedded definitionsGenerator templates and shared stored execution; Cargo compiles the result
MCP serverTool names and input schemas from the mounted definitionsProtocol handling and dispatch through StoredRuntime
OpenAPI and AsyncAPIEntity request shapes and inferred emitted-event payload schemasProjection rules; an adopter must implement HTTP and event transport
Entity reference and graphsFields, transitions, rules, events, references, and diagramsRenderer and presentation templates

The generated surfaces shipped in 0.16.0. The 0.17.7 release fixes their retry and schema behavior. Neither release converted the top-level CLI into an ESS-generated implementation. The CLI source contains both its handwritten command enum and its domain-CLI generator; the shared shell owns the generated/MCP stored-operation sequence.

Relationship to ESS

ESS specifies systems using its own ess/1 format, including domains, entities, commands, events, and components. Entity Runtime accepts its own entity-definition format headed by entity: and version:. Similar concepts do not make those files interchangeable.

This runtime does not depend on ESS or ship an ESS importer/compiler. Its JSON Schema and API projections describe supported entity surfaces; they are not a generated schema for an ESS system or proof of complete coverage of the runtime's own architecture.

Start with the refund quickstart, then use the definition language and guarantees to decide what to model.