Skip to content
Design7 min readUpdated 27 Oct 2026

2. The current runtime and what it cannot express

2.1 The current runtime in brief#

Reaktor is a Kotlin Multiplatform framework that also runs C++ and interoperates with TypeScript. Its graph has three modules. reaktor-graph-port is a domain-free kernel. It defines PortGraph and PortNode; ProviderPort<F>, which holds a live implementation object and serves many consumers; ConsumerPort<F>, which holds exactly one edge; and a binary Edge<C> from consumer to provider. A port is identified by its owner, a string key and a Type, which is a simple class name plus an optional KClass. Calls through a port pass through interceptors, and any element can carry typed attachments. reaktor-graph-runtime adds Graph, which bundles dependency injection over Koin, lifecycle, a coroutine scope and navigation. It also adds a sealed Node hierarchy (BasicNode, ControllerNode, RouteNode, ContainerNode, ActorNode). autoWire matches consumers to providers by type and then key, and falls back to the parent graph’s injection scope. RouteNode binds a path pattern to a typed payload and owns NavigationEdges, the only subclass of Edge. Each graph keeps a back stack with push, replace, pop and return-with-result. ServiceNode registers one provider port per operation of a typed Service contract, typed by the string op:<operation>:<request>-><response>. ActorNode has a bounded mailbox, exclusive state and a supervision directive. reaktor-graph renders the graph with Compose: it takes the top back-stack entry and calls the attached node’s Content(), recursing into containers.

A production social application on the current runtime composes 11 graphs and 3 containers over three levels of nesting, 23 routes and about 88 nodes and 300 ports. On its current branch, mobile clients mount a per-user session graph with 23 routes and 68 nodes. Each Cloudflare worker builds its own graph of its ServiceNodes and serves its shape at /_reaktor/shape. A separate structural IR, GraphDefinition, already exists. It has nested regions, nodes with an open kind code, ports with profile, contract and polarity (Offer, Require, Neutral), and n-ary relations whose incidences carry a role and an ordinal. The documentation publishes 140 design graphs in this format, and the test suite validates and round-trips 30 of them. Nothing connects the IR to the runtime or the editors [291, 292].

2.2 Requirements#

Table 1 lists the seventeen requirements this paper answers and the status of each in the current runtime, with source evidence.

Table 1. Requirements and their status in the current runtime. Evidence is from the Reaktor repository at 7f318a55 and from the application’s repository at f6c19f13.
Requirement Now Evidence in the current runtime RG mechanism
R1 Mount self-contained subgraphs anywhere implemented Nested graphs and containers; but edges cross scopes freely and DI resolves through parents, so boundaries are implicit Scopes, boundary ports, Export; Theorem 3
R2 Navigation as traversal partial Routes are nodes; back stacks per graph; deep links reach only plain-payload routes; cycles need imperative back-patching Transition with statechart semantics; Section 8.3
R3 Recursive rendering of containers and screens implemented Fixed interpreter; custom designs copy 530 lines of framework containers Surface slots; containment folds
R4 Client/server contracts that cannot drift partial Shared Kotlin types and schema fingerprints; route strings duplicated and unchecked; servers dispatch outside the graph Contract fingerprints; Session; realization by placement
R5 Bolt-on auth, telemetry and similar partial Two interceptor systems; secured ports carry requirements that connect never checks Interceptor roles; aspects as rewrite rules (Section 9)
R6 Powerful, general traversals partial Three visitors in both repositories; they mutate, return nothing, and breadth-first drops the exit callback One primitive with theorems (Section 8)
R7 First-class DI and framework interop implemented Type-then-key matching; ambiguity undetected (two providers of one port bind arbitrarily); missing providers fail at call time Bind resolution as a lattice fixpoint with findings
R8 Data-oriented representation absent Pointer graph; 64-bucket maps scanned per access; whole graph re-snapshotted per navigation Columnar C-set kernel (Section 11)
R9 FFI, publish/subscribe, queues absent PUBSUB, QUEUE, PEER, WORKFLOW transports declared, never dispatched; FFI is a Hermes “hello” Channel, Session; FFI as a realization
R10 Structured concurrency as part of the graph partial SupervisorJob and dispatchers fixed in classes; GlobalScope escapes; lifecycle effects fire on rejected transitions Runtime containment is the job tree; lifecycle plans
R11 Code push absent Kernel pulls in Koin, Ktor and the database; Uuid.random needs crypto; dispatcher needs setTimeout; KClass identity cannot match across bundles Platform-free kernel; capability ports; region release
R12 Data layer in the graph absent Key–value object store; typed SQL DSL unused; tables found by regex heuristics Store, Dataset, References, Access
R13 Capability layer absent “Capability” names lifecycle mixins; the availability runtime is design only Place-provided capability ports; support lattices
R14 One graph for the whole platform partial Island shapes, a cloud snapshot and a parsed topology: three infrastructure graphs with no shared key Six layers, one store; projections (Section 14)
R15 A language for arbitrary logic in a subgraph absent Kotlin only; no code entries, no distributed operations RGL (Section 10)
R16 Formal guarantees inside the system absent No specifications; a single ordered truth enum; grep-based architecture tests Claims and evidence as elements; generated specs
R17 Code and ecosystem as database and logic; transactional edits partial Definitions exist only as code; edits mutate immediately; no revisions Graph store, patches, diffs; a realization recorded for every element

