KITSOKI
Learn · Notebook

Kitsoki, an operating system for Things and Processes

Kitsoki does for an organization's systems what an operating system does for a machine: Things are its files, Processes its programs, the ops catalog its system calls.

Kitsoki·
Read the paper and learn more
Contents
  1. An operating system for two primitives
  2. Every instance is a cell
  3. One meaning, native or WebAssembly
  4. The capability matrix places every effect
  5. Only the runtime holds state
  6. The object store is the authority
  7. The A-WAL: the record and the wire
  8. Cassettes: tests that tell the truth
  9. Foreign sources and the tape
  10. The HTTP layer and its sidecars
  11. Commands, queries and the outbox
  12. Order without a clock
  13. Through a partition
  14. One graph of linked namespaces
  15. Delegation, cloning and merging
  16. Global agreement, kept small
  17. Supervisor trees
  18. Fix it and run on from where it failed
  19. Processes fulfilled by injection
  20. Ops and queries lower to anything
  21. Zero trust, down to the interpreter
  22. Observability, given
  23. From zero to global
  24. Followers that work, then take over
  25. Helm, and every heterogeneous system
  26. What Kitsoki gives Kitlark
  27. What runs on it

An operating system turns a machine into something programs can share: it owns the hardware, keeps the files, schedules the processes, and answers every request through one table of system calls. Kitsoki does the same for a whole organization's systems, at the level of the things they are about. Its files are Things, its programs are Processes, its system call table is the ops catalog, and its disk is an object store. Every instance is a cell of one distributed machine: a browser tab, a command line, an edge worker or a cloud host, each running the same closure and meaning the same thing.

