Scientific dossier
This dossier describes what Sommelle does, rule by rule, and which guidelines each rule is based on. It is intended for doctors, psychologists, pharmacists and other health professionals who want to know exactly what the app offers their patients before recommending it, or who want to help us improve it.
Everything written here matches how the app actually works. The numerical values are gathered in a single place in the source code, which is public.
Status. Sommelle is a self-help and education tool, not a medical device. It makes no diagnosis, does not replace a consultation and claims no therapeutic effect of its own. Its effectiveness has not been evaluated in a clinical study.
1. CBT-I in brief
Cognitive behavioral therapy for insomnia (CBT-I) is the first-line treatment for chronic insomnia in adults, ahead of hypnotics, according to European (2023) and American (American College of Physicians, 2016) guidelines. The French health authority (HAS, 2024) also asks for CBT to be offered first, before any medication, for insomnia that is more than occasional. It combines several components: sleep diary, sleep restriction, stimulus control, cognitive work and sleep education.
For digital CBT-I, effectiveness is mainly shown for guided online programs; effects are smaller without human support. The main challenge is for the patient to complete the program: this is what guides Sommelle's design (quick entry, nothing that makes the patient feel guilty).
2. Program outline
| Week | What the patient experiences |
|---|---|
| Before starting | A 2 to 3 minute entry questionnaire (safety and profile), leading to one of the three pathways described in section 7. |
| 0 | Observation week: sleep diary every morning, with no demanding instructions. |
| 1 | First sleep window (bedtime and rise time) and stimulus control instructions. |
| 2 to 5 | Window adjusted each week; a new cognitive exercise unlocks each week. |
| 6 | Before/after review. |
| After that | Maintenance: the patient can keep up the diary, and the window keeps adjusting. |
A forgotten night can be filled in up to 48 hours later. There is no daily score, no streak to maintain and no red: a bad week is presented as information, never as a failure.
3. The sleep diary
The diary uses the Core version of the Consensus Sleep Diary (Carney et al., 2012). Each morning, the patient enters:
- the time they went to bed and the time they turned off the light;
- the time it took to fall asleep;
- the number and total duration of night awakenings;
- the time of final awakening and the time they got out of bed;
- the perceived quality of the night.
Durations are estimated from simple choices ("less than 5 min", "15 min", "30 min"…), never timed: asking for exact minutes would push the patient to check the time at night. In an experimental study, watching a clock while trying to sleep increased pre-sleep worry and the perceived time to fall asleep (Tang et al., 2007). An entry takes a few moments. The app checks that times are consistent and flags inconsistencies without blocking the patient.
Calculations from the diary
- Time in bed = out of bed − into bed.
- Total sleep time = (final awakening − lights out) − sleep onset latency − wake after sleep onset.
- Sleep efficiency = total sleep time ÷ time in bed.
- Weekly efficiency = sum of sleep times ÷ sum of times in bed. Each night is therefore weighted by its length.
Time spent in bed before turning off the light counts towards time in bed but not towards sleep, which is consistent with the instruction to keep the bed for sleep.
4. The sleep window (sleep restriction)
The principle (Spielman et al., 1987): temporarily reduce time in bed to the time actually slept, to consolidate sleep, then gradually extend it.
| Rule | Value in Sommelle |
|---|---|
| Observation period before any restriction | 7 days |
| Logged nights required | At least 5 out of 7, otherwise the window is kept and the patient is told |
| Initial window | Mean total sleep time during the observation week, rounded up to the next quarter hour |
| Minimum length | 6 h, the same for every profile (design choice). Réseau Morphée (2019) gives 6 h as the lower limit of time in bed; other published protocols accept 5 h (Spielman et al., 2011; RACGP), and reviews report minimums of 4.5, 5 or 6 h depending on the protocol (Riemann et al., 2023). A window already under way below 6 h is raised to 6 h at the next calculation. This floor is the upper end of the published range: it is the most cautious of the minimums found |
| Maximum length | 9 h (design choice: we found no published source for this ceiling). The same bounds, 6 h and 9 h, apply to every profile: this is also a design choice |
| Anchor | Fixed rise time, chosen by the patient, 7 days a week; the bedtime follows from it |
| Weekly adjustment | Efficiency ≥ 85%: +15 min; < 80%: −15 min (without going below the minimum); in between: unchanged. For comparison, the Spielman et al. (2011) manual lengthens from 90% and shortens below 85%, and Réseau Morphée (2019) waits for an index above 85% before moving bedtime earlier: Sommelle's thresholds (85% and 80%) are therefore more lenient than the manual's (90% and 85%), while staying within the published ranges. This is a cautious choice for an app used without a therapist: the window is lengthened earlier and shortened less often |
| From age 65 | Thresholds lowered by 5 points (80% and 75%). The Spielman et al. (2011) manual also lowers thresholds by 5 points for older adults (85% and 80%); the age of 65 is a design choice |
Example
During the observation week, a 50-year-old patient spends on average 8 h 30 min in bed and sleeps 5 h 50 min: her efficiency is 69%. Her initial window is 6 h (5 h 50 min rounded up to the next quarter hour). She chooses to get up at 6:45 am: she will go to bed at 12:45 am.
The following week, she sleeps 88% of her time in bed. The window grows by 15 minutes: bedtime at 12:30 am. If her efficiency had stayed between 80 and 85%, the window would not have changed.
Precautions
Restriction causes transient daytime sleepiness, objectively measurable: in a small laboratory study, measured sleepiness was higher at weeks 1 to 3 of a 4-week restriction and back to baseline at 3 months (Kyle et al., 2014). Guidelines list sleepiness and its effect on driving among the safety points to monitor (Riemann et al., 2023; Edinger et al., 2021). A warning about driving and dangerous machinery is shown for every pathway with restriction, before the first window, and repeated at the first three weekly reviews. Each review also asks: “This week, did you fall asleep unintentionally during the day, or nearly do so?”. If yes, the window is not reduced that week (lengthening is still allowed) and the app advises talking to a doctor. Restriction is never offered in the situations listed in section 7.
5. Stimulus control and evening sleep habits
Stimulus control (Bootzin, 1972; CBT-i Coach) aims to re-associate the bed with sleep. In Sommelle, it relies on five elements:
- a fixed rise time, the same 7 days a week, even after a bad night;
- a bedtime given by the sleep window, paired on the home screen with two personalized evening landmarks calculated automatically: wind-down start (
bedtime − 1 h) and suggested caffeine cutoff (bedtime − 8 h); - an "I can't sleep" button that opens, at night, an almost black screen in warm colors and reduced brightness, with no time or numbers. It recalls the instruction: get up, go to another room, do something calm away from screens, go back to bed when sleep comes;
- a clock-free 20-minute gentle chime on that night screen: if the patient wants to be notified after about 20 minutes out of bed without ever checking the clock (Tang et al., 2007), a soft chime rings after 20 minutes with no visible countdown;
- an interactive "My evening and bedroom habits" card in the Exercises tab (5 checkable habits inspired by CBT-i Coach's Create New Sleep Habits module: hide the clock at night, reserve the bed for sleep, stop coffee, tea and cola at least 8 h before bedtime, get daylight within the hour after rising, avoid naps or keep them to 20 minutes before 3 pm).
The two evening landmarks and the habits are design choices, not established values. Here is what the open sources allow us to say.
- Screens before bed (one-hour wind-down). The NHS advises avoiding phones, tablets and computers for the hour before bed, and HAS (2024) advises limiting screens before bedtime. The one-hour length is the NHS's; no trial validates it in people with insomnia.
- Caffeine (bedtime − 8 h). A meta-analysis of 24 studies (Gardiner et al., 2023) estimates that coffee should be taken at least 8.8 h before bedtime to avoid reducing sleep time; its abstract does not say whether people with insomnia are included. A small crossover trial (12 adults without insomnia, 400 mg) measured lost sleep even when caffeine was taken six hours before bed, and suggests avoiding substantial amounts for at least 6 h (Drake et al., 2013). HAS (2024) recommends avoiding caffeine, alcohol and nicotine without giving a time.
- Naps. Avoiding naps is part of the stimulus control instructions (Morin et al., 2006; Edinger et al., 2021). HAS (2024) advises against naps longer than one hour or after 4 pm; our limit of 20 minutes before 3 pm is stricter and is our own choice.
- Daylight after rising. Réseau Morphée (2019) advises daily exposure to natural light; the one-hour delay after rising is a design choice.
- 20-minute landmark. The NHS advises getting up after about 20 minutes awake, and the RACGP after 15 to 20 minutes; the AASM (2021) and Morin et al. (2006) describe the instruction to get up without giving a duration.
6. Cognitive and relaxation exercises
Six short exercises (about five minutes each, plus a 4 s / 6 s paced breathing guide available from day one) unlock over the course of the program and remain available afterwards.
| Week | Exercise | What the patient does | Technique |
|---|---|---|---|
| 2 | Ideas about sleep | Spots five common beliefs ("I need 8 hours", "I have to catch up in bed"…) and reads a more nuanced version of each | Cognitive restructuring of dysfunctional beliefs (Morin) |
| 2 | Putting your day to rest | Early in the evening, writes down their concerns and the next small action for each, then puts the sheet away | Wind-down time and "constructive worry" (Carney and Waters, 2006) |
| 3 | Stop chasing sleep | In bed, calmly keeps their eyes open in the dark instead of trying to sleep | Paradoxical intention (Espie and Lindsay, 1985) |
| 4 | Back to the most likely | Answers four questions about what they fear for the next day and what actually happened the other times | Decatastrophizing |
| 5 | Relaxing the body | Tenses then relaxes six muscle groups, in the evening | Progressive muscle relaxation (Jacobson) |
7. Safety and referral
The entry questionnaire leads to one of three pathways: full program, program without restriction (stimulus control, cognitive exercises, education), or referral to a doctor without a program.
| Reported situation | What the app does |
|---|---|
| Loud snoring with observed breathing pauses, or marked daytime sleepiness | No restriction; advice to see a doctor (possible sleep apnea) |
| Bipolar disorder, epilepsy | No restriction; advice to talk to the treating doctor |
| Sleepwalking, night terrors or behaviours during sleep | No restriction; advice to talk to a doctor before considering a shorter time in bed |
| Depression or another mood disorder at present | No restriction; advice to talk to a doctor before considering a shorter time in bed |
| Risk of falling, or a sleeping pill or sedative taken in the evening | No restriction; advice to talk to a doctor before considering a shorter time in bed |
| Unstable condition, or one that lack of sleep can worsen (severe migraines, heart disease, poorly controlled chronic pain) | No restriction; advice to talk to a doctor before considering a shorter time in bed |
| Pregnancy | No restriction |
| Driving for work, dangerous machinery, safety-critical job | No restriction by default; message: restriction can increase sleepiness, to discuss with a doctor |
| Very late schedule with normal sleep once asleep | No restriction; possible delayed sleep phase flagged and advice to see a doctor |
| Shift or night work, nights interrupted by someone else (infant, sick relative), under 18 | Outside the app's scope; referral |
| Distress expressed | Crisis line highlighted (3114, the French suicide prevention line, always present in the app, with advice to contact a local crisis line elsewhere); path without time-in-bed restriction and invitation to see a doctor |
In all these cases the sleep diary, stimulus control, tips and exercises remain available: only the reduction of time in bed is not offered. Answers are self-reported and are not a diagnosis.
8. Follow-up: before/after review and summary for the doctor
Before/after review
From week 6, the app compares the observation week with the last 7 nights: sleep onset latency, wake after sleep onset, total sleep time, efficiency and perceived quality. The change is written out in words: "Improving", "Stable" or "Declining".
A question about daytime impact (from 0 to 4) is asked at the start and end of the program. It is not a validated scale. The Insomnia Severity Index (ISI) would be the reference tool, but it is subject to a license and is not included at this time.
Summary for the doctor
The patient can show you a summary directly on screen, or send it to you:
- as a PDF: pathway followed, current window, week-by-week table, before/after review and details of the last 28 nights;
- as a spreadsheet (CSV file, readable in Excel or LibreOffice): the full diary.
These files are created on the phone and it is the patient who chooses to share them (messaging, printing…). Sommelle has no server and sends nothing by itself.
9. What Sommelle does not do, and points to validate
- It does not diagnose insomnia or any other sleep disorder.
- It does not manage tapering or stopping hypnotics, which remains for the doctor to supervise; it reminds users not to stop them without medical advice.
- It does not offer follow-up by a professional: it can, however, support existing follow-up through the summary.
- It does not yet present all sleep hygiene and stimulus control instructions (see section 5).
- Its own effectiveness has not been evaluated in a clinical study.
Gaps and limits
- Time-in-bed restriction is offered without follow-up by a clinician, whereas the guidelines describe it with an initial suitability assessment and regular reviews of sleepiness (Riemann et al., 2023).
- The entry questionnaire also asks about the precautions listed by open sources: parasomnias (Spielman et al., 2011), depression or mood disorders other than bipolar disorder (Réseau Morphée, 2019), conditions that sleep loss may aggravate (Riemann et al., 2023) and fall risk or evening sedatives (Edinger et al., 2021). These questions are self-reported and do not replace a medical assessment. Conversely, pregnancy, shift work and delayed sleep phase are excluded as a precaution: we found no open guideline that lists them for restriction.
- The content has been reviewed against published references (European Insomnia Guideline 2023, AASM 2021, HAS 2024, Réseau Morphée 2019) but not yet validated by a sleep physician.
- Sommelle has not been clinically evaluated.
Several parameters are reasoned design choices rather than established values. We would like them to be reviewed by sleep professionals:
- the minimum length of 6 h and the adjustment thresholds, especially the lowering from age 65;
- calculating weekly efficiency on totals rather than as a mean of nights, and rounding the initial window up;
- the maximum length of 9 h;
- the content of the cognitive exercises and the order in which they unlock;
- the daytime impact question, pending a validated scale;
- the referral rules and the wording of messages, including the drowsiness warning and when it is shown.
10. Sources
- Riemann D. et al. The European Insomnia Guideline: an update on the diagnosis and treatment of insomnia 2023. J Sleep Res, 2023. pure.uva.nl
- Edinger J.D. et al. Behavioral and psychological treatments for chronic insomnia disorder in adults: an American Academy of Sleep Medicine clinical practice guideline. J Clin Sleep Med, 2021. pmc.ncbi.nlm.nih.gov
- Qaseem A. et al. (Clinical Guidelines Committee of the American College of Physicians). Management of chronic insomnia disorder in adults: a clinical practice guideline from the American College of Physicians. Ann Intern Med, 2016, 165(2), 125-133. researchconnect.buffalo.edu
- Zachariae R. et al. Efficacy of internet-delivered cognitive-behavioral therapy for insomnia: a systematic review and meta-analysis of randomized controlled trials. Sleep Med Rev, 2016. em-consulte.com
- Soh H.L. et al. Efficacy of digital cognitive behavioural therapy for insomnia: a meta-analysis of randomised controlled trials. Sleep Med, 2020. read.qxmd.com
- Carney C.E. et al. The Consensus Sleep Diary: standardizing prospective sleep self-monitoring. Sleep, 2012. core.ac.uk
- Spielman A.J., Saskin P., Thorpy M.J. Treatment of chronic insomnia by restriction of time in bed. Sleep, 1987.
- Spielman A.J., Yang C.-M., Glovinsky P.B. Sleep restriction therapy. In: Behavioral Treatments for Sleep Disorders, Elsevier, 2011, chapter 1. med.upenn.edu
- Kyle S.D. et al. Sleep restriction therapy for insomnia is associated with reduced objective total sleep time, increased daytime somnolence, and objectively impaired vigilance. Sleep, 2014. eprints.gla.ac.uk (abstract)
- Kyle S.D. et al. Towards standardisation and improved understanding of sleep restriction therapy for insomnia disorder: a systematic examination of CBT-I trial content. Sleep Med Rev, 2015. em-consulte.com (abstract)
- Morin C.M., Bootzin R.R., Buysse D.J., Edinger J.D., Espie C.A., Lichstein K.L. Psychological and behavioral treatment of insomnia: update of the recent evidence (1998-2004). Sleep, 2006, 29(11), 1398-1414. med.upenn.edu
- Bootzin R.R. Stimulus control treatment for insomnia. Proceedings of the American Psychological Association, 1972.
- Morin C.M., Vallières A., Ivers H. Dysfunctional Beliefs and Attitudes about Sleep (DBAS): validation of a brief version (DBAS-16). Sleep, 2007.
- Carney C.E., Waters W.F. Effects of a structured problem-solving procedure on pre-sleep cognitive arousal in college students with insomnia. Behav Sleep Med, 2006.
- Espie C.A., Lindsay W.R. Paradoxical intention in the treatment of chronic insomnia. Behav Res Ther, 1985.
- Tang N.K.Y., Schmidt D.A., Harvey A.G. Sleeping with the enemy: clock monitoring in the maintenance of insomnia. J Behav Ther Exp Psychiatry, 2007. med.upenn.edu
- Baron K.G. et al. Orthosomnia: are some patients taking the quantified self too far? J Clin Sleep Med, 2017.
- Haute Autorité de santé (HAS). Quelle place pour les benzodiazépines dans l'insomnie ? (good-use sheet, in French), July 2024. has-sante.fr
- Drake C., Roehrs T., Shambroom J., Roth T. Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed. J Clin Sleep Med, 2013, 9(11), 1195-1200. pmc.ncbi.nlm.nih.gov
- Réseau Morphée. Conduite à tenir : devant une insomnie chronique (in French). January 2019 version. reseau-morphee.fr
- Gardiner C. et al. The effect of caffeine on subsequent sleep: a systematic review and meta-analysis. Sleep Med Rev, 2023, 69, 101764. doi.org (abstract read on em-consulte.com)
- NHS, Every Mind Matters. How to fall asleep faster and sleep better. Accessed November 2026. nhs.uk
- Royal Australian College of General Practitioners (RACGP). HANDI: Brief behavioural therapy, insomnia in adults, 2014. racgp.org.au
11. Code and formula auditability (file-by-file mapping)
Sommelle embeds no artificial intelligence: all protocol rules are purely deterministic, isolated in the core/protocol module with no Android dependency, and verified by automated unit tests on every build.
| Clinical component | Exact formula and thresholds in code | Source file and unit tests to audit |
|---|---|---|
| Versioned clinical parameters | baselineDays = 7, minimumLoggedNightsPerWeek = 5, defaultMinimumWindow = 6h00, absoluteMinimumWindow = 6h00, maximumWindow = 9h00, increaseThreshold = 0.85, decreaseThreshold = 0.80, seniorThresholdOffset = 0.05. |
ProtocolConfig.kt |
| Diary metrics (TIB, TST, SE) | TIB = outOfBed − inBed; TST = (finalWake − lightsOff) − SOL − WASO; weighted weekly sleep efficiency SE = ΣTST / ΣTIB. |
SleepMetrics.ktSleepMetricsTest.kt |
| Sleep window & weekly adjustment | Initial window = mean baseline TST rounded up to the next 15 min, clamped to [minWindow, 9h00]. Weekly adjustment (if ≥ 5 logged nights): +15 min if SE ≥ 85% (80% from age 65), −15 min if SE < 80% (75% from age 65), unchanged otherwise. |
SleepWindowCalculator.ktSleepWindowCalculatorTest.kt |
| Safety screening & referral | Deterministic decision tree excluding sleep restriction when sleep apnea, bipolar disorder, epilepsy, pregnancy or delayed sleep phase is suspected, and also excluding it for declared distress or safety-critical or driving occupations. | ScreeningEvaluator.ktScreeningEvaluatorTest.kt |
| Diary consistency validation | Checks chronological order (inBed ≤ lightsOff ≤ finalWake ≤ outOfBed) and wake durations without blocking the patient. |
DiaryValidator.ktDiaryValidatorTest.kt |
| Progression & relapse prevention | 6-week scheduling, before/after review, and maintenance guide for handling an isolated bad night versus a multi-week relapse. | ProgramPlanner.ktProgramPlannerTest.kt |
Your comments on the protocol, thresholds or wording are valuable, whether you are a sleep physician, a psychologist trained in CBT-I, a general practitioner or a pharmacist. Write to us at pilmil.studio@proton.me or open an issue on GitHub.