How l0l1 works
l0l1 is a deterministic-plus-LLM layer that sits between whoever wrote the SQL and the warehouse that will run it. It reasons about four boundaries and applies protection at each one.
author (human · ChatGPT · internal tool)
│ ① user → tool ── PII scan (Presidio + regex)
▼
┌───────────────────────────────┐
│ l0l1 │
│ scan · validate · learn │
└───────────────────────────────┘
│ │
② tool → provider ③ tool → warehouse
anonymize before send respect granted scope
│ │
▼ ▼
OpenAI / Anthropic PostgreSQL · MySQL
(validation reasoning) SQLite · DuckDB
│
④ warehouse → output
annotate PII in results
▼
result rows The four boundaries
User → tool
Whatever a person or an LLM produced arrives at l0l1: a prompt, a query, or both.
l0l1 · PII detection runs here. Presidio plus regex scan prompts and query text for SSNs, emails, phone numbers, and card numbers.
Tool → model provider
If validation uses OpenAI or Anthropic, query text and schema context leave the local process.
l0l1 · Detected PII literals are anonymized before this crossing, so raw identifiers are not forwarded to the provider.
Tool → warehouse
The query runs against the actual database — PostgreSQL, MySQL, SQLite, or DuckDB.
l0l1 · l0l1 respects whatever access scope you grant. It reads schema to validate; it does not widen your permissions.
Warehouse → output
Result rows come back and may be stored, cached, or surfaced to a user.
l0l1 · PII columns can be annotated in output, and successful queries are sanitized of literals before being learned as patterns.
The validation pipeline
- 1
Ingest
A query (and optional prompt) enters via CLI, REST API, Jupyter magic, or the VS Code/LSP editor integration.
- 2
Scan
services/pii_detector.py runs Presidio + regex over the text and anonymizes detected literals.
- 3
Introspect
services/schema_service.py reads and caches the live schema of the connected database.
- 4
Validate
The query is checked against real columns and relationships; an LLM reviewer (OpenAI/Anthropic) reasons about intent.
- 5
Learn
services/learning_service.py sanitizes the approved query into a shape pattern and stores it per workspace.
- 6
Suggest
Later, stored patterns are surfaced as completions for the next person writing similar SQL.