Home › Use Cases › Compare a franchise fee invoice against the agreement terms that govern it
Use caseUC0364
🧪 Use-case kit · runnable

Compare a franchise fee invoice against the agreement terms that govern it

A small, forkable project that does one job end to end. Run once for real, and every figure on these pages captured from that run.

The business caseThe problem this solves

A franchisee with a dozen stores gets a fee invoice for every store every period. Each one strikes a royalty and a marketing-fund contribution off the sales the store reported, adds a technology fee, and states the rates it used. Somewhere in a drawer is the franchise agreement for that store, plus whatever amendments, addenda, side letters, renewal addenda and transfer consents have been signed since — and those are the documents that say what the invoice was supposed to charge. Checking one line against the agreement is a minute's work. Checking seven lines on twelve stores every period, against a paper trail nobody has indexed, is nobody's job, so it does not happen, and the fee is paid. Reading a fee invoice against an agreement extract and a pile of amendments by eye, line by line, deciding for each one whether the instrument in the file actually reaches this store, this charge and this period — and then doing it again next month.

Audience

The franchisee's controller and their bookkeeper, and the franchise business consultant on the other side of the same conversation. The decision is a small one and it is made every period: is this invoice worth querying, and if so on which line and against which clause. Every number on these pages came from one real run of this code, not from a vendor page.

The inputThe actual franchise fee review files

The corpus is 70 franchise fee review files, 0.18 MB (txt 70). Because the judgement this kit measures cannot be found in real documents at any usable scale, and because it has to be LABELLED to be scored. The reading is whether a signed instrument reaches THIS line at THIS store for THIS period, and the only way to know the truth of that on 490 lines is to have written them. Generating it also made it possible to build the negative class properly: 22 of the 48 lines whose answer lives in a note carry an instrument in the same sentence frame and the same words as one that does apply.

The corpus

  • The 70 franchise fee review filesgenerated from a fixed seed, so no real record, person or institution appears in it.
  • Where each came fromrecorded in the kit's own SOURCES.md, beside the corpus it describes.

Swap this folder for your own material and the kit is pointed at your franchise fee review files. That is the whole change — there is no database to migrate.

One franchise fee review file, as the model receives itRT-0001.txt · 1 of 70
FRANCHISE FEE BILLING REVIEW FILE - THE INVOICE AS RAISED, WITH THE AGREEMENT IT IS CHECKED AGAINST

FILE HEADER
  File               RT-0001
  Brand              Nine Yards Burgers
  Store              #3082, Fort Wayne, IN
  Franchisee         Kestrel Foods Group Inc
  Agreement dated    2022-03-23
  Period billed      2026-03  (March 2026)
  Net sales reported $173,069.00
  Invoice            INV-202603-3082
  Prepared by        M. Trewin, Unit Economics

AGREEMENT TERMS EXTRACT (the franchise agreement for this store as executed, clause by clause)
   A cell nobody could complete is printed --. The entries --, Per Exhibit B, As per addendum, Not stated and To be confirmed establish no term.
   On a fee line the Agreement provides column carries the amount the clause produces on the net sales reported above, computed by the reviewer's system.
   #  Line                                       Kind     Clause     Agreement provides
   1  Royalty rate applied to net sales          rate     Sec 8.1    4.25%
   2  Royalty fee billed for the period          money    Sec 8.1    $7,355.43
   3  Marketing fund rate applied to net sales   rate     Sec 9.2    3.00%
   4  Marketing fund contribution billed         money    Sec 9.2    $5,192.07
   5  Technology fee billed for the period       money    Sec 11.4   $265.00
   6  Effective date of the rates applied        date     Sec 8.3    2025-06-01
   7  Minimum monthly royalty invoked            yes-no   Sec 8.5    No