2.3 Five root causes#

The gaps share five causes, and each shapes the design.

  1. One relation shape. The only runtime edge is a pair (consumer, provider). Navigation, service calls, authorization and actor references are all squeezed into it, and semantic kinds are recognised by port key names such as routeBinding. A topic with many subscribers, a session, a join or a grant to a principal over a resource cannot be stated as one relation.

  2. Objects instead of data. The graph is a web of mutable objects. Node identifiers are Uuid.random() per process. Wiring order follows them, so dependency resolution can differ between runs. There are no revisions, digests or patches.

  3. Behaviour fixed in classes. Lifecycle, coroutine scopes, the navigation interpreter and the rendering interpreter are methods of Graph and Node. New semantics therefore require subclasses rather than traversals.

  4. Platform coupling. Every Graph needs a dependency-injection adapter, and the runtime depends on Ktor and the database module. Identity and scheduling assume platform APIs. This blocks running the graph inside an embedded JavaScript engine, and hence code push.

  5. No model of change or evidence. Edits mutate immediately and emit per-entity events. Definitions, runtime shapes, cloud inventories and evidence are separate artefacts with no shared identity.

RG addresses (1) with typed hyperedges, (2) with a columnar store of immutable revisions, (3) with traversals, (4) with a platform-free kernel whose platform access goes through capability ports, and (5) with patches and assurance elements.

The same causes at platform scale#

A survey of 283 features of Reaktor and five production systems built on its current runtime (Section 20.2) found these causes repeated across the platform as five patterns:

  1. One system, many models. A single developer tool held up to seven models of the same system, joined by names; one product declared its deployment topology in seven hand-kept places.

  2. Identity that does not survive a run. Spans, crashes and tool views were joined by label.

  3. Effects lost or misreported. Post-commit effects were fired without an outbox, and expired deadlines were reported as failures.

  4. Actions without principals. Approvers were free strings, and self-approval was possible on every path that changes tooling.

  5. Authority written in code. Checks were opt-in per handler, and the requirements of secured ports were never enforced.

Each pattern is one of the five causes seen from outside the graph.

Figure 2

Figure 2. A whole platform as one Reaktor graph: two phones and a browser, the edge network, a cloud region, a managed database and external services, from source modules to claims. The orange subgraph can be pushed as code: the scope social-ui, instantiated in the Hermes engines of both phones and in the browser. Its binds leave it only through boundary ports, FFI adapters whose contracts the installed app binary provides, so its closure (Equation 3) ends there and release social-ui@42 replaces it under next-entry activation without a store release. The claim social-ui admissible gates the release, and a receipt records it. Changing SyncApi would pull SyncEngine, and so the app binary, into the closure. The graph has 229 elements, 198 ports, 100 connections with 205 incidences and 71 assertions. It illustrates the design; it is not a deployed system.