Repository navigation
Expand file tree
/
Copy path.env.example
More file actions
402 lines (386 loc) · 21.9 KB
/
Copy path.env.example
File metadata and controls
402 lines (386 loc) · 21.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# tri-coach environment template (PROJECT_BRIEF §14).
# Secrets only via environment variables; never commit keys.
# Copy to .env (repo root for Compose, backend/.env for local `uv run`) and fill in.
# --- Application -----------------------------------------------------------
# Human-facing application name (default is fine).
APP_NAME=tri-coach
# Deployment environment: dev | staging | prod.
ENVIRONMENT=dev
# Debug mode switch; keep False outside local development.
DEBUG=false
# Owner timezone (§14: metric units, Europe/Madrid).
TIMEZONE=Europe/Madrid
# --- Infrastructure ---------------------------------------------------------
# Postgres password used by Compose interpolation (required, no default).
POSTGRES_PASSWORD=CHANGE_ME
# Async Postgres DSN (pgvector-capable Postgres 16, §6/§8).
DATABASE_URL=postgresql+asyncpg://tri_coach:CHANGE_ME@localhost:5432/tri_coach
# Redis broker/result backend for Celery.
REDIS_URL=redis://localhost:6379/0
# --- Secrets (leave empty in the template; fill via environment only) -------
# Intervals.icu API key — the sole ingestion source (§5.1).
INTERVALS_API_KEY=
# Intervals.icu athlete ID (0 = the API key's owner; default 0).
INTERVALS_ATHLETE_ID=0
# Intervals.icu API v1 base URL (verified: official API cookbook).
INTERVALS_BASE_URL=https://intervals.icu/api/v1
# Retries after the initial attempt for 429/5xx (rate limits: 30/s burst, 132/10s).
INTERVALS_MAX_RETRIES=3
# Exponential backoff factor: sleep = factor * 2**attempt seconds between retries.
INTERVALS_BACKOFF_FACTOR=0.5
# Minimum interval between client calls during sync (0.1s => at most 10 req/s; 0 disables).
INTERVALS_MIN_REQUEST_INTERVAL_S=0.1
# --- Athlete thresholds (owner-supplied configuration; brief §14, §5.1) -----
# Editable configuration for the deterministic load engine (§7.1). The editing
# surface is Intervals.icu: run `python -m app.ingest.thresholds` (backend dir)
# to fetch current values and print ready-to-paste lines. These are NEVER
# authoritative computed metrics (§5.1) — engine-computed values take
# precedence and Intervals values are cross-check only. Leave a key empty when
# the value is unknown; a missing value must never be silently defaulted.
# Endpoint payload shapes live-verified 2026-10-02.
# Functional threshold power, watts (sport-settings "Ride" entry "ftp").
ATHLETE_FTP_W=
# Lactate threshold heart rate, bpm (sport-settings "lthr").
ATHLETE_LTHR_BPM=
# Maximum heart rate, bpm (sport-settings "max_hr").
ATHLETE_HR_MAX_BPM=
# Resting heart rate, bpm (athlete profile "icu_resting_hr").
ATHLETE_HR_REST_BPM=
# Swim critical-swim-speed (CSS), m/s (sport-settings "Swim" entry
# "threshold_pace"; live-verified 0.8333333 m/s on 2026-10-02).
ATHLETE_CSS_SPEED_MPS=
# Run threshold speed, m/s (sport-settings "Run" entry "threshold_pace";
# null for this owner — a known, explicitly reported gap).
ATHLETE_THRESHOLD_RUN_SPEED_MPS=
# Body weight, kg (athlete profile "weight"; null for this owner).
ATHLETE_WEIGHT_KG=
# The athlete's name the agent uses in the per-turn context block (WA-8).
# Leave empty to omit the name line from the context. OWNER CHOICE.
ATHLETE_NAME=
# Raw FIT file storage (ING-6, brief §5.2): local root where downloaded raw
# FIT files are archived so the engine can be re-run when formulas change.
# Relative to the backend working directory; inside Compose the fit-data
# volume is mounted at /data/fit and INGEST_STORAGE_ROOT is set there.
INGEST_STORAGE_ROOT=data/fit
# Set to false to disable raw FIT archiving (activities keep raw_file_path NULL).
INGEST_STORAGE_ENABLED=true
# Twilio WhatsApp credentials (§5.1).
TWILIO_ACCOUNT_SID=
TWILIO_AUTH_TOKEN=
# Sending number in WhatsApp format, e.g. whatsapp:+14155238886.
TWILIO_WHATSAPP_FROM=
# Comma-separated allowlist of permitted WhatsApp numbers.
TWILIO_WHATSAPP_ALLOWLIST=
# Public HTTPS URL of the inbound webhook exactly as Twilio sees it (§9.1),
# e.g. the development tunnel https://<name>.trycloudflare.com.
# TRAP: signature validation MUST check the URL Twilio signed — behind a
# tunnel that is THIS URL, and validating against the locally served one
# (http://localhost:8000) silently rejects every real message with 403.
# Validation ALWAYS runs — there is no switch to skip it. Empty is fine for
# direct local access and tests only; behind a tunnel WITHOUT this variable
# set, every real message is rejected with 403.
# Debe ser la URL COMPLETA, con /webhooks/whatsapp. Pelada -> todos los mensajes se rechazan.
TWILIO_PUBLIC_WEBHOOK_URL=
# --- LLM providers (switchable per §6; both optional placeholders) ----------
# Anthropic API key (if Anthropic is the chosen provider, §15).
ANTHROPIC_API_KEY=
# OpenAI API key (the chosen provider for the WhatsApp agent, WA-4).
OPENAI_API_KEY=
# Which model object the WhatsApp agent gets: "openai" (production, uses
# OPENAI_API_KEY) or "fake" (deterministic, zero network — tests/dry runs).
LLM_PROVIDER=openai
# Model id handed to the provider (strands OpenAIConfig.model_id).
LLM_MODEL_ID=gpt-4o-mini
# Which embedding adapter the evidence store gets (Feature 9, §6): "openai"
# (production, uses OPENAI_API_KEY) or "fake" (deterministic, zero network —
# tests/dry runs). Anything else fails loudly, like llm_provider.
EMBEDDING_PROVIDER=openai
# Model id handed to the embeddings provider; must match the store's vector
# dimension convention (app.evidence.embeddings.EMBEDDING_DIMENSION = 1536).
EMBEDDING_MODEL_ID=text-embedding-3-small
# Chunks of the owner's library injected into each turn (fail-open; owner choice)
EVIDENCE_INJECTION_K=4
# --- WhatsApp agent guardrails (WA-5; brief §9.2, §14) -----------------------
# The tool-calling loop is the Strands Agents SDK's; these are the guardrails
# around it, all documented OWNER CHOICES (no literature/vendor source):
# sized generously for a single-athlete chat coach while keeping a stuck tool
# loop from burning the budget.
# Per-invocation caps (strands Limits), passed on EVERY invocation: max loop
# turns (one turn = one model call plus its tool executions), max cumulative
# output tokens and max cumulative input+output tokens of ONE message
# processing. The SDK checks them at turn boundaries and stops with
# limit_turns / limit_output_tokens / limit_total_tokens; a stop without a
# final answer gets an explicit guardrail message instead of silence.
AGENT_MAX_TURNS=8
AGENT_MAX_OUTPUT_TOKENS=4000
AGENT_MAX_TOTAL_TOKENS=20000
# Per-conversation token budget: the sum of totalTokens of every turn in the
# conversation (the WhatsApp free-form window, the 24 h after the athlete's
# last message, §9.1), accumulated from result.metrics.accumulated_usage and
# persisted per turn in message_log. When the accumulated usage reaches this
# budget the agent stops BEFORE invoking the model and replies with an
# explicit budget message; usage frees up as turns age out of the 24 h window.
AGENT_CONVERSATION_TOKEN_BUDGET=60000
# --- WhatsApp agent conversation memory (WA-8; §9.2) ----------------------
# Conversation memory persists through the Strands SDK's own session seam
# (RepositorySessionManager + OUR SessionRepository on the project database),
# one session per sender — a message processed by a DIFFERENT Celery process
# reloads the earlier turns. Both values are documented OWNER CHOICES.
# Number of most-recent messages kept VERBATIM in the conversation (N); older
# messages are folded into the stored rolling summary (agent_conversation_summary).
AGENT_MEMORY_WINDOW_MESSAGES=10
# Rolling-summary trigger: a NEW summary is generated only when at least this
# many not-yet-summarized messages have aged past the verbatim window since
# the last summary. Between crossings the stored summary is REUSED verbatim —
# never regenerated on every message. The summary generation IS a model
# invocation: its token usage counts against the conversation budget and is
# persisted with the turn's provenance (trace id, agent version).
AGENT_SUMMARY_TRIGGER_MESSAGES=6
# --- WhatsApp reply formatting (WA-8; §9.2) -------------------------------
# Maximum CHARACTERS per WhatsApp message (~1,000, §9.2). The pipeline
# splits a longer reply into consecutive messages at this budget (characters,
# not UTF-8 bytes: the constraint is stated in characters and Twilio's own
# WhatsApp cap is likewise enforced in characters). OWNER CHOICE (the "~").
AGENT_WHATSAPP_MESSAGE_CHAR_LIMIT=1000
# --- Observability -----------------------------------------------------------
# Langfuse tracing of every WhatsApp agent turn (WA-11, brief §13), exported
# over OTLP/HTTP through the Strands SDK's own OpenTelemetry surface
# (backend/app/agent/tracing.py). Tracing is enabled ONLY when ALL THREE
# variables are non-empty; otherwise it is a clean no-op (the agent behaves
# exactly as untraced).
# TRAP: keys set but LANGFUSE_HOST empty is treated as NOT configured — the
# worker logs ONE warning naming LANGFUSE_HOST and turns proceed untraced.
# A default endpoint is NEVER guessed: a guessed endpoint that is not yours
# would send traces nowhere with zero signal.
# The containerised worker reads the repository-root .env (Compose env_file);
# local `uv run` reads backend/.env — keep both in sync.
LANGFUSE_PUBLIC_KEY=
LANGFUSE_SECRET_KEY=
# Langfuse host, e.g. https://cloud.langfuse.com (no path; the OTLP trace
# endpoint {host}/api/public/otel/v1/traces is derived from it).
LANGFUSE_HOST=
# --- Logging / versioning -----------------------------------------------------
# Log level for the API and worker.
LOG_LEVEL=INFO
# Version stamped on every persisted engine output (§6).
ENGINE_VERSION=0.1.0
# --- Engine constants (LOAD-11; brief §7, §14) ------------------------------
# Every constant of the deterministic load engine, sourced and configurable.
# Defaults equal today's effective engine values; the pure engine functions
# keep the same values as their documented fallback. The read layer passes
# them into the engine — the engine never reads settings (§6).
# Performance Manager time constants (Allen & Coggan, "Training and Racing
# with a Power Meter", Performance Manager Chart).
ENGINE_TAU_CTL_DAYS=42
ENGINE_TAU_ATL_DAYS=7
# Minimum PMC history in days before the series is flagged confident.
# OWNER CHOICE: ~2 chronic time constants (2 x 42 d); below it CTL is
# seed-dominated (§7.2 low-confidence flag).
ENGINE_MIN_HISTORY_DAYS=90
# ACWR EWMA time constants (Williams, Trewartha, Cross, Kemp & Stokes 2017).
ENGINE_ACWR_TAU_ACUTE_DAYS=7
ENGINE_ACWR_TAU_CHRONIC_DAYS=28
# Normalized Power rolling window in samples (Coggan NP definition: 30 s on
# the 1 Hz per-second power stream) and the minimum fraction of valid
# samples a window needs to qualify (OWNER CHOICE: strict 1.0 — only fully
# complete windows count; relax explicitly for gap-heavy streams).
ENGINE_NP_WINDOW_SAMPLES=30
ENGINE_MIN_VALID_FRACTION=1.0
# Banister TRIMP exponent coefficients a * e^(b * dHRr) (Banister 1991,
# "Modeling elite athletic performance"): male 0.64/1.92, female 0.86/1.67.
ENGINE_TRIMP_MALE_A=0.64
ENGINE_TRIMP_MALE_B=1.92
ENGINE_TRIMP_FEMALE_A=0.86
ENGINE_TRIMP_FEMALE_B=1.67
# Which sexed coefficient set the read layer selects (OWNER CHOICE; the
# shipped default "male" is today's effective value).
ENGINE_TRIMP_SEX=male
# hrTSS reference duration in minutes (Coggan hrTSS convention: one hour at
# LTHR = 100 hrTSS).
ENGINE_TRIMP_REFERENCE_MINUTES=60
# Strength sRPE TSS-equivalent factor (Foster et al. 2001 session-RPE).
# OWNER CHOICE (2026-10-05): equivalent-effort anchor — one hour at RPE 7
# (Foster AU = 7 x 60 = 420) is treated as equivalent to one hour at
# threshold (100 TSS), so the factor is 100 / 420 = 0.2380952380952381
# (~0.2381). A documented owner decision, NOT a literature constant. It
# makes the owner's real 40.3-minute RPE-7 gym session (282.1 AU) ~67
# TSS-equivalent — comparable to a one-hour ride (~60 TSS) — where the
# earlier raw-AU value 1.0 made it 282 and dwarfed every ride. The
# hrTSS-implied anchor (~0.024, measured by app.tools.calibrate_srpe) was
# explicitly rejected: it reproduces heart rate's undervaluation of
# strength work.
ENGINE_SRPE_TSS_EQUIVALENT_FACTOR=0.2380952380952381
# Banister impulse-response time constants (Banister 1991; Morton,
# Fitz-Clarke & Banister 1990): fitness tau1, fatigue tau2, days.
ENGINE_BANISTER_TAU1_DAYS=42
ENGINE_BANISTER_TAU2_DAYS=7
# Minimum performance markers before a Banister fit is attempted.
# OWNER CHOICE: 10 = 2 x 5 free parameters (p0, k1, k2, tau1, tau2).
ENGINE_BANISTER_MIN_MARKERS=10
# Intervals.icu PMC cross-check tolerances (§12.3; cross-check only, §5.1):
# a day passes when the relative deviation is within ±10% OR the absolute
# deviation within ±0.5 CTL/ATL points — OWNER-AGREED hybrid rule (relative
# alone is unusable for a decaying series near zero); bounds inclusive.
ENGINE_CROSS_CHECK_RELATIVE_TOLERANCE=0.10
ENGINE_CROSS_CHECK_ABSOLUTE_TOLERANCE=0.5
# Their-side revision-detection threshold in CTL/ATL points. OWNER CHOICE:
# above the float noise of exact-decay days, below the measured real-data
# Intervals revisions (0.4462 ATL, 0.4982 CTL).
ENGINE_CROSS_CHECK_REVISION_THRESHOLD=0.25
# --- Engine zone/threshold constants (ZON-11; brief §7.3, §14) --------------
# Zone/threshold constants of the science engine, sourced and configurable,
# mirroring the documented module constants in app/engine/zones.py (which
# remain the engine's fallbacks). Read by
# app.db.zones_config.zone_constants_from_settings and passed into the pure
# engine — the engine never reads settings (§6).
# Critical Power fit window in seconds (Jones et al. 2019): the published
# 2-20 min window for the linear CP model. LITERATURE.
ENGINE_CP_FIT_WINDOW_MIN_S=120
ENGINE_CP_FIT_WINDOW_MAX_S=1200
# Mean-maximal power duration ladder in seconds, comma-separated (1 s, 1, 2,
# 5, 8, 10, 20, 30, 60 min). OWNER CHOICE: fixed chart-friendly ladder; the
# 20 min point feeds the FTP rule, the 2-20 min points the CP fit.
ENGINE_MMP_DURATIONS_S=1,60,120,300,480,600,1200,1800,3600
# Critical Speed fit window in seconds (brief §7.3: best run efforts between
# "roughly 3 and 20 minutes"). LITERATURE.
ENGINE_CS_FIT_WINDOW_MIN_S=180
ENGINE_CS_FIT_WINDOW_MAX_S=1200
# FTP source precedence, comma-separated permutation of
# manual,cp_derived,twenty_min_power. OWNER CHOICE: no power meter — the
# manually confirmed FTP is the value of record (human-in-the-loop, §7.3).
ENGINE_FTP_PRECEDENCE=manual,cp_derived,twenty_min_power
# CP-to-FTP factor. STANDARD CONVENTION (the linear-form CP approximates
# FTP) and documented OWNER CHOICE: 1.0, kept explicit, never buried.
ENGINE_CP_TO_FTP_FACTOR=1.0
# FTP = 95% of best 20-minute power. LITERATURE (Allen & Coggan; §7.3 fixes
# the 95%).
ENGINE_TWENTY_MIN_TO_FTP_FACTOR=0.95
# Daniels training-pace intensities, % VO2max. The published BANDS are
# LITERATURE (Daniels' Running Formula, 3rd ed., Human Kinetics 2013):
# Easy 59-74, Marathon 75-84, Threshold 83-88, Interval 95-100,
# Repetition 105-120. Each default below is the band MIDPOINT — an
# OWNER-REVIEWABLE choice inside the band.
ENGINE_DANIELS_EASY_PCT_VO2MAX=66.5
ENGINE_DANIELS_MARATHON_PCT_VO2MAX=79.5
ENGINE_DANIELS_THRESHOLD_PCT_VO2MAX=85.5
ENGINE_DANIELS_INTERVAL_PCT_VO2MAX=97.5
ENGINE_DANIELS_REPETITION_PCT_VO2MAX=112.5
# Swim zone boundaries, % of CSS SPEED, comma-separated (Recovery < 85,
# Aerobic 85-95, Tempo 95-100, Threshold 100-105, VO2 max >= 105).
# OWNER-REVIEWABLE CHOICE: §7.3 publishes no swim percentage table (unlike
# the Coggan power and Friel HR tables); only the 100% anchor is LITERATURE
# (critical speed IS the threshold intensity, Wakayoshi et al. 1992). The
# owner should confirm the other three boundaries.
ENGINE_SWIM_ZONE_BOUNDARY_PCTS=85,95,100,105
# Threshold-change detection margin (ZON-9): a proposal requires the new
# effort to exceed the current model value by strictly more than this
# RELATIVE fraction. OWNER CHOICE (pending owner confirmation).
ENGINE_THRESHOLD_CHANGE_MARGIN=0.05
# --- Engine readiness/intensity/durability constants (RID-10; brief §7.4-§7.6, §14) ---
# Constants of the readiness, intensity-distribution and durability engine
# (app/engine/readiness.py, app/engine/intensity.py, app/engine/durability.py),
# sourced and configurable, mirroring the documented module constants (which
# remain the engine's fallbacks). Read by
# app.db.engine_readiness_config and passed into the pure engine — the
# engine never reads settings (§6).
# HRV readiness (§7.4): 7-day rolling ln(rMSSD) mean vs the 60-day own
# baseline, flagged strictly outside +/- 0.5 SD. Window and baseline:
# LITERATURE (Plews et al. 2013). Band 0.5 SD: LITERATURE (smallest
# worthwhile change, Kiviniemi et al. 2007). Minimum valid baseline days
# (70% of 60): OWNER CHOICE — the owner's wellness rows are partly
# populated and a strict requirement would leave the signal permanently
# unassessable.
ENGINE_HRV_WINDOW_DAYS=7
ENGINE_HRV_BASELINE_DAYS=60
ENGINE_HRV_BAND_SD=0.5
ENGINE_HRV_MIN_BASELINE_VALID_DAYS=42
# Resting-HR readiness (§7.4): the as-of value vs the 30-day own baseline.
# Baseline window: LITERATURE (§7.4). The 0.5 SD band (smallest-worthwhile-
# change logic extended to resting HR) and the 70% completeness floor:
# OWNER CHOICE.
ENGINE_RHR_BASELINE_DAYS=30
ENGINE_RHR_BAND_SD=0.5
ENGINE_RHR_MIN_BASELINE_VALID_DAYS=21
# Sleep readiness (§7.4): duration vs the athlete's own baseline. The brief
# fixes no sleep window, so the 30-day baseline, 0.5 SD band and 70%
# completeness floor are OWNER CHOICE, symmetric with resting HR.
ENGINE_SLEEP_BASELINE_DAYS=30
ENGINE_SLEEP_BAND_SD=0.5
ENGINE_SLEEP_MIN_BASELINE_VALID_DAYS=21
# Fraction of the HRV rolling window that must carry a measurement before
# the signal assesses. OWNER CHOICE: strict 1.0 (only fully complete windows
# count); relax explicitly for gap-heavy streams.
ENGINE_MIN_WINDOW_VALID_FRACTION=1.0
# TSB strictly below this value is the "very negative" adverse signal of the
# multi-signal warning rule (§7.4). OWNER CHOICE: the brief gives no number;
# -10 follows the TrainingPeaks/Friel high-fatigue onset and fires earlier
# than the deep-overreach zone (-30) on purpose — the rule already requires
# two or more agreeing signals.
ENGINE_TSB_VERY_NEGATIVE=-10
# 3-zone intensity model (§7.5): first- (LT1) and second- (LT2) threshold
# cut points per modality as "modality:pct" comma pairs (bike_power % FTP,
# run_hr / bike_hr % LTHR, swim_pace % CSS). Second thresholds sit at the top
# of the published Threshold zone (Coggan Z4 106% FTP; Friel Z4 100% LTHR;
# the Tempo/CSS boundary 100% CSS): LITERATURE (Seiler 2010 for the 3-zone
# construct). First thresholds sit at the top of each table's last fully
# aerobic zone: OWNER CHOICE — no source publishes LT1 as an exact
# percentage.
ENGINE_FIRST_THRESHOLD_PCTS=bike_power:76,run_hr:90,bike_hr:90,swim_pace:95
ENGINE_SECOND_THRESHOLD_PCTS=bike_power:106,run_hr:100,bike_hr:100,swim_pace:100
# Which source zone table each sport's sessions use. OWNER CHOICE: bike
# rides use the Coggan power table, runs the Friel run HR table, swims the
# CSS pace table (§7.3/§7.5 primary modalities).
ENGINE_SPORT_MODALITY=run:run_hr,bike:bike_power,swim:swim_pace
# Descriptive pattern-comparison reference bands (§7.5; Seiler 2010
# polarized ~80/20; Stöggl & Sperlich 2014 pyramidal): six percentages
# Z1_lo,Z1_hi,Z2_lo,Z2_hi,Z3_lo,Z3_hi. The papers report means, not decision
# bands, so the bands around the published point values are OWNER-REVIEWABLE
# choices.
ENGINE_POLARIZED_BANDS=70,90,0,15,10,30
ENGINE_PYRAMIDAL_BANDS=55,75,15,35,5,20
# Minimum weekly time in zone (seconds) before a pattern label is reported
# at all. OWNER CHOICE: 2 h — the brief fixes no number, and at low weekly
# volume the percentages reflect session choice more than distribution.
ENGINE_MIN_PATTERN_WEEK_SECONDS=7200
# Aerobic decoupling reference band (§7.6): Pa:HR strictly below 5% on long
# steady sessions suggests good aerobic durability. LITERATURE (Friel; the
# boundary is strict — exactly 5% counts as beyond).
ENGINE_DECOUPLING_REFERENCE_BAND=0.05
# Steadiness guard for decoupling: the halves' intensity measures (NP / NGS)
# must agree within this relative drift, or the session is rejected as not
# steady. OWNER CHOICE: no source publishes a steadiness threshold; 15%
# tolerates normal cardiac drift on a steady long ride while excluding
# interval-style swings.
ENGINE_MAX_HALF_INTENSITY_DRIFT=0.15
# Durability trends on long sessions (§7.6; Maunder et al. 2021 motivate the
# trend itself, not these operational numbers — all three are OWNER CHOICE):
# the "long session" threshold (90 min; below it decoupling measures pacing,
# not durability), the trailing window (84 days = 12 weeks, roughly one
# training build) and the minimum eligible sessions (two points cannot be
# distinguished from noise).
ENGINE_MIN_LONG_SESSION_SECONDS=5400
ENGINE_TREND_WINDOW_DAYS=84
ENGINE_MIN_TREND_SESSIONS=3
# --- Scheduled messages (Feature 10; brief section 11) ----------------------
# Morning brief send time "HH:MM" in the owner's timezone (Europe/Madrid).
# OWNER CHOICE: 07:30, after the 06:55 daily-load recompute. Read once when the
# beat app is created, so changing it needs a beat restart.
MORNING_BRIEF_TIME=07:30
# Twilio approved WhatsApp template ContentSid for sends OUTSIDE the 24 h
# free-form window (section 9.1). Empty = not configured: the brief SKIPS and
# says why (the WhatsApp sandbox has no approved templates at all).
MORNING_BRIEF_TEMPLATE_SID=
# --- Scheduled messages: post-activity review and weekly report (brief 11) ---
# How far back the idempotent review pass looks for activities, in hours. OWNER
# CHOICE: 48, so a first 30-day backfill never becomes 30 messages. Each
# activity is reviewed at most once, marked by its own audit row.
POST_ACTIVITY_REVIEW_LOOKBACK_HOURS=48
# Twilio template ContentSid for review sends outside the 24 h window. Empty =
# not configured: the review SKIPS, audited with its reason.
POST_ACTIVITY_REVIEW_TEMPLATE_SID=
# Weekly report send time "HH:MM" owner-local (Europe/Madrid). OWNER CHOICE:
# 18:00 on Sundays, over the COMPLETED ISO week.
WEEKLY_REPORT_TIME=18:00
# Twilio template ContentSid for the weekly report outside the 24 h window.
# Empty = not configured: the report SKIPS, audited with its reason.
WEEKLY_REPORT_TEMPLATE_SID=