# Foreground Web Motion Detection Absolute Checklist - `MWM-001` Confirm first-release scope is web camera role only and foreground-tab only. - `MWM-002` Add detector-related state fields to [WebApp/src/lib/app/store.js](/home/matiss/Documents/Final%20Year%20Project/WebApp/src/lib/app/store.js:4). - `MWM-003` Define default motion detector config values for low-power foreground operation. - `MWM-004` Create a dedicated detector module under `WebApp/src/lib/app/`. - `MWM-005` Implement low-resolution frame sampling from the existing local camera stream. - `MWM-006` Implement grayscale conversion and normalized frame-difference scoring. - `MWM-007` Implement score smoothing or block aggregation to reduce noise flicker. - `MWM-008` Implement detector state machine transitions `idle`, `warming_up`, `monitoring`, `triggered`, `cooldown`. - `MWM-009` Implement adaptive sampling so idle sampling is slower than candidate-motion sampling. - `MWM-010` Ensure the detector starts only when the device role is `camera`, preview is ready, and detection is armed. - `MWM-011` Ensure the detector pauses or stops on camera permission loss, preview teardown, socket disconnect, or page hide. - `MWM-012` Add camera dashboard controls for arm/disarm and sensitivity. - `MWM-013` Add camera dashboard status UI for detector state and live motion score. - `MWM-014` Keep existing manual motion buttons intact and usable. - `MWM-015` Wire automatic detector trigger to the existing `startMotion` flow with `triggeredBy: "auto_motion"`. - `MWM-016` Prevent duplicate `startMotion` calls while a motion event is already active. - `MWM-017` Implement minimum event duration and quiet cooldown before automatic end. - `MWM-018` Wire automatic quiet-state completion to the existing `endMotion` flow. - `MWM-019` Add activity-log messages for detector armed/disarmed, trigger start, trigger end, and detector pause reasons. - `MWM-020` Add local persistence for detector settings so operator choices survive reloads. - `MWM-021` Validate that existing client notifications still fire through the unchanged backend event routes. - `MWM-022` Validate that existing recording behavior still works for auto-started motion events. - `MWM-023` Add unit-level tests for detector scoring and state-machine transitions. - `MWM-024` Add integration tests or deterministic mocks for event deduplication and cooldown handling. - `MWM-025` Perform manual runtime validation for no-motion idle scene, real person entry, lighting flicker, and camera shake. - `MWM-026` Measure runtime CPU/thermal behavior during a long foreground session and tune defaults if needed. - `MWM-027` Document the foreground-only assumption and known limits in project docs. - `MWM-028` Document recommended operator settings for lowest battery and heat. - `MWM-029` Add rollback behavior so disabling detection immediately stops the detector loop and leaves manual controls intact. - `MWM-030` Finalize a rollout note describing first-release non-goals such as background detection and ML classification.