Skip to content

Add sleep-quality-tracker ability: personalised sleep coaching with habit correlation - #357

Open
hassan1731996 wants to merge 3 commits into
openhome-dev:devfrom
hassan1731996:feature/sleep-quality-tracker
Open

Add sleep-quality-tracker ability: personalised sleep coaching with habit correlation#357
hassan1731996 wants to merge 3 commits into
openhome-dev:devfrom
hassan1731996:feature/sleep-quality-tracker

Conversation

@hassan1731996

Copy link
Copy Markdown
Contributor

Summary

  • Personal sleep coach that builds a correlation engine from the user's own evening habits and morning quality ratings
  • Morning check-in: 3 questions, under 60 seconds — extracts hours from natural speech ("went to bed at midnight, up at seven")
  • Evening habit logging: caffeine after 3pm, exercise, stress level, screen time — correlated with next-morning quality
  • Pattern insights after 5+ nights: not generic advice, findings from the user's own data ("on nights you exercised AND skipped caffeine, quality averaged 8.1 — 1.8 points above your baseline")
  • Sleep debt tracker: cumulative hours behind/ahead of personal goal each week
  • Background daemon: 7am morning nudge, 9pm evening habit nudge, Sunday weekly summary
  • Pure LLM + persistent storage — no API keys required

What makes it unique vs Alexa

Alexa forgets every morning. This ability builds a personal pattern database across weeks and surfaces correlations that are literally impossible without persistent memory — the longer you use it, the more personalised the insights become.

Trigger phrases

"how did I sleep", "sleep check-in", "log my sleep", "sleep report", "sleep patterns", "tips for tonight", "evening habits", and more

SDK patterns applied

  • create_key-first storage with success check
  • Whole-word exit matching (not substring)
  • background_daemon_mode set before CapabilityWorker in daemon call()
  • Outer while True loop for multi-turn follow-ups
  • Stale trigger echo filter in outer loop

Test plan

  • First trigger → setup flow → name + goal saved
  • "how did I sleep" → 3-question check-in → logged + insight spoken
  • Second trigger same day → "already logged today" response
  • "sleep report" with <2 nights → "not enough data yet"
  • "sleep report" with 5+ nights → summary + LLM correlation
  • "evening habits" → 4-question flow → saved to today's entry
  • "tips for tonight" → personalised tip spoken
  • Background daemon fires at 7am with morning nudge
  • Background daemon fires at 9pm with evening nudge
  • Sunday 8am → weekly summary spoken
  • validate_ability.py passes (exit 0)

…abit correlation and weekly pattern insights
@hassan1731996
hassan1731996 requested a review from a team as a code owner July 26, 2026 18:15
@github-actions

Copy link
Copy Markdown
Contributor

🔀 Branch Merge Check

PR direction: feature/sleep-quality-trackerdev

Passedfeature/sleep-quality-trackerdev is a valid merge direction

@github-actions

Copy link
Copy Markdown
Contributor

✅ Community PR Path Check — Passed

All changed files are inside the community/ folder. Looks good!

@github-actions github-actions Bot added the community-ability Community-contributed ability label Jul 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ Ability Validation Passed

📋 Validating: community/sleep-quality-tracker
  ✅ All checks passed!

@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

🔍 Lint Results

🔧 Formatting fixes available

This PR is from a fork, so fixes could not be pushed automatically. Download the python-lint-results artifact from the workflow run for the patch file, then run:

git apply autofix.patch

__init__.py — Empty as expected

Files linted: community/sleep-quality-tracker/background.py community/sleep-quality-tracker/main.py

✅ Flake8 — Passed

✅ All checks passed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-ability Community-contributed ability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant