chronotype
Skill0 starsChanged 7 months agoMITView on GitHub
Determine a person's chronotype from wearable data using up to three independent methods - MSF_sc (behavioral, from sleep timing), rMEQ (stated preference, 5-item survey), and HRP (physiological, from heart-rate rhythm per Chan et al. 2025) - plus social jet lag and an estimated CBTmin for phase-shift guidance. Use whenever the user mentions chronotype, MSF, MSF_sc, MCTQ, rMEQ, MEQ, HRP, heart rate phase, morningness-eveningness, "am I a morning person", "am I a night owl", lark vs owl, social jet lag, CBTmin, sleep midpoint, circadian phase, or asks to analyze sleep or HR data from WHOOP, Apple Health, Oura, Fitbit/Garmin, or generic tracker exports. Trigger even on phrasings like "figure out my body clock from my watch data" or "when does my body actually want to sleep". The deliverable is a Word report combining the behavioral, preference, and physiological chronotype results, agreement analysis between them, social jet lag, CBTmin-anchored light-timing recommendations, and a midpoint chart.
In this repository2 other files it gives its agents.
- apple-healthSkill
- whoopSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
If you can't tell which tracker the user has, list the folder contents and look for signature filenames (sleeps.csv → WHOOP, export.xml → …
- Distinctive: line 97
If anything is off, mention it to the user before they read the full report.
- Distinctive: line 118
Ask each question, listen to the answer, map it to the point value, and write the JSON.
- Very specific: line 193
WHOOP cycles are sleep-to-sleep, not midnight-to-midnight: Use Sleep onset / Wake onset (or Asleep duration (min)) — not Cycle start time — …
- Very specific: line 197
Daylight saving transitions: All timestamps are kept in their wall-clock local time.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Chronotype Analysis (Combined)
Estimate a person's chronotype using up to three complementary methods at once:
- MSF_sc (sleep-corrected mid-sleep on free days) — the behavioral marker, computed from at least two weeks of wearable sleep data using the Munich ChronoType (MCTQ) methodology.
- rMEQ (reduced Morningness-Eveningness Questionnaire) — the preference marker, a 5-question self-report instrument.
- HRP (Heart Rate Phase) — the physiological marker, fitted to ≥30 days of heart-rate data per Chan et al. (2025). Independent of sleep timing and self-report; the HR-rhythm trough is the cleanest non-invasive analog of CBTmin and MSF_sc.
The three measure different things — what your body does, what it would prefer, and what its physiology is actually doing — and any disagreement among them is often the most useful information in the analysis. Add social jet lag (MSF − MSW), an estimated CBTmin (habitual wake − 2 h), and you have a defensible chronotype profile that supports actionable recommendations about light, sleep, and schedule.
The full math, edge-case handling, and citations are in references/methodology.md. Read that before running if you need to defend a number or handle a non-standard scenario.
Workflow
The skill produces one Word document. The path has four phases — gather sleep data, ask the rMEQ questions, optionally fit HRP from heart-rate data, then synthesize.
1. Identify and parse the tracker export
scripts/compute_chronotype.py accepts:
--whoop <path>— a WHOOP "Download my data" folder, or asleeps.csvdirectly--apple <path>— an Apple Health export folder, anapple_health_exportfolder, orexport.xmldirectly--oura <path>— an Ourasleep.csv/oura_*_trends_*.csv/ similar--csv <path>— a generic CSV withsleep_onsetandsleep_endcolumns (ISO datetimes); use this for Fitbit, Garmin, Polar, or anything else
If you can't tell which tracker the user has, list the folder contents and look for signature filenames (sleeps.csv → WHOOP, export.xml → Apple Health, columns like "Bedtime Start" → Oura).
2. Confirm the free/work day split only if there's reason to doubt the default
The script defaults to Mon–Fri = work, Sat–Sun = free, which is right for the typical knowledge worker. Ask the user to clarify if any of these apply:
- Shift work, on-call rotations, or an irregular schedule
- Retired, a student on summer break, or otherwise no work-vs-free distinction
- The data covers a period that includes a long holiday
For a custom split, pass --free-days <comma-separated-day-names> (e.g., --free-days Sun,Mon). For per-night override, the generic CSV accepts an optional is_free_day boolean column.
3. Run the compute step
python scripts/compute_chronotype.py --whoop /path/to/whoop_data --out /tmp/chronotype_runProduces in the output directory:
nights.csv— one row per nightsummary.json— MSF, MSF_sc, chronotype band, social jet lag, estimated CBTmin, sleep debt, QA notesmidpoint_chart.png— scatter of nightly midpoints
4. Ask the user the 5 rMEQ questions
Ask conversationally — these don't need to be a wall of multiple-choice. The mapping of answer → point value is documented below; convert the user's natural-language answer to the integer point value and write a small JSON file. Be honest with the user about what each item is asking; don't paraphrase in ways that change meaning.
Save answers to /tmp/chronotype_run/rmeq_answers.json:
{"q1": 4, "q2": 3, "q3": 4, "q4": 4, "q5": 3}Then score:
python scripts/score_rmeq.py --answers /tmp/chronotype_run/rmeq_answers.json --out /tmp/chronotype_run/rmeq.jsonThe user can decline this step — if they don't want to do the survey, just skip the --rmeq flag in the next step and the report will be behavioral-only.
4b. (Optional) Fit Heart Rate Phase (HRP)
HRP is a physiological circadian phase marker independent of sleep timing and self-report. The Chan et al. (2025) recipe: aggregate heart-rate observations into 5-minute bins across a full week pattern, fit a 24-hour sine, and read off the phase. The trough of the HR rhythm sits 6 hours before HRP and is the closest non-invasive analog of CBTmin and MSF_sc.
HRP is most valuable when (a) you suspect schedule-driven misalignment (MSF_sc may be hiding the real biology); (b) you have a long stretch of dense HR data; (c) you want a robust cross-check that doesn't depend on the user's perception.
Data-source rules:
- Apple Health is the realistic source —
export.xmlcontains dense HR records from the Watch. Use--apple <path>. - Generic CSV (
timestamp,hr_bpmcolumns) works for anything else. Use--csv <path>. - WHOOP and Oura standard exports usually don't include the per-minute HR time series. If the user wants HRP and they're on those wearables, tell them what's needed (e.g., WHOOP raw HR via API) and skip HRP otherwise — the report will still produce MSF_sc and (if collected) rMEQ.
Minimum requirements (from the paper): ≥30 days of HR data and a sine-fit R² ≥ 0.5. The script applies these and flags precision as good / moderate / low.
python scripts/compute_hrp.py --apple /path/to/apple_export --out /tmp/chronotype_runProduces hrp.json with HRP clock time, HR peak/trough times, amplitude, R², n_days, and a z-score against the Chan et al. cohort (mean 9.48 h, SD 1.57 h).
5. Sanity-check before reporting
Open summary.json and confirm:
- At least ~7 free-day nights and ~10 work-day nights were used (precision flag)
data_quality.outliers_removedis a few, not dozens- The
chronotype_bandlooks plausible given what the user has said about themselves
If anything is off, mention it to the user before they read the full report.
6. Generate the combined Word report
python scripts/generate_report.py \
--summary /tmp/chronotype_run/summary.json \
--chart /tmp/chronotype_run/midpoint_chart.png \
--rmeq /tmp/chronotype_run/rmeq.json \
--hrp /tmp/chronotype_run/hrp.json \
--out /path/to/outputs/chronotype_report.docx--rmeq and --hrp are both optional. If the user skipped either step, just omit that flag — the report renders whichever sections have data.
7. Deliver
Send the file with a computer:// link and a one-sentence headline: the chronotype band, the MSF_sc clock time, and — if the rMEQ was completed — whether behavior and preference agree.
rMEQ items and scoring
Ask each question, listen to the answer, map it to the point value, and write the JSON. The bins below are from Adan & Almirall (1991), based on the original Horne & Östberg (1976) MEQ items.
Q1 — Preferred wake time
"If you were entirely free to plan your day, what time would you get up?"
| Answer time | Points (q1) |
| 05:00 – 06:30 | 5 |
| 06:31 – 07:45 | 4 |
| 07:46 – 09:45 | 3 |
| 09:46 – 11:00 | 2 |
| 11:01 – 12:00 | 1 |
Q2 — Preferred evening tiredness time
"At what time in the evening do you feel tired and as a result need to sleep?"
| Answer time | Points (q2) |
| 20:00 – 21:00 | 5 |
| 21:01 – 22:15 | 4 |
| 22:16 – 00:30 | 3 |
| 00:31 – 01:45 | 2 |
| 01:46 – 03:00 | 1 |
Q3 — Time of day you feel best
"At what time of day do you usually feel your best?"
| Answer time | Points (q3) |
| 05:00 – 08:00 | 5 |
| 08:01 – 10:00 | 4 |
| 10:01 – 17:00 | 3 |
| 17:01 – 22:00 | 2 |
| 22:01 – 04:59 | 1 |
Q4 — Self-described type
"One hears about 'morning' and 'evening' types of people. Which one do you consider yourself to be?"
| Answer | Points (q4) |
| Definitely a morning type | 6 |
| Rather more a morning type than an evening type | 4 |
| Rather more an evening type than a morning type | 2 |
| Definitely an evening type | 0 |
Q5 — Alertness 30 min after waking
"During the first half hour after you wake up in the morning, how tired do you feel?"
| Answer | Points (q5) |
| Very tired | 1 |
| Fairly tired | 2 |
| Fairly refreshed | 3 |
| Very refreshed | 4 |
Score interpretation
Total range 4 – 25. Categories:
| Score | rMEQ category |
| 4 – 7 | Definite Evening |
| 8 – 11 | Moderate Evening |
| 12 – 17 | Intermediate |
| 18 – 21 | Moderate Morning |
| 22 – 25 | Definite Morning |
The report compares the rMEQ category to the MSF_sc result and writes one of three findings: agreement, behaving later than preferred (often: drift, late screens, social bleed-in), or schedule forcing earlier than preferred (often: alarm-driven misalignment with real circadian cost).
Things that go wrong
Apple Health export.xml is huge. Files of 1–5 GB are normal. The bundled parser uses streaming iterparse and clears elements as it goes, so it runs in constant memory. Do not fall back to BeautifulSoup or plain ET.parse — they'll OOM.
Apple Watch records sleep stages. When the user wears the Watch to bed, sleep records appear as multiple HKCategoryValueSleepAnalysisAsleep* entries per night (Core, Deep, REM). The parser collapses contiguous asleep windows (gap ≤ 30 min) into a single per-night onset/end. "In bed" records without "Asleep" records mean iPhone-only sleep tracking — usable but less accurate; this is flagged in data_quality.sleep_signal.
WHOOP cycles are sleep-to-sleep, not midnight-to-midnight. Use Sleep onset / Wake onset (or Asleep duration (min)) — not Cycle start time — for chronotype work. Nap rows (Nap = TRUE) are excluded automatically.
Travel, illness, or alcohol skew midpoints. The script flags nights whose midpoint is > 2 h from the per-day-type median as outliers and excludes them. The count appears in data_quality.outliers_removed. If the user can point at a specific abnormal stretch (jet lag, sick week), suggest re-running with --exclude-range YYYY-MM-DD:YYYY-MM-DD.
Daylight saving transitions. All timestamps are kept in their wall-clock local time. DST transitions in the data range are listed in summary.json.data_quality.dst_transitions so the report can mention them.
Too little data. Fewer than 7 free-day nights makes MSF_sc unreliable. summary.json.data_quality.precision will be "low" — pass this through to the user and suggest collecting another two weeks.
rMEQ on people with unusual schedules. rMEQ implicitly assumes a roughly conventional life. For shift workers, retirees, parents of very young children, or people in transition (recent move across time zones, recovering from surgery), interpret with caution and lean on MSF_sc.
Chronotype bands (clock time of MSF_sc)
| MSF_sc | Band |
| before 02:00 | extreme early |
| 02:00–03:00 | moderate early |
| 03:00–04:00 | slight early |
| 04:00–05:00 | intermediate |
| 05:00–06:00 | slight late |
| 06:00–07:00 | moderate late |
| after 07:00 | extreme late |
These are Roenneberg's population cutoffs; descriptive, not diagnostic. The report frames them that way.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

