Home › Use Cases › Recompute a licensee's royalty statement line by line against the licence's own rate card
Use caseUC0399
🧪 Use-case kit · runnable

Recompute a licensee's royalty statement line by line against the licence's own rate card

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 licensee sells or streams a licensor's titles and, once a period, files a statement saying what it owes: a line per title, territory and channel, with the units it recorded, the gross receipts, the rate it applied, any deduction it claimed and the royalty it says is due. The licence says what every one of those should have been. Putting the two back together is arithmetic on a rate card — until a line's own note says the units were licensed somewhere else, or outside the period, or that a deduction inside its cap was never actually incurred, or the licensor notes record a rate amendment that may or may not have been agreed. On 52 of the 62 statements in this corpus the licensee's own royalty figure is wrong, and on 26 of them the only record of why is a sentence. Opening one statement, looking every line's territory, channel and units band up in the licence's rate card by hand, checking each deduction against the permitted list and its cap, capping the reserve, converting the total, and then reading every note printed under a line and every licensor note to decide which of them changes any of it.

Audience

A licensor's rights-administration desk working a quarter's statements, and the licensee's own auditor reading the flag back: every named line carries the clause it turns on and the statement line quoted verbatim. Every number on these pages came from one real run of this code, not from a vendor page.

The inputThe actual royalty statement

The corpus is 62 royalty statement, 0.22 MB (txt 62). It is generated because it has to be. A licensee's filed royalty statement is a counterparty's own trading record, and the exact shapes measured here — a line keyed to the wrong territory, a deduction that was never incurred, a rights director asking for an under-report to be called deliberate — are the rows a licensor would least want published. What that costs is that every percentage is a property of THIS mix; what it buys is a key DERIVED from the structure the pages were rendered from, re-derived a second time by an independent checker at 0 disagreements and red-proven seven ways.

The corpus

  • The 62 royalty statementgenerated from a fixed seed, so no real record, person or institution appears in it.
  • Where each came fromdata/SOURCES.md states where every byte came from AND what the generator costs the measurement, including a measured leak: the planted line tends to be the largest on the page, and a rule naming the largest-gross line is right on 15 of 46 named statements against a chance rate of 9.4.

Swap this folder for your own material and the kit is pointed at your royalty statement. That is the whole change — there is no database to migrate.

One royalty statement, as the model receives itLRR-0001.txt · 1 of 62
============================================================================================
LICENSEE ROYALTY STATEMENT                                                 LRR-0001
Licensor: Harrowgate Rights Group (invented)
Licensee: Vellamere Media SA (invented)
Licence: LIC-4000   Period: 2026-01-01 to 2026-03-31   Procedure: RRC-2026
============================================================================================

LICENCE AND PERIOD AS THE RIGHTS MASTER HOLDS IT
  statement currency                          EUR
  reporting currency                          USD
  fx basis                             period-end
  fx rate applied                        1.084200   USD per EUR
  reserve cap pct                           20.00   pct of royalty before reserve
  tolerance pct                              0.50   pct of royalty reported
  query threshold                         2500.00   or more
  query threshold pct                        2.00   pct or more
  period                             full-quarter

RATE CARD AS THE LICENCE SETS IT
  TERRITORY  CHANNEL      UNITS FROM    UNITS TO      RATE
  AU         physical              0       20000      7.50
  AU         physical          20001    99999999      5.50
  AU         svod                  0      100000      7.00
  AU         svod             100001    99999999      6.50
  FR         physical              0      100000     15.00
  FR         physical         100001    99999999     14.50
  FR         svod                  0       20000     16.50
  FR         svod              20001    99999999     15.00
  IT         physical              0      250000     15.00
  IT         physical         250001    99999999     13.50
  IT         svod                  0       20000      6.50

Abridged — the file continues.

The outcomeWhat a good result looks like

One statement in, one row out: which lines the licence does not agree with and under which clause, whether a rate amendment is in force, the royalty the licence produces beside the royalty the licensee reported, the difference and its percentage, and one verdict from a closed set of five. Nothing is invoiced, no audit is called for, no allegation is made and no term is changed.

And when it cannot

And what it does when it cannot. On the scored run 62 of 62 replies parsed and 0 stopped at the ceiling, so there is no unanswered column to explain. The failure is elsewhere and it is the headline: the arm named 119 lines against the key's 50, naming at least one line that recomputes on 37 of 62 statements — and exceptions is an exact-set field, so each of those loses the whole statement. The station cannot repair it: a named line it does not agree with is still the arm's own reading.

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.

  • Your licensees file a fixed-layout statement and your licence's card is (territory, channel, units band) — the free card recompute, and nothing else
    clause 4 and clause 4.2 are 23 of 23 for free code and 13 of 23 for the paid arm on this corpus. The arithmetic is one lookup and one multiplication.
  • Your statements carry prose notes that move lines between territories, channels or periods — the SPLIT arm — free code for the card, the call for the notes
    clause 2, clause 3 and clause 5 are 26 of 27 for the paid arm and 18 of 27 for the keyword rule. But the split arm is still only a TIE with free code overall (p = 1.000000), so the case has to be made on the families rather than on a headline.
  • Your licensor notes record rate amendments in prose, some agreed and some merely tabled — the paid call, for that field alone
    the regex applied all 17 amendments that were never counter-signed; the paid arm applied 0 of them and was right on 62 of 62. It is the one field where the margin is not close.
  • You are reconciling a statement to decide whether to raise a query with a counterparty — the verdict from the station, never from the reply
    the station moved the verdict from 16 right to 58 on the identical replies, and RR-2 is a conjunction the reply gets wrong in both directions.

And where nothing here is good enough:

  • You want one number to decide on — nothing here
    one headline number says the paid call is worse than free code. Per clause it says the call wins every reading and loses every piece of arithmetic. Both are true and only the second is useful.

At a glanceHow the whole thing runs

14%all five correct pct
1,611 msp50, end to end
$0.00per 1,000 royalty statement · Gemini 3 Flash

Run once, for real, on 2026-09-11. 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?Replace data/corpus/*.txt with your own statements in the same shape and data/licences.json with your own licences. ⚠︎ WHAT STOPS BEING TRUE THE MOMENT YOU DO. Corpus lens →
When is this the wrong choice?Avoid: The paid call. That is the case against the best-fitting scenario (“Your licensees file a fixed-layout statement and your licence's card is (territory, channel, units band)”). 5 scenarios scored in all, each with its own. Eval lens →
Where does it stop working?A statement that is not fixed-width columns. src/statement.py's line regex is the shape this corpus prints; a spreadsheet export, a PDF or a per-licensee layout is a parser change before anything else works. 6 recorded failure modes, each from a run rather than a guess. Corpus lens →
What was never verified?NO SECOND SCORED RUN. One was fired, so the run-to-run spread on this corpus is unknown and no confidence interval is offered around any percentage here. 8 items this kit says it could not check. Eval lens →
Can I run this on a model I control?Yes — any OpenAI-compatible endpoint, including one on your own hardware. The shipped adapter takes its host from BASE_URL and its model from MODEL, so nothing in src/ changes. The published figures come from 1 model on the fast tier, one provider, one key. Prompt lens →
And if it fits — what do I stand up?6 artifacts with a stated home and a stated egress, and 3 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-11 — r001-licensee-royalty. 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 renders the whole board, all three free floors and every committed run. tools/build_corpus.py --check, --check-fillers and python3 -m evals.check_labels all run on a machine with nothing installed.

A living map of modern AI — kept current every morning