Quiet Hours and Timezone-Aware Delivery
Goal
Hold all notifications during sleep hours, merge held messages into the morning briefing, and adjust automatically when the user travels.What the User Gets
Without this: 3 AM pings from cron jobs. One bad notification and the user disables the entire system. With this: the brain works overnight (dream cycle, collectors, enrichment) but notifications are held until morning. Travel to Tokyo? The system adjusts automatically from your calendar, no config change needed.Implementation
Quiet Hours Gate
Every cron job that sends notifications must check quiet hours FIRST.- Determine user’s current timezone (from config or heartbeat state)
- Convert current UTC time to local time
- If quiet hours: hold the message, don’t send
Held Messages
During quiet hours, output goes to a held directory instead of being sent:Timezone Awareness
The agent should know what timezone the user is in. Store it in the agent’s operational state:- Calendar shows the user flying somewhere (check for airline/hotel events)
- User mentions being in a different city
- User’s active hours shift (they’re responding at 3 AM PT = they’re probably traveling)
Shell Implementation
Configurable Hours
Some users want different quiet hours. Store the config:enabled: false to disable quiet hours entirely (e.g., for 24/7 monitoring).
Tricky Spots
- Gate on EVERY job. The quiet hours check must run before every single cron job that produces notifications. If even one job skips the gate, the user gets a 3 AM ping and loses trust in the entire system. No exceptions.
-
Held messages MUST be picked up. If the morning briefing doesn’t read
/tmp/cron-held/, overnight results vanish silently. Verify the briefing skill reads and clears the held directory. Orphaned held files mean the pickup integration is broken. - Timezone auto-detection is fragile. Calendar-based timezone detection relies on the user having airline/hotel events with location data. If the user books travel without calendar entries, the system won’t detect the move. Fall back to activity-hour analysis (responding at 3 AM PT = probably not in PT anymore) and ask the user if uncertain.
How to Verify
-
Set quiet hours to the current hour. Temporarily set
QUIET_STARTto one hour before now andQUIET_ENDto one hour after. Trigger a cron job. Verify the output goes to/tmp/cron-held/instead of being sent. -
Check held message pickup. After step 1, run or simulate the morning
briefing. Verify the held message appears in the “Overnight Updates”
section and the file is deleted from
/tmp/cron-held/. - Verify timezone adjustment. Change the timezone config to a zone where it’s currently quiet hours. Trigger a notification. Verify it’s held. Change back to your real timezone during active hours. Trigger again. Verify it sends.
Part of the ModusBrain Skillpack.