Beans in Denver: Fresh Kernel from a Crate?

How to build a KVM kernel for Java, Clojure, Scala and Groovy with open source and open weights: 24 hour practical joke from early 2000s

the host

Akuma

Akuma runs on real hardware with real drivers. It serves as a basis for other, more experimental kernels that look at what open-weight models can do in open-source kernel development and systems programming. Akuma is a self-hosting kernel, which means it builds itself: rustc and cargo run on Akuma and compile Akuma's own source. Here is the talk presented at rust.org.il in November 2026.

It is built from small host-tested crates, and amd64 includes its own hypervisor, which is what Denver runs on.

the guest

Denver, the KVM guest kernel

After finishing with a Rust crate for kernel that can run a specific platform, Tokio runtime, I remembered about all these fun languages that were released in 2000s after JVM got generics and fast reflection and other cool stuff, and tried to estimate how much code would it take to take akuma-tokio-kernel to the next level and build a new crate, akuma-jvm-kernel? My guess was 2-3k lines, not more than 5k. It took about 1750 lines of code to make it happen.

All the work was performed by GLM-5.3-Flash from z.ai mostly in autoresearch mode, methodology and runbooks are available on GitHub.

Autoresearch loop did require human intervention a couple of times but mostly to set up a test environment and to save tokens.

The whole experiment ran completely on Akuma kernel running on a Ryzen amd64 laptop with a goose agentic harness. Denver kernel builds were built with nigtly Rust and Cargo on Akuma and tested as KVM guests.

Some post-experiment cleanup was performed by Sonnet 5.5.

screencast

A Clojure web server on Denver

why

Why run Clojure on a Rust kernel?

Because it's beautiful and reminds me of the Fall 2007.

Source: denver/samples/clojure/server.clj.

