Sync Modes
Mayros synchronizes Cortex data between instances using one of two modes: native (QUIC gossip) or polled (REST delta sync). The mode is selected automatically at startup.
Mode selection
mermaidflowchart TD A[Mayros starts] --> B{Cortex healthy?} B -->|No| C[No sync] B -->|Yes| D{probeP2p succeeds?} D -->|Yes| E{nativeP2pPreferred?} E -->|Yes| F[Native mode] E -->|No| G[Polled mode] D -->|No| G
probeP2p() calls GET /api/v1/p2p/status and checks if the Cortex sidecar reports P2P as enabled with a valid node ID.
Native mode
In native mode, synchronization is handled entirely by the Cortex gossip layer:
- Transport: QUIC with TLS
- Mechanism: Bloom-filter set reconciliation in gossip rounds
- Latency: Near-zero (push-based)
- Deletion: Tombstone propagation with 24h TTL
- Overhead: Minimal — no REST polling
When native mode is active:
mayros sync statusshows P2P peers, gossip stats (round, known IDs, bloom FPR), and sync stats (successful/failed syncs)mayros sync nowdefers to gossip — shows current stats instead of triggering REST syncmayros sync pairadds both a REST peer and a P2P peer connection- The
agent_endhook skips REST polling sync (gossip handles propagation)
Polled mode
In polled mode, Mayros manages synchronization via REST:
- Transport: HTTP REST
- Mechanism: Delta sync (
POST /api/v1/sync/delta) with timestamp-based filtering - Latency: Interval-based (configurable, default 300s)
- Peer management:
PeerManagertracks known peers
When polled mode is active:
mayros sync statusshows the peer list and last sync timestampsmayros sync nowtriggers an immediate delta sync to all or a specific peermayros sync pairadds a REST peer only- The
agent_endhook triggers auto-sync whenautoSyncis enabled
Configuration
| Key | Default | Description |
|---|---|---|
sync.intervalSeconds | 300 | Polling interval (10–86,400s) |
sync.autoSync | false | Auto-sync on agent_end and config_change |
sync.conflictStrategy | "last-writer-wins" | Conflict resolution: last-writer-wins, keep-both, local-priority, remote-priority |
sync.maxTriplesPerSync | 5000 | Max triples per sync batch (100–50,000) |
sync.syncTimeoutMs | 30000 | Sync timeout (5,000–120,000ms) |
sync.nativeP2pPreferred | true | Prefer native P2P when available |
discovery.bonjourEnabled | false | Enable Bonjour/mDNS peer discovery |
discovery.bonjourServiceType | "_mayros-cortex._tcp" | mDNS service type |
discovery.manualPeers | [] | Manually configured peer list |
Monitoring
In native mode, gossip metrics are available via mayros sync status:
- Gossip round: current round number
- Known IDs: total triple IDs tracked
- Bloom FPR: false positive rate of the bloom filter
- Successful syncs / Failed syncs: cumulative counters
Related
- P2P Sync — pairing, seed auth, and discovery
- Cortex (AIngle) — sidecar overview
- sync CLI — command reference