BILLED THIS PERIOD (the franchisor's invoice lines exactly as raised)
   #  Line                                       Billed
   1  Royalty rate applied to net sales          4.25%
   2  Royalty fee billed for the period          $7,355.43
   3  Marketing fund rate applied to net sales   3.00%

Abridged — the file continues.

The outcomeWhat a good result looks like

One invoice in, one row per billed line out: what the agreement as amended provides, whether the billing followed it, what is at issue in dollars and in which direction, the clause or instrument that establishes the term, and one row of the file copied verbatim as the evidence. The two money figures are reported apart, because the royalty and technology fees are the franchisor's own revenue and the marketing fund contribution is money it collects into a fund it administers for every franchisee.

And when it cannot

⚠︎ THE HONEST HEADLINE IS THE FILE-LEVEL RESULT AND IT IS NOT A WIN. Line by line the paid call beats the best free floor this kit ships — 487 of 490 against 472, McNemar exact p = 0.0015. On WHOLE INVOICES, which this kit's own scoring note calls the number a controller cares about, it is 60 of 70 against 52, and p = 0.17. That does not reach significance. It does not mean the model is no better; it means 70 invoices cannot separate a paid call from a regular expression written with the answer key open, at the level a reviewer actually works. Where it does fail it fails quietly: 1 divergence was called conforming and 1 conforming line was called a divergence.

Where it fitsWhat did work

Every line below is a measured result from this kit's own runs, with the figure that supports it. The headline above is not softened by any of them.

  • You want to know whether an invoice was struck on the right rate — the free column floor
    it is a lookup, a comparison and one subtraction, it costs nothing and it is right 442 times out of 442 on the lines the columns settle
  • The file carries amendments and you need to know which clause governs — the paid call
    it is the only arm that reads a scope clause; it got 47 of the 48 reading-required lines and named the right instrument on 48 of 48 amended lines
  • You want the dollars, and you want them signed and in the right pot — either arm, with the station
    the amount at issue is recomputed in pure code from the readings, so it was right 490 of 490 times and R-9's two totals were right 70 and 70 of 70
  • You want to route the uncertain ones to a person — not the confidence field
    median 0.94 on the invoices it got right and 0.95 on the ones it did not — it does not separate them

At a glanceHow the whole thing runs

99%line verdicts
2,826 msp50, end to end
$1.83per 1,000 franchise fee review files · the fast tier

Run once, for real, on 2026-09-10. Every figure on these pages was captured from that run — nothing is written from intent.

14 steps, grouped by the question that sends you to them rather than by build order. Each tile carries the one figure that step is about, and opens the page behind it.

Should you use this?What you bring, where it stops, and when not to use it

Before you commit an afternoon to this, these are the answers that decide it. Each one is rendered from the record it lives in — and links the page that holds it in full.

What do I have to bring?Render your own review files into the same panel layout — FILE HEADER, AGREEMENT TERMS EXTRACT, BILLED THIS PERIOD, AMENDMENTS AND SIDE LETTERS ON FILE, NOTES TO THE FRANCHISEE, ISSUED — with columns separated by two or more spaces, and replace data/corpus/, data/terms.json and data/gold.jsonl together. What you will not have is a key. Corpus lens →
When is this the wrong choice?Avoid: Do not let it near a file with amendments in it — it clears every line billed under a superseded clause. That is the case against the best-fitting scenario (“You want to know whether an invoice was struck on the right rate”). 4 scenarios scored in all, each with its own. Eval lens →
Where does it stop working?An amendment that is not in the file. The kit reports NO-TERM, which is correct and no use to anybody: it cannot read a side letter that lives in somebody's email. 6 recorded failure modes, each from a run rather than a guess. Corpus lens →
What was never verified?Whether the corpus is FAIR. evals/check_labels.py proves the key is internally consistent and mechanically derivable from the rulebook; it cannot prove that the corpus builder's reading of its own sentences is the reading a franchise lawyer would give. 5 items this kit says it could not check. Eval lens →
Can I run this on a model I control?The shipped adapter is one provider, one key, reached only through src/adapters/; the Prompt lens states what swapping it costs. The published figures come from 1 model on the fast tier, reasoning disabled (THE PUBLISHED RUN). Prompt lens →
And if it fits — what do I stand up?4 artifacts with a stated home and a stated egress, and 4 decisions each with what you provision past its ceiling — plus what was not measured. That is the next page, not this one. step 14 — Run it in your environment →

Not asked of this kit — 2 questions: clone (a fresh clone of this kit runs with nothing fetched); judge (nothing here is graded by a model).

Last verified 2026-09-10 — r001-royalty-terms. Every figure on these pages was captured from that run.

Run itHow this reaches your data

Every result on this page was produced by pure code over checked-in files, with no API key — which is why you can read the numbers before anyone spends anything.

Run this on your own data

  • The pipeline, its eval harness and the runs behind every numberdeployed inside your environment, on your own model endpoints, against your own documents.
  • The corpus above is the shape, not the limitit is a folder swap, and there is no database to migrate.

Talk to us →

Checked before this shipped — A clean checkout with no key configured and no network was observed to rebuild the corpus byte-identically (tools/build_corpus.py --check), audit all 490 labels and pass its own four seeded red-proofs (evals/check_labels.py --self-test), score all four free floors, run the red team to 0 breaches, render the whole board and replay the committed paid run from its result file — all at $0.00. The one control that spends is disabled and prints why.

A living map of modern AI — kept current every morning