The standard advice — "stop drinking coffee by 2 PM" — is a population-level heuristic that ignores 3–12× individual variation in caffeine metabolism. A fast metabolizer clears caffeine in 3 hours; a slow metabolizer on oral contraceptives may require 12+ hours. One-size-fits-all timing advice is pharmacologically indefensible.
Caffeine (1,3,7-trimethylxanthine) is eliminated almost entirely by hepatic metabolism. The CYP1A2 enzyme handles ~95–97% of primary biotransformation via N-demethylation. Less than 2% of ingested caffeine is excreted unchanged in urine — kidney function is irrelevant to caffeine clearance.
CafOS uses a one-compartment oral absorption model with first-order kinetics, replacing the commonly used instant-absorption simplification.
| Parameter | Symbol | Population Mean | Range | Unit |
|---|---|---|---|---|
| Bioavailability | F | 0.99 | 0.95 – 1.00 | — |
| Dose | D | varies | 28 – 400 | mg |
| Absorption rate | ka | 2.0 | 0.5 – 4.5 | h−1 |
| Volume of distribution | Vd | 0.6 | 0.4 – 0.8 | L/kg |
| Elimination rate | ke | 0.139 | 0.058 – 0.231 | h−1 |
| Half-life | t½ | 5.0 | 3.0 – 12.0 | hours |
The full model captures the absorption phase (Tmax ~45 min) that the simplified model misses. This matters for calculating peak plasma concentration and the timing window before caffeine levels begin to decline.
CYP1A2 activity — and therefore caffeine half-life — varies by up to 8× between individuals due to genetics, hormones, drugs, and lifestyle. The following modifiers shift the population-mean t½ of 5.0 hours:
| Factor | Modifier on t½ | Effective t½ | Mechanism |
|---|---|---|---|
| CYP1A2 fast metabolizer | ×0.70 | 3.5h | *1A/*1A homozygous |
| CYP1A2 normal | 1.00 | 5.0h | Population mean |
| CYP1A2 slow metabolizer | ×1.80 | 9.0h | *1F or *1C carriers |
| Smoker (10+ cigs/day) | ×0.65 | 3.3h | CYP1A2 induction via AhR |
| Combined oral contraceptive | ×1.80 | 9.0h | Estrogen inhibits CYP1A2 |
| Pregnancy (3rd trimester) | ×3.00 | 15.0h | Hormonal CYP1A2 suppression |
| Age 60+ | ×1.20 | 6.0h | Reduced hepatic capacity |
| Fluvoxamine co-admin | ×5.00+ | 25h+ | Potent CYP1A2 inhibitor |
Since >99% of users will never have CYP1A2 genotyping results, CafOS infers metabolizer status through a 6-question onboarding triage. Each question is designed to be factual and observable — not a guess about sleep causation.
"Do you smoke cigarettes or use nicotine regularly?"
| Response | Modifier (M1) | Mechanism |
|---|---|---|
| No / quit >3 months ago | 1.00 | Baseline |
| Quit within last 3 months | 0.85 | CYP1A2 de-induction in progress |
| Yes, <10 cigarettes/day | 0.75 | Moderate AhR-mediated induction |
| Yes, 10+/day | 0.65 | Strong CYP1A2 induction via PAHs |
Polycyclic aromatic hydrocarbons in cigarette smoke activate the aryl hydrocarbon receptor (AhR), inducing CYP1A2 transcription. This is the most replicated finding in caffeine pharmacokinetics — heavy smokers clear caffeine 30–50% faster.
"Are you currently taking hormonal birth control or hormone replacement therapy?"
| Response | Modifier (M2) | Mechanism |
|---|---|---|
| No | 1.00 | Baseline |
| Combined pill/patch/ring (estrogen + progestin) | 1.80 | Ethinylestradiol inhibits CYP1A2 |
| Progestin-only pill/IUD/implant | 1.10 | Minimal CYP1A2 effect |
| Hormone replacement therapy | 1.50 | Conjugated estrogens, moderate inhibition |
| Not sure which type | 1.40 | Conservative estimate |
"Are you currently pregnant?"
| Response | Modifier (M3) | Effective t½ |
|---|---|---|
| No | 1.00 | 5.0h |
| 1st trimester (weeks 1–13) | 1.20 | 6.0h |
| 2nd trimester (weeks 14–27) | 2.00 | 10.0h |
| 3rd trimester (weeks 28+) | 3.00 | 15.0h |
Progressive CYP1A2 suppression from rising estrogen and progesterone. Triggers automatic 200mg/day cap per ACOG guidelines.
"After drinking a cup of coffee, how long do you typically feel the alertness/energy boost?"
| Response | Modifier (M4) | Implied phenotype |
|---|---|---|
| Less than 2 hours | 0.70 | Fast metabolizer |
| About 2–3 hours | 0.85 | Fast-normal |
| About 3–5 hours | 1.00 | Population average |
| About 5–7 hours | 1.25 | Slow-normal |
| More than 7 hours / jittery for a long time | 1.50 | Slow metabolizer |
"How many caffeinated drinks do you have on a typical day?"
| Response | Modifier (M5) | Role |
|---|---|---|
| 0–1 per day | 1.05 | Low tolerance — Q4 answers highly credible |
| 2–3 per day | 1.00 | Normal |
| 4–5 per day | 0.95 | Minor CYP1A2 autoinduction |
| 6+ per day | 0.90 | Heavy use — tolerance may mask Q4 perception |
| Response | Modifier (M6) |
|---|---|
| 18–29 | 0.95 |
| 30–44 | 1.00 |
| 45–59 | 1.10 |
| 60+ | 1.20 |
| Approach | Why rejected |
|---|---|
| "How does coffee affect your sleep?" | Circular — users don't know, that's why they use the app |
| Automatic Bayesian learning from sleep data | Too noisy — stress, screens, kids, alcohol all affect sleep. Can't attribute causation. |
| Ethnicity | GDPR Article 9 risk. Q4 captures phenotype regardless of genotype source. |
| Diet (broccoli, chargrilled meat) | Effect too small (5–15%), confusing UX |
| Family history | Users often don't know. Complex genetics, too noisy. |
| Specific medications | Handled in Settings as a separate drug interaction check, not in onboarding. |
The onboarding questionnaire provides an initial estimate. Rather than attempting automatic Bayesian inference from noisy sleep data (stress, screens, kids, and alcohol all confound sleep quality attribution), CafOS uses direct user feedback on its own output.
After 2 weeks of use, CafOS asks a single question:
| Response | Adjustment | Rationale |
|---|---|---|
| Too early | ke × 1.10 (faster metabolism) | User metabolizes caffeine faster than estimated |
| About right | No change | Model is calibrated |
| Too late | ke × 0.90 (slower metabolism) | User is still affected at cutoff time |
This prompt is available once per month in Settings. It creates a clean feedback loop on the app's output rather than attempting to infer metabolism from noisy sleep physiology data. Each adjustment shifts the effective half-life by ~10%, allowing convergence over 2–3 months without overfitting.
| Parameter | Value | Basis |
|---|---|---|
| Sleep caffeine threshold | 20 mg | Conservative; Drake et al. 2013 |
| WHO daily maximum | 400 mg/day | EFSA/WHO healthy adult limit |
| t½ model clamp | [2.5, 15.0] hours | Physiological bounds |
| Pregnancy daily limit | 200 mg/day | ACOG recommendation |