What encoding the FARs as pure functions actually looks like
The AutoBrief rules engine is ~300 lines of TypeScript. No model in the loop, no opinion, no fuzziness. Each Part 61 check is a pure function — same inputs, same output, citable to a section number. The AI sits on top. The legal call stays deterministic.
When I started the AutoBrief rules engine, the temptation was to point Claude at 14 CFR Part 61 and ask it to do the GO/NO-GO call. That would have shipped in an afternoon. It would also have been wrong every time the model hallucinated a rule, and impossible to audit when an insurance carrier asked why an override happened on flight 047 in March.
So the rules engine is a thousand-foot away from the AI layer. Pure TypeScript. About three hundred lines. Eight functions, each one matching a section of the regulations: 61.23 medical, 61.31 endorsements, 61.56 flight review, 61.57(a) day takeoff/landings, 61.57(b) night takeoff/landings, 61.57(c) IFR currency, 91.409(a) annual, 91.409(b) 100-hour.
The model writes the brief. The functions make the call.
What "pure function" means here
Each check takes a pilot, an aircraft, a planned departure, and a planned duration. It returns an array of reasons, each with a category, a severity (blocking / warning / info), a one-sentence status message, and the regulation reference. The orchestrator collects the reasons across all eight checks and picks the worst severity to compute the verdict — GO, HOLD, or NO-GO.
The functions don't reach out anywhere. They don't call an API. They don't depend on the time of day, the weather, the dispatcher's mood, or the model's sampling temperature. The same inputs always produce the same output. That property is worth more than it sounds — when a CFI asks "why did this come back NO-GO," we hand them the reasons array. When the FAA asks how the override flow works, we cite the function that produces the original NO-GO and the audit-log entry that records the override.
Why the messages aren't verbatim reg text
The status messages a dispatcher reads — "Medical Class 1 expired 2026-04-30, 27 days ago" — are descriptive, not paraphrases. We never reproduce the regulation language without sourcing it verbatim from the FAA document. The reason field cites the section number; if a CFI wants to read the actual reg, they go to the eCFR. AutoBrief doesn't try to be the source of truth on legal text. It tries to be a fast, accurate status reporter against a citable spec.
This matters more than I thought it would when I started. There's a category of aviation software that confidently restates 14 CFR in its own words and gets it subtly wrong. We're trying to be the opposite of that — the rule numbers are surfaced everywhere, the actual logic is testable, the language we write is descriptive only.
Where the AI does belong
The AI brief is the second layer. It takes the rules engine's structured output and turns it into the two-or-three sentence plain-English paragraph a busy dispatcher actually reads while crossing the ramp. "NO-GO for Jamie Park on N559TL. Medical Class 1 expired 2026-04-30 — 27 days ago — and the last flight review was 2024-02-15, also expired. Not legal to act as PIC until both are remedied; chief-pilot override required to launch."
That paragraph is the product. The engine's reasons array is the evidence. The Anthropic SDK with a cached system prompt and adaptive thinking writes it in about two seconds, and falls back to a deterministic summarizer if the API key is missing. The model is never in the legal loop. It just translates.
Sixty-six tests, all passing
Because each check is a pure function, every edge case is testable. BasicMed handling. The boundary between "30 days to expiry" (warning) and "29 days" (still warning). The 100-hour Hobbs math when the flight would push the aircraft over the limit. The IFR pilot whose approaches are current but whose holding pattern logbook entry is missing. Each one is three lines of test setup and one assertion. Sixty-six tests, run in under three hundred milliseconds.
That's the property that lets the engine evolve safely. New rules added in v2 (multi-engine currency, glider currency, instructor self-currency) don't have to fear that an old behavior regressed — the test suite says either it did or it didn't. The legal call has confidence. The dispatch board has trust.