sync-architecture

sync-architecture is a cursor rule for Cursor from airweave-ai/airweave. It costs 0 tokens per session (4,065 once invoked), scanned A, original, MIT.

A technical description of Airweave's system for moving data from external sources into searchable destinations. It explains the workers, queues, processing stages, progress tracking, and authentication updates involved.

In plain words
What is it for?
Use it when changing or debugging synchronization, worker concurrency, data transformation, vector creation, storage, progress reporting, or OAuth token handling.
Why use it?
It shows how the system controls concurrent work and prevents fast data producers from overwhelming later processing stages.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/airweave-ai/airweave/sync-architecture
Clone the repo
git clone --depth 1 https://github.com/airweave-ai/airweave

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sync-architecture

README.md
[![agentmods](https://agentmods.dev/badge/rules/airweave-ai/airweave/sync-architecture.svg)](https://agentmods.dev/rules/airweave-ai/airweave/sync-architecture)
Your own site
<a href="https://agentmods.dev/rules/airweave-ai/airweave/sync-architecture"><img src="https://agentmods.dev/badge/rules/airweave-ai/airweave/sync-architecture.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 4,065 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.04065
Opus 5 $0.00000 $0.02032
Sonnet 5 $0.00000 $0.00813
Haiku 4.5 $0.00000 $0.00407

Measured 5d ago against content hash 31be53c18725, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sync-architecture scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/sync-architecture.mdc · 407 lines

How it starts

The opening of the file, as written. The whole thing — 407 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Airweave Sync Architecture - Deep Dive

Overview

The sync module orchestrates data flow from sources to destinations using a highly concurrent, pull-based asynchronous architecture with sophisticated backpressure control, real-time progress tracking, and automatic OAuth token management.

Core Architecture Principles

1. Pull-Based Concurrency Model

  • Worker Pool Pattern: Uses AsyncWorkerPool with semaphore-controlled concurrency (default: 20 workers)
  • Pull vs Push: Workers pull entities from the stream only when ready, preventing system overload
  • Backpressure: AsyncSourceStream uses bounded queues (default: 10000) to naturally throttle producers

2. Separation of Concerns

  • Producer/Consumer Decoupling: Source generation runs independently from entity processing
  • Modular Pipeline: Each stage (enrich, transform, vectorize, persist) is isolated
  • Resource Isolation: Database sessions created only when needed to minimize connection usage

Component Deep Dive

SyncFactory

Purpose: Factory that builds SyncContext (data), SyncRuntime (services), and wires them into the orchestrator

Key Responsibilities:

  • Builds SyncContext (frozen data) via SyncContextBuilder
  • Builds source + cursor directly via _build_source() (uses SourceLifecycleService)
  • Builds destinations via DestinationsContextBuilder
  • Builds entity tracker via _build_entity_tracker() (inlined, no separate builder)
  • Assembles SyncRuntime from per-sync state
  • Configures contextual logging with sync metadata
  • Wires pipelines, handlers, worker pool, and stream

DI Model: Instance-based with constructor-injected deps. Stateless app-scoped services (event_bus, usage_checker, processor, arf_service) are held by the factory and injected directly into consumers (SyncOrchestrator, EntityPipeline), not stored in SyncRuntime.

SyncContext (frozen data)

Purpose: Immutable data describing a sync run. Inherits from BaseContext (sibling to ApiContext).

Read the full file on GitHub · 407 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 407 lines · 4,065 tokens per session scan A 31be53c18725

Subscribe to this mod's changes

sync-architecture is a cursor rule published in the GitHub repository airweave-ai/airweave (6,566 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 4,065 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.