Agents & workflows System note

One report, three coverage counts, three different answers

If two parts of a system can count the same thing, they will eventually disagree. Count once, store the answer, and make every surface print it.

Teja Sagiraju · 4 min read
The short version
• One report from the Pre-Screen described the same check three ways: "13 of 13 checks applied", "0 couldn't check" and, in the agents' review, "1 check couldn't run".
• Each part of the system was counting for itself. Now one function counts once, and the page, the file note and the agents all print its line.
• The same bug came back a layer up: Carillion's page listed 5 referral reasons where the rules gave 3. Now every reason the rules give appears once, as a reason or under Coverage.

Part of a series on the UK Company Pre-Screen, a tool that checks a UK company's public record before an underwriter quotes. Version 1 was a research agent that decided the risk itself; version 2 lets written rules decide (Version 1 let an AI agent decide. Version 2 lets written rules decide. compares them). This post is about how version 2 counts what it checked, so every part of it says the same thing.

Three answers about one check

One of the Pre-Screen's fourteen checks is county court judgments (CCJs), and it can't do that one, because the data is paid. That's fine, as long as every part of the system says so the same way.

They didn't. One report on 19 Oct said "13 of 13 checks applied" in one place and "0 couldn't check" in another, while the agents' review of the same case said "1 check couldn't run". All three were about the CCJ check. An underwriter reading the top line would think everything ran; one reading the review would think something failed. The truth was neither: the tool doesn't do CCJs. (Why a gap must never read as clear is the subject of Nothing found isn't the same as nothing checked.)

Four categories, counted once

Wilko's 14 checks on the 26 Oct run, as a grid: 11 completed (status, age and names, filings, charges, disqualification, other companies, board changes, ownership, sanctions, news, trade versus SIC code); 1 could not be checked (insolvency, because The Gazette refused the request); 1 not covered by this tool (county court judgments); 1 not applicable (FCA authorisation). 13 apply, so the page reads 11 of 13 checks completed.
Wilko's public example, 26 Oct run. Three of the completed checks found something; completed still counts them.

Each check ends in one of five results, which the case page shows: clear, worth reading, flagged, couldn't check, or not applicable. For counting, those become four categories, in one function, coverage() in src/prescreen/casefile.py:

  • Completed: clear, worth reading and flagged all count here. The check ran over everything it needed. Completed never means cleared.
  • Couldn't check: the check applies and the tool does it, but a source failed or came back incomplete.
  • Not covered by this tool: it applies, but this tool doesn't do it. CCJs, for now.
  • Not applicable: it doesn't apply to this company, like FCA authorisation for a business that isn't a regulated trade.
def coverage(checks):
    cs = [_d(c) for c in checks]
    na = [c for c in cs if c.get("status") == "not_applicable"]
    not_cov = [c for c in cs if c.get("status") == "couldnt_check" and is_out_of_scope(c)]
    gaps = [c for c in cs if c.get("status") == "couldnt_check" and not is_out_of_scope(c)]
    done = [c for c in cs if c.get("status") in ("clear", "info", "flag")]
    applies = len(cs) - len(na)
    text = f"{len(done)} of {applies} checks completed."
    if gaps:
        text += f" Couldn't check: {', '.join(c['title'] for c in gaps)}."
    if not_cov:
        text += f" Not covered by this tool: {', '.join(c['title'] for c in not_cov)}."
    return {...}  # the counts, the titles and the text
src/prescreen/casefile.py at the prescreen-v1.0 tag, docstring trimmed

"11 of 13" means completed checks over checks that apply. The report stores that line when it's made, and the case page header, the rules summary, the file note, the summary that agents read, and the agents' review all print it. None of them counts again.

The same bug, one layer up

Carillion's public example (26 Oct run): Outside appetite; referral reasons 2, status and insolvency; coverage 11 of 13 with insolvency via The Gazette couldn't check and CCJs not covered; the two referral reasons listed, company in liquidation and insolvency case on record from 15 Jan 2018; then Notes worth reading, 6.
Carillion's public example, after the 1 Nov fix. 1: two referral reasons, as the rules give. 2: the Gazette gap is shown under Coverage, not as a reason. 3: consequences of an ended company sit under Notes.

On 29 Oct I found the same pattern in the reasons the page lists. Carillion's case page showed 5; the rules had given 3. The page listed every finding above a note, including things that only follow from a company having ended: overdue accounts and no registered owner, for a company in liquidation since 2018. The rules leave those out on purpose. They're consequences, not reasons.

The fix, deployed on 1 Nov, marks each finding with whether it's one of the rules' own reasons (mark_reasons in caseview.py), and the page lists only those. Carillion now shows 2: its liquidation, and the insolvency case on record. The rules' third reason, that The Gazette couldn't be searched, appears under Coverage, and everything else sits under "Notes worth reading". The contract: every reason the rules give appears once, either as a reason or under Coverage. I checked all nine public examples against it after the fix.

On the page, this means: the coverage line is the same everywhere, so if it says a check couldn't run, that's true in the file note and the agents' review too.

Limits

  • "Not covered by this tool" is honest, but it's still a gap. The underwriter has to close it with their own credit reference service.
  • The public examples date from 26 Oct, when The Gazette was refusing the demo (Before you quote a UK company, know what wasn’t checked explains), so each shows one check that couldn't run.
  • Reports saved before the fix fall back to the old page filter.

The decision behind it

  • Decision: one function owns coverage, the report stores its result, and the page lists only the rules' reasons.
  • Alternative rejected: letting each surface count for itself. It's quicker to build, and it drifts.
  • What it cost: every surface has to read the stored result, and old reports need a fallback.
  • When to revisit: when a second tool needs the same contract, the function should become a shared library.

First published 22 Nov 2026.

Written by Teja Sagiraju

AI engineer with 14 years across machine learning and applied AI: prompt design, document AI, LLM workflows and the review loops that make them safe to ship. I build real systems and write up what breaks along the way.

Connect

Get the next note by email

One short email when something ships or breaks. Free.