> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pilotwatt.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Optimiser logic

> How export, store, and charge EV scores are computed.

<Note>
  See [Tonight's opportunity](/features/recommendation) for the user-facing summary.
</Note>

The optimiser runs server-side when Home refreshes recommendation data.

**Inputs:** solar forecast, live FoxESS state, Agile rate slots, user settings (thresholds, battery capacity).

**Output:** one `Recommendation` — action, reason, extra profit pence, confidence band, act before (\~30 min).

**Actions scored:** `export`, `store`, `charge-ev` (0–100). Store is disabled when SoC ≥ 85%.

**Tie-break:** if the winning score is within **5 points** of the runner-up → **`idle`** (no strong signal), not a forced store pick.

**Display:** when `charge-ev` wins but EV UI is hidden in alpha, Home may fall back to the next eligible action (or idle if the gap is too small).

Source of truth: `lib/domain/optimiser.ts` in the app repository.
