# CrashCalc: Where not to put AI


My dad is a veteran forensic crash reconstructionist. Years ago he wrote `CrashCalc`, a commercial suite of traffic crash-reconstruction calculators, and right now the two of us are rebuilding it from the ground up for iPhone and Android.

People who use his software do their job in two completely different rooms, and the exact same physics equation has to hold up in both.

The first room isn't a room at all. It's the shoulder of an interstate at 2:00 AM. Semi trucks are blowing past traffic cones ten feet away, your hands are in work gloves, cell service is dead, and you need one trustworthy speed estimate from a set of skid marks in thirty seconds flat.

The second room is a quiet county courtroom eight months later. A defense attorney walks you through your report line by line on the witness stand, asking which edition of which textbook your drag-factor adjustment came from, what units you entered at the scene, and whether the app rounded an intermediate number behind your back.

Nobody in that courtroom cares how clever my prompt engineering was. We're unifying two separate legacy mobile codebases onto one shared Kotlin Multiplatform math and case core under native SwiftUI and Jetpack Compose, and the single most important product call we made was deciding where to keep AI completely out.

## Keeping language models away from forensic math

In a year when coding agents make it easy to bolt a chat box onto every screen, restraint did more work here than any new feature. Picture sitting under oath and explaining that a speed figure came from a language model that felt "pretty confident" at temperature zero. You'd get laughed off the stand, and you'd deserve it.

Inside my `SKILL.md`, that instinct is one short rule: *"Never put an LLM between a user and a deterministic invariant."*

So in `CrashCalc` 4.0, AI sits in one tiny, optional corner. Strictly on-device models (Apple's local frameworks on iPhone, Gemini Nano on Android) can suggest an organizational tag or vehicle category icon from typed field notes without a single byte ever leaving the handset. Phones without local neural hardware simply skip the helper. Every suggestion requires an explicit tap to accept, anything generated wears a clear label, and **AI never computes, touches, or formats a single number that can enter a report.**

## Textbook pages on screen, and my dad gets the final word

When separate iOS and Android apps evolve independently over years, tiny rounding and formula differences creep in. Before building a single new UI screen, we audited every calculator from first principles: re-deriving each equation by hand, reading what both legacy apps actually computed, and checking reference outputs across math, published literature, and floating-point precision.

Every calculator now runs against frozen reference cases in both US customary and metric units under a four-word repo rule: **golden vectors are law.** If a test ever disagrees with a reference number, no coding agent (and definitely not me) is allowed to edit an expected test value to turn CI green. Discrepancies go straight to my dad, who wrote the calculators and knows the physics cold.

Every calculator also prints its exact published textbook citations right under the input fields, like Fricke (*Traffic Crash Reconstruction*, 2nd ed., 2010) and Daily, Shigemura, and Daily (*Fundamentals of Traffic Crash Reconstruction*, IPTM, 2018). Early on, when legal-rights questions stalled a batch of formulas, I asked a plain product question: `"these are just calculations, what rights do we need?"` That cleared the logjam immediately: physics equations need academic citations, whereas only reproduced lookup tables need licensing.

## Built for dead zones, rain, and zero scene paywalls

Everything an investigator touches on the roadside works 100% offline. Launching the app drops straight into an `"Unfiled"` workspace so nobody has to type case metadata in the rain before running a quick skid number, paired with plain-English `"What to measure"` cards (reminding you, say, that a drag sled needs a steady pull rather than peak breakaway force).

One product rule never bends: **"A paywall never appears at a crash scene."** No login wall, subscription modal, or expired-trial banner ever gets to stand between an investigator on a dark shoulder and a calculation.

Privacy works the exact same way. We run zero user accounts and zero backend servers of our own: **"nothing you record reaches us."** Case files live in local SQLite databases on the phone and will sync only through the investigator's own iCloud or Google Drive. Rather than trusting code review to remember that promise, an automated build gate fails compilation the instant the shared Kotlin core imports any networking library at all.

## Proving one Kotlin core in a day

Before betting months on Kotlin Multiplatform, we burned a day on a throwaway spike to see what broke. That spike proved the exact same Kotlin routine returned the exact same drag factor (`f = 0.5333` for `40 mph` over `100 feet`) across the JVM, Android, and iOS, and round-tripped a saved case file from Android Room into iOS SwiftData byte-for-byte identical. We logged the real taxes openly too, like trimming a painful 40-second Xcode link step down to 22 seconds by narrowing the exported Swift header surface, and setting a hard `30 MB` app-size gate after I asked early on to `"ensure we aren't loading a 1gb app on peoples devices"` (our build lands around `15 MB`).

The classic skid-to-speed formula at the center of that spike is short: speed in mph equals `√(30 × D × f)` (Fricke, *Traffic Crash Reconstruction*), so `100 feet` of skid marks with a `0.5333` drag factor gives `√(30 × 100 × 0.5333) = 40 mph`. Because the algebra itself is straightforward, cross-examination goes straight after your inputs and units. Try moving the distance and drag sliders here to see how investigators work the bounds:

## Safety orange `#FF7900` and numbers that don't count up

Plenty of seasoned reconstructionists are older pros squinting in brutal noon sun glare or working under a headlamp at midnight, so accessibility couldn't wait for a polish sprint. My early visual note was nine words: `"the high vis spirit - but maybe safety orange instead"`.

- **Highway-sign contrast:** One exact safety orange (`#FF7900`), always paired with crisp black text and reserved strictly for controls you press or pin (`Calculate`, pinned plates, active case).
- **Glove and large-type ready:** Every screen clears automated layout checks at Apple's largest `AX5` accessibility text scale, with `48 pt` minimum tap targets and text labels on every icon.
- **No slot-machine animations:** UI transitions settle on a constant-deceleration braking curve with zero bounce, and a calculated speed *never* counts dramatically up from zero.

That last detail might be my favorite thing in the whole app. A number that rolls up from zero looks like the software is still making up its mind, and a highway shoulder is the absolute wrong place for dramatic suspense.

Right now `CrashCalc` 4.0 is still being built: cases and calculators run natively on iPhone, Android is catching up right behind it, and sensor-assisted slope checks and court-ready PDF exports are next up. My dad still owns the last word on every single number in the app. My favorite part of the job is guarding the fence that keeps AI out of his math.
