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.
npx agentmods add rules/airweave-ai/airweave/api-layergit clone --depth 1 https://github.com/airweave-ai/airweaveWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02105 |
| Opus 5 | $0.00000 | $0.01052 |
| Sonnet 5 | $0.00000 | $0.00421 |
| Haiku 4.5 | $0.00000 | $0.00211 |
Grade A, and why
api-layer 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 3d 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.
How it starts
The opening of the file, as written. The whole thing — 242 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Airweave API Layer Rules
Overview
FastAPI-based HTTP interface providing RESTful endpoints for SDK access and frontend communication, with unified Auth0/API key authentication.
Architecture
Structure
api/
├── v1/
│ ├── api.py # Main router aggregation
│ └── endpoints/ # Individual endpoint modules
├── deps.py # Dependency injection & auth resolution
├── router.py # Custom TrailingSlashRouter
├── middleware.py # Request processing & CORS
└── auth.py # Auth0 integration & token validation
Endpoint Categories
- Public API (SDK):
/sources/,/collections/,/source-connections/ - Internal Frontend:
/users/,/organizations/,/api-keys/,/sync/,/dag/,/entities/,/destinations/ - Connect Frontend API:
/connect/- Short-lived session tokens for embedded frontend integration flows (Plaid-style Connect modal)
Key Endpoints
Sources API
- GET /sources/{short_name}: Retrieves source details including:
- Core metadata (name, description)
- Authentication methods (
auth_methods) - Configuration schemas (
auth_fields,config_fields) - Auth Provider Support (
supported_auth_providers): List of auth provider short names that support this source
Source Connections API
- POST /source-connections: Creates a new connection with validation:
- For direct auth: validates credential format
- For OAuth: handles authorization flows
- For auth providers: validates provider exists and supports the source
- POST /source-connections/{id}/verify-oauth: Verifies claim-token ownership and triggers deferred sync. Called after the OAuth callback completes to prove the caller that initiated the flow is the one completing it. Required for all browser-based OAuth flows.
Core Components
1. TrailingSlashRouter
from airweave.api.router import TrailingSlashRouter
router = TrailingSlashRouter() # Handles /endpoint and /endpoint/
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.
- 3d ago First seen · 242 lines · 2,105 tokens per session scan A 97bbb4a190b8
api-layer is a cursor rule published in the GitHub repository airweave-ai/airweave (6,563 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,105 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.