Pre-alpha documentation
Compile a deterministic graph.
Use StateKnot's implemented graph compiler to validate a bounded topology and freeze its schema, reducer, limits, and canonical digest.
Run the maintained example
The example is compiled by the workspace's all-targets gate. It declares
validate → finish, compiles the descriptor, and prints the
SHA-256 digest of its canonical definition.
cargo run -p stateknot-core --example compiled_graph --locked
Read the complete Apache-2.0 example in
compiled_graph.rs.
What compilation freezes
-
Owner-qualified identity
A graph name is local to an issuer/subject owner and an exact semantic version. Any definition change requires another version.
-
Schema and reducer references
Input, state, update, output, and reducer implementation references are digest-pinned; executable code is never inferred from a name.
-
Bounded topology
Entry nodes, successors, routes, maximum parallelism, and maximum supersteps are part of the immutable definition.
-
Canonical identity
Nodes and routes are put in stable order, serialized as canonical JSON, and hashed. Checkpoints retain the resulting exact reference.
Invalid graphs fail before admission
The compiler rejects, among other cases:
- duplicate node or route identities;
- missing entry or successor nodes;
- nodes unreachable from every entry;
- paths that cannot reach a wait or terminal boundary;
- ready sets above graph parallelism limits; and
- definitions above the node, route, or two-MiB byte ceilings.
Register once, recover by exact reference
Migration 13 stores canonical compiled definitions under a tenant plus owner/name/version key. Re-registering identical bytes is idempotent; reusing the version for another digest is a conflict. Recovery recompiles the bytes and validates the checkpoint binding under the live fence.
let registered = store
.register_graph_definition(tenant_id, graph)
.await?;
let pinned = recovery.load_pinned_graph().await?; Missing, altered, cross-tenant, or checkpoint-mismatched graph evidence fails closed. During claimed recovery, integrity failure enters the same fence-bound quarantine path as corrupt checkpoint or journal evidence.
Move from definition to execution
The pure barrier planner already validates complete result coverage,
applies updates to the exact pinned reducer in stable NodeId
order, resolves continue/route/wait/terminal control, and creates a successor
checkpoint intent. The Runtime now binds that definition to an offline schema/reducer/node
executable closure and drives the durable root path. Continue with the Durable Graph runtime guide, then the Durable Agent Loop guide.
Bounded journal-isolated siblings now overlap with canonical commits;
loops, subgraphs, and the stable public Agent API remain later milestones.