Skip to main content

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 use createAIVerdict():
The engine:
  • 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 tip to 240 characters and detail to 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.
The dot is an AI presentation summary unless the prompt explicitly says it reflects a supplied deterministic warning. It is not a calculated health score.

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.
Source: 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.
Source: js/light-today-ai.js. Context: the selected day, Sun/device sessions, tool results, environment, explicit deterministic warnings, recent patterns, and relevant goals.
Source: js/light-env-ai-analysis.js. Context: one room, associated measurements, source/timing answers, screen protection, and evidence quality.
Source: 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.
Source: js/light-screen-ai-analysis.js. Context: device type, room, entered after-sunset hours, protection/tint settings, and sleep-position answers.
Source: js/light-channels-ai-analysis.js. Context: current and previous seven-day Sun/device logging patterns and internal channel summaries.
Source: js/light-audit-ai-analysis.js. Context: snapshot rooms, screens, and nearby measurements within the audit’s documented date window.
Source: js/sun-ai-analysis.js. Context: one completed session’s modeled signals, solar phase, MED state, weather/body/eye fields, and supplied cautions.
Source: js/sun-onboarding-ai.js. Context: saved setup answers, including skin-model reference, location, eyewear, protection, and lighting environment when present.
Source: 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 by tests/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.