How this is built
What is real in this prototype, what is a stand-in, and what changes on the way to production.
The one design decision everything else follows from
The methodology is data, not code. Asset classes, sections, question wording, answer types, conditional branching, hazards, classifications, the rule conditions, severity and likelihood, the recommendation text, the reference clauses, the risk-band boundaries, the escalation rule, and every instruction the image model is given all live in one versioned document (lib/methodology.ts here, a row in Postgres in production).
The engine that reads it is about a hundred and twenty lines (lib/engine.ts) and does not name a single hazard, threshold or standard. That is why adding a fifth asset class, changing a threshold, or rewording a finding is an afternoon in the Rule Studio rather than a release.
The image-analysis approach
- The photograph is downscaled in the browser, then sent with a prompt assembled from the cue list for that asset class — the same list the engineering team edits in Vision cues.
- The model is constrained by a JSON schema generated from that cue list, so it must return a verdict for every cue and cannot invent one. It streams, so verdicts land on screen as they are decided.
- It is instructed to report only what is visible, to answer unclear rather than guess, and never to assign risk or cite a standard. Free-text observations outside the cue list are captured separately and never reach a rule.
- Every detection arrives as a candidate. The inspector accepts or rejects each one; only accepted cues enter the rule engine. Rejected ones are still printed on the report, so the record shows what was considered and set aside.
Model: Claude Opus 5 (multimodal) via the Anthropic API. Swapping model or provider touches one route.
What is real here
- · The rule engine, the risk scoring, the escalation logic and the coverage arithmetic.
- · The image analysis. Upload any equipment photo and it calls the live model.
- · The PDF, rendered server-side from the same data the screen shows, with the photo plate embedded.
- · The blast-radius calculation: every completed assessment is re-scored under the draft methodology before you publish.
- · The data: 46 assets across three facilities and 74 assessments, generated from a fixed seed and then scored by the engine — no finding anywhere in this prototype was written by hand.
What is a stand-in
storage Everything persists to this browser's local storage instead of a database, so the demo needs no account and no server state. lib/store.ts is deliberately shaped like the query surface it replaces.
auth The role switcher in the header stands in for a real identity provider. Roles, scoping and the permission matrix are modelled; the credential check is not.
content The plant, the companies, the people and the assessment answers are fictional. The standard clause citations are illustrative placeholders — a real deployment replaces every reference string with the client's own methodology references.
Production shape
Methodology in force
v4.2 · 4 asset classes · 65 rules · 17 vision cues · 8 hazards · 5 classifications · 67 questions.