Don't Let the Model Do Joins: Compiler-Enforced Queries to Stop Confident Wrong Numbers

dosco · x · 2026-12-04

Building deeporg, dosco found that pointing a model at raw tables leads it to happily join things that shouldn't be joined and hand back a wrong number with total confidence. His key design decision was taking joins away from the model entirely: it writes GraphQL, and the compiler performs the joins, eliminating that failure mode architecturally.

The quoted post describes a real engagement: a PE firm owning a healthcare billing software company had an AI agent built inside their Azure tenant on real claims data, with no platform rewrite. Their 20-year-old rules engine worked fine, but every hard revenue question waited on one expert hand-writing SQL against the legacy schema. About six weeks in, their CPTO was running real revenue investigations through an ad hoc research agent, with patient data never leaving the tenant. Before kickoff, the team traced a single claim's charge-to-cash journey and built a data dictionary with their data engineer during the schema migration.

Original post →

More from coding & agent

coding & agent channel →