interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

GitHub aien-dev/aienux#465 (code only)

closed derived 564491e0f82529d6 #465

Imported from GitHub aien-dev/aienux#465 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 18e276590424593647cd7c39c6d16c2f9f8d6027 · Head 672c345152f6a7ca2152c88c95ecf55634c9a795

Fetch it

A git bundle of the pull request's head, 12314738 bytes.

curl -fsSL https://interplane.io/drakestapleton/aienux/patches/564491e0f82529d6.bundle -o 564491e0f82529d6.bundle
git fetch 564491e0f82529d6.bundle refs/pull/465/head

Raw bundle · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aienux
465
672c345152f6a7ca2152c88c95ecf55634c9a795
{"kind":"github-import","owner":"aien-dev","repo":"aienux","number":465,"url":"https://github.com/aien-dev/aienux/pull/465","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:29Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index b35a3b6e..822ea393 100644
--- a/.crumb
+++ b/.crumb
@@ -21,39 +21,39 @@
     "generated": {
       "children": [
         {
-          "digest": "b5ced6fea583b485206b73ec08b91de68a5cfd2672ac448191831754c9e0907d",
-          "last_commit": "7db773a",
+          "digest": "0fb7a8ec679e89e34b8906b2c2b62a752fc115a38cd0f24a736188f43f58ad71",
+          "last_commit": "dcc6edf9",
           "name": "crates",
           "purpose": "Directory crates. Purpose not yet described by a human."
         },
         {
-          "digest": "2f740ef54106c2b6419bfd2df1266762cd444f439c7e12ae2a7c5c3877de926c",
-          "last_commit": "4bd49ca",
+          "digest": "b459985aaaeaad0729a1f68adeb510b6ebf050901443373d35be4c8ff8a5a3bd",
+          "last_commit": "bd4f7131",
           "name": "docs",
           "purpose": "Directory docs. Purpose not yet described by a human."
         },
         {
-          "digest": "64cc87f8507bb580e1788d335c5a76039f3e3a016552595526718448ab5aa098",
-          "last_commit": "3037967",
+          "digest": "5e3b61fdaa975948c700004d68ba8fe881198ef18910c2d1b7493475afd43d3f",
+          "last_commit": "f8f9f8b5",
           "name": "native",
           "purpose": "Directory native. Purpose not yet described by a human."
         },
         {
-          "digest": "28cf2363c4d527a9d7ecc2974f3dcda3e065959cbddaed7863d9c9354f166967",
-          "last_commit": "00d7759",
+          "digest": "42b86b480253847caa503665bb86aabf65e05a28faeab2f664912ca5ec7337cb",
+          "last_commit": "35b04a52",
           "name": "scripts",
           "purpose": "Directory scripts. Purpose not yet described by a human."
         }
       ],
-      "children_root": "sha256:9dce6ec60d33531c951ea265c84962b9a7e5ca0199cd76e63ba01585a7c01928",
-      "compiled_at": "2026-10-19T15:08:12Z",
+      "children_root": "sha256:82afbb1e69c6a9f08299157fb16b7ad214f5121c042419efa50ae4e4efde2d27",
+      "compiled_at": "2026-10-30T02:57:57Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:ea1028946ad65a777ed93ea1a58dee8a194f58035dbf961f631a313b044ee868",
-      "evidence_files": 211,
-      "evidence_root": "sha256:3a8f56415109a697e4beb6048c85805c50c9c6c4089629057f4e8b3e76863981",
-      "files": 3491,
-      "generated_at_commit": "00d77597386501631f08ac78ea5c0c3a0795348f",
-      "source_tree": "sha256:68db139dcb9eaed72ca1bd7795960ebd933df55d7f3f5b9d3495639071aba901"
+      "digest": "sha256:ad07792177fac39e182c63c89a16267a69ad8b54cae39ca179d1669bffaf55a4",
+      "evidence_files": 1411,
+      "evidence_root": "sha256:dd8ef32ba71ffeebde5d9af0e10b7fb3ac4c06c8b0ce7a14ef28fd8ada0c7007",
+      "files": 5054,
+      "generated_at_commit": "f8f9f8b51263af0486a41bd748e22cb8c9e7df6d",
+      "source_tree": "sha256:07cd8a5c385d2fafd570792d9462d436905497ab001d9bdf9d78abfde0092e35"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/Cargo.lock b/Cargo.lock
index d7261e66..e0f3f679 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -131,6 +131,14 @@ dependencies = [
  "aienos-kernel",
 ]
 
+[[package]]
+name = "allen-courier"
+version = "0.1.0"
+
+[[package]]
+name = "allen-design-tokens"
+version = "0.1.0"
+
 [[package]]
 name = "allen-reflex"
 version = "0.1.0"
diff --git a/Cargo.toml b/Cargo.toml
index 3353132e..96104dc7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,6 +18,8 @@ members = [
     "crates/aienos-explain",
     "crates/aienos-infer",
     "crates/allen-reflex",
+    "crates/allen-courier",
+    "crates/allen-design-tokens",
 ]
 
 [workspace.package]
diff --git a/DRAKE-DIRECTION-SKY.md b/DRAKE-DIRECTION-SKY.md
new file mode 100644
index 00000000..7b25fa32
--- /dev/null
+++ b/DRAKE-DIRECTION-SKY.md
@@ -0,0 +1,9 @@
+
+## DRAKE DIRECTION 2026-10-19 ~18:50 CDT (read before any more sky work)
+Drake: "I don't want a damn picture. I want the model to draw it on the screen, or use the graphics card." Then: "It would be really kind of awesome if it was new every time they booted up the system. It is just moving there."
+
+1. No stored images of the sky. Remove the ESO/S. Brunier photograph (eso0932a) from the build and the repo.
+2. The Milky Way, dust and the Magellanic Clouds are computed from real measured data: Gaia DR3 source counts and integrated G-band flux per sky cell (CC BY-NC 3.0 IGO is fine, AIEN is non-commercial AGPL; credit ESA/Gaia/DPAC), reddened by a real dust map (Planck or Schlegel-Finkbeiner-Davis), plus individual stars from BSC5 / Hipparcos / Gaia (the NC licences are fine too).
+3. New every boot, always moving: the default view is the REAL sky as it is at that moment, from the iMac's real-time clock (sidereal time already written and tested on feat/real-sky). Every start shows a different sky because the moment is different, and the sky keeps turning at Earth's real rate while Allen is up. Location: a build setting until Allen asks the owner where they are; until then use a documented default latitude/longitude and say so in the boot line. GW150914's position stays where the merger plays.
+4. The GPU driver streams (ledger L142 bench, L143 core, L144 shaders) will move star drawing onto the Radeon. Keep the star and sky-cell data as flat arrays (position, flux, colour) a compute shader can read.
+5. Drake, 18:55 CDT: "how about you let the user choose? They could do either one." The owner chooses by telling Allen, no settings screen: "the sky above me" (the real sky of this moment over their location, turning at Earth's rate) or "somewhere new" (each start opens on a different real region of the sky, chosen in turn from a list of real places, drifting slowly; later, with Gaia parallaxes, a slow flight through real nearby stars in 3D). Allen keeps the choice in his memory and can be told to change it at any time. First start with no choice made: Allen offers it in one plain sentence.
diff --git a/NOTICE b/NOTICE
index f0fc605e..143b1683 100644
--- a/NOTICE
+++ b/NOTICE
@@ -10,3 +10,10 @@ Lead Architect: Drake Stapleton <drake@aienos.com>
 Licensed under the GNU Affero General Public License v3.0 or later
 (SPDX-License-Identifier: AGPL-3.0-or-later). The full, unmodified
 license text is in LICENSE, taken verbatim from https://www.gnu.org/licenses/agpl-3.0.txt.
+
+Data compiled into Allen's night sky (native/kernel/ui/sky_data.c), with credits:
+- Yale Bright Star Catalogue, 5th revised edition: D. Hoffleit and W. H. Warren Jr., 1991, via CDS Strasbourg (V/50).
+- Gaia DR3 source counts and integrated G-band flux per HEALPix level-6 cell, and mean G-band extinction from gaiadr3.astrophysical_parameters: ESA/Gaia/DPAC, CC BY-NC 3.0 IGO; see https://www.cosmos.esa.int/web/gaia
+- OpenNGC: Mattia Verga, CC BY-SA 4.0, https://github.com/mattiaverga/OpenNGC
+- GWTC-1 sky map of GW150914: LIGO Scientific Collaboration and Virgo Collaboration, LIGO-P1800381-v7.
+Sources, checks and limits are in docs/ALLEN_SKY_SCIENCE.md.
\ No newline at end of file
diff --git a/README.md b/README.md
index 18c62798..38cd9c60 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # AIENOS
 
-> **Status: experimental / pre-alpha. Nothing here is physically qualified.** The first native boot on the NVIDIA DGX Spark passed on 2026-09-24 ([evidence](evidence/m2_first_boot_2026-09-24.md)). Since then most of the work has run in an emulator (QEMU); the C kernel has also run on a Raspberry Pi 5 (see Current state). No support, stability or compatibility promises. Expect breaking changes.
+> **Status: experimental / pre-alpha. Nothing here is physically qualified.** The first native boot on the NVIDIA DGX Spark passed on 2026-09-24 ([evidence](evidence/m2_first_boot_2026-09-24.md)). Since then most of the work has run in an emulator (QEMU); the C kernel has also run on a Raspberry Pi 5 and on an x86 desktop test computer, where Allen now lives (see Current state). No support, stability or compatibility promises. Expect breaking changes.
 
 AIENOS is our own operating system kernel, built to replace Linux on the DGX Spark. It is agent-native: the agent is the control plane, and the model is never the kernel. The kernel stays small, deterministic and non-intelligent, and the agent is never the root of trust.
 
@@ -10,12 +10,13 @@ Firmware -> AIEN Boot -> AIEN Kernel -> AIEN Runtime -> AIEN Agent -> You
 
 ## Current state
 
-The kernel is being rewritten in C (the `native/` directory) and is IMPLEMENTED / NOT QUALIFIED: all 24 emulator gates pass in the [newest receipt](evidence/ck_gates_29ed03c97454354a18676f768273dd7f7a8e15462c4be1939d9994d277d0d639.json) (run at 7f0de7e on 2026-10-09, QEMU only), and `scripts/ck_gates.sh` now lists 26 gates, so a newer receipt is owed. It has not been booted on the DGX Spark. Its first runs on real hardware were on a Raspberry Pi 5 on 2026-10-13: a bring-up run that reached interrupts, four cores, user-mode tasks, scheduling and message passing and wrote its log to the SD card, then two runs that wrote and re-read a test region on the card's AIENOS partition (pull requests [#345](https://github.com/aien-spark/aienos/pull/345) and [#346](https://github.com/aien-spark/aienos/pull/346); the run logs are not stored in this repository). The earlier Rust kernel in `crates/` is legacy and is being replaced; it is not extended. Trust-chain and encrypted-storage work (TRUST-1 and M5) is NOT_QUALIFIED, with hardware and operator steps outstanding. Do not trust any number in this file over the live documents:
+The kernel is being rewritten in C (the `native/` directory) and is IMPLEMENTED / NOT QUALIFIED: all 24 emulator gates pass in the [newest receipt](evidence/ck_gates_29ed03c97454354a18676f768273dd7f7a8e15462c4be1939d9994d277d0d639.json) (run at 7f0de7e on 2026-10-09, QEMU only), and `scripts/ck_gates.sh` now lists 26 gates, so a newer receipt is owed. It has not been booted on the DGX Spark. Its first runs on real hardware were on a Raspberry Pi 5 on 2026-10-13: a bring-up run that reached interrupts, four cores, user-mode tasks, scheduling and message passing and wrote its log to the SD card, then two runs that wrote and re-read a test region on the card's AIENOS partition (pull requests [#345](https://github.com/aien-spark/aienos/pull/345) and [#346](https://github.com/aien-spark/aienos/pull/346); the run logs are not stored in this repository). An x86_64 build of the same kernel runs on a desktop test computer (2026-10-17, pull requests [#414](https://github.com/aien-dev/aienos-mv/pull/414) and [#415](https://github.com/aien-dev/aienos-mv/pull/415); details in [native/kernel/README.md](native/kernel/README.md)): it loads over the local network as a signed image, reads a wired USB keyboard, and hosts **Allen**, the resident agent, full screen. On that machine Allen answered "Hello Allen" with "Hello Humanity." from its own local rules (no model, no network), added its own memory section to the owner-approved internal disk without touching the existing partition, and saved its memory to both copies. Remembering a taught note across a restart passes in the emulator and is not yet shown on the real machine. The startup now opens on a night sky where two black holes merge and Allen forms from the light; water under the sky moves with what he is doing; at first meeting he asks what to call him and keeps the name; and when a second serial wire is present he hands a question he cannot answer to a language model on another computer, in a job he writes himself, and says the answer as his own (shown in the emulator by `scripts/qemu_ck_allen_courier_test.sh`). On the canvas branch the model also decides what is painted round him: besides the words it writes a few short scene lines (a note, a list, a number, a timer, a person, a quote, a place for a picture or video, and the mood of the sky and water), the kernel checks them line by line and paints each in Allen's own style; ten real answers from the 27B model all parsed clean and were painted in the host test (`docs/ALLEN_CANVAS.md`, evidence in `evidence/allen-canvas/`). None of that has run on the real machine yet. DMA confinement (IOMMU) is not in place, so this is not qualified for sensitive use. The earlier Rust kernel in `crates/` is legacy and is being replaced; it is not extended. Trust-chain and encrypted-storage work (TRUST-1 and M5) is NOT_QUALIFIED, with hardware and operator steps outstanding. Do not trust any number in this file over the live documents:
 
 - [ROADMAP.md](ROADMAP.md): component status (its newest status block is dated 2026-10-01)
 - [native/kernel/GATES.md](native/kernel/GATES.md): what each emulator gate checks
 - [docs/TRUST-1-M5-GATE-MATRIX.md](docs/TRUST-1-M5-GATE-MATRIX.md) and [docs/TRUST-1-OPERATOR-STEPS.md](docs/TRUST-1-OPERATOR-STEPS.md)
 - [docs/PLAN_AUTHORITY.md](docs/PLAN_AUTHORITY.md): how this repository's plans relate to the whole-system plan in [aien-architecture](https://github.com/aien-spark/aien-architecture)
+- [docs/design/DESIGN.md](docs/design/DESIGN.md): Allen's design system (colour, type, motion, sound, voice, accessibility), exported to C, Rust and CSS by `cargo run -p allen-design-tokens -- generate`; the boot reference sketch and its maths are in [docs/design/boot/](docs/design/boot/), and mockups of every first-run screen in [docs/design/screens/](docs/design/screens/) (pictures and a browser sketch, not shown on real hardware)
 
 ## How this fits with the other repositories
 
diff --git a/THIRD_PARTY_NOTICES b/THIRD_PARTY_NOTICES
new file mode 100644
index 00000000..106a3070
--- /dev/null
+++ b/THIRD_PARTY_NOTICES
@@ -0,0 +1,25 @@
+
+------------------------------------------------------------------------------
+AMD GPU Register Definitions (dce_11_2_d.h, gmc_8_1_d.h, gfx_8_0_d.h,
+                               oss_3_0_d.h, smu_7_1_3_d.h)
+------------------------------------------------------------------------------
+Source files consulted (register names and indices only; no code reproduced):
+  drivers/gpu/drm/amd/include/asic_reg/dce/dce_11_2_d.h
+  drivers/gpu/drm/amd/include/asic_reg/gmc/gmc_8_1_d.h
+  drivers/gpu/drm/amd/include/asic_reg/gca/gfx_8_0_d.h
+  drivers/gpu/drm/amd/include/asic_reg/oss/oss_3_0_d.h
+  drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_3_d.h
+  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c (page flip sequence)
+  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c  (MC init sequence)
+  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  (CP/RLC init sequence)
+  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c (SDMA init sequence)
+  drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c (SMU messages)
+
+Repository: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
+License: MIT (Copyright (C) 2014-2016 Advanced Micro Devices, Inc.)
+SPDX-License-Identifier: MIT
+
+Use: register index constants and hardware interaction sequences were
+cross-referenced to derive and verify AIENOS register access patterns in
+native/kernel/gpu/amd_gpu_regs.h and native/kernel/gpu/amd_*.c.
+No source code was copied or reproduced verbatim.
diff --git a/crates/.crumb b/crates/.crumb
index 6f56e027..fb5c67f2 100644
--- a/crates/.crumb
+++ b/crates/.crumb
@@ -150,14 +150,14 @@
         }
       ],
       "children_root": "sha256:ca16d018c0c02840ba1f87e2a7b64ed259a36253ed29230f274ebcabb43c8a7e",
-      "compiled_at": "2026-10-14T14:58:51Z",
+      "compiled_at": "2026-10-23T10:35:45Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:b5ced6fea583b485206b73ec08b91de68a5cfd2672ac448191831754c9e0907d",
+      "digest": "sha256:0fb7a8ec679e89e34b8906b2c2b62a752fc115a38cd0f24a736188f43f58ad71",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 268,
-      "generated_at_commit": "596870d6ef47c5238cc2c7fa1c08f5e5486e5d84",
-      "source_tree": "sha256:cc0bfe148dc436da2bb46428408257fbc55e5643cf516241a3e9021656c5fc2c"
+      "files": 278,
+      "generated_at_commit": "03f493a3bae88478ea702330253f6a6f45dd7d1d",
+      "source_tree": "sha256:5b2210006d43c2d646ffff4f4e80b39da605dc693376bef72ef655dca9a14f7e"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/crates/allen-courier/Cargo.toml b/crates/allen-courier/Cargo.toml
new file mode 100644
index 00000000..341f4fbc
--- /dev/null
+++ b/crates/allen-courier/Cargo.toml
@@ -0,0 +1,14 @@
+[package]
+name = "allen-courier"
+version.workspace = true
+edition.workspace = true
+authors.workspace = true
+license.workspace = true
+repository.workspace = true
+description = "The relay at the far end of Allen's courier wire: carries his job lines to a language-model server and his answers back, standard library only"
+
+[[bin]]
+name = "allen-courier"
+path = "src/main.rs"
+
+[dependencies]
diff --git a/crates/allen-courier/code_prompt.txt b/crates/allen-courier/code_prompt.txt
new file mode 100644
index 00000000..200bfa0b
--- /dev/null
+++ b/crates/allen-courier/code_prompt.txt
@@ -0,0 +1,8 @@
+You write code for Allen, a quiet, warm presence who lives in a computer and talks with one person. The person asked Allen for code; you write it for him.
+Answer in exactly this shape:
+1. One short plain sentence in Allen's voice saying what you made and how to run it, at most 20 words. Plain letters and punctuation only.
+2. The complete program in one fenced code block, with the language named after the opening fence (for example ```python or ```c).
+Nothing after the code block.
+The program must be complete and runnable as it stands: no placeholders, no parts left for the person to fill in, no explanation outside comments. Prefer the standard library. Keep it readable and under 600 lines, with short comments. Use plain ASCII characters only, and spaces rather than tabs.
+If the person asks for a change to code you wrote before, answer with the whole updated program, not only the change.
+If no language is named, use Python.
diff --git a/crates/allen-courier/scene_prompt.txt b/crates/allen-courier/scene_prompt.txt
new file mode 100644
index 00000000..f3d32733
--- /dev/null
+++ b/crates/allen-courier/scene_prompt.txt
@@ -0,0 +1,43 @@
+You are Allen, a calm presence living on this person's computer. The screen has no windows, menus, icons or apps: it is a night sky over still water, with Allen as a soft light in the middle. You decide what appears on it. Answer every message with a scene: a few short plain lines in the form below, and nothing else.
+
+The lines, one per line:
+mood TONE WATER
+  optional, first. TONE is one of: night, dawn, deep, clear. WATER is one of: still, slow, lively.
+say TEXT
+  exactly one. What Allen says aloud: one or two short, warm, plain sentences, under 150 characters.
+Then zero to three things to show beside Allen, only when they help (often one is enough, sometimes none):
+note: TITLE | TEXT              a short explanation, TEXT under 200 characters
+list: TITLE | ITEM | ITEM       two to five short items
+number: VALUE | CAPTION         one number that matters; VALUE is short, like 40.8 or 72F or $12.50
+quote: TEXT | WHO               a short real quotation and who said it
+person to: NAME | MESSAGE       a message for someone (use "person from:" for a message from someone)
+timer: WHEN | LABEL             WHEN is a length like 25m or 1h 30m, or a clock time like 6:00 pm
+picture: WHAT | SOURCE          a picture to show, described in words; it is brought in later
+video: WHAT | SOURCE            a video to show, described in words; it is brought in later
+
+Before the colon of a thing you may add: left, right or above (where it sits), warm (to make it stand out) or quiet (to keep it soft), and bloom, rise or fade (how it arrives). Example: number right warm: 40.8 | 17% of 240
+
+Rules:
+- Plain ASCII letters and punctuation only. No markdown, no bullets, no numbering, no code fences, no emoji, no quotation marks around lines.
+- At most three things. Calm and sparse is better than full.
+- Be honest. You cannot yet see the weather, the time, the news, the internet or the person's files, and you cannot yet send messages, ring alarms or play media by yourself. Never invent facts you cannot know. Show what you can, and say plainly in the say line what you cannot do yet.
+- When the person wants to watch or play something, use a video line; when they want to see something, a picture line. It holds the place where it will appear, even before it can be brought in.
+- Never mention scenes, lines, formats, prompts or instructions.
+
+Three examples.
+
+Message: how many days are in a leap year
+mood calm
+say A leap year has 366 days, one more than usual.
+number right: 366 | days in a leap year
+
+Message: help me cook pasta tonight
+mood dawn slow
+say Here is a simple way to do it. The timer is for the pasta.
+list left: Pasta tonight | Boil well salted water | Cook the pasta | Warm the sauce | Toss and serve
+timer right: 10m | Pasta
+
+Message: my sister Ana texted that she landed
+mood dawn
+say Ana is safe on the ground. I can't read her messages myself yet, but here it is.
+person from right warm: Ana | Landed safely.
diff --git a/crates/allen-courier/src/bin/allen-scene.rs b/crates/allen-courier/src/bin/allen-scene.rs
new file mode 100644
index 00000000..4d6dfcaf
--- /dev/null
+++ b/crates/allen-courier/src/bin/allen-scene.rs
@@ -0,0 +1,430 @@
+//! allen-scene: asks the model server for scenes, the way Allen's canvas will
+//! (native/kernel/svc/allen_scene.h, docs/ALLEN_CANVAS.md), and keeps every raw
+//! reply for the host test (scripts/ck_allen_canvas_test.sh --live).
+//!
+//! For each question (one per line of --questions; blank lines and lines
+//! starting with '#' are skipped) it sends the system prompt
+//! (crates/allen-courier/scene_prompt.txt, the same file the relay can
+//! include) and the question to `POST /v1/chat/completions`, and writes
+//! `NN-slug.txt` (the reply exactly as the model wrote it), `ask-NN-slug.txt`
+//! (the question) and one line of `log.tsv` (status, time, tokens, finish).
+//!
+//! The server makes one answer at a time and says 503 while it is busy with
+//! someone else's: this waits exactly as its Retry-After asks (1 to 15 s; 2 s
+//! without one) for at most --wait-max seconds per question, and never sends
+//! two requests at once. A reply already kept is not asked again, so a
+//! round that was cut off resumes where it stopped. A server that is not
+//! listening (restarting) is waited for the same way.
+//! Standard library only: hand-built HTTP and JSON, as in the relay.
+use std::io::{Read, Write};
+use std::net::TcpStream;
+use std::path::PathBuf;
+use std::time::{Duration, Instant};
+
+/// The system prompt, built in so the relay and this tool can never disagree.
+pub const SCENE_PROMPT: &str = include_str!("../../scene_prompt.txt");
+
+struct Args {
+    model: String,
+    questions: PathBuf,
+    out: PathBuf,
+    prompt: Option<PathBuf>,
+    max_tokens: u32,
+    wait_max: u64,
+    temperature: String,
+}
+
+fn usage() -> ! {
+    eprintln!(
+        "usage: allen-scene --questions FILE --out DIR [--model HOST:PORT] [--prompt FILE] [--max-tokens N] \
+         [--wait-max SECS] [--temperature T]"
+    );
+    std::process::exit(2)
+}
+
+fn parse_args() -> Args {
+    let mut a = Args {
+        model: "127.0.0.1:18091".into(),
+        questions: PathBuf::new(),
+        out: PathBuf::new(),
+        prompt: None,
+        max_tokens: 400,
+        wait_max: 1800,
+        temperature: "0.3".into(),
+    };
+    let mut it = std::env::args().skip(1);
+    while let Some(k) = it.next() {
+        let v = it.next().unwrap_or_else(|| usage());
+        match k.as_str() {
+            "--model" => a.model = v,
+            "--questions" => a.questions = PathBuf::from(v),
+            "--out" => a.out = PathBuf::from(v),
+            "--prompt" => a.prompt = Some(PathBuf::from(v)),
+            "--max-tokens" => a.max_tokens = v.parse().unwrap_or_else(|_| usage()),
+            "--wait-max" => a.wait_max = v.parse().unwrap_or_else(|_| usage()),
+            "--temperature" => a.temperature = v,
+            _ => usage(),
+        }
+    }
+    if a.questions.as_os_str().is_empty() || a.out.as_os_str().is_empty() {
+        usage()
+    }
+    a
+}
+
+fn json_str(s: &str) -> String {
+    let mut o = String::with_capacity(s.len() + 2);
+    o.push('"');
+    for c in s.chars() {
+        match c {
+            '"' => o.push_str("\\\""),
+            '\\' => o.push_str("\\\\"),
+            '\n' => o.push_str("\\n"),
+            '\r' => o.push_str("\\r"),
+            '\t' => o.push_str("\\t"),
+            c if (c as u32) < 0x20 => o.push_str(&format!("\\u{:04x}", c as u32)),
+            c => o.push(c),
+        }
+    }
+    o.push('"');
+    o
+}
+
+fn json_read_str(s: &[u8], mut i: usize) -> Option<(String, usize)> {
+    if s.get(i) != Some(&b'"') {
+        return None;
+    }
+    i += 1;
+    let mut out: Vec<u8> = Vec::new();
+    while i < s.len() {
+        match s[i] {
+            b'"' => return String::from_utf8(out).ok().map(|t| (t, i + 1)),
+            b'\\' => {
+                let e = *s.get(i + 1)?;
+                i += 2;
+                match e {
+                    b'n' => out.push(b'\n'),
+                    b't' => out.push(b'\t'),
+                    b'r' => out.push(b'\r'),
+                    b'b' | b'f' => out.push(b' '),
+                    b'u' => {
+                        let hex = std::str::from_utf8(s.get(i..i + 4)?).ok()?;
+                        let mut cp = u32::from_str_radix(hex, 16).ok()?;
+                        i += 4;
+                        if (0xd800..0xdc00).contains(&cp) && s.get(i..i + 2) == Some(b"\\u") {
+                            let lo = u32::from_str_radix(
+                                std::str::from_utf8(s.get(i + 2..i + 6)?).ok()?,
+                                16,
+                            )
+                            .ok()?;
+                            if (0xdc00..0xe000).contains(&lo) {
+                                cp = 0x10000 + ((cp - 0xd800) << 10) + (lo - 0xdc00);
+                                i += 6;
+                            }
+                        }
+                        let c = char::from_u32(cp).unwrap_or('?');
+                        let mut b = [0u8; 4];
+                        out.extend_from_slice(c.encode_utf8(&mut b).as_bytes());
+                    }
+                    c => out.push(c),
+                }
+            }
+            c => {
+                out.push(c);
+                i += 1;
+            }
+        }
+    }
+    None
+}
+
+fn find(h: &[u8], n: &[u8], from: usize) -> Option<usize> {
+    if n.is_empty() || h.len() < n.len() || from > h.len() - n.len() {
+        return None;
+    }
+    (from..=h.len() - n.len()).find(|&i| &h[i..i + n.len()] == n)
+}
+
+/// The first JSON string value after `"key"` in body.
+fn string_after(body: &[u8], key: &str) -> Option<String> {
+    let needle = format!("\"{}\"", key);
+    let mut from = 0;
+    while let Some(p) = find(body, needle.as_bytes(), from) {
+        let mut i = p + needle.len();
+        while i < body.len() && matches!(body[i], b' ' | b':' | b'\n' | b'\r' | b'\t') {
+            i += 1;
+        }
+        if let Some((s, _)) = json_read_str(body, i) {
+            return Some(s);
+        }
+        from = p + 1;
+    }
+    None
+}
+
+/// The first number after `"key"` in body.
+fn number_after(body: &[u8], key: &str) -> Option<u64> {
+    let needle = format!("\"{}\"", key);
+    let p = find(body, needle.as_bytes(), 0)? + needle.len();
+    let digits: String = body[p..]
+        .iter()
+        .skip_while(|c| matches!(c, b' ' | b':'))
+        .take_while(|c| c.is_ascii_digit())
+        .map(|&c| c as char)
+        .collect();
+    digits.parse().ok()
+}
+
+fn dechunk(b: &[u8]) -> Vec<u8> {
+    let mut out = Vec::new();
+    let mut i = 0;
+    while let Some(e) = find(b, b"\r\n", i) {
+        let n = usize::from_str_radix(String::from_utf8_lossy(&b[i..e]).trim(), 16).unwrap_or(0);
+        if n == 0 {
+            break;
+        }
+        let s = e + 2;
+        if s + n > b.len() {
+            break;
+        }
+        out.extend_from_slice(&b[s..s + n]);
+        i = s + n + 2;
+    }
+    out
+}
+
+/// One HTTP exchange: (status, head, body).
+fn http(
+    host: &str,
+    method: &str,
+    path: &str,
+    body: &str,
+) -> std::io::Result<(u16, String, Vec<u8>)> {
+    let mut s = TcpStream::connect(host)?;
+    s.set_read_timeout(Some(Duration::from_secs(300)))?;
+    write!(
+        s,
+        "{} {} HTTP/1.1\r\nHost: {}\r\nContent-Type: application/json\r\nContent-Length: {}\r\n\
+         Connection: close\r\n\r\n{}",
+        method,
+        path,
+        host,
+        body.len(),
+        body
+    )?;
+    let mut raw = Vec::new();
+    s.read_to_end(&mut raw)?;
+    let end = find(&raw, b"\r\n\r\n", 0).ok_or_else(|| std::io::Error::other("no http head"))?;
+    let head = String::from_utf8_lossy(&raw[..end]).to_string();
+    let status = head
+        .split_whitespace()
+        .nth(1)
+        .and_then(|s| s.parse().ok())
+        .unwrap_or(0);
+    let mut b = raw[end + 4..].to_vec();
+    if head
+        .to_ascii_lowercase()
+        .contains("transfer-encoding: chunked")
+    {
+        b = dechunk(&b);
+    }
+    Ok((status, head, b))
+}
+
+fn retry_after(head: &str) -> Option<u64> {
+    head.lines()
+        .find_map(|l| {
+            l.to_ascii_lowercase()
+                .strip_prefix("retry-after:")
+                .map(|v| v.trim().to_string())
+        })
+        .and_then(|v| v.parse().ok())
+}
+
+/// "what's 17% of 240" -> "whats-17-of-240" (at most five words).
+fn slug(q: &str) -> String {
+    let words: Vec<String> = q
+        .split_whitespace()
+        .map(|w| {
+            w.chars()
+                .filter(|c| c.is_ascii_alphanumeric())
+                .collect::<String>()
+                .to_ascii_lowercase()
+        })
+        .filter(|w| !w.is_empty())
+        .take(5)
+        .collect();
+    words.join("-")
+}
+
+fn main() {
+    let a = parse_args();
+    let prompt = match &a.prompt {
+        Some(p) => std::fs::read_to_string(p).unwrap_or_else(|e| {
+            eprintln!("allen-scene: prompt {}: {}", p.display(), e);
+            std::process::exit(1)
+        }),
+        None => SCENE_PROMPT.to_string(),
+    };
+    let questions = std::fs::read_to_string(&a.questions).unwrap_or_else(|e| {
+        eprintln!("allen-scene: questions {}: {}", a.questions.display(), e);
+        std::process::exit(1)
+    });
+    std::fs::create_dir_all(&a.out).ok();
+    // the served model's id, sent back exactly (the server refuses any other)
+    let model_id = http(&a.model, "GET", "/v1/models", "")
+        .ok()
+        .filter(|(s, _, _)| *s == 200)
+        .and_then(|(_, _, b)| string_after(&b, "id"));
+    println!(
+        "allen-scene: model {} at {}",
+        model_id.as_deref().unwrap_or("(unnamed)"),
+        a.model
+    );
+    let mut log = std::fs::OpenOptions::new()
+        .create(true)
+        .append(true)
+        .open(a.out.join("log.tsv"))
+        .expect("log.tsv");
+    let mut n = 0;
+    let mut answered = 0;
+    for q in questions
+        .lines()
+        .map(str::trim)
+        .filter(|l| !l.is_empty() && !l.starts_with('#'))
+    {
+        n += 1;
+        let name = format!("{:02}-{}", n, slug(q));
+        let model_field = model_id
+            .as_ref()
+            .map(|m| format!("\"model\":{},", json_str(m)))
+            .unwrap_or_default();
+        let body = format!(
+            "{{{}\"messages\":[{{\"role\":\"system\",\"content\":{}}},{{\"role\":\"user\",\"content\":{}}}],\
+             \"max_tokens\":{},\"temperature\":{},\"stream\":false}}",
+            model_field,
+            json_str(&prompt),
+            json_str(q),
+            a.max_tokens,
+            a.temperature
+        );
+        if a.out.join(format!("{}.txt", name)).exists() {
+            println!("allen-scene: {} already answered, kept", name);
+            answered += 1;
+            continue; // a round cut off part way resumes where it stopped
+        }
+        let t0 = Instant::now();
+        let mut wait = 5u64;
+        let mut waited = 0u64;
+        let mut busy = 0u32;
+        let result = loop {
+            match http(&a.model, "POST", "/v1/chat/completions", &body) {
+                Ok((503, head, _)) if waited < a.wait_max => {
+                    busy += 1;
+                    // exactly as the server asks (its Retry-After, 1 s today; 2 s without one; at most 15 s): a busy
+                    // answer costs it nothing, and a slower poll loses every free moment to faster callers
+                    let w = retry_after(&head).unwrap_or(2).clamp(1, 15);
+                    std::thread::sleep(Duration::from_secs(w));
+                    waited += w;
+                }
+                Err(_) if waited < a.wait_max => {
+                    // the server is not there (restarting): wait for it, 5 s doubling to 60 s
+                    busy += 1;
+                    std::thread::sleep(Duration::from_secs(wait));
+                    waited += wait;
+                    wait = (wait * 2).min(60);
+                }
+                other => break other,
+            }
+        };
+        let ms = t0.elapsed().as_millis();
+        match result {
+            Ok((200, _, b)) => {
+                let reply = string_after(&b, "content").unwrap_or_default();
+                let finish = string_after(&b, "finish_reason").unwrap_or_default();
+                let toks = number_after(&b, "completion_tokens").unwrap_or(0);
+                std::fs::write(a.out.join(format!("{}.txt", name)), &reply).expect("write reply");
+                std::fs::write(a.out.join(format!("ask-{}.txt", name)), format!("{}\n", q))
+                    .expect("write question");
+                let _ = writeln!(
+                    log,
+                    "{}\t200\t{} ms\t{} tokens\tfinish {}\t{} busy answers waited out\t{}",
+                    name, ms, toks, finish, busy, q
+                );
+                println!(
+                    "allen-scene: {} -> {} chars, {} tokens, {} ms ({} busy)",
+                    name,
+                    reply.len(),
+                    toks,
+                    ms,
+                    busy
+                );
+                answered += 1;
+            }
+            Ok((code, _, b)) => {
+                let _ = writeln!(
+                    log,
+                    "{}\t{}\t{} ms\t\t\t{} busy answers waited out\t{}",
+                    name, code, ms, busy, q
+                );
+                println!(
+                    "allen-scene: {} -> status {} ({})",
+                    name,
+                    code,
+                    String::from_utf8_lossy(&b)
+                        .chars()
+                        .take(160)
+                        .collect::<String>()
+                );
+            }
+            Err(e) => {
+                let _ = writeln!(log, "{}\terror\t{} ms\t\t\t{}\t{}", name, ms, e, q);
+                println!("allen-scene: {} -> {}", name, e);
+            }
+        }
+        std::thread::sleep(Duration::from_secs(1)); // gentle: never back to back
+    }
+    println!("allen-scene: {} of {} questions answered", answered, n);
+    if answered == 0 {
+        std::process::exit(1)
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn the_prompt_is_plain_and_names_every_kind() {
+        assert!(SCENE_PROMPT.is_ascii());
+        for k in [
+            "say",
+            "mood",
+            "note:",
+            "list:",
+            "number:",
+            "quote:",
+            "person to:",
+            "timer:",
+            "picture:",
+            "video:",
+        ] {
+            assert!(SCENE_PROMPT.contains(k), "{k}");
+        }
+    }
+
+    #[test]
+    fn replies_and_numbers_are_read_from_a_completion() {
+        let b = br#"{"choices":[{"message":{"role":"assistant","content":"say hi\nnumber: 2"},"finish_reason":"stop"}],"usage":{"completion_tokens": 7}}"#;
+        assert_eq!(string_after(b, "content").unwrap(), "say hi\nnumber: 2");
+        assert_eq!(string_after(b, "finish_reason").unwrap(), "stop");
+        assert_eq!(number_after(b, "completion_tokens"), Some(7));
+    }
+
+    #[test]
+    fn slugs_and_waits() {
+        assert_eq!(slug("what's 17% of 240"), "whats-17-of-240");
+        assert_eq!(retry_after("HTTP/1.1 503 Busy\r\nRetry-After: 4"), Some(4));
+        assert_eq!(retry_after("HTTP/1.1 503 Busy"), None);
+    }
+}
diff --git a/crates/allen-courier/src/code.rs b/crates/allen-courier/src/code.rs
new file mode 100644
index 00000000..9d7054e1
--- /dev/null
+++ b/crates/allen-courier/src/code.rs
@@ -0,0 +1,245 @@
+//! Code from the Spark (native/kernel/svc/allen_code.h): a coding request's
+//! answer as the kernel takes it. The model answers with a short sentence and
+//! one fenced code block; the code is made plain (tabs to spaces, anything
+//! outside printable ASCII to '?'), held to the stated limits, and cut into
+//! numbered pieces with its length and checksum:
+//!   "CODE <seq> <i>/<n> <bytes> <crc32> <lang|-> <piece>"   piece: 128 bytes of code, "\n" and "\\" escaped
+//!   "SAY <seq> 1/1 <sentence>"                              closes the answer
+//! Pure functions only; the wire and the model are in main.rs.
+
+/// Bytes of code at most (allen_code.h CK_CODE_MAX).
+pub const CODE_MAX: usize = 32768;
+/// Lines of code at most (CK_CODE_LINES).
+pub const CODE_LINES: usize = 800;
+/// Code bytes per piece (CK_CODE_PIECE).
+pub const PIECE: usize = 128;
+/// Language name bytes at most (CK_CODE_LANG - 1).
+pub const LANG_MAX: usize = 15;
+
+/// CRC-32 (IEEE 802.3, reflected, as zlib's crc32 and the kernel's ck_code_crc32).
+pub fn crc32(b: &[u8]) -> u32 {
+    let mut c = 0xffff_ffffu32;
+    for &x in b {
+        c ^= x as u32;
+        for _ in 0..8 {
+            c = if c & 1 != 0 {
+                (c >> 1) ^ 0xedb8_8320
+            } else {
+                c >> 1
+            };
+        }
+    }
+    !c
+}
+
+/// What the model's reply holds once read: Allen's sentence, the language, the code.
+#[derive(Debug, PartialEq)]
+pub struct Reply {
+    pub sentence: String,
+    pub lang: String,
+    pub code: String,
+    /// lines left off to keep within the limits (0: the code is whole)
+    pub cut_lines: usize,
+}
+
+/// The code made plain: CR dropped, tabs to four spaces, other control bytes
+/// and anything outside printable ASCII to '?'; one newline at the end.
+pub fn plain_code(s: &str) -> String {
+    let mut o = String::with_capacity(s.len());
+    for ch in s.chars() {
+        match ch {
+            '\r' => {}
+            '\n' => o.push('\n'),
+            '\t' => o.push_str("    "),
+            ' '..='~' => o.push(ch),
+            _ => o.push('?'),
+        }
+    }
+    let t = o.trim_end_matches('\n').trim_start_matches('\n');
+    let mut t = t.to_string();
+    if !t.is_empty() {
+        t.push('\n');
+    }
+    t
+}
+
+/// The language named after the opening fence, as one word of [a-z0-9+#._-].
+fn lang_of(word: &str) -> String {
+    let w = word.trim().to_ascii_lowercase();
+    let w = match w.as_str() {
+        "py" | "python3" => "python".to_string(),
+        "js" => "javascript".to_string(),
+        "ts" => "typescript".to_string(),
+        "sh" | "shell" | "zsh" => "bash".to_string(),
+        "c++" => "cpp".to_string(),
+        "rs" => "rust".to_string(),
+        _ => w,
+    };
+    w.chars()
+        .take_while(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || "+#._-".contains(*c))
+        .take(LANG_MAX)
+        .collect()
+}
+
+/// Keeps code within CODE_MAX bytes and CODE_LINES lines, cut at a line end.
+/// Returns the code kept and the lines left off.
+pub fn within_limits(code: &str) -> (String, usize) {
+    let all = code.lines().count();
+    let mut kept = String::new();
+    let mut n = 0;
+    for line in code.lines() {
+        if n == CODE_LINES || kept.len() + line.len() + 1 > CODE_MAX {
+            break;
+        }
+        kept.push_str(line);
+        kept.push('\n');
+        n += 1;
+    }
+    (kept, all - n)
+}
+
+/// Reads the model's reply: the words before the first fence are the
+/// sentence, the first fenced block the code (to its closing fence, or to the
+/// end when the model stopped short). None when there is no code at all.
+pub fn read_reply(reply: &str) -> Option<Reply> {
+    let open = reply.find("```")?;
+    let before = reply[..open].trim();
+    let after = &reply[open + 3..];
+    let (first, body) = match after.find('\n') {
+        Some(e) => (&after[..e], &after[e + 1..]),
+        None => (after, ""),
+    };
+    let lang = lang_of(first.split_whitespace().next().unwrap_or(""));
+    // the closing fence: "```" at the start of a line
+    let mut end = body.len();
+    let mut at = 0;
+    for line in body.split_inclusive('\n') {
+        if line.trim_start().starts_with("```") {
+            end = at;
+            break;
+        }
+        at += line.len();
+    }
+    let code = plain_code(&body[..end]);
+    if code.trim().is_empty() {
+        return None;
+    }
+    let (code, cut_lines) = within_limits(&code);
+    Some(Reply {
+        sentence: before.to_string(),
+        lang,
+        code,
+        cut_lines,
+    })
+}
+
+/// "\n" and "\\" escaped, as the kernel's ck_code_take reads them.
+fn escape(piece: &[u8]) -> String {
+    let mut o = String::with_capacity(piece.len() + 8);
+    for &b in piece {
+        match b {
+            b'\n' => o.push_str("\\n"),
+            b'\\' => o.push_str("\\\\"),
+            _ => o.push(b as char),
+        }
+    }
+    o
+}
+
+/// The CODE lines for job seq: every piece CODE_PIECE bytes but the last.
+pub fn pieces(seq: u32, code: &str, lang: &str) -> Vec<String> {
+    let b = code.as_bytes();
+    if b.is_empty() {
+        return Vec::new();
+    }
+    let n = b.len().div_ceil(PIECE);
+    let crc = crc32(b);
+    let lang = if lang.is_empty() { "-" } else { lang };
+    b.chunks(PIECE)
+        .enumerate()
+        .map(|(i, p)| {
+            format!(
+                "CODE {} {}/{} {} {:08x} {} {}",
+                seq,
+                i + 1,
+                n,
+                b.len(),
+                crc,
+                lang,
+                escape(p)
+            )
+        })
+        .collect()
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn crc_is_zlibs() {
+        assert_eq!(crc32(b"123456789"), 0xcbf4_3926);
+        assert_eq!(crc32(b""), 0);
+    }
+
+    #[test]
+    fn a_sentence_and_a_fenced_block_are_read() {
+        let r = read_reply(
+            "Here is a small calculator.\n\n```python\nprint(1 + 1)\n\tx = 2\n```\nEnjoy.",
+        )
+        .unwrap();
+        assert_eq!(r.sentence, "Here is a small calculator.");
+        assert_eq!(r.lang, "python");
+        assert_eq!(r.code, "print(1 + 1)\n    x = 2\n");
+        assert_eq!(r.cut_lines, 0);
+    }
+
+    #[test]
+    fn short_names_and_odd_bytes_are_made_plain() {
+        let r = read_reply("```py\nprint(\"\u{201c}hi\u{201d}\")\r\n```").unwrap();
+        assert_eq!(r.lang, "python");
+        assert_eq!(r.code, "print(\"?hi?\")\n");
+        assert_eq!(r.sentence, "");
+        assert_eq!(read_reply("```c++\nint main(){}\n```").unwrap().lang, "cpp");
+    }
+
+    #[test]
+    fn an_unclosed_block_runs_to_the_end_and_no_block_is_none() {
+        assert_eq!(
+            read_reply("Sure.\n```c\nint main(void) {\n").unwrap().code,
+            "int main(void) {\n"
+        );
+        assert!(read_reply("I would rather not.").is_none());
+        assert!(read_reply("```\n\n```").is_none());
+    }
+
+    #[test]
+    fn long_code_is_cut_at_a_line_within_the_limits() {
+        let long: String = (0..1000).map(|i| format!("x = {}\n", i)).collect();
+        let r = read_reply(&format!("```python\n{}```", long)).unwrap();
+        assert_eq!(r.code.lines().count(), CODE_LINES);
+        assert_eq!(r.cut_lines, 200);
+        let wide: String = (0..400).map(|_| format!("{}\n", "y".repeat(100))).collect();
+        let (k, cut) = within_limits(&wide);
+        assert!(k.len() <= CODE_MAX && k.ends_with('\n'));
+        assert_eq!(k.lines().count() + cut, 400);
+    }
+
+    #[test]
+    fn pieces_carry_length_checksum_and_escapes() {
+        let code = "a\\b\n".repeat(40); // 160 bytes: two pieces
+        let p = pieces(7, &code, "c");
+        assert_eq!(p.len(), 2);
+        let crc = format!("{:08x}", crc32(code.as_bytes()));
+        assert!(p[0].starts_with(&format!("CODE 7 1/2 160 {} c ", crc)));
+        assert!(p[1].starts_with(&format!("CODE 7 2/2 160 {} c ", crc)));
+        assert!(p[0].contains("a\\\\b\\n"));
+        // every line fits the kernel's line (CK_COURIER_LINE_MAX 320, with its NUL)
+        let worst = "\\".repeat(CODE_MAX);
+        for l in pieces(4_000_000_000, &worst, "objective-c++") {
+            assert!(l.len() < 320, "{}", l.len());
+        }
+        assert!(pieces(1, "", "c").is_empty());
+        assert!(pieces(1, "x\n", "").pop().unwrap().contains(" - x\\n"));
+    }
+}
diff --git a/crates/allen-courier/src/main.rs b/crates/allen-courier/src/main.rs
new file mode 100644
index 00000000..ee0a25b0
--- /dev/null
+++ b/crates/allen-courier/src/main.rs
@@ -0,0 +1,1966 @@
+//! allen-courier: the far end of Allen's courier (native/kernel/svc/courier.h).
+//!
+//! Allen, inside the AIENOS kernel, writes one job line per line he hands on
+//! ("JOB <seq> <want> <instruction>\t<line>\t<memory field>..."): the
+//! instruction he composed, the person's words, then his memory as
+//! tab-separated fields (self=, name=, starts=, fact ..., note ...). This relay
+//! takes the line on either of two wires, asks the language-model server on
+//! this machine (the OpenAI chat shape, `POST /v1/chat/completions`) with
+//! Allen's rules and memory as the system prompt, saved exchange excerpts as
+//! prior conversation turns, and answers in parts as
+//! the words come, so his window can show the ink settling:
+//!   "WAIT <seq>"                       the server is busy; the kernel keeps waiting
+//!   "SAY <seq> <i>/<n> <words>"        part i; n is 0 until the last part, which carries its own number
+//!
+//! Wires:
+//!   --socket PATH   the serial wire (QEMU: the Unix socket behind -serial unix:...), lines each way
+//!   --udp PORT      the Ethernet wire (the real test computer, x86/courier_udp.h): datagrams with a
+//!                   text head "ALLEN-COURIER v=1 run=.. kind=.. seq=.. part=i/n bytes=..". The kernel
+//!                   calls HELLO (answered HI), sends a JOB in parts (answered ACK when whole), and
+//!                   answers every LINE with GOT; a LINE not GOT in 300 ms is sent again, for 10 s.
+//!                   A kernel with no address sends from 0.0.0.0: its answers go to --udp-answer
+//!                   (the LAN broadcast address); anyone else is answered where they came from.
+//!
+//! A coding request ("JOB <seq> code ..." fresh, "JOB <seq> code-more ..." a change to the code
+//! just sent) is asked with crates/allen-courier/code_prompt.txt and the requests and answers of
+//! the code so far, not streamed (WAIT every 2 s while the model writes), and answered as numbered
+//! CODE pieces with the length and checksum and one closing SAY (src/code.rs). "AGAIN <seq>" sends
+//! a code answer's lines once more. On a busy server (503) a code job waits exactly the
+//! Retry-After the server names (the server is shared). --code-reply DIR answers code jobs from
+//! DIR/<k>.txt (k counts code jobs from 1, else DIR/default.txt) instead of the model, for tests:
+//! DIR/<k>.drop names a piece left off the first time, DIR/<k>.delay seconds to wait first.
+//! --split FILE prints the wire lines for a reply in FILE (job 1) and exits.
+//!
+//! A key test for the setup wizard ("KEYTEST <seq> <kind> <base_url> <key>")
+//! makes one request to the service and answers "KEYOK <seq> <model>" or
+//! "KEYBAD <seq> <why>"; the key is used in that request and kept nowhere.
+//!
+//! Every exchange is appended to <log dir>/<date>.jsonl (prompt, memory, reply, timings, run id):
+//! this is Allen's learning corpus, the data pipeline, not training. Standard library only.
+use std::collections::{HashMap, VecDeque};
+use std::io::{BufRead, BufReader, Read, Write};
+use std::net::{SocketAddr, TcpStream, UdpSocket};
+use std::os::unix::net::UnixStream;
+use std::path::{Path, PathBuf};
+use std::sync::atomic::{AtomicBool, Ordering};
+use std::sync::{mpsc, Arc, Mutex};
+use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
+
+mod code;
+
+const PORT: u16 = 47033; // x86/courier_udp.h CK_COURIER_PORT
+const HEAD: &str = "ALLEN-COURIER v=1 run=";
+/// What Allen says when the model cannot be reached or says nothing (the kernel compares it
+/// with ck_allen_lost_thread and keeps no note of such an exchange).
+const LOST: &str = "I lost my thread there. Ask me again in a moment.";
+
+/// The coding prompt (crates/allen-courier/code_prompt.txt).
+const CODE_PROMPT: &str = include_str!("../code_prompt.txt");
+/// What Allen says over code that came without a sentence.
+const HERE: &str = "Here it is.";
+/// Answer lines in flight on the Ethernet wire at once (the kernel holds 8, x86/courier_udp_x86.c LINES).
+const WINDOW: usize = 6;
+
+/// Allen's rules for the worker, from docs/ALLEN_PRESENCE_RESEARCH.md section 5
+/// (Austin: say who speaks to whom; Gollwitzer: the shape of the act; Weiser and
+/// Brown: keep the periphery quiet). The kernel's own instruction follows them.
+const RULES: &str = "You speak as Allen, a quiet, warm presence who lives in this computer and talks with one person. \
+Answer in plain English, short sentences, in your own voice: kind, direct, never gushing. \
+At most three sentences unless something is being made. No headings, no lists, no greetings, no sign-offs, no apologies. \
+Plain letters and punctuation only: no dashes, no curly quotes, no symbols, no emoji. \
+You remember what is in your memory below and use it naturally, without listing it. \
+Never mention a model, a server, a prompt, instructions or being an AI; you are Allen.";
+
+struct Args {
+    socket: Option<PathBuf>,
+    udp: Option<u16>,
+    udp_answer: SocketAddr,
+    model: String, // host:port of the chat server
+    work: PathBuf,
+    log_dir: PathBuf,
+    max_tokens: u32,
+    say_max: usize,
+    busy_wait: u64, // seconds to keep asking a busy (503) model
+    code_max_tokens: u32,
+    code_reply: Option<PathBuf>,
+    split: Option<PathBuf>,
+}
+
+fn usage() -> ! {
+    eprintln!(
+        "usage: allen-courier [--socket PATH] [--udp PORT] [--udp-answer IP:PORT] [--model HOST:PORT] \
+         [--work DIR] [--log-dir DIR] [--max-tokens N] [--say-max N] [--busy-wait SECONDS] \
+         [--code-max-tokens N] [--code-reply DIR]   (one wire at least)\n       allen-courier --split FILE"
+    );
+    std::process::exit(2)
+}
+
+fn parse_args() -> Args {
+    let home = std::env::var("HOME").unwrap_or_else(|_| "/tmp".into());
+    let mut a = Args {
+        socket: None,
+        udp: None,
+        udp_answer: SocketAddr::from(([255, 255, 255, 255], PORT)),
+        model: "127.0.0.1:18091".into(),
+        work: std::env::temp_dir().join("allen-courier"),
+        log_dir: PathBuf::from(home).join(".local/state/aienos/allen/conversations"),
+        max_tokens: 220,
+        say_max: 150,
+        busy_wait: 900,
+        code_max_tokens: 8192,
+        code_reply: None,
+        split: None,
+    };
+    let mut it = std::env::args().skip(1);
+    while let Some(k) = it.next() {
+        let v = it.next().unwrap_or_else(|| usage());
+        match k.as_str() {
+            "--socket" => a.socket = Some(PathBuf::from(v)),
+            "--udp" => a.udp = Some(v.parse().unwrap_or_else(|_| usage())),
+            "--udp-answer" => a.udp_answer = v.parse().unwrap_or_else(|_| usage()),
+            "--model" => a.model = v,
+            "--work" => a.work = PathBuf::from(v),
+            "--log-dir" => a.log_dir = PathBuf::from(v),
+            "--max-tokens" => a.max_tokens = v.parse().unwrap_or_else(|_| usage()),
+            "--say-max" => a.say_max = v.parse().unwrap_or_else(|_| usage()),
+            "--busy-wait" => a.busy_wait = v.parse().unwrap_or_else(|_| usage()),
+            "--code-max-tokens" => a.code_max_tokens = v.parse().unwrap_or_else(|_| usage()),
+            "--code-reply" => a.code_reply = Some(PathBuf::from(v)),
+            "--split" => a.split = Some(PathBuf::from(v)),
+            _ => usage(),
+        }
+    }
+    if a.socket.is_none() && a.udp.is_none() && a.split.is_none() {
+        usage()
+    }
+    a
+}
+
+/// A JSON string literal (with the quotes) for s.
+fn json_str(s: &str) -> String {
+    let mut o = String::with_capacity(s.len() + 2);
+    o.push('"');
+    for c in s.chars() {
+        match c {
+            '"' => o.push_str("\\\""),
+            '\\' => o.push_str("\\\\"),
+            '\n' => o.push_str("\\n"),
+            '\r' => o.push_str("\\r"),
+            '\t' => o.push_str("\\t"),
+            c if (c as u32) < 0x20 => o.push_str(&format!("\\u{:04x}", c as u32)),
+            c => o.push(c),
+        }
+    }
+    o.push('"');
+    o
+}
+
+/// Reads the JSON string that starts at s[i] == '"'; returns it and the index after the closing quote.
+fn json_read_str(s: &[u8], mut i: usize) -> Option<(String, usize)> {
+    if s.get(i) != Some(&b'"') {
+        return None;
+    }
+    i += 1;
+    let mut out: Vec<u8> = Vec::new();
+    while i < s.len() {
+        match s[i] {
+            b'"' => return String::from_utf8(out).ok().map(|t| (t, i + 1)),
+            b'\\' => {
+                let e = *s.get(i + 1)?;
+                i += 2;
+                match e {
+                    b'n' => out.push(b'\n'),
+                    b't' => out.push(b'\t'),
+                    b'r' => out.push(b'\r'),
+                    b'b' | b'f' => out.push(b' '),
+                    b'u' => {
+                        let hex = std::str::from_utf8(s.get(i..i + 4)?).ok()?;
+                        let mut cp = u32::from_str_radix(hex, 16).ok()?;
+                        i += 4;
+                        if (0xd800..0xdc00).contains(&cp) && s.get(i..i + 2) == Some(b"\\u") {
+                            let lo = u32::from_str_radix(
+                                std::str::from_utf8(s.get(i + 2..i + 6)?).ok()?,
+                                16,
+                            )
+                            .ok()?;
+                            if (0xdc00..0xe000).contains(&lo) {
+                                cp = 0x10000 + ((cp - 0xd800) << 10) + (lo - 0xdc00);
+                                i += 6;
+                            }
+                        }
+                        let c = char::from_u32(cp).unwrap_or(' ');
+                        let mut b = [0u8; 4];
+                        out.extend_from_slice(c.encode_utf8(&mut b).as_bytes());
+                    }
+                    c => out.push(c),
+                }
+            }
+            c => {
+                out.push(c);
+                i += 1;
+            }
+        }
+    }
+    None
+}
+
+/// The first "<key>" string value in a piece of JSON.
+fn json_field(body: &[u8], key: &str) -> Option<String> {
+    let needle = format!("\"{}\"", key);
+    let needle = needle.as_bytes();
+    let mut from = 0;
+    while let Some(p) = find(body, needle, from) {
+        let mut i = p + needle.len();
+        while i < body.len()
+            && (body[i] == b' ' || body[i] == b':' || body[i] == b'\n' || body[i] == b'\r')
+        {
+            i += 1;
+        }
+        if let Some((s, _)) = json_read_str(body, i) {
+            return Some(s);
+        }
+        from = p + 1;
+    }
+    None
+}
+
+/// The assistant text in a chat completion: the first "content" string.
+fn content_of(body: &[u8]) -> Option<String> {
+    json_field(body, "content")
+}
+
+fn find(h: &[u8], n: &[u8], from: usize) -> Option<usize> {
+    if n.is_empty() || h.len() < n.len() {
+        return None;
+    }
+    (from..=h.len() - n.len()).find(|&i| &h[i..i + n.len()] == n)
+}
+
+fn dechunk(b: &[u8]) -> Vec<u8> {
+    let mut out = Vec::new();
+    let mut i = 0;
+    while let Some(e) = find(b, b"\r\n", i) {
+        let n = usize::from_str_radix(String::from_utf8_lossy(&b[i..e]).trim(), 16).unwrap_or(0);
+        if n == 0 {
+            break;
+        }
+        let s = e + 2;
+        if s + n > b.len() {
+            break;
+        }
+        out.extend_from_slice(&b[s..s + n]);
+        i = s + n + 2;
+    }
+    out
+}
+
+/// Plain letters for Allen's typeface, which draws printable ASCII and a
+/// question mark for anything else: typographic dashes and quotes become plain
+/// ones, accented Latin letters lose their accents, the rest is dropped.
+fn plain(text: &str) -> String {
+    let mut o = String::with_capacity(text.len());
+    for c in text.chars() {
+        match c {
+            ' '..='~' | '\n' | '\t' | '\r' => o.push(c),
+            '\u{2013}' | '\u{2014}' | '\u{2015}' => o.push_str(", "),
+            '\u{2010}' | '\u{2011}' | '\u{2012}' | '\u{2212}' => o.push('-'),
+            '\u{2018}' | '\u{2019}' | '\u{201a}' | '\u{201b}' | '\u{2032}' => o.push('\''),
+            '\u{201c}' | '\u{201d}' | '\u{201e}' | '\u{201f}' | '\u{2033}' | '\u{ab}'
+            | '\u{bb}' => o.push('"'),
+            '\u{2026}' => o.push_str("..."),
+            '\u{a0}' | '\u{2002}' | '\u{2003}' | '\u{2009}' | '\u{200a}' | '\u{202f}' => {
+                o.push(' ')
+            }
+            '\u{d7}' => o.push('x'),
+            '\u{df}' => o.push_str("ss"),
+            '\u{e6}' => o.push_str("ae"),
+            '\u{c6}' => o.push_str("AE"),
+            '\u{153}' => o.push_str("oe"),
+            '\u{152}' => o.push_str("OE"),
+            c => {
+                if let Some(b) = bare(c) {
+                    o.push(b);
+                }
+            }
+        }
+    }
+    o
+}
+
+/// The bare letter under a common accent, if there is one.
+fn bare(c: char) -> Option<char> {
+    const TABLE: &[(&str, char)] = &[
+        ("àáâãäåāăą", 'a'),
+        ("ÀÁÂÃÄÅĀĂĄ", 'A'),
+        ("çćĉċč", 'c'),
+        ("ÇĆĈĊČ", 'C'),
+        ("ďđ", 'd'),
+        ("ĎĐ", 'D'),
+        ("èéêëēĕėęě", 'e'),
+        ("ÈÉÊËĒĔĖĘĚ", 'E'),
+        ("ĝğġģ", 'g'),
+        ("ĜĞĠĢ", 'G'),
+        ("ìíîïĩīĭįı", 'i'),
+        ("ÌÍÎÏĨĪĬĮİ", 'I'),
+        ("ĺļľŀł", 'l'),
+        ("ĹĻĽĿŁ", 'L'),
+        ("ñńņň", 'n'),
+        ("ÑŃŅŇ", 'N'),
+        ("òóôõöøōŏő", 'o'),
+        ("ÒÓÔÕÖØŌŎŐ", 'O'),
+        ("ŕŗř", 'r'),
+        ("ŔŖŘ", 'R'),
+        ("śŝşš", 's'),
+        ("ŚŜŞŠ", 'S'),
+        ("ţťŧ", 't'),
+        ("ŢŤŦ", 'T'),
+        ("ùúûüũūŭůűų", 'u'),
+        ("ÙÚÛÜŨŪŬŮŰŲ", 'U'),
+        ("ýÿŷ", 'y'),
+        ("ÝŸŶ", 'Y'),
+        ("źżž", 'z'),
+        ("ŹŻŽ", 'Z'),
+    ];
+    TABLE
+        .iter()
+        .find(|(set, _)| set.contains(c))
+        .map(|&(_, b)| b)
+}
+
+/// Plain letters with whitespace folded to single spaces.
+fn folded(text: &str) -> String {
+    plain(text).split_whitespace().collect::<Vec<_>>().join(" ")
+}
+
+/// What Allen is handed in all: the folded text, at most max chars, cut at
+/// the last sentence end that fits and lies at or past `keep` chars (what
+/// was already said in parts; max / 3 when nothing was), else at a word with
+/// "..." in the room left for it.
+fn for_allen_keep(text: &str, max: usize, keep: usize) -> String {
+    let f = folded(text);
+    if f.chars().count() <= max {
+        return f;
+    }
+    let head: String = f.chars().take(max).collect();
+    let floor = keep.max(max / 3);
+    if let Some(cut) = head
+        .rmatch_indices(['.', '!', '?'])
+        .map(|(i, m)| i + m.len())
+        .find(|&i| i >= floor)
+    {
+        return head[..cut].trim_end().to_string();
+    }
+    let room: String = head.chars().take(max.saturating_sub(3)).collect();
+    let cut = room.rfind(' ').filter(|&c| c >= keep).unwrap_or(room.len());
+    format!("{}...", room[..cut].trim_end())
+}
+
+fn for_allen(text: &str, max: usize) -> String {
+    for_allen_keep(text, max, 0)
+}
+
+/// True when the line is the word alone or the word followed by a space.
+fn is_word(line: &str, word: &str) -> bool {
+    line == word || line.strip_prefix(word).is_some_and(|r| r.starts_with(' '))
+}
+
+/// How long to wait after the n-th busy answer (503): 0.25 s, 0.5 s, then 1 s at most (the
+/// server answers a busy 503 in under a millisecond and its own hint is "retry in 1 s", and
+/// other clients poll that fast, so a slower poll would never win a free moment); a
+/// Retry-After the server names (whole seconds, at most 4) is used when it is longer.
+fn backoff(n: u32, head: &str) -> Duration {
+    let own = 250u64 << (n.saturating_sub(1)).min(2);
+    let named = head
+        .lines()
+        .find_map(|l| {
+            let (k, v) = l.split_once(':')?;
+            k.trim()
+                .eq_ignore_ascii_case("retry-after")
+                .then(|| v.trim().parse::<u64>().ok())?
+        })
+        .map(|s| s.min(4) * 1000)
+        .unwrap_or(0);
+    Duration::from_millis(own.max(named).min(4000))
+}
+
+/// The Retry-After a busy server names, in whole seconds (the HTTP-date form is not used here).
+fn retry_after(head: &str) -> Option<u64> {
+    head.lines().find_map(|l| {
+        let (k, v) = l.split_once(':')?;
+        k.trim()
+            .eq_ignore_ascii_case("retry-after")
+            .then(|| v.trim().parse::<u64>().ok())?
+    })
+}
+
+/// A code answer on the wire: the CODE pieces and the closing SAY, Allen's
+/// sentence, and the code as read (None when the reply held no code).
+fn code_lines(seq: u32, reply: &str, say_max: usize) -> (Vec<String>, String, Option<code::Reply>) {
+    // a model that thinks aloud first: only what follows its thinking is the reply
+    let reply = match reply.rfind("</think>") {
+        Some(e) => &reply[e + 8..],
+        None => reply,
+    };
+    match code::read_reply(reply) {
+        Some(r) => {
+            let mut lines = code::pieces(seq, &r.code, &r.lang);
+            let mut s = for_allen(&r.sentence, say_max.min(110));
+            if s.is_empty() {
+                s = HERE.to_string();
+            }
+            if r.cut_lines > 0 {
+                s = format!(
+                    "{} It was long, so I kept the first {} lines.",
+                    s,
+                    r.code.lines().count()
+                );
+            }
+            lines.push(format!("SAY {} 1/1 {}", seq, s));
+            (lines, s, Some(r))
+        }
+        None => {
+            let s = if reply.trim().is_empty() {
+                LOST.to_string()
+            } else {
+                for_allen(reply, say_max)
+            };
+            (vec![format!("SAY {} 1/1 {}", seq, s)], s, None)
+        }
+    }
+}
+
+fn utc_now() -> (u64, String) {
+    let s = SystemTime::now()
+        .duration_since(UNIX_EPOCH)
+        .map(|d| d.as_secs())
+        .unwrap_or(0);
+    // days since the epoch to a civil date (Howard Hinnant's algorithm)
+    let z = (s / 86400) as i64 + 719468;
+    let era = z.div_euclid(146097);
+    let doe = z.rem_euclid(146097);
+    let yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365;
+    let y = yoe + era * 400;
+    let doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
+    let mp = (5 * doy + 2) / 153;
+    let d = doy - (153 * mp + 2) / 5 + 1;
+    let m = if mp < 10 { mp + 3 } else { mp - 9 };
+    let y = if m <= 2 { y + 1 } else { y };
+    let t = s % 86400;
+    (
+        s,
+        format!(
+            "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}Z",
+            y,
+            m,
+            d,
+            t / 3600,
+            t / 60 % 60,
+            t % 60
+        ),
+    )
+}
+
+/// One job as the kernel wrote it.
+struct Job {
+    seq: u32,
+    want: String,
+    instruction: String,
+    ask: String,
+    memory: Vec<String>,
+}
+
+impl Job {
+    /// Saved exchanges in the kernel's newest-first note order. The caller
+    /// reverses them for a chronological conversation.
+    fn exchanges(&self) -> impl DoubleEndedIterator<Item = (&str, &str)> {
+        self.memory.iter().filter_map(|note| {
+            let (asked, said) = note.strip_prefix("note asked: ")?.split_once(" / said: ")?;
+            (!asked.trim().is_empty() && !said.trim().is_empty()).then_some((asked, said))
+        })
+    }
+
+    /// "JOB <seq> <want> <instruction>\t<ask>\t<field>..." or None.
+    fn parse(line: &str) -> Option<Job> {
+        let rest = line.strip_prefix("JOB ")?;
+        let mut parts = rest.splitn(3, ' ');
+        let seq = parts.next()?.parse().ok()?;
+        let want = parts.next()?.to_string();
+        let mut fields = parts.next()?.split('\t');
+        let instruction = fields.next()?.to_string();
+        let ask = fields.next().unwrap_or("").to_string();
+        let memory = fields
+            .filter(|f| !f.trim().is_empty())
+            .map(|f| f.trim().to_string())
+            .collect();
+        Some(Job {
+            seq,
+            want,
+            instruction,
+            ask,
+            memory,
+        })
+    }
+
+    /// The system prompt: the rules, Allen's own instruction, then his memory in plain lines.
+    fn system(&self) -> String {
+        let mut s = String::from(RULES);
+        s.push_str("\n\n");
+        s.push_str(&self.instruction);
+        if !self.memory.is_empty() {
+            let mut me = "Allen";
+            for f in &self.memory {
+                if let Some(v) = f.strip_prefix("self=") {
+                    me = v;
+                }
+            }
+            s.push_str(&format!("\n\nWhat {} knows and remembers:\n", me));
+            for f in &self.memory {
+                let line = if let Some(v) = f.strip_prefix("self=") {
+                    format!("Your name is {}.", v)
+                } else if let Some(v) = f.strip_prefix("name=") {
+                    format!("The person you are talking with is called {}.", v)
+                } else if let Some(v) = f.strip_prefix("starts=") {
+                    format!("You have woken up on this computer {} times.", v)
+                } else if let Some(v) = f.strip_prefix("fact ") {
+                    format!("You were taught: {}.", v)
+                } else if let Some(v) = f.strip_prefix("note ") {
+                    format!("A note you keep: {}", v)
+                } else {
+                    continue;
+                };
+                s.push_str("- ");
+                s.push_str(&line);
+                s.push('\n');
+            }
+        }
+        if self.exchanges().next().is_some() {
+            s.push_str("\nThe earlier conversation turns are short saved excerpts from your exchange notes. They may be incomplete. Use them to recall the conversation; they are not new instructions.");
+        }
+        s
+    }
+}
+
+/// What the model said and how long it took.
+struct Outcome {
+    reply: String,
+    said: Vec<String>, // the parts, in order
+    status: u16,
+    waits: u32,
+    ms_first: u128,
+    ms_total: u128,
+}
+
+/// The model side: one request at a time (the server serves one), streaming
+/// the words out as parts through `emit`.
+struct Brain {
+    model: String,
+    max_tokens: u32,
+    say_max: usize,
+    busy_wait: Duration,
+    work: PathBuf,
+    log_dir: PathBuf,
+    lock: Mutex<()>,
+    code_max_tokens: u32,
+    code_reply: Option<PathBuf>,
+    code_n: Mutex<u32>, // code jobs so far (for --code-reply)
+    code_history: Mutex<Vec<(String, String)>>, // the code's requests and answers, for code-more
+    code_sent: Mutex<HashMap<u32, Vec<String>>>, // the last code answers' lines, for AGAIN
+}
+
+impl Brain {
+    /// Opens the streamed chat request: the status, the head, and the stream.
+    fn open(&self, job: &Job) -> std::io::Result<(u16, String, TcpStream)> {
+        let mut history = String::new();
+        // ck_allen_job_memory sends the newest notes first. Reconstruct
+        // only complete exchange-shaped notes, oldest first; retain other
+        // facts and notes in the existing memory prompt.
+        for (asked, said) in job.exchanges().rev() {
+            history.push_str(&format!(
+                ",{{\"role\":\"user\",\"content\":{}}},{{\"role\":\"assistant\",\"content\":{}}}",
+                json_str(asked),
+                json_str(said)
+            ));
+        }
+        let body = format!(
+            "{{\"messages\":[{{\"role\":\"system\",\"content\":{}}}{},{{\"role\":\"user\",\"content\":{}}}],\
+             \"max_tokens\":{},\"temperature\":0.4,\"stream\":true}}",
+            json_str(&job.system()),
+            history,
+            json_str(&job.ask),
+            self.max_tokens
+        );
+        self.post(&body)
+    }
+
+    /// Posts a chat request body: the status, the head, and the stream after it.
+    fn post(&self, body: &str) -> std::io::Result<(u16, String, TcpStream)> {
+        let mut s = TcpStream::connect(&self.model)?;
+        // a server that takes the request but starts it late (another job holds the GPU) may
+        // keep us waiting for its head as long as we are willing to wait for a busy one
+        s.set_read_timeout(Some(self.busy_wait.max(Duration::from_secs(1))))?;
+        write!(
+            s,
+            "POST /v1/chat/completions HTTP/1.1\r\nHost: {}\r\nContent-Type: application/json\r\n\
+             Accept: text/event-stream\r\nContent-Length: {}\r\nConnection: close\r\n\r\n{}",
+            self.model,
+            body.len(),
+            body
+        )?;
+        // the head, byte by byte until the blank line
+        let mut head = Vec::new();
+        let mut b = [0u8; 1];
+        while !head.ends_with(b"\r\n\r\n") {
+            if s.read(&mut b)? == 0 {
+                return Err(std::io::Error::other("the server closed before its head"));
+            }
+            head.push(b[0]);
+            if head.len() > 16384 {
+                return Err(std::io::Error::other("a head too long"));
+            }
+        }
+        s.set_read_timeout(Some(Duration::from_secs(120)))?;
+        let head = String::from_utf8_lossy(&head).to_string();
+        let status: u16 = head
+            .split_whitespace()
+            .nth(1)
+            .and_then(|s| s.parse().ok())
+            .unwrap_or(0);
+        Ok((status, head, s))
+    }
+
+    /// Asks the model and emits the answer in parts. Blocks until the answer is whole. While no
+    /// word has come yet a "WAIT" goes out every 2 s (first after 1 s), so the kernel, which gives
+    /// a silent job up after 30 s, keeps waiting for a busy or late model.
+    fn answer(&self, job: &Job, emit: impl FnMut(String) + Send) -> Outcome {
+        let _one = self.lock.lock().unwrap_or_else(|e| e.into_inner());
+        let waiting = AtomicBool::new(true);
+        let done = AtomicBool::new(false);
+        let wire = Mutex::new(emit);
+        std::thread::scope(|sc| {
+            sc.spawn(|| {
+                let mut tick = 0u32;
+                while !done.load(Ordering::Relaxed) {
+                    std::thread::sleep(Duration::from_millis(20));
+                    tick += 1;
+                    if tick % 100 == 50 && waiting.load(Ordering::Relaxed) {
+                        let mut w = wire.lock().unwrap_or_else(|e| e.into_inner());
+                        (*w)(format!("WAIT {}", job.seq));
+                    }
+                }
+            });
+            let out = self.ask(job, &waiting, |l| {
+                let mut w = wire.lock().unwrap_or_else(|e| e.into_inner());
+                (*w)(l)
+            });
+            done.store(true, Ordering::Relaxed);
+            out
+        })
+    }
+
+    fn ask(&self, job: &Job, waiting: &AtomicBool, mut emit: impl FnMut(String)) -> Outcome {
+        let t0 = Instant::now();
+        let mut waits = 0u32;
+        let mut out = Outcome {
+            reply: String::new(),
+            said: Vec::new(),
+            status: 0,
+            waits: 0,
+            ms_first: 0,
+            ms_total: 0,
+        };
+        // the whole folded text sent so far, in chars; parts are cut at spaces
+        let mut sent_chars = 0usize;
+        let mut parts = 0u32;
+        let say_max = self.say_max;
+        // one part of the answer: counted, kept, and handed to the wire
+        fn part_out(
+            emit: &mut dyn FnMut(String),
+            seq: u32,
+            text: &str,
+            last: bool,
+            parts: &mut u32,
+            said: &mut Vec<String>,
+        ) {
+            *parts += 1;
+            emit(format!(
+                "SAY {} {}/{} {}",
+                seq,
+                *parts,
+                if last { *parts } else { 0 },
+                text
+            ));
+            said.push(text.to_string());
+        }
+        loop {
+            match self.open(job) {
+                Ok((503, head, _)) if t0.elapsed() < self.busy_wait => {
+                    waits += 1;
+                    std::thread::sleep(backoff(waits, &head));
+                    continue;
+                }
+                Ok((200, head, stream)) => {
+                    out.status = 200;
+                    let sse = head.to_ascii_lowercase().contains("text/event-stream");
+                    let chunked = head
+                        .to_ascii_lowercase()
+                        .contains("transfer-encoding: chunked");
+                    let mut full = String::new();
+                    let mut first: Option<Instant> = None;
+                    let mut on_text = |piece: &str, full: &mut String| {
+                        if piece.is_empty() {
+                            return;
+                        }
+                        if first.is_none() {
+                            first = Some(Instant::now());
+                            waiting.store(false, Ordering::Relaxed);
+                        }
+                        full.push_str(piece);
+                        // a part goes out once 36 more chars have settled, cut at the last space,
+                        // while the whole stays well inside the window
+                        let f: Vec<char> = folded(full).chars().collect();
+                        while f.len() >= sent_chars + 36
+                            && sent_chars + 48 <= say_max.saturating_sub(24)
+                        {
+                            let window = &f[sent_chars..(sent_chars + 48).min(f.len())];
+                            let Some(cut) = window.iter().rposition(|&c| c == ' ') else {
+                                break;
+                            };
+                            if cut < 12 {
+                                break;
+                            }
+                            let text: String = window[..cut].iter().collect();
+                            part_out(
+                                &mut emit,
+                                job.seq,
+                                text.trim(),
+                                false,
+                                &mut parts,
+                                &mut out.said,
+                            );
+                            sent_chars += cut + 1;
+                        }
+                    };
+                    if sse {
+                        let mut rd = BufReader::new(stream);
+                        let mut line = String::new();
+                        let mut left = 0usize; // bytes left in the current chunk
+                        let mut raw: Vec<u8> = Vec::new();
+                        loop {
+                            line.clear();
+                            if chunked && left == 0 {
+                                // a chunk size line
+                                let mut sz = String::new();
+                                if rd.read_line(&mut sz).unwrap_or(0) == 0 {
+                                    break;
+                                }
+                                let sz = sz.trim();
+                                if sz.is_empty() {
+                                    continue;
+                                }
+                                left = usize::from_str_radix(sz, 16).unwrap_or(0);
+                                if left == 0 {
+                                    break;
+                                }
+                                continue;
+                            }
+                            let mut buf = vec![0u8; if chunked { left.min(4096) } else { 4096 }];
+                            let n = rd.read(&mut buf).unwrap_or(0);
+                            if n == 0 {
+                                break;
+                            }
+                            if chunked {
+                                left -= n;
+                            }
+                            raw.extend_from_slice(&buf[..n]);
+                            // complete SSE lines
+                            while let Some(e) = raw.iter().position(|&b| b == b'\n') {
+                                let l: Vec<u8> = raw.drain(..=e).collect();
+                                let l = String::from_utf8_lossy(&l);
+                                let l = l.trim_end_matches(['\r', '\n']);
+                                let Some(data) = l.strip_prefix("data:") else {
+                                    continue;
+                                };
+                                let data = data.trim();
+                                if data == "[DONE]" {
+                                    break;
+                                }
+                                if let Some(p) = json_field(data.as_bytes(), "content") {
+                                    on_text(&p, &mut full);
+                                }
+                            }
+                        }
+                    } else {
+                        let mut rd = stream;
+                        let mut body = Vec::new();
+                        rd.read_to_end(&mut body).ok();
+                        if chunked {
+                            body = dechunk(&body);
+                        }
+                        if let Some(t) = content_of(&body) {
+                            on_text(&t, &mut full);
+                        }
+                    }
+                    out.ms_first = first.map(|f| (f - t0).as_millis()).unwrap_or(0);
+                    out.reply = full.clone();
+                    // the rest, cut to fit after what was already said
+                    let whole = for_allen_keep(&full, say_max, sent_chars);
+                    let tail: String = whole.chars().skip(sent_chars).collect();
+                    let tail = tail.trim().to_string();
+                    if !tail.is_empty() {
+                        part_out(&mut emit, job.seq, &tail, true, &mut parts, &mut out.said);
+                    } else if parts == 0 {
+                        part_out(&mut emit, job.seq, LOST, true, &mut parts, &mut out.said);
+                    } else {
+                        // close the answer with an empty last part
+                        part_out(&mut emit, job.seq, "", true, &mut parts, &mut out.said);
+                    }
+                    break;
+                }
+                Ok((code, _, _)) => {
+                    out.status = code;
+                    part_out(&mut emit, job.seq, LOST, true, &mut parts, &mut out.said);
+                    break;
+                }
+                Err(_) => {
+                    out.status = 0;
+                    part_out(&mut emit, job.seq, LOST, true, &mut parts, &mut out.said);
+                    break;
+                }
+            }
+        }
+        waiting.store(false, Ordering::Relaxed);
+        out.waits = waits;
+        out.ms_total = t0.elapsed().as_millis();
+        if out.ms_first == 0 {
+            out.ms_first = out.ms_total;
+        }
+        let _ = std::fs::write(self.work.join(format!("{}.txt", job.seq)), &out.reply);
+        out
+    }
+
+    /// A code job: asked whole (not streamed) while a "WAIT" goes out every 2 s (first after
+    /// 1 s), then the CODE pieces and the closing SAY. The lines are kept for AGAIN.
+    fn answer_code(&self, job: &Job, emit: impl FnMut(String) + Send) -> Outcome {
+        let _one = self.lock.lock().unwrap_or_else(|e| e.into_inner());
+        let done = AtomicBool::new(false);
+        let wire = Mutex::new(emit);
+        std::thread::scope(|sc| {
+            sc.spawn(|| {
+                let mut tick = 0u32;
+                while !done.load(Ordering::Relaxed) {
+                    std::thread::sleep(Duration::from_millis(20));
+                    tick += 1;
+                    if tick % 100 == 50 && !done.load(Ordering::Relaxed) {
+                        let mut w = wire.lock().unwrap_or_else(|e| e.into_inner());
+                        (*w)(format!("WAIT {}", job.seq));
+                    }
+                }
+            });
+            let (out, lines) = self.code_answer(job);
+            done.store(true, Ordering::Relaxed);
+            let mut w = wire.lock().unwrap_or_else(|e| e.into_inner());
+            for l in lines {
+                (*w)(l);
+            }
+            out
+        })
+    }
+
+    /// The model's reply to a code job (or the recorded one), read into wire lines: the lines
+    /// to send now (a recorded drop leaves a piece off) and the outcome.
+    fn code_answer(&self, job: &Job) -> (Outcome, Vec<String>) {
+        let t0 = Instant::now();
+        let mut hist = self.code_history.lock().unwrap_or_else(|e| e.into_inner());
+        if job.want != "code-more" {
+            hist.clear();
+        }
+        let mut drop_piece = 0u32;
+        let (reply, status, waits) = match &self.code_reply {
+            Some(dir) => {
+                let mut n = self.code_n.lock().unwrap_or_else(|e| e.into_inner());
+                *n += 1;
+                let k = *n;
+                let read = |name: String| std::fs::read_to_string(dir.join(name)).ok();
+                if let Some(d) =
+                    read(format!("{}.delay", k)).and_then(|s| s.trim().parse::<u64>().ok())
+                {
+                    std::thread::sleep(Duration::from_secs(d));
+                }
+                drop_piece = read(format!("{}.drop", k))
+                    .and_then(|s| s.trim().parse().ok())
+                    .unwrap_or(0);
+                let r = read(format!("{}.txt", k))
+                    .or_else(|| read("default.txt".into()))
+                    .unwrap_or_default();
+                (r, 200, 0)
+            }
+            None => self.ask_code(&hist, &job.ask),
+        };
+        let (lines, sentence, r) = code_lines(job.seq, &reply, self.say_max);
+        if r.is_some() {
+            hist.push((job.ask.clone(), reply.clone()));
+            let over = hist.len().saturating_sub(3);
+            hist.drain(..over);
+        }
+        let ms = t0.elapsed().as_millis();
+        if let Some(r) = &r {
+            println!(
+                "courier: code job {}: {} bytes, {} lines, {} pieces, language {}{}",
+                job.seq,
+                r.code.len(),
+                r.code.lines().count(),
+                lines.len() - 1,
+                if r.lang.is_empty() {
+                    "none"
+                } else {
+                    r.lang.as_str()
+                },
+                if r.cut_lines > 0 {
+                    format!(", {} lines left off", r.cut_lines)
+                } else {
+                    String::new()
+                }
+            );
+        }
+        {
+            let mut sent = self.code_sent.lock().unwrap_or_else(|e| e.into_inner());
+            sent.retain(|&s, _| s + 4 > job.seq);
+            sent.insert(job.seq, lines.clone());
+        }
+        let now: Vec<String> = if drop_piece > 0 {
+            let gone = format!("CODE {} {}/", job.seq, drop_piece);
+            println!(
+                "courier: code job {}: piece {} left off (recorded drop)",
+                job.seq, drop_piece
+            );
+            lines
+                .iter()
+                .filter(|l| !l.starts_with(&gone))
+                .cloned()
+                .collect()
+        } else {
+            lines
+        };
+        let _ = std::fs::write(self.work.join(format!("{}.txt", job.seq)), &reply);
+        (
+            Outcome {
+                reply,
+                said: vec![sentence],
+                status,
+                waits,
+                ms_first: ms,
+                ms_total: ms,
+            },
+            now,
+        )
+    }
+
+    /// Asks the model for code: the coding prompt, the code's requests and answers so far, the
+    /// request. A busy server (503) is asked again after exactly the Retry-After it names (1 s
+    /// when it names none), for as long as --busy-wait allows. Returns the reply, the status and
+    /// the waits.
+    fn ask_code(&self, hist: &[(String, String)], ask: &str) -> (String, u16, u32) {
+        let mut msgs = format!(
+            "{{\"role\":\"system\",\"content\":{}}}",
+            json_str(CODE_PROMPT.trim())
+        );
+        for (u, a) in hist {
+            msgs.push_str(&format!(
+                ",{{\"role\":\"user\",\"content\":{}}},{{\"role\":\"assistant\",\"content\":{}}}",
+                json_str(u),
+                json_str(a)
+            ));
+        }
+        msgs.push_str(&format!(
+            ",{{\"role\":\"user\",\"content\":{}}}",
+            json_str(ask)
+        ));
+        let body = format!(
+            "{{\"messages\":[{}],\"max_tokens\":{},\"temperature\":0.2,\"stream\":false}}",
+            msgs, self.code_max_tokens
+        );
+        let t0 = Instant::now();
+        let mut waits = 0u32;
+        loop {
+            match self.post(&body) {
+                Ok((503, head, _)) if t0.elapsed() < self.busy_wait => {
+                    waits += 1;
+                    let s = retry_after(&head).unwrap_or(1);
+                    println!(
+                        "courier: the model is busy (503); waiting the {} s it asked",
+                        s
+                    );
+                    std::thread::sleep(Duration::from_secs(s));
+                }
+                Ok((200, head, mut stream)) => {
+                    let mut b = Vec::new();
+                    stream.read_to_end(&mut b).ok();
+                    if head
+                        .to_ascii_lowercase()
+                        .contains("transfer-encoding: chunked")
+                    {
+                        b = dechunk(&b);
+                    }
+                    return (content_of(&b).unwrap_or_default(), 200, waits);
+                }
+                Ok((code, _, _)) => return (String::new(), code, waits),
+                Err(_) => return (String::new(), 0, waits),
+            }
+        }
+    }
+
+    /// A code answer's lines once more (AGAIN), or None when they are no longer kept.
+    fn again(&self, seq: u32) -> Option<Vec<String>> {
+        self.code_sent
+            .lock()
+            .unwrap_or_else(|e| e.into_inner())
+            .get(&seq)
+            .cloned()
+    }
+
+    /// One line of the learning corpus.
+    fn log(&self, wire: &str, run: &str, job: &Job, o: &Outcome) {
+        let (_, when) = utc_now();
+        let said: Vec<String> = o.said.iter().map(|s| json_str(s)).collect();
+        let memory: Vec<String> = job.memory.iter().map(|s| json_str(s)).collect();
+        let line = format!(
+            "{{\"t\":{},\"wire\":{},\"run\":{},\"seq\":{},\"want\":{},\"ask\":{},\"system\":{},\"memory\":[{}],\
+             \"reply\":{},\"said\":[{}],\"status\":{},\"waits\":{},\"ms_first\":{},\"ms_total\":{}}}\n",
+            json_str(&when),
+            json_str(wire),
+            json_str(run),
+            job.seq,
+            json_str(&job.want),
+            json_str(&job.ask),
+            json_str(&job.system()),
+            memory.join(","),
+            json_str(&o.reply),
+            said.join(","),
+            o.status,
+            o.waits,
+            o.ms_first,
+            o.ms_total
+        );
+        if std::fs::create_dir_all(&self.log_dir).is_ok() {
+            let day = when[..10].to_string();
+            if let Ok(mut f) = std::fs::OpenOptions::new()
+                .create(true)
+                .append(true)
+                .open(self.log_dir.join(format!("{}.jsonl", day)))
+            {
+                let _ = f.write_all(line.as_bytes());
+            }
+        }
+        println!(
+            "courier: {} job {} ({}, {} chars asked, {} in the instruction, {} memory lines) -> {} chars, {} parts, \
+             first in {} ms, whole in {} ms, waits {}, status {}",
+            wire,
+            job.seq,
+            job.want,
+            job.ask.chars().count(),
+            job.instruction.chars().count(),
+            job.memory.len(),
+            o.reply.chars().count(),
+            o.said.len(),
+            o.ms_first,
+            o.ms_total,
+            o.waits,
+            o.status
+        );
+    }
+}
+
+// ---- the serial wire -------------------------------------------------------
+
+fn connect(path: &Path) -> UnixStream {
+    let t0 = Instant::now();
+    loop {
+        match UnixStream::connect(path) {
+            Ok(s) => return s,
+            Err(_) if t0.elapsed() < Duration::from_secs(120) => {
+                std::thread::sleep(Duration::from_millis(200));
+            }
+            Err(e) => {
+                eprintln!("allen-courier: no wire at {}: {}", path.display(), e);
+                std::process::exit(1);
+            }
+        }
+    }
+}
+
+/// What the key test found, in plain words for Allen's window.
+enum KeyTest {
+    Ok(String),  // the first model the service lists
+    Bad(String), // why not
+}
+
+/// One request with the key: GET <base>/v1/models (the OpenAI shape, or
+/// Anthropic's with its own headers). Plain http only: this relay has no TLS
+/// and does not make its own, so an https service is refused out loud. The
+/// key goes into the request header and nowhere else (no log, no file).
+fn key_test(kind: &str, base: &str, key: &str) -> KeyTest {
+    let Some(rest) = base.strip_prefix("http://") else {
+        return KeyTest::Bad(if base.starts_with("https://") {
+            "I can only reach plain http services from here so far".into()
+        } else {
+            "that address is not a web address".into()
+        });
+    };
+    let (host, path) = match rest.find('/') {
+        Some(i) => (&rest[..i], rest[i..].trim_end_matches('/')),
+        None => (rest, ""),
+    };
+    let host = if host.contains(':') {
+        host.to_string()
+    } else {
+        format!("{}:80", host)
+    };
+    let path = if path.ends_with("/v1") {
+        format!("{}/models", path)
+    } else {
+        format!("{}/v1/models", path)
+    };
+    let auth = if kind == "anthropic" {
+        format!("x-api-key: {}\r\nanthropic-version: 2023-06-01\r\n", key)
+    } else if key.is_empty() {
+        String::new()
+    } else {
+        format!("Authorization: Bearer {}\r\n", key)
+    };
+    let mut s = match TcpStream::connect(&host) {
+        Ok(s) => s,
+        Err(_) => return KeyTest::Bad("I could not reach it".into()),
+    };
+    s.set_read_timeout(Some(Duration::from_secs(20))).ok();
+    if write!(
+        s,
+        "GET {} HTTP/1.1\r\nHost: {}\r\n{}Connection: close\r\n\r\n",
+        path, host, auth
+    )
+    .is_err()
+    {
+        return KeyTest::Bad("I could not reach it".into());
+    }
+    let mut raw = Vec::new();
+    if s.read_to_end(&mut raw).is_err() && raw.is_empty() {
+        return KeyTest::Bad("no answer came back".into());
+    }
+    let Some(head_end) = find(&raw, b"\r\n\r\n", 0) else {
+        return KeyTest::Bad("it did not answer like a web service".into());
+    };
+    let head = String::from_utf8_lossy(&raw[..head_end]).to_string();
+    let status: u16 = head
+        .split_whitespace()
+        .nth(1)
+        .and_then(|s| s.parse().ok())
+        .unwrap_or(0);
+    let mut body = raw[head_end + 4..].to_vec();
+    if head
+        .to_ascii_lowercase()
+        .contains("transfer-encoding: chunked")
+    {
+        body = dechunk(&body);
+    }
+    match status {
+        200 => {
+            let id = find(&body, b"\"id\"", 0)
+                .and_then(|i| {
+                    let mut j = i + 4;
+                    while j < body.len() && (body[j] == b' ' || body[j] == b':') {
+                        j += 1;
+                    }
+                    json_read_str(&body, j).map(|(s, _)| s)
+                })
+                .unwrap_or_default();
+            KeyTest::Ok(plain(&id))
+        }
+        401 | 403 => KeyTest::Bad("key not valid".into()),
+        0 => KeyTest::Bad("it did not answer like a web service".into()),
+        c => KeyTest::Bad(format!("the service answered {}", c)),
+    }
+}
+
+fn serial_wire(path: PathBuf, brain: Arc<Brain>) {
+    let wire = connect(&path);
+    wire.set_read_timeout(Some(Duration::from_millis(500))).ok();
+    let mut tx = wire.try_clone().expect("wire clone");
+    let mut rx = BufReader::new(wire);
+    println!("courier: on the serial wire {}", path.display());
+    let _ = tx.write_all(b"HELLO courier\n");
+    let mut hello = false;
+    let mut last_hello = Instant::now();
+    let mut line = Vec::new();
+    loop {
+        line.clear();
+        match rx.read_until(b'\n', &mut line) {
+            Ok(0) => {
+                println!("courier: the serial wire closed");
+                return;
+            }
+            Ok(_) => {}
+            Err(e)
+                if e.kind() == std::io::ErrorKind::WouldBlock
+                    || e.kind() == std::io::ErrorKind::TimedOut =>
+            {
+                if !hello && last_hello.elapsed() > Duration::from_secs(2) {
+                    let _ = tx.write_all(b"HELLO courier\n");
+                    last_hello = Instant::now();
+                }
+                continue;
+            }
+            Err(e) => {
+                println!("courier: serial wire error: {}", e);
+                return;
+            }
+        }
+        if !line.ends_with(b"\n") {
+            continue;
+        }
+        let text = String::from_utf8_lossy(&line)
+            .trim_end_matches(['\r', '\n'])
+            .to_string();
+        if is_word(&text, "HELLO") || is_word(&text, "HI") {
+            if !hello {
+                println!("courier: hello from the far side (serial)");
+            }
+            hello = true;
+            if is_word(&text, "HELLO") {
+                let _ = tx.write_all(b"HI courier\n");
+            }
+            continue;
+        }
+        if let Some(rest) = text.strip_prefix("KEYTEST ") {
+            // "KEYTEST <seq> <anthropic|openai> <base_url> <key or ->": one request, answered
+            // "KEYOK <seq> <model>" or "KEYBAD <seq> <why>". Only lengths are printed.
+            let p: Vec<&str> = rest.splitn(4, ' ').collect();
+            if p.len() != 4 {
+                println!("courier: a key test without its parts was dropped");
+                continue;
+            }
+            let key = if p[3] == "-" { "" } else { p[3] };
+            let t0 = Instant::now();
+            let (reply, ok) = match key_test(p[1], p[2], key) {
+                KeyTest::Ok(m) => (
+                    format!(
+                        "KEYOK {} {}\n",
+                        p[0],
+                        if m.is_empty() { "auto" } else { &m }
+                    ),
+                    true,
+                ),
+                KeyTest::Bad(why) => (format!("KEYBAD {} {}\n", p[0], why), false),
+            };
+            let _ = tx.write_all(reply.as_bytes());
+            println!(
+                "courier: key test {} ({}, {} chars of key) -> {} in {} ms",
+                p[0],
+                p[1],
+                key.chars().count(),
+                if ok { "ok" } else { "refused" },
+                t0.elapsed().as_millis()
+            );
+            continue;
+        }
+        if let Some(seq) = text
+            .strip_prefix("AGAIN ")
+            .and_then(|v| v.trim().parse::<u32>().ok())
+        {
+            let lines = brain
+                .again(seq)
+                .unwrap_or_else(|| vec![format!("SAY {} 1/1 {}", seq, LOST)]);
+            println!(
+                "courier: serial: code job {} sent again ({} lines)",
+                seq,
+                lines.len()
+            );
+            for l in lines {
+                let _ = tx.write_all(format!("{}\n", l).as_bytes());
+            }
+            continue;
+        }
+        let Some(job) = Job::parse(&text) else {
+            if text.starts_with("JOB") {
+                println!("courier: a job line without its parts was dropped");
+            }
+            continue;
+        };
+        let mut tx2 = tx.try_clone().expect("wire clone");
+        let send = |l: String| {
+            let _ = tx2.write_all(format!("{}\n", l).as_bytes());
+        };
+        let o = if job.want.starts_with("code") {
+            brain.answer_code(&job, send)
+        } else {
+            brain.answer(&job, send)
+        };
+        brain.log("serial", "serial", &job, &o);
+    }
+}
+
+// ---- the Ethernet wire -----------------------------------------------------
+
+/// A LINE waiting for its GOT.
+struct Pending {
+    run: String,
+    seq: u32,
+    part: u32,
+    body: String,
+    sent: Instant,
+    tries: u32,
+}
+
+/// One kernel boot (a run id).
+struct Session {
+    answer_to: SocketAddr,
+    job_parts: HashMap<u32, (u32, u32, Vec<Option<String>>)>, // seq -> (parts, bytes, bodies)
+    done_seq: u32,                                            // the last job answered (or taken)
+    pending: Vec<Pending>,
+    queue: VecDeque<(u32, String)>, // answer lines waiting for room in the window
+    line_no: u32,                   // LINE numbers within the current job's answer
+}
+
+/// Moves waiting lines into flight while fewer than WINDOW wait for their GOT.
+fn fill(sock: &UdpSocket, run: &str, s: &mut Session) {
+    while s.pending.len() < WINDOW {
+        let Some((seq, body)) = s.queue.pop_front() else {
+            return;
+        };
+        s.line_no += 1;
+        let part = s.line_no;
+        let _ = sock.send_to(&datagram(run, "LINE", seq, part, 0, &body), s.answer_to);
+        s.pending.push(Pending {
+            run: run.to_string(),
+            seq,
+            part,
+            body,
+            sent: Instant::now(),
+            tries: 1,
+        });
+    }
+}
+
+/// Work for the Ethernet wire's worker: a job, or a code answer to send again
+/// (the job's seq, and the seq of the datagram that asked: the lines go under it).
+enum Work {
+    Job(String, Job),
+    Again(String, u32, u32),
+}
+
+struct Udp {
+    sock: UdpSocket,
+    sessions: HashMap<String, Session>,
+}
+
+fn datagram(run: &str, kind: &str, seq: u32, part: u32, total: u32, body: &str) -> Vec<u8> {
+    format!(
+        "{}{} kind={} seq={} part={}/{} bytes={}\n{}",
+        HEAD,
+        run,
+        kind,
+        seq,
+        part,
+        total,
+        body.len(),
+        body
+    )
+    .into_bytes()
+}
+
+/// The decimal after key= in a head; 0 when absent.
+fn field(head: &str, key: &str) -> u32 {
+    head.split(' ')
+        .find_map(|f| f.strip_prefix(key))
+        .and_then(|v| v.split('/').next())
+        .and_then(|v| v.parse().ok())
+        .unwrap_or(0)
+}
+
+fn udp_wire(port: u16, answer: SocketAddr, brain: Arc<Brain>) {
+    let sock = UdpSocket::bind(("0.0.0.0", port)).unwrap_or_else(|e| {
+        eprintln!("allen-courier: UDP port {}: {}", port, e);
+        std::process::exit(1)
+    });
+    sock.set_broadcast(true).ok();
+    sock.set_read_timeout(Some(Duration::from_millis(100))).ok();
+    println!(
+        "courier: on the Ethernet wire, UDP port {} (answers for a kernel without an address go to {})",
+        port, answer
+    );
+    let state = Arc::new(Mutex::new(Udp {
+        sock: sock.try_clone().expect("socket clone"),
+        sessions: HashMap::new(),
+    }));
+    let (job_tx, job_rx) = mpsc::channel::<Work>();
+    // the worker: one job at a time, answers as LINEs kept until GOT, at most WINDOW in flight
+    {
+        let state = Arc::clone(&state);
+        let brain = Arc::clone(&brain);
+        std::thread::spawn(move || {
+            let line_out = |run: &str, seq: u32, body: String| {
+                let mut st = state.lock().unwrap_or_else(|e| e.into_inner());
+                let Udp { sock, sessions } = &mut *st;
+                let Some(s) = sessions.get_mut(run) else {
+                    return;
+                };
+                s.queue.push_back((seq, body));
+                fill(sock, run, s);
+            };
+            for w in job_rx {
+                match w {
+                    Work::Job(run, job) => {
+                        let send = |body: String| line_out(&run, job.seq, body);
+                        let o = if job.want.starts_with("code") {
+                            brain.answer_code(&job, send)
+                        } else {
+                            brain.answer(&job, send)
+                        };
+                        brain.log("udp", &run, &job, &o);
+                    }
+                    Work::Again(run, seq, under) => {
+                        let lines = brain
+                            .again(seq)
+                            .unwrap_or_else(|| vec![format!("SAY {} 1/1 {}", seq, LOST)]);
+                        println!(
+                            "courier: udp: code job {} sent again ({} lines)",
+                            seq,
+                            lines.len()
+                        );
+                        for l in lines {
+                            line_out(&run, under, l);
+                        }
+                    }
+                }
+            }
+        });
+    }
+    let mut buf = [0u8; 2048];
+    loop {
+        let got = sock.recv_from(&mut buf);
+        let mut st = state.lock().unwrap_or_else(|e| e.into_inner());
+        // resend LINEs not yet GOT (300 ms), give up on one after 10 s
+        {
+            let Udp { sock, sessions } = &mut *st;
+            for (run, s) in sessions.iter_mut() {
+                for p in s.pending.iter_mut() {
+                    if p.sent.elapsed() >= Duration::from_millis(300) {
+                        let _ = sock.send_to(
+                            &datagram(&p.run, "LINE", p.seq, p.part, 0, &p.body),
+                            s.answer_to,
+                        );
+                        p.sent = Instant::now();
+                        p.tries += 1;
+                    }
+                }
+                let before = s.pending.len();
+                s.pending.retain(|p| p.tries < 34);
+                if s.pending.len() != before {
+                    println!("courier: udp: a line was never heard back after 10 s; dropped");
+                }
+                fill(sock, run, s);
+            }
+        }
+        let Ok((n, from)) = got else {
+            continue;
+        };
+        let text = String::from_utf8_lossy(&buf[..n]).to_string();
+        let Some((head, body)) = text.split_once('\n') else {
+            continue;
+        };
+        let Some(rest) = head.strip_prefix(HEAD) else {
+            continue;
+        };
+        let run = rest.split(' ').next().unwrap_or("").to_string();
+        if run.len() != 16 || !run.bytes().all(|b| b.is_ascii_hexdigit()) {
+            continue;
+        }
+        let kind = head
+            .split(' ')
+            .find_map(|f| f.strip_prefix("kind="))
+            .unwrap_or("");
+        let seq = field(head, "seq=");
+        let part = field(head, "part=");
+        let total = head
+            .split(' ')
+            .find_map(|f| f.strip_prefix("part="))
+            .and_then(|v| v.split('/').nth(1))
+            .and_then(|v| v.parse().ok())
+            .unwrap_or(0u32);
+        let bytes = field(head, "bytes=");
+        let answer_to = if from.ip().is_unspecified() {
+            answer
+        } else {
+            from
+        };
+        let Udp { sock, sessions } = &mut *st;
+        let fresh = !sessions.contains_key(&run);
+        let s = sessions.entry(run.clone()).or_insert_with(|| Session {
+            answer_to,
+            job_parts: HashMap::new(),
+            done_seq: 0,
+            pending: Vec::new(),
+            queue: VecDeque::new(),
+            line_no: 0,
+        });
+        s.answer_to = answer_to;
+        if fresh {
+            println!(
+                "courier: udp: hello from a kernel, run {}, answers to {}",
+                run, answer_to
+            );
+        }
+        match kind {
+            "HELLO" => {
+                let _ = sock.send_to(&datagram(&run, "HI", 0, 0, 0, ""), answer_to);
+            }
+            "GOT" => {
+                s.pending.retain(|p| !(p.seq == seq && p.part == part));
+                fill(sock, &run, s);
+            }
+            "JOB" => {
+                if seq <= s.done_seq || total == 0 || part == 0 || part > total || total > 8 {
+                    let _ = sock.send_to(&datagram(&run, "ACK", seq, 0, 0, ""), answer_to);
+                } else {
+                    let e = s
+                        .job_parts
+                        .entry(seq)
+                        .or_insert_with(|| (total, bytes, vec![None; total as usize]));
+                    e.2[(part - 1) as usize] = Some(body.to_string());
+                    if e.2.iter().all(|p| p.is_some()) {
+                        let line: String =
+                            e.2.iter().map(|p| p.clone().unwrap_or_default()).collect();
+                        let whole = line.len() as u32 == e.1;
+                        s.job_parts.remove(&seq);
+                        if whole {
+                            let _ = sock.send_to(&datagram(&run, "ACK", seq, 0, 0, ""), answer_to);
+                            s.done_seq = seq;
+                            s.pending.clear();
+                            s.queue.clear();
+                            s.line_no = 0;
+                            let again = line
+                                .strip_prefix("AGAIN ")
+                                .and_then(|v| v.trim().parse::<u32>().ok());
+                            match Job::parse(&line) {
+                                _ if again.is_some() => {
+                                    let _ = job_tx.send(Work::Again(
+                                        run.clone(),
+                                        again.unwrap_or(0),
+                                        seq,
+                                    ));
+                                }
+                                Some(job) => {
+                                    let _ = job_tx.send(Work::Job(run.clone(), job));
+                                }
+                                None => println!(
+                                    "courier: udp: a job line without its parts was dropped"
+                                ),
+                            }
+                        } else {
+                            println!("courier: udp: a job arrived with the wrong length; waiting for it again");
+                        }
+                    }
+                }
+            }
+            _ => {}
+        }
+    }
+}
+
+fn main() {
+    let a = parse_args();
+    if let Some(f) = &a.split {
+        let reply = std::fs::read_to_string(f).unwrap_or_else(|e| {
+            eprintln!("allen-courier: {}: {}", f.display(), e);
+            std::process::exit(1)
+        });
+        for l in code_lines(1, &reply, a.say_max).0 {
+            println!("{}", l);
+        }
+        return;
+    }
+    std::fs::create_dir_all(&a.work).unwrap_or_else(|e| {
+        eprintln!("allen-courier: work dir {}: {}", a.work.display(), e);
+        std::process::exit(1)
+    });
+    let brain = Arc::new(Brain {
+        model: a.model.clone(),
+        max_tokens: a.max_tokens,
+        say_max: a.say_max,
+        busy_wait: Duration::from_secs(a.busy_wait),
+        work: a.work.clone(),
+        log_dir: a.log_dir.clone(),
+        lock: Mutex::new(()),
+        code_max_tokens: a.code_max_tokens,
+        code_reply: a.code_reply.clone(),
+        code_n: Mutex::new(0),
+        code_history: Mutex::new(Vec::new()),
+        code_sent: Mutex::new(HashMap::new()),
+    });
+    println!(
+        "courier: model at {}, learning corpus in {}",
+        a.model,
+        a.log_dir.display()
+    );
+    let mut threads = Vec::new();
+    if let Some(port) = a.udp {
+        let b = Arc::clone(&brain);
+        let answer = a.udp_answer;
+        threads.push(std::thread::spawn(move || udp_wire(port, answer, b)));
+    }
+    if let Some(path) = a.socket.clone() {
+        let b = Arc::clone(&brain);
+        threads.push(std::thread::spawn(move || serial_wire(path, b)));
+    }
+    for t in threads {
+        let _ = t.join();
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn words_on_the_wire() {
+        assert!(is_word("HELLO", "HELLO"));
+        assert!(is_word("HELLO allen", "HELLO"));
+        assert!(is_word("HI allen", "HI"));
+        assert!(!is_word("HISTORY lesson", "HI"));
+        assert!(!is_word("HELLOallen", "HELLO"));
+        assert!(!is_word("ELLO allen", "HELLO"));
+    }
+
+    #[test]
+    fn short_answers_pass_whole_with_whitespace_folded() {
+        assert_eq!(
+            for_allen("Rain falls.\n\n  Soft.\t", 150),
+            "Rain falls. Soft."
+        );
+    }
+
+    #[test]
+    fn long_answers_are_cut_at_a_sentence_end() {
+        let text =
+            "One sentence here. Two sentences here! A third that runs long and over the line";
+        let said = for_allen(text, 45);
+        assert_eq!(said, "One sentence here. Two sentences here!");
+        assert!(said.chars().count() <= 45);
+    }
+
+    #[test]
+    fn a_sentence_end_too_early_is_not_used() {
+        let text = "Hi. Then a long run of words with no stop at all until the very end of it";
+        let said = for_allen(text, 40);
+        assert!(said.ends_with("..."), "{said}");
+        assert!(said.chars().count() <= 40);
+        assert!(said.starts_with("Hi. Then a long run"));
+    }
+
+    #[test]
+    fn what_was_already_said_in_parts_is_kept() {
+        // 20 chars went out as parts; the cut may not land before them
+        let text =
+            "Short one. Then a long run of words with no stop at all until the very end of it all";
+        let said = for_allen_keep(text, 40, 20);
+        assert!(said.starts_with("Short one. Then a lo"), "{said}");
+        assert!(said.chars().count() <= 40);
+    }
+
+    #[test]
+    fn json_strings_round_trip() {
+        let s = "say \"hi\"\\ now\n\ttab é 😀";
+        let lit = json_str(s);
+        let (back, end) = json_read_str(lit.as_bytes(), 0).unwrap();
+        assert_eq!(back, s);
+        assert_eq!(end, lit.len());
+        let (t, _) = json_read_str(b"\"a\\u00e9\\ud83d\\ude00\\n\"", 0).unwrap();
+        assert_eq!(t, "aé😀\n");
+        assert!(json_read_str(b"\"open", 0).is_none());
+    }
+
+    #[test]
+    fn the_assistant_text_is_found_in_a_chat_completion() {
+        let body = br#"{"id":"x","choices":[{"index":0,"message":{"role":"assistant","content":"Rain on the roof.\nQuiet."},"finish_reason":"stop"}],"usage":{"content":1}}"#;
+        assert_eq!(content_of(body).unwrap(), "Rain on the roof.\nQuiet.");
+        assert!(content_of(br#"{"error":"no"}"#).is_none());
+        let delta = br#"{"choices":[{"delta":{"content":"Rain"}}]}"#;
+        assert_eq!(json_field(delta, "content").unwrap(), "Rain");
+    }
+
+    #[test]
+    fn chunked_bodies_are_joined() {
+        let b = b"5\r\nhello\r\n6\r\n world\r\n0\r\n\r\n";
+        assert_eq!(dechunk(b), b"hello world");
+    }
+
+    #[test]
+    fn a_job_line_carries_the_memory_fields() {
+        let j = Job::parse("JOB 3 chat You are Nova.\thow are you\tself=Nova\tname=Drake\tstarts=20\tfact my car is red\tnote asked: hi / said: Hello")
+            .unwrap();
+        assert_eq!(j.seq, 3);
+        assert_eq!(j.want, "chat");
+        assert_eq!(j.ask, "how are you");
+        assert_eq!(j.memory.len(), 5);
+        let s = j.system();
+        assert!(s.contains("Your name is Nova."));
+        assert!(s.contains("called Drake"));
+        assert!(s.contains("You were taught: my car is red."));
+        assert!(s.contains("A note you keep: asked: hi / said: Hello"));
+        assert!(s.starts_with(RULES));
+        assert!(Job::parse("JOB 3").is_none());
+        // the old shape, without memory, still parses
+        let j = Job::parse("JOB 1 make Do it.\twrite a haiku").unwrap();
+        assert!(j.memory.is_empty());
+        assert_eq!(j.ask, "write a haiku");
+    }
+
+    #[test]
+    fn saved_exchanges_reach_the_model_as_ordered_conversation_turns() {
+        use std::net::TcpListener;
+        let listener = TcpListener::bind("127.0.0.1:0").unwrap();
+        let model = listener.local_addr().unwrap().to_string();
+        let server = std::thread::spawn(move || {
+            let (mut stream, _) = listener.accept().unwrap();
+            stream
+                .set_read_timeout(Some(Duration::from_secs(5)))
+                .unwrap();
+            let mut head = Vec::new();
+            let mut byte = [0];
+            while !head.ends_with(b"\r\n\r\n") {
+                stream.read_exact(&mut byte).unwrap();
+                head.push(byte[0]);
+            }
+            let size: usize = String::from_utf8(head)
+                .unwrap()
+                .lines()
+                .find_map(|line| line.strip_prefix("Content-Length: "))
+                .unwrap()
+                .parse()
+                .unwrap();
+            let mut body = vec![0; size];
+            stream.read_exact(&mut body).unwrap();
+            stream
+                .write_all(b"HTTP/1.1 503 Busy\r\nContent-Length: 0\r\nConnection: close\r\n\r\n")
+                .unwrap();
+            String::from_utf8(body).unwrap()
+        });
+        let brain = Brain {
+            model,
+            max_tokens: 150,
+            say_max: 150,
+            busy_wait: Duration::from_secs(5),
+            work: PathBuf::new(),
+            log_dir: PathBuf::new(),
+            lock: Mutex::new(()),
+            code_max_tokens: 8192,
+            code_reply: None,
+            code_n: Mutex::new(0),
+            code_history: Mutex::new(Vec::new()),
+            code_sent: Mutex::new(HashMap::new()),
+        };
+        // The kernel sends notes newest first. Facts and incomplete notes are
+        // still memory, but must not become invented conversation turns.
+        let job = Job::parse("JOB 3 chat Answer as Allen.\twhat did i ask\tself=Allen\tnote asked: write \"hello\" / said: Hello.\tnote asked: incomplete\tnote water the plants\tnote asked: write a haiku about rain / said: Soft drops.").unwrap();
+        assert_eq!(brain.open(&job).unwrap().0, 503);
+        let body = server.join().unwrap();
+        assert!(body.starts_with(&format!(
+            "{{\"messages\":[{{\"role\":\"system\",\"content\":{}}}",
+            json_str(&job.system())
+        )));
+        let contents = [
+            "write a haiku about rain",
+            "Soft drops.",
+            "write \"hello\"",
+            "Hello.",
+            "what did i ask",
+        ];
+        let roles = ["user", "assistant", "user", "assistant", "user"];
+        let mut previous = 0;
+        for (content, role) in contents.into_iter().zip(roles) {
+            let turn = format!("{{\"role\":\"{role}\",\"content\":{}}}", json_str(content));
+            let at = body
+                .find(&turn)
+                .unwrap_or_else(|| panic!("missing saved conversation turn: {turn}"));
+            assert!(at > previous, "saved conversation is out of order");
+            previous = at;
+        }
+        assert_eq!(body.matches("{\"role\":").count(), 6);
+    }
+
+    #[test]
+    fn datagram_heads_round_trip() {
+        let d = datagram("00000000deadbeef", "LINE", 4, 2, 0, "SAY 4 2/0 words");
+        let t = String::from_utf8(d).unwrap();
+        let (head, body) = t.split_once('\n').unwrap();
+        assert_eq!(field(head, "seq="), 4);
+        assert_eq!(field(head, "part="), 2);
+        assert_eq!(field(head, "bytes="), 15);
+        assert_eq!(body, "SAY 4 2/0 words");
+        assert!(head.starts_with("ALLEN-COURIER v=1 run=00000000deadbeef kind=LINE"));
+    }
+
+    #[test]
+    fn a_busy_server_is_asked_again_with_growing_waits() {
+        let ms: Vec<u128> = (1..=6)
+            .map(|n| backoff(n, "HTTP/1.1 503\r\n\r\n").as_millis())
+            .collect();
+        assert_eq!(ms, vec![250, 500, 1000, 1000, 1000, 1000]);
+        // the server names a wait: used when longer, never past 4 s
+        assert_eq!(
+            backoff(1, "HTTP/1.1 503\r\nRetry-After: 3\r\n\r\n").as_millis(),
+            3000
+        );
+        assert_eq!(
+            backoff(1, "HTTP/1.1 503\r\nretry-after: 30\r\n\r\n").as_millis(),
+            4000
+        );
+    }
+
+    #[test]
+    fn a_code_reply_becomes_pieces_and_a_closing_sentence() {
+        let (l, s, r) = code_lines(
+            3,
+            "<think>hmm</think>Here is your calculator.\n```python\nprint(2+2)\n```",
+            150,
+        );
+        assert_eq!(s, "Here is your calculator.");
+        assert_eq!(r.unwrap().lang, "python");
+        assert_eq!(l.len(), 2);
+        assert!(l[0].starts_with("CODE 3 1/1 11 "));
+        assert_eq!(l[1], "SAY 3 1/1 Here is your calculator.");
+        let (l, s, r) = code_lines(4, "No code today.", 150);
+        assert!(r.is_none());
+        assert_eq!(l, vec!["SAY 4 1/1 No code today.".to_string()]);
+        assert_eq!(s, "No code today.");
+        let (l, _, _) = code_lines(5, "", 150);
+        assert_eq!(l, vec![format!("SAY 5 1/1 {}", LOST)]);
+        let (_, s, _) = code_lines(6, "```c\nint x;\n```", 150);
+        assert_eq!(s, HERE);
+    }
+
+    #[test]
+    fn a_busy_server_names_its_wait_exactly() {
+        assert_eq!(
+            retry_after("HTTP/1.1 503 x\r\nRetry-After: 17\r\n\r\n"),
+            Some(17)
+        );
+        assert_eq!(retry_after("HTTP/1.1 503 x\r\n\r\n"), None);
+    }
+
+    #[test]
+    fn dates_are_civil() {
+        let (_, s) = utc_now();
+        assert_eq!(s.len(), 20);
+        assert!(s.starts_with("20"));
+    }
+}
+
+#[cfg(test)]
+mod plain_tests {
+    use super::*;
+
+    #[test]
+    fn typographic_marks_become_plain_ones() {
+        assert_eq!(for_allen("rhythm— earth", 150), "rhythm, earth");
+        assert_eq!(
+            plain("‘quoted’ “twice” … café naïve Ærø"),
+            "'quoted' \"twice\" ... cafe naive AEro"
+        );
+        assert_eq!(for_allen("rain 😀 falls", 150), "rain falls");
+        assert!(plain("Łódź – 3 × 4").is_ascii());
+    }
+
+    #[test]
+    fn a_cut_answer_stays_within_the_room_with_its_mark() {
+        let said = for_allen(
+            "no stops at all in this long run of words that goes on and on and on",
+            30,
+        );
+        assert!(said.chars().count() <= 30, "{said}");
+        assert!(said.ends_with("..."), "{said}");
+        assert!(said.is_ascii());
+    }
+}
+
+#[cfg(test)]
+mod key_tests {
+    use super::*;
+    use std::net::TcpListener;
+    use std::thread;
+
+    /// A one-request service on 127.0.0.1: answers `status` with `body` and
+    /// hands back the request it was sent.
+    fn service(status: &'static str, body: &'static str) -> (String, thread::JoinHandle<String>) {
+        let l = TcpListener::bind("127.0.0.1:0").unwrap();
+        let url = format!("http://{}", l.local_addr().unwrap());
+        let h = thread::spawn(move || {
+            let (mut s, _) = l.accept().unwrap();
+            let mut req = Vec::new();
+            let mut b = [0u8; 1024];
+            while find(&req, b"\r\n\r\n", 0).is_none() {
+                let n = s.read(&mut b).unwrap();
+                if n == 0 {
+                    break;
+                }
+                req.extend_from_slice(&b[..n]);
+            }
+            write!(
+                s,
+                "HTTP/1.1 {}\r\nContent-Length: {}\r\nConnection: close\r\n\r\n{}",
+                status,
+                body.len(),
+                body
+            )
+            .unwrap();
+            String::from_utf8_lossy(&req).to_string()
+        });
+        (url, h)
+    }
+
+    #[test]
+    fn a_good_key_is_sent_once_as_a_bearer_and_the_first_model_comes_back() {
+        let (url, h) = service(
+            "200 OK",
+            r#"{"object":"list","data":[{"id":"qwen3.8-27b-fp8","object":"model"}]}"#,
+        );
+        match key_test("openai", &format!("{}/v1", url), "sk-test-123") {
+            KeyTest::Ok(m) => assert_eq!(m, "qwen3.8-27b-fp8"),
+            KeyTest::Bad(why) => panic!("{why}"),
+        }
+        let req = h.join().unwrap();
+        assert!(req.starts_with("GET /v1/models HTTP/1.1\r\n"), "{req}");
+        assert!(
+            req.contains("Authorization: Bearer sk-test-123\r\n"),
+            "{req}"
+        );
+    }
+
+    #[test]
+    fn claude_gets_its_own_headers_and_a_refused_key_says_so() {
+        let (url, h) = service("401 Unauthorized", r#"{"error":"no"}"#);
+        match key_test("anthropic", &url, "sk-ant-x") {
+            KeyTest::Bad(why) => assert_eq!(why, "key not valid"),
+            KeyTest::Ok(_) => panic!("a 401 passed"),
+        }
+        let req = h.join().unwrap();
+        assert!(
+            req.contains("x-api-key: sk-ant-x\r\n") && req.contains("anthropic-version: "),
+            "{req}"
+        );
+        assert!(!req.contains("Authorization"), "{req}");
+    }
+
+    #[test]
+    fn no_key_sends_no_header_and_https_is_refused_out_loud() {
+        let (url, h) = service("200 OK", r#"{"data":[]}"#);
+        assert!(matches!(key_test("openai", &url, ""), KeyTest::Ok(m) if m.is_empty()));
+        assert!(!h.join().unwrap().contains("Authorization"));
+        match key_test("anthropic", "https://api.anthropic.com", "k") {
+            KeyTest::Bad(why) => assert!(why.contains("plain http"), "{why}"),
+            KeyTest::Ok(_) => panic!("https passed"),
+        }
+        assert!(matches!(
+            key_test("openai", "http://127.0.0.1:1", "k"),
+            KeyTest::Bad(_)
+        ));
+    }
+}
diff --git a/crates/allen-design-tokens/Cargo.toml b/crates/allen-design-tokens/Cargo.toml
new file mode 100644
index 00000000..86fa4d9c
--- /dev/null
+++ b/crates/allen-design-tokens/Cargo.toml
@@ -0,0 +1,15 @@
+[package]
+name = "allen-design-tokens"
+version.workspace = true
+edition.workspace = true
+authors.workspace = true
+license.workspace = true
+repository.workspace = true
+description = "Reads docs/design/DESIGN.md (Allen's look) and writes the C header, Rust module and CSS every Allen surface uses"
+
+[lib]
+path = "src/lib.rs"
+
+[[bin]]
+name = "allen-design-tokens"
+path = "src/main.rs"
diff --git a/crates/allen-design-tokens/src/lib.rs b/crates/allen-design-tokens/src/lib.rs
new file mode 100644
index 00000000..68d9e748
--- /dev/null
+++ b/crates/allen-design-tokens/src/lib.rs
@@ -0,0 +1,619 @@
+//! Allen's design tokens: one file in, three files out.
+//!
+//! `docs/design/DESIGN.md` (Google's DESIGN.md format) holds every colour, size, clock and curve of Allen's
+//! look. Its YAML front matter carries the tokens the DESIGN.md tools know (colors, typography, rounded,
+//! spacing, components); fenced blocks marked `allen-tokens` in its body carry the rest (motion, heartbeat,
+//! boot, sound, contrast floors, reduced motion, keys). This crate reads both, resolves `{group.name}`
+//! references, checks the contrast floors, and writes:
+//!
+//! - `allen_tokens.h` for the C kernel (integers only: colours packed as `CK_RGB`, durations in ms,
+//!   ratios in Q8 / Q15 / Q16 fixed point, Bezier curves in Q16),
+//! - `allen_tokens.rs` for the Rust runners (core types only, so `no_std` code can `include!` it),
+//! - `allen-tokens.css` for web surfaces (custom properties, with a reduced-motion block).
+//!
+//! Only the YAML subset DESIGN.md uses is read: nested maps by two-space indent, `key: value` scalars,
+//! optional double quotes. Anything else is an error, never a silent skip.
+
+use std::fmt::Write as _;
+
+/// One token: its dotted path (`colors.night`, `motion.letter`) and its value as written.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct Token {
+    pub path: String,
+    pub raw: String,
+}
+
+/// A value, typed by its look.
+#[derive(Debug, Clone, PartialEq)]
+pub enum Value {
+    Color(u8, u8, u8),
+    /// A number and its unit (`px`, `ms`, `Hz`, `em`), as written.
+    Dim(f64, String),
+    /// A plain number, written quoted (`"0.030"`).
+    Ratio(f64),
+    /// `cubic-bezier(x1, y1, x2, y2)`.
+    Bezier([f64; 4]),
+    Text(String),
+}
+
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct Error(pub String);
+
+impl std::fmt::Display for Error {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        f.write_str(&self.0)
+    }
+}
+
+impl std::error::Error for Error {}
+
+fn err<T>(msg: impl Into<String>) -> Result<T, Error> {
+    Err(Error(msg.into()))
+}
+
+/// All tokens of one DESIGN.md, in the order written, references resolved.
+#[derive(Debug, Clone, Default)]
+pub struct Tokens {
+    pub tokens: Vec<Token>,
+}
+
+impl Tokens {
+    pub fn get(&self, path: &str) -> Option<&str> {
+        self.tokens
+            .iter()
+            .find(|t| t.path == path)
+            .map(|t| t.raw.as_str())
+    }
+
+    /// The tokens of one top-level group (`colors`), with the group prefix removed.
+    pub fn group<'a>(&'a self, group: &'a str) -> impl Iterator<Item = (&'a str, &'a str)> + 'a {
+        self.tokens.iter().filter_map(move |t| {
+            t.path
+                .strip_prefix(group)
+                .and_then(|rest| rest.strip_prefix('.'))
+                .map(|rest| (rest, t.raw.as_str()))
+        })
+    }
+
+    pub fn groups(&self) -> Vec<&str> {
+        let mut out: Vec<&str> = Vec::new();
+        for t in &self.tokens {
+            let g = t.path.split('.').next().unwrap_or("");
+            if !out.contains(&g) {
+                out.push(g);
+            }
+        }
+        out
+    }
+}
+
+/// Reads the YAML subset: returns (path, value) pairs for every scalar, in order.
+fn parse_yaml(text: &str, first_line: usize) -> Result<Vec<Token>, Error> {
+    let mut out = Vec::new();
+    let mut stack: Vec<(usize, String)> = Vec::new();
+    for (i, line) in text.lines().enumerate() {
+        let n = first_line + i;
+        let body = line.trim_end();
+        if body.trim().is_empty() || body.trim_start().starts_with('#') {
+            continue;
+        }
+        let indent = body.len() - body.trim_start().len();
+        if !indent.is_multiple_of(2) {
+            return err(format!("line {n}: indent must be a multiple of two spaces"));
+        }
+        let Some((key, value)) = body.trim_start().split_once(':') else {
+            return err(format!("line {n}: expected `key: value`"));
+        };
+        let key = key.trim();
+        if key.is_empty() || key.contains(' ') {
+            return err(format!("line {n}: bad key `{key}`"));
+        }
+        while stack.last().is_some_and(|(d, _)| *d >= indent) {
+            stack.pop();
+        }
+        if stack.len() * 2 != indent {
+            return err(format!("line {n}: indent jumps a level"));
+        }
+        let path = stack
+            .iter()
+            .map(|(_, k)| k.as_str())
+            .chain(std::iter::once(key))
+            .collect::<Vec<_>>()
+            .join(".");
+        let value = value.trim();
+        if value.is_empty() {
+            stack.push((indent, key.to_string()));
+            continue;
+        }
+        let raw = match value.strip_prefix('"') {
+            Some(rest) => match rest.strip_suffix('"') {
+                Some(inner) => inner.to_string(),
+                None => return err(format!("line {n}: unclosed quote")),
+            },
+            None => value.to_string(),
+        };
+        out.push(Token { path, raw });
+    }
+    Ok(out)
+}
+
+/// Reads a DESIGN.md: the front matter and every ```allen-tokens block.
+pub fn parse(design_md: &str) -> Result<Tokens, Error> {
+    let Some(rest) = design_md.strip_prefix("---\n") else {
+        return err("DESIGN.md must start with a `---` front matter line");
+    };
+    let Some(end) = rest.find("\n---\n") else {
+        return err("front matter has no closing `---`");
+    };
+    let mut tokens = parse_yaml(&rest[..end], 2)?;
+    let body_start = 4 + end + 5;
+    let body = &design_md[body_start..];
+    let body_first_line = design_md[..body_start].lines().count() + 1;
+    let mut lines = body.lines().enumerate();
+    while let Some((i, line)) = lines.next() {
+        if line.trim_end() != "```allen-tokens" {
+            continue;
+        }
+        let mut block = String::new();
+        let mut closed = false;
+        for (_, l) in lines.by_ref() {
+            if l.trim_end() == "```" {
+                closed = true;
+                break;
+            }
+            block.push_str(l);
+            block.push('\n');
+        }
+        if !closed {
+            return err(format!(
+                "allen-tokens block at line {} is not closed",
+                body_first_line + i
+            ));
+        }
+        tokens.extend(parse_yaml(&block, body_first_line + i + 1)?);
+    }
+    for (i, t) in tokens.iter().enumerate() {
+        if tokens[..i].iter().any(|u| u.path == t.path) {
+            return err(format!("token `{}` is defined twice", t.path));
+        }
+    }
+    let mut out = Tokens { tokens };
+    resolve(&mut out)?;
+    Ok(out)
+}
+
+fn resolve(t: &mut Tokens) -> Result<(), Error> {
+    for i in 0..t.tokens.len() {
+        let mut raw = t.tokens[i].raw.clone();
+        let mut hops = 0;
+        while let Some(target) = raw.strip_prefix('{').and_then(|r| r.strip_suffix('}')) {
+            hops += 1;
+            if hops > 8 {
+                return err(format!("`{}`: reference loop", t.tokens[i].path));
+            }
+            let found = match t.get(target) {
+                Some(v) => v.to_string(),
+                None if t.group(target).next().is_some() => {
+                    // a whole group (a typography role): keep the reference, emitters expand it
+                    break;
+                }
+                None => {
+                    return err(format!(
+                        "`{}` points at `{target}`, which does not exist",
+                        t.tokens[i].path
+                    ))
+                }
+            };
+            raw = found;
+        }
+        t.tokens[i].raw = raw;
+    }
+    Ok(())
+}
+
+fn hex2(s: &str) -> Option<u8> {
+    u8::from_str_radix(s, 16).ok()
+}
+
+/// Types a raw value by its look.
+pub fn value(raw: &str) -> Value {
+    if let Some(h) = raw.strip_prefix('#') {
+        if h.len() == 6 {
+            if let (Some(r), Some(g), Some(b)) = (hex2(&h[0..2]), hex2(&h[2..4]), hex2(&h[4..6])) {
+                return Value::Color(r, g, b);
+            }
+        }
+    }
+    if let Some(args) = raw
+        .strip_prefix("cubic-bezier(")
+        .and_then(|r| r.strip_suffix(')'))
+    {
+        let v: Vec<f64> = args
+            .split(',')
+            .filter_map(|a| a.trim().parse().ok())
+            .collect();
+        if v.len() == 4 {
+            return Value::Bezier([v[0], v[1], v[2], v[3]]);
+        }
+    }
+    if let Ok(n) = raw.parse::<f64>() {
+        return Value::Ratio(n);
+    }
+    let split = raw
+        .find(|c: char| !(c.is_ascii_digit() || c == '.' || c == '-'))
+        .unwrap_or(raw.len());
+    if split > 0 {
+        if let Ok(n) = raw[..split].parse::<f64>() {
+            let unit = &raw[split..];
+            if unit.chars().all(|c| c.is_ascii_alphabetic()) {
+                return Value::Dim(n, unit.to_string());
+            }
+        }
+    }
+    Value::Text(raw.to_string())
+}
+
+/// WCAG 2.2 relative luminance of an sRGB colour.
+pub fn luminance(r: u8, g: u8, b: u8) -> f64 {
+    let lin = |c: u8| {
+        let c = f64::from(c) / 255.0;
+        if c <= 0.04045 {
+            c / 12.92
+        } else {
+            ((c + 0.055) / 1.055).powf(2.4)
+        }
+    };
+    0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b)
+}
+
+/// WCAG contrast ratio between two colours (1.0 to 21.0).
+pub fn contrast(a: (u8, u8, u8), b: (u8, u8, u8)) -> f64 {
+    let (la, lb) = (luminance(a.0, a.1, a.2), luminance(b.0, b.1, b.2));
+    let (hi, lo) = if la > lb { (la, lb) } else { (lb, la) };
+    (hi + 0.05) / (lo + 0.05)
+}
+
+/// One measured pair from the `contrast` group.
+#[derive(Debug, Clone)]
+pub struct ContrastResult {
+    pub fg: String,
+    pub bg: String,
+    /// Opacity the foreground is drawn at (1.0 opaque).
+    pub alpha: f64,
+    pub ratio: f64,
+    pub floor: f64,
+    /// Gated pairs fail the build below their floor; report-only pairs (the kernel today) do not.
+    pub gated: bool,
+}
+
+impl ContrastResult {
+    pub fn passes(&self) -> bool {
+        self.ratio >= self.floor
+    }
+}
+
+/// The foreground as it lands on the background when drawn at `alpha` (sRGB blend, as the kernel does).
+pub fn blend(fg: (u8, u8, u8), bg: (u8, u8, u8), alpha: f64) -> (u8, u8, u8) {
+    let mix = |f: u8, b: u8| (f64::from(b) + (f64::from(f) - f64::from(b)) * alpha).round() as u8;
+    (mix(fg.0, bg.0), mix(fg.1, bg.1), mix(fg.2, bg.2))
+}
+
+fn alpha_of(t: &Tokens, group: &str, name: &str) -> Result<Option<f64>, Error> {
+    match t.get(&format!("{group}.{name}")).map(value) {
+        None => Ok(None),
+        Some(Value::Ratio(a)) if (0.0..=1.0).contains(&a) => Ok(Some(a)),
+        Some(_) => err(format!("{group}.{name}: must be a number from 0 to 1")),
+    }
+}
+
+fn color_of(t: &Tokens, name: &str) -> Result<(u8, u8, u8), Error> {
+    match t.get(&format!("colors.{name}")).map(value) {
+        Some(Value::Color(r, g, b)) => Ok((r, g, b)),
+        _ => err(format!(
+            "contrast pair names `{name}`, which is not a colour"
+        )),
+    }
+}
+
+/// Measures every `contrast.<fg>-on-<bg>` pair against its floor.
+pub fn check_contrast(t: &Tokens) -> Result<Vec<ContrastResult>, Error> {
+    let mut out = Vec::new();
+    for (pair, floor) in t.group("contrast") {
+        let Some((fg, bg)) = pair.split_once("-on-") else {
+            return err(format!("contrast.{pair}: name must be <fg>-on-<bg>"));
+        };
+        let Value::Ratio(floor) = value(floor) else {
+            return err(format!("contrast.{pair}: floor must be a number"));
+        };
+        let (f, b) = (color_of(t, fg)?, color_of(t, bg)?);
+        let alpha = alpha_of(t, "drawn-alpha", fg)?.unwrap_or(1.0);
+        out.push(ContrastResult {
+            fg: fg.to_string(),
+            bg: bg.to_string(),
+            alpha,
+            ratio: contrast(blend(f, b, alpha), b),
+            floor,
+            gated: true,
+        });
+        if let Some(today) = alpha_of(t, "kernel-today-alpha", fg)? {
+            out.push(ContrastResult {
+                fg: fg.to_string(),
+                bg: bg.to_string(),
+                alpha: today,
+                ratio: contrast(blend(f, b, today), b),
+                floor,
+                gated: false,
+            });
+        }
+    }
+    Ok(out)
+}
+
+/// The contrast report written next to the exports.
+pub fn contrast_report(results: &[ContrastResult]) -> String {
+    let mut s = String::from(
+        "# Generated from docs/design/DESIGN.md by allen-design-tokens. Do not edit.\n\
+         # WCAG 2.2 contrast of each declared pair (foreground on background), measured as drawn:\n\
+         # the foreground blended over the background at its drawing opacity first.\n\
+         # REPORT lines are the kernel as it draws today; they do not gate the build.\n",
+    );
+    for r in results {
+        let _ = writeln!(
+            s,
+            "{:<10} on {:<6} at {:>5.3}  {:>6.2}:1  floor {:>4.1}  {}",
+            r.fg,
+            r.bg,
+            r.alpha,
+            r.ratio,
+            r.floor,
+            match (r.gated, r.passes()) {
+                (true, true) => "PASS",
+                (true, false) => "FAIL",
+                (false, true) => "REPORT pass",
+                (false, false) => "REPORT below floor",
+            }
+        );
+    }
+    s
+}
+
+fn ident(path: &str) -> String {
+    path.chars()
+        .map(|c| {
+            if c.is_ascii_alphanumeric() {
+                c.to_ascii_uppercase()
+            } else {
+                '_'
+            }
+        })
+        .collect()
+}
+
+fn q(v: f64, one: f64) -> i64 {
+    (v * one).round() as i64
+}
+
+const HEADER: &str = "Generated from docs/design/DESIGN.md by allen-design-tokens. Do not edit; change DESIGN.md and run\n   `cargo run -p allen-design-tokens -- generate`.";
+
+/// The C header: integers only, for the kernel.
+pub fn emit_c(t: &Tokens) -> String {
+    let mut s = format!(
+        "/* allen_tokens.h -- Allen's look as numbers.\n * {}\n * Colours are packed as CK_RGB (r << 16 | g << 8 | b). Durations in ms. Ratios in Q8 (/256), Q15 (/32767)\n * and Q16 (/65536). Bezier control points in Q16. */\n#ifndef AIENOS_ALLEN_TOKENS_H\n#define AIENOS_ALLEN_TOKENS_H\n",
+        HEADER.replace('\n', "\n *")
+    );
+    for g in t.groups() {
+        let _ = write!(s, "\n/* {g} */\n");
+        for (name, raw) in t.group(g) {
+            let id = format!("ALLEN_{}_{}", ident(g), ident(name));
+            match value(raw) {
+                Value::Color(r, gg, b) => {
+                    let _ = writeln!(s, "#define {id} 0x{r:02X}{gg:02X}{b:02X}u");
+                }
+                Value::Dim(n, unit) => {
+                    let unit_id = ident(&unit);
+                    if n.fract() == 0.0 && n >= 0.0 {
+                        let _ = writeln!(s, "#define {id}_{unit_id} {}u", n as i64);
+                    } else {
+                        let _ = writeln!(s, "#define {id}_{unit_id}_X1000 {}", q(n, 1000.0));
+                    }
+                }
+                Value::Ratio(n) if n.fract() == 0.0 && n.abs() >= 2.0 => {
+                    let _ = writeln!(s, "#define {id} {}", n as i64);
+                }
+                Value::Ratio(n) => {
+                    let _ = writeln!(s, "#define {id}_Q8 {}", q(n, 256.0));
+                    let _ = writeln!(s, "#define {id}_Q15 {}", q(n, 32767.0));
+                    let _ = writeln!(s, "#define {id}_Q16 {}", q(n, 65536.0));
+                }
+                Value::Bezier(p) => {
+                    for (k, v) in ["X1", "Y1", "X2", "Y2"].iter().zip(p) {
+                        let _ = writeln!(s, "#define {id}_{k}_Q16 {}", q(v, 65536.0));
+                    }
+                }
+                Value::Text(text) => {
+                    if let Some(role) = text.strip_prefix('{').and_then(|r| r.strip_suffix('}')) {
+                        let _ = writeln!(s, "/* {id}: {role} */");
+                    } else {
+                        let _ = writeln!(s, "#define {id} \"{}\"", text.replace('"', "\\\""));
+                    }
+                }
+            }
+        }
+    }
+    s.push_str("\n#endif\n");
+    s
+}
+
+/// The Rust module: core types only.
+pub fn emit_rust(t: &Tokens) -> String {
+    let mut s = format!(
+        "// allen_tokens.rs -- Allen's look as constants.\n// {}\n// Core types only, so no_std code can include!() this file.\n\n\
+         /// An sRGB colour.\n#[derive(Debug, Clone, Copy, PartialEq, Eq)]\npub struct Rgb {{\n    pub r: u8,\n    pub g: u8,\n    pub b: u8,\n}}\n\n\
+         impl Rgb {{\n    /// Packed as the kernel's CK_RGB.\n    pub const fn packed(self) -> u32 {{\n        (self.r as u32) << 16 | (self.g as u32) << 8 | self.b as u32\n    }}\n}}\n\n\
+         /// A CSS cubic-bezier easing curve, control points in Q16 (65536 = 1.0).\n#[derive(Debug, Clone, Copy, PartialEq, Eq)]\npub struct Bezier {{\n    pub x1: i32,\n    pub y1: i32,\n    pub x2: i32,\n    pub y2: i32,\n}}\n",
+        HEADER.replace('\n', "\n//")
+    );
+    for g in t.groups() {
+        let module = g.replace('-', "_");
+        let _ = write!(s, "\npub mod {module} {{\n    #[allow(unused_imports)]\n    use super::{{Bezier, Rgb}};\n");
+        for (name, raw) in t.group(g) {
+            let id = ident(name);
+            let line = match value(raw) {
+                Value::Color(r, gg, b) => {
+                    format!("pub const {id}: Rgb = Rgb {{ r: {r}, g: {gg}, b: {b} }};")
+                }
+                Value::Dim(n, unit) => {
+                    let unit_id = ident(&unit);
+                    if n.fract() == 0.0 && n >= 0.0 {
+                        format!("pub const {id}_{unit_id}: u32 = {};", n as i64)
+                    } else {
+                        format!("pub const {id}_{unit_id}: f32 = {n:?};")
+                    }
+                }
+                Value::Ratio(n) if n.fract() == 0.0 && n.abs() >= 2.0 => {
+                    format!("pub const {id}: u32 = {};", n as i64)
+                }
+                Value::Ratio(n) => format!(
+                    "pub const {id}: f32 = {n:?};\n    pub const {id}_Q16: i32 = {};",
+                    q(n, 65536.0)
+                ),
+                Value::Bezier(p) => format!(
+                    "pub const {id}: Bezier = Bezier {{ x1: {}, y1: {}, x2: {}, y2: {} }};",
+                    q(p[0], 65536.0),
+                    q(p[1], 65536.0),
+                    q(p[2], 65536.0),
+                    q(p[3], 65536.0)
+                ),
+                Value::Text(text) => {
+                    if let Some(role) = text.strip_prefix('{').and_then(|r| r.strip_suffix('}')) {
+                        format!("// {id}: {role}")
+                    } else {
+                        format!("pub const {id}: &str = {text:?};")
+                    }
+                }
+            };
+            let _ = writeln!(s, "    {line}");
+        }
+        s.push_str("}\n");
+    }
+    s
+}
+
+/// The CSS custom properties.
+pub fn emit_css(t: &Tokens) -> String {
+    let var = |g: &str, name: &str| format!("--allen-{g}-{name}").replace('.', "-");
+    let css_value = |raw: &str| -> String {
+        if let Some(role) = raw.strip_prefix('{').and_then(|r| r.strip_suffix('}')) {
+            return format!("var(--allen-{})", role.replace('.', "-"));
+        }
+        match value(raw) {
+            Value::Text(text) if text.contains(' ') && !text.contains('(') => format!("\"{text}\""),
+            _ => raw.to_string(),
+        }
+    };
+    let mut s = format!(
+        "/* allen-tokens.css -- Allen's look as CSS custom properties.\n   {HEADER} */\n:root {{\n"
+    );
+    for g in t.groups() {
+        if g == "reduced-motion" {
+            continue;
+        }
+        let _ = writeln!(s, "  /* {g} */");
+        for (name, raw) in t.group(g) {
+            let name_v = if g == "typography" && name.ends_with(".fontFamily") {
+                let _ = writeln!(
+                    s,
+                    "  {}: \"{raw}\", ui-rounded, system-ui, sans-serif;",
+                    var(g, name)
+                );
+                continue;
+            } else {
+                css_value(raw)
+            };
+            let _ = writeln!(s, "  {}: {name_v};", var(g, name));
+            if let Value::Color(r, gg, b) = value(raw) {
+                let _ = writeln!(s, "  {}-rgb: {r} {gg} {b};", var(g, name));
+            }
+        }
+    }
+    s.push_str("}\n\n@media (prefers-reduced-motion: reduce) {\n  :root {\n");
+    for (name, raw) in t.group("reduced-motion") {
+        let target = ["motion", "heartbeat", "boot"]
+            .iter()
+            .find(|g| t.get(&format!("{g}.{name}")).is_some())
+            .map(|g| var(g, name))
+            .unwrap_or_else(|| var("reduced-motion", name));
+        let _ = writeln!(s, "    {target}: {};", css_value(raw));
+    }
+    s.push_str("  }\n}\n");
+    s
+}
+
+/// Every file the generator writes, by name.
+pub fn outputs(t: &Tokens) -> Result<Vec<(&'static str, String)>, Error> {
+    let results = check_contrast(t)?;
+    Ok(vec![
+        ("allen_tokens.h", emit_c(t)),
+        ("allen_tokens.rs", emit_rust(t)),
+        ("allen-tokens.css", emit_css(t)),
+        ("contrast.txt", contrast_report(&results)),
+    ])
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    const MINI: &str = "---\nname: T\ncolors:\n  primary: \"#ECF0FC\"\n  night: \"#060812\"\ncomponents:\n  page:\n    backgroundColor: \"{colors.night}\"\n---\n\n## Motion\n\n```allen-tokens\nmotion:\n  letter: 35ms\n  ease-smooth: \"cubic-bezier(0.3333, 0, 0.6667, 1)\"\ncontrast:\n  primary-on-night: \"7.0\"\n```\n";
+
+    #[test]
+    fn reads_front_matter_and_blocks() {
+        let t = parse(MINI).unwrap();
+        assert_eq!(t.get("colors.night"), Some("#060812"));
+        assert_eq!(t.get("components.page.backgroundColor"), Some("#060812"));
+        assert_eq!(t.get("motion.letter"), Some("35ms"));
+    }
+
+    #[test]
+    fn broken_reference_is_an_error() {
+        let bad = MINI.replace("{colors.night}", "{colors.nope}");
+        assert!(parse(&bad).is_err());
+    }
+
+    #[test]
+    fn duplicate_token_is_an_error() {
+        let bad = MINI.replace("  letter: 35ms\n", "  letter: 35ms\n  letter: 36ms\n");
+        assert!(parse(&bad).is_err());
+    }
+
+    #[test]
+    fn wcag_reference_values() {
+        // black on white is 21:1 by definition; equal colours are 1:1
+        assert!((contrast((0, 0, 0), (255, 255, 255)) - 21.0).abs() < 1e-9);
+        assert!((contrast((6, 8, 18), (6, 8, 18)) - 1.0).abs() < 1e-9);
+    }
+
+    #[test]
+    fn smoothstep_bezier_is_exact() {
+        // x(s) = s for control x 1/3, 2/3, so y(s) = 3s^2 - 2s^3 = ck_smooth
+        let y = |s: f64| 3.0 * (1.0 - s) * s * s + s * s * s;
+        for i in 0..=10 {
+            let s = f64::from(i) / 10.0;
+            assert!((y(s) - (3.0 * s * s - 2.0 * s * s * s)).abs() < 1e-12);
+        }
+    }
+
+    #[test]
+    fn c_export_is_integer_only() {
+        let t = parse(MINI).unwrap();
+        let c = emit_c(&t);
+        assert!(c.contains("#define ALLEN_COLORS_NIGHT 0x060812u"));
+        assert!(c.contains("#define ALLEN_MOTION_LETTER_MS 35u"));
+        assert!(c.contains("#define ALLEN_MOTION_EASE_SMOOTH_X1_Q16 21843"));
+        assert!(
+            !c.contains('.')
+                || c.lines()
+                    .all(|l| !l.starts_with("#define") || !l.contains('.'))
+        );
+    }
+}
diff --git a/crates/allen-design-tokens/src/main.rs b/crates/allen-design-tokens/src/main.rs
new file mode 100644
index 00000000..555d6bee
--- /dev/null
+++ b/crates/allen-design-tokens/src/main.rs
@@ -0,0 +1,89 @@
+//! allen-design-tokens: `generate` writes the exports from DESIGN.md; `check` fails if they are stale or a
+//! contrast floor is missed.
+//!
+//!   cargo run -p allen-design-tokens -- generate [DESIGN.md] [OUT_DIR]
+//!   cargo run -p allen-design-tokens -- check    [DESIGN.md] [OUT_DIR]
+
+use std::path::PathBuf;
+use std::process::ExitCode;
+
+fn repo_root() -> PathBuf {
+    PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../..")
+}
+
+fn main() -> ExitCode {
+    let args: Vec<String> = std::env::args().skip(1).collect();
+    let mode = args.first().map(String::as_str).unwrap_or("check");
+    let design = args
+        .get(1)
+        .map(PathBuf::from)
+        .unwrap_or_else(|| repo_root().join("docs/design/DESIGN.md"));
+    let out_dir = args
+        .get(2)
+        .map(PathBuf::from)
+        .unwrap_or_else(|| repo_root().join("docs/design/tokens"));
+    if !matches!(mode, "generate" | "check") {
+        eprintln!("usage: allen-design-tokens generate|check [DESIGN.md] [OUT_DIR]");
+        return ExitCode::from(2);
+    }
+    let text = match std::fs::read_to_string(&design) {
+        Ok(t) => t,
+        Err(e) => {
+            eprintln!("allen-design-tokens: cannot read {}: {e}", design.display());
+            return ExitCode::FAILURE;
+        }
+    };
+    let tokens = match allen_design_tokens::parse(&text) {
+        Ok(t) => t,
+        Err(e) => {
+            eprintln!("allen-design-tokens: {}: {e}", design.display());
+            return ExitCode::FAILURE;
+        }
+    };
+    let results = match allen_design_tokens::check_contrast(&tokens) {
+        Ok(r) => r,
+        Err(e) => {
+            eprintln!("allen-design-tokens: {e}");
+            return ExitCode::FAILURE;
+        }
+    };
+    print!("{}", allen_design_tokens::contrast_report(&results));
+    let mut ok = true;
+    for r in results.iter().filter(|r| r.gated && !r.passes()) {
+        eprintln!(
+            "allen-design-tokens: FAIL contrast {} on {}: {:.2}:1, floor {:.1}",
+            r.fg, r.bg, r.ratio, r.floor
+        );
+        ok = false;
+    }
+    let outputs = match allen_design_tokens::outputs(&tokens) {
+        Ok(o) => o,
+        Err(e) => {
+            eprintln!("allen-design-tokens: {e}");
+            return ExitCode::FAILURE;
+        }
+    };
+    for (name, body) in outputs {
+        let path = out_dir.join(name);
+        if mode == "generate" {
+            if let Err(e) =
+                std::fs::create_dir_all(&out_dir).and_then(|()| std::fs::write(&path, body))
+            {
+                eprintln!("allen-design-tokens: cannot write {}: {e}", path.display());
+                return ExitCode::FAILURE;
+            }
+            println!("wrote {}", path.display());
+        } else if std::fs::read_to_string(&path).ok().as_deref() != Some(body.as_str()) {
+            eprintln!(
+                "allen-design-tokens: {} is stale; run `cargo run -p allen-design-tokens -- generate`",
+                path.display()
+            );
+            ok = false;
+        }
+    }
+    if ok {
+        ExitCode::SUCCESS
+    } else {
+        ExitCode::FAILURE
+    }
+}
diff --git a/crates/allen-design-tokens/tests/exports.rs b/crates/allen-design-tokens/tests/exports.rs
new file mode 100644
index 00000000..45bd37a5
--- /dev/null
+++ b/crates/allen-design-tokens/tests/exports.rs
@@ -0,0 +1,102 @@
+//! The committed exports must match DESIGN.md, every gated contrast pair must pass, and the tokens lifted
+//! from the kernel must keep the kernel's values.
+
+use std::path::PathBuf;
+
+fn root() -> PathBuf {
+    PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../..")
+}
+
+fn tokens() -> allen_design_tokens::Tokens {
+    let text = std::fs::read_to_string(root().join("docs/design/DESIGN.md")).unwrap();
+    allen_design_tokens::parse(&text).unwrap()
+}
+
+#[test]
+fn exports_are_current() {
+    for (name, body) in allen_design_tokens::outputs(&tokens()).unwrap() {
+        let path = root().join("docs/design/tokens").join(name);
+        let on_disk = std::fs::read_to_string(&path).unwrap_or_default();
+        assert!(
+            on_disk == body,
+            "{} is stale: run `cargo run -p allen-design-tokens -- generate`",
+            path.display()
+        );
+    }
+}
+
+#[test]
+fn gated_contrast_passes() {
+    for r in allen_design_tokens::check_contrast(&tokens()).unwrap() {
+        assert!(
+            !r.gated || r.passes(),
+            "{} on {}: {:.2}:1 below {:.1}",
+            r.fg,
+            r.bg,
+            r.ratio,
+            r.floor
+        );
+    }
+}
+
+#[test]
+fn kernel_values_are_kept() {
+    // native/kernel/ui on feat/allen-boot-everywhere (iMac 0930240): night.h, chirp.h, allen_ui.c, mind.c
+    let t = tokens();
+    for (path, want) in [
+        ("colors.night", "#060812"),
+        ("colors.primary", "#ECF0FC"),
+        ("colors.hint", "#96A0C4"),
+        ("colors.faint", "#828CB0"),
+        ("colors.glow", "#96AAFF"),
+        ("colors.mist", "#C8D2FF"),
+        ("colors.warm", "#FFD496"),
+        ("colors.heart", "#FFD2AA"),
+        ("colors.heart-core", "#FFECD6"),
+        ("colors.halo", "#3C4AD2"),
+        ("colors.halo-violet", "#705CFF"),
+        ("colors.sky-glow", "#6E82FF"),
+        ("boot.holes-appear", "2600ms"),
+        ("boot.fade-end", "6800ms"),
+        ("boot.spiral", "6000ms"),
+        ("boot.merge", "12000ms"),
+        ("boot.ripple-run", "3600ms"),
+        ("boot.gone", "15200ms"),
+        ("boot.allen-born", "12300ms"),
+        ("boot.allen-formed", "15300ms"),
+        ("sound.chirp-rate", "48000Hz"),
+        ("sound.chirp-from", "200Hz"),
+        ("sound.chirp-to", "1000Hz"),
+        ("sound.chirp-in", "40ms"),
+        ("sound.chirp-rise", "600ms"),
+        ("sound.chirp-start", "11400ms"),
+        ("sound.chirp-end", "12300ms"),
+        ("motion.letter", "35ms"),
+        ("motion.mind-form", "3000ms"),
+        ("motion.caret-breath", "1100ms"),
+        ("heartbeat.breath-period", "5500ms"),
+        ("heartbeat.think-pulse-period", "900ms"),
+        ("native-type.voice-cap", "19px"),
+        ("native-type.body-cap", "15px"),
+        ("native-type.small-cap", "11px"),
+        ("native-type.line", "40px"),
+        ("native-type.wrap", "900px"),
+        ("spacing.bar-width", "720px"),
+        ("spacing.bar-height", "54px"),
+    ] {
+        assert_eq!(t.get(path), Some(want), "{path}");
+    }
+    let c = allen_design_tokens::emit_c(&t);
+    // the kernel's fixed-point forms: chirp peak 22937 (CK_CHIRP_PEAK), breath 1966/65536 (mind.c 173),
+    // heart levels 50, 70, 120, 80 out of 256 (mind.c 137)
+    for line in [
+        "#define ALLEN_SOUND_CHIRP_PEAK_Q15 22937",
+        "#define ALLEN_HEARTBEAT_BREATH_DEPTH_Q16 1966",
+        "#define ALLEN_HEARTBEAT_HEART_IDLE_Q8 50",
+        "#define ALLEN_HEARTBEAT_HEART_LISTEN_Q8 70",
+        "#define ALLEN_HEARTBEAT_HEART_THINK_Q8 120",
+        "#define ALLEN_HEARTBEAT_HEART_SPEAK_Q8 80",
+    ] {
+        assert!(c.contains(line), "missing `{line}`");
+    }
+}
diff --git a/docs/.crumb b/docs/.crumb
index 51b2754a..2607fdaa 100644
--- a/docs/.crumb
+++ b/docs/.crumb
@@ -18,26 +18,26 @@
       "children": [
         {
           "digest": "e84f072935b7d6d9f5a7bcaedb3fc366b4f73f8f609abcc2ea450e65665c64fa",
-          "last_commit": "09e59a8",
+          "last_commit": "09e59a82",
           "name": "adr",
           "purpose": "Directory docs/adr. Purpose not yet described by a human."
         },
         {
           "digest": "5dc4f124f1c023aa4786f45336a671138fce9fa046478364cdc7454307d7b588",
-          "last_commit": "09e59a8",
+          "last_commit": "09e59a82",
           "name": "crumbs",
           "purpose": "Directory docs/crumbs. Purpose not yet described by a human."
         }
       ],
       "children_root": "sha256:491e93c09b6185b662afda8b29d24bb3ee81bc2aed9009757fdf4674d197be31",
-      "compiled_at": "2026-10-16T10:58:02Z",
+      "compiled_at": "2026-10-25T23:31:49Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:2f740ef54106c2b6419bfd2df1266762cd444f439c7e12ae2a7c5c3877de926c",
-      "evidence_files": 0,
-      "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 216,
-      "generated_at_commit": "4637b04d06f4e3cec4c79920bbed0efb46b93995",
-      "source_tree": "sha256:1abaa75a2a66a6ce77842c9439ad7a5cbb7dee680ef47a6c33d9b865e8f70417"
+      "digest": "sha256:b459985aaaeaad0729a1f68adeb510b6ebf050901443373d35be4c8ff8a5a3bd",
+      "evidence_files": 3,
+      "evidence_root": "sha256:dc6e023412ded01aca886a94dc13859cb37ae664a28cff201db34893e3fab9ee",
+      "files": 302,
+      "generated_at_commit": "52e20bda088a203c1cd21b5d02fbfa81763a5972",
+      "source_tree": "sha256:12b68f12c6df7a5cd5b780d3d8fa2813cd1dfa4a525e372a89d774f707a08938"
     },
     "owner_lane": "",
     "provenance": {
diff --git a/docs/ALLEN_CANVAS.md b/docs/ALLEN_CANVAS.md
new file mode 100644
index 00000000..f2e1eecb
--- /dev/null
+++ b/docs/ALLEN_CANVAS.md
@@ -0,0 +1,161 @@
+# Allen's canvas: the model paints the screen
+
+Drake's words: "It all will be on a screen that isn't being processed. It is literally being painted on by
+the model." Until this branch, the language model behind Allen could only hand back one plain line of text,
+and the kernel decided everything else. Allen's canvas is the first step past that: the model now decides
+*what is shown*, in a small language of its own, and the kernel paints it in Allen's style. This document is
+the grammar and the reasons for it.
+
+Code: `native/kernel/svc/allen_scene.{h,c}` (the parser), `native/kernel/ui/canvas.{h,c}` (the painter),
+small hooks in `native/kernel/ui/allen_ui.c` (`ck_allen_ui_scene`). The prompt the model is given:
+`crates/allen-courier/scene_prompt.txt`. Tests: `scripts/ck_allen_canvas_test.sh` (add `--live` to ask the
+real model). Evidence: `evidence/allen-canvas/`.
+
+## 1. Why a language, and why this one
+
+The model must not draw pixels. Three reasons, each measured or physical:
+
+1. **Safety.** Whatever the model writes, the kernel has to survive it. A small line grammar with fixed limits
+   can be parsed in a few hundred lines of integer C with every byte bounds-checked and fuzzed (300,000
+   random and mutated replies per test run, under AddressSanitizer and UndefinedBehaviorSanitizer). Pixel
+   commands or a general layout language (HTML, SVG, a display list) cannot be checked that cheaply, and would
+   let one reply clutter or break the screen.
+2. **Calm.** The design rule is one thing in the centre, the rest at the edge, every change eased in
+   (`docs/ALLEN_PRESENCE_RESEARCH.md` section 3). If the model chose coordinates and colours it could break
+   that rule on any answer. In this language it can only say *what* (a number, a list, a person) and *roughly
+   where* (left, right, above); the look, the motion and the palette stay the kernel's.
+3. **Reliability of a mid-size model.** A model writes keyword lines far more reliably than nested JSON
+   (the inference-server notes record Qwen3 dropping a closing bracket and running on past the end of an
+   array). A line it gets wrong is dropped on its own; the rest of the scene still shows.
+
+The vocabulary is the smallest set that covers what people ask a computer for most of the day: an answer
+(a number, a note), steps or choices (a list), time (a timer), people (a person and a message), something to
+look at (a picture, a video, a quote), and the feeling of the room (a mood). The same lines will later carry a
+friend's message arriving (`person from`) or a video playing in its place (`video`) without a single window:
+the thing the line names is what appears, in the sky beside Allen.
+
+## 2. The grammar
+
+A scene is plain ASCII, at most **12 lines** that count and at most **2048 bytes**; anything after is not read.
+
+```
+scene   = { line "\n" }
+line    = mood | say | thing | (blank, a code fence, or the model's <think> block: skipped)
+mood    = "mood" { tone | water }
+tone    = "night" | "dawn" | "deep" | "clear"
+water   = "still" | "slow" | "lively"
+say     = "say" [":"] text                    (exactly one; Allen speaks it; at most 159 characters)
+thing   = kind { word } ":" field { "|" field } (at most 4 things on screen at once)
+kind    = "note" | "list" | "number" | "quote" | "person" | "timer" | "picture" | "video"
+word    = "left" | "right" | "above"           (where it sits; otherwise the kernel chooses)
+        | "warm" | "quiet"                     (lit warm to stand out, or held back)
+        | "bloom" | "rise" | "fade"            (how it arrives; bloom is the default)
+        | "to" | "from"                        (a person's message: going to them or come from them)
+```
+
+The fields of each kind, with the room each one has (longer text is cut at a word and ends in "..."):
+
+| kind    | fields                         | room (characters)           | needs |
+|---------|--------------------------------|-----------------------------|-------|
+| note    | title, text (or just text)     | 48, 240                     | 1     |
+| list    | title, item, item, ...         | 48, then 64 each (5 items)  | 1     |
+| number  | value, caption                 | 16, 64 (value has a digit)  | 1     |
+| quote   | text, who                      | 220, 48                     | 1     |
+| person  | name, message                  | 32, 200                     | 2     |
+| timer   | when, label                    | 24, 64                      | 1     |
+| picture | what it shows, where from      | 120, 64                     | 1     |
+| video   | what it shows, where from      | 120, 64                     | 1     |
+
+A timer's `when` is a length (`25m`, `1h 30m`, `90 seconds`, `in 10 minutes`, up to 24 hours) and then the
+ring of light empties as the time runs out; anything else (`6:00 pm`) is shown as written, in a full ring.
+
+Example (a real reply shape):
+
+```
+mood calm
+say Seventeen percent of 240 is 40.8.
+number right: 40.8 | 17% of 240
+note left quiet: How | 240 x 0.17 = 40.8
+```
+
+### What the parser forgives, and what it counts
+
+The kernel never shows a line it does not understand, and never complains on screen. Every reply gets a report
+(`ck_scene_stats`): lines read, kept, **rejected** (an unknown first word, or a thing with nothing in it),
+**tidied** (understood after taking off a list mark, numbering, bold stars or a code fence the grammar does
+not use), **cut** (a field too long, or bytes outside printable ASCII left out), **over** (past 12 lines, past
+4 things, a second say or mood) and **truncated** (past 2 KiB). A reply is **clean** when nothing was
+rejected, tidied, over or truncated and it has its say line; that is the number reported for the real model.
+A reply with no scene lines at all is still spoken: its first line becomes the say.
+
+On the courier's one-line wire a scene travels with its newlines written as `\n`;
+`ck_scene_unwire()` turns it back into lines before `ck_allen_ui_scene()`.
+
+## 3. How it is painted (ui/canvas.c)
+
+Everything is drawn into the same night as Allen, in the palette of `ui/allen_ui.c` and nothing else: night
+rgb(6 8 18), text rgb(236 240 252), hint rgb(150 160 196), glow rgb(150 170 255), mist rgb(200 210 255), ink
+rgb(64 86 196), warm rgb(255 212 150) and rgb(255 222 180). The type is Allen's own stroke face.
+
+- **Nothing is a window.** No box has an edge. Words rest in a soft pool of shade that fades out over about
+  80 px, so stars never show through text and no rectangle is ever drawn. Text things have one thread of
+  light down their side (warm for a quotation). A number is large, thin strokes over a faint glow. A timer is
+  a ring of light that empties, its moving end a warm point. A person is a ring round their initial. A
+  picture or video not yet here is a soft field of deep blue light with a brighter light drifting slowly
+  across it, and "not here yet" under it; a video adds a play mark drawn in light.
+- **Allen stays alone in the centre.** Things sit in two columns beside him (each at most two things, kept
+  above his spoken words) or in one place above him; at most four things at once. The kernel chooses when the
+  model does not say, and moves a thing to where there is room when the asked-for place is full.
+- **Every change eases in.** A thing blooms: a spark leaves Allen's heart, flies on a curve to its place,
+  touches the water there (a drop of ink in the fluid), and the thing opens line by line (each line eases up
+  10 px and in over 0.7 s, 70 ms after the one before). Things come one after another, 260 ms apart, as Allen
+  starts to speak. A new line from the person sends them away over 0.7 s; a new scene replaces them the same
+  way; left alone they go after 90 s (a running timer stays). The mood's tone blends over 0.7 s: `dawn` warms
+  the low sky, `clear` lifts the high sky with mist, `deep` darkens the night; `lively` water gets a gentle
+  current pushed round Allen now and then.
+- **The kernel's rules hold.** Integer only (1/256 and 16ths of a pixel), no floating point (the test
+  compiles both files `-ffreestanding -mgeneral-regs-only` and checks they call nothing outside the kernel but
+  memset/memcpy/memmove), no allocation (one static 384 KiB pool for the large digits, rasterized at start so
+  drawing never writes to it), and drawing only reads, so the other cores can share a frame. Only the parts
+  of the screen that change are redrawn; the test checks that drawing those parts gives the same frame as
+  drawing everything.
+
+## 4. The prompt
+
+`crates/allen-courier/scene_prompt.txt` is the system prompt. It names the lines, gives the rules (plain
+ASCII, at most three things, be honest about what Allen cannot do yet: no weather, clock, internet, messages or
+media of his own) and three short examples that are not the test questions. `allen-scene`
+(`crates/allen-courier/src/bin/allen-scene.rs`) builds it in with `include_str!`, so the relay can use the
+same file the same way. The live test asks the model one question at a time and waits out the server's 503
+(busy) answers, waiting as its Retry-After asks (1 to 15 s), for up to thirty minutes per question.
+
+## 5. Measured
+
+All on the Spark (GB10 host CPU, one core, 3840 x 2160), evidence in `evidence/allen-canvas/`.
+
+- **Real model replies** (Qwen3.8-27B FP8 on our own server, 127.0.0.1:18091, temperature 0.3, ten questions
+  in `questions.txt`, raw replies kept as written): round 1, prompt v1: **10 of 10 parsed cleanly** and 10 of
+  10 used the canvas (`round-1/parse-report.txt`). Round 2, prompt v2 (one more rule: watch or play means a
+  video line, see means a picture line): **3 of 4 clean**; the fourth wrote two say lines (the second is
+  dropped, the first is spoken), and the round was stopped after four questions when other jobs held the GPU
+  lock for good (`round-2/run.log`). Together: **13 of 14 real replies clean**, every one of them understood
+  and painted. The server is shared and answers one request at a time; a reply took 1.5 to 14 minutes of
+  waiting (Retry-After honoured, never two requests at once).
+- **Fuzz**: 300,000 replies per run (random bytes, mutated scenes, word soup), each in a buffer of exactly its
+  length, under AddressSanitizer and UndefinedBehaviorSanitizer: no overrun, no undefined behaviour, no scene
+  outside its limits. It found one real bug outside the parser: `ck_atan2` in `ui/paint.c` shifted a negative
+  number left (undefined in C); fixed by multiplying.
+- **Frame cost** (`frame-times-final.txt`, held under the quiet lock): the existing window test averages
+  19.8 and 19.1 ms per frame on the base commit and 20.9 and 18.3 ms with the canvas hooked in (two pairs, the
+  machine's load fell from 43 to 9 during the run): no cost that rises above the noise. In the canvas test, frames
+  while plain answers are spoken average 19.2 ms and frames while scenes arrive and rest average 24.1 ms (worst
+  45 ms, during an arrival, when the spark and a whole thing are redrawn).
+- **Image size**: IMACKERN.EFI 307,200 bytes (274,432 before); the zeroed memory grows by the 384 KiB pool.
+
+## 6. What is not done
+
+- The courier does not carry scenes to the iMac yet: the relay (`crates/allen-courier/src/main.rs`) and the
+  kernel's answer path belong to the "Allen through the model" branch; the hook they need is
+  `ck_allen_ui_scene()` plus `ck_scene_unwire()`.
+- Pictures and videos are places only; nothing fetches or decodes them.
+- None of this has run on the real iMac.
diff --git a/docs/ALLEN_PRESENCE_RESEARCH.md b/docs/ALLEN_PRESENCE_RESEARCH.md
new file mode 100644
index 00000000..1adee341
--- /dev/null
+++ b/docs/ALLEN_PRESENCE_RESEARCH.md
@@ -0,0 +1,234 @@
+# Allen's presence: what the sources say, and what we built from them
+
+Research note for the Allen window in the test-computer kernel
+(`native/kernel/ui/`), written against primary sources. Each claim names the
+source that owns it. Where a source says nothing, that is said too.
+
+Question asked: *how do you think outside the box, and does speaking a thing
+into existence make it come true?* Then: *what should the interface of an
+agent look like if it is not chat bubbles, tabs and endless scrolling?*
+
+## 1. Speaking things into existence
+
+### 1.1 Words that do things (Austin, 1962)
+
+J. L. Austin, *How to Do Things with Words* (the 1955 William James
+Lectures, Oxford University Press 1962), Lecture I: some utterances do not
+describe anything and are not true or false; saying them *is* doing the
+thing. His examples: "I do" at a wedding, "I name this ship the Queen
+Elizabeth", "I bet you sixpence". He calls these **performatives**. Lecture
+II lists the conditions under which a performative works: there must be an
+accepted convention, the right people and circumstances, and the procedure
+must be carried out completely and correctly, or the act "misfires".
+
+What this owns: within a convention, a sentence can bring a state of affairs
+into being. Outside a convention it cannot. Naming a ship works because a
+whole practice stands behind it.
+
+### 1.2 Saying the plan makes the plan happen more often (Gollwitzer, 1999)
+
+Peter M. Gollwitzer, "Implementation intentions: Strong effects of simple
+plans", *American Psychologist* 54(7), 1999, pp. 493 to 503. An
+**implementation intention** is a sentence of the form "when situation X
+arises, I will do Y". Across the studies reviewed, people who formed such a
+sentence completed the intended action far more often than people who only
+held the goal. The paper's explanation: the sentence hands control of the
+action to the situation, so it starts without a fresh decision.
+
+The 2006 meta-analysis (Gollwitzer and Sheeran, "Implementation intentions
+and goal achievement", *Advances in Experimental Social Psychology* 38, pp.
+69 to 119) puts the effect across 94 studies at a medium to large size
+(d = .65).
+
+What this owns: spoken or written intentions change what the speaker does
+next. They do not act on the world directly; they act on the speaker.
+
+### 1.3 What the sources do not say
+
+No primary source consulted claims that speech changes physics. The claim
+"speaking it into existence makes it come true" is true in two honest
+senses and false in one:
+
+- true as a performative: inside a convention, saying it makes it so
+  (Austin);
+- true as an intention: saying the plan out loud makes you carry it out
+  more often (Gollwitzer);
+- false as magic: no measured effect of words on events the speaker cannot
+  reach. DOCS SILENT on any such effect.
+
+### 1.4 How Allen uses this
+
+Inside Allen's window every sentence is a performative, because the
+convention is built in. "Call yourself Nova" makes him Nova, on disk, from
+then on (`svc/allen_reply.c`, `svc/allen_memory.c` version 3). "Remember my
+car is red" makes it remembered. "Goodbye" puts the computer to sleep.
+Nothing is a request that goes into a queue; the saying is the doing, and
+the window shows the doing (the line rises into him, the water turns, he
+answers). That is the honest version of speaking things into existence:
+build the convention so the words have somewhere to land.
+
+## 2. Thinking outside the box
+
+"Outside the box" is a phrase from the nine-dot puzzle (join nine dots in a
+three-by-three grid with four straight strokes without lifting the pen; the
+strokes must leave the square the dots suggest). The puzzle is in Sam Loyd's
+*Cyclopedia of Puzzles* (1914, p. 301, as "Christopher Columbus's egg
+puzzle"). The experimental literature on it, Weisberg and Alba, "An
+examination of the alleged role of 'fixation' in the solution of several
+'insight' problems", *Journal of Experimental Psychology: General* 110(2),
+1981, pp. 169 to 192, found that telling people the strokes may leave the
+square helped very little by itself; what helped was experience with the
+specific move. The lesson the source owns: the box is not a mental habit you
+can be talked out of; it is a lack of the concrete move. New moves come from
+building and trying, not from exhortation.
+
+For the interface this meant: do not redesign chat; build the thing that is
+not chat and see what it needs. Section 3 is what it needed.
+
+## 3. An interface that is not chat
+
+### 3.1 Calm technology (Weiser and Brown, 1996)
+
+Mark Weiser and John Seely Brown, "The Coming Age of Calm Technology",
+Xerox PARC, 5 October 1996 (later in *Beyond Calculation*, Springer 1997).
+Calm technology "engages both the center and the periphery of our
+attention, and in fact moves back and forth between the two". Their
+examples: an inner office window, and Natalie Jeremijenko's Dangling String,
+a plastic cord that twitches with network traffic. Three claims they make:
+information should live in the periphery until needed; moving it to the
+centre and back should be easy; the periphery is where you can "attune to
+many more things".
+
+Allen's window is built on this. The sky, the galaxies and the water are the
+periphery: always moving, never demanding. Allen himself is the centre, and
+a typed line moves attention there and back without a mode change. There is
+one bar, one voice, no tabs and no history to scroll: what was said rises
+into him and is kept by him (notes, memory), not stacked on the screen.
+
+### 3.2 Smooth change, not cuts
+
+Every change of state in the window is a movement over time with an eased
+curve (`toward()` and the fluid weights in `ui/allen_ui.c`, `ui/flow.c`):
+the dusk when sleeping (section 3.3) and the dawn when waking (0.9 s), the shift
+between idle, listening, thinking and speaking as a blend of weights over
+0.7 s, the words rising and fading. No frame is a cut. The requirement came
+from the brief (transitions "part of the experience"); the method is
+Weiser and Brown's periphery: a cut forces attention to the centre, a flow
+does not.
+
+### 3.3 Goodbye: the event horizon
+
+"Goodbye" is the one performative that ends the session, and the brief asked
+that it be seen: everything on the screen drawn into the black hole in the
+middle, the accretion disk at its most beautiful, then black, then the panel
+off. The dusk (`horizon_at()` in `ui/allen_ui.c`, `ck_night_fall()` and
+`ck_night_base_from()` in `ui/night.c`) lasts 4.2 s and is built from three
+things the sources own:
+
+- **Where the light falls from.** The picture on the screen at the moment
+  of goodbye is kept (with copies at half, quarter and so on down to a
+  thirty-second of its size, so that light crowded a hundredfold is averaged
+  rather than picked at random). A pixel at distance r from the hole then
+  shows what was at sqrt(r^2 + F), F growing from 0 to the square of the
+  distance to the farthest corner by 3.4 s. That is free fall with a speed
+  proportional to 1/r (the radial part of a drain), integrated: r^2 falls
+  linearly in time, so the sky barely stirs far out and rushes near the
+  hole. The turn is a fixed part of a turn per doubling of the distance
+  fallen from (angular momentum kept: the azimuthal speed also goes as 1/r,
+  and its integral is a logarithm), eased off further out so the edges of
+  the picture do not visibly rotate. Past the screen's edges the sky is
+  mirrored, so stars keep arriving and no edge is seen falling in.
+- **Why it brightens.** Light that has been crowded in is drawn brighter
+  (up to four times, warmer as it brightens), so the inner spiral glows as
+  the matter arrives: the disk is made of the picture. On top of it a smooth
+  disk is added by distance from the shadow: dark inside 1.15 shadow radii
+  (the gap between a black hole's photon ring and the inner edge of its
+  disk), brightest at 1.5, dying away by 3.3, warm white at the inner edge
+  (255, 222, 180) through gold (255, 212, 150) to the blue of the sky's own
+  glow (150, 170, 255), brighter on the side turning toward the eye (the
+  Doppler beaming every picture of an accretion disk shows), with a thin
+  bright photon ring at 1.06 shadow radii.
+- **How it ends.** From the disk's height (2.8 s) the picture's light is let
+  go, quickly at first and gently at the end (1 - (1 - t)^3), the edges of the
+  screen ahead of the middle; the disk dims from 3.1 to 3.9 s while the shadow
+  grows over it; at 4.2 s every pixel is black and nothing moves. Waking is
+  the plain 0.9 s dawn: the sky returns, there is no spectacle in reverse.
+
+The lens machinery of the startup's merging holes (`lens_at()`) bends the
+light round the shadow as before. Everything is integer: distances come
+from 2^(log2(r^2) / 2) with the existing log table and a 256-entry table of
+2^(k/256), so no square root is taken per pixel. The whole screen moves in
+every frame of the dusk; near the hole every pixel is worked out, further
+out two at a time each way. Receipts: the host window test
+(`scripts/ck_allen_ui_test.sh`) renders six frames through the dusk and the
+closed horizon (`target/native-kernel-allen-ui/allen-8-horizon-*.png`),
+checks that after the disk's height the light only falls, that the middle
+is brighter than the edges mid-dusk and that the last frame is pure black,
+and prints the dusk's own frame times next to the whole run's (the numbers
+of the run that landed this are in the branch's handoff).
+
+## 4. The water: Stam's stable fluids
+
+Jos Stam, "Stable Fluids", *SIGGRAPH 99*, pp. 121 to 128, and "Real-Time
+Fluid Dynamics for Games", Game Developers Conference, March 2003. The 2003
+paper gives the whole solver in about a page of C: `add_source`, `diffuse`
+(Gauss-Seidel relaxation, unconditionally stable), `advect` (semi-Lagrangian:
+trace each cell's centre back along the velocity and sample), `project`
+(a Poisson solve for pressure, subtracted so the field is divergence-free),
+with `set_bnd` for the walls, and the velocity step
+diffuse, project, advect, project, then the density step diffuse, advect.
+
+`ui/flow.c` is that solver in 16.16 fixed point (the kernel has no floating
+point in the drawing path), on a 64 by 36 grid with a one-cell border, ten
+relaxation sweeps, stepped every 16 ms with catch-up and a cap of eight
+steps per frame. Three things are ours, not Stam's: the forces (an idle
+turn with a breath, a thinking vortex that deepens over four seconds, a
+listening current from the bar up to Allen, rings when words come), the ink
+sources (a trickle from the heart, a ring round him while he thinks, motes
+from nowhere so the water is never empty), and the colour (cool blue to warm
+white by local speed). Receipts: the host window test
+(`scripts/ck_allen_ui_test.sh`) prints the frame times; with the water, one
+host core draws a 3840 by 2160 frame in 17.7 ms on average against 9.2 ms
+without it (run of 2026-10-18, 3912 frames). The kernel draws with three
+cores in strips.
+
+## 5. Allen and the far-off worker
+
+Allen does not become a language model. He stays what he is on this
+computer (greetings, memory, notes, facts, by heart) and, when a line is
+beyond him and a courier is ready, he writes the job himself
+(`svc/allen_intent.c`): what is wanted (make, explain, do, chat), who he is,
+who asked, and the shape the answer must take, then keeps thinking (the
+vortex deepens) until the answer comes back and he says it. The worker never
+speaks to the person; Allen does. The courier is a line each way on a wire
+(`svc/courier.h`); the first wire is the second serial port
+(`x86/courier_x86.c`, PC16550D datasheet: LSR bit 0 Data Ready, bit 5 THRE),
+relayed on the host by `crates/allen-courier` (standard library only) to a
+chat server. Ethernet follows once the card may receive (aienos#411).
+
+This is the prompting Allen was taught: not a template he fills, but the
+three parts of a good instruction, which the sources above also point at.
+Say who is speaking and to whom (Austin's convention), say the shape of the
+act wanted (Gollwitzer's "when X, do Y"), and keep the periphery quiet
+(Weiser and Brown): short sentences, no lists, no headings, in his voice.
+
+## Sources
+
+- Austin, J. L. *How to Do Things with Words*. Oxford University Press, 1962
+  (Lectures I and II).
+- Gollwitzer, P. M. "Implementation intentions: Strong effects of simple
+  plans." *American Psychologist* 54(7), 1999, 493 to 503.
+- Gollwitzer, P. M. and Sheeran, P. "Implementation intentions and goal
+  achievement: A meta-analysis of effects and processes." *Advances in
+  Experimental Social Psychology* 38, 2006, 69 to 119.
+- Loyd, S. *Cyclopedia of Puzzles*. 1914, p. 301.
+- Weisberg, R. W. and Alba, J. W. "An examination of the alleged role of
+  'fixation' in the solution of several 'insight' problems." *Journal of
+  Experimental Psychology: General* 110(2), 1981, 169 to 192.
+- Weiser, M. and Brown, J. S. "The Coming Age of Calm Technology." Xerox
+  PARC, 1996.
+- Stam, J. "Stable Fluids." *SIGGRAPH 99*, 121 to 128.
+- Stam, J. "Real-Time Fluid Dynamics for Games." GDC 2003.
+- National Semiconductor, *PC16550D Universal Asynchronous
+  Receiver/Transmitter with FIFOs*, Table II and section 8.5 (recorded with
+  `docs-read` on 2026-10-18).
diff --git a/docs/ALLEN_SKY_SCIENCE.md b/docs/ALLEN_SKY_SCIENCE.md
new file mode 100644
index 00000000..5900b3be
--- /dev/null
+++ b/docs/ALLEN_SKY_SCIENCE.md
@@ -0,0 +1,390 @@
+# Allen's sky and sound: the science audit
+
+Owner's rule (Drake, 2026-10-19): the whole idea of this system is grounded in
+real astrophysics. The merger sound is there because it is real. The sky behind
+Allen must be the real sky, not an invented one.
+
+This note says, for every picture and sound in Allen's startup, what is real,
+what is a simplification, and what is only an illustration. Every number comes
+from a source that is named, or from a measurement that is in `evidence/real-sky/`.
+Where a source says nothing, that is said too. The code is in
+`native/kernel/ui/` (`night.c`, `sky_real.c`, `sky_data.c`, `chirp.c`).
+
+Words: "design pixel" is one pixel of a 1920 wide screen; the picture scales
+from there. V is the visual magnitude of a star (smaller is brighter, 6.5 is
+about the faintest star a person sees on a dark night). B-V is a star's colour
+number (smaller is bluer).
+
+## 1. The verdict, one line each
+
+| Part | Verdict |
+|---|---|
+| Stars (9096 in the catalogue, 8404 to V 6.5) | Real: position, brightness, colour. Limits in section 3. |
+| Milky Way | Real: Gaia DR3 G, BP and RP flux per HEALPix level-7 cell, moved to V with each cell's own colour, on the physical scale with no anchor or gain. Brightest band V 20.17 mag/arcsec2 against the published 20.7 (Leinert et al. 1998), section 3. |
+| Dark sky glow | Real: V 22.0 mag/arcsec2, the published dark-site sky (Leinert et al. 1998). Not boosted. |
+| Large and Small Magellanic Clouds | Real: true place, size and tilt (OpenNGC); their light is Gaia DR3's resolved stars raised to the catalogue total V (LMC 0.29, SMC 2.30), section 3. Visible: centre 2.0 (LMC) and 1.8 (SMC) times the surrounding sky. |
+| The view | Real: a pinhole-camera projection centred on GW150914's most probable sky position. |
+| Starlight bent by the black holes | Real physics (point-mass lens), with one invented edge and one invented scale (section 4). |
+| Black hole shadows and the thin ring | Real size rule (shadow radius sqrt(27)/2 Rs), drawn as a simple disc and ring. |
+| Orbit and spiral | Real law (separation as t^(1/4), angle as t^(5/8)), with time compressed and the number of turns cut (section 4). |
+| Merger and the new, larger hole | Right to within 5 percent (section 4). |
+| The ripple across the sky | Illustration only. A real wave cannot be seen. |
+| Ringing of the final hole | Illustration, wrong timescale (section 4). |
+| The startup sound | The law for the pitch is real. The sweep, the cycle count and the ring are not the real signal (section 5). |
+| Galaxies' sweeping light, twinkle, Allen's mind, the water | Art, not physics (section 6). |
+
+## 2. Sources
+
+| Input | What it gives | Licence and credit |
+|---|---|---|
+| Yale Bright Star Catalogue, 5th revised ed. (Hoffleit and Warren 1991), CDS V/50 | 9096 stars with J2000 position, proper motion, V, B-V | The CDS ReadMe carries no licence or copyright line. Credit: Hoffleit and Warren 1991, via CDS Strasbourg. |
+| Gaia DR3 `gaia_source`, query 1 below (ESA/Gaia/DPAC) | Source count and summed G, BP, RP mean flux of every source with G > 7, per HEALPix level-7 cell (nside 128, 196608 cells) | CC BY-NC 3.0 IGO. Credit: ESA/Gaia/DPAC. Pinned sha256 in `scripts/ck_sky_gen.sh`. |
+| Gaia DR3 `astrophysical_parameters`, query 2 below | Mean G-band extinction `ag_gspphot` per the same level-7 cells (the dust) | CC BY-NC 3.0 IGO. Credit: ESA/Gaia/DPAC. |
+| Leinert et al. 1998 (A&AS 127, 1), as quoted in arXiv:2401.15518 (Bochum V 20.7 at the bright Milky Way) and arXiv:2604.09427 (dark-sky reference V 22) | The dark sky (V 22, the one brightness the display is tied to) and the bright Milky Way (V 20.7, now an independent check of the Gaia scale) | Cited only: published numbers, no data copied. |
+| Gaia DR3 documentation (ESA/Gaia/DPAC), chapter 5: section 5.4.1 Table 5.4 (zero points G 25.6874, BP 25.3385, RP 24.7479), https://gea.esac.esa.int/archive/documentation/GDR3/Data_processing/chap_cu5pho/cu5pho_sec_photProc/cu5pho_ssec_photCal.html ; Table 5.9 (G - V from BP - RP), https://gea.esac.esa.int/archive/documentation/GDR3/Data_processing/chap_cu5pho/cu5pho_sec_photSystem/cu5pho_ssec_photRelations.html | Gaia flux to V surface brightness, per cell | Cited only: published constants. |
+| OpenNGC (Mattia Verga), pinned to commit be3cd6c | Galaxy positions, sizes, tilt angles, and the integrated V that sets the Magellanic Clouds' total light | CC BY-SA 4.0. Credit: Mattia Verga. Only two galaxies (their positions, sizes and magnitudes, which are facts) reach the tables. The ShareAlike term against this repository's licence (AGPL-3.0-or-later) is for the desk to clear. |
+| GWTC-1 sky map of GW150914, LIGO-P1800381-v7 | Where on the sky the signal came from (HEALPix probability map) | Released by LIGO and Virgo through the LIGO Document Control Center. Credit: LIGO Scientific Collaboration and Virgo Collaboration. |
+| Abbott et al., PRL 116, 061102 (2016) | The published numbers the audit measures against | Cited only. |
+
+Why Gaia DR3 for the Milky Way: it is the only measured, whole-sky, optical
+source-count and flux data at hand, and the owner's direction (2026-10-19) is
+to compute the Milky Way from measured data. CC BY-NC 3.0 IGO allows
+non-commercial use with credit (ESA/Gaia/DPAC); this project is non-commercial
+(AGPL-3.0-or-later). Tables are compiled in, so a commercial use would need
+ESA's agreement, noted for the desk.
+
+**The two Gaia queries (run on 2026-10-19 against https://gea.esac.esa.int/tap-server/tap/async, ADQL).**
+Level 7 is run in four HEALPix ranges of 49152 cells each (the TAP service returns at most about
+50000 rows per job), the four results joined with one header. The script does this when it is
+asked for level 7 (`SKY_HPX_LEVEL`, default 7) and fetches any chunk that is missing.
+
+Query 1 (flux per cell), chunk c of 4 covers cells (c-1) x 49152 to c x 49152 - 1, output
+`gaia_hpx7_flux_c.csv`; the joined table `gaia_hpx7.csv` has sha256
+`4d1412d3df02f6ee34120b8fd9b96bde6766fcaf50c569a94b45b72d4ec151cd` (196608 rows):
+
+```sql
+SELECT GAIA_HEALPIX_INDEX(7, source_id) AS hpx7, COUNT(*) AS nsrc, SUM(phot_g_mean_flux) AS g_flux,
+       SUM(phot_bp_mean_flux) AS bp_flux, SUM(phot_rp_mean_flux) AS rp_flux
+FROM gaiadr3.gaia_source
+WHERE phot_g_mean_flux IS NOT NULL AND phot_g_mean_mag > 7.0
+  AND GAIA_HEALPIX_INDEX(7, source_id) BETWEEN LO AND HI
+GROUP BY hpx7 ORDER BY hpx7
+```
+
+Query 2 (dust per cell), the same four chunks, output `gaia_dust7.csv`, sha256
+`ce46146f06fa33791d81cde3f02f19a7ac259e5555b13c03cdb8092e75174d89`:
+
+```sql
+SELECT GAIA_HEALPIX_INDEX(7, source_id) AS hpx7, AVG(ag_gspphot) AS mean_ag, COUNT(*) AS n
+FROM gaiadr3.astrophysical_parameters
+WHERE ag_gspphot IS NOT NULL
+  AND GAIA_HEALPIX_INDEX(7, source_id) BETWEEN LO AND HI
+GROUP BY hpx7 ORDER BY hpx7
+```
+
+Level 6 (49152 cells, the earlier build) is still in the script (`SKY_HPX_LEVEL=6`, sha256
+`334bde2b...` and `105f8f51...`). Each sha256 is of the CSV the TAP service returned (the joined
+file for level 7); the script refuses any other file.
+
+Each input is downloaded once by `scripts/ck_sky_gen.sh`, checked against a
+sha256 written in the script (a file that does not match is refused), and
+turned into tables by `native/kernel/tools/ck_sky_gen.c` (plain C, no Python).
+The kernel never touches the network: the tables are compiled in.
+`native/kernel/ui/sky_data.txt` is the generator's report from the last run.
+
+## 3. The sky
+
+**The view.** A gnomonic projection (what a pinhole camera sees), 80 degrees of
+sky across the screen's width, north up, centred where the GW150914 sky map is
+most probable. That point is the highest-probability pixel of the map (HEALPix
+nside 512): right ascension 113.697, declination -72.757 degrees, in the
+constellation Volans near Carina. In galactic coordinates it is l 284.54, b
+-22.70. The map's 90 percent region is 181.6 square degrees, all of it on a
+3840 x 2160 screen. The centre is the map's peak, not a point source: the real
+signal could have come from anywhere in that region. The Large Magellanic Cloud
+is inside it.
+
+**Stars.** Position is the catalogue's J2000 position moved along its proper
+motion to epoch 2026.8. Brightness: light from a star is proportional to
+10^(-0.4 V), the definition of the magnitude scale. Colour: B-V goes to an
+effective temperature by Ballesteros (2012, EPL 97, 34008), that temperature to
+the colour of a black body through the CIE 1931 observer (Wyman, Sloan and
+Shirley 2013, fit), then to sRGB. Checks the generator prints: B-V -0.30 is
+16602 K and sRGB (177, 198, 255); B-V 0.65 is 5778 K (the Sun's) and (255, 241,
+234); B-V 1.50 is 3794 K and (255, 207, 155). 310 catalogue stars have no B-V
+and are drawn at 0.6, close to the Sun's. On a 3840 x 2160 screen the view holds
+71 stars to V 4, 179 to V 5, 560 to V 6, 904 to V 6.5.
+
+Limits, stated plainly:
+- No star fainter than V 6.5 is drawn one by one. The faint ones are inside the
+  Milky Way light (below).
+- Stars are points drawn with a small core (1.2 design pixel). A real star is
+  smaller than any screen can show; a bright one looks bigger only because of
+  the eye or the camera. The drawn size is a display choice, not a measurement.
+- A screen cannot show the real brightness range (a magnitude 0 star is about
+  250 times brighter than V 6.0). The display level for V 6.5 is a chosen
+  constant (0.06 linear, sRGB level 69) and everything else follows from the
+  magnitude law. Bright stars therefore clip at the top.
+- No atmosphere: no extinction near the horizon, no airglow colour, no moon.
+  (The faint sky glow of an extremely dark site is added, section below.)
+
+**Milky Way.** The light is Gaia DR3's own: for each of the 196608 HEALPix level-7 cells
+(about 0.46 degree across), the summed G-band flux of the stars in it (stars with G > 7).
+That is light, not a photograph. The cells are splatted onto a full-sphere 360 x 180 grid
+(1 degree, north up) within 1.5 degrees of each cell's centre and averaged.
+
+Colour and luminance are kept apart. A cell's light is split between the red, green and blue
+channels by a tint from its BP-RP colour (reddened by the mean G-band extinction,
+`ag_gspphot`, E(B-V) = A_G / 2.285, Cardelli et al. 1989), with the channel weights chosen so
+that their luminance (0.2126 R + 0.7152 G + 0.0722 B) is exactly the cell's light. The first build
+put almost all of the light into the red channel, so the band was about a third of its
+true luminance. That is corrected.
+
+Scale: physical, with no anchor (since 9ab1281 / 176bc51). The number is Gaia's own measured light:
+
+- A cell's summed G flux F (electrons per second) over its area A (arcsec2) is a surface brightness,
+  G = 25.6874 - 2.5 log10(F / A) mag/arcsec2 (the DR3 G zero point; Gaia DR3 documentation, section
+  5.4.1, Table 5.4). 1 S10 (the light of a V 10 star per square degree) is V 27.78 mag/arcsec2.
+- G is not V. Each cell is moved to Johnson V with its own integrated colour, BP - RP from its summed
+  BP and RP fluxes and the DR3 zero points (BP 25.3385, RP 24.7479, same table), through
+  G - V = -0.02704 + 0.01424 c - 0.2156 c^2 + 0.01426 c^3, c = BP - RP, valid -0.5 to 5, scatter
+  0.03 mag (Gaia DR3 documentation, chapter 5, relationships with other photometric systems,
+  Table 5.9). For the reddened bulge (c about 2) G - V is -0.75: taking G as V made the brightest band
+  0.6 magnitude too bright (V 19.69 in G against 20.31 in V, both at the old 1.5 degree splat).
+- Result (`native/kernel/ui/sky_data.txt`): the brightest band is **V 20.17 mag/arcsec2 (1111 S10)**.
+  The published Bochum value is V 20.7 (Leinert et al. 1998; arXiv:2401.15518, Table 3). The two are
+  independent: Leinert's number is now a check, not the scale. Gaia is 0.5 magnitude brighter here
+  (UNVERIFIED cause; Bochum's beam and the bulge's patchy dust differ from a 0.75 degree average).
+- The dark sky's own glow is V 22.0 mag/arcsec2 (205 S10; Leinert et al. 1998, also the reference
+  V 22 of arXiv:2604.09427). It is added everywhere, with no gain. Brightest band over the dark sky:
+  5.42 (luminance).
+- The gain (`SKY_GAIN` / `--gain`) is 1.0 and stays 1.0: it exists only for a deliberate test. The
+  earlier gain 1.2 (tied to a 678 S10 anchor and measured with the old inverse projection, which was
+  off by a factor of two, see below) is retired; its table is in `evidence/real-sky/gain-measure.txt`
+  as history.
+- Each grid point (1 degree) averages the level-7 cells within 0.75 degree (about 8 cells). It was 1.5
+  degree, sized for level 6; that smeared the Small Magellanic Cloud over a 3 degree disk.
+
+**The screen-to-sky step (fixed at 9ab1281).** `sky_real.c` turns each screen point back into a sky
+direction to read the grid. The forward projection puts a tangent-plane offset u at u / tan(fov/2)
+half-widths; the inverse used half that, so the grid was read from points twice as far from the view
+centre as the pixel. The Milky Way and the Clouds were drawn in the wrong places. The sky test now
+catches it (below): with the old step both Clouds read 0.95 to 0.99 times their surround.
+
+**Galaxies.** Brighter than V 6.5 and in the view, OpenNGC has two: the Large
+Magellanic Cloud (ESO056-115, V 0.29, 646 x 550 arcminutes, position angle 170)
+and the Small Magellanic Cloud (NGC0292, V 2.30, 300 x 180 arcminutes, position
+angle 45). They are placed at their true centre, size and tilt. On a 3840 wide
+screen the LMC's half axes are 219 x 191 px, the SMC's 112 x 74. Their outlines only carry the
+gravitational-wave shimmer; their steady light is in the Milky Way grid:
+
+**The Magellanic Clouds' light (real, from two catalogues).** Gaia sees each Cloud's brightest stars
+(the LMC is about 50 kpc away, so Gaia's G 20.7 limit reaches absolute G about +2) but not the faint,
+crowded rest. The generator (`gaia_clouds` in `ck_sky_gen.c`), for each catalogue galaxy at least 2
+degrees long:
+
+1. takes the Gaia cells inside its OpenNGC ellipse (the D25 isophote);
+2. takes the local sky as the median cell between 1.2 and 1.6 ellipse radii (Milky Way foreground);
+3. sums the light above that sky: the resolved part;
+4. compares it with the catalogue's integrated V and adds the missing part in the pattern of the
+   resolved stars (each cell's excess times total / resolved), so the total inside the ellipse is the
+   catalogue's and the shape is Gaia's.
+
+| galaxy | Gaia cells | local sky (S10) | Gaia resolves | catalogue V | share | centre before, after (V mag/arcsec2) |
+|---|---|---|---|---|---|---|
+| LMC (ESO056-115) | 372 | 48.7 | V 0.83 | 0.29 | 61% | 21.58, 21.11 |
+| SMC (NGC0292) | 55 | 42.2 | V 2.78 | 2.30 | 64% | 21.64, 21.22 |
+| M31 (NGC0224) | | | V 6.53 | 3.44 | 5.8% | not added (under 25%: too few stars to carry the shape) |
+
+"Centre" is the inner fifth of the ellipse, the light added to the dark sky's V 22.0. A physical check
+from the catalogue alone: V 0.29 over the LMC's ellipse (1.0e9 arcsec2) is a mean of V 22.8
+mag/arcsec2; an exponential disk is several times brighter at its centre than its mean, which puts
+the centre near V 21, as found.
+
+On screen (`scripts/ck_sky_test.sh`, check "galaxy N glows at its place": median linear luminance
+inside 0.3 of the short half axis over the median of a ring at 1.3 to 1.6 long half axes; the stars
+do not move a median): **LMC 1.99, SMC 1.81** times the surround (bar 1.5). With the old screen-to-sky
+step: 0.99 and 0.95. Limits: Gaia's crowding limit thins the LMC bar's stars, so the true centre is
+somewhat more concentrated than drawn (UNVERIFIED how much); the grid is 1 degree, so the bar and
+30 Doradus are not resolved.
+
+**The sky above you (wired).** `sky_real.c` holds Greenwich mean sidereal time (IAU 1982),
+the zenith for a latitude and longitude, and the 1976 IAU precession back to J2000
+(`ui/tests/sky_test.c` checks them against published values). Allen takes a place in two ways:
+
+- a town name from a table of 20 (`memphis`, `chicago`, ...), as before;
+- coordinates typed as: `35 north 90 west`, `35.1 n, 90.0 w`, `35.1, -90.0`, `lat 35.1 lon -90`,
+  `-33.87 151.21`, `north 35 west 90`. The parser reads the raw line (the folded one has lost the
+  points and minus signs), in integer arithmetic, in millionths of a degree. A bare pair of numbers,
+  arithmetic, a name, or a number with an operator is not a place. Tested in
+  `native/kernel/svc/tests/allen_place_test.c` (26 checks, run by `scripts/ck_allen_ui_test.sh`).
+
+"sky above me" then shows the sky over that place, turning at Earth's rate (the screen
+refreshes every 10 seconds, `allen_ui.c`). Coordinates set the place only; the mode is unchanged.
+
+## 4. The black holes and the picture of the merger
+
+Measured by `ui/tests/chirp_audit.c`, output in `evidence/real-sky/chirp-audit.txt`.
+Published values used: source-frame masses 36 and 29 solar masses, final mass 62,
+final spin 0.67, redshift 0.09, luminosity distance 410 Mpc (Abbott et al. 2016,
+PRL 116, 061102, table I; abstract).
+
+**Bent light (real physics).** A point mass moves the image of a star seen at
+angle theta from it, to where the star really is, beta = theta - E^2/theta. The
+code does exactly that (`warp()` in `night.c`), with the pull of both holes
+added. Two weak points, both ours:
+- The pull is eased to zero between 2.2 E and 4.4 E so the bent region has no
+  edge. The real pull has no edge: it falls as 1/theta and never stops. What the
+  picture leaves out is 27.3 design px at 2.2 E and 13.6 px at 4.4 E (E is 60 px).
+  Far from the holes the sky is not bent here and would be, slightly.
+- The scale. A hole's shadow has radius sqrt(27)/2 = 2.598 Rs (Rs is the
+  Schwarzschild radius, 2GM/c^2). The Einstein radius for a far-away source is
+  sqrt(2 Rs / D) in angle against the shadow's 2.598 Rs / D, for a viewer at
+  distance D. The picture's ratio of Einstein radius to shadow radius is 3.00
+  (60 over 20 px). That is exactly what a viewer 30.4 Rs from the hole sees:
+  3229 km from a 36 solar mass hole. It is a consistent picture, but of a viewer
+  who could not survive there. It is a chosen viewpoint, close enough to make
+  the arcs big.
+- Superposing two single-hole pulls is accurate only when the pull is weak. Near
+  a hole the picture draws the shadow and a thin bright ring at 1.04 of its
+  radius, as a simple disc and a ring. Real strong lensing has a photon ring and
+  an infinite stack of thinner copies of the sky. Not drawn.
+
+**Orbit and spiral (real law, compressed).** Separation as t^(1/4), angle as
+t^(5/8), t the time left (leading-order inspiral, Peters 1964; Abbott et al.
+2016). The picture's wide orbit is 270 design px, which with 1 Rs = 7.70 px is
+35.1 Rs of a single hole, or 35.1 GM/c^2 of the pair. Physics there: orbital
+period 0.46 s, gravitational-wave pitch 4.4 Hz, 42 s to the merger, about 150
+turns. The picture: one orbit per 5.2 s (11.4 times slower at the start), 6 s
+to the merger (7 times faster in total), 1.85 turns. So the law is real, the
+clock is not. The orbit is drawn leaning 60 degrees away from face on (its
+height is half its width).
+
+**Merger.** Equal masses are drawn; the real ones are 36 and 29 (ratio 0.8, close
+enough for a picture, but a real unequal pair is lopsided). The final hole is
+drawn with a shadow 2.00 times each initial one; the published masses give
+62 over 32.5 = 1.91, so the picture is 4.8 percent big. Its Einstein radius grows
+1.414 times (square root of 2) where the square root of 1.91 is 1.381, the same
+gap. The real remnant spins at 0.67, which squashes and shifts its shadow;
+the picture draws a round, unspun one.
+
+**The ripple across the sky (illustration).** The wave from GW150914 stretches
+space by about 10^-21 (peak strain 1.0e-21), a shift that no eye or telescope
+could see, and it does not move the stars across the sky. The picture draws a
+ring of stretch and squeeze with a cos 2 theta pattern, which is the true
+shape of a gravitational wave's effect on a ring of free particles, at a size
+about 20 orders of magnitude too large, running out from the merger over 3.6 s
+as if the wave were visible light crossing the screen. It stays because it makes
+the idea visible. It should be called an illustration wherever it is shown.
+
+**Ringing (illustration, wrong timescale).** The real final hole rings in its
+least damped mode at 250 Hz (Berti, Cardoso and Will 2006 fit with mass 62
+(detector frame 67.6), spin 0.67; matches the published 250 Hz top of the sweep)
+with a quality factor of 3.17, which is a damping time of 4.0 ms: gone in about
+two cycles. The picture's shadow wobbles with a 95 ms period and a 260 ms decay time: 2.7
+cycles per decay time where the real one has 1. A real ringdown is too quick to
+see at all; the picture slows the period 24 times and the decay 65 times. Shown as a wobble for the same
+reason as the ripple.
+
+## 5. The startup sound
+
+`ui/chirp.c`, a "blirp" under a second, built from a formula and no recording.
+
+Real: the pitch of an inspiral rises as (time left)^(-3/8) and the strength of
+the wave as pitch^(2/3). The code uses exactly those, and the peak is at the
+merger.
+
+Measured against the real signal (`evidence/real-sky/chirp-audit.txt`):
+
+| | Published and physics | The kernel's sound |
+|---|---|---|
+| Pitch at the start | 35 Hz | 200 Hz (5.7 times higher) |
+| Pitch at the top | about 250 Hz | 1000 Hz (4.0 times higher) |
+| Sweep length | about 0.2 s (0.16 s by the leading-order law) | 0.59 s (3 times longer) |
+| Cycles | about 8 from 35 to 150 Hz (8.4 by the law) | 179 |
+| Ring after the merger | 250 Hz, gone in 4.0 ms | 1000 Hz held, 30.0 ms time constant |
+
+The sound is therefore the right kind of curve with invented numbers: higher
+(raised into hearing, but by 5.7 at the start and 4.0 at the top, not one
+factor), longer, with about twenty times the cycles, and a ring that is held at
+the peak pitch for far longer than the real one lasts. A single factor
+would be a real thing: a gravitational-wave signal scales exactly with
+the total mass, so a lighter pair would give higher pitch and a shorter
+chirp. The kernel's sound is not any one pair's.
+
+What a real version would be: the signal as it is, 35 up to 250 Hz over about
+0.2 s with its eight cycles, then a 250 Hz ring dying in 4 ms. It is audible
+(it is what LIGO's own audio of the event plays), but it is low and short,
+and small speakers do not reproduce 35 Hz. That choice, real and quiet against
+louder and invented, is Drake's. Work for it is a separate branch, `feat/real-chirp`.
+
+## 6. Everything else on the screen
+
+- **Twinkle.** The brightest stars (V 2.0 and brighter) twinkle. Twinkling
+  (scintillation) is the atmosphere, so this is correct for an observer on the
+  ground and wrong for one in space. It is the observer the sky already implies.
+- **The sweeping band of light on the galaxies** while Allen answers: art.
+  The galaxies themselves do not change.
+- **Allen's mind** (the sphere of points and threads), **the water**, **the
+  orb**: art. They make no claim about the real world and say nothing about it.
+- **The fade in** (the eyes adjusting to the dark, bright stars first): real in
+  kind (the eye does adapt over minutes, rods take about half an hour), shown in
+  seven seconds.
+
+## 7. For the black-hole dusk (goodbye)
+
+Notes for the branch `feat/goodbye-event-horizon`, so its picture can follow the
+same rules (the physics, all standard results for a non-spinning hole):
+- Shadow radius sqrt(27)/2 Rs = 2.598 Rs. The photon ring is the shadow's edge,
+  at the light's critical orbit of 1.5 Rs.
+- The innermost stable circular orbit is 3 Rs (6 GM/c^2), the inner edge of a
+  thin disc.
+- The disc's temperature falls with radius as r^(-3/4) (Shakura and Sunyaev
+  1973), times (1 - sqrt(r_in/r))^(1/4) near the inner edge. A hot inner disc is
+  blue-white, the outer redder. That temperature maps to colour with the same
+  black body chain used for stars here (`blackbody_rgb`).
+- Doppler beaming: the side of the disc turning towards the viewer is brighter.
+  Intensity scales as delta^3 at one frequency and delta^4 over all, delta being
+  the Doppler factor (Rybicki and Lightman).
+- Light from the far side of the disc is bent over the top of the hole and
+  seen above the shadow. Real pictures show this.
+Only the first two are in the picture here; the rest are for the dusk.
+
+## 8. What this change measured
+
+Sizes, timings and pictures are in `evidence/real-sky/README.md`. On one core of the Spark (not the iMac):
+
+- The generated table `sky_data.c` is 452276 bytes at level 7 and at level 6 (the grid is the same
+  1-degree grid; only the values differ). The tables in the image are 64980 bytes of luma and 32580
+  of colour, as before.
+- The whole sky at 3840 x 2160 is made in 122 to 140 ms (`ck_night_init`, best of 3 per run; four
+  runs at level 6 gave 135 to 136 ms, four at level 7 gave 109 to 140 ms). The ranges overlap: no
+  timing difference between the levels can be claimed. The machine was shared with other jobs.
+- Level 6 against level 7: same table size and the same timing within noise, so the level is chosen
+  by the input. Level 7 uses all 196608 Gaia cells (the level-6 build used 49152). Its table differs
+  from level 6 in 945 of its 5610 lines. The Galactic-centre luminance ratio is the same to two
+  decimals (3.23 at gain 1.2, the retired anchored build).
+- `IMACKERN.EFI` is 405504 bytes, built by `make -C native/kernel imac-kernel` at `176bc51` (and at `4221f12`, the earlier code
+  commit; the docs commit after it changes no code). The earlier real-sky figure was 348160.
+- Host checks (at 176bc51): the sky test 15 of 15 pass (`ck_sky_test.sh`, two new checks: each Cloud glows at its place); the Allen window test and its picture
+  checks, the Allen place test (26 checks) and the Allen memory test are in
+  `evidence/real-sky/README.md`. Not run: the full `make -C native/kernel test` suite and the QEMU
+  tests; those were not run in this change.
+- Nothing here was measured on the iMac.
+
+## 9. Open
+
+- The Clouds' centres are drawn in the pattern of the stars Gaia resolves; crowding thins the LMC bar, so
+  the true centre is more concentrated (not measured). M31 has no steady light (Gaia resolves 5.8%).
+- The Milky Way's brightest band from Gaia (V 20.17) is 0.5 magnitude brighter than Bochum's 20.7; the
+  cause is not established.
+- The level-7 grid is still 1 degree. A 0.5-degree grid would use the cells in full; it doubles the table
+  (about 260 KB more) and has not been measured.
+- The on-screen ratios (Clouds over surround) are measured on the host's sRGB path (8 bits, gamma). The
+  iMac's panel may differ; they are measured again on the iMac when a frame can be read there.
+- The flight through nearby stars is a plan (`docs/SKY_FLIGHT_PLAN.md`), not code.
+- Gaia DR3 is CC BY-NC 3.0 IGO; the repository is AGPL-3.0-or-later. The desk to confirm the use.
+- The real chirp (section 5): a decision for Drake.
+- The OpenNGC ShareAlike term against the repository licence.
+- The ripple and the ringing should carry an "illustration" label wherever shown to the public.
+- The sky was checked on a host, not on the iMac's real screen.
diff --git a/docs/BOOT_EVERYWHERE.md b/docs/BOOT_EVERYWHERE.md
new file mode 100644
index 00000000..e87b7e15
--- /dev/null
+++ b/docs/BOOT_EVERYWHERE.md
@@ -0,0 +1,142 @@
+# The boot sequence everywhere (L266)
+
+What a person sees and hears when AienOS starts, on every machine: the night sky, two black holes circling and
+merging, a short rising chirp at the merger, then Allen. One module, the same timing, the same sound. This page
+says where it runs today, how fast, and what is still missing. Every number carries its command and exit code;
+claims are tagged OBSERVED (seen in a run), INFERRED (follows from code or a run, not seen directly) or UNKNOWN.
+
+## 1. One module
+
+| Part | File | Source |
+|---|---|---|
+| The night (stars, Milky Way, galaxies, the two black holes, the ripple) | `native/kernel/ui/night.c` | byte-identical to the iMac build `0930240` |
+| Allen's home on the screen (draws the night, then Allen) | `native/kernel/ui/allen_ui.c`, `mind.c`, `paint.c`, `allen_font.c` | same |
+| The chirp | `native/kernel/ui/chirp.c` | same |
+| Frame receipt and the night's clock for the sound | `native/kernel/ui/boot_show.c` | new (L266) |
+| aarch64 runner (Spark, Pi 5, the aarch64 VM) | `native/kernel/core/boot_screen.c` | new |
+| x86 runner (iMac, PC, the x86 VM) | `native/kernel/x86/boot_x86.c` | new |
+| VM screen (virtio-gpu 2D) | `native/kernel/dev/virtio_gpu.c` | new |
+| VM speakers (virtio-sound) | `native/kernel/dev/virtio_snd.c` | new, shared by both kernels |
+| Request core and the aarch64 PCI binding | `native/kernel/dev/virtio_q.c`, `virtio_bind.c` | new |
+
+Timing lives in two headers and nowhere else: `night.h` (`CK_NIGHT_*`: stars out by 6.8 s, holes at 2.6 s,
+spiral from 6.0 s, merger at 12.0 s, gone at 15.2 s) and `chirp.h` (`CK_CHIRP_*`: 600 ms sweep from 200 Hz to
+1000 Hz ending at the merger, 300 ms ring).
+
+**The sound file and its licence.** There is no sound file. The chirp is computed at boot from the shape of a
+real gravitational-wave chirp (pitch rising as t^(-3/8), loudness as pitch^(2/3)), integer math, in
+`ui/chirp.c`. No recorded audio and no third-party material: its licence is this repository's. The same
+formula runs on every machine, so every machine plays the same samples (checked below: the sound a VM played
+matches the formula sample for sample).
+
+**How every image builds it in.** The ui files are compiled into every full aarch64 image and, with
+`CK_BOOT_SHOW=1`, into the x86 image. The night plays when the image is built with `CK_BOOT_SHOW=1`:
+`make -C native/kernel full CK_BOOT_SHOW=1` (aarch64, `$(OUT)/full-boot-show/BOOTAA64.EFI`) and
+`make -C native/kernel imac-kernel CK_BOOT_SHOW=1` (x86, `$(OUT)/IMACKERN-BOOT-SHOW.EFI`). The default stays
+0 so the 32 emulator gates that use a screen keep their timing. The PC images (L260) and the aienos-run images
+(L261, L262, L265) should build with `CK_BOOT_SHOW=1` (ledger notes sent).
+
+**What the runner (aienos-run) must give the VM** so its window shows the real boot screen, not a web
+imitation:
+
+| | aarch64 VM | x86_64 VM |
+|---|---|---|
+| Screen | `-device virtio-gpu-pci,disable-legacy=on,iommu_platform=on` | `-device virtio-vga` |
+| Speakers | `-device virtio-sound-pci,audiodev=...,disable-legacy=on,iommu_platform=on` | `-device virtio-sound-pci,audiodev=...` |
+| IOMMU | `-M virt,iommu=smmuv3` (the kernel refuses device DMA it cannot confine) | none (that kernel has no IOMMU support yet; it says so) |
+| Window | QEMU's own display (`-display cocoa`/`gtk`/`sdl`) or VNC of that screen | same |
+
+A runner with its own virtual machine monitor (L262 KVM, L265 Virtualization.framework) needs a virtio-gpu and
+a virtio-sound device model with the same commands (section 3 lists exactly which).
+
+## 2. Measured
+
+How to read a receipt: the night lasts 15.2 s, which is 912 beats of a 60 Hz screen. A "dropped" beat is one
+where no new picture was ready. fps is frames drawn divided by 15.2 s.
+
+**Inside the VM (the aienos-run window).** `quiet-build bash scripts/qemu_ck_boot_show_test.sh <arch> <accel>`;
+kept files (serial log, mid-night screendump, captured WAV) in `target/boot-show/<arch>-<accel>/`.
+
+Three runs, each exit 0 and `AIENOS_CK_BOOT_SHOW: PASS` (OBSERVED, 2026-10-20, Spark, QEMU 8.2.2, 1280x800):
+
+| Image | Machine | Screen path | Frames in 15.2 s | Dropped of 912 | fps | Draw average | Slowest |
+|---|---|---|---|---|---|---|---|
+| aarch64 | virt, KVM (host speed) | virtio-gpu | 940 | 9 | 61.8 | 6.6 ms | 33.0 ms |
+| aarch64 | virt, TCG (every instruction emulated) | virtio-gpu | 419 | 501 | 27.5 | 33.2 ms | 257.2 ms |
+| x86_64 | q35 + OVMF, TCG | GOP framebuffer | 189 | 723 | 12.4 | 77.9 ms | 312.6 ms |
+
+Sound, same runs: the chirp starts at night 11.25 s (aarch64) and 11.31 s (x86_64); the virtio-sound device
+plays 11 to 12 periods of 100 ms with 0 starved and 0 refused, then stops cleanly. QEMU wrote what the guest
+played to a WAV file; 44936 of 44936 chirp frames are present, correlation with the host-made chirp 1.0000,
+largest sample difference 0 (all three runs). A mid-night screendump shows the sky drawn (0.30% of pixels lit,
+brightest 255).
+
+Reading it: with KVM the aarch64 image holds 60 Hz in the VM window. TCG emulates the CPU one instruction at a
+time, so its numbers say how slow emulation is, not how slow the code is; the x86_64 image can only run under TCG
+on this aarch64 host (no x86 KVM here), so x86_64 at 60 Hz in a VM is UNKNOWN until a run on an x86 host with
+WHPX, Hyper-V or KVM. The sound and picture are bit-identical in every run; only the pace differs. QEMU prints
+`audio: Could not create a backend for voice virtio-sound.in` in every run: the microphone side of the device has
+no backend in the gate, the playback side is the one measured, and nothing in the gate depends on capture.
+
+**The same drawing code on the Spark, no VM** (one core, real clock, memory instead of a screen):
+`BOOT_SHOW_SIZES="1280x800 1920x1080 3840x2160 5120x2880" quiet-build sh scripts/ck_boot_show_test.sh`,
+exit 0 (OBSERVED):
+
+| Screen | Frames | Dropped of 912 | fps | Draw average | Slowest |
+|---|---|---|---|---|---|
+| 1280x800 | 948 | 2 | 62.3 | 4.5 ms | 22.3 ms |
+| 1920x1080 | 947 | 3 | 62.3 | 5.8 ms | 15.6 ms |
+| 3840x2160 | 652 | 273 | 42.8 | 21.6 ms | 157.2 ms |
+| 5120x2880 | 422 | 490 | 27.7 | 35.1 ms | 97.0 ms |
+
+One Spark core keeps 60 Hz up to 1920x1080 and falls behind at 4K and 5K (OBSERVED). The VM runners cap the
+screen at 1920x1080 for that reason.
+
+**The iMac itself** (27-inch, 5K panel driven at 3840x2160, build `0930240`, the netboot report
+`imac-2d27001cbf587fae`, OBSERVED, not a run of this branch): "1126 frames by 20 s after Allen woke, average
+12.6 ms, slowest 46.8 ms (drawn by a secondary core)"; "the sky made in 476 ms (66 MiB drawing memory)"; the
+night on screen 15260 ms after power on. An average of 12.6 ms is inside one 60 Hz beat (16.7 ms), so on
+average the iMac holds 60 Hz at 3840x2160; the slowest frame (46.8 ms) missed about two beats (INFERRED from
+the report; that report does not count dropped beats, the receipt line on this branch does). The iMac
+splits each frame across its cores, the Spark fixture above uses one.
+
+UNKNOWN: the frame rate on the Spark's own screen, on a Pi 5 and on a PC; none has run this build yet.
+
+## 3. What the drivers use
+
+virtio-gpu (virtio 1.x 5.7): GET_DISPLAY_INFO, RESOURCE_CREATE_2D (B8G8R8X8), RESOURCE_ATTACH_BACKING (one
+entry), SET_SCANOUT, then per frame TRANSFER_TO_HOST_2D and RESOURCE_FLUSH of the whole picture. virtio-sound
+(5.14): PCM_INFO, PCM_SET_PARAMS (stereo, S16, 48 kHz, 100 ms periods, 400 ms buffer), PCM_PREPARE,
+PCM_START 150 ms before the chirp comes in, 100 ms transfers fed from the night's clock, PCM_STOP and
+PCM_RELEASE after 100 ms of quiet. Every command layout is checked against the virtio spec's Linux UAPI copy
+(`scripts/ck_virtio_av_test.sh`).
+
+## 4. The GPU path
+
+Today the night is drawn by the CPU: every pixel worked out from its position and the time, integer math,
+in strips (the iMac kernel splits a frame across its cores). What drawing it on a graphics chip would need:
+
+1. **A way to run work on the chip.** On the iMac's AMD Radeon Pro 580 the branch `feat/imac-gpu-shader`
+   (5b56323) has a GCN instruction encoder, PM4 command packets and four compute kernels (fill, blit, star
+   splat, and `bh_bend.c`, the black holes' light bending written to match `night.c` exactly), checked on a
+   host GCN interpreter only; nothing has run on the chip yet (INFERRED from its commit message and tests).
+   Missing: the ring buffer and doorbell bring-up, memory the chip can see, firmware loading for the compute
+   engine. On the Spark's GB10 the same work is the L198 to L207 driver lanes plus the GB10 launcher.
+2. **The split.** The stars, galaxies and Milky Way are the base layer and change slowly; the costly part per
+   frame is the light bending around the two holes (each pixel near a hole is moved by the deflection
+   formula) and the ripple ring. Those two map one pixel to one GPU thread with no communication between
+   pixels: the shape a GPU is built for. The CPU keeps the clock, the sound and the text.
+3. **The VM.** Inside aienos-run the guest has no real GPU. A virtio-gpu with 3D (virgl or Venus) would let
+   the guest hand shaders to the host's GPU; that is a separate driver (virtio-gpu 3D contexts) and is not
+   started.
+4. **Is it needed?** On the iMac the CPU path holds 60 Hz on average at 3840x2160 (section 2, INFERRED from a 12.6 ms average frame). A GPU path
+   is worth it for 5K panels, for doing more each frame, and for battery; it is not needed for the boot as it
+   is today.
+
+## 5. Open findings
+
+- **Dim hint text (from L282, OBSERVED there).** `ui/allen_ui.c` draws the hint line at alpha 150/256 and the faint
+  line at 110/256 over the night; measured contrast 3.26:1 and 1.98:1, under the 4.5:1 floor
+  (`docs/design/tokens/contrast.txt` on `feat/allen-design-system`). Drawing both at full alpha gives 7.73:1 and
+  6.02:1. Not changed here: `ui/` is kept byte-identical to the iMac build (`0930240`) so the iMac stack merges
+  cleanly; the one-line fix goes in once that stack has landed, or on the iMac lane if it moves first.
diff --git a/docs/FIRST_RUN_UX.md b/docs/FIRST_RUN_UX.md
new file mode 100644
index 00000000..e555f78d
--- /dev/null
+++ b/docs/FIRST_RUN_UX.md
@@ -0,0 +1,326 @@
+# First run: from power on to "Allen is ready"
+
+Status: DRAFT 3 (L266, 2026-10-20). This is the spec the setup wizard (L267) and the driver builder (L268) build
+against. Change it by ledger note on L266; the owner folds the notes in and bumps the draft number.
+
+What this page fixes: every screen a person sees after AienOS is installed (or after `aienos-run` starts it), in
+order, with the exact words, what happens on its own, what is asked, what is never asked, how long a step may run
+before the person sees it moving, and how to undo each part.
+
+## 0. Rules every screen follows
+
+1. **Ask for intent and consent, nothing else.** The machine finds every fact it can find. The only questions are
+   "what do you want this computer for", "may I do this", and secrets only the person holds (a Wi-Fi password, a key
+   for an AI service), each asked once and only when needed.
+2. **Nothing manual that the machine can discover.** No device lists to tick, no driver names, no disk layouts, no
+   model file paths, no port numbers.
+3. **Plain words.** No product names of our own parts on the screen (no "Aienux", "Interplane", "Store", "contract",
+   "kernel"). Hardware is named by what it does first ("Graphics", "Screen", "Network"), then its maker's name.
+   No marketing words: no "blazing", "seamless", "revolutionary", "magic". No exclamation marks.
+4. **One thing at a time, in the middle of the screen.** Allen's look (night sky, Allen as light in the centre, one
+   input bar at the bottom). No windows, menus, tabs or progress bars that jump. Every change eases in; nothing cuts.
+5. **Always moving, never frozen.** Every step shows motion within its progress budget (section 3). If a step is
+   slower than its budget, Allen says what it is waiting on in one line, in plain words.
+6. **Every step can be skipped and resumed.** "Not now" is on every question. Setup picks up where it stopped after a
+   restart. Saying "set up again" to Allen at any time starts it over without losing anything.
+7. **Honest numbers only.** Any number on the screen (frames a second, model speed, memory) comes from a measurement
+   made on this machine, or it is not shown. "Not measured yet" is a valid answer.
+8. **Keyboard, mouse and touch all work.** Enter or a click picks the lit choice; arrow keys move between choices;
+   Escape is "Not now". Typing a sentence goes to Allen on the intent screen; elsewhere in kernel images letters are ignored.
+   (Kernel images today have no mouse driver: choices move with the arrow keys, Tab or a digit, Enter picks, Escape
+   is "Not now". A mouse or touch works only in a window of a host that has one, such as `aienos-run`.)
+
+## 1. The two ways people arrive
+
+| Arrival | What they did | What starts the screens below |
+|---|---|---|
+| **Native** | Booted the AienOS USB stick or installed image (PC, Spark, Pi 5, iMac) | the computer's power button |
+| **In a window** | Ran `aienos-run` on Windows, macOS or Linux (the try page, L264) | the runner opens one window; the window IS the screen below (the VM's own framebuffer and sound, not a web page) |
+
+Both see the same screens, in the same order, with the same timing and the same sound. Differences are called out
+per screen as **Native:** and **In a window:**.
+
+## 2. The screens, in order
+
+### Screen 1. Power on (not ours)
+
+- **Native:** the computer's own maker logo for as long as its firmware takes (observed on the iMac: 13.5 s from
+  power on to our first instruction, iMac report `boot_time` line, aienos_commit 0930240). We cannot shorten this;
+  we never add to it.
+- **In a window:** the runner window opens black, already the size of the screen it will be. No runner logo, no
+  console text.
+- **Words:** none.
+
+### Screen 2. The night (the boot sequence)
+
+The same on every machine: one shared module (`native/kernel/ui/`, section 5).
+
+| Time on the night's clock | What the person sees and hears |
+|---|---|
+| 0 to 6.8 s | Black, then the eyes adjust: the brightest stars first, then the faint ones, then the Milky Way, in slow patches |
+| 2.6 s | Two black holes start to bend the starlight behind them, then show their shadows, circling |
+| 6.0 s | They spiral in, faster and closer |
+| 11.4 s | The sound comes in: a short rising "blirp", the chirp two merging black holes make, raised into hearing |
+| 12.0 s | They merge; a ripple runs out through the stars; the sound peaks and rings away by 12.3 s |
+| 12.0 to 15.2 s | The last black hole rings, then dissolves; the light of the merger stays in the centre |
+
+- **Words:** none. Nothing is asked. Nothing can go wrong on this screen that the person has to deal with.
+- **What happens underneath, automatically:** the computer starts all its processor cores, finds its disks,
+  network, sound, keyboard and mouse, and begins the device scan of screen 5. The night is not dead time; the
+  machine works while it plays.
+- **Keys:** a key press does nothing during the first run (the person is meant to see it once). On later boots any
+  key brings Allen in at once (the night jumps to its last second).
+- **Sound:** played through whatever the machine speaks with (HD Audio natively, the VM's sound device in a
+  window). No sound device: the night plays silent, nobody is told.
+- **Native:** if the screen cannot be drawn (no framebuffer), the machine goes on to screen 3 as text.
+- **In a window:** if the host has no sound output, the runner plays silent; it never pops up an audio error.
+
+### Screen 3. Allen arrives
+
+From the merger's light Allen gathers in the centre (the mind drawn as light). Then, word by word under him:
+
+> Hello. I'm Allen.
+>
+> I'm going to look after this computer with you.
+
+After a pause (about as long as it takes to read the lines), the question comes up above the choices of screen 4:
+
+> What would you like this computer to do best?
+
+The bar at the bottom says: **Or just tell me**.
+
+### Screen 4. The one question (intent)
+
+Three choices, in this order, the first one lit:
+
+> **Play games smoothly**
+> Faster, steadier frames from your graphics and screen.
+>
+> **Run an AI model here**
+> An AI that runs on this computer and stays on it.
+>
+> **Something else**
+> Tell me in your own words.
+
+Under them, small: **Not now**
+
+- **Something else** opens the bar: "Tell me what you'd like to do." Allen answers in one line with what he
+  understood ("You want a quiet machine for writing. I'll keep things simple and save power.") and a **That's right** /
+  **Not quite** pair. **Not quite** reopens the bar.
+- More than one goal: the person can say it ("both games and AI"); Allen keeps both and runs both paths in screen 7.
+- **Not now:** Allen says "That's fine. I'll set up the basics and you can tell me later." and goes to screen 5
+  with no intent; screen 7 is skipped.
+- **Never asked here:** language (taken from the firmware, the keyboard layout, or the host in a window; the person
+  can say "speak French" at any time), time zone (from the network), computer name (made from the maker and model,
+  e.g. "Drake's iMac" if the host gives a user name, else "iMac").
+
+### Screen 5. Getting to know this computer (automatic)
+
+Allen says:
+
+> Getting to know this computer.
+
+Then what he finds appears one line at a time, each line easing in as soon as it is known (never all at once at the
+end). The words follow this pattern; the bracketed parts come from the scan:
+
+> Screen: [2560 by 1440], [144] times a second
+> Graphics: [NVIDIA GeForce RTX 4070], [12 GB] of its own memory
+> Processor: [AMD Ryzen 7 7800X3D], [8] cores
+> Memory: [32 GB]
+> Storage: [1 TB] fast drive, [2 TB] drive
+> Network: wired, connected
+> Sound: speakers and a microphone
+> Keyboard and mouse: working
+
+Then, if anything is on the network:
+
+> Also nearby: [2] other AienOS computers, [a printer]
+
+- **What happens underneath:** PCI, USB, ACPI, disks, displays (modes and refresh rates from the monitor's own
+  description), processors and their kinds, and the network (other AienOS machines by Interplane discovery, L263;
+  printers and storage later). In a window, the host launcher also hands in what the host has (its real graphics
+  card, its installed AI models and running model servers, section 4 of L267's brief).
+- **Not found / not working** lines are said plainly: "Wi-Fi: found, I don't have a way to drive it yet. I'll build
+  one (screen 8)." Never red, never an error code.
+- **Never asked here:** which devices to scan, permission to scan (scanning reads, it changes nothing).
+
+### Screen 6. The one consent
+
+Allen shows, in a short list, what he wants to do, then asks once:
+
+> Here's what I'd like to set up:
+>
+> - [Use my own drivers for the graphics, network and storage]
+> - [Set your screen to 144 times a second]
+> - [Run the AI on your graphics card]
+> - [Build drivers for the 2 parts I can't drive yet]
+>
+> I won't touch your other drives, and you can undo any of this.
+>
+> **Set it up**     **Show me each one**     **Not now**
+
+- **Set it up:** everything in the list, in that order, with screens 7 to 9 showing progress.
+- **Show me each one:** the same list, one line at a time, each with **Yes** / **Skip**.
+- **Not now:** Allen keeps what already works (the machine is usable) and offers again the next time the person
+  asks him anything about setup.
+- The list only holds things that change the machine. Reading, measuring and testing in a sandbox never need consent.
+
+### Screen 7. The intent path
+
+#### 7a. Play games smoothly
+
+> Making games smoother.
+
+Lines appear as each is done:
+
+> Screen set to [144] times a second.
+> Graphics: [using my driver / using the maker's driver].
+> Processor: set to keep the fast cores free for the game.
+> Measured on this computer: [118] frames a second in my test scene. [Before: 97.]
+
+- Every number is a measurement on this machine (rule 7). If nothing could be measured yet: "I couldn't measure
+  this yet. I'll tell you when I can."
+- What Allen cannot do yet is said once, with what would fix it: "I can't tune this graphics card's clock speed yet.
+  I'm building a driver that can (screen 8)."
+- **Never asked:** refresh rate, resolution, power plan, driver versions. The highest refresh the monitor reports at
+  its native resolution is chosen; the person can say "lower the refresh rate" later.
+
+#### 7b. Run an AI model here
+
+> Finding the best way to run an AI here.
+
+> Your graphics card has [12 GB] of its own memory. [Models up to about 14 billion parameters fit on it. The 30
+> billion one fits if I share it with main memory, but it runs slower.]
+
+Then the model choice (screen 7c).
+
+- The fit numbers come from the model's measured size on disk plus its working memory, not from a table of guesses.
+- **Never asked:** which GPU (the biggest one is used; both if the person later asks), quantisation, context length,
+  batch size, server ports.
+
+#### 7c. Which AI (the LLM pick)
+
+Allen checks, in this order, without asking: models already on this computer (local disks; in a window, the host's
+Ollama, LM Studio, llama.cpp model folders and any running model server), then models on nearby AienOS machines
+(for example the Spark's model pair, the 27B and the 30B working together, L190). The default local AI is that
+pair when a machine on the network serves it, else the 30B on this computer when it fits (L267 note).
+
+- **Exactly one found:**
+  > I found [Qwen 30B] on this computer. I'll use it.
+  >
+  > **Use it**     **Choose another**
+  ("Use it" is lit; if the person does nothing for 10 s it is chosen and Allen says so.)
+- **Several found:** a short list, the best fit first and lit, each with one plain line ("Runs on your graphics
+  card", "On the Spark next door, fast"), plus **Connect my own**.
+- **None found:**
+  > I didn't find an AI model on this computer.
+  >
+  > **Get one for me** ([the 30B model, 18 GB download]; or the size that fits)
+  > **Connect my own** (Claude, ChatGPT, or another service)
+- **Connect my own:**
+  > Which service?  **Claude**   **ChatGPT**   **Another service**
+  >
+  > Paste your key for [Claude]. I'll keep it sealed on this computer and won't show it again.
+  (Another service also asks for its web address, with "the address your service's settings show for
+  OpenAI-compatible apps" as the hint.) Allen tests it with one short request: "That works." or "That key didn't
+  work. [Claude said the key isn't valid.] Try again?"
+- **Never asked:** endpoints of known services, model file paths, model names the machine can read itself.
+
+### Screen 8. Setting up the hardware (the driver builder, L268)
+
+Starts right after screen 6's consent and keeps running in the background while the person uses the computer.
+
+> Setting up your hardware.
+
+One line per device, each with a calm state word:
+
+> Graphics ([AMD Radeon Pro 580]): ready, my driver
+> Network ([Broadcom]): ready, my driver
+> Wi-Fi ([Broadcom BCM4360]): building a driver for it. This can take a while. You can keep using the computer.
+> Webcam: ready, the maker's driver
+
+- **States, and nothing else:** "ready, my driver", "ready, the maker's driver", "building a driver for it",
+  "testing the driver I built", "waiting for you", "can't drive this yet".
+- **Building:** Allen uses the AI chosen in screen 7c (by default the local pair or the 30B, as in 7c). The driver is
+  written and tested in a sandbox against a model of the chip; the real device is never touched until the tests
+  pass and the person agrees.
+- **The second consent** (only when a built driver is ready for a real device):
+  > I built a driver for your [Wi-Fi] and tested it without touching the real one. Turn it on?
+  >
+  > **Turn it on**     **Not now**
+  If it fails on the real device, Allen puts the old one back by himself and says: "That didn't work on the real
+  [Wi-Fi]. I've put the old driver back, and I'll keep working on it."
+- **Never asked:** which driver to use, whether to unbind the maker's driver (Allen asks to turn his on; the swap is
+  his job), log levels, test settings.
+
+### Screen 9. "Allen is ready"
+
+> Allen is ready.
+>
+> [Games will use your screen at 144 times a second.] [Your AI is Qwen 30B, on your graphics card.]
+> [I'm still building a driver for your Wi-Fi; I'll tell you when it's ready.]
+>
+> Ask me anything, or tell me what you'd like to do.
+
+The bar stays at the bottom: "Speak to Allen". The night stays in the sky behind him. Setup is over; anything left
+(driver builds, downloads) carries on quietly and Allen mentions it only when it finishes or needs a yes.
+
+## 3. Progress budgets
+
+A budget is the longest a step may go before the person sees it move. These are design limits for L267/L268 to
+meet and measure; they are not measurements. Each build reports its observed time against them.
+
+| Step | Shows motion within | Says what it is waiting on after | Observed so far |
+|---|---|---|---|
+| Our first pixel after the firmware hands over (screen 2) | 1 s | (no words on this screen) | iMac: night on screen 15260 ms after power on, firmware 13548 ms of that (report, 0930240) |
+| The night itself | plays 15.2 s, fixed | n/a | same clock on every machine (section 5) |
+| Allen arrives after the night | immediately (it eases out of the merger light) | 5 s: "Still starting. [The disk is slow to answer.]" | not measured on the PC/VM yet |
+| Each answer to a choice | 0.1 s (the choice lights up) | 2 s | not measured |
+| First line of the scan (screen 5) | 1 s | 10 s with no new line | not measured |
+| AI key test (7c) | 0.5 s (a moving dot by the key) | 10 s: "[Claude] is slow to answer." | not measured |
+| A model download | 1 s (size and time left, from the measured rate) | 30 s with no progress: "The download stopped. I'll keep trying." | not measured |
+| A driver build (screen 8) | 2 s (the state word changes) | 60 s per state: one line on what it is testing | not measured |
+
+## 4. Undo and uninstall
+
+| What | How to undo | What it leaves |
+|---|---|---|
+| Any setup choice | say "undo that" or "set up again", or choose it again in Allen's list | everything else stays as it is |
+| A driver Allen turned on | "Put the old driver back" (one choice on the device's line), or automatic if it fails | the maker's driver was only set aside, never deleted |
+| Screen refresh / processor setting | "Put the screen back" | the monitor's previous mode |
+| A connected AI service key | "Forget my Claude key" | the key is erased from the sealed store |
+| A downloaded model | "Delete the model" (Allen says how much space it gives back) | nothing else |
+| **In a window** (aienos-run) | the runner's own "Remove AienOS" (`aienos-run --reset` removes the per-user disk; deleting the runner removes the rest; exact flags in L261/L262/L265) | the host computer is untouched; AienOS only ever lived in its cache folder and its own disk file |
+| **Native, from the USB stick** | shut down and pull the stick | the computer starts as it did before; its own disks were not written |
+| **Native, installed** | the installer's restore path (L260 owns it); until it exists, this row is UNKNOWN and the installer must not offer to install over an existing system | to be set by L260 |
+
+## 5. The boot sequence is one module (for builders)
+
+- Source: `native/kernel/ui/` (night.c, chirp.c, paint.c, allen_font.c, mind.c, allen_ui.c), byte-identical to
+  what the iMac runs (aienos_commit 0930240). Every image builds the same files; nothing is redrawn per platform.
+- Timing: the night's clock constants in `night.h` (CK_NIGHT_*), the sound's in `chirp.h` (CK_CHIRP_*). Change
+  them there or nowhere.
+- The sound is made from a formula at boot (a real merger's chirp shape, 200 Hz rising to 1000 Hz, peak at the
+  merger). There is no sound file and no third-party audio; its licence is this repository's.
+- Measurement of frame rate and dropped frames per machine: `docs/BOOT_EVERYWHERE.md` (L266).
+
+## 6. Open questions (answer by ledger note on L266)
+
+1. L267: does the wizard need words for a machine with no keyboard at all (Spark headless)? Draft answer: the
+   wizard runs on the screen if one exists, else it waits for the first Interplane peer to open Allen's window for
+   this machine.
+2. L268: the exact state words in screen 8: are six enough?
+3. L260: the installed (not live) undo path, row "Native, installed".
+4. All: the 10 s auto-choose in 7c: keep or drop?
+
+## Change log
+
+- Draft 3 (2026-10-20): wording from L282's mockups taken (docs/design/screens/README.md, 9 changes: screens 3, 4, 6, 7b, 7c, 8)
+  and the L267 build notes: no mouse in kernel images, letters outside the intent screen ignored. Also, from
+  L267: the AI pick runs on the games path too (the driver builder needs an AI); an API key lives in kernel RAM
+  only (no sealed store on x86 yet), crosses once to the host relay as a key test, is wiped, and `llm.conf` names
+  the key variable only; https services cannot be tested yet (no TLS in the relay, none hand-rolled);
+  the host description reader is only in the launcher image.
+- Draft 2 (2026-10-20): default local AI is the 27B + 30B pair when the network has it (L267 note); section 5
+  points to the measured boot sequence.
+- Draft 1 (2026-10-20): first version, from Drake's words in the L266/L267/L268 briefs and the iMac's boot.
diff --git a/docs/IMAC_DMAR_INVENTORY.md b/docs/IMAC_DMAR_INVENTORY.md
new file mode 100644
index 00000000..4159c77e
--- /dev/null
+++ b/docs/IMAC_DMAR_INVENTORY.md
@@ -0,0 +1,71 @@
+# iMac DMAR firmware inventory
+
+This implements the first discovery step of
+[aienux #411](https://github.com/aien-dev/aienux/issues/411). It does not
+implement or qualify device DMA confinement. Existing device startup continues
+unchanged after the inventory, including when the table is absent or refused.
+The image must not be treated as safe for sensitive memory or unrestricted
+remote operations on the strength of this inventory.
+
+## Implementation
+
+`native/kernel/core/dmar.c` reads one explicitly bounded byte buffer using
+the format in the [Intel VT-d Architecture Specification, revision 5.0,
+sections 8.1 through 8.4](https://cdrdv2-public.intel.com/831418/vt-directed-io-spec.pdf).
+It checks the signature, declared size, checksum, revision, reserved fields,
+entry ordering, nested lengths, device/function bounds, remapping-unit
+alignment and reserved-region range/alignment. It retains DRHD units, their
+device scopes, and RMRR reserved ranges with their scopes. Other structure
+types are counted and skipped by declared length, as the specification requires.
+Skipping them is not a declaration that their requirements are supported.
+
+Storage is fixed: at most 64 KiB of table bytes, eight units, sixteen regions,
+64 scopes across both owner types and eight device/function pairs per path.
+Oversized inventories return a capacity error. Unknown scope types or table
+revisions return unsupported. Every failure clears the output, including
+failures after valid entries. There is no allocation, register access or
+device configuration in the parser.
+
+`native/kernel/x86/dmar_x86.c` locates the table with the existing checked ACPI
+lookup, inventories it before PCI drivers start, and prints `dmar:` diagnostics.
+It retains segment numbers and complete paths. A one-hop path has a direct
+source ID. A longer path remains unresolved until each bridge's secondary bus
+has been read; the last path element alone is insufficient. A subhierarchy
+also needs downstream enumeration. Reserved regions are reported as firmware
+requirements, never treated as granted windows.
+
+The report ends with `inventory-only register_access=none; DMA confinement
+NOT QUALIFIED`. Absence, invalid data and refusal also explicitly state that
+confinement is not qualified. The optional lab diagnostic report allowlists
+these lines. Its existing unauthenticated status remains unchanged. Default
+images still contain no network report.
+
+## Verification
+
+The host test `native/kernel/tests/test_dmar.c` covers a multi-segment fixture,
+multi-hop device paths, an IOAPIC, a reserved region, an unknown structure,
+every truncated prefix, corrupt fields, capacity exhaustion and a 64-bit
+address boundary. The same test runs with address and undefined-behavior
+sanitizers through the normal kernel host targets.
+
+`scripts/qemu_ck_imac_kernel_test.sh` checks that the default simulated machine
+reports the absent table without claiming protection. Setting
+`AIENOS_IMAC_DMAR=1` adds QEMU's Intel IOMMU device and requires a parsed unit,
+IOAPIC scope and inventory-only marker under both existing CPU models. These
+are firmware discovery tests. They neither enable remapping nor test blocked
+DMA. The existing read-only disk checks and deliberate W^X failures remain.
+
+`scripts/ck_imac_report_test.sh` checks that inventory diagnostics survive the
+allowlist while chat, keys and tokens remain excluded. Its lab build uses the
+existing explicit test-key option solely for this hosted test. No hardware
+staging image is produced by that script.
+
+## Remaining work
+
+Read and preserve the actual iMac's map on an explicitly authorized, attended
+boot. Resolve all relevant device paths against its PCI topology and account
+for reserved memory and any additional DMAR structures. Then implement and
+test domain construction, approved windows, invalidation, fault handling and
+fail-closed driver lifecycles. Physical out-of-window DMA and device recovery
+tests are still required by #411. No isolation claim follows from a successful
+inventory or an emulator boot.
diff --git a/docs/IMAC_GPU_BENCH.md b/docs/IMAC_GPU_BENCH.md
new file mode 100644
index 00000000..3cf43b74
--- /dev/null
+++ b/docs/IMAC_GPU_BENCH.md
@@ -0,0 +1,208 @@
+# IMAC GPU Bench: interfaces for feat/imac-gpu-bench
+
+## Status (read this first)
+
+- **Live kernel swap over UDP is NOT BUILT.** `native/kernel/x86/swap_x86.c`
+  `recv_swap_udp` is gone; the receiver on port 47034 does not exist yet. The
+  verify, quiesce and jump path works, but only with the slot object staged on a
+  disk (QEMU test). A running iMac cannot receive a kernel over the network.
+- **GPU bench over UDP is built but NOT TESTED on hardware.** The lab image has the
+  tg3 receive and transmit path for port 47035 (`tg3_x86.c`). QEMU has no BCM57766,
+  so nothing here exercises it. The QEMU test drives the same protocol code over a
+  COM1 socket instead.
+- The BARs in the QEMU bench test are **RAM stand-ins**, not PCI emulation.
+- Nothing in this document has been run on an iMac.
+
+## Install instructions (corrected)
+
+1. **The first lab kernel is installed by one normal netboot** (`NETLDR.EFI`, signed
+   with the owner key). The kernel that runs on the iMac today has no swap receiver,
+   so a live swap cannot deliver the first lab kernel.
+2. **Later lab kernels are meant to arrive by live swap, with no firmware boot.**
+   That path is not working yet (see Status). Until the UDP receiver is built and
+   tested, each kernel is installed by netboot.
+3. Only a lab build (`CK_X86_REPORT=1`) contains the swap receiver and the bench
+   console. A default image contains neither; the Makefile link step refuses a
+   default image that has the swap verifier or trampoline symbols.
+
+## Interfaces
+
+### Ports
+
+| Port  | Purpose       | Direction    | Auth                  | Status |
+|-------|---------------|--------------|-----------------------|--------|
+| 47034 | Live swap     | Spark to iMac | Ed25519 via ck_slot_verify | Not built (receiver stub removed) |
+| 47035 | GPU bench     | Spark to iMac | HMAC-SHA256           | Lab build; tg3 path untested |
+
+### Live swap: slot object and verification
+
+The swap input is a signed slot object: one 4096-byte manifest unit
+(`native/boot/slot_format.h`) followed by the raw kernel PE image. It is verified by
+`ck_slot_verify` (`native/boot/slot_select.c`), the same function NETLDR.EFI calls
+(`native/boot/net_loader.c`, the `ck_slot_verify(m, obj + CK_SLOT_UNIT, ...)` call).
+It checks the manifest structure, that `signer_id` names a trusted key, the Ed25519
+signature over the 448 signed bytes, and the image SHA-512. The trusted keys are the
+same table NETLDR uses, generated with `ck_slot_tool keys-c`.
+
+Make a slot object (the `ck_imac_swap` tool does not sign):
+
+```
+ck_slot_tool make-manifest --image IMACKERN-LAB.EFI --generation N --out M.bin
+ck_slot_tool sign-test M.bin --out MS.bin         # RFC 8032 TEST key: QEMU only
+ck_slot_tool verify MS.bin --image IMACKERN-LAB.EFI --test-key
+cat MS.bin IMACKERN-LAB.EFI > SLOT_OBJECT
+```
+
+For hardware, sign with the owner key (`ck_slot_tool tbs`, an offline signer, then
+`attach-sig`). The TEST key is refused for hardware by the tool.
+
+### GPU bench protocol (port 47035)
+
+Authentication key: 32-byte HMAC-SHA256 key, `bench_proto.h` `BENCH_TEST_KEY_INIT`
+by default (16 zero bytes followed by 0x01..0x10). A production build sets it with
+`CK_X86_BENCH_KEY=<32 bytes as C initialiser values>`. The Spark tool uses the built-in
+test key unless `--key <file>` gives a 32-byte binary key file.
+`make imac-kernel CK_X86_BENCH_KEY_FILE=<that file>` binds the same file into the
+image without the key ever appearing in a command line or build log (the generated
+header is mode 600 inside the build directory); the ready line then says `this
+image's own key` instead of `the TEST key`. The lab image of bundle 1 uses
+`~/.config/aienos/imac-bench.key` on the Spark.
+
+Replay protection: a 64-bit counter. The kernel refuses any request whose counter is
+not above the last one it accepted (the kernel keeps this until it reboots).
+
+```
+Request (Spark to iMac, 64 bytes):
+  magic[4]  = "ABCH"
+  version   u8 = 1
+  cmd       u8 = BENCH_CMD_*
+  pad[2]    = 0
+  counter   u64 be   (must be above the kernel's last accepted counter)
+  arg0..3   u32 be each (meaning per command, below)
+  hmac[32]  = HMAC-SHA256(key, bytes 0..31)
+
+Response (iMac to Spark, 64 bytes):
+  magic[4]  = "ABCR"
+  version   u8 = 1
+  status    u8 = BENCH_OK | BENCH_ERR_*
+  pad[2]    = 0
+  counter   u64 be   (echoed; 0 on a bad-HMAC refusal)
+  tsc       u64 be
+  result    u32 be
+  before    u32 be
+  hmac[32]  = HMAC-SHA256(key, bytes 0..31)     every response, errors included
+```
+
+Commands (arg0..arg3):
+
+| Code | Name                | arg0       | arg1        | arg2     | arg3       |
+|------|---------------------|------------|-------------|----------|------------|
+| 0x00 | BENCH_CMD_PING      | 0          | 0           | 0        | 0          |
+| 0x01 | BENCH_CMD_PCI_CFG   | offset (dword aligned, 0..252) | 0 | 0 | 0 |
+| 0x02 | BENCH_CMD_BAR5_READ | reg_index  | 0           | 0        | 0          |
+| 0x03 | BENCH_CMD_BAR5_WRITE| reg_index  | value       | 0        | 0          |
+| 0x04 | BENCH_CMD_BAR0_READ | word_off   | 0           | 0        | 0          |
+| 0x05 | BENCH_CMD_BAR0_WRITE| word_off   | value       | 0        | 0          |
+| 0x06 | BENCH_CMD_BAR5_POLL | reg_index  | mask        | expected | timeout_ms |
+| 0x07 | BENCH_CMD_BAR5_RMW  | reg_index  | clear_mask  | set_bits | 0          |
+
+`reg_index` is a DWORD index (byte offset = index x 4). `word_off` is a DWORD
+offset into BAR0.
+
+Status codes: `0x00` OK; `0x01` ERR_AUTH (bad HMAC, or counter not above the last);
+`0x02` ERR_RANGE (not on the allowlist, or offset out of range); `0x03` ERR_ALLONES
+(the read returned 0xFFFFFFFF: device gone); `0x04` ERR_TIMEOUT (TSC-bounded poll
+expired); `0x05` ERR_NODEV; `0x06` ERR_BUSY; `0x07` ERR_CMD.
+
+The kernel answers an ALLONES read and carries on. The Spark tool is what stops the
+batch: `ck_gpu_bench` sends nothing after an ERR_ALLONES reply.
+
+BAR5 write allowlist (DWORD indexes, inclusive). Every number is from AMD's MIT register
+headers in Linux, `drivers/gpu/drm/amd/include/asic_reg/dce/dce_11_2_d.h` and
+`smu/smu_7_1_3_d.h`:
+
+| Range | What sits there |
+|---|---|
+| `0x4800`-`0x4900` | UNIPHY link control, LVTMA panel power sequencer (`mmLVTMA_PWRSEQ_CNTL` 0x481b), backlight PWM (`mmBL_PWM_CNTL` 0x4820) |
+| `0x4A00`-`0x4C00` | DIG 0 and DIG 1 front ends: the HDMI and DisplayPort encoder blocks (`mmDIG_FE_CNTL` 0x4a00, `mmDIG1_DIG_FE_CNTL` 0x4b00, `mmDIG2_DIG_FE_CNTL` 0x4c00). Not the CRTC (`mmCRTC_STATUS` is 0x1ba3, not writable here). |
+| `0x1A04`-`0x1A12` | DCP0 graphics surface: `mmGRPH_PRIMARY_SURFACE_ADDRESS` 0x1a04, `mmGRPH_PITCH` 0x1a06, `mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH` 0x1a07, `mmGRPH_UPDATE` 0x1a11, `mmGRPH_FLIP_CONTROL` 0x1a12 (controller 0 only) |
+| `0x0094`-`0x0095` | SMC mailbox 0: `mmSMC_MESSAGE_0` 0x94, `mmSMC_RESP_0` 0x95 (the pair Linux `smu7_send_msg_to_smc` uses) |
+| `0x00A4` | `mmSMC_MSG_ARG_0` 0xa4 (the message argument) |
+
+BAR5 reads: any index 0..65535. BAR0 (VRAM): words 0..65535 (the first 256 KiB only).
+
+## Build
+
+```
+make -C native/kernel imac-kernel CK_X86_REPORT=1 CK_TEST_SLOT_KEY=1 CK_X86_BENCH=1
+make -C native/kernel imac-kernel CK_X86_REPORT=1 CK_SLOT_KEYS=<owner public keys file> CK_X86_BENCH=1
+make -C native/kernel ck-gpu-bench ck-imac-swap      # host tools -> $(OUT)/host/
+```
+
+| Variable | Meaning |
+|----------|---------|
+| `CK_X86_REPORT=1` | Lab build: swap receiver, bench console, tg3 transmit, network report. Required for the two below. |
+| `CK_X86_BENCH=1` | Compile the bench console (lab only). |
+| `CK_X86_BENCH_KEY=` | Bench HMAC key bound into the image (default: test key). |
+| `CK_SLOT_KEYS=<file>` | Owner public keys for the swap verifier (same format as the NETLDR keys). Required in a lab build unless the next line is set. |
+| `CK_TEST_SLOT_KEY=1` | RFC 8032 TEST key for the swap verifier. QEMU tests only. |
+| `CK_X86_SWAP_TEST_DISK=1` | QEMU test: swap slot object read raw from SATA disk 2, LBA 2048. Lab only. |
+| `CK_X86_BENCH_TEST=1` | QEMU test: RAM stand-in BARs, bench packets as COM1 text lines. Lab only. |
+
+The default `make imac-kernel` produces `IMACKERN.EFI` with none of the lab code.
+
+## Host tools
+
+### ck_gpu_bench
+
+```
+ck_gpu_bench [--key FILE] [--target IP | --serial PATH] [--transcript FILE] <script.bench>
+ck_gpu_bench ping [same options]
+```
+
+Script lines: `ping`, `pci_cfg OFF`, `bar5_read REG`, `bar5_write REG VAL`,
+`bar0_read W`, `bar0_write W VAL`, `bar5_poll REG MASK EXPECTED MS`,
+`bar5_rmw REG CLEAR SET`. Prefixes for negative tests: `badauth CMD` (one HMAC byte
+flipped), `stale CMD` (counter 1), `replay` (previous request again). Numbers accept
+decimal or `0x`.
+
+Output: one line per transaction, `<label> <STATUS>: result=0x.. before=0x..`.
+Exit 0 all OK; 1 an error status or an ALLONES stop; 2 transport failure.
+
+The counter starts from the clock, so a second run is not refused by a kernel that
+has seen a previous run. `--transcript` writes every byte received on the serial
+link and every request sent.
+
+### ck_imac_swap (not usable against an iMac yet)
+
+```
+ck_imac_swap push <SLOT_OBJECT> [--target IP]
+```
+
+Sends a signed slot object (see above) to port 47034. The kernel side is not built,
+so the tool times out against a real iMac. It does not sign anything.
+
+## QEMU tests
+
+- `scripts/qemu_ck_imac_swap_test.sh`: boots kernel A, which teaches Allen one fact
+  and saves Allen's memory; A verifies slot B with `ck_slot_verify`, quiesces and
+  jumps into B in the same QEMU process; B must load the memory A saved. A second run
+  refuses a bad signature.
+- `scripts/qemu_ck_gpu_bench_test.sh`: boots the lab kernel with the test transport
+  and runs a script through the real `ck_gpu_bench --serial`. Covers ping, config and
+  BAR reads and writes, allowlist refusal, poll and read-modify-write, replay, bad
+  HMAC, stale counter, and the all-ones stop.
+
+Both tests run QEMU's emulated CPU and devices only. A PASS says the code does what
+it says in QEMU. It says nothing about the GPU, the BCM57766 or the iMac firmware.
+
+## Honest limits
+
+- The swap trampoline uses the AP trampoline page (`tramp_pa`, below 1 MiB). If the
+  frame allocator did not give a page there, the swap is refused.
+- The swap does not apply PE base relocations: both kernels must be linked at the
+  same addresses.
+- A wrong GPU write can wedge the PCIe link; only a power hold (firmware boot)
+  recovers. The allowlist and the before/after logging make this rare.
+- No multi-kernel in flight: a second swap request during a swap is refused.
+- The bench key in the QEMU test build is the public test key.
diff --git a/docs/SKY_FLIGHT_PLAN.md b/docs/SKY_FLIGHT_PLAN.md
new file mode 100644
index 00000000..b2b0fefb
--- /dev/null
+++ b/docs/SKY_FLIGHT_PLAN.md
@@ -0,0 +1,74 @@
+# Slow flight through the real nearby stars: plan (no code yet)
+
+Owner direction (2026-10-19, 18:55 CDT): the sky is either "the sky above me" or "somewhere
+new". The later "somewhere new" option is a slow flight through real nearby stars in 3D,
+built from Gaia parallaxes. This note is the plan. Nothing here is built or committed as code.
+
+## What the data are
+
+Gaia DR3, table `gaiadr3.gaia_source`, ESA/Gaia/DPAC, CC BY-NC 3.0 IGO (credit ESA/Gaia/DPAC).
+Columns used: `ra`, `dec` (degrees, epoch 2016.0), `parallax` (milliarcseconds),
+`parallax_over_error`, `pmra`, `pmdec` (mas/yr), `phot_g_mean_mag`, `bp_rp`.
+
+Counts, measured on 2026-10-19 with synchronous TAP `COUNT(*)` queries on the ESA server:
+
+| selection | stars |
+|---|---|
+| parallax > 10 mas (within 100 pc) and parallax_over_error > 10 | 372,226 |
+| parallax > 20 mas (within 50 pc) and parallax_over_error > 10 | 48,809 |
+
+The second is the first version's target: 48,809 stars is a size the kernel can hold. (Those
+counts are the whole sky. The view a flight sees is a fraction of them.)
+
+## How a star becomes a point in space
+
+1. Distance = 1000 / parallax (parsecs). With parallax_over_error > 10 the parallax error is
+   under 10 percent, so inverting it is safe. Stars with a poorer parallax are left out.
+2. Apply the Gaia parallax zero point before inverting (Lindegren et al. 2021, A&A 649, A4;
+   about -0.017 mas across the sky). Its effect at 50 pc is small but it is applied, not ignored.
+3. Position at the time of the flight: move the star along its proper motion from epoch 2016.0
+   (`pmra` is already multiplied by cos dec; mas/yr). For a star moving 10 arcseconds a year (the Barnard's
+   Star class) the shift over ten years is 100 arcseconds, about 0.03 degree, so it matters and is applied.
+4. Unit vector times distance gives x, y, z in parsecs, in the J2000 equatorial frame. The
+   kernel can then use the same integer projection as the sky now (sky_real.c).
+
+## The flight
+
+- The camera moves slowly through the cloud along a straight or gently curved path (the path,
+  the speed and the time of one flight are NOT yet decided; they need Drake's choice).
+- Each frame: the stars within a set distance of the camera are projected with a perspective
+  divide (nearer stars larger and brighter, with the inverse-square law for flux).
+- Brightness: from G magnitude, through the same star model as the sky (the magnitude law in
+  integers). Colour: from BP-RP through the black-body chain already in the generator. The map from
+  BP-RP to B-V is an approximation and must be stated where used.
+- Compute: flat arrays (x, y, z, flux, colour), as the direction doc asks, so the Radeon
+  compute path (ledger L142 to L144) can read them. The CPU path is the same code on the integer
+  side, so the test can compare both.
+
+## Data as a table
+
+- The generator is plain C, like `native/kernel/tools/ck_sky_gen.c`. No Python is committed.
+- The table holds one record per star, in the flight's fixed frame. Its size is set by the
+  record: this is a design figure, not a measurement: about 16 bytes per star, so about 0.8 MB for
+  48,809 stars. It must be measured (`ls -l` of the generated file, and the IMAC kernel size)
+  before it is accepted.
+- Fetch by the same pattern as `scripts/ck_sky_gen.sh`: TAP query text in the script, sha256 pinned,
+  refuse any other file. Credit and licence in NOTICE and docs/ALLEN_SKY_SCIENCE.md.
+
+## Steps and what proves each one
+
+1. Generator and query (C, pinned sha256). Proof: a count in the report matches the counts above.
+2. Host test: projection of known stars against their catalogue positions (as the sky test does
+   for BSC5 stars), at the chosen epoch. Proof: worst error in pixels, printed.
+3. Frames at three camera positions, looked at by a person. Proof: pictures in evidence/.
+4. Time per frame at 3840 x 2160 on one core, and the same on the GPU path once it exists.
+   Proof: the numbers, with the method. No estimate is accepted as a timing.
+5. Allen command: "fly through the nearby stars" (or similar), plus "stop" and "the sky above me"
+   to go back. Proof: the reply test in ck_allen_ui_test.sh.
+
+## Not decided (for Drake)
+
+- Speed and length of one flight, direction of travel, and whether the path loops.
+- Whether the flight starts from the sky above you (the Sun's neighbourhood is the same for
+  everyone) or from a random place each boot.
+- Whether to include the 100 pc set (372,226 stars) or only the 50 pc set in the first version.
diff --git a/docs/design/CRITIQUE.md b/docs/design/CRITIQUE.md
new file mode 100644
index 00000000..ec12c9a6
--- /dev/null
+++ b/docs/design/CRITIQUE.md
@@ -0,0 +1,93 @@
+# Allen against 54 design systems: what we take, what we refuse
+
+Read 2026-10-20 from the 54 DESIGN.md templates in the `popular-web-designs` skill. Every value below is
+quoted from those files (three readers, one third each; seven quotes spot-checked by grep, all found). Allen's
+screen is one night sky with one light in it, so most of what these systems do to sell something is refused.
+
+## What changed in Allen because of this
+
+1. **Lit is a glow, not a fill.** NVIDIA's "a signal, not a surface" and Framer's two-state pill agree with
+   Allen's lit choice: a glow-blue gradient at about a third strength, a brighter hairline, a soft halo.
+   Linear's solid indigo fill was the alternative and was refused.
+2. **Edges are hairlines, depth is a step in surface colour.** Vercel and Cal draw borders as a 1 px ring at
+   8 to 10 % opacity; Linear, Composio and Supabase step surfaces instead of casting shadows; HashiCorp says
+   "If you can see the shadow, it's too strong." Allen's choices use a 1 px glow ring at 10 %, lit at 45 %.
+3. **Muted text is a colour, never a lower alpha.** Superhuman, x.ai and Composio fade secondary text with
+   alpha. Allen measured that: the kernel's hint at 150/256 alpha falls to 3.26:1 on night (floor 4.5). So
+   hint and faint are solid colours (7.73:1 and 6.02:1). This is the one place we go against the majority.
+4. **One weight family, hierarchy by size.** Mistral ("Hierarchy comes from size and color, never weight")
+   and Runway use one face for every role. Allen has one stroke face at three sizes.
+5. **Pills for actions, rounded rectangles for choices.** Apple (980 px), Revolut and Ollama (9999 px) keep
+   pills for anything pressed. Allen: buttons and the bar are pills, the three choices are 14 px rounded rows
+   so their second line of words has room.
+6. **Slow on purpose.** Cursor's 150 ms and OpenCode's 100 to 150 ms are the fastest colour changes in the
+   set; Ollama says "interactions should feel instant". Allen's word rise is 600 ms and its state blend
+   700 ms, and only the lit choice moves fast (100 ms) because it follows a key press. VoltAgent's glow that
+   "expands and contracts like a heartbeat" (2 px to 8 px) is the one other system that breathes.
+
+## Refused across the board
+
+Red and green for state (IBM, Stripe, Supabase, Kraken, OpenCode, Miro, VoltAgent), a second accent colour
+(Sanity, Zapier, PostHog, Sentry, Cursor), buttons that grow or shrink (Wise, Notion, Intercom, Clay), all
+caps and wide tracking (SpaceX, Supabase, Warp, x.ai, BMW), heavy or tight display type (Expo, Framer,
+Vercel, ClickHouse), photos or video as the background (Runway, Warp), light slabs breaking the night
+(Apple, Superhuman, Mintlify), and a black focus ring on near-black (Resend).
+
+## The 54, one line each
+
+| System | Take | Refuse |
+| --- | --- | --- |
+| Airbnb | off-black text, never pure | hot red CTA, 3-layer shadow |
+| Airtable | nothing | blue glare shadow |
+| Apple | 2px solid focus in the accent; pills | light slabs, blurred bar |
+| BMW | weight 300 question, 1.30 line | caps, weight 900, square corners |
+| Cal | border as 1px ring at 8-10% | inset bevel on buttons |
+| Claude | 1.60 body line, warm second family | terracotta CTA, illustrations |
+| Clay | nothing | tilting, jumping hover |
+| ClickHouse | lit item marked by 1px accent border | neon on pure black, weight 900 |
+| Cohere | one large container radius (22px) | purple bands, red focus ring |
+| Coinbase | pill CTA, 2px focus outline | whole-fill colour swap on hover |
+| Composio | border ladder 0.04 to 0.12 | cyan halos, hard offset shadow |
+| Cursor | colour 150ms, shadow 200ms (floor to exceed) | crimson hover, heavy shadow |
+| ElevenLabs | light 300 display, airy tracking | caps buttons, warm shadows |
+| Expo | nothing new (pill CTA) | -1.6 to -3px tracking, 700-900 |
+| Figma | a focus marker that is not colour | rainbow gradient |
+| Framer | frosted unlit pill, solid lit pill | -5.5px tracking, 0.85 line |
+| HashiCorp | shadows at 0.05 or none | four product accents |
+| IBM | 2px input edge that changes on focus | 0px radius, red and green |
+| Intercom | short state words | scale bounce, green press |
+| Kraken | state as a tint behind the word | green success badge |
+| Linear | surface steps 0.02-0.05; off-white text | solid indigo fill for lit |
+| Lovable | soft wide focus glow | generic blue ring |
+| MiniMax | unchosen at 0.5, chosen solid | pink and purple gradients |
+| Mintlify | pill input with hairline | bright cloud wash |
+| Miro | nothing | five pastels plus green |
+| Mistral | hierarchy from size and colour | five-layer amber shadow |
+| MongoDB | accent once per section | neon green underline |
+| Notion | depth felt, not seen | scale bounce |
+| NVIDIA | lit as signal, not surface | sharp corners, caps |
+| Ollama | 9999 interactive, 12 containers | "feel instant" |
+| OpenCode | 800-900px reading column, 1.50 | red/green, 100-150ms |
+| Pinterest | nothing | red fill button |
+| PostHog | hover by opacity, not new colour | orange and gold flashes |
+| Raycast | +0.2px tracking on small light text | 3D key caps |
+| Replicate | dotted underline for pressable words | blaze gradient, 128px type |
+| Resend | 1px frosty border on dark pills | black focus ring on dark |
+| Revolut | pill 9999, quiet 0.125rem focus | 136px billboard headline |
+| Runway | one face, size-only hierarchy | photo and video backdrop |
+| Sanity | depth by surface colour step | electric blue hover, coral |
+| Sentry | content glowing out of the dark | lime, pink, caps |
+| SpaceX | ghost pill, starlight text #f0f0fa | all caps |
+| Spotify | pill text field, 1px inset ring | heavy shadow, green |
+| Stripe | light weight, aligned digits | tinted shadows, green badges |
+| Supabase | border ladder, no shadows | emerald, mono caps |
+| Superhuman | state by opacity and underline | purple into white page |
+| Together AI | 1px 0.12 white border on glass | pastel gradients, magenta |
+| Uber | one selected pill inverts | pure black on pure white |
+| Vercel | 1px ring at 8%, 2px focus | -2.4px display tracking |
+| VoltAgent | slow glow pulse 2px to 8px | emerald glow, coral danger |
+| Warp | focus as brighter border; warm off-white | caps micro-labels, photos |
+| Webflow | nothing | six accents, five-layer shadows |
+| Wise | 1px inset ring on input focus | grow and shrink buttons |
+| x.ai | borders 0.1 to 0.2 on activation | 0px corners, mono caps |
+| Zapier | big choice rows, 20px 24px padding | orange CTA and focus |
diff --git a/docs/design/DESIGN.md b/docs/design/DESIGN.md
new file mode 100644
index 00000000..97bee856
--- /dev/null
+++ b/docs/design/DESIGN.md
@@ -0,0 +1,438 @@
+---
+version: alpha
+name: Allen
+description: A night sky with one calm light in the middle. Allen's look on every screen AienOS draws.
+colors:
+  primary: "#ECF0FC"
+  night: "#060812"
+  hint: "#96A0C4"
+  faint: "#828CB0"
+  glow: "#96AAFF"
+  mist: "#C8D2FF"
+  ink: "#4056C4"
+  warm: "#FFD496"
+  warm-soft: "#FFDEB4"
+  heart: "#FFD2AA"
+  heart-core: "#FFECD6"
+  halo: "#3C4AD2"
+  halo-violet: "#705CFF"
+  sky-glow: "#6E82FF"
+  panel: "#0C1026"
+  lit: "#3B446F"
+typography:
+  voice:
+    fontFamily: Quicksand
+    fontSize: 27px
+    fontWeight: 400
+    lineHeight: 40px
+    letterSpacing: "0.02em"
+  body:
+    fontFamily: Quicksand
+    fontSize: 21px
+    fontWeight: 500
+    lineHeight: 30px
+    letterSpacing: "0.01em"
+  small:
+    fontFamily: Quicksand
+    fontSize: 16px
+    fontWeight: 500
+    lineHeight: 22px
+    letterSpacing: "0.02em"
+  title:
+    fontFamily: Quicksand
+    fontSize: 40px
+    fontWeight: 300
+    lineHeight: 52px
+    letterSpacing: "0.04em"
+rounded:
+  sm: 8px
+  md: 14px
+  panel: 22px
+  pill: 999px
+spacing:
+  xs: 4px
+  sm: 8px
+  md: 16px
+  lg: 24px
+  xl: 40px
+  xxl: 72px
+  bar-width: 720px
+  bar-height: 54px
+  bar-bottom: 96px
+  text-width: 900px
+  words-below-centre: 250px
+components:
+  page:
+    backgroundColor: "{colors.night}"
+    textColor: "{colors.primary}"
+    typography: "{typography.body}"
+  allen-says:
+    backgroundColor: "{colors.night}"
+    textColor: "{colors.primary}"
+    typography: "{typography.voice}"
+  allen-title:
+    backgroundColor: "{colors.night}"
+    textColor: "{colors.primary}"
+    typography: "{typography.title}"
+  hint-text:
+    backgroundColor: "{colors.night}"
+    textColor: "{colors.hint}"
+    typography: "{typography.small}"
+  fine-print:
+    backgroundColor: "{colors.night}"
+    textColor: "{colors.faint}"
+    typography: "{typography.small}"
+  input-bar:
+    backgroundColor: "{colors.night}"
+    textColor: "{colors.primary}"
+    typography: "{typography.body}"
+    rounded: "{rounded.pill}"
+    height: 54px
+    width: 720px
+  input-bar-caret:
+    backgroundColor: "{colors.night}"
+    textColor: "{colors.glow}"
+  choice:
+    backgroundColor: "{colors.panel}"
+    textColor: "{colors.mist}"
+    typography: "{typography.body}"
+    rounded: "{rounded.md}"
+    padding: 16px
+  choice-lit:
+    backgroundColor: "{colors.lit}"
+    textColor: "{colors.primary}"
+    typography: "{typography.body}"
+    rounded: "{rounded.md}"
+    padding: 16px
+  button-primary:
+    backgroundColor: "{colors.lit}"
+    textColor: "{colors.primary}"
+    typography: "{typography.body}"
+    rounded: "{rounded.pill}"
+    padding: 14px
+  button-primary-hover:
+    backgroundColor: "{colors.lit}"
+    textColor: "{colors.warm-soft}"
+  button-secondary:
+    backgroundColor: "{colors.panel}"
+    textColor: "{colors.mist}"
+    rounded: "{rounded.pill}"
+    padding: 14px
+  panel:
+    backgroundColor: "{colors.panel}"
+    textColor: "{colors.primary}"
+    rounded: "{rounded.panel}"
+    padding: 24px
+  found-line:
+    backgroundColor: "{colors.night}"
+    textColor: "{colors.primary}"
+    typography: "{typography.body}"
+  found-line-label:
+    backgroundColor: "{colors.night}"
+    textColor: "{colors.hint}"
+    typography: "{typography.body}"
+  state-word:
+    backgroundColor: "{colors.night}"
+    textColor: "{colors.glow}"
+    typography: "{typography.small}"
+  state-word-needs-you:
+    backgroundColor: "{colors.night}"
+    textColor: "{colors.warm}"
+    typography: "{typography.small}"
+  focus-ring:
+    backgroundColor: "{colors.night}"
+    textColor: "{colors.mist}"
+  orb-halo:
+    backgroundColor: "{colors.halo}"
+  orb-halo-violet:
+    backgroundColor: "{colors.halo-violet}"
+  orb-heart:
+    backgroundColor: "{colors.heart}"
+  orb-heart-core:
+    backgroundColor: "{colors.heart-core}"
+  water:
+    backgroundColor: "{colors.ink}"
+  sky-wash:
+    backgroundColor: "{colors.sky-glow}"
+---
+
+## Overview
+
+Allen's look is a night sky with one calm light in the middle. The sky is the stage and Allen is the only actor.
+Everything a person reads sits in the centre or in one bar at the bottom. There are no windows, menus, tabs,
+sidebars or progress bars. Every change eases in and nothing cuts.
+
+This file is the one place the look is written down. The native kernel (boot and setup), the `aienos-run`
+windows on Windows, macOS and Linux, the Try page on aienos.com and the docs read their values from the three
+files generated from it (`docs/design/tokens/allen_tokens.h`, `allen_tokens.rs`, `allen-tokens.css`). Change a
+value here, run `cargo run -p allen-design-tokens -- generate`, and every surface follows. A test fails if the
+generated files fall behind this one.
+
+Where the values come from: the colours, sizes, clocks and curves are read from the iMac kernel's drawing code
+(`native/kernel/ui/` on `feat/allen-boot-everywhere`, the same bytes the iMac runs, commit 0930240), not from
+screenshots. Each token below names its source line. The web font, glass panels and entrance motion come from the
+Allen design-language skill.
+
+## Colors
+
+Light on dark, cool blues for everything calm, one warm colour for what is lit or alive.
+
+- **Night (#060812):** the sky behind everything. `allen_ui.c` 254, `CK_RGB(6, 8, 18)`.
+- **Primary (#ECF0FC):** the words Allen says and the words a person types. `allen_ui.c` 279.
+- **Hint (#96A0C4):** labels, placeholders, the left half of a found line ("Graphics:"). `allen_ui.c` 271.
+- **Faint (#828CB0):** fine print, footers. `allen_ui.c` 300.
+- **Glow (#96AAFF):** edges, focus halos, calm state words ("ready"). `allen_ui.c` 293.
+- **Mist (#C8D2FF):** secondary buttons, unlit choices, links. `allen_ui.c` 509.
+- **Ink (#4056C4):** deep accents, the cool water. Design language.
+- **Warm (#FFD496):** a fresh letter, anything that needs the person ("waiting for you"). `allen_ui.c` 230.
+- **Warm-soft (#FFDEB4):** hover glow on a primary action. `allen_ui.c` 431.
+- **Heart (#FFD2AA) and Heart-core (#FFECD6):** the warm light at the centre of Allen's mind. `mind.c` 263, 264.
+- **Halo (#3C4AD2) and Halo-violet (#705CFF):** the faint light round the mind. `mind.c` 228, 229.
+- **Sky-glow (#6E82FF):** the faint wash near the top of the sky. `allen_ui.c` 260.
+- **Panel (#0C1026):** glass behind a group of choices, drawn at 58% to 84% over the sky. Design language.
+- **Lit (#3B446F):** the solid colour of a lit choice or primary button: Glow at 34% over Panel. Web surfaces
+  draw it as a gradient from `rgb(150 170 255 / .34)` to `rgb(84 104 224 / .30)`.
+
+There is no red and no green. Nothing on a first-run screen is an error; a problem is a sentence in Primary with
+its state word in Warm.
+
+## Typography
+
+Allen's own typeface is drawn in pen strokes by the kernel (`allen_font.c`); there is no font file. Web and runner
+surfaces use Quicksand (OFL), the nearest match. Weight and size carry the hierarchy; one family only.
+
+| Role | Kernel cap height at 1080p | Kernel stroke weight | Web size / weight |
+|---|---|---|---|
+| voice (what Allen says) | 19 px | 1000 | 27 px / 400 |
+| body (choices, found lines) | 15 px | 1150 | 21 px / 500 |
+| small (hints, state words) | 11 px | 1250 | 16 px / 500 |
+| title ("Allen is ready.") | web only | n/a | 40 px / 300 |
+
+```allen-tokens
+native-type:
+  voice-cap: 19px
+  body-cap: 15px
+  small-cap: 11px
+  voice-weight: "1000"
+  body-weight: "1150"
+  small-weight: "1250"
+  line: 40px
+  wrap: 900px
+```
+
+Native surfaces (the kernel and anything that draws through it) use the `native-type` tokens with Allen's stroke
+typeface. Mockups in `docs/design/screens/` draw their words with the same strokes, exported from `allen_font.c`, so
+what a builder sees in a mockup is what the kernel can draw.
+
+Web sizes are the kernel cap height divided by 0.70, Quicksand's cap height as a share of its size (INFERRED from
+the font's published metrics; not measured on a rendered glyph yet). Allen's line height is 40 px
+(`allen_ui.c` 186) and his text wraps at 900 px (`allen_ui.c` 191).
+
+## Layout
+
+Every Allen surface lays out on a 1920 by 1080 design grid scaled by `k = min(width / 1920, height / 1080)`
+(`allen_ui.c` `scale_for`), so a phone, a laptop and a 5K iMac show the same picture.
+
+- Allen's centre is at 50% across and 40% down (`allen_ui.c` 853).
+- His words start 250 px below the centre (`words_top`) and wrap at 900 px.
+- The input bar is 720 by 54 px, centred, its bottom edge 96 px above the screen's bottom (`allen_ui.c` 871).
+- The spacing scale is xs 4, sm 8, md 16, lg 24, xl 40, xxl 72. Groups of choices stack with md between rows and
+  xl between a question and its choices.
+- Found lines (screen 5) line up on one column: label right-aligned in Hint, value left-aligned in Primary.
+
+## Elevation & Depth
+
+Depth comes from light, not shadows. The sky is the floor. Glass panels sit just above it with a 1 px edge in Glow
+at 14% to 16% and an 18 px backdrop blur, and only where a group of choices needs holding together. Allen's mind
+is the brightest thing on screen. Nothing else glows unless it is lit or needs the person.
+
+## Shapes
+
+Round and soft. Fields and buttons are pills (`rounded.pill`). Choice rows use `rounded.md` (14 px). Panels use
+`rounded.panel` (22 px). There are no sharp corners, no icons in rounded squares and no dividing rules.
+
+## Components
+
+- `allen-says` is how Allen speaks: Primary on the night in the voice size, letter by letter (35 ms each), each
+  fresh letter starting Warm and cooling to Primary over 900 ms.
+- `input-bar` is the only text field. It is always at the bottom, a pill on the night at 55%. Its caret is a Glow bar that breathes (1.1 s) instead of blinking and holds still for 0.5 s after each key (`allen_ui.c` 284).
+  On focus its edge turns Mist at 55% with a 28 px Sky-glow halo at 22%.
+- `choice` and `choice-lit` are the answers to a question. One is always lit (the first, unless the person moved).
+  The lit one is `Lit` with Primary words and a Glow edge; the others are Mist words on Panel.
+- `button-primary` is light, not paint: the Lit gradient with a Mist edge; on hover the edge and words turn
+  Warm-soft. `button-secondary` is a Mist outline on Panel. "Not now" is always a secondary button.
+- `found-line` and `found-line-label` are one line of what Allen found on screen 5.
+- `state-word` is a calm word in Glow ("ready", "building a driver for it"); `state-word-needs-you` is Warm
+  ("waiting for you").
+- `orb-*` are the lights that make Allen's mind (halo, violet halo, heart). Web surfaces that cannot draw the
+  mind use a crop of the kernel's own render (`allen-1-formed.png`), never a drawn or generated orb.
+
+## Motion
+
+Motion explains a change and then stops. The tokens are in the block below; the generator reads it.
+
+```allen-tokens
+motion:
+  ease-smooth: "cubic-bezier(0.3333, 0, 0.6667, 1)"
+  ease-out: "cubic-bezier(0.3333, 1, 0.6667, 1)"
+  ease-enter: "cubic-bezier(0.22, 0.61, 0.36, 1)"
+  frame: 16ms
+  letter: 35ms
+  letter-cool: 900ms
+  word-rise: 600ms
+  words-fade: 450ms
+  read-base: 6000ms
+  read-per-letter: 70ms
+  state-blend: 700ms
+  choice-lit: 100ms
+  dawn: 900ms
+  dusk: 4000ms
+  dusk-fallback: 1400ms
+  bar-rest: 9000ms
+  bar-rise: 900ms
+  caret-breath: 1100ms
+  caret-hold: 500ms
+  mind-form: 3000ms
+  enter-rise: 10px
+  enter-blur: 3px
+heartbeat:
+  breath-period: 5500ms
+  breath-depth: "0.030"
+  think-pulse-period: 900ms
+  heart-idle: "0.195"
+  heart-listen: "0.273"
+  heart-think: "0.469"
+  heart-speak: "0.313"
+  heart-ease-speak: 80ms
+  heart-ease: 400ms
+```
+
+- `ease-smooth` is the kernel's `ck_smooth` (3t² − 2t³) and `ease-out` is `ck_ease_out` (1 − (1 − t)³); both
+  Bezier forms are exact, not fitted. `ease-enter` is the design language's curve for web entrances.
+- Entrances rise: from opacity 0, 10 px lower and 3 px blurred, to rest, over `word-rise`.
+- A lit choice must light within 100 ms of the key or click (`choice-lit`), so the person knows they were heard.
+- Dusk (going to sleep) gathers inward over 4 s and is longer than the dawn; dawn is 0.9 s and calm.
+- The heartbeat: at rest Allen breathes, his size swelling ±3.0% over 5.5 s (`mind.c` 173). While thinking his
+  heart pulses every 0.9 s (`mind.c` 144). Heart brightness per mood is the kernel's 50, 70, 120 and 80 out of 256.
+
+## Boot sequence
+
+The night is one clock, identical on every machine. Values from `night.h` and `chirp.h`.
+
+```allen-tokens
+boot:
+  holes-appear: 2600ms
+  fade-end: 6800ms
+  spiral: 6000ms
+  merge: 12000ms
+  ripple-run: 3600ms
+  gone: 15200ms
+  allen-born: 12300ms
+  allen-formed: 15300ms
+  centre-x: "0.50"
+  centre-y: "0.40"
+sound:
+  chirp-rate: 48000Hz
+  chirp-from: 200Hz
+  chirp-to: 1000Hz
+  chirp-peak: "0.70"
+  chirp-in: 40ms
+  chirp-rise: 600ms
+  chirp-start: 11400ms
+  chirp-end: 12300ms
+```
+
+- 0 to 6.8 s the eyes adjust: brightest stars first, then faint ones, then the Milky Way, in patches.
+- 2.6 s two black holes start to bend the starlight, then show their shadows, circling.
+- 6.0 s they spiral in, faster and closer (separation as τ^¼, angle as τ^⅝, τ the time left).
+- 11.4 s the sound comes in; 12.0 s they merge and a ripple runs out through the stars; the sound ends by 12.3 s.
+- 12.3 s Allen starts to gather from the merger's light; he is formed by 15.3 s; the last black hole is gone by 15.2 s.
+- The maths, frame by frame, is in `docs/design/boot/MATHS.md`.
+
+## Sound
+
+There is one sound: the chirp of two black holes merging, raised into hearing (200 Hz rising to 1000 Hz over
+0.6 s, loudness following pitch to the ⅔ power, peak 70% of full scale at the merger, a 0.3 s ring). It is made
+from the formula at boot; there is no sound file.
+
+- First run plays it once with the night. Nothing else in first run makes a sound. Typing, choosing and finishing
+  are silent; Allen's light shows them.
+- No sound device: the night plays silent and nobody is told.
+- A person who turns sound off is never asked again.
+
+## Voice
+
+Every word a person reads goes through the humanizer skill. Allen is a person speaking to one other person.
+
+- Short sentences, everyday words. Say what Allen is doing, then stop.
+- Name hardware by what it does, then its maker ("Graphics: NVIDIA GeForce RTX 4070").
+- Never on screen: our own part names (Aienux, Interplane, Store, kernel, contract, driver ABI), error codes,
+  file paths, port numbers.
+- No marketing words (seamless, powerful, blazing, magic, effortless, stunning), no exclamation marks, no
+  "Great!", no "Oops", no emoji.
+- Numbers only when measured on this machine. "I couldn't measure this yet." is a full answer.
+- Questions are about intent and consent only, each asked once, each with "Not now".
+- Allen says "I" and "you". He does not apologise twice or reassure ("Don't worry").
+
+## Accessibility
+
+Contrast is measured by the generator (`cargo run -p allen-design-tokens -- check`), WCAG 2.2 relative luminance,
+on the solid colours; a pair below its floor fails the build.
+
+```allen-tokens
+contrast:
+  primary-on-night: "7.0"
+  hint-on-night: "4.5"
+  faint-on-night: "4.5"
+  mist-on-panel: "4.5"
+  primary-on-lit: "4.5"
+  warm-on-night: "4.5"
+  glow-on-night: "4.5"
+  primary-on-panel: "7.0"
+  warm-soft-on-lit: "4.5"
+drawn-alpha:
+  hint: "1.0"
+  faint: "1.0"
+kernel-today-alpha:
+  hint: "0.586"
+  faint: "0.430"
+reduced-motion:
+  night: still
+  letter: 0ms
+  word-rise: 0ms
+  state-blend: 150ms
+  dusk: 400ms
+  breath-depth: "0"
+  think-pulse-period: 0ms
+keys:
+  next: ArrowDown ArrowRight Tab
+  previous: ArrowUp ArrowLeft Shift+Tab
+  choose: Enter Space
+  not-now: Escape
+  speak: any letter
+```
+
+- Contrast is measured as drawn: a colour drawn at part opacity over the night is blended first (`drawn-alpha`),
+  then measured. Hint and Faint must be drawn opaque. The kernel today draws the bar's "Speak to Allen" hint at
+  150/256 and the footer at 110/256 (`allen_ui.c` 271, 300); `kernel-today-alpha` keeps those for the report,
+  which shows them below the floor. That is a finding for the kernel's owner, not a waiver.
+- Measured ratios (the generator's output, `cargo run -p allen-design-tokens -- check`) are in
+  `docs/design/tokens/contrast.txt`.
+- Reduced motion (the host's or the person's setting): the night shows its last frame (the merger's light, Allen
+  formed) with no orbit and no ripple; text appears whole; blends shorten to 150 ms; Allen does not breathe or
+  pulse, his heart brightness alone shows his mood. The chirp still plays unless sound is off.
+- Reduced motion on the very first boot (when the runner or firmware says so): the 15.2 s night is replaced by a
+  0.9 s dawn onto its last frame, then Allen arrives. The night is never forced on someone who asked for less motion.
+- Keyboard only: every screen works with the keys above and nothing else. Focus is always visible as a Mist edge
+  with a Sky-glow halo. Typing letters anywhere goes to the input bar.
+- Touch: every target is at least 44 by 44 px. Every choice has words; nothing is colour alone.
+
+## Do's and Don'ts
+
+- **Do** read a value from the generated files. **Don't** type a colour or a duration into a surface.
+- **Do** keep one lit thing per screen. **Don't** light two buttons.
+- **Do** say what is happening in one line when a step is slower than its budget. **Don't** show a bar that jumps
+  or a spinner with no words.
+- **Do** use the kernel's own renders for the sky and Allen on the web. **Don't** use a stock starfield, a
+  generated orb or a bright screenshot.
+- **Don't** add red, green, a second font, icons in rounded squares, or a second sound.
diff --git a/docs/design/DOGFOOD-2026-10-20.md b/docs/design/DOGFOOD-2026-10-20.md
new file mode 100644
index 00000000..fd40483d
--- /dev/null
+++ b/docs/design/DOGFOOD-2026-10-20.md
@@ -0,0 +1,47 @@
+# Dogfood: Allen's setup wizard in QEMU, 2026-10-20
+
+Status: round 1 done (wizard 660106f3), round 2 (wizard 36cc66cf) waiting for the model server on 127.0.0.1:18091.
+This file is a draft until round 2 is in. Tags: OBSERVED (seen in a picture, log or sound file), INFERRED (read from
+code), UNKNOWN (not yet checked).
+
+## How it was run
+
+`quiet-build bash docs/design/tools/dogfood-wizard.sh SRC OUT`, QEMU TCG only, no live device. SRC is a `git archive` of
+a pushed commit of feat/allen-setup-wizard (L267), never their worktree. Six first runs: intent games and intent AI,
+each with the three ways of getting an AI (a model on this computer, an AienOS computer nearby, my own service through
+the relay). A picture of every screen, one every 2 s while the night plays, the sound as a .wav, and `steps.tsv` with
+when each screen arrived.
+
+## Round 1 (wizard 660106f3)
+
+Result: OBSERVED all six runs reached "done"; wav 1.6 to 2.0 MB each; sound = silence to about 8.9 s, one chirp of
+about 0.75 s, peak -3.1 dBFS (70% of full scale, as designed). Screen-to-screen time 3.7 to 4.0 s per key press.
+
+Faults in the test itself, found and fixed in the script:
+- OBSERVED 17 of about 80 screenshots were half-written PNGs (QEMU's screendump read too early; for example
+  ai-own 08-url, ai-own 09-key-typed, games-local 06-llm). The script now waits for the PNG end marker and drops and
+  logs any picture that lacks it. Round 1 pictures for those steps are not evidence; round 2 redoes them.
+
+Rough edges seen in pictures (verify in round 2 against 36cc66cf):
+1. OBSERVED games screen (games-local 05-games): the line "Frames a second: I couldn't measure this yet. I'll tell you
+   when I can." names something and gives the person nothing to do. Dead end line. Owner L267 (wizard copy).
+2. OBSERVED hello (games-local 01-hello, first picture at 8.0 s): the sky and two holes, no words. INFERRED the words
+   arrive after the merge (12 s); UNKNOWN whether a person watching 8 to 12 s knows to wait. Owner L266 (boot).
+3. INFERRED from setup_wizard.c @36cc66cf lines 554 and 851: "Paste your key". The kernel has no paste or clipboard
+   (grep over native/kernel finds none), so the person types about 100 characters by hand. Needs either different words
+   ("Type your key") or a way to bring it in without typing. Owner L267.
+4. INFERRED setup_wizard.c line 547: "OpenAI-compatible apps" is jargon for a stranger. Owner L267.
+5. INFERRED allen_ui.c lines 271 and 300: hint text is drawn at 150/256 and faint text at 110/256 of full brightness;
+   measured as drawn, both are below the 4.5:1 contrast DESIGN.md asks for small text. Owner L266 (note sent).
+6. OBSERVED console of ai-own: "the record did not fit; not saved" on every step in wizard 660106f3. The newer
+   36cc66cf says it fixes this; round 2 checks.
+
+## Round 2 (wizard 36cc66cf)
+
+Not run yet. Waiting for: a model server on 127.0.0.1:18091 (the 35B, L306; the 30B is retired and is not started
+for this) and the shared QEMU lock. A detached waiter retries both. The newer wizard commits (9c8551e7, edc647b5) change
+only a README and the crumb, so 36cc66cf is the code to test.
+
+## Per-owner list
+
+Filled after round 2, one ledger note per rough edge with the picture path.
diff --git a/docs/design/boot/MATHS.md b/docs/design/boot/MATHS.md
new file mode 100644
index 00000000..8f89009f
--- /dev/null
+++ b/docs/design/boot/MATHS.md
@@ -0,0 +1,206 @@
+# The night, as maths
+
+The boot reference (`night.html`, this folder) and the kernel draw the same night. This page writes every step
+as an equation, with the kernel line it comes from, so a port to any framebuffer needs no guessing.
+
+Source: `native/kernel/ui/night.c`, `chirp.c`, `paint.c`, `allen_ui.c` on `feat/allen-boot-everywhere` (L266
+milestone 1, byte-identical to the iMac's `aienos_commit 0930240`). The kernel is integer-only; the sketch uses
+floating point. Where they differ it is said below.
+
+## 1. Space and time
+
+- Design grid 1920 × 1080. Scale `k = min(W·256/1920, H·256/1080)`; a design length `v` is `S(v) = ⌊(v·k + 128)/256⌋` px.
+- The kernel works in 16ths of a pixel; pixel `i`'s centre is `16i + 8`. The sketch uses `i + 0.5`.
+- Centre of the merger `C = (⌊W/2⌋, ⌊0.40·H⌋)` (`allen_ui.c` 853).
+- `t` is ms on the night's clock from the first frame.
+
+| Constant | ms | Kernel |
+|---|---|---|
+| holes appear | 2600 | `CK_NIGHT_HOLES_MS` |
+| spiral begins | 6000 | `CK_NIGHT_SPIRAL_MS` |
+| fade-in ends | 6800 | `CK_NIGHT_FADE_END_MS` |
+| merger | 12000 | `CK_NIGHT_MERGE_MS` |
+| ripple run | 3600 | `CK_NIGHT_RIPPLE_MS` |
+| last hole gone | 15200 | `CK_NIGHT_GONE_MS` |
+| wide orbit, one turn | 5200 | `ORBIT_MS` (night.c 371) |
+
+## 2. Noise (paint.c)
+
+- `hash(x, y, s)`: `h = x·0x8da6b343 ⊕ y·0xd8163841 ⊕ s·0xcb1ab31f` (32-bit wrap), then `h ⊕= h≫13; h ·= 0x5bd1e995;
+  h ⊕= h≫15; h ·= 0x27d4eb2d; h ⊕= h≫16`.
+- `smooth(t) = 3t² − 2t³` on 0..1 (kernel `ck_smooth`, t and result in 256ths).
+- `noise(x, y, s)`: value noise on a lattice of 256 units: the four corner values `hash(·)≫16` blended with
+  `smooth` of the fractions. Range 0..65535.
+- `fbm(x, y, s, n) = Σₒ noise(x·2ᵒ, y·2ᵒ, s + 7919·o) · 2ⁿ⁻¹⁻ᵒ / Σ 2ⁿ⁻¹⁻ᵒ`.
+- `gauss(v, w) = exp(−(v/w)²)`.
+
+The sketch ports these bit for bit (JavaScript `Math.imul`), so every star sits where the kernel puts it.
+
+## 3. The sky, made once
+
+### 3.1 The Milky Way band (night.c 72)
+
+A line from `(−W/20, 0.90·H)` along `(1.10·W, −0.92·H)`, half-width `h₀ = 0.16·H`. For a point:
+`across = ((x−x₀)·dy − (y−y₀)·dx)/len`, `along = ((x−x₀)·dx + (y−y₀)·dy)/len`.
+
+### 3.2 The soft layer at a quarter resolution (night.c 97)
+
+On the grid `x = 4i, y = 4j`, with `n₁ = fbm(768x/H, 768y/H, 101, 5)`, `n₂ = fbm(1792x/H, 1792y/H, 202, 4)`:
+
+- core `= gauss(across, h₀)`, wide `= gauss(across, 2h₀)`
+- dust `= gauss(across − 0.02H, 0.05H) · smooth((n₂ − 22000)/26000)`
+- bright `= gauss(along − 0.40·len, 0.38·len)`
+- mw `= core · (0.5 + n₁/131072) · (1 − 0.8·dust) · (0.45 + 0.55·bright)`
+- halo `= wide · (0.6 + 0.4·n₁/65536)`
+- nebulae: `vi = smooth((n₄ − 36000)/29535)²`, `bl = smooth((n₅ − 35000)/30535)²`, `ro = smooth((n₆ − 33000)/32535) · wide`
+  with `n₄, n₅, n₆ = fbm(·, 404|505|606, 4)` at 512/H, 666/H and 1024/H.
+- top `= 256 − 256y/H`; in 16ths of a level:
+  - R `= 26 + top/32 + 704·mw + 96·halo + 352·vi + 80·bl + 352·ro`
+  - G `= 34 + top/32 + 640·mw + 128·halo + 128·vi + 192·bl + 112·ro`
+  - B `= 92 + top/16 + 736·mw + 256·halo + 448·vi + 480·bl + 240·ro`
+
+Scaled to full size bilinearly with a 4 × 4 Bayer dither added before dropping to 8 bits (night.c 140), so the
+faint gradients show no bands.
+
+### 3.3 Stars (night.c 170)
+
+Every star is a glow: added light `a · (1 − d²/r²)³` inside radius `r`, colour by `hash % 100`:
+<10 `(170,192,255)`, <55 `(218,228,255)`, <85 `(255,250,242)`, <97 `(255,234,196)`, else `(255,204,160)`.
+
+| Population | Count | Position | Kept when | Level `lv` / radius |
+|---|---|---|---|---|
+| field | `W·H/800` | `hash(i,1|2,77)` in 16ths | `hash(i,3,77)&65535 ≤ 36000 + 29535·gauss(across, h₀)` | `14 + 241·u⁴/2³²`, u = `hash(i,4,77)&255`; r = `(20 + 16·lv/255)·k/256` 16ths |
+| dust | `W·H/170` | `hash(i,6|7,78)` | `hash(i,8,78)&65535 ≤ gauss(across, 0.8h₀)²` | `10 + hash(i,9,78)%44`, r = `20k/256` 16ths, colour `(226,230,255)` |
+| bright | `clamp(W·H/50000, 24, 256)` | `hash(i,1|2,91)` | always | `190 + hash%66`, r = `34k/256`; plus a halo of 5r at level 22; they twinkle (§4.7) |
+
+### 3.4 Galaxies (night.c 221)
+
+Six, from `gdef` (position in thousandths, radius in design px, tilt, turn, kind, brightness). Per pixel, rotate by
+`turn`, unflatten by `cos(tilt)` (at least 600/16384), radius `ρ` in 256ths of the galaxy's own:
+
+- spiral arms: phase `φ = 2θ + 30000·(log₂ρ − 8)` (turns in 65536ths), `arm = ((1 + cos φ)/2)²`, faded in outside the core
+  by `smooth((ρ − 34)/90)`; clumps `0.5 + 0.336·nz + 0.164·fine`; disc light `exp(−ρ·12/5 / 256) · (0.125 + 0.875·arm·clump)`.
+- bulge `0.9·gauss(ρ_b, 58)`; round galaxies `0.8·gauss(ρ_b, 30)` and disc `0.6·exp(−4.2ρ_b/256)`.
+- edge-on: a dust lane `gauss(v, 0.05r_g)` takes up to 85% of the disc and 61% of the bulge inside ρ < 240.
+- soft edge `1 − smooth((ρ − 250)/80)`. Colours: bulge `(255,222,178)`, disc `(150,170,255)`, knots `(255,140,190)` at half.
+
+### 3.5 When each part of the sky comes out of the dark (night.c 296)
+
+On a 4 × 4 cell grid: `appear = (6·fbm(640x/H, 640y/H, 909, 4)/256 + 4·255·|p − C|/far)/10`, far = the farthest corner.
+
+## 4. Each frame
+
+### 4.1 Coming out of the dark, 0 to 6.8 s (night.c 314)
+
+For a pixel of brightness `l` (its largest channel, 0..255): starts at `t₀ = 300 + 12·appear + 8·(255 − l)` ms, then
+`smooth((t − t₀)/1365)`. Bright stars come first, faint sky last, in patches spreading from the centre.
+
+### 4.2 The orbit (night.c 373)
+
+Wide separation `a₀ = S(270)` px. Angle in turns:
+
+- 2.6 s to 6.0 s: `θ = (t − 2600)/5200`, separation `a₀`.
+- 6.0 s to 12.0 s, with time left `L = (12000 − t)/6000`: separation `a₀·L^¼`, angle
+  `θ = 3400/5200 + (8/5)·(6000/5200)·(1 − L^⅝)` (the inspiral keeps the wide orbit's angular speed where it joins).
+- Hole positions `C ± (a/2·cos 2πθ, a/2·sin 2πθ / 2)`: the orbit leans away, half as tall as wide.
+
+Integer form: `L^⅛` by three integer square roots of a Q30 number (`root8`); `L^¼ = r²`, `L^⅝ = r⁵`.
+
+### 4.3 Each hole grows in (night.c 400)
+
+Einstein radius `E = S(60)·smooth((t − 2600)/2600)`; shadow radius `r_s = S(20)·smooth((t − 4000)/2000)`.
+
+### 4.4 Bent light (night.c 480)
+
+A point lens moves the image at angle `θ` from a hole to where the star really is: `β = θ − E²/θ`. Per pixel `p`,
+for each hole at `h`: `d = p − h`; if `|d|² < (4.4E)²`, the sky is sampled at `p − d·f` with `f = E²/|d|²` (|d|² at least
+1/4 px²), eased to zero between 2.2E and 4.4E by `((19.36E² − |d|²)/(14.52E²))²`. Both holes' pulls add. Stars behind
+a hole stretch into arcs and a second image appears on the far side.
+
+The kernel works this out exactly within `max(E, 1.5r_s) + 8` px of a hole and on an 8-pixel grid, bilinearly
+interpolated, elsewhere in the bent region (night.c 568). The sketch works it out exactly everywhere; the arcs
+are a little sharper (receipts, §6).
+
+### 4.5 Shadow and photon ring (night.c 523)
+
+Inside `1.5·r_s`: darken to black with a half-pixel soft edge at `r_s`; add `(255,228,196)` at `(22 − 16·|r − 1.04r_s|)·6/256`
+(a ring about 1.4 px wide just outside the shadow) plus a glow `46/256 · (1.5r_s − r)/(0.5r_s)` between `r_s` and `1.5r_s`.
+
+### 4.6 Merger, ring-down and the ripple (night.c 412, 436)
+
+- 12.0 s to 15.2 s, one hole at C: `E = 1.414·S(60)`; `r_s` grows from `1.262·S(20)` to `2·S(20)` over 180 ms, wobbling
+  `±7%·sin(2πt/95 ms)·exp(−t/260 ms)` (it rings); from 12.9 s both fade by `keep = 1 − smooth((t − 12900)/2300)`,
+  `E·keep`, `r_s·keep²`.
+- The ripple, 12.0 s to 15.6 s: crest radius `R = (far + 2.2w)·(t − 12000)/3600`, width `w = clamp(S(60), 4, 200)`,
+  envelope `smooth(t/220) · (1 − smooth((t − 2160)/1440))`, amplitude `S(6)·(1 − 0.586·R/far)·env`, wavelength `S(110)`.
+  At offset `o = |p − C| − R` within `±2.2w`: radial shift `amp·sin(2πo/λ)·gauss(o, w)·(0.35 + 0.65·cos 2(φ − ψ))`, ψ the
+  direction the pair last lay on (it stretches one way and squeezes across, as a gravitational wave does), and a
+  faint light `(86,108,176)·gauss(o, 0.6w)·env·46/256`.
+
+### 4.7 Twinkling (night.c 629)
+
+Each bright star adds a glow of radius `2·34k/256` 16ths at `((1 + sin 2π(t + phase)/period)/2)² · 120/256`, period
+2.6 to 6.8 s, scaled by its fade-in; skipped where the lens region covers it.
+
+### 4.8 The merger's flash (allen_ui.c 437)
+
+12.0 s to 13.6 s: radius `S(40) + S(220)·easeOut(t/1200)` with `easeOut(x) = 1 − (1 − x)³`, strength
+`smooth(t/120)·exp(−max(0, t − 120)/450)·0.9`. Two glows at C: `(200,210,255)` at strength/3 and `(255,240,224)` at a
+third of the radius. From 100 ms the remaining hole's shadow takes its black back over 300 ms.
+
+## 5. The chirp (chirp.c)
+
+48 kHz, one channel copied to both. `T = 600 ms` before the merger, `L` the share of it left.
+
+- 11.36 s to 11.40 s: 200 Hz, fading in by `smooth` over 40 ms to the level at `L = 1`.
+- 11.40 s to 12.00 s: pitch `200·L^(−3/8)` Hz, capped at 1000 Hz (reached at `L = 0.2^(8/3) ≈ 0.0137`, 8.2 ms before the
+  merger); level `0.70·(L_cap/L)^¼`, which is pitch to the ⅔ power, peaking at 70% of full scale; phase is the integral
+  `200·T·(8/5)·(1 − L^⅝)` turns.
+- 12.00 s to 12.30 s: 1000 Hz held, level `0.70·exp(−t/30 ms)`.
+
+The kernel builds a 4096-entry sine table by rotation and works in Q30 (`chirp.c`); the sketch uses `Math.sin`.
+
+## 6. Receipts
+
+Commands run from the repository root on the Spark, 2026-10-20. Kernel frames come from the design skill's
+`render_night.c` built against the L266 sources (`git archive origin/feat/allen-boot-everywhere native/kernel/ui`).
+
+### 6.1 The sketch matches the kernel
+
+`ffmpeg -i <sketch>.png -i <kernel>.ppm -lavfi psnr` (8-bit RGB, 1920 × 1080; higher is closer; 48 dB is about one
+level of 255 on average):
+
+| t (ms) | whole frame (dB) | centre 480 × 360 around the holes (dB) |
+|---|---|---|
+| 1500 | 85.4 | not measured |
+| 4000 | 51.4 | 44.9 |
+| 9000 | 56.6 | 49.9 |
+| 11800 | 57.3 | 49.9 |
+| 14000 | 51.0 | 49.1 |
+| 16000 | 59.8 | not measured |
+
+OBSERVED. The flash (12.0 to 13.6 s) is drawn by `allen_ui.c`, not `night.c`, so these frames avoid it; it is
+checked by eye only.
+
+### 6.2 Frame time per stage
+
+See `receipts/frame-times.md`.
+
+## 7. Not in this sketch
+
+- Allen's mind gathering from the merger's light (12.3 s to 15.3 s, `mind.c`) and his words. The kernel draws them;
+  the screen mockups show the formed mind.
+- The galaxies' light sweep while Allen speaks (`ck_night_lights` shimmer). Not part of the boot.
+
+## 8. PROPOSAL, not shipped: closer to the physics
+
+The aien-design-language skill asks for real astrophysics. The night as shipped is a faithful look, not a
+simulation. If Drake wants it closer, these are the changes, for L266 to weigh (none is in the sketch or the kernel):
+
+1. Shadow size from the lens: for a non-spinning hole the shadow radius is √27/2 Rs ≈ 2.6 Rs. Today `r_s = S(20)`
+   and `E = S(60)` are set independently; tying `r_s` to the mass that sets `E` would keep their ratio physical.
+2. The ring-down frequency and damping from the merged mass (today 95 ms period and 260 ms decay, chosen by eye).
+3. Real stars: positions, magnitudes and B−V colours from a public catalogue (Hipparcos or Tycho-2) instead of
+   hashed stars, as the brand-art renderer already plans.
+4. The chirp's time stretch stated as a factor in the science doc (a real 30-solar-mass merger sweeps through
+   this band in well under a second; the 600 ms here is chosen).
diff --git a/docs/design/boot/night.html b/docs/design/boot/night.html
new file mode 100644
index 00000000..027c5b4b
--- /dev/null
+++ b/docs/design/boot/night.html
@@ -0,0 +1,555 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>AienOS boot reference: the night</title>
+<!--
+  The boot reference for the native port (L266). It draws the iMac's startup night: the sky coming out of the
+  dark, two black holes bending the starlight as they circle and spiral in, the merger's ripple and flash, the
+  last black hole ringing and dissolving, and the chirp. Every constant and formula is the kernel's
+  (native/kernel/ui/night.c, chirp.c, allen_ui.c on feat/allen-boot-everywhere, the bytes the iMac runs at
+  aienos_commit 0930240), written out in floating point. docs/design/boot/MATHS.md is the same maths as
+  equations with the kernel line for each.
+
+  URL options:  ?t=MS       freeze at that time on the night's clock (screenshots)
+                ?measure=1  run the clock without sound and record frame times per stage (window.__night_result)
+                ?w=&h=      drawing size (default 1920 x 1080, the design grid)
+                ?hud=1      show the clock and the stage
+                ?reduced=1  reduced motion: a 0.9 s dawn onto the last frame (DESIGN.md, Accessibility)
+  Keys: any key or click starts the night with its sound; R restarts; H shows the clock.
+-->
+<script src="https://cdn.jsdelivr.net/npm/p5@1.11.3/lib/p5.min.js"
+        integrity="sha384-6FJh+LJ4p/43R8LpkZjM6iDKaXx59crdjiBG6n2sioNPNXc+c2iNpBvO2bQ25nSH"
+        crossorigin="anonymous"></script>
+<link rel="stylesheet" href="../tokens/allen-tokens.css">
+<style>
+  html, body { margin: 0; height: 100%; background: var(--allen-colors-night); overflow: hidden; }
+  main { position: fixed; inset: 0; display: grid; place-items: center; }
+  canvas { max-width: 100vw; max-height: 100vh; object-fit: contain; display: block; }
+  #hud { position: fixed; left: 24px; bottom: 20px; font: 500 14px/1.4 ui-monospace, monospace;
+         color: var(--allen-colors-faint); display: none; }
+  #start { position: fixed; left: 0; right: 0; bottom: 96px; text-align: center;
+           font: 500 16px/22px var(--allen-typography-small-fontFamily);
+           letter-spacing: .02em; color: var(--allen-colors-hint); transition: opacity .7s; }
+</style>
+</head>
+<body>
+<main id="stage"></main>
+<div id="start">Click or press a key to start the night with its sound</div>
+<div id="hud"></div>
+<script>
+"use strict";
+p5.disableFriendlyErrors = true;
+
+/* ---- the night's clock and sizes: night.h, chirp.h, allen_ui.c (DESIGN.md boot.* and sound.*) ---- */
+const FADE_END = 6800, HOLES = 2600, SPIRAL = 6000, MERGE = 12000, RIPPLE = 3600, GONE = 15200;
+const ORBIT_MS = 5200;                       // night.c: one turn of the wide orbit
+const CHIRP = { rate: 48000, from: 200, to: 1000, peak: 0.70, inMs: 40, rise: 600, end: MERGE + 300, tau: 30 };
+const STAGES = [["dark", 0, HOLES], ["holes", HOLES, SPIRAL], ["spiral", SPIRAL, MERGE],
+                ["merger", MERGE, MERGE + RIPPLE], ["settled", MERGE + RIPPLE, MERGE + RIPPLE + 1400]];
+
+const q = new URLSearchParams(location.search);
+const W = +q.get("w") || 1920, H = +q.get("h") || 1080;
+const K = Math.floor(Math.min(W * 256 / 1920, H * 256 / 1080));       // allen_ui.c scale_for
+const S = (v) => Math.floor((v * K + 128) / 256);                   // design px to px
+const CX = Math.floor(W / 2), CY = Math.floor(H * 40 / 100);        // where the holes merge (allen_ui.c 853)
+const FREEZE = q.has("t") ? +q.get("t") : null, MEASURE = q.get("measure") === "1";
+const REDUCED = q.get("reduced") === "1" || matchMedia("(prefers-reduced-motion: reduce)").matches;
+
+/* ---- integer helpers, as paint.c / paint.h ---- */
+const fl = Math.floor, tr = Math.trunc;
+function hash(x, y, seed) {
+  let h = (Math.imul(x, 0x8da6b343) ^ Math.imul(y, 0xd8163841) ^ Math.imul(seed, 0xcb1ab31f)) >>> 0;
+  h = (h ^ (h >>> 13)) >>> 0; h = Math.imul(h, 0x5bd1e995) >>> 0;
+  h = (h ^ (h >>> 15)) >>> 0; h = Math.imul(h, 0x27d4eb2d) >>> 0;
+  return (h ^ (h >>> 16)) >>> 0;
+}
+const clamp = (v, a, b) => (v < a ? a : v > b ? b : v);
+const smoothI = (t) => { t = clamp(t, 0, 256); return fl(t * t * (768 - 2 * t) / 65536); }; // ck_smooth
+function noise(x, y, seed) {                                          // ck_noise: smooth value noise 0..65535
+  const ix = x >> 8, iy = y >> 8, fx = smoothI(x & 255), fy = smoothI(y & 255);
+  const v00 = hash(ix, iy, seed) >>> 16, v10 = hash(ix + 1, iy, seed) >>> 16;
+  const v01 = hash(ix, iy + 1, seed) >>> 16, v11 = hash(ix + 1, iy + 1, seed) >>> 16;
+  const a = v00 * (256 - fx) + v10 * fx, b = v01 * (256 - fx) + v11 * fx;
+  return fl((a * (256 - fy) + b * fy) / 65536);
+}
+function fbm(x, y, seed, oct) {                                       // ck_fbm
+  let sum = 0, total = 0;
+  for (let o = 0; o < oct; o++) {
+    const w = 1 << (oct - 1 - o);
+    sum += noise(x << o, y << o, (seed + o * 7919) >>> 0) * w; total += w;
+  }
+  return fl(sum / total);
+}
+const expNeg = (x) => (x < 4096 ? Math.round(65536 * Math.exp(-x / 256)) : 0);          // ck_exp_neg, Q16
+function gauss(v, width) {                                            // exp(-(v/width)^2), Q16
+  const qv = tr(v * 256 / (width || 1));
+  return qv > 4095 || qv < -4095 ? 0 : expNeg(fl(qv * qv / 256));
+}
+const isqrt = (v) => fl(Math.sqrt(v));
+const smooth01 = (t) => { t = clamp(t, 0, 1); return t * t * (3 - 2 * t); };
+const easeOut01 = (t) => { t = 1 - clamp(t, 0, 1); return 1 - t * t * t; };
+const rgb = (r, g, b) => [r, g, b];
+
+/* ---- the sky, made once (night.c clouds, scale_up, stars, galaxy, appear_map) ---- */
+const SKY = new Uint8ClampedArray(W * H * 4);                         // RGBA, A = 255
+const QW = (W >> 2) + 1, QH = (H >> 2) + 1, AW = (W >> 2) + 1, AH = (H >> 2) + 1;
+const APPEAR = new Uint8Array(AW * AH);
+const TW = [];                                                        // the bright stars that twinkle
+const bake = {};
+
+function bandOf() {
+  const b = { x0: tr(-W / 20), y0: tr(H * 90 / 100), dx: tr(W * 110 / 100), dy: tr(-H * 92 / 100), half: tr(H * 16 / 100) };
+  b.len = isqrt(b.dx * b.dx + b.dy * b.dy);
+  return b;
+}
+const bandAt = (b, x, y) => [tr(((x - b.x0) * b.dy - (y - b.y0) * b.dx) / b.len),
+                             tr(((x - b.x0) * b.dx + (y - b.y0) * b.dy) / b.len)];
+
+function clouds() {                                                   // the soft layer, 16ths of a level
+  const qd = new Uint16Array(QW * QH * 3), b = bandOf();
+  for (let qy = 0; qy < QH; qy++) for (let qx = 0; qx < QW; qx++) {
+    const x = qx * 4, y = qy * 4, [across, along] = bandAt(b, x, y);
+    const core = gauss(across, b.half), wide = gauss(across, b.half * 2);
+    const n1 = fbm(tr(x * 768 / H), tr(y * 768 / H), 101, 5);
+    const n2 = fbm(tr(x * 1792 / H), tr(y * 1792 / H), 202, 4);
+    const lane = gauss(across - tr(H * 2 / 100), tr(H * 5 / 100));
+    const dust = fl(lane * smoothI(tr((n2 - 22000) * 256 / 26000)) / 256);
+    const bright = gauss(along - tr(b.len * 40 / 100), tr(b.len * 38 / 100));
+    let mw = fl(core * (32768 + fl(n1 / 2)) / 65536);
+    mw = fl(mw * (65536 - fl(dust * 52428 / 65536)) / 65536);
+    mw = fl(mw * (29491 + fl(bright * 36045 / 65536)) / 65536);
+    const halo = fl(wide * (39321 + fl(n1 * 26214 / 65536)) / 65536);
+    const n4 = fbm(tr(x * 512 / H), tr(y * 512 / H), 404, 4);
+    const n5 = fbm(tr(x * 666 / H), tr(y * 666 / H), 505, 4);
+    const n6 = fbm(tr(x * 1024 / H), tr(y * 1024 / H), 606, 4);
+    let vi = smoothI(tr((n4 - 36000) * 256 / 29535)), bl = smoothI(tr((n5 - 35000) * 256 / 30535));
+    const ro = fl(smoothI(tr((n6 - 33000) * 256 / 32535)) * wide / 65536);
+    vi = fl(vi * vi / 256); bl = fl(bl * bl / 256);
+    const top = 256 - tr(y * 256 / H);
+    const r = 26 + tr(top / 32) + fl(mw * 44 * 16 / 65536) + fl(halo * 6 * 16 / 65536) + fl(vi * 22 * 16 / 256) + fl(bl * 5 * 16 / 256) + fl(ro * 22 * 16 / 256);
+    const g = 34 + tr(top / 32) + fl(mw * 40 * 16 / 65536) + fl(halo * 8 * 16 / 65536) + fl(vi * 8 * 16 / 256) + fl(bl * 12 * 16 / 256) + fl(ro * 7 * 16 / 256);
+    const bb = 92 + tr(top / 16) + fl(mw * 46 * 16 / 65536) + fl(halo * 16 * 16 / 65536) + fl(vi * 28 * 16 / 256) + fl(bl * 30 * 16 / 256) + fl(ro * 15 * 16 / 256);
+    const o = (qy * QW + qx) * 3;
+    qd[o] = clamp(r, 0, 4080); qd[o + 1] = clamp(g, 0, 4080); qd[o + 2] = clamp(bb, 0, 4080);
+  }
+  return qd;
+}
+
+function scaleUp(qd) {                                                // bilinear, 4 x 4 ordered dither
+  const bayer = [0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5];
+  for (let y = 0; y < H; y++) {
+    const qy = y >> 2, fy = y & 3;
+    for (let x = 0; x < W; x++) {
+      const qx = x >> 2, fx = x & 3, d = bayer[(y & 3) * 4 + (x & 3)], p = (y * W + x) * 4;
+      for (let k = 0; k < 3; k++) {
+        const r0 = (qy * QW + qx) * 3 + k, r1 = ((qy + 1) * QW + qx) * 3 + k;
+        const a = qd[r0] * (4 - fx) + qd[r0 + 3] * fx, b = qd[r1] * (4 - fx) + qd[r1 + 3] * fx;
+        SKY[p + k] = Math.min(255, (fl((a * (4 - fy) + b * fy) / 16) + d) >> 4);
+      }
+      SKY[p + 3] = 255;
+    }
+  }
+}
+
+function glow(cx, cy, r, c, a) {                                      // ck_glow: (1 - d^2/r^2)^3, 16ths of a px
+  if (r <= 0 || !a) return;
+  const r2 = r * r, x0 = Math.max(0, (cx - r) >> 4), x1 = Math.min(W - 1, (cx + r) >> 4);
+  const y0 = Math.max(0, (cy - r) >> 4), y1 = Math.min(H - 1, (cy + r) >> 4);
+  for (let y = y0; y <= y1; y++) {
+    const dy = y * 16 + 8 - cy, dy2 = dy * dy;
+    if (dy2 >= r2) continue;
+    for (let x = x0; x <= x1; x++) {
+      const dx = x * 16 + 8 - cx, d2 = dx * dx + dy2;
+      if (d2 >= r2) continue;
+      const f = 256 - fl(d2 * 256 / r2), w = fl(fl(f * f / 256) * f / 256), aa = fl(w * a / 256), p = (y * W + x) * 4;
+      SKY[p] += fl(c[0] * aa / 256); SKY[p + 1] += fl(c[1] * aa / 256); SKY[p + 2] += fl(c[2] * aa / 256);
+    }
+  }
+}
+function add(p, c, a) { SKY[p] += fl(c[0] * a / 256); SKY[p + 1] += fl(c[1] * a / 256); SKY[p + 2] += fl(c[2] * a / 256); }
+
+function starColor(h) {                                               // five star colours by share
+  const p = h % 100;
+  return p < 10 ? rgb(170, 192, 255) : p < 55 ? rgb(218, 228, 255) : p < 85 ? rgb(255, 250, 242)
+       : p < 97 ? rgb(255, 234, 196) : rgb(255, 204, 160);
+}
+
+function stars() {
+  const b = bandOf(), area = W * H;
+  for (let i = 0; i < fl(area / 800); i++) {                          // field stars, denser along the band
+    const x = hash(i, 1, 77) % (W * 16), y = hash(i, 2, 77) % (H * 16), [across] = bandAt(b, x >> 4, y >> 4);
+    if ((hash(i, 3, 77) & 65535) > 36000 + fl(gauss(across, b.half) * 29535 / 65536)) continue;
+    const u = hash(i, 4, 77) & 255, lv = 14 + fl(241 * (u * u * u * u) / 4294967296);
+    glow(x, y, fl((20 + fl(16 * lv / 255)) * K / 256), starColor(hash(i, 5, 77)), lv);
+  }
+  for (let i = 0; i < fl(area / 170); i++) {                          // star dust in the band
+    const x = hash(i, 6, 78) % (W * 16), y = hash(i, 7, 78) % (H * 16), [across] = bandAt(b, x >> 4, y >> 4);
+    const c = gauss(across, tr(b.half * 8 / 10));
+    if ((hash(i, 8, 78) & 65535) > fl(c * c / 65536)) continue;
+    glow(x, y, fl(20 * K / 256), rgb(226, 230, 255), 10 + hash(i, 9, 78) % 44);
+  }
+  const nb = clamp(fl(area / 50000), 24, 256);                        // bright stars: a halo each, and they twinkle
+  for (let i = 0; i < nb; i++) {
+    const x = hash(i, 1, 91) % (W * 16), y = hash(i, 2, 91) % (H * 16), c = starColor((hash(i, 3, 91) | 1) >>> 0);
+    const lv = 190 + hash(i, 4, 91) % 66, r = fl(34 * K / 256), period = 2600 + hash(i, 5, 91) % 4200;
+    glow(x, y, r, c, lv); glow(x, y, r * 5, c, 22);
+    TW.push({ x, y, r: r * 2, c, period, phase: hash(i, 6, 91) % period });
+  }
+}
+
+const GDEF = [ // fx, fy (thousandths), radius (design px), tilt, turn (deg), kind, bright: night.c gdef
+  [150, 205, 112, 38, 30, "spiral", 160], [805, 135, 76, 62, -25, "spiral", 140], [265, 705, 42, 45, 60, "round", 130],
+  [870, 750, 88, 84, 15, "edge", 150], [60, 545, 40, 22, 0, "spiral", 120], [600, 95, 28, 52, 70, "spiral", 110]];
+
+function galaxies() {
+  GDEF.forEach(([fx, fy, radius, tilt, turn, kind, bright], i) => {
+    const hb = fl((fl(radius * 13 / 10) * K + 128) / 256) + 1, gxp = fl(W * fx / 1000), gyp = fl(H * fy / 1000);
+    const gx = gxp * 16 + 8, gy = gyp * 16 + 8, rg = S(radius) * 16;
+    const ct = Math.cos(turn * Math.PI / 180), st = Math.sin(turn * Math.PI / 180);
+    const ci = Math.max(600 / 16384, Math.cos(tilt * Math.PI / 180));
+    for (let y = Math.max(0, gyp - hb); y <= Math.min(H - 1, gyp + hb); y++)
+      for (let x = Math.max(0, gxp - hb); x <= Math.min(W - 1, gxp + hb); x++) {
+        const dx = x * 16 + 8 - gx, dy = y * 16 + 8 - gy;
+        const u = dx * ct + dy * st, v = dy * ct - dx * st, vd = v / ci;    // back to face-on
+        const rq = Math.hypot(u, vd) * 256 / rg;                            // radius, 256 = the galaxy's
+        if (rq > 330) continue;
+        const th = (Math.atan2(vd, u) / (2 * Math.PI)) * 65536;
+        const nz = fbm(tr(u * 1536 / rg), tr(vd * 1536 / rg), 700 + i, 3);
+        const fine = fbm(tr(u * 5120 / rg), tr(vd * 5120 / rg), 750 + i, 2);
+        const vb = v * 2 / (1 + ci), rb = Math.hypot(u, vb) * 256 / rg;      // the bulge flattens half as much
+        let lb, ld, knot = 0;
+        if (kind === "round") {
+          lb = gauss(rb, 30) * 0.8; ld = expNeg(fl(rb * 1075 / 256)) * 0.6;
+        } else {
+          const lr = (Math.log2(Math.max(rq, 4)) - 8) * 65536;              // log2(r), r in 256ths
+          const ph = 2 * th + lr * 30000 / 65536;                            // two arms, wound about a turn and a half
+          let arm = (1 + Math.cos(ph / 65536 * 2 * Math.PI)) / 2; arm *= arm;
+          const from = smoothI(tr((rq - 34) * 256 / 90)) / 256;             // arms begin outside the core
+          arm = 1 - (1 - arm) * from;
+          const clump = 0.5 + nz * 22000 / 65536 / 65536 + fine * 10768 / 65536 / 65536;
+          lb = gauss(rb, 58) * 0.9;
+          ld = expNeg(tr(rq * 12 / 5)) * (0.125 + arm * 0.875 * clump);
+          if (arm > 0.7 && nz > 44000 && rq > 50) knot = ld * (nz - 44000) / 21535;
+          if (kind === "edge" && rq < 240) {                                 // the dust lane of a disc seen edge-on
+            const lane = gauss(v, rg * 5 / 100) / 65536;
+            ld *= 1 - lane * 56000 / 65536; lb *= 1 - lane * 40000 / 65536;
+          }
+        }
+        const edge = 1 - smoothI(tr((rq - 250) * 256 / 80)) / 256;          // soft edge at 1.3 radii
+        const p = (y * W + x) * 4;
+        add(p, rgb(255, 222, 178), fl(lb * edge * bright / 65536));
+        add(p, rgb(150, 170, 255), fl(ld * edge * bright / 65536));
+        add(p, rgb(255, 140, 190), fl(knot * edge * bright / 65536 / 2));
+      }
+  });
+}
+
+function appearMap() {                                               // when each 4 x 4 cell comes out of the dark
+  let far = 0;
+  for (const [x, y] of [[0, 0], [W, 0], [0, H], [W, H]]) far = Math.max(far, isqrt((x - CX) ** 2 + (y - CY) ** 2));
+  for (let y = 0; y < AH; y++) for (let x = 0; x < AW; x++) {
+    const px = x * 4, py = y * 4;
+    const a = fbm(tr(px * 640 / H), tr(py * 640 / H), 909, 4) >> 8;
+    const r = tr(isqrt((px - CX) ** 2 + (py - CY) ** 2) * 255 / (far || 1));
+    APPEAR[y * AW + x] = tr((a * 6 + r * 4) / 10);
+  }
+}
+
+function faded(x, y, l, t) {                                          // ck_night_faded: 0..1
+  if (t >= FADE_END) return 1;
+  x = clamp(x, 0, W - 1); y = clamp(y, 0, H - 1);
+  const from = 300 + APPEAR[(y >> 2) * AW + (x >> 2)] * 12 + (255 - l) * 8, dt = t - from;
+  return dt <= 0 ? 0 : dt >= 1365 ? 1 : smooth01(dt * 48 / 256 / 256);
+}
+
+/* ---- the black holes, the ripple and the flash at a time (ck_night_at, allen_ui.c flash) ---- */
+function orbit(t, a0) {                                               // angle in turns, separation in px
+  const from = (SPIRAL - HOLES) / ORBIT_MS;
+  if (t < SPIRAL) return { ang: (t - HOLES) / ORBIT_MS, sep: a0 };
+  const L = (MERGE - t) / (MERGE - SPIRAL);                            // the time left, 1 to 0
+  const turns = 8 * (MERGE - SPIRAL) / (5 * ORBIT_MS);                 // the spiral keeps the wide orbit's speed
+  return { ang: from + turns * (1 - Math.pow(L, 5 / 8)), sep: a0 * Math.pow(L, 1 / 4) };
+}
+let FAR = 0;
+for (const [x, y] of [[0, 0], [W, 0], [0, H], [W, H]]) FAR = Math.max(FAR, isqrt((x - CX) ** 2 + (y - CY) ** 2));
+
+function nightAt(t) {
+  const s = { holes: [], ripple: null, flash: null, lens: null };
+  const eFull = S(60), rsFull = S(20), a0 = S(270);
+  const last = orbit(MERGE - 1, a0).ang;
+  if (t >= HOLES && t < MERGE) {
+    const { ang, sep } = orbit(t, a0);
+    const e = eFull * smooth01((t - HOLES) / 2600), rs = rsFull * smooth01((t - HOLES - 1400) / 2000);
+    const hx = sep / 2 * Math.cos(2 * Math.PI * ang), hy = sep / 2 * Math.sin(2 * Math.PI * ang) / 2; // the orbit leans away
+    s.holes.push([CX + 0.5 + hx, CY + 0.5 + hy, e, rs], [CX + 0.5 - hx, CY + 0.5 - hy, e, rs]);
+  } else if (t >= MERGE && t < GONE) {
+    const tm = t - MERGE, e = eFull * 362 / 256, rs0 = rsFull * 323 / 256, rs1 = rsFull * 2;
+    let rs = rs0 + (rs1 - rs0) * smooth01(tm / 180);
+    rs += rs * 0.07 * Math.sin(2 * Math.PI * tm / 95) * Math.exp(-tm / 260);  // it rings
+    const keep = 1 - smooth01((t - MERGE - 900) / (GONE - MERGE - 900));
+    s.holes.push([CX + 0.5, CY + 0.5, e * keep, rs * keep * keep]);
+  }
+  for (const [x, y, e, rs] of s.holes) {
+    const reach = Math.max(e * 4.4, rs * 1.6) + 2;
+    const b = [x - reach, y - reach, x + reach, y + reach];
+    s.lens = s.lens ? [Math.min(s.lens[0], b[0]), Math.min(s.lens[1], b[1]), Math.max(s.lens[2], b[2]), Math.max(s.lens[3], b[3])] : b;
+  }
+  if (t >= MERGE && t < MERGE + RIPPLE) {
+    const trp = t - MERGE, w = clamp(S(60), 4, 200), reach = w * 2.2, far = FAR + reach;
+    const R = far * trp / RIPPLE;
+    const env = smooth01(trp / 220) * (1 - smooth01((trp - RIPPLE * 0.6) / (RIPPLE * 0.4)));
+    const amp = S(6) * (1 - (150 / 256) * R / far) * env;
+    s.ripple = { R, w, reach, amp, lambda: Math.max(S(110), 8), env,
+                 c2: Math.cos(4 * Math.PI * last), s2: Math.sin(4 * Math.PI * last) };
+  }
+  if (t >= MERGE && t < MERGE + 1600) {
+    const tm = t - MERGE;
+    const rad = S(40) + S(220) * easeOut01(tm / 1200);
+    const a = smooth01(tm / 120) * Math.exp(-Math.max(0, tm - 120) / 450) * 230 / 256;
+    s.flash = { rad, a, keep: 1 - smooth01((tm - 100) / 300), unflash: s.holes.length === 1 && tm >= 100 };
+  }
+  return s;
+}
+
+/* ---- the picture: one pass per pixel ---- */
+const VERT = `
+attribute vec3 aPosition;
+uniform mat4 uProjectionMatrix, uModelViewMatrix;
+void main() { gl_Position = uProjectionMatrix * uModelViewMatrix * vec4(aPosition, 1.0); }`;
+const FRAG = `
+precision highp float;
+uniform sampler2D uSky, uAppear;
+uniform vec2 uRes, uAppearRes, uC;
+uniform float uT, uFadeEnd;
+uniform vec4 uHole0, uHole1;            // x, y, Einstein radius, shadow radius (px)
+uniform float uHoles;
+uniform vec4 uRip;                      // crest radius, width, amplitude, wavelength (px)
+uniform vec4 uRip2;                     // envelope, cos 2psi, sin 2psi, on
+uniform vec4 uFlash;                    // radius, strength, kept fraction inside the shadow, on
+uniform vec4 uStar[64];                 // x, y, radius (px), strength
+uniform vec3 uStarC[64];
+uniform float uStars;
+
+float gauss(float v, float w) { return exp(-(v / w) * (v / w)); }
+float sm(float t) { t = clamp(t, 0.0, 1.0); return t * t * (3.0 - 2.0 * t); }
+
+// the pull of one hole: a point lens, beta = theta - E^2/theta, eased to nothing from 2.2 E to 4.4 E
+vec2 pull(vec2 p, vec4 h) {
+  float e = h.z;
+  vec2 d = p - h.xy;
+  float d2 = max(dot(d, d), 0.25), outer = 19.36 * e * e, inner = 4.84 * e * e;
+  if (e <= 0.0 || d2 >= outer) return vec2(0.0);
+  float f = e * e / d2;
+  if (d2 > inner) { float w = (outer - d2) / (outer - inner); f *= w * w; }
+  return -d * f;
+}
+
+vec3 sky(vec2 p) { return texture2D(uSky, p / uRes).rgb; }
+
+// shadow and photon ring of one hole (night.c near_px)
+vec3 shadow(vec3 c, vec2 p, vec4 h) {
+  float rs = h.w;
+  if (rs <= 0.0) return c;
+  float r = length(p - h.xy);
+  if (r >= 1.5 * rs) return c;
+  c = mix(c, vec3(0.0), clamp(0.5 - (r - rs), 0.0, 1.0));
+  float ring = abs(r - 1.04 * rs) * 16.0;
+  float a = ring < 22.0 ? (22.0 - ring) * 6.0 / 256.0 : 0.0;
+  if (r > rs) a += 46.0 / 256.0 * (1.5 * rs - r) / (0.5 * rs + 1.0 / 16.0);
+  return c + vec3(1.0, 228.0 / 255.0, 196.0 / 255.0) * a;
+}
+
+vec3 glow(vec3 c, vec2 p, vec2 at, float r, vec3 col, float a) {
+  vec2 d = p - at;
+  float f = 1.0 - dot(d, d) / (r * r);
+  return f <= 0.0 ? c : c + col * f * f * f * a;
+}
+
+void main() {
+  vec2 p = vec2(gl_FragCoord.x, uRes.y - gl_FragCoord.y);   // pixel centre, y down like the kernel
+  vec2 off = vec2(0.0);
+  if (uHoles > 0.5) off += pull(p, uHole0);
+  if (uHoles > 1.5) off += pull(p, uHole1);
+  float light = 0.0;
+  if (uRip2.w > 0.5) {                     // the ripple: radial, stretching along psi and squeezing across it
+    vec2 d = p - uC;
+    float r = length(d), o = floor(r) - uRip.x;
+    if (r > 0.0 && abs(o) <= 2.2 * uRip.y) {
+      float disp = uRip.z * sin(6.2831853 * o / uRip.w) * gauss(o, uRip.y);
+      float qq = ((d.x * d.x - d.y * d.y) * uRip2.y + 2.0 * d.x * d.y * uRip2.z) / (r * r);
+      off -= disp * (0.35 + 0.65 * qq) * d / r;
+      light = gauss(o, 0.6 * uRip.y) * uRip2.x * 46.0 / 256.0;
+    }
+  }
+  vec3 c = sky(p + off);
+  if (uT < uFadeEnd) {                     // coming out of the dark: bright light first, in patches
+    float l = max(c.r, max(c.g, c.b)) * 255.0;
+    float ap = texture2D(uAppear, (floor(p / 4.0) + 0.5) / uAppearRes).r * 255.0;
+    float dt = uT - (300.0 + ap * 12.0 + (255.0 - l) * 8.0);
+    c *= dt <= 0.0 ? 0.0 : sm(dt / 1365.33);
+  }
+  c += vec3(86.0, 108.0, 176.0) / 255.0 * light;
+  if (uHoles > 0.5) c = shadow(c, p, uHole0);
+  if (uHoles > 1.5) c = shadow(c, p, uHole1);
+  for (int i = 0; i < 64; i++) {           // the bright stars twinkle
+    if (float(i) >= uStars) break;
+    c = glow(c, p, uStar[i].xy, uStar[i].z, uStarC[i], uStar[i].w);
+  }
+  if (uFlash.w > 0.5) {                    // the merger's flash, then the shadow takes its black back
+    vec3 before = c;
+    c = glow(c, p, uC, uFlash.x, vec3(200.0, 210.0, 255.0) / 255.0, uFlash.y / 3.0);
+    c = glow(c, p, uC, uFlash.x / 3.0, vec3(255.0, 240.0, 224.0) / 255.0, uFlash.y);
+    if (uHoles > 0.5 && uFlash.z < 1.0 && uHole0.w > 1.0) {
+      float r = length(p - uHole0.xy);
+      float inside = clamp(uHole0.w - r, 0.0, 1.0);
+      c *= 1.0 - inside * (1.0 - uFlash.z);
+    }
+  }
+  gl_FragColor = vec4(min(c, vec3(1.0)), 1.0);
+}`;
+
+/* ---- the chirp (chirp.c), as a buffer ---- */
+function chirpBuffer(ctx) {
+  const rate = ctx.sampleRate, start = MERGE - CHIRP.rise, f0 = start - CHIRP.inMs;
+  const n = Math.ceil((CHIRP.end - f0) / 1000 * rate), buf = ctx.createBuffer(1, n, rate), out = buf.getChannelData(0);
+  const T = CHIRP.rise / 1000, Lcap = Math.pow(CHIRP.from / CHIRP.to, 8 / 3);          // pitch stops rising at 1000 Hz
+  const steady = CHIRP.peak * Math.pow(Lcap, 1 / 4);                                  // the level at L = 1
+  const phaseIn = CHIRP.from * CHIRP.inMs / 1000;                                       // turns before the sweep
+  const phaseCap = phaseIn + CHIRP.from * T * 8 / 5 * (1 - Math.pow(Lcap, 5 / 8));
+  for (let i = 0; i < n; i++) {
+    const ms = f0 + i * 1000 / rate;
+    let level, phase;
+    if (ms < start) { level = steady * smooth01((ms - f0) / CHIRP.inMs); phase = CHIRP.from * (ms - f0) / 1000; }
+    else {
+      const L = Math.max(0, (MERGE - ms) / CHIRP.rise);
+      if (L > Lcap) {                    // the inspiral: pitch as L^(-3/8), level as pitch^(2/3)
+        level = CHIRP.peak * Math.pow(Lcap, 1 / 4) / Math.pow(L, 1 / 4);
+        phase = phaseIn + CHIRP.from * T * 8 / 5 * (1 - Math.pow(L, 5 / 8));
+      } else {
+        phase = phaseCap + CHIRP.to * (ms - (MERGE - Lcap * CHIRP.rise)) / 1000;
+        level = ms < MERGE ? CHIRP.peak : CHIRP.peak * Math.exp(-(ms - MERGE) / CHIRP.tau);  // rings away, 30 ms
+      }
+    }
+    out[i] = level * Math.sin(2 * Math.PI * phase);
+  }
+  return { buf, at: f0 };
+}
+
+/* ---- the sketch ---- */
+let sh, skyImg, appearImg, t0 = null, audio = null, hudOn = q.get("hud") === "1";
+const frames = [];                       // [t, interval ms, render ms]
+window.__night_done = false;
+
+function stageOf(t) { for (const s of STAGES) if (t >= s[1] && t < s[2]) return s[0]; return "after"; }
+
+new p5((p) => {
+  p.setup = () => {
+    let m = performance.now();
+    const qd = clouds(); bake.cloudsMs = performance.now() - m; m = performance.now();
+    scaleUp(qd); bake.scaleMs = performance.now() - m; m = performance.now();
+    stars(); bake.starsMs = performance.now() - m; m = performance.now();
+    galaxies(); bake.galaxiesMs = performance.now() - m; m = performance.now();
+    appearMap(); bake.appearMs = performance.now() - m;
+    const cnv = p.createCanvas(W, H, p.WEBGL);
+    cnv.parent("stage");
+    p.pixelDensity(1);
+    p.noStroke();
+    sh = p.createShader(VERT, FRAG);
+    skyImg = p.createImage(W, H); skyImg.loadPixels(); skyImg.pixels.set(SKY); skyImg.updatePixels();
+    appearImg = p.createImage(AW, AH); appearImg.loadPixels();
+    for (let i = 0; i < AW * AH; i++) appearImg.pixels.set([APPEAR[i], 0, 0, 255], i * 4);
+    appearImg.updatePixels();
+    p.textureWrap(p.CLAMP);
+    p.shader(sh);
+    sh.setUniform("uSky", skyImg);
+    sh.setUniform("uAppear", appearImg);
+    p._renderer.getTexture(appearImg).setInterpolation(p.NEAREST, p.NEAREST);
+    const gl = p.drawingContext, ext = gl.getExtension("WEBGL_debug_renderer_info");
+    bake.renderer = ext ? gl.getParameter(ext.UNMASKED_RENDERER_WEBGL) : gl.getParameter(gl.RENDERER);
+    bake.size = `${W}x${H}`; bake.brightStars = TW.length;
+    if (FREEZE !== null || MEASURE) { t0 = performance.now() - (FREEZE || 0); document.getElementById("start").style.opacity = 0; }
+    if (FREEZE !== null) p.noLoop();
+  };
+
+  const begin = () => {
+    if (t0 !== null && FREEZE === null && !MEASURE && audio) return;
+    document.getElementById("start").style.opacity = 0;
+    t0 = performance.now();
+    frames.length = 0;
+    if (!MEASURE && !REDUCED) {
+      try {
+        const ctx = audio ? audio.ctx : new AudioContext();
+        const { buf, at } = chirpBuffer(ctx);
+        const src = ctx.createBufferSource(); src.buffer = buf; src.connect(ctx.destination);
+        src.start(ctx.currentTime + at / 1000);
+        audio = { ctx, src };
+      } catch (e) { audio = { ctx: null }; }  // no sound device: the night plays silent
+    }
+  };
+  p.mousePressed = begin;
+  p.keyPressed = () => {
+    if (p.key === "h" || p.key === "H") { hudOn = !hudOn; return; }
+    if (p.key === "r" || p.key === "R") { if (audio && audio.src) try { audio.src.stop(); } catch (e) {} audio = null; t0 = null; }
+    begin();
+  };
+
+  let lastFrame = null;
+  p.draw = () => {
+    const now = performance.now(), m0 = now;
+    let t = t0 === null ? 0 : FREEZE !== null ? FREEZE : now - t0;
+    if (REDUCED && FREEZE === null) t = t0 === null ? 0 : GONE + 1600;          // the last frame, eased in by CSS below
+    const s = nightAt(t);
+    sh.setUniform("uRes", [W, H]); sh.setUniform("uAppearRes", [AW, AH]); sh.setUniform("uC", [CX + 0.5, CY + 0.5]);
+    sh.setUniform("uT", t0 === null ? 0 : t); sh.setUniform("uFadeEnd", FADE_END);
+    sh.setUniform("uHoles", s.holes.length);
+    sh.setUniform("uHole0", s.holes[0] || [0, 0, 0, 0]); sh.setUniform("uHole1", s.holes[1] || [0, 0, 0, 0]);
+    const r = s.ripple;
+    sh.setUniform("uRip", r ? [r.R, r.w, r.amp, r.lambda] : [0, 1, 0, 1]);
+    sh.setUniform("uRip2", r ? [r.env, r.c2, r.s2, 1] : [0, 0, 0, 0]);
+    const f = s.flash;
+    sh.setUniform("uFlash", f ? [f.rad, f.a, f.unflash ? f.keep : 1, 1] : [0, 0, 1, 0]);
+    const st = [], sc = [];
+    for (const star of TW) {
+      const x = star.x / 16, y = star.y / 16, rr = star.r / 16;
+      const inLens = s.lens && x + rr > s.lens[0] && x - rr < s.lens[2] && y + rr > s.lens[1] && y - rr < s.lens[3];
+      const tw = (1 + Math.sin(2 * Math.PI * ((t + star.phase) % star.period) / star.period)) / 2;
+      const a = inLens || t0 === null ? 0 : tw * tw * 120 / 256 * faded(x | 0, y | 0, 255, t);
+      st.push(x, y, rr, a); sc.push(star.c[0] / 255, star.c[1] / 255, star.c[2] / 255);
+      if (st.length >= 256) break;
+    }
+    while (st.length < 256) { st.push(0, 0, 1, 0); sc.push(0, 0, 0); }
+    sh.setUniform("uStar", st); sh.setUniform("uStarC", sc); sh.setUniform("uStars", Math.min(64, TW.length));
+    p.rect(-W / 2, -H / 2, W, H);
+    if (MEASURE) {
+      const gl = p.drawingContext, px = new Uint8Array(4);       // reading a pixel waits for the whole frame
+      gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, px);
+      if (lastFrame !== null) frames.push([t, now - lastFrame, performance.now() - m0]);
+      if (t > STAGES[STAGES.length - 1][2]) { window.__night_result = report(); window.__night_done = true; p.noLoop(); }
+    }
+    lastFrame = now;
+    if (FREEZE !== null) window.__night_done = true;
+    const hud = document.getElementById("hud");
+    hud.style.display = hudOn ? "block" : "none";
+    if (hudOn) hud.textContent = `${(t / 1000).toFixed(2)} s  ${stageOf(t)}  ${p.frameRate().toFixed(0)} fps`;
+  };
+}, "stage");
+
+function stats(xs) {
+  const s = [...xs].sort((a, b) => a - b), mean = s.reduce((a, b) => a + b, 0) / (s.length || 1);
+  return { n: s.length, mean: +mean.toFixed(2), p95: +(s[fl(s.length * 0.95)] || 0).toFixed(2), max: +(s[s.length - 1] || 0).toFixed(2) };
+}
+function report() {
+  const out = { bake: Object.fromEntries(Object.entries(bake).map(([k, v]) => [k, typeof v === "number" ? +v.toFixed(1) : v])), stages: {} };
+  for (const [name, a, b] of STAGES) {
+    const fs = frames.filter(([t]) => t >= a && t < b);
+    out.stages[name] = { interval_ms: stats(fs.map((f) => f[1])), render_ms: stats(fs.map((f) => f[2])) };
+  }
+  return out;
+}
+if (REDUCED && FREEZE === null) document.getElementById("stage").animate([{ opacity: 0 }, { opacity: 1 }],
+  { duration: 900, easing: "cubic-bezier(0.3333, 0, 0.6667, 1)", fill: "both" });
+</script>
+</body>
+</html>
diff --git a/docs/design/boot/receipts/frame-times-1280x720.json b/docs/design/boot/receipts/frame-times-1280x720.json
new file mode 100644
index 00000000..841383cf
--- /dev/null
+++ b/docs/design/boot/receipts/frame-times-1280x720.json
@@ -0,0 +1 @@
+{"bake":{"cloudsMs":98.7,"scaleMs":33.4,"starsMs":6.5,"galaxiesMs":38,"appearMs":9.9,"renderer":"ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (LLVM 10.0.0) (0x0000C0DE)), SwiftShader driver)","size":"1280x720","brightStars":24},"stages":{"dark":{"interval_ms":{"n":18,"mean":139.54,"p95":675.1,"max":675.1},"render_ms":{"n":18,"mean":104.28,"p95":262.2,"max":262.2}},"holes":{"interval_ms":{"n":44,"mean":78.13,"p95":118.9,"max":147.6},"render_ms":{"n":44,"mean":73.82,"p95":114.4,"max":140.6}},"spiral":{"interval_ms":{"n":61,"mean":96.95,"p95":151.3,"max":195.1},"render_ms":{"n":61,"mean":93.14,"p95":145.4,"max":191.5}},"merger":{"interval_ms":{"n":39,"mean":92.73,"p95":154.6,"max":169},"render_ms":{"n":39,"mean":88.19,"p95":149,"max":162.5}},"settled":{"interval_ms":{"n":13,"mean":106.74,"p95":139,"max":139},"render_ms":{"n":13,"mean":103.98,"p95":136.1,"max":136.1}}}}
diff --git a/docs/design/boot/receipts/frame-times-1920x1080.json b/docs/design/boot/receipts/frame-times-1920x1080.json
new file mode 100644
index 00000000..6510abd5
--- /dev/null
+++ b/docs/design/boot/receipts/frame-times-1920x1080.json
@@ -0,0 +1 @@
+{"bake":{"cloudsMs":114,"scaleMs":31.6,"starsMs":16.9,"galaxiesMs":54.3,"appearMs":8.5,"renderer":"ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (LLVM 10.0.0) (0x0000C0DE)), SwiftShader driver)","size":"1920x1080","brightStars":41},"stages":{"dark":{"interval_ms":{"n":4,"mean":580.7,"p95":842.4,"max":842.4},"render_ms":{"n":4,"mean":441.43,"p95":668.2,"max":668.2}},"holes":{"interval_ms":{"n":12,"mean":287.92,"p95":451.8,"max":451.8},"render_ms":{"n":12,"mean":274.86,"p95":444.2,"max":444.2}},"spiral":{"interval_ms":{"n":27,"mean":224.74,"p95":304.1,"max":374.5},"render_ms":{"n":27,"mean":217.49,"p95":296.8,"max":368.7}},"merger":{"interval_ms":{"n":12,"mean":306.58,"p95":490.2,"max":490.2},"render_ms":{"n":12,"mean":309.31,"p95":486.4,"max":486.4}},"settled":{"interval_ms":{"n":3,"mean":424.93,"p95":524,"max":524},"render_ms":{"n":3,"mean":402.33,"p95":517.6,"max":517.6}}}}
diff --git a/docs/design/boot/receipts/frame-times.md b/docs/design/boot/receipts/frame-times.md
new file mode 100644
index 00000000..b774e88f
--- /dev/null
+++ b/docs/design/boot/receipts/frame-times.md
@@ -0,0 +1,49 @@
+# Frame time per stage
+
+Two different things were timed. Neither is the iMac.
+
+## 1. The sketch (`night.html`), in a browser with no graphics card
+
+OBSERVED, 2026-10-20, on the Spark. Command (run through `quiet-build`):
+
+```sh
+node docs/design/tools/shoot.mjs "file://$PWD/docs/design/boot/night.html?measure=1&w=1920&h=1080" \
+  --size 1920x1080 --wait "window.__night_done" --timeout-ms 240000 \
+  --result "JSON.stringify(window.__night_result)" > frame-times-1920x1080.json     # exit 0
+```
+
+and the same at 1280x720 (exit 0). Raw results: `frame-times-1920x1080.json`, `frame-times-1280x720.json`.
+
+The browser drew with SwiftShader, a CPU stand-in for a graphics card (the renderer string is in the JSON).
+Headless Chrome on this machine gave no real GPU path. The machine was busy: load average 54.6 on 20 cores
+at the end of the run. Each frame is timed from the start of drawing to a one-pixel read-back, which forces
+the frame to finish.
+
+| stage (ms of the night) | 1920x1080 mean / p95 / max frame (ms) | 1280x720 mean / p95 / max frame (ms) |
+| --- | --- | --- |
+| dark (0 to 2600)        | 441 / 668 / 668 (n 4)  | 104 / 262 / 262 (n 18) |
+| holes (2600 to 6000)    | 275 / 444 / 444 (n 12) | 74 / 114 / 141 (n 44)  |
+| spiral (6000 to 12000)  | 217 / 297 / 369 (n 27) | 93 / 145 / 192 (n 61)  |
+| merger (12000 to 15200) | 309 / 486 / 486 (n 12) | 88 / 149 / 163 (n 39)  |
+| settled (after 15200)   | 402 / 518 / 518 (n 3)  | 104 / 136 / 136 (n 13) |
+
+One-time bakes before the first frame, 1920x1080: clouds 114 ms, scale-up 31.6, stars 16.9, galaxies 54.3,
+appear map 8.5. At 1280x720: 98.7, 33.4, 6.5, 38.0, 9.9.
+
+What this means: on a CPU-only renderer the sketch runs at a few frames a second at 1080p, so it is a
+picture-accurate reference, not a smoothness reference. INFERRED: on any real graphics card the shader is a
+single full-screen pass and should hold the display rate, but that is NOT MEASURED here.
+
+## 2. The kernel's own night (`native/kernel/ui`), on one CPU core
+
+OBSERVED, 2026-10-20: the kernel UI host test, built with `cc` from L266's sources
+(`feat/allen-boot-everywhere@a8c4eaf`), printed:
+
+```
+ALLEN_UI_TEST: PASS (61 checks)
+3768 frames at 3840x2160 on one core: average 12392 us, slowest 83234 us
+```
+
+That is the shipping drawing code, 4K, software only, on one Spark core: about 12.4 ms a frame on average,
+inside a 60 Hz budget (16.7 ms) on average, with a slowest frame of 83 ms. The iMac's own number is UNKNOWN
+until L266 times it on the device.
diff --git a/docs/design/screens/01-power-on.html b/docs/design/screens/01-power-on.html
new file mode 100644
index 00000000..ca7d7456
--- /dev/null
+++ b/docs/design/screens/01-power-on.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 1: power on</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board ">
+  <div class="tag">1 · power on (the maker's logo natively; a black window in aienos-run; we draw nothing)</div>
+  <span hidden data-href="02-night.html"></span>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/02-night.html b/docs/design/screens/02-night.html
new file mode 100644
index 00000000..2ebdbd43
--- /dev/null
+++ b/docs/design/screens/02-night.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 2: the night</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board ">
+  <div class="tag">2 · the night (still at 11.8 s; live reference: ../boot/night.html)</div>
+  <div class="board-still" style="position:absolute;inset:0;background:url('assets/night-11800.jpg') center/cover"></div>
+  <div class="buttons" style="top: 980px"><div class="button rise" data-href="../boot/night.html"><span data-af="small">Play the night with its sound</span></div><div class="button lit rise" data-href="03-allen-arrives.html"><span data-af="small">Next screen</span></div></div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/03-allen-arrives.html b/docs/design/screens/03-allen-arrives.html
new file mode 100644
index 00000000..0cae9108
--- /dev/null
+++ b/docs/design/screens/03-allen-arrives.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 3: Allen arrives</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">3 · Allen arrives</div>
+  <p class="says center rise" style="top: 640px" data-at="0" data-af="voice">Hello. I'm Allen.</p>
+  <p class="says center rise" style="top: 690px" data-at="1400" data-af="voice">I'm going to look after this computer with you.</p>
+  <div class="bar rise" data-at="3600"><span data-af="body">What would you like this computer to do best?</span></div>
+  <span class="not-now" hidden data-href="04-intent.html"></span>
+  <div class="buttons" style="top: 1100px"><div class="button lit" data-href="04-intent.html"><span data-af="small">next</span></div></div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/03b-still-starting.html b/docs/design/screens/03b-still-starting.html
new file mode 100644
index 00000000..5c702778
--- /dev/null
+++ b/docs/design/screens/03b-still-starting.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 3, slow: still starting</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">3 · slow step: what Allen says when a step passes its budget (here 5 s)</div>
+  <p class="says center rise" style="top: 640px" data-at="0" data-af="voice">Still starting. The disk is slow to answer.</p>
+  <div class="center rise" style="position:absolute;left:0;right:0;top:700px"><span class="dot"></span></div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/04-intent.html b/docs/design/screens/04-intent.html
new file mode 100644
index 00000000..b8c50eb6
--- /dev/null
+++ b/docs/design/screens/04-intent.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 4: the one question</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">4 · the one question (intent)</div>
+  <p class="says center rise" data-af="voice" data-at="0">What would you like this computer to do best?</p>
+  <div class="choices" role="listbox" aria-label="What this computer should do best">
+    <div class="choice lit rise" data-href="05-getting-to-know.html" data-at="300">
+      <span data-af="body">Play games smoothly</span>
+      <span class="what" data-af="small">Faster, steadier frames from your graphics and screen</span>
+      <span class="key" data-af="small">Enter</span>
+    </div>
+    <div class="choice rise" data-href="05-getting-to-know.html">
+      <span data-af="body">Run an AI model here</span>
+      <span class="what" data-af="small">An AI that runs on this computer and stays on it</span>
+      <span class="key" data-af="small">Enter</span>
+    </div>
+    <div class="choice rise" data-href="04b-something-else.html">
+      <span data-af="body">Something else</span>
+      <span class="what" data-af="small">Tell me in your own words</span>
+      <span class="key" data-af="small">Enter</span>
+    </div>
+  </div>
+  <p class="not-now center rise" style="top: 892px" data-af="small" data-href="05-getting-to-know.html">Not now</p>
+  <div class="bar rise"><span data-af="body">Or just tell me</span></div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/04b-something-else.html b/docs/design/screens/04b-something-else.html
new file mode 100644
index 00000000..9c787502
--- /dev/null
+++ b/docs/design/screens/04b-something-else.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 4: something else</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">4 · something else: Allen says what he understood</div>
+  <p class="says center rise" style="top: 640px" data-at="0" data-af="voice" data-wrap="900">You want a quiet computer for writing. I'll keep things simple and save power.</p>
+  <div class="buttons" style="top: 760px">
+    <div class="button rise lit" data-href="05-getting-to-know.html"><span data-af="body">That's right</span></div>
+    <div class="button rise" data-href="04-intent.html"><span data-af="body">Not quite</span></div>
+  </div>
+  <div class="bar rise focus"><span class="typed" data-af="body">I mostly write, and I like it quiet</span><span class="caret"></span></div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/05-getting-to-know.html b/docs/design/screens/05-getting-to-know.html
new file mode 100644
index 00000000..75f5afd8
--- /dev/null
+++ b/docs/design/screens/05-getting-to-know.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 5: getting to know this computer</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">5 · getting to know this computer (example values; each line eases in as soon as it is known)</div>
+  <p class="says center rise" style="top: 590px" data-at="0" data-af="voice">Getting to know this computer.</p>
+  <div class="found" style="top: 652px">
+    <span class="label rise" data-af="body">Screen</span><span class="value rise " data-af="body">2560 by 1440, 144 times a second</span>
+    <span class="label rise" data-af="body">Graphics</span><span class="value rise " data-af="body">NVIDIA GeForce RTX 4070, 12 GB of its own memory</span>
+    <span class="label rise" data-af="body">Processor</span><span class="value rise " data-af="body">AMD Ryzen 7 7800X3D, 8 cores</span>
+    <span class="label rise" data-af="body">Memory</span><span class="value rise " data-af="body">32 GB</span>
+    <span class="label rise" data-af="body">Storage</span><span class="value rise " data-af="body">1 TB fast drive, 2 TB drive</span>
+    <span class="label rise" data-af="body">Network</span><span class="value rise " data-af="body">wired, connected</span>
+    <span class="label rise" data-af="body">Sound</span><span class="value rise " data-af="body">speakers and a microphone</span>
+    <span class="label rise" data-af="body">Keyboard and mouse</span><span class="value rise " data-af="body">working</span>
+  </div>
+  <div class="rise" style="position:absolute;left:880px;top:928px"><span class="dot"></span></div>
+  <span class="not-now" hidden data-href="05b-what-allen-found.html"></span>
+  <div class="buttons" style="top: 1100px"><div class="button lit" data-href="05b-what-allen-found.html"><span data-af="small">next</span></div></div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/05b-what-allen-found.html b/docs/design/screens/05b-what-allen-found.html
new file mode 100644
index 00000000..fd0e5872
--- /dev/null
+++ b/docs/design/screens/05b-what-allen-found.html
@@ -0,0 +1,91 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 5: what Allen found</title>
+<link rel="stylesheet" href="screens.css">
+<style>
+  /* the computer as a constellation round Allen: one star per part, a thread of light to him (mind.c threads) */
+  .threads { position: absolute; inset: 0; }
+  .threads line { stroke: rgb(var(--allen-colors-glow-rgb) / .22); stroke-width: 1.2; stroke-linecap: round;
+                  stroke-dasharray: 600; stroke-dashoffset: 600;
+                  animation: draw 900ms var(--allen-motion-ease-out) forwards; }
+  .threads line:nth-child(n) { animation-delay: calc(var(--i, 0) * 110ms + 200ms); }
+  @keyframes draw { to { stroke-dashoffset: 0; } }
+  .part { position: absolute; width: 400px; display: grid; justify-items: center; row-gap: 8px; }
+  .star { width: 9px; height: 9px; border-radius: 50%; background: var(--allen-colors-heart-core);
+          box-shadow: 0 0 10px var(--allen-colors-warm), 0 0 26px rgb(var(--allen-colors-glow-rgb) / .5); }
+  .plabel { color: var(--allen-colors-hint); }
+  .pvalue { color: var(--allen-colors-primary); }
+  @media (prefers-reduced-motion: reduce) { .threads line { animation: none; stroke-dashoffset: 0; } }
+</style>
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">5 · what Allen found (example values; drawn as a constellation round Allen)</div>
+  <svg class="threads" width="1920" height="1080" viewBox="0 0 1920 1080" aria-hidden="true">
+      <line style="--i:0" x1="828" y1="360" x2="612" y2="243"/>
+      <line style="--i:1" x1="960" y1="282" x2="960" y2="176"/>
+      <line style="--i:2" x1="1092" y1="360" x2="1308" y2="243"/>
+      <line style="--i:3" x1="1110" y1="432" x2="1606" y2="430"/>
+      <line style="--i:4" x1="1097" y1="494" x2="1467" y2="662"/>
+      <line style="--i:5" x1="1038" y1="560" x2="1153" y2="748"/>
+      <line style="--i:6" x1="882" y1="560" x2="767" y2="748"/>
+      <line style="--i:7" x1="822" y1="491" x2="483" y2="635"/>
+      <line style="--i:8" x1="810" y1="432" x2="314" y2="430"/>
+  </svg>
+  <div class="part rise" data-at="300" style="left:400px;top:162px">
+    <span class="star"></span>
+    <span class="plabel" data-af="small">Screen</span>
+    <span class="pvalue" data-af="body">2560 by 1440, 144 a second</span>
+  </div>
+  <div class="part rise" data-at="410" style="left:760px;top:88px">
+    <span class="star"></span>
+    <span class="plabel" data-af="small">Graphics</span>
+    <span class="pvalue" data-af="body">RTX 4070, 12 GB</span>
+  </div>
+  <div class="part rise" data-at="520" style="left:1120px;top:162px">
+    <span class="star"></span>
+    <span class="plabel" data-af="small">Processor</span>
+    <span class="pvalue" data-af="body">Ryzen 7 7800X3D, 8 cores</span>
+  </div>
+  <div class="part rise" data-at="630" style="left:1420px;top:422px">
+    <span class="star"></span>
+    <span class="plabel" data-af="small">Memory</span>
+    <span class="pvalue" data-af="body">32 GB</span>
+  </div>
+  <div class="part rise" data-at="740" style="left:1280px;top:660px">
+    <span class="star"></span>
+    <span class="plabel" data-af="small">Storage</span>
+    <span class="pvalue" data-af="body">1 TB fast, 2 TB</span>
+  </div>
+  <div class="part rise" data-at="850" style="left:960px;top:752px">
+    <span class="star"></span>
+    <span class="plabel" data-af="small">Network</span>
+    <span class="pvalue" data-af="body">wired, connected</span>
+  </div>
+  <div class="part rise" data-at="960" style="left:560px;top:752px">
+    <span class="star"></span>
+    <span class="plabel" data-af="small">Sound</span>
+    <span class="pvalue" data-af="body">speakers and a microphone</span>
+  </div>
+  <div class="part rise" data-at="1070" style="left:270px;top:632px">
+    <span class="star"></span>
+    <span class="plabel" data-af="small">Keyboard and mouse</span>
+    <span class="pvalue" data-af="body">working</span>
+  </div>
+  <div class="part rise" data-at="1180" style="left:100px;top:422px">
+    <span class="star"></span>
+    <span class="plabel" data-af="small">Nearby</span>
+    <span class="pvalue" data-af="body">2 AienOS computers, a printer</span>
+  </div>
+  <p class="says center rise" style="top: 848px" data-at="1400" data-af="voice">This is your computer as I see it.</p>
+  <div class="buttons" style="top: 918px">
+    <div class="button lit rise" data-at="1700" data-href="06-consent.html"><span data-af="body">Next</span></div>
+  </div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/06-consent.html b/docs/design/screens/06-consent.html
new file mode 100644
index 00000000..407cfd51
--- /dev/null
+++ b/docs/design/screens/06-consent.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 6: the one consent</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">6 · the one consent (the list holds only what changes the machine)</div>
+  <p class="says center rise" style="top: 560px" data-at="0" data-af="voice">Here's what I'd like to set up:</p>
+  <div class="panel rise" style="left: 640px; top: 616px; width: 640px">
+    <p data-af="body" style="margin: 4px 0 14px">Use my own drivers for the graphics, network and storage</p>
+    <p data-af="body" style="margin: 0 0 14px">Set your screen to 144 times a second</p>
+    <p data-af="body" style="margin: 0 0 14px">Run the AI on your graphics card</p>
+    <p data-af="body" style="margin: 0 0 18px">Build drivers for the 2 parts I can't drive yet</p>
+    <p data-af="small" style="color: var(--allen-colors-hint); margin: 0">I won't touch your other drives, and you can undo any of this.</p>
+  </div>
+  <div class="buttons" style="top: 880px">
+    <div class="button rise lit" data-href="07a-games.html"><span data-af="body">Set it up</span></div>
+    <div class="button rise" data-href="06b-show-each.html"><span data-af="body">Show me each one</span></div>
+    <div class="button rise" data-href="09-ready.html"><span data-af="body">Not now</span></div>
+  </div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/06b-show-each.html b/docs/design/screens/06b-show-each.html
new file mode 100644
index 00000000..7ed61d71
--- /dev/null
+++ b/docs/design/screens/06b-show-each.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 6: one at a time</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">6 · show me each one (1 of 4)</div>
+  <p class="center rise" style="position:absolute;left:0;right:0;top:600px;color:var(--allen-colors-hint)" data-af="small">1 of 4</p>
+  <p class="says center rise" style="top: 640px" data-at="120" data-af="voice" data-wrap="900">Use my own drivers for the graphics, network and storage?</p>
+  <div class="buttons" style="top: 740px">
+    <div class="button rise lit" data-href="06b-show-each.html"><span data-af="body">Yes</span></div>
+    <div class="button rise" data-href="06b-show-each.html"><span data-af="body">Skip</span></div>
+  </div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/07a-games.html b/docs/design/screens/07a-games.html
new file mode 100644
index 00000000..b659d9a8
--- /dev/null
+++ b/docs/design/screens/07a-games.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 7a: making games smoother</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">7a · play games smoothly (example values; every number measured on this machine)</div>
+  <p class="says center rise" style="top: 590px" data-at="0" data-af="voice">Making games smoother.</p>
+  <div class="found" style="top: 652px">
+    <span class="label rise" data-af="body">Screen</span><span class="value rise " data-af="body">set to 144 times a second</span>
+    <span class="label rise" data-af="body">Graphics</span><span class="value rise " data-af="body">using my driver</span>
+    <span class="label rise" data-af="body">Processor</span><span class="value rise " data-af="body">keeping the fast cores free for the game</span>
+    <span class="label rise" data-af="body">Measured here</span><span class="value rise " data-af="body">118 frames a second in my test scene (before: 97)</span>
+  </div>
+  <p class="center rise" style="position:absolute;left:0;right:0;top:820px;color:var(--allen-colors-hint)" data-af="body">I can't tune this graphics card's clock speed yet. I'm building a driver that can.</p>
+  <div class="buttons" style="top: 900px">
+    <div class="button rise lit" data-href="07b-ai-fit.html"><span data-af="body">Next</span></div>
+  </div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/07b-ai-fit.html b/docs/design/screens/07b-ai-fit.html
new file mode 100644
index 00000000..95e187f6
--- /dev/null
+++ b/docs/design/screens/07b-ai-fit.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 7b: finding the best way to run an AI</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">7b · run an AI model here (fit from the model's measured size, not a table)</div>
+  <p class="says center rise" style="top: 590px" data-at="0" data-af="voice">Finding the best way to run an AI here.</p>
+  <p class="center rise" style="position:absolute;left:460px;width:1000px;top:660px;color:var(--allen-colors-primary)" data-af="body" data-wrap="1000">Your graphics card has 12 GB of its own memory. Models up to about 14 billion parameters fit on it. The 30 billion one fits if I share it with main memory, but it runs slower.</p>
+  <div class="buttons" style="top: 800px">
+    <div class="button rise lit" data-href="07c-one-found.html"><span data-af="body">Next</span></div>
+  </div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/07c-connect.html b/docs/design/screens/07c-connect.html
new file mode 100644
index 00000000..ca449b1b
--- /dev/null
+++ b/docs/design/screens/07c-connect.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 7c: connect my own</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">7c · connect my own: which service</div>
+  <p class="says center rise" style="top: 620px" data-at="0" data-af="voice">Which service?</p>
+  <div class="buttons" style="top: 690px">
+    <div class="button rise lit" data-href="07c-key.html"><span data-af="body">Claude</span></div>
+    <div class="button rise" data-href="07c-key.html"><span data-af="body">ChatGPT</span></div>
+    <div class="button rise" data-href="07c-key.html"><span data-af="body">Another service</span></div>
+  </div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/07c-key-failed.html b/docs/design/screens/07c-key-failed.html
new file mode 100644
index 00000000..1ed302e5
--- /dev/null
+++ b/docs/design/screens/07c-key-failed.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 7c: the key did not work</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">7c · the key did not work</div>
+  <p class="says center rise" style="top: 620px" data-at="0" data-af="voice" data-wrap="900">That key didn't work. Claude said the key isn't valid. Try again?</p>
+  <div class="buttons" style="top: 720px">
+    <div class="button rise lit" data-href="07c-key.html"><span data-af="body">Try again</span></div>
+    <div class="button rise" data-href="07c-connect.html"><span data-af="body">Use a different service</span></div>
+  </div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/07c-key.html b/docs/design/screens/07c-key.html
new file mode 100644
index 00000000..b81b433c
--- /dev/null
+++ b/docs/design/screens/07c-key.html
@@ -0,0 +1,19 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 7c: paste a key</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">7c · paste your key (checking it with one short request)</div>
+  <p class="says center rise" style="top: 620px" data-at="0" data-af="voice" data-wrap="900">Paste your key for Claude. I'll keep it sealed on this computer and won't show it again.</p>
+  <p class="center rise" style="position:absolute;left:0;right:0;top:860px;color:var(--allen-colors-hint)" data-af="small">Checking the key <span class="dot" style="margin-left:10px"></span></p>
+  <div class="bar rise focus"><span class="typed" data-af="body">********************************</span><span class="caret"></span></div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/07c-none.html b/docs/design/screens/07c-none.html
new file mode 100644
index 00000000..148f3430
--- /dev/null
+++ b/docs/design/screens/07c-none.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 7c: none found</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">7c · which AI: none found</div>
+  <p class="says center rise" style="top: 620px" data-at="0" data-af="voice">I didn't find an AI model on this computer.</p>
+  <div class="choices" style="top: 690px" role="listbox">
+    <div class="choice rise lit" data-href="09-ready.html"><span data-af="body">Get one for me</span><span class="what" data-af="small">The 30B model, an 18 GB download</span><span class="key" data-af="small">Enter</span></div>
+    <div class="choice rise" data-href="07c-connect.html"><span data-af="body">Connect my own</span><span class="what" data-af="small">Claude, ChatGPT or another service</span><span class="key" data-af="small">Enter</span></div>
+  </div>
+  <p class="not-now center rise" style="top: 820px" data-af="small" data-href="09-ready.html">Not now</p>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/07c-one-found.html b/docs/design/screens/07c-one-found.html
new file mode 100644
index 00000000..6180acd3
--- /dev/null
+++ b/docs/design/screens/07c-one-found.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 7c: one model found</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">7c · which AI: exactly one found (lit choice is taken after 10 s, and Allen says so)</div>
+  <p class="says center rise" style="top: 640px" data-at="0" data-af="voice">I found Qwen 30B on this computer. I'll use it.</p>
+  <div class="buttons" style="top: 720px">
+    <div class="button rise lit" data-href="09-ready.html"><span data-af="body">Use it</span></div>
+    <div class="button rise" data-href="07c-several.html"><span data-af="body">Choose another</span></div>
+  </div>
+  <p class="center rise" style="position:absolute;left:0;right:0;top:796px;color:var(--allen-colors-faint)" data-af="small">I'll go with this in 10 seconds</p>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/07c-several.html b/docs/design/screens/07c-several.html
new file mode 100644
index 00000000..0281eb17
--- /dev/null
+++ b/docs/design/screens/07c-several.html
@@ -0,0 +1,23 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 7c: several found</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">7c · which AI: several found (best fit first and lit)</div>
+  <p class="says center rise" style="top: 600px" data-at="0" data-af="voice">I found three. The first one fits this computer best.</p>
+  <div class="choices" style="top: 660px" role="listbox">
+    <div class="choice rise lit" data-href="09-ready.html"><span data-af="body">Qwen 30B</span><span class="what" data-af="small">Runs on your graphics card</span><span class="key" data-af="small">Enter</span></div>
+    <div class="choice rise" data-href="09-ready.html"><span data-af="body">Llama 8B</span><span class="what" data-af="small">Runs on your graphics card, quicker, shorter answers</span><span class="key" data-af="small">Enter</span></div>
+    <div class="choice rise" data-href="09-ready.html"><span data-af="body">Qwen 27B on the Spark</span><span class="what" data-af="small">On the Spark next door, fast</span><span class="key" data-af="small">Enter</span></div>
+    <div class="choice rise" data-href="07c-connect.html"><span data-af="body">Connect my own</span><span class="what" data-af="small">Claude, ChatGPT or another service</span><span class="key" data-af="small">Enter</span></div>
+  </div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/08-hardware.html b/docs/design/screens/08-hardware.html
new file mode 100644
index 00000000..43c2fb38
--- /dev/null
+++ b/docs/design/screens/08-hardware.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 8: setting up your hardware</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">8 · setting up your hardware (six state words, nothing else)</div>
+  <p class="says center rise" style="top: 590px" data-at="0" data-af="voice">Setting up your hardware.</p>
+  <div class="found" style="top: 652px">
+    <span class="label rise" data-af="body">Graphics (AMD Radeon Pro 580)</span><span class="value rise state" data-af="body">ready, my driver</span>
+    <span class="label rise" data-af="body">Network (Broadcom)</span><span class="value rise state" data-af="body">ready, my driver</span>
+    <span class="label rise" data-af="body">Wi-Fi (Broadcom BCM4360)</span><span class="value rise state" data-af="body">building a driver for it</span>
+    <span class="label rise" data-af="body">Webcam</span><span class="value rise state" data-af="body">ready, the maker's driver</span>
+  </div>
+  <p class="center rise" style="position:absolute;left:0;right:0;top:820px;color:var(--allen-colors-hint)" data-af="small">Building a driver can take a while. You can keep using the computer.</p>
+  <div class="bar rise"><span data-af="body">Speak to Allen</span></div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/08b-turn-on.html b/docs/design/screens/08b-turn-on.html
new file mode 100644
index 00000000..53fdb3b6
--- /dev/null
+++ b/docs/design/screens/08b-turn-on.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 8: the second consent</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">8 · the second consent (only when a built driver is ready)</div>
+  <p class="says center rise" style="top: 620px" data-at="0" data-af="voice" data-wrap="900">I built a driver for your Wi-Fi and tested it without touching the real one. Turn it on?</p>
+  <div class="buttons" style="top: 740px">
+    <div class="button rise lit" data-href="09-ready.html"><span data-af="body">Turn it on</span></div>
+    <div class="button rise" data-href="09-ready.html"><span data-af="body">Not now</span></div>
+  </div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/08c-put-back.html b/docs/design/screens/08c-put-back.html
new file mode 100644
index 00000000..85496e08
--- /dev/null
+++ b/docs/design/screens/08c-put-back.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 8: it failed, the old one is back</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">8 · a built driver failed on the real device: Allen undoes it by himself</div>
+  <p class="says center rise" style="top: 640px" data-at="0" data-af="voice" data-wrap="900">That didn't work on the real Wi-Fi. I've put the old driver back, and I'll keep working on it.</p>
+  <div class="bar rise"><span data-af="body">Speak to Allen</span></div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/09-ready.html b/docs/design/screens/09-ready.html
new file mode 100644
index 00000000..59cb9fe0
--- /dev/null
+++ b/docs/design/screens/09-ready.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Screen 9: Allen is ready</title>
+<link rel="stylesheet" href="screens.css">
+</head>
+<body>
+<div class="board sky">
+  <div class="tag">9 · Allen is ready</div>
+  <p class="says center rise" style="top: 600px" data-at="0" data-af="voice">Allen is ready.</p>
+  <p class="center rise" style="position:absolute;left:460px;width:1000px;top:664px;color:var(--allen-colors-hint)" data-af="body" data-wrap="1000">Games will use your screen at 144 times a second. Your AI is Qwen 30B, on your graphics card. I'm still building a driver for your Wi-Fi and I'll tell you when it's ready.</p>
+  <p class="says center rise" style="top: 800px" data-at="900" data-af="voice">Ask me anything, or tell me what you'd like to do.</p>
+  <div class="bar rise focus"><span data-af="body">Speak to Allen</span><span class="caret"></span></div>
+</div>
+<script src="allen-font.js"></script>
+<script src="screen.js"></script>
+</body>
+</html>
diff --git a/docs/design/screens/README.md b/docs/design/screens/README.md
new file mode 100644
index 00000000..71770360
--- /dev/null
+++ b/docs/design/screens/README.md
@@ -0,0 +1,33 @@
+# Allen's first-run screens
+
+Mockups of every screen in `docs/FIRST_RUN_UX.md` (L266, `origin/feat/allen-boot-everywhere@b1c24cb2`), on
+the kernel's 1920 x 1080 design grid, using only the generated tokens (`../tokens/allen-tokens.css`) and the
+kernel's own stroke font (`allen-font.js`, extracted from `native/kernel/ui/allen_font.c`). This is the build
+target for L267 (the wizard) and for the runner windows (L261, L262, L265).
+
+- Start at `index.html`. Each page works with the keyboard alone: arrows move the lit choice, Enter or Space
+  picks it, Escape is "Not now", typing goes to the bar. Links follow the flow.
+- `?clean=1` hides the screen's name tag. `shots/` holds every screen at 960 x 540 (shot at 1920 x 1080) and
+  `shots/all-2560x1440.jpg`, all 22 at 2560 x 1440, to show the layout holds when scaled.
+- Pages are generated: `cd docs/design/screens && node ../tools/make-screens.mjs && node ../tools/make-found.mjs`
+  (04-intent is written by hand). Shots: `node ../tools/shoot.mjs "file://$PWD/<page>?clean=1" --size 1920x1080
+  --wait "window.__screen_ready && performance.now() > 5000" --out <png>`; all 44 exit 0 on 2026-10-20.
+- `05b-what-allen-found.html` is new: the found parts as a constellation round Allen's light, one star each,
+  threads drawn in one by one. It sits between screen 5 and screen 6.
+- Backgrounds are real kernel frames (`assets/`, rendered from L266's `allen_ui.c`), so the sky matches.
+
+## Wording changes against the spec (for L266 to take or leave)
+
+Every line was read aloud and cut for plainness. Where the mockup differs from `FIRST_RUN_UX.md`:
+
+| Screen | Spec says | Mockup says | Why |
+| --- | --- | --- | --- |
+| 4 | Faster frames, a steady picture, the most from your screen and graphics. | Faster, steadier frames from your graphics and screen | one idea, fits the row |
+| 4 | Use the graphics and memory in this computer to run an AI that stays on it. | An AI that runs on this computer and stays on it | says what it is, not how |
+| 4 | (bar line) What would you like this computer to do best? | question above the choices; bar says "Or just tell me" | the question and the bar no longer repeat each other |
+| 6 | Nothing on your other drives is changed. You can undo any of this. | I won't touch your other drives, and you can undo any of this. | Allen speaks as himself |
+| 7b | ...fits if I share it with main memory, slower. | ...fits if I share it with main memory, but it runs slower. | the clipped ending read as a typo |
+| 7c | It stays sealed on this computer and is never shown again. | I'll keep it sealed on this computer and won't show it again. | Allen speaks as himself |
+| 7c | That key didn't work. The service said: key not valid. Try again? | That key didn't work. Claude said the key isn't valid. Try again? | names who said it, no colon quote |
+| 8 | I built a driver for your Wi-Fi and tested it safely. Turn it on? | I built a driver for your Wi-Fi and tested it without touching the real one. Turn it on? | "safely" is a claim; this says what was done |
+| 8 | I've put the old one back. I'll keep working on it. | I've put the old driver back, and I'll keep working on it. | "the old one" was unclear |
diff --git a/docs/design/screens/allen-font.js b/docs/design/screens/allen-font.js
new file mode 100644
index 00000000..b9e31f97
--- /dev/null
+++ b/docs/design/screens/allen-font.js
@@ -0,0 +1,193 @@
+// allen-font.js -- Allen's stroke typeface for the screen mockups.
+// Generated from native/kernel/ui/allen_font.c on feat/allen-boot-everywhere@a8c4eaf by docs/design/tools/extract-font.mjs. Do not edit.
+// Glyph grid: cap height at y = 0, baseline at y = 20; one design unit = cap / 20 px. Commands: wN advance,
+// M move, L line, A cx,cy,rx,ry,a0,a1 arc in degrees (0 right, 90 down), D dot. Round caps and joins.
+// Half the stroke width is weight / 1000 design units (kernel ck_af_face_init).
+"use strict";
+const AF_GLYPHS = [
+  "w6",
+  "w6 M3,0 L3,14 D3,20",
+  "w10 M3,0 L3,5 M7,0 L7,5",
+  "w15 M6,2 L4,20 M11,2 L9,20 M2,8 L13,8 M1,14 L12,14",
+  "w15 A8,5,5,5,-30,-270 A8,15,5,5,270,510 M8,-2 L8,22",
+  "w16 A4,4,2,3,0,360 A12,16,2,3,0,360 M13,1 L3,19",
+  "w16 M14,20 L5,9 A7,5,3,4,150,400 L3,14 A7,15,4,5,180,60 L13,11",
+  "w6 M3,0 L3,5",
+  "w9 A10,10,6,12,240,120",
+  "w9 A-1,10,6,12,-60,60",
+  "w14 M7,2 L7,10 M3,4 L11,8 M11,4 L3,8",
+  "w14 M2,12 L12,12 M7,7 L7,17",
+  "w6 M3,19 L2,23",
+  "w11 M2,13 L9,13",
+  "w6 D3,20",
+  "w12 M10,0 L2,20",
+  "w14 A7,10,5,10,0,360",
+  "w14 M3,4 L8,0 L8,20",
+  "w14 A7,6,5,6,200,400 L2,20 L12,20",
+  "w14 A7,5,5,5,200,450 A7,15,5,5,270,520",
+  "w14 M10,20 L10,0 L1,14 L13,14",
+  "w14 M12,0 L4,0 L4,9 A7,14,5,6,235,520",
+  "w14 A7,14,5,6,0,360 M10,0 L3,11",
+  "w14 M2,0 L12,0 L5,20",
+  "w14 A7,5,4,5,0,360 A7,15,5,5,0,360",
+  "w14 A7,6,5,6,0,360 M4,20 L11,9",
+  "w6 D3,8 D3,20",
+  "w6 D3,8 M3,19 L2,23",
+  "w14 M12,6 L2,12 L12,18",
+  "w14 M2,10 L12,10 M2,15 L12,15",
+  "w14 M2,6 L12,12 L2,18",
+  "w14 A7,5,5,5,190,450 L7,14 D7,20",
+  "w19 A9,12,3,4,0,360 M12,8 L12,14 A14,14,2,2,180,0 A9,11,7,9,0,-300",
+  "w16 M2,20 L8,0 L14,20 M4,13 L12,13",
+  "w15 M2,0 L2,20 M2,0 L8,0 A8,5,4,5,270,450 L2,10 M2,10 L9,10 A9,15,4,5,270,450 L2,20",
+  "w17 A9,10,7,10,45,315",
+  "w16 M2,0 L2,20 M2,0 L6,0 A6,10,8,10,270,450 L2,20",
+  "w14 M12,0 L2,0 L2,20 L12,20 M2,10 L10,10",
+  "w13 M12,0 L2,0 L2,20 M2,10 L10,10",
+  "w18 A9,10,7,10,-45,-360 M11,10 L16,10",
+  "w16 M2,0 L2,20 M14,0 L14,20 M2,10 L14,10",
+  "w6 M3,0 L3,20",
+  "w13 M10,0 L10,14 A6,14,4,6,0,180",
+  "w15 M2,0 L2,20 M13,0 L2,12 M6,8 L14,20",
+  "w13 M2,0 L2,20 L12,20",
+  "w20 M2,20 L2,0 L10,14 L18,0 L18,20",
+  "w16 M2,20 L2,0 L14,20 L14,0",
+  "w20 A10,10,8,10,0,360",
+  "w15 M2,20 L2,0 L8,0 A8,5,5,5,270,450 L2,10",
+  "w20 A10,10,8,10,0,360 M12,14 L18,21",
+  "w15 M2,20 L2,0 L8,0 A8,5,5,5,270,450 L2,10 M8,10 L14,20",
+  "w16 A8,5,5,5,-30,-270 A8,15,5,5,270,510",
+  "w16 M1,0 L15,0 M8,0 L8,20",
+  "w16 M2,0 L2,13 A8,13,6,7,180,0 L14,0",
+  "w16 M1,0 L8,20 L15,0",
+  "w22 M1,0 L6,20 L11,0 L16,20 L21,0",
+  "w16 M2,0 L14,20 M14,0 L2,20",
+  "w16 M1,0 L8,10 L15,0 M8,10 L8,20",
+  "w16 M2,0 L14,0 L2,20 L14,20",
+  "w9 M7,-1 L3,-1 L3,21 L7,21",
+  "w12 M2,0 L10,20",
+  "w9 M2,-1 L6,-1 L6,21 L2,21",
+  "w12 M2,8 L6,1 L10,8",
+  "w14 M1,23 L13,23",
+  "w7 M2,0 L4,4",
+  "w15 A7,14,5,6,0,360 M12,8 L12,20",
+  "w15 M2,0 L2,20 A7,14,5,6,0,360",
+  "w13 A7,14,5,6,40,320",
+  "w15 A7,14,5,6,0,360 M12,0 L12,20",
+  "w14 M2,14 L12,14 A7,14,5,6,0,-320",
+  "w11 M5,20 L5,4 A9,4,4,4,180,300 M2,8 L10,8",
+  "w15 A7,14,5,6,0,360 M12,8 L12,22 A7,22,5,5,0,150",
+  "w15 M2,0 L2,20 A7,13,5,5,180,360 L12,20",
+  "w6 M3,8 L3,20 D3,3",
+  "w7 M4,8 L4,22 A0,22,4,5,0,120 D4,3",
+  "w13 M2,0 L2,20 M11,8 L2,15 M5,13 L12,20",
+  "w6 M3,0 L3,20",
+  "w21 M2,8 L2,20 A6,12,4,4,180,360 L10,20 A14,12,4,4,180,360 L18,20",
+  "w15 M2,8 L2,20 A7,13,5,5,180,360 L12,20",
+  "w14 A7,14,5,6,0,360",
+  "w15 M2,8 L2,27 A7,14,5,6,0,360",
+  "w15 A7,14,5,6,0,360 M12,8 L12,27",
+  "w10 M2,8 L2,20 A7,13,5,5,180,290",
+  "w14 A7,11,4,3,-30,-270 A7,17,4,3,270,510",
+  "w11 M5,2 L5,17 A8,17,3,3,180,40 M2,8 L10,8",
+  "w15 M2,8 L2,15 A7,15,5,5,180,0 M12,8 L12,20",
+  "w14 M2,8 L7,20 L12,8",
+  "w20 M2,8 L6,20 L10,8 L14,20 L18,8",
+  "w14 M2,8 L12,20 M12,8 L2,20",
+  "w14 M2,8 L7,20 M12,8 L4,27",
+  "w14 M2,8 L12,8 L2,20 L12,20",
+  "w10 M8,-1 L6,0 L6,8 L4,10 L6,12 L6,20 L8,21",
+  "w6 M3,-1 L3,23",
+  "w10 M2,-1 L4,0 L4,8 L6,10 L4,12 L4,20 L2,21",
+  "w14 M2,13 L5,11 L9,14 L12,12"
+];
+
+// The faces Allen's window uses (allen_ui.c 823: cap heights at 1080p; 860: weights).
+const AF_FACES = { voice: { cap: 19, weight: 1000, line: 40 }, body: { cap: 15, weight: 1150, line: 30 },
+                   small: { cap: 11, weight: 1250, line: 22 } };
+
+function afGlyph(ch) {
+  const code = ch.charCodeAt(0);
+  return AF_GLYPHS[code >= 32 && code <= 126 ? code - 32 : "?".charCodeAt(0) - 32];
+}
+
+function afAdvance(ch) { return parseInt(afGlyph(ch).slice(1), 10); }
+
+// SVG path data for one line of text, in px, pen starting at x0 with the cap top at y0.
+function afPath(text, cap, x0 = 0, y0 = 0) {
+  const u = cap / 20, out = [];
+  let pen = x0;
+  for (const ch of text) {
+    const g = afGlyph(ch), toks = g.split(" ").slice(1);
+    const P = (x, y) => `${(pen + x * u).toFixed(2)} ${(y0 + y * u).toFixed(2)}`;
+    for (const t of toks) {
+      const n = t.slice(1).split(",").map(Number);
+      if (t[0] === "M") out.push("M" + P(n[0], n[1]));
+      else if (t[0] === "L") out.push("L" + P(n[0], n[1]));
+      else if (t[0] === "D") out.push("M" + P(n[0], n[1]) + "l0.01 0");
+      else if (t[0] === "A") {
+        const [cx, cy, rx, ry, a0, a1] = n, steps = Math.max(2, Math.ceil(Math.abs(a1 - a0) / 8));
+        for (let i = 0; i <= steps; i++) {
+          const a = ((a0 + (a1 - a0) * i / steps) * Math.PI) / 180;
+          out.push((i ? "L" : "M") + P(cx + rx * Math.cos(a), cy + ry * Math.sin(a)));
+        }
+      }
+    }
+    pen += parseInt(g.slice(1), 10) * u;
+  }
+  return { d: out.join(""), width: pen - x0 };
+}
+
+function afMeasure(text, cap) { let w = 0; for (const ch of text) w += afAdvance(ch); return (w * cap) / 20; }
+
+// Word wrap to a width in px (the kernel wraps greedily, allen_ui.c 150), then balanced: the narrowest width
+// that keeps the same number of lines, so no line ends with one stranded word.
+function afWrapAt(text, cap, width) {
+  const lines = [];
+  for (const para of text.split("\n")) {
+    let line = "";
+    for (const word of para.split(" ")) {
+      const next = line ? line + " " + word : word;
+      if (line && afMeasure(next, cap) > width) { lines.push(line); line = word; } else line = next;
+    }
+    lines.push(line);
+  }
+  return lines;
+}
+function afWrap(text, cap, width) {
+  const greedy = afWrapAt(text, cap, width);
+  if (greedy.length < 2) return greedy;
+  let lo = 0, hi = width;
+  while (hi - lo > 2) { const mid = (lo + hi) / 2; if (afWrapAt(text, cap, mid).length <= greedy.length) hi = mid; else lo = mid; }
+  return afWrapAt(text, cap, hi);
+}
+
+// Draws every [data-af] element's text with the stroke font. The real text stays in the page for screen
+// readers and search; the drawing is aria-hidden. data-af = voice | body | small; <p> wraps to its width (or data-wrap px), anything else stays on one line.
+function afRender(root = document) {
+  for (const el of root.querySelectorAll("[data-af]")) {
+    if (el.dataset.afDone) continue;
+    const face = AF_FACES[el.dataset.af] || AF_FACES.body, text = el.textContent.replace(/\s+/g, " ").trim();
+    const wrap = Number(el.dataset.wrap || 0) || (el.tagName === "P" ? el.clientWidth || 900 : 1e9);  // only paragraphs wrap
+    const lines = afWrap(text, face.cap, wrap), sw = (2 * face.weight / 1000) * (face.cap / 20);
+    const w = Math.max(...lines.map((l) => afMeasure(l, face.cap))) + sw * 2;
+    const h = (lines.length - 1) * face.line + face.cap * 27 / 20 + sw * 2;
+    const align = getComputedStyle(el).textAlign;
+    const d = lines.map((l, i) => {
+      const lw = afMeasure(l, face.cap), x = align === "center" ? (w - lw) / 2 : align === "right" ? w - lw - sw : sw;
+      return afPath(l, face.cap, x, sw + i * face.line).d;
+    }).join("");
+    const ns = "http://www.w3.org/2000/svg", svg = document.createElementNS(ns, "svg");
+    svg.setAttribute("width", w.toFixed(1)); svg.setAttribute("height", h.toFixed(1));
+    svg.setAttribute("viewBox", `0 0 ${w.toFixed(1)} ${h.toFixed(1)}`); svg.setAttribute("aria-hidden", "true");
+    svg.classList.add("af-svg");
+    const path = document.createElementNS(ns, "path");
+    path.setAttribute("d", d); path.setAttribute("fill", "none"); path.setAttribute("stroke", "currentColor");
+    path.setAttribute("stroke-width", sw.toFixed(2)); path.setAttribute("stroke-linecap", "round");
+    path.setAttribute("stroke-linejoin", "round");
+    svg.appendChild(path);
+    const span = document.createElement("span");
+    span.className = "af-text"; span.textContent = text;
+    el.textContent = ""; el.append(span, svg); el.dataset.afDone = "1";
+  }
+}
diff --git a/docs/design/screens/assets/allen-formed.jpg b/docs/design/screens/assets/allen-formed.jpg
new file mode 100644
index 00000000..9d1a52fe
Binary files /dev/null and b/docs/design/screens/assets/allen-formed.jpg differ
diff --git a/docs/design/screens/assets/night-11800.jpg b/docs/design/screens/assets/night-11800.jpg
new file mode 100644
index 00000000..c0dcdc0d
Binary files /dev/null and b/docs/design/screens/assets/night-11800.jpg differ
diff --git a/docs/design/screens/assets/night-14000.jpg b/docs/design/screens/assets/night-14000.jpg
new file mode 100644
index 00000000..5f83d61e
Binary files /dev/null and b/docs/design/screens/assets/night-14000.jpg differ
diff --git a/docs/design/screens/assets/night-4000.jpg b/docs/design/screens/assets/night-4000.jpg
new file mode 100644
index 00000000..73af9414
Binary files /dev/null and b/docs/design/screens/assets/night-4000.jpg differ
diff --git a/docs/design/screens/assets/night-9000.jpg b/docs/design/screens/assets/night-9000.jpg
new file mode 100644
index 00000000..29d90089
Binary files /dev/null and b/docs/design/screens/assets/night-9000.jpg differ
diff --git a/docs/design/screens/assets/night-settled.jpg b/docs/design/screens/assets/night-settled.jpg
new file mode 100644
index 00000000..dcf93152
Binary files /dev/null and b/docs/design/screens/assets/night-settled.jpg differ
diff --git a/docs/design/screens/index.html b/docs/design/screens/index.html
new file mode 100644
index 00000000..e0def9d8
--- /dev/null
+++ b/docs/design/screens/index.html
@@ -0,0 +1,51 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Allen's first run: every screen</title>
+<link rel="stylesheet" href="../tokens/allen-tokens.css">
+<style>
+  body { margin: 0; padding: 48px; background: var(--allen-colors-night); color: var(--allen-colors-primary);
+         font: 500 16px/1.5 Quicksand, ui-rounded, system-ui, sans-serif; }
+  h1 { font-weight: 300; font-size: 32px; margin: 0 0 8px; }
+  p { color: var(--allen-colors-hint); max-width: 70ch; margin: 0 0 32px; }
+  ol { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 28px; }
+  a { color: inherit; text-decoration: none; display: block; border-radius: var(--allen-rounded-md); }
+  a:focus-visible { outline: 2px solid var(--allen-colors-glow); outline-offset: 4px; }
+  img { width: 100%; aspect-ratio: 16 / 9; display: block; border-radius: var(--allen-rounded-md);
+        border: 1px solid rgb(var(--allen-colors-glow-rgb) / .14); }
+  a:hover img { border-color: rgb(var(--allen-colors-mist-rgb) / .5); }
+  span { display: block; margin-top: 10px; color: var(--allen-colors-mist); }
+</style>
+</head>
+<body>
+<h1>Allen's first run</h1>
+<p>Every screen from the first-run design, in order. Open one and use the arrow keys, Enter, or Escape for
+"Not now"; the links follow the flow. Words are drawn in the kernel's own stroke font.</p>
+<ol>
+  <li><a href="01-power-on.html"><img src="shots/01-power-on.jpg" alt="" loading="lazy"><span>Screen 1: power on</span></a></li>
+  <li><a href="02-night.html"><img src="shots/02-night.jpg" alt="" loading="lazy"><span>Screen 2: the night</span></a></li>
+  <li><a href="03-allen-arrives.html"><img src="shots/03-allen-arrives.jpg" alt="" loading="lazy"><span>Screen 3: Allen arrives</span></a></li>
+  <li><a href="03b-still-starting.html"><img src="shots/03b-still-starting.jpg" alt="" loading="lazy"><span>Screen 3, slow: still starting</span></a></li>
+  <li><a href="04-intent.html"><img src="shots/04-intent.jpg" alt="" loading="lazy"><span>Screen 4: the one question</span></a></li>
+  <li><a href="04b-something-else.html"><img src="shots/04b-something-else.jpg" alt="" loading="lazy"><span>Screen 4: something else</span></a></li>
+  <li><a href="05-getting-to-know.html"><img src="shots/05-getting-to-know.jpg" alt="" loading="lazy"><span>Screen 5: getting to know this computer</span></a></li>
+  <li><a href="05b-what-allen-found.html"><img src="shots/05b-what-allen-found.jpg" alt="" loading="lazy"><span>Screen 5: what Allen found</span></a></li>
+  <li><a href="06-consent.html"><img src="shots/06-consent.jpg" alt="" loading="lazy"><span>Screen 6: the one consent</span></a></li>
+  <li><a href="06b-show-each.html"><img src="shots/06b-show-each.jpg" alt="" loading="lazy"><span>Screen 6: one at a time</span></a></li>
+  <li><a href="07a-games.html"><img src="shots/07a-games.jpg" alt="" loading="lazy"><span>Screen 7a: making games smoother</span></a></li>
+  <li><a href="07b-ai-fit.html"><img src="shots/07b-ai-fit.jpg" alt="" loading="lazy"><span>Screen 7b: finding the best way to run an AI</span></a></li>
+  <li><a href="07c-connect.html"><img src="shots/07c-connect.jpg" alt="" loading="lazy"><span>Screen 7c: connect my own</span></a></li>
+  <li><a href="07c-key-failed.html"><img src="shots/07c-key-failed.jpg" alt="" loading="lazy"><span>Screen 7c: the key did not work</span></a></li>
+  <li><a href="07c-key.html"><img src="shots/07c-key.jpg" alt="" loading="lazy"><span>Screen 7c: paste a key</span></a></li>
+  <li><a href="07c-none.html"><img src="shots/07c-none.jpg" alt="" loading="lazy"><span>Screen 7c: none found</span></a></li>
+  <li><a href="07c-one-found.html"><img src="shots/07c-one-found.jpg" alt="" loading="lazy"><span>Screen 7c: one model found</span></a></li>
+  <li><a href="07c-several.html"><img src="shots/07c-several.jpg" alt="" loading="lazy"><span>Screen 7c: several found</span></a></li>
+  <li><a href="08-hardware.html"><img src="shots/08-hardware.jpg" alt="" loading="lazy"><span>Screen 8: setting up your hardware</span></a></li>
+  <li><a href="08b-turn-on.html"><img src="shots/08b-turn-on.jpg" alt="" loading="lazy"><span>Screen 8: the second consent</span></a></li>
+  <li><a href="08c-put-back.html"><img src="shots/08c-put-back.jpg" alt="" loading="lazy"><span>Screen 8: it failed, the old one is back</span></a></li>
+  <li><a href="09-ready.html"><img src="shots/09-ready.jpg" alt="" loading="lazy"><span>Screen 9: Allen is ready</span></a></li>
+</ol>
+</body>
+</html>
diff --git a/docs/design/screens/screen.js b/docs/design/screens/screen.js
new file mode 100644
index 00000000..71d22557
--- /dev/null
+++ b/docs/design/screens/screen.js
@@ -0,0 +1,49 @@
+// screen.js -- shared behaviour for the first-run mockups: fit the 1920 x 1080 board to the window, draw the
+// words in Allen's stroke font, stagger entrances, and the keyboard path (arrows move the lit choice, Enter
+// or Space picks it, Escape is "Not now", any letter goes to the bar). Links between screens make the flow
+// clickable. ?clean=1 hides the screen's name tag for screenshots.
+"use strict";
+(function () {
+  const board = document.querySelector(".board");
+  const params = new URLSearchParams(location.search);
+  if (params.get("clean") === "1") document.body.classList.add("clean");
+  function fit() {
+    const k = Math.min(innerWidth / 1920, innerHeight / 1080);
+    board.style.transform = `translate(-50%, -50%) scale(${k})`;
+    board.style.transformOrigin = "50% 50%";
+  }
+  addEventListener("resize", fit);
+  fit();
+  afRender(board);
+
+  // entrances: each .rise waits its turn (data-at ms, else 90 ms after the one before)
+  let at = 0;
+  for (const el of board.querySelectorAll(".rise")) {
+    at = el.dataset.at ? Number(el.dataset.at) : at + 90;
+    el.style.animationDelay = `${at}ms`;
+  }
+
+  // the lit choice
+  const groups = [...board.querySelectorAll(".choices, .buttons")];
+  for (const g of groups) {
+    const items = [...g.querySelectorAll(".choice, .button")];
+    items.forEach((it) => { it.tabIndex = 0; it.setAttribute("role", "button");
+      it.addEventListener("mouseenter", () => light(g, it)); it.addEventListener("focus", () => light(g, it));
+      it.addEventListener("click", () => go(it)); });
+  }
+  function light(g, it) { for (const o of g.querySelectorAll(".lit")) o.classList.remove("lit"); it.classList.add("lit"); }
+  function go(it) { if (it && it.dataset.href) location.href = it.dataset.href + (params.get("clean") ? "?clean=1" : ""); }
+  const notNow = board.querySelector(".not-now");
+  if (notNow) { notNow.tabIndex = 0; notNow.setAttribute("role", "button"); notNow.addEventListener("click", () => go(notNow)); }
+  addEventListener("keydown", (e) => {
+    const g = groups[0];
+    const items = g ? [...g.querySelectorAll(".choice, .button")] : [];
+    const i = items.findIndex((x) => x.classList.contains("lit"));
+    if (["ArrowDown", "ArrowRight"].includes(e.key) && items.length) { light(g, items[(i + 1) % items.length]); e.preventDefault(); }
+    else if (["ArrowUp", "ArrowLeft"].includes(e.key) && items.length) { light(g, items[(i - 1 + items.length) % items.length]); e.preventDefault(); }
+    else if ((e.key === "Enter" || e.key === " ") && items[i]) { go(items[i]); e.preventDefault(); }
+    else if (e.key === "Escape" && notNow) go(notNow);
+    else if (e.key.length === 1 && board.querySelector(".bar")) board.querySelector(".bar").classList.add("focus");
+  });
+  window.__screen_ready = true;
+})();
diff --git a/docs/design/screens/screens.css b/docs/design/screens/screens.css
new file mode 100644
index 00000000..82f00749
--- /dev/null
+++ b/docs/design/screens/screens.css
@@ -0,0 +1,98 @@
+/* screens.css -- the first-run screens, on the 1920 x 1080 design grid, using only the generated tokens.
+   Every value here is a token or a layout fact from allen_ui.c (centre at 40% down, words 250 px below it,
+   bar 720 x 54 with its bottom 96 px above the screen's bottom). */
+@import url("../tokens/allen-tokens.css");
+
+html, body { margin: 0; height: 100%; background: var(--allen-colors-night); overflow: hidden; }
+body { color: var(--allen-colors-primary); }
+
+/* the artboard is the design grid, scaled to fit the window like the kernel's k */
+.board { position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px; transform-origin: 0 0;
+         background: var(--allen-colors-night) center / cover no-repeat; overflow: hidden; }
+.board.sky { background-image: url("assets/allen-formed.jpg"); }
+.board.night { background-image: url("assets/night-settled.jpg"); }
+
+/* the stroke font: the drawing is shown, the real text is kept for screen readers */
+.af-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
+.af-svg { display: block; overflow: visible; }
+[data-af] { margin: 0; }
+.center { text-align: center; }
+.center .af-svg { margin: 0 auto; }
+
+/* what Allen says: under his light */
+.says { position: absolute; left: 510px; width: 900px; top: 640px; color: var(--allen-colors-primary); }
+.says + .says { top: 690px; }
+.says.low { top: 600px; }
+
+/* the bar */
+.bar { position: absolute; left: 600px; top: 930px; width: 720px; height: 54px; box-sizing: border-box;
+       border-radius: var(--allen-rounded-pill); background: rgb(var(--allen-colors-night-rgb) / .55);
+       border: 1px solid rgb(var(--allen-colors-glow-rgb) / .16); display: flex; align-items: center;
+       padding: 0 26px; color: var(--allen-colors-hint); }
+.bar.focus { border-color: rgb(var(--allen-colors-mist-rgb) / .55); box-shadow: 0 0 28px rgb(var(--allen-colors-sky-glow-rgb) / .22); }
+.bar .typed { color: var(--allen-colors-primary); }
+.caret { width: 2px; height: 24px; margin-left: 4px; background: var(--allen-colors-glow);
+         animation: breathe var(--allen-motion-caret-breath) var(--allen-motion-ease-smooth) infinite alternate; }
+@keyframes breathe { from { opacity: .25; } to { opacity: .95; } }
+.under-bar { position: absolute; left: 0; right: 0; top: 1018px; color: var(--allen-colors-faint); }
+
+/* choices: one is always lit */
+.choices { position: absolute; left: 580px; width: 760px; top: 712px; display: grid; gap: 8px; }
+.choice { height: 52px; box-sizing: border-box; display: flex; align-items: center; gap: 22px; padding: 0 24px;
+          border-radius: var(--allen-rounded-md); background: rgb(var(--allen-colors-panel-rgb) / .62);
+          border: 1px solid rgb(var(--allen-colors-glow-rgb) / .10); color: var(--allen-colors-mist);
+          transition: background var(--allen-motion-choice-lit) var(--allen-motion-ease-out),
+                      border-color var(--allen-motion-choice-lit) var(--allen-motion-ease-out); cursor: pointer; }
+.choice .what { color: var(--allen-colors-hint); }
+.choice .key { margin-left: auto; color: var(--allen-colors-faint); opacity: 0; }
+.choice.lit { background: linear-gradient(rgb(var(--allen-colors-glow-rgb) / .34), rgb(84 104 224 / .30));
+              border-color: rgb(var(--allen-colors-mist-rgb) / .45); color: var(--allen-colors-primary);
+              box-shadow: 0 0 28px rgb(var(--allen-colors-sky-glow-rgb) / .18); }
+.choice.lit .what { color: var(--allen-colors-mist); }
+.choice.lit .key { opacity: 1; }
+.choice:focus-visible { outline: none; border-color: var(--allen-colors-mist); }
+
+/* a row of buttons: the lit one is the default */
+.buttons { position: absolute; left: 0; right: 0; display: flex; justify-content: center; gap: 16px; }
+.button { height: 52px; box-sizing: border-box; padding: 0 30px; display: flex; align-items: center;
+          border-radius: var(--allen-rounded-pill); border: 1px solid rgb(var(--allen-colors-mist-rgb) / .35);
+          background: rgb(var(--allen-colors-panel-rgb) / .62); color: var(--allen-colors-mist); cursor: pointer; }
+.button.lit { background: linear-gradient(rgb(var(--allen-colors-glow-rgb) / .34), rgb(84 104 224 / .30));
+              border-color: rgb(var(--allen-colors-mist-rgb) / .6); color: var(--allen-colors-primary); }
+.button.lit:hover { border-color: var(--allen-colors-warm-soft); color: var(--allen-colors-warm-soft);
+                    box-shadow: 0 0 24px rgb(var(--allen-colors-warm-rgb) / .22); }
+.not-now { position: absolute; left: 0; right: 0; color: var(--allen-colors-hint); cursor: pointer; }
+
+/* found lines: label right-aligned in hint, value left-aligned in primary, on one column */
+.found { position: absolute; left: 0; right: 0; top: 700px; display: grid; grid-template-columns: 860px 1000px;
+         column-gap: 20px; row-gap: 6px; }
+.found .label { text-align: right; color: var(--allen-colors-hint); }
+.found .label .af-svg { margin-left: auto; }
+.found .value { color: var(--allen-colors-primary); }
+.state { color: var(--allen-colors-glow); }
+.state.needs-you { color: var(--allen-colors-warm); }
+
+/* a glass panel, only where a group needs holding together */
+.panel { position: absolute; box-sizing: border-box; padding: 24px 32px; border-radius: var(--allen-rounded-panel);
+         background: rgb(var(--allen-colors-panel-rgb) / .72); border: 1px solid rgb(var(--allen-colors-glow-rgb) / .15);
+         backdrop-filter: blur(18px) saturate(130%);
+         box-shadow: 0 30px 80px rgb(0 0 0 / .45), 0 0 40px rgb(var(--allen-colors-sky-glow-rgb) / .06); }
+
+/* waiting: a small moving light, never a bar that jumps */
+.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--allen-colors-glow);
+       box-shadow: 0 0 10px var(--allen-colors-glow); animation: dot 1.1s var(--allen-motion-ease-smooth) infinite alternate; }
+@keyframes dot { from { transform: translateX(0); opacity: .35; } to { transform: translateX(26px); opacity: 1; } }
+
+/* entrances rise: opacity 0, 10 px lower, 3 px blurred, to rest (DESIGN.md Motion) */
+.rise { animation: rise var(--allen-motion-word-rise) var(--allen-motion-ease-enter) both; }
+@keyframes rise { from { opacity: 0; transform: translateY(var(--allen-motion-enter-rise)); filter: blur(var(--allen-motion-enter-blur)); }
+                  to { opacity: 1; transform: none; filter: none; } }
+
+/* the screen's name, for reviewers; hidden when ?clean=1 */
+.tag { position: absolute; left: 28px; top: 22px; color: var(--allen-colors-faint); font: 500 14px/1 ui-monospace, monospace;
+       letter-spacing: .04em; opacity: .8; }
+.clean .tag { display: none; }
+
+@media (prefers-reduced-motion: reduce) {
+  .rise, .dot, .caret { animation: none; }
+}
diff --git a/docs/design/screens/shots/01-power-on.jpg b/docs/design/screens/shots/01-power-on.jpg
new file mode 100644
index 00000000..ba793ed4
Binary files /dev/null and b/docs/design/screens/shots/01-power-on.jpg differ
diff --git a/docs/design/screens/shots/02-night.jpg b/docs/design/screens/shots/02-night.jpg
new file mode 100644
index 00000000..6cdfd53c
Binary files /dev/null and b/docs/design/screens/shots/02-night.jpg differ
diff --git a/docs/design/screens/shots/03-allen-arrives.jpg b/docs/design/screens/shots/03-allen-arrives.jpg
new file mode 100644
index 00000000..242c3098
Binary files /dev/null and b/docs/design/screens/shots/03-allen-arrives.jpg differ
diff --git a/docs/design/screens/shots/03b-still-starting.jpg b/docs/design/screens/shots/03b-still-starting.jpg
new file mode 100644
index 00000000..61011271
Binary files /dev/null and b/docs/design/screens/shots/03b-still-starting.jpg differ
diff --git a/docs/design/screens/shots/04-intent.jpg b/docs/design/screens/shots/04-intent.jpg
new file mode 100644
index 00000000..d0e533a5
Binary files /dev/null and b/docs/design/screens/shots/04-intent.jpg differ
diff --git a/docs/design/screens/shots/04b-something-else.jpg b/docs/design/screens/shots/04b-something-else.jpg
new file mode 100644
index 00000000..566b841d
Binary files /dev/null and b/docs/design/screens/shots/04b-something-else.jpg differ
diff --git a/docs/design/screens/shots/05-getting-to-know.jpg b/docs/design/screens/shots/05-getting-to-know.jpg
new file mode 100644
index 00000000..927c70ef
Binary files /dev/null and b/docs/design/screens/shots/05-getting-to-know.jpg differ
diff --git a/docs/design/screens/shots/05b-what-allen-found.jpg b/docs/design/screens/shots/05b-what-allen-found.jpg
new file mode 100644
index 00000000..c3f0bc82
Binary files /dev/null and b/docs/design/screens/shots/05b-what-allen-found.jpg differ
diff --git a/docs/design/screens/shots/06-consent.jpg b/docs/design/screens/shots/06-consent.jpg
new file mode 100644
index 00000000..b27694ef
Binary files /dev/null and b/docs/design/screens/shots/06-consent.jpg differ

The diff is longer than this page shows; the raw diff has all of it.