airweave
CLAUDE.md6.6k starsChanged 8 months agoMITArchived repositoryView on GitHub
Airweave is an open-source platform that makes any app searchable for AI agents by syncing data from 50+ sources into vector databases. It serves as a context retrieval layer for RAG systems and AI agents. Monorepo with four main components: - Backend (backend/): Python 3.13, FastAPI, SQLAlchemy async, PostgreSQL - Frontend (frontend/): React 18, TypeScript, Vite, ShadCN UI, TailwindCSS - Workers: Temporal for async sync orchestration, Redis for pub/sub - MCP Server (mcp/): Node.js, Streamable HTTP transport for AI assistant…
- Installs packages
In this repository22 other files it gives its agents.
- .cursor/rules/airweave-overview.mdcCursor rule
- .cursor/rules/api-layer.mdcCursor rule
- .cursor/rules/arf.mdcCursor rule
- .cursor/rules/auth-providers.mdcCursor rule
- .cursor/rules/backend-rules.mdcCursor rule
- .cursor/rules/connector-cursors.mdcCursor rule
- .cursor/rules/connector-development-end-to-end.mdcCursor rule
- .cursor/rules/connect-widget.mdcCursor rule
- .cursor/rules/crud-layer.mdcCursor rule
- .cursor/rules/feature-flags.mdcCursor rule
- .cursor/rules/fern-docs-generation.mdcCursor rule
- .cursor/rules/form-validation.mdcCursor rule
- .cursor/rules/frontend-rules.mdcCursor rule
- .cursor/rules/integrations-yaml.mdcCursor rule
- .cursor/rules/mcp-server.mdcCursor rule
- .cursor/rules/monke.mdcCursor rule
- .cursor/rules/monke-testing-guide.mdcCursor rule
- .cursor/rules/search-module.mdcCursor rule
- .cursor/rules/source-connector-implementation.mdcCursor rule
- .cursor/rules/stripe-billing.mdcCursor rule
- .cursor/rules/sync-architecture.mdcCursor rule
- .cursor/rules/token-provider-exceptions.mdcCursor rule
The file
We split this CLAUDE.md into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 122
Use logger from ctx (API) or sync_context (during sync)
- Very specific: line 128
Never use Math.random() (ESLint ban).
- Very specific: line 151
After OAuth redirect, call POST /source-connections/{id}/verify-oauth with { claim_token }
- Very specific: line 152
Only remove sessionStorage entry after successful verify-oauth response
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
What is Airweave?
Airweave is an open-source platform that makes any app searchable for AI agents by syncing data from 50+ sources into vector databases. It serves as a context retrieval layer for RAG systems and AI agents.
Architecture
Monorepo with four main components:
- Backend (
backend/): Python 3.13, FastAPI, SQLAlchemy async, PostgreSQL - Frontend (
frontend/): React 18, TypeScript, Vite, ShadCN UI, TailwindCSS - Workers: Temporal for async sync orchestration, Redis for pub/sub
- MCP Server (
mcp/): Node.js, Streamable HTTP transport for AI assistant integration
Data flow: Sources → Entity extraction → Transformation (DAG) → Embedding → Vector DB → Agent queries
Common Commands
Local Development (Docker)
./start.sh # Start all services
./start.sh --skip-frontend # Backend only
./start.sh --restart # Restart services
./start.sh --destroy # Tear down everythingBackend
cd backend
poetry install # Install dependencies
poetry run uvicorn airweave.main:app --host 0.0.0.0 --port 8001 --reload # Dev server
# Tests
poetry run pytest tests/unit # Unit tests only
poetry run pytest tests/integration # Integration tests
poetry run pytest tests/e2e # E2E tests
poetry run pytest tests/unit/test_foo.py # Single file
poetry run pytest tests/unit/test_foo.py::test_bar # Single test
poetry run pytest -m "not slow" # Skip slow tests
# Code quality
poetry run ruff check . # Lint
poetry run ruff format . # Format
poetry run black . # Alt formatter (88 chars)
poetry run mypy airweave # Type checking
lint-imports # Import architecture validationFrontend
cd frontend
npm install # Install dependencies
npm run dev # Dev server on :8080
npm run build # Production build
npm run lint # ESLintBackend Structure
backend/airweave/
├── api/v1/endpoints/ # FastAPI route handlers (one router per resource)
├── models/ # SQLAlchemy ORM models (UUID PKs)
├── schemas/ # Pydantic request/response schemas
├── crud/ # Database access (base classes: _base_organization, _base_user, _base_public)
├── domains/ # Business logic (service.py, repository.py, protocols.py per domain)
├── platform/
│ ├── sources/ # 50+ source connectors (Notion, Slack, etc.)
│ ├── destinations/ # Vector DB adapters
│ ├── embedding_models/# Embedding providers
│ ├── entities/ # Entity type definitions per source
│ └── temporal/ # Temporal worker and activities
├── core/
│ ├── config/ # Pydantic Settings (env vars)
│ ├── container/ # Dependency injection container + factory
│ ├── exceptions.py # Custom exception hierarchy
│ └── logging.py # structlog-based logging
├── adapters/ # External service adapters (PostHog, Stripe, etc.)
└── search/ # Search providers (Vespa)Key concepts:
short_nameis a globally unique identifier for sources/entities (e.g.,slack,hubspot_crm)ApiContextis injected into every endpoint — contains user, org, logger, cache, rate limiter- Domain services use protocol-based DI;
Containerdataclass holds implementations,Factorybuilds it - Alembic migrations run automatically on startup (144+ migration files in
backend/alembic/versions/)
Frontend Structure
frontend/src/
├── components/
│ ├── ui/ # ShadCN base components (40+)
│ └── [feature]/ # Feature-grouped components
├── pages/ # Route-level components
├── lib/
│ ├── api.ts # API client (token mgmt, org context, SSE, retry)
│ ├── stores/ # Zustand stores (organizations, collections, etc.)
│ ├── auth-context.tsx # Auth0 wrapper with dev-mode fallback
│ └── validation/ # Zod-based validation rules
├── hooks/ # Custom React hooks
├── config/ # env.ts, auth.ts
└── types/index.ts # Shared TypeScript types (mirrors backend Pydantic schemas)Key patterns:
- API client: always use relative paths, no
/api/v1prefix — e.g.,apiClient.get('/collections') - Auto-injected headers:
X-Organization-ID,X-Airweave-Session-ID(PostHog session replay) - Zustand for global state, React Query for server state, local state for UI-only concerns
- Component order: hooks → effects → handlers → render
- Path alias:
@/maps to./src
Code Style
Backend (Python)
- Ruff: 100-char lines, Google docstrings, double quotes
- Async for all I/O operations
- Typed parameters and returns; functions under 50 lines
- RESTful endpoints — version is NOT part of the URL path (just
host.com/{endpoint}) - Use logger from
ctx(API) orsync_context(during sync) - Security: never use
random.*for security values (ruff S311); usesecretsmodule
Frontend (TypeScript)
- TailwindCSS with
cn()utility for class merging - Strict typing; shared interfaces in
types/index.ts - Never use
Math.random()(ESLint ban); usecrypto.getRandomValues()orcrypto.randomUUID() - Toast notifications via Sonner:
toast.success(),toast.error(), etc.
Testing
Backend test markers
@pytest.mark.unit— fast, isolated@pytest.mark.integration— requires database/services@pytest.mark.live_integration— requires live cloud infrastructure@pytest.mark.e2e— end-to-end@pytest.mark.slow— long-running
Async mode is auto — async test functions are detected automatically.
Monke (E2E Framework)
Located in monke/. Tests source connectors end-to-end by creating real test data in external systems, triggering syncs, and verifying results in the search index. Components:
monke/bongos/{short_name}.py— test data creation/cleanupmonke/generation/schemas/{short_name}.py— generation schemasmonke/configs/{short_name}.yaml— test configuration
OAuth Browser Flow Contract
POST /source-connectionsreturnsauth.claim_token→ store insessionStorageasoauth_claim_token:{source_connection_id}- After OAuth redirect, call
POST /source-connections/{id}/verify-oauthwith{ claim_token } - Only remove sessionStorage entry after successful
verify-oauthresponse
Skipping verify-oauth leaves the sync stuck in PENDING.
Infrastructure Notes
- Adjacent
infra-corerepository manages all infrastructure - Docker Compose for dev; Kubernetes for prod
- PostgreSQL (metadata), Redis (pub/sub + caching), Vespa/Qdrant (vectors), Temporal (orchestration)
- Auth0 for user auth (can disable with
AUTH_ENABLED=Falsefor local dev) - Pre-commit hooks enforce ruff, mypy, import-linter, ESLint
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

