The review-first paradigm
Natural-language-to-SQL interfaces often conflate generation with execution. This collapse of trust boundaries creates significant risk: models hallucinate, misinterpret dialects, or generate unsafe statements that execute without oversight. QueryCraft was built to decouple these actions, establishing a rigid review boundary where AI acts as a drafter, not an authority.

Architectural evolution
QueryCraft evolved from a fragmented three-repository prototype that suffered from contract drift and incomplete security models. The second-generation implementation was a unified, full-stack Next.js application. This consolidation enabled strict type safety across the entire request lifecycle and eliminated the need for complex inter-service communication.

Engineering decisions focused on defense-in-depth. Schema-aware retrieval used immutable, hashed snapshots to ground generation in relevant context while minimizing token consumption. Execution security relied on AST-based parsing that rejected non-read operations, supplemented by database-native read-only user accounts.
Engineering lessons
- Streaming structured output requires local validation before persistence; mid-stream failures should not be retried to avoid partial or duplicated artifacts.
- Dialect-specific behavior must be isolated into provider adapters to prevent driver leaks into core application logic.
- Separating metadata introspection from execution providers preserves the security boundary necessary for safe read-only operations.

QueryCraft has been retired and is preserved as an engineering reference. Its lasting value lies in the patterns established for safe AI integration, specifically the use of independent validation layers and the commitment to keeping generated code as an editable, user-controlled artifact.