Skip to content
hs-sql-agent

SQL Compiler

Treat AI-generated SQL as untrusted input.

hs-sql-agent parses SQL into a typed compiler pipeline, validates source semantics and policy, proves target capabilities, and only then emits provider-specific SQL.

01

Parse first

SQL enters a structured parser instead of going directly to a database driver.

02

Prove capabilities

Unsupported source or target semantics are rejected instead of silently downgraded.

03

Compile per provider

The execution boundary keeps database-specific behavior explicit.

Generated SQL is input, not authority

An LLM can propose SQL, but the proposal does not become executable merely because it parses on a database. hs-sql-agent places a compiler and policy boundary between the model and the connection.

The pipeline is designed to fail closed: a statement that cannot be represented or proven safely is rejected rather than rewritten into a different meaning just to make it run.

A typed execution path

Queries pass through parsing, binding, validation, capability checks, provider-specific compilation, and immutable command execution. That gives policy enforcement a structured statement to reason about instead of raw text alone.

  • single-statement query validation
  • table authorization and query policy checks
  • source and target dialect capability boundaries
  • provider-specific rendering only after validation

Capability growth without silent fallback

The supported SQL surface can expand over time without weakening the safety contract. New syntax is added by teaching the parser, typed model, validation, capability proofs, rendering, and tests about the new semantics.