SQL that learns. AI that validates. Privacy that protects.
Website | Documentation | API Reference | Examples | Skelf Research
l0l1 is a developer toolkit for SQL analysis that combines AI-powered validation with continuous learning. It detects PII, suggests improvements, and gets smarter from your successful queries.
# Validate with AI insights
$ l0l1 validate "SELECT * FROM users WHERE email LIKE '%@%'"
# Detect PII automatically
$ l0l1 check-pii "SELECT ssn, email FROM customers"
Found: SSN, EMAIL_ADDRESS
Anonymized: SELECT <SSN>, <EMAIL> FROM customers
# Learn from your patterns
$ l0l1 complete "SELECT * FROM orders WHERE"
Suggestions based on 47 learned patterns...# Clone and install with uv (recommended)
git clone https://github.com/skelf-research/l0l1-api.git && cd l0l1-api
uv sync
# Or install from PyPI
pip install l0l1Requirements: Python 3.11+, OpenAI or Anthropic API key
# Set your API key
export OPENAI_API_KEY="sk-..."
# Validate a query
uv run l0l1 validate "SELECT * FROM users WHERE id = 1"
# Start the API server
uv run l0l1-serve
# API at http://localhost:8000, docs at /docs| Feature | Description |
|---|---|
| AI Validation | Multi-provider support (OpenAI, Anthropic) for query analysis |
| PII Detection | Presidio-powered detection and anonymization |
| Continuous Learning | Graph-based pattern learning from successful queries |
| Multi-Interface | CLI, REST API, Jupyter magic, VS Code extension |
| Schema Aware | Context-aware validation with schema introspection |
l0l1 validate "SELECT * FROM users" # Validate syntax and semantics
l0l1 explain "SELECT COUNT(*) FROM orders" # Get AI explanation
l0l1 check-pii "SELECT email FROM users" # Detect sensitive data
l0l1 complete "SELECT * FROM orders WHERE" # AI-powered completion
l0l1 serve # Start API server# Start server
uv run l0l1-serve
# Validate query
curl -X POST http://localhost:8000/sql/validate \
-H "Content-Type: application/json" \
-d '{"query": "SELECT * FROM users", "schema_context": "users(id, name, email)"}'
# Check PII
curl -X POST http://localhost:8000/sql/check-pii \
-H "Content-Type: application/json" \
-d '{"query": "SELECT * FROM users WHERE email = '\''[email protected]'\''"}'from l0l1.models.factory import ModelFactory
from l0l1.services.pii_detector import PIIDetector
from l0l1.services.learning_service import LearningService
# AI-powered validation
model = ModelFactory.get_default_model()
result = await model.validate_sql_query(
"SELECT * FROM users WHERE id = 1",
schema_context="users(id INT, name VARCHAR, email VARCHAR)"
)
# PII detection
detector = PIIDetector()
findings = detector.detect_pii("SELECT * FROM users WHERE ssn = '123-45-6789'")
anonymized, _ = detector.anonymize_sql(query)
# Learning from successful queries
learning = LearningService()
await learning.record_successful_query("workspace-1", query, execution_time=0.5)
suggestions = await learning.get_query_suggestions("SELECT * FROM", "workspace-1")# Load the magic extension
%load_ext l0l1.integrations.jupyter.magic
# Use magic commands
%%sql_validate
SELECT u.name, COUNT(o.id)
FROM users u JOIN orders o ON u.id = o.user_id
GROUP BY u.nameCreate a .env file or set environment variables:
# Required: AI Provider (at least one)
OPENAI_API_KEY=sk-...
# ANTHROPIC_API_KEY=sk-ant-...
# Optional: Provider selection
L0L1_AI_PROVIDER=openai # or "anthropic"
# Optional: Features
L0L1_ENABLE_PII_DETECTION=true
L0L1_ENABLE_LEARNING=true
# Optional: Server
L0L1_API_PORT=8000
L0L1_CORS_ORIGINS=http://localhost:3000See Configuration Guide for all options.
l0l1/
├── api/ # FastAPI REST API
├── cli/ # Typer CLI
├── core/ # Configuration
├── models/ # AI providers (OpenAI, Anthropic)
├── services/ # Core services
│ ├── pii_detector.py # PII detection (Presidio)
│ ├── learning_service.py # Pattern learning
│ ├── database_service.py # DB connections
│ └── schema_service.py # Schema management
└── integrations/
├── jupyter/ # Notebook integration
└── ide/ # LSP server
# Setup dev environment
make setup
# Run tests
make test
# Lint and format
make lint
make format
# Start dev server with reload
make serve
# Build documentation
make docs# Build and run
docker-compose up -d
# Check health
curl http://localhost:8000/healthFull documentation at docs.skelfresearch.com/l0l1
Contributions welcome! See Development Guide.
# Fork, clone, then:
uv sync --all-extras
pre-commit install
make testMIT License - see LICENSE
Documentation | Issues | Discussions
Built by Skelf Research
l0l1 is built by Skelf Research — an independent UK AI research lab publishing production-grade open-source projects.
🌐 Website · 📚 Documentation · 🔬 All projects · 🤗 Hugging Face
Related projects: compere (pairwise ranking) · mpl (agent-comms contracts) · savanty (English→constraint solver)
Released under MIT / Apache-2.0. © Skelf Research Limited.