Repository navigation
Introduction
Don't deploy code you hope works. Show what it would have done with yesterday's traffic.
Kronik is a source-available runtime in which a system is a deterministic function of its history. The goal is that every change can be verified against real production traffic before it goes live. The determinism covers everything that runs as Wasm actors, including their SQL state.
Kronik is pre-alpha: it has released v0.1.0, v0.3.0, v0.4.0, v0.4.1,
v0.5.0, v0.6.0 and v0.6.1, and is not ready for production. This page describes what the
code on main does (0.7.0-dev; the latest release is v0.6.1). The project status page
shows how far the work has come, including what has not been run on a VPS. The
quickstart is the finished-product journey with the
commands that exist today.
Kronik is one binary, kronik, that runs actors: Wasm components with
built-in state. Every input that an actor handles runs as a turn, every turn
is recorded in an append-only log before anything else happens, and all
state is derived from that log.
What the code does today, on one node:
-
Actors and turns (M1). An actor type, called a kind, is a Wasm
component that exports
describeandhandleand imports only Kronik's interfaces (the WIT reference). An actor such asbilling/acmeis one instance of a kind, with its own key-value state and its own SQLite database. It handles one input at a time, each in a turn that runs in a fresh instance of the component, within limits on fuel and memory. - Durability (M1). A turn's state writes, SQL changes and outgoing messages commit together or not at all, and nothing is applied, delivered or answered until the turn's record is fsynced in the log. After a crash, the state is brought up to date from the log.
-
Determinism (M1). Time, randomness and SQL functions such as
random()anddatetime('now')come from the host and derive from values recorded with the turn, so running a turn again gives the same outcome. A deterministic simulation of the whole daemon, with injected crashes, runs in the CI checks (ADR 0004). -
Interfaces (M1).
kronik serveruns the daemon: an HTTP gateway that routes requests to actors by the routes in their manifests, and a JSON API on a Unix socket. The CLI deploys components, sends messages, shows actors and their history, and resends dead letters. Every error has a stable code and a hint (CLI reference, error codes). -
Effects (M2). Guest code reaches the outside world only through
recorded host calls: outgoing HTTP,
callto other actors, timers, and host-side cryptography with secrets that the guest never sees. Every external effect is denied until the operator grants a capability. A crash in the middle of a turn is recovered by running the turn again with the recorded results; a request to a target that cannot take retries is not repeated, and the guest learns that its outcome is unknown. -
Fork, replay and diff (M3).
kronik proposeforks history, replays recorded traffic through new code and writes a behavior diff.approve,promoteandrollbackare the rest of that path. Policy rules decide whether a proposal may go through. -
SDKs (M4, M15).
kronik initandkronik buildproduce a component in TypeScript, Rust, Python or Go. -
Policy, tokens and MCP (M5). Tokens carry scopes. The JSON API is
described by OpenAPI.
kronik mcpserves the agent tools. Every mutation takes--reasonand--dry-run, exceptreplayandsend --fork, which take a reason and have no dry run. -
Operations (M6). Snapshots, shipping,
kronik restoreandkronik upgrade checkexist. TLS from certificate files works. ACME is tested against Pebble, not a public Let's Encrypt host.kronik doctorand/metricsexist. -
Foreign actors (M7, M20, M21). Linux programs from OCI images run in
gVisor. With
isolation = "microvm"(M20, opt-in) they run in a Firecracker VM of their own on a host with KVM; its proofs passed on GitHub-hosted Ubuntu 24.04 runners, virtual machines with nested KVM on AMD and Intel hosts, and have not run on bare metal or aarch64. gVisor stays the default.kronik serve --initinstalls the root service as before, and--init --rootlessthe nonroot service (M21, opt-in), whose installed proofs passed on the same kind of runner with AppArmor's restriction on user namespaces active and with it lifted; it has not run on other distributions, and the root service stays the default. -
Privacy (M8). Values with a subject can be sealed.
erasedeletes a subject's keys and SQL rows that have a_subjectvalue. A turn with a subject cannot write a table without a_subjectcolumn. Old rows in tables without that column, or with a NULL_subject, belong to nobody and survive erasure.resealrewrites closed segments. A--no-piifork replays with pseudonyms, including text and blob values of subject-tagged SQL rows. -
More of the change path (M9–M14). Proposals that span several actor
kinds (M9), the CLI against a remote API (M10),
watchafter a promote and preview forks that take new requests on unproposed code (M11), effect simulators that answer a fork's unrecorded effects (M12), rollback via replay of history under the old code (M13), and foreign actors copied into forks (M14). -
Standard
fetch(M22). Guest code may usewasi:http; its requests are recorded and replayed likehttp.fetch. - Keys and secrets (M23). The master key can be wrapped by OpenBao, AWS, GCP or Azure KMS, and secret names can be linked to OpenBao or Vault, AWS Secrets Manager, GCP Secret Manager or Azure Key Vault, read through a cache that rides out a backend's outage for a while. Both are checked against emulators and pinned services, not against real clouds.
-
Long-lived connections (M24).
WEBSOCKETandSSEroutes: the actor that accepts a connection owns it, its incoming frames and its close are turns of that actor, and the frames it sends are recorded with the turn and go out after the turn commits. A restart closes every open connection with a dedicated reason, and clients reconnect. -
Streaming bodies and blobs (M25, M26). A request body or a
fetchresponse above its kind's blob threshold (1 MiB by default) streams into a content-addressed blob store as it arrives and reaches the turn as a blob, a reference of hash and size; the log keeps only the reference, and memory stays flat whatever the size. A reference is not a permission: a turn may use only the blobs its actor holds and the ones it received or wrote. Actors hold blobs (put,retain,release), send them on messages, timers, calls and replies within a per-actor quota, and a collector deletes the files nothing keeps. A subject's blobs are sealed with its key, erased and resealed with it; forks and previews read production's blobs; shipping and restore carry them. The constant-memory runs at the brief's sizes passed on a test machine confined to two CPUs, not on the 2-vCPU test VPS itself, and blob shipping is tested against directory buckets and a local S3 server, not a cloud store. -
Observability (M28). OpenTelemetry traces built from the turn records,
metrics for Prometheus and over OTLP, and an audit export that
kronik audit verifychecks against the log.
The CLI, the JSON API and MCP are the supported surface. An embedded admin web
interface (M27) shipped in v0.6.0 and is accepted on a single node: with
TLS, the server.admin_listen listener serves it under /ui/, as an
ordinary client of the same API
(operations guide).
It shows a standalone node where its cluster view would be.
main also holds the cluster of M16, which no release has yet. A Raft group
of our own, on Kronik's log, replicates a node's log to the other members,
which fail over to a leader among them (kronik cluster init, token,
join, status and leave). With kronik cluster init --shards N the
actors spread over shards, a node per led shard, and a message to another
shard goes through the sender's outbox and arrives once. It was verified on
three VMs with 16 shards before it was merged. With more than one shard,
secrets, privacy mode, erasure and state rebases are refused with
NOT_IMPLEMENTED, and placement, distributed replay and rolling upgrades
(M17–M19) are not built
(design).
- Agents that write and change software at machine pace and need to prove that a change is safe.
- Humans who review the agents' work and do not have time to read all the code, but can read a behavior diff.
- Small teams that want safe deploys on a VPS without Kubernetes.
Other platforms use logs to survive crashes. Kronik uses the history to verify change, and the product is the behavior diff (M3). A feature that does not make changes safer, easier to verify or easier to run on a VPS does not belong in v0.1.
Kronik introduces five concepts of its own. Familiar concepts such as HTTP, SQL, state and timers do not count, and everything else is built from these five: a proposal is a fork with a diff, and a deployment points to a hash.
| Concept | What it is | Milestone |
|---|---|---|
| Actor | An instance with its own state, identified by kind/key | M1 |
| Message | Data sent to an actor: name, content type and body | M1 |
| Effect | A call from guest code to the outside world, via the host | M2 |
| Hash | The BLAKE3 hash of a component: the identity of its code | M1 |
| Fork | A branch of the system's history from an LSN | M3 |
Concepts defines these five and every internal term, and Architecture shows how the parts fit together.
v0.1 consists of nine milestones. M0 to M3 come in order; M4 to M8 each build on M3 and can be built in parallel, and release v0.1.0 needs all nine.
| Milestone | Content |
|---|---|
| M0 | Repository, CI, and five spikes with their ADRs |
| M1 | Durable turns on one node: log, state, SQL state, gateway, JSON API and CLI |
| M2 | Effects and capabilities: http.fetch, call, timers, secrets, grants and limits, and crash recovery of effects |
| M3 | Fork, replay and behavior diff: propose, approve, promote and rollback, with policy rules that decide whether a proposal goes through |
| M4 | TypeScript SDK, kronik init and kronik build
|
| M5 | Policy and agent interface: tokens and scopes, the complete JSON API with OpenAPI, and an MCP server |
| M6 | Operations on a VPS: TLS with ACME, systemd, snapshots, shipping and restore, engine upgrades |
| M7 | Foreign actors: Linux binaries in gVisor behind a recorded boundary |
| M8 | Privacy mode: sealed values per subject, erasure and forks without personal data |
After v0.1, the road to v1.0 (milestones M9 to M34) is a cluster, richer
replay, CI integration, visibility, control from outside and a compatibility
promise that holds until v2. Several of those milestones have already
shipped in v0.3.0 through v0.6.0. The build brief describes the whole road,
and the project status page says which parts are in the
tree and which are not. The cluster (M16) is on main and in no release
yet; M17 to M19 are not built.
- The quickstart is the install-to-verified-deploy journey, with the commands that exist today.
- Concepts and Architecture explain the model.
- The reference covers the CLI, the WIT interface that guest code is written against, and the error codes.
- The security model lists the threats Kronik is designed against and what protects against each of them today.
- The design notes and the architecture decision records live next to the code, under docs/design and docs/adr. They are the binding decisions behind the code.