Proactive Monitor

The background loop that watches system health, your calendar, and surfaces notifications.

MeghaOS doesn't only react — it watches. runs a background thread that periodically checks system health and your calendar, and raises notifications when something needs your attention.

The loop

the background monitor ticks roughly every 10 seconds, running three checks:

System health

It samples CPU and disk with system metrics and raises alerts past thresholds:

ConditionNotificationEvent
CPU > 90%"CPU is running at N% — consider closing some apps."cpu_high
Disk low (few GB free)"Only N GB remaining on disk."disk_low

The events are published on the AgentBus, so other parts of the system (or the shell) can react to them, not just display a toast.

Upcoming meetings

It reads the built-in calendar and notifies you ahead of upcoming events, so meetings surface on the desktop without you asking.

Daily briefing

_check_briefing_schedule fires a once-per-day briefing (tracked by last_briefing_date), the backbone of a "here's your day" summary.

Notifications API

All notifications land in a queue exposed to the shell:

EndpointReturns
GET /api/notificationsPending notifications (title, message, type)
python
monitor.add_notification("Disk low", "Only 4.2GB remaining on disk.", type="warning")

The shell polls this to render alerts. Calendar sync is also triggered from here (_trigger_calendar_sync), keeping Google CalDAV data fresh in the background.

Wiring

The monitor is given an the event bus and event loop at startup (set_agent_bus) and started with start / stopped with stop. Because it runs on its own thread, health checks and calendar polling never block the request path that serves /chat.