Files
SciFi-XZBT/agents.md
T
ClaudeandClaude Haiku 4.5 97b0faa4a6 Add sound reference documentation and fix air-handler/docking-clamp duplicate
- Add sound_reference.md (937 lines): Real-world production reference covering Star Trek (TOS–ENT), Doctor Who/Whoniverse, Bioships (six ships across five franchises), and Space Stations (six stations across five sources).
- Add agents.md: Project architecture guide (file ownership, load order, conventions).
- Add telemetry_elements.md: Catalog of 10 telemetry elements with per-era selection weights and preset-by-preset routing.
- Add visual_elements.md: Canvas/SVG split architecture, layer declarations, per-theme casts.
- Fix duplicate soundboard mapping: Separate 'AIR HANDLER THUD' from 'DOCKING CLAMP LATCH'. Create ExpandedSciFiAudioSynth.synthesizeAirHandlerThud() (dull triangle-wave thump + sub-octave + slow airflow whoosh) distinct from synthesizeDockingClamp() (bright square-wave impact + pneumatic hiss). Update js/app.js to wire btn-air-handler to the new method.

Key findings:
* All 70 presets across 10 universes use Star Trek telemetry eras only — cross-universe borrowing is structural, not accidental.
* Doctor Who TARDIS demat correctly implements Brian Hodgson's 1963 technique (piano strings + tape feedback).
* Sevastopol Station's production sound design (Jeff van Dyck, Pinewood foley) is the best-documented non-Trek entry.
* The Expanse's "jury-rigged" Belter signature (Nelson Ferreira) is the single most actionable production detail found.

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NbMozG2xjcgLBia8vrzTrr
2026-09-04 05:08:04 +00:00

5.2 KiB

AGENTS.md — SciFi-XZBT

Guidance for AI coding agents working in this repository.

What this project is

A browser-only, zero-dependency sci-fi ambient audio + visual display. It synthesizes starship room tone (hull drone, warp core, life support, telemetry, alerts) with the Web Audio API and renders LCARS-styled UI, an audio visualizer, and a procedural "observation" viewscreen on HTML canvas.

It runs by opening index.html in a browser. There is no build step, no package manager, no server, and no test suite.

Architecture

index.html loads one stylesheet and six scripts in a fixed order:

css/style.css
js/audio.js               -> js/config.js -> js/visualizer.js
js/observation-bezels.js  -> js/observation-engine.js -> js/app.js

Order matters: every file defines plain classes/objects and publishes them on window; js/app.js runs last and consumes all of them. Do not reorder the tags without checking the dependencies.

File Owns ~Lines
index.html DOM skeleton, script/link tags 370
css/style.css LCARS themes, CRT effects, palettes 2,300
js/audio.js AudioManager + all synth classes (hull, warp, life support, telemetry, alert, Whoniverse, expanded sci-fi) 2,250
js/config.js StarshipPresets, UniverseRegistry — data only, no behavior 1,040
js/visualizer.js StarshipVisualizer — spectrum + warp core canvas 640
js/observation-bezels.js ObservationBezels — procedural SVG viewport frames per era 270
js/observation-engine.js ObservationEngine — celestial simulation and canvas rendering 2,780
js/app.js DOM bindings, hotkeys, UI controllers, main loop 3,960
tools/package.ps1 Builds the standalone single-file HTML
dist/SciFiAmbientDisplay_v4.html Generated output — never edit by hand

Hard constraints

  • No dependencies. No npm, no CDN links, no external fonts, images, or audio files. The packaged build must work when double-clicked while offline.
  • No ES modules. No import / export, no type="module". Scripts are classic globals.
  • Publish globals explicitly. End each file with window.Thing = Thing;, matching the existing pattern.
  • All audio is synthesized, not sampled. New sounds are built from oscillators / noise / filters in js/audio.js.

Where to make a change

  • New room or ship preset, universe, palette → js/config.js
  • Sound generation, oscillators, envelopes, filters → js/audio.js
  • Spectrum bars, warp-core animation → js/visualizer.js
  • Viewscreen frame / bezel shapes per era → js/observation-bezels.js
  • Planets, stars, drift, observation-mode canvas → js/observation-engine.js
  • Buttons, sliders, hotkeys, state wiring, animation loop → js/app.js
  • Colors, layout, theme classes, CRT overlay → css/style.css

Presets in config.js follow a fixed shape — copy an existing one rather than inventing fields:

'era-room': {
  id, name, era, theme, alertType, description,
  hull:        { volume, baseFreq, filterCutoff, resonance, noiseMix, harmonicSpread },
  warp:        { volume, bpm, carrierFreq, filterCutoff, pulseShape, resonance, swirlMix },
  lifeSupport: { volume, noiseType, highpassFreq, lowpassFreq, airflowModSpeed, airflowModDepth },
  telemetry:   { volume, density, era }
}

Adding a new JS file

  1. Create js/your-file.js and end it with window.YourThing = YourThing;.

  2. Add the tag to index.html in this exact form, positioned before any file that depends on it (and always before js/app.js):

    <script src="js/your-file.js"></script>
    

    tools/package.ps1 inlines assets by matching <script\s+src="([^"]+)"></script> and <link\s+rel="stylesheet"\s+href="([^"]+)"\s*/?>. Extra attributes, a different quote style, or a self-closing script tag will be silently left as an external reference and the standalone build will break.

Build

powershell -ExecutionPolicy Bypass -File .\tools\package.ps1

Writes dist/SciFiAmbientDisplay_v4.html (CSS and JS inlined). Re-run it after any change to CSS, JS, or index.html. tools/extract.ps1 is the original extraction script, kept for reference only.

Verifying work

There are no automated tests. Verification is manual:

  1. Open index.html in a browser; check the console is clean.
  2. Exercise the affected area — play a preset, switch era/universe, open observation mode.
  3. Re-run package.ps1 and open dist/SciFiAmbientDisplay_v4.html with the network disabled to confirm it is genuinely self-contained.

Browser autoplay policy blocks audio until a user gesture; audio starting only after a click is expected behavior, not a bug.

Conventions and cautions

  • 2-space indentation; single quotes in JS; existing brace and spacing style.
  • js/app.js and js/observation-engine.js are large. Make surgical, scoped edits — do not rewrite, reorder, or reformat whole files.
  • Do not reformat or lint files wholesale; diffs should stay minimal and reviewable.
  • Never edit anything in dist/ — regenerate it instead.
  • Preserve the offline, single-file-deliverable property in every change.