Text-to-SQL prompts usually carry the whole database schema, and pay for it on every question. schemagate sends the model only the tables a question needs, and only the ones the person asking may read.

  • 91% fewer schema tokens on real warehouses (Spider 2.0, databases with 50+ tables, median)
  • #1 on UniQL Oracle: 64.93%, ahead of Claude-4.5-Sonnet (49.61)
  • #1 on BIRD Mini-Dev Legacy: SQLite 81.0 · MySQL 72.4 · PostgreSQL 72.6
  • LiveSQLBench-Large: 34.58%, #9 among agents; the BIRD team is adding it to the board
  • In LangChain's official integrations as SchemagateRetriever (pip install langchain-schemagate); also works with LlamaIndex and MCP

What it doesn't do: it picks what the model sees; the SQL is still the model's job.

https://github.com/ashishsinha1602/schemagate