architecture

architecture is a cursor rule for Cursor from Scopeo/draftnrun. It costs 2,822 tokens per session, scanned A, original, Apache-2.0.

A set of architecture rules for a system with a FastAPI web API, a PostgreSQL database, background workers, document ingestion, and a separate MCP server. It specifies how API routes, business logic, and database access are separated.

In plain words
What is it for?
Use it when adding API endpoints, services, database operations, authentication checks, ingestion workers, or Kubernetes deployment files.
Why use it?
It prevents new code from mixing responsibilities or breaking the boundaries between authentication, API handling, business logic, and data storage.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when adding API endpoints, services, database operations, authentication checks, ingestion workers, or Kubernetes deployment files.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/scopeo/draftnrun/architecture
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.

Clone the repo
git clone --depth 1 https://github.com/Scopeo/draftnrun

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 architecture

README.md
[![agentmods](https://agentmods.dev/badge/rules/scopeo/draftnrun/architecture.svg)](https://agentmods.dev/rules/scopeo/draftnrun/architecture)
Your own site
<a href="https://agentmods.dev/rules/scopeo/draftnrun/architecture"><img src="https://agentmods.dev/badge/rules/scopeo/draftnrun/architecture.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,822 This file is loaded in full into every session.
When invoked 2,822 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.02822 $0.02822
Opus 5 $0.01411 $0.01411
Sonnet 5 $0.00564 $0.00564
Haiku 4.5 $0.00282 $0.00282

Measured 2d ago against content hash 5588ee9fb08b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

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 2d 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/architecture.mdc · 103 lines

How it starts

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

Architecture Rules

Architecture Overview

Repo Structure

  • ada_backend/ — API server (FastAPI). Routers in routers/, services in services/, repos in repositories/.
  • engine/ — Graph execution engine. graph_runner/ (DAG scheduler), components/ (component implementations), field_expressions/ (AST).
  • mcp_server/ — Standalone MCP server wrapping the API. Separate process, no imports from ada_backend/ or engine/.
  • data_ingestion/ — Document ingestion logic.
  • workers/ — Ingestion + webhook worker processes.
  • infra/k8s/ — Kustomize-based Kubernetes manifests.
  • tests/ — Test suite.

Backend Pattern

Router → Service → Repository (SQLAlchemy + PostgreSQL). Routers define HTTP endpoints and auth dependencies. Services encapsulate business logic. Repositories handle DB CRUD.

Auth Split

Supabase owns users, organizations, memberships, roles. Backend owns projects, graphs, runs, components, and everything else. Backend validates Supabase JWTs via supabase.auth.get_user(). Organization roles are checked via Supabase Edge Functions (check-org-access, check-super-admin).

API Keys

SHA-256 hashed (salted with BACKEND_SECRET_KEY), prefix taylor_, scoped to project or organization.

Graph Execution

DAG of ComponentInstances connected via FieldExpressions (JSON AST). See ada_backend/docs/engine.md.

Generated run-local files are passed by filename, not by copying bytes through graph state. Python Code Runner saves supported generated files under get_output_dir() and exposes artifacts.files; wire that list to AIAgent.input_filepaths when the next AI Agent should attach those files directly to the LLM request. The AI Agent must resolve filenames relative to the run output directory and require a file-capable model.

Environments

draft / production bound to specific GraphRunner versions via ProjectEnvironmentBinding. Each Run records its graph_runner_id (set when the worker transitions the run to RUNNING).

Read the full file on GitHub · 103 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. 2d ago First seen · 103 lines · 2,822 tokens per session scan A 5588ee9fb08b

Subscribe to this mod's changes

architecture is a cursor rule published in the GitHub repository Scopeo/draftnrun (30 stars, last pushed 4d ago), licensed Apache-2.0. It adds 2,822 tokens to every session, about $0.0141 per session on Opus 5. 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-09-04.