Light and Sun prompts
Light & Sun uses separate prompts because its inputs have different evidence quality. A camera-visible ratio, entered screen habit, spectrally modeled Sun session, and vendor-described device session must not be interpreted as interchangeable measurements.Shared verdict engine
All ten prompts usecreateAIVerdict():
- sends one feature-owned system prompt and one bounded context message;
- parses the first JSON object;
- accepts only known dot values and falls back to gray for an unknown value;
- limits
tipto 240 characters anddetailto 800 characters; - fingerprints inputs to avoid repeating unchanged analysis;
- keeps an earlier valid verdict when a refresh fails;
- times out stalled work and bounds automatic retries;
- never stores an “analyzing” state as the source of truth.
light.hardware-guardrails
Seven prompt families splice this shared block verbatim from js/lighting-hardware-caveats.js:
Read each Light & Sun prompt
The following blocks show the application-authored system instruction in runtime order.[light.hardware-guardrails] expands to the exact shared block above. Context builders then attach the named record as the user message; they do not add another hidden persona.
light.measurement — saving a supported Light Tool result
light.measurement — saving a supported Light Tool result
js/light-tools-ai-analysis.js. Context: the single saved measurement plus source, calibration, room, timing, and quality fields that exist for its tool type.light.today — opening the daily view with logged data
light.today — opening the daily view with logged data
js/light-today-ai.js. Context: the selected day, Sun/device sessions, tool results, environment, explicit deterministic warnings, recent patterns, and relevant goals.light.room — viewing a room with enough entered data
light.room — viewing a room with enough entered data
js/light-env-ai-analysis.js. Context: one room, associated measurements, source/timing answers, screen protection, and evidence quality.light.device-session — requesting a completed device-session verdict
light.device-session — requesting a completed device-session verdict
js/light-device-ai-analysis.js. Context: the completed session, device class, selected mode, firing peaks, modeled dose fields, distance quality, eye state, and deterministic safety flags.light.screen — viewing a configured screen record
light.screen — viewing a configured screen record
js/light-screen-ai-analysis.js. Context: device type, room, entered after-sunset hours, protection/tint settings, and sleep-position answers.light.weekly-pattern — opening the seven-day review
light.weekly-pattern — opening the seven-day review
js/light-channels-ai-analysis.js. Context: current and previous seven-day Sun/device logging patterns and internal channel summaries.light.audit — saving a frozen multi-room audit
light.audit — saving a frozen multi-room audit
js/light-audit-ai-analysis.js. Context: snapshot rooms, screens, and nearby measurements within the audit’s documented date window.light.sun-session — requesting a completed Sun-session verdict
light.sun-session — requesting a completed Sun-session verdict
js/sun-ai-analysis.js. Context: one completed session’s modeled signals, solar phase, MED state, weather/body/eye fields, and supplied cautions.light.onboarding — completing Light & Sun setup
light.onboarding — completing Light & Sun setup
js/sun-onboarding-ai.js. Context: saved setup answers, including skin-model reference, location, eyewear, protection, and lighting environment when present.light.indoor-burden — viewing the live indoor screening
light.indoor-burden — viewing the live indoor screening
js/light-burden-ai-analysis.js. Context: current rooms, stated daylight, after-sunset timing, screens, heuristic screening values, and evidence quality.Review matrix
Focused verification
The shared engine is covered bytests/test-ai-verdict-engine.js and tests/test-ai-verdict-engine-instance.js. Feature-specific suites include tests/test-sun.js and the Light/room/device analysis tests discoverable by their source identifier.
Prompt changes must be checked against the deterministic Sun model and Sun spectrum model. The model-generated dot never gets to redefine the calculation.