Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.synheart.ai/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The Self-Reference Model (SRM) is the per-subject longitudinal baseline engine inside the native runtime. It ingests vendor-agnostic daily wearable values, maintains rolling per-dimension statistics, and emits a typed WearableReferenceView that downstream scoring (recovery, readiness) consumes as “the user’s normal.” It is the data model behind the reference field on Baselines. Hosts never write SRM state directly — they push daily values, and the runtime maintains the model.

Dimensions

The SRM tracks 11 dimensions. Five are primary: they gate the overall maturity state. The remaining six are secondary — populated when available, used by specific scorers, but not required for the model to be considered ready.
DimensionTierWindowNotes
sleep_needprimary14d30d buffer retained
sleep_regularityprimary14d
hrv_rmssdprimary30d2-MAD outlier exclusion
resting_hrprimary14d2-MAD outlier exclusion
recovery_scoreprimary30d
hrv_sdnnsecondary30dApple Health SDNN, tracked separately from RMSSD
deep_sleep_minsecondary7dμ/σ
rem_sleep_minsecondary7dμ/σ
daily_strainsecondary14d
motion_steps_estsecondary14d2-MAD outlier exclusion
hrv_hr_std_bpmsecondary30dOvernight HR standard deviation

Maturity states

The overall status field on WearableReferenceView has four values, emitted by the runtime as uppercase strings:
StatusMeaning
EMPTYNo reference exists, or all dimensions absent.
WARMINGAt least one primary dimension present, but not all five at sufficient confidence.
READYAll five primary dimensions present, each at or above its per-dimension min_confidence. Downstream personalized scoring is unlocked.
STALEWas READY; at least one primary dimension has decayed past its staleness_days window or fallen to zero confidence.
Personalized scoring (e.g. recovery Stage 3) gates on status == READY.

Per-dimension thresholds

Each primary dimension carries its own min_days, min_confidence, and staleness_days:
Dimensionmin_daysmin_confidencestaleness_days
sleep_need70.507
sleep_regularity50.507
hrv_rmssd100.507
resting_hr50.4510
recovery_score70.505
Confidence ramps up linearly over the first three days after a gap resumes, and decays exponentially when observations stop arriving.

WearableReferenceView

The host-typed shape exposed by every SDK:
status: String           // "EMPTY" | "WARMING" | "READY" | "STALE"
modelVersion: String?
recentSleepScoreMedian: Int?
dimensions: Map<String, Number>     // per-dimension central value
confidence: Map<String, Double>     // 0.0 – 1.0 per dimension
Cross-language parity:
  • Flutter: WearableReferenceView in lib/src/models/sleep_score.dart
  • Kotlin: WearableReferenceView in synheart-core/.../models/SleepScore.kt
  • Swift: WearableReferenceView in SynheartCore/Models/SleepScore.swift
Kotlin types dimensions as Map<String, Number>; Swift and Dart use the platform numeric type (Double / num). Shape is otherwise byte-equivalent across platforms.

Source fidelity

The engine distinguishes two input fidelities:
  • Raw observation — direct samples (e.g. an HR trace the runtime aggregated itself).
  • Provider summary — pre-computed vendor metrics (e.g. a Whoop recovery score).
Both count equally toward min_days. Confidence is weighted by raw_ratio — a dimension fed only by provider summaries matures, but at discounted confidence relative to one fed by raw samples.

Backfill parity

Nights ingested via Health backfill and nights ingested live are treated identically by the SRM — backfilled days count toward min_days the same as live days. Backfill events carry a backfilled flag for telemetry; this does not change their weight in the model. Late backfill (events older than seven days) does not trigger an incremental recompute; the runtime performs a full recompute instead.

Snapshot lifecycle

The runtime exposes export and load over FFI so hosts can persist longitudinal state across cold starts:
FFI symbolWhen the host calls it
synheart_core_export_srm_snapshotOn app background / session end. The host writes the returned JSON to its own secure store (Keychain, EncryptedSharedPreferences).
synheart_core_load_srm_snapshotOn app cold start, after the runtime handle is created. Schema or config mismatch is rejected; the caller must invoke recompute() afterward — load alone does not produce a new WearableReferenceView.
synheart_core_wipe_local_dataOn user consent revocation or account wipe. Clears the SRM snapshot along with other local stores.
The Baselines.reset() facade method clears the host-side cache only — it does not wipe the runtime’s SRM snapshot. Use the FFI wipe call for runtime state.
  • Baselines facade — host-facing read API over the latest reference + recent-scores ring.
  • Scoring models — recovery/readiness/sleep scorers that consume the reference view; personalized stage gates on status == READY.
  • Health backfill — cold-start path that seeds the SRM from platform health stores.
  • Runtime FFI — snapshot export/load and direct SRM accessors.