Nishi OS

Constitution and evidence ladder · established 2026-08-04 · SSOT knowledge/nishi_os_constitution.txt

Nishi OS is a clean-slate operating system. It does not use ELF, it does not reproduce the Unix process model, and it treats an AI model as something the machine can run before a userland exists rather than as an application installed on top of one. Everything below is either an axiom the code is held to, or a rung with measured evidence behind it.

The directive

"i want it at least to be minimal linux competitive and i dont want our system formats in elf … i want it to avoid all the historic clutter of unix and linux and all the previous to land on its own two feet sota [as of july 2026]"
"load an ai natively from the first bit up so that it can achieve higher speeds"

Why a clean slate is defensible in 2026

The shapes chosen here are shipping reality elsewhere, so this is extraction of what is already proven rather than novelty for its own sake: capability kernels are in production (seL4's verified kernel, Fuchsia's handle model), asynchronous submission/completion queues beat per-call syscall traffic (the io_uring lesson, adopted as a shape without the retrofitted API), component manifests beat fork inheriting everything, and every current system composites surfaces rather than emulating a 1970s serial terminal. What is inherited is the lesson; what is declined is the debt.

Axioms

A1 — Capabilities only. No root, no uid, no ambient authority. Every resource is reached through a typed unforgeable handle. This is the estate's own live capability-token doctrine turned inward. Delegation attenuates and never amplifies.

A2 — NXE, not ELF. The native executable container is NXE. PE32+ appears exactly once, at the UEFI boundary, because firmware dictates that format and every operating system pays that toll; nothing past the boundary is a foreign format. ELF exists only for host organs running on someone else's Linux. The kernel never loads ELF and there is no ambient dynamic linking.

A3 — A tiny asynchronous syscall surface. Submission and completion queues, map, unmap, spawn, and capability operations. No ioctl zoo.

A4 — No fork. spawn(manifest, explicit capability grant). Nothing is inherited implicitly.

A5 — No signals. Channels and completion notifications.

A6 — No TTY, no termios. The display is surfaces owned by a compositor; text is a surface protocol.

A7 — No global mounted tree, no magic paths. No /proc, /dev or /sys. A process sees exactly its capability table, and services are typed endpoints rather than files pretending to be something else.

A8 — Never brick. The OS writes zero firmware or NVRAM state, and metal stays operator-gated and removable-only until deliberately promoted. This is inherited estate law and is enforced mechanically, not promised.

A9 — Evidence first. Every rung ships with in-process teeth, a gate, and a second-method witness. The bar is measured against a minimal Linux, never asserted.

A10 — Donor logic is ported, not wrapped. The run-proven rv64 kernel work (traps, scheduling, preemption, virtio, heap, paging, usermode) moves into the native lane. No Unix is bolted underneath to make it easier.

A11 — AI is a boot-time citizen, not an application. The model is loadable and runnable before any userland exists: no libc, no dynamic linker, no allocator, no float ABI, no syscall boundary. Inference is a kernel service, not a process asking the kernel for favours.

A12 — No lock-in: the model and the shell are swappable parts. There is a default, never a mandate. The inference engine, the model weights, the compositor and the shell are each a component behind a typed interface, chosen by a manifest row and replaceable without rebuilding the kernel. A11 names a slot, not a vendor. The mechanical test: if swapping the shipped model or GUI for a third-party one requires editing kernel source, A12 is violated.

A13 — Distribution is a capability, and poison pays. Sharing an asset or capability someone else published must work over a hostile link and be discoverable in one step, without letting a well-resourced adversary substitute what you receive. That means content addressing (you ask for a hash, not a host), signed provenance with pinned publisher keys, erasure-coded resumable multi-source transport with no mandatory tracker, and reproducible builds so a poisoned artifact is provable rather than merely suspected.

A14 — Interface stability is what makes A12 and A13 real. Component interfaces are versioned and additive; removing or renaming a field is a new version, never an edit. A swap ecosystem with unstable interfaces is a promise, not a capability.

A15 — No third-party tool in the product path. Foreign engines — QEMU/OVMF, other people's model runtimes, another operating system's filesystem drivers — are permitted only as second-method oracles that independently witness a result we produced ourselves. The moment one is required to run, to demo or to verify, the capability is not ours. The test is mechanical: remove the foreign tool and ask whether the claim still stands. A demo that needs a third-party tool is a demo of the third-party tool.