This page is the third of a series. Order costs work: gates, leaks and construction states the problem (order costs work, and only construction removes variety), What are Processes and Things? shows the language that constructs it (Kitlark's Things and Processes), and this page shows the machine that runs it. Each section is one move; the linked chapters hold the detail.

An operating system for two primitives

A classical operating system is layers: hardware, a kernel, a system call table, processes and files. Kitsoki keeps the shape and changes what each layer holds.

Layer Unix Kitsoki
durable state a disk an object store with conditional writes
kernel one machine's kernel the runtime in every cell
system calls the syscall table the ops catalog, one authorizer on every crossing
programs processes Kitlark Processes: stages, one typed Event per move
data files Things: identity, form, laws and history

Programs reach the world only through the table, so the whole system is a closed world that the checker reads before anything runs.

Every instance is a cell

Each Kitsoki instance is a cell: a membrane of granted capabilities, a log that is its record, and an interpreter that runs Kitlark turns. A turn is pure: it reads one snapshot and yields each effect as a typed request, and the cell answers it through its injected answerers.

Cells come in host classes, and anything that computes can be one:

Cell Runs as
browser tab a person host in the page's worker, offline for one person
native app iOS, Android and desktop apps embedding the interpreter, with a replica and an outbox
command line a person host, and an agent's entry point with that person's authority
user endpoint a laptop or workstation cell beside the person's own tools and models
single-board computer, gateway a small Linux cell on an open board at the edge of a site, often the link for the devices behind it
open-source microcontroller, IoT sensor the smallest cell: a lowered module, its readings, an outbox and a clock
robot, drone a device host that acts on the world through Actuation, inside a safety envelope
edge, cloud a token-checking reader near people, and dense hosts serving many tenants

A turn run in any of them gives the same world, because every host runs the same kit over the same seam, and the capability matrix decides which parts of a story each one runs.

One meaning, native or WebAssembly

Kitlark has one semantics in the kit over a native value layer. The interpreter runs a closure natively in the Go host, or the closure lowers to validated WebAssembly and runs as a guest: in a browser's worker, at the edge, or as a unikernel cell guest with no processes, threads or files of its own. The module's imports are exactly its granted crossings, so the grant is checked by the loader as well as the checker.

Either way the trace is the same: the same turns, the same effects, the same record, bit for bit against the kit's reference.

The capability matrix places every effect

A capability is an interface with an invariant, and a host class is its base plus the interfaces it implements. The matrix is derived from those classes: yes, by config, never. Each op binding names the interfaces it needs, so every effect of a story lands on a host that can answer it, or the story is refused at draft time with the effect and the missing interface named.

Answerers are injected: the provider, a simulation, a recording, a cassette. Only modules declared as answerers touch the network, storage, clock or randomness, and the injection is enforced at draft, build and gate.

Only the runtime holds state

Application code never writes state. A turn decides; the runtime commits. A write is a changeset, admitted by one pure function over a narrow view and the unapplied tail, and it lands whole or not at all: there is no partial write to recover from and no lock an application holds.

admit(state, changeset) -> entries | typed refusal

The same function admits on a server, a device and a browser. Every change to anything, a data row, a document section, a graph item or an application, is a commit through the one door of the typestore client, carrying its audit record in the same append.

The object store is the authority

The durable state of every namespace is its chain in an object store with conditional writes. A machine's disk is a cache: any machine with an empty disk rebuilds every file exactly. Every segment is written with a conditional write, so two machines writing one namespace race for the same key and exactly one wins; the loser is fenced at the place the damage would happen.

That is the only fencing mechanism, and it needs only what every provider offers: no managed database, no coordination service, no lease interface. In durable mode a commit is acknowledged when the store has it, so losing a machine loses no acknowledged work.

The A-WAL: the record and the wire

Every change goes through the Application Write Ahead Log. A crossing is written before it runs and its outcome before the program sees it; a change to data is a changeset at a position in a hash-chained log. If it is in the log it happened.

The A-WAL is the authority and the wire at once. The whole log is kept in the object store as a columnar lake; tables, indexes, screens and reports are images of it. A clone returns its work over its log, an instance pulls another's entries after a position with the chain verified, and a cell that was offline catches up from the last position it saw. Replay answers every crossing from the log, so any session runs again exactly.

Cassettes: tests that tell the truth

A cassette is a recording of real answers, played back like a VCR. Every answer a flow or a journey supplies in place of a real call is a cassette entry: an op, its input, its output or typed error, and where it came from. An entry is keyed by the request and by the digest of the code that answered it, and playback takes its clock and randomness from the recording, so a replay is exact.

That makes trustworthy tests cheap. A flow is recorded once against the real provider and plays anywhere, in seconds, with nothing mocked by hand. When a third-party API changes or breaks, the next recording disagrees with the last, and the difference names the op and the field. A Process that uses a model is tested the same way: the model's step is an op, its real answers are the recording, and the rest of the Process runs deterministically around it, cached, memoized or replaced in isolation. Data lake reads are recorded the same way, so a study or a report replays from its cassette.

Foreign sources and the tape

Most of the data a system touches lives somewhere else: a forge, a ticket tracker, a metrics store, a partner's API. Kitsoki reads it as lifted classes, declared and read like native ones, each with its freshness, its budget and its source versions. One lift per key serves every concurrent reader, and a lifted namespace is shared by mount across instances.

Every answer a source gives is recorded on its tape, a cassette namespace per authority and scope. The tape is a backup of every request and its answer, and it closes the gap every distributed program has: a call that reached the provider whose answer the program never received. If a crash or a restart lands between the network call and the business logic, the recorded answer is played to the program, and the request is not sent twice.

The HTTP layer and its sidecars

Every request a program makes leaves through one HTTP layer, an op with its grant, its tape and its receipt. Credentials and secrets never enter a program: a connection holds a credential handle, the credential sidecar applies it at the edge of the request, and the value is never returned, cached, recorded in a cassette or traced. Personal data lives in a PII sidecar the same way, named by id and capability.

So a closure moves between environments with no secret and no personal data in it, a cassette is safe to share, and the environment binds a functional equivalent: production's credential, a tenant's own, a recording or a simulation.

Commands, queries and the outbox

Kitsoki separates verbs from nouns. Commands go to a namespace's one writer; queries read a replica built from the object store, anywhere, without waking the writer. A command returns the position it committed at, and a query carrying that position is served only from a replica at or past it, so every reader reads its own writes.

A cell writes only by appending a command to its outbox, each with the base it read, and reads only its replica. One stream carries every committed entry back in commit order. Offline, the outbox holds; reconnected, it drains, each command replayed over the base it saw and merged by its fields' declared rules.

Order without a clock

There is no global clock and none is needed. Every actor carries a cone: one position for each namespace it has seen. Every request carries the cone and a receiver joins it before acting, so no actor sees an effect before its cause. Two events compare as before, after, indeterminate or dead, and nobody is shown an order nobody knows.

Agreement has a scope: one cone for a writer, two for a Link, n for a federation, and its cost is the round trip to the farthest cone in scope. Each actor stays available in its own region through a partition.

Through a partition

Real Things live where networks fail: a field, a ship, a plant floor, a basement, a moving robot. A partition is a state every cell is built for, not an error.

When the link returns, sync runs both ways. Up, the outbox drains in order and each command replays over the base it saw, merged by declared rules or raised as a Conflict. Down, the stream delivers every entry the cell missed, in each namespace's commit order. Cones carry the order across, so no effect is applied before its cause and the whole system comes back causally consistent.

One graph of linked namespaces

Kitsoki's data is one graph cut into namespaces. A namespace is one log with one writer: the unit of atomic writes, of cloning and of scale. A mount in the graph names the namespace that holds a subgraph, by store, never by machine, so a listing across many namespaces is a union read with nothing copied.

Owners federate the same way. Each agency, company or team writes its own namespaces and reads the others' at their positions, and a shared picture carries every part's provenance with no central copy. A Link declares how one side follows another and what comes back.

Delegation, cloning and merging

A parent delegates a subtree by writing a writer record in its own log; readers resolve it once and go direct, so the parent stays out of the data path. A clone forks a namespace at a position: a draft, a child instance, a job's workspace. It costs a copy-on-write snapshot, and it comes back as a pull request: a three-way diff per entity, never a replay of its log.

Delegation is also how Kitsoki shards. A subgraph that outgrows its writer splits into a namespace of its own under a new writer, and the parent keeps a mount; quiet namespaces pack onto one host. Splits follow the boundaries of invariants, so what must be consistent together stays together, and partitioning a busy domain is a delegation, not a migration.

What comes back merges by a declared ladder of strategies: lines, syntax, identity, field rules, regeneration. What no strategy settles is a Conflict, a tracked Process with one resolver Decision, shown where the item is.

Global agreement, kept small

Most data needs only causal order: each actor stays available in its own region and meets the others at a namespace's one writer. A few writes must agree across the world before they are acknowledged: a ledger balance, a unique name, who holds the right to fly a tail number.

Kitsoki models those as their own self-contained namespace, with an agreement scope that spans the regions that must agree. Agreement costs the round trip to the farthest cone in its scope, so only the small set of data that needs global consistency pays that latency, and everything else keeps committing locally. The checker reads the scope from the model: a write that needs global agreement lands in that namespace, and nothing else is slowed by it.

Supervisor trees

Work is supervised the way Erlang supervises it: single-owner units in a tree, restart as the recovery path. A supervisor is a story, and its children are writers, jobs and other supervisors.

It keeps no state of its own, because its records are in its log, and it reconciles what is declared against what it observes, as a controller does, so nothing depends on a live link between parent and child. A supervisor's death does not stop its children: writers keep shipping, because the store is the authority. Kitsoki validates like Ada at launch and recovers like Erlang after it.

Fix it and run on from where it failed

A job is its log, so a failure is a position, not a loss. A run that failed partway is recovered from the last state it entered before the failure, on exactly the closure it ran.

Op Does
fork from run fork the run at its last resumable state
patch and run from fork, apply a fix, and run on from that state
restart restart a run from a chosen state

Hours of finished work are kept: every crossing answered before the failure replays from the log, and only the steps after the fix run again. "This run cannot be resumed" and "resuming it failed" are different answers, the first permanent and the second worth another try.

Processes fulfilled by injection

Some work needs an operating system process: a build, a browser, a model server, a native tool. Kitlark declares that need as an interface (isolation, tools, resources, network) and never names a provider. The environment injects whatever fulfils it: a gVisor sandbox, a container, a microVM, a remote host reached over RPC.

The host kit interface is one Kitlark model of machines, units and volumes, implemented by each kit and proven by one conformance suite against a real host, a recording and a model of the host. A story runs the same on any of them, and a new place for compute is a kit and a binding.

Ops and queries lower to anything

An op is a contract: its schemas, its effect, its grants and its conformance suite, with a Kitlark twin as the reference. Its implementation is a choice made per binding. Kitlark runs everywhere; a zero trust Go module, generated from the twin wherever Kitlark expresses the op, loads while the instance runs; C, Rust or R compile to a module or serve over the module wire. Each is held to the same suite, shadowed against the twin on a share of production calls, and promoted only when no difference is left unexplained.

Queries lower the same way. A binding's query compiles to a plan, and the plan runs on whatever answers a typed scan under a declared contract: Kitlark over a replica, frozen SQLite, Parquet in a column store such as ClickHouse or DuckDB, a search index, a third-party API. The profile is chosen from measured reads, and the answer is the same answer.

Zero trust, down to the interpreter

A native module runs in a host process beside the instance, and it is safe there by construction. Zero trust Go: no package state, no ambient world (no clock, network, files or goroutines it was not handed), no unsafe, reflection or assembly, and no import without the raw capability that names it. Every call is metered for depth and bytes. One finding refuses the build; there is no exception list.

The interpreter is built on the same principles. The static core holds only what cannot be loaded: the dispatcher with authorization and receipts, the typestore and its log, the evaluator, the credential seam. Each dangerous primitive (processes, sockets, HTTP, SQL, syscalls, unsafe) is imported by exactly one seam, the core's import closure equals its inventory, and the core carries no exception list either.

Observability, given

Observability is a property of the system, not a project. Every A-WAL entry is a typed fact, every process records its runtime sample at a fixed grain, and every op call, model call and job move is a fact of a cube that Observe and the Proving Ground pivot.

Kitsoki is also well behaved toward the tools a team runs: it exports Prometheus metrics and structured logs, so dashboards, alerts and log pipelines read it with no adapter. Telemetry never shares a commit path with work, so watching the system never slows it.

From zero to global

Capacity is the number of namespaces times one writer's throughput. A namespace nobody uses costs storage and nothing else, and serves again within seconds of its next request. Any host serves any namespace: routing is by resolution, liveness by lease and fencing by the chain, so losing any machine, region or provider loses nothing acknowledged, and a standby on another provider continues the chain in the same store.

A box starts from the cheapest source that holds the state: a local clone, a ZFS send from a peer, a send stream from the object store or CDN, a rebuild from the log. A send is incremental from a snapshot, so starting a cell anywhere is bounded by the network, not by setup.

Followers that work, then take over

A follower does not have to wait idle. Every region runs a warm follower of the core namespace that does real work: it serves reads from its replica and runs the fleet's jobs, while one primary writes the core. When the primary is lost, a follower continues the chain in the same store as the new writer. The jobs running across the fleet keep running; only the work that was waiting on the core writer pauses for the handoff, then resumes in order.

Helm, and every heterogeneous system

A Helm chart says what to deploy; it cannot say how the system behaves. Kitsoki imports a chart as records, adds the stories a chart cannot state, runs the model under every hazard on a simulation host, and then ports one service at a time, its acceptance the derived suite.

The same model reaches past one cluster. A system that spans regions, providers and kinds of compute (Incus boxes, Kubernetes, provider microVMs, bare metal, edge workers, devices in the field) is one Kitlark model over host kits that implement one interface, each proven by one conformance suite. The capability matrix places every part, and the heterogeneous system is checked whole before it runs.

What Kitsoki gives Kitlark

Kitsoki is Kitlark's standard library and its machine:

Kind What it is
ops stateless typed functions, the system call table: declared effect, one authorizer
primitives Record and the typed values every Thing is built from
building blocks Thing and Process, with Decision, Link and Conflict
front end kit-vue: components are Things, Vue presents, JavaScript holds no authority
OS processes units fulfilled by injection: sandbox, container, microVM, remote host

A Kitlark class has one Record base and any number of Protocols, and a component binds to a Kitlark query compiled to a plan, so the page, the model and the machine are one checked program.

What runs on it

Order by construction needs a machine that refuses to run anything else. Kitsoki is that machine: state only the runtime writes, a record that is the authority and the wire, cells that mean the same thing everywhere, and supervision that needs no live link.

On it run the systems the series turns to next: an incident read as stocks and flows, a basin of wells and aquifers, a plant's process, a fleet, Kitsoki's own changes and defects. Each is Things and Processes on one operating system, and an agent works inside each one with exactly the authority its stage grants.

← All of Learn