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/crud-layergit clone --depth 1 https://github.com/airweave-ai/airweaveWrote 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.
[](https://agentmods.dev/rules/airweave-ai/airweave/crud-layer)<a href="https://agentmods.dev/rules/airweave-ai/airweave/crud-layer"><img src="https://agentmods.dev/badge/rules/airweave-ai/airweave/crud-layer.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01790 |
| Opus 5 | $0.00000 | $0.00895 |
| Sonnet 5 | $0.00000 | $0.00358 |
| Haiku 4.5 | $0.00000 | $0.00179 |
Grade A, and why
crud-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 6d 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 — 220 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Airweave CRUD Layer Architecture
Overview
The CRUD layer provides a consistent interface for database operations across all models in Airweave. It implements a sophisticated inheritance hierarchy that enforces proper access control, transaction management, and audit tracking.
Inheritance Hierarchy
Base Classes
1. CRUDBaseOrganization (_base_organization.py)
- Purpose: For resources scoped to organizations (most common pattern)
- Key Features:
- Enforces organization-level access control via
BaseContext - Tracks user modifications with
created_by_emailandmodified_by_email - Validates organization access on every operation
- Supports both user and API key authentication contexts
- Logger access via
ctx.loggerfor contextual logging
- Enforces organization-level access control via
2. CRUDBaseUser (_base_user.py)
- Purpose: For pure user-level data (e.g., user profiles)
- Key Features:
- Enforces strict user-level access (can only access own data)
- No organization scoping
- Simpler permission model - user can only CRUD their own resources
3. CRUDPublic (_base_public.py)
- Purpose: For system-wide public resources (e.g., sources, destinations, embedding models)
- Key Features:
- No access control - publicly accessible
- Often used for system configuration data
- Supports filtering by organization for multi-tenant scenarios
- Includes
sync()method for bulk updates
Core Concepts
BaseContext
The BaseContext (from core.context) is the universal context type for the CRUD layer. ApiContext and SyncContext both inherit from it:
@dataclass
class BaseContext:
organization: schemas.Organization # Always present
user: Optional[schemas.User] = None # Present for user auth, None for API keys/system
logger: ContextualLogger # Auto-derived from org/user if not provided
Key Properties:
has_user_context: True if user is present (Auth0 or system with user)tracking_email: Returns user email for audit trackinguser_id: Returns user UUID if availablehas_feature(flag): Check organization feature flagslogger: Contextual logger (auto-derived from identity, overridable)
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.
- 6d ago First seen · 220 lines · 1,790 tokens per session scan A 00bf460f12af
crud-layer 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 1,790 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.
Other cursor rules, from other repositories
backend
XX Chat AI 后端约定(Fastify / SSE / Provider / SQLite).
backend-rules
Cursor rule "backend-rules" from jihe520/MathModelAgent, covering 后端开发规则, 目录结构, 技术栈, 运行环境 and 主要流程.
ddd-design-guide
Apply when designing or refactoring domain models, services, stores, or discussing DDD (Domain-Driven Design) architecture. Also apply when working on business logic layers, API modules, or planning domain boundaries and migrations.
rulesforconvex
description: Convex guidelines globs: alwaysApply: true.
startup-migration-bounded-work
Production djangostartup migrate must be bounded; never run makemigrations in production.
backend-python
Cursor rule "backend-python" from coeusyk/inference-x, covering backend python rules, stack assumptions, code style, fastapi conventions and schema conventions.