A16 — The spore: the system adapts itself to whatever hardware it lands on. A spore carries no per-machine code. On unfamiliar iron it must probe what exists, bind a driver if it knows one, synthesise one from a spec if the shape is known, fetch one from the network if another instance has met that device, and refuse honestly if none of those hold. An unbound device is a true statement; a false bind is a lie that can damage hardware.

The machinery for this already exists here and is gate-proven, which is why the work is porting rather than inventing. A driver specification carries the register map and the protocol step-sequence itself as data — an op-list — and the emitter walks it to synthesise a driver whose control flow is the spec. That is what makes a new device class a new spec row rather than new code. The binder probes, looks the device up by ID, emits the driver bound to the address the probe actually found, then runs it and checks. An earlier per-class emitter was retired precisely because hardcoding one device's ordering diluted that generality.

"Copying from the forest" needs no second network: a driver spec is a content-addressed, signed, reproducible artifact, so meeting unknown hardware is a one-step verified fetch under A13, and a device we bring up that the network lacked is published back. The spore that learns, teaches.

Honest state. The probe and bind stages now run in the x86 lane after ExitBootServices: the kernel enumerates PCI itself, matches each device against a registry carried as data in its own payload, and paints one of three verdicts — verified, mismatched, or unbound. Driver synthesis is still open, and the keyboard is still a hardcoded PS/2 driver, so "runs on any hardware" remains a partial claim and is listed that way below.

What the second witness was for. The first version of a registry row pinned an entire configuration dword, including the revision byte. Our own emulator verified it — because the emulator models the same bus we wrote the row against, so both sides carried the same assumption and agreed. Booted on real firmware, a device the registry owns reported a different revision and correctly came back mismatched. The row now carries a mask saying which bits are identity (class, subclass, programming interface) and which are not (revision); both witnesses then agree. The fix was a data field rather than a new code path, which is the point of keeping the protocol in the spec. The general lesson is worth more than the rung: a second method that shares your assumptions is not a second method.

What "the cost lands on the originator" means

When substitution is attempted, the burden falls on whoever published it rather than on the network: the signature identifies who, revocation propagates in one step so the artifact stops being served and relayed everywhere at once, the publisher key's standing is burned so its future publishes are refused by default, and a portable, independently re-derivable evidence bundle (the artifact, its signature, the honest rebuild, the diff) makes the attack attributable and reportable instead of deniable.

Retaliatory intrusion or denial-of-service against a suspected originator is permanently out of scope, and that is an engineering judgement rather than squeamishness. Such a mechanism is the single most valuable thing for an adversary to capture: one false positive turns it into our attack on an innocent party, and anyone able to forge a complaint gains a weapon aimed through us. Attribution and revocation impose real, compounding cost on an attacker while remaining defensible under scrutiny — which is what makes them durable.

Why A11 is reachable here specifically

An integer-only transformer stack already exists and is gate-proven — 126 nx_nofloat_* sources measured on 2026-08-04, covering GEMM, attention, softmax, layernorm, RoPE, KV cache, BPE tokenisation, sampling and serving, plus a complete encode → forward → decode → fast-generate family. Integer-only arithmetic is not an eccentricity in this context; it is precisely what allows the same math to run in ring 0 at boot, where there is no FPU state to save, no libm, and no floating-point calling convention to honour.

The speed argument is about deleting layers, not cleverness: no syscall per operation, no scheduler preempting the inference loop, weights mapped once with zero copies, and tokens written directly to the framebuffer. That argument stays a hypothesis until rung AI5 produces a row comparing tokens per second against a minimal Linux and a standard runtime on the same silicon, the same weights and the same quantisation. A11 never overrides A8 or A1: an engine running in ring 0 receives exactly the capabilities it is handed and writes no firmware.

The NXE container, version 0

offset  size  field
0x00    4     magic "NXE0"
0x04    4     version
0x08    4     arch (1 = x86_64, 2 = rv64)
0x0C    4     flags (bit0 kernel, bit1 needs-framebuffer)
0x10    8     entry offset into the payload
0x18    8     payload file offset
0x20    8     payload size (8-byte padded)
0x28    8     bss size, zeroed by the loader
0x30    8     stack size
0x38    8     payload checksum -- the loader re-derives it or REFUSES

Loader contract: verify magic, arch and checksum; refuse loudly on any mismatch;
copy the payload, zero bss, build boot-info, jump. rbx = &bootinfo on entry.

Ladder and current state