(require 'clojure.string)
(import '(com.sun.net.httpserver HttpServer HttpHandler)
        '(java.net InetSocketAddress))

(def hits (atom 0))

(defn json [m]
  (str "{" (clojure.string/join "," (for [[k v] m] (str (pr-str (name k)) ":" (pr-str v)))) "}\n"))

(defn body []
  (let [rt (Runtime/getRuntime)]
    (json {:server   (str "clojure " (clojure-version))
           :hit      (swap! hits inc)
           :os       (System/getProperty "os.version")
           :vm       (System/getProperty "java.vm.name")
           :java     (System/getProperty "java.version")
           :arch     (System/getProperty "os.arch")
           :cpus     (.availableProcessors rt)
           :heap_mib (quot (.maxMemory rt) 1048576)})))

(def handler
  (proxy [HttpHandler] []
    (handle [ex]
      (let [bytes (.getBytes ^String (body) "UTF-8")]
        (.add (.getResponseHeaders ex) "Content-Type" "application/json")
        (.sendResponseHeaders ex 200 (count bytes))
        (with-open [out (.getResponseBody ex)]
          (.write out bytes))))))

(doto (HttpServer/create (InetSocketAddress. 8080) 0)
  (.createContext "/" handler)
  (.start))

(println "listening on :8080")
(flush)
@(promise)
why

Why run Scala on a Rust kernel?

Sometimes you just need more types.

The same server in Scala 2.13, on the same JDK's HTTP server: a lambda is the handler, string interpolation builds the JSON. Source: denver/samples/scala/Server.scala.

import com.sun.net.httpserver.{HttpExchange, HttpServer}
import java.net.InetSocketAddress

object Server extends App {
  var hits = 0

  def json(fields: Seq[(String, Any)]): String =
    fields.map {
      case (k, v: String) => s""""$k":"$v""""
      case (k, v)         => s""""$k":$v"""
    }.mkString("{", ",", "}\n")

  def body: String = {
    hits += 1
    val rt = Runtime.getRuntime
    json(Seq(
      "server"   -> s"scala ${scala.util.Properties.versionNumberString}",
      "hit"      -> hits,
      "os"       -> sys.props("os.version"),
      "vm"       -> sys.props("java.vm.name"),
      "java"     -> sys.props("java.version"),
      "arch"     -> sys.props("os.arch"),
      "cpus"     -> rt.availableProcessors,
      "heap_mib" -> rt.maxMemory / 1048576))
  }

  val server = HttpServer.create(new InetSocketAddress(8080), 0)
  server.createContext("/", (ex: HttpExchange) => {
    val bytes = body.getBytes("UTF-8")
    ex.getResponseHeaders.add("Content-Type", "application/json")
    ex.sendResponseHeaders(200, bytes.length)
    ex.getResponseBody.write(bytes)
    ex.close()
  })
  server.start()
  println("listening on :8080")
}
the idea

A kernel is a manifest

Denver adds almost no kernel code of its own. One binary crate and one front crate choose, by feature name, which existing crates make up the kernel. Every feature is off by default, so the default build never changes.

denver                  the binary: main.rs, banner, the feature list
  |  features, 1:1
akuma-jvm-kernel        front crate: entry!, Kernel, zero capabilities
  |  features, 1:1
akuma-tokio-kernel      the platform: tokio on bare metal
  |
  '-- akuma-tokio-kernel-amd64    machine half: the arms the features turn on
        '-- runtime-tokio, syscalls-glue, exec, mmu, pmm, vfs, net, tty ...
the result

Stats

~24 hbare kernel to a JVM
JDK 21HotSpot, G1, C1 + C2
8defects found and fixed
~1,750auditable lines of kernel Rust, all behind off-by-default features added to existing composable kernel infrastructure
aarch64+amd642 platforms: the Clojure server runs on both
48lines in the two crates Denver adds: the binary and the front crate
2.4 MiBthe whole kernel, one ELF
KVMas a guest of Akuma's own hypervisor, on real AMD Ryzen metal
+3Clojure, Scala, Groovy on the javac kernel, no extra fix

javac compiles inside the guest and its output is identical to the host's. Clojure, Scala and Groovy compile and run. A Clojure HTTP server answers from outside, from a fresh kernel under KVM on metal.

lesson 1

The workload is the spec

lesson 2

The instrument is part of the experiment

Case in point: a probe reported that rt_sigreturn lost a register. The kernel was right. The committed probe binary stored its edit in the wrong slot, because it did not match its own source.

lessons 3 and 4

Compose, then loop

3 · The platform crate.
  • Front crate is a pure pass-through.
  • One feature per measured gap, relayed 1:1, off by default.
  • Call existing crates; never fork them.
4 · The loop.
  • One gate per session, captured output is the only judge.
  • Cheap cycles, honest failures, records before polish.
  • The human stays in the loop.
lessons 5 and 6

Interrupt, then look for the flag

5 · Interrupt when it matters.
  • The first path found is not the path required.
  • Ask "can we go around?" before chasing. A well-aimed interruption is the cheapest tool in the box.
6 · Find the feature flag.
  • "Not implemented" is a configuration question before it is an implementation task.
  • The HTTP server needed one line in a manifest: shell = ["akuma-jvm-kernel/shell"].
try it

Reproduce it locally

You need Rust (nightly toolchain from the repo), QEMU and Docker. No KVM needed: QEMU runs the x86 guest under TCG, which is slow but takes about 15 seconds to answer. ARCH=aarch64 runs the same on the aarch64 kernel under QEMU with HVF (fast on an Apple Silicon Mac).

git clone https://github.com/netoneko/akuma && cd akuma
overlays/denver/build-kernel.sh     # the gate feature set  -> out/denver
overlays/denver/build-image.sh      # JDK 21 + Clojure 1.12 -> out/denver-clojure.img
overlays/denver/run.sh              # boots; the guest's init is java itself
curl http://localhost:8080/         # {"server":"clojure 1.12.0","hit":1,"os":"0.1.0-...-denver", ...}
read more

The records

Denver is part of Akuma