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.
- 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 — 8 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.0-rc.9 | 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) |
#![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 — four modules (
cr1chain hash invariant,cr2state-machine refinement,cr3replay determinism,cr4observer capability confinement). Apalache typecheck on every push. - Kani harness suite — 5 implementation-level proofs in the
sibling ArkheForge repository (published alongside v0.13):
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. See
developteamset.md.
Stability
v0.13 — single fixed pre-public version. No version churn before
external publish; subsequent corrections land on the same v0.13 line.
Version 1.0 is intentionally never reached. See
docs/spec-drift-candidates.md for
the post-publish reconciliation backlog.
Documentation
- Architecture book:
book/(cd book && mdbook servefor local preview) - API reference: docs.rs/arkhe-kernel
- Operator runbook:
docs/runbook/ - Implementation plan:
docs/implementation-plan.md - Release keys + signing:
docs/release-keys.md - 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.