ENGINE 51

SFS-E51-PRA · INSURANCE & COMPLIANCE · REV 2026-08-14 · PRODUCTION

PRODUCTION = runnable end-to-end, CI-backed, full test suite passing. All data fictional and seeded.

Premium Audit Response

The carrier's auditor asks what the warranty work actually cost. This engine answers from the ledger's own printed totals - or refuses.

Once a year a general-liability carrier audits the policy: did the insured incur the cost the premium was underwritten on? The raw material is unglamorous - fixed-width job-cost print reports out of a construction ERP, a certificate-of-insurance coverage listing, and a policy period that never lines up with a fiscal year. In practice somebody re-keys the prints into a spreadsheet, and the workpaper's credibility rests on nobody having dropped a line. This engine reads the print instead, and it exploits the one thing a print report carries that a re-key loses: the report's own per-job totals. Every parsed job must tie its printed total to the cent, over the union of jobs parsed and jobs printed, or the engine refuses to produce a workpaper at all. What survives is cut to the audit window (inclusive on both ends), cross-referenced against the coverage listing, and triaged line by line under a fixed-precedence policy - journal entries that never had a vendor, clearing accounts, wrap-enrolled vendors, materials-only and professional exemptions, vendors whose required coverage is current at the window end, and the remainder marked for certificate chase. The output is a byte-stable audit-response package: JSON and Markdown, integer cents throughout, every line in exactly one bucket.

A premium-audit workpaper fails quietly. The re-keyed spreadsheet still foots - it just foots to the wrong number, because a page break swallowed a line, a reversal row lost its vendor, or a clearing account was chased for a certificate it can never have. The defect classes this engine is built against are exactly the ones a tired preparer produces at a print boundary: the vendor that continues onto a reversal line without being restated, the journal-entry line with a single reference token instead of two, the numeric clearing account whose name is lowercase in a report where every vendor is uppercase, the job whose printed total simply is not there. Each one is either parsed correctly by construction or converted into a refusal that names the job and the cent delta. The engine's stance is the portfolio's stance: an untied workpaper is not a draft, it is a defect - and no material output rests on a single pass's word, because the print report itself is the second opinion.

Run it Book a consultation

Architecture

functional block stack · static overview
Print Parser Printed-Total Reconciliation Audit Window Cut Certificate Triage Package Emitters substrate: seeded fictional data

Select a layer

Five stages run in build order. The parser and its reconciliation gate come first because nothing downstream is allowed to exist if the parse does not tie; the window cut, coverage cross-reference and triage are pure functions over what survived; the emitters are byte-stable so a re-run is a diff, not a judgment call.

Key specifications

at a glance
9,6481
Tests
the collected checks that pin this engine's behavior
72
Triage buckets
every line lands in exactly one
33
Planted defects
each one must produce a refusal, not a workpaper
0 cents4
Tolerance
an untied job is a refusal, not a rounding note

What it does for you

plain terms

A premium audit asks a simple question - what did the covered work actually cost during the policy period - and the honest answer lives in a print format designed for paper. Re-keying it into a spreadsheet destroys the one safeguard the print carries: its own totals. The workpaper that results is checked by the person who typed it, against the file they typed. This engine keeps the print's self-description as the verification anchor and makes the parse prove itself against it, job by job, to the cent, before any triage or period cut is allowed to exist.

A clean print parses, ties, and packages end to end5. The CLI generates a fictional print report, parses it, ties every job to the report's own printed totals, cuts the audit window, triages every line, and writes the JSON and Markdown package. The demo's numbers are fictional; the discipline is not.

A printed total off by one cent is a refusal, not a variance6. One planted defect nudges a single job's printed total by one cent. The parse completes, the reconciliation gate fails exactly that job with a delta of exactly one cent, and no package is produced. The failing job is named in the refusal.

A job that prints a total but parses no lines cannot slip through7. Reconciliation runs over the union of parsed jobs and printed-total jobs. A truncated parse that silently dropped an entire job fails against the printed side of the union - the case a sums-only check would wave through.

Functional block diagram

engineering · each block links to its source
Functional block diagram of the Premium Audit Response engine print text typed lines tied lines only coverage listing triaged lines Seeded Print Reports Print Parser Reconciliation Gate Window + Coverage Audit Package SFS-E51-PRA · FUNCTIONAL BLOCK DIAGRAM · REV 2026-08-14

