# manveer04/qryndel architecture

> Architecture diagram of the GitHub repository manveer04/qryndel, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manveer04/qryndel
- Repository: https://github.com/manveer04/qryndel

## Overview

Qryndel is a SQLite-first query language for safely running reads, joins, aggregates, writes, and transactions. The main workflow is a CLI or Python client submitting UDL; the client parses and validates it against schema and safety rules, creates and optimizes a logical plan, compiles parameterized SQLite, then executes under budgets and optionally verifies result contracts. Separate capabilities include explain/preview, schema-drift checks, metrics, and agent-oriented read-only access. Relationships are based on README statements and SOURCE INDEX references; unsampled implementation details are not asserted.

Main entry points: [`qryndel/sdk.py`](https://github.com/manveer04/qryndel/blob/main/qryndel/sdk.py) (Python client), [`qryndel/executor.py`](https://github.com/manveer04/qryndel/blob/main/qryndel/executor.py) (Query execution), [`qryndel/logical_plan.py`](https://github.com/manveer04/qryndel/blob/main/qryndel/logical_plan.py) (Logical plan), [`qryndel/cli.py`](https://github.com/manveer04/qryndel/blob/main/qryndel/cli.py) (UDL CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interfaces"]
  node_cli["UDL CLI<br/>[cli.py]"]
  node_client["Python client<br/>[sdk.py]"]
end

subgraph group_language["Language processing"]
  node_parser["UDL parser<br/>[parser.py]"]
  node_ast["Query AST<br/>[ast_nodes.py]"]
  node_rules["Rule expansion<br/>[rules.py]"]
end

subgraph group_planning["Planning and validation"]
  node_semantic["Semantic validation<br/>[semantic.py]"]
  node_schema["Schema discovery<br/>[schema.py]"]
  node_drift["Schema drift<br/>[schema_drift.py]"]
  node_optimizer["Query optimizer<br/>[optimizer.py]"]
  node_plan["Logical plan<br/>[logical_plan.py]"]
  node_capabilities["Capability checks<br/>[capabilities.py]"]
  node_safety["Safety controls<br/>[safety.py]"]
end

subgraph group_runtime["SQLite runtime"]
  node_backend["SQLite compiler<br/>[sqlite.py]"]
  node_database[("SQLite database")]
  node_executor["Query execution<br/>[executor.py]"]
  node_budgets["Execution budgets<br/>[budgets.py]"]
  node_contracts["Result contracts<br/>[contracts.py]"]
  node_explain["Explain output<br/>[explain.py]"]
  node_metrics["Execution metrics<br/>[metrics.py]"]
end

node_user(("Query caller"))

node_user -->|"submits query"| node_cli
node_user -->|"submits query"| node_client
node_cli -->|"invokes"| node_client
node_client -->|"parses"| node_parser
node_parser -->|"constructs"| node_ast
node_client -->|"loads schema"| node_schema
node_client -->|"validates"| node_semantic
node_semantic -->|"expands rules"| node_rules
node_semantic -->|"checks nodes"| node_ast
node_client -->|"optimizes query"| node_optimizer
node_optimizer -->|"rewrites plan"| node_plan
node_client -->|"builds plan"| node_plan
node_plan -->|"uses nodes"| node_ast
node_client -->|"applies controls"| node_safety
node_client -->|"compiles plan"| node_backend
node_backend -->|"preflights features"| node_capabilities
node_backend -->|"compiles plan"| node_plan
node_client -->|"runs compiled query"| node_executor
node_executor -->|"executes SQL"| node_database
node_executor -->|"enforces limits"| node_budgets
node_client -->|"verifies results"| node_contracts
node_client -->|"formats explanation"| node_explain
node_client -->|"checks declarations"| node_drift
node_cli -->|"offers drift check"| node_drift
node_executor -->|"records execution"| node_metrics

click node_cli "https://github.com/manveer04/qryndel/blob/main/qryndel/cli.py"
click node_client "https://github.com/manveer04/qryndel/blob/main/qryndel/sdk.py"
click node_parser "https://github.com/manveer04/qryndel/blob/main/qryndel/parser.py"
click node_ast "https://github.com/manveer04/qryndel/blob/main/qryndel/ast_nodes.py"
click node_rules "https://github.com/manveer04/qryndel/blob/main/qryndel/rules.py"
click node_semantic "https://github.com/manveer04/qryndel/blob/main/qryndel/semantic.py"
click node_schema "https://github.com/manveer04/qryndel/blob/main/qryndel/schema.py"
click node_drift "https://github.com/manveer04/qryndel/blob/main/qryndel/schema_drift.py"
click node_optimizer "https://github.com/manveer04/qryndel/blob/main/qryndel/optimizer.py"
click node_plan "https://github.com/manveer04/qryndel/blob/main/qryndel/logical_plan.py"
click node_capabilities "https://github.com/manveer04/qryndel/blob/main/qryndel/capabilities.py"
click node_safety "https://github.com/manveer04/qryndel/blob/main/qryndel/safety.py"
click node_backend "https://github.com/manveer04/qryndel/blob/main/qryndel/backends/sqlite.py"
click node_executor "https://github.com/manveer04/qryndel/blob/main/qryndel/executor.py"
click node_budgets "https://github.com/manveer04/qryndel/blob/main/qryndel/budgets.py"
click node_contracts "https://github.com/manveer04/qryndel/blob/main/qryndel/contracts.py"
click node_explain "https://github.com/manveer04/qryndel/blob/main/qryndel/explain.py"
click node_metrics "https://github.com/manveer04/qryndel/blob/main/qryndel/metrics.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_client toneBlue
class node_parser,node_ast,node_rules toneAmber
class node_semantic,node_schema,node_drift,node_optimizer,node_plan,node_capabilities,node_safety toneMint
class node_backend,node_database,node_executor,node_budgets,node_contracts,node_explain,node_metrics toneRose
class node_user toneIndigo
```

## Components

### User interfaces

- [UDL CLI](https://github.com/manveer04/qryndel/blob/main/qryndel/cli.py): `qryndel/cli.py`
- [Python client](https://github.com/manveer04/qryndel/blob/main/qryndel/sdk.py): `qryndel/sdk.py`

### Language processing

- [UDL parser](https://github.com/manveer04/qryndel/blob/main/qryndel/parser.py): `qryndel/parser.py`
- [Query AST](https://github.com/manveer04/qryndel/blob/main/qryndel/ast_nodes.py): `qryndel/ast_nodes.py`
- [Rule expansion](https://github.com/manveer04/qryndel/blob/main/qryndel/rules.py): `qryndel/rules.py`

### Planning and validation

- [Semantic validation](https://github.com/manveer04/qryndel/blob/main/qryndel/semantic.py): `qryndel/semantic.py`
- [Schema discovery](https://github.com/manveer04/qryndel/blob/main/qryndel/schema.py): `qryndel/schema.py`
- [Schema drift](https://github.com/manveer04/qryndel/blob/main/qryndel/schema_drift.py): `qryndel/schema_drift.py`
- [Query optimizer](https://github.com/manveer04/qryndel/blob/main/qryndel/optimizer.py): `qryndel/optimizer.py`
- [Logical plan](https://github.com/manveer04/qryndel/blob/main/qryndel/logical_plan.py): `qryndel/logical_plan.py`
- [Capability checks](https://github.com/manveer04/qryndel/blob/main/qryndel/capabilities.py): `qryndel/capabilities.py`
- [Safety controls](https://github.com/manveer04/qryndel/blob/main/qryndel/safety.py): `qryndel/safety.py`

### SQLite runtime

- [SQLite compiler](https://github.com/manveer04/qryndel/blob/main/qryndel/backends/sqlite.py): `qryndel/backends/sqlite.py`
- **SQLite database**
- [Query execution](https://github.com/manveer04/qryndel/blob/main/qryndel/executor.py): `qryndel/executor.py`
- [Execution budgets](https://github.com/manveer04/qryndel/blob/main/qryndel/budgets.py): `qryndel/budgets.py`
- [Result contracts](https://github.com/manveer04/qryndel/blob/main/qryndel/contracts.py): `qryndel/contracts.py`
- [Explain output](https://github.com/manveer04/qryndel/blob/main/qryndel/explain.py): `qryndel/explain.py`
- [Execution metrics](https://github.com/manveer04/qryndel/blob/main/qryndel/metrics.py): `qryndel/metrics.py`

### Other components

- **Query caller**

## Connections

- Query caller → UDL CLI: submits query (evidence: `README.md`)
- Query caller → Python client: submits query (evidence: `README.md`)
- UDL CLI → Python client: invokes (evidence: `qryndel/cli.py`)
- Python client → UDL parser: parses (evidence: `qryndel/sdk.py`)
- UDL parser → Query AST: constructs (evidence: `qryndel/parser.py`)
- Python client → Schema discovery: loads schema (evidence: `README.md`)
- Python client → Semantic validation: validates (evidence: `qryndel/sdk.py`)
- Semantic validation → Rule expansion: expands rules (evidence: `qryndel/semantic.py`)
- Semantic validation → Query AST: checks nodes (evidence: `qryndel/semantic.py`)
- Python client → Query optimizer: optimizes query (evidence: `qryndel/sdk.py`)
- Query optimizer → Logical plan: rewrites plan (evidence: `qryndel/optimizer.py`)
- Python client → Logical plan: builds plan (evidence: `qryndel/sdk.py`)
- Logical plan → Query AST: uses nodes (evidence: `qryndel/logical_plan.py`)
- Python client → Safety controls: applies controls (evidence: `qryndel/sdk.py`)
- Python client → SQLite compiler: compiles plan (evidence: `qryndel/sdk.py`)
- SQLite compiler → Capability checks: preflights features (evidence: `qryndel/backends/sqlite.py`)
- SQLite compiler → Logical plan: compiles plan (evidence: `qryndel/backends/sqlite.py`)
- Python client → Query execution: runs compiled query (evidence: `qryndel/sdk.py`)
- Query execution → SQLite database: executes SQL (evidence: `README.md`)
- Query execution → Execution budgets: enforces limits (evidence: `qryndel/executor.py`)
- Python client → Result contracts: verifies results (evidence: `qryndel/sdk.py`)
- Python client → Explain output: formats explanation (evidence: `qryndel/sdk.py`)
- Python client → Schema drift: checks declarations (evidence: `qryndel/sdk.py`)
- UDL CLI → Schema drift: offers drift check (evidence: `qryndel/cli.py`)
- Query execution → Execution metrics: records execution (evidence: `qryndel/executor.py`)
