
A foundry pours molten metal into a sand mould and waits. If the metal freezes in the wrong order, the casting shrinks away from itself and comes out with a cavity inside. FoundryFlash simulates that freezing. This project is the part that turns the simulation into something a person can act on: a PDF report that names the defects the run found, explains each one, and closes with a conclusion written by a language model.
Simulation is not the deliverable. What a solver produces is five scalar fields over a few hundred thousand nodes. Reading them is a skill, and the engineers who have it work at the large foundries. The small ones, which are most of them, place feeders from experience and from what worked last time.
The obvious fix is to have a language model narrate the result. It fails on contact. A model that rounds 0.019 to "about 0.02", or recommends a chill it half-remembers from a textbook, writes a document that is fluent, confident, and occasionally responsible for a scrapped batch. Molten iron is handled by people. Fluency was never the hard part here. Being unable to lie is.
I split the document along the line between what was measured and what is being said about it.
A rule engine reads the finished run and decides which of seven defects it found: a hot spot the feeder cannot reach, shrinkage porosity, an open pipe, Niyama below the microporosity threshold, gas out of the cores, and two more. Each fires on its own criterion and carries its own numbers. No model, no network, just arithmetic over the solution.
Beside it sits a catalogue of seven articles, one per defect - what the defect is, why it happens, how foundries fight it, and who says so. People wrote those. Nothing generates them.
The model gets two things. A fact sheet of every number the run produced, and the articles for the defects that fired. It never sees the casting. It writes the conclusion, a priority action per finding, and a list of geometry risks this run did not measure.
Then everything it wrote goes through a gate.
Four checks. The answer has to match a schema. Every number in it has to be a value from the fact sheet or from one of the supplied articles, read in that language's own decimal convention. Every defect it names has to be one this run found. And no paragraph may use a term the project has ruled against.
A paragraph that fails is deleted. Not the report, the paragraph. If all of them fail, the PDF says an assistant answered but none of its text could be verified, and goes out with its findings intact. The report is complete with no model configured at all.
The vocabulary check looks like pedantry. It is not. Our own translation files had foundry terms wrong three times before anyone caught them. The forbidden-term table came from a foundry engineer with a pen.
Measured on published ductile-iron runs, with gpt-4o-mini through OpenRouter - 2,300 to 3,500 tokens per report depending on how many defects fired, five to seven seconds of model time, about $0.0005. The PDF lays out in under half a second, ten to fourteen pages.
That price is the argument for the design. A fact sheet is a far smaller prompt than a document corpus, so the AI layer costs a rounding error next to the simulation it describes. 132 tests cover it and need no API key: the HTTP call sits behind a seam the tests replace, so every validation branch runs offline.
Part geometry is usually the customer's, under NDA. The prompt carries numbers and defect identifiers. It never carries the CAD model, the mesh, or a rendered image, and the pictures in the report are composed locally. The provider key is read on the server and never reaches the browser. A foundry that will not let geometry leave the building points the same client at a local model by changing two environment variables.
Agents that propose casting technology instead of describing it. Move the feeder, add a chill, simulate, read the findings, revise. The domain suits this better than most: the simulation is a verifier, so nothing has to judge whether a proposal worked. The physics answers. One loop iteration costs about 45 seconds today, and the mesher is the slow part, not the solver. The repository carries that roadmap and a design for exposing the whole thing over MCP, so other people's agents can drive it without me writing their client.