Building With AI
Most people use a model to write documents faster. I use one to ship software, and then I spend most of my time proving it works. This is what that actually looks like.
- Model surfaces live
- 6 in PitStop
- Probes guarding them
- 60
- Lines of checks
- 17,117
- Commits, four products
- 632
- Spend ceiling
- 4 dollars a garage, in code
When a model writes the code, the bottleneck stops being how fast you can type and becomes how fast you can tell whether what came back is right. That is not an engineering problem. It is the product manager's problem, and it is the whole job now.
So the discipline I built is not about prompting. It is about what gets checked, how, and by whom. Four products later the rule has not changed: the model does the one job only a model can do, and code does everything that has to be correct. Where those two meet, something counts it.
The Build Logfour products, counted this morning
Nights and weekends, alongside a full time product role and a master's degree. PitStop went from an empty folder to a working garage counter in forty five days.
- Product code 63,716
- Schema 13,296
- Checks 17,117
Nearly one line in five exists only to check the other four. That ratio is the single thing I would point at if someone asked what building with a model changed about how I work.
Six Places a Model Runsin production, doing real work
Reads a Bill a Customer Photographs
A customer uploads an old invoice from any other garage. One model call turns the photograph into rows. Nothing downstream asks a model anything about it again.
Reads a Supplier's Quote
Suppliers reply to an enquiry with a PDF, a spreadsheet or a photo of a letterhead. The reader returns the raw figure, the raw unit, the evidence it saw and a confidence, for every line.
Drafts the Enquiry
The co-pilot behind the enquiry editor. A buyer describes what they need in a sentence; it proposes the lines, the units and the questions worth asking suppliers.
Writes the Clarification Email
When the reader cannot resolve something, it drafts the message that asks the supplier. The buyer edits and sends. The system never sends on its own.
Answers Questions About a Comparison
A tool loop over one enquiry. Nine tools, and every number it says comes out of one of them, which is the same code the comparison screen's own footer uses.
The Shop Assistant
A conversation loop over the garage's own data. It can look things up and draft work. It cannot approve an estimate, issue an invoice or mark a car delivered, and the next section explains why that is not a matter of asking it nicely.
How the Reading Worksa creased photo becomes a row
There is no template, no field map and no integration with the garage that issued the bill. That is the point. The documents are carbon copies, handwriting, phone photos at an angle, half English and half not, with no layout two shops agree on. A rules engine cannot read those. A model can, and that is the one job it is given.
What it hands back is deliberately unfinished. It is asked for the figure as printed, the unit as printed, the text it read that figure from, and how sure it is. It is explicitly told not to tidy anything: a line that says "Brk pad set fr" stays "Brk pad set fr", because a description cleaned up into what the model thinks it meant is a description nobody can audit.
Then the model is done, and arithmetic takes over. Two thousand two hundred and seventy five rupees per five litre can becomes four hundred and fifty five per litre in plain code, which writes down what it divided and by what. Every assumption it leaned on, a pack size the supplier never stated, an exchange rate the buyer set, leaves a flag that caps the cell at "check" however confident the reader was.
Shrink
The browser resizes the photo to 1600px before it leaves the phone. A real test file went from 12.3 MB to 682 KB.
Resolve
The route resolves the share token and derives the storage path from what it matched. The client never names a destination.
Read
One model call. No tools, no database, no network beyond the reply. It returns JSON and nothing else.
Validate
Shape, types and ranges are checked in code. Anything unreadable comes back null, never a guess.
Convert
Units, packs and currency in plain arithmetic, each conversion recording what it did so a person can audit it.
Match
When that car returns, trigram SQL matches the complaint against this and the shop's own history. No model in this path.
Recency is half the ranking. Pads three weeks ago is why the car is back. Pads three years ago is wear.What the matcher is actually for
The last step is the one that took two tries. The matcher first used Postgres similarity(), which scores a whole sentence against a short phrase and gave a real customer complaint 0.21 against a threshold of 0.30. The panel simply never appeared, and the probe passed, because the probe had asked with a tidy keyword rather than the sentence a person types. word_similarity() is the right function and the probe now asks the way a human does.
One more thing happens on the way past. The odometer reading off the bill is checked against the shop's own readings: how far the car has travelled since, and whether the number goes backwards, which an odometer cannot do and which means a wrong car, a misread digit or a clock that has been tampered with. The screen states it. It never judges it.
Why None of It Can Be Steeredabsence of capability, not clever wording
Every document in this system is chosen by somebody outside it. A customer holding a share link can photograph any piece of paper, including one with instructions to the model written on it. A supplier can put anything in a PDF. So the design assumes prompt injection rather than trying to word its way out of it.
The reader has no tools, no database handle and no ability to do anything except return JSON that code then validates. The worst a hostile page achieves is a wrong row in a list captioned "from a bill the customer uploaded". Nothing it extracts ever creates a job card, a price or an invoice; every screen that shows it says it is a claim, not a fact.
The assistant is the same idea applied to a loop with tools. It opens on a channel where approving work, issuing invoices and marking a vehicle delivered are not refused, they are absent from the tool list entirely. And it queries through the signed-in human's own database client, so every query runs under the same row security that human has. If an injection talks it into asking for another garage's data, the database returns nothing. There is no prompt that can argue with that, because there is nothing there to argue with.
SQL matching over the extracted text
over letting a model read and act on it
The matcher runs on every keystroke of a complaint, against text a stranger uploaded. A model there would be slow, expensive, non-deterministic and reachable by anyone who can write words on paper and photograph them. Trigram similarity in Postgres is none of those four things.
Arithmetic in code
over asking the model for the converted number
A model that divides is a model you have to audit on every answer. Asking it only for what the page says, and dividing afterwards, means the same inputs give the same output twice and a buyer can see exactly which assumption produced which price.
A metered hard stop
over trusting usage to stay reasonable
Every call is priced from its tokens and written down. Past the cap the next call is refused with a sentence the screen shows as it is, so the reading waits until somebody raises the limit. Four dollars by default, set in the environment, not in code.
The Checking Systemsixty probes and a doc that is a test
These are not unit tests. They are programs that drive real HTTP, real websockets and real sessions against a real database, because the things that have gone wrong were never logic errors in a function. They were a policy that passes in SQL and is refused by the realtime layer, a signed URL that returns 200 into an iframe that stays blank, a design where a delete broadcasts one tenant's row to every other tenant subscribed.
Three of them are worth describing, because each exists for a specific morning that went badly.
The One That Checks the Documentation
The project's own context file makes countable claims: which functions an anonymous visitor may call, which tables carry a tenant id, what is published to the realtime layer. A probe settles every one of them against the live database and fails if the file and the database disagree. Nearly every serious problem found in the last few months was a claim written down once and never checked again, not a missing feature.
The One That Measures Painted Pixels
A token probe reported forty one colour pairs out of forty one passing. Meanwhile a duplicate rule was putting a near black label on a near black fill at a contrast ratio of 1.02 to 1, across eighty eight places in the app. A probe that reads tokens cannot see two CSS rules colliding, so a second one drives a real browser and measures what is actually on the screen.
The One That Opens a Websocket
A row security policy that passes under a direct database role can still be refused by the realtime layer's own evaluation, and was: a nested call came back false there while working perfectly in SQL. Anything that depends on realtime enforcing a policy has to be tested over a real socket, so that is what this one does.
One rule underneath all of it: the environment variable that chooses which database a script talks to has no default. It used to default to production, which meant the safe path required remembering a prefix and the unsafe path required nothing. Every written probe carried its own guard and so was always fine. An ad hoc one line command carries no guard, and one of mine wrote a row into the live customer table. It was caught and removed inside a minute, but the hole was the default, not the command.
What Is Not Proventhe part a case study usually leaves out
Bill reading is deployed and the key is set, but the live garage has uploaded nothing, so extraction has not been asked to read a real customer's paper yet. It works on test documents. That is a different sentence.
Its probe suite reports forty six assertions passing. They prove the storage, the shape constraints, the row security and the SQL matcher, by inserting rows already marked as extracted. Extraction is the one step they never exercise, and it is exactly the step the API key turns on. Quoting the pass rate as evidence the feature works would be true and misleading.
Neither AI feature has an end to end test. The assistant and the reader share a client and a key, so the reader is probably fine. Probably is not a measurement, and I would rather write that here than imply otherwise.
Everything above is proven at the scale of one garage that I can walk into. None of it has met a second tenant with different habits, and I expect that to teach me something expensive.
Ask Me Anything.
Happy to walk through any of this in detail: the extraction prompts, the tool schemas, the probe suite, or the parts that did not work.
venkatesh@venkateshgardas.com