This file is the repository's contract for every contributor, human or agent.
It records decisions that have already been made; a task does not reopen them.
CLAUDE.md is a symlink to this file. A personal or global agent configuration
may add rules for its own user, but where the two disagree this file wins,
because it is the only one every contributor can see.
This file is edited only by a maintainer or by the agent orchestrating a task, never by a delegated agent. An agent that finds a rule missing or wrong reports the gap in its result and leaves the wording to the orchestrator.
The table orders layers from lowest (hal/, row 1) to highest (host tools,
last row). Normal dependencies flow one way, toward lower layers (earlier
rows); a crate never has a normal dependency on a higher layer (a later row).
| Layer | Crates | Contents |
|---|---|---|
| Hardware contracts | hal/ |
Traits, capability types and value types only. #![no_std]. Depends on no workspace crate. |
| Device and protocol libraries | netstack/, virtio/, i6300esb/, tpm/, acpi/, firmware/, btrfs/, sync/ |
#![no_std] protocol engines, drivers and shared primitives. virtio/ builds on netstack/; tpm/ drives a TPM 2.0 over the FIFO and CRB interfaces for measured boot and sealing only; acpi/ runs AML for platform hardware; firmware/ turns the platform description a backend hands it (the device tree's NUMA properties, the ACPI SRAT and SLIT) into hal/ values; sync/ holds the async primitives the kernel and the compatibility layers share and depends on hal/ for LocalInterruptMask; every crate in this layer depends only on hal/ (plus virtio/ on netstack/), and none depends on the kernel. |
| Compatibility layers | unix/, linux/ |
#![no_std] services the non-Preview-3 ABIs share (unix/) and the Linux ABI (linux/), each behind a kernel feature that is off by default. Both build on hal/ and sync/ (linux/ also builds on unix/); neither depends on the kernel. |
| Shared ABIs | compiler-abi/, artifact/ |
#![no_std] wire formats shared by the kernel, user space and host tools: the compiler plugin's request and response headers, cwasm target flags, the signature trailer, and the helios-bootfs payload image the kernel reads at bring-up. |
| Kernel | kernel/ |
Every piece of hardware-independent runtime logic: executor, timer, memory and OOM, instance registry, component host, Wasmtime adapter, network service, host-fs client, every WIT service, and, behind the linux feature, the native Linux process host. #![no_std], generic over Cpu. The user payload is not linked into the kernel: it arrives as a boot module (docs/boot.md). |
| Backends | aarch64/, riscv/, x86/, x86-vmm/, hosted/ |
Boot, trap, IRQ, timer, MMIO, UART, virtio transport, SMP wiring and native user execution, and nothing else. hosted/ runs the same kernel on the host OS under the same restriction. x86-vmm/ is the x86 user address space over a Machine the backend supplies, so the host builds and tests the code the kernel runs (x86/ is the only backend that depends on another crate in this layer). |
| Kernel image | the root crate helios (src/) |
The binary that links whichever backend the target selects, and runs hosted on the host. |
| Shared guest and host contracts | inspector-protocol/, wit-rpc/, wit-rpc-macro/, compiler-support/, tools/wasi-apps/bench-metrics/ |
std protocol, compilation and benchmark contracts shared by user space and host tools, never depended on by the kernel or any layer beneath it. inspector-protocol/ is the WIT RPC and Ed25519/TLS authentication contract between the inspector and the guest /inspector/* subtree; wit-rpc/ and wit-rpc-macro/ implement typed WIT RPC over it; compiler-support/ holds the Cranelift/Wasmtime compilation driver shared by compiler-plugin/, compiler-host/ and cli/; tools/wasi-apps/bench-metrics/ formats the bench.<name>=<value> lines shared by workload programs and benchmark runners. |
| User space | api/, api-macro/, programs/*, compiler-plugin/, venus/, webgpu/, vmm/, oci/, component-manager/, nu-shell/ |
The userland SDK, user-space libraries and wasm programs, kernel plugins included (programs/*, including programs/compositor/render/, and compiler-plugin/). venus/ is the Venus wire protocol a program's GPU driver links: the hand-written sinks and the encoders generated at build time. webgpu/ is the user-space WebGPU runtime over venus/. vmm/ is the reusable async micro-VM library (helios-vmm) backing programs/vmm. oci/ is the pure user-space OCI Distribution client and image store (helios-oci) shared by api/, programs/nu-shell/ and ops/. component-manager/ is the zero-TOML-by-default component topology model, authority validator, and async supervisor (helios-component-manager) driving the root SystemComponent. nu-shell/ is the shared Nushell engine (helios-nu) used by programs/nu-shell/, inspector/ and inspector-shell/. Neither user space nor host tools depends on the kernel, its backends, or the kernel image. |
| Host tools | inspector/, inspector-shell/, ops/, cli/, compiler-host/, profdata/, venus-gen/, workspace-root/, tools/branch-hints/, tools/desktop/check-text/ |
std crates that boot, build, inspect, transform and verify a guest or its artifacts. inspector-shell/ and ops/ back inspector/'s REPL and host operations; profdata/ is the kernel profile's header check and fetched-profile store, shared by cli/ and inspector/; workspace-root/ finds the workspace and holds the root key file format those two share; venus-gen/ generates venus/'s encoders from the pinned venus-protocol registry; compiler-host/ runs the compiler plugin under Wasmtime on Linux, the bench's Linux + Wasmtime column of aot-curl; tools/branch-hints/ rewrites wasm branch-hint custom sections from recorded profiles; tools/desktop/check-text/ verifies rendered desktop text against programs/compositor/render/. |
The rules that follow from the table:
hal/names hardware properties, never a consumer. Wasmtime, Cranelift, the kernel's WIT interfaces and the inspector protocol are all upward-layer concepts; ahal/trait method named after its caller belongs inkernel/. A capability says what the hardware can do ("lazy-commit virtual memory") and the kernel turns that into a runtime knob (Wasmtime's pooling allocator).- A backend contains adapter code only. WIT worlds, RPC handlers, Wasmtime
orchestration, debugger logic and anything two backends would both need
live in
kernel/, or inhal/when it is a contract. Duplicating logic across backends is a defect to fix in the same change that notices it. hosted/exists for development and test coverage. It is never evidence for a performance decision, an optimization profile, or the validity of a kernel optimization on real targets; those are grounded in the bare-metal backends and explicit target capabilities.- A new crate marks a real boundary used by more than one owner or an externally meaningful contract. Local implementation detail is a module in the owning layer.
- Directory names carry no
heliosprefix (cli/, nothelios-cli/); package names may (helios-cli) where the workspace convention wants them.
The workspace depends on helios-kernel/wasmtime through git dependencies in
root Cargo.toml (pinned by branch; the exact commit is locked in
Cargo.lock). That fork is a vendored dependency, not a transient experiment:
docs/wasmtime.md records the branch and commit series the fork carries. Moving
the dependency means updating Cargo.toml (when the branch changes),
Cargo.lock, and docs/wasmtime.md, and passing every check in §7 against the
new revision in the same change. Changing the fork itself is a maintainer
decision, taken before the change is written. A task that finds the fork
missing a primitive it needs (an accessor on a wasmtime type, a runtime
hook) reports the gap with the call site and the shape the primitive would
take, and stops there: it neither routes around the gap inside the kernel
nor adds the primitive on its own, because the orchestrating agent holds the
maintainer's decision and the fork's revision moves once, per §1.
- The kernel never selects a runtime, probes a feature, or switches behaviour
on
#[cfg(target_arch)]. Capabilities arrive through the backend'sCpuimplementation, including executable-code publication and ISA feature probing. - Kernel code depends on traits (
ComponentRuntimeFactory,HostFileSystem, and their kin), never on concrete Wasmtime types. A runtime is an adapter that satisfies those traits. - There is no global mutable state. State is owned and passed explicitly
through
Kernel<CpuImpl>,RuntimeState<…>and similar structures. - A system capability is a Rust trait first and a WASI/WIT interface second. Define the trait, then expose it.
- An optional subsystem is a cargo feature that is off by default, and a
build without it compiles none of its code. The Linux subsystem is the
linuxfeature. - The kernel exposes one async-first API, its resources, services and
capability checks, and every guest ABI is an adapter over it: WASI
Preview 3, WASIX and the Linux subsystem. An adapter translates arguments,
layouts and errors; it never re-implements a resource, a wait mechanism or
a policy the kernel owns. What WASIX and Linux need beyond Preview 3 lives
once, in
unix/.
- No workaround, fallback, stub, or "simpler approach" code. When a design does not fit, fix the abstraction. When the only alternatives are a degraded variant or no change, make no change and record the blocker for a maintainer decision.
- An unexpected case fails fast with a message that names what was checked. Silently substituting a default (an emulator for an accelerator, a smaller budget, a skipped step) hides the defect and moves the failure somewhere harder to diagnose.
- No legacy or compatibility paths. Removing a feature removes every path that served it, in the same change.
- No architecture change while debugging. A failure that appears to involve a core subsystem is diagnosed in that subsystem, not routed around it.
- Memory bugs are never masked. Do not inflate memory sizes, widen budgets, disable limits, lower optimization, or add component-specific allocation tricks. When a program, component, or kernel plugin exhausts memory, diagnose the ownership boundary, allocator initialization, grow path and lifecycle, and fix the shared abstraction.
- Kernel memory and user memory are separate ownership domains. The kernel is as close to zero-allocation as practical and, when it must allocate, uses kernel-owned pools; kernel OOM is fatal and panics. User-mode wasm instances, kernel plugins included, and native Linux processes use user-memory allocation and accounting; user OOM kills the instance or process and reclaims its pool, and never grows a kernel budget or adds per-plugin policy.
- A buffer the device handed up belongs to the driver and is on loan for one receive pass. Nothing the stack queues (an out-of-order TCP segment, an unread datagram, a deferred reply) retains it: the queued value owns its bytes. A driver's receive pool is a shared, unsignalled resource, and one pinned buffer stalls the ring for every socket on that queue pair.
- Heap allocation in kernel-facing code needs a concrete reason tied to variable-sized guest data, plugin payloads, or runtime ownership. Stack storage, static capacity, caller-owned buffers, arenas and typed ownership come first.
- No dynamic dispatch in kernel-facing code. Generics, associated types and
concrete adapters express a boundary whose implementations are known at
compile time;
dyn Trait,Box<dyn …>,Arc<dyn …>and type-erased callbacks do not appear. - Virtio is the I/O path: boot, block, network, host share and debug transport. Replacing any of them with IDE, an emulated legacy device, an ad-hoc host file, or other fallback I/O is an architectural change that needs explicit approval in the task that proposes it.
- A TPM 2.0 (
tpm/) is the one device outside virtio. It carries measured boot and sealing, and never data I/O. - A well-maintained,
no_std-friendly third-party crate beats a hand-rolled implementation. - Kernel-mode code is safe Rust above two kinds of boundary:
hal/and the backends, whereunsafetouches hardware, and a safe, ergonomic Rust API whose implementation confines theunsafeit needs and states each precondition. A component whose work needsunsafethroughout (a driver speaking a C ABI, a parser of untrusted formats, a protocol engine over raw memory) runs in user mode, inside the wasm sandbox, as a program or kernel plugin, so that its defects end an instance rather than corrupt the kernel.
async fnis the syntax for an async function in an impl block or at module level. A trait declaration spells its future out, with bounds, because that is where the contract lives:fn op(&self) -> impl Future<Output = Result<T, E>> + Send + '_;An implementation of that trait writesasync fn op(&self) -> Result<T, E>; the declaration's bounds are checked against it.fn … -> impl Futurein an implementation is correct only when the body returns another future untouched (a forwarder) rather than wrapping it in anasyncblock.clippy::manual_async_fnenforces the impl-block half of this rule and is never allowed off.- Errors are typed enums with
thiserror;anyhowdoes not appear in this repository, andcargo deny --workspace check bans(deny.toml) refuses any crate that depends on it. A CLI or test boundary may translate an error into text, but every crate preserves structured provenance. When an upstream API answers inanyhow::Result(wit-component, for one), the caller's typed variant carries the rendered chain (format!("{error:#}")) in a namedreport: Stringfield; it never erases intoBox<dyn Error>. - Diagnostics go through
tracing, the only diagnostic crate in the tree. Thelogcrate is never used; a dependency that emitslogrecords (cranelift_codegen, for one) is bridged withtracing_log::LogTracer. Kernel,hal/, library and protocol crates never callprintln!,eprintln!ordbg!. User-mode wasm programs underprograms/, kernel plugins included, write to stdio withprintln!andprint!as the natural thing; do not route them through the SDK for the rule's sake. - Structured text is never built by string concatenation. A multi-line
literal lives in a file pulled in with
include_str!; templated output uses a compile-time typed template or a serde serializer for JSON, YAML and TOML, so a renamed field fails the build instead of emitting a broken document. - Repeated module, enum and type paths get a
use; long fully-qualified paths are not spelled inline. #[path = "…"]never pulls a source file across a crate boundary.- Invariants live in types, not in runtime checks; structs, traits and generics express variation rather than enums or erasure.
- "Kernel plugin" is the term for an ordinary user-mode wasm program that runs inside Wasmtime under the normal isolation model. Plugins differ from other programs in provisioning and lifecycle, not in runtime boundary.
- Non-core kernel functionality may depend on kernel plugins.
- The compiler is a kernel plugin: bootfs-provisioned, loaded at kernel
startup, trusted for signed
cwasmoutput. - The HTTP client is a kernel plugin (
programs/http-client): the kernel implementswasi:http/typesonly and forwardswasi:http/client.sendthrough a cache-padded, NUMA-localPerProcessorProvidershard to that core's lazy pluginwasi:http/handler; HTTP/1.1, HTTP/2, HTTP/3 (QUIC), DNS and TLS run in user memory, synchronized withProcessorStepCPU hotplug so departing cores drain/redirect work to their successor.ProviderSlotremains the route for singleton plugins with exclusive hardware ownership (such ascompositor). - Plugins share the user-memory and allocation contract of every program. There is no plugin-private allocator policy, memory floor, or oversized linker memory. A plugin may fail with a typed OOM result and be discarded or restarted by its owner through the shared runtime contract.
- The kernel provides the exception and signal mechanism Wasmtime's runtime
needs.
Config::signals_based_traps(false)is never a final answer: it removes guard-page bounds-check elimination and Winch compatibility. - Typed function references, SIMD, relaxed SIMD and target ISA feature probing stay correctly enabled wherever the real target supports them.
- Every Wasmtime performance opt-in the kernel can support stays enabled:
pooling instance allocation, signals-based traps, stack-limit
interruption (
Config::stack_limit_interruption: the end of a processor's guest time slice (GUEST_TIME_SLICE), a kill and a signal lower the running store's stack limit, and the resumable check at every function entry and loop header takes them; never epoch interruption, whose per-entry and per-loop checks cost 10–29% on compute), SIMD, threads, the component model,async_stack_zeroing(false). With a real user VM,memory_reservationandmemory_guard_sizeeliminate wasm32 bounds checks, withmemory_init_cow(true)andmemory_may_move(false). Disabling any of them needs a same-PR justification of the alternative semantic path. - x86 guest code is compiled for the highest ISA level the processor satisfies. The kernel saves no extended vector state: its image carries no VEX or EVEX instruction, and it switches away from guest code only at call boundaries, where the vector registers and k-masks are caller-saved. A change that breaks either property brings XSAVE/XRSTOR preservation with it.
- Performance decisions rest on bare-metal targets and explicit capabilities,
never on
hosted/. - A performance test, benchmark, or acceptance measurement runs
--releaseartifacts. Debug builds serve functional checks and diagnosis only.
Helios targets modern multi-core hardware. SMP correctness is a day-one
property of every kernel and hal/ subsystem, never a follow-up.
- A new abstraction states its concurrency contract before its API: which operations are lock-free, which take an async mutex, which fan out to other processors. "Add SMP later" is not a design note.
- Every address-space mutation invalidates the local TLB. One that removes a translation or narrows its permissions also sends an IPI shootdown to every other processor that has run in that space, and frees nothing it unmapped until every one has acknowledged; making a not-present page present needs no shootdown, because no processor caches a not-present translation.
- Hot paths use per-CPU storage indexed by the executing processor;
cross-processor queues prefer atomics and lock-free channels to a mutex.
Which processor is executing is a property of the hardware, not state the
kernel owns and passes: every backend answers it in one instruction from
a register the boot path seeds before the heap exists (
fs:[8],tpidr_el1,tp), sohalpublishes it as a linkage contract the backend fills, the way the global allocator and the panic handler are published, and any code may ask — a task future, a drop path, the global allocator. ACpuhandle describes the platform (its timebase, its processor table, its watchdog) and is still passed explicitly; it is not the route to the processor index and carries none. What a per-processor structure must still state is which of its operations run on the owner and which arrive from any processor: the index says where you are, never that you are alone, and a foreign free or a cross-processor push still needs a path that is correct without it. - Words written by different processors live on different cache lines
(
crossbeam_utils::CachePadded, sized per target), and a structure's docs say which processor writes each padded block. - A lock that an interrupt handler can reach (an allocator, a frame pool,
anything
Notify::notify_allor a waker can touch) masks the local processor's interrupts for as long as it is held, throughIrqSafeMutexinkernel/src/memory/and thehal::critical_section::LocalInterruptMaskit rests on. Cross-processor exclusion stays the lock's own spin word; a machine-widecritical_sectionaround a lock that already has one is contention, not safety, and is reserved for state only one processor may touch at a time (an interrupt controller register, a PCI configuration cycle). - Hardware the target already has (XSAVE and AVX, MWAIT, cache-coherent I/O, GICv3) is brought up properly rather than avoided because its setup is SMP-aware.
Performance is measured on one architecture: x86-64 Linux under KVM. Nearly
everything a Helios benchmark exercises lives in the cross-platform kernel,
so a second architecture would measure the emulator or the host, not the
kernel. bench-x86-64-linux is CI's only benchmark lane; the aarch64 and
riscv64 lanes are functional checks under TCG and never a performance
surface. GitHub's Arm runners expose no KVM, and macOS runners are not used
(§7).
Capture a baseline before any change that touches a kernel hot path,
correctness fixes included, compare after, and cite the medians and any
regression in the PR. Baseline logs live under target/perf-baselines/ and
are not committed. A developer laptop is not a benchmark host: take numbers
from the CI lane or a dedicated machine.
Two runs of the lane are not a comparison: the runner's CPU model changes
from run to run. The paired mode of bench-suite.yml (baseline_ref, or
--profile-use for a build-kind pair) boots both images in one job on one
host, reports the noise floor, and carries the compute control, and it is
the instrument for any before/after claim. A PR cites the paired run and
job ids and the control row beside its medians.
The canonical compute workload is the in-kernel compiler plugin compiling a
fixed wasm input. The regression target is the median elapsed_ms over
iterations 2..N; iteration 1 pays the cold cache build and is excluded.
--compiler-timing adds a Cranelift pass breakdown for diagnosis, not for
the baseline.
./target/release/helios vm --arch x86-64 --release --accel kvm \
aot-bench artifacts/wasi-tools/curl.wasm --iterations 5 \
| tee target/perf-baselines/x86-64-kvm-curl-<short-sha>.logA network-path change takes a second baseline, because the compiler workload
never touches the NIC. The canonical network workload is tcp-throughput on
a multi-queue tap backend; slirp (user) is single-queue with no offload and
is not evidence for anything the virtio-net driver negotiates. Cite the
virtio-net online boot line beside the median: it records the queue-pair
count and the checksum and TSO bits the run actually had. The lane boots one
guest per workload class and prints the line for each; the one to cite is
the boot that ran the workload being measured. docs/networking.md covers
the backends and the privileged setup.
helios vm net-setup \
--net-backend tap --net-ifname helios0 --net-bridge helios-br0 --net-dhcp
./target/release/helios vm --arch x86-64 --release --accel kvm \
--net-backend tap --net-ifname helios0 --net-bridge helios-br0 \
--net-queues "$(nproc)" \
workload-bench --workload tcp-throughput --iterations 5 \
| tee target/perf-baselines/x86-64-tap-tcp-<short-sha>.jsonlThe same aot-bench on an arm64 machine under HVF (--arch aarch64 --accel hvf) is a valid optional look at a second architecture. It is never required
and never comes from CI.
- Performance, scalability and cleanliness work is not cut short because the change is large. When an improvement tracks modern high-performance practice and yields a cleaner abstraction without breaking a contract here, take the full path: cross-crate interface reshapes, ownership moves across subsystems, ABI changes across backends.
- Effort is not a decision input. "Hours", "days", "quick win" and any other time-cost framing do not appear in a proposal. The criteria are whether the change resolves a root problem, whether the result tracks modern practice and reads more cleanly, and whether it introduces a contract violation.
- "Discuss before building" is a rule about public API: the surface a library exposes to other people, where a reshape is a commitment. Inside this tree it almost never applies. A large internal change, a core subsystem replaced included, is recorded on its issue with the diagnosis and the decision, then built and measured; that record is the whole of the discussion, and a performance change in particular is gated by the paired measurement of §3.6 and by nothing else. Where a discussion does happen it is for alignment, never for permission to land a degraded variant.
- The Linux subsystem runs unmodified Linux programs natively on x86-64 and aarch64, an important optional feature of Helios. Its goal is the Linux UAPI in full, and its support is measured by the conformance suite (§7), never by counting syscalls.
- Native execution is a
hal/contract each backend implements. Linux ABI decoding lives inlinux/, never in a backend or the kernel core. Each implemented behaviour cites the Linux source or manual it follows, and a divergence from Linux is a defect. - Every Linux process lives in a container, and its children stay in it. A
container is the Linux system its processes see: its root and mounts, its
process IDs, its users and groups, its hostname, all constructed by the
kernel. It holds the
ProcessAuthorityit was created with, which is the ceiling of everything its processes can reach. Processes in different containers see nothing of each other. - Inside a container, Linux's own permission model (users and groups, file modes, capabilities, setuid) applies as Linux defines it and only narrows the container's authority, never widens it: a process running as uid 0 holds no more than its container was granted. Every syscall that reaches a resource derives the capability the matching WASI or WASIX operation derives, and a missing right fails with Linux's errno.
- A filesystem reaches a program only through an explicit mount, and the rights the mount grants are all a WASI or WASIX program holds on it: neither sees ownership, modes or ACLs. A container's mounts are the same explicit mounts, and their rights bound everything the container's processes can do on them. A mount is granted as private or as shared, and that never changes while it exists. A private mount belongs to one container, and within its bound the kernel enforces the ownership, modes, ACLs, setuid bits and file capabilities a Unix filesystem stores, as Linux does. A shared mount may be granted to several containers and to WASI programs at once, and in each container it behaves as it does for WASI: every node appears owned by the identity the container's configuration names, its modes follow the mount's rights, and it is nosuid and nodev with file capabilities ignored. A node a non-Linux program creates, or any program creates on a shared mount, takes its owner and group from its parent directory, and its mode from the parent's, with the execute bits cleared for a regular file; no mount or WASI interface carries a user or group.
- Native execution runs only with the hardware protections its contract states (kernel-mode execute and access protection of user pages, a processor unaffected by rogue data cache load) and refuses to start where one is missing, naming it. It keeps every mitigation Linux applies to user processes on the same hardware.
Helios runs in production as a guest under hardware-accelerated virtualization on a cloud provider's x86-64 Linux KVM host, and a macOS development host under HVF is the same class of machine. Design and policy decisions assume that machine.
- Guest processor time is cheap and every device access crosses the virtualization boundary, so a mechanism that spends processor work to save device round-trips is usually the right one.
- The facilities a host offers its guest are part of the machine model, not an edge case.
- The host's device models are a trust boundary: device input is untrusted, and limiting what a device may access or claim is a legitimate design input.
- TCG checks correctness on architectures CI cannot virtualize. It is never a design target, and an optimization that wins only under emulation is not an optimization.
The kernel runs a cooperative async executor. Anything that pins it blocks
every other task: the 9p host-fs transport, WASI futures, timers, the network
service. These rules bind every #![no_std] crate and every crate the
executor drives (hal/, kernel/, the backends' runtime paths, components).
The signal and lock rules below bind the host side of the inspector
transport as well (inspector-protocol's client: one reader, many waiters),
because a lost wake there hangs a bench lane exactly as one in the kernel
does.
block_ondoes not appear in production code. Its only uses are tests, bootstrap entry points that run before the executor starts, and its own definition. A caller that seems to need it becomes async instead.- An async operation never looks synchronous. When an operation reaches a
trait that implements it with
.await, the public entry point isasyncor returns a future; no sync shim hides ablock_on. - Nothing busy-waits on software state inside an async context.
core::hint::spin_loop()is for sub-microsecond hardware synchronisation only: a UART FIFO drain, a virtio descriptor completion, critical-section contention. Readiness, channel messages and transport replies are awaited throughNotify, oneshot channels, oryield_now().await. - A signal is armed before the condition is tested, never after, so that a
wake-up between the test and the park cannot be lost.
Notify::notify_allis a broadcast to waits that already exist;notify_oneandnotify_countstore permits. The two never mix. - Blocking interfaces (serial readers, channel receivers) expose a
non-blocking
try_*variant for async callers. Blocking variants exist for bootstrap paths only. - No
Arc<Mutex<T>>behind an async API. Channels, the kernelNotify, and single-ownerRefCellwithin a task come first; when a lock is unavoidable it is the asyncMutexorRwLockfromsync/, and the guard is released before an.await. - A loop that polls for progress yields on the non-ready path so the executor can drive the task that produces the progress.
- The inspector's commands are
shell,tracing,stats,replandvm.repltreatsstatsandtracingas local shortcuts and forwards everything else to the guest shell.vmboots the selected architecture under QEMU, waits for the guest/inspector/*subtree, and then runs one of the session commands or a bench action:aot-bench,workload-bench,net-setup,net-teardown. Noqemu-shellordashentry returns. - The accelerator is always named. With no
--accel, the inspector requires the profile's native accelerator and fails saying which check refused it (/dev/kvmmissing or unreadable,kern.hv_supportnot set, host architecture mismatch). Emulation is asked for with--accel tcg, never reached by falling back. vm --arch aarch64 --acpiboots thevirtmachine from ACPI tables instead of a device tree. The aarch64 kernel takes its whole platform description from firmware and QEMU publishes one description or the other, so both modes keep booting and CI runs both.vm --kernel-debug --gdb <endpoint>is the QEMU gdbstub path for symbol-level kernel debugging, with--gdb-waitto attach before kernel entry;tcp::1234works with GDB (target remote :1234) and LLDB (gdb-remote 1234). It stays working forriscv64andx86-64.vm --debugis the local kernel-debugging shortcut: debug profile, default gdbstub, wait for the debugger, retained runtime directory, monitor and QMP sockets. Prefer it to hand-written QEMU invocations.- The inspector exposes the diagnosis knobs a developer would otherwise
script by hand: retained runtime directories, QEMU stdout and stderr, QEMU
-dtraces, HMP and QMP sockets, CPU and accelerator overrides, raw QEMU argument passthrough. A missing knob is added to the inspector rather than repeated as a manual command. - Boot and kernel debugging is evidence first: reproduce, capture serial and
QEMU logs and GDB, LLDB or QMP state, and only then change boot, device
topology, trap, or runtime code. A stuck or silent VM is inspected through
the process, the gdbstub, the symbols, the serial socket and the QEMU logs
before any conclusion;
hosted/evidence does not stand in for it. - An issue's own diagnosis is a hypothesis, not a finding. The cause is re-established from the run's artifacts (the console log, the counter lines, the QEMU and gdbstub state) before any code changes, and a PR that fixes a different mechanism than the issue named says so.
vm --kernel-feature linux --bootfs-root <dir>boots a kernel with the Linux subsystem and a boot root holding Linux programs;linux/tests/build-fixtures.shbuilds that root.- Inspector and guest communicate through the WIT RPC defined in
helios-inspector-protocol, never through a side channel.
- WASI 0.3 is the kernel's first-class ABI. Programs, tools and host interfaces use 0.3 wherever it covers the need. Preview 1 and WASIX are supported for programs built against them; Preview 2 is not a supported ABI.
tools/wasi-apps/build.shis the single entry point that stages the WASI shared-fs tooling: it downloads the official CPython WASI build intoartifacts/python3-root/(python3.wasmplus the standard library) and builds the Rustcurl-wasiintoartifacts/wasi-tools/.- Helios tests against real CPython or nothing. A hand-rolled interpreter stub does not return.
docs/wasi-tools.mddescribes the reproducible workflow; a change to runtime behaviour updates the docs and the paths in the same change.linux/tests/build-fixtures.shbuilds the static musl Linux fixtures for x86-64 or aarch64 and, on a Linux host of that architecture, runs them there first. A fixture records the Linux behaviour it expects and where that comes from.
Before a change is complete, run the recipes for every surface it can
affect. Compile and lint recipes run helios-cli kernel-keys; tests that
read a boot payload run helios-cli kernel-prebuild. They export the
trusted-root public key file as HELIOS_KERNEL_ROOT_PUBLIC_KEY, the only prebuild output the
kernel build tracks; a recipe that compiles the kernel's tests also exports
HELIOS_KERNEL_ROOT_SECRET_KEY, which only a test build reads and no
kernel image is given (the inspector's image build searches every image
it links for that key and fails on a match); the helios-bootfs
payload it also writes is loaded at boot, never compiled in, so changing
the boot programs never relinks the kernel. The check-target set is the
backends the diff can reach: a change in hal/, a library crate, a shared
ABI or kernel/ runs all three bare-metal targets; a change confined to
one backend runs that backend's target; a change confined to the host tools
or a user program runs none.
just check-host
just check-target aarch64-unknown-none helios-aarch64
just check-target riscv64gc-unknown-none-elf helios-riscv
just check-target x86_64-unknown-none helios-x86
just test-embedded-debugger
just lint
just test-unitsjust lint is tools/fmt.sh --check (every workspace member plus the
standalone Rust crates ops-py and tools/wasi-apps/*),
cargo deny --workspace check bans against deny.toml, and
cargo clippy … -D warnings over the host crates (including the root helios
binary), each guest program and standalone tools/wasi-apps/* crate, and the
three bare-metal targets (including the root helios kernel image).
just test-units runs test-kernel, test-libraries and test-host-tools,
covering every host-testable workspace crate (all targets, taken from
cargo metadata minus the bare-metal-only backends helios-aarch64,
helios-riscv and helios-x86), plus the standalone tools/wasi-apps/*
crates with host tests.
kernel/tests/hal_layering.rs enforces §1 and recipe coverage:
- no wasm/WASI/Wasmtime terms leak into
hal/, and WASI/WASIX protocol names stay insidekernel/src/wasmtime_adapter/; - every workspace member from
cargo metadatais assigned a §1 layer (with no unassigned or stale entries), and every normal workspace dependency obeys the one-way layer direction and intra-layer rules; - every workspace member is covered by
Justfile's lint and test recipes (or the named bare-metal test exclusion list), so a new crate cannot silently fall out of CI. Both recipes run throughcargo nextest rununder.config/nextest.toml: one process per test, so a test that hangs is killed after its slow-timeout and reported by name instead of stalling the lane.
CI (.github/workflows/ci.yml) runs the same recipes, one lane each, so a
red lane names the surface that broke:
| Lane | Runner | What it proves |
|---|---|---|
check-host |
ubuntu-24.04 |
The host surfaces compile. |
lint-fmt, lint-host, lint-programs, lint-aarch64, lint-riscv, lint-x86 |
ubuntu-24.04 |
Formatting, the deny.toml bans, and clippy at -D warnings; a bare-metal lint lane is also that target's compile check, since clippy builds the packages check-target checks. |
test-kernel, test-libraries, test-host-tools, test-embedded-debugger |
ubuntu-24.04 |
Unit tests, the btrfs reader against mkfs.btrfs images, and the hosted /inspector/* subtree. |
smoke-x86-64 |
ubuntu-24.04, --accel kvm |
Boot on one node and on two NUMA nodes, shell, CPython, the in-kernel compiler, a trapped OOB load, curl over virtio-net, the raw serial captures; under swtpm, the kernel's signing key kept across two boots, resealed after a changed payload, and a tampered payload refused; static Linux programs through dash, checked against the same programs run natively on the runner. |
smoke-x86-64-venus |
ubuntu-26.04, --accel kvm |
gpu-test on a Venus virtio-gpu-gl device rendered through lavapipe: a virgl context's fence, host and guest blobs, two instances at once. It runs only on changes to the 3D path, against a pinned QEMU and virglrenderer prebuilt in GHCR. |
smoke-riscv64 |
ubuntu-24.04, --accel tcg |
Boot, a two-node NUMA boot, shell, CPython, a trapped OOB load, the inspector RPC over vsock, curl over virtio-net. |
smoke-aarch64 |
ubuntu-24.04-arm, --accel tcg |
Boot from the device tree and from ACPI, each on one node and on two NUMA nodes; under swtpm, the kernel's signing key kept across two ACPI boots, resealed after a changed payload, changed state detected across device-tree boots, and a tampered payload refused; static Linux programs through dash, checked against the same programs run natively on the runner. Runs against a pinned upstream QEMU the lane builds and caches, because Ubuntu 24.04's QEMU asserts in its emulated GICv3 under multi-threaded TCG. |
bench-x86-64-linux |
ubuntu-24.04, --accel kvm, multi-queue tap |
The workload benchmarks of §3.6, with the negotiated virtio-net features reported. |
All smoke suites, the benchmark lanes and kernel-profile collection run nightly and on demand. They retain their full coverage outside the review loop. A nightly failure opens or reopens its suite's issue and records the failed run. Release-triggered benchmarks also remain enabled.
A pull request runs only non-heavy lanes whose surfaces its change touches
(.github/ci-lanes.json), and a draft runs lint-fmt alone until it is
marked ready for review. Compile, lint and test lanes keep a Rust cache,
written only by a main push. Other shared caches are written only from
the default branch. Guest wasm is built once per profile and reused by
every test and smoke lane that runs a kernel prebuild. A consumer compiles
its tests while the wasm builds and runs them once its profile is ready.
The CI result job requires every selected lane to succeed. Every job run by
a pull request or main push has a 15-minute timeout. A pull request's run
finishes within 15 minutes. Linux compatibility is measured by gVisor's
syscall suite, in a lane that runs only when a change touches the Linux
subsystem.
Every lane runs on a Linux runner. macOS runners are not used: their queue dominates the run and nothing Helios ships targets macOS. Every boot in CI names its accelerator explicitly, per §5.
The lint gate is -D warnings with no lint allowed workspace-wide;
[workspace.lints.clippy] enforces allow_attributes,
allow_attributes_without_reason, undocumented_unsafe_blocks,
multiple_unsafe_ops_per_block and missing_safety_doc across every crate.
Suppressing a lint needs #[expect(…, reason = "…")] on the item, with a
reason that says why the lint is wrong there. clippy::manual_async_fn is
the gate for §3.2's async fn rule.
dep-check.yml runs on a schedule and on demand. kernel-profile.yml
collects the x86-64 kernel profile every release build spends, nightly and
on demand (docs/pgo.md); bench-suite.yml's profile-generate job
calls it. release.yml runs release-plz after CI succeeds on main:
regular merges open or update the release pull request, and merging a
release pull request cuts tags, changelogs and releases, so commits follow
the conventional format (feat:, fix:, feat!:, BREAKING CHANGE:) and
nobody edits a version or a changelog by hand.
mainis the only long-lived branch. Nobody pushes tomain. Work lives on a topic branch and lands through a pull request againstmain; merging arelease-plzpull request cuts the release and is a maintainer decision.- A problem becomes an issue before it becomes a branch; one issue, one
branch, one PR, with
Fixes #Non its own line in the body. A PR that advances an issue without closing it saysPart of #N. - Commits on
mainare signed; the branch ruleset rejects unsigned ones. Commit messages and PR bodies carry no attribution trailers, generated-by footers, or session identifiers. - A PR merges when every check it can affect is green. A red lane that is
already red on
mainand untouched by the PR is named in the PR body with the issue that tracks it (filed by the PR if none exists yet) and does not block. Evidence in the PR body is concrete: the run id, the lane, the median, the negotiated feature line, the log line that proved the diagnosis. - A change to the Wasmtime fork, to a CI runner or lane, or to anything that publishes is discussed with a maintainer before it is made.
Several agents and developers work on this tree at once. The rules that keep them from colliding:
- One checkout per task. A delegated agent works in its own git worktree
branched from
origin/main, with a clonedtarget/for a warm cache, and never edits, cleans, or builds inside another worktree or another project. Nothing outside the worktree is modified for any reason: not another project'starget/, not a tool's cache under the home directory, not a sibling worktree. When the resource-headroom floor refuses a build, the agent may delete rebuildable directories inside its owntarget/and otherwise stops and reports the shortfall; reclaiming space anywhere else is the orchestrator's or the maintainer's action. - A delegated agent runs the per-crate checks for the crates it touched
(
cargo check -p,cargo clippy -p … --all-targets -D warnings,cargo nextest run -p <crate>with every target and never--libalone, because the integration tests are where a crate's enforcement tests live, the relevantjust check-target, file-scoped rustfmt). The workspace-wide lint and test suite is CI's job; running it locally as well pays the same compile twice. A check that can outrun the agent harness's default shell time limit runs under an explicittimeout, or in the background with one waiter, so that a cut-off log is never read as a result. A local check the machine cannot run (a boot refused by the resource floor) may be replaced by the CI lane that runs the same check on the same target, and the PR body names the substitution and the lane's run id. - Benchmarks never run on a developer machine. The CI bench lane produces comparable artifacts; a laptop under other load does not.
- Waiting on CI is one bounded foreground command (
timeout 590 gh pr checks <N> --watch --interval 30), not a polling loop. A wait that exceeds ten minutes is a defect signal: shorten the loop rather than wait longer. - Every ordinary PR is one issue, one branch, one delivery. An agent that finds a second problem while fixing the first files a new issue and cites it, rather than widening the PR. The exception is a defect the PR cannot be proven without (a broken job the PR's evidence has to run through, a tool the PR's check needs): that fix rides in the PR, under its own issue and its own commit, and the PR body names it as a repair rather than a widening.
- Scratch files are shared between the agents of one session. A file an
agent writes outside its worktree carries its branch or PR number in its
name, and a PR body or issue body is written from a file named that way,
never from a generic
pr.md. - A worktree reaches
artifacts/python3-root,artifacts/wasi-toolsand theartifacts/wasix/*entries through symlinks into the main checkout. Those are read-only from the worktree: an agent that needs a different artifact replaces the link with its own copy or directory and never runstools/wasi-apps/build.shor any other staging step through the link, because that rewrites another session's inputs while it is using them.