Skip to content

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

Open
hassan1731996 wants to merge 6 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 6 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!

@uzair401 uzair401 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @hassan1731996, I hope you are doing great. The ability idea is great, I'd just like you to make a couple of improvements to it.

Right now main.py asks the user for their name and other details every time it's triggered. A lot of that can come from the platform profile the memory system already maintains. It keeps user_profile.md and user_summary.md in persistent storage, so you can read them with read_file("user_profile.md", in_ability_directory=False) (and user_summary.md) and pull the name and context from there, only falling back to asking if they're empty. Just read them, don't write to them, they're platform owned. There's more on this in docs/Agent-Memory-and-Context-Injection.md.

On top of that, you can pick up the user's sleep data by catching it in normal conversation, the way you did in your other abilities, instead of a fixed question flow. That would automate the data gathering and save the user the manual back and forth.

Thanks!

@Rizwan-095
Rizwan-095 deleted the branch openhome-dev:dev August 4, 2026 06:20
@Rizwan-095 Rizwan-095 closed this Aug 4, 2026
@Rizwan-095 Rizwan-095 reopened this Aug 4, 2026
uzair401 and others added 3 commits August 4, 2026 16:52
…nd collapse morning check-in

- Read user name from user_profile.md / user_summary.md on first run; only
  ask if platform profile is empty
- Collapse 3-question morning check-in to one open question ('How'd you
  sleep?') with LLM extracting hours, quality, and notes from the natural
  reply; add single targeted follow-up only when hours are genuinely absent
@hassan1731996
hassan1731996 requested a review from uzair401 August 14, 2026 21:30
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.

3 participants