RungWhat it provesState
N1 ShimPE32+ boot shim queries GOP, validates the NXE payload, jumpsGREEN (embedded NXE; ESP file-read still open)
N2 Native GUINXE-format code paints the desktop and owns the screenGREEN
N3 InputKeyboard reaches the kernel and changes what is on screenGREEN
N4 OwnershipExitBootServices — the kernel takes the machine from firmwareGREEN
N4b Own driverAfter firmware is gone, the kernel drives the PS/2 controller itself and shows livenessGREEN
N5 Kernel parityrv64 kernel logic ported into the native lane — the two lanes meetOPEN
N6 UserlandNXE components, compositor, spawn with explicit capabilitiesOPEN
N7 StorageA sovereign filesystem beyond the ESP handshakeOPEN
N8 The barBoot-to-GUI, input latency, spawn, context switch, memory vs minimal LinuxOPEN
AI1 PrimitiveInteger multiply-accumulate runs inside the kernel at boot, known-answer verifiedGREEN
AI2 WeightsWeights read from the ESP and integrity-checked; a bad blob is refusedOPEN
AI3 First tokenTokeniser and a full forward pass in-kernel, before any userlandOPEN
AI4 GenerationKV cache and sampling loop; text streaming to the screenOPEN
AI5 The speed rowTokens per second vs minimal Linux, same silicon and weightsOPEN

The AI ladder runs beside N1–N8 rather than after it. Shaping the system around inference from the beginning is the entire content of "from the first bit up"; retrofitting it later would be the thing this constitution exists to avoid.

Swap ladder (A12)

RungWhat it provesState
SW1 SlotsModel, engine, compositor and shell become typed component interfaces; the shipped ones are default rows, not hardcoded callsOPEN
SW2 SubstitutionA second model and a second shell load from a manifest with zero kernel edits — and the build still boots with the default removedOPEN
SW3 Third-party parityA component we did not author passes the same admission gate as the shipped oneOPEN

The negative control carries the weight here: booting after the default is deleted is what proves nothing was quietly hardcoded, in a way that adding a second option never can.

Distribution ladder (A13)

RungWhat it provesState
PK1 PackageContent-addressed NXP: manifest, payloads, publisher signature, provenance chain, reproducible recipeOPEN
PK2 Verify or refuseHash, signature and pinned publisher checked before anything is unpacked; unsigned or mismatched is refused, never warnedOPEN
PK3 Poor-link transportErasure-coded, resumable, multi-source, no mandatory tracker — measured on a deliberately bad linkOPEN
PK4 One-step discoveryOne identifier resolves artifact, signature, provenance and verification recipe, with no seizable central indexOPEN
PK5 Poison accountabilityReproducible rebuild detects substitution; revocation propagates in one step; publisher standing burned; portable evidence bundleOPEN
PK6 Adversary gateA fixture that attempts substitution, downgrade, revoked-artifact replay and index poisoning — each refused with a distinct codeOPEN

PK3 is measured on a bad link on purpose: a transport only ever tested on good internet is untested for the thing it exists to do. And until PK6's attack fixture exists, PK2 and PK5 are claims rather than properties.

Spore ladder (A16) — each rung measured on hardware that was never special-cased

RungWhat it provesState
HW1 ProbeEnumerate PCI from our own kernel after ExitBootServices — no host OS, the spore reads the busDONE
HW2 Bind from specA probed device ID resolves to a registry row that carries a program — an op-list (read a config register, mask it, require a value, end) which the kernel interprets. One row runs four steps, another runs seven, and the interpreter is unchanged between them, so a new device class is a new row rather than new code. An unknown opcode is refused rather than skipped, an unterminated program is rejected at build time, and unknown device IDs stay unbound. Still open: the program verifies a device, it does not yet bring one up, and the keyboard remains a hardcoded PS/2 driver.DONE (verify)
HW3 FetchUnknown device triggers a one-step signed capsule fetch, verified before it goes near the deviceOPEN
HW4 Give backA device we bring up that the network lacked is published back as a spec capsuleOPEN
HW5 The barBoot and bind on N distinct physical machines with zero per-machine code; publish the bound/unbound matrixOPEN

Evidence behind the green rungs

All of the following is re-derivable rather than a screenshot of a good day.

Explicit non-goals for version 0

Source of truth: knowledge/nishi_os_constitution.txt. This page is generated from it and published through the publishing house rather than written into the docroot by hand. Rungs flip state only when a gate, a second-method witness and a log row all agree.