# km.flow.screens
Widget-tree builders for the flow slice's screens in the command-UI look: the CADET EVALUATION card (six virtue bars, ending, stamps, instructor portrait + notes, decision timeline, outcome, cause trace), Commander Hale's caption with CONFESS/DENY, the act-transition card and the Debrief Records list. Called by `km.flow.runtime`.
# km.flow.records
Saves each finished evaluation to `/zero/source/local/km_records/index.json` (this device only, newest first, 20 kept) and loads them back for the Debrief Records screen.
# km.scenario
The rules of KOBAYASHI MARU — pure Luau, no engine calls, so `km.tests.scenario` runs them headless.
API (contract in `/source/design/spec.md`): `newRun(opts?)`, `nightChoose`, `nightEnterLab`, `nightEdit`, `nightSeen`, `beginTest`, `availableOrders(run, limit?)` (the dealt hand, up to 8 cards), `allOrders`, `reports`, `advice`, `loudest`, `opposition`, `apply(run, orderId, args?)`, `stall`, `advance`, `isOver`, `evaluate`, `confess`.
- **Orders** (`S.ORDERS`): every `KM.ORDERS` id with label, blurb, icon, colour, minutes, visibility, preconditions (`reason` when disabled), cost and `costText`, and an effect that writes officer lines, viewscreen/alert events and a command-log entry with its cause.
- **Officers**: six distinct voices (lines in `km.scenario.lines`); each beat every officer reports, recommends an order (`advisedBy`) and objects to others (`opposedBy`). Going against an objection costs trust; low trust makes officers hesitate (+30 s) or refuse; trust 0 is mutiny. Low morale brings panic events.
- **The rig**: honest runs face unbounded cruiser arrivals (alert shortens the interval; fighting pulls the next one closer) and an overwhelm clause once they outnumber `hostilesFatal`; 8:00 of life support is shorter than any honest full rescue. Each simulator edit breaks exactly its matching rule.
- **Debrief** (`km.scenario.debrief`): six virtues from marks that each name the night choice or log entry that caused them, 16 endings, stamps, notes, timeline, outcome line, confession.
Runtime driver: `km.director`. Tests: `require("km.tests.scenario").run()`.
# km.flow.audio
All sound: a looping ambience bed (station hum, dorm night), a looping score (title theme, tension that climbs with Klingon alert, debrief bed) and one-shot cues (klaxon, decloak sting, phaser, torpedo, hit, transporter, comm chirp, transition, UI click, damage alarm). Used by `km.flow.runtime`; `A.log` and `A.playing()` report what was cued and what is sounding.
# km.flow.place
Where the observation gallery stands behind the bridge's one-way glass ("room space": -Z toward the bridge, floor y=0), its camera shots (debrief over-shoulder, seat, wall screen) and the title/transition views. Shared by `km.flow.gallery` and `km.flow.runtime`.
# km.core
The spine of KOBAYASHI MARU: constants, palette, fonts, world anchors (`KM.LOC`), stations and officers, night activities and simulator edits, tuning, virtues and ending ids, the run-state shape (`KM.newRun()`), the phase machine (`KM.setPhase`), the camera request (`KM.setView`), an event bus (`KM.on` / `KM.emit`) and optional services (`KM.services`, `KM.call`). Every slice requires it; only the plan pass edits it. Contract: /source/design/spec.md.