Plain terms

  • Seeded Print Reports. fictional fixed-width job-cost prints, with their own printed totals and planted defects
  • Print Parser. token state machine over the print
  • Reconciliation Gate. ties every job to its printed total or refuses
  • Window + Coverage. inclusive window cut; coverage currency at window end
  • Audit Package. byte-stable JSON + Markdown, every line in exactly one triage bucket

Engineering

  • Seeded Print Reports. generate_report(seed) emits the print text, the expected per-job totals, a matching coverage listing, and on request one of three planted defects: a printed total off by one cent, a missing total line, a malformed amount.
  • Print Parser. Vendor continuation, reversal rows, one-or-two-reference journal lines, page-break boilerplate.
  • Reconciliation Gate. Union of parsed and printed jobs, exact ==, ParseRefusal carries every failing job and delta.
  • Window + Coverage. Pure predicates over the surviving lines; both period cuts retained.
  • Audit Package. Sorted-key JSON, integer cents, triage census; rendered twice and compared for equality in the suite.

Instruction set

every public command
CommandOperationOutputExitArtifacts
python -m premaudit_engine --seed 7
generate a fictional print report, parse and verify it, build the triaged packageline count and window total in cents; package files under out/0 built / 2 refused (reconciliation failure)out/package_seed7.json, out/package_seed7.md
python -m pytest -q
run the engine suite: curated cases plus the pipeline, money and window grids9,648 tests0 greennone
SWEEP=1 python -m pytest -q
widen the pipeline grid tenfold for the exhaustive sweepthe same invariants over 24,000 seeds0 greennone

Benchmarks

measured demo results
MeasureResult
Engine tests89,648 tests collected
live collection from the engine directory
Pipeline grid92,400 seeded end-to-end cases
generate -> parse -> tie -> cut -> triage, every seed
Suite runtime10~7 seconds
the whole suite, grids included

Control characteristics

engineering

Plain terms

The reconciliation gate is unconditional: no package exists unless every job ties. Human judgment enters after the engine - on the period basis and on chasing the certificates the triage marked - never inside the tie.

Engineering

Deterministic envelope. seeded fictional inputs, read-only operation, offline default mode.

Demo gate. 0 on the bundled demo seed - the clean corpus ties; defect seeds exit 2 by design

SeverityVerdictAction
All jobs tie printed totalsPACKAGEcarry the package into the audit response; the period ruling can be made later from the retained dual cut
Any job fails reconciliationREFUSALfix the source print or the parse - the refusal lists each failing job with parsed vs printed cents

Operating limits

what it refuses to do

See it run

control architecture
Premium Audit Response architecture: seeded fixed-width prints pass through a self-verifying parser and an exact-cents reconciliation gate into the window cut, coverage cross-reference and certificate triage, ending in a byte-stable audit package.
The Premium Audit Response engine tile states the gate that everything else hangs from: every job the print report totals must be re-derived to the cent from the lines above it - and a workpaper that cannot make that tie is refused, with the failing jobs named.

Integration

how to run it

Distribution: public repository, MIT license.

Substantiation
  • 1python -m pytest --collect-only -q (premium-audit-automation/)
  • 2len(premaudit_engine.model.Triage)
  • 3premaudit_engine/generate.py defect parameter
  • 4premaudit_engine/parse.py exact == reconciliation
  • 5python -m premaudit_engine --seed 7 (premium-audit-automation/); tests/test_clean_baseline.py
  • 6premaudit_engine/generate.py defect=printed_total_off -> tests/test_planted_defects.py
  • 7premaudit_engine/parse.py union reconciliation; tests/test_clean_baseline.py zero-line jobs
  • 8python -m pytest --collect-only -q (premium-audit-automation/)
  • 9tests/test_invariant_grid.py PIPELINE_SEEDS
  • 10python -m pytest -q (premium-audit-automation/), local run 2026-08-14
  • 11premium-audit-automation/premaudit_engine/parse.py
  • 12premium-audit-automation/premaudit_engine/triage.py
  • 13premium-audit-automation/premaudit_engine/engine.py

Show us where the hours go.

One conversation: you describe the work that consumes your team's month; we tell you plainly what this engine can take over, what it can't, and what a scoped first phase would cost. Your people keep approval authority.

Book a free consultation