ArkheKernel
Deterministic Rust microkernel with bit-identical replay and post-quantum sealed audit chains.
Identical inputs produce bit-identical WAL bytes (BLAKE3-keyed chain) → bit-identical state, byte-for-byte. Hybrid Ed25519 + ML-DSA 65 (NIST FIPS 204, CNSA 2.0) is a first-class signing class — post-quantum migration is built in, not bolted on.
Quick start
Five-minute build, no formal-verification dependencies required:
use ;
use ;
use ;
use ;
;
let mut kernel = new;
kernel.;
let inst = kernel.create_instance;
kernel.submit.unwrap;
let report = kernel.step;
assert_eq!;
assert_eq!;
End-to-end deterministic-replay proof:
Why ArkheKernel
- Hybrid PQC baseline from day 1.
SignatureClassis{None, Ed25519, Hybrid}out of the box — no opt-in feature flag, no migration project. Hybrid mode dual-signs every WAL record (Ed25519 + ML-DSA 65, AND-mode verify) so audit chains stay verifiable through the post-quantum transition. - Byte-identical replay invariant. Most event-sourcing systems guarantee state-equivalence under replay. ArkheKernel guarantees the serialized WAL bytes themselves match across runs, runtimes, and CPU architectures. The chain hash (BLAKE3-keyed over postcard-canonical records) is the public invariant.
- Tamper-evident, anchored verification.
Wal::verify_chain_anchored/replay_into_verifiedauthenticate a WAL against a caller-supplied trust anchor (minimum signature tier + pinned verifying keys + expected chain tip) — rejecting signature downgrade, key substitution, and tail truncation. The kernel supplies the mechanism; the caller owns the trust-root policy. Untrusted snapshots gate the same way viaKernelSnapshot::deserialize_verified. - Formal verification anchored. TLA+ refinement modules cover chain hash determinism, state-machine refinement, replay invariance, and observer chain-non-affecting. Apalache typecheck is a CI gate, not a side project. A machine-readable axiom inventory pins every cited invariant to its implementation witness.
Architecture
+----------------------------------------+
| persist WAL chain, snapshots, | BLAKE3 keyed-hash, postcard
| Hybrid PQC signatures | canonical bytes, replay
+------------------^---------------------+
|
+------------------+---------------------+
| runtime Kernel orchestrator, | step-stage commit-or-rollback,
| observer pipeline, | Effect<Authorized,'i> phantom
| InstanceView read API |
+------------------^---------------------+
|
+------------------+---------------------+
| state Action / Component / Event | sealed traits, per-instance
| types | store, authorization phantoms
+------------------^---------------------+
|
+------------------+---------------------+
| abi EntityId / TypeCode / | identifiers, principals,
| CapabilityMask / errors | capability bits
+----------------------------------------+
Single-direction DAG, pub(crate) cross-stratum edges only. The layer-DAG
CI gate catches reverse imports as a structural error before they become
a runtime bug.
Determinism guarantees
- A1 D1-Total — bit-identical WAL records across runs given the same config + canonical input sequence + manifest digest.
- A2 single-thread —
Kernel: !SyncviaPhantomData<Rc<()>>. The kernel is provably single-threaded at the type level. - A12 panic-free — every kernel-internal
Dropis total; no reachable panic in production code paths. - A14 header pinning — WAL header pins kernel semver, ABI version, postcard version, BLAKE3 version, world id, and manifest digest. Replay against an incompatible header is a structural error, not a silent bit-rot.
Layer A — 7 catastrophic byte-identity invariants
A small set of byte-level guarantees where any change invalidates every chain ever produced. Concrete examples:
DOMAIN_CTX— the BLAKE3 chain key derivation literal is pinned via afrozen-hexregression test. Any edit to the literal breaks every pre-existing WAL chain.- WAL postcard field order — the on-wire field layout is pinned; a reorder changes chain hash inputs.
#[derive(ArkheAction | ArkheComponent | ArkheEvent)]byte-emission — derive macros pin the canonical-encoding byte sequence so a silent AST mutation, varint-behaviour shift, or field reorder is caught before it reaches the chain hash.
Escalating a Layer A invariant requires an 8-field audit-trail entry
in formal/axiom-test-cite.toml — date, commit hash, user consent,
rationale, literal diff, chain-invalidation status, verify-chain
reference, and spec anchor.
Full axiom catalog (A1–A24 + S1) → book/.
Crypto stack (supply-chain reviewed)
| Crate | Version | Role |
|---|---|---|
ed25519-dalek |
2.x | RFC 8032 reference impl (Tier 2 classical sig) |
ml-dsa |
=0.1.1 | NIST FIPS 204 ML-DSA 65 (Hybrid PQC sig) |
blake3 |
1.x | Keyed hash for WAL chain domain separation |
postcard |
1.x | Canonical varint serde (deterministic encoding) |
zeroize |
1.x | Signing-key + in-kernel seed scrub on drop |
#![forbid(unsafe_code)], no async, no std::thread, no HashMap
(only BTreeMap / BTreeSet for deterministic iteration).
Crypto provider extensibility
Drop-in HSM / KMS providers without patching kernel code. The
PqcSigner and PqcVerifier traits are sealed — only same-crate impls
satisfy them — so the kernel stays sealed while the provider seam stays
open:
The current build ships a software-only ML-DSA 65 signer
(SoftwareMlDsa65Signer); HSM / KMS providers integrate by adding a
sealed-trait extension impl in the same crate without touching the
kernel surface.
Formal verification
Optional path — required for contributors touching the formal layer, not for first-time users.
- 5 verification tiers — 25 invariants (24 axioms + S1) tagged as
machine-checked (TLA+ + Kani, 9), type-proven (Rust types, 10),
type-adjacent (sealed-trait shape pins, 4), runtime-asserted
(observer first-panic eviction, 1), or social-contract (S1: clock
monotonicity). See
book/for the full per-axiom breakdown. - TLA+ refinement — five refinement modules (
cr1chain hash invariant,cr2state-machine refinement,cr3replay determinism,cr4observer capability confinement,r4_implementation_refinementlayer-DAG enforcement) on a sharedruntime_corebase. Apalache typecheck on every push. - Kani harness suite — 5 implementation-level proofs in the
sibling ArkheForge repository (published alongside v0.14):
authorize,dispatch,replay,memory_bounds_check, andhybrid_and_mode(PQC AND-mode verify). - Axiom-cite gate —
formal/axiom-test-cite.tomlis a machine-readable inventory; CI verifies every cited TLA+ invariant name appears in itstla_modulefile and every cited impl test exists asfn <name>in some cited path. Catches inventory drift, not theorem soundness. - Process discipline — an 8-category cosmetic-vs-semantic commit denylist guards security-critical, formal-artifact, timing-side- channel, and fuel-budget surfaces from drive-by edits.
Performance
ArkheKernel ships three signing modes (SignatureClass::{None, Ed25519, Hybrid}); throughput depends on the choice:
| Signing mode | Throughput | Use case |
|---|---|---|
None |
~1M actions/sec | Dev / test, deterministic replay only |
Ed25519 (Tier 2) |
~35k actions/sec | Production audit log, classical sigs |
Hybrid PQC |
~1k actions/sec | Long-term post-quantum audit chain |
Numbers measured on Apple M3 Max, single-thread, via criterion (95% confidence intervals, outlier detection, warm-up). Reproduce locally:
Per-primitive measurements live in arkhe-kernel/benches/
(chain_hash, signing, codec, dispatch). HTML reports with full
distribution graphs land in target/criterion/ after cargo bench.
These are honest performance disclosures, not audited industry benchmarks — the bench code is the spec, and external readers reproduce on their own hardware to verify.
Stability
v0.14 — pre-public. The kernel version advances only when a release changes the persisted wire format (the v0.13 → v0.14 ML-DSA stabilization being the first such advance); cosmetic fixes keep the version. Version 1.0 is intentionally never reached.
Documentation
- Architecture book:
book/(cd book && mdbook servefor local preview) - API reference: docs.rs/arkhe-kernel
- Operator runbook:
docs/runbook/ - Build reproducibility:
docs/build-reproducibility.md
License
Dual-licensed under either of:
- Apache License 2.0, (LICENSE-APACHE)
- MIT License, (LICENSE-MIT)
at your option. Contributions are accepted under the same dual-license terms.
Powered by ArkheKernel — bit-identical causality across virtual worlds.