real-time-sync

Installation
SKILL.md

Real-Time Sync

Rule

The UI stays in sync with agent/script changes through useDbSync(). In-process writes stream over /_agent-native/events first; /_agent-native/poll remains the cross-process/serverless fallback. When the agent writes to the database, the UI detects the change and updates automatically — no manual refresh needed.

Why

The agent modifies data in SQL, but the UI runs in the browser. SSE bridges same-process writes immediately; polling bridges anything SSE cannot see, such as another serverless invocation, cron job, or external script. Every visible write increments a version counter, useDbSync() receives the change, and React Query invalidates the relevant caches. This is what makes database writes feel real-time without relying on aggressive polling.

How It Works

  1. Server increments a version counter on every database write. In-process events stream through the authenticated /_agent-native/events endpoint.

  2. Client listens for sync events and updates per-source change counters:

Installs
4
GitHub Stars
3.8K
First Seen
May 23, 2026
real-time-sync — builderio/agent-native